Index: GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTree.h
===================================================================
--- GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTree.h	(revision 1285)
+++ GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTree.h	(revision 1296)
@@ -48,4 +48,6 @@
 	// save entities to ascii file
 	bool saveSceneASCII(const String& filename, SceneNode *entityroot);
+	void createTerrainScene(Real max_x, Real max_y, Real max_z);
+	Vector3 clampToGround(const Vector3& vect, Real offset, Real cap);
 protected:
 	KdTreeAppListener *mFrameListener;
@@ -57,5 +59,6 @@
 
 	// scene options
-	//String  mSceneFiles;
+	String  mSceneFiles;
+	String	mViewCells;
 	Real	mRotationRadius;
 	int		mModelSpacing;
@@ -96,6 +99,4 @@
 	void createMaterials(void);
 	void createSimpleScene(void);
-	void createTerrainScene(Real max_x, Real max_y, Real max_z);
-	Vector3 clampToGround(const Vector3& vect, Real offset, Real cap);
 
 	RaySceneQuery* mRaySceneQuery;
Index: GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTreeAppListener.h
===================================================================
--- GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTreeAppListener.h	(revision 1285)
+++ GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTreeAppListener.h	(revision 1296)
@@ -81,4 +81,11 @@
 	};
 
+	enum SceneType
+	{
+		ST_SIMPLE,
+		ST_TERRAIN,
+		ST_GEOMETRY
+	};
+
 	enum SceneMgr
 	{
@@ -120,4 +127,7 @@
 		mRenderMethod(KdTree::KDRM_GTP_CHC),
 		mBuildMethod(KdTree::KDBM_PRIORITYQUEUE),
+		mSceneType(ST_SIMPLE),
+		mFastStart(false),
+		mBurnIn(false),
 		mDemoMode(false),
 		mEnhancedVisibility(false),
@@ -128,5 +138,4 @@
 		}
 
-		String mSceneFiles;
 		String mSceneOutfileName;
 		String mDemoInfileName;
@@ -143,4 +152,7 @@
 		int mRenderMethod;
 		int mBuildMethod;
+		int mSceneType;
+		bool mFastStart;
+		bool mBurnIn;
 		bool mDemoMode;
 		bool mEnhancedVisibility;
@@ -171,4 +183,8 @@
 
 	void showDebugOverlay(bool show);
+
+	void toggleUseViewCells(void);
+
+	void toggleUseVisibilityFilter(void);
 
 	void toggleVizCamera(void);
@@ -231,4 +247,8 @@
 	int mShowTree;
 
+	// view cells
+	bool mUseViewCells;
+	bool mUseVisibilityFilter;
+
 	// counters
 	int mSeqNum;
@@ -252,5 +272,4 @@
 	TextAreaOverlayElement *mDemoTime;
 	TextAreaOverlayElement *mDemoFPSDisp;
-
 
 	OverlayElement *mRenderMethodInfo;
@@ -263,4 +282,6 @@
 	OverlayElement *mMovementInfo;
 	OverlayElement *mTopCamInfo;
+	OverlayElement *mViewCellsInfo;
+	OverlayElement *mViewFilterInfo;
 
 	OverlayElement *mFrustumCulledNodesInfo;
Index: GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTree.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTree.cpp	(revision 1285)
+++ GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTree.cpp	(revision 1296)
@@ -39,5 +39,7 @@
 				.addOpt("","comment", ARGUMENT_REQUIRED)
 				.addOpt("e","enhancevis", ARGUMENT_NONE)
-				.addOpt("","savesceneto", ARGUMENT_REQUIRED);
+				.addOpt("","savesceneto", ARGUMENT_REQUIRED)
+				.addOpt("f","faststart", ARGUMENT_NONE)
+				.addOpt("b","burnin", ARGUMENT_NONE);
 
 
@@ -46,4 +48,6 @@
 			cmdparser.getOpt("l", options.mDemoLogfileName);
 			cmdparser.getOpt("comment", options.mComment);
+			options.mFastStart = cmdparser.getOpt("f");
+			options.mBurnIn = cmdparser.getOpt("b");
 			options.mDemoMode = cmdparser.getOpt("d");
 			options.mEnhancedVisibility = cmdparser.getOpt("e");
