X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fstage.cpp;h=b6c456e96c479a6330060733b97ac2afd5533832;hb=77d0c7ac9e3ebe1cecaf0c84e1501d3b6459055f;hp=e1ce3522753683e38d3941db0c2d2df05ab803f7;hpb=e2032cbdb8d2ae52e42d400c5cc90ddad844f665;p=libs%2Fdemoscene.git diff --git a/source/stage.cpp b/source/stage.cpp index e1ce352..b6c456e 100644 --- a/source/stage.cpp +++ b/source/stage.cpp @@ -3,10 +3,13 @@ #include "stage.h" using namespace std; -using namespace Msp; + +namespace Msp { +namespace DemoScene { Stage::Stage(): - pipeline(0) + pipeline(0), + last_view(0) { } Stage::~Stage() @@ -19,11 +22,6 @@ void Stage::add_things(Demo::ThingMap &things, const string &prefix) things[prefix+"camera"] = static_cast(&camera); } -void Stage::add_postprocessor(GL::PostProcessor &pp) -{ - pipeline->add_postprocessor(pp); -} - void Stage::set_camera(const GL::Camera &c) { camera.set_object_matrix(c.get_object_matrix()); @@ -53,6 +51,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); } @@ -116,3 +122,6 @@ void Stage::SetCamera::Loader::camera(const string &n) { obj.camera = &demo.get_resources().get(n); } + +} // namespace DemoScene +} // namespace Msp