Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h	(revision 1009)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h	(revision 1014)
@@ -50,5 +50,11 @@
 
 	/// LodStripsLibrary interface class.
-	/** This module contains functions that handle the levels of detail of the input multiresolution objects made of polygonal meshes. For any given resolution and object, this module returns a set of triangle strips representing the object at that resolution, that is, at the level of detail requested. These models use triangle strips to reduce storage usage and to speed up realistic rendering.
+	/** This module contains functions that handle the levels of detail 
+	 * 	of the input multiresolution objects made of polygonal meshes.
+	 * 	For any given resolution and object, this module returns a set
+	 * 	of triangle strips representing the object at that resolution, 
+	 * 	that is, at the level of detail requested. These models use 
+	 * 	triangle strips to reduce storage usage and to speed up realistic 
+	 * 	rendering.
 	\n\n
 
@@ -58,5 +64,6 @@
 
 Outputs:\n
-	- The module returns a strip set that represents the level of detail requested.
+	- The module returns a strip set that represents the level of 
+		detail requested.
 	.
 
@@ -65,9 +72,10 @@
 	{
 		private:
+			
+			// The name of the object.
+			String	mName; 
 
-			String	mName; /// The name of the object.
-
-			///Structures with the data read from the file
-			///We won't work with these structures
+			//	Structures with the data read from the file
+			//	We won't work with these structures
 			SmallIntVector									mFileVertices;
 			std::vector	<LODRegisterType>		mFileChangesLOD;
@@ -75,13 +83,22 @@
 			LongVector											mData;
 
-			///Structures with the data to work with
-			SmallInt	mTotalStrips;		///Total strips of the multiresolution object.
-			SmallInt	mTotalVertices;	///Total vertices of the multiresolution object.
-			SmallInt	mMaxVerticesLOD;///Number of vertices of the max LOD.
-			SmallInt	mTotalChanges;	///Total changes of the multiresolution object.
-			SmallInt	mLods;					///Available Lods.
-			SmallInt	mMaxLod;				///Max level of detail.
-			SmallInt	mMinLod;				///Min level of detail.
-			SmallInt	mCurrentLod;		///Current Lod.
+			//	Structures with the data to work with
+
+			//	Total strips of the multiresolution object.
+			SmallInt	mTotalStrips;
+			
+			//	Total vertices of the multiresolution object.
+			SmallInt	mTotalVertices;
+			
+			//	Number of vertices of the max LOD.
+			SmallInt	mMaxVerticesLOD;
+			
+			//	Total changes of the multiresolution object.
+			SmallInt	mTotalChanges;
+			
+			SmallInt	mLods;				//	Available Lods.
+			SmallInt	mMaxLod;			//	Max level of detail.
+			SmallInt	mMinLod;			//	Min level of detail.
+			SmallInt	mCurrentLod;	//	Current Lod.
 
 			//	For the efficient version.
@@ -112,5 +129,7 @@
 			SmallIntVector	*mStrips;
 			
-			/// Constructor, receives as a parameter the name of the file including the multiresolution object.
+			/**	Constructor, receives as a parameter the name of the file
+			 * 	including the multiresolution object.
+			*/
 			LodStripsLibrary(std::string, Mesh *geomesh);
 
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoBase.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoBase.h	(revision 980)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoBase.h	(revision 1014)
@@ -14,5 +14,5 @@
 namespace Geometry {
 
-	//Basic types
+	//	Basic types.
 	typedef float 					Real;
 	typedef unsigned int		Index;
@@ -22,5 +22,5 @@
 	typedef std::string			String;
 
-	//Vertex Info
+	//	Vertex Info.
 	static const unsigned short VERTEX_EMPTY     = 0x00;
 	static const unsigned short VERTEX_POSITION  = 0x01;
@@ -29,5 +29,5 @@
 	static const unsigned short VERTEX_ALL = VERTEX_POSITION | VERTEX_NORMAL | VERTEX_TEXCOORDS;
 
-	//Mmesh primitives
+	//	Mesh primitives.
 	typedef enum 
 	{
@@ -36,5 +36,4 @@
 	} MeshType;
 
-		//OSCAR
 	struct VertexBoneAssignment
 	{
@@ -57,6 +56,4 @@
 	};
 	
-	//	2006-02-14
-	//	Gustavo Puche.
 	//	Needed to update the progress bar.
 	typedef float updateProgressBar(float);
@@ -78,2 +75,3 @@
 
 #endif
+
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/Container.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/Container.h	(revision 1014)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/Container.h	(revision 1014)
@@ -0,0 +1,65 @@
+#ifndef __CONTAINER_H__
+#define __CONTAINER_H__
+
+template <class T>
+class ObjList
+{
+public:
+	ObjList(void){ clear(); }
+
+	~ObjList(void){
+		if (data)
+			free(data);
+		data_size=0;
+		capacity=0;
+	}
+
+	ObjList(const ObjList &l){
+		this->operator =(l);	
+	}
+
+	void push_back(T i){
+		if (data_size>=capacity)
+		{
+			capacity *= 2;
+			data = (T*)realloc(data,capacity*sizeof(T));
+		}
+		data[data_size] = i;
+		data_size++;
+	}
+
+	T & operator[](unsigned int i){ assert(i<data_size); return data[i]; }
+	const T & operator[](unsigned int i) const { assert(i<data_size); return data[i]; }
+
+	const ObjList & operator=(const ObjList &l){
+/*		capacity=l.capacity;
+		data_size=l.data_size;
+		data=(T*)malloc(capacity*sizeof(T));
+		memcpy(data,l.data,data_size*sizeof(T));*/
+		clear();
+		for (unsigned int i=0; i<l.size(); i++)
+			push_back(l[i]);
+		return l;
+	}
+
+	unsigned int size(void) const { return data_size; }
+
+	void clear(void){
+		capacity=16;
+		data=(T*)malloc(capacity*sizeof(T));
+		data_size=0;
+	}
+
+	void eraseAtPos(unsigned int i){
+		if (i!=data_size-1)
+			memmove(data+i,data+i+1,(data_size-i-1)*sizeof(T));
+		data_size--;
+	}
+
+private:
+	T *data;
+	unsigned int data_size;
+	unsigned int capacity;
+};
+
+#endif
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp	(revision 1009)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp	(revision 1014)
@@ -40,5 +40,5 @@
 LodStripsLibrary::~LodStripsLibrary()
 {
-		delete[] mStrips;
+	delete	[] mStrips;
 }
 
@@ -57,8 +57,8 @@
 	long			int							k;
 	long			int							b_change_ok	=	1;
-	unsigned long	int							lod;
+	unsigned long	int					lod;
 	long			int							t;
 	long			int							r;
-	long			int							sig;
+	long			int							next;
 	long			int							el1;
 	long			int							el2;
@@ -76,15 +76,14 @@
 		if (newLOD > mCurrentLod)
 		{
-			//HACIA ADELANTE
-			//CurrentRegLOD
-			//Incrementamos el LOD -> Calcular siguientes
+			//	Forwards.
+			//	Increments LOD.
 			for (lod = mCurrentLod; lod < newLOD; lod++)
 			{
-				sig				=	mVertex[lod];
+				next						=	mVertex[lod];
 				total_changes	=	mPChanges[lod];
 
 				for (i = 0; i < total_changes; i++)
 				{
-					//	Strip q Cambia.
+					//	Strip change.
 					t			=	mCurrentRegLOD->strip; 
 					strip	=	&(mStrips[t]);
@@ -96,5 +95,5 @@
 					for (j = totalR - 1; j >= 0; j--)
 					{
-						start[*mCurrentData]	=	sig;
+						start[*mCurrentData]	=	next;
 						
 						++mCurrentData;
@@ -132,9 +131,9 @@
 													2*(*(mCurrentData + 1)));
 
-						++mCurrentData;
-						++mCurrentData;
+						mCurrentData++;
+						mCurrentData++;
 					}
 
-					++mCurrentRegLOD;
+					mCurrentRegLOD++;
 					
 					mStripsChanges[t]	=	1;
@@ -146,11 +145,11 @@
 
 		}
-		//	Si el nuevo LOD es menos que el actual.
+		//	If LOD is less than actual.
 		else
 		{ 
-			--mCurrentRegLOD;
-			--mCurrentData;
+			mCurrentRegLOD--;
+			mCurrentData--;
 			
-			//	Decrementamos el LOD -> Calcular anteriores.
+			//	Decrements LOD.
 			for (lod = mCurrentLod; lod > newLOD; lod--)
 			{
@@ -178,6 +177,6 @@
 						}
 						
-						--mCurrentData;
-						--mCurrentData;
+						mCurrentData--;
+						mCurrentData--;
 					}
 
@@ -195,6 +194,6 @@
 						}
 
-						--mCurrentData;
-						--mCurrentData;
+						mCurrentData--;
+						mCurrentData--;
 					}
 					
