add initial glslUtil files
This commit is contained in:
parent
fecc8a0e44
commit
c1c42f3558
33
glslUtil/glslUtil.c
Normal file
33
glslUtil/glslUtil.c
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
#include "glslUtil.h"
|
||||||
|
|
||||||
|
void matrixLoadIdentity(mat4x4 *m)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 4; j++)
|
||||||
|
{
|
||||||
|
m[i][j] = (i == j) ? 1.0 : 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrixMult(mat4x4 *m, mat4x4 *a, mat4x4 *b)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 4; j++)
|
||||||
|
{
|
||||||
|
float v = 0.0;
|
||||||
|
for (int p = 0; p < 4; p++)
|
||||||
|
{
|
||||||
|
v += a[i][p] * b[p][j];
|
||||||
|
}
|
||||||
|
m[i][j] = v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrixTranslate(mat4x4 *m, float x, float y, float z)
|
||||||
|
{
|
||||||
|
}
|
12
glslUtil/glslUtil.h
Normal file
12
glslUtil/glslUtil.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
#ifndef MATRIXLIB_H
|
||||||
|
#define MATRIXLIB_H
|
||||||
|
|
||||||
|
typedef float mat4x4[4][4];
|
||||||
|
|
||||||
|
void matrixLoadIdentity(mat4x4 *m);
|
||||||
|
void matrixMult(mat4x4 *m, mat4x4 *a, mat4x4 *b);
|
||||||
|
void matrixTranslate(mat4x4 *m, float x, float y, float z);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user