ref: a458bd7e8689e64876f30353c6a0ea8bc7233fd4
parent: 4e839fac0e65d405d1d4c7edf3107cafbce1e2b8
author: MHS <gek@katherine>
date: Tue Mar 23 09:46:11 EDT 2021
Automatic commit.
--- a/src/zmath.c
+++ b/src/zmath.c
@@ -19,8 +19,16 @@
a->m[i][j] = 0.0;
}
-int gl_M4_IsId(M4* a) {
- GLint i, j;
+GLint gl_M4_IsId(M4* a) {
+ //GLint i, j;
+ const M4 c = (M4){{
+ {1,0,0,0},
+ {0,1,0,0},
+ {0,0,1,0},
+ {0,0,0,1},}
+ };
+ return (memcmp(a->m,c.m, 16 * sizeof(GLfloat)) == 0);
+/*
for (i = 0; i < 4; i++)
for (j = 0; j < 4; j++) {
if (i == j) {
@@ -30,6 +38,7 @@
return 0;
}
return 1;
+*/
}
void gl_M4_Mul(M4* c, M4* a, M4* b) {
@@ -139,7 +148,7 @@
/* Inversion of a general nxn matrix.
Note : m is destroyed */
-int Matrix_Inv(GLfloat* r, GLfloat* m, GLint n) {
+GLint Matrix_Inv(GLfloat* r, GLfloat* m, GLint n) {
GLint i, j, k, l;
GLfloat max, tmp, t;
--- a/src/zmath.h
+++ b/src/zmath.h
@@ -33,7 +33,7 @@
} V4;
void gl_M4_Id(M4* a);
-int gl_M4_IsId(M4* a);
+GLint gl_M4_IsId(M4* a);
void gl_M4_Move(M4* a, M4* b);
void gl_MoveV3(V3* a, V3* b);
void gl_MulM4V3(V3* a, M4* b, V3* c);
@@ -54,7 +54,7 @@
V3 gl_V3_New(GLfloat x, GLfloat y, GLfloat z);
V4 gl_V4_New(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-int gl_Matrix_Inv(GLfloat* r, GLfloat* m, GLint n);
+GLint gl_Matrix_Inv(GLfloat* r, GLfloat* m, GLint n);
/*
static inline GLfloat fastInvSqrt(float x){
@@ -88,7 +88,7 @@
#endif
-static inline int gl_V3_Norm_Fast(V3* a) {
+static inline GLint gl_V3_Norm_Fast(V3* a) {
GLfloat n;
#if TGL_FEATURE_FISR == 1
n = fastInvSqrt(a->X * a->X + a->Y * a->Y + a->Z * a->Z); //FISR