(libretro-common) Cleanups

This commit is contained in:
twinaphex 2017-04-16 05:06:15 +02:00
parent a86e6975cc
commit 8ac346be63
2 changed files with 32 additions and 27 deletions

View File

@ -26,21 +26,6 @@
#include <gfx/math/matrix_4x4.h> #include <gfx/math/matrix_4x4.h>
#include <gfx/math/vector_3.h> #include <gfx/math/vector_3.h>
/*
* Sets out to the transposed matrix of in
*/
void matrix_4x4_transpose(math_matrix_4x4 *out, const math_matrix_4x4 *in)
{
unsigned i, j;
math_matrix_4x4 mat;
for (i = 0; i < 4; i++)
for (j = 0; j < 4; j++)
MAT_ELEM_4X4(mat, j, i) = MAT_ELEM_4X4(*in, i, j);
*out = mat;
}
void matrix_4x4_lookat(math_matrix_4x4 *out, void matrix_4x4_lookat(math_matrix_4x4 *out,
vec3_t eye, vec3_t eye,
vec3_t center, vec3_t center,

View File

@ -81,7 +81,27 @@ typedef struct math_matrix_4x4
MAT_ELEM_4X4(mat, 3, 2) = 0.0f; \ MAT_ELEM_4X4(mat, 3, 2) = 0.0f; \
MAT_ELEM_4X4(mat, 3, 3) = 1.0f MAT_ELEM_4X4(mat, 3, 3) = 1.0f
void matrix_4x4_transpose(math_matrix_4x4 *out, const math_matrix_4x4 *in); /*
* Sets out to the transposed matrix of in
*/
#define matrix_4x4_transpose(out, in) \
MAT_ELEM_4X4(out, 0, 0) = MAT_ELEM_4X4(in, 0, 0); \
MAT_ELEM_4X4(out, 1, 0) = MAT_ELEM_4X4(in, 0, 1); \
MAT_ELEM_4X4(out, 2, 0) = MAT_ELEM_4X4(in, 0, 2); \
MAT_ELEM_4X4(out, 3, 0) = MAT_ELEM_4X4(in, 0, 3); \
MAT_ELEM_4X4(out, 0, 1) = MAT_ELEM_4X4(in, 1, 0); \
MAT_ELEM_4X4(out, 1, 1) = MAT_ELEM_4X4(in, 1, 1); \
MAT_ELEM_4X4(out, 2, 1) = MAT_ELEM_4X4(in, 1, 2); \
MAT_ELEM_4X4(out, 3, 1) = MAT_ELEM_4X4(in, 1, 3); \
MAT_ELEM_4X4(out, 0, 2) = MAT_ELEM_4X4(in, 2, 0); \
MAT_ELEM_4X4(out, 1, 2) = MAT_ELEM_4X4(in, 2, 1); \
MAT_ELEM_4X4(out, 2, 2) = MAT_ELEM_4X4(in, 2, 2); \
MAT_ELEM_4X4(out, 3, 2) = MAT_ELEM_4X4(in, 2, 3); \
MAT_ELEM_4X4(out, 0, 3) = MAT_ELEM_4X4(in, 3, 0); \
MAT_ELEM_4X4(out, 1, 3) = MAT_ELEM_4X4(in, 3, 1); \
MAT_ELEM_4X4(out, 2, 3) = MAT_ELEM_4X4(in, 3, 2); \
MAT_ELEM_4X4(out, 3, 3) = MAT_ELEM_4X4(in, 3, 3)
/* /*
* Builds an X-axis rotation matrix * Builds an X-axis rotation matrix