Main Page   Namespace List   Class Hierarchy   Alphabetical List   Data Structures   File List   Namespace Members   Data Fields   Globals  

ExManagerTexture Class Reference

#include <ExManagerTexture.h>

Inheritance diagram for ExManagerTexture:

ExManagerObject< ExCTexture > ExManager

Public Methods

void Reset (void)
void Init (void)
bool Init (std::string FileName)
bool Load (std::string FileName)
bool Add (std::string FileName)
bool Add (ExCTexture object)
bool CheckExist (std::string name)
bool SetCurrentObject (std::string Name)
bool SetCurrentObject (ExNihilo::ExId id)
GLint GetTextureId (std::string Name)
GLint GetTextureId (ExNihilo::ExId id)
ExCAction InputAction (ExCAction Action)

Static Public Methods

ExManagerTexture * CreateSingleton (void)

Private Methods

 ExManagerTexture (void)
 ~ExManagerTexture (void)

Static Private Attributes

bool m_flag = false
ExManagerTexture * m_instance = NULL

Constructor & Destructor Documentation

ExManagerTexture void    [private]
 

Definition at line 43 of file ExManagerTexture.cpp.

References ExManagerTexture(), and Guard.

Referenced by ExManagerTexture(), and ~ExManagerTexture().

00044 {
00045 Guard(ExManagerTexture::ExManagerTexture(void))
00046         
00047 UnGuard
00048 }

~ExManagerTexture void    [private]
 

Definition at line 51 of file ExManagerTexture.cpp.

References ExManagerTexture(), and Guard.

00052 {
00053 Guard(ExManagerTexture::~ExManagerTexture(void))
00054 UnGuard
00055 }


Member Function Documentation

bool Add ExCTexture    object
 

Reimplemented from ExManagerObject< ExCTexture >.

Definition at line 127 of file ExManagerTexture.cpp.

References ExManagerObject::Add(), Add(), CheckExist(), ExCObject::GetName(), and Guard.

00128 {
00129 Guard(ExManagerTexture::Add(ExCTexture object))
00130         if(!CheckExist(object.GetName())){return true;}
00131         return ExManagerObject<ExCTexture>::Add(object);
00132 UnGuard
00133 }

bool Add std::string    FileName
 

Reimplemented from ExManagerObject< ExCTexture >.

Definition at line 120 of file ExManagerTexture.cpp.

References Add(), Guard, and Load().

Referenced by Add(), Load(), ExCComposed::LoadAsc(), ExCInterface::LoadFile(), ExCMap::LoadMap(), and ExManagerConsole::SetConsoleBackGroudTexture().

00121 {
00122 Guard(ExManagerTexture::Add(std::string FileName))
00123         return Load(FileName);
00124 UnGuard
00125 }

bool CheckExist std::string    name
 

Definition at line 81 of file ExManagerTexture.cpp.

References CheckExist(), ExManagerId::GetObjectId(), Guard, and ExManagerObject< ExCTexture >::ManagerId.

Referenced by Add(), CheckExist(), and Load().

00082 {
00083 Guard(ExManagerTexture::CheckExist(std::string  name))
00084         if(name.find(".")<name.length())//if extension remove them
00085         {
00086                 name.erase(name.find("."),name.length()-name.find("."));
00087         }
00088         if(ManagerId->GetObjectId(name,typeid(ExCTexture).name())==-1)return true;
00089         return false;
00090 UnGuard
00091 }

ExManagerTexture * CreateSingleton void    [static]
 

Definition at line 29 of file ExManagerTexture.cpp.

References CreateSingleton(), Guard, m_flag, and m_instance.

Referenced by CreateSingleton(), and main().

00029                                                        {
00030 Guard(ExManagerTexture* ExManagerTexture::CreateSingleton(void))
00031         if(!m_flag)
00032         {
00033                 m_flag = true; // We are creating the error log now, so set flag to true
00034                 m_instance = new ExManagerTexture; // Create the error log
00035         }else
00036         {
00037                 std::cout<<"Error singleton already created"<<std::endl;
00038         }
00039         return m_instance; 
00040 UnGuard
00041 }

GLint GetTextureId ExNihilo::ExId    id
 

Definition at line 207 of file ExManagerTexture.cpp.

References ExManagerObject< ExCTexture >::GetObject(), GetTextureId(), Guard, ExManagerObject< ExCTexture >::m_CurrentObjectId, and ExCTexture::m_Texture.

