cleaned up and fleshed out geom.h/geom.cc and preparing to add bounding
[laserbrain_demo] / src / objmesh.cc
1 #include "opengl.h"
2 #include "objmesh.h"
3 #include "snode.h"
4
5 ObjMesh::ObjMesh()
6 {
7         mesh = 0;
8 }
9
10 ObjType ObjMesh::get_type() const
11 {
12         return OBJ_MESH;
13 }
14
15 void ObjMesh::draw() const
16 {
17         if(!mesh) return;
18
19         mtl.setup();
20
21         if(node) {
22                 glMatrixMode(GL_MODELVIEW);
23                 glPushMatrix();
24                 glMultMatrixf(node->get_matrix()[0]);
25         }
26
27         mesh->draw();
28
29         if(node) {
30                 glMatrixMode(GL_MODELVIEW);
31                 glPopMatrix();
32         }
33 }
34
35 const AABox &ObjMesh::get_aabox() const
36 {
37         return mesh ? mesh->get_aabbox() : Object::get_aabox();
38 }