glLoadMatrixf() private method

private glLoadMatrixf ( float m ) : void
m float
return void
示例#1
0
        /// <summary>
        /// Call this before render something.
        /// </summary>
        public void setView()
        {
            GL.glMatrixMode(GL.GL_MODELVIEW);

            float[] viewmatrix =
            {                                    //Remove the three '-' for non-inverted z-axis
                maf_matrix[0],                     maf_matrix[4],  -maf_matrix[8], 0,
                maf_matrix[1],                     maf_matrix[5],  -maf_matrix[9], 0,
                maf_matrix[2],                     maf_matrix[6], -maf_matrix[10], 0,

                -(maf_matrix[0] * maf_matrix[12] +
                  maf_matrix[1] * maf_matrix[13] +
                  maf_matrix[2] * maf_matrix[14]),

                -(maf_matrix[4] * maf_matrix[12] +
                  maf_matrix[5] * maf_matrix[13] +
                  maf_matrix[6] * maf_matrix[14]),

                //add a - like above for non-inverted z-axis
                (maf_matrix[8] * maf_matrix[12] +
                 maf_matrix[9] * maf_matrix[13] +
                 maf_matrix[10] * maf_matrix[14]), 1
            };
            GL.glLoadMatrixf(viewmatrix);
        }
示例#2
0
 /// <summary>
 /// Rotate camera in local(camera) space
 /// </summary>
 public void rotateLocal(float deg, float x, float y, float z)
 {
     GL.glMatrixMode(GL.GL_MODELVIEW);
     GL.glPushMatrix();
     GL.glLoadMatrixf(maf_matrix);
     GL.glRotatef(deg, x, y, z);
     GL.glGetFloatv(GL.GL_MODELVIEW_MATRIX, maf_matrix);
     GL.glPopMatrix();
 }
示例#3
0
        /// <summary>
        /// Rotate camera in world space
        /// </summary>
        public void rotateGlobal(float deg, float x, float y, float z)
        {
            float dx = x * maf_matrix[0] + y * maf_matrix[1] + z * maf_matrix[2];
            float dy = x * maf_matrix[4] + y * maf_matrix[5] + z * maf_matrix[6];
            float dz = x * maf_matrix[8] + y * maf_matrix[9] + z * maf_matrix[10];

            GL.glMatrixMode(GL.GL_MODELVIEW);
            GL.glPushMatrix();
            GL.glLoadMatrixf(maf_matrix);
            GL.glRotatef(deg, dx, dy, dz);
            GL.glGetFloatv(GL.GL_MODELVIEW_MATRIX, maf_matrix);
            GL.glPopMatrix();
        }