fixing windows things that broke when fixing linux

This commit is contained in:
zeromus 2008-09-08 08:22:19 +00:00
parent fa04607aa5
commit 83b753ae11
3 changed files with 25 additions and 19 deletions

View File

@ -33,7 +33,7 @@ void MatrixInit (float *matrix)
} }
#ifndef SSE2 #ifndef SSE2
void FASTCALL MatrixMultVec4x4 (const float *matrix, float *vecPtr) void MATRIXFASTCALL MatrixMultVec4x4 (const float *matrix, float *vecPtr)
{ {
float x = vecPtr[0]; float x = vecPtr[0];
float y = vecPtr[1]; float y = vecPtr[1];
@ -46,7 +46,7 @@ void FASTCALL MatrixMultVec4x4 (const float *matrix, float *vecPtr)
vecPtr[3] = x * matrix[3] + y * matrix[7] + z * matrix[11] + w * matrix[15]; vecPtr[3] = x * matrix[3] + y * matrix[7] + z * matrix[11] + w * matrix[15];
} }
void FASTCALL MatrixMultVec3x3 (const float *matrix, float *vecPtr) void MATRIXFASTCALL MatrixMultVec3x3 (const float *matrix, float *vecPtr)
{ {
float x = vecPtr[0]; float x = vecPtr[0];
float y = vecPtr[1]; float y = vecPtr[1];
@ -57,7 +57,7 @@ void FASTCALL MatrixMultVec3x3 (const float *matrix, float *vecPtr)
vecPtr[2] = x * matrix[2] + y * matrix[6] + z * matrix[10]; vecPtr[2] = x * matrix[2] + y * matrix[6] + z * matrix[10];
} }
void FASTCALL MatrixMultiply (float *matrix, const float *rightMatrix) void MATRIXFASTCALL MatrixMultiply (float *matrix, const float *rightMatrix)
{ {
float tmpMatrix[16]; float tmpMatrix[16];
@ -84,7 +84,7 @@ void FASTCALL MatrixMultiply (float *matrix, const float *rightMatrix)
memcpy (matrix, tmpMatrix, sizeof(float)*16); memcpy (matrix, tmpMatrix, sizeof(float)*16);
} }
void FASTCALL MatrixTranslate (float *matrix, const float *ptr) void MATRIXFASTCALL MatrixTranslate (float *matrix, const float *ptr)
{ {
matrix[12] += (matrix[0]*ptr[0])+(matrix[4]*ptr[1])+(matrix[ 8]*ptr[2]); matrix[12] += (matrix[0]*ptr[0])+(matrix[4]*ptr[1])+(matrix[ 8]*ptr[2]);
matrix[13] += (matrix[1]*ptr[0])+(matrix[5]*ptr[1])+(matrix[ 9]*ptr[2]); matrix[13] += (matrix[1]*ptr[0])+(matrix[5]*ptr[1])+(matrix[ 9]*ptr[2]);
@ -92,7 +92,7 @@ void FASTCALL MatrixTranslate (float *matrix, const float *ptr)
matrix[15] += (matrix[3]*ptr[0])+(matrix[7]*ptr[1])+(matrix[11]*ptr[2]); matrix[15] += (matrix[3]*ptr[0])+(matrix[7]*ptr[1])+(matrix[11]*ptr[2]);
} }
void FASTCALL MatrixScale (float *matrix, const float *ptr) void MATRIXFASTCALL MatrixScale (float *matrix, const float *ptr)
{ {
matrix[0] *= ptr[0]; matrix[0] *= ptr[0];
matrix[1] *= ptr[0]; matrix[1] *= ptr[0];
@ -125,13 +125,13 @@ void MatrixTranspose(float *matrix)
#undef swap #undef swap
} }
void FASTCALL MatrixIdentity (float *matrix) //============== TODO void MATRIXFASTCALL MatrixIdentity (float *matrix) //============== TODO
{ {
memset (matrix, 0, sizeof(float)*16); memset (matrix, 0, sizeof(float)*16);
matrix[0] = matrix[5] = matrix[10] = matrix[15] = 1.f; matrix[0] = matrix[5] = matrix[10] = matrix[15] = 1.f;
} }
float FASTCALL MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix) float MATRIXFASTCALL MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix)
{ {
int iMod = index%4, iDiv = (index>>2)<<2; int iMod = index%4, iDiv = (index>>2)<<2;
@ -139,12 +139,12 @@ float FASTCALL MatrixGetMultipliedIndex (int index, float *matrix, float *rightM
(matrix[iMod+8]*rightMatrix[iDiv+2])+(matrix[iMod+12]*rightMatrix[iDiv+3]); (matrix[iMod+8]*rightMatrix[iDiv+2])+(matrix[iMod+12]*rightMatrix[iDiv+3]);
} }
void FASTCALL MatrixSet (float *matrix, int x, int y, float value) // TODO void MATRIXFASTCALL MatrixSet (float *matrix, int x, int y, float value) // TODO
{ {
matrix [x+(y<<2)] = value; matrix [x+(y<<2)] = value;
} }
void FASTCALL MatrixCopy (float* matrixDST, const float* matrixSRC) void MATRIXFASTCALL MatrixCopy (float* matrixDST, const float* matrixSRC)
{ {
memcpy ((void*)matrixDST, matrixSRC, sizeof(float)*16); memcpy ((void*)matrixDST, matrixSRC, sizeof(float)*16);
} }

View File

@ -47,15 +47,21 @@ typedef struct MatrixStack
void MatrixInit (float *matrix); void MatrixInit (float *matrix);
void FASTCALL MatrixMultVec3x3 (const float * matrix, float * vecPtr); #ifdef _MSC_VER
void FASTCALL MatrixMultVec4x4 (const float * matrix, float * vecPtr); #define MATRIXFASTCALL __fastcall
void FASTCALL MatrixMultiply (float * matrix, const float * rightMatrix); #else
void FASTCALL MatrixTranslate (float *matrix, const float *ptr); #define MATRIXFASTCALL
void FASTCALL MatrixScale (float * matrix, const float * ptr); #endif
float FASTCALL MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix);
void FASTCALL MatrixSet (float *matrix, int x, int y, float value); void MATRIXFASTCALL MatrixMultVec3x3 (const float * matrix, float * vecPtr);
void FASTCALL MatrixCopy (float * matrixDST, const float * matrixSRC); void MATRIXFASTCALL MatrixMultVec4x4 (const float * matrix, float * vecPtr);
void FASTCALL MatrixIdentity (float *matrix); void MATRIXFASTCALL MatrixMultiply (float * matrix, const float * rightMatrix);
void MATRIXFASTCALL MatrixTranslate (float *matrix, const float *ptr);
void MATRIXFASTCALL MatrixScale (float * matrix, const float * ptr);
float MATRIXFASTCALL MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix);
void MATRIXFASTCALL MatrixSet (float *matrix, int x, int y, float value);
void MATRIXFASTCALL MatrixCopy (float * matrixDST, const float * matrixSRC);
void MATRIXFASTCALL MatrixIdentity (float *matrix);
void MatrixTranspose (float *matrix); void MatrixTranspose (float *matrix);
void MatrixStackInit (MatrixStack *stack); void MatrixStackInit (MatrixStack *stack);

View File

@ -28,7 +28,7 @@
#elif defined (__i386__) #elif defined (__i386__)
#define FASTCALL __attribute__((regparm(3))) #define FASTCALL __attribute__((regparm(3)))
#elif defined _MSC_VER #elif defined _MSC_VER
#define FASTCALL __fastcall #define FASTCALL
#else #else
#define FASTCALL #define FASTCALL
#endif #endif