Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/include/VisibilityEnvironment.h
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/include/VisibilityEnvironment.h	(revision 938)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/include/VisibilityEnvironment.h	(revision 1004)
@@ -40,5 +40,5 @@
 
 protected:
-	GtpVisibilityPreprocessor::Environment *mEnvironment;
+	//GtpVisibilityPreprocessor::Environment *Environment::GetSingleton();
 };
 } // namespace GtpVisibility
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/src/VisibilityEnvironment.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/src/VisibilityEnvironment.cpp	(revision 971)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/src/VisibilityEnvironment.cpp	(revision 1004)
@@ -12,10 +12,11 @@
 	GtpVisibilityPreprocessor::Debug.open("debug.log");
 	// load environment
-	mEnvironment = new GtpVisibilityPreprocessor::Environment();	 
+	//Environment::GetSingleton() = new GtpVisibilityPreprocessor::Environment::GetSingleton();	 
 }
 //-----------------------------------------------------------------------
 VisibilityEnvironment::~VisibilityEnvironment()
 {
-	DEL_PTR(mEnvironment);	 
+	//DEL_PTR(Environment::GetSingleton());
+	GtpVisibilityPreprocessor::Environment::DelSingleton();
 }
 //-----------------------------------------------------------------------
@@ -23,5 +24,5 @@
 {		
 	//-- parse environment
-	return mEnvironment->ReadEnvFile(filename.c_str());
+	return GtpVisibilityPreprocessor::Environment::GetSingleton()->ReadEnvFile(filename.c_str());
 }
 //-----------------------------------------------------------------------
@@ -29,5 +30,5 @@
 {
 	char str[200];
-	mEnvironment->GetStringValue("Scene.filename", str);
+	GtpVisibilityPreprocessor::Environment::GetSingleton()->GetStringValue("Scene.filename", str);
 	return str;
 }
@@ -36,5 +37,6 @@
 {
 	char str[200];
-	mEnvironment->GetStringValue("ViewCells.filename", str);
+	GtpVisibilityPreprocessor::Environment::GetSingleton()->GetStringValue("ViewCells.filename", str);
+	
 	return str;
 }
@@ -42,5 +44,5 @@
 GtpVisibilityPreprocessor::Environment *VisibilityEnvironment::GetPreprocessorEnvironment()
 {
-	return mEnvironment;
+	return GtpVisibilityPreprocessor::Environment::GetSingleton();
 }
 } // namespace GtpVisibility
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp	(revision 975)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp	(revision 1004)
@@ -1029,11 +1029,7 @@
 	OgreBoundingBoxConverter bconverter(this);
 
-	
-	GtpVisibilityPreprocessor::Environment *env = 
-		mVisibilityManager->GetVisibilityEnvironment()->GetPreprocessorEnvironment();
-
 	// load the view cells assigning the found objects to the pvss
 	mViewCellsManager = 
-		GtpVisibilityPreprocessor::ViewCellsManager::LoadViewCells(filename, &mObjects, env, false, &bconverter);
+		GtpVisibilityPreprocessor::ViewCellsManager::LoadViewCells(filename, &mObjects, false, &bconverter);
 
 	return (mViewCellsManager != NULL);
Index: GTP/trunk/Lib/Vis/Preprocessing/scripts/Preprocessor.vcproj
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/scripts/Preprocessor.vcproj	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/scripts/Preprocessor.vcproj	(revision 1004)
@@ -176,6 +176,5 @@
 						Name="VCCustomBuildTool"
 						Description="Performing moc on $(InputName).h"
-						CommandLine="%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp
-"
+						CommandLine="%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp&#xA;"
 						Outputs="$(InputDir)moc_$(InputName).cpp"/>
 				</FileConfiguration>
@@ -308,6 +307,5 @@
 						Name="VCCustomBuildTool"
 						Description="Performing moc on $(InputName).h"
-						CommandLine="%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp
-"
+						CommandLine="%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp&#xA;"
 						Outputs="$(InputDir)moc_$(InputName).cpp"/>
 				</FileConfiguration>
@@ -323,6 +321,5 @@
 						Name="VCCustomBuildTool"
 						Description="Performing moc on $(InputName).h"
-						CommandLine="%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp
-"
+						CommandLine="%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp&#xA;"
 						Outputs="$(InputDir)moc_$(InputName).cpp"/>
 				</FileConfiguration>