@@ -205,107 +204,23 @@
 					{
 						(*strip)[*mCurrentData]	=	lod - 1;
-						--mCurrentData;
+						mCurrentData--;
 					}
 					
-					--mCurrentRegLOD;
+					mCurrentRegLOD--;
 					mStripsChanges[t]	=	1;
 				}			
 				
-				//	Actualizar LOD.
+				//	Update LOD.
 				mCurrentLod	=	lod - 1;
 			}
 			
-			++mCurrentData;
-			++mCurrentRegLOD;
+			mCurrentData++;
+			mCurrentRegLOD++;
 		} 
-
-	}	
-
-	/*
-	// Visualizar.
-	k		=	0;
-
-	for (uint32 i	=	0; i < mTotalStrips; i++)
-	{
-		l			=	mStrips[i].size();
-		
-		//	Los dos degenerados.
-		k			=	k + l + 2;
-		
-		//	If is not the first strip.
-		if (i != 0)
-		{
-			start	=	mStrips[i].begin();
-
-			//	Degenerado.
-			mStrips[i].insert(start,mStrips[i][0]);
-		}
-
-		//	If is not the last strip.
-		if (i != (mTotalStrips - 1))
-		{
-			//	Degenerado.
-			mStrips[i].push_back(mStrips[i][mStrips[i].size() - 1]);
-		}
-
-	}
-	*/
-	
-	/*
-	 * Write in the hardware buffer.
-	 *
-	int contTira	= 0;
-	
-	//	Vuelca los datos en el buffer de pantalla.
-	//Ogre::HardwareIndexBufferSharedPtr	ibuf;
-	for(unsigned int j = 0; j < mGeoMesh->mSubMeshCount; j++)
-	{
-		k	=	0;
-		for(unsigned int s = 0; s < mGeoMesh->mSubMesh[j].mStripCount; s++)
-		{
-			l	=	mStrips[contTira].size();
-
-			mIndexBuffer[j]->writeData(k*sizeof(unsigned long),
-					l*sizeof(unsigned long),
-					&mStrips[contTira][0]);
-
-			k	=	k + l;
-
-			contTira++;
-		}
-
-		indexes[j]->indexCount	=	k;
-	}
-	*/
-	
-	/*
-	//	Para el bunny.
-	start	=	mStrips[0].begin();
-	mStrips[0].erase(start);
-	*/
-	/*
-	for (uint32 i	=	0; i < mTotalStrips; i++)
-	{
-		start	=	mStrips[i].begin();
-		
-		//	If is not the first strip.
-		if (i != 0)
-		{
-			mStrips[i].erase(start);
-		}
-
-		//	If is not the last strip.
-		if (i != (mTotalStrips - 1))
-		{
-			mStrips[i].pop_back();
-		}
-
-	}
-	*/
-	
+	}
+
 	return	return_value;
 }
 
-
 //-----------------------------------------------------------------------------
 //	Gets the maximum level of detail.
@@ -339,5 +254,5 @@
 	uint32	number_of_vertices;
 
