tavli
view src/object.cc @ 3:94aff2ff1934
too much?
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 22 Jun 2015 21:46:57 +0300 |
parents | 893192aea099 |
children | b41ceead1708 |
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 glMultTransposeMatrixf(matrix[0]);
42 mesh->draw();
44 glPopMatrix();
45 }
47 bool Object::intersect(const Ray &ray, HitPoint *hit) const
48 {
49 return false; // TODO
50 }