Index: GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTreeAppListener.h
===================================================================
--- GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTreeAppListener.h	(revision 1165)
+++ GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTreeAppListener.h	(revision 1170)
@@ -54,4 +54,5 @@
 	Real mRotationPeriod;
 	bool mShowTree;
+	bool mFreeMove;
 
 	int mSeqNum;
@@ -122,4 +123,5 @@
         }
 
+		mFreeMove = false;
 		mShowTree = false;
 		mCullCamera = false;
@@ -210,4 +212,20 @@
 		caption = OverlayManager::getSingleton().getOverlayElement("KdTree/BuildMethod")->getCaption();
 		OverlayManager::getSingleton().getOverlayElement("KdTree/BuildMethod")->setCaption(caption + value);
+
+		String rm;
+		if (mSceneMgr->getOption("RenderMethod", &rm))
+			value = " " + rm;
+		else
+			value = na;
+		caption = OverlayManager::getSingleton().getOverlayElement("KdTree/RenderMethod")->getCaption();
+		OverlayManager::getSingleton().getOverlayElement("KdTree/RenderMethod")->setCaption(caption + value);
+
+		value = na;
+		if (mFreeMove)
+			value = " Free";
+		else
+			value = " Ground";
+		caption = OverlayManager::getSingleton().getOverlayElement("KdTree/Movement")->getCaption();
+		OverlayManager::getSingleton().getOverlayElement("KdTree/Movement")->setCaption(caption + value);
 	}
 
@@ -264,8 +282,16 @@
 		static String sKT = "[5][6] KT: ";
 		static String sKI = "[7][8] KI: ";
-		static String sBM = "[Space] Build Method: ";
-
-		static String bmRec = "Recursive";
-		static String bmPQ = "PriorityQueue";
+		static String sBM = "[Y] Build Method: ";
+		static String sRM = "[X] Render Method: ";
+		static String sMov = "[Q] Movement: ";
+
+		static String bmOptions[] = { "Recursive", "PriorityQueue" };
+		static int bmOptionsSize = sizeof(bmOptions) / sizeof(String);
+		static int bmCurrent = 0;
+
+		//static String rmOptions[] = { "Recursive", "Stack", "StopAndWait", "CHC" };
+		static String rmOptions[] = { "Recursive", "Stack" };
+		static int rmOptionsSize = sizeof(rmOptions) / sizeof (String);
+		static int rmCurrent = 0;
 
 		if ((mInputDevice->isKeyDown(KC_1) || mInputDevice->isKeyDown(KC_2)) && mTimeUntilNextToggle <= 0)
@@ -374,15 +400,12 @@
 		}
 
-		if (mInputDevice->isKeyDown(KC_SPACE) && mTimeUntilNextToggle <= 0)
+		if (mInputDevice->isKeyDown(KC_Z) && mTimeUntilNextToggle <= 0)
 		{
 			String bm;
 			if (mSceneMgr->getOption("BuildMethod", &bm))
 			{
-				if (bm == bmRec)
-					bm = bmPQ;
-				else if (bm == bmPQ)
-					bm = bmRec;
-				if (mSceneMgr->setOption("BuildMethod", &bm))
-					OverlayManager::getSingleton().getOverlayElement("KdTree/BuildMethod")->setCaption(sBM + bm);
+				bmCurrent = (bmCurrent + 1) % bmOptionsSize;
+				if (mSceneMgr->setOption("BuildMethod", &bmOptions[bmCurrent]))
+					OverlayManager::getSingleton().getOverlayElement("KdTree/BuildMethod")->setCaption(sBM + bmOptions[bmCurrent]);
 			}
 			else
@@ -391,6 +414,38 @@
 			}
 
-			mTimeUntilNextToggle = 0.2;
-		}
+			mTimeUntilNextToggle = 0.5;
+		}
+
+		if (mInputDevice->isKeyDown(KC_X) && mTimeUntilNextToggle <= 0)
+		{
+			String rm;
+			if (mSceneMgr->getOption("RenderMethod", &rm))
+			{
+				rmCurrent = (rmCurrent + 1) % rmOptionsSize;
+				if (mSceneMgr->setOption("RenderMethod", &rmOptions[rmCurrent]))
+					OverlayManager::getSingleton().getOverlayElement("KdTree/RenderMethod")->setCaption(sRM + rmOptions[rmCurrent]);
+			}
+			else
+			{
+				OverlayManager::getSingleton().getOverlayElement("KdTree/RenderMethod")->setCaption(sRM + "N/A");
+			}
+
+			mTimeUntilNextToggle = 0.5;
+		}
+
+		if (mInputDevice->isKeyDown(KC_Q) && mTimeUntilNextToggle <= 0)
+		{
+			mFreeMove = !mFreeMove;
+			String move = "N/A";
+			if (mFreeMove)
+				move = "Free";
+			else
+				move = "Ground";
+
+			OverlayManager::getSingleton().getOverlayElement("KdTree/Movement")->setCaption(sMov + move);
+
+			mTimeUntilNextToggle = 0.5;
+		}
+
 
 		if (mInputDevice->isKeyDown(KC_BACK) && mTimeUntilNextToggle <= 0)
@@ -667,21 +722,24 @@
 		mTopCam->moveRelative(mCullTransVec);
 
-		Vector3 pos = mCamera->getPosition();
-		RaySceneQuery * rsquery = mSceneMgr->createRayQuery(Ray(pos, Vector3::NEGATIVE_UNIT_Y));
-		RaySceneQueryResult& rsresult = rsquery->execute();
-
-		RaySceneQueryResult::iterator it = rsresult.begin();
-		RaySceneQueryResult::iterator end = rsresult.end();
-
-		while (it != end && it->movable)
-		{
-			if (it->movable->getName() != "PlayerCam")
-			{
-				mCamera->setPosition(pos.x, it->movable->getWorldBoundingBox().getCenter().y + 3, pos.z);
-				break;
-			}
-			it++;
-		}
-		OGRE_DELETE(rsquery);
+		if (!mFreeMove)
+		{
+			Vector3 pos = mCamera->getPosition();
+			RaySceneQuery * rsquery = mSceneMgr->createRayQuery(Ray(pos, Vector3::NEGATIVE_UNIT_Y));
+			RaySceneQueryResult& rsresult = rsquery->execute();
+
+			RaySceneQueryResult::iterator it = rsresult.begin();
+			RaySceneQueryResult::iterator end = rsresult.end();
+
+			while (it != end && it->movable)
+			{
+				if (it->movable->getName() != "PlayerCam")
+				{
+					mCamera->setPosition(pos.x, it->movable->getWorldBoundingBox().getCenter().y + 3, pos.z);
+					break;
+				}
+				it++;
+			}
+			OGRE_DELETE(rsquery);
+		}
 	}
 
