mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-28 05:58:30 +00:00
Moved some functions to raymath
Exposed some raymath useful functions to raylib API
This commit is contained in:
38
src/rlgl.c
38
src/rlgl.c
@@ -360,10 +360,6 @@ static int GenerateMipmaps(unsigned char *data, int baseWidth, int baseHeight);
|
||||
static Color *GenNextMipmap(Color *srcData, int srcWidth, int srcHeight);
|
||||
#endif
|
||||
|
||||
#if defined(RLGL_STANDALONE)
|
||||
float *MatrixToFloat(Matrix mat); // Converts Matrix to float array
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Definition - Matrix operations
|
||||
//----------------------------------------------------------------------------------
|
||||
@@ -477,15 +473,15 @@ void rlScalef(float x, float y, float z)
|
||||
}
|
||||
|
||||
// Multiply the current matrix by another matrix
|
||||
void rlMultMatrixf(float *m)
|
||||
void rlMultMatrixf(float *mat)
|
||||
{
|
||||
// Matrix creation from array
|
||||
Matrix mat = { m[0], m[1], m[2], m[3],
|
||||
Matrix mat2 = { m[0], m[1], m[2], m[3],
|
||||
m[4], m[5], m[6], m[7],
|
||||
m[8], m[9], m[10], m[11],
|
||||
m[12], m[13], m[14], m[15] };
|
||||
|
||||
*currentMatrix = MatrixMultiply(*currentMatrix, mat);
|
||||
*currentMatrix = MatrixMultiply(*currentMatrix, mat2);
|
||||
}
|
||||
|
||||
// Multiply the current matrix by a perspective matrix generated by parameters
|
||||
@@ -4176,32 +4172,4 @@ void TraceLog(int msgType, const char *text, ...)
|
||||
|
||||
if (msgType == LOG_ERROR) exit(1);
|
||||
}
|
||||
|
||||
// Converts Matrix to float array
|
||||
// NOTE: Returned vector is a transposed version of the Matrix struct,
|
||||
// it should be this way because, despite raymath use OpenGL column-major convention,
|
||||
// Matrix struct memory alignment and variables naming are not coherent
|
||||
float *MatrixToFloat(Matrix mat)
|
||||
{
|
||||
static float buffer[16];
|
||||
|
||||
buffer[0] = mat.m0;
|
||||
buffer[1] = mat.m4;
|
||||
buffer[2] = mat.m8;
|
||||
buffer[3] = mat.m12;
|
||||
buffer[4] = mat.m1;
|
||||
buffer[5] = mat.m5;
|
||||
buffer[6] = mat.m9;
|
||||
buffer[7] = mat.m13;
|
||||
buffer[8] = mat.m2;
|
||||
buffer[9] = mat.m6;
|
||||
buffer[10] = mat.m10;
|
||||
buffer[11] = mat.m14;
|
||||
buffer[12] = mat.m3;
|
||||
buffer[13] = mat.m7;
|
||||
buffer[14] = mat.m11;
|
||||
buffer[15] = mat.m15;
|
||||
|
||||
return buffer;
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user