Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/OBA/OBAOgreBase.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/OBA/OBAOgreBase.h	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/OBA/OBAOgreBase.h	(revision 731)
@@ -34,12 +34,23 @@
   protected:
 	  Ogre::ArchiveManager *mArchiveManager;
+	  
 	  Ogre::ResourceGroupManager *mResourceGroupManager;
+	  
 	  Ogre::DefaultHardwareBufferManager *mDefaultHardwareBufferManager;
+	  
 	  Ogre::MeshSerializer *mMeshSerializer;
+	  
+	  Ogre::MaterialSerializer *mMaterialSerializer;
+
 	  Ogre::XMLMeshSerializer *mXMLMeshSerializer;
+	  
 	  Ogre::MaterialManager *mMaterialManager;
+	  
 	  Ogre::LogManager *mLogManager;
+	  
 	  Ogre::MeshManager *mMeshManager;
+	  
 	  FileSystemArchiveFactory *mFileSystemArchiveFactory;
+
 	  Ogre::Math *mMath;
 
@@ -56,7 +67,7 @@
 	Ogre::XMLMeshSerializer* getXMLMeshSerializer();
 	
+	Ogre::MaterialSerializer* getMaterialSerializer();
+
 	Ogre::MeshSerializer* getMeshSerializer();
-
-	Ogre::MeshManager* getMeshManager();
 
 	void initialize();
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/OBA/OBAPrerequisites.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/OBA/OBAPrerequisites.h	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/OBA/OBAPrerequisites.h	(revision 731)
@@ -23,5 +23,3 @@
 #   	endif
 
-
-
 #endif
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBCSampleConfigFile.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBCSampleConfigFile.h	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBCSampleConfigFile.h	(revision 731)
@@ -12,4 +12,6 @@
     virtual ~SampleConfigFile();
 
+	Ogre::String getEntitySampleMaterialPrefixName();
+
 	bool getEntityDistributionMerged();
 
@@ -20,5 +22,5 @@
 	bool getEntityDistributionSplitted();
 
-	Ogre::String getEntitySampleMeshPrefixFilename();
+	Ogre::String getEntitySampleMeshPrefixName();
 
 	bool getEntityDistributionGeneration();
@@ -26,5 +28,5 @@
 	Ogre::String getEntityDistributionFolder();
 
-	Ogre::String getEntityDistributionXMLPrefixFilename();
+	Ogre::String getEntityDistributionXMLPrefixName();
 
 	Ogre::String getEntitiesFolder();
@@ -32,5 +34,5 @@
 	bool getEntitySampleMeshGeneration();
 
-	Ogre::String getEntitiesMeshPrefixFilename();
+	Ogre::String getEntitiesMeshPrefixName();
 
 	bool getEntityClustersGeneration();
@@ -48,7 +50,7 @@
 	bool getEntityClustersSplittedClusters();
 
-	Ogre::String getEntityClustersMeshPrefixFilename();
+	Ogre::String getEntityClustersMeshPrefixName();
 
-	Ogre::String getEntityClustersMaterialPrefixFilename();
+	Ogre::String getEntityClustersMaterialPrefixName();
 
 	bool getBillboardCloudMergedBillboards();
@@ -60,25 +62,67 @@
 	Ogre::String getBillboardCloudFolder();
 
-	Ogre::String getBillboardCloudMeshPrefixFilename();
+	Ogre::String getBillboardCloudMeshPrefixName();
 
-	Ogre::String getBillboardCloudMaterialPrefixFilename();
+	Ogre::String getBillboardCloudBillboardMaterialPrefixName();
 
-	Ogre::String getBillboardCloudXMLPrefixFilename();
+	Ogre::String getBillboardCloudBillboardGroupMaterialPrefixName();
 
-	bool getBillboardCloudDiffuseColorTextureAtlasGeneration();
+	Ogre::String getBillboardCloudBillboardTextureUnit0PrefixName();
 
-	unsigned int getBillboardCloudDiffuseColorTextureSize();
+	Ogre::String getBillboardCloudBillboardGroupTextureUnit0PrefixName();
 
-	unsigned int getBillboardCloudDiffuseColorTextureAtlasSize();
-
-	bool getBillboardCloudIndirectTextureAtlasGeneration();
-
-	unsigned int getBillboardCloudIndirectTextureSize();
-
-	unsigned int getBillboardCloudIndirectTextureAtlasSize();
+	Ogre::String getBillboardCloudXMLPrefixName();
 
 	unsigned int getBillboardCloudGroups();
 
 	bool getBillboardCloudGroupedBillboards();
