OpenPolygon  1.0.0
OpenPolygon is a Rendering Engine
texturemanager.h
1 /*
2  Copyright (C) 2014 - 2016 Mutzii
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 */
18 #ifndef TEXTUREMANAGER_H
19 #define TEXTUREMANAGER_H
20 
21 #include "index.h"
22 #include "texture.h"
23 #include "display.h"
24 
25 namespace Engine
26 {
43  {
44  private:
45 
46  //Messages
47  const std::string ISLOADED = " texture is already loaded.";
48  const std::string ISNOT_SIX = " texture array size is not 6";
49 
50 
51  static TextureManager * ptrInstance;
54  TextureManager( const TextureManager &){}
55  void operator =( const TextureManager &){}
56 
63  Texture * createTexture( FIBITMAP * bitmap );
64 
65  public:
66 
72  static TextureManager * getSingletonPtr(void);
73  void finish(void);
74 
75 
86  void getPixelData( Texture * texture );
87  void getPixelDepthData( Texture * texture );
88 
97  Texture * createTBOandBindVBO( uint vbo_id );
98 
109  Texture * createTextureArray( const std::string & texture_name , int width , int height , int size );
110  Texture * createStorage( Texture * texture_array , GLint format );
111  void addTextureToArray( Texture * array , Texture * texture , int layer );
112 
119  Texture * createTexture( const std::string & resource_path );
120 
128  Texture * createTexture( Texture * texture , FIBITMAP * bitmap );
129 
138  Texture * createTexture( int width , int height , uchar * pixeldata );
139 
150  Texture * createFloatTexture( int width , int height , float * data );
151 
160  Texture * addMatrixToTexture( Texture * float_texture , GLintptr offset , glm::mat4 matrix );
161  Texture * addVec4ToTexture( Texture * float_texture , GLintptr offset , glm::vec4 vector );
162 
172  Texture * addCharTextureToArray( Texture * array_texture , Texture * add_texture, int layer );
173 
183  Texture * createCharTexture( int width , int height , int depth , uchar * pixeldata );
184 
191  Texture * createCubemapping( Textures six_textures , const std::string & texture_name );
192 
220  Texture * createFrameBufferTexture( int width , int height , GLint format , GLenum output_format );
221 
235  Texture * createRenderBuffer( int render_width , int render_height , GLenum format );
236 
243  Texture * createEmptyTexture(void);
244 
255  bool loadTexture( Texture * texture , bool mipmapping );
256  bool loadFloatTexture( Texture * texture );
257  bool loadFloatTexture1D( Texture * texture );
258 
264  void destroy( Texture * texture );
265 
272  Texture * getTexture( const std::string & texture_name );
273 
274  private:
275 
276  Textures mTextures;
277  };
278 }
279 
280 
281 #endif // TEXTUREMANAGER_H
The Texture class.
Definition: texture.h:37
bool loadTexture(Texture *texture, bool mipmapping)
loadTexture
Definition: TextureManager.cpp:725
Texture * getTexture(const std::string &texture_name)
getTexture
Definition: TextureManager.cpp:140
Texture * addCharTextureToArray(Texture *array_texture, Texture *add_texture, int layer)
addCharTextureToArray
Definition: TextureManager.cpp:322
Texture * createRenderBuffer(int render_width, int render_height, GLenum format)
TextureManager::createRenderBuffer.
Definition: TextureManager.cpp:546
Definition: element.h:23
Texture * createEmptyTexture(void)
createEmptyTexture
Definition: TextureManager.cpp:37
void destroy(Texture *texture)
destroy
Definition: TextureManager.cpp:845
Texture * createCubemapping(Textures six_textures, const std::string &texture_name)
createCubemapping
Definition: TextureManager.cpp:572
Texture * createTBOandBindVBO(uint vbo_id)
createTBOandBindVBO
Definition: TextureManager.cpp:108
Texture * createTextureArray(const std::string &texture_name, int width, int height, int size)
createTextureArray
Definition: TextureManager.cpp:127
void finish(void)
TextureManager::finish.
Definition: TextureManager.cpp:821
The TextureManager class.
Definition: texturemanager.h:42
Texture * addMatrixToTexture(Texture *float_texture, GLintptr offset, glm::mat4 matrix)
addMatrixToTexture
Definition: TextureManager.cpp:207
Texture * createCharTexture(int width, int height, int depth, uchar *pixeldata)
createCharTexture
Definition: TextureManager.cpp:366
static TextureManager * getSingletonPtr(void)
getSingletonPtr
Definition: TextureManager.cpp:26
Texture * createFrameBufferTexture(int width, int height, GLint format, GLenum output_format)
TextureManager::createFrameBufferTexture.
Definition: TextureManager.cpp:449
Texture * createStorage(Texture *texture_array, GLint format)
TextureManager::createStorage.
Definition: TextureManager.cpp:276
Texture * createFloatTexture(int width, int height, float *data)
createFloatTexture
Definition: TextureManager.cpp:198
void getPixelData(Texture *texture)
TextureManager::getTexImage.
Definition: TextureManager.cpp:75