Index: trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.h	(revision 462)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.h	(revision 463)
Index: trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.cpp	(revision 462)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.cpp	(revision 463)
@@ -716,12 +716,13 @@
 
 	// this is the main ray classification loop!
-    for(RayInfoContainer::iterator ri = leaf->mRays.begin();
-		ri != leaf->mRays.end(); ++ ri)
-	{
-		if (!(*ri).mRay->IsActive()) 
-			continue;
-			
-		// determine the side of this ray with respect to the plane
-		int side = (*ri).ComputeRayIntersection(axis, position, (*ri).mRay->mT);
+	  for(RayInfoContainer::iterator ri = leaf->mRays.begin();
+			ri != leaf->mRays.end(); ++ ri)
+		{
+ if (!(*ri).mRay->IsActive()) 
+								continue;
+								
+								// determine the side of this ray with respect to the plane
+								float t;
+								int side = (*ri).ComputeRayIntersection(axis, position, t);
 		//				(*ri).mRay->mSide = side;
 			
@@ -1089,7 +1090,7 @@
 				// first unref ray from the former leaf
 				(*ri).mRay->Unref();
-
+				  float t;
 				// determine the side of this ray with respect to the plane
-				int side = node->ComputeRayIntersection(*ri, (*ri).mRay->mT);
+				int side = node->ComputeRayIntersection(*ri, t);
 
 				if (side == 0) 
@@ -1099,7 +1100,7 @@
 						back->AddRay(RayInfo((*ri).mRay,
 											 (*ri).mMinT,
-											 (*ri).mRay->mT));
+											 t));
 						front->AddRay(RayInfo((*ri).mRay,
-									 		  (*ri).mRay->mT,
+									 		  t,
 											  (*ri).mMaxT));
 					} 
@@ -1107,9 +1108,9 @@
 					{
 						back->AddRay(RayInfo((*ri).mRay,
-											 (*ri).mRay->mT,
+											 t,
 											 (*ri).mMaxT));
 						front->AddRay(RayInfo((*ri).mRay,
 									 		  (*ri).mMinT,
-											  (*ri).mRay->mT));
+											  t));
 					}
 				} 
@@ -1397,5 +1398,6 @@
 	{
 	    // determine the side of this ray with respect to the plane
-		int side = in->ComputeRayIntersection(data.mRayData, data.mRayData.mRay->mT);
+ float t; 
+ int side = in->ComputeRayIntersection(data.mRayData, t);
     
 		if (side == 0) 
@@ -1404,8 +1406,8 @@
 			{
 				tstack.push(RayTraversalData(in->GetBack(), 
-							RayInfo(data.mRayData.mRay, data.mRayData.mMinT, data.mRayData.mRay->mT)));
+							RayInfo(data.mRayData.mRay, data.mRayData.mMinT, t)));
 				
 				tstack.push(RayTraversalData(in->GetFront(),
-							RayInfo(data.mRayData.mRay, data.mRayData.mRay->mT, data.mRayData.mMaxT)));
+							RayInfo(data.mRayData.mRay, t, data.mRayData.mMaxT)));
 	
 			} 
@@ -1414,10 +1416,10 @@
 				tstack.push(RayTraversalData(in->GetBack(),
 							RayInfo(data.mRayData.mRay,
-							data.mRayData.mRay->mT,
+							t,
 							data.mRayData.mMaxT)));
 				tstack.push(RayTraversalData(in->GetFront(),
 							RayInfo(data.mRayData.mRay,
 							data.mRayData.mMinT,
-							data.mRayData.mRay->mT)));
+							t)));
 			}
 		}
Index: trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.cpp	(revision 462)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.cpp	(revision 463)
Index: trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h	(revision 462)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h	(revision 463)
Index: trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.h	(revision 449)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.h	(revision 463)
Index: trunk/VUT/GtpVisibilityPreprocessor/src/RssTree.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/RssTree.h	(revision 447)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/RssTree.h	(revision 463)
@@ -229,8 +229,8 @@
   // the bbox of the node
   AxisAlignedBox3 bbox;
-
+  
   // the bbox of the node
   AxisAlignedBox3 dirBBox;
-  
+
   // data for caching
   long accesses;
@@ -514,5 +514,8 @@
   // axis aligned bounding box of directions
   AxisAlignedBox3 dirBBox;
-  
+
+  // forced bounding box for from viewcell visibility
+  AxisAlignedBox3 *mForcedBoundingBox;
+
   /////////////////////////////
   // Construction parameters
