update function prefix, fill out translate

This commit is contained in:
Josh Holtrop 2011-05-09 16:21:28 -04:00
parent c1c42f3558
commit 514a1c6d09
2 changed files with 27 additions and 9 deletions

View File

@ -1,7 +1,7 @@
#include "glslUtil.h"
void matrixLoadIdentity(mat4x4 *m)
void guMatrixLoadIdentity(guMatrix4x4 *m)
{
for (int i = 0; i < 4; i++)
{
@ -12,7 +12,7 @@ void matrixLoadIdentity(mat4x4 *m)
}
}
void matrixMult(mat4x4 *m, mat4x4 *a, mat4x4 *b)
void guMatrixMult(guMatrix4x4 *m, guMatrix4x4 *a, guMatrix4x4 *b)
{
for (int i = 0; i < 4; i++)
{
@ -28,6 +28,10 @@ void matrixMult(mat4x4 *m, mat4x4 *a, mat4x4 *b)
}
}
void matrixTranslate(mat4x4 *m, float x, float y, float z)
void guMatrixTranslate(guMatrix4x4 *m, float x, float y, float z)
{
for (int i = 0; i < 4; i++)
{
m[i][3] += m[i][0] * x + m[i][1] * y + m[i][2] * z;
}
}

View File

@ -1,12 +1,26 @@
#ifndef MATRIXLIB_H
#define MATRIXLIB_H
#ifndef GLSLUTIL_H
#define GLSLUTIL_H
typedef float mat4x4[4][4];
#ifdef GL_INCLUDE_FILE
#include GL_INCLUDE_FILE
#else
#include <GL/gl.h>
#endif
void matrixLoadIdentity(mat4x4 *m);
void matrixMult(mat4x4 *m, mat4x4 *a, mat4x4 *b);
void matrixTranslate(mat4x4 *m, float x, float y, float z);
typedef float guMatrix4x4[4][4];
#ifdef __cplusplus
extern "C" {
#endif
void guMatrixLoadIdentity(guMatrix4x4 *m);
void guMatrixMult(guMatrix4x4 *m, guMatrix4x4 *a, guMatrix4x4 *b);
void guMatrixTranslate(guMatrix4x4 *m, float x, float y, float z);
#ifdef __cplusplus
}
#endif
#endif