Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/VertexData.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/VertexData.h	(revision 831)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/VertexData.h	(revision 831)
@@ -0,0 +1,161 @@
+#ifndef __VERTEXDATA_H__
+#define __VERTEXDATA_H__
+
+namespace Geometry
+{
+	class VertexData
+	{
+	private:
+		unsigned int numverts;
+	public:
+		VertexData(unsigned int numv):numverts(numv){}
+		virtual ~VertexData(void){}
+
+		virtual void Begin(void)=0;
+		virtual void SetVertexCoord(unsigned int i, float x, float y, float z)=0;
+		virtual void SetVertexNormal(unsigned int i, float x, float y, float z)=0;
+		virtual void SetVertexTexCoord(unsigned int i, float x, float y)=0;
+		virtual void End(void)=0;	
+
+		virtual void GetVertexCoord(unsigned int i, float &x, float &y, float &z) const = 0;
+		virtual void GetVertexNormal(unsigned int i, float &x, float &y, float &z) const = 0;
+		virtual void GetVertexTexCoord(unsigned int i, float &x, float &y) const =0;
+
+		unsigned int GetNumVertices(void) const { return numverts; }
+	};
+
+	class IndexData
+	{
+	private:
+		unsigned int numinds, numvalidinds;
+	public:
+		IndexData(unsigned int numi):numinds(numi),numvalidinds(numi){}
+		virtual ~IndexData(void){}
+
+		virtual void Begin(void)=0;
+		virtual void SetIndex(unsigned int i, unsigned int index)=0;
+		virtual void End(void)=0;
+
+		virtual unsigned int GetIndex(unsigned int) const =0;
+		unsigned int GetNumMaxIndices(void) const { return numinds; }
+		unsigned int GetNumValidIndices(void) const { return numvalidinds; }
+		void SetNumValidIndices(unsigned int valid){ numvalidinds=valid; }
+	};
+
+	class MultiIndexData
+	{
+	private:
+		unsigned int num_prims, num_total_inds, *num_max_inds, *num_valid_inds;
+	public:
+		MultiIndexData(unsigned int numprims, unsigned int *maxinds){
+			num_prims=numprims;
+			num_total_inds=0;
+			num_max_inds=new unsigned int[numprims];
+			num_valid_inds=new unsigned int[numprims];
+			for (unsigned int i=0; i<numprims; i++)
+			{
+				num_max_inds[i]=num_valid_inds[i]=maxinds[i];
+				num_total_inds += maxinds[i];
+			}
+		}
+
+		~MultiIndexData(void){
+			delete[] num_max_inds;
+			delete[] num_valid_inds;
+		}
+
+		virtual void Begin(void)=0;
+		virtual void SetIndex(unsigned int iprim, unsigned int i, unsigned int index)=0;
+		virtual void End(void)=0;
+
+		virtual unsigned int GetIndex(unsigned int iprim, unsigned int index) const =0;
+		unsigned int GetNumMaxIndices(unsigned int iprim) const { return num_max_inds[iprim]; }
+		unsigned int GetNumValidIndices(unsigned int iprim) const { return num_valid_inds[iprim]; }
+		void SetNumValidIndices(unsigned int iprim, unsigned int valid){ num_valid_inds[iprim]=valid; }
+		unsigned int GetNumPrims(void) const { return num_prims; }
+	};
+
+	typedef VertexData* CreateVertexDataFunc(unsigned int numv);
+	typedef CreateVertexDataFunc* CREATEVERTEXDATAFUNC;
+	typedef IndexData* CreateIndexDataFunc(unsigned int numi);
+	typedef CreateIndexDataFunc* CREATEINDEXDATAFUNC;
+	typedef MultiIndexData* CreateMultiIndexDataFunc(unsigned int numprims, unsigned int *numi);
+	typedef CreateMultiIndexDataFunc* CREATEMULTIINDEXDATAFUNC;
+
+	class DefaultVertexData : public VertexData
+	{
+	private:
+		float *v, *n, *t;
+	public:
+		DefaultVertexData(unsigned int numv);
+		~DefaultVertexData(void);
+
+		virtual void Begin(void){}
+		virtual void SetVertexCoord(unsigned int i, float x, float y, float z){ 
+			v[i*3+0]=x; v[i*3+1]=y; v[i*3+2]=z; }
+		virtual void SetVertexNormal(unsigned int i, float x, float y, float z){
+			n[i*3+0]=x; n[i*3+1]=y; n[i*3+2]=z; }
+		virtual void SetVertexTexCoord(unsigned int i, float x, float y){ 
+			t[i*2+0]=x; t[i*2+1]=y; }
+
+		virtual void End(void){}
+
+		virtual void GetVertexCoord(unsigned int i, float &x, float &y, float &z) const { 
+			x=v[i*3+0]; 
+			y=v[i*3+1]; 
+			z=v[i*3+2];
+		}
+		virtual void GetVertexNormal(unsigned int i, float &x, float &y, float &z) const {x=n[i*3+0]; y=n[i*3+1]; z=n[i*3+2]; }
+		virtual void GetVertexTexCoord(unsigned int i, float &x, float &y) const {x=t[i*2+0]; y=t[i*2+1]; }
+
+		const float * GetVertexFloatBuffer(void) const { return v; }
+
+	};
+	VertexData *DefaultVertexDataCreator(unsigned int numv);
+
+
+	class DefaultIndexData : public IndexData
+	{
+	private:
+		unsigned int *indices;
+	public:
+		DefaultIndexData(unsigned int numi);
+		~DefaultIndexData(void);
+
+		virtual void Begin(void){}
+		virtual void SetIndex(unsigned int i, unsigned int index){ 
+			indices[i] = index; 
+		}
+		virtual void End(void){}
+
+		virtual unsigned int GetIndex(unsigned int i) const {
+			return indices[i];
+		}
+
+	};
+	IndexData *DefaultIndexDataCreator(unsigned int numi);
+
+	class DefaultMultiIndexData : public MultiIndexData
+	{
+	private:
+		unsigned int **indices;
+	public:
+		DefaultMultiIndexData(unsigned int numprims, unsigned int *numi);
+		~DefaultMultiIndexData(void);
+
+		virtual void Begin(void){}
+		virtual void SetIndex(unsigned int iprim, unsigned int i, unsigned int index){ 
+			indices[iprim][i] = index; 
+		}
+		virtual void End(void){}
+
+		virtual unsigned int GetIndex(unsigned int iprim, unsigned int i) const {
+			return indices[iprim][i];
+		}
+
+	};
+	MultiIndexData *DefaultMultiIndexDataCreator(unsigned int numprims, unsigned int *numi);
+
+}
+
+#endif
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodTreeLibrary.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodTreeLibrary.h	(revision 829)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodTreeLibrary.h	(revision 831)
@@ -9,11 +9,11 @@
 #include "GeoLodStripsLibrary.h"
 
