tavli
annotate 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 |
rev | line source |
---|---|
nuclear@1 | 1 #include "object.h" |
nuclear@1 | 2 #include "opengl.h" |
nuclear@1 | 3 |
nuclear@1 | 4 Object::Object() |
nuclear@1 | 5 { |
nuclear@1 | 6 mesh = 0; |
nuclear@1 | 7 } |
nuclear@1 | 8 |
nuclear@1 | 9 Object::~Object() |
nuclear@1 | 10 { |
nuclear@1 | 11 delete mesh; |
nuclear@1 | 12 } |
nuclear@1 | 13 |
nuclear@1 | 14 Matrix4x4 &Object::xform() |
nuclear@1 | 15 { |
nuclear@1 | 16 return matrix; |
nuclear@1 | 17 } |
nuclear@1 | 18 |
nuclear@1 | 19 const Matrix4x4 &Object::xform() const |
nuclear@1 | 20 { |
nuclear@1 | 21 return matrix; |
nuclear@1 | 22 } |
nuclear@1 | 23 |
nuclear@1 | 24 void Object::set_mesh(Mesh *m) |
nuclear@1 | 25 { |
nuclear@1 | 26 this->mesh = m; |
nuclear@1 | 27 } |
nuclear@1 | 28 |
nuclear@1 | 29 Mesh *Object::get_mesh() const |
nuclear@1 | 30 { |
nuclear@1 | 31 return mesh; |
nuclear@1 | 32 } |
nuclear@1 | 33 |
nuclear@1 | 34 void Object::draw() const |
nuclear@1 | 35 { |
nuclear@1 | 36 if(!mesh) return; |
nuclear@1 | 37 |
nuclear@1 | 38 glMatrixMode(GL_MODELVIEW); |
nuclear@1 | 39 glPushMatrix(); |
nuclear@2 | 40 glMultTransposeMatrixf(matrix[0]); |
nuclear@1 | 41 |
nuclear@1 | 42 mesh->draw(); |
nuclear@1 | 43 |
nuclear@1 | 44 glPopMatrix(); |
nuclear@1 | 45 } |
nuclear@3 | 46 |
nuclear@3 | 47 bool Object::intersect(const Ray &ray, HitPoint *hit) const |
nuclear@3 | 48 { |
nuclear@3 | 49 return false; // TODO |
nuclear@3 | 50 } |