/// <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(); }
/// <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(); }