Index: GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTree.h
===================================================================
--- GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTree.h	(revision 1204)
+++ GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTree.h	(revision 1220)
@@ -57,5 +57,4 @@
 	// scene options
 	String  mSceneFiles;
-	String	mSelectedSceneManager;
 	Real	mRotationRadius;
 	int		mModelSpacing;
@@ -67,5 +66,4 @@
 
 	KdTreeAppListener::Options mOptions;
-
 
 	virtual void setupResources(void);
Index: GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTreeAppListener.h
===================================================================
--- GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTreeAppListener.h	(revision 1215)
+++ GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTreeAppListener.h	(revision 1220)
@@ -36,10 +36,14 @@
 #define __KdTreeAppListener_H__
 
-#include "Ogre.h"
-#include "OgreKeyEvent.h"
-#include "OgreEventListeners.h"
-#include "OgreStringConverter.h"
-#include "OgreException.h"
-
+#include <Ogre.h>
+#include <OgreKeyEvent.h>
+#include <OgreEventListeners.h>
+#include <OgreStringConverter.h>
+#include <OgreException.h>
+
+#include <OgreKdTree.h>
+
+#define CONV_OCM_TO_KDT_ALG(i) (i == 0 ? 3 : i)
+#define CONV_KDT_TO_OCM_ALG(i) (i % 3)
 #define VIZ_VIEWPORT_Z_ORDER 10
 
@@ -72,4 +76,14 @@
 	};
 
