]> git.tdb.fi Git - libs/gl.git/blobdiff - source/effects/shadowmap.h
Suppoer per-light shadow casters in ShadowMap
[libs/gl.git] / source / effects / shadowmap.h
index cb6229935a81806dc3bad9af00b72bed47e739b7..6c4e1e501713d84aa393652b8eefb32912a3a0ec 100644 (file)
@@ -30,30 +30,30 @@ private:
                unsigned index;
                Rect region;
                Camera shadow_camera;
+               Renderable *shadow_caster;
        };
 
        unsigned width;
        unsigned height;
        const Lighting *lighting;
        std::vector<ShadowedLight> lights;
-       Renderable &shadow_caster;
        Framebuffer fbo;
        Texture2D depth_buf;
        const Sampler &sampler;
        Vector3 target;
-       float radius;
-       float depth_bias;
-       float darkness;
+       float radius = 1.0f;
+       float depth_bias = 4.0f;
+       float darkness = 1.0f;
        ProgramData shdata;
-       bool rendered;
+       bool rendered = false;
        std::string debug_name;
 
-       ShadowMap(unsigned, unsigned, Renderable &, const Lighting *, Renderable &);
+       ShadowMap(unsigned, unsigned, Renderable &, const Lighting *);
 public:
        ShadowMap(unsigned, Renderable &, const DirectionalLight &, Renderable &);
-       ShadowMap(unsigned, unsigned, Renderable &, const Lighting &, Renderable &);
+       ShadowMap(unsigned, unsigned, Renderable &, const Lighting &);
 
-       void add_light(const DirectionalLight &, unsigned);
+       void add_light(const DirectionalLight &, unsigned, Renderable &);
 
        /** Sets the ShadowMap target point and radius.  The transformation matrix is
        computed so that a sphere with the specified parameters will be completely