]> git.tdb.fi Git - libs/gl.git/commitdiff
Use image-based lighting in the entire desert pillars scene
authorMikko Rasa <tdb@tdb.fi>
Fri, 8 Oct 2021 06:52:47 +0000 (09:52 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 8 Oct 2021 06:52:47 +0000 (09:52 +0300)
demos/desertpillars/data/exported/Ground033.tech
demos/desertpillars/data/exported/Stone.tech
demos/desertpillars/data/exported/Tiles028.tech
demos/desertpillars/scene.blend
demos/desertpillars/source/desertpillars.cpp
demos/desertpillars/source/desertpillars.h

index 5c34da5528636a7fa99d011fba45b380113a466d..38e3f4ecd4fdd81dc1762d604a9fb92a62b07e22 100644 (file)
@@ -11,4 +11,5 @@ method ""
                sampler "linear_mip.samp";
        };
        receive_shadows true;
+       image_based_lighting true;
 };
index 999092e352a9cef234844455c28cb441203cedc6..4faebac98f9c36ccc6ea5642935615c8efd98077 100644 (file)
@@ -11,6 +11,7 @@ method ""
                sampler "linear_mip.samp";
        };
        receive_shadows true;
+       image_based_lighting true;
 };
 method "shadow"
 {
index 0c33a7cba8d641aefa2957bcc341f46af363e205..6729b0107660a2c38a1422b5a5a587acf4404a30 100644 (file)
@@ -11,6 +11,7 @@ method ""
                sampler "linear_mip.samp";
        };
        receive_shadows true;
+       image_based_lighting true;
 };
 method "shadow"
 {
index 8505c29202441b84c57c1bf8c873b9f2acdebb99..5d8d43f96cc2a77abb06e42e0dac11a245734153 100644 (file)
Binary files a/demos/desertpillars/scene.blend and b/demos/desertpillars/scene.blend differ
index 5932e56968be16851469fd045e58b96708b30dc6..84583551a75d484ca9a2c52d55680897738c6873 100644 (file)
@@ -35,8 +35,16 @@ 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");
+
        GL::DirectionalLight &sun = resources.get<GL::DirectionalLight>("Sun.light");
-       sky = make_unique<GL::Sky>(content, sun);
+       sky = make_unique<GL::Sky>(*global_env, sun);
        sky->set_debug_name("Sky");
 
        shadow_seq = make_unique<GL::Sequence>();
@@ -54,9 +62,6 @@ DesertPillars::DesertPillars(int, char **):
        seq_bld.set_debug_name("Main sequence");
        sequence.reset(seq_bld.build(view));
 
-       env_seq = make_unique<GL::Sequence>();
-       env_seq->set_clear_enabled(true);
-       env_seq->set_debug_name("Environment sequence");
        step = &env_seq->add_step("", *shadow_map);
        step->set_lighting(&resources.get<GL::Lighting>("Desert.lightn"));
        step->set_depth_test(GL::LEQUAL);
index be8235c7a68849fb210a50585a7a8d5b080fa2dc..c6242ad313d9eac4b257b1ec1d7fd37e9e4ed420 100644 (file)
@@ -70,6 +70,7 @@ private:
        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;