ComputerGraphik TU WIEN
cubeMapObject.hpp
Go to the documentation of this file.
1 #ifndef CUBEMAPOBJECT_HPP
2 #define CUBEMAPOBJECT_HPP
3 
4 #include "sceneObject.hpp"
5 
6 #include <memory>
7 #include <vector>
8 #include <GL/glew.h>
9 #include <glm/vec3.hpp>
10 #include <glm/mat4x4.hpp>
11 #include <glm/mat4x4.hpp>
12 #include <glm/gtc/matrix_transform.hpp>
13 
14 class CubeMapObject: public SceneObject {
15 public:
16 
17  CubeMapObject(const std::string& name, Scene* scene = 0, Model* model = 0, const glm::mat4& modelMatrix = glm::mat4(1.0f));
18  virtual ~CubeMapObject();
19 
20  void renderToCubeMap();
21  void reset();
22  void draw() const;
23 
24 private:
25  class EffectObject;
26  friend class EffectObject;
27 
28  GLint cubeTexWidth;
30  //the cube faces are rendered into a framebuffer
31  GLuint frameBuffer;
32  //needed for z-testing
33  GLuint depthTexture;
34  GLuint cubeTexture;
35  GLenum cubeFaces[6];
36 
38 
39  std::vector<glm::mat4> viewMatrices;
40  glm::vec4 position;
41 
42  void setUpDepthTexture();
43  void setUpColorTexture();
44  void setViewMatrices();
45 };
46 
47 #endif //CUBEMAPOBJECT_HPP
std::vector< glm::mat4 > viewMatrices
Definition: cubeMapObject.hpp:39
Encapsulates a graphical object model in the GPU.
Definition: model.hpp:14
GLint cubeTexWidth
Definition: cubeMapObject.hpp:28
void setUpDepthTexture()
Definition: cubeMapObject.cpp:199
Model * model
Definition: sceneObject.hpp:69
void draw() const
Definition: cubeMapObject.cpp:139
GLuint cubeTexture
Definition: cubeMapObject.hpp:34
void reset()
Definition: cubeMapObject.cpp:121
Encapsulates the Rendering Engine, holds a complete scene and it's assets.
Definition: scene.hpp:71
GLuint depthTexture
Definition: cubeMapObject.hpp:33
Scene * scene
Definition: sceneObject.hpp:68
GLenum cubeFaces[6]
Definition: cubeMapObject.hpp:35
GLint cubeTexHeight
Definition: cubeMapObject.hpp:29
CubeMapObject(const std::string &name, Scene *scene=0, Model *model=0, const glm::mat4 &modelMatrix=glm::mat4(1.0f))
Definition: cubeMapObject.cpp:84
void setViewMatrices()
Definition: cubeMapObject.cpp:289
std::string name
Definition: sceneObject.hpp:73
glm::mat4 modelMatrix
Definition: sceneObject.hpp:71
The base class of the objects which are rendered.
Definition: sceneObject.hpp:30
void renderToCubeMap()
Definition: cubeMapObject.cpp:226
int renderPasses
Definition: cubeMapObject.hpp:37
GLuint frameBuffer
Definition: cubeMapObject.hpp:31
void setUpColorTexture()
Definition: cubeMapObject.cpp:171
Definition: cubeMapObject.hpp:14
glm::vec4 position
Definition: cubeMapObject.hpp:40
virtual ~CubeMapObject()
Definition: cubeMapObject.cpp:115
Definition: cubeMapObject.cpp:16