GlobeEngine
Composition.h
Go to the documentation of this file.
1 
9 #ifndef GlobeEngine_Composition_h
10 #define GlobeEngine_Composition_h
11 
12 #include "OpenGL_Includes.h"
13 #include "DrawableComponent.h"
14 #include "TextureHandle.h"
15 #include "Camera.h"
16 #include "Shader.h"
17 #include "SceneStateSet.h"
18 #include "FrameBufferObject.h"
19 #include <vmmlib/matrix.hpp>
20 #include <memory>
21 
22 namespace ge {
24  {
25  public:
26  Composition();
27  ~Composition();
28  void clear();
29  void create(std::shared_ptr<ge::Shader> _shader);
30  void create(std::string _shaderFile);
31  void update() {};
32  void setSceneState(SceneStateSet* _state);
33  void createFramebuffer(enum FrameBufferObject::FBOTYPE _type, int _w, int _h, int _channels);
34  void draw(std::shared_ptr<ge::Camera> _cam);
35  void setTextureHandle(GLint _unit,const std::shared_ptr<ge::TextureHandle> _handle);
36 
37  void setModelViewMatrix(vmml::Matrix4d _mat);
38  void setProjectionMatrix(vmml::Matrix4d _mat);
39  void setInverseViewProjectionMatrix(vmml::Matrix4d _inverseViewProjectionMatrix);
41 
42  void setViewport(vmml::Vector2d _viewport);
43 
44  void enable();
45  void disable();
46  bool isEnabled();
47  void enableFramebuffer();
48  void disableFramebuffer();
49  bool isFramebufferEnabled();
50  void setZeroFramebufferID(int _id);
51 
52  void reloadShader(std::shared_ptr<ge::Shader> _shader);
53 
54  protected:
55  void create();
56  virtual void drawFrame(std::shared_ptr<ge::Camera> _cam);
57  void drawPlane();
59 
62 
63  vmml::Matrix4d modelViewMatrix;
64  vmml::Matrix4d projectionMatrix;
66 
67  bool enabled;
69 
71  std::shared_ptr<ge::TextureHandle> textures[32];
72 
73  vmml::Vector2d viewport;
74 
75  };
76 }
77 
78 #endif
Definition: DrawableComponent.h:25
void drawPlane()
Definition: Composition.cpp:126
FBOTYPE
Definition: FrameBufferObject.h:23
void enable()
Definition: Composition.cpp:209
vmml::Matrix4d inverseViewProjectionMatrix
Definition: Composition.h:65
void create()
Definition: Composition.cpp:45
bool isFramebufferEnabled()
Definition: Composition.cpp:234
void update()
Definition: Composition.h:31
void enableFramebuffer()
Definition: Composition.cpp:224
void clear()
Definition: Composition.cpp:22
Definition: FrameBufferObject.h:20
void setUniformsForMatrices()
Definition: Composition.cpp:114
void disableFramebuffer()
Definition: Composition.cpp:229
void setViewport(vmml::Vector2d _viewport)
Definition: Composition.cpp:239
void setTextureHandle(GLint _unit, const std::shared_ptr< ge::TextureHandle > _handle)
Definition: Composition.cpp:79
virtual void drawFrame(std::shared_ptr< ge::Camera > _cam)
Definition: Composition.cpp:109
void setModelViewMatrix(vmml::Matrix4d _mat)
Definition: Composition.cpp:195
bool enabledFramebuffer
Definition: Composition.h:68
FrameBufferObject * getFrameBuffer()
Definition: Composition.cpp:185
void disable()
Definition: Composition.cpp:214
void setZeroFramebufferID(int _id)
Definition: Composition.cpp:190
SceneStateSet * sceneState
Definition: Composition.h:60
void draw(std::shared_ptr< ge::Camera > _cam)
Definition: Composition.cpp:87
bool enabled
Definition: Composition.h:67
int texChannels
Definition: Composition.h:70
Definition: AvalancheTrainingSimulationEngine.h:28
Definition: Composition.h:23
Definition: SceneStateSet.h:41
Composition()
Definition: Composition.cpp:12
bool isEnabled()
Definition: Composition.cpp:219
void createFramebuffer(enum FrameBufferObject::FBOTYPE _type, int _w, int _h, int _channels)
Definition: Composition.cpp:149
vmml::Matrix4d modelViewMatrix
Definition: Composition.h:63
~Composition()
Definition: Composition.cpp:17
void setSceneState(SceneStateSet *_state)
Definition: Composition.cpp:74
void reloadShader(std::shared_ptr< ge::Shader > _shader)
Definition: Composition.cpp:181
std::shared_ptr< ge::TextureHandle > textures[32]
Definition: Composition.h:71
void setProjectionMatrix(vmml::Matrix4d _mat)
Definition: Composition.cpp:200
FrameBufferObject compositionFramebuffer
Definition: Composition.h:61
void setInverseViewProjectionMatrix(vmml::Matrix4d _inverseViewProjectionMatrix)
Definition: Composition.cpp:205
vmml::Vector2d viewport
Definition: Composition.h:73
vmml::Matrix4d projectionMatrix
Definition: Composition.h:64