]> git.tdb.fi Git - libs/gl.git/commitdiff
Update desertpillars to define more things in Blender
authorMikko Rasa <tdb@tdb.fi>
Wed, 20 Oct 2021 12:33:36 +0000 (15:33 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 20 Oct 2021 12:33:36 +0000 (15:33 +0300)
demos/desertpillars/data/exported/Desert.seq
demos/desertpillars/data/exported/Desert_environment.seq [new file with mode: 0644]
demos/desertpillars/data/exported/Desert_shadow.seq [new file with mode: 0644]
demos/desertpillars/data/exported/Desert_thsm.seq [new file with mode: 0644]
demos/desertpillars/scene.blend
demos/desertpillars/source/desertpillars.cpp
demos/desertpillars/source/desertpillars.h

index be6377e996d71c8663e6850b71fdc5d696a63df1..e7d281f49784a168f0070867186c0f9a3e589ba0 100644 (file)
@@ -4,26 +4,76 @@ clear
        color 0.00000 0.00000 0.00000 0.00000;
        depth 1.00000;
 };
-step "" "content"
+renderable "content" "Desert.scene";
+sequence "environment_sequence" "Desert_environment.seq"
+{
+       renderable "content" "sky";
+};
+effect "environment"
+{
+       type environment_map;
+       size 32;
+       roughness_levels 2;
+       fixed_position 0.00000 0.00000 0.00000;
+       content "content";
+       environment "environment_sequence";
+};
+effect "sky"
+{
+       type sky;
+       sun "Sun.light";
+       content "environment";
+};
+sequence "shadow_sequence" "Desert_shadow.seq"
+{
+       renderable "content" "content";
+};
+sequence "thsm_sequence" "Desert_thsm.seq"
+{
+       renderable "content" "content";
+};
+effect "shadow_map"
+{
+       type shadow_map;
+       size 8192 4096;
+       target 0.00000 0.00000 0.804577;
+       radius 10.4957;
+       content "sky";
+       lighting "Desert.lightn";
+       light "Sun.light"
+       {
+               size 4096;
+               shadow_caster "shadow_sequence";
+       };
+       light "Wisp.light"
+       {
+               size 2048;
+               shadow_caster "thsm_sequence";
+       };
+};
+step "" "shadow_map"
 {
        depth_test LEQUAL;
        lighting "Desert.lightn";
-       scene "Desert.scene";
 };
-step "blended" "content"
+step "blended" "shadow_map"
 {
        depth_test LEQUAL;
        lighting "Desert.lightn";
-       scene "Desert.scene";
 };
-ambient_occlusion
+postprocessor
 {
+       type ambient_occlusion;
        occlusion_radius 0.500000;
        samples 32;
 };
-bloom;
-colorcurve
+postprocessor
+{
+       type bloom;
+};
+postprocessor
 {
+       type colorcurve;
        exposure_adjust -1.50000;
        srgb;
 };
diff --git a/demos/desertpillars/data/exported/Desert_environment.seq b/demos/desertpillars/data/exported/Desert_environment.seq
new file mode 100644 (file)
index 0000000..2c47a4f
--- /dev/null
@@ -0,0 +1,16 @@
+clear
+{
+       color 0.00000 0.00000 0.00000 0.00000;
+       depth 1.00000;
+};
+renderable "content";
+step "" "content"
+{
+       depth_test LEQUAL;
+       lighting "Desert.lightn";
+};
+step "blended" "content"
+{
+       depth_test LEQUAL;
+       lighting "Desert.lightn";
+};
diff --git a/demos/desertpillars/data/exported/Desert_shadow.seq b/demos/desertpillars/data/exported/Desert_shadow.seq
new file mode 100644 (file)
index 0000000..f1a6dec
--- /dev/null
@@ -0,0 +1,9 @@
+clear
+{
+       depth 1.00000;
+};
+renderable "content";
+step "shadow" "content"
+{
+       depth_test LEQUAL;
+};
diff --git a/demos/desertpillars/data/exported/Desert_thsm.seq b/demos/desertpillars/data/exported/Desert_thsm.seq
new file mode 100644 (file)
index 0000000..25ebcae
--- /dev/null
@@ -0,0 +1,9 @@
+clear
+{
+       depth 1.00000;
+};
+renderable "content";
+step "shadow_thsm" "content"
+{
+       depth_test LEQUAL;
+};
index e452b8b7fc75158494b44add4e6c4e7579c007a5..c23803f675ce19c54de13337518034525d2664e1 100644 (file)
Binary files a/demos/desertpillars/scene.blend and b/demos/desertpillars/scene.blend differ
index 432c91663dbb4b7b53446a66b00be9ba2e391c0d..542ade3b0a8164cb668926e8312bfc90121c67e2 100644 (file)
@@ -42,43 +42,15 @@ DesertPillars::DesertPillars(int, char **):
        window.signal_close.connect(sigc::bind(sigc::mem_fun(this, &DesertPillars::exit), 0));
        keyboard.signal_button_press.connect(sigc::bind_return(sigc::mem_fun(this, &DesertPillars::key_press), false));
 
