mirror of
https://github.com/recp/cglm.git
synced 2025-10-04 17:09:40 +00:00
move mat3 print to util and insert mat3 to default header
This commit is contained in:
@@ -148,34 +148,4 @@ glm_mat3_mulv(mat3 m, vec3 v, vec3 dest) {
|
|||||||
dest[2] = m[0][2] * v[0] + m[1][2] * v[1] + m[2][2] * v[2];
|
dest[2] = m[0][2] * v[0] + m[1][2] * v[1] + m[2][2] * v[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
CGLM_INLINE
|
|
||||||
void
|
|
||||||
glm_mat3_print(mat3 matrix,
|
|
||||||
FILE * __restrict ostream) {
|
|
||||||
int i;
|
|
||||||
int j;
|
|
||||||
|
|
||||||
#define m 3
|
|
||||||
#define n 3
|
|
||||||
|
|
||||||
fprintf(ostream, "Matrix (float%dx%d):\n", m, n);
|
|
||||||
|
|
||||||
for (i = 0; i < m; i++) {
|
|
||||||
fprintf(ostream, "\t|");
|
|
||||||
for (j = 0; j < n; j++) {
|
|
||||||
fprintf(ostream, "%0.4f", matrix[j][i]);;
|
|
||||||
|
|
||||||
if (j != n - 1)
|
|
||||||
fprintf(ostream, "\t");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(ostream, "|\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(ostream, "\n");
|
|
||||||
|
|
||||||
#undef m
|
|
||||||
#undef n
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* cglm_mat3_h */
|
#endif /* cglm_mat3_h */
|
||||||
|
@@ -42,6 +42,36 @@ glm_mat4_print(mat4 matrix,
|
|||||||
#undef n
|
#undef n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGLM_INLINE
|
||||||
|
void
|
||||||
|
glm_mat3_print(mat3 matrix,
|
||||||
|
FILE * __restrict ostream) {
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
|
||||||
|
#define m 3
|
||||||
|
#define n 3
|
||||||
|
|
||||||
|
fprintf(ostream, "Matrix (float%dx%d):\n", m, n);
|
||||||
|
|
||||||
|
for (i = 0; i < m; i++) {
|
||||||
|
fprintf(ostream, "\t|");
|
||||||
|
for (j = 0; j < n; j++) {
|
||||||
|
fprintf(ostream, "%0.4f", matrix[j][i]);;
|
||||||
|
|
||||||
|
if (j != n - 1)
|
||||||
|
fprintf(ostream, "\t");
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(ostream, "|\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(ostream, "\n");
|
||||||
|
|
||||||
|
#undef m
|
||||||
|
#undef n
|
||||||
|
}
|
||||||
|
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
glm_vec4_print(vec4 vec,
|
glm_vec4_print(vec4 vec,
|
||||||
|
@@ -20,6 +20,7 @@ typedef vec4 versor;
|
|||||||
|
|
||||||
#include "cglm-vec.h"
|
#include "cglm-vec.h"
|
||||||
#include "cglm-mat.h"
|
#include "cglm-mat.h"
|
||||||
|
#include "cglm-mat3.h"
|
||||||
#include "cglm-util.h"
|
#include "cglm-util.h"
|
||||||
#include "cglm-affine.h"
|
#include "cglm-affine.h"
|
||||||
#include "cglm-cam.h"
|
#include "cglm-cam.h"
|
||||||
|
Reference in New Issue
Block a user