[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54564] trunk/blender/intern/cycles/util/ util_boundbox.h: Fix cycles hair curves with NaN values not rendering with dynamic BVH.

Brecht Van Lommel brechtvanlommel at pandora.be
Thu Feb 14 22:40:28 CET 2013


Revision: 54564
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54564
Author:   blendix
Date:     2013-02-14 21:40:28 +0000 (Thu, 14 Feb 2013)
Log Message:
-----------
Fix cycles hair curves with NaN values not rendering with dynamic BVH. These NaN
values were breaking the bounding box computation, now they should have no influence.

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

Modified: trunk/blender/intern/cycles/util/util_boundbox.h
===================================================================
--- trunk/blender/intern/cycles/util/util_boundbox.h	2013-02-14 21:40:22 UTC (rev 54563)
+++ trunk/blender/intern/cycles/util/util_boundbox.h	2013-02-14 21:40:28 UTC (rev 54564)
@@ -61,15 +61,17 @@
 
 	__forceinline void grow(const float3& pt)  
 	{
-		min = ccl::min(min, pt);
-		max = ccl::max(max, pt);
+		/* the order of arguments to min is such that if pt is nan, it will not
+		 * influence the resulting bounding box */
+		min = ccl::min(pt, min);
+		max = ccl::max(pt, max);
 	}
 
 	__forceinline void grow(const float3& pt, float border)  
 	{
 		float3 shift = {border, border, border, 0.0f};
-		min = ccl::min(min, pt - shift);
-		max = ccl::max(max, pt + shift);
+		min = ccl::min(pt - shift, min);
+		max = ccl::max(pt + shift, max);
 	}
 
 	__forceinline void grow(const BoundBox& bbox)




More information about the Bf-blender-cvs mailing list