diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2017-01-15 08:43:28 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2017-01-15 08:43:28 +0100 |
| commit | f5122870d6e6535937b8026e47fd2efa87e02bc0 (patch) | |
| tree | 599460bd6132562584578de9e3cfde77aa94f401 /Tests/OpenGL/Extensions.cs | |
| parent | e4b3f163986955b39913d1e4ff1456bb0b299252 (diff) | |
move unproject into ProjectiveIFaceCtrl, debug
Diffstat (limited to 'Tests/OpenGL/Extensions.cs')
| -rw-r--r-- | Tests/OpenGL/Extensions.cs | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/Tests/OpenGL/Extensions.cs b/Tests/OpenGL/Extensions.cs index 17fe6086..0dd1cca6 100644 --- a/Tests/OpenGL/Extensions.cs +++ b/Tests/OpenGL/Extensions.cs @@ -35,30 +35,7 @@ namespace Crow public static bool IsInBetween(this int v, int min, int max){ return v >= min & v <= max; } - public static Vector4 UnProject(ref Matrix4 projection, ref Matrix4 view, int[] viewport, Vector2 mouse) - { - Vector4 vec; - vec.X = 2.0f * mouse.X / (float)viewport[2] - 1; - vec.Y = -(2.0f * mouse.Y / (float)viewport[3] - 1); - vec.Z = 0f; - vec.W = 1.0f; - - Matrix4 viewInv = Matrix4.Invert(view); - Matrix4 projInv = Matrix4.Invert(projection); - - Vector4.Transform(ref vec, ref projInv, out vec); - Vector4.Transform(ref vec, ref viewInv, out vec); - - if (vec.W > float.Epsilon || vec.W < float.Epsilon) - { - vec.X /= vec.W; - vec.Y /= vec.W; - vec.Z /= vec.W; - } - - return vec; - } } } |