X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Feffects%2Fsky.h;h=cb8403e77709ff0eb8ab81e9f306c3a4fa422e2b;hb=HEAD;hp=be31b3085625001c9603adb1c28f4232e64862da;hpb=5bb193f930fb8738d099d630c4d625d82c1215b5;p=libs%2Fgl.git diff --git a/source/effects/sky.h b/source/effects/sky.h index be31b308..cb8403e7 100644 --- a/source/effects/sky.h +++ b/source/effects/sky.h @@ -8,14 +8,19 @@ namespace Msp { namespace GL { +class DirectionalLight; class Mesh; -class Light; class Program; /** -Renders a procedurally generated sky at the background. Based on the paper -"A Scalable and Production Ready Sky and Atmosphere Rendering Technique" by -Sébastien Hillaire (https://sebh.github.io/publications/egsr2020.pdf). +Renders a procedurally generated sky at the background. + +In addition to the background, the transmittance of the sun light is calculated +to produce realistic lighting at dawn and dusk. + +Based on the techniques described in "A Scalable and Production Ready Sky and +Atmosphere Rendering Technique" by Sébastien Hillaire +(https://sebh.github.io/publications/egsr2020.pdf). */ class Sky: public Effect { @@ -39,9 +44,27 @@ public: static Planet earth(); }; + struct Template: Effect::Template + { + class Loader: public DataFile::DerivedObjectLoader + { + private: + static ActionMap shared_actions; + + public: + Loader(Template &, Collection &); + private: + virtual void init_actions(); + }; + + DirectionalLight *sun = 0; + + virtual Sky *create(const std::map &) const; + }; + private: Planet planet; - Light &sun; + DirectionalLight &sun; RenderTarget transmittance_lookup; const Program &transmittance_shprog; bool transmittance_lookup_dirty; @@ -51,12 +74,13 @@ private: const Program &backdrop_shprog; const Sampler &sampler; const Sampler &wrap_sampler; + const Texture &dummy_texture; mutable ProgramData shdata; float view_height; bool rendered; public: - Sky(Renderable &, Light &); + Sky(Renderable &, DirectionalLight &); void set_planet(const Planet &); void set_view_height(float);