···3333 * \defgroup SurfaceControls Surface Controls
3434 * \defgroup ImageControls Image Controls
3535 * \defgroup Conversions Surface, Image, and Target Conversions
3636+ * \defgroup Matrix Matrix Controls
3637 * \defgroup Rendering Rendering
3738 * \defgroup Shapes Shapes
3839 * \defgroup ShaderInterface Shader Interface
···258259259260260261262262+263263+#define GPU_MODELVIEW 0
264264+#define GPU_PROJECTION 1
265265+261266#ifndef GPU_MATRIX_STACK_MAX
262267#define GPU_MATRIX_STACK_MAX 5
263268#endif
264269265265-/*! \ingroup Rendering
266266- * Matrix stack data structure for replacing the old OpenGL matrix stack. */
270270+/*! \ingroup Matrix
271271+ * Matrix stack data structure for global vertex transforms. */
267272typedef struct GPU_MatrixStack
268273{
269274 unsigned int size;
···984989985990// End of Conversions
986991/*! @} */
992992+993993+994994+995995+996996+997997+/*! \ingroup Matrix
998998+ * @{ */
999999+10001000+10011001+// Basic matrix operations (4x4)
10021002+10031003+/*! Copy matrix A to the given 'result' matrix. */
10041004+void GPU_MatrixCopy(float* result, const float* A);
10051005+10061006+/*! Fills 'result' matrix with the identity matrix. */
10071007+void GPU_MatrixIdentity(float* result);
10081008+10091009+/*! Multiplies matrices A and B and stores the result in the given 'result' matrix (result = A*B). Do not use A or B as 'result'.
10101010+ * \see GPU_MultiplyAndAssign
10111011+*/
10121012+void GPU_Multiply4x4(float* result, float* A, float* B);
10131013+10141014+/*! Multiplies matrices 'result' and A and stores the result in the given 'result' matrix (result = result * A). */
10151015+void GPU_MultiplyAndAssign(float* result, float* A);
10161016+10171017+10181018+// Matrix stack accessors
10191019+10201020+/*! Returns an internal string that represents the contents of matrix A. */
10211021+const char* GPU_GetMatrixString(float* A);
10221022+10231023+/*! Returns the current matrix from the top of the matrix stack. Returns NULL if stack is empty. */
10241024+float* GPU_GetCurrentMatrix(void);
10251025+10261026+/*! Returns the current modelview matrix from the top of the matrix stack. Returns NULL if stack is empty. */
10271027+float* GPU_GetModelView(void);
10281028+10291029+/*! Returns the current projection matrix from the top of the matrix stack. Returns NULL if stack is empty. */
10301030+float* GPU_GetProjection(void);
10311031+10321032+/*! Copies the current modelview-projection matrix into the given 'result' matrix (result = P*M). */
10331033+void GPU_GetModelViewProjection(float* result);
10341034+10351035+10361036+// Matrix stack manipulators
10371037+10381038+/*! Changes matrix mode to either GPU_PROJECTION or GPU_MODELVIEW. Further matrix stack operations manipulate that particular stack. */
10391039+void GPU_MatrixMode(int matrix_mode);
10401040+10411041+/*! Pushes the current matrix as a new matrix stack item. */
10421042+void GPU_PushMatrix(void);
10431043+10441044+/*! Removes the current matrix from the stack. */
10451045+void GPU_PopMatrix(void);
10461046+10471047+/*! Fills current matrix with the identity matrix. */
10481048+void GPU_LoadIdentity(void);
10491049+10501050+/*! Multiplies an orthographic projection matrix into the current matrix. */
10511051+void GPU_Ortho(float left, float right, float bottom, float top, float near, float far);
10521052+10531053+/*! Multiplies a perspective projection matrix into the current matrix. */
10541054+void GPU_Frustum(float right, float left, float bottom, float top, float near, float far);
10551055+10561056+/*! Adds a translation into the current matrix. */
10571057+void GPU_Translate(float x, float y, float z);
10581058+10591059+/*! Multiplies a scaling matrix into the current matrix. */
10601060+void GPU_Scale(float sx, float sy, float sz);
10611061+10621062+/*! Multiplies a rotation matrix into the current matrix. */
10631063+void GPU_Rotate(float degrees, float x, float y, float z);
10641064+10651065+/*! Multiplies a given matrix into the current matrix. */
10661066+void GPU_MultMatrix(float* matrix4x4);
10671067+10681068+// End of Matrix
10691069+/*! @} */
10701070+10711071+10721072+10731073+987107498810759891076/*! \ingroup Rendering