00208 {
00209 Guard(ExManagerTexture::GetTextureId(ExNihilo::ExId id))
00210         if(GetObject(id)!=NULL)
00211         {
00212                 m_CurrentObjectId=id;
00213                 try
00214                 {       
00215                         return GetObject(m_CurrentObjectId)->m_Texture;
00216                         //std::cout<<"ExManagerTexture ::"<<Name<<" Current object"<<std::endl;
00217                         }catch(...)
00218                         {
00219                                 std::cout<<"ExManagerTexture ::Exception can make :"<<m_CurrentObjectId<<" Current object"<<std::endl;
00220                                 return -1;
00221                         }
00222         }
00223         return -1;
00224 UnGuard
00225 }

GLint GetTextureId std::string    Name
 

Definition at line 182 of file ExManagerTexture.cpp.

References ExManagerObject< ExCTexture >::GetObject(), ExManagerId::GetObjectId(), GetTextureId(), Guard, Load(), ExManagerObject< ExCTexture >::m_CurrentObjectId, ExCTexture::m_Texture, and ExManagerObject< ExCTexture >::ManagerId.

Referenced by GetTextureId(), and ExCSystemeParticule::SetParticuleTexture().

00183 {
00184 Guard(ExManagerTexture::GetTextureId(std::string Name))
00185         
00186         if(Name.find(".")<Name.length())//if extension remove them
00187         {
00188                 Name.erase(Name.find("."),Name.length()-Name.find("."));
00189         }
00190         try
00191         {       
00192                 m_CurrentObjectId=ManagerId->GetObjectId(Name,typeid(ExCTexture).name());
00193                 return GetObject(m_CurrentObjectId)->m_Texture;
00194                 //std::cout<<"ExManagerTexture ::"<<Name<<" Current object"<<std::endl;
00195         }catch(...)
00196         {
00197                 if(!Load(Name))
00198                 {
00199                         std::cout<<"ExManagerTexture ::Exception can make :"<<Name<<" Current object"<<std::endl;
00200                         return -1;
00201                 }
00202                 return -1;
00203         }
00204 UnGuard
00205 }

bool Init std::string    FileName
 

Reimplemented from ExManagerObject< ExCTexture >.

Definition at line 72 of file ExManagerTexture.cpp.

References Guard, and Init().

00073 {
00074 Guard(bool  ExManagerTexture::Init(std::string FileName))
00075         //openf file and load object
00076 
00077         return true;
00078 UnGuard
00079 }

void Init void    [virtual]
 

Reimplemented from ExManagerObject< ExCTexture >.

Definition at line 57 of file ExManagerTexture.cpp.

References Guard, ExManagerObject::Init(), and Init().

Referenced by Init(), and InitManager().

00058 {
00059 Guard(void  ExManagerTexture::Init(void))
00060         ExManagerObject<ExCTexture>::Init();
00061 //      Add("back.bmp");
00062 UnGuard
00063 }

ExCAction InputAction ExCAction    Action [virtual]
 

Reimplemented from ExManager.

Definition at line 228 of file ExManagerTexture.cpp.

References Guard, InputAction(), ExManagerObject< ExCTexture >::List(), LOAD_TEXTURE, ExCAction::m_Action, ExCAction::m_NextAction, and UNLOAD_TEXTURE.

Referenced by InputAction().

00229 {
00230 Guard(ExCAction ExManagerTexture::InputAction(ExCAction Action))
00231         switch(Action.m_Action)
00232         {
00233         case LIST_TEXTURE:
00234                 List();
00235                 break;
00236         case LOAD_TEXTURE:
00237                 break;
00238         case UNLOAD_TEXTURE:
00239                 break;
00240         }
00241         if(Action.m_NextAction){return *Action.m_NextAction;}
00242         else{return NOTHING;}
00243 UnGuard
00244 }

bool Load std::string    FileName
 

Reimplemented from ExManagerObject< ExCTexture >.

Definition at line 94 of file ExManagerTexture.cpp.

References Add(), CheckExist(), ExManager::Consol, Guard, and Load().

Referenced by Add(), GetTextureId(), Load(), ExCModelMD2::Load(), ExCMap::LoadMap(), ExCModel3DS::ReadFace(), SetCurrentObject(), and ExCSystemeParticule::SetParticuleTexture().

