select and move exhibits
[laserbrain_demo] / src / exhibit.h
1 #ifndef EXHIBIT_H_
2 #define EXHIBIT_H_
3
4 #include <string>
5 #include <gmath/gmath.h>
6 #include "object.h"
7 #include "geom.h"
8 #include "audio/stream.h"
9
10 class Exhibit;
11 class ExhibitPriv;
12 class Scene;
13
14 enum {
15         EXSEL_RAY = 1,
16         EXSEL_SPHERE = 2
17 };
18
19 class ExSelection {
20 public:
21         Exhibit *ex;
22         void *obj;
23         void *data;
24         Ray selray;
25         Sphere selsphere;
26         float dist;
27         unsigned int validmask;
28
29         ExSelection(Exhibit *ex = 0);
30
31         operator bool() const;
32 };
33
34 enum {
35         EXDATA_INFO,
36         EXDATA_VIDEO
37 };
38
39 class ExData {
40 public:
41         int type;
42
43         std::string text;
44         AudioStream *voice;
45         // TODO: video stream
46
47         ExData();
48         ~ExData();
49 };
50
51
52 /* TODO
53 - select me aktina kai select me sfaira, epistrefei Selection
54 - hover me aktina kai hover me sfaira
55 - move me selection, origin, direction kai rotation (?)
56  */
57 class Exhibit : public Object {
58 private:
59         ExhibitPriv *priv;
60
61 public:
62         std::vector<ExData> data;
63
64         Exhibit();
65         virtual ~Exhibit();
66
67         Exhibit(const Exhibit&) = delete;
68         Exhibit &operator =(const Exhibit &) = delete;
69
70         virtual void set_node(SceneNode *node);
71
72         virtual ExSelection select(const Ray &ray) const;
73         virtual ExSelection select(const Sphere &sph) const;
74
75         virtual void update(float dt = 0.0f) override;
76
77         virtual void pre_draw() const;
78         virtual void draw() const override;
79         virtual void post_draw() const;
80
81         virtual const AABox &get_aabox() const override;
82 };
83
84 #endif  // EXHIBIT_H_