-/*class LodStrip;
 class Arbol;
 class Foliage;
 class Point3D;
-*/
+
 namespace Geometry
 {	
+	class IndexData;
 	class LodTreeLibrary
 	{
@@ -22,9 +22,8 @@
 		LodTreeLibrary(LodTreeLibrary*);*/
 		LodTreeLibrary(	std::string trunkSimpSeqFile,
-						Geometry::Mesh *treeGeoMesh
-						/*,
+						Geometry::Mesh *treeGeoMesh,
 						std::string foliage_verts,
 						std::string foliage_leafs,
-						std::string foliage_simpl,
+						std::string foliage_simpl/*,
 						uint32 leafSubMeshID,
 						CREATEVERTEXDATAFUNC vdfun=NULL, 
@@ -38,7 +37,7 @@
 		uint32 MinTrunkLod(void) const;
 		uint32 MaxTrunkLod(void) const;
-/*		uint32 GoToFoliageLod(uint32 newlod);
+		uint32 GoToFoliageLod(uint32 newlod);
 		uint32 MinFoliageLod(void) const;
-		uint32 MaxFoliageLod(void) const;*/
+		uint32 MaxFoliageLod(void) const;
 
 		// funciones nuevas propuestas
@@ -52,8 +51,8 @@
 
 //		uint32 Get_Foliage_VertexCount(void) const;
-//		uint32 Get_Foliage_MaxIndexCount(void) const;
-//		uint32 CurrentLOD_Foliage_IndexCount(void) const;
-/*		const IndexData* CurrentLOD_Foliage_Indices(void) const;
-		const VertexData* Get_Foliage_VertexData(void) const;
+		uint32 Get_Foliage_MaxIndexCount(void) const;
+		uint32 CurrentLOD_Foliage_IndexCount(void) const;
+		const IndexData* CurrentLOD_Foliage_Indices(void) const;
+/*		const VertexData* Get_Foliage_VertexData(void) const;
 */
 //		Geometry::IndexData *trunk_all_indices;
@@ -65,6 +64,6 @@
 		uint32 uniqueID;
 		Geometry::LodStripsLibrary *trunk;
-//		Arbol *arbol;
-//		Foliage *foliage;
+		Arbol *arbol;
+		Foliage *foliage;
 
 	};
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/Arbol.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/Arbol.cpp	(revision 830)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/Arbol.cpp	(revision 831)
@@ -1,17 +1,7 @@
-#include <GL\glut.h>
 #include <stdio.h>
 #include <string.h>
 #include <math.h>
 #include "Arbol.h"
-#include "../defs.h"
-
-//--------------------------------------------------------------------------------------------------------------------------------
-// Void constructor
-// Parameters --> None
-//--------------------------------------------------------------------------------------------------------------------------------
-/*Arbol::Arbol(void):  Vertices(NULL), Hojas(NULL)
-{
-	cx = cy= cz=0;
-}*/
+
 //--------------------------------------------------------------------------------------------------------------------------------
 // Constructor with the name of a file cotaining the data
@@ -51,9 +41,9 @@
 	    
 	//VERTICES
-	if ((TotVerts=LeeVertices(arbol))==0) ThrowFileNotFoundError((const char*)arbol);
-	if ((nHojas = LeoHojas (hojas))==0) ThrowFileNotFoundError((const char*)hojas);
+	if ((TotVerts=LeeVertices(arbol))==0){ printf("File not found '%s'\n",arbol); exit(1); }//ThrowFileNotFoundError((const char*)arbol);
+	if ((nHojas = LeoHojas (hojas))==0) { printf("File not found '%s'\n",hojas); exit(1); }//ThrowFileNotFoundError((const char*)hojas);
 //	TotTronco = LeoTronco (tronco);
 //	CalculaNormalesVertice();	
-	if ((TotHojas = LeoHojasSimpl(simpli))==0) ThrowFileNotFoundError((const char*)simpli);	
+	if ((TotHojas = LeoHojasSimpl(simpli))==0){ printf("File not found '%s'\n",simpli); exit(1); }// ThrowFileNotFoundError((const char*)simpli);	
 	RellenoRaiz();
 
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/VertexData.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/VertexData.cpp	(revision 831)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/VertexData.cpp	(revision 831)
@@ -0,0 +1,53 @@
+#include "VertexData.h"
+
+Geometry::DefaultVertexData::DefaultVertexData(unsigned int numv):Geometry::VertexData(numv)
+{
+	v = new float[numv*3];
+	n = new float[numv*3];
+	t = new float[numv*2];
+}
+Geometry::DefaultVertexData::~DefaultVertexData(void)
+{
+	delete[] v;
+	delete[] n;
+	delete[] t;
+}
+
+Geometry::VertexData *Geometry::DefaultVertexDataCreator(unsigned int numv)
+{ 
+	return new DefaultVertexData(numv); 
+}
+
+
+Geometry::DefaultIndexData::DefaultIndexData(unsigned int numi):Geometry::IndexData(numi)
+{
+	indices = new unsigned int[numi];	
+}
+Geometry::DefaultIndexData::~DefaultIndexData(void)
+{
+	delete[] indices;
+}
+
+Geometry::IndexData *Geometry::DefaultIndexDataCreator(unsigned int numi)
+{ 
+	return new DefaultIndexData(numi); 
+}
+
+
+Geometry::DefaultMultiIndexData::DefaultMultiIndexData(unsigned int numprims, unsigned int *numi):Geometry::MultiIndexData(numprims,numi)
+{
+	indices = new unsigned int*[numprims];	
+	for (unsigned int i=0; i<numprims; i++)
+		indices[i]=new unsigned int[numi[i]];
+}
+Geometry::DefaultMultiIndexData::~DefaultMultiIndexData(void)
+{
+	for (unsigned int i=0; i<GetNumPrims(); i++)
+		delete[] indices[i];
+	delete[] indices;
+}
+
+Geometry::MultiIndexData *Geometry::DefaultMultiIndexDataCreator(unsigned int numprims, unsigned int *numi)
+{ 
+	return new DefaultMultiIndexData(numprims,numi); 
+}
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp	(revision 829)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp	(revision 831)
@@ -2,6 +2,6 @@
 #include <assert.h>
 #include "GeoLodTreeLibrary.h"
-//#include "ArbolesInma/Arbol.h"
-//#include "ArbolesInma/Foliage.h"
+#include "libs/leaves/arbol.h"
+#include "libs/leaves/Foliage.h"
 
 using namespace Geometry;
@@ -10,9 +10,8 @@
 
 Geometry::LodTreeLibrary::LodTreeLibrary(std::string trunkSimpSeqFile,
-							   Geometry::Mesh *treeGeoMesh 
-							   /*,
+							   Geometry::Mesh *treeGeoMesh,
 							   std::string foliage_verts, 
 							   std::string foliage_leafs, 
-							   std::string foliage_simpl,
+							   std::string foliage_simpl/*,
 							   uint32 leafSubMeshID,
 							   CREATEVERTEXDATAFUNC vdfun,
@@ -23,24 +22,9 @@
 
 	// Cargar el tronco
-/*	trunk=new LodStrip(vdfun,midfun);
-	trunk->ED_NUEVA=1;
-	trunk->RESVARIABLE=0;
-	trunk->MODOTEST=0; //0: No test 1: plano  2: esfera
-	trunk->bTextures=0;
-	if (trunk->RecuperarModeloEFFICIENT((char*)trunkfile.c_str())==0)
-		throw FileNotFound(trunkfile);
-
-//	trunk->LodsDisp=(int) (trunk->cVerts.size()*0.99);
-	trunk->LodsDisp=(int) (trunk->TOTALCAMBIOS*0.95);
-	trunk->CopiarVectors2ArraysNUEVAED();
-	trunk->LodActual=0;
-	trunk->CalculaNormalesVertice();*/
-
 	trunk = new LodStripsLibrary(trunkSimpSeqFile,treeGeoMesh);
 
 	// Cargar la copa del árbol
-/*	arbol = new Arbol(foliage_verts.c_str(),foliage_leafs.c_str(),foliage_simpl.c_str(),vdfun,idfun);
-	foliage = new Foliage(arbol);*/
-
+	arbol = new Arbol(foliage_verts.c_str(),foliage_leafs.c_str(),foliage_simpl.c_str(),NULL/*vdfun*/,NULL/*idfun*/);
+	foliage = new Foliage(arbol);
 }
 /*
@@ -66,6 +50,6 @@
 {
 	if (trunk) delete trunk;
-//	if (arbol) delete arbol;
-//	if (foliage) delete foliage;
+	if (arbol) delete arbol;
+	if (foliage) delete foliage;
 /*	if (trunk_all_indices) delete trunk_all_indices;
 	if (indices_offsets) delete[] indices_offsets;
@@ -117,5 +101,5 @@
 }
 
-/*
+
 uint32 LodTreeLibrary::GoToFoliageLod(uint32 newlod)
 {
@@ -174,5 +158,5 @@
 	return arbol->nHojas;
 }
-*/
+
 /*const VertexData* LodTreeLibrary::Get_Trunk_VertexData(void) const 
 { 
@@ -191,10 +175,10 @@
 	return arbol->vertexdata;
 }
-
+*/
 const IndexData* LodTreeLibrary::CurrentLOD_Foliage_Indices(void) const
 {
 //	return current_foliage_indices;
 	return arbol->indexdata;
-}*/
+}
 
 
@@ -203,5 +187,5 @@
 	throw Geometry::FileNotFound(text);
 }*/
