tavli

view src/object.cc @ 1:3fcd7b4d631f

board mesh generation
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 22 Jun 2015 05:05:37 +0300
parents
children 893192aea099
line source
1 #include "object.h"
2 #include "opengl.h"
4 Object::Object()
5 {
6 mesh = 0;
7 }
9 Object::~Object()
10 {
11 delete mesh;
12 }
14 Matrix4x4 &Object::xform()
15 {
16 return matrix;
17 }
19 const Matrix4x4 &Object::xform() const
20 {
21 return matrix;
22 }
24 void Object::set_mesh(Mesh *m)
25 {
26 this->mesh = m;
27 }
29 Mesh *Object::get_mesh() const
30 {
31 return mesh;
32 }
34 void Object::draw() const
35 {
36 if(!mesh) return;
38 glMatrixMode(GL_MODELVIEW);
39 glPushMatrix();
40 glLoadTransposeMatrixf(matrix[0]);
42 mesh->draw();
44 glPopMatrix();
45 }