Index: GTP/trunk/Lib/Illum/shared/scripts/GTPIllumination.sln
===================================================================
--- GTP/trunk/Lib/Illum/shared/scripts/GTPIllumination.sln	(revision 848)
+++ GTP/trunk/Lib/Illum/shared/scripts/GTPIllumination.sln	(revision 1062)
@@ -6,13 +6,7 @@
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IllumModule_Ogre", "..\..\IllumModule\OgreIllumModule\scripts\OgreIllumModule.vcproj", "{109F610E-9B23-4D05-819E-A7F27A42AA94}"
 	ProjectSection(ProjectDependencies) = postProject
-		{109F610E-9B23-4D05-819E-A7F27A42AA94} = {109F610E-9B23-4D05-819E-A7F27A42AA94}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GameToolsParticleDemo", "..\..\..\..\App\Demos\Illum\Ogre\src\GameToolsParticleDemo\scripts\GameToolsParticleDemo.vcproj", "{09F9E809-02CF-4926-8203-2B9C02FBD916}"
-	ProjectSection(ProjectDependencies) = postProject
-		{109F610E-9B23-4D05-819E-A7F27A42AA94} = {109F610E-9B23-4D05-819E-A7F27A42AA94}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GameToolsRaytraceDemo", "..\..\..\..\App\Demos\Illum\Ogre\src\GameToolsRaytraceDemo\scripts\GameToolsRaytraceDemo.vcproj", "{09F9E809-02CF-4926-8203-2B9C02FBD916}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HPSDEMO", "..\..\..\..\App\Demos\Illum\Ogre\src\HierarchicalSystem\scripts\HierarchicalSystem.vcproj", "{09F9E809-02CF-4926-8203-2B9C02FBD916}"
 	ProjectSection(ProjectDependencies) = postProject
 		{109F610E-9B23-4D05-819E-A7F27A42AA94} = {109F610E-9B23-4D05-819E-A7F27A42AA94}
@@ -37,8 +31,4 @@
 		{09F9E809-02CF-4926-8203-2B9C02FBD916}.Release.ActiveCfg = Release|Win32
 		{09F9E809-02CF-4926-8203-2B9C02FBD916}.Release.Build.0 = Release|Win32
-		{09F9E809-02CF-4926-8203-2B9C02FBD916}.Debug.ActiveCfg = Debug|Win32
-		{09F9E809-02CF-4926-8203-2B9C02FBD916}.Debug.Build.0 = Debug|Win32
-		{09F9E809-02CF-4926-8203-2B9C02FBD916}.Release.ActiveCfg = Release|Win32
-		{09F9E809-02CF-4926-8203-2B9C02FBD916}.Release.Build.0 = Release|Win32
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
Index: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/OgreIlluminationManager.h
===================================================================
--- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/OgreIlluminationManager.h	(revision 1055)
+++ GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/OgreIlluminationManager.h	(revision 1062)
@@ -14,4 +14,6 @@
 #include "OgreDepthShadowRecieverRenderTechnique.h"
 #include "OgreFireRenderTechnique.h"
+#include "OgreHierarchicalParticleSystemTechnique.h"
+
 
 
Index: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreHierarchicalParticleSystemTechnique.h
===================================================================
--- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreHierarchicalParticleSystemTechnique.h	(revision 1055)
+++ GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreHierarchicalParticleSystemTechnique.h	(revision 1062)
@@ -47,4 +47,5 @@
 	//inherited
 	RenderingRun* createChildPSysRenderingRun();
+	virtual void impostorChanged(RenderingRun* run);
 };
 
Index: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreRenderable.cpp
===================================================================
--- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreRenderable.cpp	(revision 1055)
+++ GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreRenderable.cpp	(revision 1062)
@@ -35,5 +35,5 @@
 	parentParticleSystem = sys;
 	updateBounds();
-	name = billboardset->getName();
+	name = sys->getName();
 }
 
@@ -136,7 +136,10 @@
 		 break;
 	 case OGRE_RENDERABLETYPE_BILLBOARDSET:
