mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 16:15:34 +00:00
Added RightHandedTransform
This commit is contained in:
parent
75d7e9c718
commit
256bf73c39
|
@ -1191,6 +1191,30 @@ namespace OpenTK
|
|||
Vector3.Add(ref vec, ref temp, out result);
|
||||
}
|
||||
|
||||
/// <summary>Transform a Vector by the given Matrix using right-handed notation</summary>
|
||||
/// <param name="vec">The vector to transform</param>
|
||||
/// <param name="mat">The desired transformation</param>
|
||||
/// <param name="result">The transformed vector</param>
|
||||
public static void RightHandedTransform(ref Vector3 vec, ref Matrix3 mat, out Vector3 result)
|
||||
{
|
||||
result = new Vector3(
|
||||
mat.Row0.X * vec.X + mat.Row0.Y * vec.Y + mat.Row0.Z * vec.Z,
|
||||
mat.Row1.X * vec.X + mat.Row1.Y * vec.Y + mat.Row1.Z * vec.Z,
|
||||
mat.Row2.X * vec.X + mat.Row2.Y * vec.Y + mat.Row2.Z * vec.Z);
|
||||
}
|
||||
|
||||
/// <summary>Transform a Vector by the given Matrix using right-handed notation</summary>
|
||||
/// <param name="vec">The vector to transform</param>
|
||||
/// <param name="mat">The desired transformation</param>
|
||||
/// <param name="result">The transformed vector</param>
|
||||
public static void RightHandedTransform(ref Vector3 vec, ref Matrix4 mat, out Vector3 result)
|
||||
{
|
||||
result = new OpenTK.Vector3(
|
||||
mat.Row0.X * vec.X + mat.Row0.Y * vec.Y + mat.Row0.Z * vec.Z + mat.Row0.W,
|
||||
mat.Row1.X * vec.X + mat.Row1.Y * vec.Y + mat.Row1.Z * vec.Z + mat.Row1.W,
|
||||
mat.Row2.X * vec.X + mat.Row2.Y * vec.Y + mat.Row2.Z * vec.Z + mat.Row2.W);
|
||||
}
|
||||
|
||||
/// <summary>Transform a Vector3 by the given Matrix, and project the resulting Vector4 back to a Vector3</summary>
|
||||
/// <param name="vec">The vector to transform</param>
|
||||
/// <param name="mat">The desired transformation</param>
|
||||
|
|
|
@ -1017,6 +1017,19 @@ namespace OpenTK
|
|||
result = new Vector4(v.X, v.Y, v.Z, v.W);
|
||||
}
|
||||
|
||||
/// <summary>Transform a Vector by the given Matrix using right-handed notation</summary>
|
||||
/// <param name="vec">The vector to transform</param>
|
||||
/// <param name="mat">The desired transformation</param>
|
||||
/// <param name="result">The transformed vector</param>
|
||||
public static void RightHandedTransform(ref Vector4 vec, ref Matrix4 mat, out Vector4 result)
|
||||
{
|
||||
result = new OpenTK.Vector4(
|
||||
mat.Row0.X * vec.X + mat.Row0.Y * vec.Y + mat.Row0.Z * vec.Z + mat.Row0.W * vec.W,
|
||||
mat.Row1.X * vec.X + mat.Row1.Y * vec.Y + mat.Row1.Z * vec.Z + mat.Row1.W * vec.W,
|
||||
mat.Row2.X * vec.X + mat.Row2.Y * vec.Y + mat.Row2.Z * vec.Z + mat.Row2.W * vec.W,
|
||||
mat.Row3.X * vec.X + mat.Row3.Y * vec.Y + mat.Row3.Z * vec.Z + mat.Row3.W * vec.W);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
|
Loading…
Reference in a new issue