]> git.tdb.fi Git - libs/gl.git/commitdiff
Rename "renderable" to "content" in Effects and Scenes
authorMikko Rasa <tdb@tdb.fi>
Sat, 30 Oct 2021 19:59:09 +0000 (22:59 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 30 Oct 2021 22:28:13 +0000 (01:28 +0300)
This name better describes the relationship.

15 files changed:
source/effects/effect.cpp
source/effects/effect.h
source/effects/environmentmap.cpp
source/effects/shadowmap.cpp
source/effects/sky.cpp
source/render/occludedscene.cpp
source/render/occludedscene.h
source/render/orderedscene.cpp
source/render/orderedscene.h
source/render/simplescene.cpp
source/render/simplescene.h
source/render/slot.cpp
source/render/slot.h
source/render/zsortedscene.cpp
source/render/zsortedscene.h

index e59aeed8e039dcbc352d6daf6904a3b44eacaa06..878e23fb571cf1881e0af3cf163a1696a3cfd661 100644 (file)
@@ -4,8 +4,8 @@
 namespace Msp {
 namespace GL {
 
-Effect::Effect(Renderable &r):
-       renderable(r)
+Effect::Effect(Renderable &c):
+       content(c)
 {
        enable_for_method(Tag());
 }
index ac458361700cf669052ea69039017451f2497e8f..e77b4cf5c8b110f1ca42a6dc35c2434629534ea3 100644 (file)
@@ -44,7 +44,7 @@ public:
        };
 
 protected:
-       Renderable &renderable;
+       Renderable &content;
        std::vector<Tag> enabled_methods;
 
 protected:
@@ -56,11 +56,11 @@ public:
        void disable_for_method(Tag);
        bool is_enabled_for_method(Tag) const;
 
-       virtual const Matrix *get_matrix() const { return renderable.get_matrix(); }
-       virtual const Geometry::BoundingSphere<float, 3> *get_bounding_sphere() const { return renderable.get_bounding_sphere(); }
+       virtual const Matrix *get_matrix() const { return content.get_matrix(); }
+       virtual const Geometry::BoundingSphere<float, 3> *get_bounding_sphere() const { return content.get_bounding_sphere(); }
 
-       virtual void setup_frame(Renderer &r) { renderable.setup_frame(r); }
-       virtual void finish_frame() { renderable.finish_frame(); }
+       virtual void setup_frame(Renderer &r) { content.setup_frame(r); }
+       virtual void finish_frame() { content.finish_frame(); }
 
        virtual void set_debug_name(const std::string &) = 0;
 };
index b1a50ecc720df131be3226e96cd59b3384680e85..614b1252b26ba7b2177bf40c3cb9803e4b052a9f 100644 (file)
@@ -13,12 +13,12 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-EnvironmentMap::EnvironmentMap(unsigned s, PixelFormat f, Renderable &r, Renderable &e):
-       EnvironmentMap(s, f, 1, r, e)
+EnvironmentMap::EnvironmentMap(unsigned s, PixelFormat f, Renderable &c, Renderable &e):
+       EnvironmentMap(s, f, 1, c, e)
 { }
 
-EnvironmentMap::EnvironmentMap(unsigned s, PixelFormat f, unsigned l, Renderable &r, Renderable &e):
-       Effect(r),
+EnvironmentMap::EnvironmentMap(unsigned s, PixelFormat f, unsigned l, Renderable &c, Renderable &e):
+       Effect(c),
        size(s),
        environment(e),
        irradiance_shprog(Resources::get_global().get<Program>("_envmap_irradiance.glsl.shader")),
@@ -106,7 +106,7 @@ void EnvironmentMap::setup_frame(Renderer &renderer)
                return;
 
        rendered = true;
-       renderable.setup_frame(renderer);
+       content.setup_frame(renderer);
 
        if(update_delay)
        {
@@ -124,7 +124,7 @@ void EnvironmentMap::setup_frame(Renderer &renderer)
                center = fixed_position;
        else
        {
-               const Matrix *matrix = renderable.get_matrix();
+               const Matrix *matrix = content.get_matrix();
                if(!matrix)
                        return;
 
@@ -160,7 +160,7 @@ void EnvironmentMap::finish_frame()
        if(rendered)
        {
                rendered = false;
-               renderable.finish_frame();
+               content.finish_frame();
                environment.finish_frame();
        }
 }
@@ -170,14 +170,14 @@ void EnvironmentMap::render(Renderer &renderer, Tag tag) const
        if(in_setup_frame)
                return;
        if(!is_enabled_for_method(tag))
-               return renderable.render(renderer, tag);
+               return content.render(renderer, tag);
 
        Renderer::Push _push_rend(renderer);
 
        renderer.set_texture("environment_map", &env_tex, &mip_sampler);
        renderer.set_texture("irradiance_map", &irradiance, &sampler);
        renderer.add_shader_data(shdata);
-       renderable.render(renderer, tag);
+       content.render(renderer, tag);
 }
 
 void EnvironmentMap::set_debug_name(const string &name)
index 6b926dd897355b68b461299bb6f070207c552d86..ddb78aeb6ff5a3c07aa59cb07548604089b48e8d 100644 (file)
@@ -12,8 +12,8 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-ShadowMap::ShadowMap(unsigned w, unsigned h, Renderable &r, const Lighting *l):
-       Effect(r),
+ShadowMap::ShadowMap(unsigned w, unsigned h, Renderable &c, const Lighting *l):
+       Effect(c),
        width(w),
        height(h),
        lighting(l),
@@ -38,10 +38,10 @@ ShadowMap::ShadowMap(unsigned w, unsigned h, Renderable &r, const Lighting *l):
        shdata.uniform_array("shd_world_matrix", 1, &dummy_matrix);
 }
 
