1 #include <msp/gl/view.h>
17 void Stage::add_things(Demo::ThingMap &things, const string &prefix)
19 things[prefix+"camera"] = static_cast<GL::Placeable *>(&camera);
22 void Stage::add_postprocessor(GL::PostProcessor &pp)
24 pipeline->add_postprocessor(pp);
27 void Stage::set_camera(const GL::Camera &c)
29 camera.set_object_matrix(c.get_object_matrix());
30 camera.set_up_direction(c.get_up_direction());
31 camera.set_field_of_view(c.get_field_of_view());
32 camera.set_depth_clip(c.get_near_clip(), c.get_far_clip());
36 Stage::UseInView::UseInView():
41 Stage::UseInView::UseInView(GL::View &v, Stage &s):
46 void Stage::UseInView::validate() const
49 throw logic_error("null view");
51 throw logic_error("null stage");
54 void Stage::UseInView::start(float, float)
56 view->set_camera(&stage->camera);
57 view->set_content(stage->pipeline);
61 Stage::SetCamera::SetCamera():
66 Stage::SetCamera::SetCamera(Stage &s, const GL::Camera &c):
71 void Stage::SetCamera::validate() const
74 throw logic_error("null stage");
76 throw logic_error("null camera");
79 void Stage::SetCamera::start(float, float)
81 stage->set_camera(*camera);
85 Stage::UseInView::Loader::Loader(UseInView &u, Demo &d):
86 DataFile::DerivedObjectLoader<UseInView, Action::Loader>(u, d)
88 add("stage", &Loader::stage);
89 add("view", &Loader::view);
92 void Stage::UseInView::Loader::stage(const string &n)
94 obj.stage = &demo.get_thing<Stage>(n);
97 void Stage::UseInView::Loader::view(const string &n)
99 obj.view = &demo.get_thing<GL::View>(n);
103 Stage::SetCamera::Loader::Loader(SetCamera &s, Demo &d):
104 DataFile::DerivedObjectLoader<SetCamera, Action::Loader>(s, d)
106 add("camera", &Loader::camera);
107 add("stage", &Loader::stage);
110 void Stage::SetCamera::Loader::stage(const string &n)
112 obj.stage = &demo.get_thing<Stage>(n);
115 void Stage::SetCamera::Loader::camera(const string &n)
117 obj.camera = &demo.get_resources().get<GL::Camera>(n);