diff --git a/include/QF/mathlib.h b/include/QF/mathlib.h index bdade22a5..f6978ef50 100644 --- a/include/QF/mathlib.h +++ b/include/QF/mathlib.h @@ -632,6 +632,7 @@ void Mat4Transpose (const mat4_t a, mat4_t b); int Mat4Inverse (const mat4_t a, mat4_t b); void Mat4Mult (const mat4_t a, const mat4_t b, mat4_t c); void Mat4MultVec (const mat4_t a, const vec3_t b, vec3_t c); +void Mat4as3MultVec (const mat4_t a, const vec3_t b, vec3_t c); /** Decompose a column major matrix into its component transformations. This gives the matrix's rotation as a quaternion, shear, scale diff --git a/libs/util/mathlib.c b/libs/util/mathlib.c index 0c4428702..d5876b268 100644 --- a/libs/util/mathlib.c +++ b/libs/util/mathlib.c @@ -920,6 +920,17 @@ Mat4MultVec (const mat4_t a, const vec3_t b, vec3_t c) c[i] = a[i + 0] * tb[0] + a[i + 4] * b[1] + a[i + 8] * b[2] + a[i +12]; } +void +Mat4as3MultVec (const mat4_t a, const vec3_t b, vec3_t c) +{ + int i; + vec3_t tb; + + VectorCopy (b, tb); + for (i = 0; i < 3; i++) + c[i] = a[i + 0] * tb[0] + a[i + 4] * b[1] + a[i + 8] * b[2]; +} + int Mat4Decompose (const mat4_t mat, quat_t rot, vec3_t shear, vec3_t scale, vec3_t trans)