Merge pull request #23862 from neikeq/theaxismadness

C#: Replace calls to old of old Basis(Vec3,Vec3,Vec3) constructor
This commit is contained in:
Rémi Verschelde 2018-11-21 10:09:02 +01:00 committed by GitHub
commit dcf82065e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 16 deletions

View File

@ -13,9 +13,9 @@ namespace Godot
{ {
private static readonly Basis identity = new Basis private static readonly Basis identity = new Basis
( (
new Vector3(1f, 0f, 0f), 1f, 0f, 0f,
new Vector3(0f, 1f, 0f), 0f, 1f, 0f,
new Vector3(0f, 0f, 1f) 0f, 0f, 1f
); );
private static readonly Basis[] orthoBases = { private static readonly Basis[] orthoBases = {
@ -159,9 +159,9 @@ namespace Godot
{ {
return new Basis return new Basis
( (
new Vector3(xAxis.x, yAxis.x, zAxis.x), xAxis.x, yAxis.x, zAxis.x,
new Vector3(xAxis.y, yAxis.y, zAxis.y), xAxis.y, yAxis.y, zAxis.y,
new Vector3(xAxis.z, yAxis.z, zAxis.z) xAxis.z, yAxis.z, zAxis.z
); );
} }
@ -535,12 +535,17 @@ namespace Godot
public Basis(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis) public Basis(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis)
{ {
x = xAxis; _x = new Vector3(xAxis.x, yAxis.x, zAxis.x);
y = yAxis; _y = new Vector3(xAxis.y, yAxis.y, zAxis.y);
z = zAxis; _z = new Vector3(xAxis.z, yAxis.z, zAxis.z);
// Same as:
// SetAxis(0, xAxis);
// SetAxis(1, yAxis);
// SetAxis(2, zAxis);
// We need to assign the struct fields so we can't do that...
} }
public Basis(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz) internal Basis(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz)
{ {
_x = new Vector3(xx, xy, xz); _x = new Vector3(xx, xy, xz);
_y = new Vector3(yx, yy, yz); _y = new Vector3(yx, yy, yz);

View File

@ -124,9 +124,9 @@ namespace Godot
// Constants // Constants
private static readonly Transform _identity = new Transform(Basis.Identity, Vector3.Zero); private static readonly Transform _identity = new Transform(Basis.Identity, Vector3.Zero);
private static readonly Transform _flipX = new Transform(new Basis(new Vector3(-1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1)), Vector3.Zero); private static readonly Transform _flipX = new Transform(new Basis(-1, 0, 0, 0, 1, 0, 0, 0, 1), Vector3.Zero);
private static readonly Transform _flipY = new Transform(new Basis(new Vector3(1, 0, 0), new Vector3(0, -1, 0), new Vector3(0, 0, 1)), Vector3.Zero); private static readonly Transform _flipY = new Transform(new Basis(1, 0, 0, 0, -1, 0, 0, 0, 1), Vector3.Zero);
private static readonly Transform _flipZ = new Transform(new Basis(new Vector3(1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, -1)), Vector3.Zero); private static readonly Transform _flipZ = new Transform(new Basis(1, 0, 0, 0, 1, 0, 0, 0, -1), Vector3.Zero);
public static Transform Identity { get { return _identity; } } public static Transform Identity { get { return _identity; } }
public static Transform FlipX { get { return _flipX; } } public static Transform FlipX { get { return _flipX; } }

View File

@ -204,9 +204,9 @@ namespace Godot
public Basis Outer(Vector3 b) public Basis Outer(Vector3 b)
{ {
return new Basis( return new Basis(
new Vector3(x * b.x, x * b.y, x * b.z), x * b.x, x * b.y, x * b.z,
new Vector3(y * b.x, y * b.y, y * b.z), y * b.x, y * b.y, y * b.z,
new Vector3(z * b.x, z * b.y, z * b.z) z * b.x, z * b.y, z * b.z
); );
} }