[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27280] trunk/blender/source/blender/ blenlib/intern/math_geom.c: Fix #21458: tangent space normal maps didn' t work correct in some
Brecht Van Lommel
brecht at blender.org
Fri Mar 5 16:36:05 CET 2010
Revision: 27280
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27280
Author: blendix
Date: 2010-03-05 16:36:05 +0100 (Fri, 05 Mar 2010)
Log Message:
-----------
Fix #21458: tangent space normal maps didn't work correct in some
cases due to recent fix to avoid division by zero.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/intern/math_geom.c
Modified: trunk/blender/source/blender/blenlib/intern/math_geom.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_geom.c 2010-03-05 15:16:37 UTC (rev 27279)
+++ trunk/blender/source/blender/blenlib/intern/math_geom.c 2010-03-05 15:36:05 UTC (rev 27280)
@@ -1852,11 +1852,13 @@
float s2= uv3[0] - uv1[0];
float t1= uv2[1] - uv1[1];
float t2= uv3[1] - uv1[1];
+ float det= (s1 * t2 - s2 * t1);
- if(s1 && s2 && t1 && t2) { /* otherwise 'tang' becomes nan */
- float tangv[3], ct[3], e1[3], e2[3], det;
- det= 1.0f / (s1 * t2 - s2 * t1);
+ if(det != 0.0f) { /* otherwise 'tang' becomes nan */
+ float tangv[3], ct[3], e1[3], e2[3];
+ det= 1.0f/det;
+
/* normals in render are inversed... */
sub_v3_v3v3(e1, co1, co2);
sub_v3_v3v3(e2, co1, co3);
More information about the Bf-blender-cvs
mailing list