Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodObject.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodObject.h	(revision 1056)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodObject.h	(revision 1058)
@@ -12,5 +12,5 @@
 		}
 		uint32 GetUniqueID(void) const { return  uniqueID; }
-		virtual uint32 GoToLod(uint32)=0;
+		virtual void GoToLod(Real)=0;
 
 	private:
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h	(revision 1056)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h	(revision 1058)
@@ -15,5 +15,4 @@
 #include	"GeoMesh.h"
 #include	<vector>
-#include	<time.h>
 #include	"VertexData.h"
 #include "GeoLodObject.h"
@@ -80,8 +79,8 @@
 			//	Structures with the data read from the file
 			//	We won't work with these structures
-			SmallIntVector									mFileVertices;
-			std::vector	<LODRegisterType>		mFileChangesLOD;
-			std::vector	<SmallIntVector>		mFileStrips;
-			LongVector											mData;
+			SmallIntVector					mFileVertices;
+			std::vector	<LODRegisterType>	mFileChangesLOD;
+			std::vector	<SmallIntVector>	mFileStrips;
+			LongVector						mData;
 
 			//	Structures with the data to work with
@@ -105,9 +104,11 @@
 
 			//	For the efficient version.
-			SmallInt				mTotalFaces;
-			SmallInt				*mCurrentData;
-			SmallInt				*mStripsChanges;
+			SmallInt	mTotalFaces;
+			SmallInt	*mCurrentData;
+			SmallInt	*mStripsChanges;
 			LODRegisterType	*mCurrentRegLOD;
-			SmallInt				*mVertex;
+			SmallInt	*mVertex;
+
+			SmallInt	minFaces, maxFaces;
 		
 			//	Changes of Strips in LOD file (p).
@@ -145,10 +146,4 @@
 			~LodStripsLibrary(void);
 
-			/// Copy constructor
-			//LodStripsLibrary(const LodStripsLibrary&);
-
-			/// Assignment operator
-			//LodStripsLibrary& operator =(const LodStripsLibrary&);
-
 			/// Returns the highest LOD.
 			uint32	MaxLod();
@@ -158,5 +153,5 @@
 
 			/// Returns de current LOD and changes to the specified LOD.
-			virtual uint32	GoToLod(uint32);
+			virtual void GoToLod(Real);
 
 			/// Establishes the new LOD range.
@@ -175,8 +170,4 @@
 			/// Returns the number of vertices of the lowest LOD.
 			uint32	MinVertices();
-
-/*			//	(New)	Get the number of strips.
-			uint32	GetStripCount() const;
-			uint32  GetIndexCountByStrip(uint32) const;*/
 	};
 }
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodTreeLibrary.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodTreeLibrary.h	(revision 1056)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodTreeLibrary.h	(revision 1058)
@@ -10,7 +10,5 @@
 #include "GeoLodObject.h"
 
-class Arbol;
 class Foliage;
-class Point3D;
 
 namespace Geometry
@@ -37,13 +35,16 @@
 
 		// funciones ya descritas en la API
-		uint32 GoToTrunkLod(uint32 newlod);
+/*		uint32 GoToTrunkLod(uint32 newlod);
 		uint32 MinTrunkLod(void) const;
 		uint32 MaxTrunkLod(void) const;
 		uint32 GoToFoliageLod(uint32 newlod);
 		uint32 MinFoliageLod(void) const;
-		uint32 MaxFoliageLod(void) const;
+		uint32 MaxFoliageLod(void) const;*/
+
+		void GoToTrunkLod(Real);
+		void GoToFoliageLod(Real);
 
 		// changes the lod of the entire object (trunk and leaves)
-		virtual uint32 GoToLod(uint32);
+		virtual void GoToLod(Real);
 
 		// new proposed functions
@@ -69,5 +70,4 @@
 	private:
 		Geometry::LodStripsLibrary *trunk;
-		Arbol *arbol;
 		Foliage *foliage;
 
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp	(revision 1018)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp	(revision 1058)
@@ -35,4 +35,14 @@
 	//	Loads the Level Of Detail file.
 	LodStripsLibrary::LoadStripMesh((char*)name_of_file,mGeoMesh);
+
+	GoToLod(0.0f);	
+	minFaces = 0;
+	for (unsigned int strip = 0; strip < mTotalStrips; strip++)
+		minFaces += int(mStrips[strip].size() - 2);
+
+	GoToLod(1.0f);
+	maxFaces = 0;
+	for (unsigned int strip = 0; strip < mTotalStrips; strip++)
+		maxFaces += int(mStrips[strip].size() - 2);
 }
 
@@ -54,5 +64,5 @@
 //	Go to the level of detail.
 //-----------------------------------------------------------------------------
-uint32 LodStripsLibrary::GoToLod(uint32 newLOD)
+void LodStripsLibrary::GoToLod(float lodfactor)
 {
 	register	int							j;
@@ -73,4 +83,6 @@
 	uint32										return_value;
 
+	uint32 newLOD = (1.0f-lodfactor) * mLods;
+    
 	//	Initialize the return value to the current LOD.
 	return_value	=	mCurrentLod;
@@ -225,5 +237,5 @@
 
 	UpdateDataRetrievalInterface();
-	return	return_value;
+//	return	return_value;
 }
 
@@ -270,5 +282,5 @@
 uint32	LodStripsLibrary::MaxFaces()
 {
-	uint32	number_of_faces;
+/*	uint32	number_of_faces;
 
 	uint32	current_lod;
@@ -287,5 +299,7 @@
 	GoToLod(current_lod);
 
-	return	number_of_faces;
+	return	number_of_faces;*/
+
+	return maxFaces;
 }
 
@@ -295,5 +309,5 @@
 uint32	LodStripsLibrary::MinFaces()
 {
-	uint32	current_lod;
+/*	uint32	current_lod;
 	uint32	number_of_faces;
 
@@ -311,5 +325,7 @@
 	GoToLod(current_lod);
 
-	return	number_of_faces;
+	return	number_of_faces;*/
+
+	return minFaces;
 }
 
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/foliage.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/foliage.cpp	(revision 1057)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/foliage.cpp	(revision 1058)
@@ -6,5 +6,4 @@
 
 
-/******************************************   PANTALLA **************************************************/
 //--------------------------------------------------------------------------------------------------------------------------------
 // Void constructor
@@ -17,23 +16,19 @@
 vertexdata(NULL), Leaves(NULL), MinDet(NULL)
 {
-	cx = cy= cz= 0;
-	ppio= final = -1;
+	begin = final = -1;
 
 	ReadVertices(leavesSubMesh);
 	ReadLeafs(leavesSubMesh);
 	if (!ReadSimpSeq(simpSeq)) exit(1);
-	RellenoRaiz();
-	CalculaTexCoordsYNorms();
-
-
-	// esto no sé si devería haber akí
+	FillRoot();
+	CalculateTexCoordsAndNorms();
+
 	indexdata->SetNumValidIndices(0);
 
 	int h=0;
 
-
-	Acth  = new ActiveLeafNode[nHojas*8];
-
-	for ( h=0; h < nHojas; h++) {
+	Acth  = new ActiveLeafNode[leafCount*8];
+
+	for (h=0; h < leafCount; h++) {
 
 		Acth[h].index = h;
@@ -46,41 +41,8 @@
 	}
 				
-	ppio = 0;
-	final = nHojas-1;
-	nhactivas = nHojas;
-
-}
-
-/*
-//--------------------------------------------------------------------------------------------------------------------------------
-// Constructor with the name of a file cotaining the data
-//--------------------------------------------------------------------------------------------------------------------------------
-Foliage::Foliage ( Arbol *Arbol1)
-{
-	int h=0;
-
-
-	MiArbol = Arbol1;
-
-	Acth  = new Activas[(MiArbol->nHojas)*8];
-
-	for ( h=0; h < MiArbol->nHojas; h++) {
-
-		Acth[h].indice = h;
-		if ( h != 0)
-		{
-			Acth[h].prev = (h-1);
-			Acth[h-1].next = h;
-		}
-
-	}
-				
-	ppio = 0;
-	final = (MiArbol->nHojas)-1;
-	nhactivas = MiArbol->nHojas;
-
-
-
-}*/
+	begin = 0;
+	final = leafCount-1;
+	active_leaf_count = leafCount;
+}
 
 //--------------------------------------------------------------------------------------------------------------------------------
@@ -95,233 +57,4 @@
 	delete Acth;
 }