-	//	Total vertices less total lod.
+	//	Total vertices of minimum lod.
 	number_of_vertices	=	mMaxVerticesLOD - (mMinLod + 1);
 
@@ -432,6 +347,6 @@
 void LodStripsLibrary::CopyVectors2Arrays()
 {
-	unsigned int					i;
-	unsigned int					j;
+	unsigned int			i;
+	unsigned int			j;
 	SmallInt 					max;
 	SmallInt 					t;
@@ -447,5 +362,4 @@
 	data_array			=	new SmallInt[mData.size()];
 	
-	//Calcular el tamaño maximo de tira y el numero de caras total
 	max					=	0;
 	mTotalFaces	=	0;
@@ -463,8 +377,7 @@
 	}
 
-	//Nueva version de ALLOCATE.
 	changes_array	=	new LODRegisterType[mFileChangesLOD.size()];
 	
-	//Rellenar vChanges
+	//	Fill up changes array.
 	for (i = 0; i < mFileChangesLOD.size(); ++i)
 	{
@@ -474,15 +387,13 @@
 	mCurrentRegLOD	=	changes_array;
 	
-	//COPY----------------------------------
-	//Copiar las tiras
+	//	Copy strips.
 	for (i = 0; i < mFileStrips.size(); i++)
 	{
 		for (j = 0; j < mFileStrips[i].size(); j++)
 		{
-			//Rellenar el vVector
 			mStrips[i].push_back(mFileStrips[i][j]);
 		}
 		
-		//Poner a 0 los flags de modificados.
+		//	Reset flags of strips changed.
 		mStripsChanges[i]	=	0;
 	}
@@ -495,5 +406,5 @@
 	mCurrentData	=	data_array;
 
-	//Meter los vertices en mVertex 
+	//	Fill up mVertex.
 	for(i = 0; i < mFileVertices.size(); i++)
 	{
@@ -513,9 +424,9 @@
 	std::vector			<unsigned int>		p_changes;
 	int																value;
-	int																v		=	0;
-	int																t		=	-1;
-	int																s		=	0;
-	int																sig	=	0;
-	int																c		=	-1;
+	int																v			=	0;
+	int																t			=	-1;
+	int																s			=	0;
+	int																next	=	0;
+	int																c			=	-1;
 	char															buff[80];
 	Index															*index;
@@ -583,5 +494,4 @@
 		mTotalChanges	=	0;
 		
-
 		while (!feof (fp))
 		{
@@ -590,5 +500,4 @@
 			if (*buff == 'v')
 			{
-				//VERTICES
 				sscanf (buff+2,"%d",&value);
 				
@@ -600,5 +509,4 @@
 				if (*buff == 'c')
 				{
-					// c indica que empieza un nuevo cambio
 					c++;
 				}
@@ -628,7 +536,6 @@
 				sscanf (buff+2,"%u",&value);
 				p_changes.push_back(value);
-			}//Fin ElseIf
-
-		} // End WhileEOF
+			}
+		}
 		
 		fclose(fp);
@@ -639,5 +546,4 @@
 		mMinLod										=	mLods;
 
-		//// CHAPUZA PROVISIONAL: EL ULTIMO ELEMENTO SE REPITE 2 VECES V.v
 		mPChanges			=	new SmallInt[mLods];
 		
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshSimplifier.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshSimplifier.cpp	(revision 1009)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshSimplifier.cpp	(revision 1014)
@@ -68,4 +68,5 @@
 
 //---------------------------------------------------------------------------
+//	Constructor.
 //---------------------------------------------------------------------------
 GeometryBasedSimplifier::GeometryBasedSimplifier(	const Mesh 	*m,
@@ -76,4 +77,5 @@
 
 //---------------------------------------------------------------------------
+//	Destroyer.
 //---------------------------------------------------------------------------
 GeometryBasedSimplifier::~GeometryBasedSimplifier()
@@ -126,6 +128,4 @@
 																										:MeshSimplifier(m,upb)
 {
-	//char s[MAX_CHAR];
-
 	//	Set progress update function
 	VMI::mUPB	=	upb;
@@ -162,11 +162,4 @@
 	VMI::mesh = initMeshStructure(mGeoMesh);
 	
-	//VMI::printMesh(mesh);
-	//getchar();
-
-	// Get a filename without extension
-	//strncpy(VMI::filename, argv[argc - 1], strlen(argv[argc - 1]) - 4);
-
-	//glutInit(&argc, argv);
 	// RGB and Alpha.
 	glutInitDisplayMode(GLUT_DEPTH | GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA); 
@@ -174,18 +167,5 @@
 	glutInitWindowPosition(100, 100);
 
-	//#ifdef KL // Kullback-Leibler
-	//    sprintf(s, "VKL - [%s]", argv[argc-1]); 
-	//#endif
-	//#ifdef MI // Mutual Information
-	//    sprintf(s, "VMI - [%s]", argv[argc-1]); 
-	//#endif
-	//#ifdef HE // Hellinger
-	//    sprintf(s, "VHE - [%s]", argv[argc-1]); 
-	//#endif
-	//#ifdef CS // Chi-Square
-	//    sprintf(s, "VCS - [%s]", argv[argc-1]); 
-	//#endif
-
-	VMI::vmiWin	=	glutCreateWindow("VMI"/*s*/);
+	VMI::vmiWin	=	glutCreateWindow("VMI");
 
 	glewInit();
@@ -213,12 +193,4 @@
 		}
 	}