@@ -804,4 +807,5 @@
   GetTreeStatistics(
 					float &avgPvsSize,
+					float &avgRays,
 					float &avgRayContribution,
 					float &avgPvsEntropy,
Index: trunk/VUT/GtpVisibilityPreprocessor/src/Makefile
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/Makefile	(revision 459)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/Makefile	(revision 463)
@@ -1,896 +1,131 @@
 #############################################################################
 # Makefile for building: preprocessor
-# Generated by qmake (1.07a) (Qt 3.3.2) on: Mon Dec 05 10:27:34 2005
+# Generated by qmake (2.00a) (Qt 4.1.0-rc1) on: út 13. XII 21:49:08 2005
 # Project:  preprocessor.pro
 # Template: app
-# Command: $(QMAKE) -o Makefile preprocessor.pro
+# Command: qmake -win32 -o Makefile preprocessor.pro
 #############################################################################
 
-####### Compiler, tools and options
+first: release
+install: release-install
+uninstall: release-uninstall
+MAKEFILE      = Makefile
+QMAKE         = qmake
+DEL_FILE      = del
+CHK_DIR_EXISTS= if not exist
+MKDIR         = mkdir
+COPY          = copy /y
+COPY_FILE     = $(COPY)
+COPY_DIR      = xcopy /s /q /y /i
+INSTALL_FILE  = $(COPY_FILE)
+INSTALL_DIR   = $(COPY_DIR)
+DEL_FILE      = del
+SYMLINK       = 
+DEL_DIR       = rmdir
+MOVE          = move
+CHK_DIR_EXISTS= if not exist
+MKDIR         = mkdir
+SUBTARGETS    =  \
+		release \
+		debug
 
-CC		=	cl
-CXX		=	cl
-LEX		= flex
-YACC		= byacc
-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 /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
-UIC		=	$(QTDIR)\bin\uic.exe
-QMAKE		=	qmake
-IDC		=	$(QTDIR)\bin\idc.exe
-IDL		=	midl
-ZIP		=	zip -r -9
-COPY_FILE	=       copy
-COPY_DIR	=       copy
-DEL_FILE	=       del
-DEL_DIR	=       rmdir
-MOVE		=       move
-CHK_DIR_EXISTS =	if not exist
-MKDIR		=	mkdir
-INSTALL_FILE= $(COPY_FILE)
-INSTALL_DIR = $(COPY_DIR)
+release: $(MAKEFILE).Release FORCE
+	$(MAKE) -f $(MAKEFILE).Release
+release-make_default: $(MAKEFILE).Release FORCE
+	$(MAKE) -f $(MAKEFILE).Release 
+release-make_first: $(MAKEFILE).Release FORCE
+	$(MAKE) -f $(MAKEFILE).Release first
+release-all: $(MAKEFILE).Release FORCE
+	$(MAKE) -f $(MAKEFILE).Release all
+release-clean: $(MAKEFILE).Release FORCE
+	$(MAKE) -f $(MAKEFILE).Release clean
+release-distclean: $(MAKEFILE).Release FORCE
+	$(MAKE) -f $(MAKEFILE).Release distclean
+release-install: $(MAKEFILE).Release FORCE
+	$(MAKE) -f $(MAKEFILE).Release install
+release-uninstall: $(MAKEFILE).Release FORCE
+	$(MAKE) -f $(MAKEFILE).Release uninstall
+debug: $(MAKEFILE).Debug FORCE
+	$(MAKE) -f $(MAKEFILE).Debug
+debug-make_default: $(MAKEFILE).Debug FORCE
+	$(MAKE) -f $(MAKEFILE).Debug 
+debug-make_first: $(MAKEFILE).Debug FORCE
+	$(MAKE) -f $(MAKEFILE).Debug first
+debug-all: $(MAKEFILE).Debug FORCE
+	$(MAKE) -f $(MAKEFILE).Debug all
+debug-clean: $(MAKEFILE).Debug FORCE
+	$(MAKE) -f $(MAKEFILE).Debug clean
+debug-distclean: $(MAKEFILE).Debug FORCE
+	$(MAKE) -f $(MAKEFILE).Debug distclean
+debug-install: $(MAKEFILE).Debug FORCE
+	$(MAKE) -f $(MAKEFILE).Debug install
+debug-uninstall: $(MAKEFILE).Debug FORCE
+	$(MAKE) -f $(MAKEFILE).Debug uninstall
 
-####### Files
+Makefile: preprocessor.pro  D:/Qt/4.1.0-rc1/mkspecs/win32-msvc.net\qmake.conf D:/Qt/4.1.0-rc1/mkspecs/qconfig.pri \
+		D:\Qt\4.1.0-rc1\mkspecs\features\qt_config.prf \
+		D:\Qt\4.1.0-rc1\mkspecs\features\exclusive_builds.prf \
+		D:\Qt\4.1.0-rc1\mkspecs\features\default_pre.prf \
+		D:\Qt\4.1.0-rc1\mkspecs\features\win32\default_pre.prf \
+		D:\Qt\4.1.0-rc1\mkspecs\features\release.prf \
+		D:\Qt\4.1.0-rc1\mkspecs\features\debug_and_release.prf \
+		D:\Qt\4.1.0-rc1\mkspecs\features\default_post.prf \
+		D:\Qt\4.1.0-rc1\mkspecs\features\win32\thread.prf \
+		D:\Qt\4.1.0-rc1\mkspecs\features\warn_off.prf \
+		D:\Qt\4.1.0-rc1\mkspecs\features\win32\console.prf \
+		D:\Qt\4.1.0-rc1\mkspecs\features\win32\rtti.prf \
+		D:\Qt\4.1.0-rc1\mkspecs\features\win32\exceptions.prf \
+		D:\Qt\4.1.0-rc1\mkspecs\features\win32\stl.prf \
+		D:\Qt\4.1.0-rc1\mkspecs\features\shared.prf \
+		D:\Qt\4.1.0-rc1\mkspecs\features\qt.prf \
+		D:\Qt\4.1.0-rc1\mkspecs\features\moc.prf \
+		D:\Qt\4.1.0-rc1\mkspecs\features\resources.prf \
+		D:\Qt\4.1.0-rc1\mkspecs\features\uic.prf
+	$(QMAKE) -win32 -o Makefile preprocessor.pro
+D:/Qt/4.1.0-rc1/mkspecs/qconfig.pri:
+D:\Qt\4.1.0-rc1\mkspecs\features\qt_config.prf:
+D:\Qt\4.1.0-rc1\mkspecs\features\exclusive_builds.prf:
+D:\Qt\4.1.0-rc1\mkspecs\features\default_pre.prf:
+D:\Qt\4.1.0-rc1\mkspecs\features\win32\default_pre.prf:
+D:\Qt\4.1.0-rc1\mkspecs\features\release.prf:
+D:\Qt\4.1.0-rc1\mkspecs\features\debug_and_release.prf:
+D:\Qt\4.1.0-rc1\mkspecs\features\default_post.prf:
+D:\Qt\4.1.0-rc1\mkspecs\features\win32\thread.prf:
+D:\Qt\4.1.0-rc1\mkspecs\features\warn_off.prf:
+D:\Qt\4.1.0-rc1\mkspecs\features\win32\console.prf:
+D:\Qt\4.1.0-rc1\mkspecs\features\win32\rtti.prf:
+D:\Qt\4.1.0-rc1\mkspecs\features\win32\exceptions.prf:
+D:\Qt\4.1.0-rc1\mkspecs\features\win32\stl.prf:
+D:\Qt\4.1.0-rc1\mkspecs\features\shared.prf:
+D:\Qt\4.1.0-rc1\mkspecs\features\qt.prf:
+D:\Qt\4.1.0-rc1\mkspecs\features\moc.prf:
+D:\Qt\4.1.0-rc1\mkspecs\features\resources.prf:
+D:\Qt\4.1.0-rc1\mkspecs\features\uic.prf:
+qmake: qmake_all FORCE
+	@$(QMAKE) -win32 -o Makefile preprocessor.pro
 
-HEADERS =	Halton.h \
-		VssRay.h \
-		VssPreprocessor.h \
-		RssTree.h
-SOURCES =	Preprocessor.cpp \
-		SamplingPreprocessor.cpp \
-		ExactPreprocessor.cpp \
-		KdTree.cpp \
-		Environment.cpp \
-		gzstream.cpp \
-		common.cpp \
-		UnigraphicsParser.cpp \
-		X3dExporter.cpp \
-		SceneGraph.cpp \
-		Material.cpp \
-		Matrix4x4.cpp \
-		Vector3.cpp \
-		AxisAlignedBox3.cpp \
-		Ray.cpp \
-		main.cpp \
-		Mesh.cpp \
-		Exporter.cpp \
-		Camera.cpp \
-		X3dParser.cpp \
-		MeshKdTree.cpp \
-		Pvs.cpp \
-		MutualVisibility.cpp \
-		Triangle3.cpp \
-		Rectangle3.cpp \
-		Plane3.cpp \
-		Polygon3.cpp \
-		ViewCell.cpp \
-		ViewCellBsp.cpp \
-		Halton.cpp \
-		VssRay.cpp \
-		VssTree.cpp \
-		VssPreprocessor.cpp \
-		RenderSimulator.cpp \
-		VspKdTree.cpp \
-		RayInfo.cpp \
-		RssTree.cpp \
-		RssPreprocessor.cpp \
-		ViewCellsManager.cpp \
-		VspBspTree.cpp
-OBJECTS =	Preprocessor.obj \
-		SamplingPreprocessor.obj \
-		ExactPreprocessor.obj \
-		KdTree.obj \
-		Environment.obj \
-		gzstream.obj \
-		common.obj \
-		UnigraphicsParser.obj \
-		X3dExporter.obj \
-		SceneGraph.obj \
-		Material.obj \
-		Matrix4x4.obj \
-		Vector3.obj \
-		AxisAlignedBox3.obj \
-		Ray.obj \
-		main.obj \
-		Mesh.obj \
-		Exporter.obj \
-		Camera.obj \
-		X3dParser.obj \
-		MeshKdTree.obj \
-		Pvs.obj \
-		MutualVisibility.obj \
-		Triangle3.obj \
-		Rectangle3.obj \
-		Plane3.obj \
-		Polygon3.obj \
-		ViewCell.obj \
-		ViewCellBsp.obj \
-		Halton.obj \
-		VssRay.obj \
-		VssTree.obj \
-		VssPreprocessor.obj \
-		RenderSimulator.obj \
-		VspKdTree.obj \
-		RayInfo.obj \
-		RssTree.obj \
-		RssPreprocessor.obj \
-		ViewCellsManager.obj \
-		VspBspTree.obj
-FORMS =	
-UICDECLS =	
-UICIMPLS =	
-SRCMOC	=	
-OBJMOC	=	
-DIST	=	
-TARGET	=	preprocessor.exe
+qmake_all: FORCE
 
-####### Implicit rules
+make_default: release-make_default debug-make_default FORCE
+make_first: release-make_first debug-make_first FORCE
+all: release-all debug-all FORCE
+clean: release-clean debug-clean FORCE
+	-$(DEL_FILE) preprocessor.exp
+distclean: release-distclean debug-distclean FORCE
+	-$(DEL_FILE) Makefile
 
-.SUFFIXES: .c .cpp .cc .cxx .C
+release-mocclean: $(MAKEFILE).Release
+	$(MAKE) -f $(MAKEFILE).Release mocclean
+debug-mocclean: $(MAKEFILE).Debug
+	$(MAKE) -f $(MAKEFILE).Debug mocclean
+mocclean: release-mocclean debug-mocclean
 
-{.}.cpp{}.obj::
-	$(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<
-	$<
-<<
-
-{.}.cc{}.obj::
-	$(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<
-	$<
-<<
-
-{.}.cxx{}.obj::
-	$(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<
-	$<
-<<
-
-{.}.C{}.obj::
-	$(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<
-	$<
-<<
-
-{.}.c{}.obj::
-	$(CC) -c $(CFLAGS) $(INCPATH) -Fo @<<
-	$<
-<<
-
-####### Build rules
-
-all: Makefile $(TARGET)
-
-$(TARGET):  $(UICDECLS) $(OBJECTS) $(OBJMOC) 
-	$(LINK) $(LFLAGS) /OUT:$(TARGET) @<< 
-	  $(OBJECTS) $(OBJMOC) $(LIBS)
-<<
-
-
-mocables: $(SRCMOC)
-uicables: $(UICIMPLS) $(UICDECLS)
-
-Makefile: preprocessor.pro  C:\Qt\3.3.2\mkspecs\win32-msvc.net\qmake.conf C:\Qt\3.3.2\lib\qtmain.prl
-	$(QMAKE) -o Makefile preprocessor.pro
-qmake: 
-	@$(QMAKE) -o Makefile preprocessor.pro
-
-dist:
-	$(ZIP) preprocessor.zip $(SOURCES) $(HEADERS) $(DIST) $(FORMS) d:/gametools/svn/trunk/VUT/GtpVisibilityPreprocessor/src/preprocessor.pro C:\Qt\3.3.2\lib\qtmain.prl  
-
-uiclean:
-mocclean:
-clean: uiclean mocclean
-	-$(DEL_FILE) Preprocessor.obj
-	-$(DEL_FILE) SamplingPreprocessor.obj
-	-$(DEL_FILE) ExactPreprocessor.obj
-	-$(DEL_FILE) KdTree.obj
-	-$(DEL_FILE) Environment.obj
-	-$(DEL_FILE) gzstream.obj
-	-$(DEL_FILE) common.obj
-	-$(DEL_FILE) UnigraphicsParser.obj
-	-$(DEL_FILE) X3dExporter.obj
-	-$(DEL_FILE) SceneGraph.obj
-	-$(DEL_FILE) Material.obj
-	-$(DEL_FILE) Matrix4x4.obj
-	-$(DEL_FILE) Vector3.obj
-	-$(DEL_FILE) AxisAlignedBox3.obj
-	-$(DEL_FILE) Ray.obj
-	-$(DEL_FILE) main.obj
-	-$(DEL_FILE) Mesh.obj
-	-$(DEL_FILE) Exporter.obj
-	-$(DEL_FILE) Camera.obj
-	-$(DEL_FILE) X3dParser.obj
-	-$(DEL_FILE) MeshKdTree.obj
-	-$(DEL_FILE) Pvs.obj
-	-$(DEL_FILE) MutualVisibility.obj
-	-$(DEL_FILE) Triangle3.obj
-	-$(DEL_FILE) Rectangle3.obj
-	-$(DEL_FILE) Plane3.obj
-	-$(DEL_FILE) Polygon3.obj
-	-$(DEL_FILE) ViewCell.obj
-	-$(DEL_FILE) ViewCellBsp.obj
-	-$(DEL_FILE) Halton.obj
-	-$(DEL_FILE) VssRay.obj
-	-$(DEL_FILE) VssTree.obj
-	-$(DEL_FILE) VssPreprocessor.obj
-	-$(DEL_FILE) RenderSimulator.obj
-	-$(DEL_FILE) VspKdTree.obj
-	-$(DEL_FILE) RayInfo.obj
-	-$(DEL_FILE) RssTree.obj
-	-$(DEL_FILE) RssPreprocessor.obj
-	-$(DEL_FILE) ViewCellsManager.obj
-	-$(DEL_FILE) VspBspTree.obj
-
-
-
+release-mocables: $(MAKEFILE).Release
+	$(MAKE) -f $(MAKEFILE).Release mocables
+debug-mocables: $(MAKEFILE).Debug
+	$(MAKE) -f $(MAKEFILE).Debug mocables
+mocables: release-mocables debug-mocables
 FORCE:
 
-distclean: clean
-	-$(DEL_FILE) $(TARGET)
-
-####### Compile
-
-Preprocessor.obj: Preprocessor.cpp  \
-		SceneGraph.h \
-		Exporter.h \
-		UnigraphicsParser.h \
-		X3dParser.h \
-		Preprocessor.h \
-		ViewCell.h \
-		Environment.h \
-		ViewCellsManager.h \
-		ViewCellBsp.h \
-		VspBspTree.h \
-		VspKdTree.h \
-		Containers.h \
-		AxisAlignedBox3.h \
-		Rectangle3.h \
-		Matrix4x4.h \
-		Vector3.h \
-		Plane3.h \
-		common.h \
-		Material.h \
-		VssRay.h \
-		Ray.h \
-		Parser.h \
-		Mesh.h \
-		KdTree.h \
-		Intersectable.h \
-		Pvs.h \
-		Polygon3.h \
-		Statistics.h \
-		RayInfo.h \
-		
-
-SamplingPreprocessor.obj: SamplingPreprocessor.cpp  \
-		SceneGraph.h \
-		KdTree.h \
-		SamplingPreprocessor.h \
-		X3dExporter.h \
-		Environment.h \
-		MutualVisibility.h \
-		Polygon3.h \
-		ViewCell.h \
-		ViewCellsManager.h \
-		RenderSimulator.h \
-		Containers.h \
-		AxisAlignedBox3.h \
-		Rectangle3.h \
-		Matrix4x4.h \
-		Vector3.h \
-		Plane3.h \
-		common.h \
-		Ray.h \
-		Pvs.h \
-		Preprocessor.h \
-		VssRay.h \
-		Mesh.h \
-		Intersectable.h \
-		Material.h \
-		Exporter.h \
-		Statistics.h \
-		
-
-ExactPreprocessor.obj: ExactPreprocessor.cpp  \
-		ExactPreprocessor.h \
-		Preprocessor.h \
-		Containers.h \
-		Mesh.h \
-		KdTree.h \
-		Intersectable.h \
-		Plane3.h \
-		Matrix4x4.h \
-		AxisAlignedBox3.h \
-		Material.h \
-		Pvs.h \
-		Rectangle3.h \
-		Vector3.h \
-		common.h \
-		Ray.h \
-		
-
-KdTree.obj: KdTree.cpp  \
-		Environment.h \
-		Mesh.h \
-		KdTree.h \
-		common.h \
-		Intersectable.h \
-		Plane3.h \
-		Matrix4x4.h \
-		AxisAlignedBox3.h \
-		Material.h \
-		Pvs.h \
-		Rectangle3.h \
-		Vector3.h \
-		Containers.h \
-		Ray.h \
-		
-
-Environment.obj: Environment.cpp  \
-		gzstream.h \
-		common.h \
-		Environment.h \
-		Vector3.h \
-		
-
-gzstream.obj: gzstream.cpp  \
-		gzstream.h \
-		
-
-common.obj: common.cpp  \
-		common.h \
-		
-
-UnigraphicsParser.obj: UnigraphicsParser.cpp  \
-		Vector3.h \
-		Mesh.h \
-		SceneGraph.h \
-		UnigraphicsParser.h \
-		Material.h \
-		Environment.h \
-		common.h \
-		Intersectable.h \
-		Plane3.h \
-		Matrix4x4.h \
-		AxisAlignedBox3.h \
-		Pvs.h \
-		Rectangle3.h \
-		Containers.h \
-		Parser.h \
-		
-
-X3dExporter.obj: X3dExporter.cpp  \
-		common.h \
-		SceneGraph.h \
-		X3dExporter.h \
-		Mesh.h \
-		KdTree.h \
-		ViewCellBsp.h \
-		ViewCell.h \
-		Polygon3.h \
-		VssRay.h \
-		VspKdTree.h \
-		VssTree.h \
-		VspBspTree.h \
-		RssTree.h \
-		Containers.h \
-		AxisAlignedBox3.h \
-		Rectangle3.h \
-		Matrix4x4.h \
-		Vector3.h \
-		Plane3.h \
-		Exporter.h \
-		Material.h \
-		Ray.h \
-		Intersectable.h \
-		Pvs.h \
-		Statistics.h \
-		RayInfo.h \
-		
-
-SceneGraph.obj: SceneGraph.cpp  \
-		SceneGraph.h \
-		X3dExporter.h \
-		Intersectable.h \
-		Containers.h \
-		AxisAlignedBox3.h \
-		Rectangle3.h \
-		Matrix4x4.h \
-		Vector3.h \
-		Plane3.h \
-		common.h \
-		Exporter.h \
-		VssRay.h \
-		Material.h \
-		Ray.h \
-		Pvs.h \
-		
-
-Material.obj: Material.cpp  \
-		common.h \
-		Material.h \
-		
-
-Matrix4x4.obj: Matrix4x4.cpp  \
-		Matrix4x4.h \
-		Vector3.h \
-		common.h \
-		
-
-Vector3.obj: Vector3.cpp  \
-		Matrix4x4.h \
-		Vector3.h \
-		Halton.h \
-		common.h \
-		
-
-AxisAlignedBox3.obj: AxisAlignedBox3.cpp  \
-		AxisAlignedBox3.h \
-		Ray.h \
-		Polygon3.h \
-		Rectangle3.h \
-		Matrix4x4.h \
-		Vector3.h \
-		Plane3.h \
-		common.h \
-		Containers.h \
-		Mesh.h \
-		Intersectable.h \
-		Material.h \
-		Pvs.h \
-		
-
-Ray.obj: Ray.cpp  \
-		Ray.h \
-		Plane3.h \
-		VssRay.h \
-		Matrix4x4.h \
-		Vector3.h \
-		common.h \
-		
-
-main.obj: main.cpp  \
-		SamplingPreprocessor.h \
-		VssPreprocessor.h \
-		RssPreprocessor.h \
-		ExactPreprocessor.h \
-		Parser.h \
-		UnigraphicsParser.h \
-		X3dParser.h \
-		Environment.h \
-		Camera.h \
-		MeshKdTree.h \
-		Exporter.h \
-		X3dExporter.h \
-		ViewCell.h \
-		SceneGraph.h \
-		Preprocessor.h \
-		VssRay.h \
-		Containers.h \
-		Mesh.h \
-		KdTree.h \
-		Intersectable.h \
-		Plane3.h \
-		Matrix4x4.h \
-		AxisAlignedBox3.h \
-		Material.h \
-		Pvs.h \
-		Rectangle3.h \
-		Vector3.h \
-		common.h \
-		Ray.h \
-		
-
-Mesh.obj: Mesh.cpp  \
-		Ray.h \
-		Mesh.h \
-		MeshKdTree.h \
-		Triangle3.h \
-		Matrix4x4.h \
-		Vector3.h \
-		common.h \
-		Intersectable.h \
-		Plane3.h \
-		AxisAlignedBox3.h \
-		Material.h \
-		Pvs.h \
-		Rectangle3.h \
-		Containers.h \
-		
-
-Exporter.obj: Exporter.cpp  \
-		X3dExporter.h \
-		Exporter.h \
-		Containers.h \
-		VssRay.h \
-		Material.h \
-		Vector3.h \
-		Ray.h \
-		common.h \
-		Matrix4x4.h \
-		
-
-Camera.obj: Camera.cpp  \
-		Camera.h \
-		Ray.h \
-		KdTree.h \
-		Mesh.h \
-		Exporter.h \
-		Vector3.h \
-		AxisAlignedBox3.h \
-		common.h \
-		Rectangle3.h \
-		Matrix4x4.h \
-		Plane3.h \
-		Containers.h \
-		Pvs.h \
-		Intersectable.h \
-		Material.h \
-		VssRay.h \
-		
-
-X3dParser.obj: X3dParser.cpp  \
-		X3dParser.h \
-		X3dParserXerces.h \
-		Mesh.h \
-		SceneGraph.h \
-		Triangle3.h \
-		ViewCellsManager.h \
-		Parser.h \
-		Containers.h \
-		Intersectable.h \
-		Plane3.h \
-		Matrix4x4.h \
-		AxisAlignedBox3.h \
-		Material.h \
-		Pvs.h \
-		Rectangle3.h \
-		Vector3.h \
-		common.h \
-		Ray.h \
-		VssRay.h \
-		
-
-MeshKdTree.obj: MeshKdTree.cpp  \
-		Environment.h \
-		Mesh.h \
-		MeshKdTree.h \
-		common.h \
-		Intersectable.h \
-		Plane3.h \
-		Matrix4x4.h \
-		AxisAlignedBox3.h \
-		Material.h \
-		Pvs.h \
-		Rectangle3.h \
-		Vector3.h \
-		Containers.h \
-		Ray.h \
-		
-
-Pvs.obj: Pvs.cpp  \
-		Pvs.h \
-		
-
-MutualVisibility.obj: MutualVisibility.cpp  \
-		KdTree.h \
-		AxisAlignedBox3.h \
-		Ray.h \
-		MutualVisibility.h \
-		Exporter.h \
-		Mesh.h \
-		Triangle3.h \
-		SceneGraph.h \
-		Containers.h \
-		Pvs.h \
-		Rectangle3.h \
-		Matrix4x4.h \
-		Vector3.h \
-		Plane3.h \
-		common.h \
-		Material.h \
-		VssRay.h \
-		Intersectable.h \
-		
-
-Triangle3.obj: Triangle3.cpp  \
-		Triangle3.h \
-		Vector3.h \
-		common.h \
-		
-
-Rectangle3.obj: Rectangle3.cpp  \
-		Rectangle3.h \
-		Vector3.h \
-		common.h \
-		
-
-Plane3.obj: Plane3.cpp  \
-		Plane3.h \
-		Matrix4x4.h \
-		Vector3.h \
-		common.h \
-		
-
-Polygon3.obj: Polygon3.cpp  \
-		Polygon3.h \
-		Mesh.h \
-		ViewCellBsp.h \
-		AxisAlignedBox3.h \
-		Ray.h \
-		Containers.h \
-		Intersectable.h \
-		Plane3.h \
-		Matrix4x4.h \
-		Material.h \
-		Pvs.h \
-		Rectangle3.h \
-		Vector3.h \
-		common.h \
-		Statistics.h \
-		VssRay.h \
-		
-
-ViewCell.obj: ViewCell.cpp  \
-		ViewCell.h \
-		Mesh.h \
-		Intersectable.h \
-		MeshKdTree.h \
-		Triangle3.h \
-		Containers.h \
-		Ray.h \
-		Plane3.h \
-		Matrix4x4.h \
-		AxisAlignedBox3.h \
-		Material.h \
-		Pvs.h \
-		Rectangle3.h \
-		Vector3.h \
-		common.h \
-		
-
-ViewCellBsp.obj: ViewCellBsp.cpp  \
-		Plane3.h \
-		ViewCellBsp.h \
-		Mesh.h \
-		common.h \
-		ViewCell.h \
-		Environment.h \
-		Polygon3.h \
-		Ray.h \
-		AxisAlignedBox3.h \
-		Exporter.h \
-		Vector3.h \
-		Containers.h \
-		Statistics.h \
-		VssRay.h \
-		Intersectable.h \
-		Matrix4x4.h \
-		Material.h \
-		Pvs.h \
-		Rectangle3.h \
-		
-
-Halton.obj: Halton.cpp  \
-		Halton.h \
-		
-
-VssRay.obj: VssRay.cpp  \
-		VssRay.h \
-		AxisAlignedBox3.h \
-		Vector3.h \
-		Ray.h \
-		common.h \
-		Matrix4x4.h \
-		Rectangle3.h \
-		Plane3.h \
-		
-
-VssTree.obj: VssTree.cpp  \
-		VssTree.h \
-		Environment.h \
-		VssRay.h \
-		Intersectable.h \
-		Ray.h \
-		AxisAlignedBox3.h \
-		Statistics.h \
-		Vector3.h \
-		common.h \
-		Matrix4x4.h \
-		Rectangle3.h \
-		Plane3.h \
-		Pvs.h \
-		
-
-VssPreprocessor.obj: VssPreprocessor.cpp  \
-		SceneGraph.h \
-		KdTree.h \
-		VssPreprocessor.h \
-		X3dExporter.h \
-		Environment.h \
-		MutualVisibility.h \
-		Polygon3.h \
-		ViewCell.h \
-		VssRay.h \
-		VssTree.h \
-		ViewCellsManager.h \
-		Containers.h \
-		AxisAlignedBox3.h \
-		Rectangle3.h \
-		Matrix4x4.h \
-		Vector3.h \
-		Plane3.h \
-		common.h \
-		Ray.h \
-		Pvs.h \
-		Preprocessor.h \
-		Mesh.h \
-		Intersectable.h \
-		Material.h \
-		Exporter.h \
-		Statistics.h \
-		
-
-RenderSimulator.obj: RenderSimulator.cpp  \
-		RenderSimulator.h \
-		KdTree.h \
-		ViewCellBsp.h \
-		ViewCell.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 \
-		
-
-VspKdTree.obj: VspKdTree.cpp  \
-		VspKdTree.h \
-		Environment.h \
-		VssRay.h \
-		Intersectable.h \
-		Ray.h \
-		RayInfo.h \
-		AxisAlignedBox3.h \
-		Statistics.h \
-		Containers.h \
-		Vector3.h \
-		common.h \
-		Matrix4x4.h \
-		Rectangle3.h \
-		Plane3.h \
-		Pvs.h \
-		
-
-RayInfo.obj: RayInfo.cpp  \
-		RayInfo.h \
-		Ray.h \
-		VssRay.h \
-		Plane3.h \
-		Matrix4x4.h \
-		Vector3.h \
-		common.h \
-		
-
-RssTree.obj: RssTree.cpp  \
-		RssTree.h \
-		Environment.h \
-		VssRay.h \
-		Intersectable.h \
-		Ray.h \
-		Containers.h \
-		AxisAlignedBox3.h \
-		Statistics.h \
-		Vector3.h \
-		common.h \
-		Matrix4x4.h \
-		Rectangle3.h \
-		Plane3.h \
-		Pvs.h \
-		
-
-RssPreprocessor.obj: RssPreprocessor.cpp  \
-		SceneGraph.h \
-		KdTree.h \
-		RssPreprocessor.h \
-		X3dExporter.h \
-		Environment.h \
-		MutualVisibility.h \
-		Polygon3.h \
-		ViewCell.h \
-		VssRay.h \
-		RssTree.h \
-		ViewCellBsp.h \
-		Containers.h \
-		AxisAlignedBox3.h \
-		Rectangle3.h \
-		Matrix4x4.h \
-		Vector3.h \
-		Plane3.h \
-		common.h \
-		Ray.h \
-		Pvs.h \
-		Preprocessor.h \
-		Mesh.h \
-		Intersectable.h \
-		Material.h \
-		Exporter.h \
-		Statistics.h \
-		
-
-ViewCellsManager.obj: ViewCellsManager.cpp  \
-		ViewCellsManager.h \
-		RenderSimulator.h \
-		Mesh.h \
-		Triangle3.h \
-		ViewCell.h \
-		Environment.h \
-		X3dParser.h \
-		ViewCellBsp.h \
-		KdTree.h \
-		VspKdTree.h \
-		Exporter.h \
-		VspBspTree.h \
-		Ray.h \
-		VssRay.h \
-		Containers.h \
-		Matrix4x4.h \
-		Vector3.h \
-		common.h \
-		Statistics.h \
-		Intersectable.h \
-		Plane3.h \
-		AxisAlignedBox3.h \
-		Material.h \
-		Pvs.h \
-		Rectangle3.h \
-		Parser.h \
-		Polygon3.h \
-		RayInfo.h \
-		
-
-VspBspTree.obj: VspBspTree.cpp  \
-		Plane3.h \
-		VspBspTree.h \
-		Mesh.h \
-		common.h \
-		ViewCell.h \
-		Environment.h \
-		Polygon3.h \
-		Ray.h \
-		AxisAlignedBox3.h \
-		Exporter.h \
-		ViewCellBsp.h \
-		Vector3.h \
-		Containers.h \
-		Statistics.h \
-		VssRay.h \
-		RayInfo.h \
-		Intersectable.h \
-		Matrix4x4.h \
-		Material.h \
-		Pvs.h \
-		Rectangle3.h \
-		
-
-####### Install
-
-install:  
-
-uninstall:  
-
+$(MAKEFILE).Release: Makefile
+$(MAKEFILE).Debug: Makefile
Index: trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h	(revision 462)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h	(revision 463)
Index: trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp	(revision 462)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp	(revision 463)
@@ -862,5 +862,6 @@
 
 		VssRay *ray = rayInf.mRay;
-		const int cf = rayInf.ComputeRayIntersection(candidatePlane, ray->mT);
+		float t;
+		const int cf = rayInf.ComputeRayIntersection(candidatePlane, t);
 
 		if (mSplitPlaneStrategy & LEAST_RAY_SPLITS)
@@ -907,5 +908,5 @@
 					{
 						float newLen = len * 
-							(rayInf.GetMaxT() - rayInf.mRay->mT) / 
+							(rayInf.GetMaxT() - t) / 
 							(rayInf.GetMaxT() - rayInf.GetMinT());
 		
@@ -1305,7 +1306,7 @@
 
 		rays.pop_back();
-	
+		float t;
 		// get classification and receive new t
-		const int cf = bRay.ComputeRayIntersection(plane, ray->mT);
+		const int cf = bRay.ComputeRayIntersection(plane, t);
 
 		switch (cf)
@@ -1323,11 +1324,11 @@
 			if (plane.Side(bRay.ExtrapOrigin()) <= 0)
 			{	
-				backRays.push_back(RayInfo(ray, bRay.GetMinT(), ray->mT));
-				frontRays.push_back(RayInfo(ray, ray->mT, bRay.GetMaxT()));
+				backRays.push_back(RayInfo(ray, bRay.GetMinT(), t));
+				frontRays.push_back(RayInfo(ray, t, bRay.GetMaxT()));
 			}
 			else
 			{
-				frontRays.push_back(RayInfo(ray, bRay.GetMinT(), ray->mT));
-				backRays.push_back(RayInfo(ray, ray->mT, bRay.GetMaxT()));
+				frontRays.push_back(RayInfo(ray, bRay.GetMinT(), t));
+				backRays.push_back(RayInfo(ray, t, bRay.GetMaxT()));
 			}
 			break;
Index: trunk/VUT/GtpVisibilityPreprocessor/src/Environment.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/Environment.cpp	(revision 462)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/Environment.cpp	(revision 463)
@@ -1496,5 +1496,4 @@
   RegisterOption("VssTree.splitType", optString, "split=", "queries");
   RegisterOption("VssTree.splitUseOnlyDrivingAxis", optBool, "splitdriving=", "false");
-
   RegisterOption("VssTree.useRss", optBool, "rss=", "false");
   RegisterOption("VssTree.numberOfEndPointDomains", optInt, "endpoints=", "10000");
@@ -1515,123 +1514,63 @@
 
   RegisterOption("VssTree.interleaveDirSplits", optBool, "interleavedirsplits", "true");
-
   RegisterOption("VssTree.dirSplitDepth", optInt, "dirsplidepth=", "10");
 
-
   
   	RegisterOption("RssPreprocessor.initialSamples",
-
 								 optInt,
-
 								 "-initial_samples=",
-
 								 "100000");
 
-
-
 	RegisterOption("RssPreprocessor.vssSamples",
-
 								 optInt,
-
 								 "-vss_samples=",
-
 								 "1000000");
-
 	
-
   RegisterOption("RssPreprocessor.vssSamplesPerPass",
-
 								 optInt,
-
 								 "-vss_samples_per_pass=",
-
 								 "1000");
 
-
-
 	  RegisterOption("RssPreprocessor.samplesPerPass",
-
 								 optInt,
-
 								 "-samples_per_pass=",
-
 								 "100000");
 
-
-
   RegisterOption("RssPreprocessor.useImportanceSampling",
-
 								 optBool,
-
 								 "-vss_use_importance=",
-
 								 "true");
 
-
   RegisterOption("RssTree.maxDepth", optInt, "kd_depth=", "12");
-
   RegisterOption("RssTree.minPvs", optInt, "kd_minpvs=", "1");
-
   RegisterOption("RssTree.minRays", optInt, "kd_minrays=", "10");
-
   RegisterOption("RssTree.maxCostRatio", optFloat, "maxcost=", "0.95");
-
   RegisterOption("RssTree.maxRayContribution", optFloat, "maxraycontrib=", "0.5");
 
-
-
   RegisterOption("RssTree.epsilon", optFloat, "kd_eps=", "1e-6");
-
   RegisterOption("RssTree.ct_div_ci", optFloat, "kd_ctdivci=", "1.0");
-
   RegisterOption("RssTree.randomize", optBool, "randomize", "false");
-
   RegisterOption("RssTree.splitType", optString, "split=", "queries");
-
   RegisterOption("RssTree.splitUseOnlyDrivingAxis", optBool, "splitdriving=", "false");
-
-
   RegisterOption("RssTree.useRss", optBool, "rss=", "false");
-
-
-
   
   RegisterOption("RssTree.numberOfEndPointDomains", optInt, "endpoints=", "10000");
 
-
-
   RegisterOption("RssTree.minSize", optFloat, "minsize=", "0.001");
 
-
-
   RegisterOption("RssTree.maxTotalMemory", optFloat, "mem=", "60.0");
-
   RegisterOption("RssTree.maxStaticMemory", optFloat, "statmem=", "8.0");
 
-
-
   RegisterOption("RssTree.queryType", optString, "qtype=", "static");
 
-
-
   RegisterOption("RssTree.queryPosWeight", optFloat, "qposweight=", "0.0");
-
   RegisterOption("RssTree.useRefDirSplits", optBool, "refdir", "false");
-
   RegisterOption("RssTree.refDirAngle", optFloat, "refangle=", "10");
-
   RegisterOption("RssTree.refDirBoxMaxSize", optFloat, "refboxsize=", "0.1");
-
   RegisterOption("RssTree.accessTimeThreshold", optInt, "accesstime=", "1000");
-
   RegisterOption("RssTree.minCollapseDepth", optInt, "colldepth=", "4");
 
-
   RegisterOption("RssTree.interleaveDirSplits", optBool, "interleavedirsplits", "true");
-
-
   RegisterOption("RssTree.dirSplitDepth", optInt, "dirsplidepth=", "10");
-
-
 
 
Index: trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.cpp	(revision 462)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.cpp	(revision 463)
Index: trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h	(revision 462)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h	(revision 463)
Index: trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp	(revision 462)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp	(revision 463)
Index: trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp	(revision 462)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp	(revision 463)
Index: trunk/VUT/GtpVisibilityPreprocessor/src/RssTree.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/RssTree.cpp	(revision 459)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/RssTree.cpp	(revision 463)
@@ -234,8 +234,8 @@
 		}
 	  }
-	ComputeEntropyImportance();
-
 	mPvsSize = pvsSize;
 	mValidPvs = true;
+
+	ComputeEntropyImportance();
   }
 }
@@ -294,5 +294,6 @@
   if (mUseRss)
 	forcedBoundingBox = NULL;
-	
+
+  mForcedBoundingBox = forcedBoundingBox;
   for(VssRayContainer::const_iterator ri = rays.begin();
       ri != rays.end();
@@ -1257,5 +1258,5 @@
       ri++) {
 	RssTreeNode::RayInfo info(*ri);
-	if (ClipRay(info, bbox))
+	if (mForcedBoundingBox==NULL || ClipRay(info, bbox))
 	  AddRay(info);
   }
@@ -1642,4 +1643,5 @@
 RssTree::GetTreeStatistics(
 						   float &avgPvsSize,
+						   float &avgRays,
 						   float &avgRayContribution,
 						   float &avgPvsEntropy,
@@ -1656,4 +1658,5 @@
   float sumPvsEntropy = 0.0f;
   float sumRayLengthEntropy = 0.0f;
+  float sumRays = 0.0f;
   
   int leaves = 0;
@@ -1666,10 +1669,12 @@
 	  leaves++;
 	  RssTreeLeaf *leaf = (RssTreeLeaf *)node;
-
+	  leaf->UpdatePvsSize();
+	  
 	  sumPvsSize += leaf->GetPvsSize();
 	  sumRayContribution += leaf->GetAvgRayContribution();
 	  sumPvsEntropy += leaf->mPvsEntropy;
 	  sumRayLengthEntropy += leaf->mRayLengthEntropy;
-
+	  sumRays += leaf->rays.size();
+	  
 	  float imp = leaf->GetImportance();
 	  
@@ -1689,4 +1694,5 @@
   
   avgPvsSize = sumPvsSize/(float)leaves;
+  avgRays = sumRays/(float)leaves;
   avgRayContribution = sumRayContribution/(float)leaves;
   avgPvsEntropy = sumPvsEntropy/(float)leaves;
@@ -1757,5 +1763,6 @@
 RssTree::ValidLeaf(RssTreeLeaf *leaf) const
 {
-  return leaf->rays.size() > termMinRays/4;
+  return true;
+  //return leaf->rays.size() > termMinRays/4;
 }
 
@@ -1766,23 +1773,27 @@
 						  SimpleRayContainer &rays)
 {
+
   int nrays = leaf->rays.size();
   for (int i=0; i < numberOfRays; i++) {
-	// pickup 3 random rays
-	int r1 = Random(nrays-1);
-	int r2 = Random(nrays-1);
-	int r3 = Random(nrays-1);
-		
-	Vector3 o1 = leaf->rays[r1].GetOrigin();
-
-	Vector3 o2 = leaf->rays[r2].GetOrigin();
-		
-	Vector3 o3 = leaf->rays[r3].GetOrigin();
-
-	const float overlap = 0.0;
+	bool useExtendedConvexCombination = (nrays >= 3) && (i > numberOfRays/2);
+
 		
 	Vector3 origin, direction;
 	// generate half of convex combination and half of random rays
-	bool useExtendedConvexCombination = 0 &&  (i > numberOfRays/2);
 	if (useExtendedConvexCombination) {
+	  // pickup 3 random rays
+	  int r1 = Random(nrays);
+	  int r2 = Random(nrays);
+	  int r3 = Random(nrays);
+	  
+	  Vector3 o1 = leaf->rays[r1].GetOrigin();
+	  
+	  Vector3 o2 = leaf->rays[r2].GetOrigin();
+	  
+	  Vector3 o3 = leaf->rays[r3].GetOrigin();
+	  
+	  const float overlap = 0.0;
+	  
+
 	  float w1, w2, w3;
 	  GenerateExtendedConvexCombinationWeights(w1, w2, w3, overlap);
Index: trunk/VUT/GtpVisibilityPreprocessor/src/VssTree.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/VssTree.cpp	(revision 446)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/VssTree.cpp	(revision 463)
@@ -597,7 +597,7 @@
 		ri++)
       if ((*ri).mRay->IsActive()) {
-				
+		float t;
 		// determine the side of this ray with respect to the plane
-		int side = (*ri).ComputeRayIntersection(axis, position, (*ri).mRay->mT);
+		int side = (*ri).ComputeRayIntersection(axis, position, t);
 		//				(*ri).mRay->mSide = side;
 				
@@ -1066,5 +1066,6 @@
 		// Debug << "computed t: " << (*ri).mRay->mT << endl;
 		// determine the side of this ray with respect to the plane
-		int side = node->ComputeRayIntersection(*ri, (*ri).mRay->mT);
+		float t;
+		int side = node->ComputeRayIntersection(*ri, t);
 		
 		if (side == 0) {
@@ -1072,16 +1073,16 @@
 			back->AddRay(VssTreeNode::RayInfo((*ri).mRay,
 											  (*ri).mMinT,
-											  (*ri).mRay->mT)
+											  t)
 						 );
 			front->AddRay(VssTreeNode::RayInfo((*ri).mRay,
-											   (*ri).mRay->mT,
+											   t,
 											   (*ri).mMaxT));
 		  } else {
 			back->AddRay(VssTreeNode::RayInfo((*ri).mRay,
-											  (*ri).mRay->mT,
+											  t,
 											  (*ri).mMaxT));
 			front->AddRay(VssTreeNode::RayInfo((*ri).mRay,
 											   (*ri).mMinT,
-											   (*ri).mRay->mT));
+											   t));
 		  }
 		} else
@@ -1382,8 +1383,8 @@
   
   if (in->axis <= VssTreeNode::SPLIT_Z) {
-
+	float t;
     // determine the side of this ray with respect to the plane
     int side = in->ComputeRayIntersection(data.rayData,
-										  data.rayData.mRay->mT);
+										  t);
     
   
@@ -1393,10 +1394,10 @@
 									 VssTreeNode::RayInfo(data.rayData.mRay,
 														  data.rayData.mMinT,
-														  data.rayData.mRay->mT))
+														  t))
 					);
 				
 		tstack.push(RayTraversalData(in->front,
 									 VssTreeNode::RayInfo(data.rayData.mRay,
-														  data.rayData.mRay->mT,
+														  t,
 														  data.rayData.mMaxT
 														  ))
@@ -1406,5 +1407,5 @@
 		tstack.push(RayTraversalData(in->back,
 									 VssTreeNode::RayInfo(data.rayData.mRay,
-														  data.rayData.mRay->mT,
+														  t,
 														  data.rayData.mMaxT
 														  ))
@@ -1414,5 +1415,5 @@
 									 VssTreeNode::RayInfo(data.rayData.mRay,
 														  data.rayData.mMinT,
-														  data.rayData.mRay->mT))
+														  t))
 					);
 				
