Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-12-28 07:35:59 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-12-28 07:49:39 +0300
commitd5edaac42d3b49e1a9abef1f7bcc54fb6f067ef8 (patch)
treee491741afd6b2ec6c4d2c15d1fac1f33d82976bf /source/blender
parentd874b40a555790d1ca08a930597f017e59a4b698 (diff)
Comments: mul_project_m4_v3_zfac
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenlib/intern/math_vector_inline.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index e9fb77f6302..ee5e8651bd3 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]) +