Index: GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/Plugins.cfg
===================================================================
--- GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/Plugins.cfg	(revision 1540)
+++ GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/Plugins.cfg	(revision 1540)
@@ -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_LodTrees/build/Release/ogre.cfg
===================================================================
--- GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/ogre.cfg	(revision 1540)
+++ GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/ogre.cfg	(revision 1540)
@@ -0,0 +1,7 @@
+Render System	OpenGL Rendering Subsystem
+Colour Depth	32
+Display Frequency	60
+FSAA	0
+Full Screen	Yes
+VSync	No
+Video Mode	1024 x 768
Index: GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/terrain.cfg
===================================================================
--- GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/terrain.cfg	(revision 1540)
+++ GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/terrain.cfg	(revision 1540)
@@ -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_LodTrees/build/Release/quake3settings.cfg
===================================================================
--- GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/quake3settings.cfg	(revision 1540)
+++ GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/quake3settings.cfg	(revision 1540)
@@ -0,0 +1,2 @@
+Pak0Location: f:\quake3arena\baseq3\pak0.pk3
+Map: maps/q3dm3.bsp
Index: GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/resources.cfg
===================================================================
--- GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/resources.cfg	(revision 1540)
+++ GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/resources.cfg	(revision 1540)
@@ -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_LodTrees/build/Release/media.cfg
===================================================================
--- GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/media.cfg	(revision 1540)
+++ GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/media.cfg	(revision 1540)
@@ -0,0 +1,16 @@
+Mesh=ogrehead.mesh
+Mesh=geosphere4500.mesh
+Mesh=razor.mesh
+Mesh=knot.mesh
+Mesh=RZR-002.mesh
+Mesh=geosphere8000.mesh
+Mesh=sphere.mesh
+
+CubeMap=cubescene.jpg
+CubeMap=early_morning.jpg
+CubeMap=cubemap.jpg
+CubeMap=morning.jpg
+CubeMap=cloudy_noon.jpg
+CubeMap=evening.jpg
+CubeMap=stormy.jpg
+CubeMap=stevecube.jpg
Index: GTP/trunk/App/Demos/Geom/Demo_LodTrees/main.cpp
===================================================================
--- GTP/trunk/App/Demos/Geom/Demo_LodTrees/main.cpp	(revision 1529)
+++ GTP/trunk/App/Demos/Geom/Demo_LodTrees/main.cpp	(revision 1540)
@@ -43,45 +43,6 @@
 
 
-/*void DumpDataToOgreBuffers(Ogre::Mesh *original_mesh, Geometry::LodTreeLibrary *lodTreesLib)
-{
-	// Copy to Ogre buffers including the degenerated triangles
-	Ogre::HardwareIndexBufferSharedPtr	ibuf;
-	Ogre::IndexData	*indexes;
-	Ogre::RenderOperation mRenderOp;
-
-	for (int submesh=0; submesh < original_mesh->getNumSubMeshes(); submesh++)
-	{
-		bool istrunk = lodTreesLib->GetLeavesSubMesh()!=submesh;
-		original_mesh->getSubMesh(submesh)->_getRenderOperation(mRenderOp,0);
-
-		// we will suppose this submesh is the foliage
-		int indices_to_render = lodTreesLib->CurrentLOD_Foliage_IndexCount();		
-		int offset = 0;
-
-		if (istrunk)
-		{
-			// this submesh is the trunk
-			offset = lodTreesLib->GetValidTrunkOffset(submesh);
-			indices_to_render = lodTreesLib->GetValidTrunkIndexCount(submesh);
-		}
-
-		ibuf = mRenderOp.indexData->indexBuffer;
-		mRenderOp.indexData->indexStart = 0;
-		mRenderOp.indexData->indexCount = indices_to_render;		
-
-		unsigned long* pIdx = static_cast<unsigned long*>(ibuf->lock(Ogre::HardwareBuffer::HBL_NORMAL));
-
-		for (int k=0; k<indices_to_render; k++)
-			if (istrunk)
-				pIdx[k] = lodTreesLib->CurrentLOD_Trunk_Indices()->GetIndex(k+offset);
-			else
-				pIdx[k] = lodTreesLib->CurrentLOD_Foliage_Indices()->GetIndex(k);
-
-			
-		ibuf->unlock();
-	}
-}*/
-
-class FresnelFrameListener : public ExampleFrameListener
+
+class LodTreeFrameListener : public ExampleFrameListener
 {
 	int manage;
@@ -89,5 +50,5 @@
 public:
 
-    FresnelFrameListener(RenderWindow* win, Camera* cam)
+    LodTreeFrameListener(RenderWindow* win, Camera* cam)
         : ExampleFrameListener(win, cam, false, false)
     {
@@ -153,11 +114,22 @@
 		}
 
-		// Move the node
-		if(mInputDevice->isKeyDown(Ogre::KC_UP))
+		// Move the cam
+		if(mInputDevice->isKeyDown(Ogre::KC_UP) ||
+		   mInputDevice->isKeyDown(Ogre::KC_W) ||
+		   mInputDevice->isKeyDown(Ogre::KC_NUMPAD5))
 		  mTranslateVector.z = -mMoveScale;
 
-
-		if(mInputDevice->isKeyDown(Ogre::KC_DOWN))
+		if(mInputDevice->isKeyDown(Ogre::KC_DOWN) ||
+		   mInputDevice->isKeyDown(Ogre::KC_S) ||
+		   mInputDevice->isKeyDown(Ogre::KC_NUMPAD2))
 		  mTranslateVector.z = mMoveScale;
+
+		if (mInputDevice->isKeyDown(Ogre::KC_A) ||
+			mInputDevice->isKeyDown(Ogre::KC_NUMPAD1))
+			mTranslateVector.x = -mMoveScale;
+
+		if (mInputDevice->isKeyDown(Ogre::KC_D) ||
+			mInputDevice->isKeyDown(Ogre::KC_NUMPAD3))
+			mTranslateVector.x = mMoveScale;
 
 		// Instead of moving the ship left and right, rotate it using yaw()
@@ -238,15 +210,11 @@
 
 
-class FresnelApplication : public ExampleApplication
+class LodTreeApplication : public ExampleApplication
 {
 protected:
 public:
-    FresnelApplication()
-	{
-	}
-
-    ~FresnelApplication() 
-    {
-    }
+    LodTreeApplication(){}
+    ~LodTreeApplication(){}
+
 protected:
     
@@ -353,5 +321,5 @@
     void createFrameListener(void)
     {
-        mFrameListener= new FresnelFrameListener(mWindow, mCamera);
+        mFrameListener= new LodTreeFrameListener(mWindow, mCamera);
         mFrameListener->showDebugOverlay(true);
         mRoot->addFrameListener(mFrameListener);
@@ -378,5 +346,5 @@
 {
     // Create application object
-    FresnelApplication app;
+    LodTreeApplication app;
 
     try {
Index: GTP/trunk/App/Demos/Geom/Demo_LodTrees/README.txt
===================================================================
--- GTP/trunk/App/Demos/Geom/Demo_LodTrees/README.txt	(revision 1540)
+++ GTP/trunk/App/Demos/Geom/Demo_LodTrees/README.txt	(revision 1540)
@@ -0,0 +1,13 @@
+Overview
+--------
+
+This demo shows an example of the LodTree model in action. The trees in the scene
+are associated to a LodTree object that manage their level of detail of both the 
+trunk and the leaves. 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 forest, and stops
+decreasing when the objects reach the their minimum LOD. This 'lodding' distance is
+customizable from the source code of the demo.
