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
moRenderManager.h
Go to the documentation of this file.
1 /*******************************************************************************
2 
3  moRenderManager.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 
29 
30 *******************************************************************************/
31 
32 #ifndef __MO_RENDERMANAGER_H__
33 #define __MO_RENDERMANAGER_H__
34 
35 #include <moTextureManager.h>
36 #include <moGUIManager.h>
37 #include <moBuckets.h>
38 
39 class moEffect;
40 class moBucketPool;
41 
42 #define MO_RENDER_RESOLUTION 0
43 #define MO_SCREEN_RESOLUTION 1
44 
45 #define MO_RENDER_TO_TEXTURE_FBSCREEN 0
46 #define MO_RENDER_TO_TEXTURE_FBOBJECT 1
47 
49 
53 
54 };
55 
57 
60 
61 };
62 
64 
65  public:
66 
67  int Width() const { return width; }
68  int Height() const { return height; }
69  float Aspect() const { return aspect; }
70 
71  int width;
72  int height;
73  float aspect;
74 
75 
76 };
77 
78 
80 
81  public:
82 
83  moVector2f points[4];
84 
85 
86 };
87 
89 
90 
92 
93  public:
94 
95  moDisplay();
96  moDisplay( int w, int h);
97  moDisplay( float w, float h);
98  moDisplay( const moDisplay& p_src );
99  virtual ~moDisplay();
100  moDisplay& operator= ( const moDisplay& p_src );
101 
102  const moResolution& Resolution() const {
103  return m_DisplayResolution;
104  }
105 
106  float HeightToProportion( float p_height ) const {
107  return p_height/Proportion();
108  }
109 
110  float Proportion() const {
111  return m_DisplayResolution.Aspect();
112  }
113 
114  private:
115 
116  moResolution m_DisplayResolution;
117 
118 };
119 
121 
122 
124 
125  public:
126 
128 
130 
133 
135 
136  moRenderClips Clips;
137 
138  moDisplays Displays;
139 
140 };
141 
142 
143 
144 
159 {
160  public:
164  moRenderManager();
168  virtual ~moRenderManager();
169 
174  bool Lock();
179  bool Unlock();
180 
192  virtual MOboolean Init( moRenderManagerMode p_render_to_texture_mode,
193  MOint p_screen_width, MOint p_screen_height,
194  MOint p_render_width, MOint p_render_height);
199  virtual MOboolean Finish();
200 
201  void SetView( int p_width, int p_height );
202  void SetInterfaceView( int p_width, int p_height );
203 
208  MOboolean IsRenderToFBOEnabled();
213  MOboolean RenderResEqualScreenRes();
214 
219  void SetRenderToTexMode( moRenderManagerMode p_render_to_texture_mode);
224  MOint GetRenderToTexMode() { return m_render_to_texture_mode; }
225 
230  void BeginUpdate();
235  void BeginUpdateDevice();
240  void EndUpdateDevice();
245  void EndUpdate();
246 
251  void BeginUpdateObject();
256  void EndUpdateObject();
257 
262  void BeginDraw();
268  void BeginDrawEffect();
273  void EndDrawEffect();
278  void EndDraw();
279 
285  void DrawRenderTexure(MOint p_resolution) { DrawTexture(p_resolution, 0); }
292  void DrawTexture(MOint p_resolution, MOint p_tex_num);
300  void DrawTexture(MOint p_width, MOint p_height, MOint p_tex_num);
305  void SaveScreen();
306 
307  bool Screenshot( moText pathname, moText& screenshot_result, const moText& image_format="PNG", const moText& file_pattern="image_{DATETIME}_{####}.png" );
308 
313  bool PreviewShot( bool shot_start = false);
314 
320  void CopyRenderToTexture(MOint p_tex_num);
325  MOint RenderTexGLId(MOint p_tex_num);
326 
331  MOint ScreenWidth() const;
336  MOint ScreenHeight() const;
337 
342  MOint InterfaceWidth() const;
347  MOint InterfaceHeight() const;
348 
353  float ScreenProportion() const;
354 
355 
360  MOint RenderWidth() const;
365  MOint RenderHeight() const;
366 
371  float RenderProportion() const;
372 
373 
378  MOboolean MultiTextureSupported() const;
383  MOboolean FramebufferObjectSupported() const;
388  MOboolean ShadersSupported() const;
389 
390  MOboolean IsTextureNonPowerOf2Disabled() const;
391 
392  void SetOutputConfiguration( moRenderOutputConfiguration p_output_configuration );
393 
394  moRenderOutputConfiguration& GetOutputConfiguration();
395 
397  return m_pFramesPool;
398  }
399 
400  int CreateLayer( moEffect* p_scene_effect );
401  void RenderLayer( int layer_id );
402  int Render( moObject3D* p_pObj, moCamera3D* p_pCamera );
403 
404 
405  protected:
406 
410 
412 
417 
419 
421 
423 
425 
426  MOint m_screen_width, m_screen_height;
427  MOint m_render_width, m_render_height;
428  MOint m_interface_width, m_interface_height;
429 
430  MOint m_render_tex_moid[6];
431  MOuint m_render_attach_points[4];
433 
434  MOboolean ValidSourceTexNum(MOint p_tex_num) const { return (0 <= p_tex_num) && (p_tex_num < 4); }
435  MOboolean ValidDestTexNum(MOint p_tex_num) const { return (0 < p_tex_num) && (p_tex_num < 4); }
436 };
437 
438 
439 #endif
440 
moTextureManager * m_pTextureManager
moShaderManager * m_pSHManager
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 )
Definition: moLock.h:50
moRenderManagerMode
MOboolean ValidDestTexNum(MOint p_tex_num) const
#define MOboolean
Definition: moTypes.h:385
float HeightToProportion(float p_height) const
Clase base abstracta de donde deben derivar los objetos [virtual pura].
Definition: moAbstract.h:191
moRenderOutputMode m_OutputMode
#define LIBMOLDEO_API
Definition: moTypes.h:180
float Proportion() const
MOboolean m_saved_screen
virtual MOboolean Init()
clase de para manejar textos
Definition: moText.h:75
moDeclareExportedDynamicArray(moRenderClip *, moRenderClips)
float Aspect() const
moRenderManagerMode m_render_to_texture_mode
moRenderOutputMode
#define MOint
Definition: moTypes.h:388
const moResolution & Resolution() const
MOint GetRenderToTexMode()
int Width() const
Administrador de moBucket 's.
Definition: moBuckets.h:152
MOboolean ValidSourceTexNum(MOint p_tex_num) const
Clase que implementa un administrador de shaders.
manejador de operaciones comunes de Open GL
Definition: moGLManager.h:154
moDisplays Displays
clip or section of render resolution
virtual MOboolean Finish()
moRenderClips Clips
normal output need this
moGLManager * m_pGLManager
moBucketsPool * m_pFramesPool
moMatrix3 & operator=(const moMatrix3 &rkM)
rsolution ouput to display output
moBucketsPool * GetFramesPool()
moDecoderManager * m_pDecoderManager
moTimerAbsolute m_PreviewShotTimer
#define MOuint
Definition: moTypes.h:387
int Height() const
clase base para objetos dibujables
Definition: moEffect.h:82
void DrawRenderTexure(MOint p_resolution)
moRenderOutputConfiguration m_OutputConfiguration
moFBManager * m_pFBManager
Clase para el control de un temporizador (absoluto)
Definition: moTimer.h:183
moResolution m_OutputResolution
normal mode need this