Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h	(revision 1069)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h	(revision 1070)
@@ -42,6 +42,6 @@
 	typedef struct
 	{
-		float Vertex[3];
-		SmallInt Next;
+		float			Vertex[3];
+		SmallInt	Next;
 	} VertexType;
 
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoBase.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoBase.h	(revision 1014)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoBase.h	(revision 1070)
@@ -12,6 +12,6 @@
 .
 */
-namespace Geometry {
-
+namespace Geometry
+{
 	//	Basic types.
 	typedef float 					Real;
@@ -41,5 +41,4 @@
 		unsigned short boneIndex;
 		Real weight;
-
 	};
 
@@ -55,5 +54,5 @@
 		float	scaleFactor;
 	};
-	
+
 	//	Needed to update the progress bar.
 	typedef float updateProgressBar(float);
@@ -62,5 +61,4 @@
 
 } // end of Geometry namespace
-
 
 #define GEO_ENDIAN_LITTLE 1
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoMeshSimplifier.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoMeshSimplifier.h	(revision 1024)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoMeshSimplifier.h	(revision 1070)
@@ -59,4 +59,5 @@
 			//private: // fer protected
 			Mesh												*mGeoMesh;
+			Mesh												*mInitialMesh;
 			MeshSimplificationSequence	*msimpsequence;
 			const Mesh 									*objmesh;
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoTreeSimplifier.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoTreeSimplifier.h	(revision 1019)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoTreeSimplifier.h	(revision 1070)
@@ -94,5 +94,5 @@
 		void RecursiveFillOctreeWithLeaves(LeafOctree*);
 		LeafOctree* CreateLeafOctree(int deep); // generates a new leaf octree and returns its root node
-		int vertex_count;
+		size_t	vertex_count;
 		LeafOctree ** octree_owning_leaf;
 		LeafOctree *GetMinOctreeNodeForLeaf(LeafOctree *start, const Leaf &leaf);
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsConstructor.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsConstructor.h	(revision 1018)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsConstructor.h	(revision 1070)
@@ -67,6 +67,6 @@
 			//	Lista que contiene el modelo en varias tiras y cada tira
 			//	contiene la secuencia
+			//	de vertices que la forma
 
-			// de vertices que la forma
 			uint32 MARCA; //Para delimitar el final de tira.
 			uint32 TOTALTIRAS;
@@ -80,7 +80,9 @@
 			size_t	mSubMeshLeaves;
 
-			Mesh	*geoMesh;
+			Mesh	*mGeoMesh;
+			Mesh	*mInitialMesh;
+
 			const	Geometry::Mesh *meshoriginal;
-			/*const	*/MeshSimplificationSequence *geoMeshSQ;
+			/*const	*/MeshSimplificationSequence *mGeoMeshSQ;
 			int		NumVertsRepetidos;
 
@@ -120,4 +122,7 @@
 			void leeVerticesyTirasDeMesh();
 
+			//	Sort submesh bones.
+			void	sortBones();
+			
 		public:
 
@@ -149,7 +154,6 @@
 			Mesh	*	GetMesh();
 
-			// Sets what is the submesh that stores the leaves
+			///	Sets what is the submesh that stores the leaves.
 			void SetSubMeshLeaves(size_t	submesh);
-
 	};
 
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoMesh.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoMesh.h	(revision 980)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoMesh.h	(revision 1070)
@@ -59,3 +59,2 @@
 
 #endif
-
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp	(revision 1069)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp	(revision 1070)
@@ -83,5 +83,5 @@
 	uint32										return_value;
 
-	uint32 newLOD = (1.0f-lodfactor) * mLods;
+	uint32 newLOD = (uint32)((1.0f - lodfactor) * mLods);
     
 	//	Initialize the return value to the current LOD.
