adding exhibit data, starting with descriptions
[laserbrain_demo] / src / exhibit.cc
1 #include "exhibit.h"
2 #include "snode.h"
3 #include "scene.h"
4
5 class ExhibitPriv {
6 public:
7         Vec3 orig_pos;
8         Quat orig_rot;
9         SceneNode *orig_node;
10
11         ExhibitPriv();
12 };
13
14
15 // selection
16 ExSelection::ExSelection(Exhibit *ex)
17 {
18         this->ex = ex;
19         obj = data = 0;
20         validmask = 0;
21 }
22
23 ExSelection::operator bool() const
24 {
25         return ex != 0;
26 }
27
28 // Exhibit data
29 ExData::ExData()
30 {
31         voice = 0;
32 }
33
34 ExData::~ExData()
35 {
36         delete voice;
37 }
38
39 // private data for each exhibit type
40 ExhibitPriv::ExhibitPriv()
41 {
42         orig_node = 0;
43 }
44
45 // exhibit class
46 Exhibit::Exhibit()
47 {
48         priv = new ExhibitPriv;
49 }
50
51 Exhibit::~Exhibit()
52 {
53         delete priv;
54 }
55
56 void Exhibit::set_node(SceneNode *node)
57 {
58         this->node = priv->orig_node = node;
59         priv->orig_pos = node->get_position();
60         priv->orig_rot = node->get_rotation();
61 }
62
63 ExSelection Exhibit::select(const Ray &ray) const
64 {
65         return ExSelection(0);
66 }
67
68 ExSelection Exhibit::select(const Sphere &sph) const
69 {
70         return ExSelection(0);
71 }
72
73 void Exhibit::update(float dt)
74 {
75 }
76
77 void Exhibit::pre_draw() const
78 {
79         if(node) {
80                 glMatrixMode(GL_MODELVIEW);
81                 glPushMatrix();
82                 glMultMatrixf(node->get_matrix()[0]);
83         }
84 }
85
86 void Exhibit::draw() const
87 {
88 }
89
90 void Exhibit::post_draw() const
91 {
92         if(node) {
93                 glMatrixMode(GL_MODELVIEW);
94                 glPopMatrix();
95         }
96 }