#include <msp/gl/view.h>
+#include "demo.h"
#include "stage.h"
+using namespace std;
using namespace Msp;
Stage::Stage():
}
+Stage::UseInView::UseInView():
+ view(0),
+ stage(0)
+{ }
+
Stage::UseInView::UseInView(GL::View &v, Stage &s):
- view(v),
- stage(s)
+ view(&v),
+ stage(&s)
{ }
+void Stage::UseInView::validate() const
+{
+ if(!view)
+ throw logic_error("null view");
+ if(!stage)
+ throw logic_error("null stage");
+}
+
void Stage::UseInView::start(float, float)
{
- view.set_camera(&stage.camera_control.get_camera());
- view.set_content(stage.pipeline);
+ view->set_camera(&stage->camera_control.get_camera());
+ view->set_content(stage->pipeline);
+}
+
+
+Stage::UseInView::Loader::Loader(UseInView &u, Demo &d):
+ DataFile::DerivedObjectLoader<UseInView, Action::Loader>(u, d)
+{
+ add("view", &Loader::view);
+ add("stage", &Loader::stage);
+}
+
+void Stage::UseInView::Loader::view(const string &n)
+{
+ obj.view = &demo.get_thing<GL::View>(n);
+}
+
+void Stage::UseInView::Loader::stage(const string &n)
+{
+ obj.stage = &demo.get_thing<Stage>(n);
}