]> git.tdb.fi Git - libs/demoscene.git/blob - source/stage.h
1d20bdae6760f4e79b08f44e7fd47bd0a9ad2030
[libs/demoscene.git] / source / stage.h
1 #ifndef MSP_DEMOSCENE_STAGE_H_
2 #define MSP_DEMOSCENE_STAGE_H_
3
4 #include <msp/gl/camera.h>
5 #include <msp/gl/pipeline.h>
6 #include "action.h"
7 #include "demo.h"
8
9 namespace Msp {
10 namespace DemoScene {
11
12 class Stage
13 {
14 public:
15         class UseInView: public Action
16         {
17         public:
18                 class Loader: public Msp::DataFile::DerivedObjectLoader<UseInView, Action::Loader>
19                 {
20                 public:
21                         Loader(UseInView &, Demo &);
22
23                 private:
24                         void stage(const std::string &);
25                         void view(const std::string &);
26                 };
27
28         private:
29                 Msp::GL::View *view;
30                 Stage *stage;
31
32         public:
33                 UseInView();
34                 UseInView(Msp::GL::View &, Stage &);
35
36                 virtual void validate() const;
37
38                 virtual void start(float, float);
39         };
40
41         class SetCamera: public Action
42         {
43         public:
44                 class Loader: public Msp::DataFile::DerivedObjectLoader<SetCamera, Action::Loader>
45                 {
46                 public:
47                         Loader(SetCamera &, Demo &);
48
49                 private:
50                         void camera(const std::string &);
51                         void stage(const std::string &);
52                 };
53
54         private:
55                 Stage *stage;
56                 const Msp::GL::Camera *camera;
57
58         public:
59                 SetCamera();
60                 SetCamera(Stage &, const Msp::GL::Camera &);
61
62                 virtual void validate() const;
63
64                 virtual void start(float, float);
65         };
66
67 protected:
68         Msp::GL::Pipeline *pipeline;
69         Msp::GL::Camera camera;
70         Msp::GL::View *last_view;
71
72 public:
73         Stage();
74         ~Stage();
75
76         virtual void add_things(Demo::ThingMap &, const std::string &);
77
78         void set_camera(const Msp::GL::Camera &);
79         Msp::GL::Camera &get_camera() { return camera; }
80
81 protected:
82         virtual void create_pipeline(Msp::GL::View &) = 0;
83 };
84
85 } // namespace DemoScene
86 } // namespace Msp
87
88 #endif