-//
-
-//--------------------------------------------------------------------------------------------------------------------------------
-// Dibuja una hoja
-//--------------------------------------------------------------------------------------------------------------------------------
-				/*
-void Foliage::Dibuja_Hoja ( Hoja &aHoja)
-{
-	
-	float a,b,c;
-
-	glBegin (GL_TRIANGLE_STRIP);
-		glNormal3fv (aHoja.Normal);
-		MiArbol->Vertices[aHoja.vertsLeaf[0]].GetCoordinates (a,b,c);
-		glTexCoord2f ( 0.0, 0.0);
-
-		glVertex3f (a,b,c);
-
-		MiArbol->Vertices[aHoja.vertsLeaf[1]].GetCoordinates (a,b,c);
-		glTexCoord2f ( 0.0, 1.0);
-		glVertex3f (a,b,c);
-	
-		MiArbol->Vertices[aHoja.vertsLeaf[2]].GetCoordinates (a,b,c);
-		glTexCoord2f ( 1.0, 0.0);
-		glVertex3f (a,b,c);
-
-		MiArbol->Vertices[aHoja.vertsLeaf[3]].GetCoordinates (a,b,c);
-		glTexCoord2f ( 1.0, 1.0);
-		glVertex3f (a,b,c);
-
-	glEnd ();
-
-}
-
-
-//--------------------------------------------------------------------------------------------------------------------------------
-// Dibujar todas las hojas activas 
-//--------------------------------------------------------------------------------------------------------------------------------
-				
-int Foliage::DibujarHojas (float frustum[6][4], float zoom)
-{
-	int hojactiva, i;
-
-
-	glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
-
-	hojactiva = 0;
-	glBindTexture (GL_TEXTURE_2D,texName[0]);
-	glEnable(GL_ALPHA_TEST);
-
-	if ( zoom <75.0) 
-	//if ( false) 
-	{
-		//calculo el culling de las hojas de minimo detalle
-		Culling (frustum);
-		//printf ( "--------------------------->Entro en culling\n");
-
-		i= ppio; 
-		while ( i != -1)
-		{ 
-			if (MiArbol->Hojas[MiArbol->Hojas[i].raiz].visible == 1)
-			{
-				hojactiva ++;
-				Dibuja_Hoja (MiArbol->Hojas[i]);
-			}
-			i = Acth[i].next;
-		}
-	}
-	else
-	{
-		i= ppio; 
-    	while ( i != -1)
-		{ 
-			hojactiva ++;
-			Dibuja_Hoja (MiArbol->Hojas[i]);
-			i=Acth[i].next;
-		}
-
-	}
-
-
-
-	glDisable(GL_ALPHA_TEST);
-
-	return ( hojactiva);
-
-}
-
-//--------------------------------------------------------------------------------------------------------------------------------
-// Dibujar media copa del arbol 
-// si el char c es 'f' dibuja la parte delantera
-// si es 'b' la parte trasera
-//--------------------------------------------------------------------------------------------------------------------------------
-				
-int Foliage::DibujaMediaCopa (  char c, float rva, float rvb,float rvc, float rvd, float radio)
-{
-	int hojactiva, i;
-//	int count, count2;
-
-	glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
-
-	hojactiva = 0;
-	glBindTexture (GL_TEXTURE_2D,texName[0]);
-	glEnable(GL_ALPHA_TEST);
-
-	i= ppio; 
-	if ( c == 'b')
-	{//count = 0;
-	while ( i != -1)
-	{  //count ++;
-			if ( Criterio (MiArbol->Hojas[i],'p', rva,rvb,rvc,rvd, radio) == false) //esta detras del plano
-		{
-			hojactiva ++;
-			Dibuja_Hoja (MiArbol->Hojas[i]);
-			}
-		i = Acth[i].next;
-
-	}
-//	printf ( " EN LA TRASERA chequeo %i hojas \n", count);
-	}
-	else
-	{// count2 = 0;
-
-		while ( i != -1)
-		{ //count2++;
-			if ( Criterio (MiArbol->Hojas[i],'p', rva,rvb,rvc,rvd, radio) == true) //esta detras del plano
-		{
-			hojactiva ++;
-			Dibuja_Hoja (MiArbol->Hojas[i]);
-			}
-		i = Acth[i].next;
-	}
-		//	printf ( " EN LA DELANTERA chequeo %i hojas \n", count2);
-
-	}
-	glDisable(GL_ALPHA_TEST);
-
-//	nhactivas = hojactiva;
-
-
-	return ( hojactiva);
-
-
-
-}
-
-
-
-//-------------------------------------------------------------------------------------------------------------------------
-// dibuja la esfera
-//-------------------------------------------------------------------------------------------------------------------------
-
-void Foliage::DibujaEsfera(float r)
-{
-
-	glPushMatrix();
-		glTranslated (0.0,MiArbol->cy, 0.0);
-		glColor3f(1.0, 0.0, 0.0);
-		glDisable(GL_LIGHTING);
-		glLineWidth(1.2);
-		glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
-		glutSolidSphere ( r,20, 20);
-		glEnable(GL_LIGHTING);
-		glColor3f ( 1.0, 1.0, 1.0);
-	glPopMatrix();
-
-}
-
-/******************************************   CULLING **************************************************/
-//-------------------------------------------------------------------------------------------------------------------------
-// culling de las hojas de menor detalle
-//-------------------------------------------------------------------------------------------------------------------------
-
-void Foliage::Culling (float frustum[6][4])
-{
-	int i, j;
-
-	i = 0;
-	while ( MinDet[i].index != -1)
-	{
-		j = MinDet[i].index;
-		if (LeafinFrustum ( j, frustum) == true) {
-		//	printf("dentro %i y el padre es %i\n", j, MiArbol->Hojas[MiArbol->MinDet[i].indice].parent);
-			Leaves[j].visible = 1;
-		}
-		else  
-		{
-		//	printf("fuera %i\n", j);
-			Leaves[j].visible = 0;
-		}
-
-		i++;
-	}
-
-}
-
-
-//-------
-// si está en el frustrum --> true
-//	sino --> false
-//------------
-
-
-bool Foliage::LeafinFrustum ( int i, float frustum[6][4])
-{
-	float a,b,c, tmp;
-	int j,p;
-	Vector v;
-
-	for (j =0; j<4; j++)
-	{
-//		MiArbol->Vertices[MiArbol->Hojas[i].vertsLeaf[j]].GetCoordinates (a,b,c);
-		vertexdata->GetVertexCoord(Leaves[i].vertsLeaf[j],a,b,c);
-		v[0]=a; v[1]=b;	v[2]=c; v[3]=1;
-
-		//  el punto resultante será
-		v = mat_aux*v;
-
-		for( p = 0; p < 5; p++ )
-		{ tmp = float(frustum[p][0] * v[0] + frustum[p][1] * v[1] + frustum[p][2] * v[2] + frustum[p][3]);
-		  if ( tmp <= -2.0 )  return false;
-		}
-	}
-
-
-	return true;
-
-}
-
 
 /******************************************   CRITERIO **************************************************/
