Index: /GTP/trunk/App/Demos/Illum/Ogre/src/ReflectionTest/include/ReflectionTest.h
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/src/ReflectionTest/include/ReflectionTest.h	(revision 2095)
+++ /GTP/trunk/App/Demos/Illum/Ogre/src/ReflectionTest/include/ReflectionTest.h	(revision 2140)
@@ -29,16 +29,23 @@
 #include "SpriteParticleRenderer.h"
 #include "FrameCapture.h"
-
-float refIndex = 0.77;
-int scene = 3;
+#include "OgreCausticCubeMapRenderingRun.h"
+
+float worldSizeVar = 0.002;
+float refIndex = 0.995;
+int scene = 1;
 FrameCapture* capture;
 
 bool multiplebounce = true;
-
-int currentMaterial = 2;
-int currentObject = 2;
+bool useCauInt = true;
+
+int currentMaterial = 3;
+int currentObject = 1;
 String objectNames[] = {String("sphere.mesh"),
                         String("teapot.mesh"),
-						String("buddha.mesh")};
+						String("buddha.mesh"),
+						String("head.mesh")};
+
+float objectscales[] = {0.01,1,1,0.1};
+float scenescales[] = {0.3,1, 2.7};
 
 String materialNames[] = {String("GTP/MultiBounce/Reflector"),
@@ -47,5 +54,7 @@
 							String("GTP/MultiBounce/Reflector_MinMax"),
 							String("GTP/MultiBounce/Refractor_MinMax"),
-							String("GTP/MultiBounce/CausticRefractor_MinMax")};
+							String("GTP/MultiBounce/CausticRefractor_MinMax"),
+							String("semmi")
+							};
                         
 String resourceGroupName[] = {	String("GTP_MultipleReflection"),
@@ -54,5 +63,6 @@
 								String("GTP_MultipleReflection_MinMax"),
 								String("GTP_MultipleRefraction_MinMax"),
-								String("GTP_MultipleRefraction_MinMax")};
+								String("GTP_MultipleRefraction_MinMax"),
+								String("GTP_Basic")};
 
 // Listener class for frame updates
@@ -62,12 +72,14 @@
 	unsigned long framecount;
 	SceneNode* objectNode;
+	Entity *object;
 	
 public:
 	void setMoveSpeed(float speed){mMoveSpeed = speed;}
