[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22214] branches/soc-2009-jaguarandi/ source/blender/render/intern/raytrace/rayobject_vbvh.cpp: Fix point-hint

André Pinto andresusanopinto at gmail.com
Tue Aug 4 20:03:05 CEST 2009


Revision: 22214
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22214
Author:   jaguarandi
Date:     2009-08-04 20:03:04 +0200 (Tue, 04 Aug 2009)

Log Message:
-----------
Fix point-hint

Modified Paths:
--------------
    branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/rayobject_vbvh.cpp

Modified: branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
===================================================================
--- branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/rayobject_vbvh.cpp	2009-08-04 17:24:49 UTC (rev 22213)
+++ branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/rayobject_vbvh.cpp	2009-08-04 18:03:04 UTC (rev 22214)
@@ -345,24 +345,32 @@
 			bvh_dfs_make_hint_push_siblings(node->sibling, hint, reserve_space+1, min, max);
 
 		bvh_dfs_make_hint(node, hint, reserve_space, min, max);
-	}
-		
-	
+	}	
 }
 
 template<class Node>
 void bvh_dfs_make_hint(Node *node, LCTSHint *hint, int reserve_space, float *min, float *max)
 {
-	assert( hint->size - reserve_space + 1 <= RE_RAY_LCTS_MAX_SIZE );
+	assert( hint->size + reserve_space + 1 <= RE_RAY_LCTS_MAX_SIZE );
 	
-	if(hint->size - reserve_space + 1 == RE_RAY_LCTS_MAX_SIZE || !RayObject_isAligned(node))
+	if(!RayObject_isAligned(node))
+	{
 		hint->stack[hint->size++] = (RayObject*)node;
+	}
 	else
 	{
-		/* We are 100% sure the ray will be pass inside this node */
-		if(bb_fits_inside(node->bb, node->bb+3, min, max) )
+		int childs = count_childs(node);
+		if(hint->size + reserve_space + childs <= RE_RAY_LCTS_MAX_SIZE)
 		{
-			bvh_dfs_make_hint_push_siblings(node->child, hint, reserve_space, min, max);
+			/* We are 100% sure the ray will be pass inside this node */
+			if(bb_fits_inside(node->bb, node->bb+3, min, max) )
+			{
+				bvh_dfs_make_hint_push_siblings(node->child, hint, reserve_space, min, max);
+			}
+			else
+			{
+				hint->stack[hint->size++] = (RayObject*)node;
+			}
 		}
 		else
 		{





More information about the Bf-blender-cvs mailing list