@@ -184,5 +188,6 @@
 	cfDeath.load("testKdTree.cfg");
 
-	mOptions.mSceneFiles = cfDeath.getSetting("scene");
+	mSceneFiles = cfDeath.getSetting("scene");
+	mViewCells = cfDeath.getSetting("viewcells");
 
 	tmp = cfDeath.getSetting("shadows");
@@ -240,85 +245,103 @@
 
 	// load simple scene (planes & robots)
-	if (mOptions.mSceneFiles == "")
+	if (mSceneFiles == "")
 	{
 		createSimpleScene();
+		mOptions.mSceneType = KdTreeAppListener::ST_SIMPLE;
 		mCamNode->setPosition(Vector3(1280,600,1666));
 		mCamNode->setOrientation(Quaternion(0.936893, -0.124586, 0.323813, 0.04306));
 	}
-	// load terrain, but only if terrainscenemanager selected
-	else if (mOptions.mSceneFiles == TERRAIN_SCENE)
-	{
-		Plane waterPlane;
-
-		// Set ambient light
-		mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
-
-		// Create a light
-		Light* l = mSceneMgr->createLight("MainLight");
-		// Accept default settings: point light, white diffuse, just set position
-		// NB I could attach the light to a SceneNode if I wanted it to move automatically with
-		//  other objects, but I don't
-		l->setPosition(20,80,50);
-
-		// Fog
-		// NB it's VERY important to set this before calling setWorldGeometry 
-		// because the vertex program picked will be different
-		//ColourValue fadeColour(0.93, 0.86, 0.76);
-		//mSceneMgr->setFog( FOG_LINEAR, fadeColour, .001, 500, 1000);
-		//mWindow->getViewport(0)->setBackgroundColour(fadeColour);
-		mWindow->getViewport(0)->setBackgroundColour(ColourValue::Blue);
-
-		std::string terrain_cfg("terrain.cfg");
-
-		mSceneMgr -> setWorldGeometry( terrain_cfg );
-
-		// Define the required skyplane
-		Plane plane;
-		// 5000 world units from the camera
-		plane.d = 5000;
-		// Above the camera, facing down
-		plane.normal = -Vector3::UNIT_Y;
-
-		// read interesting params from config file
-		ConfigFile terrainconf;
-		std::stringstream s;
-		Real x,y,z;
-		
-		terrainconf.load(terrain_cfg);
-
-		s << terrainconf.getSetting("PageWorldX");
-		s >> x;
-		s.clear();
-
-		s << terrainconf.getSetting("MaxHeight");
-		s >> y;
-		s.clear();
-
-		s << terrainconf.getSetting("PageWorldZ");
-		s >> z;
-		s.clear();
-
-		// add stuff minus gound plane
-		createTerrainScene(x, y + 1500, z);
-
-		// Set a nice viewpoint
-		mCamNode->setPosition(707,2500,528);
-		mCamNode->setOrientation(Quaternion(-0.3486, 0.0122, 0.9365, 0.0329));
-		//mCamNode->setPosition(1056.59, 467.412, 783.502);
-		//mCamNode->setOrientation(Quaternion(-0.281354, 0.0204027, 0.956747, 0.0695345));
-	}
+	//// load terrain, but only if terrainscenemanager selected
+	//else if (mSceneFiles == TERRAIN_SCENE)
+	//{
+	//	Plane waterPlane;
+
+	//	// Set ambient light
+	//	mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
+
+	//	// Create a light
+	//	Light* l = mSceneMgr->createLight("MainLight");
+	//	// Accept default settings: point light, white diffuse, just set position
+	//	// NB I could attach the light to a SceneNode if I wanted it to move automatically with
+	//	//  other objects, but I don't
+	//	l->setPosition(20,80,50);
+
+	//	// Fog
+	//	// NB it's VERY important to set this before calling setWorldGeometry 
+	//	// because the vertex program picked will be different
+	//	//ColourValue fadeColour(0.93, 0.86, 0.76);
+	//	//mSceneMgr->setFog( FOG_LINEAR, fadeColour, .001, 500, 1000);
+	//	//mWindow->getViewport(0)->setBackgroundColour(fadeColour);
+	//	mWindow->getViewport(0)->setBackgroundColour(ColourValue::Blue);
+
+	//	std::string terrain_cfg("terrain.cfg");
+
+	//	mSceneMgr -> setWorldGeometry( terrain_cfg );
+
+	//	// Define the required skyplane
+	//	Plane plane;
+	//	// 5000 world units from the camera
+	//	plane.d = 5000;
+	//	// Above the camera, facing down
+	//	plane.normal = -Vector3::UNIT_Y;
+
+	//	// read interesting params from config file
+	//	ConfigFile terrainconf;
+	//	std::stringstream s;
+	//	Real x,y,z;
+	//	
+	//	terrainconf.load(terrain_cfg);
+
+	//	s << terrainconf.getSetting("PageWorldX");
+	//	s >> x;
+	//	s.clear();
+
+	//	s << terrainconf.getSetting("MaxHeight");
+	//	s >> y;
+	//	s.clear();
+
+	//	s << terrainconf.getSetting("PageWorldZ");
+	//	s >> z;
+	//	s.clear();
+
+	//	// add stuff minus gound plane
+	//	createTerrainScene(x, y + 1500, z);
+
+	//	// Set a nice viewpoint
+	//	mCamNode->setPosition(707,2500,528);
+	//	mCamNode->setOrientation(Quaternion(-0.3486, 0.0122, 0.9365, 0.0329));
+	//	//mCamNode->setPosition(1056.59, 467.412, 783.502);
+	//	//mCamNode->setOrientation(Quaternion(-0.281354, 0.0204027, 0.956747, 0.0695345));
+	//}
 	// load scene from file
 	else
 	{
 		// don't load the other stuff
-		loadScene(mOptions.mSceneFiles);
-
-		// top view
-		mTopCam->setPosition(Vector3(1232, 3990, -1477));
-		// walkthrough view
-		mCamNode->setPosition(Vector3(827.885, 184.435, -524.984));
-		mCamNode->setOrientation(Quaternion(0.98935, 0.0348082, -0.141246, 0.00496945));
-
-		mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox", 5000, true);
+		loadScene(mSceneFiles);
+
+		if (mOptions.mSceneType == KdTreeAppListener::ST_GEOMETRY)
+		{
+			// initial position
+			mCamNode->setPosition(Vector3(827.885, 184.435, -524.984));
+			mCamNode->setOrientation(Quaternion(0.98935, 0.0348082, -0.141246, 0.00496945));
+			// initial position for vis camera
+			mTopCam->setPosition(Vector3(1232, 3990, -1477));
+
+			// try loading view cells if specified and if scene manager supports it
+			if (!mViewCells.empty())
+				mSceneMgr->setOption("LoadViewCells", mViewCells.c_str());
+
+			// sky box
+			mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox", 5000, true);
+		}
+		else if (mOptions.mSceneType == KdTreeAppListener::ST_TERRAIN)
+		{
+			// initial position
+			mCamNode->setPosition(707,2500,528);
+			mCamNode->setOrientation(Quaternion(-0.3486, 0.0122, 0.9365, 0.0329));
+
+			// sky box
+			mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox", mPlaneDim * 2);
+		}
 	}
 }
