]> git.tdb.fi Git - libs/gl.git/blob - source/environmentmap.h
Add overloads of keyframe uniform statements without size suffixes
[libs/gl.git] / source / environmentmap.h
1 #ifndef MSP_GL_ENVIRONMENTMAP_H_
2 #define MSP_GL_ENVIRONMENTMAP_H_
3
4 #include "camera.h"
5 #include "effect.h"
6 #include "framebuffer.h"
7 #include "matrix.h"
8 #include "programdata.h"
9 #include "renderbuffer.h"
10 #include "texturecube.h"
11 #include "vector.h"
12
13 namespace Msp {
14 namespace GL {
15
16 class Renderable;
17
18 /**
19 Creates a cube map texture of the surroundings of the renderable.  This texture
20 can then be used to implement effects such as reflections or refractions.
21
22 If the EnvironmentMap is used in a Pipeline, it's worth noting that the cube
23 map will be prepared outside of any rendering pass.  It's recommended to use
24 another Pipeline to define which passes should be used to render the
25 environment.
26 */
27 class EnvironmentMap: public Effect
28 {
29 private:
30         unsigned size;
31         Renderable &environment;
32         TextureCube env_tex;
33         Renderbuffer depth_buf;
34         Framebuffer fbo[6];
35         Camera camera;
36         mutable ProgramData shdata;
37         bool rendered;
38         unsigned update_interval;
39         unsigned update_delay;
40
41 public:
42         EnvironmentMap(unsigned size, Renderable &rend, Renderable &env);
43
44         void set_depth_clip(float, float);
45         void set_update_interval(unsigned);
46         void queue_update();
47
48         virtual void setup_frame(Renderer &);
49         virtual void finish_frame();
50
51         virtual void render(Renderer &, const Tag & = Tag()) const;
52 };
53
54 } // namespace GL
55 } // namespace Msp
56
57 #endif