+	enum SceneMgr
+	{
+		SM_KDT,
+		SM_OCM,
+		SM_OCT,
+		SM_GEN,
+		SM_SIZE,
+		SM_NOTSET
+	};
+
 	enum ShowTree
 	{
@@ -90,31 +104,34 @@
 	{
 		Options():
-		mDemoMode(false),
-		mEnhancedVisibility(false),
 		mRotateSpeed(36.0f),
 		mMoveSpeed(100.0f),
 		mRotationPeriod(30.0f),
-		mMaxDepth(12),
 		mKT(2.0f),
 		mKI(1.0f),
-		mRenderMethod("CHC")
+		mMaxDepth(12),
+		mSceneManager(SM_KDT),
+		mRenderMethod(KdTree::KDRM_GTP_CHC),
+		mBuildMethod(KdTree::KDBM_PRIORITYQUEUE),
+		mDemoMode(false),
+		mEnhancedVisibility(false)
 		{
 
 		}
 
-		String mSceneManager;
 		String mDemoInfileName;
 		String mDemoOutfileName;
 		String mDemoLogfileName;
-		bool mDemoMode;
-		bool mEnhancedVisibility;
+		String mComment;
 		Degree mRotateSpeed;
 		Real mMoveSpeed;
 		Real mRotationPeriod;
-		int mMaxDepth;
 		Real mKT;
 		Real mKI;
-		String mRenderMethod;
-		String mComment;
+		int mMaxDepth;
+		int mSceneManager;
+		int mRenderMethod;
+		int mBuildMethod;
+		bool mDemoMode;
+		bool mEnhancedVisibility;
 	};
 
@@ -164,6 +181,12 @@
 	void keyReleased(KeyEvent* e) {};
 
+	const static Real	DEMO_WAIT;
 	const static String NA;
-	const static Real DEMO_WAIT;
+	const static String RENDERMETHOD[];
+	const static String RENDERMETHODCAPTION[];
+	const static String BUILDMETHOD[];
+	const static String BUILDMETHODCAPTION[];
+	const static String SCENEMANAGER[];
+	const static String SCENEMANAGERNAME[];
 protected:
 	// basic
Index: GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/scripts/TestKdTree.vcproj
===================================================================
--- GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/scripts/TestKdTree.vcproj	(revision 1203)
+++ GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/scripts/TestKdTree.vcproj	(revision 1220)
@@ -21,5 +21,5 @@
 				Optimization="0"
 				ImproveFloatingPointConsistency="TRUE"
-				AdditionalIncludeDirectories="..\include;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include"
+				AdditionalIncludeDirectories="..\include;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include;..\..\..\..\..\..\Lib\Vis\OnlineCullingCHC\OGRE\include;..\..\..\..\..\..\Lib\Vis\OnlineCullingCHC\include"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;GTP_VISIBILITY_MODIFIED_OGRE"
 				MinimalRebuild="TRUE"
@@ -84,5 +84,5 @@
 				OptimizeForProcessor="2"
 				OptimizeForWindowsApplication="TRUE"
-				AdditionalIncludeDirectories="..\include;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include"
+				AdditionalIncludeDirectories="..\include;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include;..\..\..\..\..\..\Lib\Vis\OnlineCullingCHC\OGRE\include;..\..\..\..\..\..\Lib\Vis\OnlineCullingCHC\include"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;GTP_VISIBILITY_MODIFIED_OGRE"
 				StringPooling="TRUE"
Index: GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTree.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTree.cpp	(revision 1215)
+++ GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTree.cpp	(revision 1220)
@@ -30,4 +30,5 @@
 				.addOpt("l","logfile", ARGUMENT_REQUIRED)
 				.addOpt("d","demomode", ARGUMENT_NONE)
+				.addOpt("","buildmode", ARGUMENT_REQUIRED)
 				.addOpt("","maxdepth", ARGUMENT_REQUIRED)
 				.addOpt("","kt", ARGUMENT_REQUIRED)
@@ -49,4 +50,23 @@
 			std::stringstream s;
 
+			if (cmdparser.getOpt("buildmode", tmp))
+			{
+				int bm = KdTree::KDBM_NOTSET;
+				for (int i = 0; i < KdTree::KDBM_SIZE; i ++)
+				{
+					if (tmp == KdTreeAppListener::BUILDMETHOD[i])
+						bm = i;
+				}
+				if (bm != KdTree::KDBM_NOTSET)
+				{
+					options.mBuildMethod = bm;
+				}
+				else
+				{
+					MessageBox(NULL, ("Invalid argument for option --buildmode: " + tmp).c_str(), "Error", MB_OK | MB_ICONERROR );
+					return -1;
+				}
+			}
+
 			if (cmdparser.getOpt("maxdepth", tmp))
 			{
@@ -72,11 +92,17 @@
 			if (cmdparser.getOpt("r",tmp))
 			{
-				if (tmp == "INT" || tmp == "VFC" || tmp == "SWC" || tmp == "CHC")
-				{
-					options.mRenderMethod = tmp;
+				int rm = KdTree::KDRM_NOTSET;
+				for (int i = 0; i < KdTree::KDRM_SIZE; i ++)
+				{
+					if (tmp == KdTreeAppListener::RENDERMETHOD[i])
+						rm = i;
+				}
+				if (rm != KdTree::KDRM_NOTSET)
+				{
+					options.mRenderMethod = rm;
 				}
 				else
 				{
-					MessageBox(NULL, ("Invalid argument for option --rendermethod: " + tmp).c_str(), "Error", MB_OK | MB_ICONERROR );
+					MessageBox(NULL, ("Invalid argument for option --rendermode: " + tmp).c_str(), "Error", MB_OK | MB_ICONERROR );
 					return -1;
 				}
@@ -85,7 +111,13 @@
 			if (cmdparser.getOpt("s",tmp))
 			{
-				if (tmp == "KDT" || tmp == "OCT" || tmp == "OCM" || tmp == "GEN")
-				{
-					options.mSceneManager = tmp;
+				int sm = KdTreeAppListener::SM_NOTSET;
+				for (int i = 0; i < KdTreeAppListener::SM_SIZE; i ++)
+				{
+					if (tmp == KdTreeAppListener::SCENEMANAGER[i])
+						sm = i;
+				}
+				if (sm != KdTreeAppListener::SM_NOTSET)
+				{
+					options.mSceneManager = sm;
 				}
 				else
@@ -149,5 +181,4 @@
 	cfDeath.load("testKdTree.cfg");
 
-	mSelectedSceneManager = cfDeath.getSetting("scenemanager");
 	mSceneFiles = cfDeath.getSetting("scene");
 
@@ -194,39 +225,6 @@
 		mOptions.mDemoOutfileName = cfDeath.getSetting("demooutfile");
 
-	// set default demo output name to avoid SNAFUs
-	//if (mOptions.mDemoOutfileName.empty())
-	//	mOptions.mDemoOutfileName = "demo.bin";
-
 	if (mOptions.mDemoLogfileName.empty())
 		mOptions.mDemoLogfileName = cfDeath.getSetting("demologfile");
-
-	// set default demo logfile name to avoid SNAFUs
-	//if (mOptions.mDemoLogfileName.empty())
-	//	mOptions.mDemoLogfileName = "demo.csv";
-
-	// override scene manager set in config file
-	if (!mOptions.mSceneManager.empty())
-	{
-		if (mOptions.mSceneManager == "KDT")
-			mSelectedSceneManager = "KdTreeSceneManager";
-		else if (mOptions.mSceneManager == "OCT")
-			mSelectedSceneManager = "OctreeSceneManager";
-		else if (mOptions.mSceneManager == "OCM")
-			mSelectedSceneManager = "OcclusionCullingSceneManager";
-		else if (mOptions.mSceneManager == "GEN")
-			mSelectedSceneManager = "DefaultSceneManager";
-	}
-	// the other way round for log
-	else
-	{
-		if (mSelectedSceneManager == "KdTreeSceneManager")
-			mOptions.mSceneManager = "KDT";
-		else if (mSelectedSceneManager == "OctreeSceneManager")
-			mOptions.mSceneManager = "OCT";
-		else if (mSelectedSceneManager == "OcclusionCullingSceneManager")
-			mOptions.mSceneManager = "OCM";
-		else if (mSelectedSceneManager == "DefaultSceneManager")
-			mOptions.mSceneManager = "GEN";
-	}
 
 	ExampleApplication::setupResources();
@@ -416,11 +414,23 @@
 {
 	// Get the SceneManager
-	mSceneMgr = mRoot->createSceneManager(mSelectedSceneManager,"MySceneManager");
-	// set params
-	mSceneMgr->setOption("KdTreeMaxDepth", &mOptions.mMaxDepth);
-	mSceneMgr->setOption("KT", &mOptions.mKT);
-	mSceneMgr->setOption("KI", &mOptions.mKI);
-	mSceneMgr->setOption("RenderMethod", &mOptions.mRenderMethod);
-	mSceneMgr->setOption("EnhancedVisibility", &mOptions.mEnhancedVisibility);
+	mSceneMgr = mRoot->createSceneManager(
+		KdTreeAppListener::SCENEMANAGERNAME[mOptions.mSceneManager],
+		"MySceneManager");
+	// set params depending on scene manager
+	if (mOptions.mSceneManager == KdTreeAppListener::SM_KDT)
+	{
+		mSceneMgr->setOption("BuildMethod", &mOptions.mBuildMethod);
+		mSceneMgr->setOption("KdTreeMaxDepth", &mOptions.mMaxDepth);
+		mSceneMgr->setOption("KT", &mOptions.mKT);
+		mSceneMgr->setOption("KI", &mOptions.mKI);
+		mSceneMgr->setOption("RenderMethod", &mOptions.mRenderMethod);
+		mSceneMgr->setOption("EnhancedVisibility", &mOptions.mEnhancedVisibility);
+	}
+	// set algorithm when scene manager is OCM - numbering is different though
+	if (mOptions.mSceneManager == KdTreeAppListener::SM_OCM)
+	{
+		int alg = CONV_KDT_TO_OCM_ALG(mOptions.mRenderMethod);
+		mSceneMgr->setOption("Algorithm", &alg);
+	}
 }
 
@@ -452,5 +462,5 @@
 	mTopCam->setDirection(0,0,-1);
 	mTopCam->pitch(Radian(-Math::HALF_PI));
-	//mTopCam->setCullingFrustum(mCamera);
+	mTopCam->setCullingFrustum(mCamera);
 	mTopCam->setNearClipDistance(1);
 
Index: GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTreeAppListener.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTreeAppListener.cpp	(revision 1215)
+++ GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTreeAppListener.cpp	(revision 1220)
@@ -6,6 +6,24 @@
 #include <windows.h>
 
+const Real	 KdTreeAppListener::DEMO_WAIT = 5.0;
 const String KdTreeAppListener::NA = ": N/A";
-const Real KdTreeAppListener::DEMO_WAIT = 5.0;
+const String KdTreeAppListener::RENDERMETHOD[] = { "INT", "VFC", "SWC", "CHC" };
+const String KdTreeAppListener::RENDERMETHODCAPTION[] =
+{
+	"Internal Frustum Culling",
+	"View Frustum Culling", 
+	"Stop and Wait Culling",
+	"Coherent Hierarchical Culling"
+};
+const String KdTreeAppListener::BUILDMETHOD[] = { "RE", "PQ" };
+const String KdTreeAppListener::BUILDMETHODCAPTION[] = { "Recursive", "Priority Queue" };
+const String KdTreeAppListener::SCENEMANAGER[] = { "KDT", "OCM", "OCT", "GEN" };
+const String KdTreeAppListener::SCENEMANAGERNAME[] =
+{
+	"KdTreeSceneManager",
+	"OcclusionCullingSceneManager",
+	"OctreeSceneManager",
+	"DefaultSceneManager"
+};
 
 void KdTreeAppListener::updateStats(void)
@@ -220,9 +238,8 @@
 	const int border_height = 10;
 	const int vert_space = 15;
+	int top = border_height;
+
+	String ext = "KdTree/";
 	String sMD, sKT, sKI, sHL, sBM, sRM, sFM, sTC, sEV;
-
-	int top = border_height;
-
-	String ext = "KdTree/";
 
 	int maxd;
@@ -252,26 +269,22 @@
 		sHL = ": off";
 
-	String bm;
+	int bm;
 	if (mSceneMgr->getOption("BuildMethod", &bm))
-		sBM = ": " + bm;
+		sBM = ": " + BUILDMETHODCAPTION[bm];
 	else
 		sBM = NA;
 
-	String rm;
+	int rm;
 	if (mSceneMgr->getOption("RenderMethod", &rm))
-	{
-		if (rm == "INT")
-			sRM = ": Internal Frustum Culling";
-		else if (rm == "VFC")
-			sRM = ": View Frustum Culling";
-		else if (rm == "SWC")
-			sRM = ": Stop and Wait Culling";
-		else if (rm == "CHC")
-			sRM = ": Coherent Hierarchical Culling";
-		else
-			sRM = NA;
-	}
+		sRM = ": " + RENDERMETHODCAPTION[rm];
 	else
 		sRM = NA;
+
+	// hack to allow mode switching in OCM
+	if (mOptions.mSceneManager == SM_OCM)
+	{
+		rm = CONV_KDT_TO_OCM_ALG(mOptions.mRenderMethod);
+		sRM = ": " + RENDERMETHODCAPTION[CONV_OCM_TO_KDT_ALG(rm)];
+	}
 
 	bool enh;
@@ -430,18 +443,11 @@
 void KdTreeAppListener::toggleBuildMethod()
 {
-	static String bmOptions[] = { "Recursive", "PriorityQueue" };
-	static String bmOptionCaptions[] = { ": Recursive", ": PriorityQueue" };
-	static int bmOptionsSize = sizeof(bmOptions) / sizeof(String);
-	static int bmCurrent = 0;
-
-	String bm;
+	int bm;
+
 	if (mSceneMgr->getOption("BuildMethod", &bm))
 	{
-		for (int idx = 0; idx < bmOptionsSize; idx++)
-			if (bmOptions[idx] == bm)
-				bmCurrent = idx;
-		bmCurrent = (bmCurrent + 1) % bmOptionsSize;
-		if (mSceneMgr->setOption("BuildMethod", &bmOptions[bmCurrent]))
-			mBuildMethodInfo->setCaption(bmOptionCaptions[bmCurrent]);
+		bm = (bm + 1) % KdTree::KDBM_SIZE;
+		if (mSceneMgr->setOption("BuildMethod", &bm))
+			mBuildMethodInfo->setCaption(": " + BUILDMETHODCAPTION[bm]);
 	}
 	else
@@ -453,28 +459,24 @@
 void KdTreeAppListener::toggleRenderMethod()
 {
-	static String rmOptions[] = { "INT", "VFC", "SWC", "CHC" };
-	static String rmOptionCaptions[] =
-	{
-		": Internal Frustum Culling",
-		": View Frustum Culling", 
-		": Stop and Wait Culling",
-		": Coherent Hierarchical Culling"
-	};
-	static int rmOptionsSize = sizeof(rmOptions) / sizeof (String);
-	static int rmCurrent = 0;
-
-	String rm;
+	int rm;
+
 	if (mSceneMgr->getOption("RenderMethod", &rm))
 	{
-		for (int idx = 0; idx < rmOptionsSize; idx++)
-			if (rmOptions[idx] == rm)
-				rmCurrent = idx;
-		rmCurrent = (rmCurrent + 1) % rmOptionsSize;
-		if (mSceneMgr->setOption("RenderMethod", &rmOptions[rmCurrent]))
-			mRenderMethodInfo->setCaption(rmOptionCaptions[rmCurrent]);
+		rm = (rm + 1) % KdTree::KDRM_SIZE;
+		if (mSceneMgr->setOption("RenderMethod", &rm))
+			mRenderMethodInfo->setCaption(": " + RENDERMETHODCAPTION[rm]);
 	}
 	else
 	{
 		mRenderMethodInfo->setCaption(NA);
+	}
+
+	// hack to allow mode switching in OCM, cannot extract setting from sm
+	if (mOptions.mSceneManager == SM_OCM)
+	{
+		static int alg = CONV_KDT_TO_OCM_ALG(mOptions.mRenderMethod);
+		alg = (alg + 1) % 3;
+		if (mSceneMgr->setOption("Algorithm", &alg))
+			mRenderMethodInfo->setCaption(": " + RENDERMETHODCAPTION[CONV_OCM_TO_KDT_ALG(alg)]);
 	}
 }
@@ -539,5 +541,5 @@
 	}
 
-	if (mInputDevice->isKeyDown(KC_F11) && mTimeUntilNextToggle <= 0)
+	if (mInputDevice->isKeyDown(KC_0) && mTimeUntilNextToggle <= 0)
 	{
 		toggleBuildMethod();
@@ -1500,14 +1502,14 @@
 	{
 		// demo settings
-		logwrite << mOptions.mSceneManager;
-		if (mOptions.mSceneManager == "KDT")
-		{
-			logwrite << ds << mOptions.mRenderMethod << ds << mOptions.mMaxDepth << ds 
+		logwrite << SCENEMANAGER[mOptions.mSceneManager];
+		if (mOptions.mSceneManager == SM_KDT)
+		{
+			logwrite << ds << RENDERMETHOD[mOptions.mRenderMethod] << ds << mOptions.mMaxDepth << ds 
 				<< mOptions.mKT << ds << mOptions.mKI;
 		}
-		//else if (mOptions.mSceneManager == "OCM" && mOptions.mRenderMethod != "INT")
-		//{
-		//	logwrite << ds << mOptions.mRenderMethod;
-		//}
+		else if (mOptions.mSceneManager == SM_OCM && mOptions.mRenderMethod != KdTree::KDRM_INTERNAL)
+		{
+			logwrite << ds << RENDERMETHOD[(mOptions.mRenderMethod+3)%3];
+		}
 		logwrite << fs;
 		// per second stats
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTree.h
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTree.h	(revision 1211)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTree.h	(revision 1220)
@@ -478,6 +478,8 @@
 			KDRM_GTP_VFC,
 			KDRM_GTP_SWC,
-			KDRM_GTP_CHC
-
+			KDRM_GTP_CHC,
+			// invalid modes, just for convenience
+			KDRM_SIZE,
+			KDRM_NOTSET
 		};
 
@@ -485,6 +487,10 @@
 		{
 			KDBM_RECURSIVE,
-			KDBM_PRIORITYQUEUE
-		};
+			KDBM_PRIORITYQUEUE,
+			// invalid modes, just for convenience
+			KDBM_SIZE,
+			KDBM_NOTSET
+		};
+
 
 		const static int HILITE_OFF  = -1;
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp	(revision 1193)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp	(revision 1220)
@@ -454,5 +454,5 @@
 
 	getRenderQueue()->clear(); // finally clear render queue
-	if (0) OGRE_DELETE(mRenderQueue); // HACK: should rather only be cleared ...
+	if (1) OGRE_DELETE(mRenderQueue); // HACK: should rather only be cleared ...
 	if (0) WriteLog(); // write out stats
 }
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp	(revision 1214)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp	(revision 1220)
@@ -51,11 +51,11 @@
 mIsHierarchicalCulling(false)
 {
-// Replace root node with my node
-OGRE_DELETE(mSceneRoot);
-
-mSceneRoot = new KdTreeSceneNode(this, "root node");
-mSceneRoot->_notifyRootNode();
-
-mHierarchyInterface = new KdTreeHierarchyInterface(this, mDestRenderSystem);
+	// Replace root node with my node
+	OGRE_DELETE(mSceneRoot);
+	mSceneRoot = new KdTreeSceneNode(this, "root node");
+	mSceneRoot->_notifyRootNode();
+
+	// init heirarchy interface
+	mHierarchyInterface = new KdTreeHierarchyInterface(this, mDestRenderSystem);
 }
 
@@ -80,12 +80,4 @@
 	return mShowBoxes;
 }
-
-//void KdTreeSceneManager::setEnhancedVis(bool enhanced)
-//{
-//	for (CameraList::iterator it = mCameras.begin(); it != mCameras.end(); it ++)
-//	{
-//		KDCAMPTR_CAST(it->second)->setEnhancedVisMode(enhanced);
-//	}
-//}
 
 bool KdTreeSceneManager::setOption(const String& strKey, const void* pValue)
@@ -156,45 +148,40 @@
 	else if (strKey == "BuildMethod")
 	{
-		String bm = *static_cast<const String *>(pValue);
-		if (bm == "PriorityQueue")
-		{
-			mBuildMethod = KdTree::KDBM_PRIORITYQUEUE;
+		KdTree::BuildMethod bm = *static_cast<const KdTree::BuildMethod *>(pValue);
+		if (bm == KdTree::KDBM_RECURSIVE || bm == KdTree::KDBM_PRIORITYQUEUE)
+		{
+			mBuildMethod = bm;
 			return true;
 		}
-		else if (bm == "Recursive")
-		{
-			mBuildMethod = KdTree::KDBM_RECURSIVE;
+		else
+		{
+			return false;
+		}
+	}
+	else if (strKey == "RenderMethod")
+	{
+		KdTree::RenderMethod rm = *static_cast<const KdTree::RenderMethod *>(pValue);
+		if (rm == KdTree::KDRM_INTERNAL)
+		{
+			mRenderMethod = rm;
 			return true;
 		}
-		else
-		{
-			return false;
-		}
-	}
-	else if (strKey == "RenderMethod")
-	{
-		String rm = *static_cast<const String *>(pValue);
-		if (rm == "INT")
-		{
-			mRenderMethod = KdTree::KDRM_INTERNAL;
-			return true;
-		}
-		else if (rm == "VFC")
-		{
-			mRenderMethod = KdTree::KDRM_GTP_VFC;
+		else if (rm == KdTree::KDRM_GTP_VFC)
+		{
+			mRenderMethod = rm;
 			int cmt = GtpVisibility::VisibilityEnvironment::FRUSTUM_CULLING;
 			return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface)
 				.setOption("Algorithm", &cmt);
 		}
-		else if (rm == "SWC")
-		{
-			mRenderMethod = KdTree::KDRM_GTP_SWC;
+		else if (rm == KdTree::KDRM_GTP_SWC)
+		{
+			mRenderMethod = rm;
 			int cmt = GtpVisibility::VisibilityEnvironment::STOP_AND_WAIT_CULLING;
 			return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface)
 				.setOption("Algorithm", &cmt);
 		}
-		else if (rm == "CHC")
-		{
-			mRenderMethod = KdTree::KDRM_GTP_CHC;
+		else if (rm == KdTree::KDRM_GTP_CHC)
+		{
+			mRenderMethod = rm;
 			int cmt = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING;
 			return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface)
@@ -205,4 +192,35 @@
 			return false;
 		}
+		//String rm = *static_cast<const String *>(pValue);
+		//if (rm == "INT")
+		//{
+		//	mRenderMethod = KdTree::KDRM_INTERNAL;
+		//	return true;
+		//}
+		//else if (rm == "VFC")
+		//{
+		//	mRenderMethod = KdTree::KDRM_GTP_VFC;
+		//	int cmt = GtpVisibility::VisibilityEnvironment::FRUSTUM_CULLING;
+		//	return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface)
+		//		.setOption("Algorithm", &cmt);
+		//}
+		//else if (rm == "SWC")
+		//{
+		//	mRenderMethod = KdTree::KDRM_GTP_SWC;
+		//	int cmt = GtpVisibility::VisibilityEnvironment::STOP_AND_WAIT_CULLING;
+		//	return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface)
+		//		.setOption("Algorithm", &cmt);
+		//}
+		//else if (rm == "CHC")
+		//{
+		//	mRenderMethod = KdTree::KDRM_GTP_CHC;
+		//	int cmt = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING;
+		//	return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface)
+		//		.setOption("Algorithm", &cmt);
+		//}
+		//else
+		//{
+		//	return false;
+		//}
 	}
 	// little hack in case someone uses "Algorithm" option from VisOptMan directly
@@ -362,5 +380,4 @@
 		if (mKdTree)
 			*static_cast<bool *>(pDestValue) = mKdTree->getEnhancedVis();
-			//KDCAMPTR_CAST(mCameras.begin()->second)->getEnhancedVisMode();
 		else
 			*static_cast<bool *>(pDestValue) = mEnhancedVisiblity;
@@ -369,36 +386,38 @@
 	else if (strKey == "BuildMethod")
 	{
-		if (mBuildMethod == KdTree::KDBM_PRIORITYQUEUE)
-		{
-			*static_cast<String *>(pDestValue) = "PriorityQueue";
-		}
-		else if (mBuildMethod == KdTree::KDBM_RECURSIVE)
-		{
-			*static_cast<String *>(pDestValue) = "Recursive";
-		}
+		//if (mBuildMethod == KdTree::KDBM_PRIORITYQUEUE)
+		//{
+		//	*static_cast<String *>(pDestValue) = "PriorityQueue";
+		//}
+		//else if (mBuildMethod == KdTree::KDBM_RECURSIVE)
+		//{
+		//	*static_cast<String *>(pDestValue) = "Recursive";
+		//}
+		*static_cast<KdTree::BuildMethod *>(pDestValue) = mBuildMethod;
 		return true;
 	}
 	else if (strKey == "RenderMethod")
 	{
-		if (mRenderMethod == KdTree::KDRM_INTERNAL)
-		{
-			*static_cast<String *>(pDestValue) = "INT";
-		}
-		else if (mRenderMethod == KdTree::KDRM_GTP_VFC)
-		{
-				*static_cast<String *>(pDestValue) = "VFC";
-		}
-		else if (mRenderMethod == KdTree::KDRM_GTP_SWC)
-		{
-				*static_cast<String *>(pDestValue) = "SWC";
-		}
-		else if (mRenderMethod == KdTree::KDRM_GTP_CHC)
-		{
-				*static_cast<String *>(pDestValue) = "CHC";
-		}
-		else
-		{
-			return false;
-		}
+		//if (mRenderMethod == KdTree::KDRM_INTERNAL)
+		//{
+		//	*static_cast<String *>(pDestValue) = "INT";
+		//}
+		//else if (mRenderMethod == KdTree::KDRM_GTP_VFC)
+		//{
+		//		*static_cast<String *>(pDestValue) = "VFC";
+		//}
+		//else if (mRenderMethod == KdTree::KDRM_GTP_SWC)
+		//{
+		//		*static_cast<String *>(pDestValue) = "SWC";
+		//}
+		//else if (mRenderMethod == KdTree::KDRM_GTP_CHC)
+		//{
+		//		*static_cast<String *>(pDestValue) = "CHC";
+		//}
+		//else
+		//{
+		//	return false;
+		//}
+		*static_cast<KdTree::RenderMethod *>(pDestValue) = mRenderMethod;
 		return true;
 	}