@@ -329,5 +352,5 @@
 	Vector3 scale(0.3, 0.3, 0.3);
 	Entity *deaths;
-	SceneNode *nodes;
+	SceneNode *nodes, *anchor;
 	std::string entName;
 	std::string nodeName;
@@ -336,5 +359,12 @@
 	max_x -= 100; max_z -= 100;
 
-	SceneNode *anchor = mSceneMgr->getRootSceneNode()->createChildSceneNode("AnchorNode");
+	try
+	{
+		anchor = mSceneMgr->getSceneNode("AnchorNode");
+	}
+	catch (Exception)
+	{
+		anchor = mSceneMgr->getRootSceneNode()->createChildSceneNode("AnchorNode");		
+	}
 
 	if (mSelectEntities & ENT_RND)
@@ -348,4 +378,12 @@
 				max_y, 
 				Math::RangeRandom(min_z, max_z)), 0, max_y);
+			
+			// hack to fill valleys
+			if (pos == Vector3::ZERO)
+			{
+				-- i;
+				continue;
+			}
+
 			deaths = mSceneMgr->createEntity(cat(entName,666,i),"robot.mesh");
 			if (mShadowsEnabled)
@@ -369,4 +407,12 @@
 				Math::RangeRandom(min_z, max_z)),
 				Math::RangeRandom(20, 500), max_y);
