Index: trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.cpp
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.cpp	(revision 44)
+++ trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.cpp	(revision 51)
@@ -20,15 +20,13 @@
 #include "windows.h"
 
-//RaySceneQuery* mRaySceneQuery = 0;
 
 /***********************************************/
 /* TestCullingApplication implementation       */
 /***********************************************/
-/*TestCullingApplication::~TestCullingApplication()
-{
-	delete mRaySceneQuery;
-}*/
-//-----------------------------------------------------------------------
-void TestCullingApplication::createCamera( void )
+TestCullingApplication::~TestCullingApplication()
+{
+}
+//-----------------------------------------------------------------------
+/*void TestCullingApplication::createCamera( void )
 {
 	// Create the camera
@@ -42,9 +40,8 @@
     mCamera->setNearClipDistance( 1 );
     mCamera->setFarClipDistance( 1000 );
-}
+}*/
 //-----------------------------------------------------------------------
 void TestCullingApplication::createScene(void)
 {
-	Plane waterPlane;
 	// Set ambient light
 	mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
@@ -52,66 +49,24 @@
 	// 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);
-    //mSceneMgr->setFog( FOG_EXP, fadeColour, 0.005 );
-
+	//l->setPosition(20,80,50);
+
+	mMinTranslation = Vector3(-70.0f, -70.0f, 0.0f);
+	mMaxTranslation = Vector3(70.0f, 70.0f, 600.0f);
+
+	mMinAngle = Vector3(0, 0, 0);
+	mMaxAngle = Vector3(360, 360, 360);
+
+	/*
 	mWindow->getViewport(0)->setBackgroundColour(fadeColour);
 
+	Entity *ogreHeadEnt = mSceneMgr->createEntity("head", "ogrehead.mesh");
+	mOgreHead = mSceneMgr->getRootSceneNode()->createChildSceneNode( "OgreHeadNode" );
+	mOgreHead->attachObject(ogreHeadEnt);
+	*/
+	generateScene(4);
 	// Create a skybox
-    //mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox", 500, false);
-	//mSceneMgr->setSkyDome( true, "Examples/CloudySky", 5, 8, 500, false );
-
-	std::string terrain_cfg("terrain.cfg");
-#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
-	terrain_cfg = mResourcePath + terrain_cfg;
-#endif
-	mSceneMgr -> setWorldGeometry( terrain_cfg );
-	// Infinite far plane?
-	if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(RSC_INFINITE_FAR_PLANE))
-	{
-		mCamera->setFarClipDistance(0);
-	}
-
-/*	// 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;
-	// Create the plane 10000 units wide, tile the texture 3 times
-    mSceneMgr->setSkyPlane(true, plane, "Examples/SpaceSkyPlane",10000,3);*/
-
-	// Set a nice viewpoint
-	mCamera->setPosition(707,2500,528);
-	mCamera->setOrientation(Quaternion(-0.3486, 0.0122, 0.9365, 0.0329));
-
-	//mRaySceneQuery = mSceneMgr->createRayQuery(
-	//	Ray(mCamera->getPosition(), Vector3::NEGATIVE_UNIT_Y));
-
-	/*Entity *robotEnt = mSceneMgr->createEntity( "Robot", "robot.mesh" );
-	SceneNode *robotNode = mSceneMgr->getRootSceneNode()->createChildSceneNode( "RobotNode", Vector3( 750, 25, 600 ));
-	robotNode->attachObject( robotEnt );
-	robotNode->scale( .3, .3, .3 );
-	robotNode->yaw( Degree( 160 ) );
-
-	Entity *ogreEnt = mSceneMgr->createEntity( "Ogre", "ogrehead.mesh" );
-    SceneNode *ogreNode = mSceneMgr->getRootSceneNode()->createChildSceneNode( "Ogre", Vector3( 800, 50, 830 ) );
-    ogreNode->attachObject( ogreEnt );
-	ogreNode->scale(.2,.2,.2);
-	ogreNode->yaw( Degree( 20 ) );
-
-	Entity *ogreEnt2 = mSceneMgr->createEntity( "Ogre2", "ogrehead.mesh" );
-    SceneNode *ogreNode2 = mSceneMgr->getRootSceneNode()->createChildSceneNode( "Ogre2", Vector3( 700, 50, 730 ) );
-    ogreNode2->attachObject( ogreEnt2 );
-	ogreNode2->scale(.05,.05,.05);
-	ogreNode->yaw( Degree( 40 ) );*/
+    //mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox", 1000, false);
+    ColourValue fadeColour(0.3, 0.9, 0.5);
+	mWindow->getViewport(0)->setBackgroundColour(fadeColour);
 
 	// CEGUI setup
