]> git.tdb.fi Git - libs/demoscene.git/blob - source/stage.h
Make it possible for Stages to add things to the Demo
[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 class Stage
10 {
11 public:
12         class UseInView: public Action
13         {
14         public:
15                 class Loader: public Msp::DataFile::DerivedObjectLoader<UseInView, Action::Loader>
16                 {
17                 public:
18                         Loader(UseInView &, Demo &);
19
20                 private:
21                         void stage(const std::string &);
22                         void view(const std::string &);
23                 };
24
25         private:
26                 Msp::GL::View *view;
27                 Stage *stage;
28
29         public:
30                 UseInView();
31                 UseInView(Msp::GL::View &, Stage &);
32
33                 virtual void validate() const;
34
35                 virtual void start(float, float);
36         };
37
38         class SetCamera: public Action
39         {
40         public:
41                 class Loader: public Msp::DataFile::DerivedObjectLoader<SetCamera, Action::Loader>
42                 {
43                 public:
44                         Loader(SetCamera &, Demo &);
45
46                 private:
47                         void camera(const std::string &);
48                         void stage(const std::string &);
49                 };
50
51         private:
52                 Stage *stage;
53                 const Msp::GL::Camera *camera;
54
55         public:
56                 SetCamera();
57                 SetCamera(Stage &, const Msp::GL::Camera &);
58
59                 virtual void validate() const;
60
61                 virtual void start(float, float);
62         };
63
64 protected:
65         Msp::GL::Pipeline *pipeline;
66         Msp::GL::Camera camera;
67
68 public:
69         Stage();
70         ~Stage();
71
72         virtual void add_things(Demo::ThingMap &, const std::string &);
73         void add_postprocessor(Msp::GL::PostProcessor &);
74         void set_camera(const Msp::GL::Camera &);
75         Msp::GL::Camera &get_camera() { return camera; }
76 };
77
78 #endif