-	else 
-	{
-		// Loads a cameras file
-		//sprintf(s,"%s.cam", VMI::filename);
-
-		//VMI::cameras = VMI::loadCameras(VMI::radius, s, &VMI::numCameras);
-		//getchar();
-	}
 
 	VMI::histogram	=	VMI::initHistogram(	VMI::mesh->currentNumTriangles,
@@ -247,7 +219,4 @@
 void ViewPointDrivenSimplifier::Simplify(Real percent)
 {
-	// TODO: parametros libreria globales
-
-
 	VMI::numDemandedTriangles = (int)(VMI::mesh->numTriangles * percent);
 
@@ -440,8 +409,8 @@
 			for (j = 0; j < 3; j++)
 			{
-				// Adding triangle index adjacent to 3 vertices
+				// Adding triangle index adjacent to 3 vertices.
 				v1 = vmi_mesh->triangles[index].indices[j];
 
-				// Reallocate memory for the new adjacent triangle
+				// Reallocate memory for the new adjacent triangle.
 				vmi_mesh->vertices[v1].triangles = (GLuint *)realloc(vmi_mesh->vertices[v1].triangles, (vmi_mesh->vertices[v1].numTriangles + 1) * sizeof(GLuint));
 				VMI::addItem((int *)vmi_mesh->vertices[v1].triangles, (int *)&vmi_mesh->vertices[v1].numTriangles, index);
@@ -453,5 +422,4 @@
 	}
 	
-	//printf("\n");
 	printf("Ok\n");
 
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoTreeSimplifier.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoTreeSimplifier.cpp	(revision 1007)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoTreeSimplifier.cpp	(revision 1014)
@@ -141,8 +141,8 @@
 	long int triangleID=0;
 
-	countv += vertex_count = (int)mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount;	
+	countv += vertex_count = mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount;	
 	Vertex  = new float[2*countv][3];
 		
-	int update_each = (int)(mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount / 5);
+	int update_each = mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount/5;
 	
 	for (unsigned int j=0; j<mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount; j++)
@@ -174,5 +174,5 @@
 	pos=0;
 
-	update_each = (int)(mesh->mSubMesh[meshLeaves].mIndexCount / 5);
+	update_each = mesh->mSubMesh[meshLeaves].mIndexCount / 5;
 	
 	// Each leaf is composed of 6 vertices
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp	(revision 996)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp	(revision 1014)
@@ -23,11 +23,9 @@
 }
 
-//-----------------------------------------------------------------------------------
-//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;
@@ -36,7 +34,7 @@
 	unsigned long 		int		v;
 	long 		int							p0;
-	long 		int							lod	=	0;
 	long 		int							sigue;
-	long 		int							ac[3]	=	{0,0,0};
+	unsigned long 		int		lod				=	0;
+	long 		int							ac[3]			=	{0,0,0};
 	long 		int							totalRegs	=	0;
 	long 		int							RegsCambios;
@@ -44,8 +42,17 @@
 	LODData 								regLOD;
 	LODChanges							listaCambios;
+
+	//	Progress bar.
 	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;
@@ -55,4 +62,5 @@
 	listaCambios.clear();
 
+	//	Progress bar.
 	//	Initialize increment.
 	increment	=	0.0;
@@ -67,20 +75,39 @@
 	percent		=	1.0;
 	
-	this->LodsDisp	=	this->TOTALCAMBIOS	=	lod;
+	this->LodsDisp	=	this->TOTALCAMBIOS;//	=	lod;
 	pCambios				=	new uint32[this->TOTALCAMBIOS];
 	pCambios[0]			=	0;
 	
-	for	(lod = 0; ((this->cVerts[lod].Next) != -1); lod++)
-	{
+	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))
 		{
 			update	=	(int)(increment * lod);
 			upb(percent);
-		}			
-		
-		RegsCambios				=	0;
-		regLOD.obligatory	=	this->Ordenacion[lod].obligatorio;
-		
-		for(t = 0; t < this->cStrips.size(); t++)
+		}
+		
+		/*
+		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++)
 		{
 			//	Initialize.
@@ -90,8 +117,13 @@
 			totalRegs		=	0;
 			
-			for (v = 0; v < this->cStrips[t].size(); v++)
-			{
-				if (this->cStrips[t][v] == lod)	
-				{ 
+			//	Last index of the current strip.
+			itFin				=	itTiras->end();
+			
+			for (	it	=	itTiras->begin(),	v	=	0;
+						it != itFin;
+						it++,	v++)
+			{
+				if ((*it) == lod)
+				{
 					//	Strips.
 					if (regLOD.strip == this->MARCAVACIO)
@@ -104,5 +136,5 @@
 					cDatos.push_back(v);
 
-					this->cStrips[t][v]	=	this->cVerts[lod].Next;
+					*it	=	itVertex->Next;
 				}
 			}
@@ -116,13 +148,11 @@
 			r					=	0;
 			sigue			=	0;
-			k					=	long(this->cStrips[t].size()-3);
-			
+			k					=	long(itTiras->size() - 3);
+			it				=	itTiras->begin();
+
 			while (i < k)
 			{
-				if (	(this->cStrips[t][i] == this->cStrips[t][i+1])
-							&&
-							(this->cStrips[t][i+1] == this->cStrips[t][i+2])
-						)
-				{ 
+				if (	((*it) == (*(it + 1))) && ((*(it + 1)) == (*(it + 2))))
+				{
 					//	Saves beginning of repetition.
 					if (!r)
@@ -131,9 +161,10 @@
 					}
 					
-					this->cStrips[t].erase(this->cStrips[t].begin()+i);
+					itTiras->erase(itTiras->begin() + i);
 					i--;
+					it--;
 					r++;
 					
-					if ((i+1) != this->cStrips[t].size()-1)
+					if ((i + 1) != (itTiras->size() - 1))
 					{
 						sigue	=	1;
@@ -163,8 +194,9 @@
 
 					r	=	0;
-					k	=	long(this->cStrips[t].size()-r-3);
+					k	=	long(itTiras->size() - r - 3);
 				}
 
 				i++;
+				it++;
 			}
 			
@@ -176,12 +208,11 @@
 			r					=	0;
 			sigue			=	0;
-			k					=	long(this->cStrips[t].size() - 4);
+			k					=	long(itTiras->size() - 4);
 			
+			it = itTiras->begin();
+
 			while	(i < k)
 			{
-				if (	(this->cStrips[t][i] == this->cStrips[t][i+2])
-							&&
-							(this->cStrips[t][i+1] == this->cStrips[t][i+3])
-						)
+				if (((*it) == (*(it + 2))) && ((*(it + 1)) == (*(it + 3))))
 				{
 					if (!r)
@@ -190,11 +221,15 @@
 					}
 					
-					this->cStrips[t].erase(this->cStrips[t].begin()+i);
-					this->cStrips[t].erase(this->cStrips[t].begin()+i);
+					itTiras->erase(itTiras->begin() + i);
+					itTiras->erase(itTiras->begin() + i);
+
 					r++;
 					
 					i	-=	2;
 					
-					if ((i+1) != this->cStrips[t].size()-3)
+					it--;
+					it--;
+					
+					if ((i + 1) != itTiras->size() - 3)
 					{
 						sigue	=	1;
@@ -204,5 +239,4 @@
 						sigue	=	0;
 					}
-					
 				}
 				else
@@ -224,8 +258,9 @@
 					
 					r	=	0;
-					k	=	long((this->cStrips[t].size()-4-2*r));
+					k	=	long(itTiras->size() - 4 - 2 * r);
 				}
 
 				i++;
+				it++;
 			}
 			
@@ -242,8 +277,10 @@
 	}//	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
@@ -261,30 +298,41 @@
 	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;
 	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();
 
 	c1					=	0;
 	c2					=	0;
 	
+	//	Progress bar.
 	update			=	-1;
 	percent			=	1.0;
-	increment		=	(float)(10.0) / (float)(geoMeshSQ->mSteps.size());
-	
-	for	(i = 0; i < this->geoMeshSQ->mSteps.size(); i++)
+	increment		=	(float)(10.0) / (float)(totalSize);
+
+	for	(i = 0; i < totalSize; i++)
 	{
 		if (update	!= (int)(i * increment))
@@ -310,11 +358,19 @@
 	this->NumVertsRepetidos = c2;
 
+	printf("\n---->Cambiar vertices con x!0, Verts: %d",Ordenacion.size());
+
+	//	Change all vertices that have x != 0.
+	totalSize	=	(long int)Ordenacion.size();
+	Ord				=	&(Ordenacion[0]);
+
+	//	Progress bar.
 	update		=	-1;
-	increment	=	(float)(10.0) / (float)(Ordenacion.size());
+	increment	=	(float)(10.0) / (float)(totalSize);
 	percent		=	1.0;
 
 	//	Change all vertices that have x != 0.
-	for(i	=	0;	i < Ordenacion.size();	i++)
-	{
+	for(i	=	0;	i < totalSize;	i++)
+	{
+		//	Progress bar.
 		if (update	!= (int)(i * increment))
 		{
@@ -323,7 +379,5 @@
 		}
 		
-		Ord	=	&(Ordenacion[i]);
-
-		if (Ord->x!=0)
+		if (Ord->x != 0)
 		{
 			//	Change the simplification order.
@@ -331,29 +385,38 @@
 			Ord->vQslim			=	Ord->vQslimNext;
 			Ord->vQslimNext	=	v;
-
-			for (j = i+1; j < Ordenacion.size(); j++)
-			{
-				if (Ordenacion[j].vQslim == Ord->vQslim)
-				{
-					Ordenacion[j].vQslim	=	Ord->vQslimNext;
-					Ordenacion[j].cambio	=	"y";
-				}
-				else if (Ordenacion[j].vQslimNext == Ord->vQslim)
-				{
-					Ordenacion[j].vQslimNext	=	Ord->vQslimNext;	
-					Ordenacion[j].cambio			=	"y";
-				}
-			}
-		}
-	}
-
+			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.
 	update		=	-1;
-	increment	=	(float)(10.0) / (float)(Ordenacion.size());
+	increment	=	(float)(10.0) / (float)(totalSize);
 	percent		=	1.0;
 
-	//	3 seg.
-	//Ordenacion de los vertices
-	for(i = 0; i < Ordenacion.size(); i++)
-	{
+	//	Vertex sort.
+	for(i = 0; i < totalSize; i++)
+	{
+		//	Progress bar.
 		if (update	!=	(int)(i * increment))
 		{
@@ -363,12 +426,17 @@
 
 		c1++;
-		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.
+		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.
 	int cont				=	0;
 	int contestaban	=	0;
@@ -394,12 +462,22 @@
 	}
 
+	totalSize	=	(long int)Ordenacion.size();
+
+	printf("\n---->Siguientes QSLIM: %d",totalSize);
+
+	//	Progress bar.
 	update		=	-1;
-	increment	=	(float)(10.0)	/	(float)(Ordenacion.size());
+	increment	=	(float)(10.0)	/	(float)(totalSize);
 	percent		=	1.0;
 	
-	//	2 min.
-	//	Calcular los siguiente teniendo en cuenta el QSLIM.
-	for (i = 0; i < Ordenacion.size(); i++)
-	{
+	//	Obtain nexts.
+	if (totalSize > 0)
+	{
+		Ord	=	&(Ordenacion[0]);
+	}
+
+	for (i = 0; i < totalSize; i++)
+	{
+		//	Progress bar.
 		if (update	!=	(int)(i * increment))
 		{
@@ -408,23 +486,57 @@
 		}
 		
-		v	=	Ordenacion[i].vQslimNext;
-
-		//Buscar ese vertice v cual es ahora
+		v			=	Ord->vQslimNext;
 		vSig	=	0;
-
-		for (t = 0; t < Ordenacion.size() && !vSig;t++)
-		{
-			if (Ordenacion[t].vQslim==v)
-			{
-				vSig=Ordenacion[t].vLS;
-			}
-		}
-
-		if (vSig!=0)
-		{
-			Ordenacion[i].vLSNext	=	vSig;
-		}
-	}
-
+		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++)
+	{
+		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);
+				}
+			}
+		}
+
+		NuevasTiras.push_back(tira);
+	}
+	*/
+	
 	//Creacion de nuevas tiras con las mismas dimensiones
 	for(t = 0; t < this->cStrips.size(); t++)