-ShadowMap::ShadowMap(unsigned s, Renderable &r, const DirectionalLight &l, Renderable &c):
-       ShadowMap(s, s, r, 0)
+ShadowMap::ShadowMap(unsigned s, Renderable &c, const DirectionalLight &l, Renderable &sc):
+       ShadowMap(s, s, c, 0)
 {
-       add_light(l, s, c);
+       add_light(l, s, sc);
 }
 
 ShadowMap::ShadowMap(unsigned w, unsigned h, Renderable &r, const Lighting &l):
@@ -183,7 +183,7 @@ void ShadowMap::setup_frame(Renderer &renderer)
                return;
 
        rendered = true;
-       renderable.setup_frame(renderer);
+       content.setup_frame(renderer);
        for(const ShadowedLight &l: lights)
                l.shadow_caster->setup_frame(renderer);
 
@@ -244,20 +244,20 @@ void ShadowMap::finish_frame()
        if(rendered)
        {
                rendered = false;
-               renderable.finish_frame();
+               content.finish_frame();
        }
 }
 
 void ShadowMap::render(Renderer &renderer, Tag tag) const
 {
        if(!is_enabled_for_method(tag))
-               return renderable.render(renderer, tag);
+               return content.render(renderer, tag);
 
        Renderer::Push _push_rend(renderer);
 
        renderer.set_texture("shadow_map", &depth_buf, &sampler);
        renderer.add_shader_data(shdata);
-       renderable.render(renderer, tag);
+       content.render(renderer, tag);
 }
 
 void ShadowMap::set_debug_name(const string &name)
index 0744e7b9adaacda6b02be7cfaf775e9a53e97600..2e5a6e1825114141fb57784324475e3acfdd84c2 100644 (file)
@@ -13,8 +13,8 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Sky::Sky(Renderable &r, DirectionalLight &s):
-       Effect(r),
+Sky::Sky(Renderable &c, DirectionalLight &s):
+       Effect(c),
        sun(s),
        transmittance_lookup(128, 64, (COLOR_ATTACHMENT,RGB16F)),
        transmittance_shprog(Resources::get_global().get<Program>("_sky_transmittance.glsl.shader")),
@@ -116,7 +116,7 @@ void Sky::setup_frame(Renderer &renderer)
        renderer.set_texture("transmittance_lookup", &transmittance_lookup.get_target_texture(0), &sampler);
        fullscreen_mesh.draw(renderer);
 
-       renderable.setup_frame(renderer);
+       content.setup_frame(renderer);
 }
 
 void Sky::finish_frame()