Index: trunk/VUT/GtpVisibilityPreprocessor/src/VssRay.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/VssRay.h	(revision 448)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/VssRay.h	(revision 463)
@@ -26,5 +26,5 @@
 	
   // computed t
-  float mT;
+  //  float mT;
 
   // inverse of the ray size
@@ -56,6 +56,6 @@
 	mTerminationObject(terminationObject),
 	mRefCount(0),
-    mFlags(0),
-	mT(1.0f)
+    mFlags(0)
+	//	mT(1.0f)
   {
     Precompute();
@@ -66,6 +66,6 @@
 	mFlags(0),
 	mMailbox(-1),
-	mOriginObject(ray.sourceObject.mObject),
-	mT(1.0f)
+	mOriginObject(ray.sourceObject.mObject)
+	//	mT(1.0f)
 	{
 		if (ray.sourceObject.mObject)
Index: trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp	(revision 462)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp	(revision 463)
@@ -14,9 +14,13 @@
 static bool useViewSpaceBox = true;
 static bool use2dSampling = false;
-static bool fromBoxVisibility = true;
+static bool fromBoxVisibility = false;
 
 static bool exportPvs = false;
-static int numExportRays = 10000;
+static bool exportRssTree = false;
+
+static int numExportRays = 5000;
 // static int numExportRays = 0;
+
+static bool useViewcells = false;
 
 RssPreprocessor::RssPreprocessor():
@@ -192,4 +196,6 @@
 {
   int num;
+
+
   
   float avgPvsSize;
@@ -198,7 +204,8 @@
   float avgRayLengthEntropy;
   float avgImportance;
-  
+  float avgRays;
   rssTree->GetTreeStatistics(
 							 avgPvsSize,
+							 avgRays,
 							 avgRayContribution,
 							 avgPvsEntropy,
@@ -208,4 +215,5 @@
   cout<<
 	"#AVG_PVS_SIZE\n"<<avgPvsSize<<endl<<
+	"#AVG_RAYS\n"<<avgRays<<endl<<
 	"#AVG_RAY_CONTRIB\n"<<avgRayContribution<<endl<<
 	"#AVG_PVS_ENTROPY\n"<<avgPvsEntropy<<endl<<
@@ -485,7 +493,7 @@
   }
   
-
-  // construct view cells
-  mViewCellsManager->Construct(mObjects, mVssRays, mViewSpaceBox);
+  if (useViewcells)
+	// construct view cells
+	mViewCellsManager->Construct(mObjects, mVssRays, mViewSpaceBox);
 
   rssTree = new RssTree;
@@ -498,11 +506,12 @@
 
   cout<<"RssTree root PVS size = "<<rssTree->GetRootPvsSize()<<endl;
-  
-  ExportRssTree("rss-tree-100.x3d", rssTree, Vector3(1,0,0));
-  ExportRssTree("rss-tree-001.x3d", rssTree, Vector3(0,0,1));
-  ExportRssTree("rss-tree-101.x3d", rssTree, Vector3(1,0,1));
-  ExportRssTree("rss-tree-101m.x3d", rssTree, Vector3(-1,0,-1));
-
-  ExportRssTreeLeaves(rssTree, 10);
+
+  if (exportRssTree) {
+	ExportRssTree("rss-tree-100.x3d", rssTree, Vector3(1,0,0));
+	ExportRssTree("rss-tree-001.x3d", rssTree, Vector3(0,0,1));
+	ExportRssTree("rss-tree-101.x3d", rssTree, Vector3(1,0,1));
+	ExportRssTree("rss-tree-101m.x3d", rssTree, Vector3(-1,0,-1));
+	ExportRssTreeLeaves(rssTree, 10);
+  }
 
   if (exportPvs) {
@@ -558,6 +567,8 @@
 	}
 
-	float avgPvs = GetAvgPvsSize(rssTree, kdViewcells);
-	cout<<"Average PVS size = "<<avgPvs<<endl;
+	if (useViewcells) {
+	  float avgPvs = GetAvgPvsSize(rssTree, kdViewcells);
+	  cout<<"Average PVS size = "<<avgPvs<<endl;
+	}
 
 	if (numExportRays) {
@@ -571,43 +582,47 @@
 	}
 
-	//-- prepare traversal rays for view cell intersections
-	RayContainer passRays;
-
-	VssRayContainer::const_iterator it, it_end = vssRays.end();
-	
-	for (it = vssRays.begin(); it != it_end; ++ it)
+	samples+=num;
+
+	if (useViewcells) {
+	  
+	  //-- prepare traversal rays for view cell intersections
+	  RayContainer passRays;
+	  
+	  VssRayContainer::const_iterator it, it_end = vssRays.end();
+	  
+	  for (it = vssRays.begin(); it != it_end; ++ it)
 		passRays.push_back(new Ray(*(*it)));
-	
-	int sampleContributions = 0;
-	int contributingSamples = 0;
-
-	/// compute view cell contribution of rays
-	mViewCellsManager->ComputeSampleContributions(passRays,
-												  sampleContributions, 
-												  contributingSamples);
-	
-	//-- save rays for post processing
-	if (((int)storedRays.size() < mViewCellsManager->GetPostProcessSamples()) ||
-		((int)storedRays.size() < mViewCellsManager->GetVisualizationSamples()))
-	{
-		RayContainer::const_iterator it, it_end = passRays.end();
-
-		for (it = passRays.begin(); it != it_end; ++ it)
+	  
+	  int sampleContributions = 0;
+	  int contributingSamples = 0;
+	  
+	  /// compute view cell contribution of rays
+	  mViewCellsManager->ComputeSampleContributions(passRays,
+													sampleContributions, 
+													contributingSamples);
+	  
+	  //-- save rays for post processing
+	  if (((int)storedRays.size() < mViewCellsManager->GetPostProcessSamples()) ||
+		  ((int)storedRays.size() < mViewCellsManager->GetVisualizationSamples()))
+		{
+		  RayContainer::const_iterator it, it_end = passRays.end();
+		  
+		  for (it = passRays.begin(); it != it_end; ++ it)
 			storedRays.push_back(new Ray(*(*it)));
-	}
-	else
-	{
-		CLEAR_CONTAINER(passRays);
-	}
-
-	samples+=num;
-	float pvs = rssTree->GetAvgPvsSize();
-	cout<<"*****************************\n";
-	cout<<samples<<" avgPVS ="<<pvs<<endl;
-	cout<<"sample contributions ="<<sampleContributions<<endl;
-	cout<<"contributing sample ="<<contributingSamples<<endl;
-	cout<<"RssTree root PVS size = "<<rssTree->GetRootPvsSize()<<endl;
-	cout<<"*****************************\n";
-
+		}
+	  else
+		{
+		  CLEAR_CONTAINER(passRays);
+		}
+	  
+	  float pvs = rssTree->GetAvgPvsSize();
+	  cout<<"*****************************\n";
+	  cout<<samples<<" avgPVS ="<<pvs<<endl;
+	  cout<<"sample contributions ="<<sampleContributions<<endl;
+	  cout<<"contributing sample ="<<contributingSamples<<endl;
+	  cout<<"RssTree root PVS size = "<<rssTree->GetRootPvsSize()<<endl;
+	  cout<<"*****************************\n";
+	}
+	
 	if (exportPvs) {
 	  char filename[64];
@@ -623,22 +638,25 @@
   }
   
-  //-- post process view cells
-  mViewCellsManager->PostProcess(mObjects, storedRays);
-
-  //-- several visualizations and statistics
-  mViewCellsManager->PrintStatistics(Debug);
-
-  //-- render simulation after merge
-  cout << "\nevaluating render time of final view cells ... ";
-		 
-  const SimulationStatistics ss = mViewCellsManager->SimulateRendering();
-		 
-  cout << " finished" << endl;
-
-  cout << ss << endl;
-  Debug << ss << endl;
-
-  mViewCellsManager->Visualize(mObjects, storedRays);
-
+  if (useViewcells) {
+	
+	//-- post process view cells
+	mViewCellsManager->PostProcess(mObjects, storedRays);
+	
+	//-- several visualizations and statistics
+	mViewCellsManager->PrintStatistics(Debug);
+	
+	//-- render simulation after merge
+	cout << "\nevaluating render time of final view cells ... ";
+	
+	const SimulationStatistics ss = mViewCellsManager->SimulateRendering();
+	
+	cout << " finished" << endl;
+	
+	cout << ss << endl;
+	Debug << ss << endl;
+	
+	mViewCellsManager->Visualize(mObjects, storedRays);
+  }
+  
   delete rssTree;
   
Index: trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.h	(revision 441)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.h	(revision 463)
Index: trunk/VUT/GtpVisibilityPreprocessor/src/default.env
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/default.env	(revision 459)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/default.env	(revision 463)
@@ -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
 }
 
@@ -39,5 +39,5 @@
 	maxDepth 	40
 	minPvs		3
-	minRays		100
+	minRays		200
 	minSize		0.001
  	maxCostRatio	2.0
@@ -47,7 +47,7 @@
 	maxStaticMemory	100
 
-	splitType regular
+#	splitType regular
 #	splitType heuristic
-#	splitType hybrid
+	splitType hybrid
 	splitUseOnlyDrivingAxis true
 
@@ -64,7 +64,7 @@
 RssPreprocessor {
 	samplesPerPass  100000
-	initialSamples 1000000
-	vssSamples 1000000
-	vssSamplesPerPass 50000
+	initialSamples 500000
+	vssSamples 50000000
+	vssSamplesPerPass 500000
 	useImportanceSampling true
 }
Index: trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.h	(revision 445)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.h	(revision 463)
Index: trunk/VUT/GtpVisibilityPreprocessor/src/preprocessor.pro
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/preprocessor.pro	(revision 459)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/preprocessor.pro	(revision 463)
@@ -1,3 +1,2 @@
-
 TEMPLATE = app
 
Index: trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.h
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.h	(revision 462)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.h	(revision 463)
Index: trunk/VUT/GtpVisibilityPreprocessor/src/AxisAlignedBox3.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/AxisAlignedBox3.cpp	(revision 448)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/AxisAlignedBox3.cpp	(revision 463)
Index: trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp	(revision 462)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp	(revision 463)
