Index: trunk/VUT/GtpVisibilityPreprocessor/scripts/Preprocessor.vcproj
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/scripts/Preprocessor.vcproj	(revision 136)
+++ trunk/VUT/GtpVisibilityPreprocessor/scripts/Preprocessor.vcproj	(revision 179)
@@ -62,5 +62,5 @@
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\include"
+				AdditionalIncludeDirectories="&quot;$(ZLIB_PATH)\include&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\Qt&quot;;&quot;$(XERCES_PATH)\include&quot;;..\include"
 				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
 				RuntimeLibrary="2"
@@ -102,14 +102,137 @@
 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
 			<File
+				RelativePath="..\src\AxisAlignedBox3.cpp">
+			</File>
+			<File
+				RelativePath="..\src\AxisAlignedBox3.h">
+			</File>
+			<File
+				RelativePath="..\src\Camera.cpp">
+			</File>
+			<File
+				RelativePath="..\src\Camera.h">
+			</File>
+			<File
+				RelativePath="..\src\common.cpp">
+			</File>
+			<File
+				RelativePath="..\src\common.h">
+			</File>
+			<File
+				RelativePath="..\src\Containers.h">
+			</File>
+			<File
+				RelativePath="..\src\Environment.cpp">
+			</File>
+			<File
+				RelativePath="..\src\Environment.h">
+			</File>
+			<File
 				RelativePath="..\src\ExactPreprocessor.cpp">
 			</File>
 			<File
+				RelativePath="..\src\ExactPreprocessor.h">
+			</File>
+			<File
+				RelativePath="..\src\Exporter.cpp">
+			</File>
+			<File
+				RelativePath="..\src\Exporter.h">
+			</File>
+			<File
+				RelativePath="..\src\gzstream.cpp">
+			</File>
+			<File
+				RelativePath="..\src\gzstream.h">
+			</File>
+			<File
+				RelativePath="..\src\Intersectable.h">
+			</File>
+			<File
 				RelativePath="..\src\KdTree.cpp">
 			</File>
 			<File
+				RelativePath="..\src\KdTree.h">
+			</File>
+			<File
+				RelativePath="..\src\main.cpp">
+			</File>
+			<File
+				RelativePath="..\src\Material.cpp">
+			</File>
+			<File
+				RelativePath="..\src\Material.h">
+			</File>
+			<File
+				RelativePath="..\src\Matrix4x4.cpp">
+			</File>
+			<File
+				RelativePath="..\src\Matrix4x4.h">
+			</File>
+			<File
+				RelativePath="..\src\Mesh.cpp">
+			</File>
+			<File
+				RelativePath="..\src\Mesh.h">
+			</File>
+			<File
+				RelativePath="..\src\Parser.h">
+			</File>
+			<File
+				RelativePath="..\src\Plane3.h">
+			</File>
+			<File
 				RelativePath="..\src\Preprocessor.cpp">
 			</File>
 			<File
+				RelativePath="..\src\Preprocessor.h">
+			</File>
+			<File
+				RelativePath="..\src\Ray.cpp">
+			</File>
+			<File
+				RelativePath="..\src\Ray.h">
+			</File>
+			<File
 				RelativePath="..\src\SamplingPreprocessor.cpp">
+			</File>
+			<File
+				RelativePath="..\src\SamplingPreprocessor.h">
+			</File>
+			<File
+				RelativePath="..\src\SceneGraph.cpp">
+			</File>
+			<File
+				RelativePath="..\src\SceneGraph.h">
+			</File>
+			<File
+				RelativePath="..\src\UnigraphicsParser.cpp">
+			</File>
+			<File
+				RelativePath="..\src\UnigraphicsParser.h">
+			</File>
+			<File
+				RelativePath="..\src\Vector3.cpp">
+			</File>
+			<File
+				RelativePath="..\src\Vector3.h">
+			</File>
+			<File
+				RelativePath="..\src\ViewCellBsp.h">
+			</File>
+			<File
+				RelativePath="..\src\VisibilityVector3.h">
+			</File>
+			<File
+				RelativePath="..\src\X3dExporter.cpp">
+			</File>
+			<File
+				RelativePath="..\src\X3dExporter.h">
+			</File>
+			<File
+				RelativePath="..\src\X3dParser.cpp">
+			</File>
+			<File
+				RelativePath="..\src\X3dParser.h">
 			</File>
 		</Filter>
