Inheritance: MatrixSquare
Example #1
0
        public void MatrixMode(int mode)
        {
            if (mode != CurrentMode)
            {
                switch (mode)
                {
                    case MODELVIEW:
                        {
                            ProjectionMatrix = CurrentMatrix;
                            CurrentMatrix = ModelviewMatrix;
                            CurrentMode = MODELVIEW;
                            break;
                        }

                    case PROJECTION:
                        {
                            ModelviewMatrix = CurrentMatrix;
                            CurrentMatrix = ProjectionMatrix;
                            CurrentMode = PROJECTION;
                            break;
                        }

                    default:
                        break;
                }
            }
        }
Example #2
0
        public static mat4 outerProcuct(vec4 c, vec4 r)
        {
            mat4 a = new mat4();

            a[0,0] = c.x * r.x; a[1,0] = c.x * r.y; a[2,0] = c.x * r.z; a[3,0] = c.x * r.w;
            a[0,1] = c.y * r.x; a[1,1] = c.y * r.y; a[2,1] = c.y * r.z; a[3,1] = c.y * r.w;
            a[0,2] = c.z * r.x; a[1,2] = c.z * r.y; a[2,2] = c.z * r.z; a[3,2] = c.z * r.w;
            a[0,3] = c.w * r.x; a[1,3] = c.w * r.y; a[2,3] = c.w * r.z; a[3,3] = c.w * r.w;

            return a;
        }
Example #3
0
        public static mat4 inverse(mat4 m)
        {
            double[,] i = m.GetInverse();
            mat4 r = new mat4(i);

            return r;
        }
Example #4
0
 public static mat4 transpose(mat4 m)
 {
     return (mat4)m.Transpose;
 }
Example #5
0
        public static mat4 matrixCompMult(mat4 x, mat4 y)
        {
            mat4 r = new mat4(MatrixSquare.ComponentMultiply(x, y));

            return r;
        }
Example #6
0
 public void Frustum(float left, float right,
     float bottom, float top,
     float zNear, float zFar)
 {
     CurrentMatrix = (mat4)(Matrix4Util.FrustumMatrix(left, right, bottom, top, zNear, zFar) *
         CurrentMatrix);
 }
Example #7
0
 public void Ortho(float left, float right,
     float bottom, float top,
     float zNear, float zFar)
 {
     CurrentMatrix = (mat4)(Matrix4Util.OrthoMatrix(left, right, bottom, top, zNear, zFar) * CurrentMatrix);
 }
Example #8
0
 public void Rotate(float angle, vec3 axis)
 {
     CurrentMatrix = (mat4)(Matrix4Util.RotateMatrix(angle, axis) * CurrentMatrix);
 }
Example #9
0
 public void Translate(vec3 t)
 {
     CurrentMatrix = (mat4)(Matrix4Util.Translate(ref t) * CurrentMatrix);
 }
Example #10
0
 public void Scale(vec3 s)
 {
     CurrentMatrix = (mat4)(Matrix4Util.ScaleMatrix(ref s) * CurrentMatrix);
 }
Example #11
0
 public void MultMatrix(mat4 m)
 {
     CurrentMatrix = (mat4)(m * CurrentMatrix);
 }
Example #12
0
 public void LoadMatrix(mat4 m)
 {
     CurrentMatrix = m;
 }
Example #13
0
 public void LoadIdentity()
 {
     CurrentMatrix = Matrix4Util.IdentityMatrix();
 }