@@ -339,177 +72,17 @@
 
 
-//--------------------------------------------------------------------------------------------------------------------------------
-// Colapsa dos hojas 
-//--------------------------------------------------------------------------------------------------------------------------------
-				
-void Foliage::ColapsaHoja (  int h,   int& post)
-{
-
-	//actualizo los punteros del ppio y del final, y post
-	while (( ppio == Leaves[h].childLeft) || ( ppio == Leaves[h].childRight))
-		ppio = Acth[ppio].next;
-	while (( final == Leaves[h].childLeft) || ( final == Leaves[h].childRight))
-		 final = Acth[final].prev; 
-
-	while (( post == Leaves[h].childLeft) || ( post == Leaves[h].childRight))
-		 post = Acth[post].next; 
-
-
-
-	//COLAPSAR = QUITO DOS DE ACTIVOS PONGO UNO A ACTIVO
-
-	if (Acth[Leaves[h].childLeft].next != -1)
-		Acth[Acth[Leaves[h].childLeft].next].prev = Acth[Leaves[h].childLeft].prev;
-	if (Acth[Leaves[h].childLeft].prev != -1)
-		Acth[Acth[Leaves[h].childLeft].prev].next = Acth[Leaves[h].childLeft].next;
-
-	if (Acth[Leaves[h].childRight].next != -1)
-		Acth[Acth[Leaves[h].childRight].next].prev = Acth[Leaves[h].childRight].prev;
-	if (Acth[Leaves[h].childRight].prev != -1)
-		Acth[Acth[Leaves[h].childRight].prev].next = Acth[Leaves[h].childRight].next;
-
-	
-	//  desconecto a los hijos
-	Acth[Leaves[h].childLeft].prev = -1;
-	Acth[Leaves[h].childLeft].next = -1;
-	Acth[Leaves[h].childRight].prev = -1;
-	Acth[Leaves[h].childRight].next = -1;
-
-	//añado al final
-	Acth[h].prev = final;
-	Acth[h].next = -1;
-	Acth[final].next = h;
-	final = h;
-
-	
-}
-
-//--------------------------------------------------------------------------------------------------------------------------------
-// Splitea una hoja 
-//--------------------------------------------------------------------------------------------------------------------------------
-				
-void Foliage::SplitHoja (int h, int &post)
-{
-
-	// SPLITEAR: QUITO UNO, PONGO DOS
-	
-	if ( ppio == h) ppio = Acth[h].next;
-	if ( final == h) final = Acth[h].prev; 
-
-	// 1 enlazo los hijos 
-	Acth[Leaves[h].childLeft].next = Leaves[h].childRight;
-	Acth[Leaves[h].childRight].prev = Leaves[h].childLeft;
-	Acth[Leaves[h].childRight].next = -1;
-
-	//y desconecto al padre
-	if ( Acth[h].prev != -1)
-		Acth[Acth[h].prev].next = Acth[h].next;
-	if ( Acth[h].next != -1)
-		Acth[Acth[h].next].prev = Acth[h].prev;
-	Acth[h].prev = -1;
-	Acth[h].next = -1;
-	
-	//añado al final los hijos 
-	Acth[Leaves[h].childLeft].prev = final;
-	Acth[final].next = Leaves[h].childLeft;
-	final = Leaves[h].childRight;
-
-}
-
-
-
-
-
-//-------------------------------------------------------------------------------------------
-// fuerzo a splitear
-// hoja -> es el nodo que cumple la condicion
-// padre -> es el nodo que chequeaba de la lista de activos
-// hpost -> es el nodo siguiente en la lista de activos
-//-------------------------------------------------------------------------------------------
-
-bool Foliage::Forzar_Split(int hoja, int padre, int &hpost)
-{
-	
-	int h;
-	lista <int> listah;
-	bool bien;
-
-	bien = false;
-	h = Leaves[hoja].parent;
-	listah.Inserta (h); // Inserta un dato en la lista
-
-	while ( h != padre)
-	{
-		h = Leaves[h].parent;
-		listah.Inserta (h); // Inserta un dato en la lista
-	}
-
-
-	while  (listah.NDatos () != 0) 
-	{
-		h = listah.GetCola ();//coger el padre más alto
-		SplitHoja(h, hpost);
-		listah.Borra(h);
-	
-	}
-
-	if ( listah.NDatos() == 0)
-		bien = true;
-	return (bien);
-		
-}		
-
-
-
-
-/******************************************   RESOLUCIÓN CONSTANTE **************************************************/
-
-
-int Foliage::ResolucionC (float dist, float dmax, float dmin)
-{
-
-	float difdist,  d;
-	int difhojas, nhojas;
-
-	if (( dist > dmin) && (dist <dmax))
-	{
-		difdist = dmax - dmin;
-		difhojas = nHojas - minHojas;
-
-		d = dist - dmin;
-
-		//regla de 3
-
-		nhojas = int(abs(d*difhojas /difdist));
-
-		AjusteHojas ((nHojas)-nhojas);
-
-	}
-	else if (dist > dmax) {
-		AjusteHojas (minHojas);
-	}
-	else if (dist < dmin) {
-		AjusteHojas (nHojas);
-	}
-		
-	return (nhactivas);
-}
-
-
-
-void Foliage::AjusteHojas( int nhojas)
-{
-	if ((nhojas <= nHojas) && (nhojas >= minHojas))
-	{
-		if ( nhojas < nhactivas) {
-			RCecol ( nhactivas - nhojas);
+
+void Foliage::CalculateLOD(int nleaves)
+{
+	if ((nleaves <= leafCount) && (nleaves > minLeaves))
+	{
+		if ( nleaves < active_leaf_count) {
+			RCecol (active_leaf_count - nleaves);
 		}
 		else  {
-			 RCsplit (nhojas-nhactivas );
-		}
-
-		nhactivas = nhojas;
-	//	printf ( "ajusto a %i\n", nhactivas );
-
+			 RCsplit (nleaves-active_leaf_count);
+		}
+
+		active_leaf_count = nleaves;
 	}
 
@@ -524,14 +97,11 @@
 	j = num;
 	h = final+1;
-		while ((h<=TotHojas) && (j>0))
+		while ((h<=leafTotal) && (j>0))
 		{
-			while (( ppio == Leaves[h].childLeft) || ( ppio == Leaves[h].childRight))
-				ppio = Acth[ppio].next;
+			while (( begin == Leaves[h].childLeft) || ( begin == Leaves[h].childRight))
+				begin = Acth[begin].next;
 
 			while (( final == Leaves[h].childLeft) || ( final == Leaves[h].childRight))
 				final = Acth[final].prev; 
-
-
-			//COLAPSAR = QUITO DOS DE ACTIVOS PONGO UNO A ACTIVO
 
 			if (Acth[Leaves[h].childLeft].next != -1)
@@ -563,38 +133,13 @@
 			//incremento el posible siguiente colapso 
 			h++;
-
-
-		}
-
-}
-
-/*
-void Foliage::RCsplit (  int nhojas)
-{
-	int i, hpost;
-
-	i = ppio;
-	
-	while (( i != -1) && (nhojas>0)){
-		hpost = Acth[i].next;
-
-		if (MiArbol->Leaves[i].childLeft != -1){
-					SplitHoja(i, hpost);
-					nhojas --;
-
-		}
-		
-		i = hpost;
-
-	}
-}
-*/
-
-int Foliage::AnteriorActivo (int h)
+		}
+}
+
+int Foliage::PrevActive(int h)
 {
 	int i;
 
 	
-	if (ppio > h)  i = -1;
+	if (begin > h)  i = -1;
 	else
 	{
@@ -608,13 +153,13 @@
 }
 
-int Foliage::PosteriorActivo (int h)
+int Foliage::NextActive(int h)
 {	int i;
 
 	i = h++;
 	
-	while ((IsActive(i) == false) || (i> TotHojas))
+	while ((IsActive(i) == false) || (i> leafTotal))
 		i++;
 
-	if (i > TotHojas) i=-1;
+	if (i > leafTotal) i=-1;
 
 
@@ -629,11 +174,10 @@
 	j = num;
 	h = final;
-	while ((h > nHojas) &&  (j>0))
-	{
-
+	while (h>leafCount &&  j>0)
+	{
 		///////////// insertar a los hijos en orden segun su indice
 		//hijo izquierdo
-		ant = AnteriorActivo (Leaves[h].childLeft);
-		post = PosteriorActivo (Leaves[h].childLeft);
+		ant = PrevActive(Leaves[h].childLeft);
+		post = NextActive(Leaves[h].childLeft);
 
 
@@ -641,11 +185,11 @@
 		Acth[Leaves[h].childLeft].prev = ant;
 		if (ant != -1) Acth[ant].next = Leaves[h].childLeft;
-			else ppio = Leaves[h].childLeft;
+			else begin = Leaves[h].childLeft;
 		if (post != -1) Acth[post].prev = Leaves[h].childLeft;
 
 		
 		//hijo derecho
-		ant = AnteriorActivo (Leaves[h].childRight);
-		post = PosteriorActivo (Leaves[h].childRight);
+		ant = PrevActive(Leaves[h].childRight);
+		post = NextActive(Leaves[h].childRight);
 
 
@@ -653,5 +197,5 @@
 		Acth[Leaves[h].childRight].prev = ant;
 		if (ant != -1)  Acth[ant].next = Leaves[h].childRight;
-				else ppio = Leaves[h].childRight;
+				else begin = Leaves[h].childRight;
 		if (post != -1) Acth[post].prev = Leaves[h].childRight;
 
@@ -695,5 +239,5 @@
 	vertexdata->End();
 
-	TotVerts = countv;
+	TotalVerts = countv;
 }
 
@@ -746,6 +290,6 @@
 {
 	int numtris = int(submesh->mIndexCount / 3);
-	nHojas =  numtris / 2;
-	for (int h=0; h<nHojas; h++)
+	leafCount =  numtris / 2;
+	for (int h=0; h<leafCount; h++)
 	{
 		Leaves[h].vertsLeaf[0] = submesh->mIndex[h*6+0];
@@ -773,5 +317,5 @@
 	else
 	{
-		tn = nHojas;
+		tn = leafCount;
 		while (fgets (linea, 255, fp_simpli) != NULL)
 		{
@@ -779,8 +323,4 @@
 				continue;
 		
-			//N 446 Ver 10176 10178 10169 10171  Tv 156 154 E 2
-
-//			sscanf(linea, "%s %lu %s %lu %lu  %lu %lu %s %lu %lu %s %i", 
-//				&str, &tn, &str, &v0, &v1, &v2, &v3, &str, &tv1, &tv2, &str, &e );
 			long int triviej00=-1, triviej01=-1;
 			long int triviej10=-1, triviej11=-1;
@@ -812,10 +352,10 @@
 	fclose(fp_simpli);
 
-	TotHojas=tn;
+	leafTotal=tn;
 		
 	return true;
 }
 
-void Foliage::RellenoRaiz (void)
+void Foliage::FillRoot(void)
 {
 	int i,j, k, t, cont;
@@ -826,10 +366,10 @@
 	cont =-1;
 
-	MinDet  = new ActiveLeafNode[nHojas*2];
-	
-	while (i<TotHojas)
+	MinDet  = new ActiveLeafNode[leafCount*2];
+	
+	while (i<leafTotal)
 	{
 		j=i;
-		while (Leaves[j].parent > -1) j= Leaves[j].parent;
+		while (Leaves[j].parent>-1) j=Leaves[j].parent;
 		Leaves[i].root = j;
 
@@ -853,5 +393,5 @@
 			}
 
-			if ( esta == false) //añado al final
+			if ( esta == false)
 			{
 				cont++;
@@ -860,15 +400,15 @@
 		}
 
-	i++;
+		i++;
 	}	
 
-	minHojas = cont;
-
-}
-
-void Foliage::CalculaTexCoordsYNorms(void)
+	minLeaves = cont;
+
+}
+
+void Foliage::CalculateTexCoordsAndNorms(void)
 {	
 	vertexdata->Begin();
-	for (int i=0; i<nHojas; i++)
+	for (int i=0; i<leafCount; i++)
 	{	
 		const float* lanormal = Leaves[i].normal;
@@ -884,17 +424,4 @@
 		vertexdata->SetVertexNormal(Leaves[i].vertsLeaf[3], lanormal[0], lanormal[1], lanormal[2]);
 		vertexdata->SetVertexTexCoord(Leaves[i].vertsLeaf[3], 1.0f, 0.0f);
-
-
-/*		MiArbol->Vertices[aHoja.vertsLeaf[1]].GetCoordinates (a,b,c);
-		glTexCoord2f ( 0.0, 1.0);
-		glVertex3f (a,b,c);
-	
-		MiArbol->Vertices[aHoja.vertsLeaf[2]].GetCoordinates (a,b,c);
-		glTexCoord2f ( 1.0, 0.0);
-		glVertex3f (a,b,c);
-
-		MiArbol->Vertices[aHoja.vertsLeaf[3]].GetCoordinates (a,b,c);
-		glTexCoord2f ( 1.0, 1.0);
-		glVertex3f (a,b,c);*/
 	}
 	vertexdata->End();
@@ -903,16 +430,12 @@
 Foliage::Foliage(const Foliage *ar)
 {
-	nHojas=ar->nHojas;
-	MinDet  = new ActiveLeafNode[nHojas*2];
+	leafCount = ar->leafCount;
+	MinDet = new ActiveLeafNode[leafCount*2];
 //	for (unsigned int i=0; i<nHojas*2; i++)
 //		MinDet[i]=ar->MinDet[i];
-	memcpy(MinDet,ar->MinDet,sizeof(ActiveLeafNode)*nHojas*2);
-	TotHojas=ar->TotHojas;
-	cx=ar->cx;
-	cy=ar->cy;
-	cz=ar->cz;
-	rad=ar->rad;
-	minHojas=ar->minHojas;
-	TotVerts=ar->TotVerts;
+	memcpy(MinDet,ar->MinDet,sizeof(ActiveLeafNode)*leafCount*2);
+	leafTotal=ar->leafTotal;
+	minLeaves=ar->minLeaves;
+	TotalVerts=ar->TotalVerts;
 
 	create_vertex_data_func=ar->create_vertex_data_func;
@@ -945,7 +468,7 @@
 	int h=0;
 
-	Acth  = new ActiveLeafNode[nHojas*8];
-
-	for ( h=0; h < nHojas; h++) {
+	Acth  = new ActiveLeafNode[leafCount*8];
+
+	for ( h=0; h < leafCount; h++) {
 
 		Acth[h].index = h;
@@ -958,7 +481,7 @@
 	}
 				
-	ppio = 0;
-	final = nHojas-1;
-	nhactivas = nHojas;
-
-}
+	begin = 0;
+	final = leafCount-1;
+	active_leaf_count = leafCount;
+
+}
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/foliage.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/foliage.h	(revision 1057)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/foliage.h	(revision 1058)
@@ -4,5 +4,4 @@
 #include "GeoSubMesh.h"
 #include "tlista.h"
-#include "TMatrix.h"
 #include "VertexData.h"
 #include "Leaf.h"
@@ -24,7 +23,6 @@
 
 		ActiveLeafNode  *Acth; // first active leaf
-		int ppio, final;
-		int nhactivas;
-		TMatrix mat_aux;
+		int begin, final;
+		int active_leaf_count;
 
 		Foliage (const Geometry::SubMesh *, const char *simpSeq, Geometry::CREATEVERTEXDATAFUNC vdfun=NULL, Geometry::CREATEINDEXDATAFUNC idfun=NULL);
@@ -32,22 +30,5 @@
 		virtual ~Foliage (void); // Destructor
 		
-		//culling
-		void Culling (float frustum[6][4]);
-		bool LeafinFrustum ( int i, float frustum[6][4]);
-
-		bool IsActive( int num) const;
-		int  ResolucionV ( char c, float rva, float rvb,float rvc, float rvd, float radio);
-		void ColapsaHoja (int, int&);
-		void SplitHoja (int, int&);
-		bool Forzar_Split(int, int, int&);
-		int  AnteriorActivo (int h);
-		int  PosteriorActivo (int h);
-
-
-		// resolucion constante
-		int  ResolucionC (float dist, float dmax, float dmin);
-		void AjusteHojas( int nhojas);
-		void RCecol (  int nhojas);
-		void RCsplit (  int nhojas);
+		void CalculateLOD(int nhojas);
 
 		Geometry::VertexData *vertexdata;
@@ -55,12 +36,10 @@
 
 		Leaf   *Leaves;
-		ActiveLeafNode  *MinDet; // primera hoja activa
-		int nHojas;
-		int TotHojas;
+		ActiveLeafNode  *MinDet; // first active leaf
+		int leafCount;
+		int leafTotal;
 		
-		float cx,cy,cz; //centro de la copa// para los impostores y resolucion variable
-		float rad; //radio de la esfera envolvente
-		int minHojas;
-		int TotVerts;
+		int minLeaves;
+		int TotalVerts;
 
 	private:
@@ -68,16 +47,22 @@
 		Geometry::CREATEINDEXDATAFUNC create_index_data_func;
 
+		bool IsActive( int num) const;
+		int  PrevActive (int h);
+		int  NextActive (int h);
+
+		void RCecol(int nhojas);
+		void RCsplit(int nhojas);
+
 		void ReadLeafs(const Geometry::SubMesh *);
 		void ReadVertices(const Geometry::SubMesh *);
 		bool ReadSimpSeq(const char*); /// returns true when successful
-		void RellenoRaiz (void);
+		void FillRoot(void);
 
 		void GetNormalH (Leaf&);
-//		void GetNormalT(Tronco&);
 
 		void CrossProduct(const float *v1, const float *v2, float *res);
 		void Normalize(const float *v, float *res);
 //		void CalculaNormalesVertice(void);
-		void CalculaTexCoordsYNorms(void);
+		void CalculateTexCoordsAndNorms(void);
 
 };
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/Point3D.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/Point3D.cpp	(revision 830)
+++ 	(revision )
@@ -1,161 +1,0 @@
-#include <math.h> // Necesaria para el cálculo de raices cuadradas.
-#include "Point3D.h"
-
-
-//---------------------------------------------------------------------------------------------------
-// Constructor de copia sin parámetros
-//---------------------------------------------------------------------------------------------------
-Point3D::Point3D (void)
-{
-	coords[0] = coords[1] = coords[2] = 0.0f;
-}
-
-
-//---------------------------------------------------------------------------------------------------
-// Constructor con tres parámetros
-// Parámetros --> x, y, z son las coordenadas del punto en 3D
-//---------------------------------------------------------------------------------------------------
-Point3D::Point3D (float x, float y, float z)
-{
-	coords[0] = x;
-	coords[1] = y;
-	coords[2] = z;
-}
-
-
-//---------------------------------------------------------------------------------------------------
-// Constructor de copia
-// Parámetros --> p es el punto con el se hace la copia
-//---------------------------------------------------------------------------------------------------
-Point3D::Point3D (const Point3D & p)
-{
-	coords[0] = p.coords[0];
-	coords[1] = p.coords[1];
-	coords[2] = p.coords[2];
-}
-
-
-//---------------------------------------------------------------------------------------------------
-// Operador de asignación
-// Parámetros --> p es el punto con los datos a copiar
-// Salida --> Se devuelve una referencia al punto al que se acaban de copiar los datos
-//---------------------------------------------------------------------------------------------------
-Point3D & Point3D::operator = (const Point3D & p)
-{
-	coords[0] = p.coords[0];
-	coords[1] = p.coords[1];
-	coords[2] = p.coords[2];
-
-	return *this;
-}
-
-
-//---------------------------------------------------------------------------------------------------
-// Operador de comparación
-// Parámetros const Point3D& p : Punto con el que se está comparando
-// Salida --> 'true' si los puntos son iguales
-//			  'false' en caso contrario
-//---------------------------------------------------------------------------------------------------
-bool Point3D::operator == (const Point3D & p) const
-{
-	if (coords[0] == p.coords[0] &&
-		coords[1] == p.coords[1] &&
-		coords[2] == p.coords[2])
-		return true;
-
-	return false;
-}
-
-
-//---------------------------------------------------------------------------------------------------
-// Operador diferencia
-// Parámetros --> p es el punto con el que se compara el actual
-// Salida si son distintos 'true' en caso contrario 'false'
-//---------------------------------------------------------------------------------------------------
-bool Point3D::operator != (const Point3D & p) const
-{
-	return (coords[0] != p.coords[0] ||
-			coords[1] != p.coords[1] ||
-			coords[2] != p.coords[2]);
-}
-
-
-//---------------------------------------------------------------------------------------------------
-// Para actualizar las componentes del punto
-// Parámetros --> const float a, const float b, const float c : las nuevas coordenadas del punto
-//---------------------------------------------------------------------------------------------------
-bool Point3D::Update (const float a, const float b, const float c)
-{
-	coords[0] = a;
-	coords[1] = b;
-	coords[2] = c;
-
-	return true;
-}
-
-
-
-bool Point3D::Update (const Point3D& unPunto)
-{
-	*this = unPunto;
-
-	return true;
-}
-
-
-//---------------------------------------------------------------------------------------------------
-// Returns the point coordinates 
-// Parameters --> float& a, float& b, float& c : References that recieve the coordinates
-// Return --> None
-//---------------------------------------------------------------------------------------------------
-void Point3D::GetCoordinates (float& a, float& b, float& c) const
-{
-	a = coords[0];
-	b = coords[1];
-	c = coords[2];
-}
-
-//---------------------------------------------------------------------------------------------------
-// Actualiza las coordenadas
-// Parameters --> float a, float b, float c : Lo que se van a incrementar
-//							las coordenadas del punto
-// Return --> None
-//---------------------------------------------------------------------------------------------------
-void Point3D::Actualiza (float a, float b, float c) 
-{
-	coords[0] = coords[0] + a;
-	coords[1] = coords[1] + b;
-	coords[2] = coords[2] + c;
-}
-
-
-
-//---------------------------------------------------------------------------------------------------
-//---------------------------------------------------------------------------------------------------
-const float * const Point3D::GetCoordinates (void) const
-{
-	return coords;
-}
-
-
-//---------------------------------------------------------------------------------------------------
-// Calcula la distancia euclidea entre dos puntos
-// Parámetros --> p es el punto hasta el que se calcula la distancia desde este
-// Salida la distancia entre los puntos como un float
-//---------------------------------------------------------------------------------------------------
-float Point3D::Distance (const Point3D & p) const
-{
-	return ((float)sqrt ((coords[0]-p.coords[0])*(coords[0]-p.coords[0])+
-						 (coords[1]-p.coords[1])*(coords[1]-p.coords[1])+
-						 (coords[2]-p.coords[2])*(coords[2]-p.coords[2])));
-}
-
-
-//---------------------------------------------------------------------------------------------------
-//---------------------------------------------------------------------------------------------------
-std::ostream& operator << (std::ostream& os, Point3D & p)
-{
-	os << '(' << p.coords[0] << ',' << p.coords[1] << ',' << p.coords[2] << ")\n";
-
-	return os;
-}
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/Point3D.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/Point3D.h	(revision 830)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#ifndef POINT3D_H
-#define POINT3D_H
-
-
-
-#include <iostream>
-
-
-
-class Point3D
-{
-	protected:
-		float coords[3]; // Las tres coordenadas de un punto en 3D
-
-	public:
-		Point3D (void); // Constructor sin parámetros
-		Point3D (float, float, float); // Constructor con parámetros
-		Point3D (const Point3D&); // Constructor de copia
-		Point3D & operator = (const Point3D &); // Operador de asignación
-		bool operator == (const Point3D &) const; // Operador de comparación
-		bool operator != (const Point3D &) const; // Operador distinto de
-		bool Update (const float, const float, const float); // Actualiza las coordenadas del punto
-		bool Update (const Point3D&); // Actualiza con los datos de otro punto
-		void GetCoordinates (float&, float&, float&) const;
-		void Actualiza (float, float, float);
-		const float * const GetCoordinates (void) const;
-		float Distance (const Point3D &) const; // Distancia entre dos puntos
-		// A partir de aqui las funciones son relevantes solo para depuración de código
-		friend std::ostream& operator << (std::ostream& os, Point3D&); // Para salida por consola
-
-};
-
-//#define Vertex Point3D
-
-
-#endif
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/Vector.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/Vector.h	(revision 985)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
----------------------------------------------------------------------
-This file is part of Sandra Engine (real-time 3D engine)
- Copyright (C) 2004 Jesus Gumbau Portales
-
-This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, 
- USA, or go to http://www.gnu.org/copyleft/lesser.txt.
----------------------------------------------------------------------
-*/
-
-// 21-02-2001
-// Jesus Gumbau Portales
-
-#ifndef __VECTOR_H__
-#define __VECTOR_H__
-
-#include <math.h>
-
-#ifndef PI
-#define PI	3.14159f
-#endif
-#define GradToRad(x) x*PI/180.0f
-
-class Vector
-{
-public:
-	Vector(double vx=0.0f, double vy=0.0f, double vz=0.0f, double vw=1.0f){ x=vx; y=vy; z=vz; w=vw; }
-	double x,y,z,w;
-	inline Vector operator*(double f) const { return Vector(x*f,y*f,z*f); }
-	inline void operator+=(const Vector &v){ x+=v.x; y+=v.y; z+=v.z; }
-	inline void operator+=(double f){ x+=f; y+=f; z+=f; }
-	inline void operator-=(const Vector &v){ x-=v.x; y-=v.y; z-=v.z; }
-	inline void operator-=(double f){ x-=f; y-=f; z-=f; }
-	inline Vector operator+(const Vector &v) const { return Vector(x+v.x,y+v.y,z+v.z); }
-//	Vector operator-(Vector &v){ return Vector(x-v.x,y-v.y,z-v.z); }
-	inline Vector operator-(const Vector &v) const { return Vector(x-v.x,y-v.y,z-v.z); }
-	inline double Module(void) const { return sqrtf(float(x*x) + float(y*y) + float(z*z)); }
-	inline bool operator==(const Vector &v) const { return (x==v.x && y==v.y && z==v.z); }
-	inline bool operator!=(const Vector &v) const { return (x!=v.x || y!=v.y || z!=v.z); }
-	inline Vector operator-(void) const { return Vector(-x,-y,-z); }
-	inline Vector operator/(double f) const { return (*this)*(1/f); }
-	inline Vector operator/=(double f) { x/=f; y/=f; z/=f; return (*this); }
-	inline Vector operator=(const Vector &v) { x=v.x; y=v.y; z=v.z; w=v.w; return Vector(x,y,z,w); }
-	inline Vector operator=(double f) { x=f; y=f; z=f; return Vector(x,y,z); }
-	inline bool operator<(const Vector &v) const { return (x<v.x && y<v.y && z<v.z && w<v.w); }
-	inline void Normalize(void){
-		double module=sqrtf(float(x*x) + float(y*y) + float(z*z));
-		x=x/module;
-		y=y/module;
-		z=z/module;
-	}
-
-
-	static const Vector UNITY;
-		
-	const double &operator[](unsigned int i) const { return (&x)[i]; }
-	double &operator[](unsigned int i){ return (&x)[i]; }
-};
-
-#endif
-
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/TMatrix.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/TMatrix.h	(revision 985)
+++ 	(revision )
@@ -1,639 +1,0 @@
- /*
----------------------------------------------------------------------
-This file is part of Sandra Engine (real-time 3D engine)
- Copyright (C) 2004 Jesus Gumbau Portales
-
-This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, 
- USA, or go to http://www.gnu.org/copyleft/lesser.txt.
----------------------------------------------------------------------
-*/
-
-// 21-02-2001
-// Jesus Gumbau Portales
-
-#ifndef __TMATRIX_H__
-#define __TMATRIX_H__
-
-#include "Vector.h"
-
-#define MATRIX_WORLD_SPACE 0
-#define MATRIX_OBJECT_SPACE 1
-
-	class RotMatrix
-	{
-	private:
-		Vector col[3];
-		float tempmat[16];
-	public:
-		RotMatrix(void){
-			col[0].x=1.0f; col[1].x=0.0f; col[2].x=0.0f;
-			col[0].y=0.0f; col[1].y=1.0f; col[2].y=0.0f;
-			col[0].z=0.0f; col[1].z=0.0f; col[2].z=1.0f;
-		}
-		RotMatrix(const RotMatrix &t){
-			col[0]=t.col[0];
-			col[1]=t.col[1];
-			col[2]=t.col[2];
-		}
-
-		void SetBaseX(float v[3]){ col[0].x=v[0]; col[0].y=v[1]; col[0].z=v[2]; }
-		void SetBaseY(float v[3]){ col[1].x=v[0]; col[1].y=v[1]; col[1].z=v[2]; }
-		void SetBaseZ(float v[3]){ col[2].x=v[0]; col[2].y=v[1]; col[2].z=v[2]; }
-
-		void SetBaseX(float x, float y, float z){ col[0].x=x; col[0].y=y; col[0].z=z; }
-		void SetBaseY(float x, float y, float z){ col[1].x=x; col[1].y=y; col[1].z=z; }
-		void SetBaseZ(float x, float y, float z){ col[2].x=x; col[2].y=y; col[2].z=z; }
-
-		void SetBaseX(const Vector &v){ col[0].x=v.x; col[0].y=v.y; col[0].z=v.z; }
-		void SetBaseY(const Vector &v){ col[1].x=v.x; col[1].y=v.y; col[1].z=v.z; }
-		void SetBaseZ(const Vector &v){ col[2].x=v.x; col[2].y=v.y; col[2].z=v.z; }
-
-		Vector GetBaseX(void) const { return col[0]; }
-		Vector GetBaseY(void) const { return col[1]; }
-		Vector GetBaseZ(void) const { return col[2]; }
-
-		// RotMatrix x Vector
-		Vector operator*(const Vector &v) const {
-			return Vector(col[0].x*v.x + col[1].x*v.y + col[2].x*v.z,
-						  col[0].y*v.x + col[1].y*v.y + col[2].y*v.z,
-						  col[0].z*v.x + col[1].z*v.y + col[2].z*v.z);
-		}
-
-		Vector &operator[](unsigned int column){
-			return ((Vector&)(col[column]));
-		}
-		const Vector &operator[](unsigned int column) const {
-			return ((Vector&)(col[column]));
-		}
-
-
-		// RotMatrix - RotMatrix
-		RotMatrix operator-(const RotMatrix &tm) const {
-			RotMatrix res;
-
-			for (unsigned int c=0; c<3; c++)
-				for (unsigned int f=0; f<3; f++)
-					res[c][f]=col[c][f]-tm[c][f];
-
-			return res;
-		}
-
-
-		// RotMatrix * RotMatrix
-		RotMatrix operator*(const RotMatrix &tm) const {
-			RotMatrix res;
-			for (unsigned int c=0; c<3; c++)
-				for (unsigned int f=0; f<3; f++)
-				{
-					float ff=0.0f;
-					ff+=float(col[0][f]*tm[c][0]);
-					ff+=float(col[1][f]*tm[c][1]);
-					ff+=float(col[2][f]*tm[c][2]);
-					res[c][f]=ff;
-				}
-			return res;
-		}
-
-		void PostMultiply(const RotMatrix &tm){
-			RotMatrix res;
-			for (unsigned int f=0; f<3; f++)
-				for (unsigned int c=0; c<3; c++)
-				{
-					float ff=0.0f;
-					ff+=float(col[0][c]*tm[f][0]);
-					ff+=float(col[1][c]*tm[f][1]);
-					ff+=float(col[2][c]*tm[f][2]);
-					res[c][f]=ff;
-				}
-			(*this)=res;
-		}
-
-		const RotMatrix & operator=(const RotMatrix &tm){
-			col[0]=tm.col[0];
-			col[1]=tm.col[1];
-			col[2]=tm.col[2];
-			return tm;
-		}
-
-		bool operator!=(const RotMatrix &tm) const {
-			if (col[0]!=tm[0]) return false;
-			if (col[1]!=tm[1]) return false;
-			if (col[2]!=tm[2]) return false;
-			return true;
-		}
-
-		void LoadIdentity(void){
-			col[0][0]=1.0f; col[1][0]=0.0f; col[2][0]=0.0f;
-			col[0][1]=0.0f; col[1][1]=1.0f; col[2][1]=0.0f;
-			col[0][2]=0.0f; col[1][2]=0.0f; col[2][2]=1.0f;
-		}
-
-		// returns a mat[16] in opengl conform format
-		// WARNING: returns a dir to a TEMP variable
-		float *GetOpenGLConform(void){
-			tempmat[0]=float(col[0][0]);
-			tempmat[1]=float(col[0][1]);
-			tempmat[2]=float(col[0][2]);
-			tempmat[3]=0.0f;
-			tempmat[4]=float(col[1][0]);
-			tempmat[5]=float(col[1][1]);
-			tempmat[6]=float(col[1][2]);
-			tempmat[7]=0.0f;
-			tempmat[8]=float(col[2][0]);
-			tempmat[9]=float(col[2][1]);
-			tempmat[10]=float(col[2][2]);
-			tempmat[11]=0.0f;
-			tempmat[12]=0.0f;
-			tempmat[13]=0.0f;
-			tempmat[14]=0.0f;
-			tempmat[15]=1.0f;
-			return tempmat;
-		}
-
-
-		// sets the matrix to a rotation matrix 
-		void LoadRotationXMatrix(float angle){
-			float cosa=cosf(GradToRad(angle));
-			float sina=sinf(GradToRad(angle));
-			col[0][0]=1.0f; col[1][0]=0.0f; col[2][0]=0.0f;
-			col[0][1]=0.0f; col[1][1]=cosa; col[2][1]=-sina;
-			col[0][2]=0.0f; col[1][2]=sina; col[2][2]=cosa;
-		}
-
-		void LoadRotationYMatrix(float angle){
-			float cosa=cosf(GradToRad(angle));
-			float sina=sinf(GradToRad(angle));
-			col[0][0]=cosa; col[1][0]=0.0f; col[2][0]=sina;
-			col[0][1]=0.0f; col[1][1]=1.0f; col[2][1]=0.0f;
-			col[0][2]=-sina;col[1][2]=0.0f; col[2][2]=cosa;
-		}
-
-		void LoadRotationZMatrix(float angle){
-			float cosa=cosf(GradToRad(angle));
-			float sina=sinf(GradToRad(angle));
-			col[0][0]=cosa; col[1][0]=-sina;col[2][0]=0.0f;
-			col[0][1]=sina; col[1][1]=cosa; col[2][1]=0.0f;
-			col[0][2]=0.0f; col[1][2]=0.0f; col[2][2]=1.0f;
-		}
-
-		// Rotate the object around X axis
-		void RotateX(float angle, int mode=MATRIX_OBJECT_SPACE){
-			RotMatrix tr;
-			tr.LoadRotationXMatrix(angle); // FIXME!!!!! -angle?!?!
-			if (mode==MATRIX_OBJECT_SPACE)
-				operator=( (*this)*tr );
-			else
-				operator=( tr*(*this) );
-		}
-
-		void RotateY(float angle, int mode=MATRIX_OBJECT_SPACE){
-			RotMatrix tr;
-			tr.LoadRotationYMatrix(angle);
-			if (mode==MATRIX_OBJECT_SPACE)
-				operator=( (*this)*tr );
-			else
-				operator=( tr*(*this) );
-		}
-
-		void RotateZ(float angle, int mode=MATRIX_OBJECT_SPACE){
-			RotMatrix tr;
-			tr.LoadRotationZMatrix(angle);
-			if (mode==MATRIX_OBJECT_SPACE)
-				operator=( (*this)*tr );
-			else
-				operator=( tr*(*this) );
-		}
-
-		void RotateAxis(float angle, Vector axis, int mode=MATRIX_OBJECT_SPACE){
-			RotMatrix Rx,Ry,Rz,iRx,iRy;
-			float d = (float)sqrt(axis.y*axis.y + axis.z*axis.z);
-
-			Rx.SetBaseX(1.0f, 0.0f, 0.0f);
-			Rx.SetBaseY(0.0f, float(axis.z/d), float(axis.y/d));
-			Rx.SetBaseZ(0.0f, float(-axis.y/d), float(axis.z/d));			
-			
-			Ry.SetBaseX(d, 0.0f, float(axis.x));
-			Ry.SetBaseY(0.0f, 1.0f, 0.0f);
-			Ry.SetBaseZ(float(-axis.x), 0.0f, d);
-
-			Rz.LoadRotationZMatrix(angle);
-
-			iRx = Rx;	iRx.Traspose();
-			iRy = Ry;	iRy.Traspose();
-			
-			RotMatrix accum;
-			accum.LoadIdentity();
-			if (d!=0)
-				accum = accum * iRx;
-			accum = accum * iRy;
-			accum = accum * Rz;
-			accum = accum * Ry;
-			if (d!=0)
-				accum = accum * Rx;
-
-			if (mode==MATRIX_OBJECT_SPACE)
-				operator=( (*this)*accum );
-			else
-				operator=( accum*(*this) );
-		}
-
-		void Traspose(void){
-			tempmat[0]=float(col[0][0]);
-			tempmat[1]=float(col[0][1]);
-			tempmat[2]=float(col[0][2]);
-
-			tempmat[3]=float(col[1][0]);
-			tempmat[4]=float(col[1][1]);
-			tempmat[5]=float(col[1][2]);
-
-			tempmat[6]=float(col[2][0]);
-			tempmat[7]=float(col[2][1]);
-			tempmat[8]=float(col[2][2]);
-
-			col[0].x=tempmat[0];  col[1].x=tempmat[1];  col[2].x=tempmat[2];
-			col[0].y=tempmat[4];  col[1].y=tempmat[4];  col[2].y=tempmat[5];
-			col[0].z=tempmat[6];  col[1].z=tempmat[7];  col[2].z=tempmat[8];
-		}
-
-		// This function inverts (only) a valid ROTRANSFORM Matrix (with unitary vector lengths). This should not work on arbitrary matrices
-		void Invert(void){
-			Traspose();
-		}
-	};
-
-
-	class TMatrix
-	{
-	private:
-		Vector col[4];
-		float tempmat[16];
-	public:
-		TMatrix(void){
-			col[0].x=1.0f; col[1].x=0.0f; col[2].x=0.0f; col[3].x=0.0f;
-			col[0].y=0.0f; col[1].y=1.0f; col[2].y=0.0f; col[3].y=0.0f;
-			col[0].z=0.0f; col[1].z=0.0f; col[2].z=1.0f; col[3].z=0.0f;
-			col[0].w=0.0f; col[1].w=0.0f; col[2].w=0.0f; col[3].w=1.0f;
-		}
-		TMatrix(const TMatrix &t){
-			col[0]=t.col[0];
-			col[1]=t.col[1];
-			col[2]=t.col[2];
-			col[3]=t.col[3];
-		}
-
-		TMatrix(const Vector &tr, const RotMatrix &rot, const Vector &scale){
-			col[0] = rot.GetBaseX()*scale.x;
-			col[1] = rot.GetBaseY()*scale.y;
-			col[2] = rot.GetBaseZ()*scale.z;
-			col[3] = tr;
-			col[0].w=0.0f; col[1].w=0.0f; col[2].w=0.0f; col[3].w=1.0f;
-		}
-
-		void SetBaseX(float v[3]){ col[0].x=v[0]; col[0].y=v[1]; col[0].z=v[2]; }
-		void SetBaseY(float v[3]){ col[1].x=v[0]; col[1].y=v[1]; col[1].z=v[2]; }
-		void SetBaseZ(float v[3]){ col[2].x=v[0]; col[2].y=v[1]; col[2].z=v[2]; }
-		void SetPoint(float v[3]){ col[3].x=v[0]; col[3].y=v[1]; col[3].z=v[2]; }
-
-		void SetBaseX(float x, float y, float z){ col[0].x=x; col[0].y=y; col[0].z=z; }
-		void SetBaseY(float x, float y, float z){ col[1].x=x; col[1].y=y; col[1].z=z; }
-		void SetBaseZ(float x, float y, float z){ col[2].x=x; col[2].y=y; col[2].z=z; }
-		void SetPoint(float x, float y, float z){ col[3].x=x; col[3].y=y; col[3].z=z; }
-
-		void SetBaseX(const Vector &v){ col[0].x=v.x; col[0].y=v.y; col[0].z=v.z; }
-		void SetBaseY(const Vector &v){ col[1].x=v.x; col[1].y=v.y; col[1].z=v.z; }
-		void SetBaseZ(const Vector &v){ col[2].x=v.x; col[2].y=v.y; col[2].z=v.z; }
-		void SetPoint(const Vector &v){ col[3].x=v.x; col[3].y=v.y; col[3].z=v.z; }
-
-		Vector GetBaseX(void) const { return col[0]; }
-		Vector GetBaseY(void) const { return col[1]; }
-		Vector GetBaseZ(void) const { return col[2]; }
-
-		// TMatrix x Vector
-		Vector operator*(const Vector &v) const {
-			return Vector(col[0].x*v.x + col[1].x*v.y + col[2].x*v.z + col[3].x*v.w,
-						  col[0].y*v.x + col[1].y*v.y + col[2].y*v.z + col[3].y*v.w,
-						  col[0].z*v.x + col[1].z*v.y + col[2].z*v.z + col[3].z*v.w,
-						  col[0].w*v.x + col[1].w*v.y + col[2].w*v.z + col[3].w*v.w);
-		}
-
-		Vector &operator[](unsigned int column){
-			return ((Vector&)(col[column]));
-		}
-		const Vector &operator[](unsigned int column) const {
-			return ((Vector&)(col[column]));
-		}
-
-
-		// TMatrix - TMatrix
-		TMatrix operator-(const TMatrix &tm) const {
-			TMatrix res;
-
-			for (unsigned int c=0; c<4; c++)
-				for (unsigned int f=0; f<4; f++)
-					res[c][f]=col[c][f]-tm[c][f];
-
-			return res;
-		}
-
-
-		// TMatrix * TMatrix
-		TMatrix operator*(const TMatrix &tm) const {
-			TMatrix res;
-			for (unsigned int c=0; c<4; c++)
-				for (unsigned int f=0; f<4; f++)
-				{
-					float ff=0.0f;
-					ff+=float(col[0][f]*tm[c][0]);
-					ff+=float(col[1][f]*tm[c][1]);
-					ff+=float(col[2][f]*tm[c][2]);
-					ff+=float(col[3][f]*tm[c][3]);
-					res[c][f]=ff;
-				}
-			return res;
-		}
-
-		void PostMultiply(const TMatrix &tm){
-			TMatrix res;
-			for (unsigned int f=0; f<4; f++)
-				for (unsigned int c=0; c<4; c++)
-				{
-					float ff=0.0f;
-					ff+=float(col[0][c]*tm[f][0]);
-					ff+=float(col[1][c]*tm[f][1]);
-					ff+=float(col[2][c]*tm[f][2]);
-					ff+=float(col[3][c]*tm[f][3]);
-					res[c][f]=ff;
-				}
-			(*this)=res;
-		}
-
-		const TMatrix & operator=(const TMatrix &tm){
-			col[0]=tm.col[0];
-			col[1]=tm.col[1];
-			col[2]=tm.col[2];
-			col[3]=tm.col[3];
-			return tm;
-		}
-
-		bool operator!=(const TMatrix &tm) const {
-			if (col[0]!=tm[0]) return false;
-			if (col[1]!=tm[1]) return false;
-			if (col[2]!=tm[2]) return false;
-			if (col[3]!=tm[3]) return false;
-			return true;
-		}
-
-		void LoadIdentity(void){
-			col[0][0]=1.0f; col[1][0]=0.0f; col[2][0]=0.0f; col[3][0]=0.0f;
-			col[0][1]=0.0f; col[1][1]=1.0f; col[2][1]=0.0f; col[3][1]=0.0f;
-			col[0][2]=0.0f; col[1][2]=0.0f; col[2][2]=1.0f; col[3][2]=0.0f;
-			col[0][3]=0.0f; col[1][3]=0.0f; col[2][3]=0.0f; col[3][3]=1.0f;
-		}
-
-		// returns a mat[16] in opengl conform format
-		// WARNING: returns a dir to a TEMP variable
-		float *GetOpenGLConform(void){
-			tempmat[0]=float(col[0][0]);
-			tempmat[1]=float(col[0][1]);
-			tempmat[2]=float(col[0][2]);
-			tempmat[3]=float(col[0][3]);
-			tempmat[4]=float(col[1][0]);
-			tempmat[5]=float(col[1][1]);
-			tempmat[6]=float(col[1][2]);
-			tempmat[7]=float(col[1][3]);
-			tempmat[8]=float(col[2][0]);
-			tempmat[9]=float(col[2][1]);
-			tempmat[10]=float(col[2][2]);
-			tempmat[11]=float(col[2][3]);
-			tempmat[12]=float(col[3][0]);
-			tempmat[13]=float(col[3][1]);
-			tempmat[14]=float(col[3][2]);
-			tempmat[15]=float(col[3][3]);
-			return tempmat;
-		}
-
-		void ImportOpenGLMatrix(float *oglmatrix){
-			col[0][0]=oglmatrix[0];
-			col[0][1]=oglmatrix[1];
-			col[0][2]=oglmatrix[2];
-			col[0][3]=oglmatrix[3];
-			col[1][0]=oglmatrix[4];
-			col[1][1]=oglmatrix[5];
-			col[1][2]=oglmatrix[6];
-			col[1][3]=oglmatrix[7];
-			col[2][0]=oglmatrix[8];
-			col[2][1]=oglmatrix[9];
-			col[2][2]=oglmatrix[10];
-			col[2][3]=oglmatrix[11];
-			col[3][0]=oglmatrix[12];
-			col[3][1]=oglmatrix[13];
-			col[3][2]=oglmatrix[14];
-			col[3][3]=oglmatrix[15];
-		}
-
-/*		// REVISAR ESTO
-		Vector GetAbsolutePos(void) const {
-			return (operator*(col[3]));
-		}
-*/
-		Vector GetTranslation(void) const {
-			return col[3];
-		}
-
-		// sets the matrix to a rotation matrix 
-		void LoadRotationXMatrix(float angle){
-			float cosa=cosf(GradToRad(angle));
-			float sina=sinf(GradToRad(angle));
-			col[0][0]=1.0f; col[1][0]=0.0f; col[2][0]=0.0f; col[3][0]=0.0f;
-			col[0][1]=0.0f; col[1][1]=cosa; col[2][1]=-sina;col[3][1]=0.0f;
-			col[0][2]=0.0f; col[1][2]=sina; col[2][2]=cosa; col[3][2]=0.0f;
-			col[0][3]=0.0f; col[1][3]=0.0f; col[2][3]=0.0f; col[3][3]=1.0f;
-		}
-
-		void LoadRotationYMatrix(float angle){
-			float cosa=cosf(GradToRad(angle));
-			float sina=sinf(GradToRad(angle));
-			col[0][0]=cosa; col[1][0]=0.0f; col[2][0]=sina; col[3][0]=0.0f;
-			col[0][1]=0.0f; col[1][1]=1.0f; col[2][1]=0.0f; col[3][1]=0.0f;
-			col[0][2]=-sina;col[1][2]=0.0f; col[2][2]=cosa; col[3][2]=0.0f;
-			col[0][3]=0.0f; col[1][3]=0.0f; col[2][3]=0.0f; col[3][3]=1.0f;
-		}
-
-		void LoadRotationZMatrix(float angle){
-			float cosa=cosf(GradToRad(angle));
-			float sina=sinf(GradToRad(angle));
-			col[0][0]=cosa; col[1][0]=-sina;col[2][0]=0.0f; col[3][0]=0.0f;
-			col[0][1]=sina; col[1][1]=cosa; col[2][1]=0.0f; col[3][1]=0.0f;
-			col[0][2]=0.0f; col[1][2]=0.0f; col[2][2]=1.0f; col[3][2]=0.0f;
-			col[0][3]=0.0f; col[1][3]=0.0f; col[2][3]=0.0f; col[3][3]=1.0f;
-		}
-
-		// Rotate the object around X axis
-		void RotateX(float angle, int mode=MATRIX_OBJECT_SPACE){
-			TMatrix tr;
-			tr.LoadRotationXMatrix(angle); // FIXME!!!!! -angle?!?!
-			if (mode==MATRIX_OBJECT_SPACE)
-				operator=( (*this)*tr );
-			else
-				operator=( tr*(*this) );
-		}
-
-		void RotateY(float angle, int mode=MATRIX_OBJECT_SPACE){
-			TMatrix tr;
-			tr.LoadRotationYMatrix(angle);
-			if (mode==MATRIX_OBJECT_SPACE)
-				operator=( (*this)*tr );
-			else
-				operator=( tr*(*this) );
-		}
-
-		void RotateZ(float angle, int mode=MATRIX_OBJECT_SPACE){
-			TMatrix tr;
-			tr.LoadRotationZMatrix(angle);
-			if (mode==MATRIX_OBJECT_SPACE)
-				operator=( (*this)*tr );
-			else
-				operator=( tr*(*this) );
-		}
-
-		void RotateAxis(float angle, Vector axis, int mode=MATRIX_OBJECT_SPACE){
-			TMatrix Rx,Ry,Rz,iRx,iRy;
-			float d = (float)sqrt(axis.y*axis.y + axis.z*axis.z);
-
-			Rx.SetBaseX(1.0f, 0.0f, 0.0f);
-			Rx.SetBaseY(0.0f, float(axis.z/d), float(axis.y/d));
-			Rx.SetBaseZ(0.0f, float(-axis.y/d), float(axis.z/d));			
-			
-			Ry.SetBaseX(d, 0.0f, float(axis.x));
-			Ry.SetBaseY(0.0f, 1.0f, 0.0f);
-			Ry.SetBaseZ(float(-axis.x), 0.0f, d);
-
-			Rz.LoadRotationZMatrix(angle);
-
-			iRx = Rx;	iRx.Traspose();
-			iRy = Ry;	iRy.Traspose();
-			
-			TMatrix accum;
-			accum.LoadIdentity();
-			if (d!=0)
-				accum = accum * iRx;
-			accum = accum * iRy;
-			accum = accum * Rz;
-			accum = accum * Ry;
-			if (d!=0)
-				accum = accum * Rx;
-
-			if (mode==MATRIX_OBJECT_SPACE)
-				operator=( (*this)*accum );
-			else
-				operator=( accum*(*this) );
-		}
-
-		void Translate(Vector tv, int mode=MATRIX_OBJECT_SPACE){
-			TMatrix tr;
-			tr.col[3]=tv;
-			if (mode==MATRIX_OBJECT_SPACE)
-				operator=( (*this)*tr );
-			else
-				operator=( tr*(*this) );
-		}
-
-		void Scale(Vector sv, int mode=MATRIX_OBJECT_SPACE){
-			if (mode==MATRIX_OBJECT_SPACE)
-				operator=( (*this)*ScaleMatrix(sv) );
-			else
-				operator=( ScaleMatrix(sv)*(*this) );			
-		}
-
-		static TMatrix ScaleMatrix(const Vector &v){
-			TMatrix mat;
-			mat[0].x = v.x;
-			mat[1].y = v.y;
-			mat[2].z = v.z;
-			return mat;
-		}
-
-		static TMatrix TranslationMatrix(const Vector &v){
-			TMatrix mat;
-			mat[3] = v;
-			mat[3].w = 1.0f;
-			return mat;
-		}
-		
-
-		void Traspose(void){
-			tempmat[0]=float(col[0][0]);
-			tempmat[1]=float(col[0][1]);
-			tempmat[2]=float(col[0][2]);
-			tempmat[3]=float(col[0][3]);
-
-			tempmat[4]=float(col[1][0]);
-			tempmat[5]=float(col[1][1]);
-			tempmat[6]=float(col[1][2]);
-			tempmat[7]=float(col[1][3]);
-
-			tempmat[8]=float(col[2][0]);
-			tempmat[9]=float(col[2][1]);
-			tempmat[10]=float(col[2][2]);
-			tempmat[11]=float(col[2][3]);
-
-			tempmat[12]=float(col[3][0]);
-			tempmat[13]=float(col[3][1]);
-			tempmat[14]=float(col[3][2]);
-			tempmat[15]=float(col[3][3]);
-
-			col[0].x=tempmat[0];  col[1].x=tempmat[1];  col[2].x=tempmat[2];  col[3].x=tempmat[3];
-			col[0].y=tempmat[4];  col[1].y=tempmat[5];  col[2].y=tempmat[6];  col[3].y=tempmat[7];
-			col[0].z=tempmat[8];  col[1].z=tempmat[9];  col[2].z=tempmat[10]; col[3].z=tempmat[11];
-			col[0].w=tempmat[12]; col[1].w=tempmat[13]; col[2].w=tempmat[14]; col[3].w=tempmat[15];
-		}
-
-		// This function inverts a (only) TRANSFORM Matrix. This should not work on arbitrary matrices
-		void Invert(void){
-			tempmat[0]=float(col[0][0]);
-			tempmat[1]=float(col[0][1]);
-			tempmat[2]=float(col[0][2]);
-			tempmat[3]=0.0f;
-
-			tempmat[4]=float(col[1][0]);
-			tempmat[5]=float(col[1][1]);
-			tempmat[6]=float(col[1][2]);
-			tempmat[7]=0.0f;
-
-			tempmat[8]=float(col[2][0]);
-			tempmat[9]=float(col[2][1]);
-			tempmat[10]=float(col[2][2]);
-			tempmat[11]=0.0f;
-
-			tempmat[12]=float(-(col[3][0]*col[0][0])-(col[3][1]*col[0][1])-(col[3][2]*col[0][2]));
-			tempmat[13]=float(-(col[3][0]*col[1][0])-(col[3][1]*col[1][1])-(col[3][2]*col[1][2]));
-			tempmat[14]=float(-(col[3][0]*col[2][0])-(col[3][1]*col[2][1])-(col[3][2]*col[2][2]));
-			tempmat[15]=1.0f;
-
-			col[0].x=tempmat[0];  col[1].x=tempmat[1];  col[2].x=tempmat[2];	col[3].x=tempmat[12];
-			col[0].y=tempmat[4];  col[1].y=tempmat[5];  col[2].y=tempmat[6];	col[3].y=tempmat[13];
-			col[0].z=tempmat[8];  col[1].z=tempmat[9];  col[2].z=tempmat[10];	col[3].z=tempmat[14];
-			col[0].w=0.0f;		  col[1].w=0.0f;		col[2].w=0.0f;			col[3].w=tempmat[15];
-		}
-
-	};
-
-
-
-
-
-
-#endif
-
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp	(revision 1057)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp	(revision 1058)
@@ -1,3 +1,2 @@
-//#include "defs.h"
 #include <assert.h>
 #include "GeoLodTreeLibrary.h"
@@ -10,8 +9,4 @@
 										 Geometry::Mesh *treeGeoMesh,
 										 uint32 leafSubMeshID/*
-								std::string foliage_verts, 
-								std::string foliage_leafs, 
-								std::string foliage_simpl,
-							   uint32 leafSubMeshID,
 							   CREATEVERTEXDATAFUNC vdfun,
 							   CREATEINDEXDATAFUNC idfun,
@@ -22,7 +17,7 @@
 
 	// Cargar la copa del árbol
-//	arbol = new Arbol(foliage_verts.c_str(),foliage_leafs.c_str(),foliage_simpl.c_str(),NULL/*vdfun*/,NULL/*idfun*/);
 	Geometry::SubMesh * leafsSubMesh = &(treeGeoMesh->mSubMesh[leafSubMeshID]);
 	foliage = new Foliage(leafsSubMesh,leafSimpSeqFile.c_str());
+	GoToFoliageLod(1.0f);
 }
 /*
@@ -77,45 +72,38 @@
 */
 
-uint32 LodTreeLibrary::GoToTrunkLod(uint32 newlod)
-{
-	return trunk->GoToLod(newlod);
-/*	uint32 previouslod = trunk->LodActual;
-	trunk->VerModeloVBO(newlod);
-	return previouslod;*/
-}
-
+void LodTreeLibrary::GoToTrunkLod(float newlod)
+{
+	trunk->GoToLod(newlod);
+}
+/*
 uint32 LodTreeLibrary::MinTrunkLod(void) const
 {
-//	return 3; // un polígono: preguntar a francisco
-//	return (trunk->TOTALCAMBIOS*0.95f);
 	return trunk->MinLod();
 }
 uint32 LodTreeLibrary::MaxTrunkLod(void) const
 {
-//	return (trunk->cVerts.size()*0.99);
-//	return (trunk->TOTALCAMBIOS*0.95f);
-//	return 0;
 	return trunk->MaxLod();
 }
-
-
-uint32 LodTreeLibrary::GoToFoliageLod(uint32 newlod)
-{
-	foliage->AjusteHojas(newlod);
+*/
+
+void LodTreeLibrary::GoToFoliageLod(float newlod)
+{
+	uint32 targetLeaves = (1.0f-newlod)*foliage->minLeaves + newlod*foliage->leafCount;
+	foliage->CalculateLOD(targetLeaves);
 
 	foliage->indexdata->Begin();
 	foliage->vertexdata->Begin();
-	int i = foliage->ppio;
-	int auxnumhojas = 0;
+	int i = foliage->begin;
+	int auxnumleaves = 0;
 	while(i!=-1)
 	{
-		auxnumhojas++;
+		auxnumleaves++;
 		i=foliage->Acth[i].next;
 	}
 
-	assert(auxnumhojas*6<=int(foliage->indexdata->GetNumMaxIndices()));
-	foliage->indexdata->SetNumValidIndices(auxnumhojas*6);
-	i = foliage->ppio;
-	int kkkk=0;
+	assert(auxnumleaves*6<=int(foliage->indexdata->GetNumMaxIndices()));
+	foliage->indexdata->SetNumValidIndices(auxnumleaves*6);
+	i = foliage->begin;
+	int index=0;
 	while(i!=-1)
 	{
@@ -126,10 +114,10 @@
 		v3 = foliage->Leaves[i].vertsLeaf[3];
 
-		foliage->indexdata->SetIndex(kkkk+0,v0);
-		foliage->indexdata->SetIndex(kkkk+1,v1);
-		foliage->indexdata->SetIndex(kkkk+2,v2);
-		foliage->indexdata->SetIndex(kkkk+3,v2);
-		foliage->indexdata->SetIndex(kkkk+4,v1);
-		foliage->indexdata->SetIndex(kkkk+5,v3);
+		foliage->indexdata->SetIndex(index+0,v0);
+		foliage->indexdata->SetIndex(index+1,v1);
+		foliage->indexdata->SetIndex(index+2,v2);
+		foliage->indexdata->SetIndex(index+3,v2);
+		foliage->indexdata->SetIndex(index+4,v1);
+		foliage->indexdata->SetIndex(index+5,v3);
 
 		foliage->vertexdata->SetVertexTexCoord(v0,0,0);
@@ -138,24 +126,19 @@
 		foliage->vertexdata->SetVertexTexCoord(v3,1,1); 
 
-		kkkk+=6;
+		index+=6;
 		i=foliage->Acth[i].next;
 	}
 	foliage->indexdata->End();
 	foliage->vertexdata->End();
-
-	return 0;
-}
-
+}
+/*
 uint32 LodTreeLibrary::MinFoliageLod(void) const
 {
-//	return arbol->minHojas;
 	return foliage->nHojas;
 }
 uint32 LodTreeLibrary::MaxFoliageLod(void) const
 {
-	//	return arbol->TotHojas;
-	//return arbol->nHojas;
 	return foliage->minHojas;
-}
+}*/
 
 /*const VertexData* LodTreeLibrary::Get_Trunk_VertexData(void) const 
@@ -165,6 +148,4 @@
 const MultiIndexData* LodTreeLibrary::CurrentLOD_Trunk_Indices(void) const 
 { 
-//	return (uint32*)trunk->vStrips[istrip]; 
-//	return trunk->indices_x_tira[istrip];
 	return trunk->dataRetrievalInterface;
 }
@@ -178,5 +159,4 @@
 const IndexData* LodTreeLibrary::CurrentLOD_Foliage_Indices(void) const
 {
-//	return current_foliage_indices;
 	return foliage->indexdata;
 }
@@ -216,6 +196,8 @@
 
 // changes the lod of the entire object (trunk and leaves)
-uint32 LodTreeLibrary::GoToLod(uint32 lod)
-{
-	return 0;
-}
+void LodTreeLibrary::GoToLod(Real lod)
+{
+	assert(lod<=1.0f && lod>=0.0f);
+	GoToTrunkLod(lod);
+	GoToFoliageLod(lod);
+}
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/GTGeometry.vcproj
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/GTGeometry.vcproj	(revision 1057)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/GTGeometry.vcproj	(revision 1058)
@@ -263,7 +263,4 @@
 				</File>
 				<File
-					RelativePath=".\src\libs\leaves\Point3D.cpp">
-				</File>
-				<File
 					RelativePath=".\src\libs\leaves\VertexData.cpp">
 				</File>
@@ -405,13 +402,7 @@
 			</File>
 			<File
-				RelativePath=".\include\hoja.h">
-			</File>
-			<File
 				RelativePath=".\src\libs\NPrim.h">
 			</File>
 			<File
-				RelativePath=".\src\libs\leaves\Point3D.h">
-			</File>
-			<File
 				RelativePath=".\src\libs\detail\policy.h">
 			</File>
@@ -436,7 +427,4 @@
 			<File
 				RelativePath=".\src\libs\tri_stripper.h">
-			</File>
-			<File
-				RelativePath=".\src\libs\leaves\Vector.h">
 			</File>
 			<File
Index: GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshView.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshView.h	(revision 998)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshView.h	(revision 1058)
@@ -190,6 +190,6 @@
 
 	//	Change de Level of detail of the object.
-	void	GoToLod_LodStrip(unsigned int lod);
-	void	GoToLod_LodTree(unsigned int lod);
+	void	GoToLod_LodStrip(float lod);
+	void	GoToLod_LodTree(float lod);
 	
 	// load a image file as a texture
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp	(revision 1050)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp	(revision 1058)
@@ -1373,5 +1373,5 @@
 {
 	//	Change the lod.
-	geoMeshView->GoToLod_LodStrip((unsigned int)o->value());
+	geoMeshView->GoToLod_LodStrip((float)o->value());
 
 	//	Refresh data aplication.
@@ -1394,5 +1394,5 @@
 {
 	//	Change the lod.
-	geoMeshView->GoToLod_LodTree((unsigned int)o->value());
+	geoMeshView->GoToLod_LodTree((float)o->value());
 
 	//	Refresh data aplication.
@@ -2401,5 +2401,6 @@
 
 	//	Sets the slider range.
-	mLodStripSlider->range(lodStripsLib->MinLod(),lodStripsLib->MaxLod());
+//	mLodStripSlider->range(lodStripsLib->MinLod(),lodStripsLib->MaxLod());
+	mLodStripSlider->range(0.0f,1.0f);
 
 	//	Pass to geomeshview the lod strips object.
@@ -2431,6 +2432,8 @@
 
 	//	Sets the slider range.
-	mLodStripSlider->range(lodTreeLib->MaxTrunkLod(), lodTreeLib->MinTrunkLod());
-	mLodTreeSlider->range(lodTreeLib->MaxFoliageLod(), lodTreeLib->MinFoliageLod());
+//	mLodStripSlider->range(lodTreeLib->MaxTrunkLod(), lodTreeLib->MinTrunkLod());
+//	mLodTreeSlider->range(lodTreeLib->MaxFoliageLod(), lodTreeLib->MinFoliageLod());
+	mLodStripSlider->range(0.0f,1.0f);
+	mLodTreeSlider->range(0.0f,1.0f);
 
 	//	Pass to geomeshview the lod strips object.
@@ -2438,6 +2441,6 @@
 	
 	//	Puts the slider in the max position.
-	mLodStripSlider->value(lodTreeLib->MinTrunkLod());
-	mLodTreeSlider->value(lodTreeLib->MinFoliageLod());
+	mLodStripSlider->value(1.0f);
+	mLodTreeSlider->value(1.0f);
 }
 
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp	(revision 1051)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp	(revision 1058)
@@ -1129,5 +1129,5 @@
 //	Change de Level of detail of the object.
 //---------------------------------------------------------------------------
-void	GeoMeshView::GoToLod_LodStrip(unsigned int	lod)
+void	GeoMeshView::GoToLod_LodStrip(float	lod)
 {
 	if (mLodStrip)
@@ -1141,5 +1141,5 @@
 //	Change de Level of detail of the object.
 //---------------------------------------------------------------------------
-void	GeoMeshView::GoToLod_LodTree(unsigned int	lod)
+void	GeoMeshView::GoToLod_LodTree(float	lod)
 {
 	if (mLodTree)
