Browse Source

another hack

cxgeorge 25 years ago
parent
commit
ed6aa9f28d
2 changed files with 2 additions and 2 deletions
  1. 1 1
      panda/src/linmath/lmatrix3_src.I
  2. 1 1
      panda/src/linmath/lmatrix4_src.I

+ 1 - 1
panda/src/linmath/lmatrix3_src.I

@@ -786,7 +786,7 @@ rotate_mat(FLOATTYPE angle, FLOATNAME(LVecBase3) axis,
   // which is what we usually pass in anyway. screws up if you happen to
   // which is what we usually pass in anyway. screws up if you happen to
   // pass in something like (.5,.5,0).  need to add flag parameter so caller
   // pass in something like (.5,.5,0).  need to add flag parameter so caller
   // can request normalization if needed
   // can request normalization if needed
-  if((axis_0+axis_1+axis_2) != 1.0) {
+  if((cabs(axis_0)+cabs(axis_1)+cabs(axis_2)) != 1.0) {
 	  FLOATTYPE length_sq = axis_0 * axis_0 + axis_1 * axis_1 + axis_2 * axis_2;
 	  FLOATTYPE length_sq = axis_0 * axis_0 + axis_1 * axis_1 + axis_2 * axis_2;
 	  #ifdef _DEBUG
 	  #ifdef _DEBUG
 	      nassertr(length_sq != 0.0, ident_mat());
 	      nassertr(length_sq != 0.0, ident_mat());

+ 1 - 1
panda/src/linmath/lmatrix4_src.I

@@ -1143,7 +1143,7 @@ rotate_mat(FLOATTYPE angle, FLOATNAME(LVecBase3) axis,
   // which is what we usually pass in anyway. screws up if you happen to
   // which is what we usually pass in anyway. screws up if you happen to
   // pass in something like (.5,.5,0).  need to add flag parameter so caller
   // pass in something like (.5,.5,0).  need to add flag parameter so caller
   // can request normalization if needed
   // can request normalization if needed
-  if((axis_0+axis_1+axis_2) != 1.0) {
+  if((cabs(axis_0)+cabs(axis_1)+cabs(axis_2)) != 1.0) {
 	  FLOATTYPE length_sq = axis_0 * axis_0 + axis_1 * axis_1 + axis_2 * axis_2;
 	  FLOATTYPE length_sq = axis_0 * axis_0 + axis_1 * axis_1 + axis_2 * axis_2;
 	  #ifdef _DEBUG
 	  #ifdef _DEBUG
 	      nassertr(length_sq != 0.0, ident_mat());
 	      nassertr(length_sq != 0.0, ident_mat());