X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Feffects%2Fsky.h;h=7d8933d4a65f4a6facbb7799fbb99f59293bc6bb;hb=6d2e2a0bb28496a8c25b441009bdd2a1a1e72d81;hp=5cc7bdaa668a6d6935be713f890f9c20991fc891;hpb=bb4638a8470b0be2f960709368ec0d360a64f8ac;p=libs%2Fgl.git diff --git a/source/effects/sky.h b/source/effects/sky.h index 5cc7bdaa..7d8933d4 100644 --- a/source/effects/sky.h +++ b/source/effects/sky.h @@ -2,21 +2,25 @@ #define MSP_GL_SKY_H_ #include "effect.h" -#include "framebuffer.h" #include "programdata.h" #include "rendertarget.h" 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 { @@ -40,8 +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: - const Light &sun; + Planet planet; + DirectionalLight &sun; RenderTarget transmittance_lookup; const Program &transmittance_shprog; bool transmittance_lookup_dirty; @@ -52,17 +75,22 @@ private: const Sampler &sampler; const Sampler &wrap_sampler; mutable ProgramData shdata; + float view_height; bool rendered; public: - Sky(Resources &, Renderable &, const Light &); + Sky(Renderable &, DirectionalLight &); void set_planet(const Planet &); void set_view_height(float); + Color get_transmittance(const Vector3 &); + virtual void setup_frame(Renderer &); virtual void finish_frame(); virtual void render(Renderer &, Tag = Tag()) const; + + virtual void set_debug_name(const std::string &); }; } // namespace GL