@@ -439,10 +551,7 @@
 		NuevasTiras.push_back(tira);
 	}
-
-	update		=	-1;
-	increment	=	(float)(20.0) / (float)(NuevosVerts.size());
-	percent		=	1.0;
-
-	k	=	0;
+	
+	update	=	long(NuevosVerts.size() / 40);
+	percent	=	0.5;
 
 	//	2 min.
@@ -450,10 +559,9 @@
 	for(v = 0; v < NuevosVerts.size(); v++)
 	{
-		if (update != (int)(v * increment))
-		{
-			update	=	(int)(v * increment);
+		if ((v % update) == 0)
+		{
 			upb(percent);
 		}
-		
+
 		for(t = 0; t < this->cStrips.size(); t++)
 		{
@@ -462,5 +570,4 @@
 				if (this->cStrips[t][i] == Ordenacion[v].vQslim)
 				{
-					k++;
 					NuevasTiras[t][i]	=	v;
 				}
@@ -469,15 +576,31 @@
 	}
 
-	//Cambiar a Tiras Nuevas
+	printf("\n---->Copiar los datos");
+
+	//	Change to new strips.
 	this->cStrips	=	NuevasTiras;
 
-	//NuevosVerts y Ordenacion = tamaño.
-	for(i = 0; i < NuevosVerts.size(); i++)
+	//	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[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;
@@ -1124,4 +1247,20 @@
 		//	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");
+	}
+	//---------------------------------------------
+
 }
 
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/GTGeometry.vcproj
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/GTGeometry.vcproj	(revision 1007)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/GTGeometry.vcproj	(revision 1014)
@@ -62,14 +62,14 @@
 			<Tool
 				Name="VCCLCompilerTool"
