Index: GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h	(revision 1526)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h	(revision 1543)
@@ -86,45 +86,46 @@
 
 using	namespace	Geometry;
+using	namespace	std;
 
 class GeoToolIndexData : public Geometry::IndexData
 {
-public:
-	GeoToolIndexData(unsigned int submeshes):Geometry::IndexData(){
-		submeshcount = submeshes;
-		indices=new unsigned int*[submeshcount];
-		indexCount=new unsigned int[submeshcount];
-		for (int i=0; i<submeshcount; i++)
-		{
-			indices[i]=NULL;
-			indexCount[i]=0;
+	public:
+		GeoToolIndexData(unsigned int submeshes):Geometry::IndexData(){
+			submeshcount = submeshes;
+			indices=new unsigned int*[submeshcount];
+			indexCount=new unsigned int[submeshcount];
+			for (int i=0; i<submeshcount; i++)
+			{
+				indices[i]=NULL;
+				indexCount[i]=0;
+			}
 		}
-	}
-	virtual ~GeoToolIndexData(void){
-		for (int i=0; i<submeshcount; i++)
-			if (indices[i])
-				delete[] indices[i];
-		delete[] indices;
-		delete[] indexCount;
-	}
-
-	virtual void Begin(unsigned int submesh, unsigned int numinds){
-		if (indices[submesh])		
-			delete[] indices[submesh];
-		indices[submesh] = new unsigned int[numinds];     
-		indexCount[submesh] = numinds;
-		modifySubmesh=submesh;
-	}
-
-	virtual void SetIndex(unsigned int i, unsigned int index){
-		indices[modifySubmesh][i] = index;
-	}
-
-	virtual void End(void){}
-	virtual void BorrowIndexData(const IndexData *){}
-
-	unsigned int submeshcount;
-	unsigned int **indices;
-	unsigned int *indexCount;
-	unsigned int modifySubmesh;
+		virtual ~GeoToolIndexData(void){
+			for (int i=0; i<submeshcount; i++)
+				if (indices[i])
+					delete[] indices[i];
+			delete[] indices;
+			delete[] indexCount;
+		}
+
+		virtual void Begin(unsigned int submesh, unsigned int numinds){
+			if (indices[submesh])		
+				delete[] indices[submesh];
+			indices[submesh] = new unsigned int[numinds];     
+			indexCount[submesh] = numinds;
+			modifySubmesh=submesh;
+		}
+
+		virtual void SetIndex(unsigned int i, unsigned int index){
+			indices[modifySubmesh][i] = index;
+		}
+
+		virtual void End(void){}
+		virtual void BorrowIndexData(const IndexData *){}
+
+		unsigned int submeshcount;
+		unsigned int **indices;
+		unsigned int *indexCount;
+		unsigned int modifySubmesh;
 };
 
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp	(revision 1526)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp	(revision 1543)
@@ -1148,4 +1148,8 @@
 		//	Refresh geometry attributes.
 		refreshApplicationBar();
+
+		//	Set textures.
+		geoMeshView->resetTextures();
+		setTextures();
 	}
 	
@@ -1289,4 +1293,8 @@
 		//	Refresh data aplication.
 		refreshApplicationBar();
+
+		//	Set textures.
+		geoMeshView->resetTextures();
+		setTextures();
 	}	
 }
@@ -1645,4 +1653,7 @@
 	showEdgeCollapse();
 
+	//	Deactive VMI option.
+	mViewPointDriven->deactivate();
+
 	mButtonBuild->set_visible();
 	//mButtonBuild->activate();
@@ -1659,4 +1670,7 @@
 	//	Shows the simplify panel.
 	showEdgeCollapse();
+
+	//	Deactive VMI option.
+	mViewPointDriven->deactivate();
 
 	mButtonBuild->set_visible();
@@ -2264,4 +2278,8 @@
 		//	Repaint the window.
 		mMainWindow->redraw();
+
+		//	Set textures.
+		geoMeshView->resetTextures();
+		setTextures();
 	}
 }
