]> git.tdb.fi Git - libs/gl.git/blobdiff - source/builders/sequencetemplate.cpp
Remove deprecated things related to vertex formats and arrays
[libs/gl.git] / source / builders / sequencetemplate.cpp
index d852643301fa0ecac87fe0114b514bbe4478b45e..13534d75d28e99f61d648e35f57f5c744dcb0676 100644 (file)
@@ -9,7 +9,6 @@
 #include "resources.h"
 #include "scene.h"
 #include "sequencetemplate.h"
-#include "tests.h"
 
 using namespace std;
 
@@ -113,7 +112,11 @@ void SequenceTemplate::Loader::step_with_slot(const string &tag, const string &r
        stp.tag = tag;
        stp.slot_name = rend;
        if(coll)
-               load_sub(stp, *coll);
+       {
+               Step::Loader ldr(stp, *coll);
+               ldr.set_inline_base_name(format("%s/%d.step", get_source(), obj.steps.size()));
+               load_sub_with(ldr);
+       }
        else
                load_sub(stp);
 
@@ -136,64 +139,52 @@ SequenceTemplate::Step::Loader::Loader(Step &p, Collection &c):
 void SequenceTemplate::Step::Loader::init()
 {
        add("blend", &Loader::blend);
-       add("blend", &Loader::blend_predefined);
+       add("blend", &Loader::blend_factors);
        add("depth_test", &Loader::depth_test);
-       add("depth_test", &Loader::depth_test_predefined);
+       add("depth_test", &Loader::depth_compare);
        add("lighting", &Loader::lighting);
        add("lighting", &Loader::lighting_inline);
        add("object", &Loader::object);
        add("scene", &Loader::scene);
+       add("stencil_test", &Loader::stencil_test);
 }
 
-void SequenceTemplate::Step::Loader::blend_predefined(const string &name)
+void SequenceTemplate::Step::Loader::set_inline_base_name(const string &n)
 {
-       const Blend *bln = 0;
-       if(name=="alpha")
-               bln = &Blend::alpha();
-       else if(name=="additive")
-               bln = &Blend::additive();
-       else if(name=="additive_alpha")
-               bln = &Blend::additive_alpha();
-       else
-               throw key_error(name);
-
-       obj.blend = bln;
-       obj.blend.keep();
+       inline_base_name = n;
 }
 
-void SequenceTemplate::Step::Loader::blend(BlendFactor src, BlendFactor dest)
+void SequenceTemplate::Step::Loader::blend()
 {
-       obj.blend = new Blend(src, dest);
+       load_sub(obj.blend);
 }
 
-void SequenceTemplate::Step::Loader::depth_test_predefined(const string &name)
+void SequenceTemplate::Step::Loader::blend_factors(BlendFactor src, BlendFactor dest)
 {
-       const DepthTest *dtest = 0;
-       if(name=="lequal")
-               dtest = &DepthTest::lequal();
-       else
-               throw key_error(name);
+       obj.blend = Blend(src, dest);
+}
 
-       obj.depth_test = dtest;
-       obj.depth_test.keep();
+void SequenceTemplate::Step::Loader::depth_test()
+{
+       load_sub(obj.depth_test);
 }
 
-void SequenceTemplate::Step::Loader::depth_test(Predicate pred)
+void SequenceTemplate::Step::Loader::depth_compare(Predicate c)
 {
-       obj.depth_test = new DepthTest(pred);
+       obj.depth_test = DepthTest(c);
 }
 
 void SequenceTemplate::Step::Loader::lighting_inline()
 {
        RefPtr<Lighting> lightn = new Lighting;
        load_sub(*lightn);
-       obj.lighting = lightn;
+       get_collection().add(inline_base_name+".lightn", lightn.get());
+       obj.lighting = lightn.release();
 }
 
 void SequenceTemplate::Step::Loader::lighting(const string &name)
 {
        obj.lighting = &get_collection().get<Lighting>(name);
-       obj.lighting.keep();
 }
 
 void SequenceTemplate::Step::Loader::object(const string &name)
@@ -206,5 +197,10 @@ void SequenceTemplate::Step::Loader::scene(const string &name)
        obj.default_renderable = &get_collection().get<Scene>(name);
 }
 
+void SequenceTemplate::Step::Loader::stencil_test()
+{
+       load_sub(obj.stencil_test);
+}
+
 } // namespace GL
 } // namespace Msp