X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fstage.cpp;h=0ca5c5eec607e1f7143b54edef0eeaf10cb1ea24;hb=e34e82619af0704b465e081f257f9952972e04b2;hp=267afe3a7dbe31148c590fa8fbf907fa9cb75813;hpb=5dad2cbf4556cd4b433722c172f0b468d0161de5;p=libs%2Fdemoscene.git diff --git a/source/stage.cpp b/source/stage.cpp index 267afe3..0ca5c5e 100644 --- a/source/stage.cpp +++ b/source/stage.cpp @@ -6,7 +6,8 @@ using namespace std; using namespace Msp; Stage::Stage(): - pipeline(0) + pipeline(0), + last_view(0) { } Stage::~Stage() @@ -14,9 +15,9 @@ Stage::~Stage() delete pipeline; } -void Stage::add_postprocessor(GL::PostProcessor &pp) +void Stage::add_things(Demo::ThingMap &things, const string &prefix) { - pipeline->add_postprocessor(pp); + things[prefix+"camera"] = static_cast(&camera); } void Stage::set_camera(const GL::Camera &c) @@ -48,6 +49,14 @@ void Stage::UseInView::validate() const void Stage::UseInView::start(float, float) { + if(!stage->pipeline || view!=stage->last_view) + { + stage->create_pipeline(*view); + if(!stage->pipeline) + throw logic_error("null pipeline"); + stage->last_view = view; + } + view->set_camera(&stage->camera); view->set_content(stage->pipeline); }