]> git.sesse.net Git - nageru/commitdiff
Rename chain -> scene as appropriate.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 16 Jun 2019 08:30:38 +0000 (10:30 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 16 Jun 2019 08:30:38 +0000 (10:30 +0200)
nageru/scene.cpp
nageru/scene.h

index 090f95be917884a1044239bb4046fc4d6726d613..8df9511276c65c8202e75c3ed84597dc078add7a 100644 (file)
@@ -67,10 +67,10 @@ size_t Scene::compute_chain_number_for_block(size_t block_idx) const
 int Scene::add_input(lua_State* L)
 {
        assert(lua_gettop(L) == 1 || lua_gettop(L) == 2);
-       Scene *chain = (Scene *)luaL_checkudata(L, 1, "Scene");
+       Scene *scene = (Scene *)luaL_checkudata(L, 1, "Scene");
 
        Block *block = new Block;
-       block->idx = chain->blocks.size();
+       block->idx = scene->blocks.size();
        if (lua_gettop(L) == 1) {
                // No parameter given, so a flexible input.
                block->alternatives.emplace_back(new EffectBlueprint(LIVE_INPUT_YCBCR));
@@ -104,7 +104,7 @@ int Scene::add_input(lua_State* L)
                assert(ok);
        }
        block->is_input = true;
-       chain->blocks.push_back(block);
+       scene->blocks.push_back(block);
 
        return wrap_lua_existing_object_nonowned<Block>(L, "Block", block);
 }
@@ -112,10 +112,10 @@ int Scene::add_input(lua_State* L)
 int Scene::add_effect(lua_State* L)
 {
        assert(lua_gettop(L) >= 2);
-       Scene *chain = (Scene *)luaL_checkudata(L, 1, "Scene");
+       Scene *scene = (Scene *)luaL_checkudata(L, 1, "Scene");
 
        Block *block = new Block;
-       block->idx = chain->blocks.size();
+       block->idx = scene->blocks.size();
 
        if (lua_istable(L, 2)) {
                size_t len = lua_objlen(L, 2);
@@ -132,8 +132,8 @@ int Scene::add_effect(lua_State* L)
 
        // Find the inputs.
        if (lua_gettop(L) == 2) {
-               assert(!chain->blocks.empty());
-               block->inputs.push_back(chain->blocks.size() - 1);
+               assert(!scene->blocks.empty());
+               block->inputs.push_back(scene->blocks.size() - 1);
        } else {
                for (int idx = 3; idx <= lua_gettop(L); ++idx) {
                        Block *input_block = nullptr;
@@ -143,21 +143,21 @@ int Scene::add_effect(lua_State* L)
                                EffectBlueprint *blueprint = *(EffectBlueprint **)luaL_checkudata(L, idx, "EffectBlueprint");
 
                                // Search through all the blocks to figure out which one contains this effect.
-                               for (Block *block : chain->blocks) {
+                               for (Block *block : scene->blocks) {
                                        if (find(block->alternatives.begin(), block->alternatives.end(), blueprint) != block->alternatives.end()) {
                                                input_block = block;
                                                break;
                                        }
                                }
                                if (input_block == nullptr) {
-                                       luaL_error(L, "Input effect in parameter #%d has not been added to this chain", idx - 1);
+                                       luaL_error(L, "Input effect in parameter #%d has not been added to this scene", idx - 1);
                                }
                        }
                        block->inputs.push_back(input_block->idx);
                }
        }
 
-       chain->blocks.push_back(block);
+       scene->blocks.push_back(block);
 
        return wrap_lua_existing_object_nonowned<Block>(L, "Block", block);
 }
@@ -165,11 +165,11 @@ int Scene::add_effect(lua_State* L)
 int Scene::add_optional_effect(lua_State* L)
 {
        assert(lua_gettop(L) >= 2);
-       Scene *chain = (Scene *)luaL_checkudata(L, 1, "Scene");
+       Scene *scene = (Scene *)luaL_checkudata(L, 1, "Scene");
 
        // NOTE: We only support effects with a single parent, since that's what IdentityEffect does.
        Block *block = new Block;
-       block->idx = chain->blocks.size();
+       block->idx = scene->blocks.size();
 
        EffectBlueprint *blueprint = *(EffectBlueprint **)luaL_checkudata(L, 2, "EffectBlueprint");
        block->alternatives.push_back(blueprint);
@@ -177,8 +177,8 @@ int Scene::add_optional_effect(lua_State* L)
        // An IdentityEffect will be the alternative for when the effect is disabled.
        block->alternatives.push_back(new EffectBlueprint(IDENTITY_EFFECT));
 
-       block->inputs.push_back(chain->blocks.size() - 1);
-       chain->blocks.push_back(block);
+       block->inputs.push_back(scene->blocks.size() - 1);
+       scene->blocks.push_back(block);
 
        return wrap_lua_existing_object_nonowned<Block>(L, "Block", block);
 }
@@ -243,11 +243,11 @@ int Scene::finalize(lua_State* L)
        } else {
                assert(lua_gettop(L) == 1);
        }
-       Scene *chain = (Scene *)luaL_checkudata(L, 1, "Scene");
+       Scene *scene = (Scene *)luaL_checkudata(L, 1, "Scene");
        Theme *theme = get_theme_updata(L);
 
        size_t base = 1;
-       for (Block *block : chain->blocks) {
+       for (Block *block : scene->blocks) {
                block->cardinality_base = base;
                base *= block->alternatives.size();
        }
@@ -259,20 +259,20 @@ int Scene::finalize(lua_State* L)
                        total_cardinality);
        }
 
