Index: trunk/VUT/GtpVisibilityPreprocessor/src/AxisAlignedBox3.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/AxisAlignedBox3.h	(revision 448)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/AxisAlignedBox3.h	(revision 459)
@@ -55,5 +55,5 @@
   }
 
-	float Size(const int axis) const {
+  float Size(const int axis) const {
     return  Max(axis) - Min(axis);
   }
Index: trunk/VUT/GtpVisibilityPreprocessor/src/Makefile
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/Makefile	(revision 450)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/Makefile	(revision 459)
@@ -1,5 +1,5 @@
 #############################################################################
 # Makefile for building: preprocessor
-# Generated by qmake (1.07a) (Qt 3.3.2) on: Mon Dec 05 09:51:45 2005
+# Generated by qmake (1.07a) (Qt 3.3.2) on: Mon Dec 05 10:27:34 2005
 # Project:  preprocessor.pro
 # Template: app
@@ -13,11 +13,11 @@
 LEX		= flex
 YACC		= byacc
-CFLAGS	=	-nologo -Zm200 -W0 -MDd -Zi -Gm -GX  -DUNICODE -DWIN32 -DQT_DLL -DQT_THREAD_SUPPORT
-CXXFLAGS	=	-nologo -Zm200 -W0 -MDd -Zi -Gm -GX  -DUNICODE -DWIN32 -DQT_DLL -DQT_THREAD_SUPPORT
+CFLAGS	=	-nologo -Zm200 -W0 -MD -O2 -G7 -GX  -DUNICODE -DWIN32 -DQT_DLL -DQT_THREAD_SUPPORT -DQT_NO_DEBUG
+CXXFLAGS	=	-nologo -Zm200 -W0 -MD -O2 -G7 -GX  -DUNICODE -DWIN32 -DQT_DLL -DQT_THREAD_SUPPORT -DQT_NO_DEBUG
 LEXFLAGS	=
 YACCFLAGS	=-d
 INCPATH	=	 -I"..\src" -I"..\support\xerces\include" -I"..\support\zlib\include" -I"..\support\boost" -I"..\support\devil\include" -I"$(QTDIR)\include" -I"d:\gametools\svn\trunk\VUT\GtpVisibilityPreprocessor\src" -I"C:\Qt\3.3.2\mkspecs\win32-msvc.net"
 LINK	=	"c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\link.exe"
-LFLAGS	=	/NOLOGO /DEBUG /SUBSYSTEM:CONSOLE /LIBPATH:"../support/xerces/lib" /LIBPATH:"../support/devil/lib" /LIBPATH:"$(QTDIR)\lib"
+LFLAGS	=	/NOLOGO /DELAYLOAD:comdlg32.dll /DELAYLOAD:oleaut32.dll /DELAYLOAD:winmm.dll /DELAYLOAD:wsock32.dll /DELAYLOAD:winspool.dll /SUBSYSTEM:CONSOLE /LIBPATH:"../support/xerces/lib" /LIBPATH:"../support/devil/lib" /LIBPATH:"$(QTDIR)\lib"
 LIBS	=	 "qt-mt332.lib" "qtmain.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "imm32.lib" "winmm.lib" "wsock32.lib" "winspool.lib" "delayimp.lib" "xerces-c_2.lib" "devil.lib" "ilu.lib" "ilut.lib" "opengl32.lib" "glu32.lib"
 MOC		=	$(QTDIR)\bin\moc.exe
@@ -224,9 +224,4 @@
 	-$(DEL_FILE) ViewCellsManager.obj
 	-$(DEL_FILE) VspBspTree.obj
-	-$(DEL_FILE) preprocessor.pdb
-	-$(DEL_FILE) preprocessor.ilk
-	-$(DEL_FILE) vc*.pdb
-	-$(DEL_FILE) vc*.idb
-
 
 
@@ -380,4 +375,5 @@
 		VspKdTree.h \
 		VssTree.h \
+		VspBspTree.h \
 		RssTree.h \
 		Containers.h \
@@ -636,4 +632,5 @@
 		common.h \
 		Statistics.h \
+		VssRay.h \
 		
 
@@ -670,10 +667,10 @@
 		Containers.h \
 		Statistics.h \
-		Intersectable.h \
-		Matrix4x4.h \
-		Material.h \
-		Pvs.h \
-		Rectangle3.h \
-		VssRay.h \
+		VssRay.h \
+		Intersectable.h \
+		Matrix4x4.h \
+		Material.h \
+		Pvs.h \
+		Rectangle3.h \
 		
 
@@ -743,18 +740,22 @@
 		ViewCellBsp.h \
 		ViewCell.h \
-		common.h \
-		Statistics.h \
-		Containers.h \
-		AxisAlignedBox3.h \
-		Ray.h \
-		Pvs.h \
-		Rectangle3.h \
-		Matrix4x4.h \
-		Vector3.h \
-		Plane3.h \
-		Mesh.h \
-		Polygon3.h \
-		Intersectable.h \
-		Material.h \
+		VspBspTree.h \
+		VspKdTree.h \
+		common.h \
+		Statistics.h \
+		Containers.h \
+		AxisAlignedBox3.h \
+		Ray.h \
+		Pvs.h \
+		Rectangle3.h \
+		Matrix4x4.h \
+		Vector3.h \
+		Plane3.h \
+		Mesh.h \
+		Polygon3.h \
+		VssRay.h \
+		Intersectable.h \
+		Material.h \
+		RayInfo.h \
 		
 
@@ -815,4 +816,5 @@
 		VssRay.h \
 		RssTree.h \
+		ViewCellBsp.h \
 		Containers.h \
 		AxisAlignedBox3.h \
@@ -874,4 +876,5 @@
 		AxisAlignedBox3.h \
 		Exporter.h \
+		ViewCellBsp.h \
 		Vector3.h \
 		Containers.h \
Index: trunk/VUT/GtpVisibilityPreprocessor/src/Exporter.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/Exporter.h	(revision 448)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/Exporter.h	(revision 459)
@@ -135,4 +135,6 @@
   GetExporter(const string filename);
 
+  virtual void ExportViewpoint(const Vector3 &point, const Vector3 &direction) = 0;
+
 };
  
