X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Feffects%2Fsky.h;h=0152729a0ec8cf8dbb5ba88c5fc529ad5fd895c2;hp=eb4f618d9607569bcdb32a9151a44ebf7442d8bd;hb=083a8227715fa32c841fc2b8126e4ab8d2840ba0;hpb=06d83c11e10208478487dea864ddd7822630c391 diff --git a/source/effects/sky.h b/source/effects/sky.h index eb4f618d..0152729a 100644 --- a/source/effects/sky.h +++ b/source/effects/sky.h @@ -2,15 +2,14 @@ #define MSP_GL_SKY_H_ #include "effect.h" -#include "framebuffer.h" #include "programdata.h" -#include "texture2d.h" +#include "rendertarget.h" namespace Msp { namespace GL { +class DirectionalLight; class Mesh; -class Light; class Program; /** @@ -40,31 +39,53 @@ 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; - Texture2D transmittance_lookup; + Planet planet; + DirectionalLight &sun; + RenderTarget transmittance_lookup; const Program &transmittance_shprog; - Framebuffer transmittance_fbo; bool transmittance_lookup_dirty; - Texture2D distant; + RenderTarget distant; const Program &distant_shprog; - Framebuffer distant_fbo; const Mesh &fullscreen_mesh; const Program &backdrop_shprog; 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