Move macros of matrix functions to C files

This commit is contained in:
twinaphex 2016-11-03 14:52:22 +01:00
parent cb23aec500
commit 19ee1a4751
4 changed files with 6 additions and 6 deletions

View File

@ -24,8 +24,10 @@
#include <math.h> #include <math.h>
#include <string.h> #include <string.h>
#define floats_are_equal(x, y) (fabs(x - y) <= 0.00001f * ((x) > (y) ? (y) : (x))) #define floats_are_equal(x, y) (fabs(x - y) <= 0.00001f * ((x) > (y) ? (y) : (x)))
#define float_is_zero(x) (floats_are_equal((x) + 1, 1)) #define float_is_zero(x) (floats_are_equal((x) + 1, 1))
#define MAT_ELEM_3X3(mat, r, c) ((mat).data[3 * (r) + (c)])
void matrix_3x3_identity(math_matrix_3x3 *mat) void matrix_3x3_identity(math_matrix_3x3 *mat)
{ {

View File

@ -26,6 +26,8 @@
#include <gfx/math/matrix_4x4.h> #include <gfx/math/matrix_4x4.h>
#include <gfx/math/vector_3.h> #include <gfx/math/vector_3.h>
#define MAT_ELEM_4X4(mat, r, c) ((mat).data[4 * (c) + (r)])
void matrix_4x4_copy(math_matrix_4x4 *dst, const math_matrix_4x4 *src) void matrix_4x4_copy(math_matrix_4x4 *dst, const math_matrix_4x4 *src)
{ {
unsigned i, j; unsigned i, j;

View File

@ -30,8 +30,6 @@ typedef struct math_matrix_3x3
float data[9]; float data[9];
} math_matrix_3x3; } math_matrix_3x3;
#define MAT_ELEM_3X3(mat, r, c) ((mat).data[3 * (r) + (c)])
void matrix_3x3_inits(math_matrix_3x3 *mat, void matrix_3x3_inits(math_matrix_3x3 *mat,
const float n11, const float n12, const float n13, const float n11, const float n12, const float n13,
const float n21, const float n22, const float n23, const float n21, const float n22, const float n23,

View File

@ -33,8 +33,6 @@ typedef struct math_matrix_4x4
float data[16]; float data[16];
} math_matrix_4x4; } math_matrix_4x4;
#define MAT_ELEM_4X4(mat, r, c) ((mat).data[4 * (c) + (r)])
void matrix_4x4_copy(math_matrix_4x4 *dst, const math_matrix_4x4 *src); void matrix_4x4_copy(math_matrix_4x4 *dst, const math_matrix_4x4 *src);
void matrix_4x4_identity(math_matrix_4x4 *mat); void matrix_4x4_identity(math_matrix_4x4 *mat);
void matrix_4x4_transpose(math_matrix_4x4 *out, const math_matrix_4x4 *in); void matrix_4x4_transpose(math_matrix_4x4 *out, const math_matrix_4x4 *in);