erebus
view liberebus/src/object.cc @ 0:4abdce1361b9
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 27 Apr 2014 16:02:47 +0300 |
parents | |
children | 474a0244f57d |
line source
1 #include "object.h"
3 Object::Object()
4 {
5 name = "<unnamed>";
6 inv_xform_valid = false;
7 }
9 ObjType Object::get_type() const
10 {
11 return ObjType::null;
12 }
14 void Object::set_name(const char *name)
15 {
16 this->name = name;
17 }
19 const char *Object::get_name() const
20 {
21 return name.c_str();
22 }
24 void Object::set_xform(const Matrix4x4 &mat)
25 {
26 xform = mat;
27 inv_xform_valid = false;
28 }
30 void Object::set_xform(const Matrix4x4 &mat, const Matrix4x4 &inv_mat)
31 {
32 xform = mat;
33 inv_xform = inv_mat;
34 inv_xform_valid = true;
35 }
37 Matrix4x4 &Object::get_xform()
38 {
39 inv_xform_valid = false;
40 return xform;
41 }
43 const Matrix4x4 &Object::get_xform() const
44 {
45 return xform;
46 }
48 const Matrix4x4 &Object::get_inv_xform() const
49 {
50 if(!inv_xform_valid) {
51 inv_xform = xform.inverse();
52 inv_xform_valid = true;
53 }
54 return inv_xform;
55 }
57 bool Object::intersect(const Ray &ray, RayHit *hit) const
58 {
59 return false;
60 }