利用者:Jwilkins/VFX/Common/Matrix

提供: wiki
移動先: 案内検索

Matrixes

Header File: GPU_matrix.h

uniform mat4 b_ModelViewMatrix;
uniform mat4 b_ProjectionMatrix;
uniform mat4 b_ModelViewProjectionMatrix;
uniform mat4 b_TextureMatrix[b_MaxTextureCoords];

The common matrix library is designed based on the legacy OpenGL matrix stack.

In addition it contains re-implementations of GLU functions, some convenience functions, and some functions that are useful for Blender.

Where there is normally a float and double version of the function, only the floating point version is provided and no 'f' suffix is needed.

OpenGL Replacements

Where a GLenum is called for, it has the same value as from OpenGL with the same meaning.

void gpuPushMatrix(void);
void gpuPopMatrix(void);

void gpuMatrixMode(GLenum mode);

void gpuLoadMatrix(const GLfloat* m);
void gpuLoadIdentity(void);

void gpuMultMatrix(const GLfloat*m);
void gpuMultMatrixd(const double *m);

void gpuTranslate(GLfloat x, GLfloat y, GLfloat z);
void gpuScale(GLfloat x, GLfloat y, GLfloat z);
void gpuOrtho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal);
void gpuFrustum(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal);

Get Replacements

State is queried without using deprecated GLenum values. For example, glGetFloatv(GL_MODELVIEW_MATRIX, ...) is replaced with gpuGetMatrix(GL_MODELVIEW_MATRIX, ...).

GLenum         gpuGetMatrixMode(void);
const GLfloat* gpuGetMatrix(GLenum type, GLfloat* m);

GLU Replacements

void gpuLookAt(GLfloat eyeX, GLfloat eyeY, GLfloat eyeZ, GLfloat centerX, GLfloat centerY, GLfloat centerZ, GLfloat upX, GLfloat upY, GLfloat upZ);
void gpuProject(const GLfloat obj[3], const GLfloat model[4][4], const GLfloat proj[4][4], const GLint view[4], GLfloat win[3]);
GLboolean gpuUnProject(const GLfloat win[3], const GLfloat model[4][4], const GLfloat proj[4][4], const GLint view[4], GLfloat obj[3]);

No OpenGL or GLU Equivalent

Angles are still given in degrees, not radians.

void gpuRotateVector(GLfloat deg, GLfloat vector[3]);
void gpuRotateAxis(GLfloat deg, char axis);
void gpuRotateRight(char type);

void gpuLoadOrtho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal);
void gpuLoadFrustum(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal);