Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h	(revision 1070)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h	(revision 1078)
@@ -70,4 +70,12 @@
 
 	*/
+	class LodStripsLibraryData
+	{
+	public:
+		SmallIntVector					mFileVertices;
+		std::vector	<LODRegisterType>	mFileChangesLOD;
+		LongVector						mData;
+		std::vector<unsigned int>		p_changes;
+	};
 	class LodStripsLibrary : public Geometry::LodObject
 	{
@@ -125,5 +133,5 @@
 
 			//	Loads Mesh.
-			void	LoadStripMesh(char *name, Mesh *geomesh);
+			void	LoadStripMesh(const LodStripsLibraryData &, Mesh *geomesh);
 
 			Geometry::CREATEINDEXDATAFUNC create_index_data_func;
@@ -132,5 +140,5 @@
 			SmallIntVector	*mStrips;
 
-			void UpdateDataRetrievalInterface(void);
+			void UpdateDataRetrievalInterface(void);			
 
 		public:
@@ -141,5 +149,5 @@
 			 * 	including the multiresolution object.
 			*/
-			LodStripsLibrary(std::string, Mesh *geomesh, CREATEINDEXDATAFUNC idfun=NULL);
+			LodStripsLibrary(const LodStripsLibraryData &, Mesh *geomesh, CREATEINDEXDATAFUNC idfun=NULL);
 
 			/// Destructor.
@@ -164,4 +172,6 @@
 			/// Returns the number of vertices of the lowest LOD.
 			uint32	MinVertices();
+
+			int *indices_x_submesh;
 	};
 }
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodTreeLibrary.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodTreeLibrary.h	(revision 1069)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodTreeLibrary.h	(revision 1078)
@@ -8,4 +8,5 @@
 #include "GeoMesh.h"
 #include "GeoLodStripsLibrary.h"
+#include "GeoTreeSimpSequence.h"
 #include "GeoLodObject.h"
 
@@ -21,6 +22,6 @@
 /*		LodTreeLibrary( const LodTreeLibrary &);
 		LodTreeLibrary(LodTreeLibrary*);*/
