Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ObjectPvs.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ObjectPvs.h	(revision 2116)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ObjectPvs.h	(revision 2116)
@@ -0,0 +1,48 @@
+#ifndef __OBJECTPVS_H
+#define __OBJECTPVS_H
+
+#include "common.h"
+#include "PvsDefinitions.h"
+
+using namespace std;
+
+namespace GtpVisibilityPreprocessor {
+
+class KdNode;
+class BspNode;
+class Ray;
+class Intersectable;
+class ViewCell;
+
+
+class ObjectPvs: public DefaultPvs
+{
+public:
+	/** Counts object int the pvs. Different to method "GetSize", not
+		only the raw container size is returned,
+		but the individual contributions of the entries are summed up.
+	*/
+	float EvalPvsCost() const;
+
+	friend ostream &operator<<(ostream &s, const ObjectPvs &p) 
+	{
+		ObjectPvsIterator pit = p.GetIterator();
+
+		while (pit.HasMoreEntries())
+		{		
+			const ObjectPvsEntry &entry = pit.Next();
+			Intersectable *obj = entry.mObject;
+
+			cout << obj << " ";
+		}
+		
+		return s;
+	}
+};
+
+
+
+}
+
+#endif
+
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj	(revision 2066)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj	(revision 2116)
@@ -21,5 +21,5 @@
 				Optimization="0"
 				AdditionalIncludeDirectories="..\include;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NO_QT"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NO_QT;USE_HASH_PVS"
 				MinimalRebuild="TRUE"
 				BasicRuntimeChecks="3"
@@ -81,5 +81,5 @@
 				OptimizeForWindowsApplication="TRUE"
 				AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\MultiLevelRayTracing;Timer"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NO_QT"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NO_QT;USE_HASH_PVS"
 				RuntimeLibrary="2"
 				EnableEnhancedInstructionSet="2"
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ObjExporter.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ObjExporter.h	(revision 1694)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ObjExporter.h	(revision 2116)
@@ -12,5 +12,5 @@
 #include "Containers.h"
 #include "VssRay.h"
-#include "ViewCell.h"
+//#include "ViewCell.h"
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp	(revision 1789)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp	(revision 2116)
@@ -32,5 +32,5 @@
 #include "IntersectableWrapper.h"
 #include <assert.h>
-
+#include "Polygon3.h"
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h	(revision 2115)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h	(revision 2116)
@@ -7,5 +7,5 @@
 #include "Containers.h"
 #include "ViewCell.h"