-       env_seq = make_unique<GL::Sequence>();
-       env_seq->set_clear_enabled(true);
-       env_seq->set_debug_name("Environment sequence");
-
-       global_env = make_unique<GL::EnvironmentMap>(32, GL::RGB16F, 2, content, *env_seq);
-       global_env->set_fixed_position(GL::Vector3(0.0f, 0.0f, 0.0f));
-       global_env->set_debug_name("Global environment");
-
-       sky = make_unique<GL::Sky>(*global_env, sun);
-       sky->set_debug_name("Sky");
-
-       shadow_seq = make_unique<GL::Sequence>();
-       shadow_seq->set_clear_enabled(true);
-       shadow_seq->set_debug_name("Shadow sequence");
-       GL::Sequence::Step *step = &shadow_seq->add_step("shadow", content);
-       step->set_depth_test(GL::LEQUAL);
-
-       shadow_seq_thsm = make_unique<GL::Sequence>();
-       shadow_seq_thsm->set_clear_enabled(true);
-       shadow_seq_thsm->set_debug_name("Shadow sequence");
-       step = &shadow_seq_thsm->add_step("shadow_thsm", content);
-       step->set_depth_test(GL::LEQUAL);
-
-       shadow_map = make_unique<GL::ShadowMap>(6144, 4096, *sky, lighting);
-       shadow_map->set_debug_name("Shadow map");
-       shadow_map->add_light(sun, 4096, *shadow_seq);
-       shadow_map->add_light(resources.get<GL::PointLight>("Wisp.light"), 2048, *shadow_seq_thsm);
-       shadow_map->set_target(GL::Vector3(0.0f, 0.0f, 0.0f), 20.0f);
-
        GL::SequenceBuilder seq_bld(resources.get<GL::SequenceTemplate>("Desert.seq"));
-       seq_bld.set_renderable("content", *shadow_map);
+       seq_bld.set_renderable("content", content);
        seq_bld.set_debug_name("Main sequence");
        sequence.reset(seq_bld.build(view));
 
-       step = &env_seq->add_step("", *shadow_map);
-       step->set_lighting(&lighting);
-       step->set_depth_test(GL::LEQUAL);
+       GL::SequenceBuilder env_bld(resources.get<GL::SequenceTemplate>("Desert_environment.seq"));
+       env_bld.set_renderable("content", *sequence->get_steps().front().get_renderable());
+       env_bld.set_debug_name("Environment sequence");
+       env_seq.reset(env_bld.build());
 
        env_map = make_unique<GL::EnvironmentMap>(256, GL::RGB16F, 7, sphere, *env_seq);
        env_map->set_debug_name("Environment map");
index 18522a57ca324f0449d52d50d7b7cf892d3c3365..0a3f2f2e336481598920722b76305d156dd5a80d 100644 (file)
@@ -77,13 +77,8 @@ private:
        Msp::GL::Camera camera;
        const Msp::GL::Lighting &lighting;
 
-       std::unique_ptr<Msp::GL::Sky> sky;
-       std::unique_ptr<Msp::GL::Sequence> shadow_seq;
-       std::unique_ptr<Msp::GL::Sequence> shadow_seq_thsm;
-       std::unique_ptr<Msp::GL::ShadowMap> shadow_map;
        std::unique_ptr<Msp::GL::Sequence> env_seq;
        std::unique_ptr<Msp::GL::EnvironmentMap> env_map;
-       std::unique_ptr<Msp::GL::EnvironmentMap> global_env;
        Msp::GL::OrderedScene content;
 
        MorphSphere sphere;