1 #ifndef MSP_GL_ENVIRONMENTMAP_H_
2 #define MSP_GL_ENVIRONMENTMAP_H_
6 #include "framebuffer.h"
8 #include "programdata.h"
10 #include "texturecube.h"
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.
22 If the EnvironmentMap is used in a Sequence, it's worth noting that the cube
23 map will be prepared outside of any rendering pass. It's recommended to use
24 another Sequence to define which passes should be used to render the
27 class EnvironmentMap: public Effect
37 Renderable &environment;
42 TextureCube irradiance;
43 const Program &irradiance_shprog;
44 Framebuffer irradiance_fbo;
45 const Program &specular_shprog;
46 std::vector<Framebuffer> specular_fbos;
47 ProgramData prefilter_shdata;
48 const Mesh &fullscreen_mesh;
50 const Sampler &sampler;
51 const Sampler &mip_sampler;
54 unsigned update_interval;
55 unsigned update_delay;
58 EnvironmentMap(unsigned size, Renderable &rend, Renderable &env);
59 EnvironmentMap(unsigned size, PixelFormat, Renderable &rend, Renderable &env);
60 EnvironmentMap(unsigned size, PixelFormat, unsigned, Renderable &rend, Renderable &env);
62 void init(unsigned, PixelFormat, unsigned);
65 void set_depth_clip(float, float);
67 /** Sets the interval in frames between environment map updates. A value of
68 0 means an update is only done when manually requested. */
69 void set_update_interval(unsigned);
71 /** Request that the environment map is updated on the next frame. */
74 virtual void setup_frame(Renderer &);
75 virtual void finish_frame();
77 virtual void render(Renderer &, Tag = Tag()) const;
79 virtual void set_debug_name(const std::string &);