示例#1
0
        public unsafe void SetUniform4fv(int location, int count, bool transpose, float[] value)
        {
            mat4 matrix;

            if (transpose)
            {
                matrix = new mat4(
                    new vec4(value[0], value[4], value[8], value[12]),
                    new vec4(value[1], value[5], value[9], value[13]),
                    new vec4(value[2], value[6], value[10], value[14]),
                    new vec4(value[3], value[7], value[11], value[15])
                    );
            }
            else
            {
                matrix = new mat4(
                    new vec4(value[0], value[1], value[2], value[3]),
                    new vec4(value[4], value[5], value[6], value[7]),
                    new vec4(value[8], value[9], value[10], value[11]),
                    new vec4(value[12], value[13], value[14], value[15])
                    );
            }

            if (count == 1)
            {
                this.SetUniform(location, matrix);
            }
            else
            {
                var v = new mat4[count];
                for (int i = 0; i < count; i++)
                {
                    v[i] = matrix;
                }
                this.SetUniform(location, v);
            }
        }
示例#2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="matrix"></param>
 public mat3(mat4 matrix)
 {
     this.col0 = new vec3(matrix.col0);
     this.col1 = new vec3(matrix.col1);
     this.col2 = new vec3(matrix.col2);
 }