Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h	(revision 774)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h	(revision 829)
@@ -9,4 +9,7 @@
 	*	@file	GeoLodStripsLibrary.h
 /*===========================================================================*/
+
+#ifndef _GEOLODSTRIPSLIBRARY
+#define _GEOLODSTRIPSLIBRARY
 
 #include	"GeoMesh.h"
@@ -150,6 +153,9 @@
 
 			//	(New)	Get the number of strips.
-			uint32	GetStripCount();
+			uint32	GetStripCount() const;
+			uint32  GetIndexCountByStrip(uint32) const;
 	};
 }
 
+
+#endif
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodTreeLibrary.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodTreeLibrary.h	(revision 774)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodTreeLibrary.h	(revision 829)
@@ -1,87 +1,73 @@
-#include "GeoBase.h"
+//#include <string>
+//#include <exception>
+//#include "vertexdata.h"
 
+#ifndef _GEOLODSTREELIBRARY
+#define _GEOLODSTREELIBRARY
+
+#include "GeoMesh.h"
+#include "GeoLodStripsLibrary.h"
+
+/*class LodStrip;
+class Arbol;
+class Foliage;
+class Point3D;
+*/
 namespace Geometry
-{
-	/// LodTreeLibrary interface class.
-	/** This module contains functions that handle the levels of detail of the input multiresolution trees.
-	For Any given resolution and object this module returns two thins: a set of triangle strips representing the trunk 
-	and the branches at that resolution, and a triangle list representing the leaves at the same resolution. 
-	\n\n
-
-Inputs:\n
-	- The module receives a file describing a multiresolution tree object.
-	.
-
-Outputs:\n
-	- The module returns a strip set that represents the level of deatil demanded for the trunk and a triangle list 
-	that representes the level of detail for leaves.
-	.
-
-	*/
+{	
 	class LodTreeLibrary
 	{
 	public:
-		/// Constructor, receives as a parameter the name of the file including the multiresolution object.
-		LodTreeLibrary (std::string);
+/*		LodTreeLibrary( const LodTreeLibrary &);
+		LodTreeLibrary(LodTreeLibrary*);*/
+		LodTreeLibrary(	std::string trunkSimpSeqFile,
+						Geometry::Mesh *treeGeoMesh
+						/*,
+						std::string foliage_verts,
+						std::string foliage_leafs,
+						std::string foliage_simpl,
+						uint32 leafSubMeshID,
+						CREATEVERTEXDATAFUNC vdfun=NULL, 
+						CREATEINDEXDATAFUNC idfun=NULL,
+						CREATEMULTIINDEXDATAFUNC midfun=NULL*/); // throws a FileNotFound exception
+		~LodTreeLibrary(void);
+		uint32 GetUniqueID(void) const { return  uniqueID; }
 
-		/// Destructor.
-		~LodTreeLibrary (void);
+		// funciones ya descritas en la API
+		uint32 GoToTrunkLod(uint32 newlod);
+		uint32 MinTrunkLod(void) const;
+		uint32 MaxTrunkLod(void) const;
+/*		uint32 GoToFoliageLod(uint32 newlod);
+		uint32 MinFoliageLod(void) const;
+		uint32 MaxFoliageLod(void) const;*/
 
-		/// Copy constructor
-		//LodTreeLibrary(const LodTreeLibrary&);
+		// funciones nuevas propuestas
+//		uint32 Get_Trunk_VertexCount(void) const;
+//		uint32 Get_Trunk_MaxIndexCount(uint32 istrip) const;
+		uint32 CurrentLOD_Trunk_StripCount(void) const;
+//		uint32 CurrentLOD_Trunk_IndexCount(void) const;
+		uint32 CurrentLOD_Trunk_IndexCountByStrip(uint32 istrip) const;
+/*		const VertexData* Get_Trunk_VertexData(void) const;
+//		const MultiIndexData* CurrentLOD_Trunk_Indices(void) const;*/
 
-		/// Assignment operator
-		//LodTreeLibrary& operator =(const LodTreeLibrary&);
+//		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;
+*/
+//		Geometry::IndexData *trunk_all_indices;
+//		unsigned int *indices_offsets;
 
-		/// Returns the highest LOD of the foliage.
-		uint32 MaxFoliageLod();
+		const Geometry::SmallIntVector & GetStrip(uint32 istrip) const { return trunk->mStrips[istrip]; }
 
-		/// Returns the highest LOD of the trunk.
-		uint32 MaxTrunkLod();
-
-		/// Returns the lowest LOD of the foliage.
-		uint32 MinFoliageLod();
-
-		/// Returns the lowest LOD of the trunk.
-		uint32 MinTrunkLod();
-
-		/// Returns de current foliage LOD and changes to the specified LOD.
-		uint32 GoToFoliageLod(uint32);
-
-		/// Returns de current trunk LOD and changes to the specified LOD.
-		uint32 GoToTrunkLod(uint32);
-
-		/// Establishes the new LOD range.
-		/// Only the LODs in that range are stored and used.
-		void TrimFoliageByLod(uint32, uint32);
-
-		/// Establishes the new LOD range.
-		/// Only the LODs in that range are stored and used.
-		void TrimTrunkByLod(uint32, uint32);
-
-		/// Returns the number of triangles of the foliage at the highest LOD.
-		uint32 MaxFoliageFaces();
-
-		/// Returns the number of triangles of the trunk at the highest LOD.
-		uint32 MaxTrunkFaces();
-
-		/// Returns the number of triangles of the foliage at the lowest LOD.
-		uint32 MinFoliageFaces();
-
-		/// Returns the number of triangles of the trunk at the lowest LOD.
-		uint32 MinTrunkFaces();
-
-		/// Returns the number of vertices of the foliage at the highest LOD.
-		uint32 MaxFoliageVertices();
-
-		/// Returns the number of vertices of the trunk at the highest LOD.
-		uint32 MaxTrunkVertices();
-
-		/// Returns the number of vertices of the foliage at the lowest LOD.
-		uint32 MinFoliageVertices();
-
-		/// Returns the number of vertices of the trunk at the lowest LOD.
-		uint32 MinTrunkVertices();
+	private:
+		uint32 uniqueID;
+		Geometry::LodStripsLibrary *trunk;
+//		Arbol *arbol;
+//		Foliage *foliage;
 
 	};
 }
+
+#endif
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp	(revision 774)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp	(revision 829)
@@ -406,7 +406,12 @@
 }
 