-       Block *output_block = chain->blocks.back();
+       Block *output_block = scene->blocks.back();
        for (bool is_main_chain : { false, true }) {
                for (size_t chain_idx = 0; chain_idx < cardinality; ++chain_idx) {
                        if (only_one_mode && is_main_chain != chosen_mode) {
-                               chain->chains.emplace_back();
+                               scene->chains.emplace_back();
                                continue;
                        }
 
                        Scene::Instantiation instantiation;
-                       instantiation.chain.reset(new EffectChain(chain->aspect_nom, chain->aspect_denom, theme->get_resource_pool()));
-                       chain->instantiate_effects(output_block, chain_idx, &instantiation);
+                       instantiation.chain.reset(new EffectChain(scene->aspect_nom, scene->aspect_denom, theme->get_resource_pool()));
+                       scene->instantiate_effects(output_block, chain_idx, &instantiation);
 
                        add_outputs_and_finalize(instantiation.chain.get(), is_main_chain);
-                       chain->chains.emplace_back(move(instantiation));
+                       scene->chains.emplace_back(move(instantiation));
                }
        }
        return 0;
@@ -328,7 +328,7 @@ Scene::get_chain(Theme *theme, lua_State *L, unsigned num, const InputState &inp
                        } else if (block->signal_type_to_connect == Block::CONNECT_VIDEO) {
                                signals_to_connect.emplace(input, block->video_to_connect->get_card_index());
                        } else if (block->signal_type_to_connect == Block::CONNECT_NONE) {
-                               luaL_error(L, "An input in a chain was not connected to anything (forgot to call display())");
+                               luaL_error(L, "An input in a scene was not connected to anything (forgot to call display())");
                        } else {
                                assert(false);
                        }
index fc36963cc9eebd3ae56943293e9c74ce71886ea5..bf23fbd1f2bb789d1fb350393fadf84ff2c5629c 100644 (file)
@@ -9,7 +9,7 @@
 // ResizeEffect or IdentityEffect (effectively doing nothing), or many
 // different input types. On finalization, every different combination of
 // block alternatives are tried, and one EffectChain is generated for each.
-// This also goes for whether the chain is destined for preview outputs
+// This also goes for whether the scene is destined for preview outputs
 // (directly to screen, RGBA) or live (Y'CbCr output).
 
 #include <stddef.h>
@@ -64,7 +64,7 @@ struct Block {
        // where C_0 = 0 and C_(i+1) = C_i * B_i. In other words, C_i is
        // the product of the cardinalities of each previous effect; if we
        // are e.g. at the third index and there have been C_2 = 3 * 5 = 15
-       // different alternatives for constructing the chain so far
+       // different alternatives for constructing the scene so far
        // (with possible indexes 0..14), it is only logical that if we
        // want three new options (B_2 = 3), we must add 0, 15 or 30 to
        // the index. (Then the local possible indexes become 0..44 and