-    RaytraceDemoListener(RenderWindow* window, Camera* maincam, SceneNode* objectNode)
+    RaytraceDemoListener(RenderWindow* window, Camera* maincam, SceneNode* objectNode, Entity* object)
         :ExampleFrameListener(window, maincam) 
 				 
     {
-		this->mMoveSpeed = 0.1;
+		this->object = object;
+		this->mMoveSpeed = 1;
 		if(scene == 2)
 		this->mMoveSpeed = 1.0;
@@ -99,9 +111,59 @@
 		float thisTime = (float) Root::getSingleton().getTimer()->getMilliseconds() / 1000.0f;
 		float elapsed = thisTime - lastTime;
-		float move = elapsed * 0.25;
-		if(scene == 3)
+		float move = elapsed * 0.5;
+		if(scene == 3 )
 			move *= 10;
 		float rotate = 80.0 * move;
-
+		if (mInputDevice->isKeyDown(KC_G))
+        {
+			worldSizeVar -= 0.002;
+			if(worldSizeVar < 0.002)worldSizeVar = 0.002;
+			MaterialPtr mat = MaterialManager::getSingleton().getByName("GTP/MultiBounce/CauCube_Trianglesobject_SE_0_clone");
+			if(!mat.isNull())
+			{
+				GpuProgramParameters* Vparams = mat->getTechnique(0)->getPass(0)->getVertexProgramParameters().getPointer();
+			  Vparams->setNamedConstant("WorldSize", worldSizeVar);
+			}
+		}
+		if (mInputDevice->isKeyDown(KC_H))
+        {
+			worldSizeVar += 0.002;
+			MaterialPtr mat = MaterialManager::getSingleton().getByName("GTP/MultiBounce/CauCube_Trianglesobject_SE_0_clone");
+			if(!mat.isNull())
+			{
+				GpuProgramParameters* Vparams = mat->getTechnique(0)->getPass(0)->getVertexProgramParameters().getPointer();
+			  Vparams->setNamedConstant("WorldSize", worldSizeVar);
+			}
+		}
+		if (mInputDevice->isKeyDown(KC_I) && mTimeUntilNextToggle <= 0)
+        {			
+			useCauInt = !useCauInt;
+
+			MaterialPtr mat = MaterialManager::getSingleton().getByName("GTP/MultiBounce/CauCube_Trianglesobject_SE_0_clone");
+			if(!mat.isNull())
+			{
+			  GpuProgramParameters* Vparams = mat->getTechnique(0)->getPass(0)->getVertexProgramParameters().getPointer();
+			  Vparams->setNamedConstant("notUseIntensity", !useCauInt);
+			  if(useCauInt)
+			  {
+				  mat->getTechnique(0)->getPass(0)->setPolygonMode(PM_SOLID);
+				  OgreTechniqueGroup* tg = (OgreTechniqueGroup*) object->getSubEntity(0)->getRenderTechniqueGroup();
+				  OgreCausticCubeMapRenderingRun* rr = (OgreCausticCubeMapRenderingRun*) 
+								tg->getSharedRuns()->getRun(ILLUMRUN_CAUSTIC_CUBEMAP)
+								->asOgreRenderingRun();
+				  rr->setBlurMap(true);
+			  }
+			  else
+			  {
+				   mat->getTechnique(0)->getPass(0)->setPolygonMode(PM_POINTS);
+				   OgreTechniqueGroup* tg = (OgreTechniqueGroup*) object->getSubEntity(0)->getRenderTechniqueGroup();
+				  OgreCausticCubeMapRenderingRun* rr = (OgreCausticCubeMapRenderingRun*) 
+								tg->getSharedRuns()->getRun(ILLUMRUN_CAUSTIC_CUBEMAP)
+								->asOgreRenderingRun();
+				  rr->setBlurMap(false);
+			  }
+			}
+			mTimeUntilNextToggle = 1;
+        }
 		if (mInputDevice->isKeyDown(KC_J))
         {			
@@ -114,5 +176,6 @@
 			  Fparams1->setNamedConstant("refIndex", refIndex);
 			}
-			MaterialPtr mat2 = MaterialManager::getSingleton().getByName("GTP/MultiBounce/PhotonMap");
+			//MaterialPtr mat2 = MaterialManager::getSingleton().getByName("GTP/MultiBounce/PhotonMap");
+			MaterialPtr mat2 = MaterialManager::getSingleton().getByName("GTP/Caustic/PhotonMap_HitEnv");
 			if(!mat2.isNull())
 			{
@@ -131,5 +194,6 @@
 			  Fparams1->setNamedConstant("refIndex", refIndex);
 			}
-			MaterialPtr mat2 = MaterialManager::getSingleton().getByName("GTP/MultiBounce/PhotonMap");
+			//MaterialPtr mat2 = MaterialManager::getSingleton().getByName("GTP/MultiBounce/PhotonMap");
+			MaterialPtr mat2 = MaterialManager::getSingleton().getByName("GTP/Caustic/PhotonMap_HitEnv");
 			if(!mat2.isNull())
 			{
@@ -336,7 +400,22 @@
 			ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_MultipleCausticRefraction_MinMax");
 	}
+  Entity* object;
+
+    void createPostproc()
+	{		
+		CompositorManager::getSingleton().addCompositor(mWindow->getViewport(0),
+														"GTP/PostProc/Glow");
+		CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0),
+														"GTP/PostProc/Glow", true);
+/*
+		CompositorManager::getSingleton().addCompositor(mWindow->getViewport(0),
+														"GTP/PostProc/ToneMap");
+		CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0),
+														"GTP/PostProc/ToneMap", true);	*/	
+	}
 
 	void createScene(void)
     {
+		createPostproc();
 
 		OgreIlluminationManager::getSingleton().setMainCamera(mCamera);
@@ -372,6 +451,5 @@
 		mCamera->getParentSceneNode()->translate(1.1,0.8,1.0);
 		//mCamera->lookAt(Vector3(0,1.2,0.0));
-		
-		Entity* object;
+			
 		object = mSceneMgr->createEntity("object", objectNames[currentObject]);
 		 
@@ -380,9 +458,6 @@
 		objectNode->attachObject(object);
 		
-		if(currentObject == 1)
-			objectNode->scale(0.5,0.5,0.5);
-		if(currentObject == 0)
-			objectNode->scale(0.005,0.005,0.005);
-		//objectNode->scale(0.005,0.005,0.005);
+		float scale = objectscales[currentObject] * scenescales[scene-1];
+		objectNode->scale(scale, scale, scale);		
 		
 		objectNode->setPosition(0,1.2,0);
@@ -395,8 +470,9 @@
 		//room->setMaterialName("GameTools/Phong");
 		SceneNode* roomNode = rootNode->createChildSceneNode();
-		roomNode->attachObject(room);
+		roomNode->attachObject(room);		
 		roomNode->_updateBounds();		
 
 		mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE);
