[Bf-blender-cvs] [775a544] master: Math Lib: add mul_v3_project_m4_v3

Campbell Barton noreply at git.blender.org
Tue Sep 16 07:46:03 CEST 2014


Commit: 775a54485b09526b806f6a327c2737dc4bde80a8
Author: Campbell Barton
Date:   Tue Sep 16 15:41:17 2014 +1000
Branches: master
https://developer.blender.org/rB775a54485b09526b806f6a327c2737dc4bde80a8

Math Lib: add mul_v3_project_m4_v3

===================================================================

M	source/blender/blenlib/BLI_math_matrix.h
M	source/blender/blenlib/intern/math_matrix.c

===================================================================

diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 0eac92c..732f4b6 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -109,6 +109,7 @@ void mul_mat3_m4_v3(float M[4][4], float r[3]);
 void mul_m4_v4(float M[4][4], float r[4]);
 void mul_v4_m4v4(float r[4], float M[4][4], const float v[4]);
 void mul_project_m4_v3(float M[4][4], float vec[3]);
+void mul_v3_project_m4_v3(float r[3], float mat[4][4], const float vec[3]);
 void mul_v2_project_m4_v3(float r[2], float M[4][4], const float vec[3]);
 
 void mul_m3_v2(float m[3][3], float r[2]);
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 888587e..af42af8 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -514,6 +514,16 @@ void mul_project_m4_v3(float mat[4][4], float vec[3])
 	vec[2] /= w;
 }
 
+void mul_v3_project_m4_v3(float r[3], float mat[4][4], const float vec[3])
+{
+	const float w = mul_project_m4_v3_zfac(mat, vec);
+	mul_v3_m4v3(r, mat, vec);
+
+	r[0] /= w;
+	r[1] /= w;
+	r[2] /= w;
+}
+
 void mul_v2_project_m4_v3(float r[2], float mat[4][4], const float vec[3])
 {
 	const float w = mul_project_m4_v3_zfac(mat, vec);




More information about the Bf-blender-cvs mailing list