Index: trunk/VUT/OcclusionCullingSceneManager/TestCullingDotScene/TestCullingDotScene.vcproj
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/TestCullingDotScene/TestCullingDotScene.vcproj	(revision 36)
+++ trunk/VUT/OcclusionCullingSceneManager/TestCullingDotScene/TestCullingDotScene.vcproj	(revision 37)
@@ -13,6 +13,6 @@
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="..\bin\$(ConfigurationName)"
+			IntermediateDirectory="..\obj\$(ConfigurationName)"
 			ConfigurationType="1"
 			CharacterSet="2">
@@ -21,8 +21,8 @@
 				Optimization="0"
 				AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\Dependencies\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;../include"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
+				PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_DEBUG;WIN32;_STLP_DEBUG"
 				MinimalRebuild="TRUE"
 				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
+				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
@@ -34,5 +34,5 @@
 				Name="VCLinkerTool"
 				AdditionalDependencies="Plugin_OctreeSceneManager.lib OGREMain_d.LIB CEGUIBase_d.lib OgreGUIRenderer_d.lib Plugin_DotSceneManager.lib"
-				OutputFile="$(OutDir)/TestCullingDotScene.exe"
+				OutputFile="$(OGRE_PATH)/Samples/Common/bin/Debug/TestCullingDotScene.exe"
 				LinkIncremental="2"
 				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\Dependencies\Lib\Debug&quot;;&quot;$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\debug&quot;;&quot;$(OGRE_PATH)\OgreMain\Lib\Debug&quot;;&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\debug&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;"
@@ -133,4 +133,26 @@
 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
 		</Filter>
+		<Filter
+			Name="tinyxml"
+			Filter="">
+			<File
+				RelativePath="..\tinyxml\tinystr.cpp">
+			</File>
+			<File
+				RelativePath="..\tinyxml\tinystr.h">
+			</File>
+			<File
+				RelativePath="..\tinyxml\tinyxml.cpp">
+			</File>
+			<File
+				RelativePath="..\tinyxml\tinyxml.h">
+			</File>
+			<File
+				RelativePath="..\tinyxml\tinyxmlerror.cpp">
+			</File>
+			<File
+				RelativePath="..\tinyxml\tinyxmlparser.cpp">
+			</File>
+		</Filter>
 	</Files>
 	<Globals>
Index: trunk/VUT/OcclusionCullingSceneManager/TestCullingDotScene/TestCullingDotSceneApplication.cpp
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/TestCullingDotScene/TestCullingDotSceneApplication.cpp	(revision 36)
+++ trunk/VUT/OcclusionCullingSceneManager/TestCullingDotScene/TestCullingDotSceneApplication.cpp	(revision 37)
@@ -14,5 +14,7 @@
 
 #include "Ogre.h"
-#include "TestCullingApplication.h"
+#include "OgreLight.h"
+#include "tinyxml.h"
+#include "TestCullingDotSceneApplication.h"
 #include "OgreOcclusionCullingSceneTraverser.h"
 
@@ -20,15 +22,8 @@
 #include "windows.h"
 
-RaySceneQuery* raySceneQuery = 0;
-
 /***********************************************/
-/* TestCullingApplication implementation       */
+/* TestCullingDotSceneApplication implementation       */
 /***********************************************/
-TestCullingApplication::~TestCullingApplication()
-{
-	delete raySceneQuery;
-}
-
-void TestCullingApplication::parseDotScene( const String &SceneName, const String& groupName )
+void TestCullingDotSceneApplication::ParseDotScene( const String &SceneName, const String& groupName )
 {
 	TiXmlDocument	*XMLDoc;
@@ -254,18 +249,18 @@
 }
 
-Light* LoadLight( TiXmlElement *XMLLight )
+Light* TestCullingDotSceneApplication::LoadLight( TiXmlElement *XMLLight )
 {
 	TiXmlElement *XMLDiffuse, *XMLSpecular, *XMLAttentuation, *XMLPosition;
 
 	// Create a light (point | directional | spot | radPoint)
-	Light* l = mSceneMgr->createLight( XMLLight->Attribute("name") );
+	Light* light = mSceneMgr->createLight( XMLLight->Attribute("name") );
 	if( !XMLLight->Attribute("type") || String(XMLLight->Attribute("type")) == "point" )
-		l->setType( Light::LT_POINT );
+		light->setType( Light::LT_POINT );
 	else if( String(XMLLight->Attribute("type")) == "directional")
-		l->setType( Light::LT_DIRECTIONAL );
+		light->setType( Light::LT_DIRECTIONAL );
 	else if( String(XMLLight->Attribute("type")) == "spot")
-		l->setType( Light::LT_SPOTLIGHT );
+		light->setType( Light::LT_SPOTLIGHT );
 	else if( String(XMLLight->Attribute("type")) == "radPoint")
-		l->setType( Light::LT_POINT );
+		light->setType( Light::LT_POINT );
 
 	XMLDiffuse = XMLLight->FirstChildElement("colourDiffuse");
@@ -277,5 +272,5 @@
 		Diffuse.b = Ogre::StringConverter::parseReal( XMLDiffuse->Attribute("b") );
 		Diffuse.a = 1;
-		l->setDiffuseColour(Diffuse);
+		light->setDiffuseColour(Diffuse);
 	}
 	