00095 {
00096 Guard(ExManagerTexture::Load(std::string FileName))
00097         if(FileName.find(".")<FileName.length())//if extension remove them
00098         {
00099                 FileName.erase(FileName.find("."),FileName.length()-FileName.find("."));
00100         }
00101         if(!CheckExist(FileName)){return true;}
00102         
00103         try
00104         {
00105                 return  Add(ExCTexture(FileName));
00106         }catch(ExCExpFileNotFound)
00107         {
00108                 *Consol<<"Exception file not found texture not added"<<std::endl;
00109                 return false;
00110         }
00111         catch(ExCExpNullPointer)
00112         {
00113                 *Consol<<"Exception null pointer texture not added"<<std::endl;
00114                 return false;
00115         }
00116         
00117 UnGuard
00118 }

void Reset void    [virtual]
 

Reimplemented from ExManagerObject< ExCTexture >.

Definition at line 65 of file ExManagerTexture.cpp.

References Guard, ExManagerObject::Reset(), and Reset().

Referenced by ExManagerCommand::ProcesExCAction(), and Reset().

00066 {
00067 Guard(void  ExManagerTexture::Reset(void))
00068         ExManagerObject<ExCTexture>::Reset();
00069 UnGuard
00070 }

bool SetCurrentObject ExNihilo::ExId    id
 

Reimplemented from ExManagerObject< ExCTexture >.

Definition at line 161 of file ExManagerTexture.cpp.

References ExManagerObject< ExCTexture >::GetObject(), Guard, ExManagerObject< ExCTexture >::m_CurrentObjectId, and SetCurrentObject().

00162 {
00163 Guard(ExManagerTexture::SetCurrentObject(ExNihilo::ExId id))
00164         if(GetObject(id)!=NULL)
00165         {
00166                 m_CurrentObjectId=id;
00167                 try
00168                 {       
00169                         glBindTexture(GL_TEXTURE_2D,GetObject(m_CurrentObjectId)->m_Texture);
00170                         return true;
00171                         //std::cout<<"ExManagerTexture ::"<<Name<<" Current object"<<std::endl;
00172                         }catch(...)
00173                         {
00174                                 std::cout<<"ExManagerTexture ::Exception can make :"<<m_CurrentObjectId<<" Current object"<<std::endl;
00175                                 return false;
00176                         }
00177         }
00178         return false;
00179 UnGuard
00180 }

bool SetCurrentObject std::string    Name
 

Reimplemented from ExManagerObject< ExCTexture >.

Definition at line 135 of file ExManagerTexture.cpp.

References ExManagerObject< ExCTexture >::GetObject(), ExManagerId::GetObjectId(), Guard, Load(), ExManagerObject< ExCTexture >::m_CurrentObjectId, ExManagerObject< ExCTexture >::ManagerId, and SetCurrentObject().

Referenced by ExCModelASC::BuildList(), ExCModel3DS::BuildList(), ExCMap::BuildSkyBox(), ExCOctree::BuilList(), ExCMap::BuilList(), ExManagerConsole::Draw(), ExCModelMD2::Draw(), ExCInterface::Draw(), ExCEntite::DrawWithoutList(), ExCMap::LoadMap(), and SetCurrentObject().

00136 {
00137 Guard(ExManagerTexture::SetCurrentObject(std::string Name))
00138         
00139         if(Name.find(".")<Name.length())//if extension remove them
00140         {
00141                 Name.erase(Name.find("."),Name.length()-Name.find("."));
00142         }
00143         try
00144         {       
00145                 m_CurrentObjectId=ManagerId->GetObjectId(Name,typeid(ExCTexture).name());
00146                 glBindTexture(GL_TEXTURE_2D,GetObject(m_CurrentObjectId)->m_Texture);
00147                 return true;
00148                 //std::cout<<"ExManagerTexture ::"<<Name<<" Current object"<<std::endl;
00149         }catch(...)
00150         {
00151                 if(!Load(Name))
00152                 {
00153                         std::cout<<"ExManagerTexture ::Exception can make :"<<Name<<" Current object"<<std::endl;
00154                         return true;
00155                 }
00156                 return false;
00157         }
00158 UnGuard
00159 }


Field Documentation

bool m_flag = false [static, private]
 

Definition at line 26 of file ExManagerTexture.cpp.

Referenced by CreateSingleton().

ExManagerTexture * m_instance = NULL [static, private]
 

Definition at line 27 of file ExManagerTexture.cpp.

Referenced by CreateSingleton().


The documentation for this class was generated from the following files:
Generated on Tue Dec 10 18:20:45 2002 for ExNihilo by doxygen1.3-rc1