git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2804
d7cf8633-e32d-0410-b094-
e92efae38249
Matrix4x4_Concat(out, &base, &temp);
}
+void Matrix4x4_OriginFromMatrix (const matrix4x4_t *in, float *out)
+{
+ out[0] = in->m[0][3];
+ out[1] = in->m[1][3];
+ out[2] = in->m[2][3];
+}
+
+float Matrix4x4_ScaleFromMatrix (const matrix4x4_t *in)
+{
+ // we only support uniform scaling, so assume the first row is enough
+ return sqrt(in->m[0][0] * in->m[0][0] + in->m[0][1] * in->m[0][1] + in->m[0][2] * in->m[0][2]);
+}
+
// immediately applies a Scale3 to the matrix
void Matrix4x4_ConcatScale3 (matrix4x4_t *out, float x, float y, float z);
+// extracts origin vector (translate) from matrix
+void Matrix4x4_OriginFromMatrix (const matrix4x4_t *in, float *out);
+// extracts scaling factor from matrix (only works for uniform scaling)
+float Matrix4x4_ScaleFromMatrix (const matrix4x4_t *in);
+
#endif