![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsOpenGLTexturePool.hpp 00003 00004 TexturePool class (hpp file). 00005 00006 SUKITTI PUNAK (03/27/2009) 00007 ******************************************************************************/ 00008 #ifndef TAPs_OPENGL_TEXTURE_POOL_HPP 00009 #define TAPs_OPENGL_TEXTURE_POOL_HPP 00010 00011 //#include "../Core/TAPsStdLib.hpp" 00012 #include "TAPsOpenGLFns.hpp" 00013 00014 BEGIN_NAMESPACE_TAPs__OpenGL 00015 00016 //============================================================================= 00020 class TexturePool { 00021 //============================================================================= 00022 public: 00023 // Member Functions ------------------------------------------------------- 00025 friend std::ostream & operator<< ( std::ostream &output, TexturePool const &obj ) 00026 { 00027 output << obj.StrInfo(); 00028 return output; 00029 } 00030 //------------------------------------------------------------------------- 00032 TexturePool (); 00034 //TexturePool ( TexturePool const &v ); 00036 ~TexturePool (); 00038 bool Clear (); 00039 //------------------------------------------------------------------------- 00041 virtual std::string StrInfo () const; 00042 //------------------------------------------------------------------------- 00044 //inline TexturePool & operator= ( TexturePool const &v ); 00045 00046 //------------------------------------------------------------------------- 00048 GLuint Get1DTextureNumber ( unsigned int number ) { 00049 if ( number < m_v1DTextureList.size() ) return m_v1DTextureList[number]->TextureID; 00050 else return 0; 00051 } 00053 GLuint Get2DTextureNumber ( unsigned int number ) { 00054 if ( number < m_v2DTextureList.size() ) return m_v2DTextureList[number]->TextureID; 00055 else return 0; 00056 } 00058 GLuint Get3DTextureNumber ( unsigned int number ) { 00059 if ( number < m_v3DTextureList.size() ) return m_v3DTextureList[number]->TextureID; 00060 else return 0; 00061 } 00062 //------------------------------------------------------------------------- 00063 00088 00089 GLuint Create1DTextureFromFile ( std::string const & fileName, std::string const & texName = "" ); 00091 GLuint Create2DTextureFromFile ( std::string const & fileName, std::string const & texName = "" ); 00093 GLuint Create3DTextureFromFile ( std::string const & fileName, std::string const & fileType, const int depth, std::string const & texName = "" ); 00094 00096 bool Delete1DTexture ( GLuint assignedID ) { return false; }; 00098 bool Delete1DTexture ( std::string const & name ) { return false; }; 00099 00101 bool Delete2DTexture ( GLuint assignedID ) { return false; }; 00103 bool Delete2DTexture ( std::string const & name ) { return false; }; 00104 00106 bool Delete3DTexture ( GLuint assignedID ) { return false; }; 00108 bool Delete3DTexture ( std::string const & name ) { return false; }; 00109 00110 // Data Members ----------------------------------------------------------- 00111 //============================================================================= 00112 protected: 00113 // Member Functions ------------------------------------------------------- 00114 // Data Members ----------------------------------------------------------- 00115 //============================================================================= 00116 private: 00117 // Member Functions ------------------------------------------------------- 00118 // Data Members ----------------------------------------------------------- 00119 class TextureObj { 00120 public: 00121 TextureObj () : TextureID( 0 ), TextureName( "" ) {} 00122 GLuint TextureID; 00123 std::string TextureName; 00124 }; 00125 std::vector< TextureObj * > m_v1DTextureList; 00126 std::vector< TextureObj * > m_v2DTextureList; 00127 std::vector< TextureObj * > m_v3DTextureList; 00128 //--------------------------------------------------------------- 00129 //============================================================================= 00130 }; // END CLASS TexturePool 00131 //============================================================================= 00132 END_NAMESPACE_TAPs__OpenGL 00133 //----------------------------------------------------------------------------- 00134 // If the class is NOT template, use this 00135 #if !defined( TAPs_USE_EXPORT ) 00136 #include "TAPsOpenGLTexturePool.cpp" 00137 #endif 00138 00139 //----------------------------------------------------------------------------- 00140 #endif 00141 //34567890123456789012345678901234567890123456789012345678901234567890123456789 00142 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----