Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/scripts/Plugin_VisibilitySceneManager.vcproj
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/scripts/Plugin_VisibilitySceneManager.vcproj	(revision 657)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/scripts/Plugin_VisibilitySceneManager.vcproj	(revision 670)
@@ -109,5 +109,5 @@
 				LinkIncremental="1"
 				SuppressStartupBanner="TRUE"
-				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;&quot;..\..\GtpVisibility\lib\$(ConfigurationName)&quot;;&quot;..\..\lib\$(ConfigurationName)&quot;;&quot;..\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;"
+				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;&quot;..\..\GtpVisibility\lib\$(ConfigurationName)&quot;;&quot;..\..\lib\$(ConfigurationName)&quot;;&quot;..\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;"
 				ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def"
 				GenerateDebugInformation="TRUE"
Index: GTP/trunk/Lib/Vis/Preprocessing/scripts/egsr_test_script
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/scripts/egsr_test_script	(revision 668)
+++ GTP/trunk/Lib/Vis/Preprocessing/scripts/egsr_test_script	(revision 670)
@@ -102,5 +102,5 @@
 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
--bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \
+-vsp_bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \
 -view_cells_post_process_merge=false \
 -vsp_bsp_split_only_driving_axis=true \
@@ -136,5 +136,5 @@
 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
--bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \
+-vsp_bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \
 -view_cells_construction_samples=0 \
 -view_cells_post_process_merge=false \
@@ -166,5 +166,5 @@
 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
--bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \
+-vsp_bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \
 -view_cells_post_process_merge=false \
 -vsp_bsp_split_only_driving_axis=false \
@@ -186,4 +186,29 @@
 
 
+################################################################
+#             vspbsptree - good merge                          #
+################################################################
+
+#
+# use many samples for merge
+#
+
+METHOD=vsp-good-merge
+
+echo "$SCENE $METHOD"
+
+$PROGRAM $ENVIRONMENT \
+-view_cells_type=vspBspTree \
+-view_cells_construction_samples=8000000 \
+-view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
+-view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
+-vsp_bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \
+-view_cells_post_process_merge=true \
+-view_cells_filename=$LOG_PREFIX-$METHOD-viewCells.x3d
+
+mv debug.log $LOG_PREFIX-$METHOD-debug.log
+
+
+
 
 ################################################################
@@ -195,4 +220,31 @@
 #
 
+METHOD=vsp-few-samples
+
+echo "$SCENE $METHOD"
+
+$PROGRAM $ENVIRONMENT \
+-view_cells_type=vspBspTree \
+-view_cells_term_max_view_cells=2500 \
+-vsp_bsp_construction_samples=100000 \
+-view_cells_construction_samples=0 \
+-view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
+-view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
+-vsp_bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \
+-view_cells_post_process_merge=false \
+-view_cells_filename=$LOG_PREFIX-$METHOD-viewCells.x3d
+
+mv debug.log $LOG_PREFIX-$METHOD-debug.log
+
+
+
+################################################################
+#             vspbsptree - many samples                        #
+################################################################
+
+#
+# use many samples for initial subdivision
+#
+
 METHOD=vsp-many-samples
 
@@ -201,88 +253,40 @@
 $PROGRAM $ENVIRONMENT \
 -view_cells_type=vspBspTree \
--view_cells_term_max_view_cells=1000 \
--vsp_bsp_construction_samples=100000 \
+-view_cells_term_max_view_cells=2500 \
+-vsp_bsp_construction_samples=2500000 \
+-view_cells_construction_samples=0 \
+-view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
+-view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
+-vsp_bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \
+-view_cells_post_process_merge=false \
+-view_cells_filename=$LOG_PREFIX-$METHOD-viewCells.x3d
+
+mv debug.log $LOG_PREFIX-$METHOD-debug.log
+
+
+
+################################################################
+#             vspbsptree - many samples                        #
+################################################################
+
+#
+# use many samples for initial subdivision but don't use split cost queue
+#
+
+METHOD=vsp-many-samples-no-split-queue
+
+echo "$SCENE $METHOD"
+
+$PROGRAM $ENVIRONMENT \
+-view_cells_type=vspBspTree \
+-view_cells_term_max_view_cells=2500 \
+-vsp_bsp_construction_samples=2500000 \
+-view_cells_construction_samples=0 \
 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
 -vsp_bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \
 -view_cells_post_process_merge=true \