Index: trunk/VUT/GtpVisibilityPreprocessor/src/X3dParser.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/X3dParser.cpp	(revision 176)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/X3dParser.cpp	(revision 179)
@@ -24,5 +24,5 @@
 #include "X3dParser.h"
 
-#include "X3dParserXerces.h"
+//#include "X3dParserXerces.h"
 #include "Mesh.h"
 #include "SceneGraph.h"
Index: trunk/VUT/GtpVisibilityPreprocessor/src/UnigraphicsParser.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/UnigraphicsParser.cpp	(revision 167)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/UnigraphicsParser.cpp	(revision 179)
@@ -35,5 +35,5 @@
   char str[80];
   Face     *face;
-  Vector3  *vptr;
+  //Vector3  *vptr;
   
   float x,y,z;
Index: trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp	(revision 177)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp	(revision 179)
@@ -73,5 +73,7 @@
     int passSampleContributions = 0;
     int passSamples = 0;
-    
+	int index = 0;
+    KdNode *visibleNode = NULL;
+
     for (i =0; i < objects.size(); i++) {
       KdNode *nodeToSample = NULL;
@@ -80,92 +82,97 @@
       int pvsSize = object->mKdPvs.GetSize();
       
-      if (0 && pvsSize) {
-	// mail all nodes from the pvs
-	Intersectable::NewMail();
-	KdPvsMap::iterator i = object->mKdPvs.mEntries.begin();
-	for (; i != object->mKdPvs.mEntries.end(); i++) {
-	  KdNode *node = (*i).first;
-	  node->Mail();
+    if (0 && pvsSize) {
+		// mail all nodes from the pvs
+		Intersectable::NewMail();
+		KdPvsMap::iterator i = object->mKdPvs.mEntries.begin();
+		for (; i != object->mKdPvs.mEntries.end(); i++) {
+			KdNode *node = (*i).first;
+			node->Mail();
+		}
+		int maxTries = 2*pvsSize;
+	
+		for (int tries = 0; tries < 10; tries++) {
+			index = RandomValue(0, pvsSize - 1);
+			KdPvsData data;
+			object->mKdPvs.GetData(index, visibleNode, data);
+			nodeToSample = mKdTree->FindRandomNeighbor(visibleNode, true);
+			if (nodeToSample)
+			break;
+		}
 	}
-	int maxTries = 2*pvsSize;
-	for (int tries = 0; tries < 10; tries++) {
-	  int index = RandomValue(0, pvsSize - 1);
-	  KdPvsData data;
-	  KdNode *visibleNode;
-	  object->mKdPvs.GetData(index, visibleNode, data);
-	  nodeToSample = mKdTree->FindRandomNeighbor(visibleNode, true);
-	  if (nodeToSample)
-	    break;
-	}
+
+    if (pvsSize) {
+		// mail all nodes from the pvs
+		Intersectable::NewMail();
+		KdPvsMap::iterator i = object->mKdPvs.mEntries.begin();
+		for (; i != object->mKdPvs.mEntries.end(); i++) {
+			KdNode *node = (*i).first;
+			node->Mail();
+		}
+	
+		vector<KdNode *> invisibleNeighbors;
+		// get all neighbors of all PVS nodes
+		i = object->mKdPvs.mEntries.begin();
+		for (; i != object->mKdPvs.mEntries.end(); i++) {
+			KdNode *node = (*i).first;
+			mKdTree->FindNeighbors(visibleNode, invisibleNeighbors, true);
+		}
+
+		KdPvsData data;
+		KdNode *visibleNode;
+		object->mKdPvs.GetData(index, visibleNode, data);
+		nodeToSample = mKdTree->FindRandomNeighbor(visibleNode, true);
+		if (nodeToSample)
+			break;
       }
-
-      if (pvsSize) {
-	// mail all nodes from the pvs
-	Intersectable::NewMail();
-	KdPvsMap::iterator i = object->mKdPvs.mEntries.begin();
-	for (; i != object->mKdPvs.mEntries.end(); i++) {
-	  KdNode *node = (*i).first;
-	  node->Mail();
-	}
-	vector<KdNode *> invisibleNeighbors;
-	// get all neighbors of all PVS nodes
-	KdPvsMap::iterator i = object->mKdPvs.mEntries.begin();
-	for (; i != object->mKdPvs.mEntries.end(); i++) {
-	  KdNode *node = (*i).first;
-	  mKdTree->FindNeighbors(visibleNode, invisibleNeighbors, true);
-	}
-
-	KdPvsData data;
-	KdNode *visibleNode;
-	object->mKdPvs.GetData(index, visibleNode, data);
-	nodeToSample = mKdTree->FindRandomNeighbor(visibleNode, true);
-	if (nodeToSample)
-	  break;
-      }
       
 
       for (int k=0; k < mSamplesPerPass; k++) {
-	object->GetRandomSurfacePoint(point, normal);
-	if (nodeToSample) {
-	  int maxTries = 5;
-	  for (int tries = 0; tries < maxTries; tries++) {
-	    direction = mKdTree->GetBox(nodeToSample).GetRandomPoint() - point;
-	    if (DotProd(direction, normal) > Limits::Small)
-	      break;
-	  }
-	  if (tries == maxTries)
-	    direction = UniformRandomVector(normal);
-	} else
-	  direction = UniformRandomVector(normal);
-	
-	// construct a ray
-	SetupRay(ray, point, direction);
-	mKdTree->CastRay(ray);
-
-	if (i < pvsOut)
-	  rays[i].push_back(ray);
-	
-	int sampleContributions = 0;
-	
-	if (ray.leaves.size()) {
-	  sampleContributions += AddNodeSamples(object, ray);
+		  object->GetRandomSurfacePoint(point, normal);
+		  if (nodeToSample) {
+			  int maxTries = 5;
+			  for (int tries = 0; tries < maxTries; tries++) {
+				  direction = mKdTree->GetBox(nodeToSample).GetRandomPoint() - point;
+				  if (DotProd(direction, normal) > Limits::Small)
+					break;
+			  }
+		
+			  if (tries == maxTries)
+				  direction = UniformRandomVector(normal);
+		  } else
+			  direction = UniformRandomVector(normal);
+	
+		  // construct a ray
+		  SetupRay(ray, point, direction);
+		  mKdTree->CastRay(ray);
+
+		  if (i < pvsOut)
+			  rays[i].push_back(ray);
+	
+		  int sampleContributions = 0;
+	
+		  
+		  if (ray.leaves.size()) {
+			  sampleContributions += AddNodeSamples(object, ray);
 	  
-	  if (ray.intersections.size()) {
-	    sampleContributions += AddNodeSamples(ray.intersections[0].mObject, ray);
-	    // check whether we can add this to the rays
-	    for (int j = 0; j < pvsOut; j++) {
-	      if (objects[j] == ray.intersections[0].mObject) {
-		rays[j].push_back(ray);
-	      }
-	    }
-	  }
-	  passSamples++;
-	  if (sampleContributions) {
-	    passContributingSamples++;
-	    passSampleContributions += sampleContributions;
+			  if (ray.intersections.size()) {
+				  sampleContributions += AddNodeSamples(ray.intersections[0].mObject, ray);
+				  // check whether we can add this to the rays
+				  for (int j = 0; j < pvsOut; j++) {
+					  if (objects[j] == ray.intersections[0].mObject) {
+						  rays[j].push_back(ray);
+					  }
+				  }
+			  }
+		
+			  passSamples++;
+			
+			  if (sampleContributions) {
+				  passContributingSamples++;
+				  passSampleContributions += sampleContributions;
+			  }
+		  }
 	  }
 	}
-      }
-    }
     totalSamples += passSamples;
     pass++;
Index: trunk/VUT/GtpVisibilityPreprocessor/src/Camera.cpp
===================================================================
--- trunk/VUT/GtpVisibilityPreprocessor/src/Camera.cpp	(revision 176)
+++ trunk/VUT/GtpVisibilityPreprocessor/src/Camera.cpp	(revision 179)
@@ -20,5 +20,7 @@
   
   
-  QImage image(mWidth, mHeight, 32);
+ // QImage image(mWidth, mHeight, 32); changed by matt
+  QImage image(mWidth, mHeight, QImage::Format_RGB32);
+  
   vector<Ray> rays;
 
