Complementary fix for rB8054372: Follow the common naming scheme by
authorLukas Tönne <lukas.toenne@gmail.com>
Thu, 30 Oct 2014 14:26:41 +0000 (15:26 +0100)
committerLukas Tönne <lukas.toenne@gmail.com>
Thu, 30 Oct 2014 14:31:18 +0000 (15:31 +0100)
using negate_mat3_m4 instead of negate_m4.

This avoids changing the behavior and only flips the 3x3 part of the
matrix.

source/blender/blenlib/BLI_math_matrix.h
source/blender/blenlib/intern/math_matrix.c
source/blender/editors/object/object_bake_api.c

index ee8b53037b0e035a88ad23c5c0e30a3526589451..45972d03175034a982bae624a822498002689432 100644 (file)
@@ -126,6 +126,7 @@ void mul_m4_fl(float R[4][4], float f);
 void mul_mat3_m4_fl(float R[4][4], float f);
 
 void negate_m3(float R[3][3]);
+void negate_mat3_m4(float R[4][4]);
 void negate_m4(float R[4][4]);
 
 bool invert_m3_ex(float m[3][3], const float epsilon);
index fb04271fedd0d7217ebf45e0205f2ca56d4530bd..0204c3bc86c9659e6f5bdf6a2bfa298d6658eb6e 100644 (file)
@@ -648,6 +648,15 @@ void negate_m3(float m[3][3])
                        m[i][j] *= -1.0f;
 }
 
+void negate_mat3_m4(float m[4][4])
+{
+       int i, j;
+
+       for (i = 0; i < 3; i++)
+               for (j = 0; j < 3; j++)
+                       m[i][j] *= -1.0f;
+}
+
 void negate_m4(float m[4][4])
 {
        int i, j;
index 4821ffd4119addc0f20800697de83ba7990ba03c..57fabcb06cfc8dbc394e1fb92f69086189d92466 100644 (file)
@@ -768,7 +768,7 @@ static int bake(
                        normalize_m4_m4(highpoly[i].rotmat, highpoly[i].imat);
                        zero_v3(highpoly[i].rotmat[3]);
                        if (is_negative_m4(highpoly[i].rotmat))
-                               negate_m4(highpoly[i].rotmat);
+                               negate_mat3_m4(highpoly[i].rotmat);
 
                        i++;
                }