-				Optimization="0"
+				Optimization="2"
 				AdditionalIncludeDirectories=".\src\libs;.\include;.\src\libs\vmi\include"
 				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GLEW_STATIC"
 				MinimalRebuild="TRUE"
-				BasicRuntimeChecks="3"
+				BasicRuntimeChecks="0"
 				RuntimeLibrary="4"
 				UsePrecompiledHeader="0"
-				WarningLevel="3"
+				WarningLevel="0"
 				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="4"
+				DebugInformationFormat="0"
 				CompileAs="2"/>
 			<Tool
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp	(revision 1007)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp	(revision 1014)
@@ -1231,13 +1231,18 @@
 		{
 			//	Build the LOD file.
-			case	LODTREES_AUTO:			
+			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;
 
@@ -1259,10 +1264,12 @@
 									delete auxTreeSimpSequence;*/
 
-
 			case	LODSTRIPS_AUTO:
 
-				// Builder					
+				//	Builder
 				if (!file_name)
+				{
 					file_name	=	fltk::file_chooser("Build LOD","*","");
+				}
+				
 				//	If a file was selected.
 				if (file_name)
@@ -1281,5 +1288,6 @@
 
 					//	Loads a simplification sequence file.
-					oMeshSimpSequence->Load(Serializer("SimplifSequence.txt",Serializer::READ));
+					oMeshSimpSequence->Load(Serializer(	"SimplifSequence.txt",
+																							Serializer::READ));
 
 					//	If the simplification sequence and the mesh exist.
@@ -1291,5 +1299,6 @@
 								progress_function);
 
-						oSerializer	=	new Serializer(strcat(file_name,".lod"),Serializer::Mode::WRITE);
+						oSerializer	=	new Serializer(	strcat(file_name,".lod"),
+																					Serializer::Mode::WRITE);
 
 						oLodStrip->Save(*oSerializer);
@@ -1314,7 +1323,9 @@
 						mesh_saver	=	new	GeoMeshSaver();
 						file_name[strlen(file_name) - 4]	=	'\0';
-						mesh_saver->save(mGeoMesh, strcat(file_name,".mesh"));
+						
+						mesh_saver->save(	mGeoMesh,
+															strcat(file_name,".mesh"));
+						
 						delete	mesh_saver;
-
 					}
 					else
@@ -1362,5 +1373,4 @@
 }
 
-
 //---------------------------------------------------------------------------
 //	Lod Slider Callback for the foliage
@@ -1384,6 +1394,4 @@
 }
 
-
-
 //---------------------------------------------------------------------------
 //	Mesh Info Callback
@@ -1402,5 +1410,5 @@
 
 //---------------------------------------------------------------------------
-//	Logo Callback
+//	Logo Callback.
 //---------------------------------------------------------------------------
 inline void GeoMeshViewUI::cb_mLogo_i(fltk::InvisibleBox*, void*)
@@ -1428,5 +1436,5 @@
 
 //---------------------------------------------------------------------------
-//	Show the stripify panel
+//	Show the stripify panel.
 //---------------------------------------------------------------------------
 void	GeoMeshViewUI::showStripify()
@@ -1451,5 +1459,5 @@
 
 //---------------------------------------------------------------------------
-//	Hide the stripify panel
+//	Hide the stripify panel.
 //---------------------------------------------------------------------------
 void	GeoMeshViewUI::hideStripify()
@@ -1474,5 +1482,5 @@
 
 //---------------------------------------------------------------------------
-//	Show the Simplify Edge Collapse panel
+//	Show the Simplify Edge Collapse panel.
 //---------------------------------------------------------------------------
 void	GeoMeshViewUI::showEdgeCollapse()
@@ -1562,5 +1570,5 @@
 
 //---------------------------------------------------------------------------
-//	Show the Simlify Leaves Collapse
+//	Show the Simlify Leaves Collapse.
 //---------------------------------------------------------------------------
 void	GeoMeshViewUI::showLeavesCollapse()
@@ -1606,5 +1614,5 @@
 
 //---------------------------------------------------------------------------
-//	Hide the Simplify Leaves Collapse
+//	Hide the Simplify Leaves Collapse.
 //---------------------------------------------------------------------------
 void	GeoMeshViewUI::hideLeavesCollapse()
@@ -1647,5 +1655,5 @@
 
 //---------------------------------------------------------------------------