-/*
+
 uint32 LodTreeLibrary::CurrentLOD_Foliage_IndexCount(void) const
 {
@@ -209,5 +193,5 @@
 	return arbol->indexdata->GetNumValidIndices();
 }
-
+/*
 uint32 LodTreeLibrary::Get_Trunk_VertexCount(void) const
 {
@@ -224,8 +208,7 @@
 {
 	return arbol->vertexdata->GetNumVertices();
-}
+}*/
 uint32 LodTreeLibrary::Get_Foliage_MaxIndexCount(void) const
 {
 	return arbol->indexdata->GetNumMaxIndices();
 }
-*/
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/GTGeometry.vcproj
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/GTGeometry.vcproj	(revision 829)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/GTGeometry.vcproj	(revision 831)
@@ -256,4 +256,38 @@
 				</File>
 			</Filter>
+			<Filter
+				Name="leaves"
+				Filter="">
+				<File
+					RelativePath=".\src\libs\leaves\activas.cpp">
+				</File>
+				<File
+					RelativePath=".\src\libs\leaves\Arbol.cpp">
+				</File>
+				<File
+					RelativePath=".\src\libs\leaves\foliage.cpp">
+				</File>
+				<File
+					RelativePath=".\src\libs\leaves\Hoja.cpp">
+					<FileConfiguration
+						Name="Debug|Win32">
+						<Tool
+							Name="VCCLCompilerTool"
+							ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32">
+						<Tool
+							Name="VCCLCompilerTool"
+							ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath=".\src\libs\leaves\Point3D.cpp">
+				</File>
+				<File
+					RelativePath=".\src\libs\leaves\VertexData.cpp">
+				</File>
+			</Filter>
 		</Filter>
 		<Filter