@@ -142,8 +97,46 @@
 void TestCullingApplication::chooseSceneManager(void)
 {
-    //mSceneMgr = mRoot->getSceneManager(ST_GENERIC);
-	mSceneMgr = mRoot->getSceneManager(ST_EXTERIOR_CLOSE);
-}
-
+    mSceneMgr = mRoot->getSceneManager(ST_GENERIC);
+}
+//-----------------------------------------------------------------------
+void TestCullingApplication::generateSceneObject(const Vector3 &translationRatio, 
+												 const Vector3 &rotationRatio, const int idx, const String& entName)
+{
+	Vector3 rotation = mMinAngle + rotationRatio * (mMaxAngle - mMinAngle);
+	Vector3 translation = mMinTranslation + translationRatio * (mMaxTranslation - mMinTranslation);
+
+	char name[16];
+    sprintf( name, "object%d", idx );
+
+    Entity *ent = mSceneMgr->createEntity( name, entName );
+	SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode( String(name) + "Node", translation);
+	node->attachObject(ent);
+	node->scale(0.1,0.1,0.1);
+
+	node->yaw(Degree(rotation.x));
+    node->pitch(Degree(rotation.y));
+	node->roll(Degree(rotation.z));
+}
+//-----------------------------------------------------------------------
+void TestCullingApplication::generateScene( int numObjects )
+{
+	srand (time (0));
+	
+	Vector3 rotationRatio;
+	Vector3 translationRatio;
+
+	for(int i=0; i < numObjects; i++)
+	{
+		rotationRatio.x = rand() / (float) RAND_MAX;
+		rotationRatio.y = rand() / (float) RAND_MAX;
+		rotationRatio.z = rand() / (float) RAND_MAX;
+
+		translationRatio.x = rand() / (float) RAND_MAX;
+		translationRatio.y = rand() / (float) RAND_MAX;
+		translationRatio.z = rand() / (float) RAND_MAX;
+
+		generateSceneObject(translationRatio, rotationRatio, i, "sphere.mesh");
+	}
+}
 /***********************************************/
 /* MouseQueryListener implementation           */
@@ -156,5 +149,5 @@
 
 	// Setup default variables
-	mCurrentObject = NULL;
+	//mOgreHead = NULL;
 	mLMouseDown = false;
 	mRMouseDown = false;
@@ -173,6 +166,4 @@
 	mEventProcessor->addKeyListener(this);
 
-	mRaySceneQuery = mSceneMgr->createRayQuery( Ray() );
-
 	// show overlay
 	Overlay* pOver = OverlayManager::getSingleton().getByName("Example/OcclusionCullingDemoOverlay"); 
@@ -199,5 +190,4 @@
 MouseQueryListener::~MouseQueryListener( )
 {
-	delete mRaySceneQuery;
 }
 //-----------------------------------------------------------------------
