using namespace Msp;
Stage::Stage():
- pipeline(0)
+ pipeline(0),
+ last_view(0)
{ }
Stage::~Stage()
things[prefix+"camera"] = static_cast<GL::Placeable *>(&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());
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);
}
protected:
Msp::GL::Pipeline *pipeline;
Msp::GL::Camera camera;
+ Msp::GL::View *last_view;
public:
Stage();
~Stage();
virtual void add_things(Demo::ThingMap &, const std::string &);
- void add_postprocessor(Msp::GL::PostProcessor &);
+
void set_camera(const Msp::GL::Camera &);
Msp::GL::Camera &get_camera() { return camera; }
+
+protected:
+ virtual void create_pipeline(Msp::GL::View &) = 0;
};
#endif