Fix some bugs in the new matrix functions/macros.

This commit is contained in:
Bill Currie 2011-12-31 13:20:31 +09:00
parent 55e53b796d
commit ea2ae1436c
2 changed files with 3 additions and 1 deletions

View file

@ -314,7 +314,7 @@ extern const vec_t *const quat_origin;
QuatCompMult ((a) + 12, (b) + 12, (c) + 12); \
} while (0)
#define Mat4Zero(a) \
memset (a, 0, sizeof (16 * sizeof a[0]))
memset (a, 0, 16 * sizeof a[0])
#define Mat4Identity(a) \
do { \
Mat4Zero (a); \

View file

@ -703,12 +703,14 @@ Mat4Transpose (const mat4_t a, mat4_t b)
int i, j;
for (i = 0; i < 3; i++) {
b[i * 4 + i] = a[i * 4 + i]; // in case b != a
for (j = i + 1; j < 4; j++) {
t = a[i * 4 + j]; // in case b == a
b[i * 4 + j] = a[j * 4 + i];
b[j * 4 + i] = t;
}
}
b[i * 4 + i] = a[i * 4 + i]; // in case b != a
}
void