-		LodTreeLibrary(	std::string trunkSimpSeqFile,
-						std::string leafSimpSeqFile,
+		LodTreeLibrary(	const LodStripsLibraryData &,
+						const TreeSimplificationSequence &,
 						Geometry::Mesh *treeGeoMesh,
 						uint32 leafSubMeshID
@@ -67,7 +68,7 @@
 
 //		const Geometry::SmallIntVector & GetStrip(uint32 istrip) const { return trunk->mStrips[istrip]; }
+		Geometry::LodStripsLibrary *trunk;
 
 	private:
-		Geometry::LodStripsLibrary *trunk;
 		Foliage *foliage;
 
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsConstructor.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsConstructor.h	(revision 1070)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsConstructor.h	(revision 1078)
@@ -52,5 +52,5 @@
 - It also writes the LODStrips mesh into a file.
 */
-	class LodStripsConstructor : public Serializable
+	class LodStripsConstructor/* : public Serializable*/
 	{
 		protected:
@@ -145,9 +145,12 @@
 
 			/// Load 
-			void Load(Serializer &s);
+		/*	void Load(Serializer &s);*/
 
 			/// Saves the multiresolution model into a LODStrip file and the
 			//	LODStrips mesh using the serializer given as a parameter.
-			void Save (Serializer &s);
+			//void Save (Serializer &s);
+			void Save (std::string);
+
+			void UpdateMesh(void);
 
 			///	GetMesh: Return de current Mesh.
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp	(revision 1070)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp	(revision 1078)
@@ -17,8 +17,8 @@
 //	Constructors.
 //-----------------------------------------------------------------------------
-LodStripsLibrary::LodStripsLibrary(std::string	name, Mesh *geomesh, CREATEINDEXDATAFUNC idfun)
+LodStripsLibrary::LodStripsLibrary(const LodStripsLibraryData &lodstripsdata, Mesh *geomesh, CREATEINDEXDATAFUNC idfun)
 :create_index_data_func(idfun?idfun:DefaultIndexDataCreator)
 {
-	const	char	*name_of_file;
+//	const	char	*name_of_file;
 
 	//	Sets the current lod.
@@ -26,5 +26,5 @@
 
 	//	Converts a String to const char *.
-	name_of_file	=	name.data();
+//	name_of_file	=	name.data();
 
 	//	Sets the global mesh.
@@ -32,7 +32,8 @@
 
 	dataRetrievalInterface=NULL;
+	indices_x_submesh = NULL;
 	
 	//	Loads the Level Of Detail file.
-	LodStripsLibrary::LoadStripMesh((char*)name_of_file,mGeoMesh);
+	LodStripsLibrary::LoadStripMesh(lodstripsdata,mGeoMesh);
 
 	GoToLod(0.0f);	
@@ -55,4 +56,6 @@
 	if (dataRetrievalInterface)
 		delete dataRetrievalInterface;
+	if (indices_x_submesh)
+		delete[] indices_x_submesh;
 }
 
@@ -427,5 +430,5 @@
 //	LoadStripMesh
 //-----------------------------------------------------------------------------
-void LodStripsLibrary::LoadStripMesh(char *name, Mesh *geomesh)
+void LodStripsLibrary::LoadStripMesh(const LodStripsLibraryData &lodstripsdata, Mesh *geomesh)
 {
 	FILE															*fp;
@@ -447,4 +450,5 @@
 
 	//	For each one of the submeshes.
+	indices_x_submesh = new int[geomesh->mSubMeshCount];
 	for (unsigned int submesh	=	0; submesh < geomesh->mSubMeshCount; submesh++)
 	{
@@ -487,8 +491,10 @@
 			int i;
 			i	= 0;
+			indices_x_submesh[submesh] = 0;
 			//	For each index of the strip.
 			for (index = indexBegin; index < indexEnd; index++)
 			{
 				mFileStrips[t].push_back(indexBegin[i]);
+				indices_x_submesh[submesh]++;
 				i++;
 			}
@@ -498,5 +504,5 @@
 	//	TODO:	LOD file loaded in load file mesh process.
 	//	Open the LOD file.
-	if ((fp = fopen (name, "r")) == NULL)
+/*	if ((fp = fopen (name, "r")) == NULL)
 	{
 		//	Error in open.
@@ -551,5 +557,11 @@
 		}
 		
-		fclose(fp);
+		fclose(fp);*/
+
+	mFileVertices = lodstripsdata.mFileVertices;
+	mFileChangesLOD = lodstripsdata.mFileChangesLOD;
+	mData = lodstripsdata.mData;
+	p_changes = lodstripsdata.p_changes;
+		
 		
 		//	Max / Min values for LOD.
@@ -572,5 +584,5 @@
 		//Copy the data to the structure we will use
 		CopyVectors2Arrays();
-	}
+//	}
 }
 
@@ -581,10 +593,33 @@
 	dataRetrievalInterface->Begin();
 
-	for (unsigned	int i=0; i<mTotalStrips; i++)
-	{
+	int counter = 0;
+	int target_submesh = 0;
+	int strip_count = 0;
+
+	for (unsigned	int i=0; i<mTotalStrips; i++, strip_count++)
+	{
+		if (strip_count >= mGeoMesh->mSubMesh[target_submesh].mStripCount)
+		{
+			indices_x_submesh[target_submesh] = counter;
+			counter = 0;
+			strip_count = 0;
+			target_submesh++;
+		}
 		for (SmallIntVector::iterator it=mStrips[i].begin(); it!=mStrips[i].end(); it++, ii++)
+		{
 			dataRetrievalInterface->SetIndex(ii,*it);
+			counter++;
+		}
 		dataRetrievalInterface->SetNumValidIndices(ii);
 	}
+
+	if (strip_count >= mGeoMesh->mSubMesh[target_submesh].mStripCount)
+	{
+		indices_x_submesh[target_submesh] = counter;
+		counter = 0;
+		strip_count = 0;
+		target_submesh++;
+	}
+
 	dataRetrievalInterface->End();
 }
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/foliage.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/foliage.cpp	(revision 1058)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/foliage.cpp	(revision 1078)
@@ -10,5 +10,5 @@
 // Parameters --> None
 //--------------------------------------------------------------------------------------------------------------------------------
-Foliage::Foliage(const Geometry::SubMesh *leavesSubMesh, const char *simpSeq, Geometry::CREATEVERTEXDATAFUNC vdfun, Geometry::CREATEINDEXDATAFUNC idfun): 
+Foliage::Foliage(const Geometry::SubMesh *leavesSubMesh, const Geometry::TreeSimplificationSequence & simpSeq, Geometry::CREATEVERTEXDATAFUNC vdfun, Geometry::CREATEINDEXDATAFUNC idfun): 
 Acth(NULL),
 create_vertex_data_func(vdfun==NULL?Geometry::DefaultVertexDataCreator:vdfun),
@@ -304,7 +304,33 @@
 
 /// returns the number of total leafs
-bool Foliage::ReadSimpSeq(const char *simpSeqFile)
-{
-	FILE* fp_simpli;
+bool Foliage::ReadSimpSeq(const Geometry::TreeSimplificationSequence & simpSeq)
+{
+	int tn, tv1,tv2, e=0;
+
+	tn = leafCount;
+	for (std::vector<Geometry::TreeSimplificationSequence::Step>::const_iterator it = simpSeq.mSteps.begin(); it != simpSeq.mSteps.end(); it++)
+	{
+		Leaves[tn].vertsLeaf[0] = it->mNewQuad[0];
+		Leaves[tn].vertsLeaf[1] = it->mNewQuad[1];
+		Leaves[tn].vertsLeaf[2] = it->mNewQuad[2];
+		Leaves[tn].vertsLeaf[3] = it->mNewQuad[3];
+
+		Leaves[tn].visible = 0;
+
+		GetNormalH  (Leaves[tn]);
+
+		tv1 = it->mV0/2;
+		tv2 = it->mT0/2;
+
+		Leaves[tn].childLeft= tv1;
+		Leaves[tn].childRight= tv2;
+
+		Leaves[tv1].parent = tn;
+		Leaves[tv2].parent = tn;		
+
+		tn++;
+	}
+
+/*	FILE* fp_simpli;
 	char linea[256];
 	int v0, v1, v2, v3, tn, tv1,tv2, e=0;
@@ -350,5 +376,5 @@
 	}
 
-	fclose(fp_simpli);
+	fclose(fp_simpli);*/
 
 	leafTotal=tn;
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/foliage.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/foliage.h	(revision 1058)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/foliage.h	(revision 1078)
@@ -6,4 +6,5 @@
 #include "VertexData.h"
 #include "Leaf.h"
+#include "GeoTreeSimpSequence.h"
 
 class ActiveLeafNode
@@ -26,5 +27,5 @@
 		int active_leaf_count;
 
-		Foliage (const Geometry::SubMesh *, const char *simpSeq, Geometry::CREATEVERTEXDATAFUNC vdfun=NULL, Geometry::CREATEINDEXDATAFUNC idfun=NULL);
+		Foliage (const Geometry::SubMesh *, const Geometry::TreeSimplificationSequence &, Geometry::CREATEVERTEXDATAFUNC vdfun=NULL, Geometry::CREATEINDEXDATAFUNC idfun=NULL);
 		Foliage (const Foliage *);
 		virtual ~Foliage (void); // Destructor
@@ -56,5 +57,5 @@
 		void ReadLeafs(const Geometry::SubMesh *);
 		void ReadVertices(const Geometry::SubMesh *);
-		bool ReadSimpSeq(const char*); /// returns true when successful
+		bool ReadSimpSeq(const Geometry::TreeSimplificationSequence &); /// returns true when successful
 		void FillRoot(void);
 
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoTreeSimpSequence.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoTreeSimpSequence.cpp	(revision 1009)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoTreeSimpSequence.cpp	(revision 1078)
@@ -60,22 +60,36 @@
 {
 	// Almacena la secuencia de simplificación en un fichero
-	char simp[256];
+/*	char simp[256];
 
 	// Nombre del mesh
 	sprintf(simp,"%s\n",meshName);
 	s.WriteData(simp,sizeof(char),strlen(simp));
+*/
+	unsigned short chunkid = 0xdcba;
+	s.WriteData(&chunkid,sizeof(unsigned short),1);
+	unsigned long size = mSteps.size()*8*sizeof(int);
+	s.WriteData(&size,sizeof(unsigned long),1);
 
-	for(unsigned int i=0; i<mSteps.size(); i++)
+	int tam = mSteps.size();
+	s.WriteData(&tam,sizeof(int),1);
+	for(unsigned int i=0; i<tam; i++)
 	{
 		Geometry::TreeSimplificationSequence::Step paso = mSteps.operator [](i);
 
+		s.WriteData(&paso.mV0,sizeof(int),1);
+		s.WriteData(&paso.mV1,sizeof(int),1);
+		s.WriteData(&paso.mT0,sizeof(int),1);
+		s.WriteData(&paso.mT1,sizeof(int),1);
+
+		s.WriteData(paso.mNewQuad,sizeof(int),4);
+
 		// El último %u que recibe el sprintf es para indicar si un paso es dependiente del anterior. REVISAR
 		// ------------------------------------------------------------------------
-		sprintf(simp,"%u %u %u %u &", paso.mV0, paso.mV1, paso.mT0, paso.mT1);
+/*		sprintf(simp,"%u %u %u %u &", paso.mV0, paso.mV1, paso.mT0, paso.mT1);
 		s.WriteData(simp,sizeof(char),strlen(simp));
 
 		// los quads
 		sprintf(simp," %u %u %u %u\n",paso.mNewQuad[0],paso.mNewQuad[1],paso.mNewQuad[2],paso.mNewQuad[3]);
-		s.WriteData(simp,sizeof(char),strlen(simp));
+		s.WriteData(simp,sizeof(char),strlen(simp));*/
 		//s.WriteData("\n",sizeof(char),1);
 	}
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp	(revision 1070)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp	(revision 1078)
@@ -5,6 +5,6 @@
 using namespace Geometry;
 
-Geometry::LodTreeLibrary::LodTreeLibrary(std::string trunkSimpSeqFile,
-										 std::string leafSimpSeqFile,
+Geometry::LodTreeLibrary::LodTreeLibrary(const LodStripsLibraryData &lodstripsdata,
+										 const TreeSimplificationSequence &simpseq,
 										 Geometry::Mesh *treeGeoMesh,
 										 uint32 leafSubMeshID/*
@@ -14,9 +14,9 @@
 {
 	// Cargar el tronco
-	trunk = new LodStripsLibrary(trunkSimpSeqFile,treeGeoMesh);
+	trunk = new LodStripsLibrary(lodstripsdata,treeGeoMesh);
 
 	// Cargar la copa del árbol
 	Geometry::SubMesh * leafsSubMesh = &(treeGeoMesh->mSubMesh[leafSubMeshID]);
-	foliage = new Foliage(leafsSubMesh,leafSimpSeqFile.c_str());
+	foliage = new Foliage(leafsSubMesh,simpseq);
 	GoToFoliageLod(1.0f);
 }
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp	(revision 1070)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp	(revision 1078)
@@ -609,5 +609,5 @@
 //	lodStripConstructor object.
 //---------------------------------------------------------------------------
-void LodStripsConstructor::Save(Serializer &oSerializer)
+void LodStripsConstructor::Save(std::string filename)
 {
 	unsigned int	i, j;
@@ -615,13 +615,31 @@
 	char					simp[256];
 
-	//******************  1º CONSTRUCCION DEL FICHERO.LOD *********************
+	int vertexCount = this->cVerts.size();
+	int changesCount = this->cCambios.size();
+	int dataCount = this->cDatos.size();
+	int cambiosCount = this->TOTALCAMBIOS;
+	int size= dataCount*sizeof(LODData) + (vertexCount + changesCount + cambiosCount + 4)*sizeof(int);
+
+	FILE *f = fopen(filename.c_str(),"ab");
+
+	unsigned short chunkid = 0xabcd;
+	fwrite(&chunkid,sizeof(unsigned short),1,f);	
+	fwrite(&size,sizeof(unsigned long),1,f);
+
+	fwrite(&vertexCount, sizeof(int), 1, f);
+	for(i = 0; i < this->cVerts.size(); i++)
+	{
+		int auxv = cVerts[i].Next;
+		fwrite(&auxv, sizeof(int), 1, f);
+	}
 
 	//	VERTICES.
-	for(i = 0; i < this->cVerts.size(); i++)
+/*	for(i = 0; i < this->cVerts.size(); i++)
 	{
 		sprintf(simp,"v %d\n",cVerts[i].Next);
 		oSerializer.WriteData(simp,sizeof(char),strlen(simp));
 	}
-
+*/
+	
 	//	CSTRIPS.
 	this->TOTALINDICES	=	0;
@@ -634,5 +652,13 @@
 	//	lines starting with a d.
 	//	Changes
+	fwrite(&changesCount, sizeof(int), 1, f);
 	for(i = 0; i < this->cCambios.size(); i++)
+	{
+		LODData change= cCambios[i];
+		fwrite(&change, sizeof(LODData), 1, f);
+	}
+
+
+/*	for(i = 0; i < this->cCambios.size(); i++)
 	{
 		sprintf(simp,"c\n");
@@ -649,4 +675,71 @@
 		oSerializer.WriteData(simp,sizeof(char),strlen(simp));
 	}
+*/	//	Lines starting with a b.
+	//	Data.
+
+	fwrite(&dataCount, sizeof(int), 1, f);
+	for(i = 0; i < this->cDatos.size(); i++)
+	{
+		int data= cDatos[i];
+		fwrite(&data, sizeof(int), 1, f);
+	}
+
+	sprintf(simp,"a\n");
+/*	oSerializer.WriteData(simp,sizeof(char),strlen(simp));
+	
+	for(i = 0; i < this->cDatos.size(); i++)
+	{
+		sprintf(simp,"b %d\n",cDatos[i]);
+
+		oSerializer.WriteData(simp,sizeof(char),strlen(simp));
+	}
+*/
+
+
+	//	lines starting with a p.
+	//	Chages made in a LOD.
+	fwrite(&cambiosCount, sizeof(int), 1, f);
+	for(i = 0; i < this->TOTALCAMBIOS; i++)
+	{
+		int cambio= pCambios[i];
+		fwrite(&cambio, sizeof(int), 1, f);
+	}
+
+	fclose(f);
+
+
+/*
+	//	VERTICES.
+	for(i = 0; i < this->cVerts.size(); i++)
+	{
+		sprintf(simp,"v %d\n",cVerts[i].Next);
+		oSerializer.WriteData(simp,sizeof(char),strlen(simp));
+	}
+
+	//	CSTRIPS.
+	this->TOTALINDICES	=	0;
+	
+	for(i = 0; i < this->cStrips.size(); i++)
+	{
+		this->TOTALINDICES += int(this->cStrips[i].size());
+	}
+
+	//	lines starting with a d.
+	//	Changes
+	for(i = 0; i < this->cCambios.size(); i++)
+	{
+		sprintf(simp,"c\n");
+		oSerializer.WriteData(simp,sizeof(char),strlen(simp));
+		
+		sprintf(simp,
+						"d %u %u %u %u %u\n",
+						cCambios[i].strip,
+						cCambios[i].nP,
+						cCambios[i].nL1,
+						cCambios[i].nL2,
+						cCambios[i].obligatory);
+		
+		oSerializer.WriteData(simp,sizeof(char),strlen(simp));
+	}
 	//	Lines starting with a b.
 	//	Data.
@@ -670,196 +763,5 @@
 	}
 
-	oSerializer.WriteData("\n",sizeof(char),1);
-
-	//*******************  2º DEVOLVER EL MESH CON LAS MODIFICACIONES EFECTUADAS  *********************
-	int num_no	=	0;
-
-	if(this->mGeoMesh->mSubMesh[0].mSharedVertexBuffer == true)
-	{
-		//mPosition
-		delete[] this->mGeoMesh->mVertexBuffer->mPosition;
-		this->mGeoMesh->mVertexBuffer->mPosition = new Vector3[this->cVerts.size()];
-
-		//mNormal
-		if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
-		{
-			delete[] this->mGeoMesh->mVertexBuffer->mNormal;
-			this->mGeoMesh->mVertexBuffer->mNormal = new Vector3[this->cVerts.size()];
-		}
-
-		//mTexCoords
-		if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
-		{
-			delete[] this->mGeoMesh->mVertexBuffer->mTexCoords;
-			this->mGeoMesh->mVertexBuffer->mTexCoords = new Vector2[this->cVerts.size()];
-		}
-
-		this->mGeoMesh->mVertexBuffer->mVertexCount	=	this->cVerts.size();
-		this->mGeoMesh->mVertexBuffer->mVertexInfo		=	this->meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo;
-
-		for(i = 0; i < this->mGeoMesh->mSubMeshCount; i++)
-		{
-			this->mGeoMesh->mSubMesh[i].mVertexBuffer				=	this->mGeoMesh->mVertexBuffer;
-			this->mGeoMesh->mSubMesh[i].mSharedVertexBuffer	=	true;
-		}
-
-		int	indice	=	0;
-
-		for (j = 0; j < this->cVerts.size(); j++)
-		{
-			//Copiamos las coordeandas de posicion 
-			this->mGeoMesh->mVertexBuffer->mPosition[indice].x	=	this->cVerts[j].Vertex[0];
-			this->mGeoMesh->mVertexBuffer->mPosition[indice].y	=	this->cVerts[j].Vertex[1];
-			this->mGeoMesh->mVertexBuffer->mPosition[indice].z	=	this->cVerts[j].Vertex[2];
-
-			//Copiamos las normales
-			if (meshoriginal->mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
-			{
-				this->mGeoMesh->mVertexBuffer->mNormal[indice].x	=	this->cVerts[j].Normal[0];
-				this->mGeoMesh->mVertexBuffer->mNormal[indice].y	=	this->cVerts[j].Normal[1];
-				this->mGeoMesh->mVertexBuffer->mNormal[indice].z	=	this->cVerts[j].Normal[2];
-			}
-
-			//Copiamos las coordenadas de textura
-			if (meshoriginal->mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
-			{
-				this->mGeoMesh->mVertexBuffer->mTexCoords[indice].x	=	this->cVerts[j].TexCoords[0];
-				this->mGeoMesh->mVertexBuffer->mTexCoords[indice].y	=	this->cVerts[j].TexCoords[1];
-			}
-
-			indice++;
-
-		}
-
-		this->mGeoMesh->mVertexBuffer->mVertexCount	=	indice;
-	}
-	else	//OSCAR
-	{
-		//Supondre que solo tengo un submesh con vertices no compartidos
-		//mPosition
-		delete[]	this->mGeoMesh->mSubMesh[0].mVertexBuffer->mPosition;
-		
-		this->mGeoMesh->mSubMesh[0].mVertexBuffer->mPosition	=	new Vector3[this->cVerts.size()];
-
-		//mNormal
-		if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
-		{
-			delete[] this->mGeoMesh->mSubMesh[0].mVertexBuffer->mNormal;
-			this->mGeoMesh->mSubMesh[0].mVertexBuffer->mNormal = new Vector3[this->cVerts.size()];
-		}
-
-		//mTexCoords
-		if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
-		{
-			delete[] this->mGeoMesh->mSubMesh[0].mVertexBuffer->mTexCoords;
-			this->mGeoMesh->mSubMesh[0].mVertexBuffer->mTexCoords = new Vector2[this->cVerts.size()];
-		}
-
-		this->mGeoMesh->mSubMesh[0].mVertexBuffer->mVertexCount =this->cVerts.size();
-		this->mGeoMesh->mSubMesh[0].mVertexBuffer->mVertexInfo = this->meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo;
-
-		this->mGeoMesh->mSubMesh[0].mSharedVertexBuffer=false;
-
-		int indice=0;
-		for (j=0; j<this->cVerts.size(); j++)
-		{
-			//Copiamos las coordeandas de posicion 
-			this->mGeoMesh->mSubMesh[0].mVertexBuffer->mPosition[indice].x=this->cVerts[j].Vertex[0];
-			this->mGeoMesh->mSubMesh[0].mVertexBuffer->mPosition[indice].y=this->cVerts[j].Vertex[1];
-			this->mGeoMesh->mSubMesh[0].mVertexBuffer->mPosition[indice].z=this->cVerts[j].Vertex[2];
-
-			//Copiamos las normales
-			if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
-			{
-				this->mGeoMesh->mSubMesh[0].mVertexBuffer->mNormal[indice].x=this->cVerts[j].Normal[0];
-				this->mGeoMesh->mSubMesh[0].mVertexBuffer->mNormal[indice].y=this->cVerts[j].Normal[1];
-				this->mGeoMesh->mSubMesh[0].mVertexBuffer->mNormal[indice].z=this->cVerts[j].Normal[2];
-			}
-
-			//Copiamos las coordenadas de textura
-			if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
-			{
-				this->mGeoMesh->mSubMesh[0].mVertexBuffer->mTexCoords[indice].x=this->cVerts[j].TexCoords[0];
-				this->mGeoMesh->mSubMesh[0].mVertexBuffer->mTexCoords[indice].y=this->cVerts[j].TexCoords[1];
-			}
-			indice++;
-		}
-		this->mGeoMesh->mSubMesh[0].mVertexBuffer->mVertexCount =indice;
-	}
-	
-
-
-	int indice_acum = 0;
-	for(i=0;i<this->mGeoMesh->mSubMeshCount;i++)
-	{
-		Geometry::SubMesh & subMesh = meshoriginal->mSubMesh[i];
-		Geometry::SubMesh & mGeoMeshSubMesh = this->mGeoMesh->mSubMesh[i];
-
-		for (size_t ind=0; ind < subMesh.mIndexCount; ind++) 
-		{
-			Index indIndex = subMesh.mIndex[ind];
-			if (subMesh.mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
-			{
-				//Hay coordenadas de textura y normales
-				if(subMesh.mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
-				{
-					for (size_t indvo=0; indvo<mGeoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)
-					{
-						if (igual(subMesh.mVertexBuffer->mPosition[indIndex],mGeoMeshSubMesh.mVertexBuffer->mPosition[indvo]))
-						{
-							if (igual(subMesh.mVertexBuffer->mNormal[indIndex],mGeoMeshSubMesh.mVertexBuffer->mNormal[indvo]))
-							{
-								if (igual(subMesh.mVertexBuffer->mTexCoords[indIndex],mGeoMeshSubMesh.mVertexBuffer->mTexCoords[indvo]))
-								{
-									mGeoMeshSubMesh.mIndex[ind]= int(indvo);//+indice_acum;
-								}
-							}
-						}
-					}
-				}
-				else		//Hay coordenadas de textura pero no hay normales
-				{
-					for (size_t indvo=0; indvo<mGeoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)
-					{
-						if (igual(subMesh.mVertexBuffer->mPosition[indIndex],mGeoMeshSubMesh.mVertexBuffer->mPosition[indvo]))
-						{
-							if (igual(subMesh.mVertexBuffer->mTexCoords[indIndex],mGeoMeshSubMesh.mVertexBuffer->mTexCoords[indvo]))
-							{
-								mGeoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum;
-							}
-						}
-					}
-				}
-			}
-			else
-			{
-				// No hay coordenadas de textura pero si normales
-				if(subMesh.mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
-				{
-					for (size_t indvo=0; indvo<mGeoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)
-					{
-						if (igual(subMesh.mVertexBuffer->mPosition[indIndex],mGeoMeshSubMesh.mVertexBuffer->mPosition[indvo]))
-						{
-							if (igual(subMesh.mVertexBuffer->mNormal[indIndex],mGeoMeshSubMesh.mVertexBuffer->mNormal[indvo]))
-							{
-								mGeoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum;
-							}
-						}
-					}
-				}
-				else		//No hay coordenadas de texturas ni normales
-				{
-					for (size_t indvo=0; indvo<mGeoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)
-					{
-						if (igual(subMesh.mVertexBuffer->mPosition[indIndex],mGeoMeshSubMesh.mVertexBuffer->mPosition[indvo]))
-						{
-							mGeoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum;
-						}
-					}
-				}
-			}
-		}
-	}
-	
+	oSerializer.WriteData("\n",sizeof(char),1);	*/
 }
 
@@ -880,7 +782,7 @@
 }
 
-void LodStripsConstructor::Load(Serializer &oSerializer)
+/*void LodStripsConstructor::Load(Serializer &oSerializer)
 {
-}
+}*/
 
 //---------------------------------------------------------------------------
@@ -1339,2 +1241,195 @@
 }
 
+void Geometry::LodStripsConstructor::UpdateMesh(void)
+{
+	int num_no	=	0;
+	int i=0,j=0;
+
+	if(this->mGeoMesh->mSubMesh[0].mSharedVertexBuffer == true)
+	{
+		//mPosition
+		delete[] this->mGeoMesh->mVertexBuffer->mPosition;
+		this->mGeoMesh->mVertexBuffer->mPosition = new Vector3[this->cVerts.size()];
+
+		//mNormal
+		if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
+		{
+			delete[] this->mGeoMesh->mVertexBuffer->mNormal;
+			this->mGeoMesh->mVertexBuffer->mNormal = new Vector3[this->cVerts.size()];
+		}
+
+		//mTexCoords
+		if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
+		{
+			delete[] this->mGeoMesh->mVertexBuffer->mTexCoords;
+			this->mGeoMesh->mVertexBuffer->mTexCoords = new Vector2[this->cVerts.size()];
+		}
+
+		this->mGeoMesh->mVertexBuffer->mVertexCount	=	this->cVerts.size();
+		this->mGeoMesh->mVertexBuffer->mVertexInfo		=	this->meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo;
+
+		for(i = 0; i < this->mGeoMesh->mSubMeshCount; i++)
+		{
+			this->mGeoMesh->mSubMesh[i].mVertexBuffer				=	this->mGeoMesh->mVertexBuffer;
+			this->mGeoMesh->mSubMesh[i].mSharedVertexBuffer	=	true;
+		}
+
+		int	indice	=	0;
+
+		for (j = 0; j < this->cVerts.size(); j++)
+		{
+			//Copiamos las coordeandas de posicion 
+			this->mGeoMesh->mVertexBuffer->mPosition[indice].x	=	this->cVerts[j].Vertex[0];
+			this->mGeoMesh->mVertexBuffer->mPosition[indice].y	=	this->cVerts[j].Vertex[1];
+			this->mGeoMesh->mVertexBuffer->mPosition[indice].z	=	this->cVerts[j].Vertex[2];
+
+			//Copiamos las normales
+			if (meshoriginal->mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
+			{
+				this->mGeoMesh->mVertexBuffer->mNormal[indice].x	=	this->cVerts[j].Normal[0];
+				this->mGeoMesh->mVertexBuffer->mNormal[indice].y	=	this->cVerts[j].Normal[1];
+				this->mGeoMesh->mVertexBuffer->mNormal[indice].z	=	this->cVerts[j].Normal[2];
+			}
+
+			//Copiamos las coordenadas de textura
+			if (meshoriginal->mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
+			{
+				this->mGeoMesh->mVertexBuffer->mTexCoords[indice].x	=	this->cVerts[j].TexCoords[0];
+				this->mGeoMesh->mVertexBuffer->mTexCoords[indice].y	=	this->cVerts[j].TexCoords[1];
+			}
+
+			indice++;
+
+		}
+
+		this->mGeoMesh->mVertexBuffer->mVertexCount	=	indice;
+	}
+	else	//OSCAR
+	{
+		//Supondre que solo tengo un submesh con vertices no compartidos
+		//mPosition
+		delete[]	this->mGeoMesh->mSubMesh[0].mVertexBuffer->mPosition;
+		
+		this->mGeoMesh->mSubMesh[0].mVertexBuffer->mPosition	=	new Vector3[this->cVerts.size()];
+
+		//mNormal
+		if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
+		{
+			delete[] this->mGeoMesh->mSubMesh[0].mVertexBuffer->mNormal;
+			this->mGeoMesh->mSubMesh[0].mVertexBuffer->mNormal = new Vector3[this->cVerts.size()];
+		}
+
+		//mTexCoords
+		if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
+		{
+			delete[] this->mGeoMesh->mSubMesh[0].mVertexBuffer->mTexCoords;
+			this->mGeoMesh->mSubMesh[0].mVertexBuffer->mTexCoords = new Vector2[this->cVerts.size()];
+		}
+
+		this->mGeoMesh->mSubMesh[0].mVertexBuffer->mVertexCount =this->cVerts.size();
+		this->mGeoMesh->mSubMesh[0].mVertexBuffer->mVertexInfo = this->meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo;
+
+		this->mGeoMesh->mSubMesh[0].mSharedVertexBuffer=false;
+
+		int indice=0;
+		for (j=0; j<this->cVerts.size(); j++)
+		{
+			//Copiamos las coordeandas de posicion 
+			this->mGeoMesh->mSubMesh[0].mVertexBuffer->mPosition[indice].x=this->cVerts[j].Vertex[0];
+			this->mGeoMesh->mSubMesh[0].mVertexBuffer->mPosition[indice].y=this->cVerts[j].Vertex[1];
+			this->mGeoMesh->mSubMesh[0].mVertexBuffer->mPosition[indice].z=this->cVerts[j].Vertex[2];
+
+			//Copiamos las normales
+			if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
+			{
+				this->mGeoMesh->mSubMesh[0].mVertexBuffer->mNormal[indice].x=this->cVerts[j].Normal[0];
+				this->mGeoMesh->mSubMesh[0].mVertexBuffer->mNormal[indice].y=this->cVerts[j].Normal[1];
+				this->mGeoMesh->mSubMesh[0].mVertexBuffer->mNormal[indice].z=this->cVerts[j].Normal[2];
+			}
+
+			//Copiamos las coordenadas de textura
+			if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
+			{
+				this->mGeoMesh->mSubMesh[0].mVertexBuffer->mTexCoords[indice].x=this->cVerts[j].TexCoords[0];
+				this->mGeoMesh->mSubMesh[0].mVertexBuffer->mTexCoords[indice].y=this->cVerts[j].TexCoords[1];
+			}
+			indice++;
+		}
+		this->mGeoMesh->mSubMesh[0].mVertexBuffer->mVertexCount =indice;
+	}
+	
+
+
+	int indice_acum = 0;
+	for(i=0;i<this->mGeoMesh->mSubMeshCount;i++)
+	{
+		Geometry::SubMesh & subMesh = meshoriginal->mSubMesh[i];
+		Geometry::SubMesh & mGeoMeshSubMesh = this->mGeoMesh->mSubMesh[i];
+
+		for (size_t ind=0; ind < subMesh.mIndexCount; ind++) 
+		{
+			Index indIndex = subMesh.mIndex[ind];
+			if (subMesh.mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
+			{
+				//Hay coordenadas de textura y normales
+				if(subMesh.mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
+				{
+					for (size_t indvo=0; indvo<mGeoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)
+					{
+						if (igual(subMesh.mVertexBuffer->mPosition[indIndex],mGeoMeshSubMesh.mVertexBuffer->mPosition[indvo]))
+						{
+							if (igual(subMesh.mVertexBuffer->mNormal[indIndex],mGeoMeshSubMesh.mVertexBuffer->mNormal[indvo]))
+							{
+								if (igual(subMesh.mVertexBuffer->mTexCoords[indIndex],mGeoMeshSubMesh.mVertexBuffer->mTexCoords[indvo]))
+								{
+									mGeoMeshSubMesh.mIndex[ind]= int(indvo);//+indice_acum;
+								}
+							}
+						}
+					}
+				}
+				else		//Hay coordenadas de textura pero no hay normales
+				{
+					for (size_t indvo=0; indvo<mGeoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)
+					{
+						if (igual(subMesh.mVertexBuffer->mPosition[indIndex],mGeoMeshSubMesh.mVertexBuffer->mPosition[indvo]))
+						{
+							if (igual(subMesh.mVertexBuffer->mTexCoords[indIndex],mGeoMeshSubMesh.mVertexBuffer->mTexCoords[indvo]))
+							{
+								mGeoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum;
+							}
+						}
+					}
+				}
+			}
+			else
+			{
+				// No hay coordenadas de textura pero si normales
+				if(subMesh.mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
+				{
+					for (size_t indvo=0; indvo<mGeoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)
+					{
+						if (igual(subMesh.mVertexBuffer->mPosition[indIndex],mGeoMeshSubMesh.mVertexBuffer->mPosition[indvo]))
+						{
+							if (igual(subMesh.mVertexBuffer->mNormal[indIndex],mGeoMeshSubMesh.mVertexBuffer->mNormal[indvo]))
+							{
+								mGeoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum;
+							}
+						}
+					}
+				}
+				else		//No hay coordenadas de texturas ni normales
+				{
+					for (size_t indvo=0; indvo<mGeoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)
+					{
+						if (igual(subMesh.mVertexBuffer->mPosition[indIndex],mGeoMeshSubMesh.mVertexBuffer->mPosition[indvo]))
+						{
+							mGeoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum;
+						}
+					}
+				}
+			}
+		}
+	}
+
+}
Index: GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshLoader.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshLoader.h	(revision 1070)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshLoader.h	(revision 1078)
@@ -22,4 +22,6 @@
 #include "GeoBase.h"
 #include "GeoMesh.h"
+#include "GeoLodStripsLibrary.h"
+#include "GeoLodTreeLibrary.h"
 
 namespace Geometry 
@@ -204,4 +206,7 @@
 			//	Get the size in bytes of the file.
 			size_t	getFileSize();
+
+			Geometry::LodStripsLibraryData lodstripsdata;
+			Geometry::TreeSimplificationSequence treesimpseq;
 	};
 }
Index: GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h	(revision 1050)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h	(revision 1078)
@@ -372,7 +372,7 @@
 
 	//	Initialize the lodstripslibrary for visualization.
-	void	setLodStripsLibrary(std::string lodfile, Mesh	*geomesh);
+	void	setLodStripsLibrary(const Geometry::LodStripsLibraryData &, Mesh	*geomesh);
 	//	Initialize the lodtreelibrary for visualization.
-	void	setLodTreesLibrary(std::string lodfile, std::string leafseqfile, Mesh	*geomesh, uint32 ileafSubMesh);
+	void	setLodTreesLibrary(const Geometry::LodStripsLibraryData &, const Geometry::TreeSimplificationSequence &, Mesh	*geomesh, uint32 ileafSubMesh);
 
 	// Indentify the mesh of leaves.
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshLoader.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshLoader.cpp	(revision 1071)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshLoader.cpp	(revision 1078)
@@ -642,4 +642,8 @@
 //	Read a mesh file.
 //---------------------------------------------------------------------------
+
+#include "GeoLodStripsLibrary.h"
+#include "GeoLodStripsConstructor.h"
+
 void GeoMeshLoader::readMesh(FILE	*f, Mesh	*geoMesh, int option)
 {
@@ -670,8 +674,77 @@
 				 chunkID == M_MESH_BOUNDS ||
 				 chunkID == M_SUBMESH_NAME_TABLE ||
-				 chunkID == M_EDGE_LISTS))
+				 chunkID == M_EDGE_LISTS ||
+				 chunkID == 0xabcd || 
+				 chunkID == 0xdcba))
 		{
 			switch(chunkID)
 			{
+				case 0xabcd:
+					cout << "LODSTRIPS_Chunk" << endl;
+					int				aux,v,c;
+					LODRegisterType	lod_register;
+					LODData			dataaux;
+					int				tam;
+
+					fread(&tam, sizeof(int), 1, f);
+					lodstripsdata.mFileVertices.clear();
+					for (v=0; v<tam; v++)
+					{
+						fread(&aux, sizeof(int), 1, f);
+						lodstripsdata.mFileVertices.push_back(aux);
+					}
+
+					lodstripsdata.mFileChangesLOD.clear();
+					fread(&tam, sizeof(int), 1, f);
+					for (c=0; c<tam; c++)
+					{
+						fread(&dataaux, sizeof(LODData), 1, f);
+						lod_register.strip= dataaux.strip;
+						lod_register.position= dataaux.nP;
+						lod_register.vertexRepetition= dataaux.nL1;
+						lod_register.edgeRepetition= dataaux.nL2;
+						//lod_register.obligatory=false;
+						//lod_register.obligatory= dataaux.obligatory;
+
+						lodstripsdata.mFileChangesLOD.push_back(lod_register);
+					}
+					
+					lodstripsdata.mData.clear();
+					fread(&tam, sizeof(int), 1, f);
+					for (int b=0; b<tam; b++)
+					{
+						fread(&aux, sizeof(int), 1, f);
+						lodstripsdata.mData.push_back(aux);
+					}
+
+					lodstripsdata.p_changes.clear();
+					fread(&tam, sizeof(int), 1, f);
+					for (int p=0; p<tam; p++)
+					{
+						fread(&aux, sizeof(int), 1, f);
+						lodstripsdata.p_changes.push_back(aux);
+					}					
+
+					break;
+
+				case 0xdcba:
+					cout << "LODTREES_Chunk" << endl;
+					int size;
+					fread(&size, sizeof(int), 1, f);
+					treesimpseq.mSteps.clear();
+					for (int i=0; i<size; i++)
+					{
+						Geometry::TreeSimplificationSequence::Step auxstep;
+						fread(&auxstep.mV0,sizeof(int),1,f);
+						fread(&auxstep.mV1,sizeof(int),1,f);
+						fread(&auxstep.mT0,sizeof(int),1,f);
+						fread(&auxstep.mT1,sizeof(int),1,f);
+						fread(auxstep.mNewQuad,sizeof(int),4,f);
+						treesimpseq.mSteps.push_back(auxstep);
+					}
+
+					break;
+
+
 				case M_GEOMETRY:
 
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp	(revision 1070)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp	(revision 1078)
@@ -811,5 +811,5 @@
 	if (mGeoMesh != NULL)
 	{
-		fcho	=	new fltk::FileChooser("",
+/*		fcho	=	new fltk::FileChooser("",
 				"*.lod",
 				fltk::FileChooser::CREATE,
@@ -820,14 +820,14 @@
 		//	If a file was selected.
 		if (fcho->value())
-		{
+		{*/
 			//	Build lod strips library.
-			setLodStripsLibrary(string(fcho->value()), mGeoMesh);
+			setLodStripsLibrary(geoMeshLoader->lodstripsdata, mGeoMesh);
 
 			//	Sets the aplication mode.
 			mApplicationState	=	VISUALIZE_LODSTRIPS;
-		}
+	/*	}
 
 		//	Free memory.
-		delete	fcho;
+		delete	fcho;*/
 
 		//	Hide the right panel.
@@ -883,8 +883,8 @@
 
 		//	If an object is loaded.
-		if (mGeoMesh != NULL)
+/*		if (mGeoMesh != NULL)
 		{
 			fcho	=	new fltk::FileChooser("",
-					"*.lod",
+					"*.mesh",
 					fltk::FileChooser::CREATE,
 					"Open Lod file");
@@ -908,16 +908,17 @@
 				if (fcho->value())
 				{
-					std::string leafseqFile(fcho->value());
-
-					setLodTreesLibrary(lodstripFile, leafseqFile, mGeoMesh, leafsSubMeshID);
+					std::string leafseqFile(fcho->value());*/
+
+					//setLodTreesLibrary(lodstripFile, leafseqFile, mGeoMesh, leafsSubMeshID);
+					setLodTreesLibrary(geoMeshLoader->lodstripsdata, geoMeshLoader->treesimpseq, mGeoMesh, leafsSubMeshID);
 
 					//	Sets the aplication mode.
 					mApplicationState	=	VISUALIZE_LODTREES;
-				}
+/*				}
 			}
 
 			//	Free memory.
 			delete	fcho;
-
+*/
 			//	Hide the right panel.
 			hideRightPanel();
@@ -932,5 +933,5 @@
 			//	Repaint the window.
 			mMainWindow->redraw();
-		}
+/*		}*/
 	}
 }
@@ -1243,119 +1244,93 @@
 	{
 		//	Choose between aplication state.
-		switch(mApplicationState)
+		if (mApplicationState==LODSTRIPS_AUTO || mApplicationState==LODTREES_AUTO)
 		{
-			//	Build the LOD file.
-			case	LODTREES_AUTO:
-
-				//	Open file chooser dialog.
-				file_name	=	fltk::file_chooser("Build LOD","*","");
-				
-				if (!file_name)
-				{
-					break;
-				}
-
-				std::cout << "Creando secuencia de simplificacion de hojas...";
-				
-				createLeavesSequence(file_name+std::string(".leafseq"));
-				
-				std::cout << "OK!" << std::endl;
-
-				/*				TreeSimplificationSequence * auxTreeSimpSequence = new TreeSimplificationSequence();
-									auxTreeSimpSequence->Load(Serializer("leavesSimplification.txt",Serializer::READ));
-
-									if (auxTreeSimpSequence && mGeoMesh)
-									{
-									LodTreeConstructor * auxLodTreeConstructor = new LodTreeConstructor(mGeoMesh,auxTreeSimpSequence);
-									delete auxLodTreeConstructor;
-									}
-									else
-									{
-									fltk::alert("There is no leaf simplification sequence.");
-									break;
-									}
-
-
-									delete auxTreeSimpSequence;*/
-
-			case	LODSTRIPS_AUTO:
-
-				//	Builder
-				if (!file_name)
-				{
-					file_name	=	fltk::file_chooser("Build LOD","*","");
-				}
-				
-				//	If a file was selected.
-				if (file_name)
-				{
-					//	Undo the simplification changes.
-					undo();
-
-					//	Stripify the mesh object.
-					stripify();
-
-					//	Reset the build bar.
-					mBuildBar->position(0);
-
-					//	Simplification sequence.
-					oMeshSimpSequence = new MeshSimplificationSequence();
-
-					//	Loads a simplification sequence file.
-					oMeshSimpSequence->Load(Serializer(	"SimplifSequence.txt",
-																							Serializer::READ));
-
-					//	If the simplification sequence and the mesh exist.
-					if (oMeshSimpSequence && mGeoMesh)
+			file_name	=	fltk::file_chooser("Build LOD","*.mesh","");
+			
+			//	If a file was selected.
+			if (file_name)
+			{
+				//	Undo the simplification changes.
+				undo();
+
+				//	Stripify the mesh object.
+				stripify();
+
+				//	Reset the build bar.
+				mBuildBar->position(0);
+
+				//	Simplification sequence.
+				oMeshSimpSequence = new MeshSimplificationSequence();
+
+				//	Loads a simplification sequence file.
+				oMeshSimpSequence->Load(Serializer("SimplifSequence.txt",Serializer::READ));
+
+				//	If the simplification sequence and the mesh exist.
+				if (oMeshSimpSequence && mGeoMesh)
+				{
+					oLodStrip		=	new LodStripsConstructor(	mGeoMesh,
+							oMeshSimpSequence,
+							idMeshLeaves,
+							progress_function);
+
+//						oSerializer	= new Serializer(file_name,Serializer::Mode::WRITE);
+
+                    oLodStrip->UpdateMesh();
+
+					//	Deletes the previous mesh.
+					delete mUndoMesh;
+
+					mUndoMesh	=	new Mesh();
+
+					//	Sets the undo mesh.
+					*mUndoMesh	=	*mGeoMesh;
+
+					delete	mGeoMesh;
+
+					mGeoMesh	=	oLodStrip->GetMesh();
+
+					geoMeshView->setMesh(mGeoMesh);
+
+					mesh_saver	=	new	GeoMeshSaver();
+//					file_name[strlen(file_name) - 4]	=	'\0';
+					
+					mesh_saver->leavesSubMesh=idMeshLeaves;
+					mesh_saver->leavesVB=origSubMeshVB;
+					mesh_saver->numindices=orig_numindices;
+					mesh_saver->indices=orig_indices;
+					mesh_saver->save(mGeoMesh,file_name);
+					delete	mesh_saver;
+					oLodStrip->Save(file_name);
+					//	Close file.
+//						delete	oSerializer;				
+				}
+				else
+				{
+					//	Error message.
+					fltk::alert("There is no simplification sequence.");
+				}
+
+				//	Deletes the siplification sequence object.
+				delete	oMeshSimpSequence;
+
+				if (mApplicationState==LODTREES_AUTO)
+				{
+					//	Open file chooser dialog.
+/*					file_name	=	fltk::file_chooser("Build LOD","*","");
+					
+					if (!file_name)
 					{
-						oLodStrip		=	new LodStripsConstructor(	mGeoMesh,
-								oMeshSimpSequence,
-								idMeshLeaves,
-								progress_function);
-
-						oSerializer	=	new Serializer(	strcat(file_name,".lod"),
-																					Serializer::Mode::WRITE);
-
-						oLodStrip->Save(*oSerializer);
-
-						//	Close file.
-						delete	oSerializer;
-
-						//	Deletes the previous mesh.
-						delete mUndoMesh;
-
-						mUndoMesh	=	new Mesh();
-
-						//	Sets the undo mesh.
-						*mUndoMesh	=	*mGeoMesh;
-
-						delete	mGeoMesh;
-
-						mGeoMesh	=	oLodStrip->GetMesh();
-
-						geoMeshView->setMesh(mGeoMesh);
-
-						mesh_saver	=	new	GeoMeshSaver();
-						file_name[strlen(file_name) - 4]	=	'\0';
-						
-						mesh_saver->leavesSubMesh=idMeshLeaves;
-						mesh_saver->leavesVB=origSubMeshVB;
-						mesh_saver->numindices=orig_numindices;
-						mesh_saver->indices=orig_indices;
-						mesh_saver->save(mGeoMesh,strcat(file_name,".mesh"));
-						
-						delete	mesh_saver;
-					}
-					else
-					{
-						//	Error message.
-						fltk::alert("There is no simplification sequence.");
-					}
-
-					//	Deletes the siplification sequence object.
-					delete	oMeshSimpSequence;
-				}
-				break;
+						break;
+					}*/
+
+					std::cout << "Creando secuencia de simplificacion de hojas...";
+					
+					createLeavesSequence(file_name);
+					
+					std::cout << "OK!" << std::endl;		
+				}
+			}
 		}
+
 		//	Refresh data aplication.
 		refreshApplicationBar();
@@ -2236,6 +2211,6 @@
 	tree_sequencer	=	mTreeSimplifier->GetSimplificationSequence();
 	
-	tree_sequencer->putMeshName(nombremesh); 
-	tree_sequencer->Save(Serializer(filename,Serializer::WRITE));
+	tree_sequencer->putMeshName(nombremesh); 	
+	tree_sequencer->Save(Serializer(filename,Serializer::APPEND));
 
 	delete	tree_sequencer;
@@ -2392,5 +2367,5 @@
 //	Initialize the lodstripslibrary for visualization.
 //---------------------------------------------------------------------------
-void	GeoMeshViewUI::setLodStripsLibrary(std::string lodfile, Mesh	*geomesh)
+void	GeoMeshViewUI::setLodStripsLibrary(const Geometry::LodStripsLibraryData &loddata, Mesh	*geomesh)
 {
 	//	If there is no lod strips object.
@@ -2401,5 +2376,5 @@
 
 	//	New lod strips object.
-	lodStripsLib	=	new	LodStripsLibrary(lodfile, geomesh);
+	lodStripsLib	=	new	LodStripsLibrary(loddata, geomesh);
 
 	//	Sets the slider range.
@@ -2417,7 +2392,5 @@
 //	Initialize the lodTreelibrary for visualization.
 //---------------------------------------------------------------------------
-//void	GeoMeshViewUI::setLodTreesLibrary(std::string lodfile, Mesh	*geomesh)
-void	GeoMeshViewUI::setLodTreesLibrary(std::string lodfile, std::string leafseqfile, Mesh *geomesh, uint32 ileafSubMesh)
-
+void	GeoMeshViewUI::setLodTreesLibrary(const LodStripsLibraryData &lodstripsdata, const TreeSimplificationSequence &treesimpseq, Mesh *geomesh, uint32 ileafSubMesh)
 {
 	//	If there is no lod strips object.
@@ -2428,13 +2401,8 @@
 
 	//	New lod strips object.
-/*	lodTreeLib	=	new	Geometry::LodTreeLibrary(lodfile, geomesh,"\\\\quake\\home\\\Modelos\\betula_populifolia\\vertices.obj",
-										"\\\\quake\\home\\\Modelos\\betula_populifolia\\hojas.obj",
-										"\\\\quake\\home\\\Modelos\\betula_populifolia\\simplifica.obj");*/
-
-	lodTreeLib = new Geometry::LodTreeLibrary(lodfile,leafseqfile,geomesh,ileafSubMesh);
+
+	lodTreeLib = new Geometry::LodTreeLibrary(lodstripsdata,treesimpseq,geomesh,ileafSubMesh);
 
 	//	Sets the slider range.
-//	mLodStripSlider->range(lodTreeLib->MaxTrunkLod(), lodTreeLib->MinTrunkLod());
-//	mLodTreeSlider->range(lodTreeLib->MaxFoliageLod(), lodTreeLib->MinFoliageLod());
 	mLodStripSlider->range(0.0f,1.0f);
 	mLodTreeSlider->range(0.0f,1.0f);
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp	(revision 1070)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp	(revision 1078)
@@ -892,4 +892,6 @@
 	current_strip = 0;
 
+	int begin_index = 0;
+
 	//	For each submesh.
 	for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++)
@@ -966,6 +968,10 @@
 		}*/
 
+		int indices_to_render = lodStripsLib->indices_x_submesh[submesh];
+
+
 		glBegin(GL_TRIANGLE_STRIP);
-		for (int index = 0; index < lodStripsLib->dataRetrievalInterface->GetNumValidIndices(); index ++)
+		//for (int index = 0; index < lodStripsLib->dataRetrievalInterface->GetNumValidIndices(); index ++)
+		for (int index = begin_index; index < indices_to_render+begin_index; index ++)
 		{
 			position = lodStripsLib->dataRetrievalInterface->GetIndex(index);
@@ -1001,4 +1007,5 @@
 		}
 		glEnd();
+		begin_index += indices_to_render;
 
 	}
@@ -1026,4 +1033,6 @@
 	// DRAW THE TRUNK AS A LODSTRIP OBJECT
 
+	int begin_index = 0;
+
 	//	For each submesh.
 	for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++)
@@ -1102,6 +1111,9 @@
 
 		}*/
+	
+		int indices_to_render = lodTreeLib->trunk->indices_x_submesh[submesh];
+        		
 		glBegin(GL_TRIANGLE_STRIP);
-		for (int index = 0; index < lodTreeLib->CurrentLOD_Trunk_Indices()->GetNumValidIndices(); index ++)
+		for (int index = begin_index; index < lodTreeLib->trunk->indices_x_submesh[submesh]; index ++)
 		{
 			position = lodTreeLib->CurrentLOD_Trunk_Indices()->GetIndex(index);
@@ -1137,4 +1149,5 @@
 		}
 		glEnd();
+		begin_index += indices_to_render;
 
 	}