-uint32	LodStripsLibrary::GetStripCount()
+uint32	LodStripsLibrary::GetStripCount() const
 {
 	return	(uint32)	mTotalStrips;
+}
+
+uint32	LodStripsLibrary::GetIndexCountByStrip(uint32 istrip) const
+{
+	return (uint32)	mStrips[istrip].size();
 }
 
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp	(revision 774)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp	(revision 829)
@@ -1,1 +1,231 @@
+//#include "defs.h"
+#include <assert.h>
 #include "GeoLodTreeLibrary.h"
+//#include "ArbolesInma/Arbol.h"
+//#include "ArbolesInma/Foliage.h"
+
+using namespace Geometry;
+
+uint32 uniqueIDgen = 0;
+
+Geometry::LodTreeLibrary::LodTreeLibrary(std::string trunkSimpSeqFile,
+							   Geometry::Mesh *treeGeoMesh 
+							   /*,
+							   std::string foliage_verts, 
+							   std::string foliage_leafs, 
+							   std::string foliage_simpl,
+							   uint32 leafSubMeshID,
+							   CREATEVERTEXDATAFUNC vdfun,
+							   CREATEINDEXDATAFUNC idfun,
+							   CREATEMULTIINDEXDATAFUNC midfun*/)
+{
+	uniqueID = uniqueIDgen++;
+
+	// 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);*/
+
+}
+/*
+LodTreeLibrary::LodTreeLibrary(const LodTreeLibrary &t)
+{
+	uniqueID = uniqueIDgen++;
+	assert(
+//	trunk=new LodStrip(t.trunk);
+	arbol=new Arbol(t.arbol);
+	foliage=new Foliage(arbol);
+}
+
+LodTreeLibrary::LodTreeLibrary(LodTreeLibrary *t)
+{
+	uniqueID = uniqueIDgen++;
+	trunk=new LodStrip(t->trunk); 
+	arbol=new Arbol(t->arbol);
+	foliage=new Foliage(arbol);
+}
+*/
+
+LodTreeLibrary::~LodTreeLibrary(void)
+{
+	if (trunk) delete trunk;
+//	if (arbol) delete arbol;
+//	if (foliage) delete foliage;
+/*	if (trunk_all_indices) delete trunk_all_indices;
+	if (indices_offsets) delete[] indices_offsets;
+//	if (current_foliage_indices) delete[] current_foliage_indices;*/
+}
+
+uint32 LodTreeLibrary::CurrentLOD_Trunk_StripCount(void) const
+{
+	assert(trunk);
+//	return trunk->TOTALTIRAS;
+	return trunk->GetStripCount();
+}
+
+
+uint32 LodTreeLibrary::CurrentLOD_Trunk_IndexCountByStrip(uint32 istrip) const
+{
+	assert(trunk);
+//	return trunk->lStripsV[istrip].size();
+	return trunk->GetIndexCountByStrip(istrip);
+}
+/*
+uint32 LodTreeLibrary::CurrentLOD_Trunk_IndexCount(void) const
+{
+	assert(trunk);
+	return trunk->num_indices_current_lod;
+}
+*/
+
+uint32 LodTreeLibrary::GoToTrunkLod(uint32 newlod)
+{
+	return trunk->GoToLod(newlod);
+/*	uint32 previouslod = trunk->LodActual;
+	trunk->VerModeloVBO(newlod);
+	return previouslod;*/
+}
+
+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);
+
+	arbol->indexdata->Begin();
+	arbol->vertexdata->Begin();
+	int i = foliage->ppio;
+	int auxnumhojas = 0;
+	while(i!=-1)
+	{
+		auxnumhojas++;
+		i=foliage->Acth[i].next;
+	}
+
+	assert(auxnumhojas*6<=arbol->indexdata->GetNumMaxIndices());
+	arbol->indexdata->SetNumValidIndices(auxnumhojas*6);
+	i = foliage->ppio;
+	int kkkk=0;
+	while(i!=-1)
+	{
+		unsigned int v0,v1,v2,v3;
+		v0 = arbol->Hojas[i].Vert_Hoja[0];
+		v1 = arbol->Hojas[i].Vert_Hoja[1];
+		v2 = arbol->Hojas[i].Vert_Hoja[2];
+		v3 = arbol->Hojas[i].Vert_Hoja[3];
+
+		arbol->indexdata->SetIndex(kkkk+0,v0);
+		arbol->indexdata->SetIndex(kkkk+1,v1);
+		arbol->indexdata->SetIndex(kkkk+2,v2);
+		arbol->indexdata->SetIndex(kkkk+3,v2);
+		arbol->indexdata->SetIndex(kkkk+4,v1);
+		arbol->indexdata->SetIndex(kkkk+5,v3);
+
+		arbol->vertexdata->SetVertexTexCoord(v0,0,0);
+		arbol->vertexdata->SetVertexTexCoord(v1,0,1);
+		arbol->vertexdata->SetVertexTexCoord(v2,1,0);
+		arbol->vertexdata->SetVertexTexCoord(v3,1,1); 
+
+		kkkk+=6;
+		i=foliage->Acth[i].next;
+	}
+	arbol->indexdata->End();
+	arbol->vertexdata->End();
+
+	return 0;
+}
+
+uint32 LodTreeLibrary::MinFoliageLod(void) const
+{
+	return arbol->minHojas; // una hoja: preguntar a francisco
+}
+uint32 LodTreeLibrary::MaxFoliageLod(void) const
+{
+//	return arbol->TotHojas;
+	return arbol->nHojas;
+}
+*/
+/*const VertexData* LodTreeLibrary::Get_Trunk_VertexData(void) const 
+{ 
+	return trunk->vertices; 
+}
+const MultiIndexData* LodTreeLibrary::CurrentLOD_Trunk_Indices(void) const 
+{ 
+//	return (uint32*)trunk->vStrips[istrip]; 
+//	return trunk->indices_x_tira[istrip];
+	return trunk->indices;
+}*/
+
+/*
+const VertexData* LodTreeLibrary::Get_Foliage_VertexData(void) const
+{
+	return arbol->vertexdata;
+}
+
+const IndexData* LodTreeLibrary::CurrentLOD_Foliage_Indices(void) const
+{
+//	return current_foliage_indices;
+	return arbol->indexdata;
+}*/
+
+
+/*void ThrowFileNotFoundError(const char *text)
+{
+	throw Geometry::FileNotFound(text);
+}*/
+/*
+uint32 LodTreeLibrary::CurrentLOD_Foliage_IndexCount(void) const
+{
+//	return current_foliage_indexcount;
+	return arbol->indexdata->GetNumValidIndices();
+}
+
+uint32 LodTreeLibrary::Get_Trunk_VertexCount(void) const
+{
+	return trunk->TOTALVERTS;
+}
+
+uint32 LodTreeLibrary::Get_Trunk_MaxIndexCount(uint32 istrip) const
+{
+//	return trunk->indices_x_tira[istrip]->GetNumMaxIndices();
+	return trunk->indices->GetNumMaxIndices(istrip);
+}
+
+uint32 LodTreeLibrary::Get_Foliage_VertexCount(void) const
+{
+	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 774)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/GTGeometry.vcproj	(revision 829)
@@ -286,53 +286,53 @@
 			</File>
 			<File
-				RelativePath=".\src\libs\GeoLodStripsConstructor.h">
-			</File>
-			<File
-				RelativePath=".\src\libs\GeoLodStripsLibrary.h">
-			</File>
-			<File
-				RelativePath=".\src\libs\GeoLodTreeConstructor.h">
-			</File>
-			<File
-				RelativePath=".\src\libs\GeoLodTreeLibrary.h">
-			</File>
-			<File
-				RelativePath=".\src\libs\GeoMesh.h">
-			</File>
-			<File
-				RelativePath=".\src\libs\GeoMeshSimplifier.h">
-			</File>
-			<File
-				RelativePath=".\src\libs\GeoMeshSimpSequence.h">
-			</File>
-			<File
-				RelativePath=".\src\libs\GeoMeshStripifier.h">
-			</File>
-			<File
-				RelativePath=".\src\libs\GeoSerializable.h">
-			</File>
-			<File
-				RelativePath=".\src\libs\GeoSerializer.h">
-			</File>
-			<File
-				RelativePath=".\src\libs\GeoSubMesh.h">
-			</File>
-			<File
-				RelativePath=".\src\libs\GeoTreeSimplifier.h">
-			</File>
-			<File
-				RelativePath=".\src\libs\GeoTreeSimpSequence.h">
-			</File>
-			<File
-				RelativePath=".\src\libs\GeoVector2.h">
-			</File>
-			<File
-				RelativePath=".\src\libs\GeoVector3.h">
-			</File>
-			<File
-				RelativePath=".\src\libs\GeoVertexBuffer.h">
-			</File>
-			<File
-				RelativePath=".\src\libs\hoja.h">
+				RelativePath=".\include\GeoLodStripsConstructor.h">
+			</File>
+			<File
+				RelativePath=".\include\GeoLodStripsLibrary.h">
+			</File>
+			<File
+				RelativePath=".\include\GeoLodTreeConstructor.h">
+			</File>
+			<File
+				RelativePath=".\include\GeoLodTreeLibrary.h">
+			</File>
+			<File
+				RelativePath=".\include\GeoMesh.h">
+			</File>
+			<File
+				RelativePath=".\include\GeoMeshSimplifier.h">
+			</File>
+			<File
+				RelativePath=".\include\GeoMeshSimpSequence.h">
+			</File>
+			<File
+				RelativePath=".\include\GeoMeshStripifier.h">
+			</File>
+			<File
+				RelativePath=".\include\GeoSerializable.h">
+			</File>
+			<File
+				RelativePath=".\include\GeoSerializer.h">
+			</File>
+			<File
+				RelativePath=".\include\GeoSubMesh.h">
+			</File>
+			<File
+				RelativePath=".\include\GeoTreeSimplifier.h">
+			</File>
+			<File
+				RelativePath=".\include\GeoTreeSimpSequence.h">
+			</File>
+			<File
+				RelativePath=".\include\GeoVector2.h">
+			</File>
+			<File
+				RelativePath=".\include\GeoVector3.h">
+			</File>
+			<File
+				RelativePath=".\include\GeoVertexBuffer.h">
+			</File>
+			<File
+				RelativePath=".\include\hoja.h">
 			</File>
 			<File
Index: GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h	(revision 774)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h	(revision 829)
@@ -42,4 +42,5 @@
 #include	"GeoTreeSimpSequence.h"
 #include	"GeoLodStripsConstructor.h"
+#include	"GeoLodTreeLibrary.h"
 
 //	About Dialog.
@@ -58,5 +59,6 @@
 	LODTREES,
 	SELECT_LEAVES,
-	VISUALIZE_LODSTRIPS
+	VISUALIZE_LODSTRIPS,
+	VISUALIZE_LODTREES
 };
 
@@ -96,4 +98,6 @@
 	//	Lod strips object.
 	LodStripsLibrary	*lodStripsLib;
+	//	Lod tree object.
+	LodTreeLibrary	*lodTreeLib;
 	
 	//	Mesh Bounds.
@@ -170,4 +174,6 @@
 	inline void cb_menuLodTreesOpenLeavesSimplification_i(fltk::Item*, void*);
 	static void cb_menuLodTreesOpenLeavesSimplification(fltk::Item*, void*);
+	inline void cb_menuLodTreesVisualize_i(fltk::Item*, void*);
+	static void cb_menuLodTreesVisualize(fltk::Item*, void*);
 	inline void cb_menuHelpAbout_i(fltk::Item*, void*);
 	static void cb_menuHelpAbout(fltk::Item*, void*);
@@ -206,5 +212,5 @@
 	
 	//	Show the LodStrips visulization panel.
-	void	showVisualizeLodStrips();
+	void	showSlider();
 
 	void	hideStripify();
@@ -218,5 +224,5 @@
 
 	//	Hide the LodStrips visualization panel.
-	void	hideVisualizeLodStrips();
+	void	hideSlider();
 	
 	//	Get the number of vertices.
@@ -292,4 +298,5 @@
 	fltk::Item					*menuLodStripsVisualize;
 	fltk::ItemGroup			*menuLodTrees;
+	fltk::Item					*menuLodTreesVisualize;
 
 	fltk::Item					*menuSelectLeaves;
@@ -333,4 +340,6 @@
 	//	Initialize the lodstripslibrary for visualization.
 	void	setLodStripsLibrary(std::string lodfile, Mesh	*geomesh);
+	//	Initialize the lodtreelibrary for visualization.
+	void	setLodTreesLibrary(std::string lodfile, Mesh	*geomesh);
 
 	// 26-12-2005
Index: GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshView.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshView.h	(revision 826)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshView.h	(revision 829)
@@ -14,6 +14,7 @@
 #include	<GeoMeshSaver.h>
 #include	<GeoMeshViewUI.h>
-//#include	<GeoLodStripsLibrary.h>
+
 //#endif
+namespace Geometry{ class LodTreeLibrary; }
 
 class GeoMeshView : public fltk::GlWindow
@@ -33,4 +34,5 @@
 	bool		mRotate;
 	bool		mLodStrip;
+	bool		mLodTree;
 
 	GeoMeshView(int 					x,
@@ -94,18 +96,23 @@
 
 	//	Counter Clockwise mode.
-	void	activeCCW(){mCCW	=	true;};
-	void	deactiveCCW(){mCCW	=	false;};
+	void	activeCCW(){mCCW	=	true;}
+	void	deactiveCCW(){mCCW	=	false;}
 
 	//	Pan mode.
-	void	activePan(){mPan	=	true;};
-	void	deactivePan(){mPan	=	false;};
+	void	activePan(){mPan	=	true;}
+	void	deactivePan(){mPan	=	false;}
 
 	//	Rotate mode.
-	void	activeRotate(){mRotate	=	true;};
-	void	deactiveRotate(){mRotate	=	false;};
+	void	activeRotate(){mRotate	=	true;}
+	void	deactiveRotate(){mRotate	=	false;}
 
 	//	LodStrip mode.
-	void	activeLodStrip(){mLodStrip	=	true;};
-	void	deactiveLodStrip(){mLodStrip	=	false;};
+	void	activeLodStrip(){mLodStrip	=	true;}
+	void	deactiveLodStrip(){mLodStrip	=	false;}
+
+	//	LodTree mode.
+	void	activeLodTree(){mLodTree	=	true;}
+	void	deactiveLodTree(){mLodTree	=	false;}
+
 
 	//	Ilumination modes.
@@ -158,4 +165,6 @@
 	//	Sets the lodstripslibrary object.
 	void	setLodStripsLibrary(Geometry::LodStripsLibrary *lodstrips);
+	//	Sets the lodtreeslibrary object.
+	void	setLodTreesLibrary(Geometry::LodTreeLibrary *lodtrees);
 
 	//	Change de Level of detail of the object.
@@ -174,4 +183,6 @@
 	//	LodStrips library object.
 	Geometry::LodStripsLibrary	*lodStripsLib;
+	//	LodTree library object.
+	Geometry::LodTreeLibrary	*lodTreeLib;
 	
 	//	Flag tha activate / deactivate the color strips.
@@ -206,4 +217,5 @@
 	void	drawTriangleStrip(int submesh);
 	void	drawLodStrip();
+	void	drawLodTree();
 	void	enableColorStrips();
 	void	disableColorStrips();
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp	(revision 826)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp	(revision 829)
@@ -682,4 +682,5 @@
 	//	Deactive Lod strip visualization.
 	geoMeshView->deactiveLodStrip();
+	geoMeshView->deactiveLodTree();
 
 	//	Loads a mesh file.
@@ -717,5 +718,5 @@
 
 	//	Show the Visulize LodStrips panel.
-	showVisualizeLodStrips();
+	showSlider();
 	
 	//	Repaint the window.
@@ -723,33 +724,92 @@
 }
 
-void GeoMeshViewUI::cb_menuLodStripsVisualize(fltk::Item* o, void* v)
-{
-  ((GeoMeshViewUI*)	(o->parent()->parent()->parent()->user_data()))
-										->
-										cb_menuLodStripsVisualize_i(o,v);
-}
-
-//---------------------------------------------------------------------------
-//	Open LodStrip trunk Callback
-//---------------------------------------------------------------------------
-inline void GeoMeshViewUI::cb_menuLodTreesOpenLodStripTrunk_i(fltk::Item*, void*)
-{
-}
-
-void GeoMeshViewUI::cb_menuLodTreesOpenLodStripTrunk(fltk::Item* o, void* v)
-{
-  ((GeoMeshViewUI*)	(o->parent()->parent()->parent()->user_data()))
-										->
-										cb_menuLodTreesOpenLodStripTrunk_i(o,v);
-}
-
-//---------------------------------------------------------------------------
-//	Open leaves simplification Callback
-//---------------------------------------------------------------------------
-inline void GeoMeshViewUI::cb_menuLodTreesOpenLeavesSimplification_i(fltk::Item*, void*)
-{
+
+inline void GeoMeshViewUI::cb_menuLodTreesVisualize_i(fltk::Item*, void*)
+{
+	fltk::FileChooser *fcho;
+	const	char				*lod_file;
+	
+	//	Sets menus application state to NONE.
+	mApplicationState	=	NONE;
+
+	//	Deactive Lod strip visualization.
+	geoMeshView->deactiveLodTree();
+	geoMeshView->deactiveLodStrip();
+
+	//	Loads a mesh file.
+	openMeshFile();
+	
+	//	Show title.
+	mProcessTitle->label("Visualize LodTrees");
+
+	//	If an object is loaded.
+	if (mGeoMesh != NULL)
+	{
+		fcho	=	new fltk::FileChooser("",
+				"*.lod",
+				fltk::FileChooser::CREATE,
+				"Open Lod file");
+
+		fcho->exec();
+
+		//	If a file was selected.
+		if (fcho->value())
+		{
+			//	Build lod strips library.
+			setLodTreesLibrary(string(fcho->value()), mGeoMesh);
+
+			//	Sets the aplication mode.
+			mApplicationState	=	VISUALIZE_LODTREES;
+		}
+
+		//	Free memory.
+		delete	fcho;
+	}
+
 	//	Hide the right panel.
 	hideRightPanel();
 
+	//	Show the Visulize LodTree panel.
+	showSlider();
+	
+	//	Repaint the window.
+	mMainWindow->redraw();
+}
+void GeoMeshViewUI::cb_menuLodTreesVisualize(fltk::Item *o, void *v)
+{
+  ((GeoMeshViewUI*)	(o->parent()->parent()->parent()->user_data()))
+										->
+										cb_menuLodTreesVisualize_i(o,v);
+}
+
+void GeoMeshViewUI::cb_menuLodStripsVisualize(fltk::Item* o, void* v)
+{
+  ((GeoMeshViewUI*)	(o->parent()->parent()->parent()->user_data()))
+										->
+										cb_menuLodStripsVisualize_i(o,v);
+}
+
+//---------------------------------------------------------------------------
+//	Open LodStrip trunk Callback
+//---------------------------------------------------------------------------
+inline void GeoMeshViewUI::cb_menuLodTreesOpenLodStripTrunk_i(fltk::Item*, void*)
+{
+}
+
+void GeoMeshViewUI::cb_menuLodTreesOpenLodStripTrunk(fltk::Item* o, void* v)
+{
+  ((GeoMeshViewUI*)	(o->parent()->parent()->parent()->user_data()))
+										->
+										cb_menuLodTreesOpenLodStripTrunk_i(o,v);
+}
+
+//---------------------------------------------------------------------------
+//	Open leaves simplification Callback
+//---------------------------------------------------------------------------
+inline void GeoMeshViewUI::cb_menuLodTreesOpenLeavesSimplification_i(fltk::Item*, void*)
+{
+	//	Hide the right panel.
+	hideRightPanel();
+
 	//	Show the LodTrees panel.
 	showOpenLeavesSimplification();
@@ -768,4 +828,6 @@
 										cb_menuLodTreesOpenLeavesSimplification_i(o,v);
 }
+
+
 
 //---------------------------------------------------------------------------
@@ -1338,5 +1400,5 @@
 //	Show the LodStrips visulization panel
 //---------------------------------------------------------------------------
-void	GeoMeshViewUI::showVisualizeLodStrips()
+void	GeoMeshViewUI::showSlider()
 {
 	mLodSlider->set_visible();
@@ -1347,9 +1409,10 @@
 //	Hide the LodStrips visualization panel
 //---------------------------------------------------------------------------
-void	GeoMeshViewUI::hideVisualizeLodStrips()
+void	GeoMeshViewUI::hideSlider()
 {
 	mLodSlider->hide();
 	mLodSlider->deactivate();
 }
+
 
 //---------------------------------------------------------------------------
@@ -1495,5 +1558,5 @@
 	hideOpenMeshSimplification();
 	hideOpenLeavesSimplification();
-	hideVisualizeLodStrips();
+	hideSlider();
 	hideMeshInfo();
 }
@@ -1914,4 +1977,28 @@
 
 //---------------------------------------------------------------------------
+//	Initialize the lodTreelibrary for visualization.
+//---------------------------------------------------------------------------
+void	GeoMeshViewUI::setLodTreesLibrary(std::string lodfile, Mesh	*geomesh)
+{
+	//	If there is no lod strips object.
+	if (lodTreeLib)
+	{
+		delete	lodTreeLib;
+	}
+
+	//	New lod strips object.
+	lodTreeLib	=	new	Geometry::LodTreeLibrary(lodfile, geomesh);
+
+	//	Sets the slider range.
+	mLodSlider->range(lodTreeLib->MaxTrunkLod(), lodTreeLib->MinTrunkLod());
+
+	//	Pass to geomeshview the lod strips object.
+	geoMeshView->setLodTreesLibrary(lodTreeLib);
+	
+	//	Puts the slider in the max position.
+	mLodSlider->value(lodTreeLib->MinTrunkLod());
+}
+
+//---------------------------------------------------------------------------
 //	Open a mesh file.
 //---------------------------------------------------------------------------
@@ -2026,4 +2113,5 @@
 	//	Initialize the lod strip object.
 	lodStripsLib	=	NULL;
+	lodTreeLib	=	NULL;
 
 	//	Identify the mesh that stores the leaves
@@ -2445,5 +2533,5 @@
 
 			//	Menu LodTrees.
-			/*
+			
 			{
 				fltk::ItemGroup* o;
@@ -2453,16 +2541,11 @@
 				{
 					fltk::Item* o;
-					o = menuLodTreesOpenLodStripTrunk = new fltk::Item("Open LodStrip trunk");
-					o->callback((fltk::Callback*)cb_menuLodTreesOpenLodStripTrunk);
-				}
-
-				{
-					fltk::Item* o;
-					o = menuLodTreesOpenLeavesSimplification = new fltk::Item("Open leaves simplification");
-					o->callback((fltk::Callback*)cb_menuLodTreesOpenLeavesSimplification);
-				}
+					o = menuLodTreesVisualize = new fltk::Item("Visualize Trunk");
+					o->callback((fltk::Callback*)cb_menuLodTreesVisualize);
+				}
+
 				o->end();
 			}
-			*/
+			
 			
 			{
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp	(revision 826)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp	(revision 829)
@@ -586,4 +586,8 @@
 			drawLodStrip();
 		}