-		 billboardSetRenderable->getParentSceneNode()->_updateBounds();
+		/* billboardSetRenderable->getParentSceneNode()->_updateBounds();
 		 boundingBox = billboardSetRenderable->getWorldBoundingBox(true);
-		 boundingSphere = billboardSetRenderable->getWorldBoundingSphere(true);
+		 boundingSphere = billboardSetRenderable->getWorldBoundingSphere(true);*/
+		 parentParticleSystem->getParentSceneNode()->_updateBounds();
+		 boundingBox = parentParticleSystem->getWorldBoundingBox(true);
+		 boundingSphere = parentParticleSystem->getWorldBoundingSphere(true);
 		 break;
 	default:
Index: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgreChildParticlesystemRenderingRun.cpp
===================================================================
--- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgreChildParticlesystemRenderingRun.cpp	(revision 1055)
+++ GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgreChildParticlesystemRenderingRun.cpp	(revision 1062)
@@ -47,4 +47,5 @@
 	 RenderTarget* rt = hpb->getRenderTarget();
 	 Viewport* v = rt->addViewport(impostorCamera);
+	 v->setBackgroundColour(ColourValue(0,1,0,0));
 	 v->setOverlaysEnabled(false);
 	 rt->setAutoUpdated(false);
@@ -60,4 +61,5 @@
 	rq->clear();
 
+	sharedRuns->getRoot()->updateBounds();
 	Sphere boundSphere = ((OgreSharedRuns*)sharedRuns->getRoot(ILLUMRUN_HPP_IMPOSTOR))->getBoundingSphere();
 	Camera* mainCam = OgreIlluminationManager::getSingleton().getMainCamera();
@@ -65,4 +67,5 @@
 	Vector3 dir = boundSphere.getCenter() - mainCam->getPosition();
 	float r = boundSphere.getRadius();
+	r = 200;
 	float d = dir.normalise();
 	impostorCamera->setDirection(dir);
@@ -72,8 +75,8 @@
 		impostorCamera->setProjectionType(PT_PERSPECTIVE);
 		impostorCamera->setAspectRatio(1.0);
-		Radian a = Math::ASin(r / d);
-		impostorCamera->setFOVy(a * 2.0);
-		impostorCamera->setNearClipDistance(std::max(0.01f, d - r));
-		impostorCamera->setFarClipDistance(r + d);		
+		Radian a = Math::ASin(r / d) * 2.0;
+		impostorCamera->setFOVy(/*a*/ Radian(Degree(90)));
+		impostorCamera->setNearClipDistance(/*std::max(0.01f, d - r)*/0.1);
+		impostorCamera->setFarClipDistance(/*r + d*/1000);		
 	}
 	else
@@ -100,13 +103,12 @@
 	rt->update();	
 	
-	/*
-		static int framecount = 0;
-		String filename = "photon";
-		filename.append(this->name);
-		//filename.append(StringConverter::toString(framecount));
-		filename.append(".png");
-		rt->writeContentsToFile(filename);
-		framecount++;
-	*/
+	
+	static int framecount = 0;
+	String filename = "impostor";
+	filename.append(this->name);
+	//filename.append(StringConverter::toString(framecount));
+	filename.append(".dds");
+	rt->writeContentsToFile(filename);
+	framecount++;	
 	
 	if(!useOwnMaterial)
Index: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreHierarchicalParticleSystemTechnique.cpp
===================================================================
--- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreHierarchicalParticleSystemTechnique.cpp	(revision 1055)
+++ GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreHierarchicalParticleSystemTechnique.cpp	(revision 1062)
@@ -24,15 +24,17 @@
 	this->childPSysScriptName = childPSysScriptName;
 	this->impostorMaterialName = impostorMaterialName;
-														
+	this->useOwnMaterial = useOwnMaterial;
+	
+	//create the Particle system
+	childPSysName = parentOgreRenderable->getName() + "_small_PSYS";
+	ParticleSystem* psys = Root::getSingleton()._getCurrentSceneManager()->createParticleSystem(childPSysName, childPSysScriptName);
+	SceneNode* node = Root::getSingleton()._getCurrentSceneManager()->getRootSceneNode()->createChildSceneNode();
+	node->attachObject(psys);
+	psys->setVisible(false);
 	
 	if(sharedRuns->getRun(ILLUMRUN_HPP_IMPOSTOR) == 0)
 		sharedRuns->addRun(ILLUMRUN_HPP_IMPOSTOR, createChildPSysRenderingRun());	
 
-	//create the Particle system
-	String name = parentOgreRenderable->getName() + "_small_PSYS";
-	ParticleSystem* psys = Root::getSingleton()._getCurrentSceneManager()->createParticleSystem(name, childPSysScriptName);
-	SceneNode* node = Root::getSingleton()._getCurrentSceneManager()->getRootSceneNode()->createChildSceneNode();
-	node->attachObject(psys);
-	psys->setVisible(false);
+	impostorChanged(sharedRuns->getRun(ILLUMRUN_HPP_IMPOSTOR));
 }
 
@@ -41,4 +43,10 @@
 {
 
+}
+
+void OgreHierarchicalParticleSystemTechnique::impostorChanged(RenderingRun* run)
+{
+	OgreChildPSystemRenderingRun* r = (OgreChildPSystemRenderingRun*) run->asOgreRenderingRun();
+	pass->getTextureUnitState(impostorTexID)->setTextureName(r->getImpostorTextureName());
 }
 
@@ -178,2 +186,3 @@
 }
 
+
Index: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreIlluminationManager.cpp
===================================================================
--- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreIlluminationManager.cpp	(revision 1055)
+++ GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreIlluminationManager.cpp	(revision 1062)
@@ -102,4 +102,6 @@
 	OgreFireRenderTechniqueFactory* fire = new OgreFireRenderTechniqueFactory();
 		addRenderTechniqueFactory(fire);
+	OgreHierarchicalParticleSystemTechniqueFactory* HPSF = new OgreHierarchicalParticleSystemTechniqueFactory();
+		addRenderTechniqueFactory(HPSF);
 }
 
Index: GTP/trunk/Lib/Illum/IllumModule/IllumModule/include/RenderTechniques/HierarchicalParticleSystemTechnique.h
===================================================================
--- GTP/trunk/Lib/Illum/IllumModule/IllumModule/include/RenderTechniques/HierarchicalParticleSystemTechnique.h	(revision 1055)
+++ GTP/trunk/Lib/Illum/IllumModule/IllumModule/include/RenderTechniques/HierarchicalParticleSystemTechnique.h	(revision 1062)
@@ -27,4 +27,7 @@
 	void update(unsigned long frameNum);
 
+	//inherited
+	void runChanged(RenderingRunType runType, RenderingRun* run);
+
 protected:
 	unsigned long impostorUpdateInterval;
@@ -38,4 +41,5 @@
 
 	virtual RenderingRun* createChildPSysRenderingRun()=0;
+	virtual void impostorChanged(RenderingRun* run) = 0;
 	
 };
Index: GTP/trunk/Lib/Illum/IllumModule/IllumModule/src/RenderTechniques/HierarchicalParticleSystemTechnique.cpp
===================================================================
--- GTP/trunk/Lib/Illum/IllumModule/IllumModule/src/RenderTechniques/HierarchicalParticleSystemTechnique.cpp	(revision 1055)
+++ GTP/trunk/Lib/Illum/IllumModule/IllumModule/src/RenderTechniques/HierarchicalParticleSystemTechnique.cpp	(revision 1062)
@@ -29,3 +29,8 @@
 }
 
+void HierarchicalParticleSystemTechnique::runChanged(RenderingRunType runType, RenderingRun* run)
+{
+	if(runType == ILLUMRUN_HPP_IMPOSTOR)
+		impostorChanged(run);
+}
 