+	
 		Light* redLight1 = mSceneMgr->createLight("RedLight1");
 		redLight1->setType(Light::LT_POINT);
@@ -421,5 +497,5 @@
 		mainBlueLight->setCastShadows(true);
         mainBlueLight->setDiffuseColour(ColourValue(0.395,0.766, 1.0));
-		mainBlueLight->setPowerScale(5.0);
+		mainBlueLight->setPowerScale(3.0);
 		mainBlueLight->setSpotlightRange(Degree(0),Degree(160));
 		mainBlueLight->setAttenuation(2.5, 0, 1, 0);
@@ -431,4 +507,22 @@
 		mainBlueLight->setDirection(-1.5,-2.0,1.0);
 		mainBlueLightNode->attachObject(mainBlueLight);
+/*
+		Light* mainLight = mSceneMgr->createLight("MainLight");
+		mainLight->setType(Light::LT_SPOTLIGHT);
+		mainLight->setSpotlightRange(Degree(0),Degree(160));
+		mainLight->setCastShadows(false);
+        mainLight->setDiffuseColour(ColourValue(0.995,0.996, 0.80));
+		mainLight->setPowerScale(1.0);
+		mainLight->setAttenuation(3, 0, 1, 0);
+		SceneNode* mainLightNode = rootNode->createChildSceneNode();
+		mainLightNode->setPosition(0,2.5,0);
+		mainLight->setDirection(0,-1.0,0);
+		mainLightNode->attachObject(mainLight);*/
+/*
+		BillboardSet* bbs = mSceneMgr->createBillboardSet("bb", 1);
+		bbs->setDefaultDimensions(0.2, 0.2);
+		bbs->createBillboard(Vector3::ZERO, ColourValue::White);
+		bbs->setMaterialName("Flare");
+		mainLightNode->attachObject(bbs);*/
    }
 
@@ -440,5 +534,5 @@
 		//mCamera->lookAt(Vector3(0,5.75,0.0));
 		
-		Entity* object = mSceneMgr->createEntity("object", "teapot.mesh");
+		object = mSceneMgr->createEntity("object", "teapot.mesh");
 		object->setMaterialName("MetalTeapotMultipleBounce");
 		objectNode = rootNode->createChildSceneNode();
@@ -465,5 +559,5 @@
 		LightNode1->attachObject(Light1);		
    }
-
+		
 	void createScene3(void)
     {	   
@@ -475,5 +569,4 @@
 		mCamera->setPosition(7.0,2.6,-0.5);
 		mCamera->lookAt(Vector3(1.0, 0.0,0.6));
-		Entity* object;
 		
 		object = mSceneMgr->createEntity("object", objectNames[currentObject]);
@@ -483,15 +576,7 @@
 		objectNode->attachObject(object);
 
-		if(currentObject == 1)
-		{
-		  objectNode->scale(2.7,2.7,2.7);
-		  objectNode->setPosition(0,0.7,0.0);
-		}
-		if(currentObject == 0)
-		{
-		  objectNode->scale(0.027,0.027,0.027);		
-		  objectNode->setPosition(1,0.0,1.0);
-		}
-
+		float scale = objectscales[currentObject] * scenescales[scene-1];
+		objectNode->scale(scale, scale, scale);
+		
 		objectNode->_updateBounds();
 
@@ -525,5 +610,5 @@
     {
 		// This is where we instantiate our own frame listener
-		mFrameListener= new RaytraceDemoListener(mWindow, mCamera, objectNode);
+		mFrameListener= new RaytraceDemoListener(mWindow, mCamera, objectNode, object);
 		mFrameListener->setPriority(1);
 		OgreIlluminationManager::getSingleton().setPriority(3);