+
+			// hack to fill valleys
+			if (pos == Vector3::ZERO)
+			{
+				-- i;
+				continue;
+			}
+
 			deaths = mSceneMgr->createEntity(cat(entName,666,i),"razor.mesh");
 			if (mShadowsEnabled)
@@ -398,6 +444,4 @@
 		node_ball->setScale(scale/10);
 	}
-
-	mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox", mPlaneDim * 2);
 }
 
@@ -644,9 +688,12 @@
     // You can skip this and use root.restoreConfig() to load configuration
     // settings if you were sure there are valid ones saved in ogre.cfg
-#ifdef KDTREE_FASTSTART
-    if(mRoot->restoreConfig())
-#else
-	if(mRoot->showConfigDialog())
-#endif
+	bool cont = false;
+
+	if (mOptions.mFastStart)
+		cont = mRoot->restoreConfig();
+	else
+		cont = mRoot->showConfigDialog();
+
+	if (cont)
     {
         // If returned true, user clicked OK so initialise
@@ -700,5 +747,5 @@
 	result = vect;
 
-	if (mOptions.mSceneFiles == TERRAIN_SCENE)
+	if (mOptions.mSceneType == KdTreeAppListener::ST_TERRAIN)
 	{
 		updateRay.setOrigin(vect);
@@ -732,4 +779,8 @@
 	}
 
+	// hack to fill the valleys only - make cap lower than max height
+	if (result.y >= cap)
+		return Vector3::ZERO;
+
 	result.y = result.y + offset > cap ? cap : result.y + offset;
 
@@ -780,5 +831,6 @@
 		{
 			// load iv files
-			loadres = loadSceneIV(fn, mSceneMgr->getRootSceneNode(), i);			
+			loadres = loadSceneIV(fn, mSceneMgr->getRootSceneNode(), i);
+			mOptions.mSceneType = KdTreeAppListener::ST_GEOMETRY;
 		}
 		else if (strstr(fn.c_str(), ".cfg"))
@@ -786,4 +838,5 @@
 			// load terrain from cfg
 			loadres = loadSceneCfg(fn, mSceneMgr->getRootSceneNode(), i);
+			mOptions.mSceneType = KdTreeAppListener::ST_TERRAIN;
 		}
 		else if (strstr(fn.c_str(), ".txt"))
@@ -899,5 +952,5 @@
 				s.clear();
 				s << line[2];
-				s >> or.x >> or.y >> or.z >> or.w;
+				s >> or.w >> or.x >> or.y >> or.z;
 				s.clear();
 				s << line[3];
@@ -912,6 +965,6 @@
 				}
 				// build node
-				SceneNode *newnode = anchor->createChildSceneNode(node, pos, or);
-				newnode->setScale(scale);
+				//SceneNode *newnode = anchor->createChildSceneNode(node, pos, or);
+				SceneNode *newnode = anchor->createChildSceneNode(node);
 				for (EntMeshMap::iterator emmit = emm.begin(); emmit != emm.end(); emmit ++)
 				{
@@ -919,4 +972,7 @@
 					newnode->attachObject(entity);
 				}
+				newnode->setPosition(pos);
+				newnode->setOrientation(or);
+				newnode->setScale(scale);
 				emm.clear();
 			}
Index: GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTreeAppListener.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTreeAppListener.cpp	(revision 1285)
+++ GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTreeAppListener.cpp	(revision 1296)
@@ -113,4 +113,7 @@
 mTopCamFollow(true),
 mShowTree(SHOWTREE_OFF),
