mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-25 17:26:58 +00:00
Merge pull request #176 from Robmaister/develop
Added Matrix3[d].Add and Matrix4[d].CreateFromRotationMatrix
This commit is contained in:
commit
c29509838d
|
@ -668,6 +668,24 @@ namespace OpenTK
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Add Functions
|
||||||
|
|
||||||
|
public static Matrix3 Add(Matrix3 left, Matrix3 right)
|
||||||
|
{
|
||||||
|
Matrix3 result;
|
||||||
|
Add(ref left, ref right, out result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Add(ref Matrix3 left, ref Matrix3 right, out Matrix3 result)
|
||||||
|
{
|
||||||
|
Vector3.Add(ref left.Row0, ref right.Row0, out result.Row0);
|
||||||
|
Vector3.Add(ref left.Row1, ref right.Row1, out result.Row1);
|
||||||
|
Vector3.Add(ref left.Row2, ref right.Row2, out result.Row2);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Multiply Functions
|
#region Multiply Functions
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -665,6 +665,24 @@ namespace OpenTK
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Add Functions
|
||||||
|
|
||||||
|
public static Matrix3d Add(Matrix3d left, Matrix3d right)
|
||||||
|
{
|
||||||
|
Matrix3d result;
|
||||||
|
Add(ref left, ref right, out result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Add(ref Matrix3d left, ref Matrix3d right, out Matrix3d result)
|
||||||
|
{
|
||||||
|
Vector3d.Add(ref left.Row0, ref right.Row0, out result.Row0);
|
||||||
|
Vector3d.Add(ref left.Row1, ref right.Row1, out result.Row1);
|
||||||
|
Vector3d.Add(ref left.Row2, ref right.Row2, out result.Row2);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Multiply Functions
|
#region Multiply Functions
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -117,6 +117,30 @@ namespace OpenTK
|
||||||
Row3 = new Vector4(m30, m31, m32, m33);
|
Row3 = new Vector4(m30, m31, m32, m33);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs a new instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="topLeft">The top left 3x3 of the matrix.</param>
|
||||||
|
public Matrix4(Matrix3 topLeft)
|
||||||
|
{
|
||||||
|
Row0.X = topLeft.Row0.X;
|
||||||
|
Row0.Y = topLeft.Row0.Y;
|
||||||
|
Row0.Z = topLeft.Row0.Z;
|
||||||
|
Row0.W = 0;
|
||||||
|
Row1.X = topLeft.Row1.X;
|
||||||
|
Row1.Y = topLeft.Row1.Y;
|
||||||
|
Row1.Z = topLeft.Row1.Z;
|
||||||
|
Row1.W = 0;
|
||||||
|
Row2.X = topLeft.Row2.X;
|
||||||
|
Row2.Y = topLeft.Row2.Y;
|
||||||
|
Row2.Z = topLeft.Row2.Z;
|
||||||
|
Row2.W = 0;
|
||||||
|
Row3.X = 0;
|
||||||
|
Row3.Y = 0;
|
||||||
|
Row3.Z = 0;
|
||||||
|
Row3.W = 1;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Members
|
#region Public Members
|
||||||
|
|
|
@ -109,6 +109,30 @@ namespace OpenTK
|
||||||
Row3 = new Vector4d(m30, m31, m32, m33);
|
Row3 = new Vector4d(m30, m31, m32, m33);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs a new instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="topLeft">The top left 3x3 of the matrix.</param>
|
||||||
|
public Matrix4d(Matrix3d topLeft)
|
||||||
|
{
|
||||||
|
Row0.X = topLeft.Row0.X;
|
||||||
|
Row0.Y = topLeft.Row0.Y;
|
||||||
|
Row0.Z = topLeft.Row0.Z;
|
||||||
|
Row0.W = 0;
|
||||||
|
Row1.X = topLeft.Row1.X;
|
||||||
|
Row1.Y = topLeft.Row1.Y;
|
||||||
|
Row1.Z = topLeft.Row1.Z;
|
||||||
|
Row1.W = 0;
|
||||||
|
Row2.X = topLeft.Row2.X;
|
||||||
|
Row2.Y = topLeft.Row2.Y;
|
||||||
|
Row2.Z = topLeft.Row2.Z;
|
||||||
|
Row2.W = 0;
|
||||||
|
Row3.X = 0;
|
||||||
|
Row3.Y = 0;
|
||||||
|
Row3.Z = 0;
|
||||||
|
Row3.W = 1;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Members
|
#region Public Members
|
||||||
|
|
Loading…
Reference in a new issue