@@ -124,13 +124,13 @@ void Sky::finish_frame()
        if(rendered)
        {
                rendered = false;
-               renderable.finish_frame();
+               content.finish_frame();
        }
 }
 
 void Sky::render(Renderer &renderer, Tag tag) const
 {
-       renderable.render(renderer, tag);
+       content.render(renderer, tag);
 
        if(!is_enabled_for_method(tag))
                return;
index bfe17349fd13ee836234c9297ec5476e6039d9f7..0d8a5b857698d17d3a67e91e2367d674424eec05 100644 (file)
@@ -21,20 +21,20 @@ OccludedScene::OccludedScene():
 
 void OccludedScene::add(Renderable &r)
 {
-       auto i = lower_bound(renderables, &r);
-       if(i==renderables.end() || *i!=&r)
+       auto i = lower_bound(content, &r);
+       if(i==content.end() || *i!=&r)
        {
-               renderables.insert(i, &r);
+               content.insert(i, &r);
                cache_dirty = true;
        }
 }
 
 void OccludedScene::remove(Renderable &r)
 {
-       auto i = lower_bound(renderables, &r);
-       if(i!=renderables.end() && *i==&r)
+       auto i = lower_bound(content, &r);
+       if(i!=content.end() && *i==&r)
        {
-               renderables.erase(i);
+               content.erase(i);
                cache_dirty = true;
        }
 }
@@ -44,13 +44,13 @@ void OccludedScene::populate_cache() const
        if(!cache_dirty)
                return;
 
-       if(queries.get_size()<renderables.size())
-               queries.resize(renderables.size());
-       if(occluded_cache.size()<renderables.size())
-               occluded_cache.resize(renderables.size());
+       if(queries.get_size()<content.size())
+               queries.resize(content.size());
+       if(occluded_cache.size()<content.size())
+               occluded_cache.resize(content.size());
 
        auto j = occluded_cache.begin();
-       for(Renderable *r: renderables)
+       for(Renderable *r: content)
                j++->renderable = r;
        for(; j!=occluded_cache.end(); ++j)
        {
@@ -76,7 +76,7 @@ void OccludedScene::finish_frame()
 
 void OccludedScene::render(Renderer &renderer, Tag tag) const
 {
-       if(renderables.empty())
+       if(content.empty())
                return;
 
        populate_cache();
@@ -119,7 +119,7 @@ void OccludedScene::render(Renderer &renderer, Tag tag) const
        }
 
        // Move all objects within the frustum to the beginning of the array
-       for(auto i=occluded_cache.begin(), j=i+renderables.size()-1; i!=j; )
+       for(auto i=occluded_cache.begin(), j=i+content.size()-1; i!=j; )
        {
                if(i->in_frustum)
                        ++i;
index 2e24db5ed87faaa69813ae776e37a28e765d43fa..1f447c39b2efec06ea25c3e0287185d5fb92d12e 100644 (file)
@@ -39,7 +39,7 @@ private:
        const Program &bounding_shader;
        Blend no_color_write;
        DepthTest no_depth_write = { LEQUAL, false };
-       std::vector<Renderable *> renderables;
+       std::vector<Renderable *> content;
        float occluder_min_size = 0.25f;
        mutable QueryPool queries;
        mutable std::vector<OccludedRenderable> occluded_cache;
index 2d018c7080901af2a837d238caef16eb22a26789..48ad7d644c43c4b39047528cb5d772584c667e10 100644 (file)
@@ -7,42 +7,42 @@ namespace GL {
 
 void OrderedScene::add(Renderable &r)
 {
-       renderables.push_back(&r);
+       content.push_back(&r);
 }
 
 void OrderedScene::remove(Renderable &r)
 {
-       auto end = std::remove(renderables.begin(), renderables.end(), &r);
-       renderables.erase(end, renderables.end());
+       auto end = std::remove(content.begin(), content.end(), &r);
+       content.erase(end, content.end());
 }
 
 void OrderedScene::prepend(Renderable &r)
 {
-       renderables.insert(renderables.begin(), &r);
+       content.insert(content.begin(), &r);
 }
 
 void OrderedScene::insert(unsigned index, Renderable &r)
 {
-       auto i = renderables.begin();
-       for(; (i!=renderables.end() && index); ++i, --index) ;
-       renderables.insert(i, &r);
+       auto i = content.begin();
+       for(; (i!=content.end() && index); ++i, --index) ;
+       content.insert(i, &r);
 }
 
 void OrderedScene::insert_after(Renderable &after, Renderable &r)
 {
-       auto i = find(renderables, &after);
-       renderables.insert(i, &r);
+       auto i = find(content, &after);
+       content.insert(i, &r);
 }
 
 void OrderedScene::setup_frame(Renderer &renderer)
 {
-       for(Renderable *r: renderables)
+       for(Renderable *r: content)
                r->setup_frame(renderer);
 }
 
 void OrderedScene::finish_frame()
 {
-       for(Renderable *r: renderables)
+       for(Renderable *r: content)
                r->finish_frame();
 }
 
@@ -50,13 +50,13 @@ void OrderedScene::render(Renderer &renderer, Tag tag) const
 {
        if(setup_frustum(renderer))
        {
-               for(Renderable *r: renderables)
+               for(Renderable *r: content)
                        if(!frustum_cull(*r))
                                r->render(renderer, tag);
        }
        else
        {
-               for(Renderable *r: renderables)
+               for(Renderable *r: content)
                        r->render(renderer, tag);
        }
 }
index a4e5631bf337f852c166e752016ad725f9cd1104..b7fa8c6c66869c2dbc52ed09aeea9aa4fa05d59e 100644 (file)
@@ -16,7 +16,7 @@ public:
        using Scene::Loader;
 
 private:
-       std::vector<Renderable *> renderables;
+       std::vector<Renderable *> content;
 
 public:
        virtual void add(Renderable &);
index fbdb004f9a0e8f8917b5ae42a8a2554d84b54d22..68db812b2db18c34f5338b0844932d5146dc2a74 100644 (file)
@@ -7,27 +7,27 @@ namespace GL {
 
 void SimpleScene::add(Renderable &r)
 {
-       auto i = lower_bound(renderables, &r);
-       if(i==renderables.end() || *i!=&r)
-               renderables.insert(i, &r);
+       auto i = lower_bound(content, &r);
+       if(i==content.end() || *i!=&r)
+               content.insert(i, &r);
 }
 
 void SimpleScene::remove(Renderable &r)
 {
-       auto i = find(renderables, &r);
-       if(i!=renderables.end())
-               renderables.erase(i);
+       auto i = find(content, &r);
+       if(i!=content.end())
+               content.erase(i);
 }
 
 void SimpleScene::setup_frame(Renderer &renderer)
 {
-       for(Renderable *r: renderables)
+       for(Renderable *r: content)
                r->setup_frame(renderer);
 }
 
 void SimpleScene::finish_frame()
 {
-       for(Renderable *r: renderables)
+       for(Renderable *r: content)
                r->finish_frame();
 }
 
@@ -35,13 +35,13 @@ void SimpleScene::render(Renderer &renderer, Tag tag) const
 {
        if(setup_frustum(renderer))
        {
-               for(Renderable *r: renderables)
+               for(Renderable *r: content)
                        if(!frustum_cull(*r))
                                r->render(renderer, tag);
        }
        else
        {
-               for(Renderable *r: renderables)
+               for(Renderable *r: content)
                        r->render(renderer, tag);
        }
 }
index ce2a154642cda385ab502af5b35ab217ab6867be..174a9e2ea80e3cd6c7da982bf4672e88b58201b4 100644 (file)
@@ -16,7 +16,7 @@ public:
        using Scene::Loader;
 
 private:
-       std::vector<Renderable *> renderables;
+       std::vector<Renderable *> content;
 
 public:
        virtual void add(Renderable &);
index adbf535e0390419a06699e8a5b0434ae4ee8d7ab..eb2a2e3e186188cdff7d3e11b7eee247c80ed02e 100644 (file)
@@ -4,37 +4,37 @@
 namespace Msp {
 namespace GL {
 
-void Slot::set(Renderable *r)
+void Slot::set(Renderable *c)
 {
-       renderable = r;
+       content = c;
 }
 
 const Matrix *Slot::get_matrix() const
 {
-       return renderable ? renderable->get_matrix() : 0;
+       return content ? content->get_matrix() : 0;
 }
 
 const Geometry::BoundingSphere<float, 3> *Slot::get_bounding_sphere() const
 {
-       return renderable ? renderable->get_bounding_sphere() : 0;
+       return content ? content->get_bounding_sphere() : 0;
 }
 
 void Slot::setup_frame(Renderer &renderer)
 {
-       if(renderable)
-               renderable->setup_frame(renderer);
+       if(content)
+               content->setup_frame(renderer);
 }
 
 void Slot::finish_frame()
 {
-       if(renderable)
-               renderable->finish_frame();
+       if(content)
+               content->finish_frame();
 }
 
 void Slot::render(Renderer &renderer, Tag tag) const
 {
-       if(renderable)
-               renderable->render(renderer, tag);
+       if(content)
+               content->render(renderer, tag);
 }
 
 } // namespace GL
index 40dfd7587abed4c2ce615533c84a69b1faa4cde7..a675c64fb879a8f160e601dd5ccf1542aec0d313 100644 (file)
@@ -13,11 +13,11 @@ needs to be switched without affecting the rest.
 class Slot: public Renderable
 {
 private:
-       Renderable *renderable = 0;
+       Renderable *content = 0;
 
 public:
        void set(Renderable *);
-       Renderable *get() const { return renderable; }
+       Renderable *get() const { return content; }
 
        virtual const Matrix *get_matrix() const;
        virtual const Geometry::BoundingSphere<float, 3> *get_bounding_sphere() const;
index af3c5b86140823968a12cc19cf36a747fe3b5c1c..25255dc693569a9d34b2adfc7b64f709089af63e 100644 (file)
@@ -10,10 +10,10 @@ namespace GL {
 
 void ZSortedScene::add(Renderable &r)
 {
-       auto i = lower_bound(renderables, &r);
-       if(i==renderables.end() || *i!=&r)
+       auto i = lower_bound(content, &r);
+       if(i==content.end() || *i!=&r)
        {
-               renderables.insert(i, &r);
+               content.insert(i, &r);
                if(!sorted_cache.empty())
                        sorted_cache.push_back(&r);
        }
@@ -21,10 +21,10 @@ void ZSortedScene::add(Renderable &r)
 
 void ZSortedScene::remove(Renderable &r)
 {
-       auto i = lower_bound(renderables, &r);
-       if(i!=renderables.end() && *i==&r)
+       auto i = lower_bound(content, &r);
+       if(i!=content.end() && *i==&r)
        {
-               renderables.erase(i);
+               content.erase(i);
                sorted_cache.clear();
        }
 }
@@ -41,10 +41,10 @@ void ZSortedScene::set_reference(DepthReference r)
 
 void ZSortedScene::populate_cache() const
 {
-       if(sorted_cache.empty() && !renderables.empty())
+       if(sorted_cache.empty() && !content.empty())
        {
-               sorted_cache.reserve(renderables.size());
-               sorted_cache.insert(sorted_cache.end(), renderables.begin(), renderables.end());
+               sorted_cache.reserve(content.size());
+               sorted_cache.insert(sorted_cache.end(), content.begin(), content.end());
        }
 }
 
@@ -63,7 +63,7 @@ void ZSortedScene::finish_frame()
 
 void ZSortedScene::render(Renderer &renderer, Tag tag) const
 {
-       if(renderables.empty())
+       if(content.empty())
                return;
 
        populate_cache();
index 277d62cf7ac080ed8aa70d4b132e1f4bbf636f48..778b097e801fdf913c418b85e403ff3030237791 100644 (file)
@@ -45,7 +45,7 @@ private:
                bool operator<(const SortedRenderable &o) const { return depth<o.depth; }
        };
 
-       std::vector<Renderable *> renderables;
+       std::vector<Renderable *> content;
        SortOrder order = BACK_TO_FRONT;
        DepthReference reference = FURTHEST;
        mutable std::vector<SortedRenderable> sorted_cache;