+		else if (mLodTree)
+		{
+			drawLodTree();
+		}
 		else
 		{
@@ -892,4 +896,89 @@
 }//End drawTriangleStrip.
 
+
+//---------------------------------------------------------------------------
+//	Paint lodtree object.
+//---------------------------------------------------------------------------
+void GeoMeshView::drawLodTree()
+{
+	SubMesh				*geosubmesh;
+	Index					position;
+	Vector3				vector3;
+	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++)
+	{
+		
+		color_index	=	0;
+
+		//	Gets the actual submesh.
+		geosubmesh	=	&geoMesh->mSubMesh[submesh];
+
+		//	For each one of the strips.
+		for (int strip = 0; strip < geosubmesh->mStripCount; strip++)
+		{
+			//	Paint the current strip.
+			glBegin(GL_TRIANGLE_STRIP);
+
+			if (getColorStrips())
+			{
+				//	Gets the color of the strip.
+				r	=	mStripColors[submesh][color_index].r;
+				g	=	mStripColors[submesh][color_index].g;
+				b	=	mStripColors[submesh][color_index].b;
+
+				//	Change to the next color.
+				color_index++;
+
+				//	Paint a new color.
+				glColor3f(r,g,b);
+			}
+
+			//	For each index of the strip.
+			for (int index = 0; index < lodTreeLib->GetStrip(current_strip).size(); index++)
+			{
+				position	=	lodTreeLib->GetStrip(current_strip)[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);
+
+				//	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);
+			}
+
+			//	Increments current strip.
+			current_strip++;
+
+			//	A strip is generated.
+			glEnd();
+
+		}
+	}
+	
+}//End drawTriangleStrip.
+
+
+
 //---------------------------------------------------------------------------
 //	Sets the lodstripslibrary object.
@@ -902,9 +991,22 @@
 
 //---------------------------------------------------------------------------
+//	Sets the lodtreeslibrary object.
+//---------------------------------------------------------------------------
+void	GeoMeshView::setLodTreesLibrary(LodTreeLibrary *lodtrees)
+{
+	lodTreeLib	=	lodtrees;
+	activeLodTree();
+}
+
+
+//---------------------------------------------------------------------------
 //	Change de Level of detail of the object.
 //---------------------------------------------------------------------------
 void	GeoMeshView::GoToLod(unsigned int	lod)
 {
-	lodStripsLib->GoToLod(lod);
+	if (mLodStrip)
+		lodStripsLib->GoToLod(lod);
+	if (mLodTree)
+		lodTreeLib->GoToTrunkLod(lod);
 	draw();
 }