@@ -2492,20 +2510,9 @@
 	{
 		material	= string(mGeoMesh->mSubMesh[submesh].mMaterialName);
-				
+
 		if (loader->existsMaterial(material))
-		{
-			//	Debug.
-			cout	<<	"Material "
-						<<	material
-						<<	" found."
-						<<	endl;
-			
+		{			
 			filename	=	loader->getTextureFileName(material);
 
-			//	Debug.
-			cout	<<	"File: "
-						<<	filename.c_str()
-						<<	endl;
-			
 			geoMeshView->LoadTextureSubMesh(submesh,	filename.c_str());
 		}
@@ -3121,5 +3128,5 @@
 }
 
-
+//	Build Textures menu.
 void GeoMeshViewUI::BuildLoadTextureSubMeshMenu(void)
 {
@@ -3127,5 +3134,6 @@
 	{
 		menuLoadTextures->clear();
-		for (int i=0; i<numSubMeshNames; i++)
+
+		for (int i	=	0; i < numSubMeshNames; i++)
 		{
 			delete[] SubMeshNames[i];
@@ -3135,18 +3143,22 @@
 
 	menuFileLoadTexture = new fltk::Item("Entire model");
+
 	menuFileLoadTexture->callback((fltk::Callback*)cb_menuFileLoadTexture);
 	menuLoadTextures->add(menuFileLoadTexture);
 
-	numSubMeshNames=geoMeshView->getSubMeshCount();
-	SubMeshNames=new char*[numSubMeshNames];
-
-	for (int i=0; i<numSubMeshNames; i++)
-	{
-		SubMeshNames[i]=new char[10];
+	numSubMeshNames	=	geoMeshView->getSubMeshCount();
+	SubMeshNames		=	new char*[numSubMeshNames];
+
+	for (int i	=	0; i < numSubMeshNames; i++)
+	{
+		SubMeshNames[i]	=	new char[10];
 
 		sprintf(SubMeshNames[i],"submesh %d",i);
-		fltk::Item *item = new fltk::Item(SubMeshNames[i]);
+
+		fltk::Item *item	=	new fltk::Item(SubMeshNames[i]);
+
 		item->callback((fltk::Callback*)cb_menuFileLoadTextureSubMesh);
 		menuLoadTextures->add(item);
 	}
 }
+
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp	(revision 1526)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp	(revision 1543)
@@ -399,43 +399,43 @@
             : fltk::GlWindow(x,y,w,h,l)
 {
-		mStripColors		=	NULL;
-		mSharedPosArray		=	NULL;
-		mSharedNorArray		=	NULL;
-		mSharedTexCoordArray=	NULL;
-		mPosArray			=	NULL;
-		mNorArray			=	NULL;
-		mTexCoordArray		=	NULL;
-		mIndexArray			=	NULL;
-		vAng				= 0.0;
-		hAng							=	0.0;
-		size							=	0.0;
-		mSizeY						=	0;
-		xshift						=	0.0;
-		yshift						=	0.0;
-		geoMesh						=	0;
-		mRotate						=	true;
-		mPan							=	false;
-		mLodStrip					=	false;
-		mLodTree					=	false;
-		mIdVisualList			=	0;
-		mSubMeshCount			=	0;
-		mStripColorsCount	=	0;
-		
-		//	Initialize the model view.
-		deactiveWire();
-		deactiveSolid();
-		activeRotate();
-		deactiveCW();
-		activeCCW();
-		
-		//	Initialize start time for FPS.
-		mStartTime	=	clock();
-
-		//	Cross Reference.
-		mGeoMeshViewUI	=	geoMeshViewUI;
-
-		current_texture = 0;
-		current_texture_submesh=NULL;
-		use_texture_mapping = true;
+	mStripColors					=	NULL;
+	mSharedPosArray				=	NULL;
+	mSharedNorArray				=	NULL;
+	mSharedTexCoordArray	=	NULL;
+	mPosArray							=	NULL;
+	mNorArray							=	NULL;
+	mTexCoordArray				=	NULL;
+	mIndexArray						=	NULL;
+	vAng									= 0.0;
+	hAng									=	0.0;
+	size									=	0.0;
+	mSizeY								=	0;
+	xshift								=	0.0;
+	yshift								=	0.0;
+	geoMesh								=	0;
+	mRotate								=	true;
+	mPan									=	false;
+	mLodStrip							=	false;
+	mLodTree							=	false;
+	mIdVisualList					=	0;
+	mSubMeshCount					=	0;
+	mStripColorsCount			=	0;
+
+	//	Initialize the model view.
+	deactiveWire();
+	deactiveSolid();
+	activeRotate();
+	deactiveCW();
+	activeCCW();
+
+	//	Initialize start time for FPS.
+	mStartTime	=	clock();
+
+	//	Cross Reference.
+	mGeoMeshViewUI	=	geoMeshViewUI;
+	current_texture = 0;
+
+	current_texture_submesh	=	NULL;
+	use_texture_mapping 		=	true;
 }
 
@@ -464,8 +464,14 @@
 
 	if (current_texture_submesh)
-		delete[] current_texture_submesh;
-	current_texture_submesh=new GLuint[getSubMeshCount()];
+	{
+		delete	[]	current_texture_submesh;
+	}
+
+	current_texture_submesh	=	new GLuint[getSubMeshCount()];
+
 	for (int i=0; i<getSubMeshCount(); i++)
-		current_texture_submesh[i]=0;
+	{
+		current_texture_submesh[i]	=	0;
+	}
 }
 
@@ -505,16 +511,21 @@
 		mSharedPosArray = new GLfloat[vertex_buffer->mVertexCount * 3];
 		mSharedNorArray = new GLfloat[vertex_buffer->mVertexCount * 3];
+
 		if (vertex_buffer->mTexCoords)
+		{
 			mSharedTexCoordArray = new GLfloat[vertex_buffer->mVertexCount * 2];
+		}
 		else
+		{
 			mSharedTexCoordArray = NULL;
+		}
 
 		for (int vertex = 0; vertex < vertex_buffer->mVertexCount; vertex++)
 		{
-			mSharedPosArray[3 * vertex]			=	vertex_buffer->mPosition[vertex].x;
+			mSharedPosArray[3 * vertex]				=	vertex_buffer->mPosition[vertex].x;
 			mSharedPosArray[(3 * vertex) + 1]	=	vertex_buffer->mPosition[vertex].y;
 			mSharedPosArray[(3 * vertex) + 2]	=	vertex_buffer->mPosition[vertex].z;
 
-			mSharedNorArray[3 * vertex]			=	vertex_buffer->mNormal[vertex].x;
+			mSharedNorArray[3 * vertex]				=	vertex_buffer->mNormal[vertex].x;
 			mSharedNorArray[(3 * vertex) + 1]	=	vertex_buffer->mNormal[vertex].y;
 			mSharedNorArray[(3 * vertex) + 2]	=	vertex_buffer->mNormal[vertex].z;
@@ -522,6 +533,9 @@
 			if (vertex_buffer->mTexCoords)
 			{
-				mSharedTexCoordArray[2 * vertex]		=	vertex_buffer->mTexCoords[vertex].x;
-				mSharedTexCoordArray[(2 * vertex) + 1]	=	vertex_buffer->mTexCoords[vertex].y;
+				mSharedTexCoordArray[2 * vertex]				=	vertex_buffer->
+																									mTexCoords[vertex].x;
+
+				mSharedTexCoordArray[(2 * vertex) + 1]	=	vertex_buffer->
+																									mTexCoords[vertex].y;
 			}
 		}
@@ -529,8 +543,8 @@
 	
 	//	Build the arrays of vertices and indices.
-	mPosArray		=	new GLfloat*[geomesh->mSubMeshCount];
-	mNorArray		=	new GLfloat*[geomesh->mSubMeshCount];
+	mPosArray				=	new GLfloat*[geomesh->mSubMeshCount];
+	mNorArray				=	new GLfloat*[geomesh->mSubMeshCount];
 	mTexCoordArray	=	new GLfloat*[geomesh->mSubMeshCount];
-	mIndexArray		=	new GLuint*[geomesh->mSubMeshCount];
+	mIndexArray			=	new GLuint*[geomesh->mSubMeshCount];
 
 	//	For each submesh.
@@ -555,6 +569,6 @@
 
 			//	Allocate memory for vertices of the actual submesh.
-			mPosArray[submesh]	=	new GLfloat[vertex_buffer->mVertexCount * 3];
-			mNorArray[submesh]	=	new GLfloat[vertex_buffer->mVertexCount * 3];
+			mPosArray[submesh]			=	new GLfloat[vertex_buffer->mVertexCount * 3];
+			mNorArray[submesh]			=	new GLfloat[vertex_buffer->mVertexCount * 3];
 			mTexCoordArray[submesh]	=	new GLfloat[vertex_buffer->mVertexCount * 2];
 
@@ -577,6 +591,6 @@
 		else
 		{
-			mPosArray[submesh]	=	NULL;
-			mNorArray[submesh]	=	NULL;
+			mPosArray[submesh]			=	NULL;
+			mNorArray[submesh]			=	NULL;
 			mTexCoordArray[submesh]	=	NULL;
 		}
@@ -880,7 +894,83 @@
 {
 	SubMesh		*geosubmesh;
-	Index		position;
+	Index			position;
 	Vector3		vector3;
 	Vector2		vector2;
+	float			x,y,z;
+	float			r,g,b;
+	int				color_index;
+	int				current_strip;
+
+	//	Initialize current strip.
+	current_strip = 0;
+
+	//	For each submesh.
+	for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++)
+	{
+		// bind current texture to use
+		bool usetex = SetTextureRenderingState(submesh);
+
+		color_index	=	0;
+
+		//	Gets the actual submesh.
+		geosubmesh	=	&geoMesh->mSubMesh[submesh];
+
+		//	For each one of the strips.
+		int indices_to_render =	lodStripsLib->GetValidIndexCount(submesh);
+		int offset						=	lodStripsLib->GetValidOffset(submesh);
+
+		glBegin(GL_TRIANGLE_STRIP);
+
+		for (	int index = 0;
+					index < mGeoMeshViewUI->lod_index_data->indexCount[submesh];
+					index ++)
+		{
+			position	=	mGeoMeshViewUI->lod_index_data->indices[submesh][index];
+
+			//	Gets the vertex normal.
+			vector3	=	geosubmesh->mVertexBuffer->mNormal[position];
+
+			x				=	vector3[0];
+			y				=	vector3[1];
+			z				=	vector3[2];
+
+			//	Sets the vertex normal.
+			glNormal3f(x,y,z);
+
+			// set the texture coordinates if needed
+			if (usetex)
+			{
+				vector2 = geosubmesh->mVertexBuffer->mTexCoords[position];
+				x				=	vector2[0];
+				y				=	vector2[1];
+
+				glTexCoord2f(x,y);
+			}
+
+			//	Gets the vertex coordinates.
+			vector3	=	geosubmesh->mVertexBuffer->mPosition[position];
+
+			x				=	vector3[0];
+			y				=	vector3[1];
+			z				=	vector3[2];
+
+			//	Sets the vertex position.
+			glVertex3f(x,y,z);
+		}
+		glEnd();
+
+	}
+	
+}//End drawTriangleStrip.
+
+//---------------------------------------------------------------------------
+//	Paint lodtree object.
+//---------------------------------------------------------------------------
+void GeoMeshView::drawLodTree()
+{
+	SubMesh	*geosubmesh;
+	Index		position;
+	Vector3	vector3;
+	Vector2	vector2;
 	float		x,y,z;
 	float		r,g,b;
@@ -889,9 +979,15 @@
 
 	//	Initialize current strip.
-	current_strip = 0;
-
+	current_strip	=	0;
+
+	// DRAW THE TRUNK AS A LODSTRIP OBJECT
 	//	For each submesh.
 	for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++)
 	{
+		if (submesh == lodTreeLib->GetLeavesSubMesh())
+		{
+			continue;
+		}
+
 		// bind current texture to use
 		bool usetex = SetTextureRenderingState(submesh);
@@ -903,12 +999,13 @@
 
 		//	For each one of the strips.
-		int indices_to_render = lodStripsLib->GetValidIndexCount(submesh);
-		int offset = lodStripsLib->GetValidOffset(submesh);
-
+		int indices_to_render =	lodTreeLib->GetValidTrunkIndexCount(submesh);
+		int begin_index 			=	lodTreeLib->GetValidTrunkOffset(submesh);
+        		
 		glBegin(GL_TRIANGLE_STRIP);
-//		for (int index = offset; index < indices_to_render+offset; index ++)
-		for (int index = 0; index < mGeoMeshViewUI->lod_index_data->indexCount[submesh]; index ++)
-		{
-//			position = lodStripsLib->dataRetrievalInterface->GetIndex(index);
+
+		for (	int index = 0;
+					index < mGeoMeshViewUI->lod_index_data->indexCount[submesh];
+					index ++)
+		{
 			position = mGeoMeshViewUI->lod_index_data->indices[submesh][index];
 
@@ -943,84 +1040,4 @@
 		}
 		glEnd();
-
-	}
-
-	
-}//End drawTriangleStrip.
-
-//---------------------------------------------------------------------------
-//	Paint lodtree object.
-//---------------------------------------------------------------------------
-void GeoMeshView::drawLodTree()
-{
-	SubMesh				*geosubmesh;
-	Index					position;
-	Vector3				vector3;
-	Vector2				vector2;
-	float					x,y,z;
-	float					r,g,b;
-	int						color_index;
-	int						current_strip;
-
-	//	Initialize current strip.
-	current_strip	=	0;
-
-	// DRAW THE TRUNK AS A LODSTRIP OBJECT
-	//	For each submesh.
-	for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++)
-	{
-		//if (submesh==leavesSubMesh)
-		if (submesh == lodTreeLib->GetLeavesSubMesh())
-			continue;
-
-		// bind current texture to use
-		bool usetex = SetTextureRenderingState(submesh);
-
-		color_index	=	0;
-
-		//	Gets the actual submesh.
-		geosubmesh	=	&geoMesh->mSubMesh[submesh];
-
-		//	For each one of the strips.
-		int indices_to_render = lodTreeLib->GetValidTrunkIndexCount(submesh);
-		int begin_index = lodTreeLib->GetValidTrunkOffset(submesh);
-        		
-		glBegin(GL_TRIANGLE_STRIP);
-//		for (int index = begin_index; index < indices_to_render+begin_index; index ++)
-		for (int index = 0; index < mGeoMeshViewUI->lod_index_data->indexCount[submesh]; index ++)
-		{
-//			position = lodTreeLib->CurrentLOD_Trunk_Indices()->GetIndex(index);
-			position = mGeoMeshViewUI->lod_index_data->indices[submesh][index];
-
-			//	Gets the vertex normal.
-			vector3	=	geosubmesh->mVertexBuffer->mNormal[position];
-
-			x				=	vector3[0];
-			y				=	vector3[1];
-			z				=	vector3[2];
-
-			//	Sets the vertex normal.
-			glNormal3f(x,y,z);
-
-			// set the texture coordinates if needed
-			if (usetex)
-			{
-				vector2 = geosubmesh->mVertexBuffer->mTexCoords[position];
-				x				=	vector2[0];
-				y				=	vector2[1];
-				glTexCoord2f(x,y);
-			}
-
-			//	Gets the vertex coordinates.
-			vector3	=	geosubmesh->mVertexBuffer->mPosition[position];
-
-			x				=	vector3[0];
-			y				=	vector3[1];
-			z				=	vector3[2];
-
-			//	Sets the vertex position.
-			glVertex3f(x,y,z);
-		}
-		glEnd();
 	}
 
@@ -1034,24 +1051,36 @@
 
 	glBegin(GL_TRIANGLES);
-	Geometry::SubMesh & foliageSubMesh = geoMesh->mSubMesh[lodTreeLib->GetLeavesSubMesh()];
-	Geometry::Vector3 auxv;
-	for (int j=0; j<mGeoMeshViewUI->lod_index_data->indexCount[lodTreeLib->GetLeavesSubMesh()]; j++)
-	{		
-		int k = mGeoMeshViewUI->lod_index_data->indices[lodTreeLib->GetLeavesSubMesh()][j];
+
+	SubMesh & foliageSubMesh = geoMesh->mSubMesh[lodTreeLib->GetLeavesSubMesh()];
+	Vector3 auxv;
+
+	for (	int	j	=	0;
+				j < mGeoMeshViewUI->lod_index_data->
+						indexCount[lodTreeLib->GetLeavesSubMesh()];
+				j++)
+	{
+		int	k	=	mGeoMeshViewUI->lod_index_data->
+						indices[lodTreeLib->GetLeavesSubMesh()][j];
+
 		if (usetex)
 		{
-			Geometry::Vector2 tc = foliageSubMesh.mVertexBuffer->mTexCoords[k];
+			Vector2 tc = foliageSubMesh.mVertexBuffer->mTexCoords[k];
 			glTexCoord2f(tc.x,tc.y);
 		}
-		auxv = foliageSubMesh.mVertexBuffer->mNormal[k];
+
+		auxv	=	foliageSubMesh.mVertexBuffer->mNormal[k];
+
 		glNormal3f(auxv.x,auxv.y,auxv.z);
-		auxv = foliageSubMesh.mVertexBuffer->mPosition[k];
+
+		auxv	=	foliageSubMesh.mVertexBuffer->mPosition[k];
+
 		glVertex3f(auxv.x,auxv.y,auxv.z);
 	}
+
 	glEnd();
 
 	glColor3f(1,1,1);
 	glDisable(GL_ALPHA_TEST);
-	glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,0);	
+	glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,0);
 }
 
