]> git.tdb.fi Git - libs/gl.git/blobdiff - source/effects/shadowmap.cpp
Add debug name capability to more classes
[libs/gl.git] / source / effects / shadowmap.cpp
index 11bb706e6afa3265562e277e3ac899783e888095..a6d431bc200da86e025dcc2b640aa9d2a342d0e0 100644 (file)
@@ -13,20 +13,20 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-ShadowMap::ShadowMap(Resources &resources, unsigned s, Renderable &r, const Light &l, Renderable &c):
+ShadowMap::ShadowMap(unsigned s, Renderable &r, const Light &l, Renderable &c):
        Effect(r),
        light(l),
        shadow_caster(c),
-       sampler(resources.get<Sampler>("_linear_clamp_shadow.samp"))
+       sampler(Resources::get_global().get<Sampler>("_linear_clamp_shadow.samp"))
 {
        init(s);
 }
 
-ShadowMap::ShadowMap(Resources &resources, unsigned s, Renderable &r, const Light &l):
+ShadowMap::ShadowMap(unsigned s, Renderable &r, const Light &l):
        Effect(r),
        light(l),
        shadow_caster(r),
-       sampler(resources.get<Sampler>("_linear_clamp_shadow.samp"))
+       sampler(Resources::get_global().get<Sampler>("_linear_clamp_shadow.samp"))
 {
        init(s);
 }
@@ -42,7 +42,7 @@ void ShadowMap::init(unsigned s)
        fbo.attach(DEPTH_ATTACHMENT, depth_buf, 0);
        fbo.require_complete();
 
-       set_darkness(0.7);
+       set_darkness(1.0f);
        shdata.uniform("shd_world_matrix", Matrix());
 }
 
@@ -122,5 +122,17 @@ void ShadowMap::render(Renderer &renderer, Tag tag) const
        renderer.render(renderable, tag);
 }
 
+void ShadowMap::set_debug_name(const std::string &name)
+{
+#ifdef DEBUG
+       fbo.set_debug_name(name+" [FBO]");
+       shadow_camera.set_debug_name(name+".camera");
+       depth_buf.set_debug_name(name+"/depth.tex2d");
+       shdata.set_debug_name(name+" [UBO]");
+#else
+       (void)name;
+#endif
+}
+
 } // namespace GL
 } // namespace Msp