--view_cells_filename=$LOG_PREFIX-$METHOD-viewCells.x3d
-
-mv debug.log $LOG_PREFIX-$METHOD-debug.log
-
-
-################################################################
-#             vspbsptree - good merge                          #
-################################################################
-
-#
-# use many samples for merge
-#
-
-METHOD=vsp-good-merge
-
-echo "$SCENE $METHOD"
-
-$PROGRAM $ENVIRONMENT \
--view_cells_type=vspBspTree \
--view_cells_construction_samples=8000000 \
--view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
--view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
--vsp_bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \
--view_cells_post_process_merge=true \
--view_cells_filename=$LOG_PREFIX-$METHOD-viewCells.x3d
-
-mv debug.log $LOG_PREFIX-$METHOD-debug.log
-
-
-
-
-################################################################
-#             vspbsptree - many samples                        #
-################################################################
-
-#
-# use many samples for initial subdivision
-#
-
-METHOD=vsp-many-samples
-
-echo "$SCENE $METHOD"
-
-$PROGRAM $ENVIRONMENT \
--view_cells_type=vspBspTree \
--view_cells_term_max_view_cells=1000 \
--vsp_bsp_construction_samples=2000000 \
--view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
--view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
--vsp_bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \
--view_cells_post_process_merge=true \
--view_cells_filename=$LOG_PREFIX-$METHOD-viewCells.x3d
-
-mv debug.log $LOG_PREFIX-$METHOD-debug.log
-
-
-################################################################
-#             vspbsptree - many samples                        #
-################################################################
-
-#
-# use many samples for initial subdivision but don't use split cost queue
-#
-
-METHOD=vsp-many-samples-no-split-queue
-
-echo "$SCENE $METHOD"
-
-$PROGRAM $ENVIRONMENT \
--view_cells_type=vspBspTree \
--view_cells_term_max_view_cells=1000 \
--vsp_bsp_construction_samples=2000000 \
--view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \
--view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \
--vsp_bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \
--view_cells_post_process_merge=true \
--vsp_bsp_use_split_cost_queue=true \
--view_cells_filename=$LOG_PREFIX-$METHOD-viewCells.x3d
-
-mv debug.log $LOG_PREFIX-$METHOD-debug.log
+-vsp_bsp_use_split_cost_queue=false \
+-view_cells_filename=$LOG_PREFIX-$METHOD-viewCells.x3d
+
+mv debug.log $LOG_PREFIX-$METHOD-debug.log
Index: GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h	(revision 666)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h	(revision 670)
@@ -129,4 +129,5 @@
 		float GetCost() const
 		{
+			//cout << "here " << mPriority << endl;
 			return mPriority;
 		}
Index: GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp	(revision 667)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp	(revision 670)
@@ -743,6 +743,5 @@
 				float cData = (float)tData.mPvs * tData.mProbability;;
 
-                float costDecr = 
-					(cFront + cBack - cData) / mBox.GetVolume();
+                float costDecr = (cFront + cBack - cData) / mBox.GetVolume();
 
 				mTotalCost += costDecr;
@@ -943,4 +942,5 @@
     tData.mPriority = mBreathFirstSplits ? 
 		(float)-tData.mDepth : tData.mPvs * tData.mProbability;
+	//cout << "priority: " << tData.mPriority << endl;
 }
 
@@ -1356,4 +1356,6 @@
 		sAxis = tData.mAxis;
 		
+	//Debug << "use special axis: " << useSpecialAxis << endl;
+	//Debug << "axis: " << sAxis << " drivingaxis: " << box.Size().DrivingAxis();
 
 	for (axis = 0; axis < 3; ++ axis)
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp	(revision 667)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp	(revision 670)
@@ -1276,5 +1276,5 @@
 	RegisterOption("ViewCells.evaluateViewCells",
 					optBool,
-					"view_cells_evaluate_view_cells=",
+					"view_cells_evaluate=",
 					"false");
 
Index: GTP/trunk/Lib/Vis/shared/EvalStats/EvalStats.cpp
===================================================================
--- GTP/trunk/Lib/Vis/shared/EvalStats/EvalStats.cpp	(revision 668)
+++ GTP/trunk/Lib/Vis/shared/EvalStats/EvalStats.cpp	(revision 670)
@@ -97,13 +97,15 @@
 				  const int index)
 {
-	float denom = currentStats.mRenderCost ? currentStats.mRenderCost : 0.000001f;
-	float costRatio = firstStats.mRenderCost / denom;
+	float denom = firstStats.mRenderCost ? firstStats.mRenderCost : 0.000001f;
+	float costRatio = currentStats.mRenderCost / denom;
 			
 	denom = firstStats.mAvgRenderCost ? firstStats.mAvgRenderCost : 0.000001f;
-	float avgCostRatio = firstStats.mAvgRenderCost / denom;
+	float avgCostRatio = currentStats.mAvgRenderCost / denom;
 
 	statsOut << "#ViewCells\n" << index + 1 << endl
-			 << "#TotalRenderCostGain\n" << 100.0f - costRatio * 100.0f << endl
-			 << "#AvgRenderCostGain\n" << 100.0f - avgCostRatio * 100.0f << endl << endl;
+			 //<< "#TotalRenderCostGain\n" << 100.0f - costRatio * 100.0f << endl
+			 //<< "#AvgRenderCostGain\n" << 100.0f - avgCostRatio * 100.0f << endl << endl;
+			 << "#TotalRenderCostGain\n" << 100.0f * costRatio - 100.0f<< endl
+			 << "#AvgRenderCostGain\n" << 100.0f * avgCostRatio -100.0f << endl << endl;
 }
 
@@ -163,9 +165,7 @@
 	{
 		cout << "writing output to file " << *sit << endl;
-
 		ofstream statsOut((*sit).c_str());
 		++ sit;
 
-		cout << "size here" << (*it).size() << endl;
 		// compute size of output vector
 		const int n = min((int)firstStats.size(), (int)(*it).size());
@@ -175,5 +175,5 @@
 			ComputeStats(statsOut, firstStats[i], (*it)[i], i);
 		}
-		cout << "here2 " << n << endl;
+		
 		statsOut.close();
 	}
