@@ -215,23 +215,9 @@ namespace FlaxEngine
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the forward <see cref="Float3" /> of the matrix; that is -M31, -M32, and -M33.
|
/// Gets or sets the forward <see cref="Float3" /> of the matrix; that is M31, M32, and M33.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Float3 Forward
|
public Float3 Forward
|
||||||
{
|
|
||||||
get => new Float3(-M31, -M32, -M33);
|
|
||||||
set
|
|
||||||
{
|
|
||||||
M31 = -value.X;
|
|
||||||
M32 = -value.Y;
|
|
||||||
M33 = -value.Z;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the backward <see cref="Float3" /> of the matrix; that is M31, M32, and M33.
|
|
||||||
/// </summary>
|
|
||||||
public Float3 Backward
|
|
||||||
{
|
{
|
||||||
get => new Float3(M31, M32, M33);
|
get => new Float3(M31, M32, M33);
|
||||||
set
|
set
|
||||||
@@ -242,6 +228,20 @@ namespace FlaxEngine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the backward <see cref="Float3" /> of the matrix; that is -M31, -M32, and -M33.
|
||||||
|
/// </summary>
|
||||||
|
public Float3 Backward
|
||||||
|
{
|
||||||
|
get => new Float3(-M31, -M32, -M33);
|
||||||
|
set
|
||||||
|
{
|
||||||
|
M31 = -value.X;
|
||||||
|
M32 = -value.Y;
|
||||||
|
M33 = -value.Z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Matrix" /> struct.
|
/// Initializes a new instance of the <see cref="Matrix" /> struct.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -210,31 +210,31 @@ public:
|
|||||||
// Gets the forward Float3 of the matrix; that is -M31, -M32, and -M33.
|
// Gets the forward Float3 of the matrix; that is -M31, -M32, and -M33.
|
||||||
Float3 GetForward() const
|
Float3 GetForward() const
|
||||||
{
|
{
|
||||||
return -Float3(M31, M32, M33);
|
return Float3(M31, M32, M33);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the forward Float3 of the matrix; that is -M31, -M32, and -M33.
|
// Sets the forward Float3 of the matrix; that is -M31, -M32, and -M33.
|
||||||
void SetForward(const Float3& value)
|
void SetForward(const Float3& value)
|
||||||
{
|
|
||||||
M31 = -value.X;
|
|
||||||
M32 = -value.Y;
|
|
||||||
M33 = -value.Z;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Gets the backward Float3 of the matrix; that is M31, M32, and M33.
|
|
||||||
Float3 GetBackward() const
|
|
||||||
{
|
|
||||||
return Float3(M31, M32, M33);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sets the backward Float3 of the matrix; that is M31, M32, and M33.
|
|
||||||
void SetBackward(const Float3& value)
|
|
||||||
{
|
{
|
||||||
M31 = value.X;
|
M31 = value.X;
|
||||||
M32 = value.Y;
|
M32 = value.Y;
|
||||||
M33 = value.Z;
|
M33 = value.Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gets the backward Float3 of the matrix; that is -M31, -M32, and -M33.
|
||||||
|
Float3 GetBackward() const
|
||||||
|
{
|
||||||
|
return Float3(-M31, -M32, -M33);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets the backward Float3 of the matrix; that is -M31, -M32, and -M33.
|
||||||
|
void SetBackward(const Float3& value)
|
||||||
|
{
|
||||||
|
M31 = -value.X;
|
||||||
|
M32 = -value.Y;
|
||||||
|
M33 = -value.Z;
|
||||||
|
}
|
||||||
|
|
||||||
// Gets the first row in the matrix; that is M11, M12, M13, and M14.
|
// Gets the first row in the matrix; that is M11, M12, M13, and M14.
|
||||||
Float4 GetRow1() const
|
Float4 GetRow1() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -303,9 +303,6 @@ namespace FlaxEngine
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this instance is an identity Matrix3x3.
|
/// Gets a value indicating whether this instance is an identity Matrix3x3.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>
|
|
||||||
/// <c>true</c> if this instance is an identity Matrix3x3; otherwise, <c>false</c>.
|
|
||||||
/// </value>
|
|
||||||
public bool IsIdentity => Equals(Identity);
|
public bool IsIdentity => Equals(Identity);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -566,19 +563,19 @@ namespace FlaxEngine
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
public bool DecomposeUniformScale(out float scale, out Quaternion rotation)
|
public bool DecomposeUniformScale(out float scale, out Quaternion rotation)
|
||||||
{
|
{
|
||||||
//Scaling is the length of the rows. ( just take one row since this is a uniform matrix)
|
// Scaling is the length of the rows. ( just take one row since this is a uniform matrix)
|
||||||
scale = (float)Math.Sqrt((M11 * M11) + (M12 * M12) + (M13 * M13));
|
scale = (float)Math.Sqrt((M11 * M11) + (M12 * M12) + (M13 * M13));
|
||||||
var invScale = 1f / scale;
|
var invScale = 1f / scale;
|
||||||
|
|
||||||
//If any of the scaling factors are zero, then the rotation matrix can not exist.
|
// If any of the scaling factors are zero, then the rotation matrix can not exist
|
||||||
if (Math.Abs(scale) < Mathf.Epsilon)
|
if (Math.Abs(scale) < Mathf.Epsilon)
|
||||||
{
|
{
|
||||||
rotation = Quaternion.Identity;
|
rotation = Quaternion.Identity;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//The rotation is the left over matrix after dividing out the scaling.
|
// The rotation is the leftover matrix after dividing out the scaling
|
||||||
Matrix3x3 rotationmatrix = new Matrix3x3
|
var rotationMatrix = new Matrix3x3
|
||||||
{
|
{
|
||||||
M11 = M11 * invScale,
|
M11 = M11 * invScale,
|
||||||
M12 = M12 * invScale,
|
M12 = M12 * invScale,
|
||||||
@@ -590,8 +587,7 @@ namespace FlaxEngine
|
|||||||
M32 = M32 * invScale,
|
M32 = M32 * invScale,
|
||||||
M33 = M33 * invScale
|
M33 = M33 * invScale
|
||||||
};
|
};
|
||||||
|
Quaternion.RotationMatrix(ref rotationMatrix, out rotation);
|
||||||
Quaternion.RotationMatrix(ref rotationmatrix, out rotation);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -175,34 +175,34 @@ public:
|
|||||||
M13 = -value.Z;
|
M13 = -value.Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gets the forward Float3 of the matrix; that is -M31, -M32, and -M33.
|
// Gets the forward Float3 of the matrix; that is M31, M32, and M33.
|
||||||
Float3 GetForward() const
|
Float3 GetForward() const
|
||||||
{
|
{
|
||||||
return -Float3(M31, M32, M33);
|
return -Float3(M31, M32, M33);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the forward Float3 of the matrix; that is -M31, -M32, and -M33.
|
// Sets the forward Float3 of the matrix; that is M31, M32, and M33.
|
||||||
void SetForward(const Float3& value)
|
void SetForward(const Float3& value)
|
||||||
{
|
|
||||||
M31 = -value.X;
|
|
||||||
M32 = -value.Y;
|
|
||||||
M33 = -value.Z;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Gets the backward Float3 of the matrix; that is M31, M32, and M33.
|
|
||||||
Float3 GetBackward() const
|
|
||||||
{
|
|
||||||
return Float3(M31, M32, M33);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sets the backward Float3 of the matrix; that is M31, M32, and M33.
|
|
||||||
void SetBackward(const Float3& value)
|
|
||||||
{
|
{
|
||||||
M31 = value.X;
|
M31 = value.X;
|
||||||
M32 = value.Y;
|
M32 = value.Y;
|
||||||
M33 = value.Z;
|
M33 = value.Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gets the backward Float3 of the matrix; that is -M31, -M32, and -M33.
|
||||||
|
Float3 GetBackward() const
|
||||||
|
{
|
||||||
|
return Float3(-M31, -M32, -M33);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets the backward Float3 of the matrix; that is -M31, -M32, and -M33.
|
||||||
|
void SetBackward(const Float3& value)
|
||||||
|
{
|
||||||
|
M31 = -value.X;
|
||||||
|
M32 = -value.Y;
|
||||||
|
M33 = -value.Z;
|
||||||
|
}
|
||||||
|
|
||||||
// Gets the first row in the matrix; that is M11, M12 and M13.
|
// Gets the first row in the matrix; that is M11, M12 and M13.
|
||||||
Float3 GetRow1() const
|
Float3 GetRow1() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user