+
+	bool getBillboardCloudDiffuseColorEntityTextureAtlasGeneration();
+
+	Ogre::String getBillboardCloudDiffuseColorEntityTexturePrefixName();
+
+	Ogre::String getBillboardCloudDiffuseColorEntityTextureAtlasPrefixName();
+
+	unsigned int getBillboardCloudDiffuseColorEntityTextureAtlasBitRange();
+
+	unsigned int getBillboardCloudDiffuseColorEntityTextureAtlasSize();
+
+	unsigned int getBillboardCloudDiffuseColorBillboardGroupTextureSize();
+
+	bool getBillboardCloudIndirectBillboardGroupTextureAtlasGeneration();
+
+	Ogre::String getBillboardCloudIndirectBillboardGroupTextureAtlasPrefixName();
+
+	unsigned int getBillboardCloudIndirectBillboardGroupTextureAtlasBitRange();
+
+	unsigned int getBillboardCloudIndirectBillboardGroupTextureAtlasSize();
+
+	unsigned int getBillboardCloudIndirectBillboardGroupTextureSize();
+
+	bool getBillboardCloudDiffuseColorBillboardGroupTextureAtlasGeneration();
+
+	bool getBillboardCloudDiffuseColorMergedBillboardsTextureAtlasGeneration();
+
+	Ogre::String getBillboardCloudDiffuseColorMergedBillboardsTextureAtlasPrefixName();
+
+	unsigned int getBillboardCloudDiffuseColorMergedBillboardsTextureAtlasBitRange();
+
+	unsigned int getBillboardCloudDiffuseColorMergedBillboardsTextureAtlasSize();
+
+	unsigned int getBillboardCloudDiffuseColorMergedBillboardsTextureSize();
+
+	unsigned int getBillboardCloudDiffuseColorBillboardGroupTextureAtlasSize();
+
+	unsigned int getBillboardCloudDiffuseColorEntityTextureAtlasNumSamples();
+
+	bool getBillboardCloudIndirectMergedBillboardsTextureAtlasGeneration();
+
+	Ogre::String getBillboardCloudIndirectMergedBillboardsTextureAtlasPrefixName();
+
+	unsigned int getBillboardCloudIndirectMergedBillboardsTextureAtlasBitRange();
+
+	unsigned int getBillboardCloudIndirectMergedBillboardsTextureAtlasSize();
+
+	unsigned int getBillboardCloudIndirectMergedBillboardsTextureSize();
 
 };
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBCManager.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBCManager.h	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBCManager.h	(revision 731)
@@ -15,9 +15,9 @@
 namespace LBBC {
 
-class _BBCExport Manager : public BBC::Manager {
+class _BBCExport LBBCManager : public BBC::BBCManager {
   public:
-    Manager();
+    LBBCManager();
 
-    ~Manager();
+    ~LBBCManager();
 
 	void runSampleConfigFile();
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBC.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBC.h	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBC.h	(revision 731)
@@ -9,4 +9,4 @@
 #include <LBBCBillboardViewMode.h>
 #include <LBBCClusterViewMode.h>
-
+#include <LBBCEntityTextureAtlasViewMode.h>
 #endif
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBCClusterViewMode.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBCClusterViewMode.h	(revision 731)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBCClusterViewMode.h	(revision 731)
@@ -0,0 +1,30 @@
+#ifndef _LBBCCLUSTERSVIEWMODE_H
+#define _LBBCCLUSTERSVIEWMODE_H
+
+#include <LBBCPrerequisites.h>
+#include <OBAOgreFrameListenerMode.h>
+
+namespace LBBC {
+
+class ClusterViewMode : public OBA::OgreFrameListenerMode 
+{
+	public:
+		ClusterViewMode(Ogre::RenderWindow* win, unsigned int ogreFrameListenerModeHandle, bool useBufferedInputKeys = false, bool useBufferedInputMouse = false):
+		  OBA::OgreFrameListenerMode(win, ogreFrameListenerModeHandle, useBufferedInputKeys, useBufferedInputMouse)
+		{
+		}
+
+		virtual ~ClusterViewMode()
+		{
+		}
+
+		virtual void createScene()
+		{
+			Ogre::SceneNode* sNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
+			Ogre::Entity* emesh = mSceneMgr->createEntity("chestnutLeavesEntitySample.mesh", "chestnutLeavesEntitySample.mesh");		
+			sNode->attachObject(emesh);
+		}
+};
+
+}
+#endif
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBCEntityTextureAtlasViewMode.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBCEntityTextureAtlasViewMode.h	(revision 731)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBCEntityTextureAtlasViewMode.h	(revision 731)
@@ -0,0 +1,64 @@
+#ifndef _LBBCENTITYTEXTUREATLASVIEWMODE_H
+#define _LBBCENTITYTEXTUREATLASVIEWMODE_H
+
+#include <LBBCPrerequisites.h>
+#include <IMG.h>
+#include <OBAOgreFrameListenerMode.h>
+
+namespace LBBC {
+
+class _BBCExport EntityTextureAtlasViewMode : public OBA::OgreFrameListenerMode 
+{
+	protected:
+		Ogre::SceneNode* mTextureAtlasNode;
+
+		IMG::TextureAtlasPtr mTextureAtlas;
+
+		unsigned int mFrame;
+
+		bool mTextureAtlasGenerated;
+
+		unsigned int mBitRange;
+
+		Ogre::PixelFormat mSrcPixelFormat;
+
+		Ogre::PixelFormat mDestPixelFormat;
+
+		Ogre::String mTextureName;
+
+		Ogre::String mTextureAtlasName;
+
+		Ogre::String mTextureAtlasFolder;
+
+		unsigned int mTextureAtlasSize;
+
+		unsigned int mNumSamples;
+
+	public:
+		EntityTextureAtlasViewMode(Ogre::RenderWindow* win, unsigned int ogreFrameListenerModeHandle, bool useBufferedInputKeys = false, bool useBufferedInputMouse = false);
+
+		virtual ~EntityTextureAtlasViewMode();		
+
+		void setTextureAtlasFolder(Ogre::String textureAtlasFolder);
+
+		unsigned int nextPowerOf2(unsigned int nPlanes);
+
+		virtual bool frameStarted(const Ogre::FrameEvent& evt, Ogre::InputReader *inputReader);
+
+		virtual void createScene();
+
+		virtual void destroyScene();
+
+		void setTextureAtlasBitRange(unsigned int bitRange);
+
+		void setTextureAtlasNumSamples(unsigned int numSamples);
+
+		void setTextureName(Ogre::String textureName);
+
+		void setTextureAtlasName(Ogre::String textureAtlasName);
+
+		void setTextureAtlasSize(unsigned int size);
+};
+
+}
+#endif
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBCBillboardViewMode.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBCBillboardViewMode.h	(revision 731)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBCBillboardViewMode.h	(revision 731)
@@ -0,0 +1,31 @@
+#ifndef _LBBCBILLBOARDVIEWMODE_H
+#define _LBBCBILLBOARDVIEWMODE_H
+
+
+#include "OBAOgreFrameListenerMode.h"
+
+namespace LBBC {
+
+class BillboardViewMode : public OBA::OgreFrameListenerMode 
+{
+	public:
+		BillboardViewMode(Ogre::RenderWindow* win, unsigned int ogreFrameListenerModeHandle, bool useBufferedInputKeys = false, bool useBufferedInputMouse = false):
+		  OBA::OgreFrameListenerMode(win, ogreFrameListenerModeHandle, useBufferedInputKeys, useBufferedInputMouse)
+		{
+		}
+
+		virtual ~BillboardViewMode()
+		{
+		}
+
+		virtual void createScene()
+		{
+			Ogre::SceneNode* sNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
+			Ogre::Entity* emesh = mSceneMgr->createEntity("chestnutLeavesBillboardCloudMerged.mesh","chestnutLeavesBillboardCloudGrouped.mesh");		
+			sNode->attachObject(emesh);
+		}
+
+};
+
+}
+#endif
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/BBC/BBCMesh.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/BBC/BBCMesh.h	(revision 731)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/BBC/BBCMesh.h	(revision 731)
@@ -0,0 +1,65 @@
+#ifndef _BBCMESH_H
+#define _BBCMESH_H
+
+#include <BBCPrerequisites.h>
+
+namespace BBC {
+
+using namespace Ogre;
+
+//Fordward declaration
+class Mesh;
+
+namespace boost
+{
+	void intrusive_ptr_add_ref(Mesh * p);
+    void intrusive_ptr_release(Mesh * p);
+};
+
+class _BBCExport Mesh
+{
+  protected:
+	Ogre::Mesh* mMesh;
+
+  private:
+    long references;
+    friend void boost::intrusive_ptr_add_ref(Mesh * p);
+    friend void boost::intrusive_ptr_release(Mesh * p);
+
+  public:
+
+	Mesh(Ogre::Mesh* mesh): references(0) // initialize references to 0 
+	{
+		mMesh = mesh;
+	}
+	
+	Ogre::Mesh* get()
+	{
+		return mMesh;
+	}
+
+	virtual ~Mesh();
+};
+
+// class specific addref/release implementation
+// the two function overloads must be in the boost namespace on most compilers:
+namespace boost
+{
+	inline void intrusive_ptr_add_ref(Mesh * p)
+	{
+		// increment reference count of object *p
+		++(p->references);
+	}
+
+	inline void intrusive_ptr_release(Mesh * p)
+	{
+	// decrement reference count, and delete object when reference count reaches 0
+	if (--(p->references) == 0)
+		delete p;
+	} 
+} // namespace boost
+
+typedef ::boost::intrusive_ptr<Mesh> MeshPtr;
+
+}
+#endif
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/BBC/BBCManager.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/BBC/BBCManager.h	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/BBC/BBCManager.h	(revision 731)
@@ -7,13 +7,13 @@
 namespace BBC {
 
-class _BBCExport Manager : public CSingleton<Manager> {
+class _BBCExport BBCManager : public CSingleton<BBCManager> {
   public:
-    Manager();
+    BBCManager();
 	
-    ~Manager();
+    ~BBCManager();
 
-	static Manager& getSingleton(void);
+	static BBCManager& getSingleton(void);
     
-	static Manager* getSingletonPtr(void);
+	static BBCManager* getSingletonPtr(void);
 
 	Ogre::Mesh* loadMesh(Ogre::String folderName, Ogre::String fileName);
@@ -24,4 +24,6 @@
 
 	void saveXMLMesh(Ogre::String name);
+
+	void saveMaterial(Ogre::String materialName);
 
 	void initialize(void);
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IBRBillboardCloudTreeApplication.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IBRBillboardCloudTreeApplication.h	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IBRBillboardCloudTreeApplication.h	(revision 731)
@@ -2,6 +2,7 @@
 #define _IBRBILLBOARDCLOUDTREEAPPLICATION_H
 
+#include <IMG.h>
+#include <LBBC.h>
 #include <OBAOgreApplication.h>
-#include <LBBC.h>
 #include <IBRBillboardCloudTreeFrameListener.h>
 
@@ -15,7 +16,9 @@
 protected:
 	
+	LBBC::SampleConfigFile *mSampleConfigFile;
+
 	CommandLineOptions mOpts;
 	
-	LBBC::Manager* mLBBCManager;
+	LBBC::LBBCManager* mLBBCManager;
 
 	int findCommandLineOpts(int numargs, char** argv, Ogre::UnaryOptionList& unaryOptList, Ogre::BinaryOptionList& binOptList);
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGClusterList.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGClusterList.h	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGClusterList.h	(revision 731)
@@ -7,5 +7,5 @@
 namespace IMG {
 
-class ClusterList 
+class _IMGExport ClusterList 
 {
   public:
@@ -14,15 +14,15 @@
     virtual ~ClusterList();
     
-    std::vector<Cluster> * GetList();
+    std::vector<Cluster> * getList();
 
     //return the pointer to the list of voxels
-    unsigned int GetSize() const;
+    unsigned int getSize() const;
 
     //return the number of elements of list
-    Cluster * Get(unsigned int i);
+    Cluster * get(unsigned int i);
 
-    bool Insert(Cluster * p);
+    bool insert(Cluster * p);
 
-    void Print();
+    void print();
 
 
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGBox2d.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGBox2d.h	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGBox2d.h	(revision 731)
@@ -7,5 +7,5 @@
 
 //* this class represents a 2d bound box for a texture 
-class Box2d 
+class _IMGExport Box2d 
 {
 	public:
@@ -22,19 +22,19 @@
 		}
 
-		Ogre::Vector2 GetMinimum();
+		Ogre::Vector2 getMinimum();
 
-		Ogre::Vector2 GetMaximum(); 
+		Ogre::Vector2 getMaximum(); 
 
-		void SetBoundBox(float x, float y, float X, float Y); 
+		void setBoundBox(float x, float y, float X, float Y); 
 
-		void AddBoundingVector3(float x, float y);
+		void addBoundingVector3(float x, float y);
 
-		void Print(); 
+		void print(); 
 
-		Ogre::Vector2 GetCorner(int corner) const;
+		Ogre::Vector2 getCorner(int corner) const;
 
-		bool In(int w, int h); 
+		bool in(int w, int h); 
 
-		bool FitPerfect(int w, int h);
+		bool fitPerfect(int w, int h);
 
 	protected:
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMG.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMG.h	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMG.h	(revision 731)
@@ -2,3 +2,6 @@
 #define _IMG_H
 
+#include <IMGTexture.h>
+#include <IMGTextureAtlas.h>
+
 #endif
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGTexture.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGTexture.h	(revision 731)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGTexture.h	(revision 731)
@@ -0,0 +1,116 @@
+#ifndef _IMGTEXTURE_H
+#define _IMGTEXTURE_H
+
+#include <IMGPrerequisites.h>
+
+namespace IMG 
+{
+
+// Forward declarations
+class _IMGExport Texture;
+
+
+namespace boost
+{
+    void intrusive_ptr_add_ref(Texture * p);
+    void intrusive_ptr_release(Texture * p);
+};
+
+class _IMGExport Texture 
+{
+
+private:
+    long references;
+    friend void boost::intrusive_ptr_add_ref(Texture * p);
+    friend void boost::intrusive_ptr_release(Texture * p);
+
+  protected:
+	 Ogre::Texture *mTexture;
+
+	 Ogre::Material *mMaterial;
+
+     Ogre::Rectangle2D *mRectangle2D;
+
+	 unsigned int mWidth;
+
+	 unsigned int mHeight;
+
+	 Ogre::String mTextureName;
+
+	 Ogre::ColourValue mAvgColour;
+
+	 Ogre::ColourValue mBackgroundColour;
+
+	 bool mCalculatedAvgColour;
+
+  public:
+     Texture();
+
+     virtual ~Texture();
+
+	 Ogre::ColourValue getAvgColour();
+
+	 void calculateAvgColour();
+
+	 void setBackgroundColour(Ogre::ColourValue colour);
+
+	 Ogre::ColourValue getBackgroundColour();
+
+	 virtual void load(Ogre::String folderName, Ogre::String filename);
+
+	 virtual void save(Ogre::String folderName, Ogre::String filename);
+
+	 void rotate(Ogre::Real rRotation);
+
+	 void setCorners(Ogre::Real left, Ogre::Real top, Ogre::Real right, Ogre::Real bottom);
+
+	 Ogre::Rectangle2D* getRectangle2D();
+
+	 Ogre::Vector2 getMinTexCoord();
+
+	 Ogre::Vector2 getMaxTexCoord();
+
+     void setWidth(unsigned int width);
+
+     unsigned int getWidth();
+
+     void setHeight(unsigned int height);
+
+     unsigned int getHeight();
+
+     void setTextureName(Ogre::String textureName);
+
+     Ogre::String getTextureName();
+
+	 void setMaterial(Ogre::Material *material);
+
+	 Ogre::Material* getMaterial();
+
+	 void bind(Ogre::String textureName);
+
+};
+
+// class specific addref/release implementation
+// the two function overloads must be in the boost namespace on most compilers:
+namespace boost
+{
+ inline void intrusive_ptr_add_ref(Texture * p)
+  {
+    // increment reference count of object *p
+    ++(p->references);
+  }
+
+
+
+ inline void intrusive_ptr_release(Texture * p)
+  {
+   // decrement reference count, and delete object when reference count reaches 0
+   if (--(p->references) == 0)
+     delete p;
+  } 
+} // namespace boost
+
+typedef ::boost::intrusive_ptr<Texture> TexturePtr;
+
+}
+#endif
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGCluster.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGCluster.h	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGCluster.h	(revision 731)
@@ -11,8 +11,10 @@
 {
 
-class Cluster 
+class _IMGExport Cluster 
 {
   public:
     Cluster();
+
+    virtual ~Cluster();
 
     Cluster & operator =(const Cluster & p);
@@ -20,43 +22,43 @@
     Cluster(const Cluster & p);
 
-	void SetNormal(Ogre::Vector3* n);
+	void setNormal(Ogre::Vector3* n);
 
-	Ogre::Vector3* GetNormal();
+	Ogre::Vector3* getNormal();
 
-    BBox* GetBound();
+    BBox* getBound();
 
-    Box2d* GetBspNodeBound();
+    Box2d* getBspNodeBound();
 
-    void SetBspNodeBound(Box2d* box);
+    void setBspNodeBound(Box2d* box);
 
-    void Print();
+    void print();
 
     //* return the dominant normal axis, for calculate the 2d projection
-    int AxisProjected();
+    int axisProjected();
 
-    int GetId() const;
+    int getId() const;
 
-    void SetId(int id_);
+    void setId(int id_);
 
-	std::vector<Ogre::Vector3>* GetVector3sVector();
+	std::vector<Ogre::Vector3>* getVector3sVector();
 
-	Ogre::Vector3* GetVector3sTex() const;
+	Ogre::Vector3* getVector3sTex() const;
 
-    void Finish();
+    void finish();
 
-	void SetPlane(Ogre::Vector3* normal, Ogre::Vector3 * point);
+	void setPlane(Ogre::Vector3* normal, Ogre::Vector3 * point);
 
-    Plane3 * GetPlane();
+    Plane3 * getPlane();
 
     //* Return the increment in U (lumel increment in x). For patchs calculation 
-	Ogre::Vector3 GetIncU();
+	Ogre::Vector3 getIncU();
 
     //* Return the increment in V (lumel increment in x). For patchs calculation 
-	Ogre::Vector3 GetIncV();
+	Ogre::Vector3 getIncV();
 
     //* Return the origin. For patchs calculation 
-	Ogre::Vector3 GetOrigin();
+	Ogre::Vector3 getOrigin();
 
-	bool PointIn(Ogre::Vector3 & point);
+	bool pointIn(Ogre::Vector3 & point);
 
 	Ogre::Real *pointeru[4]; 
@@ -93,7 +95,4 @@
     Plane3 plane;
 
-  public:
-    virtual ~Cluster();
-
 };
 
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGPlane3.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGPlane3.h	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGPlane3.h	(revision 731)
@@ -6,5 +6,5 @@
 namespace IMG {
 
-class Plane3: public Ogre::Plane {
+class _IMGExport Plane3: public Ogre::Plane {
   public:
     //a plane's interface
@@ -15,13 +15,13 @@
     Plane3 & operator =(const Plane3 & p);
 
-	Ogre::Vector3 * GetNormal();
+	Ogre::Vector3 * getNormal();
 
-    void SetNormal(float x, float y, float z);
+    void setNormal(float x, float y, float z);
 
-    void SetDistance(float dist);
+    void setDistance(float dist);
 
-    float GetDistance() const;
+    float getDistance() const;
 
-    void Print();
+    void print();
 
 };
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGBsp.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGBsp.h	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGBsp.h	(revision 731)
@@ -7,5 +7,5 @@
 namespace IMG {
 
-class Bsp {
+class _IMGExport Bsp {
   public:
     Bsp();
@@ -13,13 +13,13 @@
     virtual ~Bsp();
 
-    void SetRoot(NodeBspPtr node);
+    void setRoot(NodeBspPtr node);
 
-    void Print();
+    void print();
 
-    void PrintLeaf(); 
+    void printLeaf(); 
 
-    NodeBspPtr Insert(int w, int h, int idcluster);
+    NodeBspPtr insert(int w, int h, int idcluster);
 
-    NodeBspPtr Get(int i);
+    NodeBspPtr get(int i);
 
   protected:
@@ -30,7 +30,7 @@
     int counttotal;
 
-    void Print(NodeBspPtr node);
+    void print(NodeBspPtr node);
 
-    void PrintLeaf(NodeBspPtr node);
+    void printLeaf(NodeBspPtr node);
 
 };
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGPrerequisites.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGPrerequisites.h	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGPrerequisites.h	(revision 731)
@@ -8,6 +8,16 @@
 #include <OgrePlane.h>
 #include <OgreAxisAlignedBox.h> 
+#include <OgreHardwarePixelBuffer.h>
+#include <OgreImageCodec.h>
+
+#include <imdebug.h>
 
 #include <boost/smart_ptr.hpp>
 
+#   	if defined( IMG_LIB_BUILD )
+#       	define _IMGExport __declspec( dllexport )			
+#   	else
+#       	define _IMGExport
+#   	endif
+
 #endif
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGTextureAtlas.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGTextureAtlas.h	(revision 731)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGTextureAtlas.h	(revision 731)
@@ -0,0 +1,98 @@
+#ifndef _IMGTEXTUREATLAS_H
+#define _IMGTEXTUREATLAS_H
+
+#include <IMGPrerequisites.h>
+#include <IMGTexture.h>
+
+namespace IMG {
+
+// Fordward declaration...
+class TextureAtlas;
+
+namespace boost
+{
+    void intrusive_ptr_add_ref(TextureAtlas * p);
+    void intrusive_ptr_release(TextureAtlas * p);
+};
+
+class _IMGExport TextureAtlas : public Texture 
+{
+
+  private:
+    long references;
+    friend void boost::intrusive_ptr_add_ref(TextureAtlas * p);
+    friend void boost::intrusive_ptr_release(TextureAtlas * p);
+
+  protected:
+     Ogre::String mTextureAtlasName;
+
+	 Ogre::TexturePtr mTextureAtlas;
+
+	 Ogre::Camera *mCamera;
+	
+	 Ogre::SceneNode *mTextureAtlasSceneNode;
+
+     std::vector<TexturePtr> mTextureList;
+
+	 Ogre::PixelFormat mPixelFormat;
+
+  public:
+
+    TextureAtlas();
+
+    virtual ~TextureAtlas();
+
+	unsigned int getReference();
+
+	void setFormat(Ogre::PixelFormat pixelFormat);
+
+	void create(Ogre::String fileName, unsigned int width, unsigned int height, Ogre::PixelFormat pixelFormat, Ogre::Camera *camera);
+
+	void setCamera(Ogre::Camera *camera);
+
+	void update();
+
+	void setTextureAtlasSceneNode(Ogre::SceneNode *textureAtlasSceneNode);
+
+	Ogre::SceneNode* getTextureAtlasSceneNode();
+
+	void save(Ogre::String folderName, Ogre::String filename, Ogre::PixelFormat pixelFormat);
+
+	void addTexture(TexturePtr texture);
+
+	TexturePtr getTexture(unsigned int iTexture);
+
+	void removeTexture(unsigned int iTexture);
+
+    void setTextureAtlasName(Ogre::String textureAtlasName);
+
+    Ogre::String getTextureAtlasName();
+
+	unsigned int getNumTextures();
+
+};
+
+// class specific addref/release implementation
+// the two function overloads must be in the boost namespace on most compilers:
+namespace boost
+{
+ inline void intrusive_ptr_add_ref(TextureAtlas * p)
+  {
+    // increment reference count of object *p
+    ++(p->references);
+  }
+
+
+
+ inline void intrusive_ptr_release(TextureAtlas * p)
+  {
+   // decrement reference count, and delete object when reference count reaches 0
+   if (--(p->references) == 0)
+     delete p;
+  } 
+} // namespace boost
+
+typedef ::boost::intrusive_ptr<TextureAtlas> TextureAtlasPtr;
+
+}
+#endif
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGCluster2d.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGCluster2d.h	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGCluster2d.h	(revision 731)
@@ -8,5 +8,5 @@
 class Cluster;
 
-class Cluster2d {
+class _IMGExport Cluster2d {
   public:
     Cluster2d();
@@ -17,13 +17,13 @@
     //			
     //	 
-    int Create2d(Cluster * cluster, int type, int type_vertexs);
+    int create2d(Cluster * cluster, int type, int type_vertexs);
 
-    void Print();
+    void print();
 
-	Ogre::Vector2 * GetVector3s();
+	Ogre::Vector2 * getVector3s();
 
-	std::vector<Ogre::Vector2> * GetVector3sVector();
+	std::vector<Ogre::Vector2> * getVector3sVector();
 
-	Ogre::Vector3 * GetNormal();
+	Ogre::Vector3 * getNormal();
 
   protected:
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGBBox.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGBBox.h	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGBBox.h	(revision 731)
@@ -25,5 +25,5 @@
 //	this class encaplusalte the ogre::AxisAlignedBox
 //*
-class BBox: public Ogre::AxisAlignedBox {
+class _IMGExport BBox: public Ogre::AxisAlignedBox {
   public:
     BBox();
@@ -31,15 +31,15 @@
 	~BBox();
 
-    void StartBoundingBox();
+    void initialize();
 
-	Ogre::Vector3 GetMinimum();
+	Ogre::Vector3 getMinimum();
 
-	Ogre::Vector3 GetMaximum();
+	Ogre::Vector3 getMaximum();
 
-    void AddBoundingVector3(float x, float y, float z);
+    void addBoundingVector3(float x, float y, float z);
 
-    void Print();
+    void print();
 
-	Ogre::Vector3 GetCorner(int corner) const;
+	Ogre::Vector3 getCorner(int corner) const;
 
     bool intersects(Ogre::Vector3 v);
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGNodeBsp.h
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGNodeBsp.h	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGNodeBsp.h	(revision 731)
@@ -8,5 +8,5 @@
 
 // Fordward declaration...
-class NodeBsp;
+class _IMGExport NodeBsp;
 
 typedef ::boost::intrusive_ptr<NodeBsp> NodeBspPtr;
@@ -25,21 +25,21 @@
     virtual ~NodeBsp();
 
-    Box2d* GetBound();
+    Box2d* getBound();
 
-    void SetBound(Box2d *box);
+    void setBound(Box2d *box);
 
-    NodeBspPtr GetChild(int i);
+    NodeBspPtr getChild(int i);
 
-    void SetId(int id_);
+    void setId(int id_);
 
-    unsigned int GetId() const;
+    unsigned int getId() const;
 
-    void SetChild(NodeBspPtr node, int i);
+    void setChild(NodeBspPtr node, int i);
 
-    void Print();
+    void print();
 
-    NodeBspPtr Insert(int w, int h);
+    NodeBspPtr insert(int w, int h);
 
-    NodeBspPtr Get(NodeBspPtr node, int i);
+    NodeBspPtr get(NodeBspPtr node, int i);
 
   protected:
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/scripts/IBRBillboardCloudTreeGenerator.vcproj
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/scripts/IBRBillboardCloudTreeGenerator.vcproj	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/scripts/IBRBillboardCloudTreeGenerator.vcproj	(revision 731)
@@ -20,7 +20,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions="/D &quot;TIXML_USE_STL&quot; /D &quot;OBA_LIB_BUILD&quot;"
+				AdditionalOptions="/D &quot;TIXML_USE_STL&quot; /D &quot;OBA_LIB_BUILD&quot;  /D &quot;IMG_LIB_BUILD&quot;"
 				Optimization="0"
-				AdditionalIncludeDirectories="&quot;$(OGRE_PATH)/OgreMain/include&quot;;&quot;$(OGRE_PATH)/Samples/Common/include&quot;;&quot;$(OGRE_PATH)/Tools/XMLConverter/include&quot;;../include/IMG;../include/BBC;../include/LBBC;../include/OBA;D:\design_04_11_2005\svn\NonGTP\Boost"
+				AdditionalIncludeDirectories="&quot;$(OGRE_PATH)/OgreMain/include&quot;;&quot;$(OGRE_PATH)/Samples/Common/include&quot;;&quot;$(OGRE_PATH)/Tools/XMLConverter/include&quot;;../include/IMG;../include/BBC;../include/LBBC;../include/OBA;D:\design_04_11_2005\svn\NonGTP\Boost;D:\design_04_11_2005\svn\NonGTP\ImageDebugger\include"
 				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;_MT"
 				MinimalRebuild="TRUE"
@@ -39,9 +39,9 @@
 				Name="VCLinkerTool"
 				AdditionalOptions=" /IMPLIB:&quot;..\bin\debug\$(ProjectName)_d.lib&quot; "
-				AdditionalDependencies="Ogremain_d.lib"
+				AdditionalDependencies="Ogremain_d.lib imdebug.lib"
 				OutputFile="$(OutDir)/$(ProjectName)_d.dll"
 				LinkIncremental="2"
 				SuppressStartupBanner="TRUE"
-				AdditionalLibraryDirectories="$(OGRE_PATH)/OgreMain/lib/$(ConfigurationName)"
+				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)/OgreMain/lib/$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)/OgreMain/lib/Release&quot;;D:\design_04_11_2005\svn\NonGTP\ImageDebugger\lib"
 				IgnoreDefaultLibraryNames="LIBCD;LIBCMTD"
 				GenerateDebugInformation="TRUE"
@@ -79,6 +79,6 @@
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions="/D &quot;TIXML_USE_STL&quot; /D &quot;TIXML_USE_STL&quot; /D &quot;OBA_LIB_BUILD&quot;"
-				AdditionalIncludeDirectories="&quot;$(OGRE_PATH)/OgreMain/include&quot;;&quot;$(OGRE_PATH)/Tools/XMLConverter/include&quot;;&quot;$(OGRE_PATH)/Samples/Common/include&quot;;../include/IMG;../include/BBC;../include/LBBC;../include/OBA;D:\design_04_11_2005\svn\NonGTP\Boost"
+				AdditionalOptions="/D &quot;TIXML_USE_STL&quot; /D &quot;TIXML_USE_STL&quot; /D &quot;OBA_LIB_BUILD&quot;  /D &quot;IMG_LIB_BUILD&quot;"
+				AdditionalIncludeDirectories="&quot;$(OGRE_PATH)/OgreMain/include&quot;;&quot;$(OGRE_PATH)/Tools/XMLConverter/include&quot;;&quot;$(OGRE_PATH)/Samples/Common/include&quot;;../include/IMG;../include/BBC;../include/LBBC;../include/OBA;D:\design_04_11_2005\svn\NonGTP\Boost;D:\design_04_11_2005\svn\NonGTP\ImageDebugger\include"
 				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
 				RuntimeLibrary="2"
@@ -92,8 +92,8 @@
 				Name="VCLinkerTool"
 				AdditionalOptions=" /IMPLIB:&quot;..\bin\release\$(ProjectName).lib&quot; "
-				AdditionalDependencies="OgreMain.lib"
+				AdditionalDependencies="OgreMain.lib imdebug.lib"
 				LinkIncremental="1"
 				SuppressStartupBanner="TRUE"
-				AdditionalLibraryDirectories="$(OGRE_PATH)/OgreMain/lib/$(ConfigurationName)"
+				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)/OgreMain/lib/$(ConfigurationName)&quot;;D:\design_04_11_2005\svn\NonGTP\ImageDebugger\lib"
 				SubSystem="1"
 				OptimizeReferences="2"
@@ -223,4 +223,10 @@
 				</File>
 				<File
+					RelativePath="..\src\LBBCClusterViewMode.cpp">
+				</File>
+				<File
+					RelativePath="..\src\LBBCEntityTextureAtlasViewMode.cpp">
+				</File>
+				<File
 					RelativePath="..\src\LBBCKdTreeClusterGenerator.cpp">
 				</File>
@@ -288,4 +294,10 @@
 				<File
 					RelativePath="..\src\IMGPlane3.cpp">
+				</File>
+				<File
+					RelativePath="..\src\IMGTexture.cpp">
+				</File>
+				<File
+					RelativePath="..\src\IMGTextureAtlas.cpp">
 				</File>
 			</Filter>
@@ -417,4 +429,7 @@
 				</File>
 				<File
+					RelativePath="..\include\Lbbc\LBBCEntityTextureAtlasViewMode.h">
+				</File>
+				<File
 					RelativePath="..\include\Lbbc\LBBCKdTreeClusterGenerator.h">
 				</File>
@@ -491,4 +506,10 @@
 				<File
 					RelativePath="..\include\Img\IMGPrerequisites.h">
+				</File>
+				<File
+					RelativePath="..\include\Img\IMGTexture.h">
+				</File>
+				<File
+					RelativePath="..\include\Img\IMGTextureAtlas.h">
 				</File>
 			</Filter>
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/scripts/IBRBillboardCloudTreeGeneratorCommandLine.vcproj
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/scripts/IBRBillboardCloudTreeGeneratorCommandLine.vcproj	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/scripts/IBRBillboardCloudTreeGeneratorCommandLine.vcproj	(revision 731)
@@ -20,5 +20,5 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="../include;../include/BBC;../include/IMG;../include/OBA;../include/LBBC;&quot;$(OGRE_PATH)/OgreMain/include&quot;;&quot;$(OGRE_PATH)/Tools/XMLConverter/include&quot;;D:\design_04_11_2005\svn\NonGTP\Boost"
+				AdditionalIncludeDirectories="../include;../include/BBC;../include/IMG;../include/OBA;../include/LBBC;&quot;$(OGRE_PATH)/OgreMain/include&quot;;&quot;$(OGRE_PATH)/Tools/XMLConverter/include&quot;;D:\design_04_11_2005\svn\NonGTP\Boost;D:\design_04_11_2005\svn\NonGTP\ImageDebugger\include"
 				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
 				MinimalRebuild="TRUE"
@@ -33,8 +33,8 @@
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="IBRBillboardCloudTreeGenerator_d.lib OgreMain_d.lib"
+				AdditionalDependencies="IBRBillboardCloudTreeGenerator_d.lib OgreMain_d.lib imdebug.lib"
 				OutputFile="$(OutDir)/IBRBillboardCloudTreeGeneratorCmd_d.exe"
 				LinkIncremental="2"
-				AdditionalLibraryDirectories="../bin/$(ConfigurationName);$(OGRE_PATH)/OgreMain/lib/$(ConfigurationName)"
+				AdditionalLibraryDirectories="&quot;../bin/$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)/OgreMain/lib/$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)/OgreMain/lib/Release&quot;;D:\design_04_11_2005\svn\NonGTP\ImageDebugger\lib"
 				GenerateDebugInformation="TRUE"
 				ProgramDatabaseFile="$(OutDir)/scripts.pdb"
@@ -70,5 +70,5 @@
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="../include;../include/OBA;../include/BBC;../include/IMG;../include/LBBC;&quot;$(OGRE_PATH)/OgreMain/include&quot;;&quot;$(OGRE_PATH)/Tools/XMLConverter/include&quot;;D:\design_04_11_2005\svn\NonGTP\Boost"
+				AdditionalIncludeDirectories="../include;../include/OBA;../include/BBC;../include/IMG;../include/LBBC;&quot;$(OGRE_PATH)/OgreMain/include&quot;;&quot;$(OGRE_PATH)/Tools/XMLConverter/include&quot;;D:\design_04_11_2005\svn\NonGTP\Boost;D:\design_04_11_2005\svn\NonGTP\ImageDebugger\include"
 				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
 				RuntimeLibrary="0"
@@ -81,8 +81,8 @@
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="IBRBillboardCloudTreeGenerator.lib OgreMain.lib"
+				AdditionalDependencies="IBRBillboardCloudTreeGenerator.lib OgreMain.lib imdebug.lib"
 				OutputFile="$(OutDir)/IBRBillboardCloudTreeGeneratorCmd.exe"
 				LinkIncremental="1"
-				AdditionalLibraryDirectories="../bin/$(ConfigurationName);$(OGRE_PATH)/OgreMain/lib/$(ConfigurationName)"
+				AdditionalLibraryDirectories="&quot;../bin/$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)/OgreMain/lib/$(ConfigurationName)&quot;;D:\design_04_11_2005\svn\NonGTP\ImageDebugger\lib"
 				GenerateDebugInformation="TRUE"
 				SubSystem="1"
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/OBAOgreFrameListener.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/OBAOgreFrameListener.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/OBAOgreFrameListener.cpp	(revision 731)
@@ -39,4 +39,8 @@
 OgreFrameListener::~OgreFrameListener()
 {
+		for (unsigned int iOgreFrameListenerMode = 0; iOgreFrameListenerMode < this->getNumFrameListenerModes(); iOgreFrameListenerMode++)
+		{
+			this->removeFrameListenerMode(iOgreFrameListenerMode);		
+		}
 		if (mInputTypeSwitchingOn)
 		{
@@ -48,16 +52,11 @@
         else
         {
-			if (mInputDevice)
-			{
-				Ogre::PlatformManager::getSingleton().destroyInputReader( mInputDevice );
-			}
+			// Gametools -- BUG: 06/04/2006
+			//if (mInputDevice)
+			//{
+			//	Ogre::PlatformManager::getSingleton().destroyInputReader( mInputDevice );
+			//}
+			//delete mInputDevice;
         }
-
-		for (unsigned int iOgreFrameListenerMode = 0; iOgreFrameListenerMode < this->getNumFrameListenerModes(); iOgreFrameListenerMode++)
-		{
-			OBA::OgreFrameListenerMode *ogreFrameListenerMode = this->getFrameListenerMode(iOgreFrameListenerMode);
-			this->removeFrameListenerMode(iOgreFrameListenerMode);
-			delete ogreFrameListenerMode;
-		}
 }
 
@@ -91,4 +90,6 @@
     }
 
+	mWindow->setDebugText("P: " + mDefaultOgreFrameListenerMode->getSceneManager()->getName() + " -- " + Ogre::StringConverter::toString(mTimeUntilNextToggle));
+
 	return mDefaultOgreFrameListenerMode->frameStarted(evt,mInputDevice);
 }
@@ -107,5 +108,5 @@
 		mWindow->setDebugText("P: " + mDefaultOgreFrameListenerMode->getSceneManager()->getName());
 
-		mTimeUntilNextToggle = 1;
+		mTimeUntilNextToggle = 0.25;
     }
 
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/OBAOgreApplication.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/OBAOgreApplication.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/OBAOgreApplication.cpp	(revision 731)
@@ -14,8 +14,8 @@
 {
 	// Gametools -- BUG: 31/03/2006
-	//if (mFrameListener)
-	//{
-	//	delete mFrameListener;
-	//}
+	if (mFrameListener)
+	{
+		delete mFrameListener;
+	}
 
 	//if (mOgreBase)
@@ -76,6 +76,6 @@
 		// You can skip this and use root.restoreConfig() to load configuration
 		// settings if you were sure there are valid ones saved in ogre.cfg
-		//if(mRoot->showConfigDialog())
-		if (mRoot->restoreConfig())
+		if(mRoot->showConfigDialog())
+		//if (mRoot->restoreConfig())
 		{
 			// If returned true, user clicked OK so initialise
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCMesh.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCMesh.cpp	(revision 731)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCMesh.cpp	(revision 731)
@@ -0,0 +1,15 @@
+
+#include "BBCMesh.h"
+
+namespace BBC {
+
+
+Mesh::~Mesh()	 
+{
+	Ogre::LogManager::getSingleton().logMessage("Destroy Mesh...");
+	Ogre::MeshManager::getSingleton().unload( this->get()->getName() );
+	Ogre::MeshManager::getSingleton().remove( this->get()->getName() );
+	//delete mMesh;
+}
+
+}
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGCluster2d.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGCluster2d.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGCluster2d.cpp	(revision 731)
@@ -13,15 +13,15 @@
 }
 
-Ogre::Vector2 * Cluster2d::GetVector3s()
+Ogre::Vector2 * Cluster2d::getVector3s()
 { 
 	return Vector3s; 
 }
 
-std::vector<Ogre::Vector2> * Cluster2d::GetVector3sVector() 
+std::vector<Ogre::Vector2> * Cluster2d::getVector3sVector() 
 { 
 	return &Vector3s2_vector; 
 } 
 
-Ogre::Vector3 * Cluster2d::GetNormal() 
+Ogre::Vector3 * Cluster2d::getNormal() 
 { 
 	return normal; 
@@ -31,5 +31,5 @@
 //			
 //	 
-int Cluster2d::Create2d(Cluster * cluster, int type, int type_vertexs) 
+int Cluster2d::create2d(Cluster * cluster, int type, int type_vertexs) 
 {
 	if (!cluster)
@@ -38,5 +38,5 @@
 	}
 	
-	int axis = cluster->AxisProjected();
+	int axis = cluster->axisProjected();
 
 	this->cluster = cluster;
@@ -45,7 +45,7 @@
 }
 
-void Cluster2d::Print() 
+void Cluster2d::print() 
 {
-	printf("\nPrintant cluster2d: %d", id);
+	Ogre::LogManager::getSingleton().logMessage("Printant cluster2d: " + Ogre::StringConverter::toString(id));
 }
 
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCEntityTextureAtlasViewMode.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCEntityTextureAtlasViewMode.cpp	(revision 731)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCEntityTextureAtlasViewMode.cpp	(revision 731)
@@ -0,0 +1,171 @@
+
+#include "LBBCEntityTextureAtlasViewMode.h"
+
+namespace LBBC 
+{
+
+EntityTextureAtlasViewMode::EntityTextureAtlasViewMode(Ogre::RenderWindow* win, unsigned int ogreFrameListenerModeHandle, bool useBufferedInputKeys, bool useBufferedInputMouse)
+:OBA::OgreFrameListenerMode(win, ogreFrameListenerModeHandle, useBufferedInputKeys, useBufferedInputMouse)
+{	
+	mTextureAtlasGenerated = false;
+	mFrame = 0;
+	mDebugOverlay->setScale(0.0, 0.0);
+}
+
+EntityTextureAtlasViewMode::~EntityTextureAtlasViewMode()
+{
+	// Gametools -- BUG: 06/04/2006
+	//destroyScene();
+}
+
+void EntityTextureAtlasViewMode::setTextureAtlasFolder(Ogre::String textureAtlasFolder)
+{
+	mTextureAtlasFolder = textureAtlasFolder;
+}
+
+void EntityTextureAtlasViewMode::setTextureName(Ogre::String textureName)
+{
+	mTextureName = textureName;
+}
+
+void EntityTextureAtlasViewMode::setTextureAtlasName(Ogre::String textureAtlasName)
+{
+	mTextureAtlasName = textureAtlasName;
+}
+
+void EntityTextureAtlasViewMode::setTextureAtlasSize(unsigned int size)
+{
+	mTextureAtlasSize = size;
+}
+
+void EntityTextureAtlasViewMode::setTextureAtlasNumSamples(unsigned int numSamples)
+{
+	mNumSamples = numSamples;
+}
+
+void EntityTextureAtlasViewMode::setTextureAtlasBitRange(unsigned int bitRange)
+{
+	mBitRange = bitRange;
+}
+
+unsigned int EntityTextureAtlasViewMode::nextPowerOf2(unsigned int nPlanes)
+{
+	unsigned int depth = 1;
+	while (depth < nPlanes)
+	{
+		depth = depth << 1;
+	}
+	return depth;
+}
+
+bool EntityTextureAtlasViewMode::frameStarted(const Ogre::FrameEvent& evt, Ogre::InputReader *inputReader)
+{
+	if (mFrame == 1)
+	{
+		if (!mTextureAtlasGenerated)
+		{
+			if (mBitRange == 32)
+			{
+				mDestPixelFormat = Ogre::PF_FLOAT32_RGBA;
+			}
+			else if (mBitRange == 16)
+			{
+				mDestPixelFormat = Ogre::PF_FLOAT16_RGBA;
+			}
+			else  // mBitRange == 8
+			{
+				mDestPixelFormat = Ogre::PF_A8R8G8B8;
+			}
+
+			mTextureAtlas->update();
+			mTextureAtlas->save(mTextureAtlasFolder, mTextureAtlasName, mDestPixelFormat);
+			mTextureAtlasGenerated = true;
+		}
+	}
+
+	mFrame++;
+
+	return OgreFrameListenerMode::frameStarted(evt, inputReader);	
+}
+
+
+void EntityTextureAtlasViewMode::createScene()
+{
+	mTextureAtlasNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
+	mTextureAtlas = IMG::TextureAtlasPtr( new IMG::TextureAtlas() );
+
+	if (mBitRange == 32)
+	{
+		mSrcPixelFormat = Ogre::PF_FLOAT32_RGBA;
+	}
+	else if (mBitRange == 16)
+	{
+		mSrcPixelFormat = Ogre::PF_FLOAT16_RGBA;
+	}
+	else  // mBitRange == 8
+	{
+		mSrcPixelFormat = Ogre::PF_A8R8G8B8;
+	}
+
+	mTextureAtlas->create(mTextureAtlasName, mTextureAtlasSize, mTextureAtlasSize, mSrcPixelFormat, mCamera);
+	mTextureAtlas->setTextureAtlasSceneNode(mTextureAtlasNode);
+
+	unsigned int numSubTextures = mNumSamples;			
+	Ogre::Vector2 maxTexCoords(1.0, 1.0);
+	unsigned int irow = 1;
+	unsigned int icol = 1;
+	unsigned int nrow = Ogre::Math::Sqrt(nextPowerOf2(numSubTextures));
+	Ogre::Real step = 2.0 / nrow;
+	Ogre::Real degreeStep = 360.0 / numSubTextures;
+	Ogre::Real degree = 0.0;
+
+	IMG::TexturePtr texturePtr ( new IMG::Texture() );
+	texturePtr->bind(mTextureName);
+	Ogre::MaterialPtr materialPtr = Ogre::MaterialManager::getSingleton().create("TextureAtlas" + Ogre::StringConverter::toString(numSubTextures), "General");		
+	materialPtr->getTechnique(0)->getPass(0)->setDiffuse( 1.0, 1.0, 1.0, 0.0);
+	materialPtr->getTechnique(0)->getPass(0)->setAmbient( texturePtr->getAvgColour() );	
+
+	mTextureAtlas->setMaterial(materialPtr.getPointer());	
+	mTextureAtlas->setCorners(-1.0, 1.0, 1.0, -1.0);	
+
+	for (unsigned int iSubTexture = 0; iSubTexture < numSubTextures; iSubTexture++)
+	{				
+		IMG::TexturePtr texturePtr = IMG::TexturePtr( new IMG::Texture() );
+		Ogre::MaterialPtr materialPtr = Ogre::MaterialManager::getSingleton().create("TextureAtlas" + Ogre::StringConverter::toString(iSubTexture), "General");		
+		materialPtr->getTechnique(0)->getPass(0)->setAmbient( 1.0, Ogre::Math::RangeRandom(0.5,1.0), 1.0 );
+		materialPtr->getTechnique(0)->getPass(0)->setAmbient(maxTexCoords[0], maxTexCoords[1], 1.0 );
+		materialPtr->getTechnique(0)->getPass(0)->setDiffuse( 1.0, 1.0, 1.0, 1.0);
+		materialPtr->getTechnique(0)->getPass(0)->setAlphaRejectSettings(Ogre::CMPF_GREATER_EQUAL, 10);
+		materialPtr->getTechnique(0)->getPass(0)->createTextureUnitState(mTextureName, 0);
+		materialPtr->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureAddressingMode(Ogre::TextureUnitState::TAM_CLAMP);
+		materialPtr->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureRotate(Ogre::Radian(Ogre::Degree(degree)));
+		materialPtr->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureFiltering(Ogre::FO_NONE, Ogre::FO_NONE, Ogre::FO_NONE);
+		materialPtr->getTechnique(0)->getPass(0)->setLightingEnabled(false);
+		
+		texturePtr->setMaterial(materialPtr.getPointer());
+		texturePtr->setCorners(maxTexCoords[0] - step, maxTexCoords[1], maxTexCoords[0], maxTexCoords[1] - step);
+	
+		mTextureAtlas->addTexture(texturePtr);
+
+		if (irow == nrow)
+		{
+			irow = 1;
+			icol++;
+			maxTexCoords = Ogre::Vector2(1.0, maxTexCoords[1] - step);
+		}
+		else
+		{
+			irow++;
+			maxTexCoords = Ogre::Vector2(maxTexCoords[0] - step, maxTexCoords[1]);
+		}
+
+		degree = degree + degreeStep;
+	}
+}
+
+void EntityTextureAtlasViewMode::destroyScene()
+{
+	mTextureAtlasNode->detachAllObjects();
+}
+
+}
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/OBAOgreBase.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/OBAOgreBase.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/OBAOgreBase.cpp	(revision 731)
@@ -29,13 +29,13 @@
 	return mXMLMeshSerializer;
 }
-	
+
+Ogre::MaterialSerializer* OgreBase::getMaterialSerializer()
+{
+	return mMaterialSerializer;
+}
+
 Ogre::MeshSerializer* OgreBase::getMeshSerializer()
 {
 	return mMeshSerializer;
-}
-
-Ogre::MeshManager* OgreBase::getMeshManager()
-{
-	return mMeshManager;
 }
 
@@ -48,5 +48,7 @@
    mMath = new Ogre::Math();
    mMeshManager = new Ogre::MeshManager();
-   //mMaterialManager = new Ogre::MaterialManager();
+   mMaterialManager = new Ogre::MaterialManager();
+   mMaterialManager->initialise();
+   mMaterialSerializer = new Ogre::MaterialSerializer();
    mMeshSerializer = new Ogre::MeshSerializer();
    mXMLMeshSerializer = new Ogre::XMLMeshSerializer();
@@ -79,4 +81,9 @@
 	}
 
+	if (mMaterialSerializer)
+	{
+		delete mMaterialSerializer;
+	}
+
 	if (mMath)
 	{
@@ -89,9 +96,9 @@
 	}
 
-	//if (mMaterialManager)
-	//{
-	//	mMaterialManager->removeAll();
-	//	delete mMaterialManager;	
-	//}
+	if (mMaterialManager)
+	{
+		mMaterialManager->removeAll();
+		delete mMaterialManager;	
+	}
 
 	if (mResourceGroupManager)
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCOgreMeshSerializer.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCOgreMeshSerializer.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCOgreMeshSerializer.cpp	(revision 731)
@@ -53,5 +53,5 @@
 		BBC::MeshPtr pMesh(new BBC::Mesh(Ogre::MeshManager::getSingleton().createManual(fileName, fileName).getPointer()));
 		
-		Ogre::MeshPtr mesh = OBA::OgreBase::getSingleton().getMeshManager()->load(fileName, fileName);
+		Ogre::MeshPtr mesh = Ogre::MeshManager::getSingleton().load(fileName, fileName);
 
 		Ogre::LogManager::getSingleton().logMessage("Num.SubEntities:" + Ogre::StringConverter::toString(mEntity->getNumSubEntities()));
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGPlane3.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGPlane3.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGPlane3.cpp	(revision 731)
@@ -21,5 +21,5 @@
 }
 
-Ogre::Vector3 * Plane3::GetNormal() 
+Ogre::Vector3 * Plane3::getNormal() 
 {
 	Ogre::Vector3 *v = new Ogre::Vector3;
@@ -30,5 +30,5 @@
 }
 
-void Plane3::SetNormal(float x, float y, float z) 
+void Plane3::setNormal(float x, float y, float z) 
 {
     normal.x = x;
@@ -37,15 +37,15 @@
 }
 
-void Plane3::SetDistance(float dist) 
+void Plane3::setDistance(float dist) 
 {
     d = dist;
 }
 
-float Plane3::GetDistance() const 
+float Plane3::getDistance() const 
 { 
 	return d;
 }
 
-void Plane3::Print() 
+void Plane3::print() 
 {
 	Ogre::LogManager::getSingleton().logMessage("Printant pla: (" + Ogre::StringConverter::toString(normal) + Ogre::StringConverter::toString(d) + ")");
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGBsp.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGBsp.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGBsp.cpp	(revision 731)
@@ -14,5 +14,5 @@
 }
 
-void Bsp::SetRoot(NodeBspPtr node) 
+void Bsp::setRoot(NodeBspPtr node) 
 {
     root = node;
@@ -20,22 +20,22 @@
 }
 
-void Bsp::Print() 
+void Bsp::print() 
 {
 	Ogre::LogManager::getSingleton().logMessage("\nImprimint Arbre BSP, num nodes leaf: " + Ogre::StringConverter::toString(countleaf) + ", totals: " + Ogre::StringConverter::toString(counttotal));
-    Print(root);
+    print(root);
 }
 
-void Bsp::PrintLeaf()
+void Bsp::printLeaf()
 {
-  	PrintLeaf(root);
+  	printLeaf(root);
 }
 
-NodeBspPtr Bsp::Insert(int w, int h, int idcluster) 
+NodeBspPtr Bsp::insert(int w, int h, int idcluster) 
 {
-    NodeBspPtr node = root->Insert(w,h);
+    NodeBspPtr node = root->insert(w,h);
 
 	if (idcluster != -1)
     {
-    	node->SetId (idcluster);
+    	node->setId(idcluster);
     	countleaf++;			
     }
@@ -48,25 +48,25 @@
 }
 
-NodeBspPtr Bsp::Get(int i) 
+NodeBspPtr Bsp::get(int i) 
 {
-	return root->Get(root, i);
+	return root->get(root, i);
 }
 
-void Bsp::Print(NodeBspPtr node) 
+void Bsp::print(NodeBspPtr node) 
 {
-    node->Print();
-    Print(node->GetChild(0));
-    Print(node->GetChild(1));
+    node->print();
+    this->print(node->getChild(0));
+    this->print(node->getChild(1));
 }
 
-void Bsp::PrintLeaf(NodeBspPtr node) 
+void Bsp::printLeaf(NodeBspPtr node) 
 {   	
-    if (node->GetChild(0) == NULL && node->GetChild(1) == NULL)
+    if (node->getChild(0) == NULL && node->getChild(1) == NULL)
 	{
-		node->Print();
+		node->print();
 	}
     	
-    PrintLeaf (node->GetChild(0));
-    PrintLeaf (node->GetChild(1));	
+    printLeaf(node->getChild(0));
+    printLeaf(node->getChild(1));	
 }
 
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IBRBillboardCloudTreeApplication.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IBRBillboardCloudTreeApplication.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IBRBillboardCloudTreeApplication.cpp	(revision 731)
@@ -19,9 +19,10 @@
 	for (unsigned int i = 0; i < 1; i++)
 	{
+		mSampleConfigFile = new LBBC::SampleConfigFile();
+		mSampleConfigFile->load(mOpts.cfg);
+
 		this->setup(false);
-		mLBBCManager = new LBBC::Manager();	
-		LBBC::SampleConfigFile *sampleConfigFile = new LBBC::SampleConfigFile();
-		sampleConfigFile->load(mOpts.cfg);
-		mLBBCManager->setSampleConfigFile(sampleConfigFile);	
+		mLBBCManager = new LBBC::LBBCManager();	
+		mLBBCManager->setSampleConfigFile(mSampleConfigFile);	
 		//mLBBCManager->loadSampleConfigFile(mOpts.cfg);
 		mLBBCManager->runSampleConfigFile();	
@@ -33,8 +34,14 @@
 		this->setup(true);
 		this->go();	
+		for (unsigned int iFrameListenerMode = 0; iFrameListenerMode < mFrameListener->getNumFrameListenerModes(); iFrameListenerMode++)
+		{
+			mFrameListener->getFrameListenerMode(iFrameListenerMode)->destroyScene();
+		}
 		mRoot->shutdown();	
 		mWindow->destroy();		
 		delete mRoot;
+		delete mSampleConfigFile;
 	}
+
 }
 
@@ -108,7 +115,8 @@
 	
 	mSceneMgr = mFrameListener->getEnabledFrameListenerMode()->getSceneManager();	
+
 	{
-		LBBC::ClustersViewMode *anotherFrameListenerMode;
-		anotherFrameListenerMode = new LBBC::ClustersViewMode(mWindow,mFrameListener->getNumFrameListenerModes());
+		LBBC::ClusterViewMode *anotherFrameListenerMode;
+		anotherFrameListenerMode = new LBBC::ClusterViewMode(mWindow,mFrameListener->getNumFrameListenerModes());
 		anotherFrameListenerMode->chooseSceneManager();
 		anotherFrameListenerMode->createCamera();
@@ -118,16 +126,33 @@
 	}
 
+	//{
+	//	LBBC::BillboardViewMode *anotherFrameListenerMode;
+	//	anotherFrameListenerMode = new LBBC::BillboardViewMode(mWindow,mFrameListener->getNumFrameListenerModes());
+	//	anotherFrameListenerMode->chooseSceneManager();
+	//	anotherFrameListenerMode->createCamera();
+	//	anotherFrameListenerMode->createViewports();
+	//	anotherFrameListenerMode->createScene();
+	//	mFrameListener->addFrameListenerMode(anotherFrameListenerMode);
+	//}
+
 	{
-		LBBC::BillboardViewMode *anotherFrameListenerMode;
-		anotherFrameListenerMode = new LBBC::BillboardViewMode(mWindow,mFrameListener->getNumFrameListenerModes());
-		anotherFrameListenerMode->chooseSceneManager();
-		anotherFrameListenerMode->createCamera();
-		anotherFrameListenerMode->createViewports();
-		anotherFrameListenerMode->createScene();
-		mFrameListener->addFrameListenerMode(anotherFrameListenerMode);
+		LBBC::EntityTextureAtlasViewMode *textureAtlasFrameListenerMode;
+		textureAtlasFrameListenerMode = new LBBC::EntityTextureAtlasViewMode(mWindow,mFrameListener->getNumFrameListenerModes());
+		textureAtlasFrameListenerMode->chooseSceneManager();
+		textureAtlasFrameListenerMode->createCamera();
+		textureAtlasFrameListenerMode->createViewports();
+		textureAtlasFrameListenerMode->setTextureAtlasSize(mSampleConfigFile->getBillboardCloudDiffuseColorEntityTextureAtlasSize());
+		textureAtlasFrameListenerMode->setTextureAtlasBitRange(mSampleConfigFile->getBillboardCloudDiffuseColorEntityTextureAtlasBitRange());
+		textureAtlasFrameListenerMode->setTextureAtlasNumSamples(mSampleConfigFile->getBillboardCloudDiffuseColorEntityTextureAtlasNumSamples());
+		textureAtlasFrameListenerMode->setTextureName(mSampleConfigFile->getBillboardCloudDiffuseColorEntityTexturePrefixName());
+		textureAtlasFrameListenerMode->setTextureAtlasName(mSampleConfigFile->getBillboardCloudDiffuseColorEntityTextureAtlasPrefixName());
+		textureAtlasFrameListenerMode->setTextureAtlasFolder(mSampleConfigFile->getBillboardCloudFolder());
+
+		mFrameListener->addFrameListenerMode(textureAtlasFrameListenerMode);
+		textureAtlasFrameListenerMode->createScene();
 	}
 
-	mFrameListener->setEnabledFrameListenerMode(1);
 	mFrameListener->removeFrameListenerMode(0);
+	mFrameListener->setEnabledFrameListenerMode(0);
 
     mRoot->addFrameListener(mFrameListener);
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGNodeBsp.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGNodeBsp.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGNodeBsp.cpp	(revision 731)
@@ -15,30 +15,30 @@
 }
 
-void NodeBsp::SetBound(Box2d * box) 
+void NodeBsp::setBound(Box2d * box) 
 { 
 	bound = (*box); 
 }
 
-NodeBspPtr NodeBsp::GetChild(int i) 
+NodeBspPtr NodeBsp::getChild(int i) 
 { 
 	return child[i]; 
 }
 
-void NodeBsp::SetId(int id_) 
+void NodeBsp::setId(int id_) 
 { 
 	id = id_; 
 }
 
-unsigned int NodeBsp::GetId() const
+unsigned int NodeBsp::getId() const
 { 
 	return id; 
 }
 
-void NodeBsp::SetChild(NodeBspPtr node, int i) 
+void NodeBsp::setChild(NodeBspPtr node, int i) 
 { 
 	child[i] = node; 
 }
 
-NodeBspPtr NodeBsp::Get(NodeBspPtr node, int i) 
+NodeBspPtr NodeBsp::get(NodeBspPtr node, int i) 
 {
     if (!node)
@@ -47,5 +47,5 @@
 	}
 
-    if (node->GetId() == i )
+    if (node->getId() == i )
 	{
 		return node;
@@ -53,26 +53,26 @@
     
     NodeBspPtr nod; 
-    if (nod = node->GetChild(0)->Get(node->GetChild(0), i)) 
+    if (nod = node->getChild(0)->get(node->getChild(0), i)) 
 	{
 		return nod;
 	}
     
-    return node->GetChild(0)->Get(node->GetChild(1), i);
+    return node->getChild(0)->get(node->getChild(1), i);
 }
 
 
-Box2d * NodeBsp::GetBound() 
+Box2d * NodeBsp::getBound() 
 { 
 	return &bound;   
 }
 
-void NodeBsp::Print() 
+void NodeBsp::print() 
 {
 	Ogre::LogManager::getSingleton().logMessage("Node : " + Ogre::StringConverter::toString(id) + ", fit: " + Ogre::StringConverter::toString(fit));
 
-	bound.Print();
+	bound.print();
 }
 
-NodeBspPtr NodeBsp::Insert(int w, int h) 
+NodeBspPtr NodeBsp::insert(int w, int h) 
 {
 	//Ogre::LogManager::getSingleton().logMessage("\nInsert del node: :" + Ogre::StringConverter::toString(id) + " (" + Ogre::StringConverter::toString(w) + ", " + Ogre::StringConverter::toString(h));
@@ -85,17 +85,17 @@
 	if (this->child[0] != NULL && this->child[1] != NULL)
 	{
-		NodeBspPtr new_node = child[0]->Insert(w, h);
+		NodeBspPtr new_node = child[0]->insert(w, h);
 		
 		if (new_node) return new_node;
 		
-		return child[1]->Insert(w,h);
+		return child[1]->insert(w,h);
 	}
 	
-	if (!bound.In (w,h)) 
+	if (!bound.in(w,h)) 
 	{
 		return NULL; 
 	}
 	
-	if (bound.FitPerfect(w,h))
+	if (bound.fitPerfect(w,h))
 	{
 		fit = true;  return this; 
@@ -109,7 +109,7 @@
 	float width, height;
 	
-	bound.Print();
-	min = bound.GetMinimum();
-	max = bound.GetMaximum();
+	bound.print();
+	min = bound.getMinimum();
+	max = bound.getMaximum();
 	
 	width = max.x - min.x;
@@ -121,14 +121,14 @@
 	if (dw > dh)
 	{	
-		child[0]->bound.SetBoundBox(min.x, min.y, min.x + w, max.y);		
-		child[1]->bound.SetBoundBox(min.x + w, min.y, max.x, max.y);										
+		child[0]->bound.setBoundBox(min.x, min.y, min.x + w, max.y);		
+		child[1]->bound.setBoundBox(min.x + w, min.y, max.x, max.y);										
 	}
 	else
 	{		
-		child[0]->bound.SetBoundBox(min.x, max.y - h, max.x, max.y);
-		child[1]->bound.SetBoundBox(min.x, min.y, max.x, max.y - h);
+		child[0]->bound.setBoundBox(min.x, max.y - h, max.x, max.y);
+		child[1]->bound.setBoundBox(min.x, min.y, max.x, max.y - h);
 	}
 	
-	return child[0]->Insert(w, h);
+	return child[0]->insert(w, h);
 }
 
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGTexture.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGTexture.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGTexture.cpp	(revision 731)
@@ -2,73 +2,187 @@
 #include "IMGTexture.h"
 
-namespace IMG {
+namespace IMG 
+{
 
-    Texture::Texture()
+Texture::Texture(): references(0) // initialize references to 0
+{
+	mTexture = 0;
+	mWidth = 0;
+	mHeight = 0;
+	mMaterial = 0;
+	mCalculatedAvgColour = false;
+	mRectangle2D = new Ogre::Rectangle2D(true);
+	mRectangle2D->setBoundingBox(Ogre::AxisAlignedBox(-100000.0 * Ogre::Vector3::UNIT_SCALE, 100000.0 * Ogre::Vector3::UNIT_SCALE));
+	mRectangle2D->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY);
+}
+
+Texture::~Texture()
+{
+	// Gametools -- BUG: 06/04/2006
+	//if (mRectangle2D)
+	//{
+	//	delete mRectangle2D;
+	//}
+
+	//if (mMaterial)
+	//{
+	//	delete mMaterial;
+	//}
+}
+
+Ogre::Rectangle2D* Texture::getRectangle2D()
+{
+	return mRectangle2D;
+}
+
+void Texture::setCorners(Ogre::Real left, Ogre::Real top, Ogre::Real right, Ogre::Real bottom)
+{
+	mRectangle2D->setCorners(left, top, right, bottom);
+}
+
+void Texture::bind(Ogre::String textureName)
+{		
+	if (!Ogre::TextureManager::getSingleton().getByName(textureName).isNull())
 	{
+		mTexture = (Ogre::Texture*) Ogre::TextureManager::getSingleton().getByName(textureName).getPointer();
+		mWidth = mTexture->getSrcWidth();
+		mHeight = mTexture->getSrcHeight();
+	}
+	else
+	{
+		Ogre::TexturePtr tPtr = Ogre::TextureManager::getSingleton().load(textureName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+
+		mTexture = (Ogre::Texture*) tPtr.getPointer();
+		mWidth = mTexture->getSrcWidth();
+		mHeight = mTexture->getSrcHeight();
+	}
+}
+
+void Texture::setBackgroundColour(Ogre::ColourValue colour)
+{
+	mBackgroundColour = colour;
+}
+
+Ogre::ColourValue Texture::getBackgroundColour()
+{
+	return mBackgroundColour;
+}
+
+Ogre::ColourValue Texture::getAvgColour()
+{
+	if (mCalculatedAvgColour)
+	{
+		return mAvgColour;
+	}
+	else
+	{
+		calculateAvgColour();
+		return mAvgColour;
+	}
+}
+
+void Texture::calculateAvgColour()
+{
+	unsigned int cR = 0;
+	unsigned int cG = 0;
+	unsigned int cB = 0;
+	unsigned int cA = 0;
+
+	Ogre::Image img;
+	img.load(mTexture->getName(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 
+	unsigned char* data = static_cast<unsigned char*>(img.getData());
+
+	unsigned int nColorpixels = 1;
+
+	for (unsigned int i = 0; i < mTexture->getWidth() * mTexture->getHeight() * 4; i=i+4)
+	{
+		cA = (unsigned short int)data[i+3];
+		if (cA != 0)
+		{
+			cB = cB + data[i+2];
+			cG = cG + data[i+1];
+			cR = cR + data[i];				
+
+			nColorpixels++;
+			//Ogre::LogManager::getSingleton().logMessage("(" + Ogre::StringConverter::toString(data[i]) + "," + Ogre::StringConverter::toString(data[i+1]) + "," + Ogre::StringConverter::toString(data[i+2]) + "," + Ogre::StringConverter::toString(data[i+3]) + ")");
+		}					
 	}
 
-    virtual Texture::~Texture()
-	{
-	}
+	cR = cR / nColorpixels;
+	cG = cG / nColorpixels;
+	cB = cB / nColorpixels;
 
-    void Texture::setTextureHandle(unsigned int textureHandle)
-	{
-		mTextureHandle = textureHandle;
-	}
+	mAvgColour = Ogre::ColourValue(cR/255.0, cG/255.0, cB/255.0, 0.0);
+	mCalculatedAvgColour = true;
+}
 
-    unsigned int Texture::getTextureHandle()
-	{
-		return mTextureHandle;
-	}
+void Texture::load(Ogre::String folderName, Ogre::String fileName)
+{
+	Ogre::TextureManager::getSingleton().load(fileName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+	mTexture = (Ogre::Texture*)Ogre::TextureManager::getSingleton().getByName(fileName).getPointer();
+	mWidth = mTexture->getSrcWidth();
+	mHeight = mTexture->getSrcHeight();
+}
 
-    Ogre::String Texture::getMaterialName()
-	{
-		return mMaterialName;
-	}
+void Texture::save(Ogre::String folderName, Ogre::String filename)
+{
+    Ogre::HardwarePixelBufferSharedPtr readbuffer;
+    readbuffer = mTexture->getBuffer(0, 0);
+	unsigned char *tex = new unsigned char[readbuffer->getSizeInBytes()];
+	Ogre::PixelBox *pBox = new Ogre::PixelBox(mTexture->getWidth(), mTexture->getHeight(), mTexture->getDepth(), mTexture->getFormat(), tex);
+    readbuffer->blitToMemory((*pBox));
+    
+    Ogre::Image img;
+    img = img.loadDynamicImage(tex, mTexture->getWidth(), mTexture->getHeight(), mTexture->getDepth(), mTexture->getFormat(), true, 1, 0);		
+	img.resize(mWidth, mHeight);
+    img.save(folderName + filename);
+	delete pBox;
+}
 
-    void Texture::setMaterialName(Ogre::String materialName)
-	{
-		mMaterialName = materialName;
-	}
+void Texture::rotate(Ogre::Real rRotation)
+{
+	//mTexture->setTextureRotate( Degree( -rRotation ) );
+}
 
-    void Texture::setWidth(unsigned int width)
-	{
-		mWidth = width;
-	}
+void Texture::setWidth(unsigned int width)
+{
+	mWidth = width;
+}
 
-    unsigned int Texture::getWidth()
-	{
-		return mWidth;
-	}
+unsigned int Texture::getWidth()
+{
+	return mWidth;
+}
 
-    void Texture::setHeight(unsigned int height)
-	{
-		mHeight = height;
-	}
+void Texture::setHeight(unsigned int height)
+{
+	mHeight = height;
+}
 
-    unsigned int Texture::getHeight()
-	{
-		return mHeight;
-	}
+unsigned int Texture::getHeight()
+{
+	return mHeight;
+}
 
-    void Texture::setRenderTargetName(Ogre::String renderTargetName)
-	{
-		mRenderTargetName = renderTargetName;
-	}
+void Texture::setTextureName(Ogre::String textureName)
+{
+	mTextureName = textureName;
+}
 
-    Ogre::String Texture::getRenderTarget()
-	{
-		return mRenderTargetName;
-	}
+Ogre::String Texture::getTextureName()
+{
+	return mTextureName;
+}
 
-    void Texture::setTextureName(Ogre::String textureName)
-	{
-		mTextureName = textureName;
-	}
+void Texture::setMaterial(Ogre::Material *material)
+{
+	mMaterial = material;
+	mRectangle2D->setMaterial(mMaterial->getName());
+}
 
-    Ogre::String Texture::getTextureName()
-	{
-		return mTextureName;
-	}
+Ogre::Material* Texture::getMaterial()
+{
+	return mMaterial;
+}
 
 }
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCClusterViewMode.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCClusterViewMode.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCClusterViewMode.cpp	(revision 731)
@@ -1,4 +1,4 @@
 
-#include "LBBCClustersViewMode.h"
+#include "LBBCClusterViewMode.h"
 
 namespace LBBC {
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCBillboardKMeansClusterData.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCBillboardKMeansClusterData.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCBillboardKMeansClusterData.cpp	(revision 731)
@@ -36,5 +36,4 @@
 	TiXmlNode *quadBottomRightCornerNode;
 	TiXmlNode *quadBottomLeftCornerNode;
-	TiXmlNode *axisXNode;
 	TiXmlNode *axisYNode;
 	TiXmlNode *axisZNode;
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCBillboardCloudUVMapper.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCBillboardCloudUVMapper.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCBillboardCloudUVMapper.cpp	(revision 731)
@@ -124,10 +124,10 @@
 	Ogre::LogManager::getSingleton().logMessage("iBBC:" + Ogre::StringConverter::toString(numGeneratedBillboardClouds) + "-" + "iBBCG:" + Ogre::StringConverter::toString(iBillboardGroup));
 
-	Ogre::LogManager::getSingleton().logMessage("SizeCLList:" + Ogre::StringConverter::toString(getClusterList(iBillboardGroup)->GetSize()) + " -- numBBC:" + Ogre::StringConverter::toString(numGeneratedBillboardClouds));
-
-	IMG::Cluster *cluster = getClusterList(iBillboardGroup)->Get(getClusterList(iBillboardGroup)->GetSize()-1);		
-	IMG::Box2d *box = cluster->GetBspNodeBound();
-	Ogre::Vector2 max = box->GetMaximum();
-	Ogre::Vector2 min = box->GetMinimum();
+	Ogre::LogManager::getSingleton().logMessage("SizeCLList:" + Ogre::StringConverter::toString(getClusterList(iBillboardGroup)->getSize()) + " -- numBBC:" + Ogre::StringConverter::toString(numGeneratedBillboardClouds));
+
+	IMG::Cluster *cluster = getClusterList(iBillboardGroup)->get(getClusterList(iBillboardGroup)->getSize()-1);		
+	IMG::Box2d *box = cluster->getBspNodeBound();
+	Ogre::Vector2 max = box->getMaximum();
+	Ogre::Vector2 min = box->getMinimum();
 	Ogre::LogManager::getSingleton().logMessage("Max:" + Ogre::StringConverter::toString(Ogre::Vector3(max[0],max[1],0)) + 
 		"\tMin:" + Ogre::StringConverter::toString(Ogre::Vector3(min[0],min[1],0)) + 
@@ -282,9 +282,9 @@
 	Ogre::LogManager::getSingleton().logMessage("w:" + Ogre::StringConverter::toString(mTextureWidth));
 	Ogre::LogManager::getSingleton().logMessage("h:" + Ogre::StringConverter::toString(mTextureHeight));
-	nodeDest = getBsp(iBillboardGroup)->Insert(mTextureWidth,mTextureHeight,iBillboard);
+	nodeDest = getBsp(iBillboardGroup)->insert(mTextureWidth,mTextureHeight,iBillboard);
 	
-	cluster.SetBspNodeBound(nodeDest->GetBound());
-	//cluster.Finish();
-	getClusterList(iBillboardGroup)->Insert(&cluster);	
+	cluster.setBspNodeBound(nodeDest->getBound());
+	//cluster.finish();
+	getClusterList(iBillboardGroup)->insert(&cluster);	
 }
 
@@ -353,6 +353,6 @@
 		IMG::NodeBspPtr node = IMG::NodeBspPtr(new IMG::NodeBsp);
 
-		node->GetBound()->SetBoundBox(0, 0, mTextureAtlasWidth, mTextureAtlasHeight);
-		bsp->SetRoot(node);	
+		node->getBound()->setBoundBox(0, 0, mTextureAtlasWidth, mTextureAtlasHeight);
+		bsp->setRoot(node);	
 
 		addBsp(bsp);
@@ -379,5 +379,5 @@
 				{
 					Ogre::LogManager::getSingleton().logMessage("\nA");
-					Ogre::LogManager::getSingleton().logMessage("IG:" + Ogre::StringConverter::toString(iBillboardsInGroup) + " SizeCLList(" + Ogre::StringConverter::toString(iBillboardGroup) + "):" + Ogre::StringConverter::toString(getClusterList(iBillboardGroup)->GetSize()) + " -- numBBC:" + Ogre::StringConverter::toString(numGeneratedBillboardClouds));
+					Ogre::LogManager::getSingleton().logMessage("IG:" + Ogre::StringConverter::toString(iBillboardsInGroup) + " SizeCLList(" + Ogre::StringConverter::toString(iBillboardGroup) + "):" + Ogre::StringConverter::toString(getClusterList(iBillboardGroup)->getSize()) + " -- numBBC:" + Ogre::StringConverter::toString(numGeneratedBillboardClouds));
 
 					addTextureInBsp(iBillboardGroup, iBillboard);
@@ -391,5 +391,5 @@
 					{
 						Ogre::LogManager::getSingleton().logMessage("\nB");
-						Ogre::LogManager::getSingleton().logMessage("IG:" + Ogre::StringConverter::toString(iBillboardsInGroup) + " SizeCLList(" + Ogre::StringConverter::toString(iBillboardGroup) + "):" + Ogre::StringConverter::toString(getClusterList(iBillboardGroup)->GetSize()) + " -- numBBC:" + Ogre::StringConverter::toString(numGeneratedBillboardClouds));
+						Ogre::LogManager::getSingleton().logMessage("IG:" + Ogre::StringConverter::toString(iBillboardsInGroup) + " SizeCLList(" + Ogre::StringConverter::toString(iBillboardGroup) + "):" + Ogre::StringConverter::toString(getClusterList(iBillboardGroup)->getSize()) + " -- numBBC:" + Ogre::StringConverter::toString(numGeneratedBillboardClouds));
 
 						addTextureInBsp(iBillboardGroup, iBillboard);
@@ -403,6 +403,6 @@
 						iBillboardsInGroup = 0;
 
-						Ogre::LogManager::getSingleton().logMessage("\nC IG:" + Ogre::StringConverter::toString(iBillboardsInGroup-1) + " SizeCLList(" + Ogre::StringConverter::toString(iBillboardGroup-1) + "):" + Ogre::StringConverter::toString(getClusterList(iBillboardGroup-1)->GetSize()));
-						Ogre::LogManager::getSingleton().logMessage("IG:" + Ogre::StringConverter::toString(iBillboardsInGroup) + " SizeCLList(" + Ogre::StringConverter::toString(iBillboardGroup) + "):" + Ogre::StringConverter::toString(getClusterList(iBillboardGroup)->GetSize()) + " -- numBBC:" + Ogre::StringConverter::toString(numGeneratedBillboardClouds));
+						Ogre::LogManager::getSingleton().logMessage("\nC IG:" + Ogre::StringConverter::toString(iBillboardsInGroup-1) + " SizeCLList(" + Ogre::StringConverter::toString(iBillboardGroup-1) + "):" + Ogre::StringConverter::toString(getClusterList(iBillboardGroup-1)->getSize()));
+						Ogre::LogManager::getSingleton().logMessage("IG:" + Ogre::StringConverter::toString(iBillboardsInGroup) + " SizeCLList(" + Ogre::StringConverter::toString(iBillboardGroup) + "):" + Ogre::StringConverter::toString(getClusterList(iBillboardGroup)->getSize()) + " -- numBBC:" + Ogre::StringConverter::toString(numGeneratedBillboardClouds));
 
 						addTextureInBsp(iBillboardGroup, iBillboard);
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGClusterList.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGClusterList.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGClusterList.cpp	(revision 731)
@@ -9,5 +9,5 @@
 }
 
-bool ClusterList::Insert(Cluster * p) 
+bool ClusterList::insert(Cluster * p) 
 {
 	if (!p)
@@ -21,10 +21,11 @@
 }
 
-void ClusterList::Print() 
+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();
+		this->get(i)->print();
 	}	
 }
@@ -35,15 +36,15 @@
 }
 
-std::vector<Cluster> * ClusterList::GetList() 
+std::vector<Cluster> * ClusterList::getList() 
 {
 	return &list;
 }
 
-unsigned int ClusterList::GetSize() const
+unsigned int ClusterList::getSize() const
 { 
 	return list.size(); 
 }
 
-Cluster * ClusterList::Get(unsigned int i) 
+Cluster * ClusterList::get(unsigned int i) 
 {
     if (i <= list.size())
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGBox2d.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGBox2d.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGBox2d.cpp	(revision 731)
@@ -18,15 +18,15 @@
 }
 
-Ogre::Vector2 Box2d::GetMinimum() 
+Ogre::Vector2 Box2d::getMinimum() 
 { 
     return mMinimum;
 }
 
-Ogre::Vector2 Box2d::GetMaximum() 
+Ogre::Vector2 Box2d::getMaximum() 
 { 
     return mMaximum; 
 }
 
-void Box2d::SetBoundBox(float x, float y, float X, float Y) 
+void Box2d::setBoundBox(float x, float y, float X, float Y) 
 {
     mMinimum.x = x;
@@ -36,5 +36,5 @@
 }
 
-void Box2d::AddBoundingVector3(float x, float y)
+void Box2d::addBoundingVector3(float x, float y)
 {
     if (x < mMinimum.x)
@@ -59,10 +59,10 @@
 }
 
-void Box2d::Print()
+void Box2d::print()
 {
 	Ogre::LogManager::getSingleton().logMessage("Valor de la Caixa: (" + Ogre::StringConverter::toString(Ogre::Vector3(mMinimum.x, mMinimum.y, 0)) + ") - (" + Ogre::StringConverter::toString(Ogre::Vector3(mMaximum.x, mMaximum.y, 0)) + ")");
 }
 
-Ogre::Vector2 Box2d::GetCorner(int corner) const 
+Ogre::Vector2 Box2d::getCorner(int corner) const 
 {
 	Ogre::Vector2 vector;
@@ -79,5 +79,5 @@
 }
 
-bool Box2d::In(int w, int h) 
+bool Box2d::in(int w, int h) 
 {
     if (w <= (mMaximum.x - mMinimum.x) && h <= (mMaximum.y - mMinimum.y))
@@ -89,5 +89,5 @@
 }
 
-bool Box2d::FitPerfect(int w, int h)
+bool Box2d::fitPerfect(int w, int h)
 {	
     if (w == (mMaximum.x - mMinimum.x) && h == (mMaximum.y - mMinimum.y))
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGCluster.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGCluster.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGCluster.cpp	(revision 731)
@@ -13,50 +13,50 @@
 }
 
-void Cluster::SetNormal(Ogre::Vector3* n) 
+void Cluster::setNormal(Ogre::Vector3* n) 
 { 
 	normal = *n; 
 }
 
-Ogre::Vector3* Cluster::GetNormal() 
+Ogre::Vector3* Cluster::getNormal() 
 { 
 	return &normal; 
 }
 
-BBox* Cluster::GetBound() 
+BBox* Cluster::getBound() 
 { 
 	return &bound; 
 }
 
-Box2d* Cluster::GetBspNodeBound() 
+Box2d* Cluster::getBspNodeBound() 
 { 
 	return &bspnodebound; 
 }
 
-void Cluster::SetBspNodeBound(Box2d* box) 
+void Cluster::setBspNodeBound(Box2d* box) 
 {
 	bspnodebound = (*box);
 }
 
-int Cluster::GetId() const 
+int Cluster::getId() const 
 { 
 	return id; 
 }
 
-void Cluster::SetId(int id_) 
+void Cluster::setId(int id_) 
 { 
 	id = id;
 }
 
-	std::vector<Ogre::Vector3>* Cluster::GetVector3sVector() 
+std::vector<Ogre::Vector3>* Cluster::getVector3sVector() 
 { 
 	return &Vector3s_vector; 
 }
 
-Ogre::Vector3* Cluster::GetVector3sTex() const 
+Ogre::Vector3* Cluster::getVector3sTex() const 
 { 
 	return Vector3s_triangle_text;
 }
 
-void Cluster::SetPlane(Ogre::Vector3* normal, Ogre::Vector3 * point) 
+void Cluster::setPlane(Ogre::Vector3* normal, Ogre::Vector3 * point) 
 {
     plane.normal = *normal;
@@ -65,5 +65,5 @@
 }
 
-Plane3 * Cluster::GetPlane()
+Plane3 * Cluster::getPlane()
 { 
 	return &plane; 
@@ -108,16 +108,16 @@
 }
 
-void Cluster::Print() 
+void Cluster::print() 
 {
 	Ogre::LogManager::getSingleton().logMessage("\n\nCluster: " + Ogre::StringConverter::toString(id) + ", axisproj: " + Ogre::StringConverter::toString(axisproj)  + ", order: " + Ogre::StringConverter::toString(order));
 	
-	plane.Print();
+	plane.print();
 	Ogre::LogManager::getSingleton().logMessage("\nOrigin (" + Ogre::StringConverter::toString(lumel_origin) + ")");
 	Ogre::LogManager::getSingleton().logMessage("Inc U (" + Ogre::StringConverter::toString(lumel_x_axis) + ")");
 	Ogre::LogManager::getSingleton().logMessage("Inc V (" + Ogre::StringConverter::toString(lumel_y_axis.z) + ")");
 	
-	bound.Print();
-
-	bspnodebound.Print();
+	bound.print();
+
+	bspnodebound.print();
 	
 	Ogre::LogManager::getSingleton().logMessage("Printant els vertexs: ");
@@ -125,7 +125,7 @@
 
 //* return the dominant normal axis, for calculate the 2d projection
-int Cluster::AxisProjected() {
-	
-	Ogre::Vector3 *normal = plane.GetNormal();
+int Cluster::axisProjected() 
+{
+	Ogre::Vector3 *normal = plane.getNormal();
 	
 	if (Ogre::Math::Abs(normal->x) >= Ogre::Math::Abs(normal->y) && Ogre::Math::Abs(normal->x) >= Ogre::Math::Abs(normal->z))
@@ -143,38 +143,35 @@
 }
 
-void Cluster::Finish() 
+void Cluster::finish() 
 {
 	Ogre::LogManager::getSingleton().logMessage("\nCluster::Finish()");
-	Plane3 *plane = GetPlane();
-	Ogre::Vector3 normal = *plane->GetNormal();
-	float distance = plane->GetDistance();
+	Plane3 *plane = getPlane();
+	Ogre::Vector3 normal = *plane->getNormal();
+	float distance = plane->getDistance();
 	Ogre::Vector3 corner;
 	Cluster2d cluster2d;		
 	Ogre::Vector3 vertexfinal[3];
-	Ogre::Vector2 *vertexs2d;
 	int num_vertexs = 4;
-	//Box box;
 	Ogre::Vector3 min;
 	Ogre::Vector3 max;
-	float num, den;	
 	bool type = true;
 
 	Ogre::LogManager::getSingleton().logMessage("\tCreant cluster 2d");
-	axisproj = cluster2d.Create2d (this, 0, true);	
+	axisproj = cluster2d.create2d (this, 0, true);	
 	Ogre::LogManager::getSingleton().logMessage("\t Imprimint el que hi al del cluster");
 		
 	std::vector<Ogre::Vector2> vector2;
-	vector2 =*cluster2d.GetVector3sVector();
+	vector2 =*cluster2d.getVector3sVector();
 	
 	for (unsigned int i = 0; i < vector2.size(); i++)
 	{		
-		bound.AddBoundingVector3 (vector2[i].x, vector2[i].y, 0);		
-	}
-	
-	min = bound.GetMinimum();	
-	max = bound.GetMaximum();
+		bound.addBoundingVector3 (vector2[i].x, vector2[i].y, 0);		
+	}
+	
+	min = bound.getMinimum();	
+	max = bound.getMaximum();
 	
 	Ogre::LogManager::getSingleton().logMessage("Caixa Englobant del cluster 2d");
-	bound.Print();
+	bound.print();
 
 	Ogre::Vector3 aux (-9999,-9999,-9999);
@@ -184,5 +181,5 @@
 
 //* Return the increment in U (lumel increment in x). For patchs calculation 
-Ogre::Vector3 Cluster::GetIncU() 
+Ogre::Vector3 Cluster::getIncU() 
 { 
 	return lumel_x_axis;
@@ -190,10 +187,10 @@
 
 //* Return the increment in V (lumel increment in x). For patchs calculation 
-Ogre::Vector3 Cluster::GetIncV() 
+Ogre::Vector3 Cluster::getIncV() 
 {
 	return lumel_y_axis;
 }
 
-Ogre::Vector3 Cluster::GetOrigin() 
+Ogre::Vector3 Cluster::getOrigin() 
 {
 	return lumel_origin;
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCManager.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCManager.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCManager.cpp	(revision 731)
@@ -4,33 +4,33 @@
 namespace BBC {
 
-template <> Manager* CSingleton<Manager>::ms_Singleton = NULL;
+template <> BBCManager* CSingleton<BBCManager>::ms_Singleton = NULL;
 
-Manager* Manager::getSingletonPtr(void)
+BBCManager* BBCManager::getSingletonPtr(void)
 {
     return ms_Singleton;
 }
 
-Manager& Manager::getSingleton(void)
+BBCManager& BBCManager::getSingleton(void)
 {  
     assert( ms_Singleton );  return ( *ms_Singleton );  
 }
 
-Manager::Manager() 
+BBCManager::BBCManager() 
 {   
 }
 
-Manager::~Manager() 
+BBCManager::~BBCManager() 
 {
 }
 
-void Manager::shutdown()
+void BBCManager::shutdown()
 {
 }
 
-void Manager::initialize()
+void BBCManager::initialize()
 {
 }
 
-Ogre::Mesh* Manager::loadMesh(Ogre::String folderName, Ogre::String fileName)
+Ogre::Mesh* BBCManager::loadMesh(Ogre::String folderName, Ogre::String fileName)
 {	
 	//std::ifstream ifs;
@@ -42,10 +42,10 @@
 	Ogre::ResourceGroupManager::getSingleton().addResourceLocation(folderName, "FileSystem", fileName, false);
 
-	Ogre::MeshPtr mesh = OBA::OgreBase::getSingleton().getMeshManager()->load(fileName, fileName);
+	Ogre::MeshPtr mesh = Ogre::MeshManager::getSingleton().load(fileName, fileName);
 
 	return mesh.getPointer();
 }
 
-Ogre::Mesh* Manager::loadXMLMesh(Ogre::String name)
+Ogre::Mesh* BBCManager::loadXMLMesh(Ogre::String name)
 {
 	Ogre::MeshPtr newMesh = Ogre::MeshManager::getSingleton().createManual(name.substr(0,((name.size()-1)-4)),Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
@@ -68,5 +68,5 @@
 }
 
-void Manager::saveMesh(Ogre::String name)
+void BBCManager::saveMesh(Ogre::String name)
 {
 	Ogre::MeshPtr meshPtr = Ogre::MeshManager::getSingleton().getByName(name);
@@ -74,5 +74,5 @@
 }
 
-void Manager::saveXMLMesh(Ogre::String name)
+void BBCManager::saveXMLMesh(Ogre::String name)
 {
 	Ogre::MeshPtr meshPtr = Ogre::MeshManager::getSingleton().getByName(name);
@@ -80,3 +80,19 @@
 }
 
+void BBCManager::saveMaterial(Ogre::String materialName)
+{
+	Ogre::ResourceManager::ResourceMapIterator it = Ogre::MaterialManager::getSingleton().getResourceIterator();
+    while (it.hasMoreElements())
+    {
+		Ogre::MaterialPtr m = it.getNext();
+        
+        if (m->getName() == materialName)
+		{
+			OBA::OgreBase::getSingleton().getMaterialSerializer()->queueForExport(m);
+			break;
+		}
+    }
+    //OBA::OgreBase::getSingleton().getMaterialSerializer()->exportQueued(dest);
 }
+
+}
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGTextureAtlas.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGTextureAtlas.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGTextureAtlas.cpp	(revision 731)
@@ -4,47 +4,146 @@
 namespace IMG {
 
-    TextureAtlas::TextureAtlas()
+TextureAtlas::TextureAtlas(): references(0) // initialize references to 0
+{
+	mRectangle2D->setBoundingBox(Ogre::AxisAlignedBox(-100000.0 * Ogre::Vector3::UNIT_SCALE, 100000.0 * Ogre::Vector3::UNIT_SCALE));
+	mRectangle2D->setRenderQueueGroup(Ogre::RENDER_QUEUE_BACKGROUND);
+}
+
+TextureAtlas::~TextureAtlas()
+{
+	mTextureList.clear();
+}
+
+unsigned int TextureAtlas::getReference()
+{
+	return references;
+}
+
+void TextureAtlas::setTextureAtlasName(Ogre::String textureAtlasName)
+{
+	mTextureAtlasName = textureAtlasName;
+}
+
+Ogre::String TextureAtlas::getTextureAtlasName()
+{
+	return mTextureAtlasName;
+}
+
+void TextureAtlas::addTexture(TexturePtr texture)
+{
+	mTextureList.push_back(texture);
+	mTextureAtlasSceneNode->attachObject(texture->getRectangle2D());
+}
+
+TexturePtr TextureAtlas::getTexture(unsigned int iTexture)
+{
+	return mTextureList[iTexture];
+}
+
+void TextureAtlas::removeTexture(unsigned int iTexture)
+{
+	mTextureList.erase(mTextureList.begin()+iTexture);
+}
+
+unsigned int TextureAtlas::getNumTextures()
+{
+	return mTextureList.size();
+}
+
+void TextureAtlas::setTextureAtlasSceneNode(Ogre::SceneNode *textureAtlasSceneNode)
+{
+	mTextureAtlasSceneNode = textureAtlasSceneNode;	
+	mTextureAtlasSceneNode->attachObject(mRectangle2D);
+}
+
+Ogre::SceneNode* TextureAtlas::getTextureAtlasSceneNode()
+{
+	return mTextureAtlasSceneNode;
+}
+
+void TextureAtlas::setCamera(Ogre::Camera *camera)
+{
+	mCamera = camera;
+}
+
+void TextureAtlas::update()
+{
+	mTexture->getBuffer(0, 0)->getRenderTarget()->update();
+}
+
+void TextureAtlas::save(Ogre::String folderName, Ogre::String fileName, Ogre::PixelFormat pixelFormat)
+{	
+	unsigned char* pBufferBox = new unsigned char[mTexture->getBuffer(0, 0)->getSizeInBytes()];
+	unsigned char* pBufferDest = new unsigned char[mTexture->getBuffer(0, 0)->getSizeInBytes()];
+
+    // Read pixels	
+	Ogre::PixelBox pBox(mWidth, mHeight, 1, mPixelFormat, pBufferBox);
+	Ogre::PixelBox pDest(mWidth, mHeight, 1, pixelFormat, pBufferDest);	
+	mTexture->getBuffer(0, 0)->blitToMemory(pBox);
+	Ogre::PixelUtil::bulkPixelConversion(pBox.data,mPixelFormat,pDest.data,pixelFormat,pBox.getWidth()*pBox.getHeight());
+
+	//if (pixelFormat == Ogre::PF_FLOAT32_RGBA)
+	//{
+	//	imdebug("rgba w=%d h=%d %p b=32f",pDest.getWidth(),pDest.getHeight(),pDest.data);
+	//}
+
+	// copyToMemory
+	Ogre::ImageCodec::ImageData *imgData = new Ogre::ImageCodec::ImageData();
+    
+    imgData->width = mWidth;
+    imgData->height = mHeight;
+	imgData->depth = 1;	
+    imgData->format = pixelFormat;
+
+	// Wrap buffer in a chunk
+	Ogre::MemoryDataStreamPtr stream(new Ogre::MemoryDataStream(pBufferDest, mTexture->getBuffer(0, 0)->getSizeInBytes(), false));
+
+    // Get codec 
+    size_t pos = fileName.find_last_of(".");
+    Ogre::String extension;
+    if( pos == Ogre::String::npos )
 	{
+        OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "Unable to determine image type for '" + fileName + "' - invalid extension.", "GLRenderTexture::writeContentsToFile" );
 	}
 
-    virtual TextureAtlas::~TextureAtlas()
+    while( pos != fileName.length() - 1 )
 	{
+        extension += fileName[++pos];
 	}
 
-    void TextureAtlas::setRenderSourceName(Ogre::String renderSourceName)
-	{
-		mRenderSourceName = renderSourceName;
-	}
+    // Get the codec
+    Ogre::Codec * pCodec = Ogre::Codec::getCodec(extension);
 
-    Ogre::String TextureAtlas::getRenderSourceName()
-	{
-		return mRenderSourceName;
-	}
+    // Write out
+    Ogre::Codec::CodecDataPtr codecDataPtr(imgData);
 
-	void TextureAtlas::setRenderSourceName(Ogre::String renderSourceName)
-	{
-		mRenderSourceName = renderSourceName;
-	}
+	pCodec->codeToFile(stream,folderName + fileName, codecDataPtr);
 
-	void TextureAtlas::addTexture(Texture *texture)
-	{
-		mTextureList.push_back(texture);
-	}
+	delete [] pBufferDest;
+	delete [] pBufferBox;
+}
 
-	void TextureAtlas::getTexture(unsigned int iTexture)
-	{
-		return mTextureList[iTexture];
-	}
+void TextureAtlas::setFormat(Ogre::PixelFormat pixelFormat)
+{
+	mPixelFormat = pixelFormat;
+}
 
-	void TextureAtlas::removeTexture(unsigned int iTexture)
-	{
-		Texture *texture = mTextureList[iTexture];
-		mTextureList.erase(mTextureList.begin()+iTexture);
-		delete texture;
-	}
+void TextureAtlas::create(Ogre::String fileName, unsigned int width, unsigned int height, Ogre::PixelFormat pixelFormat, Ogre::Camera *camera)
+{
+	mCamera = camera;
+	mWidth = width;
+	mHeight = height;
+	mPixelFormat = pixelFormat;
+	mTexture = Ogre::TextureManager::getSingleton().createManual(fileName, "General", Ogre::TEX_TYPE_2D, mWidth, mHeight, 0, mPixelFormat, Ogre::TU_RENDERTARGET).getPointer();
+	mTexture->getBuffer(0, 0)->getRenderTarget();
+	Ogre::RenderTexture *rt = mTexture->getBuffer()->getRenderTarget();
+	rt->setAutoUpdated(false);
+	Ogre::Viewport *v = rt->addViewport(mCamera);
+	v->setClearEveryFrame(true);
+	v->setBackgroundColour(Ogre::ColourValue(1.0f, 1.0f, 1.0f, 0.0f));
+	v->setOverlaysEnabled(false);
+	v->setDimensions(0,0,1.0,1.0);	
+	Ogre::Root::getSingleton().getRenderSystem()->clearFrameBuffer(Ogre::FBT_COLOUR, Ogre::ColourValue(1.0f,1.0f,1.0f,0.0f) );
+}
 
-	unsigned int TextureAtlas::getNumTextures()
-	{
-		return mTextureList.size();
-	}
 }
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGBBox.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGBBox.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGBBox.cpp	(revision 731)
@@ -6,5 +6,5 @@
 BBox::BBox()
 { 
-	BBox::StartBoundingBox(); 
+	BBox::initialize(); 
 }
 
@@ -13,5 +13,5 @@
 }
 
-void BBox::StartBoundingBox()
+void BBox::initialize()
 {
 	mMinimum.x =  BOUNDINGBOX_MAXVALUE;
@@ -23,15 +23,15 @@
 }
 
-Ogre::Vector3 BBox::GetMinimum() 
+Ogre::Vector3 BBox::getMinimum() 
 { 
 	return mMinimum; 
 }
 
-Ogre::Vector3 BBox::GetMaximum()
+Ogre::Vector3 BBox::getMaximum()
 { 
 	return mMaximum;
 }
 
-void BBox::AddBoundingVector3(float x, float y, float z)
+void BBox::addBoundingVector3(float x, float y, float z)
 {
     if (x < mMinimum.x)
@@ -66,10 +66,10 @@
 }
 
-void BBox::Print() 
+void BBox::print() 
 {
 	Ogre::LogManager::getSingleton().logMessage("\nValor de la Caixa: (" + Ogre::StringConverter::toString(mMinimum) + ") - (" + + ") " + Ogre::StringConverter::toString(mMaximum));
 }
 
-Ogre::Vector3 BBox::GetCorner(int corner) const 
+Ogre::Vector3 BBox::getCorner(int corner) const 
 {
     Ogre::Vector3 vector;    	
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCSampleConfigFile.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCSampleConfigFile.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCSampleConfigFile.cpp	(revision 731)
@@ -11,7 +11,12 @@
 }
 
-Ogre::String SampleConfigFile::getEntitySampleMeshPrefixFilename()
-{
-	return getSetting("Entity Sample Mesh Prefix Filename");
+Ogre::String SampleConfigFile::getEntitySampleMaterialPrefixName()
+{
+	return getSetting("Entity Sample Material Prefix Name");
+}
+
+Ogre::String SampleConfigFile::getEntitySampleMeshPrefixName()
+{
+	return getSetting("Entity Sample Mesh Prefix Name");
 }
 
@@ -41,7 +46,7 @@
 }
 
-Ogre::String SampleConfigFile::getEntityDistributionXMLPrefixFilename()
-{
-	return getSetting("Entity Distribution XML Prefix Filename");
+Ogre::String SampleConfigFile::getEntityDistributionXMLPrefixName()
+{
+	return getSetting("Entity Distribution XML Prefix Name");
 }
 
@@ -52,12 +57,12 @@
 
 
-Ogre::String SampleConfigFile::getEntitiesMeshPrefixFilename()
-{
-	return getSetting("Entities Mesh Prefix Filename");
-}
-
-Ogre::String SampleConfigFile::getBillboardCloudXMLPrefixFilename()
-{
-	return getSetting("Billboard Cloud XML Prefix Filename");
+Ogre::String SampleConfigFile::getEntitiesMeshPrefixName()
+{
+	return getSetting("Entities Mesh Prefix Name");
+}
+
+Ogre::String SampleConfigFile::getBillboardCloudXMLPrefixName()
+{
+	return getSetting("Billboard Cloud XML Prefix Name");
 }
 
@@ -122,12 +127,12 @@
 }
 
-Ogre::String SampleConfigFile::getEntityClustersMeshPrefixFilename()
-{
-	return getSetting("Entity Clusters Mesh Prefix Filename");
-}
-
-Ogre::String SampleConfigFile::getEntityClustersMaterialPrefixFilename()
-{
-	return getSetting("Entity Clusters Material Prefix Filename");
+Ogre::String SampleConfigFile::getEntityClustersMeshPrefixName()
+{
+	return getSetting("Entity Clusters Mesh Prefix Name");
+}
+
+Ogre::String SampleConfigFile::getEntityClustersMaterialPrefixName()
+{
+	return getSetting("Entity Clusters Material Prefix Name");
 }
 
@@ -137,42 +142,42 @@
 }
 
-Ogre::String SampleConfigFile::getBillboardCloudMeshPrefixFilename()
-{
-	return getSetting("Billboard Cloud Mesh Prefix Filename");
-}
-
-Ogre::String SampleConfigFile::getBillboardCloudMaterialPrefixFilename()
-{
-	return getSetting("Billboard Cloud Material Prefix Filename");
-}
-
-bool SampleConfigFile::getBillboardCloudDiffuseColorTextureAtlasGeneration()
-{
-	return Ogre::StringConverter::parseBool(getSetting("Billboard Cloud Diffuse Color Texture Atlas Generation"));
-}
-
-unsigned int SampleConfigFile::getBillboardCloudDiffuseColorTextureSize()
-{
-	return Ogre::StringConverter::parseInt(getSetting("Billboard Cloud Diffuse Color Texture Size"));
-}
-
-unsigned int SampleConfigFile::getBillboardCloudDiffuseColorTextureAtlasSize()
-{
-	return Ogre::StringConverter::parseInt(getSetting("Billboard Cloud Diffuse Color Texture Atlas Size"));
-}
-
-bool SampleConfigFile::getBillboardCloudIndirectTextureAtlasGeneration()
-{
-	return Ogre::StringConverter::parseBool(getSetting("Billboard Cloud Diffuse Color Texture Atlas Generation"));
-}
-
-unsigned int SampleConfigFile::getBillboardCloudIndirectTextureSize()
-{
-	return Ogre::StringConverter::parseInt(getSetting("Billboard Cloud Indirect Texture Size"));
-}
-
-unsigned int SampleConfigFile::getBillboardCloudIndirectTextureAtlasSize()
-{
-	return Ogre::StringConverter::parseInt(getSetting("Billboard Cloud Indirect Texture Atlas Size"));
+Ogre::String SampleConfigFile::getBillboardCloudMeshPrefixName()
+{
+	return getSetting("Billboard Cloud Mesh Prefix Name");
+}
+
+Ogre::String SampleConfigFile::getBillboardCloudBillboardMaterialPrefixName()
+{
+	return getSetting("Billboard Cloud Billboard Material Prefix Name");
+}
+
+Ogre::String SampleConfigFile::getBillboardCloudBillboardGroupMaterialPrefixName()
+{
+	return getSetting("Billboard Cloud Billboard Group Material Prefix Name");
+}
+
+Ogre::String SampleConfigFile::getBillboardCloudBillboardTextureUnit0PrefixName()
+{
+	return getSetting("Billboard Cloud Billboard Texture Unit 0 Prefix Name");
+}
+
+Ogre::String SampleConfigFile::getBillboardCloudBillboardGroupTextureUnit0PrefixName()
+{
+	return getSetting("Billboard Cloud Billboard Group Texture Unit 0 Prefix Name");
+}
+
+Ogre::String SampleConfigFile::getBillboardCloudIndirectBillboardGroupTextureAtlasPrefixName()
+{
+	return getSetting("Billboard Cloud Indirect Billboard Group Texture Atlas Prefix Name");
+}
+
+unsigned int SampleConfigFile::getBillboardCloudDiffuseColorEntityTextureAtlasBitRange()
+{
+	return Ogre::StringConverter::parseInt(getSetting("Billboard Cloud Diffuse Color Entity Texture Atlas Bit Range"));
+}
+
+unsigned int SampleConfigFile::getBillboardCloudDiffuseColorBillboardGroupTextureSize()
+{
+	return Ogre::StringConverter::parseInt(getSetting("Billboard Cloud Diffuse Color Billboard Group Texture Size"));
 }
 
@@ -182,4 +187,34 @@
 }
 
+unsigned int SampleConfigFile::getBillboardCloudIndirectBillboardGroupTextureAtlasBitRange()
+{
+	return Ogre::StringConverter::parseInt(getSetting("Billboard Cloud Indirect Billboard Group Texture Atlas Bit Range"));
+}
+
+unsigned int SampleConfigFile::getBillboardCloudIndirectBillboardGroupTextureAtlasSize()
+{
+	return Ogre::StringConverter::parseInt(getSetting("Billboard Cloud Indirect Billboard Group Texture Atlas Size"));
+}
+
+unsigned int SampleConfigFile::getBillboardCloudIndirectBillboardGroupTextureSize()
+{
+	return Ogre::StringConverter::parseInt(getSetting("Billboard Cloud Indirect Billboard Group Texture Size"));
+}
+
+unsigned int SampleConfigFile::getBillboardCloudDiffuseColorBillboardGroupTextureAtlasSize()
+{
+	return Ogre::StringConverter::parseInt(getSetting("Billboard Cloud Diffuse Color Billboard Group Texture Atlas Size"));
+}
+
+bool SampleConfigFile::getBillboardCloudDiffuseColorBillboardGroupTextureAtlasGeneration()
+{
+	return Ogre::StringConverter::parseBool(getSetting("Billboard Cloud Diffuse Color Billboard Group Texture Atlas Generation"));
+}
+
+bool SampleConfigFile::getBillboardCloudIndirectBillboardGroupTextureAtlasGeneration()
+{
+	return Ogre::StringConverter::parseBool(getSetting("Billboard Cloud Indirect Billboard Group Texture Atlas Generation"));
+}
+
 bool SampleConfigFile::getBillboardCloudGroupedBillboards()
 {
@@ -187,3 +222,78 @@
 }
 
-}
+bool SampleConfigFile::getBillboardCloudDiffuseColorEntityTextureAtlasGeneration()
+{
+	return Ogre::StringConverter::parseBool(getSetting("Billboard Cloud Diffuse Color Entity Texture Atlas Generation"));
+}
+
+Ogre::String SampleConfigFile::getBillboardCloudDiffuseColorEntityTexturePrefixName()
+{
+	return getSetting("Billboard Cloud Diffuse Color Entity Texture Prefix Name");
+}
+
+Ogre::String SampleConfigFile::getBillboardCloudDiffuseColorEntityTextureAtlasPrefixName()
+{
+	return getSetting("Billboard Cloud Diffuse Color Entity Texture Atlas Prefix Name");
+}
+
+unsigned int SampleConfigFile::getBillboardCloudDiffuseColorEntityTextureAtlasSize()
+{
+	return Ogre::StringConverter::parseInt(getSetting("Billboard Cloud Diffuse Color Entity Texture Atlas Size"));
+}
+
+unsigned int SampleConfigFile::getBillboardCloudDiffuseColorEntityTextureAtlasNumSamples()
+{
+	return Ogre::StringConverter::parseInt(getSetting("Billboard Cloud Diffuse Color Entity Texture Atlas NumSamples"));
+}
+
+bool SampleConfigFile::getBillboardCloudDiffuseColorMergedBillboardsTextureAtlasGeneration()
+{
+	return Ogre::StringConverter::parseBool(getSetting("Billboard Cloud Diffuse Color Merged Billboards Texture Atlas Generation"));
+}
+
+Ogre::String SampleConfigFile::getBillboardCloudDiffuseColorMergedBillboardsTextureAtlasPrefixName()
+{
+	return getSetting("Billboard Cloud Diffuse Color Merged Billboards Texture Atlas Prefix Name");
+}
+
+unsigned int SampleConfigFile::getBillboardCloudDiffuseColorMergedBillboardsTextureAtlasBitRange()
+{
+	return Ogre::StringConverter::parseInt(getSetting("Billboard Cloud Diffuse Color Merged Billboards Texture Atlas Bit Range"));
+}
+
+unsigned int SampleConfigFile::getBillboardCloudDiffuseColorMergedBillboardsTextureAtlasSize()
+{
+	return Ogre::StringConverter::parseInt(getSetting("Billboard Cloud Diffuse Color Merged Billboards Texture Atlas Size"));
+}
+
+unsigned int SampleConfigFile::getBillboardCloudDiffuseColorMergedBillboardsTextureSize()
+{
+	return Ogre::StringConverter::parseInt(getSetting("Billboard Cloud Diffuse Color Merged Billboards Texture Size"));
+}
+
+bool SampleConfigFile::getBillboardCloudIndirectMergedBillboardsTextureAtlasGeneration()
+{
+	return Ogre::StringConverter::parseBool(getSetting("Billboard Cloud Indirect Merged Billboards Texture Atlas Generation"));
+}
+
+Ogre::String SampleConfigFile::getBillboardCloudIndirectMergedBillboardsTextureAtlasPrefixName()
+{
+	return getSetting("Billboard Cloud Indirect Merged Billboards Texture Atlas Prefix Name");
+}
+
+unsigned int SampleConfigFile::getBillboardCloudIndirectMergedBillboardsTextureAtlasBitRange()
+{
+	return Ogre::StringConverter::parseInt(getSetting("Billboard Cloud Indirect Merged Billboards Texture Atlas Bit Range"));
+}
+
+unsigned int SampleConfigFile::getBillboardCloudIndirectMergedBillboardsTextureAtlasSize()
+{
+	return Ogre::StringConverter::parseInt(getSetting("Billboard Cloud Indirect Merged Billboards Texture Atlas Size"));
+}
+
+unsigned int SampleConfigFile::getBillboardCloudIndirectMergedBillboardsTextureSize()
+{
+	return Ogre::StringConverter::parseInt(getSetting("Billboard Cloud Indirect Merged Billboards Texture Size"));
+}
+
+}
Index: /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCManager.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCManager.cpp	(revision 721)
+++ /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCManager.cpp	(revision 731)
@@ -4,6 +4,6 @@
 namespace LBBC {
 
-Manager::Manager() 
-	: BBC::Manager() 
+LBBCManager::LBBCManager() 
+	: BBC::BBCManager() 
 {
 	mBillboardCloudSerializer = new KMeansClusterSerializer();
@@ -15,5 +15,5 @@
 }
 
-Manager::~Manager() 
+LBBCManager::~LBBCManager() 
 {
 	if (mOgreMeshSerializer)
@@ -21,8 +21,9 @@
 		delete mOgreMeshSerializer;
 	}
-	if (mSampleConfigFile)
-	{
-		delete mSampleConfigFile;
-	}
+	// Gametools -- BUG: 06/04/2006
+	//if (mSampleConfigFile)
+	//{
+	//	delete mSampleConfigFile;
+	//}
 	if (mLeafDistributionSerializer)
 	{
@@ -52,15 +53,15 @@
 }
 
-SampleConfigFile* Manager::getSampleConfigFile()
+SampleConfigFile* LBBCManager::getSampleConfigFile()
 {
 	return mSampleConfigFile;
 }
 
-void Manager::setSampleConfigFile(SampleConfigFile *sampleConfigFile)
+void LBBCManager::setSampleConfigFile(SampleConfigFile *sampleConfigFile)
 {
 	mSampleConfigFile = sampleConfigFile;
 }
 
-void Manager::loadSampleConfigFile(Ogre::String sampleConfigFile)
+void LBBCManager::loadSampleConfigFile(Ogre::String sampleConfigFile)
 {
 	mSampleConfigFile = new SampleConfigFile();
@@ -68,10 +69,10 @@
 }
 
-void Manager::runSampleConfigFile()
+void LBBCManager::runSampleConfigFile()
 {
 	mLeaves = new Leaves();
 	
 	BBC::EntityPtr entityLeaves(new BBC::Entity);
-	BBC::MeshPtr meshLeaves(new BBC::Mesh(this->loadMesh(mSampleConfigFile->getEntitiesFolder(), mSampleConfigFile->getEntitiesMeshPrefixFilename() + ".mesh")) );
+	BBC::MeshPtr meshLeaves(new BBC::Mesh(this->loadMesh(mSampleConfigFile->getEntitiesFolder(), mSampleConfigFile->getEntitiesMeshPrefixName() + ".mesh")) );
 	entityLeaves->setMesh(meshLeaves);	
 	mLeaves->setEntity(entityLeaves);
@@ -87,4 +88,9 @@
 	}
 	
+	if (mSampleConfigFile->getEntitySampleMeshGeneration())
+	{
+		saveSingleEntity();
+	}
+
 	if (mSampleConfigFile->getEntityClustersGeneration())
 	{
@@ -96,7 +102,8 @@
 		generateBillboardCloud();
 	}	
-}
-
-void Manager::createEntityDistribution()
+
+}
+
+void LBBCManager::createEntityDistribution()
 {
 	mLeafDistributionGenerator->setDistribution(mLeaves->getDistribution());
@@ -105,5 +112,5 @@
 }
 
-void Manager::saveEntityDistributionSplitted()
+void LBBCManager::saveEntityDistributionSplitted()
 {
 	BBC::EntityPtr entity;
@@ -143,8 +150,8 @@
 			mOgreMeshSerializer->setEntity(entity);
 			mOgreMeshSerializer->exportMesh(mSampleConfigFile->getEntityClustersFolder() +
-				mSampleConfigFile->getEntityClustersMeshPrefixFilename() + "Splitted.mesh", false, false);
+				mSampleConfigFile->getEntityClustersMeshPrefixName() + "Splitted.mesh", false, false);
 			
-			OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(entity->getMesh()->get(), mSampleConfigFile->getEntityDistributionFolder() + mSampleConfigFile->getEntitiesMeshPrefixFilename() + "Splitted.mesh");
-			//OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(entity->getMesh().get(), mSampleConfigFile->getEntityClustersFolder() + mSampleConfigFile->getEntitiesMeshPrefixFilename() + "Splitted.mesh" + ".xml");			
+			OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(entity->getMesh()->get(), mSampleConfigFile->getEntityDistributionFolder() + mSampleConfigFile->getEntitiesMeshPrefixName() + "Splitted.mesh");
+			//OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(entity->getMesh().get(), mSampleConfigFile->getEntityClustersFolder() + mSampleConfigFile->getEntitiesMeshPrefixName() + "Splitted.mesh" + ".xml");			
 		}
 	}
@@ -157,18 +164,16 @@
 		mOgreMeshSerializer->setEntity(entity);
 		mOgreMeshSerializer->exportMesh(mSampleConfigFile->getEntityClustersFolder() +
-			mSampleConfigFile->getEntityClustersMeshPrefixFilename() + "Merged.mesh", false, false);
-		
-		OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh((Ogre::Mesh*)entity->getMesh().get(), mSampleConfigFile->getEntityDistributionFolder() + mSampleConfigFile->getEntitiesMeshPrefixFilename() + "Merged.mesh");
-		//OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(entity->getMesh(), mSampleConfigFile->getEntityClustersFolder() + mSampleConfigFile->getEntitiesMeshPrefixFilename() + "Merged.mesh" + ".xml");		
-
-		//Ogre::MeshManager::getSingleton().unload(mSampleConfigFile->getEntitiesMeshPrefixFilename() + "Merged.mesh");
-	}
-}
-
-void Manager::saveEntityDistributionXML()
+			mSampleConfigFile->getEntityClustersMeshPrefixName() + "Merged.mesh", false, false);
+		
+		OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh((Ogre::Mesh*)entity->getMesh().get(), mSampleConfigFile->getEntityDistributionFolder() + mSampleConfigFile->getEntitiesMeshPrefixName() + "Merged.mesh");
+		//OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(entity->getMesh(), mSampleConfigFile->getEntityClustersFolder() + mSampleConfigFile->getEntitiesMeshPrefixName() + "Merged.mesh" + ".xml");				
+	}
+}
+
+void LBBCManager::saveEntityDistributionXML()
 {
 	TiXmlDocument *document = mLeafDistributionSerializer->create(
 									mSampleConfigFile->getEntityDistributionFolder() +
-									mSampleConfigFile->getEntityDistributionXMLPrefixFilename() + ".xml");
+									mSampleConfigFile->getEntityDistributionXMLPrefixName() + ".xml");
 	mLeafDistributionSerializer->setLeafDistribution(mLeaves->getDistribution());
 	mLeafDistributionSerializer->writeLeafDistribution(document);	
@@ -176,9 +181,9 @@
 }
 
-void Manager::loadEntityDistribution()
+void LBBCManager::loadEntityDistribution()
 {
 	TiXmlDocument *document = mLeafDistributionSerializer->load(
 									mSampleConfigFile->getEntityDistributionFolder() +
-									mSampleConfigFile->getEntityDistributionXMLPrefixFilename() + ".xml");
+									mSampleConfigFile->getEntityDistributionXMLPrefixName() + ".xml");
 	mLeafDistributionSerializer->setLeafDistribution(mLeaves->getDistribution());
 	mLeafDistributionSerializer->getEntity()->setMesh(mLeaves->getEntity()->getMesh());
@@ -188,5 +193,5 @@
 	BBC::EntityDistribution *entityDistribution;
 
-	BBC::MeshPtr pMeshLeavesSplitted(new BBC::Mesh(this->loadMesh(mSampleConfigFile->getEntitiesFolder(), mSampleConfigFile->getEntitiesMeshPrefixFilename() + "Splitted.mesh")));
+	BBC::MeshPtr pMeshLeavesSplitted(new BBC::Mesh(this->loadMesh(mSampleConfigFile->getEntitiesFolder(), mSampleConfigFile->getEntitiesMeshPrefixName() + "Splitted.mesh")));
 	entity = BBC::EntityPtr(new BBC::Entity());
 	entity->setMesh(pMeshLeavesSplitted);
@@ -211,5 +216,5 @@
 }
 
-void Manager::generateEntityDistribution()
+void LBBCManager::generateEntityDistribution()
 {
 	if (mSampleConfigFile->getEntityDistributionGeneration())
@@ -221,10 +226,10 @@
 }
 
-void Manager::saveBillboardCloudGrouped()
+void LBBCManager::saveBillboardCloudGrouped()
 {
 	for (unsigned int iSubEntity = 0; iSubEntity < mLeaves->getBillboardCloud()->getEntity()->getNumSubEntities(); iSubEntity++)
 	{
 		BBC::SubEntityPtr subEntity = mLeaves->getBillboardCloud()->getEntity()->getSubEntity(iSubEntity);
-		subEntity->setMaterialName(mSampleConfigFile->getBillboardCloudMaterialPrefixFilename());
+		subEntity->setMaterialName(mSampleConfigFile->getBillboardCloudBillboardGroupMaterialPrefixName());
 	}
 	mOgreMeshSerializer->setEntity(mLeaves->getBillboardCloud()->getEntity());
@@ -232,18 +237,16 @@
 	Ogre::LogManager::getSingleton().logMessage("Num.SubEntities:" + Ogre::StringConverter::toString(mLeaves->getBillboardCloud()->getEntity()->getNumSubEntities()));
 	mOgreMeshSerializer->exportMesh(mSampleConfigFile->getBillboardCloudFolder() +
-				mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Grouped.mesh",false, false);
-	OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Grouped.mesh");
-	OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Grouped.mesh.xml");
-
-	//Ogre::MeshManager::getSingleton().unload(mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Grouped.mesh");
-}
-
-
-void Manager::saveBillboardCloudSplitted()
+				mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Grouped.mesh",false, false);
+	OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Grouped.mesh");
+	OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Grouped.mesh.xml");
+}
+
+
+void LBBCManager::saveBillboardCloudSplitted()
 {	
 	for (unsigned int iSubEntity = 0; iSubEntity < mLeaves->getBillboardCloud()->getEntity()->getNumSubEntities(); iSubEntity++)
 	{
 		BBC::SubEntityPtr subEntity = mLeaves->getBillboardCloud()->getEntity()->getSubEntity(iSubEntity);
-		subEntity->setMaterialName(mSampleConfigFile->getBillboardCloudMaterialPrefixFilename());
+		subEntity->setMaterialName(mSampleConfigFile->getBillboardCloudBillboardMaterialPrefixName());
 	}
 
@@ -253,20 +256,20 @@
 
 	mOgreMeshSerializer->exportMesh(mSampleConfigFile->getBillboardCloudFolder() +
-				mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Splitted.mesh",false, false);
-
-	OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Splitted.mesh");
-
-	OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Splitted.mesh.xml");
-}
-
-void Manager::saveBillboardCloudMerged()
+				mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Splitted.mesh",false, false);
+
+	OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Splitted.mesh");
+
+	OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Splitted.mesh.xml");
+}
+
+void LBBCManager::saveBillboardCloudMerged()
 {	
-	//mLeaves->getBillboardCloud()->getEntity()->getSubEntity(0)->setMaterialName(mSampleConfigFile->getBillboardCloudMaterialPrefixFilename());
+	//mLeaves->getBillboardCloud()->getEntity()->getSubEntity(0)->setMaterialName(mSampleConfigFile->getBillboardCloudMaterialPrefixName());
 	//mOgreMeshSerializer->setEntity(mLeaves->getBillboardCloud()->getEntity());
 	//mOgreMeshSerializer->exportMesh(mSampleConfigFile->getBillboardCloudFolder() +
-	//			mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Merged.mesh", mSampleConfigFile->getBillboardCloudMergedBillboards(), false);
+	//			mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Merged.mesh", mSampleConfigFile->getBillboardCloudMergedBillboards(), false);
 	//OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh(), 
-	//			mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Merged.mesh");
-	//OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Merged.mesh.xml");
+	//			mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Merged.mesh");
+	//OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Merged.mesh.xml");
 	
 
@@ -274,5 +277,5 @@
 	{
 		BBC::SubEntityPtr subEntity = mLeaves->getBillboardCloud()->getEntity()->getSubEntity(iSubEntity);
-		subEntity->setMaterialName(mSampleConfigFile->getBillboardCloudMaterialPrefixFilename());
+		subEntity->setMaterialName(mSampleConfigFile->getBillboardCloudBillboardGroupMaterialPrefixName());
 	}
 	mOgreMeshSerializer->setEntity(mLeaves->getBillboardCloud()->getEntity());
@@ -280,17 +283,15 @@
 	Ogre::LogManager::getSingleton().logMessage("Num.SubEntities:" + Ogre::StringConverter::toString(mLeaves->getBillboardCloud()->getEntity()->getNumSubEntities()));
 	mOgreMeshSerializer->exportMesh(mSampleConfigFile->getBillboardCloudFolder() +
-				mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Merged.mesh",false, false);
-	OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Merged.mesh");	
-	OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Merged.mesh.xml");
-	
-	//Ogre::MeshManager::getSingleton().unload(mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Merged.mesh");
-}
-
-void Manager::saveBillboardCloudXML()
+				mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Merged.mesh",false, false);
+	OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Merged.mesh");	
+	OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Merged.mesh.xml");	
+}
+
+void LBBCManager::saveBillboardCloudXML()
 {
 	//saveBillboardCloud()
 	TiXmlDocument *document2 = mBillboardCloudSerializer->create(
 									mSampleConfigFile->getBillboardCloudFolder() + 
-									mSampleConfigFile->getBillboardCloudXMLPrefixFilename() + ".xml");
+									mSampleConfigFile->getBillboardCloudXMLPrefixName() + ".xml");
 	mBillboardCloudSerializer->setBillboardCloud(mLeaves->getBillboardCloud());
 	mBillboardCloudSerializer->writeBillboardCloud(document2);	
@@ -298,5 +299,5 @@
 }
 
-void Manager::saveEntityClusters()
+void LBBCManager::saveEntityClusters()
 {
 	BBC::BillboardClusterDataPtr billboardClusterData;
@@ -315,16 +316,14 @@
 			{					
 				BBC::EntityPtr entityClusterized = entityCluster->getEntity();
-				entityClusterized->getSubEntity(0)->setMaterialName(mSampleConfigFile->getEntityClustersMaterialPrefixFilename());
+				entityClusterized->getSubEntity(0)->setMaterialName(mSampleConfigFile->getEntityClustersMaterialPrefixName());
 				mOgreMeshSerializer->setEntity(entityClusterized);
 				mOgreMeshSerializer->exportMesh(mSampleConfigFile->getEntityDistributionFolder() +
-					mSampleConfigFile->getEntityClustersMeshPrefixFilename() +
+					mSampleConfigFile->getEntityClustersMeshPrefixName() +
 					Ogre::StringConverter::toString(numSerializedBillboards) + ".mesh", !(mSampleConfigFile->getEntityClustersSplittedClusters()), false);
 				OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(entityClusterized->getMesh()->get(),
 					mSampleConfigFile->getEntityClustersFolder() +
-					mSampleConfigFile->getEntityClustersMeshPrefixFilename() +
+					mSampleConfigFile->getEntityClustersMeshPrefixName() +
 					Ogre::StringConverter::toString(numSerializedBillboards) + ".mesh");
 				//OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(entityClusterized->getMesh(), entityClusterized->getMesh()->getName() + ".xml");
-
-				//Ogre::MeshManager::getSingleton().unload(mSampleConfigFile->getEntityClustersMeshPrefixFilename() + Ogre::StringConverter::toString(numSerializedBillboards) + ".mesh");
 
 				numSerializedBillboards++;
@@ -347,5 +346,5 @@
 			{			
 				BBC::EntityPtr entityClusterized = entityCluster->getEntity();
-				entityClusterized->getSubEntity(0)->setMaterialName(mSampleConfigFile->getEntityClustersMaterialPrefixFilename());
+				entityClusterized->getSubEntity(0)->setMaterialName(mSampleConfigFile->getEntityClustersMaterialPrefixName());
 				BBC::SubEntityPtr subEntity = entityClusterized->getSubEntity(0);
 
@@ -371,16 +370,14 @@
 		mOgreMeshSerializer->setEntity(entity);
 		mOgreMeshSerializer->exportMesh(mSampleConfigFile->getEntityClustersFolder() +
-			mSampleConfigFile->getEntityClustersMeshPrefixFilename() + "Merged.mesh", false, false);
-		
-		OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(entity->getMesh()->get(), mSampleConfigFile->getEntityClustersFolder() + mSampleConfigFile->getEntityClustersMeshPrefixFilename() + "Merged.mesh");
-		//OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(entity->getMesh(), mSampleConfigFile->getEntityClustersFolder() + mSampleConfigFile->getEntityClustersMeshPrefixFilename() + "Merged.mesh" + ".xml");
-
-		//Ogre::MeshManager::getSingleton().unload(mSampleConfigFile->getEntityClustersMeshPrefixFilename() + "Merged.mesh");
-
-		Ogre::LogManager::getSingleton().logMessage("Before deleting:" + mSampleConfigFile->getEntityClustersMeshPrefixFilename() + "Merged.mesh");	
-	}
-}
-
-void Manager::createEntityClusters()
+			mSampleConfigFile->getEntityClustersMeshPrefixName() + "Merged.mesh", false, false);
+		
+		OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(entity->getMesh()->get(), mSampleConfigFile->getEntityClustersFolder() + mSampleConfigFile->getEntityClustersMeshPrefixName() + "Merged.mesh");
+		//OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(entity->getMesh(), mSampleConfigFile->getEntityClustersFolder() + mSampleConfigFile->getEntityClustersMeshPrefixName() + "Merged.mesh" + ".xml");
+
+		Ogre::LogManager::getSingleton().logMessage("Before deleting:" + mSampleConfigFile->getEntityClustersMeshPrefixName() + "Merged.mesh");	
+	}
+}
+
+void LBBCManager::createEntityClusters()
 {
 	mBillboardCloudGenerator->setDistribution(mLeaves->getDistribution());
@@ -392,27 +389,23 @@
 }
 
-void Manager::saveSingleEntity()
-{
-	if (mSampleConfigFile->getEntitySampleMeshGeneration())
-	{
-		BBC::EntityPtr entityLeaf = mLeaves->getDistribution()->getEntity(2);
-		entityLeaf->getSubEntity(0)->setMaterialName(mSampleConfigFile->getEntityClustersMaterialPrefixFilename());
-		mOgreMeshSerializer->setEntity(entityLeaf);
-		mOgreMeshSerializer->exportMesh(mSampleConfigFile->getEntityDistributionFolder() +
-			mSampleConfigFile->getEntitySampleMeshPrefixFilename(), mSampleConfigFile->getEntityClustersMergedClusters(), false);
-		//OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(entityLeaf->getMesh(), entityLeaf->getMesh()->getName() + ".xml");
-
-	}
-}
-
-void Manager::generateEntityClusters()
-{
-	Ogre::LogManager::getSingleton().logMessage("EntityClustersMeshPrefixName:" + mSampleConfigFile->getEntityClustersMeshPrefixFilename());
+void LBBCManager::saveSingleEntity()
+{
+	BBC::EntityPtr entityLeaf = mLeaves->getDistribution()->getEntity(2);
+	entityLeaf->getSubEntity(0)->setMaterialName(mSampleConfigFile->getEntitySampleMaterialPrefixName());
+	mOgreMeshSerializer->setEntity(entityLeaf);
+	mOgreMeshSerializer->exportMesh(mSampleConfigFile->getEntityDistributionFolder() +
+		mSampleConfigFile->getEntitySampleMeshPrefixName(), false, false);
+	OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(entityLeaf->getMesh()->get(), mSampleConfigFile->getEntityDistributionFolder() + mSampleConfigFile->getEntitySampleMeshPrefixName() + ".mesh");
+	OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(entityLeaf->getMesh()->get(), mSampleConfigFile->getEntityDistributionFolder() + mSampleConfigFile->getEntitySampleMeshPrefixName() + ".mesh.xml");	
+}
+
+void LBBCManager::generateEntityClusters()
+{
+	Ogre::LogManager::getSingleton().logMessage("EntityClustersMeshPrefixName:" + mSampleConfigFile->getEntityClustersMeshPrefixName());
 	createEntityClusters();
-	saveEntityClusters();
-	saveSingleEntity();	
-}
-
-void Manager::generateBillboardCloud()
+	saveEntityClusters();	
+}
+
+void LBBCManager::generateBillboardCloud()
 {
 	if (mSampleConfigFile->getBillboardCloudMergedBillboards())
@@ -422,12 +415,12 @@
 		mLeaves->getBillboardCloud()->initializeBillboardCloudGroups(1);
 
-		if (mSampleConfigFile->getBillboardCloudDiffuseColorTextureAtlasGeneration())
+		if (mSampleConfigFile->getBillboardCloudDiffuseColorMergedBillboardsTextureAtlasGeneration())
 		{
 			mBillboardCloudUVMapper->shutdown();
 			mBillboardCloudUVMapper->setBillboardCloud(mLeaves->getBillboardCloud());
-			mBillboardCloudUVMapper->setTextureWidth(mSampleConfigFile->getBillboardCloudDiffuseColorTextureSize());
-			mBillboardCloudUVMapper->setTextureHeight(mSampleConfigFile->getBillboardCloudDiffuseColorTextureSize());
-			mBillboardCloudUVMapper->setTextureAtlasWidth(mSampleConfigFile->getBillboardCloudDiffuseColorTextureAtlasSize());
-			mBillboardCloudUVMapper->setTextureAtlasHeight(mSampleConfigFile->getBillboardCloudDiffuseColorTextureAtlasSize());
+			mBillboardCloudUVMapper->setTextureWidth(mSampleConfigFile->getBillboardCloudDiffuseColorMergedBillboardsTextureSize());
+			mBillboardCloudUVMapper->setTextureHeight(mSampleConfigFile->getBillboardCloudDiffuseColorMergedBillboardsTextureSize());
+			mBillboardCloudUVMapper->setTextureAtlasWidth(mSampleConfigFile->getBillboardCloudDiffuseColorMergedBillboardsTextureAtlasSize());
+			mBillboardCloudUVMapper->setTextureAtlasHeight(mSampleConfigFile->getBillboardCloudDiffuseColorMergedBillboardsTextureAtlasSize());
 			mBillboardCloudUVMapper->initialize();
 
@@ -446,12 +439,12 @@
 		mLeaves->getBillboardCloud()->initializeBillboardCloudGroups(mSampleConfigFile->getBillboardCloudGroups());
 		
-		if (mSampleConfigFile->getBillboardCloudDiffuseColorTextureAtlasGeneration())
+		if (mSampleConfigFile->getBillboardCloudDiffuseColorBillboardGroupTextureAtlasGeneration())
 		{
 			mBillboardCloudUVMapper->shutdown();
 			mBillboardCloudUVMapper->setBillboardCloud(mLeaves->getBillboardCloud());
-			mBillboardCloudUVMapper->setTextureWidth(mSampleConfigFile->getBillboardCloudDiffuseColorTextureSize());
-			mBillboardCloudUVMapper->setTextureHeight(mSampleConfigFile->getBillboardCloudDiffuseColorTextureSize());
-			mBillboardCloudUVMapper->setTextureAtlasWidth(mSampleConfigFile->getBillboardCloudDiffuseColorTextureAtlasSize());
-			mBillboardCloudUVMapper->setTextureAtlasHeight(mSampleConfigFile->getBillboardCloudDiffuseColorTextureAtlasSize());
+			mBillboardCloudUVMapper->setTextureWidth(mSampleConfigFile->getBillboardCloudDiffuseColorBillboardGroupTextureSize());
+			mBillboardCloudUVMapper->setTextureHeight(mSampleConfigFile->getBillboardCloudDiffuseColorBillboardGroupTextureSize());
+			mBillboardCloudUVMapper->setTextureAtlasWidth(mSampleConfigFile->getBillboardCloudDiffuseColorBillboardGroupTextureAtlasSize());
+			mBillboardCloudUVMapper->setTextureAtlasHeight(mSampleConfigFile->getBillboardCloudDiffuseColorBillboardGroupTextureAtlasSize());
 			mBillboardCloudUVMapper->initialize();
 			mBillboardCloudUVMapper->generateTextureAtlasTextureCoords(false, mSampleConfigFile->getBillboardCloudGroupedBillboards(), mSampleConfigFile->getBillboardCloudGroups()); 
@@ -466,15 +459,15 @@
 	{		
 		mLeaves->getBillboardCloud()->generateBillboardCloud(false);
-		if (mSampleConfigFile->getBillboardCloudDiffuseColorTextureAtlasGeneration())
-		{
-			mBillboardCloudUVMapper->shutdown();
-			mBillboardCloudUVMapper->setBillboardCloud(mLeaves->getBillboardCloud());
-			mBillboardCloudUVMapper->setTextureWidth(mSampleConfigFile->getBillboardCloudDiffuseColorTextureSize());
-			mBillboardCloudUVMapper->setTextureHeight(mSampleConfigFile->getBillboardCloudDiffuseColorTextureSize());
-			mBillboardCloudUVMapper->setTextureAtlasWidth(mSampleConfigFile->getBillboardCloudDiffuseColorTextureAtlasSize());
-			mBillboardCloudUVMapper->setTextureAtlasHeight(mSampleConfigFile->getBillboardCloudDiffuseColorTextureAtlasSize());
-			mBillboardCloudUVMapper->initialize();
-			mBillboardCloudUVMapper->generateTextureAtlasTextureCoords(!mSampleConfigFile->getBillboardCloudSplittedBillboards(),false); 
-		}
+		//if (mSampleConfigFile->getBillboardCloudDiffuseColorTextureAtlasGeneration())
+		//{
+		//	mBillboardCloudUVMapper->shutdown();
+		//	mBillboardCloudUVMapper->setBillboardCloud(mLeaves->getBillboardCloud());
+		//	mBillboardCloudUVMapper->setTextureWidth(mSampleConfigFile->getBillboardCloudDiffuseColorTextureSize());
+		//	mBillboardCloudUVMapper->setTextureHeight(mSampleConfigFile->getBillboardCloudDiffuseColorTextureSize());
+		//	mBillboardCloudUVMapper->setTextureAtlasWidth(mSampleConfigFile->getBillboardCloudDiffuseColorTextureAtlasSize());
+		//	mBillboardCloudUVMapper->setTextureAtlasHeight(mSampleConfigFile->getBillboardCloudDiffuseColorTextureAtlasSize());
+		//	mBillboardCloudUVMapper->initialize();
+		//	mBillboardCloudUVMapper->generateTextureAtlasTextureCoords(!mSampleConfigFile->getBillboardCloudSplittedBillboards(),false); 
+		//}
 		saveBillboardCloudSplitted();
 	}
@@ -483,5 +476,5 @@
 }
 
-Leaves* Manager::getLeaves()
+Leaves* LBBCManager::getLeaves()
 {
 	return mLeaves;
Index: P/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCBillboardCloudTextureGenerator.cpp
===================================================================
--- /GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCBillboardCloudTextureGenerator.cpp	(revision 699)
+++ 	(revision )
@@ -1,7 +1,0 @@
-
-#include "BBCBillboardCloudTextureGenerator.h"
-
-namespace BBC {
-
-
-}
