Modified TransformPerspective to work correctly with orthographic projection matrices. Fixes issue [#1827]: "OpenTK.Vector3.TransformPerspective code is wrong".

This commit is contained in:
the_fiddler 2010-11-21 00:09:50 +00:00
parent c89f8e375e
commit 4be74af5d4
2 changed files with 2 additions and 2 deletions

View file

@ -1154,7 +1154,7 @@ namespace OpenTK
/// <param name="result">The transformed vector</param>
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);
result.X = v.X / v.W;
result.Y = v.Y / v.W;

View file

@ -1152,7 +1152,7 @@ namespace OpenTK
/// <param name="result">The transformed vector</param>
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);
result.X = v.X / v.W;
result.Y = v.Y / v.W;