[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42593] trunk/blender/intern/cycles/util/ util_transform.h: Fix #29594: cycles NaN values with window coordinates mapping.

Brecht Van Lommel brechtvanlommel at pandora.be
Tue Dec 13 01:00:27 CET 2011


Revision: 42593
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42593
Author:   blendix
Date:     2011-12-13 00:00:26 +0000 (Tue, 13 Dec 2011)
Log Message:
-----------
Fix #29594: cycles NaN values with window coordinates mapping.

Modified Paths:
--------------
    trunk/blender/intern/cycles/util/util_transform.h

Modified: trunk/blender/intern/cycles/util/util_transform.h
===================================================================
--- trunk/blender/intern/cycles/util/util_transform.h	2011-12-12 23:58:05 UTC (rev 42592)
+++ trunk/blender/intern/cycles/util/util_transform.h	2011-12-13 00:00:26 UTC (rev 42593)
@@ -41,8 +41,9 @@
 {
 	float4 b = make_float4(a.x, a.y, a.z, 1.0f);
 	float3 c = make_float3(dot(t->x, b), dot(t->y, b), dot(t->z, b));
+	float w = dot(t->w, b);
 
-	return c/dot(t->w, b);
+	return (w != 0.0f)? c/w: make_float3(0.0f, 0.0f, 0.0f);
 }
 
 __device_inline float3 transform_direction(const Transform *t, const float3 a)




More information about the Bf-blender-cvs mailing list