X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Feffects%2Fsky.cpp;h=ab322f230e34365e6363c3ea9c867b2be251d79c;hb=f2bb1caa233930e1148613e9d5daa2c29b0fe271;hp=158606f845305dcbef7f206fc706328faf01bfe9;hpb=ed8e639ee3d03e6303df31e31625099e70f598a5;p=libs%2Fgl.git diff --git a/source/effects/sky.cpp b/source/effects/sky.cpp index 158606f8..ab322f23 100644 --- a/source/effects/sky.cpp +++ b/source/effects/sky.cpp @@ -1,6 +1,7 @@ #include #include #include "directionallight.h" +#include "error.h" #include "mesh.h" #include "renderer.h" #include "resources.h" @@ -163,7 +164,8 @@ Sky::Planet::Planet(): ozone_band_center(1e4f), ozone_band_extent(1e2f), atmosphere_thickness(2e4f), - planet_radius(1e6f) + planet_radius(1e6f), + ground_albedo(0.2f) { } Sky::Planet Sky::Planet::earth() @@ -182,5 +184,29 @@ Sky::Planet Sky::Planet::earth() return planet; } + +Sky *Sky::Template::create(const map &renderables) const +{ + Renderable *content = get_item(renderables, content_name); + if(!content || !sun) + throw invalid_operation("Sky::Template::create"); + return new Sky(*content, *sun); +} + + +DataFile::Loader::ActionMap Sky::Template::Loader::shared_actions; + +Sky::Template::Loader::Loader(Template &t, Collection &c): + DerivedObjectLoader(t, c) +{ + set_actions(shared_actions); +} + +void Sky::Template::Loader::init_actions() +{ + Effect::Template::Loader::init_actions(); + add("sun", &Template::sun); +} + } // namespace GL } // namespace Msp