@@ -352,6 +352,4 @@
 void LodStripsLibrary::CopyVectors2Arrays()
 {
-	unsigned int			i;
-	unsigned int			j;
 	SmallInt 					max;
 	SmallInt 					t;
@@ -372,5 +370,6 @@
 //	unsigned int * strip_sizes = new unsigned int[mFileStrips.size()];
 	unsigned int total_strip_size = 0;
-	for (i = 0; i < mFileStrips.size(); i++)
+	
+	for (unsigned	int	i = 0; i < mFileStrips.size(); i++)
 	{
 		total_strip_size += t = int(mFileStrips[i].size());
@@ -383,5 +382,5 @@
 	
 	//	Fill up changes array.
-	for (i = 0; i < mFileChangesLOD.size(); ++i)
+	for (unsigned	int	i = 0; i < mFileChangesLOD.size(); ++i)
 	{
 		changes_array[i]	=	mFileChangesLOD[i];
@@ -392,8 +391,11 @@
 	//	Copy strips.
 	dataRetrievalInterface=create_index_data_func(total_strip_size);
-	dataRetrievalInterface->Begin();	
-	for (int ii = 0, i = 0; i < mFileStrips.size(); i++)
-	{
-		for (j = 0; j < mFileStrips[i].size(); j++,ii++)
+	dataRetrievalInterface->Begin();
+
+	unsigned	int	ii = 0;
+
+	for (unsigned	int	i = 0; i < mFileStrips.size(); i++)
+	{
+		for (unsigned	int	j = 0; j < mFileStrips[i].size(); j++,ii++)
 		{
 			mStrips[i].push_back(mFileStrips[i][j]);
@@ -406,5 +408,5 @@
 	dataRetrievalInterface->End();
 
-	for (i = 0; i < mData.size(); i++)
+	for (unsigned	int	i = 0; i < mData.size(); i++)
 	{
 		data_array[i]	=	mData[i];
@@ -414,5 +416,5 @@
 
 	//	Fill up mVertex.
-	for(i = 0; i < mFileVertices.size(); i++)
+	for(unsigned	int	i = 0; i < mFileVertices.size(); i++)
 	{
 		mVertex[i]	=	mFileVertices[i];
@@ -444,6 +446,4 @@
 	SubMesh														*geoSubMesh;
 
-
-
 	//	For each one of the submeshes.
 	for (unsigned int submesh	=	0; submesh < geomesh->mSubMeshCount; submesh++)
@@ -496,4 +496,5 @@
 	}
 
+	//	TODO:	LOD file loaded in load file mesh process.
 	//	Open the LOD file.
 	if ((fp = fopen (name, "r")) == NULL)
@@ -574,9 +575,11 @@
 }
 
-
 void LodStripsLibrary::UpdateDataRetrievalInterface(void)
 {
+	unsigned	int	ii	=	0;
+	
 	dataRetrievalInterface->Begin();
-	for (int i=0, ii=0; i<mTotalStrips; i++)
+
+	for (unsigned	int i=0; i<mTotalStrips; i++)
 	{
 		for (SmallIntVector::iterator it=mStrips[i].begin(); it!=mStrips[i].end(); it++, ii++)
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshSimplifier.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshSimplifier.cpp	(revision 1024)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshSimplifier.cpp	(revision 1070)
@@ -20,4 +20,8 @@
 																TIPOFUNC		upb)
 {
+	//	Saves initial state of mesh.
+	mInitialMesh	=	new Mesh();
+	*mInitialMesh	=	*m;
+	
 	objmesh					=	m;
 	mGeoMesh				=	NULL;
@@ -34,5 +38,6 @@
 MeshSimplifier::~MeshSimplifier()
 {
-	delete msimpsequence;
+	delete	mInitialMesh;
+	delete	msimpsequence;
 }
 
@@ -66,5 +71,5 @@
 void	MeshSimplifier::sortBones()
 {
-	Mesh									*mesh_copy;
+	bool									shared_found;
 	int										n;
 	int 									o;
@@ -72,50 +77,78 @@
 	VertexBoneAssignment	assign;
 	VertexBuffer					*mesh_vb;
-	VertexBuffer					*undo_vb;
+	VertexBuffer					*copy_vb;
 	SubMesh								*geosubmesh;
-	SubMesh								*undosubmesh;
-	
-	//	Gets a copy of the mesh.
-	mesh_copy		=	new Mesh();
-	*mesh_copy	=	*mGeoMesh;
-	
+	SubMesh								*copysubmesh;
+
+	std::vector<VertexBoneAssignment>	*mesh_bones;
+	std::vector<VertexBoneAssignment>	*copy_bones;
+	
+	//	Initialize shared flag.
+	shared_found	=	false;
+
 	//	For each submesh.
 	for (size_t	i	=	0; i < mGeoMesh->mSubMeshCount; i++)
 	{
 		geosubmesh	=	&mGeoMesh->mSubMesh[i];
-		undosubmesh	=	&mesh_copy->mSubMesh[i];
+		copysubmesh	=	&mInitialMesh->mSubMesh[i];
+
+		//	If submesh has shared vertex.
+		if (geosubmesh->mSharedVertexBuffer)
+		{
+			if (shared_found)
+			{
+				continue;
+			}
+
+			shared_found	=	true;
+			
+			//	Vertex buffers.
+			mesh_vb	=	mGeoMesh->mVertexBuffer;
+			copy_vb	=	mInitialMesh->mVertexBuffer;
+
+			//	Bones.
+			mesh_bones	=	&mGeoMesh->mBones;
+			copy_bones	=	&mInitialMesh->mBones;
+		}
+		else
+		{
+			//	Vertex buffers.
+			mesh_vb	=	geosubmesh->mVertexBuffer;
+			copy_vb	=	copysubmesh->mVertexBuffer;
+
+			//	Bones.
+			mesh_bones	=	&geosubmesh->mBones;
+			copy_bones	=	&copysubmesh->mBones;
+		}
 		
 		//	If there is submesh bones.
-		if (!geosubmesh->mBones.empty())
+		if (!mesh_bones->empty())
 		{
 			assign.boneIndex	=	0;
 			assign.weight			=	1;
 
-			geosubmesh->mBones.clear();
-
-			for (int	m	=	0;	m < geosubmesh->mVertexBuffer->mVertexCount;	m++)
+			mesh_bones->clear();
+
+			for (size_t	m	=	0;	m < mesh_vb->mVertexCount;	m++)
 			{
-				assign.vertexIndex	=	m;
+				assign.vertexIndex	=	(int)m;
 				
-				geosubmesh->mBones.push_back(assign);
+				mesh_bones->push_back(assign);
 			}
 
 			//	Change bones.
-			for (int	m = 0;	m < geosubmesh->mBones.size();	m++)
+			for (size_t	m = 0;	m < mesh_bones->size();	m++)
 			{
-				n	=	geosubmesh->mBones[m].vertexIndex;
+				n	=	(*mesh_bones)[m].vertexIndex;
 
 				//	Initialize o.
 				o	=	0;
 
-				mesh_vb	=	geosubmesh->mVertexBuffer;
-				undo_vb	=	undosubmesh->mVertexBuffer;
-
 				while (!(
-							(mesh_vb->mPosition[n].x == undo_vb->mPosition[o].x)
+							(mesh_vb->mPosition[n].x == copy_vb->mPosition[o].x)
 							&&
-							(mesh_vb->mPosition[n].y == undo_vb->mPosition[o].y)
+							(mesh_vb->mPosition[n].y == copy_vb->mPosition[o].y)
 							&&
-							(mesh_vb->mPosition[n].z == undo_vb->mPosition[o].z)
+							(mesh_vb->mPosition[n].z == copy_vb->mPosition[o].z)
 							))
 				{
@@ -126,5 +159,5 @@
 				p	=	0;
 
-				while (undosubmesh->mBones[p].vertexIndex != o)
+				while ((*copy_bones)[p].vertexIndex != o)
 				{
 					p++;
@@ -132,11 +165,9 @@
 
 				//	Same bone for 'm' and 'p'.
-				geosubmesh->mBones[m].boneIndex	=	undosubmesh->mBones[p].boneIndex;
+				(*mesh_bones)[m].boneIndex	=	(*copy_bones)[p].boneIndex;
 			}
 		}
 	}
 
-	//	Delete copy of the mesh.
-	delete	mesh_copy;
 }
 
@@ -176,4 +207,7 @@
 	mGeoMesh	=	m_qslim->GetMesh();
 	
+	//	Sort bones.
+	sortBones();
+	
 	delete	m_qslim;
 }
@@ -191,4 +225,7 @@
 
 	mGeoMesh	=	m_qslim->GetMesh();
+	
+	//	Sort bones.
+	sortBones();
 	
 	delete m_qslim;
@@ -278,5 +315,4 @@
 
 	VMI::initialIs	=	VMI::initIs(VMI::numCameras);
-
 }
 
@@ -313,4 +349,7 @@
 	loadMesh();
 
+	//	Sort bones.
+	sortBones();
+	
 	GetMeshSimpSequence();
 }
@@ -339,4 +378,7 @@
 	loadMesh();
 
+	//	Sort bones.
+	sortBones();
+	
 	GetMeshSimpSequence();
 }
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp	(revision 1069)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp	(revision 1070)
@@ -89,5 +89,15 @@
 void LodTreeLibrary::GoToFoliageLod(float newlod)
 {
-	uint32 targetLeaves = (1.0f-newlod)*foliage->minLeaves + newlod*foliage->leafCount;
+	uint32 targetLeaves = (uint32)
+												(
+													(1.0f - newlod)
+													*
+													foliage->minLeaves
+													+
+													newlod
+													*
+													foliage->leafCount
+												);
+
 	foliage->CalculateLOD(targetLeaves);
 
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoTreeSimplifier.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoTreeSimplifier.cpp	(revision 1019)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoTreeSimplifier.cpp	(revision 1070)
@@ -136,17 +136,17 @@
 void TreeSimplifier::Mesh2Structure(const Mesh *mesh, Index meshLeaves)
 {
-	long int countv=0;
-	long int pos=0;
-	long int v1, v2, v3;
-	long int triangleID=0;
+	size_t		countv=0;
+	long int	pos=0;
+	long int	v1, v2, v3;
+	long int	triangleID=0;
 
 	countv += vertex_count = mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount;	
 	Vertex  = new float[2*countv][3];
 		
-	int update_each = mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount/5;
+	size_t	update_each = mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount/5;
 	
 	for (unsigned int j=0; j<mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount; j++)
 	{
-		static int ticks_since_last_update = 0;
+		static size_t	ticks_since_last_update = 0;
 		if (mUPB && ticks_since_last_update>=update_each)
 		{
@@ -179,5 +179,5 @@
 	for (unsigned int j=0; j<mesh->mSubMesh[meshLeaves].mIndexCount; j=j+6) 
 	{
-		static int ticks_since_last_update = 0;
+		static size_t	ticks_since_last_update = 0;
 		if (mUPB && ticks_since_last_update>=update_each)
 		{
@@ -1193,5 +1193,5 @@
 
 	// calcualte the limits of the octree
-	for (int i=0; i<vertex_count; i++)
+	for (size_t	i	=	0; i < vertex_count; i++)
 	{
 		if (leafoctree->left>Vertex[i][0])
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp	(revision 1048)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp	(revision 1070)
@@ -1,19 +1,16 @@
 #include <iostream>
 #include <fstream>
-
+#include <time.h>
 #include "GeoLodStripsConstructor.h"
 
 using namespace Geometry;
 
-
-//--------------------------------------------------------------------------
-//Call GenerarModeloV and CopiarVectorsArraysNUEVAED to make changes
-//---------------------------------------------------------------------------
-//	Se utiliza en el constructor sobrecargado.
+//---------------------------------------------------------------------------
+//	Call GenerarModeloV and CopiarVectorsArraysNUEVAED to make changes.
+//---------------------------------------------------------------------------
 void LodStripsConstructor::GenerarModeloCompleto(TIPOFUNC	upb)
 {	
 	float	percent;
 
-
 	this->GenerarModeloV(upb);
 	this->CopiarVectors2ArraysNUEVAED();
@@ -24,7 +21,7 @@
 }
 
-//-----------------------------------------------------------------------------------
-//It makes Lods changes and count them
-//-----------------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+//	It makes Lods changes and count them.
+//---------------------------------------------------------------------------
 void LodStripsConstructor::CalcularCambiosLODsVNuevaED(TIPOFUNC upb)
 {
@@ -203,6 +200,7 @@
 
 
-					r= 0;
-					k=cStripsT.size()-3;
+					r	=	0;
+
+					k	=	(long)(cStripsT.size() - 3);
 
 				}
@@ -295,8 +293,7 @@
 }
 
-//-----------------------------------------------------------------------
+//---------------------------------------------------------------------------
 //Put in order vertex of Mesh from simplification sequence
-//-----------------------------------------------------------------------
-#include <time.h>
+//---------------------------------------------------------------------------
 void LodStripsConstructor::OrdenarModeloVQSLIM(TIPOFUNC	upb)
 {
@@ -326,5 +323,5 @@
 	bEncontrado = false;
 
-	int mStepsSize = geoMeshSQ->mSteps.size();
+	size_t	mStepsSize = mGeoMeshSQ->mSteps.size();
 
 	c1					=	0;
@@ -343,5 +340,5 @@
 		}
 		
-		const Geometry::MeshSimplificationSequence::Step & theStep = this->geoMeshSQ->mSteps[i];
+		const Geometry::MeshSimplificationSequence::Step & theStep = this->mGeoMeshSQ->mSteps[i];
 
 		mV1Aux.push_back(theStep.mV1);
@@ -426,5 +423,5 @@
 	int contestaban	=	0;
 
-	int cVertsSize = this->cVerts.size();
+	size_t	cVertsSize = this->cVerts.size();
 	for(i = 0; i < cVertsSize; i++)
 	{
@@ -481,10 +478,10 @@
 
 	//Creacion de nuevas tiras con las mismas dimensiones
-	int cStripsSize = this->cStrips.size();
+	size_t	cStripsSize = this->cStrips.size();
 	for(t = 0; t < cStripsSize; t++)
 	{
 		tira.clear();
 
-		int cStripsSizeT = this->cStrips[t].size();
+		size_t	cStripsSizeT = this->cStrips[t].size();
 		for(i = 0; i < cStripsSizeT; i++)
 			tira.push_back(0);
@@ -501,5 +498,5 @@
 	//	2 min.
 	//Cambiar los vertices de las tiras
-	int NuevosVertsSize = NuevosVerts.size();	
+	size_t	NuevosVertsSize = NuevosVerts.size();	
 	for(v = 0; v < NuevosVertsSize; v++)
 	{
@@ -516,5 +513,5 @@
 			std::vector<int> & thisStrip = cStrips[t];			
 			std::vector<int> & NuevasTirasT = NuevasTiras[t];
-			int cStripsSizeT = thisStrip.size();
+			size_t	cStripsSizeT = thisStrip.size();
 			for(i = 0; i < cStripsSizeT; i++)
 			{
@@ -545,12 +542,8 @@
 }
 
-//-----------------------------------------------------------------------------
+//---------------------------------------------------------------------------
 //	Constructor of LodStripsConstructor object from
-//	a Mesh and MeshSimplificationSequence
-//	Constructor del objeto LodStripsConstructor.
-//	Tomamos el Mesh y la secuencia de simplificacion que se pasan
-//	como parametros y llamamos a la funcion GenerarModeloCompleto para
-//	que se realicen las modificaciones a efectuar
-//-----------------------------------------------------------------------------
+//	a Mesh and MeshSimplificationSequence.
+//---------------------------------------------------------------------------
 LodStripsConstructor::LodStripsConstructor(const Mesh						*m,
 										   				const MeshSimplificationSequence	*ms,
@@ -560,18 +553,26 @@
 	MARCA	=	TOTALTIRAS	=	TOTALVERTS	=	TOTALCAMBIOS	=	0;
 	
-	meshoriginal		=	m;
-	this->geoMesh		=	new Geometry::Mesh();
-	*this->geoMesh	=	*m;
-	this->geoMeshSQ = const_cast<MeshSimplificationSequence*>(ms);
+	meshoriginal	=	m;
+	
+	mGeoMesh			=	new Mesh();
+	*mGeoMesh			=	*m;
+	
+	mInitialMesh	=	new Mesh();
+	*mInitialMesh	=	*m;
+	
+	this->mGeoMeshSQ	=	const_cast<MeshSimplificationSequence*>(ms);
 
 	//	Set the leaves submesh.
 	mSubMeshLeaves	=	submesh;
+	
 	this->GenerarModeloCompleto(upb);
-}
-
-//---------------------------------------------
+
+	//	Sort submesh bones.
+	this->sortBones();
+}
+
+//---------------------------------------------------------------------------
 //	Destructor LodStripsConstructor object
-//	Destructor de la clase LodStripsConstructor
-//---------------------------------------------
+//---------------------------------------------------------------------------
 LodStripsConstructor::~LodStripsConstructor()
 {
@@ -600,16 +601,12 @@
 	delete [] pCambios;
 
-	delete this->geoMesh;
-}
-
-//------------------------------------------------------------------------------
-//	build lod file with necessary information and save all changes at
-//	lodStripConstructor object
-//	Construimos el archivo Lod donde se guarda la informacion sobre los
-//	cambios realizados en el mesh
-//	y copiamos todos los cambios realizados sobre las estructuras que
-//	contienen los vertices y los indices 
-//	modificados sobre el objeto Mesh de la clase
-//------------------------------------------------------------------------------
+	delete	mInitialMesh;
+	delete	mGeoMesh;
+}
+
+//---------------------------------------------------------------------------
+//	Build lod file with necessary information and save all changes at
+//	lodStripConstructor object.
+//---------------------------------------------------------------------------
 void LodStripsConstructor::Save(Serializer &oSerializer)
 {
@@ -678,15 +675,15 @@
 	int num_no	=	0;
 
-	if(this->geoMesh->mSubMesh[0].mSharedVertexBuffer == true)
+	if(this->mGeoMesh->mSubMesh[0].mSharedVertexBuffer == true)
 	{
 		//mPosition
-		delete[] this->geoMesh->mVertexBuffer->mPosition;
-		this->geoMesh->mVertexBuffer->mPosition = new Vector3[this->cVerts.size()];
+		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->geoMesh->mVertexBuffer->mNormal;
-			this->geoMesh->mVertexBuffer->mNormal = new Vector3[this->cVerts.size()];
+			delete[] this->mGeoMesh->mVertexBuffer->mNormal;
+			this->mGeoMesh->mVertexBuffer->mNormal = new Vector3[this->cVerts.size()];
 		}
 
@@ -694,15 +691,15 @@
 		if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
 		{
-			delete[] this->geoMesh->mVertexBuffer->mTexCoords;
-			this->geoMesh->mVertexBuffer->mTexCoords = new Vector2[this->cVerts.size()];
-		}
-
-		this->geoMesh->mVertexBuffer->mVertexCount	=	this->cVerts.size();
-		this->geoMesh->mVertexBuffer->mVertexInfo		=	this->meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo;
-
-		for(i = 0; i < this->geoMesh->mSubMeshCount; i++)
-		{
-			this->geoMesh->mSubMesh[i].mVertexBuffer				=	this->geoMesh->mVertexBuffer;
-			this->geoMesh->mSubMesh[i].mSharedVertexBuffer	=	true;
+			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;
 		}
 
@@ -712,14 +709,14 @@
 		{
 			//Copiamos las coordeandas de posicion 
-			this->geoMesh->mVertexBuffer->mPosition[indice].x	=	this->cVerts[j].Vertex[0];
-			this->geoMesh->mVertexBuffer->mPosition[indice].y	=	this->cVerts[j].Vertex[1];
-			this->geoMesh->mVertexBuffer->mPosition[indice].z	=	this->cVerts[j].Vertex[2];
+			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->geoMesh->mVertexBuffer->mNormal[indice].x	=	this->cVerts[j].Normal[0];
-				this->geoMesh->mVertexBuffer->mNormal[indice].y	=	this->cVerts[j].Normal[1];
-				this->geoMesh->mVertexBuffer->mNormal[indice].z	=	this->cVerts[j].Normal[2];
+				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];
 			}
 
@@ -727,6 +724,6 @@
 			if (meshoriginal->mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
 			{
-				this->geoMesh->mVertexBuffer->mTexCoords[indice].x	=	this->cVerts[j].TexCoords[0];
-				this->geoMesh->mVertexBuffer->mTexCoords[indice].y	=	this->cVerts[j].TexCoords[1];
+				this->mGeoMesh->mVertexBuffer->mTexCoords[indice].x	=	this->cVerts[j].TexCoords[0];
+				this->mGeoMesh->mVertexBuffer->mTexCoords[indice].y	=	this->cVerts[j].TexCoords[1];
 			}
 
@@ -735,5 +732,5 @@
 		}
 
-		this->geoMesh->mVertexBuffer->mVertexCount	=	indice;
+		this->mGeoMesh->mVertexBuffer->mVertexCount	=	indice;
 	}
 	else	//OSCAR
@@ -741,13 +738,13 @@
 		//Supondre que solo tengo un submesh con vertices no compartidos
 		//mPosition
-		delete[]	this->geoMesh->mSubMesh[0].mVertexBuffer->mPosition;
+		delete[]	this->mGeoMesh->mSubMesh[0].mVertexBuffer->mPosition;
 		
-		this->geoMesh->mSubMesh[0].mVertexBuffer->mPosition	=	new Vector3[this->cVerts.size()];
+		this->mGeoMesh->mSubMesh[0].mVertexBuffer->mPosition	=	new Vector3[this->cVerts.size()];
 
 		//mNormal
 		if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
 		{
-			delete[] this->geoMesh->mSubMesh[0].mVertexBuffer->mNormal;
-			this->geoMesh->mSubMesh[0].mVertexBuffer->mNormal = new Vector3[this->cVerts.size()];
+			delete[] this->mGeoMesh->mSubMesh[0].mVertexBuffer->mNormal;
+			this->mGeoMesh->mSubMesh[0].mVertexBuffer->mNormal = new Vector3[this->cVerts.size()];
 		}
 
@@ -755,12 +752,12 @@
 		if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
 		{
-			delete[] this->geoMesh->mSubMesh[0].mVertexBuffer->mTexCoords;
-			this->geoMesh->mSubMesh[0].mVertexBuffer->mTexCoords = new Vector2[this->cVerts.size()];
-		}
-
-		this->geoMesh->mSubMesh[0].mVertexBuffer->mVertexCount =this->cVerts.size();
-		this->geoMesh->mSubMesh[0].mVertexBuffer->mVertexInfo = this->meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo;
-
-		this->geoMesh->mSubMesh[0].mSharedVertexBuffer=false;
+			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;
@@ -768,14 +765,14 @@
 		{
 			//Copiamos las coordeandas de posicion 
-			this->geoMesh->mSubMesh[0].mVertexBuffer->mPosition[indice].x=this->cVerts[j].Vertex[0];
-			this->geoMesh->mSubMesh[0].mVertexBuffer->mPosition[indice].y=this->cVerts[j].Vertex[1];
-			this->geoMesh->mSubMesh[0].mVertexBuffer->mPosition[indice].z=this->cVerts[j].Vertex[2];
+			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->geoMesh->mSubMesh[0].mVertexBuffer->mNormal[indice].x=this->cVerts[j].Normal[0];
-				this->geoMesh->mSubMesh[0].mVertexBuffer->mNormal[indice].y=this->cVerts[j].Normal[1];
-				this->geoMesh->mSubMesh[0].mVertexBuffer->mNormal[indice].z=this->cVerts[j].Normal[2];
+				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];
 			}
 
@@ -783,10 +780,10 @@
 			if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
 			{
-				this->geoMesh->mSubMesh[0].mVertexBuffer->mTexCoords[indice].x=this->cVerts[j].TexCoords[0];
-				this->geoMesh->mSubMesh[0].mVertexBuffer->mTexCoords[indice].y=this->cVerts[j].TexCoords[1];
+				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->geoMesh->mSubMesh[0].mVertexBuffer->mVertexCount =indice;
+		this->mGeoMesh->mSubMesh[0].mVertexBuffer->mVertexCount =indice;
 	}
 	
@@ -794,8 +791,8 @@
 
 	int indice_acum = 0;
-	for(i=0;i<this->geoMesh->mSubMeshCount;i++)
+	for(i=0;i<this->mGeoMesh->mSubMeshCount;i++)
 	{
 		Geometry::SubMesh & subMesh = meshoriginal->mSubMesh[i];
-		Geometry::SubMesh & geoMeshSubMesh = this->geoMesh->mSubMesh[i];
+		Geometry::SubMesh & mGeoMeshSubMesh = this->mGeoMesh->mSubMesh[i];
 
 		for (size_t ind=0; ind < subMesh.mIndexCount; ind++) 
@@ -807,13 +804,13 @@
 				if(subMesh.mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
 				{
-					for (size_t indvo=0; indvo<geoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)
-					{
-						if (igual(subMesh.mVertexBuffer->mPosition[indIndex],geoMeshSubMesh.mVertexBuffer->mPosition[indvo]))
+					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],geoMeshSubMesh.mVertexBuffer->mNormal[indvo]))
+							if (igual(subMesh.mVertexBuffer->mNormal[indIndex],mGeoMeshSubMesh.mVertexBuffer->mNormal[indvo]))
 							{
-								if (igual(subMesh.mVertexBuffer->mTexCoords[indIndex],geoMeshSubMesh.mVertexBuffer->mTexCoords[indvo]))
+								if (igual(subMesh.mVertexBuffer->mTexCoords[indIndex],mGeoMeshSubMesh.mVertexBuffer->mTexCoords[indvo]))
 								{
-									geoMeshSubMesh.mIndex[ind]= int(indvo);//+indice_acum;
+									mGeoMeshSubMesh.mIndex[ind]= int(indvo);//+indice_acum;
 								}
 							}
@@ -823,11 +820,11 @@
 				else		//Hay coordenadas de textura pero no hay normales
 				{
-					for (size_t indvo=0; indvo<geoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)
-					{
-						if (igual(subMesh.mVertexBuffer->mPosition[indIndex],geoMeshSubMesh.mVertexBuffer->mPosition[indvo]))
+					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],geoMeshSubMesh.mVertexBuffer->mTexCoords[indvo]))
+							if (igual(subMesh.mVertexBuffer->mTexCoords[indIndex],mGeoMeshSubMesh.mVertexBuffer->mTexCoords[indvo]))
 							{
-								geoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum;
+								mGeoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum;
 							}
 						}
@@ -840,11 +837,11 @@
 				if(subMesh.mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
 				{
-					for (size_t indvo=0; indvo<geoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)
-					{
-						if (igual(subMesh.mVertexBuffer->mPosition[indIndex],geoMeshSubMesh.mVertexBuffer->mPosition[indvo]))
+					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],geoMeshSubMesh.mVertexBuffer->mNormal[indvo]))
+							if (igual(subMesh.mVertexBuffer->mNormal[indIndex],mGeoMeshSubMesh.mVertexBuffer->mNormal[indvo]))
 							{
-								geoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum;
+								mGeoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum;
 							}
 						}
@@ -853,9 +850,9 @@
 				else		//No hay coordenadas de texturas ni normales
 				{
-					for (size_t indvo=0; indvo<geoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)
-					{
-						if (igual(subMesh.mVertexBuffer->mPosition[indIndex],geoMeshSubMesh.mVertexBuffer->mPosition[indvo]))
+					for (size_t indvo=0; indvo<mGeoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)
+					{
+						if (igual(subMesh.mVertexBuffer->mPosition[indIndex],mGeoMeshSubMesh.mVertexBuffer->mPosition[indvo]))
 						{
-							geoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum;
+							mGeoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum;
 						}
 					}
@@ -887,11 +884,9 @@
 }
 
-//-----------------------------------------------------------------------------------------------
-//Call leeVerticesyTirasDeMesh, OrdenarModeloVQSLIM and CalcularCambiosLODsVNuevaED to make changes 
-//at vertex and index strutures
-//Llama a los metodos que realizan los cambios sobre las estructuras que contienen la informacion 
-//de los vertices y los indices
-//-----------------------------------------------------------------------------------------------
-
+//---------------------------------------------------------------------------
+//	Call leeVerticesyTirasDeMesh, OrdenarModeloVQSLIM 
+//	and CalcularCambiosLODsVNuevaED to make changes at vertex 
+//	and index strutures.
+//---------------------------------------------------------------------------
 void LodStripsConstructor::GenerarModeloV(TIPOFUNC	upb)
 {
@@ -927,8 +922,7 @@
 }
 
-//-----------------------------------------------------------------------------------------
-//It fills structs with vertex and index information
-//Rellena estructuras de datos que contienen la informacion de vertices y tiras modificadas
-//-----------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+//	It fills structs with vertex and index information.
+//---------------------------------------------------------------------------
 void LodStripsConstructor::CopiarVectors2ArraysNUEVAED()
 {
@@ -1002,8 +996,8 @@
 }
 
-//---------------------------------------------------------------------------------------------------
-//It fills cVerts and cStrips with original Mesh vertex and strips information 
-//Rellena las estructuras cVerts Y cStrips a partir de de los vertices y las tiras del mesh original
-//---------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+//	It fills cVerts and cStrips with original Mesh vertex and strips 
+//	information.
+//---------------------------------------------------------------------------
 void LodStripsConstructor::leeVerticesyTirasDeMesh()
 {
@@ -1016,5 +1010,5 @@
 	error	=	false;
 	
-	if(this->geoMesh->mSubMeshCount == 1)
+	if(this->mGeoMesh->mSubMeshCount == 1)
 	{
 		error	=	false;
@@ -1022,7 +1016,7 @@
 	else
 	{
-		for	(i = 0; i < this->geoMesh->mSubMeshCount;i++)
-		{
-			if	(this->geoMesh->mSubMesh[i].mSharedVertexBuffer == true)
+		for	(i = 0; i < this->mGeoMesh->mSubMeshCount;i++)
+		{
+			if	(this->mGeoMesh->mSubMesh[i].mSharedVertexBuffer == true)
 			{
 				error	=	false;
@@ -1038,35 +1032,35 @@
 	if(!error)
 	{
-		if	(	(this->geoMesh->mSubMesh[0].mSharedVertexBuffer == true)
+		if	(	(this->mGeoMesh->mSubMesh[0].mSharedVertexBuffer == true)
 					&&
-					(this->geoMesh->mSubMeshCount > 1)
+					(this->mGeoMesh->mSubMeshCount > 1)
 				)
 		{
-			for	(j = 0; j < this->geoMesh->mVertexBuffer->mVertexCount; j++)
+			for	(j = 0; j < this->mGeoMesh->mVertexBuffer->mVertexCount; j++)
 			{
 				//	Si hay mas de un submesh ListaIndices no se rellena correctamente
-				vAux.Vertex[0] = this->geoMesh->mVertexBuffer->mPosition[j].x;
-				vAux.Vertex[1] = this->geoMesh->mVertexBuffer->mPosition[j].y;
-				vAux.Vertex[2] = this->geoMesh->mVertexBuffer->mPosition[j].z;
+				vAux.Vertex[0] = this->mGeoMesh->mVertexBuffer->mPosition[j].x;
+				vAux.Vertex[1] = this->mGeoMesh->mVertexBuffer->mPosition[j].y;
+				vAux.Vertex[2] = this->mGeoMesh->mVertexBuffer->mPosition[j].z;
 
 				//	Añadimos las normales en cVerts.
-				if	(	this->geoMesh->mVertexBuffer->mVertexInfo
+				if	(	this->mGeoMesh->mVertexBuffer->mVertexInfo
 							&
 							Geometry::VERTEX_NORMAL
 						)
 				{
-					vAux.Normal[0] = this->geoMesh->mVertexBuffer->mNormal[j].x;
-					vAux.Normal[1] = this->geoMesh->mVertexBuffer->mNormal[j].y;
-					vAux.Normal[2] = this->geoMesh->mVertexBuffer->mNormal[j].z;
+					vAux.Normal[0] = this->mGeoMesh->mVertexBuffer->mNormal[j].x;
+					vAux.Normal[1] = this->mGeoMesh->mVertexBuffer->mNormal[j].y;
+					vAux.Normal[2] = this->mGeoMesh->mVertexBuffer->mNormal[j].z;
 				}
 
 				//	Añadimos las coordenadas de textura a cVerts.
-				if	(	this->geoMesh->mVertexBuffer->mVertexInfo
+				if	(	this->mGeoMesh->mVertexBuffer->mVertexInfo
 							&
 							Geometry::VERTEX_TEXCOORDS
 						)
 				{
-					vAux.TexCoords[0] = this->geoMesh->mVertexBuffer->mTexCoords[j].x;
-					vAux.TexCoords[1] = this->geoMesh->mVertexBuffer->mTexCoords[j].y;
+					vAux.TexCoords[0] = this->mGeoMesh->mVertexBuffer->mTexCoords[j].x;
+					vAux.TexCoords[1] = this->mGeoMesh->mVertexBuffer->mTexCoords[j].y;
 				}
 
@@ -1081,30 +1075,30 @@
 		else
 		{
-			for	(i = 0; i < this->geoMesh->mSubMeshCount; i++)
+			for	(i = 0; i < this->mGeoMesh->mSubMeshCount; i++)
 			{
 				for	(	j = 0;
-						j < this->geoMesh->mSubMesh[i].mVertexBuffer->mVertexCount;
+						j < this->mGeoMesh->mSubMesh[i].mVertexBuffer->mVertexCount;
 						j++)
 				{
 					//	Si hay mas de un submesh ListaIndices 
 					//	no se rellena correctamente.
-					vAux.Vertex[0] = this->geoMesh->mSubMesh[i].
+					vAux.Vertex[0] = this->mGeoMesh->mSubMesh[i].
 						mVertexBuffer->mPosition[j].x;
-					vAux.Vertex[1] = this->geoMesh->mSubMesh[i].
+					vAux.Vertex[1] = this->mGeoMesh->mSubMesh[i].
 						mVertexBuffer->mPosition[j].y;
-					vAux.Vertex[2] = this->geoMesh->mSubMesh[i].
+					vAux.Vertex[2] = this->mGeoMesh->mSubMesh[i].
 						mVertexBuffer->mPosition[j].z;
 					//	Añadimos las normales en cVerts.
-					vAux.Normal[0] = this->geoMesh->mSubMesh[i].
+					vAux.Normal[0] = this->mGeoMesh->mSubMesh[i].
 						mVertexBuffer->mNormal[j].x;
-					vAux.Normal[1] = this->geoMesh->mSubMesh[i].
+					vAux.Normal[1] = this->mGeoMesh->mSubMesh[i].
 						mVertexBuffer->mNormal[j].y;
-					vAux.Normal[2] = this->geoMesh->mSubMesh[i].
+					vAux.Normal[2] = this->mGeoMesh->mSubMesh[i].
 						mVertexBuffer->mNormal[j].z;
 
 					//	Añadimos las coordenadas de textura a cVerts.
-					vAux.TexCoords[0]	=	this->geoMesh->mSubMesh[i].
+					vAux.TexCoords[0]	=	this->mGeoMesh->mSubMesh[i].
 						mVertexBuffer->mTexCoords[j].x;
-					vAux.TexCoords[1] = this->geoMesh->mSubMesh[i].
+					vAux.TexCoords[1] = this->mGeoMesh->mSubMesh[i].
 						mVertexBuffer->mTexCoords[j].y;
 
@@ -1122,5 +1116,5 @@
 		num_vert	=	0;
 		
-		for	(i = 0; i < this->geoMesh->mSubMeshCount; i++)
+		for	(i = 0; i < this->mGeoMesh->mSubMeshCount; i++)
 		{
 			//	If is not the leaves submesh.
@@ -1129,7 +1123,7 @@
 				indice_acum	=	0;
 
-				for	(j = 0; j < this->geoMesh->mSubMesh[i].mStripCount; j++)
-				{
-					Index	*aux	=	this->geoMesh->mSubMesh[i].mStrip[j];
+				for	(j = 0; j < this->mGeoMesh->mSubMesh[i].mStripCount; j++)
+				{
+					Index	*aux	=	this->mGeoMesh->mSubMesh[i].mStrip[j];
 
 					/*
@@ -1143,7 +1137,7 @@
 					*/
 
-					if (j+1 < this->geoMesh->mSubMesh[i].mStripCount)
-					{
-						Index	*siguiente	=	this->geoMesh->mSubMesh[i].mStrip[j+1];
+					if (j+1 < this->mGeoMesh->mSubMesh[i].mStripCount)
+					{
+						Index	*siguiente	=	this->mGeoMesh->mSubMesh[i].mStrip[j+1];
 
 						tira.clear();
@@ -1167,8 +1161,8 @@
 
 						for	(	unsigned int k = indice_acum;
-								k < this->geoMesh->mSubMesh[i].mIndexCount;
+								k < this->mGeoMesh->mSubMesh[i].mIndexCount;
 								k++)
 						{
-							tira.push_back(this->geoMesh->mSubMesh[i].mIndex[k]);
+							tira.push_back(this->mGeoMesh->mSubMesh[i].mIndex[k]);
 						}
 
@@ -1177,5 +1171,5 @@
 				}
 
-				num_vert	+=	int(this->geoMesh->mSubMesh[i].
+				num_vert	+=	int(this->mGeoMesh->mSubMesh[i].
 					mVertexBuffer->mVertexCount);
 			}
@@ -1191,5 +1185,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	GetMesh: Return de current Mesh.
+//---------------------------------------------------------------------------
 Mesh	*	LodStripsConstructor::GetMesh()
 {
@@ -1197,10 +1193,12 @@
 
 	mesh_built		=	new Mesh();
-	*mesh_built		=	*geoMesh;
+	*mesh_built		=	*mGeoMesh;
 
 	return	mesh_built;
 }
 
+//---------------------------------------------------------------------------
 // Sets what is the submesh that stores the leaves.
+//---------------------------------------------------------------------------
 void LodStripsConstructor::SetSubMeshLeaves(size_t	submesh)
 {
@@ -1208,2 +1206,135 @@
 }
 
+//---------------------------------------------------------------------------
+//	Sort submesh bones.
+//---------------------------------------------------------------------------
+void LodStripsConstructor::sortBones()
+{
+	bool									shared_found;
+	int										n;
+	int										o;
+	int										p;
+	VertexBoneAssignment	assign;
+	SubMesh								*submesh;
+	SubMesh								*copysubmesh;
+	VertexBuffer					*mesh_vb;
+	VertexBuffer					*copy_vb;
+
+	std::vector<VertexBoneAssignment>	*mesh_bones;
+	std::vector<VertexBoneAssignment>	*copy_bones;
+
+	//	Initialize shared vertex flag.
+	shared_found	=	false;
+
+	//	For each submesh.
+	for (size_t	i = 0;	i	<	mGeoMesh->mSubMeshCount;	i++)
+	{
+		submesh			=	&mGeoMesh->mSubMesh[i];
+		copysubmesh	=	&mInitialMesh->mSubMesh[i];
+
+		//	If submesh has shared vertex.
+		if (submesh->mSharedVertexBuffer)
+		{
+			if (shared_found)
+			{
+				continue;
+			}
+
+			shared_found	=	true;
+			
+			//	Vertex buffers.
+			mesh_vb	=	mGeoMesh->mVertexBuffer;
+			copy_vb	=	mInitialMesh->mVertexBuffer;
+
+			//	Bones.
+			mesh_bones	=	&mGeoMesh->mBones;
+			copy_bones	=	&mInitialMesh->mBones;
+		}
+		else
+		{
+			//	Vertex buffers.
+			mesh_vb	=	submesh->mVertexBuffer;
+			copy_vb	=	copysubmesh->mVertexBuffer;
+
+			//	Bones.
+			mesh_bones	=	&submesh->mBones;
+			copy_bones	=	&copysubmesh->mBones;
+		}
+		
+		if (!mesh_bones->empty())
+		{
+			assign.boneIndex	=	0;
+			assign.weight			=	1;
+
+			for (	size_t	m = copy_vb->mVertexCount;
+						m < mesh_vb->mVertexCount;
+						m++)
+			{
+				assign.vertexIndex	=	(unsigned int)m;
+				
+				mesh_bones->push_back(assign);
+			}
+
+			//	Change bones.
+			for (size_t	m = 0;	m < mesh_bones->size();	m++)
+			{
+				n	=	(*mesh_bones)[m].vertexIndex;
+
+				o	=	0;
+				
+				while (!(	(mesh_vb->mPosition[n].x == copy_vb->mPosition[o].x)
+									&&
+									(mesh_vb->mPosition[n].y == copy_vb->mPosition[o].y)
+									&&
+									(mesh_vb->mPosition[n].z == copy_vb->mPosition[o].z)))
+				{
+					o++;
+				}
+
+				p = 0;
+				
+				while ((*copy_bones)[p].vertexIndex != o)
+				{
+					p++;
+				}
+
+				//	Same bone for 'm' and 'p'.
+				(*mesh_bones)[m].boneIndex	=	(*copy_bones)[p].boneIndex;
+			}
+
+			//	Look for repeated bones.
+			for (size_t	m	=	0;	m < mesh_vb->mVertexCount;	m++)
+			{
+				for (size_t	n	=	m + 1;	n < mesh_vb->mVertexCount;	n++)
+				{
+					if ((mesh_vb->mPosition[m].x == mesh_vb->mPosition[n].x)
+							&&
+							(mesh_vb->mPosition[m].y == mesh_vb->mPosition[n].y)
+							&&
+							(mesh_vb->mPosition[m].z == mesh_vb->mPosition[n].z))
+					{
+						o	=	0;
+						
+						while ((*mesh_bones)[o].vertexIndex != m)
+						{
+							o++;
+						}
+
+						p	=	0;
+						
+						while ((*mesh_bones)[p].vertexIndex != n)
+						{
+							p++;
+						}
+
+						if ((*mesh_bones)[o].boneIndex != (*mesh_bones)[p].boneIndex)
+						{
+							printf("-->Error en los vertices %d y %d\n",m,n);
+						}
+					}
+				}
+			}
+		}
+	}
+}
+
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMesh.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMesh.cpp	(revision 1009)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMesh.cpp	(revision 1070)
@@ -514,15 +514,16 @@
 		}
 		
+		//	Shared bones.
+		if (!mSubMesh[i].mBones.empty())
+		{
+			for (unsigned int j = 0; j < mSubMesh[i].mBones.size(); j++)
+			{
+				mesh->mBones.push_back(mSubMesh[i].mBones[j]);
+				
+				mesh->mBones.back().vertexIndex	+= acumVerts;
+			}
+		}
+
 		acumVerts	+=	long(mSubMesh[i].mVertexBuffer->mVertexCount);
-
-		//	Copy submesh bones.
-		if (!mSubMesh[i].mBones.empty())
-		{
-			for (unsigned int j = 0; j < mSubMesh[i].mBones.size(); j++)
-			{
-				mesh->mSubMesh[i].mBones.push_back(mSubMesh[i].mBones[j]);
-			}
-		}
-
 	}
 
@@ -535,4 +536,5 @@
 	}
 
+	/*
 	//	Copy mesh bones.
 	if (!mBones.empty())
@@ -543,4 +545,5 @@
 		}
 	}
+	*/
 
 	return mesh;
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshStripifier.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshStripifier.cpp	(revision 1009)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshStripifier.cpp	(revision 1070)
@@ -36,5 +36,5 @@
 
 //-----------------------------------------------------------------------------
-///	AddHead.
+//	AddHead.
 //-----------------------------------------------------------------------------
 BOOL CustomStripifier::AddHead(PLISTHEAD LHead, PLISTINFO LInfo)
@@ -8452,7 +8452,6 @@
 			{
 				v_indices								=		mi_vector[i];
-				geoSubMesh->mIndexCount	+=	v_indices.size() /*+ 2*/;
-
-				/*
+				geoSubMesh->mIndexCount	+=	v_indices.size() + 2;
+
 				//	Insert a new vertex if the strip es odd.
 				if(oddStrip)
@@ -8470,5 +8469,4 @@
 					oddStrip	=	FALSE;
 				}
-				*/
 			}
 
@@ -8483,6 +8481,4 @@
 			//	Obtiene el total de indices de la primera strip.
 			//geoSubMesh->mIndexCount	=	v_indices.size();
-
-
 
 			//	Copia la primera tira en el array de indices.
@@ -8503,5 +8499,4 @@
 			//-----------------------
 
-			/*
 			//	Number of vertices of a strip odd or even.
 			if(v_indices.size() % 2)
@@ -8513,25 +8508,18 @@
 				oddStrip	=	FALSE;
 			}
-			*/
 
 			//	Para todas las tiras menos la primera.
 			for(i	=	2;	i <= num_tiras;	i++)
 			{
-				
 				/*	copia en el inicio de la tira el final de la anterior.
 						triangulos degenerados.	*/
-				/*
 				geoSubMesh->mIndex[totalStripIndices++]	=	geoSubMesh->
 					mIndex[totalStripIndices-1];
-				*/
 
 				v_indices								=	mi_vector[i];
-
-				//geoSubMesh->mIndexCount	=	geoSubMesh->mIndexCount	+	v_indices.size() + 2;
 
 				/*	copia el inicio de la tira 2 veces.
 						triangulos degenerados.
 						*/
-				
 				geoSubMesh->mIndex[totalStripIndices++]	=	v_indices[0];
 
@@ -8540,11 +8528,9 @@
 
 				//	Triangulo Degenerado.
-				//geoSubMesh->mIndex[totalStripIndices++]	=	v_indices[0];
-
-				/*
+				geoSubMesh->mIndex[totalStripIndices++]	=	v_indices[0];
+
 				//	Insert a new vertex if the strip es odd.
 				if(oddStrip)
 				{
-					//	geoSubMesh->mIndexCount++;
 					geoSubMesh->mIndex[totalStripIndices++]	=	v_indices[0];
 				}
@@ -8559,8 +8545,7 @@
 					oddStrip	=	FALSE;
 				}
-				*/
 				
 				//	Copia la tira en curso en el array de indices.
-				for(j=1;j<v_indices.size();j++)
+				for(j	=	1;	j < v_indices.size();	j++)
 				{
 					geoSubMesh->mIndex[totalStripIndices++]	=	v_indices[j];
Index: GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshLoader.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshLoader.h	(revision 1050)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshLoader.h	(revision 1070)
@@ -3,10 +3,10 @@
  *	==========================================================================
  *	PROYECT:	GAME TOOLS
- *	=========================================================================*/
-/**	CONTENT:	
-	*
-	*
-	*	@file	GeoMeshLoader.h
-/*===========================================================================*/
+ *	==========================================================================
+ *	CONTENT:	
+ *
+ *
+ *	@file	GeoMeshLoader.h
+ *===========================================================================*/
 #ifndef __GEO_MESH_LOADER__
 #define __GEO_MESH_LOADER__
@@ -64,5 +64,5 @@
 		VET_SHORT2,
 		VET_SHORT3,
-		VET_SHORT4, 
+		VET_SHORT4,
 		VET_UBYTE4
 	};
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshLoader.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshLoader.cpp	(revision 1050)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshLoader.cpp	(revision 1070)
@@ -426,5 +426,5 @@
 	}
 	
-	list.clear(); 
+	list.clear();
 
 	//	Gets material name.
@@ -879,5 +879,5 @@
 
 	//	Remove degenerate triangles of a submesh given.
-	geoSubMesh	=	removeDegenerateTriangles(geoSubMesh);
+	//geoSubMesh	=	removeDegenerateTriangles(geoSubMesh);
 
 	return	geoSubMesh;
@@ -910,5 +910,5 @@
 	indices	=	new	Index[new_index_count];
 
-	//	Initialize the current index;
+	//	Initialize the current index.
 	current_index	=	0;
 	
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp	(revision 1058)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp	(revision 1070)
@@ -183,9 +183,13 @@
 			}
 
-			//	If answer yes to replace question.
+			//	If answer yes to replace question
 			//	or if file not exists.
 			if (answer_yes)
 			{
 				mesh_saver	=	new	GeoMeshSaver();
+
+				//	Debug.
+				mGeoMesh	=	mGeoMesh->toSharedVertex();
+				//-------------------------------------
 
 				mesh_saver->save(mGeoMesh,filename_name(file_name));
@@ -803,5 +807,4 @@
 	//	Loads a mesh file.
 	openMeshFile();
-	
 
 	//	If an object is loaded.
@@ -828,15 +831,15 @@
 		delete	fcho;
 
-	//	Hide the right panel.
-	hideRightPanel();
-
-	//	Show title.
-	mProcessTitle->label("Visualize LodStrips");
-
-	//	Show the Visulize LodStrips panel.
-	showLodStripSlider();
-	
-	//	Repaint the window.
-	mMainWindow->redraw();
+		//	Hide the right panel.
+		hideRightPanel();
+
+		//	Show title.
+		mProcessTitle->label("Visualize LodStrips");
+
+		//	Show the Visulize LodStrips panel.
+		showLodStripSlider();
+
+		//	Repaint the window.
+		mMainWindow->redraw();
 
 	}
@@ -2408,5 +2411,5 @@
 	
 	//	Puts the slider in the max position.
-	//mLodStripSlider->value(lodStripsLib->MinLod());
+	mLodStripSlider->value(1.0f);
 }
 
@@ -3109,4 +3112,5 @@
 			o->begin();
 
+			/*
 			{
 				fltk::Widget* o;
@@ -3116,4 +3120,5 @@
 				o->color((fltk::Color)0xe0dfe300);
 			}
+			*/
 
 			{
@@ -3133,5 +3138,5 @@
 
 				//	Hide triangle count.
-				o->hide();
+				//o->hide();
 			}
 
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp	(revision 1069)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp	(revision 1070)
@@ -1007,5 +1007,4 @@
 }//End drawTriangleStrip.
 
-
 //---------------------------------------------------------------------------
 //	Paint lodtree object.
@@ -1172,6 +1171,4 @@
 }
 
-
-
 //---------------------------------------------------------------------------
 //	Sets the lodstripslibrary object.
@@ -1213,5 +1210,4 @@
 	draw();
 }
-
 
 //---------------------------------------------------------------------------
@@ -1319,7 +1315,6 @@
 
 	//	Calculate the FPS.
-	calcFPS();
-}
-
+	//calcFPS();
+}
 
 #include <IL/ILUT.h>
@@ -1338,5 +1333,4 @@
 }
 
-
 void	GeoMeshView::LoadTextureSubMesh(int isubmesh, const char *imgfile)
 {
@@ -1366,5 +1360,4 @@
 	}
 }
-
 
 bool	GeoMeshView::SetTextureRenderingState(int submesh)
@@ -1388,5 +1381,4 @@
 }
 
-
 int		GeoMeshView::findLeavesSubMesh(void)
 {
@@ -1396,2 +1388,3 @@
 	return -1;
 }
+
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshSaver.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshSaver.cpp	(revision 1024)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshSaver.cpp	(revision 1070)
@@ -23,8 +23,8 @@
 GeoMeshSaver::GeoMeshSaver()
 {
-	leavesSubMesh=-1;
-	leavesVB=NULL;
-	numindices=0;
-	indices=NULL;
+	leavesSubMesh	=	-1;
+	leavesVB			=	NULL;
+	numindices		=	0;
+	indices				=	NULL;
 }
 
@@ -147,5 +147,4 @@
 	}
 
-	//OSCAR
 	// Write skeleton info if required
 	if (geoMesh->hasSkeleton)
@@ -158,5 +157,5 @@
 		{
 
-			for (int i=0; i< geoMesh->mBones.size(); i++)
+			for (int i = 0; i< geoMesh->mBones.size(); i++)
 			{
 				writeMeshBoneAssignment(geoMesh->mBones[i]);
@@ -206,5 +205,5 @@
 	Index						*indexBegin;
 	Index						*indexEnd;
-	
+
 	// Header.
 	writeChunkHeader(M_SUBMESH, calcSubMeshSize(geoSubMesh));
@@ -222,10 +221,14 @@
 
 	indexCount	=	geoSubMesh->mIndexCount;
-
+	
+	/*
 	//	If the submesh is in triangle strips.
 	if (geoSubMesh->mType == GEO_TRIANGLE_STRIPS)
 	{
-		indexCount	+=	2 * geoSubMesh->mStripCount - 2;
-	}
+		indexCount	+=	(2 * geoSubMesh->mStripCount)
+										-
+										2;
+	}
+	*/
 	
 	//	Write index count.
@@ -236,4 +239,5 @@
 	writeBools(idx32bit, 1);
 
+	/*
 	//	If the submesh is in triangle strips.
 	if (geoSubMesh->mType == GEO_TRIANGLE_STRIPS)
@@ -260,4 +264,5 @@
 			i	= 0;
 
+			//	Degenerate.
 			if (strip != 0)
 			{
@@ -274,9 +279,9 @@
 			}
 
+			//	Degenerate.
 			if (strip	!= (geoSubMesh->mStripCount - 1))
 			{
 				writeInts(indexBegin[i - 1], 1);
 			}
-
 		}
 	}
@@ -284,4 +289,5 @@
 	else
 	{
+	*/
 		//	Write the index array.
 		for (int i = 0; i < geoSubMesh->mIndexCount; i++)
@@ -289,5 +295,5 @@
 			writeInts(geoSubMesh->mIndex[i], 1);
 		}
-	}
+	//}
 
 	// M_GEOMETRY stream (Optional: present only if useSharedVertices = false)
@@ -300,5 +306,5 @@
 	writeSubMeshOperation(geoSubMesh);
 
-	// Bone assignments
+	// Bone assignments.
 	if (!geoSubMesh->mBones.empty())
 	{
@@ -347,5 +353,4 @@
 
 	buffer_count	=	3;
-
 	
 	//	Calculate the size in bytes of the geometry chunk.