-//	Show the LodStrips Panel
+//	Show the LodStrips Panel.
 //---------------------------------------------------------------------------
 void	GeoMeshViewUI::showOpenMeshSimplification()
@@ -1665,5 +1673,5 @@
 
 //---------------------------------------------------------------------------
-//	Hide the LodStrips Panel
+//	Hide the LodStrips Panel.
 //---------------------------------------------------------------------------
 void	GeoMeshViewUI::hideOpenMeshSimplification()
@@ -1683,5 +1691,5 @@
 
 //---------------------------------------------------------------------------
-//	Shows the auto generate LodStrips panel
+//	Shows the auto generate LodStrips panel.
 //---------------------------------------------------------------------------
 void	GeoMeshViewUI::showAutoGenerateLodStrips()
@@ -1696,6 +1704,7 @@
 	//mBuildBar->activate();
 }
-//---------------------------------------------------------------------------
-//	Shows the auto generate LodStrips panel
+
+//---------------------------------------------------------------------------
+//	Shows the auto generate LodStrips panel.
 //---------------------------------------------------------------------------
 void	GeoMeshViewUI::showAutoGenerateLodTrees()
@@ -1712,5 +1721,5 @@
 
 //---------------------------------------------------------------------------
-//	Show the LodStrips visulization panel
+//	Show the LodStrips visulization panel.
 //---------------------------------------------------------------------------
 void	GeoMeshViewUI::showLodStripSlider()
@@ -1721,5 +1730,5 @@
 
 //---------------------------------------------------------------------------
-//	Hide the LodStrips visualization panel
+//	Hide the LodStrips visualization panel.
 //---------------------------------------------------------------------------
 void	GeoMeshViewUI::hideLodStripSlider()
@@ -1730,5 +1739,5 @@
 
 //---------------------------------------------------------------------------
-//	Show the LodTree visulization panel
+//	Show the LodTree visulization panel.
 //---------------------------------------------------------------------------
 void	GeoMeshViewUI::showLodTreeSlider()
@@ -1739,5 +1748,5 @@
 
 //---------------------------------------------------------------------------
-//	Hide the LodTree visualization panel
+//	Hide the LodTree visualization panel.
 //---------------------------------------------------------------------------
 void	GeoMeshViewUI::hideLodTreeSlider()
@@ -1747,7 +1756,6 @@
 }
 
-
-//---------------------------------------------------------------------------
-//	Show the LodTrees Panel
+//---------------------------------------------------------------------------
+//	Show the LodTrees Panel.
 //---------------------------------------------------------------------------
 void	GeoMeshViewUI::showOpenLeavesSimplification()
@@ -1761,5 +1769,5 @@
 
 //---------------------------------------------------------------------------
-//	Hide the LodTrees Panel
+//	Hide the LodTrees Panel.
 //---------------------------------------------------------------------------
 void	GeoMeshViewUI::hideOpenLeavesSimplification()
@@ -1773,5 +1781,5 @@
 
 //---------------------------------------------------------------------------
-//	Show the mesh info browser
+//	Show the mesh info browser.
 //---------------------------------------------------------------------------
 void	GeoMeshViewUI::showMeshInfo()
@@ -1879,5 +1887,5 @@
 
 //---------------------------------------------------------------------------
-//	Hide the mesh info browser
+//	Hide the mesh info browser.
 //---------------------------------------------------------------------------
 void	GeoMeshViewUI::hideMeshInfo()
@@ -1888,5 +1896,5 @@
 
 //---------------------------------------------------------------------------
-//	Hide the right panel
+//	Hide the right panel.
 //---------------------------------------------------------------------------
 void	GeoMeshViewUI::hideRightPanel()
@@ -1903,5 +1911,5 @@
 
 //---------------------------------------------------------------------------
-//	Get the number of vertices
+//	Get the number of vertices.
 //---------------------------------------------------------------------------
 size_t	GeoMeshViewUI::getVertexCount(Mesh	*geoMesh)
@@ -1930,5 +1938,5 @@
 
 //---------------------------------------------------------------------------
-//	Get the number of triangles
+//	Get the number of triangles.
 //---------------------------------------------------------------------------
 size_t	GeoMeshViewUI::getTriangleCount(Geometry::Mesh	*geoMesh)
@@ -1969,5 +1977,5 @@
 
 //---------------------------------------------------------------------------
-//	Get the number of strips
+//	Get the number of strips.
 //---------------------------------------------------------------------------
 size_t	GeoMeshViewUI::getStripCount(Geometry::Mesh	*geoMesh)
@@ -1995,6 +2003,6 @@
 
 //---------------------------------------------------------------------------
-//	It paints the submesh selected by the mMeshInfo tree
-//	Trate the mMeshInfo event	
+//	It paints the submesh selected by the mMeshInfo tree.
+//	Trate the mMeshInfo event.
 //---------------------------------------------------------------------------
 int GeoMeshViewUI::paintMesh(void)
@@ -2008,10 +2016,10 @@
 	meshNumber	=	-1;
 
-	// Shows the selected object label
+	// Shows the selected object label.
 	strcpy(selectedTag,mMeshInfo->goto_focus()->label());
 	
 	p=strstr(selectedTag,"SubMesh ");
 
