From e6a855f00a8f104a1b2c3cb55eabb0233d2886c2 Mon Sep 17 00:00:00 2001 From: Robert Rouhani Date: Wed, 16 Jan 2013 17:53:00 -0800 Subject: [PATCH] Added UniformMatrix3/3d/4d overloads --- Source/OpenTK/Graphics/ES20/Helper.cs | 11 +++++ Source/OpenTK/Graphics/OpenGL/GLHelper.cs | 55 ++++++++++++++++++----- Source/OpenTK/OpenTK.csproj | 1 + 3 files changed, 56 insertions(+), 11 deletions(-) diff --git a/Source/OpenTK/Graphics/ES20/Helper.cs b/Source/OpenTK/Graphics/ES20/Helper.cs index f0046f36..a14bee80 100644 --- a/Source/OpenTK/Graphics/ES20/Helper.cs +++ b/Source/OpenTK/Graphics/ES20/Helper.cs @@ -137,6 +137,17 @@ namespace OpenTK.Graphics.ES20 GL.Uniform4(location, quaternion.X, quaternion.Y, quaternion.Z, quaternion.W); } + public static void UniformMatrix3(int location, bool transpose, ref Matrix3 matrix) + { + unsafe + { + fixed (float* matrix_ptr = &matrix.Row0.X) + { + GL.UniformMatrix3(location, 1, transpose, matrix_ptr); + } + } + } + public static void UniformMatrix4(int location, bool transpose, ref Matrix4 matrix) { unsafe diff --git a/Source/OpenTK/Graphics/OpenGL/GLHelper.cs b/Source/OpenTK/Graphics/OpenGL/GLHelper.cs index 6e071871..b90f81fe 100644 --- a/Source/OpenTK/Graphics/OpenGL/GLHelper.cs +++ b/Source/OpenTK/Graphics/OpenGL/GLHelper.cs @@ -300,17 +300,6 @@ namespace OpenTK.Graphics.OpenGL } } - public static void UniformMatrix4(int location, bool transpose, ref Matrix4 matrix) - { - unsafe - { - fixed (float* matrix_ptr = &matrix.Row0.X) - { - GL.UniformMatrix4(location, 1, transpose, matrix_ptr); - } - } - } - public static void Normal3(Vector3d normal) { GL.Normal3(normal.X, normal.Y, normal.Z); @@ -465,6 +454,50 @@ namespace OpenTK.Graphics.OpenGL GL.Uniform4(location, quaternion.X, quaternion.Y, quaternion.Z, quaternion.W); } + public static void UniformMatrix3(int location, bool transpose, ref Matrix3 matrix) + { + unsafe + { + fixed (float* matrix_ptr = &matrix.Row0.X) + { + GL.UniformMatrix3(location, 1, transpose, matrix_ptr); + } + } + } + + public static void UniformMatrix3(int location, bool transpose, ref Matrix3d matrix) + { + unsafe + { + fixed (double* matrix_ptr = &matrix.Row0.X) + { + GL.UniformMatrix3(location, 1, transpose, matrix_ptr); + } + } + } + + public static void UniformMatrix4(int location, bool transpose, ref Matrix4 matrix) + { + unsafe + { + fixed (float* matrix_ptr = &matrix.Row0.X) + { + GL.UniformMatrix4(location, 1, transpose, matrix_ptr); + } + } + } + + public static void UniformMatrix4(int location, bool transpose, ref Matrix4d matrix) + { + unsafe + { + fixed (double* matrix_ptr = &matrix.Row0.X) + { + GL.UniformMatrix4(location, 1, transpose, matrix_ptr); + } + } + } + #endregion #endregion diff --git a/Source/OpenTK/OpenTK.csproj b/Source/OpenTK/OpenTK.csproj index d794c9b4..605d0c6b 100644 --- a/Source/OpenTK/OpenTK.csproj +++ b/Source/OpenTK/OpenTK.csproj @@ -132,6 +132,7 @@ +