EnvironmentMap::EnvironmentMap(Resources &resources, unsigned s, Renderable &r, Renderable &e):
Effect(r),
- size(s),
environment(e),
- sampler(resources.get<Sampler>("_linear_clamp.samp")),
- rendered(false),
- update_interval(1),
- update_delay(0)
+ sampler(resources.get<Sampler>("_linear_clamp.samp"))
{
- env_tex.storage(RGB8, size, 1);
+ init(s, RGB8);
+}
+
+EnvironmentMap::EnvironmentMap(Resources &resources, unsigned s, PixelFormat f, Renderable &r, Renderable &e):
+ Effect(r),
+ environment(e),
+ sampler(resources.get<Sampler>("_linear_clamp.samp"))
+{
+ init(s, f);
+}
+
+void EnvironmentMap::init(unsigned s, PixelFormat f)
+{
+ size = s;
+ rendered = false;
+ update_interval = 1;
+ update_delay = 0;
+
+ env_tex.storage(f, size);
depth_buf.storage(DEPTH_COMPONENT32F, size, size);
for(unsigned i=0; i<6; ++i)
{
public:
EnvironmentMap(Resources &, unsigned size, Renderable &rend, Renderable &env);
+ EnvironmentMap(Resources &, unsigned size, PixelFormat, Renderable &rend, Renderable &env);
+private:
+ void init(unsigned, PixelFormat, unsigned);
+public:
void set_depth_clip(float, float);
/** Sets the interval in frames between environment map updates. A value of