some matrix code cleanup leftover from olden times of more floating point in gfx3d
This commit is contained in:
parent
55c0d8e32f
commit
b547e6bd3b
|
@ -139,17 +139,17 @@ void MatrixScale (float *matrix, const float *ptr)
|
||||||
|
|
||||||
void MatrixInit (s32 *matrix)
|
void MatrixInit (s32 *matrix)
|
||||||
{
|
{
|
||||||
memset (matrix, 0, sizeof(float)*16);
|
memset (matrix, 0, sizeof(s32)*16);
|
||||||
matrix[0] = matrix[5] = matrix[10] = matrix[15] = 1<<12;
|
matrix[0] = matrix[5] = matrix[10] = matrix[15] = 1<<12;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatrixInit (float *matrix)
|
void MatrixInit (float *matrix)
|
||||||
{
|
{
|
||||||
memset (matrix, 0, sizeof(float)*16);
|
memset (matrix, 0, sizeof(s32)*16);
|
||||||
matrix[0] = matrix[5] = matrix[10] = matrix[15] = 1.f;
|
matrix[0] = matrix[5] = matrix[10] = matrix[15] = 1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatrixTranspose(float *matrix)
|
void MatrixTranspose(s32 *matrix)
|
||||||
{
|
{
|
||||||
float temp;
|
float temp;
|
||||||
#define swap(A,B) temp = matrix[A];matrix[A] = matrix[B]; matrix[B] = temp;
|
#define swap(A,B) temp = matrix[A];matrix[A] = matrix[B]; matrix[B] = temp;
|
||||||
|
@ -169,21 +169,6 @@ void MatrixIdentity (s32 *matrix)
|
||||||
matrix[11] = matrix[12] = matrix[13] = matrix[14] = 0;
|
matrix[11] = matrix[12] = matrix[13] = matrix[14] = 0;
|
||||||
matrix[0] = matrix[5] = matrix[10] = matrix[15] = 1<<12;
|
matrix[0] = matrix[5] = matrix[10] = matrix[15] = 1<<12;
|
||||||
}
|
}
|
||||||
void MatrixIdentity (float *matrix)
|
|
||||||
{
|
|
||||||
matrix[1] = matrix[2] = matrix[3] = matrix[4] = 0.0f;
|
|
||||||
matrix[6] = matrix[7] = matrix[8] = matrix[9] = 0.0f;
|
|
||||||
matrix[11] = matrix[12] = matrix[13] = matrix[14] = 0.0f;
|
|
||||||
matrix[0] = matrix[5] = matrix[10] = matrix[15] = 1.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
float MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix)
|
|
||||||
{
|
|
||||||
int iMod = index%4, iDiv = (index>>2)<<2;
|
|
||||||
|
|
||||||
return (matrix[iMod ]*rightMatrix[iDiv ])+(matrix[iMod+ 4]*rightMatrix[iDiv+1])+
|
|
||||||
(matrix[iMod+8]*rightMatrix[iDiv+2])+(matrix[iMod+12]*rightMatrix[iDiv+3]);
|
|
||||||
}
|
|
||||||
|
|
||||||
s32 MatrixGetMultipliedIndex (int index, s32 *matrix, s32 *rightMatrix)
|
s32 MatrixGetMultipliedIndex (int index, s32 *matrix, s32 *rightMatrix)
|
||||||
{
|
{
|
||||||
|
@ -195,7 +180,7 @@ s32 MatrixGetMultipliedIndex (int index, s32 *matrix, s32 *rightMatrix)
|
||||||
return (s32)(temp>>12);
|
return (s32)(temp>>12);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatrixSet (float *matrix, int x, int y, float value) // TODO
|
void MatrixSet (s32 *matrix, int x, int y, s32 value)
|
||||||
{
|
{
|
||||||
matrix [x+(y<<2)] = value;
|
matrix [x+(y<<2)] = value;
|
||||||
}
|
}
|
||||||
|
@ -226,9 +211,9 @@ void MatrixCopy (s32* matrixDST, const s32* matrixSRC)
|
||||||
memcpy(matrixDST,matrixSRC,sizeof(s32)*16);
|
memcpy(matrixDST,matrixSRC,sizeof(s32)*16);
|
||||||
}
|
}
|
||||||
|
|
||||||
int MatrixCompare (const float* matrixDST, const float* matrixSRC)
|
int MatrixCompare (const s32* matrixDST, const s32* matrixSRC)
|
||||||
{
|
{
|
||||||
return memcmp((void*)matrixDST, matrixSRC, sizeof(float)*16);
|
return memcmp((void*)matrixDST, matrixSRC, sizeof(s32)*16);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatrixStackInit(MatrixStack *stack)
|
void MatrixStackInit(MatrixStack *stack)
|
||||||
|
|
|
@ -50,14 +50,12 @@ void MatrixInit (s32 *matrix);
|
||||||
|
|
||||||
float MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix);
|
float MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix);
|
||||||
s32 MatrixGetMultipliedIndex (int index, s32 *matrix, s32 *rightMatrix);
|
s32 MatrixGetMultipliedIndex (int index, s32 *matrix, s32 *rightMatrix);
|
||||||
void MatrixSet (float *matrix, int x, int y, float value);
|
void MatrixSet (s32 *matrix, int x, int y, s32 value);
|
||||||
void MatrixCopy (float * matrixDST, const float * matrixSRC);
|
|
||||||
void MatrixCopy (s32 * matrixDST, const s32 * matrixSRC);
|
void MatrixCopy (s32 * matrixDST, const s32 * matrixSRC);
|
||||||
int MatrixCompare (const float * matrixDST, const float * matrixSRC);
|
int MatrixCompare (const s32 * matrixDST, const float * matrixSRC);
|
||||||
void MatrixIdentity (float *matrix);
|
|
||||||
void MatrixIdentity (s32 *matrix);
|
void MatrixIdentity (s32 *matrix);
|
||||||
|
|
||||||
void MatrixTranspose (float *matrix);
|
void MatrixTranspose (s32 *matrix);
|
||||||
void MatrixStackInit (MatrixStack *stack);
|
void MatrixStackInit (MatrixStack *stack);
|
||||||
void MatrixStackSetMaxSize (MatrixStack *stack, int size);
|
void MatrixStackSetMaxSize (MatrixStack *stack, int size);
|
||||||
void MatrixStackPushMatrix (MatrixStack *stack, const s32 *ptr);
|
void MatrixStackPushMatrix (MatrixStack *stack, const s32 *ptr);
|
||||||
|
|
Loading…
Reference in New Issue