@@ -289,5 +284,5 @@
 		Specular.b = Ogre::StringConverter::parseReal( XMLSpecular->Attribute("b") );
 		Specular.a = 1;
-		l->setSpecularColour(Specular);
+		light->setSpecularColour(Specular);
 	}
 
@@ -297,8 +292,8 @@
 		//get defaults incase not all values specified
 		Real range, constant, linear, quadratic;
-		range = l->getAttenuationRange();
-		constant = l->getAttenuationConstant();
-		linear = l->getAttenuationLinear();
-		quadratic = l->getAttenuationQuadric();
+		range = light->getAttenuationRange();
+		constant = light->getAttenuationConstant();
+		linear = light->getAttenuationLinear();
+		quadratic = light->getAttenuationQuadric();
 			
 		if( XMLAttentuation->Attribute("range") )
@@ -310,5 +305,5 @@
 		if( XMLAttentuation->Attribute("quadratic") )
 			quadratic = StringConverter::parseReal( XMLAttentuation->Attribute("quadratic") );
-			l->setAttenuation( range, constant, linear, quadratic );
+			light->setAttenuation( range, constant, linear, quadratic );
 	}
 
@@ -324,91 +319,40 @@
 			p.z = StringConverter::parseReal( XMLPosition->Attribute("z") );
             
-		l->setPosition( p );
+		light->setPosition( p );
 	}
 
 	//castShadows		(true | false) "true"
-	l->setCastShadows( true );
+	light->setCastShadows( true );
 	if( XMLLight->Attribute("visible") )
 		if( String(XMLLight->Attribute("visible")) == "false" )
-				l->setCastShadows( false );
+				light->setCastShadows( false );
 			
 	//visible			(true | false) "true"		
-	l->setVisible( true );
+	light->setVisible( true );
 	if( XMLLight->Attribute("visible") )
 		if( String(XMLLight->Attribute("visible")) == "false" )
-			l->setVisible( false );
-
-	return l;
-}
-//-----------------------------------------------------------------------
-void TestCullingApplication::createCamera( void )
-{
-	// Create the camera
-	mCamera = mSceneMgr->createCamera("PlayerCam");
-
-	// Position it at 500 in Z direction
-	mCamera->setPosition(Vector3(128,25,128));
-
-	// Look back along -Z
-    mCamera->lookAt(Vector3(0,0,-300));
-    mCamera->setNearClipDistance( 1 );
-    mCamera->setFarClipDistance( 1000 );
-}
-//-----------------------------------------------------------------------
-void TestCullingApplication::createScene(void)
-{
-	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);
-
-	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;
-
-	// Set a nice viewpoint
-	mCamera->setPosition(707,2500,528);
-	mCamera->setOrientation(Quaternion(-0.3486, 0.0122, 0.9365, 0.0329));
-
-	raySceneQuery = mSceneMgr->createRayQuery(
-	Ray(mCamera->getPosition(), Vector3::NEGATIVE_UNIT_Y));
-
-     // Create a skybox
-  //   mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox");
-
-	 // CEGUI setup
-	 setupGui();
-}
-//-----------------------------------------------------------------------
-void TestCullingApplication::setupGui( void )
-{
-	 mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, ST_EXTERIOR_CLOSE);
+			light->setVisible( false );
+
+	return light;
+}
+//-----------------------------------------------------------------------
+void TestCullingDotSceneApplication::createScene(void)
+{
+	mSceneMgr->setAmbientLight(ColourValue(0.09f, 0.09f, 0.09f));
+	mSceneMgr->setSkyBox(true, "Examples/MorningSkyBox" );
+		
+	//This is default, though, set it anyway :)
+	ResourceGroupManager::getSingleton().setWorldResourceGroupName("General");
+	mSceneMgr->setWorldGeometry( "MyScene.scene" );
+	//mSceneMgr->SetOctreeVisible( 1 );
+		
+	ParseDotScene( "MyScene.scene", "General" );
+	// CEGUI setup
+	setupGui();
+}
+//-----------------------------------------------------------------------
+void TestCullingDotSceneApplication::setupGui( void )
+{
+	 mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, ST_GENERIC);
      mGUISystem = new CEGUI::System(mGUIRenderer);
 
@@ -428,5 +372,5 @@
 }
 //-----------------------------------------------------------------------
