mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
Add Mat4as3MultVec.
to transform a vertex without the translation (eg, for normals) without having to have separate matrices.
This commit is contained in:
parent
0fbaa2a88a
commit
b5add680f7
2 changed files with 12 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue