1 #include <msp/fs/dir.h>
2 #include <msp/gl/sequencebuilder.h>
3 #include "forestpond.h"
8 ForestPond::ForestPond(int, char **):
9 window(display, 1920, 1080),
11 /* TODO InstanceArray is not compatible with ResourceManager at the moment,
12 because it requires Mesh to have its vertex format ready. */
15 camera(resources.get<GL::Camera>("Camera.camera")),
16 water(resources.get<GL::Object>("Water.object"), resources, { resources.get<GL::Mesh>("Terrain.mesh"), -10.0f, -3.0f, 2.0f, 6.0f })
18 window.set_title("Forest Pond");
19 window.signal_close.connect(sigc::bind(sigc::mem_fun(this, &ForestPond::exit), 0));
21 GL::SequenceBuilder seq_bld(resources.get<GL::SequenceTemplate>("Forest.seq"));
22 seq_bld.set_debug_name("Main sequence");
23 seq_bld.set_renderable("content", content);
24 sequence.reset(seq_bld.build(view));
26 content.add(resources.get<GL::Scene>("Forest.scene"));
28 water.set_matrix(GL::Matrix::translation(GL::Vector3(-3, 2, 0)));
30 view.set_content(sequence.get());
31 view.set_camera(&camera);
34 int ForestPond::main()
37 return Application::main();
40 void ForestPond::tick()
47 ForestPond::Resources::Resources(GL::ResourceManager *rm)
49 FS::Path base_dir = FS::get_sys_data_dir()/"demos"/"forestpond"/"data";
50 source.add_directory(base_dir);
51 source.add_directory(base_dir/"textures");
52 source.add_directory(base_dir/"exported");
55 set_resource_manager(rm);