[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22356] branches/soc-2009-jaguarandi/ source/blender/render: Ability to disable hints at compile time

André Pinto andresusanopinto at gmail.com
Mon Aug 10 23:37:16 CEST 2009


Revision: 22356
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22356
Author:   jaguarandi
Date:     2009-08-10 23:37:16 +0200 (Mon, 10 Aug 2009)

Log Message:
-----------
Ability to disable hints at compile time

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

Modified: branches/soc-2009-jaguarandi/source/blender/render/SConscript
===================================================================
--- branches/soc-2009-jaguarandi/source/blender/render/SConscript	2009-08-10 21:31:05 UTC (rev 22355)
+++ branches/soc-2009-jaguarandi/source/blender/render/SConscript	2009-08-10 21:37:16 UTC (rev 22356)
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 Import ('env')
 
-cflags = ['-O3']
+cflags = ['-O3','-msse2','-mfpmath=sse']
 cxxflags = ['-O3','-msse2','-mfpmath=sse']
 sources = env.Glob('intern/source/*.c')
 raysources = env.Glob('intern/raytrace/*.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-10 21:31:05 UTC (rev 22355)
+++ branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/rayobject_vbvh.cpp	2009-08-10 21:37:16 UTC (rev 22356)
@@ -46,6 +46,8 @@
 #define BVHNode VBVHNode
 #define BVHTree VBVHTree
 
+
+#define RE_DO_HINTS	(0)
 #define RAY_BB_TEST_COST (0.2f)
 #define DFS_STACK_SIZE	256
 //#define DYNAMIC_ALLOC_BB
@@ -293,20 +295,20 @@
 template<class Node>
 float bvh_refit(Node *node)
 {
-	if(RayObject_isAligned(node)) return 0;	
-	if(RayObject_isAligned(node->child)) return 0;
+	if(!RayObject_isAligned(node)) return 0;	
+	if(!RayObject_isAligned(node->child)) return 0;
 	
 	float total = 0;
 	
-	for(Node *child = node->child; RayObject_isAligned(child) && child; child = child->sibling)
+	for(Node *child = node->child; child; child = child->sibling)
 		total += bvh_refit(child);
 		
 	float old_area = bb_area(node->bb, node->bb+3);
 	INIT_MINMAX(node->bb, node->bb+3);
-	for(Node *child = node->child; RayObject_isAligned(child) && child; child = child->sibling)
+	for(Node *child = node->child; child; child = child->sibling)
 	{
 		DO_MIN(child->bb, node->bb);
-		DO_MIN(child->bb+3, node->bb+3);
+		DO_MAX(child->bb+3, node->bb+3);
 	}
 	total += old_area - bb_area(node->bb, node->bb+3);
 	return total;
@@ -329,8 +331,8 @@
 	obj->root = bvh_rearrange<BVHTree,BVHNode,RTBuilder>( obj, obj->builder );
 	reorganize(obj->root);
 	remove_useless(obj->root, &obj->root);
+	printf("refit: %f\n", bvh_refit(obj->root) );
 	pushup(obj->root);
-	printf("refit: %f\n", bvh_refit(obj->root) );
 	pushdown(obj->root);
 //	obj->root = memory_rearrange(obj->root);
 	obj->cost = 1.0;
@@ -342,7 +344,7 @@
 template<int StackSize>
 int intersect(BVHTree *obj, Isect* isec)
 {
-	if(isec->hint)
+	if(RE_DO_HINTS && isec->hint)
 	{
 		LCTSHint *lcts = (LCTSHint*)isec->hint;
 		isec->hint = 0;
@@ -423,13 +425,22 @@
 template<class Tree>
 void bvh_hint_bb(Tree *tree, LCTSHint *hint, float *min, float *max)
 {
-	HintBB bb;
-	VECCOPY(bb.bb, min);
-	VECCOPY(bb.bb+3, max);
+	if(RE_DO_HINTS)
+	{
+		HintBB bb;
+		VECCOPY(bb.bb, min);
+		VECCOPY(bb.bb+3, max);
 	
-	hint->size = 0;
-	bvh_dfs_make_hint( tree->root, hint, 0, &bb );
-	tot_hints++;
+		hint->size = 0;
+		bvh_dfs_make_hint( tree->root, hint, 0, &bb );
+		tot_hints++;
+	}
+	else
+	{
+		hint->size = 0;
+		hint->stack[hint->size++] = (RayObject*)tree->root;
+		tot_hints++;
+	}
 }
 
 void bfree(BVHTree *tree)





More information about the Bf-blender-cvs mailing list