Index: /GTP/trunk/App/Demos/Illum/Ogre/src/SpaceStation/include/SpaceStation.h
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/src/SpaceStation/include/SpaceStation.h	(revision 2472)
+++ /GTP/trunk/App/Demos/Illum/Ogre/src/SpaceStation/include/SpaceStation.h	(revision 2472)
@@ -0,0 +1,543 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+You may use this sample code for anything you like, it is not covered by the
+LGPL like the rest of the engine.
+-----------------------------------------------------------------------------
+*/
+
+/**
+    \file 
+        Lighting.h
+    \brief
+        Shows lighting support in OGRE. Also demonstrates the use of billboards
+        and controllers for automatic time-relative behaviour.
+*/
+
+
+#include "ExampleApplication.h"
+#include "OgreIlluminationManager.h"
+#include "NXOgre.h"
+#include "SceneSerializer.h"
+#include "Characters.h"
+
+bool highQuality = true;
+
+Scene* NXScene = 0;
+FPSPlayer* gFPSPlayer;
+
+bool PP_glowON = true;
+bool PP_tonemapON = true;
+bool PP_dofON = true;
+
+Real lightpower = 32.0;
+Real glowCut = 50.6;
+Real glowTimeBlur = 0.6;
+Real glowStrech = 1.8;
+Real glowCombine = 0.5;
+
+bool hallLightON = true;
+bool smokeON = true;
+bool smokeVisible = true;
+Timer* smokeOffTimer;
+
+ParticleSystem* smokeSystem;
+
+Entity* LightButton;
+Entity* SmokeButton;
+
+AnimationState* scientistAnimState;
+
+// Listener class for frame updates
+class SpaceStationFrameListener : public ExampleFrameListener
+{
+protected:
+	
+	unsigned long framecount;
+	SceneNode* mainLightNode;
+	Light* light1;
+	Light* light2;
+	SceneNode* sysNode;
+	
+public:
+    SpaceStationFrameListener(RenderWindow* window, Camera* maincam, SceneNode* lightNode, Light* l, Light* l2, SceneNode* sysNode)
+        :ExampleFrameListener(window, maincam) 
+				 
+    {
+		mainLightNode = lightNode;
+		light1 = l;
+		light2 = l2;
+		framecount = 0;	
+		mMoveSpeed /= 50.0;
+		this->sysNode = sysNode;
+
+		mStatsOn = false;
+		showDebugOverlay(mStatsOn);
+		smokeOffTimer = new Timer();
+		smokeOffTimer->reset();
+    }
+
+    bool frameStarted(const FrameEvent& evt)
+    {	
+		scientistAnimState->addTime(evt.timeSinceLastFrame);
+
+		if(smokeOffTimer->getMilliseconds()>10)
+		{
+			if(smokeVisible)
+			{
+				smokeVisible = false;
+				smokeSystem->setVisible(false);
+			}
+		}
+
+		float dt = evt.timeSinceLastFrame;
+		static float rotate = 0;
+		rotate += dt * 100.0;
+		Vector3 dir(Math::Sin(Radian(Degree(rotate))), -1.4,Math::Cos(Radian(Degree(rotate))));
+		dir.normalise();
+		if(light1)
+			light1->setDirection(dir);
+
+		if(light2)
+		{
+			Vector3 pos = Vector3(-1.6,3,-25.5)+ Vector3(dir.x, 0, dir.z) * 0.3;
+			light2->setPosition(pos);
+			dir *= -1;
+			dir.y = -2.0;
+			dir.normalise();
+			light2->setDirection(dir);
+		}
+		
+		return ExampleFrameListener::frameStarted(evt);     
+    }
+	
+	void turnSmokeOff()
+	{
+		smokeSystem->getEmitter(0)->setEmissionRate(0);
+		smokeOffTimer->reset();
+	}
+	void smokebuttonpressed()
+	{
+		hallLightON = !hallLightON;
+				light2->setVisible(hallLightON);
+			if(!hallLightON)
+			{
+				smokeON = false;
+				turnSmokeOff();
+			}
+	}
+	void lightbuttonpressed()
+	{
+		if(hallLightON)
+		{
+			smokeON = !smokeON;
+			if(smokeON)
+			{
+				smokeSystem->getEmitter(0)->setEmissionRate(3);
+				smokeSystem->setVisible(true);
+				smokeVisible = true;
+			}
+			else
+			{
+				turnSmokeOff();
+			}
+				
+		}
+	}
+
+	bool processUnbufferedKeyInput(const FrameEvent& evt)
+    {
+		gFPSPlayer->processKeyInputs(mInputDevice);
+				
+		if (mInputDevice->isKeyDown(KC_ADD) && mTimeUntilNextToggle <= 0)
+		{
+			if (mInputDevice->isKeyDown(KC_RSHIFT))
+				lightpower /= 1.2;
+			else
+				lightpower *= 1.2;
+			light2->setPowerScale(lightpower);
+			mTimeUntilNextToggle = 0.2;
+				mWindow->setDebugText(String("LightPower ") + StringConverter::toString(lightpower));
+		}
+		if (mInputDevice->isKeyDown(KC_SUBTRACT) && mTimeUntilNextToggle <= 0)
+		{
+			if (mInputDevice->isKeyDown(KC_RSHIFT))
+				glowCut /= 1.2;
+			else
+				glowCut *= 1.2;
+			Ogre::Material* m = (Ogre::Material*) MaterialManager::getSingleton().getByName("GTP/Station/PostProc/GlowCut").getPointer();
+			m->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant("cutValue",glowCut);
+			mTimeUntilNextToggle = 0.2;
+			mWindow->setDebugText(String("GlowCut ") + StringConverter::toString(glowCut));
+		}
+		if (mInputDevice->isKeyDown(KC_MULTIPLY) && mTimeUntilNextToggle <= 0)
+		{
+			if (mInputDevice->isKeyDown(KC_RSHIFT))
+				glowTimeBlur /= 1.2;
+			else
+				glowTimeBlur *= 1.2;
+			Ogre::Material* m = (Ogre::Material*) MaterialManager::getSingleton().getByName("GTP/Station/PostProc/GlowCut").getPointer();
+			m->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant("timeBlur", glowTimeBlur);
+			mTimeUntilNextToggle = 0.2;
+			mWindow->setDebugText(String("GlowTimeBlur ") + StringConverter::toString(glowTimeBlur));
+		}
+		if (mInputDevice->isKeyDown(KC_M))
+		{
+			if (mInputDevice->isKeyDown(KC_RSHIFT))
+				glowStrech -= 0.01;
+			else
+				glowStrech += 0.01;
+			Ogre::Material* m = (Ogre::Material*) MaterialManager::getSingleton().getByName("GTP/Station/PostProc/GlowBlurH").getPointer();
+			m->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant("Stretch", glowStrech);
+			m = (Ogre::Material*) MaterialManager::getSingleton().getByName("GTP/Station/PostProc/GlowBlurV").getPointer();
+			m->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant("Stretch", glowStrech);
+			mWindow->setDebugText(String("GlowStretch ") + StringConverter::toString(glowStrech));
+		}
+		if (mInputDevice->isKeyDown(KC_N))
+		{
+			if (mInputDevice->isKeyDown(KC_RSHIFT))
+				glowCombine -= 0.01;
+			else
+				glowCombine += 0.01;
+			Ogre::Material* m = (Ogre::Material*) MaterialManager::getSingleton().getByName("GTP/Station/GlowFinalCombine").getPointer();
+			m->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant("weight2", glowCombine);
+			mTimeUntilNextToggle = 0.2;
+			mWindow->setDebugText(String("GlowCombine ") + StringConverter::toString(glowCombine));
+		}
+
+		if (mInputDevice->isKeyDown(KC_3) && mTimeUntilNextToggle <= 0)
+		{
+			PP_glowON = !PP_glowON;
+			CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0),
+														"GTP/Station/PostProc/Glow", PP_glowON);
+			mTimeUntilNextToggle = 0.2;
+		}
+		if (mInputDevice->isKeyDown(KC_4) && mTimeUntilNextToggle <= 0)
+		{
+			PP_tonemapON = !PP_tonemapON;
+
+			CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0),
+														"GTP/PostProc/ToneMap", PP_tonemapON);
+			
+			mTimeUntilNextToggle = 0.2;
+		}
+		if (mInputDevice->isKeyDown(KC_5) && mTimeUntilNextToggle <= 0)
+		{
+			PP_dofON = !PP_dofON;
+			CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0),
+														"GTP/Moria/PostProc/DoF", PP_dofON);
+			mTimeUntilNextToggle = 0.2;
+		}
+
+		if( mInputDevice->isKeyDown( KC_ESCAPE) )
+        {            
+            return false;
+        }
+		if (mInputDevice->isKeyDown(KC_F) && mTimeUntilNextToggle <= 0)
+        {
+            mStatsOn = !mStatsOn;
+            showDebugOverlay(mStatsOn);
+
+            mTimeUntilNextToggle = 1;
+        }
+		if (mInputDevice->isKeyDown(KC_SYSRQ) && mTimeUntilNextToggle <= 0)
+        {
+			char tmp[20];
+			sprintf(tmp, "screenshot_%d.png", ++mNumScreenShots);
+            mWindow->writeContentsToFile(tmp);
+            mTimeUntilNextToggle = 0.5;
+			mWindow->setDebugText(String("Wrote ") + tmp);
+        }
+		return true;
+		//return ExampleFrameListener::processUnbufferedKeyInput(evt);
+	}
+
+	bool processUnbufferedMouseInput(const FrameEvent& evt)
+	{
+		gFPSPlayer->processMouseInputs(mInputDevice);
+	//	return ExampleFrameListener::processUnbufferedMouseInput(evt);
+
+		static float lasttime = 0;
+		float thistime = Root::getSingleton().getTimer()->getMilliseconds();
+		float dt = ((float)(thistime - lasttime))/ 1000.0;
+		lasttime = thistime;
+
+		static float buttonChangeTime = 0;
+		buttonChangeTime += dt;
+		if( mInputDevice->getMouseButton( 1 ) && buttonChangeTime > 0.25)
+		{
+			buttonChangeTime = 0;
+			
+			Vector3 PlayerPos = FPSPlayer::thePlayer->getPosition();
+			float dist = (PlayerPos - Vector3(-1.5375, -0.73,-27.6)).length();
+			if( dist < 1 && FPSPlayer::thePlayer->getDirection().dotProduct(Vector3(0,0,-1))>0)
+			{
+				if(PlayerPos.x > -1.5375)//lightbutton
+				{
+					lightbuttonpressed();
+				}
+				else//smokebutton
+				{
+					smokebuttonpressed();
+				}
+			}
+		}
+		return true;
+	}
+};
+
+/** Application class */
+class SpaceStationApplication : public ExampleApplication
+{
+
+
+
+
+protected:
+	SceneNode* kupolaNode;
+	SceneNode* roomLightNode;
+	SceneNode* hallLightNode;
+	Light* roomLight;
+	Light* hallLight;
+	SceneNode *pSysNode;
+	
+	void loadResources(void)
+	{
+		// Initialise, parse scripts etc
+		ResourceGroupManager::getSingleton().initialiseResourceGroup("Bootstrap");
+		ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_Basic");
+		ResourceGroupManager::getSingleton().initialiseResourceGroup("General");
+		ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_EnvMap");
+		ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_Caustic");
+		ResourceGroupManager::getSingleton().initialiseResourceGroup("PostProc");
+		ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_Particles");
+		ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_PathMap");
+		ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_Diffuse");
+		ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_SpaceStation");		
+	}
+
+	void createPostproc()
+	{		
+	/*	CompositorManager::getSingleton().addCompositor(mWindow->getViewport(0),
+														"GTP/SpaceStation/PostProc/DoF");
+		CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0),
+														"GTP/SpaceStation/PostProc/DoF", true);*/
+
+		CompositorManager::getSingleton().addCompositor(mWindow->getViewport(0),
+														"GTP/Station/PostProc/Glow");
+		CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0),
+														"GTP/Station/PostProc/Glow", true);
+		
+		CompositorManager::getSingleton().addCompositor(mWindow->getViewport(0),
+														"GTP/PostProc/ToneMap");
+		CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0),
+														"GTP/PostProc/ToneMap", true);	
+		/*		
+		CompositorManager::getSingleton().addCompositor(mWindow->getViewport(0),
+														"GTP/PostProc/MotionBlur");
+		CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0),
+														"GTP/PostProc/MotionBlur", false);*/
+		
+	}
+    
+	void chooseSceneManager()
+	{
+		mSceneMgr = mRoot->createSceneManager("OctreeSceneManager");
+		//mSceneMgr = mRoot->createSceneManager("OcclusionCullingSceneManager");
+	}
+
+	void createScene(void) ///TOWERS
+    {
+		roomLight = hallLight = 0;
+
+		std::string occlusion_cfg("OcclusionCulling.cfg");
+		//mSceneMgr->setWorldGeometry(occlusion_cfg);
+		
+		//Overlay* mainOverlay = OverlayManager::getSingleton().getByName("MORIA/MainOverlay");
+		//mainOverlay->show();
+
+		createPostproc();
+
+		OgreIlluminationManager::getSingleton().setMainCamera(mCamera);
+		OgreIlluminationManager::getSingleton().setMainViewport(mWindow->getViewport(0));
+		 OgreIlluminationManager::getSingleton().setFocusingSM(false);
+	   OgreIlluminationManager::getSingleton().setShadowMapSize(700);
+	   OgreIlluminationManager::getSingleton().setBlurShadowMap(highQuality);
+	   if(highQuality)
+		   OgreIlluminationManager::getSingleton().setShadowMapMaterialName(Light::LT_SPOTLIGHT, "GTP/Basic/Distance_Normalized");
+	   else
+		   OgreIlluminationManager::getSingleton().setShadowMapMaterialName(Light::LT_SPOTLIGHT, "GTP/Basic/Depth");//GTP/Basic/Distance_Normalize
+	   OgreIlluminationManager::getSingleton().setShadowMapMaterialName(Light::LT_POINT, "GTP/Basic/Distance_Normalized");
+	   OgreIlluminationManager::getSingleton().setUseLISPSM(false);
+	   OgreIlluminationManager::getSingleton().joinSharedRuns(false);
+				
+		Root::getSingleton()._setCurrentSceneManager(mSceneMgr);
+		mCamera->setPosition(0,0,0);
+		//mCamera->setPosition(0,100,0);
+		//mCamera->lookAt(0,-1,0);
+		mCamera->setFOVy(Radian(Degree(80)));
+		mCamera->setNearClipDistance(0.001);
+		mCamera->setFarClipDistance(820);
+		// Set ambient light
+       // mSceneMgr->setAmbientLight(ColourValue(0.1, 0.1, 0.1));
+		//mSceneMgr->setSkyBox(true, "Examples/EveningSkyBox", 500);
+		
+		SceneNode* rootNode = mSceneMgr->getRootSceneNode();
+		
+		SceneSerializer s(mSceneMgr);
+		DataStreamPtr inputStream; 				
+		inputStream = ResourceGroupManager::getSingleton().openResource("station.level");	
+		World* NXWorld = new World("FrameListener: no, log: html");
+		NXWorld->getPhysXDriver()->createFrameListener(90);
+		NXScene = NXWorld->createScene("Main", mSceneMgr, "gravity: yes, floor: no"); 
+		s.setScene(NXScene);
+		s.setWorld(NXWorld);
+		s.parseScript(inputStream, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+		s.parseEntryPoints("StationPrmEntryPoints.text");
+	
+		NXScene->createActor("bound", new MeshShape("stationbound.mesh"), Vector3(0,0,0), "static: yes"); 
+		NXScene->createActor("bound2", new MeshShape("stationbound2.mesh"), Vector3(0,0,0), "static: yes"); 
+		
+		hallLight = mSceneMgr->createLight("hallLight");
+		hallLight->setType(Light::LT_SPOTLIGHT);
+		hallLight->setCastShadows(true);
+        hallLight->setDiffuseColour(ColourValue::White);
+		hallLight->setSpecularColour(ColourValue::White);
+		hallLightNode = rootNode->createChildSceneNode();
+		
+		//hallLightNode->setPosition(-1.6,3,-25.5);		
+		hallLight->setPowerScale(200);
+		hallLight->setDirection(0,0,-1);
+		hallLightNode->attachObject(hallLight);
+		hallLight->setSpotlightRange(Degree(0),Degree(140));
+		hallLight->setAttenuation(20.0, 0, 0, 3);
+		hallLight->setVisible(hallLightON);
+
+		
+		roomLight = mSceneMgr->createLight("roomLight");
+		roomLight->setType(Light::LT_SPOTLIGHT);
+		roomLight->setCastShadows(true);
+        roomLight->setDiffuseColour(ColourValue::White);
+		roomLight->setSpecularColour(ColourValue::White);
+		roomLightNode = rootNode->createChildSceneNode();
+		
+		roomLightNode->setPosition(-7.5,1,-11);		
+		roomLight->setPowerScale(50);
+		roomLight->setDirection(0,0,-1);
+		roomLightNode->attachObject(roomLight);
+		roomLight->setSpotlightRange(Degree(0),Degree(140));
+		roomLight->setAttenuation(20.0, 0, 0, 3);
+	/*
+		BillboardSet* bbs = mSceneMgr->createBillboardSet("bb", 1);
+		bbs->setDefaultDimensions(0.3, 0.3);
+		bbs->createBillboard(Vector3::ZERO, ColourValue::White);
+		bbs->setMaterialName("Flare");
+		roomLightNode->attachObject(bbs);*/
+
+
+		Entity* CauCaster = mSceneMgr->createEntity("CauCaster", "sphere.mesh");
+		SceneNode* casterNode = rootNode->createChildSceneNode();
+		casterNode->setPosition(-1.5, 1.0, -25);
+		casterNode->setScale(0.75, .75, 0.75);
+		CauCaster->setMaterialName("SpaceStation_CausticCaster");
+		casterNode->attachObject(CauCaster);
+		casterNode->_updateBounds();
+		CauCaster->setCastShadows(true);
+
+		smokeSystem = mSceneMgr->createParticleSystem("psys1", "GTP/Station/Smoke");
+		smokeSystem->setKeepParticlesInLocalSpace(false);
+		SceneNode *pSysNode = rootNode->createChildSceneNode("psys1");
+		pSysNode->attachObject(smokeSystem);
+		smokeSystem->getEmitter(0)->setPosition(Vector3(0,-3.7,0));
+		smokeSystem->setCastShadows(false);
+		pSysNode->setPosition(-1.5, 3, -25);
+		smokeSystem->setVisible(smokeVisible);
+
+		LightButton = mSceneMgr->createEntity("lightButton", "cube.mesh");
+		SceneNode* lbNode = rootNode->createChildSceneNode();
+		lbNode->setScale(0.1,0.1,0.1);
+		lbNode->setPosition(-1.8, -0.73, -27.6);
+		lbNode->rotate(Vector3(1,0,0), Degree(30.0));
+		lbNode->attachObject(LightButton);
+		LightButton->setMaterialName("Station/redbutton");
+		
+		SmokeButton = mSceneMgr->createEntity("smokeButton", "cube.mesh");
+		SceneNode* sbNode = rootNode->createChildSceneNode();
+		sbNode->setScale(0.1,0.1,0.1);
+		sbNode->setPosition(-1.25, -0.73, -27.6);
+		sbNode->rotate(Vector3(1,0,0), Degree(30.0));
+		sbNode->attachObject(SmokeButton);
+		SmokeButton->setMaterialName("Station/bluebutton");
+
+		Entity* scientist = mSceneMgr->createEntity("scientist", "scientist.mesh");
+		//scientist->setMaterialName("GTP/Diffuse/Disc2Point");
+		SceneNode* aNode = rootNode->createChildSceneNode();
+		aNode->setPosition(-7.5,-1.3,-11);
+		aNode->setScale(0.02,0.02,0.02);
+		aNode->attachObject(scientist);
+		scientist->setCastShadows(true);
+		aNode->_updateBounds();
+		AxisAlignedBox bb4 = scientist->getWorldBoundingBox();
+		AxisAlignedBox bb3 = scientist->getBoundingBox();
+		Ogre::Sphere bs2 = scientist->getWorldBoundingSphere();
+		scientistAnimState = scientist->getAnimationState("idle");
+		scientistAnimState->setEnabled(true);
+
+		PlayerCharacter::frameListenerPriority = 20;
+	
+		gFPSPlayer = new FPSPlayer(NXScene, mSceneMgr, Vector3(0.4, 1.0, 0.35),/* Vector3(-0.6,-0.5,-24)*/Vector3(0, -0.5, 11.5), 1.15, mCamera, false);
+		/*gFPSPlayer->addPlayerMesh("FPSarm.mesh", 0.02, false);
+		gFPSPlayer->addWeaponModel("sword.mesh", "joint28");
+	
+		TrollCharacter* troll = new TrollCharacter("troll1", NXScene, mSceneMgr, Vector3(1.5, 3.0, 1.2), Vector3(15, 10, 15), false);
+		troll->addPlayerMesh("troll.mesh", 0.05, false);
+		troll->addWeaponModel("trollMace.mesh", "RightHand");
+
+		CharacterManager::getSingleton().mScene = NXScene;
+		CharacterManager::getSingleton().mSceneManager = mSceneMgr;*/
+
+		OgreIlluminationManager::getSingleton().initTechniques();
+   }
+	
+	void createPlane(Ogre::String _name, Ogre::String _material, Ogre::Vector3 _pos, Ogre::Vector2 _size, Ogre::Vector2 _subdivisions = Ogre::Vector2(1,1)) 
+	{
+		Plane _plane;
+        _plane.normal = Vector3::UNIT_Y;
+        _plane.d = 0;
+
+
+        MeshManager::getSingleton().createPlane(_name + ".plane",
+            ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, 
+            _plane,_size.x,_size.y,1,1,true,1,_subdivisions.x,_subdivisions.y,Vector3::UNIT_Z);
+        
+		Entity *_entity = mSceneMgr->createEntity(_name + ".entity", _name + ".plane");
+        _entity->setMaterialName(_material);
+
+		SceneNode* _node = mSceneMgr->getRootSceneNode()->createChildSceneNode(_name + ".node");
+		_node->attachObject(_entity);
+		_node->setPosition(_pos);
+
+	}
+
+	void createFrameListener(void)
+    {
+		// This is where we instantiate our own frame listener
+		mFrameListener= new SpaceStationFrameListener(mWindow,
+			mCamera, roomLightNode, roomLight, hallLight, pSysNode	);
+        mFrameListener->setPriority(10);	
+		mRoot->addFrameListener(mFrameListener);
+//		gFPSPlayer->setPriority(20);
+//		mRoot->addFrameListener(gFPSPlayer);
+		OgreIlluminationManager::getSingleton().setPriority(100);
+	    mRoot->addFrameListener(&OgreIlluminationManager::getSingleton());
+	  
+    }
+
+};
+
Index: /GTP/trunk/App/Demos/Illum/Ogre/src/SpaceStation/include/Characters.h
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/src/SpaceStation/include/Characters.h	(revision 2472)
+++ /GTP/trunk/App/Demos/Illum/Ogre/src/SpaceStation/include/Characters.h	(revision 2472)
@@ -0,0 +1,159 @@
+#pragma once
+
+#include "Ogre.h"
+#include "OgreBillboardParticleRenderer.h"
+#include "OgreIlluminationManager.h"
+#include "NXOgre.h"
+
+using namespace Ogre;
+using namespace NxOgre;
+
+enum PlayerAnimState
+{
+	PLAYERANIMSTATE_STAND,
+	PLAYERANIMSTATE_IDLE,
+	PLAYERANIMSTATE_ATTACK,
+	PLAYERANIMSTATE_BLOCK,
+	PLAYERANIMSTATE_WALK,
+	PLAYERANIMSTATE_PAIN,
+	PLAYERANIMSTATE_DEATH,
+	PLAYERANIMSTATE_TURN
+};
+
+class PlayerCharacter;
+class MyCharMoveController;
+
+class CharacterManager
+{
+public:
+	static CharacterManager& getSingleton()
+	{
+		if(mSingleton == 0)
+			mSingleton = new CharacterManager();
+		return *mSingleton;
+	}
+	PlayerCharacter* getTrigger(NxOgre::Actor* a)
+	{
+		if(triggers.find(a)== triggers.end())
+			return 0;
+		return triggers[a];
+	}
+	PlayerCharacter* getTarget(NxOgre::Actor* a)
+	{
+		if(targets.find(a)== targets.end())
+			return 0;
+		return targets[a]; 
+	}
+
+	void addTrigger(NxOgre::Actor* a, PlayerCharacter* c){triggers[a] = c;}
+	void addTarget(NxOgre::Actor* a, PlayerCharacter* c){targets[a] = c;}
+	
+	SceneManager* mSceneManager;
+	Scene* mScene;
+
+protected:
+	CharacterManager(){}
+	static CharacterManager* mSingleton;
+	std::map<NxOgre::Actor*, PlayerCharacter*> triggers;
+	std::map<NxOgre::Actor*, PlayerCharacter*> targets;
+	
+};
+
+
+class PlayerCharacter  : public FrameListener
+{
+public:
+
+	PlayerCharacter(String name, Scene* scene, SceneManager* sceneManager, Vector3 dimensions, Vector3 startPosition, bool debug = false);
+	
+	virtual void addPlayerMesh(String meshname, float meshscale, bool rotateModel);
+	virtual bool frameStarted(const FrameEvent& evt);
+	virtual void doAction(float dt){}
+	virtual float getHit(){return 0;}
+	virtual void addHit(float hit){mHealth -= hit; if(mHealth < 0) mHealth = 0;}
+	
+	static unsigned int frameListenerPriority;
+
+	Entity* getMeshEntity(){return mCharacterMeshEntity;}
+	
+protected:
+	
+	String mName;
+	Entity* mCharacterMeshEntity;
+	SceneNode*  mPlayerBoundDebugNode;
+	Scene* mScene;
+	Character* mPlayerCharacter;
+	SceneNode* mPlayerNode;
+	float mMeshScale;
+	AnimationState* mCharacterMesh_AnimState;
+	SceneManager* mSceneManager;
+	PlayerAnimState mCurrentAnimState;
+	int mWeapon;
+	bool mMoving;
+	bool mForceAnimChange;
+	MyCharMoveController* mCharacterController;
+	Vector3 mPlayerDimensions;
+	bool mRunning;
+	bool isAlive;
+	
+	bool mDebug;
+
+	float mHealth;
+		
+	float getAnimSpeed(){return 1.2;}
+	virtual String getAnimStateName(PlayerAnimState as,  int option = 0){return "stand";}
+	virtual void setAnimState(PlayerAnimState as){}
+	
+};
+
+class AlienCharacter : public PlayerCharacter
+{
+public:
+	AlienCharacter(String name, Scene* scene, SceneManager* sceneManager, Vector3 dimensions, Vector3 startPosition, bool debug = false);
+	~AlienCharacter(){}
+
+	void doAction(float dt);
+	
+	bool frameStarted(const FrameEvent& evt)
+	{		
+		return PlayerCharacter::frameStarted(evt);
+	}
+protected:
+	String getAnimStateName(PlayerAnimState as,  int option = 0);
+	void setAnimState(PlayerAnimState as);
+
+	static float MaxHealth;
+};
+
+class FPSPlayer : public PlayerCharacter
+{
+public:
+	FPSPlayer(Scene* scene, SceneManager* sceneManager, Vector3 dimensions, Vector3 startPosition, float cameraHeight, Camera* cam, bool debug = false);
+	~FPSPlayer(void);
+
+	void addPlayerMesh(String meshname, float meshscale, bool rotateModel);
+	virtual void processKeyInputs(InputReader* inputDevice);
+	bool frameStarted(const FrameEvent& evt);
+	virtual void processMouseInputs(InputReader* inputDevice);	
+	Vector3 getPosition(){return mPlayerNode->getWorldPosition();
+		return mPlayerCharacter->getGlobalPosition();}
+	Vector3 getDirection()
+	{
+		Vector3 dir = mCamera->getDerivedDirection();
+		dir.normalise();
+		return dir;
+	}
+//	Vector3 getOrienation(){return mPlayerCharacter->getGlobalOrientation();}
+	
+	static FPSPlayer* thePlayer;
+	static FPSPlayer* getPlayer(){return thePlayer;}
+	
+protected:
+
+	Camera* mCamera;
+	float mCameraHeight;
+	Light* mFlashLight;
+		
+	String getAnimStateName(PlayerAnimState as,  int option = 0);
+	void setAnimState(PlayerAnimState as);
+};
Index: /GTP/trunk/App/Demos/Illum/Ogre/src/SpaceStation/scripts/SpaceStation.7.10.vcproj
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/src/SpaceStation/scripts/SpaceStation.7.10.vcproj	(revision 2472)
+++ /GTP/trunk/App/Demos/Illum/Ogre/src/SpaceStation/scripts/SpaceStation.7.10.vcproj	(revision 2472)
@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="SpaceStation"
+	ProjectGUID="{09F9E809-02CF-4926-8203-2B9C02FBD916}"
+	RootNamespace="SpaceStation"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="..\bin\$(ConfigurationName)"
+			IntermediateDirectory="..\obj\$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				ImproveFloatingPointConsistency="TRUE"
+				AdditionalIncludeDirectories="..\include;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderingRuns;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderingRuns;..\..\Common\include;&quot;$(NXOGRE_PATH)\include&quot;;&quot;$(PHYSX_DIR)\SDKs\Physics\include&quot;;&quot;$(PHYSX_DIR)\SDKs\Foundation\include&quot;;&quot;$(PHYSX_DIR)\SDKs\Cooking\include&quot;;&quot;$(PHYSX_DIR)\SDKs\NxCharacter\include&quot;;&quot;$(PHYSX_DIR)\SDKs\PhysXLoader\include&quot;"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;GAMETOOLS_ILLUMINATION_MODULE;GTP_VISIBILITY_MODIFIED_OGRE;NXOGRE"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				EnableFunctionLevelLinking="TRUE"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="4"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="OgreMain_d.lib IllumModule_Ogre.lib IllumModule.lib NxOgre_d.lib"
+				OutputFile="$(OutDir)/SpaceStation.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories="..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\bin\Debug;&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\bin\Debug;&quot;$(NXOGRE_PATH)/lib&quot;"
+				IgnoreDefaultLibraryNames=""
+				GenerateDebugInformation="TRUE"
+				ProgramDatabaseFile="$(OutDir)/PRMDemo.pdb"
+				SubSystem="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="copy $(OutDir)\$(TargetFileName) ..\..\..\bin\$(ConfigurationName)"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="..\bin\$(ConfigurationName)"
+			IntermediateDirectory="..\obj\$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="TRUE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="1"
+				EnableIntrinsicFunctions="TRUE"
+				ImproveFloatingPointConsistency="TRUE"
+				FavorSizeOrSpeed="1"
+				OmitFramePointers="TRUE"
+				EnableFiberSafeOptimizations="FALSE"
+				OptimizeForProcessor="2"
+				OptimizeForWindowsApplication="TRUE"
+				AdditionalIncludeDirectories="..\include;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\include\RenderingRuns;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderTechniques;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\include\RenderingRuns;..\..\Common\include;&quot;$(NXOGRE_PATH)\include&quot;;&quot;$(PHYSX_DIR)\SDKs\Physics\include&quot;;&quot;$(PHYSX_DIR)\SDKs\Foundation\include&quot;;&quot;$(PHYSX_DIR)\SDKs\Cooking\include&quot;;&quot;$(PHYSX_DIR)\SDKs\NxCharacter\include&quot;;&quot;$(PHYSX_DIR)\SDKs\PhysXLoader\include&quot;"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;GAMETOOLS_ILLUMINATION_MODULE;GTP_VISIBILITY_MODIFIED_OGRE;NXOGRE"
+				StringPooling="TRUE"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="0"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="FALSE"
+				EnableFunctionLevelLinking="TRUE"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="OgreMain.lib IllumModule_Ogre.lib IllumModule.lib NxOgre.lib"
+				OutputFile="$(OutDir)/SpaceStation.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="..\..\..\..\..\..\..\Lib\Illum\IllumModule\OgreIllumModule\bin\Release;&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;..\..\..\..\..\..\..\Lib\Illum\IllumModule\IllumModule\bin\Release;&quot;$(NXOGRE_PATH)\lib&quot;"
+				GenerateDebugInformation="FALSE"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="copy $(OutDir)\$(TargetFileName) ..\..\..\bin\$(ConfigurationName)"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+			<File
+				RelativePath="..\src\Characters.cpp">
+			</File>
+			<File
+				RelativePath="..\src\SpaceStation.cpp">
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc">
+			<File
+				RelativePath="..\include\Characters.h">
+			</File>
+			<File
+				RelativePath="..\include\SpaceStation.h">
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+		</Filter>
+		<Filter
+			Name="Common"
+			Filter="">
+			<File
+				RelativePath="..\..\Common\src\SceneSerializer.cpp">
+			</File>
+			<File
+				RelativePath="..\..\Common\include\SceneSerializer.h">
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
Index: /GTP/trunk/App/Demos/Illum/Ogre/src/SpaceStation/src/Characters.cpp
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/src/SpaceStation/src/Characters.cpp	(revision 2472)
+++ /GTP/trunk/App/Demos/Illum/Ogre/src/SpaceStation/src/Characters.cpp	(revision 2472)
@@ -0,0 +1,275 @@
+#include "characters.h"
+
+FPSPlayer* FPSPlayer::thePlayer = NULL;
+unsigned int PlayerCharacter::frameListenerPriority = 1;
+float AlienCharacter::MaxHealth = 350;
+CharacterManager* CharacterManager::mSingleton = 0;
+
+
+
+class MyTrigger : public Trigger
+{
+public:
+	MyTrigger(const NxString& meshIdentifier, Scene* scene, ShapeDescription* shape, const NxOgre::Pose& pose, ActorParams params = ""):
+	  Trigger(meshIdentifier, scene, shape, pose, params)
+	  {
+	  }
+
+	 void onEnter(Actor* a)
+	 {
+		 PlayerCharacter* trigger = CharacterManager::getSingleton().getTrigger(this);
+		 PlayerCharacter* target = CharacterManager::getSingleton().getTarget(a);
+		
+		 if(target != trigger && target == FPSPlayer::thePlayer)
+			target->addHit(trigger->getHit());
+
+	 }
+};
+
+class MyCharMoveController : public CharacterController
+{
+public:
+	MyCharMoveController(float speed = 1.5){movespeed = speed;}
+	float movespeed;
+	void move(NxVec3 &out, NxVec3 &moveVector, NxQuat &direction, NxVec3 &g, float t, Character*)
+	{
+		NxVec3 dir = direction.rot(moveVector);
+		out = ((dir * movespeed) + g) * t;		
+	}
+	NxControllerAction onShapeHit(const NxControllerShapeHit & hit)
+	{
+		return CharacterController::onShapeHit(hit);
+	}
+	NxControllerAction onControllerHit(const NxControllersHit & hit)
+	{
+		return CharacterController::onControllerHit(hit);
+	}
+};
+
+PlayerCharacter::PlayerCharacter(String name, Scene* scene, SceneManager* sceneManager, Vector3 dimensions, Vector3 startPosition, bool debug)
+{
+	mCurrentAnimState = PLAYERANIMSTATE_STAND;
+	isAlive = true;
+	mName = name;
+	mPlayerDimensions = dimensions;
+	mDebug = debug;
+	mSceneManager = sceneManager;
+	mScene = scene;
+	CharacterParams cp;
+	cp.setToDefault();
+	cp.mDimensions = NxVec3(dimensions.x, dimensions.y, dimensions.z);
+	cp.mType = CharacterParams::CT_Box;
+	mPlayerCharacter = mScene->createCharacter(mName, startPosition, cp); 
+	NxActor* a = mPlayerCharacter->getNxController()->getActor();
+	CharacterManager::getSingleton().addTarget((Actor*) a->userData, this);
+	mPlayerCharacter->createNode();
+	mPlayerNode = mPlayerCharacter->getNode();
+	
+	mCharacterController = 0;
+	mCharacterController = new MyCharMoveController(2.0);
+	mPlayerCharacter->setMovementVectorController(mCharacterController);
+
+	if(mDebug)
+	{		
+		mPlayerBoundDebugNode = mPlayerNode->createChildSceneNode(mName + "_BoundDebugNode");
+		mPlayerBoundDebugNode->setScale(Vector3(dimensions.x, dimensions.y, dimensions.z));	
+	}
+
+	mCharacterMesh_AnimState = 0;
+	mForceAnimChange = false;
+	mCharacterMeshEntity = 0;
+	mPlayerBoundDebugNode = 0;
+		
+	this->setPriority(frameListenerPriority++);
+	Root::getSingleton().addFrameListener(this);
+}
+
+AlienCharacter::AlienCharacter(String name, Scene* scene, SceneManager* sceneManager, Vector3 dimensions, Vector3 startPosition, bool debug)
+: PlayerCharacter(name, scene, sceneManager, dimensions, startPosition, debug)
+{
+	mHealth = MaxHealth;
+}
+
+FPSPlayer::FPSPlayer(Scene* scene, SceneManager* sceneManager, Vector3 dimensions, Vector3 startPosition, float cameraHeight, Camera* cam, bool debug)
+: PlayerCharacter("FPSPlayerCharacter", scene, sceneManager, dimensions, startPosition, debug)
+{	
+	mCameraHeight = cameraHeight - dimensions.y / 2.0;
+	mCamera = cam;
+	mPlayerNode->attachObject(cam); 
+	//mCamera->rotate(Vector3(0,1,0), Radian(Degree(180)));
+	
+	thePlayer = this;	
+
+	mFlashLight = mSceneManager->createLight(mName + "_flashLight");
+	mFlashLight->setType(Light::LT_SPOTLIGHT);
+	mFlashLight->setCastShadows(true);
+    mFlashLight->setDiffuseColour(ColourValue::White);
+	mFlashLight->setSpecularColour(ColourValue::White);
+	
+	mFlashLight->setPosition(-0.1,0.1 + mCameraHeight,0);		
+	mFlashLight->setPowerScale(25);
+	mFlashLight->setDirection(0,0,-1);
+	mPlayerNode->attachObject(mFlashLight);
+	mFlashLight->setSpotlightRange(Degree(0),Degree(140));
+	mFlashLight->setAttenuation(20.0, 0, 0, 3);
+}
+
+FPSPlayer::~FPSPlayer(void)
+{
+}
+
+void PlayerCharacter::addPlayerMesh(String meshname, float meshscale, bool rotateModel)
+{
+	mCharacterMeshEntity = mSceneManager->createEntity(mName, meshname);
+	mCharacterMeshEntity->setCastShadows(true);
+	mMeshScale = meshscale;
+	mCurrentAnimState = PLAYERANIMSTATE_STAND;
+	mCharacterMesh_AnimState = mCharacterMeshEntity->getAnimationState(getAnimStateName(PLAYERANIMSTATE_STAND));
+	mCharacterMesh_AnimState->setEnabled(true);
+	mCharacterMesh_AnimState->setLoop(true);
+	SceneNode* meshNode = mPlayerNode->createChildSceneNode(mName + "_MeshNode");
+	meshNode->attachObject(mCharacterMeshEntity);
+	meshNode->setPosition(0 ,-mPlayerDimensions.y / 2.0, 0);
+	meshNode->setScale(meshscale, meshscale, meshscale);
+	if(rotateModel)
+	meshNode->rotate(Vector3::UNIT_Y, Degree(180.0));	
+}
+
+void FPSPlayer::addPlayerMesh(String meshname, float meshscale, bool rotateModel)
+{	
+}
+
+void AlienCharacter::doAction(float dt)
+{
+	
+}
+
+void  AlienCharacter::setAnimState(PlayerAnimState as)
+{	
+}
+
+String AlienCharacter::getAnimStateName(PlayerAnimState as,  int option)
+{	
+	return "";
+}
+
+bool PlayerCharacter::frameStarted(const FrameEvent& evt)
+{
+	doAction(evt.timeSinceLastFrame);
+
+	float dt = evt.timeSinceLastFrame;
+		
+	if(mCharacterMesh_AnimState)
+	 mCharacterMesh_AnimState->addTime(dt * getAnimSpeed());	
+	
+	if(mCharacterMeshEntity)
+	this->mCharacterMeshEntity->_updateAnimation();	
+
+	return true;
+}
+
+void FPSPlayer::processKeyInputs(InputReader* inputDevice)
+{	
+	
+	mMoving = false;
+	if (inputDevice->isKeyDown(KC_S))
+	{ 
+		mPlayerCharacter->addMovement(Character::DR_Forward); 
+		mMoving = true;
+	} 	
+	if (inputDevice->isKeyDown(KC_W))
+	{ 
+		mPlayerCharacter->addMovement(Character::DR_Backward);
+		mMoving = true;
+	} 
+	if (inputDevice->isKeyDown(KC_D))
+	{ 
+		mPlayerCharacter->addMovement(Character::DR_StepRight);
+		mMoving = true;
+	} 
+	if (inputDevice->isKeyDown(KC_A))
+	{ 
+		mPlayerCharacter->addMovement(Character::DR_StepLeft); 
+		mMoving = true;
+	} 
+	if (inputDevice->isKeyDown(KC_PGUP))
+	{ 
+		mPlayerCharacter->addMovement(Character::DR_Ladder_Up); 
+		mMoving = true;
+	} 
+	if (inputDevice->isKeyDown(KC_PGDOWN))
+	{ 
+		mPlayerCharacter->addMovement(Character::DR_Ladder_Down); 
+		mMoving = true;
+	} 
+	if (inputDevice->isKeyDown(KC_LSHIFT))
+	{			
+		
+		if(mCharacterController)
+				((MyCharMoveController*)mCharacterController)->movespeed = 2.0;
+			mRunning = true;			
+	}
+	else
+	{
+		if(mCharacterController)
+		((MyCharMoveController*)mCharacterController)->movespeed = 1.0;
+		mRunning = false;
+	}
+	
+}
+
+void FPSPlayer::processMouseInputs(InputReader* inputDevice)
+{
+	Quaternion q; 
+	q.FromAngleAxis( Radian(Degree(-inputDevice->getMouseRelX() * 0.13)), Vector3::UNIT_Y ); 
+	q = mPlayerCharacter->getGlobalOrientation() * q; 
+	mPlayerCharacter->setDirection(q); 
+
+	mCamera->pitch(Radian(Degree(-inputDevice->getMouseRelY() * 0.13)));
+	mFlashLight->setDirection(mCamera->getDirection());
+
+	static float lasttime = 0;
+	float thistime = Root::getSingleton().getTimer()->getMilliseconds();
+	float dt = ((float)(thistime - lasttime))/ 1000.0;
+	lasttime = thistime;
+
+	static float flashChangeTime = 0;
+	flashChangeTime += dt;
+	if( inputDevice->getMouseButton( 0 ) && flashChangeTime > 0.25)
+	{
+		flashChangeTime = 0;
+		mFlashLight->setVisible(!mFlashLight->isVisible());
+	}
+}
+
+bool FPSPlayer::frameStarted(const FrameEvent& evt)
+{
+	float dt = evt.timeSinceLastFrame;
+	
+	static float moveTime=0;
+		
+	float movecameraup = 0;
+	if(mDebug)movecameraup = 2.0;
+
+	if(mMoving)
+	{
+		moveTime += dt;
+		mCamera->setPosition(Vector3(0,mCameraHeight + movecameraup,0) + Vector3(0,0.009 * pow(sin(moveTime*5.0), 2),0));
+	}
+	else
+	{
+		moveTime = 0;
+		mCamera->setPosition(Vector3(0,mCameraHeight + movecameraup,0));
+	}
+		
+	return true;
+}
+
+String FPSPlayer::getAnimStateName(PlayerAnimState as, int option)
+{	
+	return "";
+}
+
+void FPSPlayer::setAnimState(PlayerAnimState as)
+{	
+}
Index: /GTP/trunk/App/Demos/Illum/Ogre/src/SpaceStation/src/SpaceStation.cpp
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/src/SpaceStation/src/SpaceStation.cpp	(revision 2472)
+++ /GTP/trunk/App/Demos/Illum/Ogre/src/SpaceStation/src/SpaceStation.cpp	(revision 2472)
@@ -0,0 +1,66 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+You may use this sample code for anything you like, it is not covered by the
+LGPL like the rest of the engine.
+-----------------------------------------------------------------------------
+*/
+
+/**
+    \file 
+        Lighting.cpp
+    \brief
+        Shows lighting support in OGRE.
+*/
+
+
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+#define WIN32_LEAN_AND_MEAN
+#include "windows.h"
+#endif
+
+#include "SpaceStation.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
+#else
+int main(int argc, char **argv)
+#endif
+{
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+	String args = strCmdLine;
+	if(StringUtil::match(args, "low"))
+		highQuality = false;
+#endif
+    // Create application object
+    SpaceStationApplication app;
+
+    try {
+        app.go();
+    } catch( Ogre::Exception& e ) {
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+        MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
+#else
+        std::cerr << "An exception has occured: " << e.getFullDescription();
+#endif
+    }
+
+    return 0;
+}
+
+#ifdef __cplusplus
+}
+#endif