@@ -1080,7 +1109,13 @@
 {
 	if (mLodStrip)
+	{
 		lodStripsLib->GoToLod(lod);
+	}
+
 	if (mLodTree)
+	{
 		lodTreeLib->GoToTrunkLod(lod);
+	}
+
 	draw();
 }
@@ -1092,5 +1127,8 @@
 {
 	if (mLodTree)
+	{
 		lodTreeLib->GoToFoliageLod(lod);
+	}
+
 	draw();
 }
@@ -1117,6 +1155,6 @@
 
 	GLfloat	light_ambient[]	=	{0.3,0.3,0.3,1.0};
-	GLfloat	luzpos[]		=	{0.0,0.0,1.0,0.0};
-	GLfloat	luzcolor[]		=	{1.0,1.0,1.0,1.0};
+	GLfloat	luzpos[]				=	{0.0,0.0,1.0,0.0};
+	GLfloat	luzcolor[]			=	{1.0,1.0,1.0,1.0};
 
 	//	glLightModelfv(GL_LIGHT_MODEL_AMBIENT, light_ambient);
@@ -1143,5 +1181,7 @@
 	//	Set white color to the object.
 	glColor3d(1.0, 1.0, 1.0);
+
 	GLfloat color_blanco[]	=	{1.0f,1.0f,1.0f,1.0f};
