[Bf-blender-cvs] [d5edaac] master: Comments: mul_project_m4_v3_zfac
Campbell Barton
noreply at git.blender.org
Wed Dec 28 05:31:13 CET 2016
Commit: d5edaac42d3b49e1a9abef1f7bcc54fb6f067ef8
Author: Campbell Barton
Date: Wed Dec 28 15:35:59 2016 +1100
Branches: master
https://developer.blender.org/rBd5edaac42d3b49e1a9abef1f7bcc54fb6f067ef8
Comments: mul_project_m4_v3_zfac
===================================================================
M source/blender/blenlib/intern/math_vector_inline.c
===================================================================
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index e9fb77f..ee5e865 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -479,7 +479,18 @@ MINLINE void mul_v2_v2_ccw(float r[2], const float mat[2], const float vec[2])
r[1] = mat[1] * vec[0] + (+mat[0]) * vec[1];
}
-/* note: could add a matrix inline */
+/**
+ * Convenience function to get the projected depth of a position.
+ * This avoids creating a temporary 4D vector and multiplying it - only for the 4th component.
+ *
+ * Matches logic for:
+ *
+ * \code{.c}
+ * float co_4d[4] = {co[0], co[1], co[2], 1.0};
+ * mul_m4_v4(mat, co_4d);
+ * return co_4d[3];
+ * \endcode
+ */
MINLINE float mul_project_m4_v3_zfac(float mat[4][4], const float co[3])
{
return (mat[0][3] * co[0]) +
More information about the Bf-blender-cvs
mailing list