-void TestCullingApplication::createFrameListener(void)
+void TestCullingDotSceneApplication::createFrameListener(void)
 {
 	mFrameListener= new MouseQueryListener(mWindow, mCamera, mSceneMgr, mGUIRenderer);
@@ -435,8 +379,17 @@
 }
 //-----------------------------------------------------------------------
-void TestCullingApplication::chooseSceneManager(void)
-{
-    //mSceneMgr = mRoot->getSceneManager(ST_GENERIC);
-	mSceneMgr = mRoot->getSceneManager(ST_EXTERIOR_CLOSE);
+void TestCullingDotSceneApplication::chooseSceneManager(void)
+{
+	mSceneMgr = mRoot->getSceneManager(ST_GENERIC);
+
+}
+//-----------------------------------------------------------------------
+void TestCullingDotSceneApplication::createViewports(void)
+{
+	// Create one viewport, entire window
+	Viewport* vp = mWindow->addViewport(mCamera);
+	// Look back along -Z
+    mCamera->lookAt(Vector3(0, 0, -300));
+	mCamera->setPosition(0 , 100, 600);
 }
 
@@ -544,25 +497,4 @@
 }
 //-----------------------------------------------------------------------
-bool MouseQueryListener::frameStarted(const FrameEvent &evt)
-{
-	// clamp to terrain
-	static Ray updateRay;
-	updateRay.setOrigin(mCamera->getPosition());
-	updateRay.setDirection(Vector3::NEGATIVE_UNIT_Y);
-	raySceneQuery->setRay(updateRay);
-	RaySceneQueryResult& qryResult = raySceneQuery->execute();
-	RaySceneQueryResult::iterator i = qryResult.begin();
-	 
-	if (i != qryResult.end() && i->worldFragment)
-	{
-		SceneQuery::WorldFragment* wf = i->worldFragment;
-		mCamera->setPosition(mCamera->getPosition().x, 
-			i->worldFragment->singleIntersection.y + 10, 
-			mCamera->getPosition().z);
-	}
-	 
-	return ExampleFrameListener::frameStarted(evt);
-}
-//-----------------------------------------------------------------------
 bool MouseQueryListener::frameEnded(const FrameEvent& evt)
 {
@@ -575,5 +507,5 @@
     KEY_PRESSED(KC_SPACE, 0.3, changeAlgorithm());
 
-	KEY_PRESSED(KC_SUBTRACT, 0.3, changeThreshold(-10));
+	KEY_PRESSED(KC_SUBTRACT, 0.0, changeThreshold(-10));
 	KEY_PRESSED(KC_ADD, 0, changeThreshold(10));
 	//KEY_PRESSED(KC_T, 1, change);
@@ -646,5 +578,5 @@
 {
     // Create application object
-    TestCullingApplication app;
+    TestCullingDotSceneApplication app;
 
 	try 
Index: trunk/VUT/OcclusionCullingSceneManager/TestCullingDotScene/TestCullingDotSceneApplication.h
===================================================================
--- trunk/VUT/OcclusionCullingSceneManager/TestCullingDotScene/TestCullingDotSceneApplication.h	(revision 36)
+++ trunk/VUT/OcclusionCullingSceneManager/TestCullingDotScene/TestCullingDotSceneApplication.h	(revision 37)
@@ -5,5 +5,5 @@
 #include "CEGUIForwardRefs.h"
 #include "ExampleApplication.h"
-//#include "OgreOcclusionCullingSceneManager.h"
+#include "OgreLight.h"
 #include "OgreOcclusionCullingSceneTraverser.h"
 
@@ -36,5 +36,5 @@
     }
 
-	bool frameStarted(const FrameEvent& evt);
+//	bool frameStarted(const FrameEvent& evt);
 	bool frameEnded(const FrameEvent& evt);
 
@@ -83,8 +83,8 @@
 
 
-class TestCullingApplication : public ExampleApplication
+class TestCullingDotSceneApplication : public ExampleApplication
 {
 public:
-	~TestCullingApplication();
+	//~TestCullingDotSceneApplication();
 
 protected:
@@ -92,8 +92,8 @@
 	void createFrameListener(void);
 	void setupGui(void);
-	void parseDotScene( const String &SceneName, const String& groupName );
-	void Light* LoadLight( TiXmlElement *XMLLight );
+	void ParseDotScene( const String &SceneName, const String& groupName );
+	Light* LoadLight( TiXmlElement *XMLLight );
 
-	virtual void createCamera(void);
+	virtual void createViewports(void);
 
 	CEGUI::OgreCEGUIRenderer *mGUIRenderer;
@@ -103,4 +103,5 @@
 	void chooseSceneManager(void);
 
+	//SceneManager* mSceneMgr;
 	//Entity* mShip;
 	//SceneNode* mShipNode;