-#include "ViewCellBsp.h"
+//#include "ViewCellBsp.h"
 
 namespace GtpVisibilityPreprocessor {
@@ -43,17 +43,18 @@
 struct AxisAlignedPlane;
 struct BspRay;
-
-
-
-
-  struct PvsFilterStatistics {
+class BspTree;
+
+
+
+struct PvsFilterStatistics 
+{
 	PvsFilterStatistics(): 
-  mAvgFilterRadius(0.0f), mLocalFilterCount(0), mGlobalFilterCount(0) {}
+	mAvgFilterRadius(0.0f), mLocalFilterCount(0), mGlobalFilterCount(0) {}
+	
 	float mAvgFilterRadius;
 	int mLocalFilterCount;
 	int mGlobalFilterCount;
-	
-  };
-  
+};
+
 /** Probably Visible Set 
 */
@@ -61,11 +62,11 @@
 {
 public:
-  /// root of view cells tree
-  ViewCell *mViewCell;
-
-  // input parameter is the render budget for the PrVs
-  float mRenderBudget;
-
-  // some characteristic values could be stored as well
+	/// root of view cells tree
+	ViewCell *mViewCell;
+
+	// input parameter is the render budget for the PrVs
+	float mRenderBudget;
+
+	// some characteristic values could be stored as well
 };
 
@@ -85,39 +86,42 @@
 {
 public:
-  
-  struct PerViewCellStat {
-	float pvsSize;
-	float relPvsIncrease;
-  };
-
-  struct SamplesStatistics {
-	int mRays;
-	int mViewCells;
-	int mContributingRays;
-	int mPvsContributions;
-	void Reset() {
-	  mRays = 0;
-	  mViewCells = 0;
-	  mContributingRays = 0;
-	  mPvsContributions = 0;
+
+	struct PerViewCellStat 
+	{
+		float pvsSize;
+		float relPvsIncrease;
 	};
-  };
-
-  struct PvsStatistics 
+
+	struct SamplesStatistics 
 	{
-	  float minPvs;
-	  float maxPvs;
-	  float avgPvs;
-	  float avgPvsEntries;
-	  
-	  float avgFilteredPvs;
-	  float avgFilteredPvsEntries;
-
-	  float avgFilterContribution;
-	  float avgFilterRadius;
-	  float avgFilterRatio;
-	  float avgRelPvsIncrease;
-	  float devRelPvsIncrease;
-	  int viewcells;
+		int mRays;
+		int mViewCells;
+		int mContributingRays;
+		int mPvsContributions;
+		void Reset() 
+		{
+			mRays = 0;
+			mViewCells = 0;
+			mContributingRays = 0;
+			mPvsContributions = 0;
+		};
+	};
+
+	struct PvsStatistics 
+	{
+		float minPvs;
+		float maxPvs;
+		float avgPvs;
+		float avgPvsEntries;
+
+		float avgFilteredPvs;
+		float avgFilteredPvsEntries;
+
+		float avgFilterContribution;
+		float avgFilterRadius;
+		float avgFilterRatio;
+		float avgRelPvsIncrease;
+		float devRelPvsIncrease;
+		int viewcells;
 	};
   
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.h	(revision 2091)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.h	(revision 2116)
@@ -7,8 +7,7 @@
 
 
-
 #include "Material.h"
 #include "Containers.h"
-#include "VssRay.h"
+//#include "VssRay.h"
 #include "AxisAlignedBox3.h"
 
@@ -31,5 +30,9 @@
 class BvHierarchy;
 class TransformedMeshInstance;
+class MeshInstance;
+class VssRay;
+//class Material;
 
+struct VssRayContainer;
 
 class Exporter
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/HashPvs.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/HashPvs.h	(revision 2102)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/HashPvs.h	(revision 2116)
@@ -2,6 +2,6 @@
 #define __HASHPVS_H
 
-#include <hash_map>
-#include <vector>
+//#include <hash_map>
+#include <hash_set>
 #include "common.h"
 #include <math.h>
@@ -13,9 +13,71 @@
 namespace GtpVisibilityPreprocessor {
 
-class KdNode;
-class BspNode;
-class Ray;
-class Intersectable;
-class ViewCell;
+
+template<typename T>
+struct my_hash_compare
+{
+   enum
+   {
+      bucket_size = 4,
+      min_buckets = 80
+   };
+
+   size_t operator()(T a) const
+   {
+      size_t h = (size_t)(a->GetId());// % 2000;
+      //for (; *s; ++s)
+      //   h = 5 * h + *s;
+      return h;
+   }
+
+   bool operator()(T a, T b) const
+   {
+      return a < b;
+   }
+};
+
+/*
+template<typename T>
+struct gt
+{
+	bool operator() (T s1, T s2) const
+	{
+		return s1 > s2;
+	}
+};
+*/
+//#define HASH_SET stdext::hash_set<T, stdext::hash_compare<T, gt<T> > >
+#define HASH_SET stdext::hash_set<T, my_hash_compare<T> >
+
+/** Iterator over a hash pvs.
+*/
+template<typename T, typename S>
+class HashPvsIterator
+{
+public:
+	
+	HashPvsIterator<T, S>() {}
+
+	HashPvsIterator<T, S>(const typename HASH_SET::const_iterator &itCurrent,
+						  const typename HASH_SET::const_iterator &itEnd):
+	mItCurrent(itCurrent), mItEnd(itEnd)
+	{
+	}
+
+	bool HasMoreEntries() const 
+	{
+		return (mItCurrent != mItEnd);
+	}
+
+	PvsEntry<T, S> Next()
+	{
+		// hack: create new pvs entry
+		return PvsEntry<T, S>(*(mItCurrent) ++, S(0.0));
+	}
+	
+private:
+	typename HASH_SET::const_iterator mItCurrent;
+	typename HASH_SET::const_iterator mItEnd;
+};
 
 
@@ -23,12 +85,12 @@
 	mainly from a view cell, but also e.g., from objects.
 */
-template<typename T>
-class HashPvs: public PvsBase<T>
-{
-	template<typename T>
-		friend class PvsIterator2;
+template<typename T, typename S>
+class HashPvs//: public PvsBase<T>
+{
+	template<typename T, typename S> friend class HashPvsIterator;
 
 public:
 
+	//HashPvs(): mEntries((Intersectable *)100) {};
 	HashPvs() {};
 	//virtual ~HashPvs() {};
@@ -40,15 +102,15 @@
 		@returns contribution of sample (0 or 1)
 	*/
-	float AddSample(T sample);
+	float AddSample(T sample, const float pdf);
 
 	/** Adds sample to PVS without checking for presence of the sample
 		warning: pvs remains unsorted!
 	*/
-	void AddSampleDirty(T sample);
+	void AddSampleDirty(T sample, const float pdf);
 
 	/** Adds sample dirty (on the end of the vector) but
 		first checks if sample is already in clean part of the pvs.
 	*/
-	bool AddSampleDirtyCheck(T sample);
+	bool AddSampleDirtyCheck(T sample, const float pdf);
 
 	/** Sort pvs entries - this should always be called after a
@@ -61,16 +123,78 @@
 	void Clear(const bool trim = true);
 
-	//static void Merge(PvsBase &mergedPvs, const PvsBase &a, const PvsBase &b);
-
 	bool IsDirty() const;
 
 	bool RequiresResort() const;
 
-	//typename PvsIterator<T> GetIterator() const;
-
+	/** Finds sample in PVS.
+		@param checkDirty if dirty part of the pvs should be checked for entry 
+		(warning: linear runtime in dirty part)
+		@returns iterator on the sample if found, else the place where 
+		it would be added in the sorted vector.
+	*/
+	bool Find(T sample, typename HASH_SET::iterator &it);
+
+	typename HashPvsIterator<T, S> GetIterator() const;
+
+	/** Compute continuous PVS difference 
+	*/
+	float GetPvsHomogenity(HashPvs<T, S> &pvs);
+
+	static void Merge(HashPvs<T, S> &mergedPvs, 
+					  const HashPvs<T, S> &a, 
+					  const HashPvs<T, S> &b);
+
+	static int GetEntrySizeByte(); 
+	static float GetEntrySize();
+
+	bool GetSampleContribution(T sample,
+        					   const float pdf,
+							   float &contribution);
+
+	int GetSamples() const
+	{
+		return mSamples;
+	}
+
+	void MergeInPlace(const HashPvs<T, S> &a)
+	{
+		cerr << "not implemented yet" << endl;
+	}
+
+	bool RequiresResortLog() const
+	{
+		return false;
+	}
+
+	void Reserve(const int n) 
+	{ 
+		// not necessary
+	}
+
+	/** Sort pvs entries assume that the pvs contains unique entries
+	*/
+	void SimpleSort()
+	{
+		// not necessary
+	}
+
+	int SubtractPvs(const HashPvs<T, S> &pvs)
+	{
+		cerr << "not yet implemented" << endl;
+		return 0;
+	}
+
+	/** Compute continuous PVS difference 
+	*/
+	void ComputeContinuousPvsDifference(HashPvs<T, S> &pvs, 
+										float &pvsReduction,
+										float &pvsEnlargement)
+	{
+		cerr << "not yet implemented" << endl;
+	}
 protected:
 
-	/// vector of PVS entries
-	vector<T> mEntries; 
+	/// hash table of PVS entries
+	HASH_SET mEntries; 
 
 	/// Number of samples used to create the PVS
@@ -79,13 +203,84 @@
 
 
-template <typename T>
-int HashPvs<T>::GetSize() const
-{
-	return 0;
-}
-
-
-template <typename T>
-bool HashPvs<T>::Empty() const
+template <typename T, typename S>
+bool HashPvs<T, S>::Find(T sample, typename HASH_SET::iterator &it)
+{
+	it = mEntries.find(sample);
+
+	// already in map
+	return (it != mEntries.end());
+}
+
+
+template <typename T, typename S>
+int HashPvs<T, S>::GetSize() const
+{
+	return (int)mEntries.size();
+}
+
+
+template <typename T, typename S>
+bool HashPvs<T, S>::Empty() const
+{
+	return mEntries.empty();
+}
+
+
+template <typename T, typename S>
+float HashPvs<T, S>::AddSample(T sample, const float pdf)
+{
+	HASH_SET::iterator it;
+
+	if (Find(sample, it))
+		return 0.0f;
+	
+	mEntries.insert(sample);
+	return 1.0f;
+}
+	
+
+template <typename T, typename S>
+void HashPvs<T, S>::AddSampleDirty(T sample, const float pdf)
+{
+	HASH_SET::iterator it;
+
+	// not yet in map
+	if (!Find(sample, it))
+	{
+		mEntries.insert(sample);	
+	}
+}
+
+
+template <typename T, typename S>
+bool HashPvs<T, S>::AddSampleDirtyCheck(T sample, 
+										const float pdf)
+{
+	HASH_SET::iterator it;
+
+	// already in map
+	if (Find(sample, it))
+		return false;
+	
+	mEntries.insert(sample);
+	return true;
+}
+
+
+template <typename T, typename S>
+void HashPvs<T, S>::Sort()
+{
+}
+
+
+template <typename T, typename S>
+void HashPvs<T, S>::Clear(const bool trim = true)
+{
+	mEntries.clear();
+}
+
+
+template <typename T, typename S>
+bool HashPvs<T, S>::IsDirty() const
 {
 	return false;
@@ -93,19 +288,6 @@
 
 
-template <typename T>
-float HashPvs<T>::AddSample(T sample)
-{
-	return 0;
-}
-	
-
-template <typename T>
-void HashPvs<T>::AddSampleDirty(T sample)
-{
-}
-
-
-template <typename T>
-bool HashPvs<T>::AddSampleDirtyCheck(T sample)
+template <typename T, typename S>
+bool HashPvs<T, S>::RequiresResort() const
 {
 	return false;
@@ -113,30 +295,80 @@
 
 
-template <typename T>
-void HashPvs<T>::Sort()
-{
-}
-
-
-template <typename T>
-void HashPvs<T>::Clear(const bool trim = true)
-{
-}
-
-
-template <typename T>
-bool HashPvs<T>::IsDirty() const
-{
-	return false;
-}
-
-
-template <typename T>
-bool HashPvs<T>::RequiresResort() const
-{
-	return false;
-}
-
-//typename PvsIterator<T> GetIterator() const;
+template <typename T, typename S>
+typename HashPvsIterator<T, S> HashPvs<T, S>::GetIterator() const
+{
+	HashPvsIterator<T, S> pit(mEntries.begin(), mEntries.end());
+
+	return pit;
+}
+
+
+template <typename T, typename S>
+float HashPvs<T, S>::GetEntrySize()
+{
+	return (float)(sizeof(T)) / float(1024 * 1024);
+}
+
+
+template <typename T, typename S>
+int HashPvs<T, S>::GetEntrySizeByte()
+{
+	return sizeof(T);
+}
+
+
+template <typename T, typename S>
+float HashPvs<T, S>::GetPvsHomogenity(HashPvs<T, S> &pvs) 
+{
+	float pvsReduction, pvsEnlargement;
+
+	ComputeContinuousPvsDifference(pvs,	pvsReduction, pvsEnlargement);
+
+	return pvsReduction + pvsEnlargement;
+}
+
+
+template <typename T, typename S>
+bool HashPvs<T, S>::GetSampleContribution(T sample,
+									  const float pdf,
+									  float &contribution) 
+{
+	HASH_SET::iterator it;
+	const bool entryFound = Find(sample, it);
+
+	if (entryFound)  
+	{
+		contribution = 0.0f;
+		return false;
+	}
+	else 
+	{
+		contribution = 1.0f;
+		return true;
+	}
+}
+
+
+template <typename T, typename S>
+void HashPvs<T, S>::Merge(HashPvs<T, S> &mergedPvs, 
+						  const HashPvs<T, S> &a, 
+						  const HashPvs<T, S> &b)
+{
+	HASH_SET::const_iterator ait, ait_end = a.mEntries.end();
+
+	for (ait = a.mEntries.begin(); ait != ait_end; ++ ait)
+	{
+		mergedPvs.AddSample(*ait, 1.0f);
+	}
+
+	HASH_SET::const_iterator bit, bit_end = b.mEntries.end();
+
+	for (bit = b.mEntries.begin(); bit != bit_end; ++ bit)
+	{
+		mergedPvs.AddSample(*bit, 1.0f);
+	}
+
+	//cerr << "not implemented" << endl; 
+}
 
 }
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj	(revision 2115)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj	(revision 2116)
@@ -20,6 +20,6 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\include;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost"
-				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
+				AdditionalIncludeDirectories="..\include;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;Timer"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;USE_HASH_PVS"
 				MinimalRebuild="TRUE"
 				BasicRuntimeChecks="3"
@@ -72,5 +72,5 @@
 				OptimizeForWindowsApplication="TRUE"
 				AdditionalIncludeDirectories="..\include;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;Timer"
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;USE_HASH_PVS"
 				ExceptionHandling="TRUE"
 				RuntimeLibrary="2"
@@ -383,4 +383,7 @@
 			</File>
 			<File
+				RelativePath=".\BitVectorPvs.h">
+			</File>
+			<File
 				RelativePath="..\src\BoostPreprocessorThread.cpp">
 			</File>
@@ -581,11 +584,8 @@
 			</File>
 			<File
-				RelativePath=".\ObjectsParser.cpp">
-			</File>
-			<File
-				RelativePath=".\ObjectsParser.h">
-			</File>
-			<File
-				RelativePath=".\ObjectsParserXerces.h">
+				RelativePath=".\ObjectPvs.cpp">
+			</File>
+			<File
+				RelativePath=".\ObjectPvs.h">
 			</File>
 			<File
@@ -767,11 +767,11 @@
 			</File>
 			<File
-				RelativePath="..\src\Pvs.cpp">
-			</File>
-			<File
 				RelativePath="..\src\Pvs.h">
 			</File>
 			<File
 				RelativePath=".\PvsBase.h">
+			</File>
+			<File
+				RelativePath=".\PvsDefinitions.h">
 			</File>
 			<File
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h	(revision 2094)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h	(revision 2116)
@@ -43,5 +43,5 @@
 class ViewCellsParseHandlers;
 class TraversalTree;
-
+class ObjectPvs;
 
 
@@ -679,5 +679,5 @@
 	ViewCellContainer mOldViewCells;
 
-	ObjectPvs mOldPvs;
+	//ObjectPvs mOldPvs;
 };
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp	(revision 2066)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp	(revision 2116)
@@ -16,5 +16,5 @@
 #include "RayCaster.h"
 #include "SamplingStrategy.h"
-
+#include "ViewCellBsp.h"
 
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Containers.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Containers.h	(revision 1344)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Containers.h	(revision 2116)
@@ -69,5 +69,4 @@
 
 /// vertex index container
-//typedef std::vector<short> VertexIndexContainer;
 typedef std::vector<int> VertexIndexContainer;
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.cpp	(revision 2053)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.cpp	(revision 2116)
@@ -16,4 +16,5 @@
 {
 }
+
 
 Polygon3::Polygon3(const VertexContainer &vertices): 
@@ -67,4 +68,9 @@
 }
 
+
+Polygon3::~Polygon3() 
+{
+	DEL_PTR(mPlane);
+}
 
 Plane3 Polygon3::GetSupportingPlane()// const
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 2115)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 2116)
@@ -28,4 +28,5 @@
 
 
+
 #define USE_RAY_LENGTH_AS_CONTRIBUTION 0
 #define DIST_WEIGHTED_CONTRIBUTION 0
@@ -170,6 +171,5 @@
 	}
 		
-    Debug << "casting initial strategies: ";
-
+    Debug << "casting strategies: ";
 	for (int i = 0; i < (int)mStrategies.size(); ++ i)
 		Debug << mStrategies[i] << " ";
@@ -730,5 +730,5 @@
 {
 	long startTime = GetTime();
-
+	
 	SimpleRayContainer simpleRays;
 	
@@ -1018,18 +1018,4 @@
 
 
-ViewCellsManager *ViewCellsManager::LoadViewCells(const string &filename, 
-												  ObjectContainer &pvsObjects,
-												  bool finalizeViewCells,
-												  BoundingBoxConverter *bconverter)
-												 
-{
-	ObjectContainer dummys;
-
-	return LoadViewCells(filename, 
-						 pvsObjects,
-						 dummys,
-						 finalizeViewCells,
-						 bconverter);
-}
 
 
@@ -1059,4 +1045,6 @@
 	}
 	
+	//cout << "viewcells parsed " <<endl;
+
 	if (0)
 	{
@@ -1127,6 +1115,5 @@
 		if (mUseKdPvs)
 		{
-			vector<KdIntersectable *>::iterator kit, kit_end = 
-				GetPreprocessor()->mKdTree->mKdIntersectables.end();
+			vector<KdIntersectable *>::iterator kit, kit_end = GetPreprocessor()->mKdTree->mKdIntersectables.end();
 
 			int id = 0;
@@ -1138,7 +1125,7 @@
 				obj->SetId(id);
 	
-				stream << "<BoundingBox" << " id=\""    << id  << "\""
-					   << " min=\""      << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\""
-					   << " max=\""      << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl;
+				stream << "<BoundingBox" << " id=\"" << id << "\""
+					   << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\""
+					   << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl;
 			}
 		}
@@ -1154,7 +1141,7 @@
 				//-- the bounding boxes
 
-				stream << "<BoundingBox" << " id=\""    << (*oit)->GetId()    << "\""
-					   << " min=\""      << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\""
-					   << " max=\""      << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl;
+				stream << "<BoundingBox" << " id=\"" << (*oit)->GetId() << "\""
+					   << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\""
+					   << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl;
 			}
 		}