Index: trunk/VUT/GtpVisibilityPreprocessor/src/RssTree.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/RssTree.cpp	(revision 447)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/RssTree.cpp	(revision 459)
@@ -1779,9 +1779,9 @@
 	Vector3 o3 = leaf->rays[r3].GetOrigin();
 
-	const float overlap = 0.1;
+	const float overlap = 0.0;
 		
 	Vector3 origin, direction;
 	// generate half of convex combination and half of random rays
-	bool useExtendedConvexCombination = (i > numberOfRays/2);
+	bool useExtendedConvexCombination = 0 &&  (i > numberOfRays/2);
 	if (useExtendedConvexCombination) {
 	  float w1, w2, w3;
Index: trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.h	(revision 448)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.h	(revision 459)
@@ -143,5 +143,10 @@
 						   const AxisAlignedBox3 &box, 
 						   const bool exportDepth,
+
+
 						   const bool epsilon);
+
+  void ExportViewpoint(const Vector3 &point, const Vector3 &direction);
+
 };
  
Index: trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp	(revision 452)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp	(revision 459)
@@ -17,4 +17,6 @@
 
 static bool exportPvs = false;
+static int numExportRays = 10000;
+// static int numExportRays = 0;
 
 RssPreprocessor::RssPreprocessor():
@@ -215,5 +217,5 @@
 	num = rssTree->GenerateRays(p, rays);
   } else {
-	int leaves = rssTree->stat.Leaves()/2;
+	int leaves = rssTree->stat.Leaves()/1;
 	num = rssTree->GenerateRays(desiredSamples, leaves, rays);
   }
@@ -365,4 +367,7 @@
 	exporter->SetFilled();
 	exporter->ExportGeometry(pvs);
+	exporter->SetWireframe();
+	exporter->ExportBox(rssTree->bbox);
+	exporter->ExportViewpoint(rssTree->bbox.Center(), Vector3(1,0,0));
 	delete exporter;
   }
@@ -385,16 +390,27 @@
 
   if (fromBoxVisibility) {
-	float size = 0.05f;
+	float m = box->Min(1);
+	float bsize = box->Size(1);
+
+	float size = 0.02f;
 	float s = 0.5f - size;
 	float olds = Magnitude(box->Size());
 	box->Enlarge(box->Size()*Vector3(-s));
-	Vector3 translation = Vector3(-olds*0.1f, 0, 0);
+	//	Vector3 translation = Vector3(-olds*0.2f, 0, 0);
+	Vector3 translation = Vector3(-0.05*olds, 0, 0);
 	box->SetMin(box->Min() + translation);
 	box->SetMax(box->Max() + translation);
+
+	box->SetMin(1,  m + bsize*0.1);
+	box->SetMax(1,  m + bsize*0.6);
+
+	
   } else {
 		
 	// sample city like heights
-	box->SetMin(1, box->Min(1) + box->Size(1)*0.2);
-	box->SetMax(1, box->Min(1) + box->Size(1)*0.3);
+	float m = box->Min(1);
+	float bsize = box->Size(1);
+	box->SetMin(1,  m + bsize*0.2);
+	box->SetMax(1,  m + bsize*0.3);
   }
 