@@ -213,27 +203,5 @@
      if (e->getButtonID() & InputEvent::BUTTON0_MASK)
      {
-		 CEGUI::MouseCursor::getSingleton().hide( );
-
-		 // Setup the ray scene query
-         Ray mouseRay = mCamera->getCameraToViewportRay( e->getX(), e->getY() );
-         mRaySceneQuery->setRay( mouseRay );
-
-         // Execute query
-         RaySceneQueryResult &result = mRaySceneQuery->execute();
-         RaySceneQueryResult::iterator itr = result.begin( );
-
-         // Get results, create a node/entity on the position
-         if ( itr != result.end() && itr->worldFragment )
-         {
-			 char name[16];
-             sprintf( name, "Robot%d", mCount++ );
-
-             Entity *ent = mSceneMgr->createEntity( name, "robot.mesh" );
-             mCurrentObject = mSceneMgr->getRootSceneNode( )->createChildSceneNode( String(name) + "Node", itr->worldFragment->singleIntersection );
-             mCurrentObject->attachObject( ent );
-             mCurrentObject->setScale( 0.1f, 0.1f, 0.1f );
-         }
-
-         mLMouseDown = true; 
+		mLMouseDown = true; 
      }
      // Right mouse button down
@@ -267,14 +235,5 @@
 	 if ( mLMouseDown )
      {
-		 Ray mouseRay = mCamera->getCameraToViewportRay( e->getX(), e->getY() );
-		 mRaySceneQuery->setRay( mouseRay );
-
-		 RaySceneQueryResult &result = mRaySceneQuery->execute();
-		 RaySceneQueryResult::iterator itr = result.begin( );
-
-		 if ( itr != result.end() && itr->worldFragment )
-		 {
-			 mCurrentObject->setPosition( itr->worldFragment->singleIntersection );
-		 } 
+		
      }
 	 // If we are dragging the right mouse button.
@@ -287,22 +246,5 @@
 //-----------------------------------------------------------------------
 bool MouseQueryListener::frameStarted(const FrameEvent &evt)
-{
-	// clamp to terrain
-	Vector3 camPos = mCamera->getPosition( );
-    Ray cameraRay( Vector3(camPos.x, 5000.0f, camPos.z), Vector3::NEGATIVE_UNIT_Y );
-    mRaySceneQuery->setRay( cameraRay );
-
-    // Perform the scene query
-    RaySceneQueryResult &queryResult = mRaySceneQuery->execute();
-    RaySceneQueryResult::iterator it = queryResult.begin( );
-
-	if (it != queryResult.end() && it->worldFragment)
-	{
-		SceneQuery::WorldFragment* wf = it->worldFragment;
-
-		mCamera->setPosition(mCamera->getPosition().x, wf->singleIntersection.y + 10, 
-			mCamera->getPosition().z);
-	}
-	 
+{	 
 	return ExampleFrameListener::frameStarted(evt);
 }
Index: trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.h
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.h	(revision 44)
+++ trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.h	(revision 51)
@@ -79,8 +79,4 @@
 	OverlayElement *mHierarchyNodesInfo;
 	OverlayElement *mSceneNodesInfo;
-
-	SceneNode *mCurrentObject;         // The newly created object
-	int mCount;                        // The number of robots on the screen
-	RaySceneQuery *mRaySceneQuery;     // The ray scene query pointer
 };
 
@@ -95,8 +91,28 @@
 	void createFrameListener(void);
 	void setupGui(void);
-	virtual void createCamera(void);
+	/** generates a the scene hierarchy with random values 
+	@param number of objects to generate
+	*/
+	void generateScene(int numObjects);
+
+	/** generates a new scene object 
+	@param tranlationRatio ratio between minimal and maximal possible translation
+	@param rotationRatio ratio between minimal and maximal possible rotation
+	@idx the index of the new object
+	@entName the name of the object entity
+	*/
+	void generateSceneObject(const Vector3 &translationRatio, const Vector3 &rotationRatio, 
+							 const int idx, const String &entName);
+
+	//virtual void createCamera(void);
 
 	CEGUI::OgreCEGUIRenderer *mGUIRenderer;
 	CEGUI::System *mGUISystem;
+
+	Vector3 mMinTranslation;
+	Vector3 mMaxTranslation;
+
+	Vector3 mMinAngle;
+	Vector3 mMaxAngle;
 
 private:
