Index: /GTP/trunk/App/Demos/Geom/Demo_LodStrips/build/Release/Plugins.cfg
===================================================================
--- /GTP/trunk/App/Demos/Geom/Demo_LodStrips/build/Release/Plugins.cfg	(revision 1536)
+++ /GTP/trunk/App/Demos/Geom/Demo_LodStrips/build/Release/Plugins.cfg	(revision 1536)
@@ -0,0 +1,15 @@
+# Defines plugins to load
+
+# Define plugin folder
+PluginFolder=.
+
+# Define plugins
+Plugin=RenderSystem_Direct3D7
+Plugin=RenderSystem_Direct3D9
+Plugin=RenderSystem_GL
+Plugin=Plugin_ParticleFX
+Plugin=Plugin_BSPSceneManager
+Plugin=Plugin_OctreeSceneManager
+Plugin=Plugin_CgProgramManager
+
+
Index: /GTP/trunk/App/Demos/Geom/Demo_LodStrips/build/Release/terrain.cfg
===================================================================
--- /GTP/trunk/App/Demos/Geom/Demo_LodStrips/build/Release/terrain.cfg	(revision 1536)
+++ /GTP/trunk/App/Demos/Geom/Demo_LodStrips/build/Release/terrain.cfg	(revision 1536)
@@ -0,0 +1,73 @@
+# The main world texture (if you wish the terrain manager to create a material for you)
+WorldTexture=terrain_texture.jpg
+
+# The detail texture (if you wish the terrain manager to create a material for you)
+DetailTexture=terrain_detail.jpg
+
+#number of times the detail texture will tile in a terrain tile
+DetailTile=3
+
+# Heightmap source
+PageSource=Heightmap
+
+# Heightmap-source specific settings
+Heightmap.image=terrain.png
+
+# If you use RAW, fill in the below too
+# RAW-specific setting - size (horizontal/vertical)
+#Heightmap.raw.size=513
+# RAW-specific setting - bytes per pixel (1 = 8bit, 2=16bit)
+#Heightmap.raw.bpp=2
+# Use this if you want to flip the terrain (eg Terragen exports raw upside down)
+#Heightmap.flip=true
+
+# How large is a page of tiles (in vertices)? Must be (2^n)+1
+PageSize=513
+
+# How large is each tile? Must be (2^n)+1 and be smaller than PageSize
+TileSize=65
+
+# The maximum error allowed when determining which LOD to use
+MaxPixelError=3
+
+# The size of a terrain page, in world units
+PageWorldX=1500
+PageWorldZ=1500
+# Maximum height of the terrain 
+MaxHeight=100
+
+# Upper LOD limit
+MaxMipMapLevel=5
+
+VertexNormals=yes
+#VertexColors=yes
+#UseTriStrips=yes
+
+# Use vertex program to morph LODs, if available
+VertexProgramMorph=yes
+
+# The proportional distance range at which the LOD morph starts to take effect
+# This is as a proportion of the distance between the current LODs effective range,
+# and the effective range of the next lower LOD
+LODMorphStart=0.2
+
+# This following section is for if you want to provide your own terrain shading routine
+# Note that since you define your textures within the material this makes the 
+# WorldTexture and DetailTexture settings redundant
+
+# The name of the vertex program parameter you wish to bind the morph LOD factor to
+# this is 0 when there is no adjustment (highest) to 1 when the morph takes it completely
+# to the same position as the next lower LOD
+# USE THIS IF YOU USE HIGH-LEVEL VERTEX PROGRAMS WITH LOD MORPHING
+#MorphLODFactorParamName=morphFactor
+
+# The index of the vertex program parameter you wish to bind the morph LOD factor to
+# this is 0 when there is no adjustment (highest) to 1 when the morph takes it completely
+# to the same position as the next lower LOD
+# USE THIS IF YOU USE ASSEMBLER VERTEX PROGRAMS WITH LOD MORPHING
+#MorphLODFactorParamIndex=4
+
+# The name of the material you will define to shade the terrain
+CustomMaterialName=TestTerrainMaterial
+
+
Index: /GTP/trunk/App/Demos/Geom/Demo_LodStrips/build/Release/quake3settings.cfg
===================================================================
--- /GTP/trunk/App/Demos/Geom/Demo_LodStrips/build/Release/quake3settings.cfg	(revision 1536)
+++ /GTP/trunk/App/Demos/Geom/Demo_LodStrips/build/Release/quake3settings.cfg	(revision 1536)
@@ -0,0 +1,2 @@
+Pak0Location: f:\quake3arena\baseq3\pak0.pk3
+Map: maps/q3dm3.bsp
Index: /GTP/trunk/App/Demos/Geom/Demo_LodStrips/build/Release/resources.cfg
===================================================================
--- /GTP/trunk/App/Demos/Geom/Demo_LodStrips/build/Release/resources.cfg	(revision 1536)
+++ /GTP/trunk/App/Demos/Geom/Demo_LodStrips/build/Release/resources.cfg	(revision 1536)
@@ -0,0 +1,22 @@
+# Resource locations to be added to the 'boostrap' path
+# This also contains the minimum you need to use the Ogre example framework
+[Bootstrap]
+Zip=../../../OgreStuff/media/packs/OgreCore.zip
+
+# Resource locations to be added to the default path
+[General]
+FileSystem=../../../OgreStuff/media
+FileSystem=../../../OgreStuff/media/fonts
+FileSystem=../../../OgreStuff/media/materials/programs
+FileSystem=../../../OgreStuff/media/materials/scripts
+FileSystem=../../../OgreStuff/media/materials/textures
+FileSystem=../../../OgreStuff/media/models
+FileSystem=../../../OgreStuff/media/overlays
+FileSystem=../../../OgreStuff/media/particle
+FileSystem=../../../OgreStuff/media/gui
+FileSystem=../../../OgreStuff/media/GT
+Zip=../../../OgreStuff/media/packs/cubemap.zip
+Zip=../../../OgreStuff/media/packs/cubemapsJS.zip
+Zip=../../../OgreStuff/media/packs/fresneldemo.zip
+Zip=../../../OgreStuff/media/packs/ogretestmap.zip
+Zip=../../../OgreStuff/media/packs/skybox.zip
Index: /GTP/trunk/App/Demos/Geom/Demo_LodStrips/main.cpp
===================================================================
--- /GTP/trunk/App/Demos/Geom/Demo_LodStrips/main.cpp	(revision 1529)
+++ /GTP/trunk/App/Demos/Geom/Demo_LodStrips/main.cpp	(revision 1536)
@@ -18,5 +18,5 @@
 
 // Distance values
-#define dist_min 1200
+#define dist_min 1100
 #define dist_max 2000
 
@@ -38,70 +38,7 @@
 Camera* theCam;
 Entity* pPlaneEnt;
-std::vector<Entity*> belowWaterEnts;
-std::vector<Entity*> aboveWaterEnts;
-
-Plane reflectionPlane;
 
 OverlayElement* mInfo;
 OverlayElement* mInfo2;
-
-class RefractionTextureListener : public RenderTargetListener
-{
-public:
-    void preRenderTargetUpdate(const RenderTargetEvent& evt)
-    {
-        // Hide plane and objects above the water
-        pPlaneEnt->setVisible(false);
-        std::vector<Entity*>::iterator i, iend;
-        iend = aboveWaterEnts.end();
-        for (i = aboveWaterEnts.begin(); i != iend; ++i)
-        {
-            (*i)->setVisible(false);
-        }
-
-    }
-    void postRenderTargetUpdate(const RenderTargetEvent& evt)
-    {
-        // Show plane and objects above the water
-        pPlaneEnt->setVisible(true);
-        std::vector<Entity*>::iterator i, iend;
-        iend = aboveWaterEnts.end();
-        for (i = aboveWaterEnts.begin(); i != iend; ++i)
-        {
-            (*i)->setVisible(true);
-        }
-    }
-
-};
-class ReflectionTextureListener : public RenderTargetListener
-{
-public:
-    void preRenderTargetUpdate(const RenderTargetEvent& evt)
-    {
-        // Hide plane and objects below the water
-        pPlaneEnt->setVisible(false);
-        std::vector<Entity*>::iterator i, iend;
-        iend = belowWaterEnts.end();
-        for (i = belowWaterEnts.begin(); i != iend; ++i)
-        {
-            (*i)->setVisible(false);
-        }
-        theCam->enableReflection(reflectionPlane);
-
-    }
-    void postRenderTargetUpdate(const RenderTargetEvent& evt)
-    {
-        // Show plane and objects below the water
-        pPlaneEnt->setVisible(true);
-        std::vector<Entity*>::iterator i, iend;
-        iend = belowWaterEnts.end();
-        for (i = belowWaterEnts.begin(); i != iend; ++i)
-        {
-            (*i)->setVisible(true);
-        }
-        theCam->disableReflection();
-    }
-
-};
 
 class CustomIndexData : public Geometry::IndexData
@@ -197,10 +134,9 @@
 
 		static float lodfactorBefore = -1.0f;
-		if (fabsf(lodfactorBefore-lodfactor)>0.05f || 
+		if (fabsf(lodfactorBefore-lodfactor)>0.03f || 
 			(lodfactorBefore>0.0f && lodfactor==0.0f) ||
 			(lodfactorBefore<1.0f && lodfactor==1.0f))
 		{
 			myStrips->GoToLod(lodfactor);
-//			DumpDataToOgreBuffers(ogreMesh,myStrips);
 			lodfactorBefore=lodfactor;
 		}
@@ -281,21 +217,12 @@
 };
 
-class FresnelApplication : public ExampleApplication
+class LodStripsApplication : public ExampleApplication
 {
 protected:
-    RefractionTextureListener mRefractionListener;
-    ReflectionTextureListener mReflectionListener;
 public:
-    FresnelApplication() {
-    
-    
-    }
-
-    ~FresnelApplication() 
-    {
-    }
+    LodStripsApplication() {}
+    ~LodStripsApplication() {}
+
 protected:
-    
-
 
     // Just override the mandatory create scene method
@@ -305,70 +232,16 @@
 
 		mat = new MaterialPtr[1];
-		
-	    // Check prerequisites first
-		const RenderSystemCapabilities* caps = Root::getSingleton().getRenderSystem()->getCapabilities();
-        if (!caps->hasCapability(RSC_VERTEX_PROGRAM) || !(caps->hasCapability(RSC_FRAGMENT_PROGRAM)))
-        {
-            OGRE_EXCEPT(1, "Your card does not support vertex and fragment programs, so cannot "
-                "run this demo. Sorry!", 
-                "Fresnel::createScene");
-        }
-        else
-        {
-            if (!GpuProgramManager::getSingleton().isSyntaxSupported("arbfp1") &&
-                !GpuProgramManager::getSingleton().isSyntaxSupported("ps_2_0") &&
-				!GpuProgramManager::getSingleton().isSyntaxSupported("ps_1_4")
-				)
-            {
-                OGRE_EXCEPT(1, "Your card does not support advanced fragment programs, "
-                    "so cannot run this demo. Sorry!", 
-                "Fresnel::createScene");
-            }
-        }
 
         theCam = mCamera;
-        theCam->setPosition(0,20,dist_min-600.0f);
+        theCam->setPosition(0,-100,dist_min-600.0f);
         // Set ambient light
         mSceneMgr->setAmbientLight(ColourValue(0.3, 0.3, 0.3));
 
-        // Create a point light
+        // Create a directional light
         Light* l = mSceneMgr->createLight("MainLight");
         l->setType(Light::LT_DIRECTIONAL);
         l->setDirection(0.0,0.0,-1.0);
-
        
-        RenderTexture* rttTex = mRoot->getRenderSystem()->createRenderTexture( "Refraction", 512, 512 );
-		
-        {
-            Viewport *v = rttTex->addViewport( mCamera );
-            MaterialPtr mat = MaterialManager::getSingleton().getByName("Examples/FresnelReflectionRefraction");
-            mat->getTechnique(0)->getPass(0)->getTextureUnitState(2)->setTextureName("Refraction");
-            v->setOverlaysEnabled(false);
-            rttTex->addListener(&mRefractionListener);
-        }
-        
-		
-        rttTex = mRoot->getRenderSystem()->createRenderTexture( "Reflection", 512, 512 );
-        {
-            Viewport *v = rttTex->addViewport( mCamera );
-            MaterialPtr mat = MaterialManager::getSingleton().getByName("Examples/FresnelReflectionRefraction");
-            mat->getTechnique(0)->getPass(0)->getTextureUnitState(1)->setTextureName("Reflection");
-            v->setOverlaysEnabled(false);
-            rttTex->addListener(&mReflectionListener);
-        }
-        
-        
-        // Define a floor plane mesh
-        reflectionPlane.normal = Vector3::UNIT_Y;
-        reflectionPlane.d = 0;
-        MeshManager::getSingleton().createPlane("ReflectPlane",
-            ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
-            reflectionPlane,
-            9000,9000,10,10,true,1,5,5,Vector3::UNIT_Z);
-        pPlaneEnt = mSceneMgr->createEntity( "plane", "ReflectPlane" );
-        pPlaneEnt->setMaterialName("Examples/FresnelReflectionRefraction");
-        mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(pPlaneEnt);
-
-        
+       
         mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox");
 
@@ -377,8 +250,6 @@
 
 
-        // Now the below water ents
         pEnt = mSceneMgr->createEntity( "PoolFloor", "PoolFloor.mesh" );
         myRootNode->attachObject(pEnt);
-        belowWaterEnts.push_back(pEnt);
 		myRootNode->scale(6.0,6.0,6.0);
 
@@ -410,9 +281,8 @@
 		
 		entity->setNormaliseNormals(true);
-		aboveWaterEnts.push_back(entity);
 		entity->setMaterialName("LODStripsDemo/Ogro");
 
-		for (int i=-3; i<7; i++) // 7
-			for (int j=0; j<4; j++) // 4
+		for (int i=-3; i<6; i++) // 7
+			for (int j=0; j<10; j++) // 4
 			{
 				char newObjName[16]="";
@@ -425,5 +295,5 @@
 				float randomsepx = (float)((rand()%18)-9);
 				float randomsepy = (float)((rand()%12)-6);
-				auxnode->translate(i*70.0f+randomsepx,-1.0f,-j*70.0f-randomsepx);
+				auxnode->translate(i*70.0f+randomsepx,-150.0f,-j*70.0f-randomsepx);
 				auxen->setNormaliseNormals(true);
 			}
@@ -466,5 +336,5 @@
 {
     // Create application object
-    FresnelApplication app;
+    LodStripsApplication app;
 
     try {
Index: /GTP/trunk/App/Demos/Geom/Demo_LodStrips/README.txt
===================================================================
--- /GTP/trunk/App/Demos/Geom/Demo_LodStrips/README.txt	(revision 1536)
+++ /GTP/trunk/App/Demos/Geom/Demo_LodStrips/README.txt	(revision 1536)
@@ -0,0 +1,13 @@
+Overview
+--------
+
+This demo shows an example of the LODStrips model in action. The models in the scene
+are associated to a LodStrips object that manage their level of detail. 
+The level of detail of the objects depend on the distance to the camera. When the 
+camera goes away from them, the level of detail decreases, and when the camera gets 
+closer to them the level of detail increases to restore the original geometry of the
+model.
+
+The level of detail begins to decrease at a certain distance of the crowd, and stops
+decreasing when the objects reach the their minimum LOD. This 'lodding' distance is
+customizable from the source code of the demo.
