libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo is the group of objects and functions that executes the basic operations of Moldeo 1.0 Platform.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
moTextureManager.h
Go to the documentation of this file.
1 /*******************************************************************************
2 
3  moTextureManager.h
4 
5  ****************************************************************************
6  * *
7  * This source is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This code is distributed in the hope that it will be useful, but *
13  * WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15  * General Public License for more details. *
16  * *
17  * A copy of the GNU General Public License is available on the World *
18  * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
19  * obtain it by writing to the Free Software Foundation, *
20  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  * *
22  ****************************************************************************
23 
24  Copyright(C) 2006 Fabricio Costa
25 
26  Authors:
27  Fabricio Costa
28  Andres Colubri
29 
30 *******************************************************************************/
31 
32 #ifndef __MO_TEXTURE_MANAGER_H
33 #define __MO_TEXTURE_MANAGER_H
34 
35 #include "moTexture.h"
36 #include "moResourceManager.h"
37 #include <moFileManager.h>
38 
40 
42 
44 
52 };
53 
55 
56  public:
58  virtual ~moTextureBuffer();
59 
60  virtual MOboolean Init();
61  virtual MOboolean Init( moText p_foldername, moText p_bufferformat, moResourceManager* p_pResourceManager );
62  virtual MOboolean Init( moText p_foldername, moTextureBufferFormat p_bufferformat, int p_pattern_width, int p_pattern_height, moResourceManager* p_pResourceManager );
63  virtual MOboolean Finish();
64 
65  virtual int GetFrame( MOuint p_i );
66 
67  virtual void ReleaseFrame( MOuint p_i );
68 
69  virtual moTextureMemory* GetTexture( MOuint p_i );
70 
71  MOboolean UpdateImages( int maxfiles = -1 );
72 
73  MOboolean LoadCompleted();
74  int GetImagesProcessed() { return m_ImagesProcessed; }
75 
76  MOboolean LoadImage( moText p_ImageName, moBitmap* pImage, int indeximage );
77 
78  moText GetBufferPath() { return m_BufferPath; }
79  moText GetBufferFormat() { return m_BufferFormat; }
80 
81  moText GetName() { return m_FolderName; }
82 
83  moTextureFrames& GetBufferLevels( int L, int C );
84  moTextureFrames& GetBufferPatterns( moTexture* p_ImageReference, int x, int y, int width=0, int height=0 );
85  moTextureFrames& GetBufferPatterns( const moTexture& p_ImageReference, int x, int y, int width=0, int height=0 );
86 
91 
92  //size of max_luminance
94 
95  private:
96 
97  int pattern_width;
98  int pattern_height;
99 
100  MOint m_ImagesProcessed;
101  MOboolean m_bLoadCompleted;
102  MOint m_ActualImage;
103 
104 
105  moText m_FolderName;
106  moText m_BufferPath;
107  moText m_BufferFormat;
108 
109  moResourceManager* m_pResourceManager;
110 
111  moTextureFrames m_Frames;
112  moDirectory* m_pDirectory;
113 
116  moTextureFrames** m_pBufferLevels;
117  moTextureFrames* m_pBufferPatterns;
118 
119 };
120 
122 
124 
125 
126 
136 {
137  public:
138 
143 
147  virtual ~moTextureManager();
148 
152  virtual MOboolean Init();
153 
157  virtual MOboolean Finish();
158 
166  MOint GetTextureMOId(moParam *param, MOboolean p_create_tex);
167 
171  MOint GetTextureMOId(moValue *value, MOboolean p_create_tex);
172 
173 
182  MOint GetTextureMOId(moText p_name, MOboolean p_create_tex, bool p_refresh=false );
183 
189  MOint GetTextureMOId(MOuint p_glid);
190 
199  MOint GetTextureBuffer( moText p_foldername, MOboolean p_create_tex = true, moText p_bufferformat = "JPGAVERAGE" );
200 
201  moTextureBuffer* GetTextureBuffer( int idx );
202 
210  MOint AddTexture(MOuint p_type, moText p_name, moTexParam p_tex_param = MODefTex2DParams);
211 
217  MOint AddTexture(moParam* p_param);
218 
227  MOint AddTexture(moValue* p_value);
228 
232  MOint AddTexture(moText p_name, MOuint p_width, MOuint p_height, moTexParam p_tex_param = MODefTex2DParams);
233 
246  MOint AddTexture(moText p_name, MOuint p_width, MOuint p_height, GLvoid* p_buffer, GLenum p_pixel_format = GL_RGBA, GLenum p_pixel_type = GL_UNSIGNED_BYTE, moTexParam p_tex_param = MODefTex2DParams);
247 
253  MOint AddTexture(moText p_filename);
254 
260  MOint AddTextureBuffer( moText p_foldername, moText p_bufferformat = "JPGAVERAGE" );
261 
262 
268  MOboolean DeleteTexture(MOuint p_moid);
269 
274  MOuint GetTextureCount() { return m_textures_array.Count(); }
275 
281  moTexture* GetTexture(MOuint p_moid) { return m_textures_array[p_moid]; }
282 
288  MOint GetType(MOuint p_moid);
289 
295  MOuint GetGLId(MOuint p_moid);
296 
304  moText GetName(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetName() : moText(""); }
305 
311  MOint GetWidth(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetWidth() : MO_UNDEFINED; }
312 
318  MOint GetHeight(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetHeight() : MO_UNDEFINED; }
319 
325  MOint GetDataWidth(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetDataWidth() : MO_UNDEFINED; }
326 
332  MOint GetDataHeight(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetDataHeight() : MO_UNDEFINED; }
333 
341  MOint GetComponents(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetComponents() : MO_UNDEFINED; }
342 
348  MOlong GetTexelCount(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetTexelCount() : MO_UNDEFINED; }
349 
356  MOlong GetDataTexelCount(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetDataTexelCount() : MO_UNDEFINED; }
357 
363  MOfloat GetMaxCoordS(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetMaxCoordS() : MO_UNDEFINED; }
364 
370  MOfloat GetMaxCoordT(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetMaxCoordT() : MO_UNDEFINED; }
371 
377  moTexParam GetTexParam(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetTexParam() : MOUndefinedTex; }
378 
384  GLenum GetTexTarget(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetTexTarget() : MO_UNDEFINED; }
385 
392  GLenum GetTexInternalFormat(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetTexInternalFormat() : MO_UNDEFINED; }
393 
400  GLint GetMinFilter(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetMinFilter() : MO_UNDEFINED; }
401 
407  GLint GetMagFilter(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetMagFilter() : MO_UNDEFINED; }
408 
415  GLint GetWrapS(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetWrapS() : MO_UNDEFINED; }
416 
423  GLint GetWrapT(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetWrapT() : MO_UNDEFINED; }
424 
430  moFBO* GetFBO(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetFBO() : NULL; }
431 
437  MOint GetFBOAttachPoint(MOuint p_moid) { return ValidTexture(p_moid) ? m_textures_array[p_moid]->GetFBOAttachPoint() : MO_UNDEFINED; }
438 
444  MOboolean ValidTexture(MOuint p_moid) { return m_textures_array[p_moid] != NULL; }
445 
450  MOuint GetTypeForFile(moText p_filename);
451 
452  void RefreshAll();
453 
454  virtual void Update(moEventList *Events);
455 
456 
458 
459 
460  protected:
463  moTextureArray m_textures_array;
464 
465  moTextureBuffers m_textures_buffers;
466 
467 
468  moTexture* CreateTexture(MOuint p_type, moText p_name, moTexParam p_param = MODefTex2DParams);
469  MOboolean CreateMultipleTex(moTextureMultiple* p_tex_mult, moParam* p_param);
470  MOboolean CreateMultipleTex(moTextureMultiple* p_tex_mult, moValue* p_value);
471 };
472 
473 
474 #endif
475 
void moBitmap
Definition: moTexture.h:44
moTexParam GetTexParam(MOuint p_moid)
MOint GetHeight(MOuint p_moid)
Valor de un Parámetro.
Definition: moValue.h:501
Parámetros internos de una textura.
Definition: moTypes.h:543
moTextureArray m_textures_array
moTextureBufferFormat
Buffer de imágenes.
Recurso ( objeto para cargar y manipular objetos físicos de datos de imágenes, audio, video, 3d, 2d, fuentes, shaders y de cualquier otro tipo extendible por un plugin )
MOint GetDataWidth(MOuint p_moid)
virtual MOboolean Finish()
Finaliza el objeto, libera recursos.
Definition: moAbstract.cpp:147
#define MO_UNDEFINED
Definition: moTypes.h:379
MOfloat GetMaxCoordS(MOuint p_moid)
#define MOboolean
Definition: moTypes.h:385
const moTexParam MODefTex2DParams
Parámetros internos predeterminados de una textura.
Definition: moTypes.h:562
moGLManager * m_glmanager
moText GetBufferFormat()
#define MObyte
Definition: moTypes.h:400
Clase base abstracta de donde deben derivar los objetos [virtual pura].
Definition: moAbstract.h:191
virtual MOboolean Init()
Inicializa el objeto.
Definition: moAbstract.cpp:141
moTextureBuffer * moTextureBufferPtr
GLenum GetTexInternalFormat(MOuint p_moid)
moFBManager * m_fbmanager
#define LIBMOLDEO_API
Definition: moTypes.h:180
#define MOfloat
Definition: moTypes.h:403
virtual MOboolean Init()
Definition: moFBO.h:60
Lista de eventos.
Definition: moEventList.h:139
clase de para manejar textos
Definition: moText.h:75
moTexture * GetTexture(MOuint p_moid)
GLint GetWrapT(MOuint p_moid)
#define MOlong
Definition: moTypes.h:391
MOint GetComponents(MOuint p_moid)
moDeclareExportedDynamicArray(moTextureFramePtr, moTextureFrames)
moTextureBuffers m_textures_buffers
MOint GetWidth(MOuint p_moid)
moFBO * GetFBO(MOuint p_moid)
moText0 moText
Definition: moText.h:291
#define MOint
Definition: moTypes.h:388
GLint GetWrapS(MOuint p_moid)
MOboolean ValidTexture(MOuint p_moid)
MOfloat GetMaxCoordT(MOuint p_moid)
clase base para el manejo de una textura
Definition: moTexture.h:78
MOint GetFBOAttachPoint(MOuint p_moid)
Administrador de recursos.
virtual void Update(moEventList *p_EventList)
moText GetName(MOuint p_moid)
GLint GetMagFilter(MOuint p_moid)
manejador de operaciones comunes de Open GL
Definition: moGLManager.h:154
moMoldeoObjectType GetType() const
MOint GetDataHeight(MOuint p_moid)
virtual MOboolean Finish()
Secuencia de texturas.
Definition: moTexture.h:744
const moTexParam MOUndefinedTex
Parámetros internos predeterminados de una textura no identificados.
Definition: moTypes.h:580
moText GetBufferPath()
#define MOuint
Definition: moTypes.h:387
MOlong GetDataTexelCount(MOuint p_moid)
clase base para el manejo de una textura con su copia comprimida en memoria
Definition: moTexture.h:442
moTextureMemory * moTextureFramePtr
GLint GetMinFilter(MOuint p_moid)
GLenum GetTexTarget(MOuint p_moid)
MOlong GetTexelCount(MOuint p_moid)