Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp	(revision 1014)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp	(revision 1017)
@@ -5,4 +5,5 @@
 
 using namespace Geometry;
+
 
 //--------------------------------------------------------------------------
@@ -23,9 +24,11 @@
 }
 
-//----------------------------------------------------------------------------
-//	It makes Lods changes and count them.
-//----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------
+//It makes Lods changes and count them
+//-----------------------------------------------------------------------------------
 void LodStripsConstructor::CalcularCambiosLODsVNuevaED(TIPOFUNC upb)
 {
+//	LODPosition						pos;
+//	vector	<LODPosition>	listaPos;
 	long 		int							k;
 	long 		int							i;
@@ -34,25 +37,17 @@
 	unsigned long 		int		v;
 	long 		int							p0;
+	long 		int							lod	=	0;
 	long 		int							sigue;
-	unsigned long 		int		lod				=	0;
-	long 		int							ac[3]			=	{0,0,0};
+	long 		int							ac[3]	=	{0,0,0};
 	long 		int							totalRegs	=	0;
 	long 		int							RegsCambios;
-	vector	<VECTORINT>			TiraOriginal;
+	ObjList<ObjList<int> >			TiraOriginal;
 	LODData 								regLOD;
-	LODChanges							listaCambios;
-
-	//	Progress bar.
+	//LODChanges							listaCambios;
+	ObjList<LODData>						listaCambios;
 	float										percent;
 	float										increment;
 	long		int							update;
 
-	VECTORINT::iterator 					it;
-	VECTORINT::iterator 					itFin;
-	vector <VECTORINT>::iterator	itTiras;
-	vector <VECTORINT>::iterator	itTirasFin;
-	VECTORVERTEX::iterator				itVertex;
-	VECTORVERTEX::iterator				itVertexFin;
-
 	//	Saves original copy.
 	TiraOriginal			=	this->cStrips;
@@ -62,5 +57,4 @@
 	listaCambios.clear();
 
-	//	Progress bar.
 	//	Initialize increment.
 	increment	=	0.0;
@@ -75,40 +69,26 @@
 	percent		=	1.0;
 	
-	this->LodsDisp	=	this->TOTALCAMBIOS;//	=	lod;
+	this->LodsDisp	=	this->TOTALCAMBIOS	=	lod;
 	pCambios				=	new uint32[this->TOTALCAMBIOS];
 	pCambios[0]			=	0;
 	
-	listaCambios.reserve(this->TOTALCAMBIOS * 2);
-	cDatos.reserve(this->TOTALCAMBIOS * 2 * 2);
-
-	printf("\nEmpiezan los cambios...%d",this->TOTALCAMBIOS);
-
-	for	(	lod	=	0,	itVertex	=	this->cVerts.begin();
-				lod < this->TOTALCAMBIOS;
-				lod++,	itVertex++)
-	{
-		//	Progress bar.
-		if (update	!= (int)(increment * lod))
+	for	(lod = 0; ((this->cVerts[lod].Next) != -1); lod++)
+	{
+/*		if (update	!= (int)(increment * lod))
 		{
 			update	=	(int)(increment * lod);
 			upb(percent);
-		}
-		
-		/*
-		if ((lod % 100)==0)
-		{
-			printf("*%d*",lod);
-		}
-		*/
-		
-		RegsCambios	=	0;
-		
-		//	Last strip.
-		itTirasFin	=	this->cStrips.end();
-		
-		for(t	=	0,	itTiras	=	this->cStrips.begin();
-				itTiras != itTirasFin;
-				itTiras++,	t++)
-		{
+		}*/
+
+		tipoVertice & cVertsLOD = this->cVerts[lod];
+		
+		RegsCambios				=	0;
+		regLOD.obligatory	=	this->Ordenacion[lod].obligatorio;
+		
+		for(t = 0; t < this->cStrips.size(); t++)
+		{
+
+			ObjList<int> & cStripsT = this->cStrips[t];
+
 			//	Initialize.
 			regLOD.strip	=	this->MARCAVACIO;
@@ -117,13 +97,8 @@
 			totalRegs		=	0;
 			
-			//	Last index of the current strip.
-			itFin				=	itTiras->end();
-			
-			for (	it	=	itTiras->begin(),	v	=	0;
-						it != itFin;
-						it++,	v++)
-			{
-				if ((*it) == lod)
-				{
+			for (v = 0; v < cStripsT.size(); v++)
+			{
+				if (cStripsT[v] == lod)	
+				{ 
 					//	Strips.
 					if (regLOD.strip == this->MARCAVACIO)
@@ -136,5 +111,5 @@
 					cDatos.push_back(v);
 
-					*it	=	itVertex->Next;
+					cStripsT[v]	=	cVertsLOD.Next;
 				}
 			}
@@ -148,11 +123,13 @@
 			r					=	0;
 			sigue			=	0;
-			k					=	long(itTiras->size() - 3);
-			it				=	itTiras->begin();
-
+			k					=	long(cStripsT.size()-3);
+			
 			while (i < k)
 			{
-				if (	((*it) == (*(it + 1))) && ((*(it + 1)) == (*(it + 2))))
-				{
+				if (	(cStripsT[i] == cStripsT[i+1])
+							&&
+							(cStripsT[i+1] == cStripsT[i+2])
+						)
+				{ 
 					//	Saves beginning of repetition.
 					if (!r)
@@ -161,10 +138,10 @@
 					}
 					
-					itTiras->erase(itTiras->begin() + i);
+					cStripsT.eraseAtPos(i);
+					//this->cStrips[t].erase(this->cStrips[t].begin()+i);
 					i--;
-					it--;
 					r++;
 					
-					if ((i + 1) != (itTiras->size() - 1))
+					if ((i+1) != cStripsT.size()-1)
 					{
 						sigue	=	1;
@@ -194,9 +171,8 @@
 
 					r	=	0;
-					k	=	long(itTiras->size() - r - 3);
+					k	=	long(cStripsT.size()-r-3);
 				}
 
 				i++;
-				it++;
 			}
 			
@@ -208,11 +184,12 @@
 			r					=	0;
 			sigue			=	0;
-			k					=	long(itTiras->size() - 4);
+			k					=	long(cStripsT.size() - 4);
 			
-			it = itTiras->begin();
-
 			while	(i < k)
 			{
-				if (((*it) == (*(it + 2))) && ((*(it + 1)) == (*(it + 3))))
+				if (	(cStripsT[i] == cStripsT[i+2])
+							&&
+							(cStripsT[i+1] == cStripsT[i+3])
+						)
 				{
 					if (!r)
@@ -221,22 +198,21 @@
 					}
 					
-					itTiras->erase(itTiras->begin() + i);
-					itTiras->erase(itTiras->begin() + i);
-
+					cStripsT.eraseAtPos(i);
+					//this->cStrips[t].erase(this->cStrips[t].begin()+i);
+					cStripsT.eraseAtPos(i);
+					//this->cStrips[t].erase(this->cStrips[t].begin()+i);
 					r++;
 					
 					i	-=	2;
 					
-					it--;
-					it--;
+					if ((i+1) != cStripsT.size()-3)
+					{
+						sigue	=	1;
+					}
+					else
+					{
+						sigue	=	0;
+					}
 					
-					if ((i + 1) != itTiras->size() - 3)
-					{
-						sigue	=	1;
-					}
-					else
-					{
-						sigue	=	0;
-					}
 				}
 				else
@@ -258,9 +234,8 @@
 					
 					r	=	0;
-					k	=	long(itTiras->size() - 4 - 2 * r);
+					k	=	long((cStripsT.size()-4-2*r));
 				}
 
 				i++;
-				it++;
 			}
 			
@@ -277,10 +252,8 @@
 	}//	End for lod.
 
-	printf("\nFin de los cambios...");
-
 	this->cCambios	=	listaCambios;
 
 	//	Guardar el numero de LODS disponibles.
-	//this->TOTALCAMBIOS	=	this->LodsDisp=lod;
+	this->TOTALCAMBIOS	=	this->LodsDisp=lod;
 
 	//Retornar a la lista original
@@ -291,4 +264,5 @@
 //Put in order vertex of Mesh from simplification sequence
 //-----------------------------------------------------------------------
+#include <time.h>
 void LodStripsConstructor::OrdenarModeloVQSLIM(TIPOFUNC	upb)
 {
@@ -298,41 +272,34 @@
 	unsigned long int v;
 	long int vSig;
-	//long int k;
+	long int k;
 	VECTORVERTEX				Vertices;
-	VECTORVERTEX				NuevosVerts;
-	vector	<VECTORINT>	NuevasTiras;
-	VECTORINT						tira;
-	VECTORINT::iterator it;
-	VECTORINT::iterator itFin;
+	ObjList<tipoVertice>		NuevosVerts;
+	//vector	<VECTORINT>	NuevasTiras;
+	ObjList<ObjList<int> > NuevasTiras;
+//	VECTORINT						tira;
+	ObjList<int> tira;
 	vector	<Index>			mV1Aux;
 	tipoOrden						Orden;
 	tipoOrden						*Ord;
-	tipoOrden						*Ord2;
 	bool								bEncontrado;
 	long	int						c1;
 	long	int						c2;
-	
-	//	Progress bar.
+	//	Progress bar
 	float			percent;
 	float			increment;
 	long	int	update;
 
-	unsigned long int	totalSize;
-
 	bEncontrado = false;
 
-	printf("\n---->Lectura de Ordenacion");
-	
-	totalSize	=	(long int)this->geoMeshSQ->mSteps.size();
+	int mStepsSize = geoMeshSQ->mSteps.size();
 
 	c1					=	0;
 	c2					=	0;
 	
-	//	Progress bar.
 	update			=	-1;
 	percent			=	1.0;
-	increment		=	(float)(10.0) / (float)(totalSize);
-
-	for	(i = 0; i < totalSize; i++)
+	increment		=	(float)(10.0) / (float)mStepsSize;
+	
+	for	(i = 0; i < mStepsSize; i++)
 	{
 		if (update	!= (int)(i * increment))
@@ -342,12 +309,14 @@
 		}
 		
-		mV1Aux.push_back(this->geoMeshSQ->mSteps[i].mV1);
-
-		Orden.vQslimNext	=	this->geoMeshSQ->mSteps[i].mV0;
-		Orden.vQslim			=	this->geoMeshSQ->mSteps[i].mV1;
-		Orden.obligatorio	=	this->geoMeshSQ->mSteps[i].obligatorio;
+		const Geometry::MeshSimplificationSequence::Step & theStep = this->geoMeshSQ->mSteps[i];
+
+		mV1Aux.push_back(theStep.mV1);
+
+		Orden.vQslimNext	=	theStep.mV0;
+		Orden.vQslim			=	theStep.mV1;
+		Orden.obligatorio	=	theStep.obligatorio;
 		Orden.vLS					=	i;
 
-		Orden.x						=	this->geoMeshSQ->mSteps[i].x;
+		Orden.x						=	theStep.x;
 		Orden.vLSNext			=	-1;
 		Orden.cambio			=	"n";
@@ -355,22 +324,14 @@
 		Ordenacion.push_back(Orden);
 	}
-
+	
 	this->NumVertsRepetidos = c2;
 
-	printf("\n---->Cambiar vertices con x!0, Verts: %d",Ordenacion.size());
+	update		=	-1;
+	increment	=	(float)(10.0) / (float)(Ordenacion.size());
+	percent		=	1.0;
 
 	//	Change all vertices that have x != 0.
-	totalSize	=	(long int)Ordenacion.size();
-	Ord				=	&(Ordenacion[0]);
-
-	//	Progress bar.
-	update		=	-1;
-	increment	=	(float)(10.0) / (float)(totalSize);
-	percent		=	1.0;
-
-	//	Change all vertices that have x != 0.
-	for(i	=	0;	i < totalSize;	i++)
-	{
-		//	Progress bar.
+	for(i	=	0;	i < Ordenacion.size();	i++)
+	{
 		if (update	!= (int)(i * increment))
 		{
@@ -379,5 +340,7 @@
 		}
 		
-		if (Ord->x != 0)
+		Ord	=	&(Ordenacion[i]);
+
+		if (Ord->x!=0)
 		{
 			//	Change the simplification order.
@@ -385,38 +348,30 @@
 			Ord->vQslim			=	Ord->vQslimNext;
 			Ord->vQslimNext	=	v;
-			Ord2						=	&(Ordenacion[i + 1]);
-			
-			for (j = i + 1; j < totalSize; j++,Ord2++)
-			{
-				if (Ord2->vQslim == Ord->vQslim)
-				{
-					Ord2->vQslim	=	Ord->vQslimNext;
-					Ord2->cambio	=	"y";
-				}
-				else if (Ord2->vQslimNext == Ord->vQslim)
-				{
-					Ord2->vQslimNext	=	Ord->vQslimNext;	
-					Ord2->cambio			=	"y";
-				}
-			}
-		}
-
-		Ord++;
-	}
-
-	printf("\n---->Nuevos vertices");
-
-	totalSize	=	(long int)Ordenacion.size();
-	Ord				=	&(Ordenacion[0]);
-
-	//	Progress bar.
+
+			for (j = i+1; j < Ordenacion.size(); j++)
+			{
+				tipoOrden & ordJ = Ordenacion[j];
+				if (ordJ.vQslim == Ord->vQslim)
+				{
+					ordJ.vQslim	=	Ord->vQslimNext;
+					ordJ.cambio	=	"y";
+				}
+				else if (ordJ.vQslimNext == Ord->vQslim)
+				{
+					ordJ.vQslimNext	=	Ord->vQslimNext;	
+					ordJ.cambio			=	"y";
+				}
+			}
+		}
+	}
+
 	update		=	-1;
-	increment	=	(float)(10.0) / (float)(totalSize);
+	increment	=	(float)(10.0) / (float)(Ordenacion.size());
 	percent		=	1.0;
 
-	//	Vertex sort.
-	for(i = 0; i < totalSize; i++)
-	{
-		//	Progress bar.
+	//	3 seg.
+	//Ordenacion de los vertices
+	for(i = 0; i < Ordenacion.size(); i++)
+	{
 		if (update	!=	(int)(i * increment))
 		{
@@ -426,21 +381,17 @@
 
 		c1++;
-		NuevosVerts.push_back(this->cVerts[Ord->vQslim]);
-
-		cVerts[Ord->vQslim].Next	=	-1;
-
-		//--------
-		Ord++;
-		//--------
-	}
-
-	printf(	"\n---->Meter los que no se simplifican -> Ahora Hay: %d",
-					Ordenacion.size());
-
-	//	Adds new vertices not in NuevosVerts.
+		NuevosVerts.push_back(this->cVerts[Ordenacion[i].vQslim]);
+
+		cVerts[Ordenacion[i].vQslim].Next	=	-1;
+
+	}
+
+	//	Añadir aquellos vertices que no estaban en NuevosVerts 
+	//	y no se simplificaban.
 	int cont				=	0;
 	int contestaban	=	0;
 
-	for(i = 0; i < this->cVerts.size(); i++)
+	int cVertsSize = this->cVerts.size();
+	for(i = 0; i < cVertsSize; i++)
 	{
 		if (this->cVerts[i].Next != -1)
@@ -462,22 +413,12 @@
 	}
 
-	totalSize	=	(long int)Ordenacion.size();
-
-	printf("\n---->Siguientes QSLIM: %d",totalSize);
-
-	//	Progress bar.
 	update		=	-1;
-	increment	=	(float)(10.0)	/	(float)(totalSize);
+	increment	=	(float)(10.0)	/	(float)(Ordenacion.size());
 	percent		=	1.0;
 	
-	//	Obtain nexts.
-	if (totalSize > 0)
-	{
-		Ord	=	&(Ordenacion[0]);
-	}
-
-	for (i = 0; i < totalSize; i++)
-	{
-		//	Progress bar.
+	//	2 min.
+	//	Calcular los siguiente teniendo en cuenta el QSLIM.
+	for (i = 0; i < Ordenacion.size(); i++)
+	{
 		if (update	!=	(int)(i * increment))
 		{
@@ -486,121 +427,83 @@
 		}
 		
-		v			=	Ord->vQslimNext;
+		v	=	Ordenacion[i].vQslimNext;
+
+		//Buscar ese vertice v cual es ahora
 		vSig	=	0;
-		Ord2	=	&(Ordenacion[0]);
-		
-		for (t	=	0;	(t < totalSize) && !vSig;	t++)
-		{
-			if (Ord2->vQslim == v)
-			{
-				vSig	=	Ord2->vLS;
-			}
-			
-			Ord2++;
-		}
-		
-		if (vSig != 0)
-		{
-			Ord->vLSNext	=	vSig;
-		}
-		
-		Ord++;
-	}
-
-	printf("\n---->Crear nuevas de tiras");
-
-	/*
-	//	Create new strips with same dimensions.
-	for(t = 0; t < this->cStrips.size(); t++)
+
+		for (t = 0; t < Ordenacion.size() && !vSig;t++)
+		{
+			if (Ordenacion[t].vQslim==v)
+			{
+				vSig=Ordenacion[t].vLS;
+			}
+		}
+
+		if (vSig!=0)
+		{
+			Ordenacion[i].vLSNext	=	vSig;
+		}
+	}
+
+	//Creacion de nuevas tiras con las mismas dimensiones
+	int cStripsSize = this->cStrips.size();
+	for(t = 0; t < cStripsSize; t++)
 	{
 		tira.clear();
 
-		itFin	=	this->cStrips[t].end();
-
-		for(it = cStrips[t].begin(); it != itFin; it++)
-		{
-			//	For each new vertex.
-			for	(v = 0;	v < NuevosVerts.size(); v++)
-			{
-				Ord	=	&(Ordenacion[v]);
-
-				if ((*it) == Ord->vQslim)
-				{
-					tira.push_back(v);
-
-					//	Delete vertex inserted.
-					//NuevosVerts.erase(v);
-				}
-			}
-		}
+		int cStripsSizeT = this->cStrips[t].size();
+		for(i = 0; i < cStripsSizeT; i++)
+			tira.push_back(0);
 
 		NuevasTiras.push_back(tira);
 	}
-	*/
-	
-	//Creacion de nuevas tiras con las mismas dimensiones
-	for(t = 0; t < this->cStrips.size(); t++)
-	{
-		tira.clear();
-
-		for(i = 0; i < this->cStrips[t].size(); i++)
-		{
-			tira.push_back(0);
-		}
-
-		NuevasTiras.push_back(tira);
-	}
-	
-	update	=	long(NuevosVerts.size() / 40);
-	percent	=	0.5;
+
+	update		=	-1;
+	increment	=	(float)(20.0) / (float)(NuevosVerts.size());
+	percent		=	1.0;
+
+	k	=	0;
 
 	//	2 min.
 	//Cambiar los vertices de las tiras
-	for(v = 0; v < NuevosVerts.size(); v++)
-	{
-		if ((v % update) == 0)
-		{
+	int NuevosVertsSize = NuevosVerts.size();	
+	for(v = 0; v < NuevosVertsSize; v++)
+	{
+		if (update != (int)(v * increment))
+		{
+			update	=	(int)(v * increment);
 			upb(percent);
-		}
-
-		for(t = 0; t < this->cStrips.size(); t++)
-		{
-			for(i = 0; i < this->cStrips[t].size(); i++)
-			{
-				if (this->cStrips[t][i] == Ordenacion[v].vQslim)
-				{
-					NuevasTiras[t][i]	=	v;
-				}
-			}
-		}
-	}
-
-	printf("\n---->Copiar los datos");
-
-	//	Change to new strips.
+		}		
+
+		const tipoOrden & OrdenacionV = Ordenacion[v];
+
+		for(t = 0; t < cStrips.size(); t++)
+		{
+			ObjList<int> & thisStrip = cStrips[t];			
+			ObjList<int> & NuevasTirasT = NuevasTiras[t];
+			int cStripsSizeT = thisStrip.size();
+			for(i = 0; i < cStripsSizeT; i++)
+			{
+				if (thisStrip[i] == OrdenacionV.vQslim)
+				{
+					k++;
+					NuevasTirasT[i]	=	v;
+				}
+			}
+		}
+	}
+
+	//Cambiar a Tiras Nuevas
 	this->cStrips	=	NuevasTiras;
 
-	//	Same size for NuevosVerts and Ordenacion.
-	this->TOTALCAMBIOS	=	0;
-	
-	totalSize	=	(long int)NuevosVerts.size();
-	
-	//	For each new vertex.
-	for(i = 0; i < totalSize; i++)
+	//NuevosVerts y Ordenacion = tamaño.
+	NuevosVertsSize = NuevosVerts.size();
+	for(i = 0; i < NuevosVertsSize; i++)
 	{
 		NuevosVerts[i].Next	=	Ordenacion[i].vLSNext;
-		
-		if ((this->TOTALCAMBIOS == 0) && (NuevosVerts[i].Next == -1))
-		{
-			this->TOTALCAMBIOS	=	i;
-		}
 	}
 
 	//Cambiar cVerts por nuevosVerts.
 	this->cVerts	=	NuevosVerts;
-
-	printf(	"--->Vertices: %d  * Cambios: %d",
-					NuevosVerts.size(),
-					this->TOTALCAMBIOS);
 
 	//percent	=	100.0;
@@ -626,10 +529,8 @@
 	this->geoMesh		=	new Geometry::Mesh();
 	*this->geoMesh	=	*m;
-	this->geoMeshSQ = ms;
+	this->geoMeshSQ = const_cast<MeshSimplificationSequence*>(ms);
 
 	//	Set the leaves submesh.
 	mSubMeshLeaves	=	submesh;
-
-	
 	this->GenerarModeloCompleto(upb);
 }
@@ -643,9 +544,11 @@
 	delete [] vDatos;
 	delete [] vCambios;
-	vector <LODData> cCambiosTemp;
-	cCambios.swap(cCambiosTemp);
-
-	VECTORUNINT cDatosTemp;
-	cDatos.swap(cDatosTemp);
+/*	vector <LODData> cCambiosTemp;
+	cCambios.swap(cCambiosTemp);*/
+	cCambios.clear();
+
+/*	VECTORUNINT cDatosTemp;
+	cDatos.swap(cDatosTemp);*/
+	cDatos.clear();
 
 	delete [] vStrips;
@@ -653,9 +556,11 @@
 	delete [] vVerts;
 
-	vector <VECTORINT> cStripsTemp;
-	cStrips.swap(cStripsTemp);;
-
-	VECTORVERTEX cVertsTemp;
-	cVerts.swap(cVertsTemp);
+//	vector <VECTORINT> cStripsTemp;
+//	cStrips.swap(cStripsTemp);;
+	cStrips.clear();
+
+//	VECTORVERTEX cVertsTemp;
+//	cVerts.swap(cVertsTemp);
+	cVerts.clear();
 
 	delete [] pCambios;
@@ -713,5 +618,4 @@
 		oSerializer.WriteData(simp,sizeof(char),strlen(simp));
 	}
-
 	//	Lines starting with a b.
 	//	Data.
@@ -853,23 +757,29 @@
 	}
 	
+
+
 	int indice_acum = 0;
 	for(i=0;i<this->geoMesh->mSubMeshCount;i++)
 	{
-		for (size_t ind=0; ind < meshoriginal->mSubMesh[i].mIndexCount; ind++) 
-		{
-			if (meshoriginal->mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
+		Geometry::SubMesh & subMesh = meshoriginal->mSubMesh[i];
+		Geometry::SubMesh & geoMeshSubMesh = this->geoMesh->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(meshoriginal->mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
-				{
-					for (size_t indvo=0; indvo<this->geoMesh->mSubMesh[i].mVertexBuffer->mVertexCount; indvo++)
-					{
-						if (igual(meshoriginal->mSubMesh[i].mVertexBuffer->mPosition[meshoriginal->mSubMesh[i].mIndex[ind]],this->geoMesh->mSubMesh[i].mVertexBuffer->mPosition[indvo]))
+				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]))
 						{
-							if (igual(meshoriginal->mSubMesh[i].mVertexBuffer->mNormal[meshoriginal->mSubMesh[i].mIndex[ind]],this->geoMesh->mSubMesh[i].mVertexBuffer->mNormal[indvo]))
+							if (igual(subMesh.mVertexBuffer->mNormal[indIndex],geoMeshSubMesh.mVertexBuffer->mNormal[indvo]))
 							{
-								if (igual(meshoriginal->mSubMesh[i].mVertexBuffer->mTexCoords[meshoriginal->mSubMesh[i].mIndex[ind]],this->geoMesh->mSubMesh[i].mVertexBuffer->mTexCoords[indvo]))
+								if (igual(subMesh.mVertexBuffer->mTexCoords[indIndex],geoMeshSubMesh.mVertexBuffer->mTexCoords[indvo]))
 								{
-									this->geoMesh->mSubMesh[i].mIndex[ind]= int(indvo);//+indice_acum;
+									geoMeshSubMesh.mIndex[ind]= int(indvo);//+indice_acum;
 								}
 							}
@@ -879,11 +789,11 @@
 				else		//Hay coordenadas de textura pero no hay normales
 				{
-					for (size_t indvo=0; indvo<this->geoMesh->mSubMesh[i].mVertexBuffer->mVertexCount; indvo++)
-					{
-						if (igual(meshoriginal->mSubMesh[i].mVertexBuffer->mPosition[meshoriginal->mSubMesh[i].mIndex[ind]],this->geoMesh->mSubMesh[i].mVertexBuffer->mPosition[indvo]))
+					for (size_t indvo=0; indvo<geoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)
+					{
+						if (igual(subMesh.mVertexBuffer->mPosition[indIndex],geoMeshSubMesh.mVertexBuffer->mPosition[indvo]))
 						{
-							if (igual(meshoriginal->mSubMesh[i].mVertexBuffer->mTexCoords[meshoriginal->mSubMesh[i].mIndex[ind]],this->geoMesh->mSubMesh[i].mVertexBuffer->mTexCoords[indvo]))
+							if (igual(subMesh.mVertexBuffer->mTexCoords[indIndex],geoMeshSubMesh.mVertexBuffer->mTexCoords[indvo]))
 							{
-								this->geoMesh->mSubMesh[i].mIndex[ind]=int(indvo);//+indice_acum;
+								geoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum;
 							}
 						}
@@ -894,13 +804,13 @@
 			{
 				// No hay coordenadas de textura pero si normales
-				if(meshoriginal->mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
-				{
-					for (size_t indvo=0; indvo<this->geoMesh->mSubMesh[i].mVertexBuffer->mVertexCount; indvo++)
-					{
-						if (igual(meshoriginal->mSubMesh[i].mVertexBuffer->mPosition[meshoriginal->mSubMesh[i].mIndex[ind]],this->geoMesh->mSubMesh[i].mVertexBuffer->mPosition[indvo]))
+				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]))
 						{
-							if (igual(meshoriginal->mSubMesh[i].mVertexBuffer->mNormal[meshoriginal->mSubMesh[i].mIndex[ind]],this->geoMesh->mSubMesh[i].mVertexBuffer->mNormal[indvo]))
+							if (igual(subMesh.mVertexBuffer->mNormal[indIndex],geoMeshSubMesh.mVertexBuffer->mNormal[indvo]))
 							{
-								this->geoMesh->mSubMesh[i].mIndex[ind]=int(indvo);//+indice_acum;
+								geoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum;
 							}
 						}
@@ -909,9 +819,9 @@
 				else		//No hay coordenadas de texturas ni normales
 				{
-					for (size_t indvo=0; indvo<this->geoMesh->mSubMesh[i].mVertexBuffer->mVertexCount; indvo++)
-					{
-						if (igual(meshoriginal->mSubMesh[i].mVertexBuffer->mPosition[meshoriginal->mSubMesh[i].mIndex[ind]],this->geoMesh->mSubMesh[i].mVertexBuffer->mPosition[indvo]))
+					for (size_t indvo=0; indvo<geoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)
+					{
+						if (igual(subMesh.mVertexBuffer->mPosition[indIndex],geoMeshSubMesh.mVertexBuffer->mPosition[indvo]))
 						{
-							this->geoMesh->mSubMesh[i].mIndex[ind]=int(indvo);//+indice_acum;
+							geoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum;
 						}
 					}
@@ -920,5 +830,5 @@
 		}
 	}
-
+	
 }
 
@@ -949,4 +859,5 @@
 //de los vertices y los indices
 //-----------------------------------------------------------------------------------------------
+
 void LodStripsConstructor::GenerarModeloV(TIPOFUNC	upb)
 {
@@ -962,5 +873,5 @@
 	upb(percent);
 
-	//	6 min.
+	//	6 min.	
 	this->OrdenarModeloVQSLIM(upb);
 
@@ -979,8 +890,5 @@
 
 	this->MARCA	=	max + 1;
-
-	//	5 min.
 	this->CalcularCambiosLODsVNuevaED(upb);
-
 }
 
@@ -1067,5 +975,5 @@
 {
 	tipoVertice	vAux;
-	VECTORINT		tira;
+	ObjList<int>		tira;
 	size_t			i;
 	size_t			j;
@@ -1247,20 +1155,4 @@
 		//	Error.
 	}
-
-	//---------------------------------------------
-	//	Debug.
-	//---------------------------------------------
-	FILE	*file_aux;
-	file_aux	=	fopen("StripsModel.txt","w");
-	for (unsigned	int i = 0; i < cStrips.size(); i++)
-	{
-		for (unsigned	int j = 0; j < cStrips[i].size();	j++)
-		{
-			fprintf(file_aux,"%d ",cStrips[i][j]);
-		}
-		fprintf(file_aux,"\n");
-	}
-	//---------------------------------------------
-
 }
 
