Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h	(revision 1083)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h	(revision 1090)
@@ -144,4 +144,7 @@
 			void UpdateDataRetrievalInterface(void);			
 
+			//Number of strips in each submesh
+			int* mStripsSubmesh;
+
 		public:
 
@@ -177,4 +180,6 @@
 			uint32 GetValidIndexCount(int submeshid) const { return indices_x_submesh[submeshid]; }
 			uint32 GetValidOffset(int submeshid) const { return offsets_x_submesh[submeshid]; }
+			uint32 GetTotalStripCount(void) const { return mTotalStrips; }
+			uint32 GetSubMeshtripCount(int submeshid) const { return mStripsSubmesh[submeshid]; }
 	};
 }
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodTreeLibrary.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodTreeLibrary.h	(revision 1083)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodTreeLibrary.h	(revision 1090)
@@ -24,5 +24,5 @@
 		LodTreeLibrary(	const LodStripsLibraryData *,
 						const TreeSimplificationSequence *,
-						Geometry::Mesh *treeGeoMesh,
+						Geometry::Mesh *treeGeoMesh/*,
 						uint32 leafSubMeshID
 						/*std::string foliage_verts,
@@ -65,8 +65,10 @@
 		const IndexData* CurrentLOD_Foliage_Indices(void) const;
 		const VertexData* Get_Foliage_VertexData(void) const;
+		uint32 GetLeavesSubMesh(void) const { return mLeavesSubMesh; }
 
 	private:
 		Foliage *foliage;
 		Geometry::LodStripsLibrary *trunk;
+		uint32 mLeavesSubMesh;
 	};
 }
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp	(revision 1088)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp	(revision 1090)
@@ -34,4 +34,5 @@
 	indices_x_submesh = NULL;
 	offsets_x_submesh = NULL;
+	mStripsSubmesh = NULL;
 	
 	//	Loads the Level Of Detail file.
@@ -61,4 +62,6 @@
 	if (offsets_x_submesh)
 		delete[] offsets_x_submesh;
+	if (mStripsSubmesh)
+		delete[] mStripsSubmesh;
 }
 
@@ -573,25 +576,31 @@
 	mData = lodstripsdata->mData;
 	p_changes = lodstripsdata->p_changes;
-		
-		
-		//	Max / Min values for LOD.
-		mLods											=	int(p_changes.size());
-		mMaxLod										=	0;
-		mMinLod										=	mLods;
-
-		mPChanges			=	new SmallInt[mLods];
-		
-		for (unsigned int i = 0; i < mLods; i++)
-		{
-			mPChanges[i] = p_changes[i];
-		}
-
-		mTotalVertices		=	int(mFileVertices.size());
-		mMaxVerticesLOD		=	mTotalVertices;
-		mTotalStrips			=	int(mFileStrips.size());
-		mTotalChanges			=	int(mFileChangesLOD.size());
-
-		//Copy the data to the structure we will use
-		CopyVectors2Arrays();
+
+	mStripsSubmesh = new int [geomesh->mSubMeshCount];
+	for (int submesh = 0; submesh < geomesh->mSubMeshCount; submesh++)
+	{	
+		mStripsSubmesh[submesh]=0;
+	}
+
+			
+	//	Max / Min values for LOD.
+	mLods											=	int(p_changes.size());
+	mMaxLod										=	0;
+	mMinLod										=	mLods;
+
+	mPChanges			=	new SmallInt[mLods];
+	
+	for (unsigned int i = 0; i < mLods; i++)
+	{
+		mPChanges[i] = p_changes[i];
+	}
+
+	mTotalVertices		=	int(mFileVertices.size());
+	mMaxVerticesLOD		=	mTotalVertices;
+	mTotalStrips			=	int(mFileStrips.size());
+	mTotalChanges			=	int(mFileChangesLOD.size());
+
+	//Copy the data to the structure we will use
+	CopyVectors2Arrays();
 //	}
 }
@@ -618,4 +627,5 @@
 
 			counter = 0;
+			mStripsSubmesh[target_submesh] = strip_count;
 			strip_count = 0;
 			target_submesh++;
@@ -655,4 +665,5 @@
 
 		counter = 0;
+		mStripsSubmesh[target_submesh] = strip_count;
 		strip_count = 0;
 		target_submesh++;
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoTreeSimpSequence.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoTreeSimpSequence.cpp	(revision 1078)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoTreeSimpSequence.cpp	(revision 1090)
@@ -2,4 +2,5 @@
 #include <iostream>
 #include <fstream>
+#include "GeoMeshLoader.h"
 
 using namespace Geometry;
@@ -68,5 +69,5 @@
 	unsigned short chunkid = 0xdcba;
 	s.WriteData(&chunkid,sizeof(unsigned short),1);
-	unsigned long size = mSteps.size()*8*sizeof(int);
+	unsigned long size = mSteps.size()*8*sizeof(int) + CHUNK_OVERHEAD_SIZE;
 	s.WriteData(&size,sizeof(unsigned long),1);
 
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp	(revision 1083)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp	(revision 1090)
@@ -7,6 +7,6 @@
 Geometry::LodTreeLibrary::LodTreeLibrary(const LodStripsLibraryData *lodstripsdata,
 										 const TreeSimplificationSequence *simpseq,
-										 Geometry::Mesh *treeGeoMesh,
-										 uint32 leafSubMeshID/*
+										 Geometry::Mesh *treeGeoMesh/*,
+										 uint32 leafSubMeshID,
 							   CREATEVERTEXDATAFUNC vdfun,
 							   CREATEINDEXDATAFUNC idfun,
@@ -16,6 +16,17 @@
 	trunk = new LodStripsLibrary(lodstripsdata,treeGeoMesh);
 
+	// select the first triangle-list submesh as leaves submesh
+	mLeavesSubMesh = -1;
+	for (int i=0; i<treeGeoMesh->mSubMeshCount; i++)
+	{
+		if (treeGeoMesh->mSubMesh[i].mType==GEO_TRIANGLE_LIST)
+		{
+			mLeavesSubMesh=i;
+			break;
+		}
+	}	
+
 	// Cargar la copa del árbol
-	Geometry::SubMesh * leafsSubMesh = &(treeGeoMesh->mSubMesh[leafSubMeshID]);
+	Geometry::SubMesh * leafsSubMesh = &(treeGeoMesh->mSubMesh[mLeavesSubMesh]);
 	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 1078)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp	(revision 1090)
@@ -3,4 +3,5 @@
 #include <time.h>
 #include "GeoLodStripsConstructor.h"
+#include "GeoMeshLoader.h"
 
 using namespace Geometry;
@@ -619,5 +620,7 @@
 	int dataCount = this->cDatos.size();
 	int cambiosCount = this->TOTALCAMBIOS;
-	int size= dataCount*sizeof(LODData) + (vertexCount + changesCount + cambiosCount + 4)*sizeof(int);
+	int size =	changesCount*sizeof(LODData) + 
+				(vertexCount + dataCount + cambiosCount + 4)*sizeof(int) +
+				CHUNK_OVERHEAD_SIZE;
 
 	FILE *f = fopen(filename.c_str(),"ab");
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/GTGeometry.vcproj
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/GTGeometry.vcproj	(revision 1083)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/GTGeometry.vcproj	(revision 1090)
@@ -77,5 +77,7 @@
 			<Tool
 				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/GTGeometry.lib"/>
+				OutputFile="$(OutDir)/GTGeometry.lib"
+				IgnoreAllDefaultLibraries="TRUE"
+				IgnoreDefaultLibraryNames="LIBC"/>
 			<Tool
 				Name="VCMIDLTool"/>
Index: GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h	(revision 1083)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h	(revision 1090)
@@ -374,5 +374,5 @@
 	void	setLodStripsLibrary(const Geometry::LodStripsLibraryData *, Mesh	*geomesh);
 	//	Initialize the lodtreelibrary for visualization.
-	void	setLodTreesLibrary(const Geometry::LodStripsLibraryData *, const Geometry::TreeSimplificationSequence *, 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/GeoMeshViewUI.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp	(revision 1083)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp	(revision 1090)
@@ -852,5 +852,5 @@
 		if (geoMeshLoader->GetTreeSimpSeq() && geoMeshLoader->GetLodStripsData())
 		{
-			// select the first triangle-list submesh as leaves submesh
+/*			// select the first triangle-list submesh as leaves submesh
 			int leafsSubMeshID = -1;
 
@@ -862,7 +862,7 @@
 					break;
 				}
-			}
-
-			setLodTreesLibrary(geoMeshLoader->GetLodStripsData(), geoMeshLoader->GetTreeSimpSeq(), mGeoMesh, leafsSubMeshID);
+			}*/
+
+			setLodTreesLibrary(geoMeshLoader->GetLodStripsData(), geoMeshLoader->GetTreeSimpSeq(), mGeoMesh/*, leafsSubMeshID*/);
 
 			//	Sets the aplication mode.
@@ -2342,5 +2342,5 @@
 //	Initialize the lodTreelibrary for visualization.
 //---------------------------------------------------------------------------
-void	GeoMeshViewUI::setLodTreesLibrary(const LodStripsLibraryData *lodstripsdata, const TreeSimplificationSequence *treesimpseq, Mesh *geomesh, uint32 ileafSubMesh)
+void	GeoMeshViewUI::setLodTreesLibrary(const LodStripsLibraryData *lodstripsdata, const TreeSimplificationSequence *treesimpseq, Mesh *geomesh/*, uint32 ileafSubMesh*/)
 {
 	//	If there is no lod strips object.
@@ -2350,5 +2350,5 @@
 	//	New lod strips object.
 
-	lodTreeLib = new Geometry::LodTreeLibrary(lodstripsdata,treesimpseq,geomesh,ileafSubMesh);
+	lodTreeLib = new Geometry::LodTreeLibrary(lodstripsdata,treesimpseq,geomesh/*,ileafSubMesh*/);
 
 	//	Sets the slider range.
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp	(revision 1083)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp	(revision 1090)
@@ -1032,5 +1032,6 @@
 	for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++)
 	{
-		if (submesh==leavesSubMesh)
+		//if (submesh==leavesSubMesh)
+		if (submesh == lodTreeLib->GetLeavesSubMesh())
 			continue;
 