@@ -262,4 +296,7 @@
 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
 			<File
+				RelativePath=".\src\libs\leaves\activas.h">
+			</File>
+			<File
 				RelativePath=".\src\libs\AdjModel.cxx">
 			</File>
@@ -274,4 +311,7 @@
 			</File>
 			<File
+				RelativePath=".\src\libs\leaves\arbol.h">
+			</File>
+			<File
 				RelativePath=".\src\libs\auxiliar.h">
 			</File>
@@ -283,4 +323,7 @@
 			</File>
 			<File
+				RelativePath=".\src\libs\leaves\foliage.h">
+			</File>
+			<File
 				RelativePath=".\src\libs\GeoBase.h">
 			</File>
@@ -334,4 +377,7 @@
 			</File>
 			<File
+				RelativePath=".\src\libs\leaves\hoja.h">
+			</File>
+			<File
 				RelativePath=".\include\hoja.h">
 			</File>
@@ -340,4 +386,7 @@
 			</File>
 			<File
+				RelativePath=".\src\libs\leaves\Point3D.h">
+			</File>
+			<File
 				RelativePath=".\src\libs\detail\policy.h">
 			</File>
@@ -355,5 +404,17 @@
 			</File>
 			<File
+				RelativePath=".\src\libs\leaves\tlista.h">
+			</File>
+			<File
+				RelativePath=".\src\libs\leaves\TMatrix.h">
+			</File>
+			<File
 				RelativePath=".\src\libs\tri_stripper.h">
+			</File>
+			<File
+				RelativePath=".\src\libs\leaves\Vector.h">
+			</File>
+			<File
+				RelativePath=".\include\VertexData.h">
 			</File>
 			<Filter
