prepare_data now only processes files based on modification time
[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 ExSelection::ExSelection(Exhibit *ex)
15 {
16         this->ex = ex;
17         obj = data = 0;
18         validmask = 0;
19 }
20
21 ExSelection::operator bool() const
22 {
23         return ex != 0;
24 }
25
26 ExhibitPriv::ExhibitPriv()
27 {
28         orig_node = 0;
29 }
30
31 Exhibit::Exhibit()
32 {
33         priv = new ExhibitPriv;
34 }
35
36 Exhibit::~Exhibit()
37 {
38         delete priv;
39 }
40
41 void Exhibit::set_node(SceneNode *node)
42 {
43         this->node = priv->orig_node = node;
44         priv->orig_pos = node->get_position();
45         priv->orig_rot = node->get_rotation();
46 }
47
48 ExSelection Exhibit::select(const Ray &ray) const
49 {
50         return ExSelection(0);
51 }
52
53 ExSelection Exhibit::select(const Sphere &sph) const
54 {
55         return ExSelection(0);
56 }
57
58 void Exhibit::update(float dt)
59 {
60 }
61
62 void Exhibit::pre_draw() const
63 {
64         if(node) {
65                 glMatrixMode(GL_MODELVIEW);
66                 glPushMatrix();
67                 glMultMatrixf(node->get_matrix()[0]);
68         }
69 }
70
71 void Exhibit::draw() const
72 {
73 }
74
75 void Exhibit::post_draw() const
76 {
77         if(node) {
78                 glMatrixMode(GL_MODELVIEW);
79                 glPopMatrix();
80         }
81 }