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