+// view cells
+mUseViewCells(false),
+mUseVisibilityFilter(false),
 //counters
 mSeqNum(0),
@@ -164,4 +167,7 @@
 	mCamNode = sm->getSceneNode("PlayerCamNode");
 
+	sm->getOption("UseViewCells", &mUseViewCells);
+	sm->getOption("UseVisibilityFilter", &mUseVisibilityFilter);
+
 	mRaySceneQuery = mSceneMgr->createRayQuery(Ray(mCamNode->getPosition(), Vector3::NEGATIVE_UNIT_Y));
 
@@ -248,5 +254,5 @@
 
 	String ext = "KdTree/";
-	String sMD, sKT, sKI, sHL, sBM, sRM, sFM, sTC, sEV;
+	String sMD, sKT, sKI, sHL, sBM, sRM, sFM, sTC, sEV, sVC, sVF;
 
 	int maxd;
@@ -319,4 +325,28 @@
 	else
 		sTC = ": Free";
+
+	if (mSceneMgr->getOption("UseViewCells", &mUseViewCells))
+	{
+		if (mUseViewCells)
+			sVC = ": on";
+		else
+			sVC = ": off";
+	}
+	else
+	{
+		sVC = NA;
+	}
+
+	if (mSceneMgr->getOption("UseVisibilityFilter", &mUseVisibilityFilter))
+	{
+		if (mUseVisibilityFilter)
+			sVF = ": on";
+		else
+			sVF = ": off";
+	}
+	else
+	{
+		sVF = NA;
+	}
 
 	initOverlayElement(&mRenderMethodInfo, ext, "RenderMethod", top, sRM); top += vert_space;
@@ -329,4 +359,6 @@
 	initOverlayElement(&mMovementInfo, ext, "Movement", top, sFM); top += vert_space;
 	initOverlayElement(&mTopCamInfo, ext, "TopCam", top, sTC); top += vert_space;
+	initOverlayElement(&mViewCellsInfo, ext, "ViewCells", top, sVC); top += vert_space;
+	initOverlayElement(&mViewFilterInfo, ext, "ViewFilter", top, sVF); top += vert_space;
 
 	OverlayElement *visPanel = OverlayManager::getSingleton().
@@ -350,4 +382,36 @@
 			mKdTreeOverlay->hide();
 		}
+	}
+}
+
+void KdTreeAppListener::toggleUseViewCells()
+{
+	mUseViewCells = !mUseViewCells;
+	if (mSceneMgr->setOption("UseViewCells", &mUseViewCells))
+	{
+		if (mUseViewCells)
+			mViewCellsInfo->setCaption(": on");
+		else
+			mViewCellsInfo->setCaption(": off");
+	}
+	else
+	{
+		mViewCellsInfo->setCaption(NA);
+	}
+}
+
+void KdTreeAppListener::toggleUseVisibilityFilter()
+{
+	mUseVisibilityFilter = !mUseVisibilityFilter;
+	if (mSceneMgr->setOption("UseVisibilityFilter", &mUseVisibilityFilter))
+	{
+		if (mUseVisibilityFilter)
+			mViewFilterInfo->setCaption(": on");
+		else
+			mViewFilterInfo->setCaption(": off");
+	}
+	else
+	{
+		mViewFilterInfo->setCaption(NA);
 	}
 }
@@ -442,4 +506,6 @@
 			else
 				mEnhancedVisInfo->setCaption(": Simple");
+
+			mOptions.mEnhancedVisibility = mode;
 		}
 	}
@@ -458,5 +524,8 @@
 		bm = (bm + 1) % KdTree::KDBM_SIZE;
 		if (mSceneMgr->setOption("BuildMethod", &bm))
+		{
 			mBuildMethodInfo->setCaption(": " + BUILDMETHODCAPTION[bm]);
+			mOptions.mBuildMethod = bm;
+		}
 	}
 	else
@@ -474,5 +543,8 @@
 		rm = (rm + 1) % KdTree::KDRM_SIZE;
 		if (mSceneMgr->setOption("RenderMethod", &rm))
+		{
 			mRenderMethodInfo->setCaption(": " + RENDERMETHODCAPTION[rm]);
+			mOptions.mRenderMethod = rm;
+		}
 	}
 	else
