erebus

annotate liberebus/src/object.cc @ 2:474a0244f57d

fixed specialization mistake fixed line endings added makefiles
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 28 Apr 2014 06:31:10 +0300
parents 4abdce1361b9
children a932848de652
rev   line source
nuclear@2 1 #include "object.h"
nuclear@2 2
nuclear@2 3 Object::Object()
nuclear@2 4 {
nuclear@2 5 name = "<unnamed>";
nuclear@2 6 inv_xform_valid = false;
nuclear@2 7 }
nuclear@2 8
nuclear@2 9 ObjType Object::get_type() const
nuclear@2 10 {
nuclear@2 11 return ObjType::null;
nuclear@2 12 }
nuclear@2 13
nuclear@2 14 void Object::set_name(const char *name)
nuclear@2 15 {
nuclear@2 16 this->name = name;
nuclear@2 17 }
nuclear@2 18
nuclear@2 19 const char *Object::get_name() const
nuclear@2 20 {
nuclear@2 21 return name.c_str();
nuclear@2 22 }
nuclear@2 23
nuclear@2 24 void Object::set_xform(const Matrix4x4 &mat)
nuclear@2 25 {
nuclear@2 26 xform = mat;
nuclear@2 27 inv_xform_valid = false;
nuclear@2 28 }
nuclear@2 29
nuclear@2 30 void Object::set_xform(const Matrix4x4 &mat, const Matrix4x4 &inv_mat)
nuclear@2 31 {
nuclear@2 32 xform = mat;
nuclear@2 33 inv_xform = inv_mat;
nuclear@2 34 inv_xform_valid = true;
nuclear@2 35 }
nuclear@2 36
nuclear@2 37 Matrix4x4 &Object::get_xform()
nuclear@2 38 {
nuclear@2 39 inv_xform_valid = false;
nuclear@2 40 return xform;
nuclear@2 41 }
nuclear@2 42
nuclear@2 43 const Matrix4x4 &Object::get_xform() const
nuclear@2 44 {
nuclear@2 45 return xform;
nuclear@2 46 }
nuclear@2 47
nuclear@2 48 const Matrix4x4 &Object::get_inv_xform() const
nuclear@2 49 {
nuclear@2 50 if(!inv_xform_valid) {
nuclear@2 51 inv_xform = xform.inverse();
nuclear@2 52 inv_xform_valid = true;
nuclear@2 53 }
nuclear@2 54 return inv_xform;
nuclear@2 55 }
nuclear@2 56
nuclear@2 57 bool Object::intersect(const Ray &ray, RayHit *hit) const
nuclear@2 58 {
nuclear@2 59 return false;
nuclear@2 60 }