Index: GTP/trunk/Lib/Vis/Preprocessing/src/VspKdTree.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/VspKdTree.cpp	(revision 882)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/VspKdTree.cpp	(revision 1004)
@@ -407,33 +407,33 @@
 VspKdTree::VspKdTree(): mOnlyDrivingAxis(false)
 {
-	environment->GetIntValue("VspKdTree.Termination.maxDepth", mTermMaxDepth);
-	environment->GetIntValue("VspKdTree.Termination.minPvs", mTermMinPvs);
-	environment->GetIntValue("VspKdTree.Termination.minRays", mTermMinRays);
-	environment->GetFloatValue("VspKdTree.Termination.maxRayContribution", mTermMaxRayContribution);
-	environment->GetFloatValue("VspKdTree.Termination.maxCostRatio", mTermMaxCostRatio);
-	environment->GetFloatValue("VspKdTree.Termination.minSize", mTermMinSize);
-
-	environment->GetIntValue("VspKdTree.Termination.missTolerance", mTermMissTolerance);
+	Environment::GetSingleton()->GetIntValue("VspKdTree.Termination.maxDepth", mTermMaxDepth);
+	Environment::GetSingleton()->GetIntValue("VspKdTree.Termination.minPvs", mTermMinPvs);
+	Environment::GetSingleton()->GetIntValue("VspKdTree.Termination.minRays", mTermMinRays);
+	Environment::GetSingleton()->GetFloatValue("VspKdTree.Termination.maxRayContribution", mTermMaxRayContribution);
+	Environment::GetSingleton()->GetFloatValue("VspKdTree.Termination.maxCostRatio", mTermMaxCostRatio);
+	Environment::GetSingleton()->GetFloatValue("VspKdTree.Termination.minSize", mTermMinSize);
+
+	Environment::GetSingleton()->GetIntValue("VspKdTree.Termination.missTolerance", mTermMissTolerance);
 
 	mTermMinSize = sqr(mTermMinSize);
 
-	environment->GetFloatValue("VspKdTree.epsilon", mEpsilon);
-	environment->GetFloatValue("VspKdTree.ct_div_ci", mCtDivCi);
-
-	environment->GetFloatValue("VspKdTree.maxTotalMemory", mMaxTotalMemory);
-	environment->GetFloatValue("VspKdTree.maxStaticMemory", mMaxStaticMemory);
-
-	environment->GetIntValue("VspKdTree.accessTimeThreshold", mAccessTimeThreshold);
-	environment->GetIntValue("VspKdTree.minCollapseDepth", mMinCollapseDepth);
-
-	//environment->GetIntValue("ViewCells.maxViewCells", mMaxViewCells);
-
-	environment->GetIntValue("VspKdTree.PostProcess.minViewCells", mMergeMinViewCells);
-	environment->GetFloatValue("VspKdTree.PostProcess.maxCostRatio", mMergeMaxCostRatio);
-	environment->GetIntValue("VspKdTree.PostProcess.maxPvsSize",
+	Environment::GetSingleton()->GetFloatValue("VspKdTree.epsilon", mEpsilon);
+	Environment::GetSingleton()->GetFloatValue("VspKdTree.ct_div_ci", mCtDivCi);
+
+	Environment::GetSingleton()->GetFloatValue("VspKdTree.maxTotalMemory", mMaxTotalMemory);
+	Environment::GetSingleton()->GetFloatValue("VspKdTree.maxStaticMemory", mMaxStaticMemory);
+
+	Environment::GetSingleton()->GetIntValue("VspKdTree.accessTimeThreshold", mAccessTimeThreshold);
+	Environment::GetSingleton()->GetIntValue("VspKdTree.minCollapseDepth", mMinCollapseDepth);
+
+	//Environment::GetSingleton()->GetIntValue("ViewCells.maxViewCells", mMaxViewCells);
+
+	Environment::GetSingleton()->GetIntValue("VspKdTree.PostProcess.minViewCells", mMergeMinViewCells);
+	Environment::GetSingleton()->GetFloatValue("VspKdTree.PostProcess.maxCostRatio", mMergeMaxCostRatio);
+	Environment::GetSingleton()->GetIntValue("VspKdTree.PostProcess.maxPvsSize",
 							 VspKdMergeCandidate::sMaxPvsSize);
 
-	environment->GetBoolValue("VspKdTree.splitUseOnlyDrivingAxis", mOnlyDrivingAxis);
-	environment->GetIntValue("VspKdTree.Termination.maxViewCells", mMaxViewCells);
+	Environment::GetSingleton()->GetBoolValue("VspKdTree.splitUseOnlyDrivingAxis", mOnlyDrivingAxis);
+	Environment::GetSingleton()->GetIntValue("VspKdTree.Termination.maxViewCells", mMaxViewCells);
 
 	//-- output
@@ -450,5 +450,5 @@
 	//-- split type
 	char sname[128];
-	environment->GetStringValue("VspKdTree.splitType", sname);
+	Environment::GetSingleton()->GetStringValue("VspKdTree.splitType", sname);
 	string name(sname);
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp	(revision 1001)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp	(revision 1004)
@@ -751,5 +751,5 @@
 				VssRay *ray;
 				
-				const indices[][2] = {{0,0}, {0,1}, {1,1}, {1,0}}; 
+				const int indices[][2] = {{0,0}, {0,1}, {1,1}, {1,0}}; 
 				MeshInstance dummy(mesh);
 				for (int i=0; i < 4; i++) 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp	(revision 1004)
@@ -175,5 +175,5 @@
 			Vector3 transl;
 							
-			if (sscanf(ptr, "%f %f %f %f", &transl.x, &transl.y, &transl.z) == 3)
+			if (sscanf(ptr, "%f %f %f", &transl.x, &transl.y, &transl.z) == 3)
 			{
 				translm = new Matrix4x4(TranslationMatrix(transl));
@@ -184,5 +184,5 @@
 			Vector3 scale;
 
-			if (sscanf(ptr, "%f %f %f %f", &scale.x, &scale.y, &scale.z) == 3)
+			if (sscanf(ptr, "%f %f %f", &scale.x, &scale.y, &scale.z) == 3)
 			{
 				scalem = new Matrix4x4(ScaleMatrix(scale.x, scale.y, scale.z));
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.h	(revision 938)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.h	(revision 1004)
@@ -21,6 +21,5 @@
 				 ViewCellsManager **viewCells,
 				 ObjectContainer *objectsm,
-				 BoundingBoxConverter *bconverter,
-				 Environment *env);
+				 BoundingBoxConverter *bconverter);
 };
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp	(revision 1004)
@@ -55,5 +55,5 @@
 
 
-VspBspTree::VspBspTree(Environment *env):
+VspBspTree::VspBspTree():
 mRoot(NULL),
 mUseAreaForPvs(false),
@@ -67,70 +67,70 @@
 {
 	bool randomize = false;
-	env->GetBoolValue("VspBspTree.Construction.randomize", randomize);
+	Environment::GetSingleton()->GetBoolValue("VspBspTree.Construction.randomize", randomize);
 	if (randomize)
 		Randomize(); // initialise random generator for heuristics
 
 	//-- termination criteria for autopartition
-	env->GetIntValue("VspBspTree.Termination.maxDepth", mTermMaxDepth);
-	env->GetIntValue("VspBspTree.Termination.minPvs", mTermMinPvs);
-	env->GetIntValue("VspBspTree.Termination.minRays", mTermMinRays);
-	env->GetFloatValue("VspBspTree.Termination.minProbability", mTermMinProbability);
-	env->GetFloatValue("VspBspTree.Termination.maxRayContribution", mTermMaxRayContribution);
-	env->GetFloatValue("VspBspTree.Termination.minAccRayLenght", mTermMinAccRayLength);
-	env->GetFloatValue("VspBspTree.Termination.maxCostRatio", mTermMaxCostRatio);
-	env->GetIntValue("VspBspTree.Termination.missTolerance", mTermMissTolerance);
-	env->GetIntValue("VspBspTree.Termination.maxViewCells", mMaxViewCells);
+	Environment::GetSingleton()->GetIntValue("VspBspTree.Termination.maxDepth", mTermMaxDepth);
+	Environment::GetSingleton()->GetIntValue("VspBspTree.Termination.minPvs", mTermMinPvs);
+	Environment::GetSingleton()->GetIntValue("VspBspTree.Termination.minRays", mTermMinRays);
+	Environment::GetSingleton()->GetFloatValue("VspBspTree.Termination.minProbability", mTermMinProbability);
+	Environment::GetSingleton()->GetFloatValue("VspBspTree.Termination.maxRayContribution", mTermMaxRayContribution);
+	Environment::GetSingleton()->GetFloatValue("VspBspTree.Termination.minAccRayLenght", mTermMinAccRayLength);
+	Environment::GetSingleton()->GetFloatValue("VspBspTree.Termination.maxCostRatio", mTermMaxCostRatio);
+	Environment::GetSingleton()->GetIntValue("VspBspTree.Termination.missTolerance", mTermMissTolerance);
+	Environment::GetSingleton()->GetIntValue("VspBspTree.Termination.maxViewCells", mMaxViewCells);
 
 	//-- max cost ratio for early tree termination
-	env->GetFloatValue("VspBspTree.Termination.maxCostRatio", mTermMaxCostRatio);
-
-	env->GetFloatValue("VspBspTree.Termination.minGlobalCostRatio", mTermMinGlobalCostRatio);
-	env->GetIntValue("VspBspTree.Termination.globalCostMissTolerance", mTermGlobalCostMissTolerance);
+	Environment::GetSingleton()->GetFloatValue("VspBspTree.Termination.maxCostRatio", mTermMaxCostRatio);
+
+	Environment::GetSingleton()->GetFloatValue("VspBspTree.Termination.minGlobalCostRatio", mTermMinGlobalCostRatio);
+	Environment::GetSingleton()->GetIntValue("VspBspTree.Termination.globalCostMissTolerance", mTermGlobalCostMissTolerance);
 
 	// HACK//mTermMinPolygons = 25;
 
 	//-- factors for bsp tree split plane heuristics
-	env->GetFloatValue("VspBspTree.Factor.pvs", mPvsFactor);
-	env->GetFloatValue("VspBspTree.Termination.ct_div_ci", mCtDivCi);
+	Environment::GetSingleton()->GetFloatValue("VspBspTree.Factor.pvs", mPvsFactor);
+	Environment::GetSingleton()->GetFloatValue("VspBspTree.Termination.ct_div_ci", mCtDivCi);
 
 
 	//-- partition criteria
-	env->GetIntValue("VspBspTree.maxPolyCandidates", mMaxPolyCandidates);
-	env->GetIntValue("VspBspTree.maxRayCandidates", mMaxRayCandidates);
-	env->GetIntValue("VspBspTree.splitPlaneStrategy", mSplitPlaneStrategy);
-
-	env->GetFloatValue("VspBspTree.Construction.epsilon", mEpsilon);
-	env->GetIntValue("VspBspTree.maxTests", mMaxTests);
+	Environment::GetSingleton()->GetIntValue("VspBspTree.maxPolyCandidates", mMaxPolyCandidates);
+	Environment::GetSingleton()->GetIntValue("VspBspTree.maxRayCandidates", mMaxRayCandidates);
+	Environment::GetSingleton()->GetIntValue("VspBspTree.splitPlaneStrategy", mSplitPlaneStrategy);
+
+	Environment::GetSingleton()->GetFloatValue("VspBspTree.Construction.epsilon", mEpsilon);
+	Environment::GetSingleton()->GetIntValue("VspBspTree.maxTests", mMaxTests);
 
 	// if only the driving axis is used for axis aligned split
-	env->GetBoolValue("VspBspTree.splitUseOnlyDrivingAxis", mOnlyDrivingAxis);
+	Environment::GetSingleton()->GetBoolValue("VspBspTree.splitUseOnlyDrivingAxis", mOnlyDrivingAxis);
 	
 	//-- termination criteria for axis aligned split
-	env->GetFloatValue("VspBspTree.Termination.AxisAligned.maxRayContribution", 
+	Environment::GetSingleton()->GetFloatValue("VspBspTree.Termination.AxisAligned.maxRayContribution", 
 								mTermMaxRayContriForAxisAligned);
-	env->GetIntValue("VspBspTree.Termination.AxisAligned.minRays",
+	Environment::GetSingleton()->GetIntValue("VspBspTree.Termination.AxisAligned.minRays",
 							 mTermMinRaysForAxisAligned);
 
-	//env->GetFloatValue("VspBspTree.maxTotalMemory", mMaxTotalMemory);
-	env->GetFloatValue("VspBspTree.maxStaticMemory", mMaxMemory);
-
-	env->GetFloatValue("VspBspTree.Construction.renderCostWeight", mRenderCostWeight);
-	env->GetBoolValue("VspBspTree.usePolygonSplitIfAvailable", mUsePolygonSplitIfAvailable);
-
-	env->GetBoolValue("VspBspTree.useCostHeuristics", mUseCostHeuristics);
-	env->GetBoolValue("VspBspTree.useSplitCostQueue", mUseSplitCostQueue);
-	env->GetBoolValue("VspBspTree.simulateOctree", mCirculatingAxis);
-	env->GetBoolValue("VspBspTree.useRandomAxis", mUseRandomAxis);
-	env->GetIntValue("VspBspTree.nodePriorityQueueType", mNodePriorityQueueType);
-
-	env->GetBoolValue("ViewCells.PostProcess.emptyViewCellsMerge", mEmptyViewCellsMergeAllowed);
+	//Environment::GetSingleton()->GetFloatValue("VspBspTree.maxTotalMemory", mMaxTotalMemory);
+	Environment::GetSingleton()->GetFloatValue("VspBspTree.maxStaticMemory", mMaxMemory);
+
+	Environment::GetSingleton()->GetFloatValue("VspBspTree.Construction.renderCostWeight", mRenderCostWeight);
+	Environment::GetSingleton()->GetBoolValue("VspBspTree.usePolygonSplitIfAvailable", mUsePolygonSplitIfAvailable);
+
+	Environment::GetSingleton()->GetBoolValue("VspBspTree.useCostHeuristics", mUseCostHeuristics);
+	Environment::GetSingleton()->GetBoolValue("VspBspTree.useSplitCostQueue", mUseSplitCostQueue);
+	Environment::GetSingleton()->GetBoolValue("VspBspTree.simulateOctree", mCirculatingAxis);
+	Environment::GetSingleton()->GetBoolValue("VspBspTree.useRandomAxis", mUseRandomAxis);
+	Environment::GetSingleton()->GetIntValue("VspBspTree.nodePriorityQueueType", mNodePriorityQueueType);
+
+	Environment::GetSingleton()->GetBoolValue("ViewCells.PostProcess.emptyViewCellsMerge", mEmptyViewCellsMergeAllowed);
 	
 	char subdivisionStatsLog[100];
-	env->GetStringValue("VspBspTree.subdivisionStats", subdivisionStatsLog);
+	Environment::GetSingleton()->GetStringValue("VspBspTree.subdivisionStats", subdivisionStatsLog);
 	mSubdivisionStats.open(subdivisionStatsLog);
 
-	env->GetFloatValue("VspBspTree.Construction.minBand", mMinBand);
-	env->GetFloatValue("VspBspTree.Construction.maxBand", mMaxBand);
-	env->GetBoolValue("VspBspTree.Construction.useDrivingAxisForMaxCost", mUseDrivingAxisForMaxCost);
+	Environment::GetSingleton()->GetFloatValue("VspBspTree.Construction.minBand", mMinBand);
+	Environment::GetSingleton()->GetFloatValue("VspBspTree.Construction.maxBand", mMaxBand);
+	Environment::GetSingleton()->GetBoolValue("VspBspTree.Construction.useDrivingAxisForMaxCost", mUseDrivingAxisForMaxCost);
 
 	//-- debug output
@@ -198,5 +198,5 @@
 	Debug << endl;
 }
-
+/*
 VspBspTree::VspBspTree():
 mRoot(NULL),
@@ -211,5 +211,5 @@
 mEpsilon(1e-6f)
 {
-}
+}*/
 
 BspViewCell *VspBspTree::GetOutOfBoundsCell()
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h	(revision 1004)
@@ -33,5 +33,5 @@
 class MergeCandidate;
 class BoundingBoxConverter;
-class Environment;
+
 
 struct BspRay;
@@ -72,7 +72,7 @@
 	enum {PER_OBJECT, PER_TRIANGLE};
 
-	/** default constructor taking an environment file.
-	*/
-	ViewCellsManager(Environment *env);
+	/** Default constructor.
+	*/
+	ViewCellsManager();
 
 	virtual ~ViewCellsManager();
@@ -409,5 +409,5 @@
 		of the hierarchy.
 	*/
-	inline void SetScalarPvsSize(ViewCell *vc, const int pvsSize) const;
+	void SetScalarPvsSize(ViewCell *vc, const int pvsSize) const;
 
 
@@ -433,5 +433,4 @@
 		@param filename the filename of the view cells
 		@param objects the scene objects
-		@param env an environment file containing more parameters
 		@param finalizeViewCells if the view cells should be post processed, i.e.
 			a mesh is created representing the geometry
@@ -443,5 +442,4 @@
 	static ViewCellsManager *LoadViewCells(const string &filename, 
 										   ObjectContainer *objects, 
-										   Environment *env,
 										   const bool finalizeViewCells,
 										   BoundingBoxConverter *bconverter = NULL);
@@ -571,5 +569,5 @@
 	bool mExportBboxesForPvs;
 		
-	Environment *environment;
+	//Environment *environment;
 	Plane3 mClipPlane;
 
@@ -652,7 +650,4 @@
 	/// if pvs should be exported with view cells
 	bool mExportPvs;
-
-	/// the pointer to the environment
-	Environment *mEnvironment;
 };
 
@@ -668,5 +663,5 @@
 		used to construct the bsp tree.
 	*/
-	BspViewCellsManager(BspTree *tree, Environment *env);
+	BspViewCellsManager(BspTree *tree);
 
 	~BspViewCellsManager();
@@ -757,5 +752,5 @@
 public:
 
-	KdViewCellsManager(KdTree *tree, Environment *env);
+	KdViewCellsManager(KdTree *tree);
 
 	int ConstructSubdivision(const ObjectContainer &objects, 
@@ -826,5 +821,5 @@
 public:
 
-	VspKdViewCellsManager(VspKdTree *vspKdTree, Environment *env);
+	VspKdViewCellsManager(VspKdTree *vspKdTree);
 
 	int ConstructSubdivision(const ObjectContainer &objects, 
@@ -892,5 +887,5 @@
 public:
 
-	VspBspViewCellsManager(VspBspTree *tree, Environment *env);
+	VspBspViewCellsManager(VspBspTree *tree);
 	~VspBspViewCellsManager();
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp	(revision 1004)
@@ -26,5 +26,23 @@
 
 
-Environment *environment = NULL;
+//Environment *environment = NULL;
+Environment *Environment::sEnvironment = NULL;
+
+
+Environment *Environment::GetSingleton()
+{
+	if (!sEnvironment)
+	{
+		sEnvironment = new Environment();
+	}
+
+	return sEnvironment;
+}
+
+void Environment::DelSingleton()
+{
+	DEL_PTR(sEnvironment);
+}
+
 
 Environment::~Environment()
@@ -2219,5 +2237,5 @@
   if (!GetParam(' ', 0, filename)) {
     // user didn't specified environment file explicitly, so
-    strcpy(filename, "default.env");
+    strcpy(filename, "default.Environment::GetSingleton()");
   }
   
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp	(revision 1004)
@@ -227,45 +227,45 @@
 
 	//-- termination criteria for autopartition
-	environment->GetIntValue("BspTree.Termination.maxDepth", mTermMaxDepth);
-	environment->GetIntValue("BspTree.Termination.minPvs", mTermMinPvs);
-	environment->GetIntValue("BspTree.Termination.minPolygons", mTermMinPolys);
-	environment->GetIntValue("BspTree.Termination.minRays", mTermMinRays);
-	environment->GetFloatValue("BspTree.Termination.minProbability", mTermMinProbability);	
-	environment->GetFloatValue("BspTree.Termination.maxRayContribution", mTermMaxRayContribution);
-	environment->GetFloatValue("BspTree.Termination.minAccRayLenght", mTermMinAccRayLength);
+	Environment::GetSingleton()->GetIntValue("BspTree.Termination.maxDepth", mTermMaxDepth);
+	Environment::GetSingleton()->GetIntValue("BspTree.Termination.minPvs", mTermMinPvs);
+	Environment::GetSingleton()->GetIntValue("BspTree.Termination.minPolygons", mTermMinPolys);
+	Environment::GetSingleton()->GetIntValue("BspTree.Termination.minRays", mTermMinRays);
+	Environment::GetSingleton()->GetFloatValue("BspTree.Termination.minProbability", mTermMinProbability);	
+	Environment::GetSingleton()->GetFloatValue("BspTree.Termination.maxRayContribution", mTermMaxRayContribution);
+	Environment::GetSingleton()->GetFloatValue("BspTree.Termination.minAccRayLenght", mTermMinAccRayLength);
 
 	//-- factors for bsp tree split plane heuristics
-	environment->GetFloatValue("BspTree.Factor.verticalSplits", mVerticalSplitsFactor);
-	environment->GetFloatValue("BspTree.Factor.largestPolyArea", mLargestPolyAreaFactor);
-	environment->GetFloatValue("BspTree.Factor.blockedRays", mBlockedRaysFactor);
-	environment->GetFloatValue("BspTree.Factor.leastRaySplits", mLeastRaySplitsFactor);
-	environment->GetFloatValue("BspTree.Factor.balancedRays", mBalancedRaysFactor);
-	environment->GetFloatValue("BspTree.Factor.pvs", mPvsFactor);
-	environment->GetFloatValue("BspTree.Factor.leastSplits" , mLeastSplitsFactor);
-	environment->GetFloatValue("BspTree.Factor.balancedPolys", mBalancedPolysFactor);
-	environment->GetFloatValue("BspTree.Factor.balancedViewCells", mBalancedViewCellsFactor);
-	environment->GetFloatValue("BspTree.Termination.ct_div_ci", mCtDivCi);
+	Environment::GetSingleton()->GetFloatValue("BspTree.Factor.verticalSplits", mVerticalSplitsFactor);
+	Environment::GetSingleton()->GetFloatValue("BspTree.Factor.largestPolyArea", mLargestPolyAreaFactor);
+	Environment::GetSingleton()->GetFloatValue("BspTree.Factor.blockedRays", mBlockedRaysFactor);
+	Environment::GetSingleton()->GetFloatValue("BspTree.Factor.leastRaySplits", mLeastRaySplitsFactor);
+	Environment::GetSingleton()->GetFloatValue("BspTree.Factor.balancedRays", mBalancedRaysFactor);
+	Environment::GetSingleton()->GetFloatValue("BspTree.Factor.pvs", mPvsFactor);
+	Environment::GetSingleton()->GetFloatValue("BspTree.Factor.leastSplits" , mLeastSplitsFactor);
+	Environment::GetSingleton()->GetFloatValue("BspTree.Factor.balancedPolys", mBalancedPolysFactor);
+	Environment::GetSingleton()->GetFloatValue("BspTree.Factor.balancedViewCells", mBalancedViewCellsFactor);
+	Environment::GetSingleton()->GetFloatValue("BspTree.Termination.ct_div_ci", mCtDivCi);
 
 	//-- termination criteria for axis aligned split
-	environment->GetFloatValue("BspTree.Termination.AxisAligned.ct_div_ci", mAxisAlignedCtDivCi);
-	environment->GetFloatValue("BspTree.Termination.maxCostRatio", mMaxCostRatio);
-	environment->GetIntValue("BspTree.Termination.AxisAligned.minPolys", 
+	Environment::GetSingleton()->GetFloatValue("BspTree.Termination.AxisAligned.ct_div_ci", mAxisAlignedCtDivCi);
+	Environment::GetSingleton()->GetFloatValue("BspTree.Termination.maxCostRatio", mMaxCostRatio);
+	Environment::GetSingleton()->GetIntValue("BspTree.Termination.AxisAligned.minPolys", 
 							 mTermMinPolysForAxisAligned);
-	environment->GetIntValue("BspTree.Termination.AxisAligned.minRays", 
+	Environment::GetSingleton()->GetIntValue("BspTree.Termination.AxisAligned.minRays", 
 							 mTermMinRaysForAxisAligned);
-	environment->GetIntValue("BspTree.Termination.AxisAligned.minObjects", 
+	Environment::GetSingleton()->GetIntValue("BspTree.Termination.AxisAligned.minObjects", 
 							 mTermMinObjectsForAxisAligned);
 	//-- partition criteria
-	environment->GetIntValue("BspTree.maxPolyCandidates", mMaxPolyCandidates);
-	environment->GetIntValue("BspTree.maxRayCandidates", mMaxRayCandidates);
-	environment->GetIntValue("BspTree.splitPlaneStrategy", mSplitPlaneStrategy);
-	environment->GetFloatValue("BspTree.AxisAligned.splitBorder", mSplitBorder);
-	environment->GetIntValue("BspTree.maxTests", mMaxTests);
-	environment->GetIntValue("BspTree.Termination.maxViewCells", mMaxViewCells);
-
-	environment->GetFloatValue("BspTree.Construction.epsilon", mEpsilon);
+	Environment::GetSingleton()->GetIntValue("BspTree.maxPolyCandidates", mMaxPolyCandidates);
+	Environment::GetSingleton()->GetIntValue("BspTree.maxRayCandidates", mMaxRayCandidates);
+	Environment::GetSingleton()->GetIntValue("BspTree.splitPlaneStrategy", mSplitPlaneStrategy);
+	Environment::GetSingleton()->GetFloatValue("BspTree.AxisAligned.splitBorder", mSplitBorder);
+	Environment::GetSingleton()->GetIntValue("BspTree.maxTests", mMaxTests);
+	Environment::GetSingleton()->GetIntValue("BspTree.Termination.maxViewCells", mMaxViewCells);
+
+	Environment::GetSingleton()->GetFloatValue("BspTree.Construction.epsilon", mEpsilon);
 
 	char subdivisionStatsLog[100];
-	environment->GetStringValue("BspTree.subdivisionStats", subdivisionStatsLog);
+	Environment::GetSingleton()->GetStringValue("BspTree.subdivisionStats", subdivisionStatsLog);
 	mSubdivisionStats.open(subdivisionStatsLog);
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/LogManager.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/LogManager.h	(revision 1001)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/LogManager.h	(revision 1004)
@@ -24,4 +24,5 @@
 	static LogManager *GetSingleton();
 
+	static void DelSingleton();
 
 protected:
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 1004)
@@ -118,23 +118,23 @@
 mRenderSimulator(NULL)
 {
-	environment->GetBoolValue("Preprocessor.useGlRenderer", mUseGlRenderer);
+	Environment::GetSingleton()->GetBoolValue("Preprocessor.useGlRenderer", mUseGlRenderer);
   
 	// renderer will be constructed when the scene graph and viewcell manager will be known
 	renderer = NULL;
   
-	environment->GetBoolValue("Preprocessor.useGlDebugger", mUseGlDebugger);
-	environment->GetBoolValue("Preprocessor.loadPolygonsAsMeshes", mLoadPolygonsAsMeshes);
-	environment->GetBoolValue("Preprocessor.quitOnFinish", mQuitOnFinish);
-	environment->GetBoolValue("Preprocessor.computeVisibility", mComputeVisibility);
-	environment->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace);
-	environment->GetBoolValue("Preprocessor.exportVisibility", mExportVisibility );
+	Environment::GetSingleton()->GetBoolValue("Preprocessor.useGlDebugger", mUseGlDebugger);
+	Environment::GetSingleton()->GetBoolValue("Preprocessor.loadPolygonsAsMeshes", mLoadPolygonsAsMeshes);
+	Environment::GetSingleton()->GetBoolValue("Preprocessor.quitOnFinish", mQuitOnFinish);
+	Environment::GetSingleton()->GetBoolValue("Preprocessor.computeVisibility", mComputeVisibility);
+	Environment::GetSingleton()->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace);
+	Environment::GetSingleton()->GetBoolValue("Preprocessor.exportVisibility", mExportVisibility );
 
 	char buffer[256];
-	environment->GetStringValue("Preprocessor.visibilityFile",  buffer);
+	Environment::GetSingleton()->GetStringValue("Preprocessor.visibilityFile",  buffer);
 	mVisibilityFileName = buffer;
-	environment->GetBoolValue("Preprocessor.applyVisibilityFilter", mApplyVisibilityFilter );
-	environment->GetBoolValue("Preprocessor.applyVisibilitySpatialFilter",
+	Environment::GetSingleton()->GetBoolValue("Preprocessor.applyVisibilityFilter", mApplyVisibilityFilter );
+	Environment::GetSingleton()->GetBoolValue("Preprocessor.applyVisibilitySpatialFilter",
 							  mApplyVisibilitySpatialFilter );
-	environment->GetFloatValue("Preprocessor.visibilityFilterWidth", mVisibilityFilterWidth);
+	Environment::GetSingleton()->GetFloatValue("Preprocessor.visibilityFilterWidth", mVisibilityFilterWidth);
 
 	Debug << "detect empty view space=" << mDetectEmptyViewSpace << endl;
@@ -361,16 +361,16 @@
 {
 	//-- parse view cells construction method
-	environment->GetBoolValue("ViewCells.loadFromFile", mLoadViewCells);
+	Environment::GetSingleton()->GetBoolValue("ViewCells.loadFromFile", mLoadViewCells);
 	char buf[100];
 	
 	if (mLoadViewCells)
 	{	
-		environment->GetStringValue("ViewCells.filename", buf);
-		mViewCellsManager = ViewCellsManager::LoadViewCells(buf, &mObjects, environment, true);
+		Environment::GetSingleton()->GetStringValue("ViewCells.filename", buf);
+		mViewCellsManager = ViewCellsManager::LoadViewCells(buf, &mObjects, true);
 	}
 	else
 	{
 		//-- parse type of view cell container
-		environment->GetStringValue("ViewCells.type", buf);		
+		Environment::GetSingleton()->GetStringValue("ViewCells.type", buf);		
 	    mViewCellsManager = CreateViewCellsManager(buf);
 	}
@@ -379,7 +379,7 @@
 	float objRenderCost = 0, vcOverhead = 0, moveSpeed = 0;
 
-	environment->GetFloatValue("Simulation.objRenderCost",objRenderCost);
-	environment->GetFloatValue("Simulation.vcOverhead", vcOverhead);
-	environment->GetFloatValue("Simulation.moveSpeed", moveSpeed);
+	Environment::GetSingleton()->GetFloatValue("Simulation.objRenderCost",objRenderCost);
+	Environment::GetSingleton()->GetFloatValue("Simulation.vcOverhead", vcOverhead);
+	Environment::GetSingleton()->GetFloatValue("Simulation.moveSpeed", moveSpeed);
 	
 	mRenderSimulator = 
@@ -408,5 +408,5 @@
 	if (strcmp(name, "kdTree") == 0)
 	{
-		mViewCellsManager = new KdViewCellsManager(mKdTree, environment);
+		mViewCellsManager = new KdViewCellsManager(mKdTree);
 	}
 	else if (strcmp(name, "bspTree") == 0)
@@ -415,5 +415,5 @@
 
 		mBspTree = new BspTree();
-		mViewCellsManager = new BspViewCellsManager(mBspTree, environment);
+		mViewCellsManager = new BspViewCellsManager(mBspTree);
 	}
 	else if (strcmp(name, "vspBspTree") == 0)
@@ -421,6 +421,6 @@
 		Debug << "view cell type: VspBsp" << endl;
 
-		mVspBspTree = new VspBspTree(environment);
-		mViewCellsManager = new VspBspViewCellsManager(mVspBspTree, environment);
+		mVspBspTree = new VspBspTree();
+		mViewCellsManager = new VspBspViewCellsManager(mVspBspTree);
 	}
 	else if (strcmp(name, "vspKdTree") == 0)
@@ -428,5 +428,5 @@
 		mVspKdTree = new VspKdTree();		
 	
-		mViewCellsManager = new VspKdViewCellsManager(mVspKdTree, environment);
+		mViewCellsManager = new VspKdViewCellsManager(mVspKdTree);
 	}
 	else if (strcmp(name, "sceneDependent") == 0)
@@ -437,5 +437,5 @@
 		Debug << "view cell type: Bsp" << endl;
 		
-		mViewCellsManager = new BspViewCellsManager(mBspTree, environment);
+		mViewCellsManager = new BspViewCellsManager(mBspTree);
 	}
 	else
@@ -464,5 +464,5 @@
 	std::stable_sort(objects.begin(), objects.end(), ilt);
 	char fileName[100];
-	environment->GetStringValue("Preprocessor.samplesFilename", fileName);
+	Environment::GetSingleton()->GetStringValue("Preprocessor.samplesFilename", fileName);
 	
     Vector3 origin, termination;
@@ -549,5 +549,5 @@
 {
 	char fileName[100];
-	environment->GetStringValue("Preprocessor.samplesFilename", fileName);
+	Environment::GetSingleton()->GetStringValue("Preprocessor.samplesFilename", fileName);
 	
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/RenderSampler.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/RenderSampler.cpp	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/RenderSampler.cpp	(revision 1004)
@@ -8,5 +8,5 @@
 RenderSampler::RenderSampler():Preprocessor()
 {
-  environment->GetIntValue("RenderSampler.samples", mSamples);
+  Environment::GetSingleton()->GetIntValue("RenderSampler.samples", mSamples);
   cout << "number of render samples: " << mSamples << endl;
 }
@@ -22,8 +22,8 @@
 	bool useOcclusionQueries;
 
-    environment->GetIntValue("Preprocessor.histogram.maxValue", histoMaxVal);
-	environment->GetIntValue("Preprocessor.histogram.intervals", histoIntervals);
-	environment->GetIntValue("RenderSampler.visibleThreshold", threshold);
-	environment->GetBoolValue("RenderSampler.useOcclusionQueries", useOcclusionQueries);
+    Environment::GetSingleton()->GetIntValue("Preprocessor.histogram.maxValue", histoMaxVal);
+	Environment::GetSingleton()->GetIntValue("Preprocessor.histogram.intervals", histoIntervals);
+	Environment::GetSingleton()->GetIntValue("RenderSampler.visibleThreshold", threshold);
+	Environment::GetSingleton()->GetBoolValue("RenderSampler.useOcclusionQueries", useOcclusionQueries);
 
 	Debug << "************* render sampler ****************" << endl;
@@ -57,6 +57,5 @@
 		histogram[i] = 0;
 	}
-cout << "here3 "<< mSamples << endl;
-	cout << "here2 " << samples.size() << endl;
+
 	// store maximal pvs
 	for (int i = 0; i < mSamples; ++ i) 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp	(revision 884)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp	(revision 1004)
@@ -29,21 +29,21 @@
 {
   // this should increase coherence of the samples
-  environment->GetIntValue("RssPreprocessor.samplesPerPass", mSamplesPerPass);
-  environment->GetIntValue("RssPreprocessor.initialSamples", mInitialSamples);
-  environment->GetIntValue("RssPreprocessor.vssSamples", mRssSamples);
-  environment->GetIntValue("RssPreprocessor.vssSamplesPerPass", mRssSamplesPerPass);
-  environment->GetBoolValue("RssPreprocessor.useImportanceSampling", mUseImportanceSampling);
-
-  environment->GetBoolValue("RssPreprocessor.Export.pvs", mExportPvs);
-  environment->GetBoolValue("RssPreprocessor.Export.rssTree", mExportRssTree);
-  environment->GetBoolValue("RssPreprocessor.Export.rays", mExportRays);
-  environment->GetIntValue("RssPreprocessor.Export.numRays", mExportNumRays);
-  environment->GetBoolValue("RssPreprocessor.useViewcells", mUseViewcells);
-  environment->GetBoolValue("RssPreprocessor.objectBasedSampling", mObjectBasedSampling);
-  environment->GetBoolValue("RssPreprocessor.directionalSampling", mDirectionalSampling);
-
-  environment->GetBoolValue("RssPreprocessor.loadInitialSamples", mLoadInitialSamples);
-  environment->GetBoolValue("RssPreprocessor.storeInitialSamples", mStoreInitialSamples);
-  environment->GetBoolValue("RssPreprocessor.updateSubdivision", mUpdateSubdivision);
+  Environment::GetSingleton()->GetIntValue("RssPreprocessor.samplesPerPass", mSamplesPerPass);
+  Environment::GetSingleton()->GetIntValue("RssPreprocessor.initialSamples", mInitialSamples);
+  Environment::GetSingleton()->GetIntValue("RssPreprocessor.vssSamples", mRssSamples);
+  Environment::GetSingleton()->GetIntValue("RssPreprocessor.vssSamplesPerPass", mRssSamplesPerPass);
+  Environment::GetSingleton()->GetBoolValue("RssPreprocessor.useImportanceSampling", mUseImportanceSampling);
+
+  Environment::GetSingleton()->GetBoolValue("RssPreprocessor.Export.pvs", mExportPvs);
+  Environment::GetSingleton()->GetBoolValue("RssPreprocessor.Export.rssTree", mExportRssTree);
+  Environment::GetSingleton()->GetBoolValue("RssPreprocessor.Export.rays", mExportRays);
+  Environment::GetSingleton()->GetIntValue("RssPreprocessor.Export.numRays", mExportNumRays);
+  Environment::GetSingleton()->GetBoolValue("RssPreprocessor.useViewcells", mUseViewcells);
+  Environment::GetSingleton()->GetBoolValue("RssPreprocessor.objectBasedSampling", mObjectBasedSampling);
+  Environment::GetSingleton()->GetBoolValue("RssPreprocessor.directionalSampling", mDirectionalSampling);
+
+  Environment::GetSingleton()->GetBoolValue("RssPreprocessor.loadInitialSamples", mLoadInitialSamples);
+  Environment::GetSingleton()->GetBoolValue("RssPreprocessor.storeInitialSamples", mStoreInitialSamples);
+  Environment::GetSingleton()->GetBoolValue("RssPreprocessor.updateSubdivision", mUpdateSubdivision);
   
   mStats.open("stats.log");
Index: GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp	(revision 1004)
@@ -26,16 +26,16 @@
 {
   // this should increase coherence of the samples
-  environment->GetIntValue("VssPreprocessor.samplesPerPass", mSamplesPerPass);
-  environment->GetIntValue("VssPreprocessor.initialSamples", mInitialSamples);
-  environment->GetIntValue("VssPreprocessor.vssSamples", mVssSamples);
-  environment->GetIntValue("VssPreprocessor.vssSamplesPerPass", mVssSamplesPerPass);
-  environment->GetBoolValue("VssPreprocessor.useImportanceSampling", mUseImportanceSampling);
+  Environment::GetSingleton()->GetIntValue("VssPreprocessor.samplesPerPass", mSamplesPerPass);
+  Environment::GetSingleton()->GetIntValue("VssPreprocessor.initialSamples", mInitialSamples);
+  Environment::GetSingleton()->GetIntValue("VssPreprocessor.vssSamples", mVssSamples);
+  Environment::GetSingleton()->GetIntValue("VssPreprocessor.vssSamplesPerPass", mVssSamplesPerPass);
+  Environment::GetSingleton()->GetBoolValue("VssPreprocessor.useImportanceSampling", mUseImportanceSampling);
  
-  environment->GetBoolValue("VssPreprocessor.loadInitialSamples", mLoadInitialSamples);
-  environment->GetBoolValue("VssPreprocessor.storeInitialSamples", mStoreInitialSamples);
-  environment->GetBoolValue("VssPreprocessor.useViewSpaceBox", mUseViewSpaceBox);
-  environment->GetBoolValue("VssPreprocessor.testBeamSampling", mTestBeamSampling);
-  environment->GetBoolValue("VssPreprocessor.enlargeViewSpace", mEnlargeViewSpace);
-  environment->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace);
+  Environment::GetSingleton()->GetBoolValue("VssPreprocessor.loadInitialSamples", mLoadInitialSamples);
+  Environment::GetSingleton()->GetBoolValue("VssPreprocessor.storeInitialSamples", mStoreInitialSamples);
+  Environment::GetSingleton()->GetBoolValue("VssPreprocessor.useViewSpaceBox", mUseViewSpaceBox);
+  Environment::GetSingleton()->GetBoolValue("VssPreprocessor.testBeamSampling", mTestBeamSampling);
+  Environment::GetSingleton()->GetBoolValue("VssPreprocessor.enlargeViewSpace", mEnlargeViewSpace);
+  Environment::GetSingleton()->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace);
   
   useViewspacePlane = mUseViewSpaceBox; //hack
Index: GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp	(revision 1001)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp	(revision 1004)
@@ -737,5 +737,5 @@
 				VssRay *ray;
 				
-				const indices[][2] = {{0,0}, {0,1}, {1,1}, {1,0}}; 
+				const int indices[][2] = {{0,0}, {0,1}, {1,1}, {1,0}}; 
 				MeshInstance dummy(mesh);
 				for (int i=0; i < 4; i++) {
Index: GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp	(revision 863)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp	(revision 1004)
@@ -17,6 +17,6 @@
 {
   // this should increase coherence of the samples
-  environment->GetIntValue("Sampling.samplesPerPass", mSamplesPerPass);
-  environment->GetIntValue("Sampling.totalSamples", mTotalSamples);
+  Environment::GetSingleton()->GetIntValue("Sampling.samplesPerPass", mSamplesPerPass);
+  Environment::GetSingleton()->GetIntValue("Sampling.totalSamples", mTotalSamples);
  
   mStats.open("stats.log");
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 1004)
@@ -40,5 +40,5 @@
 
 
-ViewCellsManager::ViewCellsManager(Environment *env):
+ViewCellsManager::ViewCellsManager():
 mRenderer(NULL),
 mInitialSamples(0),
@@ -53,10 +53,9 @@
 mMaxPvsRatio(1.0),
 mViewCellPvsIsUpdated(false)
-,mEnvironment(env)
 {
 	mViewSpaceBox.Initialize();
 	ParseEnvironment();
 
-	mViewCellsTree = new ViewCellsTree(this, env);
+	mViewCellsTree = new ViewCellsTree(this);
 }
 
@@ -65,9 +64,9 @@
 {
 	// visualization stuff
-	mEnvironment->GetBoolValue("ViewCells.Visualization.exportRays", mExportRays);
-	mEnvironment->GetBoolValue("ViewCells.Visualization.exportGeometry", mExportGeometry);
-	mEnvironment->GetFloatValue("ViewCells.maxPvsRatio", mMaxPvsRatio);
-	
-	mEnvironment->GetBoolValue("ViewCells.pruneEmptyViewCells", mPruneEmptyViewCells);
+	Environment::GetSingleton()->GetBoolValue("ViewCells.Visualization.exportRays", mExportRays);
+	Environment::GetSingleton()->GetBoolValue("ViewCells.Visualization.exportGeometry", mExportGeometry);
+	Environment::GetSingleton()->GetFloatValue("ViewCells.maxPvsRatio", mMaxPvsRatio);
+	
+	Environment::GetSingleton()->GetBoolValue("ViewCells.pruneEmptyViewCells", mPruneEmptyViewCells);
 
 	// HACK
@@ -77,30 +76,30 @@
 		mMinPvsSize = 0;
 
-	mEnvironment->GetBoolValue("ViewCells.processOnlyValidViewCells", mOnlyValidViewCells);
-
-	mEnvironment->GetIntValue("ViewCells.Construction.samples", mConstructionSamples);
-	mEnvironment->GetIntValue("ViewCells.PostProcess.samples", mPostProcessSamples);
-	mEnvironment->GetBoolValue("ViewCells.PostProcess.useRaysForMerge", mUseRaysForMerge);
-
- 	mEnvironment->GetIntValue("ViewCells.Visualization.samples", mVisualizationSamples);
-
-	mEnvironment->GetIntValue("ViewCells.Construction.samplesPerPass", mSamplesPerPass);
-	mEnvironment->GetBoolValue("ViewCells.exportToFile", mExportViewCells);
-	
-	mEnvironment->GetIntValue("ViewCells.active", mNumActiveViewCells);
-	mEnvironment->GetBoolValue("ViewCells.PostProcess.compress", mCompressViewCells);
-	mEnvironment->GetBoolValue("ViewCells.Visualization.useClipPlane", mUseClipPlaneForViz);
-	mEnvironment->GetBoolValue("ViewCells.PostProcess.merge", mMergeViewCells);
-	mEnvironment->GetBoolValue("ViewCells.evaluateViewCells", mEvaluateViewCells);
-	mEnvironment->GetBoolValue("ViewCells.showVisualization", mShowVisualization);
-	mEnvironment->GetIntValue("ViewCells.Filter.maxSize", mMaxFilterSize);
-	mEnvironment->GetFloatValue("ViewCells.Filter.width", mFilterWidth);
-	mEnvironment->GetIntValue("ViewCells.renderCostEvaluationType", mRenderCostEvaluationType);
-
-	mEnvironment->GetBoolValue("ViewCells.exportBboxesForPvs", mExportBboxesForPvs);
-	mEnvironment->GetBoolValue("ViewCells.exportPvs", mExportPvs);
+	Environment::GetSingleton()->GetBoolValue("ViewCells.processOnlyValidViewCells", mOnlyValidViewCells);
+
+	Environment::GetSingleton()->GetIntValue("ViewCells.Construction.samples", mConstructionSamples);
+	Environment::GetSingleton()->GetIntValue("ViewCells.PostProcess.samples", mPostProcessSamples);
+	Environment::GetSingleton()->GetBoolValue("ViewCells.PostProcess.useRaysForMerge", mUseRaysForMerge);
+
+ 	Environment::GetSingleton()->GetIntValue("ViewCells.Visualization.samples", mVisualizationSamples);
+
+	Environment::GetSingleton()->GetIntValue("ViewCells.Construction.samplesPerPass", mSamplesPerPass);
+	Environment::GetSingleton()->GetBoolValue("ViewCells.exportToFile", mExportViewCells);
+	
+	Environment::GetSingleton()->GetIntValue("ViewCells.active", mNumActiveViewCells);
+	Environment::GetSingleton()->GetBoolValue("ViewCells.PostProcess.compress", mCompressViewCells);
+	Environment::GetSingleton()->GetBoolValue("ViewCells.Visualization.useClipPlane", mUseClipPlaneForViz);
+	Environment::GetSingleton()->GetBoolValue("ViewCells.PostProcess.merge", mMergeViewCells);
+	Environment::GetSingleton()->GetBoolValue("ViewCells.evaluateViewCells", mEvaluateViewCells);
+	Environment::GetSingleton()->GetBoolValue("ViewCells.showVisualization", mShowVisualization);
+	Environment::GetSingleton()->GetIntValue("ViewCells.Filter.maxSize", mMaxFilterSize);
+	Environment::GetSingleton()->GetFloatValue("ViewCells.Filter.width", mFilterWidth);
+	Environment::GetSingleton()->GetIntValue("ViewCells.renderCostEvaluationType", mRenderCostEvaluationType);
+
+	Environment::GetSingleton()->GetBoolValue("ViewCells.exportBboxesForPvs", mExportBboxesForPvs);
+	Environment::GetSingleton()->GetBoolValue("ViewCells.exportPvs", mExportPvs);
 
 	char buf[100];
-	mEnvironment->GetStringValue("ViewCells.samplingType", buf);
+	Environment::GetSingleton()->GetStringValue("ViewCells.samplingType", buf);
 
 	
@@ -119,5 +118,5 @@
 	}
 
-	mEnvironment->GetStringValue("ViewCells.Evaluation.samplingType", buf);
+	Environment::GetSingleton()->GetStringValue("ViewCells.Evaluation.samplingType", buf);
 	
 	if (strcmp(buf, "box") == 0)
@@ -135,5 +134,5 @@
 	}
 
-	mEnvironment->GetStringValue("ViewCells.renderCostEvaluationType", buf);
+	Environment::GetSingleton()->GetStringValue("ViewCells.renderCostEvaluationType", buf);
 	
 	if (strcmp(buf, "perobject") == 0)
@@ -151,5 +150,5 @@
 	}
 
-    mEnvironment->GetStringValue("ViewCells.Visualization.colorCode", buf);
+    Environment::GetSingleton()->GetStringValue("ViewCells.Visualization.colorCode", buf);
 
 	if (strcmp(buf, "PVS") == 0)
@@ -393,5 +392,5 @@
 		  << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl;
 
-return 0;
+//return 0;
 	// take post processing time
 	startTime = GetTime();
@@ -560,9 +559,9 @@
 
     int histoIntervals;
-	mEnvironment->GetIntValue("Preprocessor.histogram.intervals", histoIntervals);
+	Environment::GetSingleton()->GetIntValue("Preprocessor.histogram.intervals", histoIntervals);
 	const int intervals = min(histoIntervals, (int)viewCells.size());
 
 	int histoMaxVal;
-	mEnvironment->GetIntValue("Preprocessor.histogram.maxValue", histoMaxVal);
+	Environment::GetSingleton()->GetIntValue("Preprocessor.histogram.maxValue", histoMaxVal);
 	maxRenderCost = max(histoMaxVal, maxRenderCost);
 
@@ -629,5 +628,4 @@
 ViewCellsManager *ViewCellsManager::LoadViewCells(const string &filename, 
 												  ObjectContainer *objects,
-												  Environment *env,
 												  const bool finalizeViewCells,
 												  BoundingBoxConverter *bconverter)
@@ -638,5 +636,5 @@
 	ViewCellsManager *vm = NULL;
 
-	if (parser.ParseFile(filename, &vm, objects, bconverter, env))
+	if (parser.ParseFile(filename, &vm, objects, bconverter))
 	{
 		long startTime = GetTime();
@@ -762,5 +760,5 @@
 	// hack: normalize pvs size
 	int histoMaxVal;
-	mEnvironment->GetIntValue("Preprocessor.histogram.maxValue", histoMaxVal);
+	Environment::GetSingleton()->GetIntValue("Preprocessor.histogram.maxValue", histoMaxVal);
 	maxVal = max(histoMaxVal, maxPvs);
 		
@@ -768,5 +766,5 @@
 
 	int histoIntervals;
-	mEnvironment->GetIntValue("Preprocessor.histogram.intervals", histoIntervals);
+	Environment::GetSingleton()->GetIntValue("Preprocessor.histogram.intervals", histoIntervals);
 	const int intervals = min(histoIntervals, (int)viewCells.size());
 
@@ -847,9 +845,9 @@
 	char s[64]; 
 
-	mEnvironment->GetIntValue("ViewCells.Evaluation.samplesPerPass", samplesPerPass);
-	mEnvironment->GetIntValue("ViewCells.Evaluation.samples", numSamples);
+	Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.samplesPerPass", samplesPerPass);
+	Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.samples", numSamples);
 
 	char statsPrefix[100];
-	mEnvironment->GetStringValue("ViewCells.Evaluation.statsPrefix", statsPrefix);
+	Environment::GetSingleton()->GetStringValue("ViewCells.Evaluation.statsPrefix", statsPrefix);
 
 	Debug << "view cell evaluation samples per pass: " << samplesPerPass << endl;
@@ -895,17 +893,33 @@
 				 		Preprocessor::SPATIAL_BOX_BASED_DISTRIBUTION;
 		*/
+		long startTime = GetTime();
+
 		//-- construction rays => we use uniform samples for this
-		cout << "casting " << samplesPerPass << " samples " << endl;
+		cout << "casting " << samplesPerPass << " samples ... ";
+		Debug << "casting " << samplesPerPass << " samples ... ";
+
 		CastPassSamples(samplesPerPass, samplingType, evaluationSamples);
 		
 		castSamples += samplesPerPass;
 
-		cout << "computing sample contributions of " << (int)evaluationSamples.size() 
-			 << " samples " << endl;
+		Real timeDiff = TimeDiff(startTime, GetTime());
+		Debug << "finished in " << timeDiff * 1e-3 << " secs" << endl;
+		cout << "finished in " << timeDiff * 1e-3 << " secs" << endl;
+
+		cout << "computing sample contributions of " << (int)evaluationSamples.size()  << " samples ... ";
+		Debug << "computing sample contributions of " << (int)evaluationSamples.size()  << " samples ... ";
+
+		startTime = GetTime();
 
 		ComputeSampleContributions(evaluationSamples, true, false);
 
+		timeDiff = TimeDiff(startTime, GetTime());
+		cout << "finished in " << timeDiff * 1e-3 << " secs" << endl;
+		Debug << "finished in " << timeDiff * 1e-3 << " secs" << endl;
+
+		startTime = GetTime();
+
 		cout << "compute new statistics ... ";
-
+		Debug << "compute new statistics ... ";
 
 		//-- propagate pvs or pvs size information
@@ -913,5 +927,4 @@
 		UpdatePvsForEvaluation(mViewCellsTree->GetRoot(), pvs);
 
-
 		//-- output stats
 		sprintf(s, "-%09d-eval.log", castSamples);
@@ -920,5 +933,8 @@
 		mViewCellsTree->ExportStats(fileName);
 
-		cout << "finished" << endl;
+		timeDiff = TimeDiff(startTime, GetTime());
+		cout << "finished in " << timeDiff * 1e-3 << " secs" << endl;
+		Debug << "finished in " << timeDiff * 1e-3 << " secs" << endl;
+
 	
 		disposeRays(evaluationSamples, NULL);
@@ -931,6 +947,6 @@
 	int histoStepSize;
 
-	mEnvironment->GetBoolValue("ViewCells.Evaluation.histogram", useHisto);
-	mEnvironment->GetIntValue("ViewCells.Evaluation.histoStepSize", histoStepSize);
+	Environment::GetSingleton()->GetBoolValue("ViewCells.Evaluation.histogram", useHisto);
+	Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.histoStepSize", histoStepSize);
 
 	const int numLeaves = mViewCellsTree->GetNumInitialViewCells(mViewCellsTree->GetRoot());
@@ -1263,5 +1279,5 @@
 	X3dParser parser;
 
-	mEnvironment->GetFloatValue("ViewCells.height", parser.mViewCellHeight);
+	Environment::GetSingleton()->GetFloatValue("ViewCells.height", parser.mViewCellHeight);
 
 	bool success = parser.ParseFile(filename, *this);
@@ -1705,10 +1721,10 @@
 	float pos;
 
-	mEnvironment->GetFloatValue("ViewCells.Visualization.clipPlanePos", pos);
+	Environment::GetSingleton()->GetFloatValue("ViewCells.Visualization.clipPlanePos", pos);
 
 	Vector3 point = mViewSpaceBox.Min() +  mViewSpaceBox.Size() * pos;
 
 	if (mUseClipPlaneForViz)
-        mEnvironment->GetIntValue("ViewCells.Visualization.clipPlaneAxis", axis);
+        Environment::GetSingleton()->GetIntValue("ViewCells.Visualization.clipPlaneAxis", axis);
 
 	Vector3 normal(0,0,0);
@@ -2169,8 +2185,8 @@
 
 
-BspViewCellsManager::BspViewCellsManager(BspTree *bspTree, Environment *env):
-ViewCellsManager(env), mBspTree(bspTree)
-{
-	mEnvironment->GetIntValue("BspTree.Construction.samples", mInitialSamples);
+BspViewCellsManager::BspViewCellsManager(BspTree *bspTree):
+ViewCellsManager(), mBspTree(bspTree)
+{
+	Environment::GetSingleton()->GetIntValue("BspTree.Construction.samples", mInitialSamples);
 	mBspTree->SetViewCellsManager(this);
 	mBspTree->mViewCellsTree = mViewCellsTree;
@@ -2340,5 +2356,5 @@
 	{
 		char mstats[100];
-		mEnvironment->GetStringValue("ViewCells.mergeStats", mstats);
+		Environment::GetSingleton()->GetStringValue("ViewCells.mergeStats", mstats);
 		mViewCellsTree->ExportStats(mstats);
 	}
@@ -2424,5 +2440,5 @@
 	{
 		char filename[100];
-		mEnvironment->GetStringValue("ViewCells.filename", filename);
+		Environment::GetSingleton()->GetStringValue("ViewCells.filename", filename);
 		ExportViewCells(filename, mExportPvs, objects);
 	}
@@ -2432,5 +2448,5 @@
 	{
 		char filename[100];
-		mEnvironment->GetStringValue("ViewCells.boxesFilename", filename);
+		Environment::GetSingleton()->GetStringValue("ViewCells.boxesFilename", filename);
 		ExportBoundingBoxes(filename, objects);
 	}
@@ -2459,5 +2475,4 @@
 	
 	int savedColorCode = mColorCode;
-
 	
 	
@@ -2477,5 +2492,4 @@
 				exporter->ExportGeometry(objects);
 
-			//exporter->SetWireframe();
 			//exporter->SetFilled();
 			bool b = mUseClipPlaneForViz;
@@ -2492,5 +2506,5 @@
 	//-- visualization of the BSP splits
 	bool exportSplits = false;
-	mEnvironment->GetBoolValue("BspTree.Visualization.exportSplits", exportSplits);
+	Environment::GetSingleton()->GetBoolValue("BspTree.Visualization.exportSplits", exportSplits);
 
 	if (exportSplits)
@@ -3034,6 +3048,6 @@
 
 
-KdViewCellsManager::KdViewCellsManager(KdTree *kdTree, Environment *env):
-ViewCellsManager(env), mKdTree(kdTree), mKdPvsDepth(100)
+KdViewCellsManager::KdViewCellsManager(KdTree *kdTree):
+ViewCellsManager(), mKdTree(kdTree), mKdPvsDepth(100)
 {
 }
@@ -3338,8 +3352,8 @@
 
 
-VspKdViewCellsManager::VspKdViewCellsManager(VspKdTree *vspKdTree, Environment *env):
-ViewCellsManager(env), mVspKdTree(vspKdTree)
-{
-	mEnvironment->GetIntValue("VspKdTree.Construction.samples", mInitialSamples);
+VspKdViewCellsManager::VspKdViewCellsManager(VspKdTree *vspKdTree):
+ViewCellsManager(), mVspKdTree(vspKdTree)
+{
+	Environment::GetSingleton()->GetIntValue("VspKdTree.Construction.samples", mInitialSamples);
 	mVspKdTree->SetViewCellsManager(this);
 }
@@ -3699,8 +3713,8 @@
 
 
-VspBspViewCellsManager::VspBspViewCellsManager(VspBspTree *vspBspTree, Environment *env):
-ViewCellsManager(env), mVspBspTree(vspBspTree)
-{
-	mEnvironment->GetIntValue("VspBspTree.Construction.samples", mInitialSamples);
+VspBspViewCellsManager::VspBspViewCellsManager(VspBspTree *vspBspTree):
+ViewCellsManager(), mVspBspTree(vspBspTree)
+{
+	Environment::GetSingleton()->GetIntValue("VspBspTree.Construction.samples", mInitialSamples);
 	mVspBspTree->SetViewCellsManager(this);
 	mVspBspTree->mViewCellsTree = mViewCellsTree;
@@ -3857,5 +3871,5 @@
 		ObjectPvs pvs;
 
-		mEnvironment->GetStringValue("ViewCells.mergeStats", mstats);
+		Environment::GetSingleton()->GetStringValue("ViewCells.mergeStats", mstats);
 		mViewCellsTree->ExportStats(mstats);
 	}
@@ -4111,5 +4125,5 @@
 	{
 		char filename[100];
-		mEnvironment->GetStringValue("ViewCells.filename", filename);
+		Environment::GetSingleton()->GetStringValue("ViewCells.filename", filename);
 		ExportViewCells(filename, mExportPvs, objects);
 	}
@@ -4120,26 +4134,7 @@
 	{
 		char filename[100];
-		mEnvironment->GetStringValue("ViewCells.boxesFilename", filename);
+		Environment::GetSingleton()->GetStringValue("ViewCells.boxesFilename", filename);
 	
 		ExportBoundingBoxes(filename, objects);
-/*
-		IndexedBoundingBoxContainer boxes;
-		LoadBoundingBoxes(filename, boxes);
-
-		IndexedBoundingBoxContainer::const_iterator it, it_end = boxes.end();
-
-		for (it = boxes.begin(); it != it_end; ++ it)
-		{
-			IndexedBoundingBox ibox = *it;
-			AxisAlignedBox3 box = ibox.second;
-
-			Debug << ibox.first << " " 
-				  << box.Min().x << " " 
-				  << box.Min().y << " " 
-				  << box.Min().z << " " 
-				  << box.Max().x << " " 
-				  << box.Max().y << " " 
-                  << box.Max().z << endl;	
-		}*/
 	}
 
@@ -4330,4 +4325,5 @@
 			if (0)
 			{
+				// export view space box
 				exporter->SetWireframe();
 				exporter->ExportBox(mViewSpaceBox);
@@ -4421,5 +4417,5 @@
 	//-- visualization of the BSP splits
 	bool exportSplits = false;
-	mEnvironment->GetBoolValue("VspBspTree.Visualization.exportSplits", exportSplits);
+	Environment::GetSingleton()->GetBoolValue("VspBspTree.Visualization.exportSplits", exportSplits);
 
 	if (exportSplits)
@@ -4712,5 +4708,5 @@
 	int numSamples;
 
-	mEnvironment->GetIntValue("RenderSampler.samples", numSamples);
+	Environment::GetSingleton()->GetIntValue("RenderSampler.samples", numSamples);
 	cout << "samples" << numSamples << endl;
 
@@ -5046,5 +5042,5 @@
 	int i;
 	for (i=0; it != it_end; ++ it, ++ i) {
-	  	cout<<"v"<<i<<" pvs="<<(*it)->GetPvs().mEntries.size()<<endl;
+	  	//cout<<"v"<<i<<" pvs="<<(*it)->GetPvs().mEntries.size()<<endl;
 	  pvs.Merge((*it)->GetPvs());
 	}
Index: GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp	(revision 1004)
@@ -86,5 +86,5 @@
   mFrame = 0;
   mWireFrame = false;
-  environment->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace);
+  Environment::GetSingleton()->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace);
   mSnapErrorFrames = true;
   mSnapPrefix = "snap/";
@@ -775,5 +775,5 @@
 QGLPixelBuffer(QSize(w, h)), GlRenderer(sceneGraph, viewcells, tree) {
  
-  environment->GetIntValue("Preprocessor.pvsRenderErrorSamples", mPvsStatFrames);
+  Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", mPvsStatFrames);
   mPvsErrorBuffer.resize(mPvsStatFrames);
   ClearErrorBuffer();
@@ -939,8 +939,8 @@
 
 void
-GlRendererWidget::SetupProjection(const int w, const int h)
+GlRendererWidget::SetupProjection(const int w, const int h, const float angle)
 {
   if (!mTopView)
-	GlRenderer::SetupProjection(w, h);
+	GlRenderer::SetupProjection(w, h, angle);
   else {
 	glViewport(0, 0, w, h);
Index: GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h	(revision 971)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h	(revision 1004)
@@ -28,5 +28,5 @@
 class Beam;
 class ViewCellsTree;
-class Environment;
+//class Environment;
 
 /**
@@ -201,10 +201,4 @@
 	VspBspTree();
 
-	
-	/** Constructor creating an empty tree. Loads parameters 
-		from an environment file.
-	*/ 
-	VspBspTree(Environment *env);
-
 	/** Default destructor.
 	*/
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp	(revision 1004)
@@ -354,5 +354,5 @@
 
 
-ViewCellsTree::ViewCellsTree(ViewCellsManager *vcm, Environment *env):
+ViewCellsTree::ViewCellsTree(ViewCellsManager *vcm):
 mRoot(NULL),
 mUseAreaForPvs(false),
@@ -364,15 +364,15 @@
 #endif
 {
-	env->GetBoolValue("ViewCells.Visualization.exportMergedViewCells", mExportMergedViewCells);
-	env->GetFloatValue("ViewCells.maxStaticMemory", mMaxMemory);
+	Environment::GetSingleton()->GetBoolValue("ViewCells.Visualization.exportMergedViewCells", mExportMergedViewCells);
+	Environment::GetSingleton()->GetFloatValue("ViewCells.maxStaticMemory", mMaxMemory);
 
 	//-- merge options
-	env->GetFloatValue("ViewCells.PostProcess.renderCostWeight", mRenderCostWeight);
-	env->GetIntValue("ViewCells.PostProcess.minViewCells", mMergeMinViewCells);
-	env->GetFloatValue("ViewCells.PostProcess.maxCostRatio", mMergeMaxCostRatio);
-	env->GetBoolValue("ViewCells.PostProcess.refine", mRefineViewCells);	
-
-	env->GetIntValue("ViewCells.PostProcess.maxMergesPerPass", mMaxMergesPerPass);
-	env->GetFloatValue("ViewCells.PostProcess.avgCostMaxDeviation", mAvgCostMaxDeviation);
+	Environment::GetSingleton()->GetFloatValue("ViewCells.PostProcess.renderCostWeight", mRenderCostWeight);
+	Environment::GetSingleton()->GetIntValue("ViewCells.PostProcess.minViewCells", mMergeMinViewCells);
+	Environment::GetSingleton()->GetFloatValue("ViewCells.PostProcess.maxCostRatio", mMergeMaxCostRatio);
+	Environment::GetSingleton()->GetBoolValue("ViewCells.PostProcess.refine", mRefineViewCells);	
+
+	Environment::GetSingleton()->GetIntValue("ViewCells.PostProcess.maxMergesPerPass", mMaxMergesPerPass);
+	Environment::GetSingleton()->GetFloatValue("ViewCells.PostProcess.avgCostMaxDeviation", mAvgCostMaxDeviation);
 
 	Debug << "============= view cell tree options ================\n";
Index: GTP/trunk/Lib/Vis/Preprocessing/src/LogManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/LogManager.cpp	(revision 1001)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/LogManager.cpp	(revision 1004)
@@ -1,3 +1,5 @@
 #include "LogManager.h"
+#include "common.h"
+
 using namespace std;
 
@@ -18,4 +20,10 @@
 
 
+void LogManager::DelSingleton()
+{
+	DEL_PTR(sLogManager);
+}
+
+
 LogManager::LogManager()
 {
Index: GTP/trunk/Lib/Vis/Preprocessing/src/UnigraphicsParser.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/UnigraphicsParser.cpp	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/UnigraphicsParser.cpp	(revision 1004)
@@ -65,5 +65,5 @@
 
   int meshGrouping;
-  environment->GetIntValue("Unigraphics.meshGrouping",
+  Environment::GetSingleton()->GetIntValue("Unigraphics.meshGrouping",
 			   meshGrouping);
   
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.h	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.h	(revision 1004)
@@ -256,8 +256,5 @@
   }
 
-  virtual int
-  CastRay(
-	  Ray &ray
-	  );
+  virtual int CastRay(Ray &ray);
 
   virtual bool IsConvex() { return mMesh->mIsConvex; }
@@ -303,5 +300,5 @@
 	class if the same mesh should be instantiated on different places.
 */
-class TransformedMeshInstance : public MeshInstance
+class TransformedMeshInstance: public MeshInstance
 {
 public:
@@ -313,4 +310,6 @@
   virtual int CastRay(Ray &ray);
 
+  virtual int CastRay(Ray &ray, const vector<int> &faces);
+
   virtual int Type() const { return TRANSFORMED_MESH_INSTANCE; }
 
@@ -329,5 +328,5 @@
   void GetWorldTransform(Matrix4x4 &m);
 
-  /** Transforms mesh-
+  /** Transforms a mesh according to the stored world transform.
 	@param transformedMesh returns the tranformed mesh.
   */
Index: GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp	(revision 1004)
@@ -36,15 +36,15 @@
   
   mRoot = new KdLeaf(NULL, 0);
-  environment->GetIntValue("KdTree.Termination.maxNodes", mTermMaxNodes);
-  environment->GetIntValue("KdTree.Termination.maxDepth", mTermMaxDepth);
-  environment->GetIntValue("KdTree.Termination.minCost", mTermMinCost);
-  environment->GetFloatValue("KdTree.Termination.maxCostRatio", mMaxCostRatio);
-  environment->GetFloatValue("KdTree.Termination.ct_div_ci", mCt_div_ci);
-  environment->GetFloatValue("KdTree.splitBorder", mSplitBorder);
-
-  environment->GetBoolValue("KdTree.sahUseFaces", mSahUseFaces);
+  Environment::GetSingleton()->GetIntValue("KdTree.Termination.maxNodes", mTermMaxNodes);
+  Environment::GetSingleton()->GetIntValue("KdTree.Termination.maxDepth", mTermMaxDepth);
+  Environment::GetSingleton()->GetIntValue("KdTree.Termination.minCost", mTermMinCost);
+  Environment::GetSingleton()->GetFloatValue("KdTree.Termination.maxCostRatio", mMaxCostRatio);
+  Environment::GetSingleton()->GetFloatValue("KdTree.Termination.ct_div_ci", mCt_div_ci);
+  Environment::GetSingleton()->GetFloatValue("KdTree.splitBorder", mSplitBorder);
+
+  Environment::GetSingleton()->GetBoolValue("KdTree.sahUseFaces", mSahUseFaces);
 
   char splitType[64];
-  environment->GetStringValue("KdTree.splitMethod", splitType);
+  Environment::GetSingleton()->GetStringValue("KdTree.splitMethod", splitType);
   
   mSplitMethod = SPLIT_SPATIAL_MEDIAN;
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h	(revision 1004)
@@ -24,5 +24,5 @@
 class ViewCellsManager;
 class ViewCellLeaf;
-class Environment;
+//class Environment;
 
 
@@ -393,8 +393,7 @@
 
 public:
-	/** View cells tree constructor taking a view cell mnanager and
-		an environment as parameters.
-	*/
-	ViewCellsTree(ViewCellsManager *vcm, Environment *env);
+	/** View cells tree constructor taking a view cell mnanager as parameter
+	*/
+	ViewCellsTree(ViewCellsManager *vcm);
 	~ViewCellsTree();
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp	(revision 863)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp	(revision 1004)
@@ -107,29 +107,29 @@
 RssTree::RssTree()
 {
-  environment->GetIntValue("RssTree.maxDepth", termMaxDepth);
-  environment->GetIntValue("RssTree.minPvs", termMinPvs);
-  environment->GetIntValue("RssTree.minRays", termMinRays);
-  environment->GetFloatValue("RssTree.maxRayContribution", termMaxRayContribution);
-  environment->GetFloatValue("RssTree.maxCostRatio", termMaxCostRatio);
-
-  environment->GetFloatValue("RssTree.minSize", termMinSize);
+  Environment::GetSingleton()->GetIntValue("RssTree.maxDepth", termMaxDepth);
+  Environment::GetSingleton()->GetIntValue("RssTree.minPvs", termMinPvs);
+  Environment::GetSingleton()->GetIntValue("RssTree.minRays", termMinRays);
+  Environment::GetSingleton()->GetFloatValue("RssTree.maxRayContribution", termMaxRayContribution);
+  Environment::GetSingleton()->GetFloatValue("RssTree.maxCostRatio", termMaxCostRatio);
+
+  Environment::GetSingleton()->GetFloatValue("RssTree.minSize", termMinSize);
   termMinSize = sqr(termMinSize);
 	
-  environment->GetFloatValue("RssTree.refDirBoxMaxSize", refDirBoxMaxSize);
+  Environment::GetSingleton()->GetFloatValue("RssTree.refDirBoxMaxSize", refDirBoxMaxSize);
   refDirBoxMaxSize = sqr(refDirBoxMaxSize);
   
-  environment->GetFloatValue("RssTree.epsilon", epsilon);
-  environment->GetFloatValue("RssTree.ct_div_ci", ct_div_ci);
-	
-  environment->GetFloatValue("RssTree.maxTotalMemory", maxTotalMemory);
-  environment->GetFloatValue("RssTree.maxStaticMemory", maxStaticMemory);
-  
-  environment->GetFloatValue("RssTree.maxStaticMemory", maxStaticMemory);
-
-
-  
-  environment->GetIntValue("RssTree.accessTimeThreshold", accessTimeThreshold);
+  Environment::GetSingleton()->GetFloatValue("RssTree.epsilon", epsilon);
+  Environment::GetSingleton()->GetFloatValue("RssTree.ct_div_ci", ct_div_ci);
+	
+  Environment::GetSingleton()->GetFloatValue("RssTree.maxTotalMemory", maxTotalMemory);
+  Environment::GetSingleton()->GetFloatValue("RssTree.maxStaticMemory", maxStaticMemory);
+  
+  Environment::GetSingleton()->GetFloatValue("RssTree.maxStaticMemory", maxStaticMemory);
+
+
+  
+  Environment::GetSingleton()->GetIntValue("RssTree.accessTimeThreshold", accessTimeThreshold);
   //= 1000;
-  environment->GetIntValue("RssTree.minCollapseDepth", minCollapseDepth);
+  Environment::GetSingleton()->GetIntValue("RssTree.minCollapseDepth", minCollapseDepth);
   //  int minCollapseDepth = 4;
 
@@ -141,5 +141,5 @@
   // split type
   char sname[128];
-  environment->GetStringValue("RssTree.splitType", sname);
+  Environment::GetSingleton()->GetStringValue("RssTree.splitType", sname);
   string name(sname);
 	
@@ -157,15 +157,15 @@
 	  }
 	
-  environment->GetBoolValue("RssTree.randomize", randomize);
-  environment->GetBoolValue("RssTree.splitUseOnlyDrivingAxis", mSplitUseOnlyDrivingAxis);
-
-  environment->GetBoolValue("RssTree.interleaveDirSplits", mInterleaveDirSplits);
-  environment->GetIntValue("RssTree.dirSplitDepth", mDirSplitDepth);
-
-  environment->GetBoolValue("RssTree.importanceBasedCost", mImportanceBasedCost);
-  
-  environment->GetIntValue("RssTree.maxRays", mMaxRays);
-
-  environment->GetBoolValue("RssTree.perObjectTree", mPerObjectTree);
+  Environment::GetSingleton()->GetBoolValue("RssTree.randomize", randomize);
+  Environment::GetSingleton()->GetBoolValue("RssTree.splitUseOnlyDrivingAxis", mSplitUseOnlyDrivingAxis);
+
+  Environment::GetSingleton()->GetBoolValue("RssTree.interleaveDirSplits", mInterleaveDirSplits);
+  Environment::GetSingleton()->GetIntValue("RssTree.dirSplitDepth", mDirSplitDepth);
+
+  Environment::GetSingleton()->GetBoolValue("RssTree.importanceBasedCost", mImportanceBasedCost);
+  
+  Environment::GetSingleton()->GetIntValue("RssTree.maxRays", mMaxRays);
+
+  Environment::GetSingleton()->GetBoolValue("RssTree.perObjectTree", mPerObjectTree);
   
   //  mRoots;
Index: GTP/trunk/Lib/Vis/Preprocessing/src/VssTree.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/VssTree.cpp	(revision 863)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/VssTree.cpp	(revision 1004)
@@ -67,21 +67,21 @@
 VssTree::VssTree()
 {
-  environment->GetIntValue("VssTree.maxDepth", termMaxDepth);
-  environment->GetIntValue("VssTree.minPvs", termMinPvs);
-  environment->GetIntValue("VssTree.minRays", termMinRays);
-  environment->GetFloatValue("VssTree.maxRayContribution", termMaxRayContribution);
-  environment->GetFloatValue("VssTree.maxCostRatio", termMaxCostRatio);
-
-  environment->GetFloatValue("VssTree.minSize", termMinSize);
+  Environment::GetSingleton()->GetIntValue("VssTree.maxDepth", termMaxDepth);
+  Environment::GetSingleton()->GetIntValue("VssTree.minPvs", termMinPvs);
+  Environment::GetSingleton()->GetIntValue("VssTree.minRays", termMinRays);
+  Environment::GetSingleton()->GetFloatValue("VssTree.maxRayContribution", termMaxRayContribution);
+  Environment::GetSingleton()->GetFloatValue("VssTree.maxCostRatio", termMaxCostRatio);
+
+  Environment::GetSingleton()->GetFloatValue("VssTree.minSize", termMinSize);
   termMinSize = sqr(termMinSize);
 	
-  environment->GetFloatValue("VssTree.refDirBoxMaxSize", refDirBoxMaxSize);
+  Environment::GetSingleton()->GetFloatValue("VssTree.refDirBoxMaxSize", refDirBoxMaxSize);
   refDirBoxMaxSize = sqr(refDirBoxMaxSize);
   
-  environment->GetFloatValue("VssTree.epsilon", epsilon);
-  environment->GetFloatValue("VssTree.ct_div_ci", ct_div_ci);
-	
-  environment->GetFloatValue("VssTree.maxTotalMemory", maxTotalMemory);
-  environment->GetFloatValue("VssTree.maxStaticMemory", maxStaticMemory);
+  Environment::GetSingleton()->GetFloatValue("VssTree.epsilon", epsilon);
+  Environment::GetSingleton()->GetFloatValue("VssTree.ct_div_ci", ct_div_ci);
+	
+  Environment::GetSingleton()->GetFloatValue("VssTree.maxTotalMemory", maxTotalMemory);
+  Environment::GetSingleton()->GetFloatValue("VssTree.maxStaticMemory", maxStaticMemory);
   
   
@@ -89,9 +89,9 @@
 
   float refDirAngle;
-  environment->GetFloatValue("VssTree.refDirAngle", refDirAngle);
-  
-  environment->GetIntValue("VssTree.accessTimeThreshold", accessTimeThreshold);
+  Environment::GetSingleton()->GetFloatValue("VssTree.refDirAngle", refDirAngle);
+  
+  Environment::GetSingleton()->GetIntValue("VssTree.accessTimeThreshold", accessTimeThreshold);
   //= 1000;
-  environment->GetIntValue("VssTree.minCollapseDepth", minCollapseDepth);
+  Environment::GetSingleton()->GetIntValue("VssTree.minCollapseDepth", minCollapseDepth);
   //  int minCollapseDepth = 4;
 
@@ -103,5 +103,5 @@
   // split type
   char sname[128];
-  environment->GetStringValue("VssTree.splitType", sname);
+  Environment::GetSingleton()->GetStringValue("VssTree.splitType", sname);
   string name(sname);
 	
@@ -119,10 +119,10 @@
 	  }
 	
-  environment->GetBoolValue("VssTree.randomize", randomize);
-  environment->GetBoolValue("VssTree.splitUseOnlyDrivingAxis", mSplitUseOnlyDrivingAxis);
-  environment->GetBoolValue("VssTree.useRss", mUseRss);
-
-  environment->GetBoolValue("VssTree.interleaveDirSplits", mInterleaveDirSplits);
-  environment->GetIntValue("VssTree.dirSplitDepth", mDirSplitDepth);
+  Environment::GetSingleton()->GetBoolValue("VssTree.randomize", randomize);
+  Environment::GetSingleton()->GetBoolValue("VssTree.splitUseOnlyDrivingAxis", mSplitUseOnlyDrivingAxis);
+  Environment::GetSingleton()->GetBoolValue("VssTree.useRss", mUseRss);
+
+  Environment::GetSingleton()->GetBoolValue("VssTree.interleaveDirSplits", mInterleaveDirSplits);
+  Environment::GetSingleton()->GetIntValue("VssTree.dirSplitDepth", mDirSplitDepth);
 
   root = NULL;
Index: GTP/trunk/Lib/Vis/Preprocessing/src/FromPointVisibilityTree.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/FromPointVisibilityTree.cpp	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/FromPointVisibilityTree.cpp	(revision 1004)
@@ -67,69 +67,69 @@
 {
 	bool randomize = false;
-	environment->GetBoolValue("FromPointVisibilityTree.Construction.randomize", randomize);
+	Environment::GetSingleton()->GetBoolValue("FromPointVisibilityTree.Construction.randomize", randomize);
 	if (randomize)
 		Randomize(); // initialise random generator for heuristics
 
 	//-- termination criteria for autopartition
-	environment->GetIntValue("FromPointVisibilityTree.Termination.maxDepth", mTermMaxDepth);
-	environment->GetIntValue("FromPointVisibilityTree.Termination.minPvs", mTermMinPvs);
-	environment->GetIntValue("FromPointVisibilityTree.Termination.minRays", mTermMinRays);
-	environment->GetFloatValue("FromPointVisibilityTree.Termination.minProbability", mTermMinProbability);
-	environment->GetFloatValue("FromPointVisibilityTree.Termination.maxRayContribution", mTermMaxRayContribution);
-	environment->GetFloatValue("FromPointVisibilityTree.Termination.minAccRayLenght", mTermMinAccRayLength);
-	environment->GetFloatValue("FromPointVisibilityTree.Termination.maxCostRatio", mTermMaxCostRatio);
-	environment->GetIntValue("FromPointVisibilityTree.Termination.missTolerance", mTermMissTolerance);
-	environment->GetIntValue("FromPointVisibilityTree.Termination.maxViewCells", mMaxViewCells);
+	Environment::GetSingleton()->GetIntValue("FromPointVisibilityTree.Termination.maxDepth", mTermMaxDepth);
+	Environment::GetSingleton()->GetIntValue("FromPointVisibilityTree.Termination.minPvs", mTermMinPvs);
+	Environment::GetSingleton()->GetIntValue("FromPointVisibilityTree.Termination.minRays", mTermMinRays);
+	Environment::GetSingleton()->GetFloatValue("FromPointVisibilityTree.Termination.minProbability", mTermMinProbability);
+	Environment::GetSingleton()->GetFloatValue("FromPointVisibilityTree.Termination.maxRayContribution", mTermMaxRayContribution);
+	Environment::GetSingleton()->GetFloatValue("FromPointVisibilityTree.Termination.minAccRayLenght", mTermMinAccRayLength);
+	Environment::GetSingleton()->GetFloatValue("FromPointVisibilityTree.Termination.maxCostRatio", mTermMaxCostRatio);
+	Environment::GetSingleton()->GetIntValue("FromPointVisibilityTree.Termination.missTolerance", mTermMissTolerance);
+	Environment::GetSingleton()->GetIntValue("FromPointVisibilityTree.Termination.maxViewCells", mMaxViewCells);
 
 	//-- max cost ratio for early tree termination
-	environment->GetFloatValue("FromPointVisibilityTree.Termination.maxCostRatio", mTermMaxCostRatio);
-
-	environment->GetFloatValue("FromPointVisibilityTree.Termination.minGlobalCostRatio", mTermMinGlobalCostRatio);
-	environment->GetIntValue("FromPointVisibilityTree.Termination.globalCostMissTolerance", mTermGlobalCostMissTolerance);
+	Environment::GetSingleton()->GetFloatValue("FromPointVisibilityTree.Termination.maxCostRatio", mTermMaxCostRatio);
+
+	Environment::GetSingleton()->GetFloatValue("FromPointVisibilityTree.Termination.minGlobalCostRatio", mTermMinGlobalCostRatio);
+	Environment::GetSingleton()->GetIntValue("FromPointVisibilityTree.Termination.globalCostMissTolerance", mTermGlobalCostMissTolerance);
 
 	// HACK//mTermMinPolygons = 25;
 
 	//-- factors for bsp tree split plane heuristics
-	environment->GetFloatValue("FromPointVisibilityTree.Factor.pvs", mPvsFactor);
-	environment->GetFloatValue("FromPointVisibilityTree.Termination.ct_div_ci", mCtDivCi);
+	Environment::GetSingleton()->GetFloatValue("FromPointVisibilityTree.Factor.pvs", mPvsFactor);
+	Environment::GetSingleton()->GetFloatValue("FromPointVisibilityTree.Termination.ct_div_ci", mCtDivCi);
 
 
 	//-- partition criteria
-	environment->GetIntValue("FromPointVisibilityTree.maxPolyCandidates", mMaxPolyCandidates);
-	environment->GetIntValue("FromPointVisibilityTree.maxRayCandidates", mMaxRayCandidates);
-	environment->GetIntValue("FromPointVisibilityTree.splitPlaneStrategy", mSplitPlaneStrategy);
-
-	environment->GetFloatValue("FromPointVisibilityTree.Construction.epsilon", mEpsilon);
-	environment->GetIntValue("FromPointVisibilityTree.maxTests", mMaxTests);
+	Environment::GetSingleton()->GetIntValue("FromPointVisibilityTree.maxPolyCandidates", mMaxPolyCandidates);
+	Environment::GetSingleton()->GetIntValue("FromPointVisibilityTree.maxRayCandidates", mMaxRayCandidates);
+	Environment::GetSingleton()->GetIntValue("FromPointVisibilityTree.splitPlaneStrategy", mSplitPlaneStrategy);
+
+	Environment::GetSingleton()->GetFloatValue("FromPointVisibilityTree.Construction.epsilon", mEpsilon);
+	Environment::GetSingleton()->GetIntValue("FromPointVisibilityTree.maxTests", mMaxTests);
 
 	// if only the driving axis is used for axis aligned split
-	environment->GetBoolValue("FromPointVisibilityTree.splitUseOnlyDrivingAxis", mOnlyDrivingAxis);
+	Environment::GetSingleton()->GetBoolValue("FromPointVisibilityTree.splitUseOnlyDrivingAxis", mOnlyDrivingAxis);
 	
 	//-- termination criteria for axis aligned split
-	environment->GetFloatValue("FromPointVisibilityTree.Termination.AxisAligned.maxRayContribution", 
-								mTermMaxRayContriForAxisAligned);
-	environment->GetIntValue("FromPointVisibilityTree.Termination.AxisAligned.minRays",
-							 mTermMinRaysForAxisAligned);
-
-	//environment->GetFloatValue("FromPointVisibilityTree.maxTotalMemory", mMaxTotalMemory);
-	environment->GetFloatValue("FromPointVisibilityTree.maxStaticMemory", mMaxMemory);
-
-	environment->GetFloatValue("FromPointVisibilityTree.Construction.renderCostWeight", mRenderCostWeight);
-	environment->GetBoolValue("FromPointVisibilityTree.usePolygonSplitIfAvailable", mUsePolygonSplitIfAvailable);
-
-	environment->GetBoolValue("FromPointVisibilityTree.useCostHeuristics", mUseCostHeuristics);
-	environment->GetBoolValue("FromPointVisibilityTree.useSplitCostQueue", mUseSplitCostQueue);
-	environment->GetBoolValue("FromPointVisibilityTree.simulateOctree", mCirculatingAxis);
-	environment->GetBoolValue("FromPointVisibilityTree.useRandomAxis", mUseRandomAxis);
-	environment->GetIntValue("FromPointVisibilityTree.nodePriorityQueueType", mNodePriorityQueueType);
-
-	environment->GetBoolValue("ViewCells.PostProcess.emptyViewCellsMerge", mEmptyViewCellsMergeAllowed);
+	Environment::GetSingleton()->GetFloatValue("FromPointVisibilityTree.Termination.AxisAligned.maxRayContribution", 
+												mTermMaxRayContriForAxisAligned);
+	Environment::GetSingleton()->GetIntValue("FromPointVisibilityTree.Termination.AxisAligned.minRays",
+											  mTermMinRaysForAxisAligned);
+
+	//Environment::GetSingleton()->GetFloatValue("FromPointVisibilityTree.maxTotalMemory", mMaxTotalMemory);
+	Environment::GetSingleton()->GetFloatValue("FromPointVisibilityTree.maxStaticMemory", mMaxMemory);
+
+	Environment::GetSingleton()->GetFloatValue("FromPointVisibilityTree.Construction.renderCostWeight", mRenderCostWeight);
+	Environment::GetSingleton()->GetBoolValue("FromPointVisibilityTree.usePolygonSplitIfAvailable", mUsePolygonSplitIfAvailable);
+
+	Environment::GetSingleton()->GetBoolValue("FromPointVisibilityTree.useCostHeuristics", mUseCostHeuristics);
+	Environment::GetSingleton()->GetBoolValue("FromPointVisibilityTree.useSplitCostQueue", mUseSplitCostQueue);
+	Environment::GetSingleton()->GetBoolValue("FromPointVisibilityTree.simulateOctree", mCirculatingAxis);
+	Environment::GetSingleton()->GetBoolValue("FromPointVisibilityTree.useRandomAxis", mUseRandomAxis);
+	Environment::GetSingleton()->GetIntValue("FromPointVisibilityTree.nodePriorityQueueType", mNodePriorityQueueType);
+
+	Environment::GetSingleton()->GetBoolValue("ViewCells.PostProcess.emptyViewCellsMerge", mEmptyViewCellsMergeAllowed);
 	
 	char subdivisionStatsLog[100];
-	environment->GetStringValue("FromPointVisibilityTree.subdivisionStats", subdivisionStatsLog);
+	Environment::GetSingleton()->GetStringValue("FromPointVisibilityTree.subdivisionStats", subdivisionStatsLog);
 	mSubdivisionStats.open(subdivisionStatsLog);
 
-	environment->GetFloatValue("FromPointVisibilityTree.Construction.minBand", mMinBand);
-	environment->GetFloatValue("FromPointVisibilityTree.Construction.maxBand", mMaxBand);
+	Environment::GetSingleton()->GetFloatValue("FromPointVisibilityTree.Construction.minBand", mMinBand);
+	Environment::GetSingleton()->GetFloatValue("FromPointVisibilityTree.Construction.maxBand", mMaxBand);
 
 	//-- debug output
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Environment.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Environment.h	(revision 938)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Environment.h	(revision 1004)
@@ -174,15 +174,17 @@
 
 public:  
-  /**@name Methods */
-  //@{
-  /// Constructor of the CEnvironment class.
-  Environment();
-  /// Destructor of the CEnvironment class.
-  virtual ~Environment();
-  
-  /// This method is used as a help on available command line options.
-  virtual void PrintUsage(ostream &s) const;
-
-  virtual void SetStaticOptions();
+	
+public:
+
+	/** Returns the resource manager as a singleton.
+	*/
+	static Environment *GetSingleton();
+
+	static void DelSingleton();
+
+    /// This method is used as a help on available command line options.
+	virtual void PrintUsage(ostream &s) const;
+
+	virtual void SetStaticOptions();
 
 
@@ -312,6 +314,6 @@
   /// returns named option as a character string.
   bool GetStringValue(const char *name,
-											char *value,
-											const bool isFatal = false) const;
+					  char *value,
+					  const bool isFatal = false) const;
   
   //@}
@@ -348,8 +350,19 @@
 		char *filenameCoded);
 
+protected:
+
+	/**@name Methods */  //@{
+  /// Constructor of the CEnvironment class.
+  Environment();
+  /// Destructor of the CEnvironment class.
+  virtual ~Environment();
+
+private:
+
+	static Environment *sEnvironment;
 };
 
 // global environment value
-extern Environment *environment;
+//extern Environment *environment;
 
 }
Index: GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp	(revision 1004)
@@ -40,11 +40,10 @@
 
   Debug.open("debug.log");
-  environment = new Environment;
- 
-  environment->Parse(argc, argv, USE_EXE_PATH);
+  
+  Environment::GetSingleton()->Parse(argc, argv, USE_EXE_PATH);
   MeshKdTree::ParseEnvironment();
 
   char buff[128];
-  environment->GetStringValue("Preprocessor.type", buff);
+  Environment::GetSingleton()->GetStringValue("Preprocessor.type", buff);
   string preprocessorType(buff);
 
@@ -81,5 +80,5 @@
 		  }
 		  else {
-			  DEL_PTR(environment);
+			  Environment::DelSingleton();
 			  cerr<<"Unknown preprocessor type"<<endl;
 			  Debug<<"Unknown preprocessor type"<<endl;
@@ -109,5 +108,5 @@
   preprocessor = p;
   
-  environment->GetStringValue("Scene.filename", buff);
+  Environment::GetSingleton()->GetStringValue("Scene.filename", buff);
   string filename(buff);
   p->LoadScene(filename);
@@ -166,5 +165,5 @@
   //-- clean up
   DEL_PTR(p);
-  DEL_PTR(environment);
+  Environment::DelSingleton();
 
   MeshManager::DelSingleton();
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ResourceManager.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ResourceManager.h	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ResourceManager.h	(revision 1004)
@@ -38,4 +38,6 @@
 	}
 
+	/** We also want full control over the delete.
+	*/
 	static void DelSingleton()
 	{
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParserXerces.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParserXerces.h	(revision 955)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParserXerces.h	(revision 1004)
@@ -29,5 +29,5 @@
   //  Constructors and Destructor
   // -----------------------------------------------------------------------
-  ViewCellsParseHandlers(ObjectContainer *objects, BoundingBoxConverter *bconverter, Environment *env);
+  ViewCellsParseHandlers(ObjectContainer *objects, BoundingBoxConverter *bconverter);
   ~ViewCellsParseHandlers();
   
@@ -85,6 +85,5 @@
 
   IndexedBoundingBoxContainer mIBoundingBoxes;
-  Environment *mEnvironment;
-
+ 
   bool mParseViewCells;
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h	(revision 1001)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h	(revision 1004)
@@ -366,6 +366,6 @@
   virtual int GetHeight() const { return height(); }
 
-  virtual void
-  SetupProjection(const int w, const int h);
+ virtual void
+  SetupProjection(const int w, const int h, const float angle = 70.0f);
 
   void
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp	(revision 975)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp	(revision 1004)
@@ -67,6 +67,5 @@
 // ---------------------------------------------------------------------------
 ViewCellsParseHandlers::ViewCellsParseHandlers(ObjectContainer *objects, 
-											   BoundingBoxConverter *bconverter,
-											   Environment *env):
+											   BoundingBoxConverter *bconverter):
   mElementCount(0)
   , mAttrCount(0)
@@ -82,5 +81,4 @@
   , mObjects(objects)
   , mBoundingBoxConverter(bconverter)
-  , mEnvironment(env)
 {
 }
@@ -622,5 +620,5 @@
 		//mCurrentBspNode = mBspTree->GetRoot();
 
-		mViewCellsManager = new BspViewCellsManager(mBspTree, mEnvironment);
+		mViewCellsManager = new BspViewCellsManager(mBspTree);
 	}
 	
@@ -630,5 +628,5 @@
 		Debug << "view cell type: VspKd" << endl;
 		mVspKdTree = new VspKdTree();	
-		mViewCellsManager = new VspKdViewCellsManager(mVspKdTree, mEnvironment);
+		mViewCellsManager = new VspKdViewCellsManager(mVspKdTree);
 	}
 	else // vspBspTree
@@ -638,5 +636,5 @@
 		mVspBspTree = new VspBspTree();
 		//mCurrentBspNode = mVspBspTree->GetRoot();
-		mViewCellsManager = new VspBspViewCellsManager(mVspBspTree, mEnvironment);
+		mViewCellsManager = new VspBspViewCellsManager(mVspBspTree);
 
 		mVspBspTree->mBox = mViewSpaceBox;
@@ -705,6 +703,5 @@
 								ViewCellsManager **viewCells,
 								ObjectContainer *objects,
-								BoundingBoxConverter *bconverter,
-								Environment *env)
+								BoundingBoxConverter *bconverter)
 {
   // Initialize the XML4C system
@@ -737,5 +734,5 @@
   //  to do.
   //
-  ViewCellsParseHandlers handler(objects, bconverter, env);
+  ViewCellsParseHandlers handler(objects, bconverter);
   parser->setDocumentHandler(&handler);
   parser->setErrorHandler(&handler);
Index: GTP/trunk/Lib/Vis/Preprocessing/src/VspKdTree.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/VspKdTree.h	(revision 860)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/VspKdTree.h	(revision 1004)
@@ -277,8 +277,8 @@
 	/** Returns back child.
 	*/
-	inline VspKdNode *GetBack() const;
+	VspKdNode *GetBack() const;
 	/** Returns front child.
 	*/
-	inline VspKdNode *GetFront() const;
+	VspKdNode *GetFront() const;
 
 protected:
Index: GTP/trunk/Lib/Vis/Preprocessing/src/MeshKdTree.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/MeshKdTree.cpp	(revision 863)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/MeshKdTree.cpp	(revision 1004)
@@ -25,12 +25,12 @@
 MeshKdTree::ParseEnvironment()
 {
-  environment->GetIntValue("MeshKdTree.Termination.maxDepth", mTermMaxDepth);
-  environment->GetIntValue("MeshKdTree.Termination.minCost", mTermMinCost);
-  environment->GetFloatValue("MeshKdTree.Termination.maxCostRatio", mMaxCostRatio);
-  environment->GetFloatValue("MeshKdTree.Termination.ct_div_ci", mCt_div_ci);
-  environment->GetFloatValue("MeshKdTree.splitBorder", mSplitBorder);
+  Environment::GetSingleton()->GetIntValue("MeshKdTree.Termination.maxDepth", mTermMaxDepth);
+  Environment::GetSingleton()->GetIntValue("MeshKdTree.Termination.minCost", mTermMinCost);
+  Environment::GetSingleton()->GetFloatValue("MeshKdTree.Termination.maxCostRatio", mMaxCostRatio);
+  Environment::GetSingleton()->GetFloatValue("MeshKdTree.Termination.ct_div_ci", mCt_div_ci);
+  Environment::GetSingleton()->GetFloatValue("MeshKdTree.splitBorder", mSplitBorder);
   
   char splitType[64];
-  environment->GetStringValue("MeshKdTree.splitMethod", splitType);
+  Environment::GetSingleton()->GetStringValue("MeshKdTree.splitMethod", splitType);
   
   mSplitMethod = SPLIT_SPATIAL_MEDIAN;
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.cpp	(revision 1002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.cpp	(revision 1004)
@@ -719,9 +719,20 @@
 int TransformedMeshInstance::CastRay(Ray &ray)
 {
-  ray.ApplyTransform(Invert(mWorldTransform));
-  int res = mMesh->CastRay(ray, this);
-  ray.ApplyTransform(mWorldTransform);
-  
-  return res;
+	ray.ApplyTransform(Invert(mWorldTransform));
+	
+	const int res = mMesh->CastRay(ray, this);
+	ray.ApplyTransform(mWorldTransform);
+
+    return res;
+}
+
+int TransformedMeshInstance::CastRay(Ray &ray, const vector<int> &faces)
+{
+	ray.ApplyTransform(Invert(mWorldTransform));
+
+	const int res = mMesh->CastRayToSelectedFaces(ray, faces, this);
+	ray.ApplyTransform(mWorldTransform);
+
+	 return res;
 }
 
Index: GTP/trunk/Lib/Vis/shared/scripts/GtpVisibility.sln
===================================================================
--- GTP/trunk/Lib/Vis/shared/scripts/GtpVisibility.sln	(revision 902)
+++ GTP/trunk/Lib/Vis/shared/scripts/GtpVisibility.sln	(revision 1004)
@@ -1,34 +1,34 @@
 Microsoft Visual Studio Solution File, Format Version 8.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Preprocessor", "..\..\Preprocessing\scripts\Preprocessor.vcproj", "{EABCE292-D598-4600-A1C9-2591E7D62FDA}"
+Project("{EAF909A5-FA59-4C3D-9431-0FCC20D5BCF9}") = "Preprocessor", "..\..\Preprocessing\scripts\Preprocessor.icproj", "{1C63E944-5E2E-447C-AE75-F1BF14641C98}"
 	ProjectSection(ProjectDependencies) = postProject
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GtpVisibility", "..\..\OnlineCullingCHC\scripts\GtpVisibility.vcproj", "{101A7691-74F3-48B4-96A3-CF35578F5900}"
+Project("{EAF909A5-FA59-4C3D-9431-0FCC20D5BCF9}") = "GtpVisibility", "..\..\OnlineCullingCHC\scripts\GtpVisibility.icproj", "{C1910FAC-39EA-49F1-B93C-517E15D1C250}"
 	ProjectSection(ProjectDependencies) = postProject
-		{EABCE292-D598-4600-A1C9-2591E7D62FDA} = {EABCE292-D598-4600-A1C9-2591E7D62FDA}
+		{1C63E944-5E2E-447C-AE75-F1BF14641C98} = {1C63E944-5E2E-447C-AE75-F1BF14641C98}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCullingTerrain", "..\..\..\..\App\Demos\Vis\HillyTerrain\OGRE\TestCullingTerrain.vcproj", "{248F19A6-2FE0-4F5D-8928-E0EA10609887}"
+Project("{EAF909A5-FA59-4C3D-9431-0FCC20D5BCF9}") = "TestCullingTerrain", "..\..\..\..\App\Demos\Vis\HillyTerrain\OGRE\TestCullingTerrain.icproj", "{D26A9780-4457-473C-A391-BBEB7758E2D0}"
 	ProjectSection(ProjectDependencies) = postProject
-		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436}
-		{101A7691-74F3-48B4-96A3-CF35578F5900} = {101A7691-74F3-48B4-96A3-CF35578F5900}
-		{7319E499-473D-4CE5-9983-725D6E68A55D} = {7319E499-473D-4CE5-9983-725D6E68A55D}
+		{4FC8EE48-701E-474E-88CB-FFD17E8A778B} = {4FC8EE48-701E-474E-88CB-FFD17E8A778B}
+		{C1910FAC-39EA-49F1-B93C-517E15D1C250} = {C1910FAC-39EA-49F1-B93C-517E15D1C250}
+		{7499CFDA-3C7F-4660-B1D3-8A41EA2EBFA3} = {7499CFDA-3C7F-4660-B1D3-8A41EA2EBFA3}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_VisibilitySceneManager", "..\..\OnlineCullingCHC\OGRE\scripts\Plugin_VisibilitySceneManager.vcproj", "{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}"
+Project("{EAF909A5-FA59-4C3D-9431-0FCC20D5BCF9}") = "Plugin_VisibilitySceneManager", "..\..\OnlineCullingCHC\OGRE\scripts\Plugin_VisibilitySceneManager.icproj", "{4FC8EE48-701E-474E-88CB-FFD17E8A778B}"
 	ProjectSection(ProjectDependencies) = postProject
-		{101A7691-74F3-48B4-96A3-CF35578F5900} = {101A7691-74F3-48B4-96A3-CF35578F5900}
+		{C1910FAC-39EA-49F1-B93C-517E15D1C250} = {C1910FAC-39EA-49F1-B93C-517E15D1C250}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EvalStats", "..\EvalStats\EvalStats.vcproj", "{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}"
+Project("{EAF909A5-FA59-4C3D-9431-0FCC20D5BCF9}") = "EvalStats", "..\EvalStats\EvalStats.icproj", "{A83C475F-BE2B-452B-B702-97C8F125D31D}"
 	ProjectSection(ProjectDependencies) = postProject
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestPreprocessor", "..\..\Preprocessing\scripts\TestPreprocessor.vcproj", "{69BC58F0-C7EB-4B43-B782-B6F047EF0528}"
+Project("{EAF909A5-FA59-4C3D-9431-0FCC20D5BCF9}") = "TestPreprocessor", "..\..\Preprocessing\scripts\TestPreprocessor.icproj", "{6DB3C2CD-BBE6-463D-A9D3-92240C71ED22}"
 	ProjectSection(ProjectDependencies) = postProject
-		{EABCE292-D598-4600-A1C9-2591E7D62FDA} = {EABCE292-D598-4600-A1C9-2591E7D62FDA}
+		{1C63E944-5E2E-447C-AE75-F1BF14641C98} = {1C63E944-5E2E-447C-AE75-F1BF14641C98}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IVReader", "..\..\OnlineCullingCHC\IVReader\scripts\IVReader.vcproj", "{7319E499-473D-4CE5-9983-725D6E68A55D}"
+Project("{EAF909A5-FA59-4C3D-9431-0FCC20D5BCF9}") = "IVReader", "..\..\OnlineCullingCHC\IVReader\scripts\IVReader.icproj", "{7499CFDA-3C7F-4660-B1D3-8A41EA2EBFA3}"
 	ProjectSection(ProjectDependencies) = postProject
 	EndProjectSection
@@ -40,32 +40,60 @@
 	EndGlobalSection
 	GlobalSection(ProjectConfiguration) = postSolution
+		{1C63E944-5E2E-447C-AE75-F1BF14641C98}.Debug.ActiveCfg = Debug|Win32
+		{1C63E944-5E2E-447C-AE75-F1BF14641C98}.Debug.Build.0 = Debug|Win32
+		{1C63E944-5E2E-447C-AE75-F1BF14641C98}.Release.ActiveCfg = Release|Win32
+		{1C63E944-5E2E-447C-AE75-F1BF14641C98}.Release.Build.0 = Release|Win32
+		{C1910FAC-39EA-49F1-B93C-517E15D1C250}.Debug.ActiveCfg = Debug|Win32
+		{C1910FAC-39EA-49F1-B93C-517E15D1C250}.Debug.Build.0 = Debug|Win32
+		{C1910FAC-39EA-49F1-B93C-517E15D1C250}.Release.ActiveCfg = Release|Win32
+		{C1910FAC-39EA-49F1-B93C-517E15D1C250}.Release.Build.0 = Release|Win32
+		{D26A9780-4457-473C-A391-BBEB7758E2D0}.Debug.ActiveCfg = Debug|Win32
+		{D26A9780-4457-473C-A391-BBEB7758E2D0}.Debug.Build.0 = Debug|Win32
+		{D26A9780-4457-473C-A391-BBEB7758E2D0}.Release.ActiveCfg = Release|Win32
+		{D26A9780-4457-473C-A391-BBEB7758E2D0}.Release.Build.0 = Release|Win32
+		{4FC8EE48-701E-474E-88CB-FFD17E8A778B}.Debug.ActiveCfg = Debug|Win32
+		{4FC8EE48-701E-474E-88CB-FFD17E8A778B}.Debug.Build.0 = Debug|Win32
+		{4FC8EE48-701E-474E-88CB-FFD17E8A778B}.Release.ActiveCfg = Release|Win32
+		{4FC8EE48-701E-474E-88CB-FFD17E8A778B}.Release.Build.0 = Release|Win32
+		{A83C475F-BE2B-452B-B702-97C8F125D31D}.Debug.ActiveCfg = Debug|Win32
+		{A83C475F-BE2B-452B-B702-97C8F125D31D}.Debug.Build.0 = Debug|Win32
+		{A83C475F-BE2B-452B-B702-97C8F125D31D}.Release.ActiveCfg = Release|Win32
+		{A83C475F-BE2B-452B-B702-97C8F125D31D}.Release.Build.0 = Release|Win32
+		{6DB3C2CD-BBE6-463D-A9D3-92240C71ED22}.Debug.ActiveCfg = Debug|Win32
+		{6DB3C2CD-BBE6-463D-A9D3-92240C71ED22}.Debug.Build.0 = Debug|Win32
+		{6DB3C2CD-BBE6-463D-A9D3-92240C71ED22}.Release.ActiveCfg = Release|Win32
+		{6DB3C2CD-BBE6-463D-A9D3-92240C71ED22}.Release.Build.0 = Release|Win32
+		{7499CFDA-3C7F-4660-B1D3-8A41EA2EBFA3}.Debug.ActiveCfg = Debug|Win32
+		{7499CFDA-3C7F-4660-B1D3-8A41EA2EBFA3}.Debug.Build.0 = Debug|Win32
+		{7499CFDA-3C7F-4660-B1D3-8A41EA2EBFA3}.Release.ActiveCfg = Release|Win32
+		{7499CFDA-3C7F-4660-B1D3-8A41EA2EBFA3}.Release.Build.0 = Release|Win32
+		{EABCE292-D598-4600-A1C9-2591E7D62FDA}.Release.Build.0 = Release|Win32
+		{EABCE292-D598-4600-A1C9-2591E7D62FDA}.Release.ActiveCfg = Release|Win32
+		{EABCE292-D598-4600-A1C9-2591E7D62FDA}.Debug.Build.0 = Debug|Win32
 		{EABCE292-D598-4600-A1C9-2591E7D62FDA}.Debug.ActiveCfg = Debug|Win32
-		{EABCE292-D598-4600-A1C9-2591E7D62FDA}.Debug.Build.0 = Debug|Win32
-		{EABCE292-D598-4600-A1C9-2591E7D62FDA}.Release.ActiveCfg = Release|Win32
-		{EABCE292-D598-4600-A1C9-2591E7D62FDA}.Release.Build.0 = Release|Win32
+		{101A7691-74F3-48B4-96A3-CF35578F5900}.Release.Build.0 = Release|Win32
+		{101A7691-74F3-48B4-96A3-CF35578F5900}.Release.ActiveCfg = Release|Win32
+		{101A7691-74F3-48B4-96A3-CF35578F5900}.Debug.Build.0 = Debug|Win32
 		{101A7691-74F3-48B4-96A3-CF35578F5900}.Debug.ActiveCfg = Debug|Win32
-		{101A7691-74F3-48B4-96A3-CF35578F5900}.Debug.Build.0 = Debug|Win32
-		{101A7691-74F3-48B4-96A3-CF35578F5900}.Release.ActiveCfg = Release|Win32
-		{101A7691-74F3-48B4-96A3-CF35578F5900}.Release.Build.0 = Release|Win32
+		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Release.Build.0 = Release|Win32
+		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Release.ActiveCfg = Release|Win32
+		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Debug.Build.0 = Debug|Win32
 		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Debug.ActiveCfg = Debug|Win32
-		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Debug.Build.0 = Debug|Win32
-		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Release.ActiveCfg = Release|Win32
-		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Release.Build.0 = Release|Win32
+		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Release.Build.0 = Release|Win32
+		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Release.ActiveCfg = Release|Win32
+		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Debug.Build.0 = Debug|Win32
 		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Debug.ActiveCfg = Debug|Win32
-		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Debug.Build.0 = Debug|Win32
-		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Release.ActiveCfg = Release|Win32
-		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Release.Build.0 = Release|Win32
+		{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.Release.Build.0 = Release|Win32
+		{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.Release.ActiveCfg = Release|Win32
+		{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.Debug.Build.0 = Debug|Win32
 		{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.Debug.ActiveCfg = Debug|Win32
-		{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.Debug.Build.0 = Debug|Win32
-		{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.Release.ActiveCfg = Release|Win32
-		{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.Release.Build.0 = Release|Win32
+		{69BC58F0-C7EB-4B43-B782-B6F047EF0528}.Release.Build.0 = Release|Win32
+		{69BC58F0-C7EB-4B43-B782-B6F047EF0528}.Release.ActiveCfg = Release|Win32
+		{69BC58F0-C7EB-4B43-B782-B6F047EF0528}.Debug.Build.0 = Debug|Win32
 		{69BC58F0-C7EB-4B43-B782-B6F047EF0528}.Debug.ActiveCfg = Debug|Win32
-		{69BC58F0-C7EB-4B43-B782-B6F047EF0528}.Debug.Build.0 = Debug|Win32
-		{69BC58F0-C7EB-4B43-B782-B6F047EF0528}.Release.ActiveCfg = Release|Win32
-		{69BC58F0-C7EB-4B43-B782-B6F047EF0528}.Release.Build.0 = Release|Win32
+		{7319E499-473D-4CE5-9983-725D6E68A55D}.Release.Build.0 = Release|Win32
+		{7319E499-473D-4CE5-9983-725D6E68A55D}.Release.ActiveCfg = Release|Win32
+		{7319E499-473D-4CE5-9983-725D6E68A55D}.Debug.Build.0 = Debug|Win32
 		{7319E499-473D-4CE5-9983-725D6E68A55D}.Debug.ActiveCfg = Debug|Win32
-		{7319E499-473D-4CE5-9983-725D6E68A55D}.Debug.Build.0 = Debug|Win32
-		{7319E499-473D-4CE5-9983-725D6E68A55D}.Release.ActiveCfg = Release|Win32
-		{7319E499-473D-4CE5-9983-725D6E68A55D}.Release.Build.0 = Release|Win32
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
