Index: trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
===================================================================
--- trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp	(revision 415)
+++ trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp	(revision 417)
@@ -141,5 +141,6 @@
 mDemoFps(0),
 mUseDemoFps(false),
-mUseArbQueries(false)
+mUseArbQueries(false),
+mUseBufferedInputMouse(false)
 {
 	//mInputDevice = PlatformManager::getSingleton().createInputReader();
@@ -156,4 +157,6 @@
 	mInputDevice = mEventProcessor->getInputReader();	
 
+	mInputDevice->setBufferedInput(true, mUseBufferedInputMouse);
+
 	// create ray query executor, used to place objects in terrain
 	mRayQueryExecutor = new RayQueryExecutor(mSceneMgr);
@@ -216,29 +219,28 @@
 void TerrainFrameListener::mousePressed(MouseEvent* e)
 {
-     // Left mouse button down
-     if (e->getButtonID() & InputEvent::BUTTON0_MASK)
-     {
-		 CEGUI::MouseCursor::getSingleton().hide();
-
-		 // Setup the ray scene query
-         Ray mouseRay = mCamera->getCameraToViewportRay(e->getX(), e->getY());
+	// Left mouse button down
+	if (e->getButtonID() & InputEvent::BUTTON0_MASK)
+	{
+		CEGUI::MouseCursor::getSingleton().hide();
+
+		// Setup the ray scene query
+		Ray mouseRay = mCamera->getCameraToViewportRay(e->getX(), e->getY());
 		 
-		 //Vector3 queryResult; mRayQueryExecutor->executeRayQuery(&queryResult, mouseRay);
-		 
-		 Real val = Math::RangeRandom(0, 360); // random rotation
-
-		 // get results, create a node/entity on the position
-		 mCurrentObject = mTerrainContentGenerator->GenerateSceneObject(
-			 mouseRay.getOrigin()/*queryResult*/, Vector3(val, 0, 0), 
-			 msObjectCaptions[mCurrentObjectType]);
-		
-         mLMouseDown = true; 
-     }
-     // Right mouse button down
-     else if (e->getButtonID() & InputEvent::BUTTON1_MASK)
-     {
+		//Vector3 queryResult; mRayQueryExecutor->executeRayQuery(&queryResult, mouseRay);
+		Real val = Math::RangeRandom(0, 360); // random rotation
+
+		// get results, create a node/entity on the position
+		mCurrentObject = mTerrainContentGenerator->GenerateSceneObject(
+			mouseRay.getOrigin(), Vector3(val, 0, 0), 
+			msObjectCaptions[mCurrentObjectType]);
+		
+		mLMouseDown = true; 
+	}
+	// Right mouse button down
+	/*else if (e->getButtonID() & InputEvent::BUTTON1_MASK)
+	{
          CEGUI::MouseCursor::getSingleton().hide();
          mRMouseDown = true;
-     }
+	}*/
 }
 //-----------------------------------------------------------------------
@@ -289,29 +291,21 @@
 //-----------------------------------------------------------------------
 void TerrainFrameListener::mouseDragged(MouseEvent *e)
- {
-	 // If we are dragging the left mouse button.	 	 
-	 if (mLMouseDown)
-     {
-		 if (!mCurrentObject)
-			 return;
-
-		 Vector3 queryResult;
-		 Ray mouseRay = mCamera->getCameraToViewportRay(e->getX(), e->getY());
-
-		 if (mRayQueryExecutor->executeRayQuery(&queryResult, mouseRay))
-		 {
-			 // apply offset so object is ON terrain
-			 queryResult.y += msObjectTerrainOffsets[mCurrentObjectType];
-			 mCurrentObject->setPosition(queryResult);
-		 }
-     }
-	 // If we are dragging the right mouse button.
-	 if (mRMouseDown)
-	 {
-		 //mCamera->yaw(-e->getRelX() * mRotateSpeed);
-		 //mCamera->pitch(-e->getRelY() * mRotateSpeed);
-		 mCamNode->yaw(-e->getRelX() * mRotateSpeed);
-		 mCamNode->pitch(-e->getRelY() * mRotateSpeed);
-	 }
+{
+	// If we are dragging the left mouse button.	 	 
+	if (mLMouseDown)
+    {
+		if (!mCurrentObject)
+			return;
+
+		Vector3 queryResult;
+		Ray mouseRay = mCamera->getCameraToViewportRay(e->getX(), e->getY());
+
+		if (mRayQueryExecutor->executeRayQuery(&queryResult, mouseRay))
+		{
+			// apply offset so object is ON terrain
+			queryResult.y += msObjectTerrainOffsets[mCurrentObjectType];
+			mCurrentObject->setPosition(queryResult);
+		}
+	}
 }
 //-----------------------------------------------------------------------
@@ -370,6 +364,11 @@
 		return false;
 	}
-/*	if (!processUnbufferedMouseInput(evt))
-	{	return false;	}*/
+	if (!mUseBufferedInputMouse)
+	{
+		if (!processUnbufferedMouseInput(evt))
+		{	
+			return false;	
+		}
+	}
 
 	//-- set parameters for visualization
@@ -593,4 +592,24 @@
 }
 
+
+bool TerrainFrameListener::processUnbufferedMouseInput(const FrameEvent& evt)
+{
+	/* Rotation factors, may not be used if the second mouse button is pressed. */
+
+    /* If the second mouse button is pressed, then the mouse movement results in 
+       sliding the camera, otherwise we rotate. */
+    if (mInputDevice->getMouseButton(1))
+    {
+		mTranslateVector.x += mInputDevice->getMouseRelativeX() * 0.13;
+		mTranslateVector.y -= mInputDevice->getMouseRelativeY() * 0.13;
+	}
+	else
+	{
+		mRotX = Degree(-mInputDevice->getMouseRelativeX() * 0.13);
+		mRotY = Degree(-mInputDevice->getMouseRelativeY() * 0.13);
+	}
+
+	return true;
+}
 //-----------------------------------------------------------------------
 bool TerrainFrameListener::frameEnded(const FrameEvent& evt)
@@ -1201,5 +1220,7 @@
 		toggleUseArbQueries();
 		break;
-
+	case KC_O:
+		switchMouseMode();
+		break;
 	//KEY_PRESSED(KC_F3, 0.3, writeFrames());
 	//KEY_PRESSED(KC_F4, 0.3, loadFrames());
Index: trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
===================================================================
--- trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp	(revision 350)
+++ trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp	(revision 417)
@@ -231,5 +231,5 @@
 
 	// Set ambient light
-	mAmbientLight = ColourValue(0.5 , 0.5, 0.5);
+	mAmbientLight = ColourValue(0.5, 0.5, 0.5);
 	mSceneMgr->setAmbientLight(mAmbientLight);
 	
@@ -316,10 +316,13 @@
 	Vector3 scale(val, val, val); 
 	const float maxHeight = 75;
-	// to provide much occlusion,
+	
+	// In order to provide much occlusion,
 	// height is restricted to maxHeight => no objects are created on peaks
 	mTerrainContentGenerator->SetMinPos(Vector3(mTerrainMinPos));
 	mTerrainContentGenerator->SetMaxPos(Vector3(mTerrainMaxPos.x, maxHeight, mTerrainMaxPos.z));
-	std::stringstream d; d << "objscale: " << scale[0];
-	Ogre::LogManager::getSingleton().logMessage(d.str());
+	
+	//std::stringstream d; d << "objscale: " << scale[0];
+	//Ogre::LogManager::getSingleton().logMessage(d.str());
+	
 	mTerrainContentGenerator->SetScale(scale);
 	mTerrainContentGenerator->SetOffset(TerrainFrameListener::msObjectTerrainOffsets[objectType]);
Index: trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h
===================================================================
--- trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h	(revision 343)
+++ trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h	(revision 417)
@@ -111,6 +111,5 @@
    bool frameStarted(const FrameEvent& evt);
    bool frameEnded(const FrameEvent& evt);
-   //bool processUnbufferedKeyInput(const FrameEvent& evt);
-    
+     
 
    /* MouseListener callbacks. */
@@ -172,4 +171,10 @@
     bool processUnbufferedKeyInput(const FrameEvent& evt);
     bool processUnbufferedMouseInput(const FrameEvent& evt);
+
+	void switchMouseMode() 
+	{
+        mUseBufferedInputMouse = !mUseBufferedInputMouse;
+		mInputDevice->setBufferedInput(true, mUseBufferedInputMouse);
+	}
 
 	/** Shows the frame / algorithm statistics.
@@ -393,4 +398,6 @@
 	float mPureRenderTimeFps;
 	TestCullingTerrainApplication *mApplication;
+
+	bool mUseBufferedInputMouse;
 };
 
Index: trunk/VUT/work/iv/IVFrameListener.cpp
===================================================================
--- trunk/VUT/work/iv/IVFrameListener.cpp	(revision 345)
+++ trunk/VUT/work/iv/IVFrameListener.cpp	(revision 417)
@@ -258,6 +258,8 @@
 		return false;
 	}
-/*	if (!processUnbufferedMouseInput(evt))
-	{	return false;	}*/
+	if (!processUnbufferedMouseInput(evt))
+	{	
+		return false;	
+	}
 
 	// --- set parameters for visualization
@@ -313,4 +315,25 @@
 		break;
 	};	
+
+	return true;
+}
+
+bool IVFrameListener::processUnbufferedMouseInput(const FrameEvent& evt)
+{
+	/* Rotation factors, may not be used if the second mouse button is pressed. */
+
+    /* If the second mouse button is pressed, then the mouse movement results in 
+       sliding the camera, otherwise we rotate. */
+    if (mInputDevice->getMouseButton(1))
+    {
+		mTranslateVector.x += mInputDevice->getMouseRelativeX() * 0.13;
+		mTranslateVector.y -= mInputDevice->getMouseRelativeY() * 0.13;
+	}
+	else
+	{
+		mRotX = Degree(-mInputDevice->getMouseRelativeX() * 0.13);
+		mRotY = Degree(-mInputDevice->getMouseRelativeY() * 0.13);
+	}
+
 
 	return true;