+
 	glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,color_blanco);
 
@@ -1183,5 +1223,7 @@
 		//glDisable(GL_LIGHTING);
 		glColor3d(0.0, 0.0, 0.0);
+
 		GLfloat color[]	=	{0.0f,0.0f,0.0f,1.0f};
+
 		glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,color);
 
@@ -1215,6 +1257,9 @@
 
 	current_texture = ilutGLLoadImage((const ILstring)imgfile);
+
 	if (!current_texture)
+	{
 		fltk::alert("Error loading texture!");
+	}
 
 	ilShutDown();
@@ -1228,6 +1273,9 @@
 
 	current_texture_submesh[isubmesh] = ilutGLLoadImage((const ILstring)imgfile);
+
 	if (!current_texture_submesh[isubmesh])
+	{
 		fltk::alert("Error loading texture!");
+	}
 
 	ilShutDown();
@@ -1239,11 +1287,16 @@
 	{
 		glDeleteTextures(1,&current_texture);
-		current_texture=0;
-	}
+
+		current_texture	=	0;
+	}
+
 	if (current_texture_submesh)
 	{
 		glDeleteTextures(getSubMeshCount(),current_texture_submesh);
-		for (int i=0; i<getSubMeshCount(); i++)
-			current_texture_submesh[i]=0;
+
+		for (int	i	=	0;	i < getSubMeshCount(); i++)
+		{
+			current_texture_submesh[i]	=	0;
+		}
 	}
 }