-	// If the item begins with string "SubMesh"
+	// If the item begins with string "SubMesh".
 	if (p!=NULL)
 	{
@@ -2032,98 +2040,95 @@
 bool GeoMeshViewUI::simplifyEdgeCollapse()
 {
-    Real    percent;
-
-    //    If input field empty.
-    if (mMeshReduction->fvalue() <= 0.0)
-    {
-        return false;
-    }
-
-    geoMeshView->saveContext();
-
-    //    Debug.
-    cout    <<    "Mesh Reduction: "
-                <<    mMeshReduction->fvalue()
-                <<    endl;
-    
-    //    Gets simplify option.
-    if (mGeometryBased->value())
-    {
-        simplificationState    =    MESHSIMP;
-        mMeshSimplifier         = new GeometryBasedSimplifier(mGeoMesh,
-                                                                       
-                                     progress_function);
-    }
-    else
-    {
-        simplificationState    =    VIEWPOINTDRIVEN;
-        mMeshSimplifier         = new ViewPointDrivenSimplifier(mGeoMesh,
-                                                                       
-                                         progress_function);
-    }
-
-    mMeshSimplifier->setMeshLeaves(idMeshLeaves);
-
-    if (mPercent->value())
-    {
-        // Simplificación por porcentaje
-        if (mMeshReduction->fvalue() <= 100.0 && 
-mMeshReduction->fvalue() > 0.0)
-        {
-            percent    = mMeshReduction->fvalue();
-            percent    =    percent    / 100.0;
-
-            // Simplifica el geomesh -> Parámetro es un factor LOD [0,1].
-            mMeshSimplifier->Simplify(percent);
-
-            //    Deletes the previous mesh.
-            delete mUndoMesh;
-
-            mUndoMesh    =    new Mesh();
-
-            //    Sets the undo mesh.
-            *mUndoMesh    =    *mGeoMesh;
-
-            delete    mGeoMesh;
-
-            mGeoMesh    =    mMeshSimplifier->GetMesh();
-
-            //    Visualize mesh.
-            geoMeshView->setMesh(mGeoMesh);
-
-        }
-        else
-        {
-            fltk::alert("Wrong value for simplification.\n"
-                    "Valid values [0..100]");
-            
-            return    false;
-        }
-    }
-    else
-    {
-        //	Simplificar hasta un número de vértices.
-        uint32 v    =    (uint32)mMeshReduction->fvalue();
-
-        //	Simplifica el geomesh -> Parámetro es un factor LOD [0,1].
-        mMeshSimplifier->Simplify(v);
-
-        //	Deletes the previous mesh.
-        delete mUndoMesh;
-
-        mUndoMesh    =    new Mesh();
-
-        //	Sets the undo mesh.
-        *mUndoMesh    =    *mGeoMesh;
-
-        delete    mGeoMesh;
-
-        mGeoMesh    =    mMeshSimplifier->GetMesh();
-
-        //	Visualize the mesh.
-        geoMeshView->setMesh(mGeoMesh);
-    }
-
-    return    true;
+	Real    percent;
+
+	//    If input field empty.
+	if (mMeshReduction->fvalue() <= 0.0)
+	{
+		return false;
+	}
+
+	geoMeshView->saveContext();
+
+	//    Debug.
+	cout    <<    "Mesh Reduction: "
+		<<    mMeshReduction->fvalue()
+		<<    endl;
+
+	//    Gets simplify option.
+	if (mGeometryBased->value())
+	{
+		simplificationState	=	MESHSIMP;
+		mMeshSimplifier			=	new GeometryBasedSimplifier(mGeoMesh,
+																											progress_function);
+	}
+	else
+	{
+		simplificationState	=	VIEWPOINTDRIVEN;
+		mMeshSimplifier			=	new ViewPointDrivenSimplifier(mGeoMesh,
+																												progress_function);
+	}
+
+	mMeshSimplifier->setMeshLeaves(idMeshLeaves);
+
+	if (mPercent->value())
+	{
+		// Simplificación por porcentaje
+		if (mMeshReduction->fvalue() <= 100.0 && 
+				mMeshReduction->fvalue() > 0.0)
+		{
+			percent	=	mMeshReduction->fvalue();
+			percent	=	percent / 100.0;
+
+			//	Simplifica el geomesh -> Parámetro es un factor LOD [0,1].
+			mMeshSimplifier->Simplify(percent);
+
+			//	Deletes the previous mesh.
+			delete mUndoMesh;
+
+			mUndoMesh	=	new Mesh();
+
+			//	Sets the undo mesh.
+			*mUndoMesh	=	*mGeoMesh;
+
+			delete    mGeoMesh;
+
+			mGeoMesh	=	mMeshSimplifier->GetMesh();
+
+			//	Visualize mesh.
+			geoMeshView->setMesh(mGeoMesh);
+		}
+		else
+		{
+			fltk::alert("Wrong value for simplification.\n"
+									"Valid values [0..100]");
+
+			return	false;
+		}
+	}
+	else
+	{
+		//	Simplificar hasta un número de vértices.
+		uint32 v	=	(uint32)mMeshReduction->fvalue();
+
+		//	Simplifica el geomesh -> Parámetro es un factor LOD [0,1].
+		mMeshSimplifier->Simplify(v);
+
+		//	Deletes the previous mesh.
+		delete mUndoMesh;
+
+		mUndoMesh	=	new Mesh();
+
+		//	Sets the undo mesh.
+		*mUndoMesh	=	*mGeoMesh;
+
+		delete	mGeoMesh;
+
+		mGeoMesh	=	mMeshSimplifier->GetMesh();
+
+		//	Visualize the mesh.
+		geoMeshView->setMesh(mGeoMesh);
+	}
+
+	return	true;
 }
 
Index: GTP/trunk/Lib/Geom/shared/GeoTool/GeoTool.vcproj
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/GeoTool.vcproj	(revision 998)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/GeoTool.vcproj	(revision 1014)
@@ -82,8 +82,9 @@
 			<Tool
 				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=".\include;..\include;..\..\..\..\..\..\NonGTP\FLTK\include;..\..\..\..\..\..\NonGTP\glut;..\GTGeometry\include;..\GTGeometry\src\libs\vmi\include"
+				Optimization="2"
+				AdditionalIncludeDirectories=".\include;..\include;..\..\..\..\..\..\NonGTP\FLTK\include;..\..\..\..\..\..\NonGTP\glut;..\GTGeometry\include;..\GTGeometry\src\libs\vmi\include;..\..\..\..\..\..\nongtp\Devil\include"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WIN32_LEAN_AND_MEAN;VC_EXTRA_LEAN;WIN32_EXTRA_LEAN"
 				RuntimeLibrary="4"
+				BufferSecurityCheck="FALSE"
 				UsePrecompiledHeader="0"
 				WarningLevel="0"
