Index: GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGClusterList.cpp
===================================================================
--- GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGClusterList.cpp	(revision 709)
+++ GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGClusterList.cpp	(revision 721)
@@ -1,193 +1,6 @@
 
-#include "IMGClusterList.h"
+#include <IMGClusterList.h>
 
 namespace IMG {
-
-// Gametools -- Isma 17/08/2005
-//int Cluster::CalculaPatch (Vector3 &point)
-//{
-//	//printf("\nCalculaPatch on estÃ  el vertex: (%.4f, %.4f, %.4f)", point.x, point.y, point.z);	
-//	
-//	//this->Print();
-//	
-//	int idpatch = this->CalcPatch (point);
-//	if (ObscuranceRayTracing::Config::Debug) printf("\nEl idpatch calculat Ã©s: %d", idpatch);
-//	int id = GetIdPatch(idpatch);
-//	if (ObscuranceRayTracing::Config::Debug) printf("\nEl patch real Ã©s el : %d", id);
-//	return id;
-//}
-// Gametools -- Isma 17/08/2005
-//
-//int Cluster::CalcPatch (Vector3 &point)
-//{
-//	//printf("\nDins Calcular Patch, valor de la caixa: ");
-//	//bound->Print();
-//	int x, y;
-//	//Polygon2d poly2d;
-//	//int axisproj;	
-//	Vector2 point2d;
-//	//Box box;
-//	Vector3 min, max;
-//	//Vector2 *vertexs;
-//	//int order;
-//	
-//	
-//	//vertexs = poly2d_text->GetVector3s();
-//	//vertexs = triangle2d_text->GetVector3s();
-//	
-//	//printf("\nCalc Patch ");
-//	
-//	
-//	//for (register unsigned int i = 0; i < 4; i++)
-//	//{
-//	//	box.AddBoundingVector3 (vertexs[i].x, vertexs[i].y, 0);		
-//	//}	
-//	
-//	
-//	
-//	min = bound->GetMinimum();	
-//	max = bound->GetMaximum();
-//	//box.Print();
-//	
-//	point2d = point2d.ProjectVector33d (point, axisproj);
-//	//printf("\nPoint2d: (%.4f, %.4f)", point2d.x, point2d.y);
-//	
-//	
-//	switch (axisproj)
-//	{
-//		
-//		case 1:	// 2 3
-//			// 0 1
-//				
-//			x = int ( (point2d.x - min.x) * ObscuranceRayTracing::Config::MapWidth / (max.x - min.x));
-//			y = int ( (point2d.y - min.y) * ObscuranceRayTracing::Config::MapHeight / (max.y - min.y));
-//			return x + y * ObscuranceRayTracing::Config::MapWidth;
-//		case 2:	// 0 1
-//			// 2 3
-//
-//			x = int ( (point2d.x - min.x) * ObscuranceRayTracing::Config::MapWidth / (max.x - min.x));
-//			y = int ( (point2d.y - min.y) * ObscuranceRayTracing::Config::MapHeight / (min.y - max.y));
-//			//printf("\nValor x: %d", x);
-//			//printf("\nValor y: %d", y);
-//			
-//			if (x < 0) x = -x;	//arreglo temporal si no no va bÃ©
-//			if (y < 0) y = -y;
-//			return x + y * ObscuranceRayTracing::Config::MapWidth;
-//		
-//		case 0:	// 3 2
-//			// 1 0
-//
-//			
-//			x = int ( (point2d.x - min.x) * ObscuranceRayTracing::Config::MapWidth / (min.x - max.x));
-//			y = int ( (point2d.y - min.y) * ObscuranceRayTracing::Config::MapHeight / (max.y - min.y));
-//			
-//			//printf("\nValor x: %d", x);
-//			//printf("\nValor y: %d", y);
-//			if (x < 0) x = -x;
-//			if (y < 0) y = -y;
-//			return x + y * ObscuranceRayTracing::Config::MapWidth;		
-//	}
-//	
-//	return -1;
-//}
-//
-// Gametools -- Isma 17/08/2005
-//
-//bool Cluster::CreatePatches( bool dinamic)
-//{
-//	if (ObscuranceRayTracing::Config::Debug) 
-//	{
-//		printf("\n\nCreant Patches en cluster (%d), isdinamic %d\n\n", dinamic, GetId());
-// 		printf("\nEl polygon es: ");
-//		Print();
-//		//printf("\n-----------\n ");
-//	}
-//	
-//	//if (!Inc) return false;
-//	//if (!vertexs) return false;
-//				
-//	int acum = 0;
-//	register unsigned int i = 0, j = 0;
-//	//Vector3 orig = Inc[0], valorx = Inc[1], valory = Inc[2];
-//	
-//	
-//	Vector3 orig, valorx, valory;
-//	
-//	orig = lumel_origin;
-//	valorx = lumel_x_axis;
-//	valory = lumel_y_axis;
-//	
-//	//if (ObscuranceRayTracing::Config::Debug)
-//	{
-//		printf("\nValor de origen: (%.4f, %.4f, %.4f)", lumel_origin.x, lumel_origin.y,lumel_origin.z);
-//		printf("\nValor de Ax: (%.4f, %.4f, %.4f)", lumel_x_axis.x, lumel_x_axis.y, lumel_x_axis.z);
-//		printf("\nValor de Ay: (%.4f, %.4f, %.4f)", lumel_y_axis.x, lumel_y_axis.y, lumel_y_axis.z);
-//	}
-//	
-//	Vector3 p0, p1, p2, p3;
-//	
-//	
-//	patchlistid.GetList()->reserve ( ObscuranceRayTracing::Config::MapHeight * ObscuranceRayTracing::Config::MapWidth);
-//	int cont = 0;
-//	for (; j <  ObscuranceRayTracing::Config::MapHeight; j++)
-//	{		
-//		i = 0;
-//		for (i = 0; i < ObscuranceRayTracing::Config::MapWidth; i++)
-//		{			
-//			Patch * patch = new Patch;						
-//			patch->SetCoord (i, j);
-//			//patch->SetCoord (j, i);
-//			patch->SetIdLumel(i + j + acum);
-//			patch->SetCluster (this);
-//			
-//			if (dinamic) patch->dinamic = dinamic;
-//			
-//			
-//			Patch::seqid++;			
-//						
-//			//if (ObscuranceRayTracing::Config::Debug) patch->Print(2);
-//			
-//			patchlistid.Insert(patch->GetId());	//add the id (index) to polygon's patchlistid
-//			
-//			//if (dinamic) ObscuranceRayTracing::patchlistdinamic.Insert(patch);
-//			//else ObscuranceRayTracing::patchlist.Insert(patch);
-//			
-//			ObscuranceRayTracing::patchlist_triangle.Insert(patch);
-//			//ObscuranceRayTracing::patchlist_cluster.Insert(patch);
-//			//patch->Print(2);
-//			
-//			delete patch;
-//			cont++;
-//		}
-//			
-//		acum = acum + ObscuranceRayTracing::Config::MapWidth - 1;	//el id del patch segÃŒent acum += lightmap_del_polygon->GetWidth() - 1
-//	}
-//	
-//	//if (ObscuranceRayTracing::Config::Debug) 
-//		printf("\n\nLlista de indexs de patchs del polygon: %d" , patchlistid.GetSize());
-//	return true;
-//}
-//
-
-bool ClusterList::Insert(Cluster * p) {
-	if (!p) return false;
-	//printf("\nInserting polygon");
-	//p->Print();	
-	//list.push_back(p);
-	//printf("\nInsert polygon: INsert\n");
-	list.push_back(*p);
-	//printf("\nInsert polygon: INsert fora\n");
-	return true;
-}
-
-void ClusterList::Print() {
-	printf("\n\n\nNombre de  cluster a la llista: %d --> ", list.size());
-	for (register int i = 0; i < list.size(); i ++)
-	{
-		//printf( "%d", GetPolygon(i)->GetId());
-		Get(i)->Print();
-	}
-	
-}
 
 ClusterList::~ClusterList() 
@@ -196,4 +9,49 @@
 }
 
+bool ClusterList::Insert(Cluster * p) 
+{
+	if (!p)
+	{
+		return false;
+	}
+
+	list.push_back(*p);
+	
+	return true;
+}
+
+void ClusterList::Print() 
+{
+	Ogre::LogManager::getSingleton().logMessage("nNombre de  cluster a la llista: " + Ogre::StringConverter::toString(list.size()));
+	for (register int i = 0; i < list.size(); i ++)
+	{
+		Get(i)->Print();
+	}	
+}
+
+ClusterList::ClusterList() 
+{
+    list.reserve(100);
+}
+
+std::vector<Cluster> * ClusterList::GetList() 
+{
+	return &list;
+}
+
+unsigned int ClusterList::GetSize() const
+{ 
+	return list.size(); 
+}
+
+Cluster * ClusterList::Get(unsigned int i) 
+{
+    if (i <= list.size())
+	{
+		return &list[i];
+	}
+    
+    return NULL;
+}
 
 }