@@ -1560,5 +1547,4 @@
 		
 		castSamples += samplesPerPass;
-		//HashPvs<int> dummy;
 
 		Real timeDiff = TimeDiff(startTime, GetTime());
@@ -2070,24 +2056,32 @@
 											 const bool useHitObjects)
 {
-  float sum = 0.0f;
-
-  VssRayContainer::const_iterator it, it_end = rays.end();
-
-  for (it = rays.begin(); it != it_end; ++ it) 
-	{
-	  if (!ViewCellsConstructed()) {
-		// view cells not yet constructed
-		// just take the lenghts of the rays as contributions
-		if ((*it)->mTerminationObject)
-		  sum += (*it)->Length();
-	  } else {
-		sum += ComputeSampleContribution(*(*it), addRays, storeViewCells, useHitObjects);
-	  }
-	}
-
-  //cout<<"view cell cast time:"<<viewCellCastTimer.TotalTime()<<" s"<<endl;
- // cout<<"pvs time:"<<pvsTimer.TotalTime()<<" s"<<endl;
-  
-  return sum;
+	float sum = 0.0f;
+
+	VssRayContainer::const_iterator it, it_end = rays.end();
+
+	for (it = rays.begin(); it != it_end; ++ it) 
+	{
+		if (!ViewCellsConstructed()) 
+		{
+			// view cells not yet constructed
+			// just take the lenghts of the rays as contributions
+			if ((*it)->mTerminationObject)
+			{
+				sum += (*it)->Length();
+			}
+		} 
+		else 
+		{
+			sum += ComputeSampleContribution(*(*it), addRays, storeViewCells, useHitObjects);
+		}
+	}
+
+	cout << "view cell cast time: " << viewCellCastTimer.TotalTime() << " s" << endl;
+	Debug << "view cell cast time: " << viewCellCastTimer.TotalTime() << " s" << endl;
+
+	cout << "pvs time: " << pvsTimer.TotalTime() << " s" << endl;
+	Debug << "pvs time: " << pvsTimer.TotalTime() << " s" << endl;
+	
+	return sum;
 }
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp	(revision 2053)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp	(revision 2116)
@@ -5,5 +5,5 @@
 #include "ViewCellsManager.h"
 #include "SceneGraph.h"
-#include "Pvs.h"
+//#include "ObjectPvs.h"
 #include "Viewcell.h"
 #include "Beam.h"
@@ -93,5 +93,5 @@
 
   if (mViewCellsManager->GetViewCellPoints()->size())
