mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-11 23:05:55 +00:00
Modified TransformPerspective to work correctly with orthographic projection matrices. Fixes issue [#1827]: "OpenTK.Vector3.TransformPerspective code is wrong".
This commit is contained in:
parent
c89f8e375e
commit
4be74af5d4
|
@ -1154,7 +1154,7 @@ namespace OpenTK
|
||||||
/// <param name="result">The transformed vector</param>
|
/// <param name="result">The transformed vector</param>
|
||||||
public static void TransformPerspective(ref Vector3 vec, ref Matrix4 mat, out Vector3 result)
|
public static void TransformPerspective(ref Vector3 vec, ref Matrix4 mat, out Vector3 result)
|
||||||
{
|
{
|
||||||
Vector4 v = new Vector4(vec);
|
Vector4 v = new Vector4(vec, 1);
|
||||||
Vector4.Transform(ref v, ref mat, out v);
|
Vector4.Transform(ref v, ref mat, out v);
|
||||||
result.X = v.X / v.W;
|
result.X = v.X / v.W;
|
||||||
result.Y = v.Y / v.W;
|
result.Y = v.Y / v.W;
|
||||||
|
|
|
@ -1152,7 +1152,7 @@ namespace OpenTK
|
||||||
/// <param name="result">The transformed vector</param>
|
/// <param name="result">The transformed vector</param>
|
||||||
public static void TransformPerspective(ref Vector3d vec, ref Matrix4d mat, out Vector3d result)
|
public static void TransformPerspective(ref Vector3d vec, ref Matrix4d mat, out Vector3d result)
|
||||||
{
|
{
|
||||||
Vector4d v = new Vector4d(vec);
|
Vector4d v = new Vector4d(vec, 1);
|
||||||
Vector4d.Transform(ref v, ref mat, out v);
|
Vector4d.Transform(ref v, ref mat, out v);
|
||||||
result.X = v.X / v.W;
|
result.X = v.X / v.W;
|
||||||
result.Y = v.Y / v.W;
|
result.Y = v.Y / v.W;
|
||||||
|
|
Loading…
Reference in a new issue