@@ -462,6 +478,4 @@
   cout << "#totalRayStackSize=" << mVssRays.size() << endl <<flush;
   
-  int numExportRays = 10000;
-  //  int numExportRays = 0;
 
   if (numExportRays) {
@@ -471,7 +485,4 @@
   }
   
-  if (exportPvs) {
-	ExportPvs("rss-pvs-initial.x3d", rssTree);
-  }
 
   // construct view cells
@@ -494,4 +505,8 @@
 
   ExportRssTreeLeaves(rssTree, 10);
+
+  if (exportPvs) {
+	ExportPvs("rss-pvs-initial.x3d", rssTree);
+  }
 
   // viewcells->UpdatePVS(newVssRays);
@@ -539,4 +554,6 @@
 	  int subdivided = rssTree->UpdateSubdivision();
 	  cout<<"subdivided leafs = "<<subdivided<<endl;
+	  cout<<"#total leaves = "<<rssTree->stat.Leaves()<<endl;
+
 	}
 
Index: trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp	(revision 450)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp	(revision 459)
@@ -1308,2 +1308,17 @@
   return true;
 }
+
+
+void
+X3dExporter::ExportViewpoint(const Vector3 &point,
+							 const Vector3 &direction)
+{
+  stream<<"<Viewpoint "<<endl;
+  
+  stream<<"position=\""<<point.x<<" "<<point.y<<" "<<point.z<<"\""<<endl;
+  //  stream<<"orientation "<<direction.x<<direction.y<<direction.z<<endl;
+  
+  stream<<">"<<endl;
+  stream<<"</Viewpoint>"<<endl;
+  
+}
Index: trunk/VUT/GtpVisibilityPreprocessor/src/VssRay.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/VssRay.cpp	(revision 446)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/VssRay.cpp	(revision 459)
@@ -166,9 +166,4 @@
   w1 = RandomValue(-overlap, 1.0f + overlap);
   w2 = RandomValue(-overlap, 1.0f + overlap);
-  w3 = RandomValue(-overlap, 1.0f + overlap);
-  
-  float c = 1.0f/(w1 + w2 + w3);
-  w1 *= c;
-  w2 *= c;
-  w3 *= c;
+  w3 = 1.0f - w1 - w2;
 }
Index: trunk/VUT/GtpVisibilityPreprocessor/src/default.env
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/default.env	(revision 451)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/default.env	(revision 459)
@@ -13,7 +13,7 @@
 #;../data/vienna/vienna-plane.x3d
 # filename ../data/vienna/viewcells-25-sel.x3d
-# filename ../data/atlanta/atlanta2.x3d
+ filename ../data/atlanta/atlanta2.x3d
 # filename ../data/soda/soda.dat
- filename ../data/soda/soda5.dat
+# filename ../data/soda/soda5.dat
 }
 
@@ -64,7 +64,7 @@
 RssPreprocessor {
 	samplesPerPass  100000
-	initialSamples 500000
-	vssSamples 5000000
-	vssSamplesPerPass 100000
+	initialSamples 1000000
+	vssSamples 1000000
+	vssSamplesPerPass 50000
 	useImportanceSampling true
 }
@@ -75,5 +75,5 @@
 
 	maxDepth 	40
-	minPvs		5
+	minPvs		3
 	minRays		30
 	minSize		0.001
@@ -90,5 +90,5 @@
 
 	interleaveDirSplits	true
-    dirSplitDepth 9
+    dirSplitDepth 0
 
 	numberOfEndPointDomains	10000
@@ -179,5 +179,4 @@
 		epsilon 0.005
 	}
-
 
 	# random polygon       = 1
Index: trunk/VUT/GtpVisibilityPreprocessor/src/preprocessor.pro
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/preprocessor.pro	(revision 450)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/preprocessor.pro	(revision 459)
@@ -17,5 +17,5 @@
 
 # debuc config
-CONFIG		+= console warn_off thread debug
+CONFIG		+= console warn_off thread release
 
 # RELEASE CONFIG