-	mPvsStatFrames = mViewCellsManager->GetViewCellPoints()->size();
+	mPvsStatFrames = (int)mViewCellsManager->GetViewCellPoints()->size();
   else
 	Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", mPvsStatFrames);
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/BitVectorPvs.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/BitVectorPvs.h	(revision 2116)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/BitVectorPvs.h	(revision 2116)
@@ -0,0 +1,328 @@
+#ifndef __BITVECTORPVS_H
+#define __BITVECTORPVS_H
+
+#include <vector>
+#include "common.h"
+#include "PvsBase.h"
+
+using namespace std;
+
+namespace GtpVisibilityPreprocessor {
+
+// specialisation of vector<bool>
+typedef vector<bool> bit_vector;
+
+/** Iterator over a bitvector pvs.
+*/
+#if 0
+template<typename T, typename S>
+class BitVectorPvsIterator
+{
+public:
+	
+	HashPvsIterator<T, S>() {}
+
+	HashPvsIterator<T, S>(const typename HASH_SET::const_iterator &itCurrent,
+						  const typename HASH_SET::const_iterator &itEnd):
+	mItCurrent(itCurrent), mItEnd(itEnd)
+	{
+	}
+
+	bool HasMoreEntries() const 
+	{
+		return (mItCurrent != mItEnd);
+	}
+
+	PvsEntry<T, S> Next()
+	{
+		// hack: create new pvs entry
+		return PvsEntry<T, S>(*(mItCurrent) ++, S(0.0));
+	}
+	
+private:
+	typename HASH_SET::const_iterator mItCurrent;
+	typename HASH_SET::const_iterator mItEnd;
+};
+#endif
+
+#if 0
+/** Pvs implemented as bitvector
+*/
+template<typename T, typename S>
+class BitVectorPvs//: public PvsBase<T>
+{
+	template<typename T, typename S> friend class BitVectorPvsIterator;
+
+public:
+
+	//HashPvs(): mEntries((Intersectable *)100) {};
+	HashPvs() {};
+	//virtual ~HashPvs() {};
+
+	int GetSize() const;
+	bool Empty() const;
+
+	/** Adds sample to PVS.
+		@returns contribution of sample (0 or 1)
+	*/
+	float AddSample(T sample, const float pdf);
+
+	/** Adds sample to PVS without checking for presence of the sample
+		warning: pvs remains unsorted!
+	*/
+	void AddSampleDirty(T sample, const float pdf);
+
+	/** Adds sample dirty (on the end of the vector) but
+		first checks if sample is already in clean part of the pvs.
+	*/
+	bool AddSampleDirtyCheck(T sample, const float pdf);
+
+	/** Sort pvs entries - this should always be called after a
+		sequence of AddSampleDirty calls 
+	*/
+	void Sort();
+
+	/** Clears the pvs.
+	*/
+	void Clear(const bool trim = true);
+
+	bool IsDirty() const;
+
+	bool RequiresResort() const;
+
+	/** Finds sample in PVS.
+		@param checkDirty if dirty part of the pvs should be checked for entry 
+		(warning: linear runtime in dirty part)
+		@returns iterator on the sample if found, else the place where 
+		it would be added in the sorted vector.
+	*/
+	bool Find(T sample, typename HASH_SET::iterator &it);
+
+	typename HashPvsIterator<T, S> GetIterator() const;
+
+	/** Compute continuous PVS difference 
+	*/
+	float GetPvsHomogenity(HashPvs<T, S> &pvs);
+
+	static void Merge(HashPvs<T, S> &mergedPvs, 
+					  const HashPvs<T, S> &a, 
+					  const HashPvs<T, S> &b);
+
+	static int GetEntrySizeByte(); 
+	static float GetEntrySize();
+
+	bool GetSampleContribution(T sample,
+        					   const float pdf,
+							   float &contribution);
+
+	int GetSamples() const
+	{
+		return mSamples;
+	}
+
+	void MergeInPlace(const HashPvs<T, S> &a)
+	{
+		cerr << "not implemented yet" << endl;
+	}
+
+	bool RequiresResortLog() const
+	{
+		return false;
+	}
+
+	void Reserve(const int n) 
+	{ 
+		// not necessary
+	}
+
+	/** Sort pvs entries assume that the pvs contains unique entries
+	*/
+	void SimpleSort()
+	{
+		// not necessary
+	}
+
+	int SubtractPvs(const HashPvs<T, S> &pvs)
+	{
+		cerr << "not yet implemented" << endl;
+		return 0;
+	}
+
+	/** Compute continuous PVS difference 
+	*/
+	void ComputeContinuousPvsDifference(HashPvs<T, S> &pvs, 
+										float &pvsReduction,
+										float &pvsEnlargement)
+	{
+		cerr << "not yet implemented" << endl;
+	}
+protected:
+
+	/// hash table of PVS entries
+	HASH_SET mEntries; 
+
+	/// Number of samples used to create the PVS
+	int mSamples;
+};
+
+
+template <typename T, typename S>
+bool HashPvs<T, S>::Find(T sample, typename HASH_SET::iterator &it)
+{
+	it = mEntries.find(sample);
+
+	// already in map
+	return (it != mEntries.end());
+}
+
+
+template <typename T, typename S>
+int HashPvs<T, S>::GetSize() const
+{
+	return (int)mEntries.size();
+}
+
+
+template <typename T, typename S>
+bool HashPvs<T, S>::Empty() const
+{
+	return mEntries.empty();
+}
+
+
+template <typename T, typename S>
+float HashPvs<T, S>::AddSample(T sample, const float pdf)
+{
+	HASH_SET::iterator it;
+
+	if (Find(sample, it))
+		return 0.0f;
+	
+	mEntries.insert(sample);
+	return 1.0f;
+}
+	
+
+template <typename T, typename S>
+void HashPvs<T, S>::AddSampleDirty(T sample, const float pdf)
+{
+	HASH_SET::iterator it;
+
+	// not yet in map
+	if (!Find(sample, it))
+	{
+		mEntries.insert(sample);	
+	}
+}
+
+
+template <typename T, typename S>
+bool HashPvs<T, S>::AddSampleDirtyCheck(T sample, 
+										const float pdf)
+{
+	HASH_SET::iterator it;
+
+	// already in map
+	if (Find(sample, it))
+		return false;
+	
+	mEntries.insert(sample);
+	return true;
+}
+
+
+template <typename T, typename S>
+void HashPvs<T, S>::Sort()
+{
+}
+
+
+template <typename T, typename S>
+void HashPvs<T, S>::Clear(const bool trim = true)
+{
+	mEntries.clear();
+}
+
+
+template <typename T, typename S>
+bool HashPvs<T, S>::IsDirty() const
+{
+	return false;
+}
+
+
+template <typename T, typename S>
+bool HashPvs<T, S>::RequiresResort() const
+{
+	return false;
+}
+
+
+template <typename T, typename S>
+typename HashPvsIterator<T, S> HashPvs<T, S>::GetIterator() const
+{
+	HashPvsIterator<T, S> pit(mEntries.begin(), mEntries.end());
+
+	return pit;
+}
+
+
+template <typename T, typename S>
+float HashPvs<T, S>::GetEntrySize()
+{
+	return (float)(sizeof(T)) / float(1024 * 1024);
+}
+
+
+template <typename T, typename S>
+int HashPvs<T, S>::GetEntrySizeByte()
+{
+	return sizeof(T);
+}
+
+
+template <typename T, typename S>
+float HashPvs<T, S>::GetPvsHomogenity(HashPvs<T, S> &pvs) 
+{
+	float pvsReduction, pvsEnlargement;
+
+	ComputeContinuousPvsDifference(pvs,	pvsReduction, pvsEnlargement);
+
+	return pvsReduction + pvsEnlargement;
+}
+
+
+template <typename T, typename S>
+bool HashPvs<T, S>::GetSampleContribution(T sample,
+									  const float pdf,
+									  float &contribution) 
+{
+	HASH_SET::iterator it;
+	const bool entryFound = Find(sample, it);
+
+	if (entryFound)  
+	{
+		contribution = 0.0f;
+		return false;
+	}
+	else 
+	{
+		contribution = 1.0f;
+		return true;
+	}
+}
+
+
+template <typename T, typename S>
+void HashPvs<T, S>::Merge(HashPvs<T, S> &mergedPvs, 
+						  const HashPvs<T, S> &a, 
+						  const HashPvs<T, S> &b)
+{
+}
+
+#endif
+
+}
+
+#endif
+
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/SimpleRay.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/SimpleRay.h	(revision 2105)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/SimpleRay.h	(revision 2116)
@@ -40,5 +40,5 @@
   SimpleRay(const Vector3 &o,
 			const Vector3 &d,
-			const short distribution,
+			const unsigned char distribution,
 			const float weight,
 			const unsigned char flags = F_BIDIRECTIONAL
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h	(revision 2100)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h	(revision 2116)
@@ -1,137 +1,14 @@
-#ifndef __PVS_H
-#define __PVS_H
-
-#include <map>
+#ifndef __VERBOSEPVS_H
+#define __VERBOSEPVS_H
+
 #include <vector>
 #include "common.h"
 #include <math.h>
+#include "PvsBase.h"
+
+
 using namespace std;
 
 namespace GtpVisibilityPreprocessor {
-
-class KdNode;
-class BspNode;
-class Ray;
-class Intersectable;
-class ViewCell;
-
-
-/** Information stored with a PVS entry. Consists of the number
-	the object was seen from the view cell.
-*/
-template<typename T, typename S>
-struct PvsEntry 
-{
-public:
-
-	PvsEntry() {}
-
-	PvsEntry(T sample, const S &data): mObject(sample), mData(data) {}
-
-	T mObject;
-	S mData;
-
-	template<typename T, typename S>
-	friend int operator< (const PvsEntry<T, S> &a, const PvsEntry<T, S> &b);
-	template<typename T, typename S>
-	friend int operator== (const PvsEntry<T, S> &a, const PvsEntry<T, S> &b);
-};
-
-
-template<typename T, typename S>
-int operator< (const PvsEntry<T, S> &a, const PvsEntry<T, S> &b)
-{
-	return a.mObject < b.mObject;
-} 
-
-template<typename T, typename S>
-int operator== (const PvsEntry<T, S> &a, const PvsEntry<T, S> &b)
-{
-	return a.mObject == b.mObject;
-} 
-
-
-template<typename T, typename S>
-struct LtSample
-{
-    bool operator()(const PvsEntry<T, S> &a, const PvsEntry<T, S> &b) const
-    {
-		return a.mObject < b.mObject;
-	} 
-};
-
-template<typename T, typename S>
-int equalSample (const PvsEntry<T, S> &a, const PvsEntry<T, S> &b)
-{
-	return a.mObject == b.mObject;
-} 
-
-/** Information stored with a PVS entry. Consists of the number
-	the object was seen from the view cell.
-*/
-struct PvsData {
-public:
-	PvsData() {}
-	PvsData(const float sumPdf):
-	mSumPdf(sumPdf) {}
-	
-	// $$JB in order to return meaningfull values
-	// it assumes that the sum pdf has been normalized somehow!!!
-	inline float GetVisibility() 
-	{ 
-		return mSumPdf; 
-	}
-
-	/// sum of probability density of visible sample rays
-	float mSumPdf;
-};
-
-
-class MailablePvsData 
-{
-public:
-	// sum of probability density of visible sample rays
-	float mSumPdf;
-	int mCounter;
-
-	MailablePvsData() {}
-	MailablePvsData(const float sumPdf):
-	mSumPdf(sumPdf) {}
-
-	// $$JB in order to return meaningfull values
-	// it assumes that the sum pdf has been normalized somehow!!!
-	float GetVisibility() 
-	{ 
-		return mSumPdf; 
-	}
-
-	///////////////
-	//  Mailing stuff
-
-	// last mail id -> warning not thread safe!
-	// both mailId and mailbox should be unique for each thread!!!
-	static int sMailId;
-	static int sReservedMailboxes;
-
-	static void NewMail(const int reserve = 1) {
-		sMailId += sReservedMailboxes;
-		sReservedMailboxes = reserve;
-	}
-
-	void Mail() { mMailbox = sMailId; }
-	bool Mailed() const { return mMailbox == sMailId; }
-
-	void Mail(const int mailbox) { mMailbox = sMailId + mailbox; }
-	bool Mailed(const int mailbox) const { return mMailbox == sMailId + mailbox; }
-
-	int IncMail() { return ++ mMailbox - sMailId; }
-	
-	//////////////////////////////////////////
-
-protected:
-
-	int mMailbox;
-
-};
 
 
@@ -140,7 +17,5 @@
 {
 public:
-	
-	PvsIterator<T, S>() {}
-
+	PvsIterator<T, S>(){}
 	PvsIterator<T, S>(const typename vector<PvsEntry<T, S> >::const_iterator &itCurrent,
 					  const typename vector<PvsEntry<T, S> >::const_iterator &itEnd):
@@ -158,5 +33,5 @@
 		return *(mItCurrent ++);
 	}
-	
+
 private:
 	typename vector<PvsEntry<T, S> >::const_iterator mItCurrent;
@@ -169,18 +44,17 @@
 */
 template<typename T, typename S>
-class Pvs
-{
-	template<typename T, typename S>
-		friend class PvsIterator;
+class VerbosePvs
+{
+	template<typename T, typename S> friend class PvsIterator;
 
 public:
 
-	Pvs(): mSamples(0), mEntries(), mLastSorted(0), mQueriesSinceSort(0) {}
+	VerbosePvs(): mSamples(0), mEntries(), mLastSorted(0), mQueriesSinceSort(0) {}
 
 	/** creates pvs and initializes it with the given entries. 
 	Assumes that entries are sorted-
 	*/
-	Pvs(const vector<PvsEntry<T, S> > &samples);
-	virtual ~Pvs() {};
+	VerbosePvs(const vector<PvsEntry<T, S> > &samples);
+	virtual ~VerbosePvs() {};
 
 	/** Compresses PVS lossless or lossy.
@@ -214,10 +88,10 @@
 	Warning: very slow!
 	*/
-	void MergeInPlace(const Pvs<T, S> &a);
+	void MergeInPlace(const VerbosePvs<T, S> &a);
 
 	/** Difference of pvs to pvs b.
 	@returns number of different entries.
 	*/
-	int Diff(const Pvs<T, S> &b);
+	int Diff(const VerbosePvs<T, S> &b);
 
 	/** Finds sample in PVS.
@@ -246,5 +120,5 @@
 		first checks if sample is already in clean part of the pvs.
 	*/
-	bool AddSampleDirtyCheck(T sample, const float pdf);//, float &contribution);
+	bool AddSampleDirtyCheck(T sample, const float pdf);
 
 	/** Sort pvs entries - this should always be called after a
@@ -260,5 +134,6 @@
 		@returns PvsData
 	*/
-	typename std::vector<PvsEntry<T, S> >::iterator AddSample2(T sample, const float pdf);
+	typename std::vector<PvsEntry<T, S> >::iterator 
+		AddSample2(T sample, const float pdf);
 
 	/** Subtracts one pvs from another one.
@@ -266,5 +141,5 @@
 		@returns new pvs size
 	*/
-	int SubtractPvs(const Pvs<T, S> &pvs);
+	int SubtractPvs(const VerbosePvs<T, S> &pvs);
 
 	/** Returns PVS data, i.e., how often it was seen from the view cell, 
@@ -284,5 +159,5 @@
 	/** Compute continuous PVS difference 
 	*/
-	void ComputeContinuousPvsDifference(Pvs<T, S> &pvs, 
+	void ComputeContinuousPvsDifference(VerbosePvs<T, S> &pvs, 
 										float &pvsReduction,
 										float &pvsEnlargement);
@@ -299,7 +174,9 @@
 	/** Compute continuous PVS difference 
 	*/
-	float GetPvsHomogenity(Pvs<T, S> &pvs);
-
-	static void Merge(Pvs<T, S> &mergedPvs, const Pvs<T, S> &a, const Pvs<T, S> &b);
+	float GetPvsHomogenity(VerbosePvs<T, S> &pvs);
+
+	static void Merge(VerbosePvs<T, S> &mergedPvs, 
+					  const VerbosePvs<T, S> &a, 
+					  const VerbosePvs<T, S> &b);
 
 	int GetSamples() const
@@ -320,5 +197,5 @@
 		const int dirtySize = n - mLastSorted;
 
-#define LOG2E 1.442695040f
+		const double LOG2E = 1.442695040f;
 
 		const float logN = log((float)max(1, n))/LOG2E;
@@ -344,5 +221,4 @@
 	}
 
-
 	int GetLastSorted() const
 	{
@@ -354,5 +230,5 @@
 protected:
 
-	static void Merge(Pvs<T, S> &mergedPvs, 
+	static void Merge(VerbosePvs<T, S> &mergedPvs, 
 					  const typename std::vector<PvsEntry<T, S> >::const_iterator &aBegin,
 					  const typename std::vector<PvsEntry<T, S> >::const_iterator &aEnd,
@@ -362,4 +238,6 @@
 					  const int bSamples);
 
+	//////////////////////////////
+
 	/// vector of PVS entries
 	vector<PvsEntry<T, S> > mEntries; 
@@ -376,5 +254,5 @@
 
 template <typename T, typename S>
-Pvs<T, S>::Pvs(const vector<PvsEntry<T, S> > &samples)
+VerbosePvs<T, S>::VerbosePvs(const vector<PvsEntry<T, S> > &samples)
 {
 	mEntries.reserve(samples.size());
@@ -386,8 +264,8 @@
 
 template <typename T, typename S>
-void Pvs<T, S>::Sort()
-{
-	std::vector<PvsEntry<T, S> >::iterator it = mEntries.begin() + mLastSorted;
-	std::vector<PvsEntry<T, S> >::iterator it_end = mEntries.end();
+void VerbosePvs<T, S>::Sort()
+{
+	vector<PvsEntry<T, S> >::iterator it = mEntries.begin() + mLastSorted;
+	vector<PvsEntry<T, S> >::iterator it_end = mEntries.end();
 
 	// throw out double entries
@@ -411,8 +289,8 @@
 
 template <typename T, typename S>
-void Pvs<T, S>::SimpleSort()
+void VerbosePvs<T, S>::SimpleSort()
 {
 	//  sort(mEntries.begin(), mEntries.end());
-	std::vector<PvsEntry<T, S> >::iterator it = mEntries.begin() + mLastSorted;
+	vector<PvsEntry<T, S> >::iterator it = mEntries.begin() + mLastSorted;
 
 	sort(it, mEntries.end());
@@ -431,5 +309,5 @@
 template <typename T, typename S>
 void
-Pvs<T, S>::ComputeContinuousPvsDifference(Pvs<T, S> &b,
+VerbosePvs<T, S>::ComputeContinuousPvsDifference(VerbosePvs<T, S> &b,
 										  float &pvsReduction,
 										  float &pvsEnlargement)
@@ -439,5 +317,5 @@
 
 	// Uses sum of log differences, which corresponds to entropy
-	std::vector<PvsEntry<T, S> >::iterator it;
+	vector<PvsEntry<T, S> >::iterator it;
 
 	for (it = b.mEntries.begin(); it != b.mEntries.end(); ++ it) 
@@ -514,5 +392,5 @@
 
 template <typename T, typename S>
-int Pvs<T, S>::Diff(const Pvs<T, S> &b)
+int VerbosePvs<T, S>::Diff(const VerbosePvs<T, S> &b)
 {
 	int dif = 0;
@@ -533,5 +411,5 @@
 
 template <typename T, typename S> 
-void Pvs<T, S>::MergeInPlace(const Pvs<T, S> &a)
+void VerbosePvs<T, S>::MergeInPlace(const VerbosePvs<T, S> &a)
 {
 	// early exit
@@ -559,8 +437,12 @@
 
 template <typename T, typename S>
-void Pvs<T, S>::Merge(Pvs<T, S> &mergedPvs, const Pvs<T, S> &a, const Pvs<T, S> &b)
-{
-	std::vector<PvsEntry<T, S> >::const_iterator ait = a.mEntries.begin(), ait_end = a.mEntries.end();
-	std::vector<PvsEntry<T, S> >::const_iterator bit = b.mEntries.begin(), bit_end = b.mEntries.end();
+void VerbosePvs<T, S>::Merge(VerbosePvs<T, S> &mergedPvs, 
+							 const VerbosePvs<T, S> &a, 
+							 const VerbosePvs<T, S> &b)
+{
+	std::vector<PvsEntry<T, S> >::const_iterator ait = 
+		a.mEntries.begin(), ait_end = a.mEntries.end();
+	std::vector<PvsEntry<T, S> >::const_iterator bit = 
+		b.mEntries.begin(), bit_end = b.mEntries.end();
 	
 	Merge(mergedPvs, 
@@ -573,5 +455,5 @@
 
 template <typename T, typename S>
-void Pvs<T, S>::Merge(Pvs<T, S> &mergedPvs, 
+void VerbosePvs<T, S>::Merge(VerbosePvs<T, S> &mergedPvs, 
 					  const typename std::vector<PvsEntry<T, S> >::const_iterator &aBegin,
 					  const typename std::vector<PvsEntry<T, S> >::const_iterator &aEnd,
@@ -627,5 +509,5 @@
 
 
-template <typename T, typename S> void Pvs<T, S>::Clear(const bool trim = true)
+template <typename T, typename S> void VerbosePvs<T, S>::Clear(const bool trim = true)
 {
 	mEntries.clear();
@@ -640,5 +522,5 @@
 
 
-template <typename T, typename S> void Pvs<T, S>::Trim()
+template <typename T, typename S> void VerbosePvs<T, S>::Trim()
 {
 	vector<PvsEntry<T,S> >(mEntries).swap(mEntries);
@@ -647,5 +529,5 @@
 
 template <typename T, typename S> 
-bool Pvs<T, S>::Find(T sample,
+bool VerbosePvs<T, S>::Find(T sample,
 					 typename vector<PvsEntry<T, S> >::iterator &it,
 					 const bool checkDirty)
@@ -684,5 +566,5 @@
 
 template <typename T, typename S>
-void Pvs<T, S>::GetData(const int index, T &entry, S &data)
+void VerbosePvs<T, S>::GetData(const int index, T &entry, S &data)
 {
 	std::vector<PvsEntry<T, S> >::iterator i = mEntries.begin();
@@ -695,5 +577,5 @@
 
 template <typename T, typename S>
-float Pvs<T, S>::AddSample(T sample, const float pdf)
+float VerbosePvs<T, S>::AddSample(T sample, const float pdf)
 {
 	++ mSamples;
@@ -719,5 +601,5 @@
 
 template <typename T, typename S>
-void Pvs<T, S>::AddSampleDirty(T sample, const float pdf)
+void VerbosePvs<T, S>::AddSampleDirty(T sample, const float pdf)
 {
 	++ mSamples;
@@ -727,5 +609,5 @@
 
 template <typename T, typename S>
-typename vector< PvsEntry<T, S> >::iterator Pvs<T, S>::AddSample2(T sample, 
+typename vector< PvsEntry<T, S> >::iterator VerbosePvs<T, S>::AddSample2(T sample, 
 																  const float pdf)
 {
@@ -751,9 +633,6 @@
 
 
-/** Adds sample dirty (on the end of the vector) but
-	first checks if sample is already in clean part of the pvs.
-*/
 template <typename T, typename S> 
-bool Pvs<T, S>::AddSampleDirtyCheck(T sample,
+bool VerbosePvs<T, S>::AddSampleDirtyCheck(T sample,
 									const float pdf)
 									//,float &contribution)
@@ -784,5 +663,5 @@
 
 template <typename T, typename S>
-bool Pvs<T, S>::GetSampleContribution(T sample,
+bool VerbosePvs<T, S>::GetSampleContribution(T sample,
 									  const float pdf,
 									  float &contribution) 
@@ -806,5 +685,5 @@
 
 template <typename T, typename S>
-bool Pvs<T, S>::RemoveSample(T sample, const float pdf)
+bool VerbosePvs<T, S>::RemoveSample(T sample, const float pdf)
 {
 	-- mSamples;
@@ -831,5 +710,5 @@
 
 template <typename T, typename S>
-int Pvs<T, S>::SubtractPvs(const Pvs<T, S> &pvs)
+int VerbosePvs<T, S>::SubtractPvs(const VerbosePvs<T, S> &pvs)
 {
 	const int samples = mSamples - pvs.mSamples;
@@ -849,5 +728,5 @@
 
 template <typename T, typename S>
-void Pvs<T, S>::CollectEntries(std::vector<T> &entries)
+void VerbosePvs<T, S>::CollectEntries(std::vector<T> &entries)
 {
 	std::vector<PvsEntry<T, S> >::
@@ -861,5 +740,5 @@
 
 template <typename T, typename S>
-void Pvs<T, S>::NormalizeMaximum()
+void VerbosePvs<T, S>::NormalizeMaximum()
 {
 	std::vector<PvsEntry<T, S> >::
@@ -880,10 +759,9 @@
 		(*it)->second.sumPdf *= maxSum;
 	}
-
-}
-
-
-template <typename T, typename S>
-float Pvs<T, S>::GetEntrySize()
+}
+
+
+template <typename T, typename S>
+float VerbosePvs<T, S>::GetEntrySize()
 {
 	return (float)(sizeof(T) + sizeof(S)) / float(1024 * 1024);
@@ -892,5 +770,5 @@
 
 template <typename T, typename S>
-int Pvs<T, S>::GetEntrySizeByte()
+int VerbosePvs<T, S>::GetEntrySizeByte()
 {
 	return sizeof(T) + sizeof(S);
@@ -899,10 +777,9 @@
 
 template <typename T, typename S>
-float Pvs<T, S>::GetPvsHomogenity(Pvs<T, S> &pvs) 
+float VerbosePvs<T, S>::GetPvsHomogenity(VerbosePvs<T, S> &pvs) 
 {
 	float pvsReduction, pvsEnlargement;
 
 	ComputeContinuousPvsDifference(pvs,	pvsReduction, pvsEnlargement);
-
 	return pvsReduction + pvsEnlargement;
 }
@@ -910,59 +787,10 @@
 
 template <typename T, typename S>
-typename PvsIterator<T, S> Pvs<T, S>::GetIterator() const
+typename PvsIterator<T, S> VerbosePvs<T, S>::GetIterator() const
 {
 	PvsIterator<T, S> pit(mEntries.begin(), mEntries.end());
-
 	return pit;
 }
 
-
-///////////////////////////////////////
-
-/** Class instantiating the Pvs template for kd tree nodes.
-*/
-class KdPvs: public Pvs<KdNode *, PvsData>
-{
-public:
-	int Compress();
-};
-
-
-////////////
-//-- typedefs
-
-typedef PvsEntry<Intersectable *, PvsData> ObjectPvsEntry;
-typedef std::vector<ObjectPvsEntry> ObjectPvsEntries;
-typedef Pvs<ViewCell *, MailablePvsData> ViewCellPvs;
-typedef PvsIterator<Intersectable *, PvsData> ObjectPvsIterator;
-
-
-class ObjectPvs: public Pvs<Intersectable *, PvsData>
-{
-public:
-	/** Counts object int the pvs. Different to method "GetSize", not
-		only the raw container size is returned,
-		but the individual contributions of the entries are summed up.
-	*/
-	float EvalPvsCost() const;
-
-	friend ostream &operator<<(ostream &s, const ObjectPvs &p) 
-	{
-		ObjectPvsIterator pit = p.GetIterator();
-
-		while (pit.HasMoreEntries())
-		{		
-			const ObjectPvsEntry &entry = pit.Next();
-			Intersectable *obj = entry.mObject;
-
-			cout << obj << " ";
-		}
-		
-		return s;
-	}
-};
-
-
-
 }
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.h	(revision 1420)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.h	(revision 2116)
@@ -3,9 +3,8 @@
 
 
-//#include <iostream>
-//#include <math.h>
-//#include "common.h"
+#include <iostream>
+#include "common.h"
 #include "Containers.h"
-#include "Mesh.h"
+#include "Vector3.h"
 #include <iomanip>
 
@@ -18,5 +17,9 @@
 class AxisAlignedBox3;
 class Ray;
-//typedef Vertex3 Vector3;
+class Mesh;
+class MeshInstance;
+class Material;
+struct Triangle3;
+
 
 /** Class representing a planar convex polygon in 3d.
@@ -41,5 +44,5 @@
 	Polygon3(const Triangle3 &tri);
 
-	~Polygon3() {DEL_PTR(mPlane);}
+	~Polygon3();
 	
 	/** Copies all the vertices of the face.
@@ -173,7 +176,9 @@
 
 	//s << setprecision(6) << "Polygon:\n";
-	for (it = A.mVertices.begin(); it != A.mVertices.end(); ++it)
+	for (it = A.mVertices.begin(); it != A.mVertices.end(); ++ it)
+	{
 		s << *it << " ";
-	
+	}
+
 	return s;
 }
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/TraversalTree.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/TraversalTree.h	(revision 2093)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/TraversalTree.h	(revision 2116)
@@ -8,8 +8,8 @@
 #include "AxisAlignedBox3.h"
 #include "Ray.h"
-#include "Pvs.h"
-#include "Viewcell.h"
-#include "VssRay.h"
-#include "IntersectableWrapper.h"
+//#include "ObjectPvs.h"
+//#include "Viewcell.h"
+//#include "VssRay.h"
+//#include "IntersectableWrapper.h"
 
 
@@ -17,13 +17,13 @@
 
   
-  class TraversalNode;
-  class TraversalLeaf;
-  class TraversalInterior;
-  class Intersectable;
-  class Beam;
-
-  class TraversalTree;
-  
-  //  TraversalTree *SceneTraversalTree;
+class TraversalNode;
+class TraversalLeaf;
+class TraversalInterior;
+class Intersectable;
+class Beam;
+
+class TraversalTree;
+  
+//  TraversalTree *SceneTraversalTree;
 
 // --------------------------------------------------------------
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/PvsBase.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/PvsBase.h	(revision 2116)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/PvsBase.h	(revision 2116)
@@ -0,0 +1,135 @@
+#ifndef __PVSBASE_H
+#define __PVSBASE_H
+
+#include "common.h"
+#include "Containers.h"
+
+using namespace std;
+
+namespace GtpVisibilityPreprocessor {
+
+//class Intersectable;
+
+/** Information stored with a PVS entry. Consists of the number
+	the object was seen from the view cell.
+*/
+template<typename T, typename S>
+struct PvsEntry 
+{
+public:
+
+	PvsEntry() {}
+
+	PvsEntry(T sample, const S &data): mObject(sample), mData(data) {}
+
+	T mObject;
+	S mData;
+
+	template<typename T, typename S>
+	friend int operator< (const PvsEntry<T, S> &a, const PvsEntry<T, S> &b);
+	template<typename T, typename S>
+	friend int operator== (const PvsEntry<T, S> &a, const PvsEntry<T, S> &b);
+};
+
+
+template<typename T, typename S>
+int operator< (const PvsEntry<T, S> &a, const PvsEntry<T, S> &b)
+{
+	return a.mObject < b.mObject;
+} 
+
+template<typename T, typename S>
+int operator== (const PvsEntry<T, S> &a, const PvsEntry<T, S> &b)
+{
+	return a.mObject == b.mObject;
+} 
+
+
+template<typename T, typename S>
+struct LtSample
+{
+    bool operator()(const PvsEntry<T, S> &a, const PvsEntry<T, S> &b) const
+    {
+		return a.mObject < b.mObject;
+	} 
+};
+
+template<typename T, typename S>
+int equalSample (const PvsEntry<T, S> &a, const PvsEntry<T, S> &b)
+{
+	return a.mObject == b.mObject;
+} 
+
+/** Information stored with a PVS entry. Consists of the number
+	the object was seen from the view cell.
+*/
+struct PvsData 
+{
+public:
+	PvsData() {}
+	PvsData(const float sumPdf):
+	mSumPdf(sumPdf) {}
+	
+	// $$JB in order to return meaningfull values
+	// it assumes that the sum pdf has been normalized somehow!!!
+	inline float GetVisibility() 
+	{ 
+		return mSumPdf; 
+	}
+
+	/// sum of probability density of visible sample rays
+	float mSumPdf;
+};
+
+
+class MailablePvsData 
+{
+public:
+	// sum of probability density of visible sample rays
+	float mSumPdf;
+	int mCounter;
+
+	MailablePvsData() {}
+	MailablePvsData(const float sumPdf):
+	mSumPdf(sumPdf) {}
+
+	// $$JB in order to return meaningfull values
+	// it assumes that the sum pdf has been normalized somehow!!!
+	float GetVisibility() 
+	{ 
+		return mSumPdf; 
+	}
+
+	///////////////
+	//  Mailing stuff
+
+	// last mail id -> warning not thread safe!
+	// both mailId and mailbox should be unique for each thread!!!
+	static int sMailId;
+	static int sReservedMailboxes;
+
+	static void NewMail(const int reserve = 1) 
+	{
+		sMailId += sReservedMailboxes;
+		sReservedMailboxes = reserve;
+	}
+
+	void Mail() { mMailbox = sMailId; }
+	bool Mailed() const { return mMailbox == sMailId; }
+
+	void Mail(const int mailbox) { mMailbox = sMailId + mailbox; }
+	bool Mailed(const int mailbox) const { return mMailbox == sMailId + mailbox; }
+
+	int IncMail() { return ++ mMailbox - sMailId; }
+	
+	//////////////////////////////////////////
+
+protected:
+
+	int mMailbox;
+
+};
+
+}
+
+#endif
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp	(revision 2091)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp	(revision 2116)
@@ -7,4 +7,6 @@
 #include "ViewCell.h"
 #include "Beam.h"
+#include "ViewCell.h"
+#include "IntersectableWrapper.h"
 
 
@@ -85,5 +87,4 @@
 {
     DEL_PTR(mRoot);
-
 	CLEAR_CONTAINER(mKdIntersectables);
 }
@@ -1457,15 +1458,16 @@
 KdTree::GetOrCreateKdIntersectable(KdNode *node)
 {
-
-  if (node == NULL)
-	return NULL;
-
-  if (node->mIntersectable == NULL) {
-	// not in map => create new entry
-	node->mIntersectable = new KdIntersectable(node, GetBox(node));
-	mKdIntersectables.push_back(node->mIntersectable);
-  }
-
-  return node->mIntersectable;
+	if (node == NULL)
+		return NULL;
+
+	if (node->mIntersectable == NULL) 
+	{
+		// not in map => create new entry
+		node->mIntersectable = new KdIntersectable(node, GetBox(node));
+		mKdIntersectables.push_back(node->mIntersectable);
+		node->mIntersectable->SetId((int)mKdIntersectables.size());
+	}
+
+	return node->mIntersectable;
 }
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h	(revision 1999)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h	(revision 2116)
@@ -8,5 +8,5 @@
 #include "Material.h"
 #include "gzstream.h"
-
+#include "ObjectPvs.h"
 
 namespace GtpVisibilityPreprocessor {
@@ -24,4 +24,6 @@
 class ViewCellLeaf;
 
+
+//class ObjectPvs;
 
 
@@ -282,27 +284,4 @@
 	}
 
-	//////////
-	//-- mailing stuff
-
-	//	static void NewMail(const int reserve = 1) 
-	//	{
-	//		sMailId += sReservedMailboxes;
-	//		sReservedMailboxes = reserve;
-	//	}
-
-	//	void Mail() { mMailbox = sMailId; }
-	//	bool Mailed() const { return mMailbox == sMailId; }
-
-	//	void Mail(const int mailbox) { mMailbox = sMailId + mailbox; }
-	//	bool Mailed(const int mailbox) const { return mMailbox == sMailId + mailbox; }
-
-	//	int IncMail() { return ++ mMailbox - sMailId; }
-
-
-	// last mail id -> warning not thread safe!
-	// both mailId and mailbox should be unique for each thread!!!
-
-	//static int sMailId;
-	//static int sReservedMailboxes;
 
 	int GetFilteredPvsSize() const 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp	(revision 2073)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp	(revision 2116)
@@ -619,5 +619,7 @@
 		// update scalar pvs size value
 		ObjectPvs &pvs = viewCell->GetPvs();
-		mViewCellsManager->UpdateScalarPvsSize(viewCell, pvs.EvalPvsCost(), pvs.GetSize());
+		mViewCellsManager->UpdateScalarPvsSize(viewCell, 
+											   pvs.EvalPvsCost(), 
+											   pvs.GetSize());
 
 		mVspStats.contributingSamples += conSamp;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.h	(revision 2014)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.h	(revision 2116)
@@ -3,8 +3,10 @@
 
 #include <vector>
+
+#include "Vector3.h"
+#include "Containers.h"
+
 using namespace std;
-#include "Vector3.h"
-#include "Ray.h"
-#include "Containers.h"
+
 
 namespace GtpVisibilityPreprocessor {
@@ -13,4 +15,5 @@
 class Intersectable;
 class KdNode;
+class Ray;
 
 #define ABS_CONTRIBUTION_WEIGHT 0.0f
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h	(revision 2113)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h	(revision 2116)
@@ -8,20 +8,20 @@
 #include "AxisAlignedBox3.h"
 #include "Ray.h"
-#include "Pvs.h"
+//#include "ObjectPvs.h"
 #include "Viewcell.h"
 #include "VssRay.h"
-#include "IntersectableWrapper.h"
-
+//#include "IntersectableWrapper.h"
+#include "gzstream.h"
 
 namespace GtpVisibilityPreprocessor {
 
-  
-  class KdNode;
-  class KdLeaf;
-  class KdInterior;
-  class Intersectable;
-  class Beam;
-
-  class KdTree;
+class KdNode;
+class KdLeaf;
+class KdInterior;
+class Intersectable;
+class KdIntersectable;
+class Beam;
+class KdTree;
+//class KdViewCell;
   
   //  KdTree *SceneKdTree;
@@ -213,5 +213,5 @@
 	
   /** PVS consisting of visible KdTree nodes */
-  KdPvs mKdPvs;
+  //KdPvs mKdPvs;
 
   /// pvs of view cells seeing this node.
@@ -619,4 +619,5 @@
   AxisAlignedBox3 mBox;
   KdTreeStatistics mStat;
+
 public:
   /// stores the kd node intersectables used for pvs
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp	(revision 2115)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp	(revision 2116)
@@ -1,11 +1,2 @@
-/*#ifdef GTP_INTERNAL
-#ifndef USE_QT
-#define USE_QT 1
-#else
-#define USE_QT 0
-#endif
-#endif
-*/
-
 #define USE_THREADS 0
 
@@ -29,4 +20,5 @@
 #include "SceneGraph.h"
 #include "GlobalLinesRenderer.h"
+#include "PvsDefinitions.h"
 
 #include "ViewCellsManager.h"
@@ -227,4 +219,9 @@
 
 
+	if (HASH_PVS)
+		Debug << "using hash pvs" << endl;
+	else
+		Debug << "using verbose pvs" << endl;
+
 	/////////////
 	//-- load scene 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.cpp	(revision 1966)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.cpp	(revision 2116)
@@ -1,4 +1,6 @@
 #include "VssRay.h"
 #include "AxisAlignedBox3.h"
+#include "Ray.h"
+
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.h	(revision 2113)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.h	(revision 2116)
@@ -3,7 +3,6 @@
 
 #include "AxisAlignedBox3.h"
-#include "Pvs.h"
 #include <set>
-#include "VssRay.h"
+//#include "VssRay.h"
 #include "Mailable.h"
 
@@ -15,4 +14,5 @@
 class BvhNode;
 class Intersectable;
+class VssRay;
 struct Face;
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParserXerces.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParserXerces.h	(revision 2115)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParserXerces.h	(revision 2116)
@@ -27,4 +27,6 @@
 class BvHierarchy;
 class HierarchyManager;
+class ObjectPvs;
+class BspNode;
 
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h	(revision 2050)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h	(revision 2116)
@@ -7,5 +7,5 @@
 #include "Renderer.h"
 #include "Beam.h"
-#include "Pvs.h"
+#include "ObjectPvs.h"
 
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp	(revision 2053)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp	(revision 2116)
@@ -11,4 +11,5 @@
 #include "SamplingStrategy.h"
 #include "BvHierarchy.h"
+#include "Polygon3.h"
 
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/PvsDefinitions.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/PvsDefinitions.h	(revision 2116)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/PvsDefinitions.h	(revision 2116)
@@ -0,0 +1,41 @@
+#ifndef __PVSDEFINITIONS_H
+#define __PVSDEFINITIONS_H
+
+#include "common.h"
+#include <math.h>
+
+////////////
+//-- typedefs
+
+#ifdef USE_HASH_PVS
+
+#include "HashPvs.h"
+
+#define HASH_PVS 1
+
+namespace GtpVisibilityPreprocessor {
+typedef HashPvs<Intersectable *, PvsData> DefaultPvs;
+typedef HashPvsIterator<Intersectable *, PvsData> ObjectPvsIterator;
+}
+
+#else
+
+#include "Pvs.h"
+
+#define HASH_PVS 0
+
+namespace GtpVisibilityPreprocessor {
+typedef VerbosePvs<Intersectable *, PvsData> DefaultPvs;
+typedef PvsIterator<Intersectable *, PvsData> ObjectPvsIterator;
+}
+#endif
+
+namespace GtpVisibilityPreprocessor {
+
+typedef PvsEntry<Intersectable *, PvsData> ObjectPvsEntry;
+
+}
+
+
+#endif
+
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.cpp	(revision 2100)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.cpp	(revision 2116)
@@ -27,4 +27,8 @@
 
 
+int MailablePvsData::sMailId = 1;
+int MailablePvsData::sReservedMailboxes = 1;
+
+
 	////////////
 //-- static members
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/IntersectionBoundingBoxConverter.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/IntersectionBoundingBoxConverter.cpp	(revision 2113)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/IntersectionBoundingBoxConverter.cpp	(revision 2116)
@@ -1,4 +1,5 @@
 #include "IntersectionBoundingBoxConverter.h"
 #include "KdTree.h"
+#include "IntersectableWrapper.h"
 
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp	(revision 2076)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp	(revision 2116)
@@ -569,8 +569,16 @@
 
 #if 1
-  cout<<"view cell cast time:"<<viewCellCastTimer.TotalTime()<<" s"<<endl;
-  cout<<"pvs time:"<<pvsTimer.TotalTime()<<" s"<<endl;
-  cout<<"halton time:"<<haltonTimer.TotalTime()<<" s"<<endl;
-  //  cout<<"obj time:"<<objTimer.TotalTime()<<" s"<<endl;
+  const float vcTime = viewCellCastTimer.TotalTime();
+  const float pvsTime = pvsTimer.TotalTime();
+  const float haltonTime = haltonTimer.TotalTime();
+
+  cout << "view cell cast time: " << vcTime << " s" << endl;
+  cout << "pvs time: " << pvsTime << " s" << endl;
+  cout << "halton time: "<< haltonTime << " s" << endl;
+  // cout<<"obj time:"<<objTimer.TotalTime()<<" s"<<endl;
+
+  Debug << "view cell cast time: " << vcTime << " s" << endl;
+  Debug << "pvs time: " << pvsTime << " s" << endl;
+  Debug << "halton time: "<< haltonTime << " s" << endl;
 #endif
 }
