From 7e0f9229d6e9133338c6e5170699722989b1b8d5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 16 Nov 2010 01:19:37 +0000 Subject: fix for fix, r33086. - incorrect range check broke ZYX euler rotations, use MIN/MAX constants so this doesn't happen again. - BGE Armature PyAPI also wasn't using correct min/max with rotation modes. - clamp on file read rather then when calling the rotation functions, so developers don't use invalid args without realizing it. - added assert() checks for debug builds so invalid axis constants don't slip through. --- source/blender/blenlib/intern/math_matrix.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender/blenlib/intern/math_matrix.c') diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 58fb3b9b76b..d2bd7a0a2b1 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -25,7 +25,7 @@ * ***** END GPL LICENSE BLOCK ***** */ - +#include #include "BLI_math.h" /********************************* Init **************************************/ @@ -1041,6 +1041,8 @@ void rotate_m4(float mat[][4], const char axis, const float angle) float temp[4]= {0.0f, 0.0f, 0.0f, 0.0f}; float cosine, sine; + assert(axis >= 'X' && axis <= 'Z'); + cosine = (float)cos(angle); sine = (float)sin(angle); switch(axis){ -- cgit v1.2.3