@@ -553,4 +625,42 @@
 	}
 
+	if (mInputDevice->isKeyDown(KC_F8) && mTimeUntilNextToggle <= 0)
+	{
+		// fill scene only once (for now), stop if anchor node exists
+		try
+		{
+			SceneNode *entnode = mSceneMgr->getSceneNode("AnchorNode");
+		}
+		catch (Exception)
+		{
+			// read interesting params from config file
+			ConfigFile terrainconf;
+			std::stringstream s;
+			Real x,y,z;
+			
+			terrainconf.load("terrain.cfg");
+
+			s << terrainconf.getSetting("PageWorldX");
+			s >> x;
+			s.clear();
+
+			s << terrainconf.getSetting("MaxHeight");
+			s >> y;
+			s.clear();
+
+			s << terrainconf.getSetting("PageWorldZ");
+			s >> z;
+			s.clear();
+
+			mOptions.myApp->createTerrainScene(x, y * 0.3, z);
+
+			// rebuild tree
+			mSceneMgr->setOption("RebuildKdTree", 0);
+		}
+
+		mTimeUntilNextToggle = 0.5;
+	}
+
+
 	if (mInputDevice->isKeyDown(KC_F9) && mTimeUntilNextToggle <= 0)
 	{
@@ -571,7 +681,13 @@
 	}
 
-	if (mInputDevice->isKeyDown(KC_V) && mTimeUntilNextToggle <= 0)
-	{
-		toggleEnhancedVisibility();
+	if (mInputDevice->isKeyDown(KC_C) && mTimeUntilNextToggle <= 0)
+	{
+		toggleUseViewCells();
+		mTimeUntilNextToggle = 0.5;
+	}
+
+	if (mInputDevice->isKeyDown(KC_X) && mTimeUntilNextToggle <= 0)
+	{
+		toggleUseVisibilityFilter();
 		mTimeUntilNextToggle = 0.5;
 	}
@@ -982,5 +1098,5 @@
 	if (!mFreeMove)
 	{
-		if (mOptions.mSceneFiles == TERRAIN_SCENE)
+		if (mOptions.mSceneType == ST_TERRAIN)
 		{
 			static Vector3 pos;
@@ -1155,5 +1271,8 @@
 			{
 				saveLog();
-				return false;
+				if (mOptions.mBurnIn)
+					togglePlayback();
+				else
+					return false;
 			}
 		}
@@ -1344,4 +1463,5 @@
 		mDemoStats.mEllapsedTime = 0.0f;
 		mDemoStats.mTotalEllapsedTime = 0.0f;
+		mDemoFPS.clear();
 	}
 	// stop playback
@@ -1597,10 +1717,21 @@
 		if (mOptions.mSceneManager == SM_KDT || mOptions.mSceneManager == SM_KTE)
 		{
-			logwrite << ds << RENDERMETHOD[mOptions.mRenderMethod] << ds << mOptions.mMaxDepth << ds 
-				<< mOptions.mKT << ds << mOptions.mKI;
+			// info about enhanced visibility if internal rendering
+			String senhvis;
+			if (mOptions.mRenderMethod == KdTree::KDRM_INTERNAL)
+			{
+				if (mOptions.mEnhancedVisibility)
+					senhvis = "E" + ds;
+				else
+					senhvis = "S" + ds;
+			}
+
+			logwrite << ds << RENDERMETHOD[mOptions.mRenderMethod] << ds << senhvis << 
+				mOptions.mMaxDepth << ds << mOptions.mKT << ds << mOptions.mKI << ds << 
+				BUILDMETHOD[mOptions.mBuildMethod];
 		}
 		else if (mOptions.mSceneManager == SM_OCM && mOptions.mRenderMethod != KdTree::KDRM_INTERNAL)
 		{
-			logwrite << ds << RENDERMETHOD[(mOptions.mRenderMethod+3)%3];
+			logwrite << ds << RENDERMETHOD[CONV_OCM_TO_KDT_ALG(mOptions.mRenderMethod)];
 		}
 		logwrite << "\"" << fs;
