Merge pull request #29021 from aaronfranke/mono-tuple
[Mono] Misc Basis and AABB improvements
This commit is contained in:
commit
0d8f1ba6a9
3 changed files with 30 additions and 21 deletions
|
@ -414,6 +414,21 @@ namespace Godot
|
||||||
_position = position;
|
_position = position;
|
||||||
_size = size;
|
_size = size;
|
||||||
}
|
}
|
||||||
|
public AABB(Vector3 position, real_t width, real_t height, real_t depth)
|
||||||
|
{
|
||||||
|
_position = position;
|
||||||
|
_size = new Vector3(width, height, depth);
|
||||||
|
}
|
||||||
|
public AABB(real_t x, real_t y, real_t z, Vector3 size)
|
||||||
|
{
|
||||||
|
_position = new Vector3(x, y, z);
|
||||||
|
_size = size;
|
||||||
|
}
|
||||||
|
public AABB(real_t x, real_t y, real_t z, real_t width, real_t height, real_t depth)
|
||||||
|
{
|
||||||
|
_position = new Vector3(x, y, z);
|
||||||
|
_size = new Vector3(width, height, depth);
|
||||||
|
}
|
||||||
|
|
||||||
public static bool operator ==(AABB left, AABB right)
|
public static bool operator ==(AABB left, AABB right)
|
||||||
{
|
{
|
||||||
|
|
|
@ -260,13 +260,13 @@ namespace Godot
|
||||||
Vector3 euler;
|
Vector3 euler;
|
||||||
euler.z = 0.0f;
|
euler.z = 0.0f;
|
||||||
|
|
||||||
real_t mxy = m.Row1[2];
|
real_t mzy = m.Row1[2];
|
||||||
|
|
||||||
if (mxy < 1.0f)
|
if (mzy < 1.0f)
|
||||||
{
|
{
|
||||||
if (mxy > -1.0f)
|
if (mzy > -1.0f)
|
||||||
{
|
{
|
||||||
euler.x = Mathf.Asin(-mxy);
|
euler.x = Mathf.Asin(-mzy);
|
||||||
euler.y = Mathf.Atan2(m.Row0[2], m.Row2[2]);
|
euler.y = Mathf.Atan2(m.Row0[2], m.Row2[2]);
|
||||||
euler.z = Mathf.Atan2(m.Row1[0], m.Row1[1]);
|
euler.z = Mathf.Atan2(m.Row1[0], m.Row1[1]);
|
||||||
}
|
}
|
||||||
|
@ -418,19 +418,11 @@ namespace Godot
|
||||||
|
|
||||||
public Basis Scaled(Vector3 scale)
|
public Basis Scaled(Vector3 scale)
|
||||||
{
|
{
|
||||||
var m = this;
|
var b = this;
|
||||||
|
b.Row0 *= scale.x;
|
||||||
m.Row0[0] *= scale.x;
|
b.Row1 *= scale.y;
|
||||||
m.Row0[1] *= scale.x;
|
b.Row2 *= scale.z;
|
||||||
m.Row0[2] *= scale.x;
|
return b;
|
||||||
m.Row1[0] *= scale.y;
|
|
||||||
m.Row1[1] *= scale.y;
|
|
||||||
m.Row1[2] *= scale.y;
|
|
||||||
m.Row2[0] *= scale.z;
|
|
||||||
m.Row2[1] *= scale.z;
|
|
||||||
m.Row2[2] *= scale.z;
|
|
||||||
|
|
||||||
return m;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public real_t Tdotx(Vector3 with)
|
public real_t Tdotx(Vector3 with)
|
||||||
|
@ -622,11 +614,12 @@ namespace Godot
|
||||||
// We need to assign the struct fields here first so we can't do it that way...
|
// We need to assign the struct fields here first so we can't do it that way...
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
// Arguments are named such that xy is equal to calling x.y
|
||||||
|
internal Basis(real_t xx, real_t yx, real_t zx, real_t xy, real_t yy, real_t zy, real_t xz, real_t yz, real_t zz)
|
||||||
{
|
{
|
||||||
Row0 = new Vector3(xx, xy, xz);
|
Row0 = new Vector3(xx, yx, zx);
|
||||||
Row1 = new Vector3(yx, yy, yz);
|
Row1 = new Vector3(xy, yy, zy);
|
||||||
Row2 = new Vector3(zx, zy, zz);
|
Row2 = new Vector3(xz, yz, zz);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Basis operator *(Basis left, Basis right)
|
public static Basis operator *(Basis left, Basis right)
|
||||||
|
|
|
@ -298,6 +298,7 @@ namespace Godot
|
||||||
origin = originPos;
|
origin = originPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Arguments are named such that xy is equal to calling x.y
|
||||||
public Transform2D(real_t xx, real_t xy, real_t yx, real_t yy, real_t ox, real_t oy)
|
public Transform2D(real_t xx, real_t xy, real_t yx, real_t yy, real_t ox, real_t oy)
|
||||||
{
|
{
|
||||||
x = new Vector2(xx, xy);
|
x = new Vector2(xx, xy);
|
||||||
|
|
Loading…
Reference in a new issue