Inheritance: MatrixSquare
Ejemplo n.º 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;
                }
            }
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 3
0
        public static mat4 inverse(mat4 m)
        {
            double[,] i = m.GetInverse();
            mat4 r = new mat4(i);

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

            return r;
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 8
0
 public void Rotate(float angle, vec3 axis)
 {
     CurrentMatrix = (mat4)(Matrix4Util.RotateMatrix(angle, axis) * CurrentMatrix);
 }
Ejemplo n.º 9
0
 public void Translate(vec3 t)
 {
     CurrentMatrix = (mat4)(Matrix4Util.Translate(ref t) * CurrentMatrix);
 }
Ejemplo n.º 10
0
 public void Scale(vec3 s)
 {
     CurrentMatrix = (mat4)(Matrix4Util.ScaleMatrix(ref s) * CurrentMatrix);
 }
Ejemplo n.º 11
0
 public void MultMatrix(mat4 m)
 {
     CurrentMatrix = (mat4)(m * CurrentMatrix);
 }
Ejemplo n.º 12
0
 public void LoadMatrix(mat4 m)
 {
     CurrentMatrix = m;
 }
Ejemplo n.º 13
0
 public void LoadIdentity()
 {
     CurrentMatrix = Matrix4Util.IdentityMatrix();
 }