@@ -1251,28 +1304,43 @@
 bool	GeoMeshView::SetTextureRenderingState(int submesh)
 {
-	GLuint usetex = 0;
+	GLuint usetex	=	0;
+
 	if (use_texture_mapping)
 	{
 		if (current_texture_submesh[submesh])
-			usetex=current_texture_submesh[submesh];
+		{
+			usetex	=	current_texture_submesh[submesh];
+		}
 		else if (current_texture)
-			usetex=current_texture;
-	}
+		{
+			usetex	=	current_texture;
+		}
+	}
+
 	if (usetex)
+	{
 		glEnable(GL_TEXTURE_2D);
+	}
 	else
+	{
 		glDisable(GL_TEXTURE_2D);
+	}
 
 	glBindTexture(GL_TEXTURE_2D,usetex);
 
-	return (usetex!=0);
+	return (usetex != 0);
 }
 
 int		GeoMeshView::findLeavesSubMesh(void)
 {
-	for (int i=0; i<geoMesh->mSubMeshCount; i++)
-		if (geoMesh->mSubMesh[i].mType==GEO_TRIANGLE_LIST)
-			return i;
-	return -1;
-}
-
+	for (int i	=	0; i < geoMesh->mSubMeshCount; i++)
+	{
+		if (geoMesh->mSubMesh[i].mType == GEO_TRIANGLE_LIST)
+		{
+			return	i;
+		}
+	}
+
+	return	-1;
+}
+
