Tobias Bohnen avatar Tobias Bohnen committed 286e891

Comments (0)

Files changed (6)

 
         static Cg()
         {
-            DefaultOrder = Order.RowMajor;
+            DefaultMatrixOrder = MatrixOrder.RowMajor;
         }
 
         #endregion Constructors
 
         #region Public Static Properties
 
-        public static Order DefaultOrder
+        public static MatrixOrder DefaultMatrixOrder
         {
             get;
             set;
         ThreadSafePolicy = 4135,
     }
 
+    public enum MatrixOrder
+    {
+        ColumnMajor = 4121,
+        RowMajor = 4120
+    }
+
     public enum NameSpace
     {
         Global = 4108,
         Program = 4109,
     }
 
-    public enum Order
-    {
-        ColumnMajor = 4121,
-        RowMajor = 4120
-    }
-
     public enum ParameterClass
     {
         Unknown = 0,
 
         #region Internal Static Methods
 
-        internal static T GetMatrixParameter<T>(IntPtr param, Order order)
+        internal static T GetMatrixParameter<T>(IntPtr param, MatrixOrder order)
             where T : struct
         {
             GCHandle handle = GCHandle.Alloc(new T(), GCHandleType.Pinned);
                 {
                     switch (order)
                     {
-                        case Order.ColumnMajor:
+                        case MatrixOrder.ColumnMajor:
                             NativeMethods.cgGLGetMatrixParameterdc(param, handle.AddrOfPinnedObject());
                             break;
-                        case Order.RowMajor:
+                        case MatrixOrder.RowMajor:
                             NativeMethods.cgGLGetMatrixParameterdr(param, handle.AddrOfPinnedObject());
                             break;
                         default:
                 {
                     switch (order)
                     {
-                        case Order.ColumnMajor:
+                        case MatrixOrder.ColumnMajor:
                             NativeMethods.cgGLGetMatrixParameterfc(param, handle.AddrOfPinnedObject());
                             break;
-                        case Order.RowMajor:
+                        case MatrixOrder.RowMajor:
                             NativeMethods.cgGLGetMatrixParameterfr(param, handle.AddrOfPinnedObject());
                             break;
                         default:
             }
         }
 
-        internal static T[] GetMatrixParameterArray<T>(IntPtr param, int offset, int nelements, Order order)
+        internal static T[] GetMatrixParameterArray<T>(IntPtr param, int offset, int nelements, MatrixOrder order)
             where T : struct
         {
             var retValue = new T[nelements];
                 {
                     switch (order)
                     {
-                        case Order.ColumnMajor:
+                        case MatrixOrder.ColumnMajor:
                             NativeMethods.cgGLGetMatrixParameterArrayfc(param, offset, nelements, g.AddrOfPinnedObject());
                             break;
-                        case Order.RowMajor:
+                        case MatrixOrder.RowMajor:
                             NativeMethods.cgGLGetMatrixParameterArrayfr(param, offset, nelements, g.AddrOfPinnedObject());
                             break;
                         default:
                 {
                     switch (order)
                     {
-                        case Order.ColumnMajor:
+                        case MatrixOrder.ColumnMajor:
                             NativeMethods.cgGLGetMatrixParameterArraydc(param, offset, nelements, g.AddrOfPinnedObject());
                             break;
-                        case Order.RowMajor:
+                        case MatrixOrder.RowMajor:
                             NativeMethods.cgGLGetMatrixParameterArraydr(param, offset, nelements, g.AddrOfPinnedObject());
                             break;
                         default:
             }
         }
 
-        internal static void SetMatrixParameter(IntPtr param, Matrix4d matrix, Order order)
+        internal static void SetMatrixParameter(IntPtr param, Matrix4d matrix, MatrixOrder order)
         {
             switch (order)
             {
-                case Order.ColumnMajor:
+                case MatrixOrder.ColumnMajor:
                     NativeMethods.cgGLSetMatrixParameterdc(param, ref matrix);
                     break;
-                case Order.RowMajor:
+                case MatrixOrder.RowMajor:
                     NativeMethods.cgGLSetMatrixParameterdr(param, ref matrix);
                     break;
                 default:
             }
         }
 
-        internal static void SetMatrixParameterArray(IntPtr param, int offset, int nelements, Matrix4d[] matrices, Order order)
+        internal static void SetMatrixParameterArray(IntPtr param, int offset, int nelements, Matrix4d[] matrices, MatrixOrder order)
         {
             switch (order)
             {
-                case Order.ColumnMajor:
+                case MatrixOrder.ColumnMajor:
                     NativeMethods.cgGLSetMatrixParameterArraydc(param, offset, nelements, matrices);
                     break;
-                case Order.RowMajor:
+                case MatrixOrder.RowMajor:
                     NativeMethods.cgGLSetMatrixParameterArraydr(param, offset, nelements, matrices);
                     break;
                 default:
             }
         }
 
-        internal static void SetMatrixParameterArray(IntPtr param, int offset, int nelements, Matrix4[] matrices, Order order)
+        internal static void SetMatrixParameterArray(IntPtr param, int offset, int nelements, Matrix4[] matrices, MatrixOrder order)
         {
             switch (order)
             {
-                case Order.ColumnMajor:
+                case MatrixOrder.ColumnMajor:
                     NativeMethods.cgGLSetMatrixParameterArrayfc(param, offset, nelements, matrices);
                     break;
-                case Order.RowMajor:
+                case MatrixOrder.RowMajor:
                     NativeMethods.cgGLSetMatrixParameterArrayfr(param, offset, nelements, matrices);
                     break;
                 default:

CgNet/GL/CgGLParameter.cs

 
         public static void GetMatrix(this Parameter param, out Matrix4 value)
         {
-            value = CgGL.GetMatrixParameter<Matrix4>(param.Handle, Cg.DefaultOrder);
+            value = CgGL.GetMatrixParameter<Matrix4>(param.Handle, Cg.DefaultMatrixOrder);
         }
 
         public static void GetMatrix(this Parameter param, out Matrix4d value)
         {
-            value = CgGL.GetMatrixParameter<Matrix4d>(param.Handle, Cg.DefaultOrder);
+            value = CgGL.GetMatrixParameter<Matrix4d>(param.Handle, Cg.DefaultMatrixOrder);
         }
 
         public static T GetMatrix<T>(this Parameter param)
             where T : struct
         {
-            return CgGL.GetMatrixParameter<T>(param.Handle, Cg.DefaultOrder);
+            return CgGL.GetMatrixParameter<T>(param.Handle, Cg.DefaultMatrixOrder);
         }
 
-        public static T GetMatrix<T>(this Parameter param, Order order)
+        public static T GetMatrix<T>(this Parameter param, MatrixOrder order)
             where T : struct
         {
             return CgGL.GetMatrixParameter<T>(param.Handle, order);
 
         public static void GetMatrixArray(this Parameter param, int offset, int nelements, out Matrix4[] values)
         {
-            values = CgGL.GetMatrixParameterArray<Matrix4>(param.Handle, offset, nelements, Cg.DefaultOrder);
+            values = CgGL.GetMatrixParameterArray<Matrix4>(param.Handle, offset, nelements, Cg.DefaultMatrixOrder);
         }
 
         public static void GetMatrixArray(this Parameter param, int offset, int nelements, out Matrix4d[] values)
         {
-            values = CgGL.GetMatrixParameterArray<Matrix4d>(param.Handle, offset, nelements, Cg.DefaultOrder);
+            values = CgGL.GetMatrixParameterArray<Matrix4d>(param.Handle, offset, nelements, Cg.DefaultMatrixOrder);
         }
 
         public static T[] GetMatrixArray<T>(this Parameter param, int offset, int nelements)
             where T : struct
         {
-            return CgGL.GetMatrixParameterArray<T>(param.Handle, offset, nelements, Cg.DefaultOrder);
+            return CgGL.GetMatrixParameterArray<T>(param.Handle, offset, nelements, Cg.DefaultMatrixOrder);
         }
 
-        public static T[] GetMatrixArray<T>(this Parameter param, int offset, int nelements, Order order)
+        public static T[] GetMatrixArray<T>(this Parameter param, int offset, int nelements, MatrixOrder order)
             where T : struct
         {
             return CgGL.GetMatrixParameterArray<T>(param.Handle, offset, nelements, order);
 
         public static void SetMatrix(this Parameter param, Matrix4 matrix)
         {
-            SetMatrix(param, matrix, Cg.DefaultOrder);
+            SetMatrix(param, matrix, Cg.DefaultMatrixOrder);
         }
 
-        public static void SetMatrix(this Parameter param, Matrix4 matrix, Order order)
+        public static void SetMatrix(this Parameter param, Matrix4 matrix, MatrixOrder order)
         {
             switch (order)
             {
-                case Order.ColumnMajor:
+                case MatrixOrder.ColumnMajor:
                     NativeMethods.cgGLSetMatrixParameterfc(param.Handle, ref matrix);
                     break;
-                case Order.RowMajor:
+                case MatrixOrder.RowMajor:
                     NativeMethods.cgGLSetMatrixParameterfr(param.Handle, ref matrix);
                     break;
                 default:
 
         public static void SetMatrix(this Parameter param, Matrix4d matrix)
         {
-            CgGL.SetMatrixParameter(param.Handle, matrix, Cg.DefaultOrder);
+            CgGL.SetMatrixParameter(param.Handle, matrix, Cg.DefaultMatrixOrder);
         }
 
-        public static void SetMatrix(this Parameter param, Matrix4d matrix, Order order)
+        public static void SetMatrix(this Parameter param, Matrix4d matrix, MatrixOrder order)
         {
             CgGL.SetMatrixParameter(param.Handle, matrix, order);
         }
 
         public static void SetMatrixArray(this Parameter param, int offset, int nelements, Matrix4d[] matrices)
         {
-            CgGL.SetMatrixParameterArray(param.Handle, offset, nelements, matrices, Cg.DefaultOrder);
+            CgGL.SetMatrixParameterArray(param.Handle, offset, nelements, matrices, Cg.DefaultMatrixOrder);
         }
 
         public static void SetMatrixArray(this Parameter param, int offset, int nelements, Matrix4[] matrices)
         {
-            CgGL.SetMatrixParameterArray(param.Handle, offset, nelements, matrices, Cg.DefaultOrder);
+            CgGL.SetMatrixParameterArray(param.Handle, offset, nelements, matrices, Cg.DefaultMatrixOrder);
         }
 
-        public static void SetMatrixArray(this Parameter param, int offset, int nelements, Matrix4d[] matrices, Order order)
+        public static void SetMatrixArray(this Parameter param, int offset, int nelements, Matrix4d[] matrices, MatrixOrder order)
         {
             CgGL.SetMatrixParameterArray(param.Handle, offset, nelements, matrices, order);
         }
 
-        public static void SetMatrixArray(this Parameter param, int offset, int nelements, Matrix4[] matrices, Order order)
+        public static void SetMatrixArray(this Parameter param, int offset, int nelements, Matrix4[] matrices, MatrixOrder order)
         {
             CgGL.SetMatrixParameterArray(param.Handle, offset, nelements, matrices, order);
         }

CgNet/NativeMethods.cs

         // CGDLL_API void cgGetMatrixParameterdc(CGparameter param, double *matrix);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        public static extern void cgGetMatrixParameterdc(IntPtr param, IntPtr matrix);
+        public static extern void cgGetMatrixParameterdc(IntPtr param, double[] matrix);
 
         /// <summary>
         /// 
         // CGDLL_API void cgGetMatrixParameterdr(CGparameter param, double *matrix);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        public static extern void cgGetMatrixParameterdr(IntPtr param, IntPtr matrix);
+        public static extern void cgGetMatrixParameterdr(IntPtr param, double[] matrix);
 
         /// <summary>
         /// 
         // CGDLL_API void cgGetMatrixParameterfc(CGparameter param, float *matrix);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        public static extern void cgGetMatrixParameterfc(IntPtr param, IntPtr matrix);
+        public static extern void cgGetMatrixParameterfc(IntPtr param, float[] matrix);
 
         /// <summary>
         /// 
         // CGDLL_API void cgGetMatrixParameterfr(CGparameter param, float *matrix);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        public static extern void cgGetMatrixParameterfr(IntPtr param, IntPtr matrix);
+        public static extern void cgGetMatrixParameterfr(IntPtr param, float[] matrix);
 
         /// <summary>
         /// 
         // CGDLL_API void cgGetMatrixParameteric(CGparameter param, int *matrix);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        public static extern void cgGetMatrixParameteric(IntPtr param, IntPtr matrix);
+        public static extern void cgGetMatrixParameteric(IntPtr param, int[] matrix);
 
         /// <summary>
         /// 
         // CGDLL_API void cgGetMatrixParameterir(CGparameter param, int *matrix);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        public static extern void cgGetMatrixParameterir(IntPtr param, IntPtr matrix);
+        public static extern void cgGetMatrixParameterir(IntPtr param, int[] matrix);
 
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        public static extern Order cgGetMatrixParameterOrder(IntPtr param);
+        public static extern MatrixOrder cgGetMatrixParameterOrder(IntPtr param);
 
         //CG_API void CGENTRY cgGetMatrixSize(CGtype type, int *nrows, int *ncols);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         // CGDLL_API int cgGetParameterValuedc(CGparameter param, int n, double *vals);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        public static extern int cgGetParameterValuedc(IntPtr param, int n, IntPtr vals);
+        public static extern int cgGetParameterValuedc(IntPtr param, int n, double[] vals);
 
         /// <summary>
         /// 
         // CGDLL_API int cgGetParameterValuedr(CGparameter param, int n, double *vals);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        public static extern int cgGetParameterValuedr(IntPtr param, int n, IntPtr vals);
+        public static extern int cgGetParameterValuedr(IntPtr param, int n, double[] vals);
 
         /// <summary>
         /// 
         // CGDLL_API int cgGetParameterValuefc(CGparameter param, int n, float *vals);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        public static extern int cgGetParameterValuefc(IntPtr param, int n, IntPtr vals);
+        public static extern int cgGetParameterValuefc(IntPtr param, int n, float[] vals);
 
         /// <summary>
         /// 
         // CGDLL_API int cgGetParameterValuefr(CGparameter param, int n, float *vals);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        public static extern int cgGetParameterValuefr(IntPtr param, int n, IntPtr vals);
+        public static extern int cgGetParameterValuefr(IntPtr param, int n, float[] vals);
 
         /// <summary>
         /// 
         // CGDLL_API int cgGetParameterValueic(CGparameter param, int n, int *vals);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        public static extern int cgGetParameterValueic(IntPtr param, int n, IntPtr vals);
+        public static extern int cgGetParameterValueic(IntPtr param, int n, int[] vals);
 
         /// <summary>
         /// 
         // CGDLL_API int cgGetParameterValueir(CGparameter param, int n, int *vals);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        public static extern int cgGetParameterValueir(IntPtr param, int n, IntPtr vals);
+        public static extern int cgGetParameterValueir(IntPtr param, int n, int[] vals);
 
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]

CgNet/Parameter.cs

 
         public int GetDefaultValue(ref double[] values)
         {
-            return this.GetDefaultValue(ref values, Cg.DefaultOrder);
+            return this.GetDefaultValue(ref values, Cg.DefaultMatrixOrder);
         }
 
-        public int GetDefaultValue(ref double[] values, Order order)
+        public int GetDefaultValue(ref double[] values, MatrixOrder order)
         {
             IntPtr param = this.Handle;
             switch (order)
             {
-                case Order.ColumnMajor:
+                case MatrixOrder.ColumnMajor:
                     return NativeMethods.cgGetParameterDefaultValuedc(param, values.Length, values);
-                case Order.RowMajor:
+                case MatrixOrder.RowMajor:
                     return NativeMethods.cgGetParameterDefaultValuedr(param, values.Length, values);
                 default:
                     throw new ArgumentOutOfRangeException("order");
 
         public int GetDefaultValue(ref int[] values)
         {
-            return this.GetDefaultValue(ref values, Cg.DefaultOrder);
+            return this.GetDefaultValue(ref values, Cg.DefaultMatrixOrder);
         }
 
-        public int GetDefaultValue(ref int[] values, Order order)
+        public int GetDefaultValue(ref int[] values, MatrixOrder order)
         {
             IntPtr param = this.Handle;
             switch (order)
             {
-                case Order.ColumnMajor:
+                case MatrixOrder.ColumnMajor:
                     return NativeMethods.cgGetParameterDefaultValueic(param, values.Length, values);
-                case Order.RowMajor:
+                case MatrixOrder.RowMajor:
                     return NativeMethods.cgGetParameterDefaultValueir(param, values.Length, values);
                 default:
                     throw new ArgumentOutOfRangeException("order");
 
         public int GetDefaultValue(ref float[] values)
         {
-            return this.GetDefaultValue(ref values, Cg.DefaultOrder);
+            return this.GetDefaultValue(ref values, Cg.DefaultMatrixOrder);
         }
 
-        public int GetDefaultValue(ref float[] values, Order order)
+        public int GetDefaultValue(ref float[] values, MatrixOrder order)
         {
             IntPtr param = this.Handle;
             switch (order)
             {
-                case Order.ColumnMajor:
+                case MatrixOrder.ColumnMajor:
                     return NativeMethods.cgGetParameterDefaultValuefc(param, values.Length, values);
-                case Order.RowMajor:
+                case MatrixOrder.RowMajor:
                     return NativeMethods.cgGetParameterDefaultValuefr(param, values.Length, values);
                 default:
                     throw new ArgumentOutOfRangeException("order");
 
         public void GetMatrix(out int[] values)
         {
-            values = this.GetMatrix<int>(Cg.DefaultOrder);
+            GetMatrix(out values, Cg.DefaultMatrixOrder);
+        }
+
+        public void GetMatrix(out int[] values, MatrixOrder order)
+        {
+            values = new int[16];
+            switch (order)
+            {
+                case MatrixOrder.ColumnMajor:
+                    NativeMethods.cgGetMatrixParameteric(this.Handle, values);
+                    break;
+                case MatrixOrder.RowMajor:
+                    NativeMethods.cgGetMatrixParameterir(this.Handle, values);
+                    break;
+                default:
+                    throw new InvalidEnumArgumentException("order");
+            }
         }
 
         public void GetMatrix(out float[] values)
         {
-            values = this.GetMatrix<float>(Cg.DefaultOrder);
+            GetMatrix(out values, Cg.DefaultMatrixOrder);
+        }
+
+        public void GetMatrix(out float[] values, MatrixOrder order)
+        {
+            values = new float[16];
+            switch (order)
+            {
+                case MatrixOrder.ColumnMajor:
+                    NativeMethods.cgGetMatrixParameterfc(this.Handle, values);
+                    break;
+                case MatrixOrder.RowMajor:
+                    NativeMethods.cgGetMatrixParameterfr(this.Handle, values);
+                    break;
+                default:
+                    throw new InvalidEnumArgumentException("order");
+            }
         }
 
         public void GetMatrix(out double[] values)
         {
-            values = this.GetMatrix<double>(Cg.DefaultOrder);
+            GetMatrix(out values, Cg.DefaultMatrixOrder);
         }
 
-        public T[] GetMatrix<T>()
-            where T : struct
+        public void GetMatrix(out double[] values, MatrixOrder order)
         {
-            return this.GetMatrix<T>(Cg.DefaultOrder);
-        }
-
-        public T[] GetMatrix<T>(Order order)
-            where T : struct
-        {
-            IntPtr param = this.Handle;
-            var retValue = new T[16];
-            GCHandle handle = GCHandle.Alloc(retValue, GCHandleType.Pinned);
-
-            try
+            values = new double[16];
+            switch (order)
             {
-                if (typeof(T) == typeof(double))
-                {
-                    switch (order)
-                    {
-                        case Order.ColumnMajor:
-                            NativeMethods.cgGetMatrixParameterdc(param, handle.AddrOfPinnedObject());
-                            break;
-                        case Order.RowMajor:
-                            NativeMethods.cgGetMatrixParameterdr(param, handle.AddrOfPinnedObject());
-                            break;
-                        default:
-                            throw new InvalidEnumArgumentException("order");
-                    }
-                }
-                else if (typeof(T) == typeof(float))
-                {
-                    switch (order)
-                    {
-                        case Order.ColumnMajor:
-                            NativeMethods.cgGetMatrixParameterfc(param, handle.AddrOfPinnedObject());
-                            break;
-                        case Order.RowMajor:
-                            NativeMethods.cgGetMatrixParameterfr(param, handle.AddrOfPinnedObject());
-                            break;
-                        default:
-                            throw new InvalidEnumArgumentException("order");
-                    }
-                }
-                else if (typeof(T) == typeof(int))
-                {
-                    switch (order)
-                    {
-                        case Order.ColumnMajor:
-                            NativeMethods.cgGetMatrixParameteric(param, handle.AddrOfPinnedObject());
-                            break;
-                        case Order.RowMajor:
-                            NativeMethods.cgGetMatrixParameterir(param, handle.AddrOfPinnedObject());
-                            break;
-                        default:
-                            throw new InvalidEnumArgumentException("order");
-                    }
-                }
-                else
-                {
-                    throw new ArgumentException();
-                }
-
-                return retValue;
-            }
-            finally
-            {
-                handle.Free();
+                case MatrixOrder.ColumnMajor:
+                    NativeMethods.cgGetMatrixParameterdc(this.Handle, values);
+                    break;
+                case MatrixOrder.RowMajor:
+                    NativeMethods.cgGetMatrixParameterdr(this.Handle, values);
+                    break;
+                default:
+                    throw new InvalidEnumArgumentException("order");
             }
         }
 
-        public Order GetMatrixOrder()
+        public MatrixOrder GetMatrixOrder()
         {
             return NativeMethods.cgGetMatrixParameterOrder(this.Handle);
         }
             return Marshal.PtrToStringAnsi(NativeMethods.cgGetStringParameterValue(this.Handle));
         }
 
-        public void GetValue(ref int[] values)
+        public void GetValue(int[] values)
         {
-            this.GetValue(ref values, Cg.DefaultOrder);
+            this.GetValue(values, Cg.DefaultMatrixOrder);
         }
 
-        public void GetValue(ref int[] values, Order order)
+        public void GetValue(int[] values, MatrixOrder order)
         {
-            GCHandle handle = GCHandle.Alloc(values, GCHandleType.Pinned);
-            try
+            switch (order)
             {
-                switch (order)
-                {
-                    case Order.ColumnMajor:
-                        NativeMethods.cgGetParameterValueic(this.Handle, values.Length, handle.AddrOfPinnedObject());
-                        break;
-                    case Order.RowMajor:
-                        NativeMethods.cgGetParameterValueir(this.Handle, values.Length, handle.AddrOfPinnedObject());
-                        break;
-                    default:
-                        throw new InvalidEnumArgumentException("order");
-                }
-            }
-            finally
-            {
-                handle.Free();
+                case MatrixOrder.ColumnMajor:
+                    NativeMethods.cgGetParameterValueic(this.Handle, values.Length, values);
+                    break;
+                case MatrixOrder.RowMajor:
+                    NativeMethods.cgGetParameterValueir(this.Handle, values.Length, values);
+                    break;
+                default:
+                    throw new InvalidEnumArgumentException("order");
             }
         }
 
-        public void GetValue(ref double[] values)
+        public void GetValue(double[] values)
         {
-            this.GetValue(ref values, Cg.DefaultOrder);
+            this.GetValue(values, Cg.DefaultMatrixOrder);
         }
 
-        public void GetValue(ref double[] values, Order order)
+        public void GetValue(double[] values, MatrixOrder order)
         {
-            GCHandle handle = GCHandle.Alloc(values, GCHandleType.Pinned);
-            try
+            switch (order)
             {
-                switch (order)
-                {
-                    case Order.ColumnMajor:
-                        NativeMethods.cgGetParameterValuedc(this.Handle, values.Length, handle.AddrOfPinnedObject());
-                        break;
-                    case Order.RowMajor:
-                        NativeMethods.cgGetParameterValuedr(this.Handle, values.Length, handle.AddrOfPinnedObject());
-                        break;
-                    default:
-                        throw new InvalidEnumArgumentException("order");
-                }
-            }
-            finally
-            {
-                handle.Free();
+                case MatrixOrder.ColumnMajor:
+                    NativeMethods.cgGetParameterValuedc(this.Handle, values.Length, values);
+                    break;
+                case MatrixOrder.RowMajor:
+                    NativeMethods.cgGetParameterValuedr(this.Handle, values.Length, values);
+                    break;
+                default:
+                    throw new InvalidEnumArgumentException("order");
             }
         }
 
-        public void GetValue(ref float[] values)
+        public void GetValue(float[] values)
         {
-            this.GetValue(ref values, Cg.DefaultOrder);
+            this.GetValue(values, Cg.DefaultMatrixOrder);
         }
 
-        public void GetValue(ref float[] values, Order order)
+        public void GetValue(float[] values, MatrixOrder order)
         {
-            GCHandle handle = GCHandle.Alloc(values, GCHandleType.Pinned);
-            try
+            switch (order)
             {
-                switch (order)
-                {
-                    case Order.ColumnMajor:
-                        NativeMethods.cgGetParameterValuefc(this.Handle, values.Length, handle.AddrOfPinnedObject());
-                        break;
-                    case Order.RowMajor:
-                        NativeMethods.cgGetParameterValuefr(this.Handle, values.Length, handle.AddrOfPinnedObject());
-                        break;
-                    default:
-                        throw new InvalidEnumArgumentException("order");
-                }
+                case MatrixOrder.ColumnMajor:
+                    NativeMethods.cgGetParameterValuefc(this.Handle, values.Length, values);
+                    break;
+                case MatrixOrder.RowMajor:
+                    NativeMethods.cgGetParameterValuefr(this.Handle, values.Length, values);
+                    break;
+                default:
+                    throw new InvalidEnumArgumentException("order");
             }
-            finally
-            {
-                handle.Free();
-            }
-        }
-
-        public T GetValue<T>()
-            where T : struct
-        {
-            var f = new T[1];
-            GCHandle handle = GCHandle.Alloc(f, GCHandleType.Pinned);
-            try
-            {
-                if (typeof(T) == typeof(int))
-                {
-                    NativeMethods.cgGetParameterValueir(this.Handle, f.Length, handle.AddrOfPinnedObject());
-                }
-                else if (typeof(T) == typeof(double))
-                {
-                    NativeMethods.cgGetParameterValuedr(this.Handle, f.Length, handle.AddrOfPinnedObject());
-                }
-                else if (typeof(T) == typeof(float))
-                {
-                    NativeMethods.cgGetParameterValuefr(this.Handle, f.Length, handle.AddrOfPinnedObject());
-                }
-            }
-            finally
-            {
-                handle.Free();
-            }
-
-            return f[0];
         }
 
         public bool IsUsed(WrapperObject container)
 
         public void SetMatrix(float[] matrix)
         {
-            this.SetMatrix(matrix, Cg.DefaultOrder);
+            this.SetMatrix(matrix, Cg.DefaultMatrixOrder);
         }
 
-        public void SetMatrix(float[] matrix, Order order)
+        public void SetMatrix(float[] matrix, MatrixOrder order)
         {
             IntPtr param = this.Handle;
             switch (order)
             {
-                case Order.ColumnMajor:
+                case MatrixOrder.ColumnMajor:
                     NativeMethods.cgSetMatrixParameterfc(param, matrix);
                     break;
-                case Order.RowMajor:
+                case MatrixOrder.RowMajor:
                     NativeMethods.cgSetMatrixParameterfr(param, matrix);
                     break;
                 default:
 
         public void SetMatrix(double[] matrix)
         {
-            this.SetMatrix(matrix, Cg.DefaultOrder);
+            this.SetMatrix(matrix, Cg.DefaultMatrixOrder);
         }
 
-        public void SetMatrix(double[] matrix, Order order)
+        public void SetMatrix(double[] matrix, MatrixOrder order)
         {
             switch (order)
             {
-                case Order.ColumnMajor:
+                case MatrixOrder.ColumnMajor:
                     NativeMethods.cgSetMatrixParameterdc(this.Handle, matrix);
                     break;
-                case Order.RowMajor:
+                case MatrixOrder.RowMajor:
                     NativeMethods.cgSetMatrixParameterdr(this.Handle, matrix);
                     break;
                 default:
 
         public void SetMatrix(int[] matrix)
         {
-            this.SetMatrix(matrix, Cg.DefaultOrder);
+            this.SetMatrix(matrix, Cg.DefaultMatrixOrder);
         }
 
-        public void SetMatrix(int[] matrix, Order order)
+        public void SetMatrix(int[] matrix, MatrixOrder order)
         {
             switch (order)
             {
-                case Order.ColumnMajor:
+                case MatrixOrder.ColumnMajor:
                     NativeMethods.cgSetMatrixParameteric(this.Handle, matrix);
                     break;
-                case Order.RowMajor:
+                case MatrixOrder.RowMajor:
                     NativeMethods.cgSetMatrixParameterir(this.Handle, matrix);
                     break;
                 default:
 
         public void SetValue(double[] vals)
         {
-            this.SetValue(vals, Cg.DefaultOrder);
+            this.SetValue(vals, Cg.DefaultMatrixOrder);
         }
 
-        public void SetValue(double[] vals, Order order)
+        public void SetValue(double[] vals, MatrixOrder order)
         {
             switch (order)
             {
-                case Order.ColumnMajor:
+                case MatrixOrder.ColumnMajor:
                     NativeMethods.cgSetParameterValuedc(this.Handle, vals.Length, vals);
                     break;
-                case Order.RowMajor:
+                case MatrixOrder.RowMajor:
                     NativeMethods.cgSetParameterValuedr(this.Handle, vals.Length, vals);
                     break;
                 default:
 
         public void SetValue(float[] vals)
         {
-            this.SetValue(vals, Cg.DefaultOrder);
+            this.SetValue(vals, Cg.DefaultMatrixOrder);
         }
 
-        public void SetValue(float[] vals, Order order)
+        public void SetValue(float[] vals, MatrixOrder order)
         {
             switch (order)
             {
-                case Order.ColumnMajor:
+                case MatrixOrder.ColumnMajor:
                     NativeMethods.cgSetParameterValuefc(this.Handle, vals.Length, vals);
                     break;
-                case Order.RowMajor:
+                case MatrixOrder.RowMajor:
                     NativeMethods.cgSetParameterValuefr(this.Handle, vals.Length, vals);
                     break;
                 default:
 
         public void SetValue(int[] vals)
         {
-            this.SetValue(vals, Cg.DefaultOrder);
+            this.SetValue(vals, Cg.DefaultMatrixOrder);
         }
 
-        public void SetValue(int[] vals, Order order)
+        public void SetValue(int[] vals, MatrixOrder order)
         {
             switch (order)
             {
-                case Order.ColumnMajor:
+                case MatrixOrder.ColumnMajor:
                     NativeMethods.cgSetParameterValueic(this.Handle, vals.Length, vals);
                     break;
-                case Order.RowMajor:
+                case MatrixOrder.RowMajor:
                     NativeMethods.cgSetParameterValueir(this.Handle, vals.Length, vals);
                     break;
                 default:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.