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:
authorMike Erwin <significant.bit@gmail.com>2016-09-25 15:27:48 +0300
committerMike Erwin <significant.bit@gmail.com>2016-09-25 15:27:48 +0300
commit5c6baf1ee9754e39392926cd077bb2097baf39b9 (patch)
tree06019e8c6e19fdf7a24d66c2c18aace9f1b95b35 /source/blender/blenlib/BLI_math_matrix.h
parentaddc666999255ae908cec63af18da2db4001e90b (diff)
specialize mat4 multiply routines
mul_m4_m4m4(R, A, B) gives us R = AB in general. Existing code assumed the worst, that A and B both alias the output R. For safety it makes internal copies of A and B before calculating & writing R. This is the least common case. Usually all 3 matrices differ. Often we see M = AM or M = MB, but never M = MM. With this revision mul_m4_m4m4 is called in exactly the same way but copies inputs only when needed. If you know the inputs are independent of the output use the "uniq" variant to skip the saftety checks.
Diffstat (limited to 'source/blender/blenlib/BLI_math_matrix.h')
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 6388105032a..a5868e00c8e 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -72,6 +72,11 @@ void mul_m4_m4m3(float R[4][4], const float A[4][4], const float B[3][3]);
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4]);
void mul_m3_m3m4(float R[3][3], const float A[4][4], const float B[3][3]);
+/* special matrix multiplies */
+void mul_m4_m4m4_uniq(float R[4][4], const float A[4][4], const float B[4][4]); /* R <-- AB, R is neither A nor B */
+void mul_m4_m4_pre(float R[4][4], const float A[4][4]); /* R <-- AR */
+void mul_m4_m4_post(float R[4][4], const float B[4][4]); /* R <-- RB */
+
/* mul_m3_series */
void _va_mul_m3_series_3(float R[3][3], float M1[3][3], float M2[3][3]) ATTR_NONNULL();
void _va_mul_m3_series_4(float R[3][3], float M1[3][3], float M2[3][3], float M3[3][3]) ATTR_NONNULL();