src/rcrt/objects/DynamicObject.cpp

Go to the documentation of this file.
00001 #include "DynamicObject.h"
00002 
00003 using namespace std;
00004 
00005 namespace rcrt
00006 {
00007 
00008 DynamicObject::DynamicObject(string name):SolidObject(name)
00009 {
00010         worldMatrix = Matrix4D::identity();
00011         invWorldMatrix = Matrix4D::identity();
00012 }
00013 
00014 DynamicObject::~DynamicObject()
00015 {
00016 }
00017 
00018 
00019 void DynamicObject::setPrimitives(std::vector<Primitive*>* prList)
00020 {
00021         localTree.setTraceables(prList);
00022 }
00023 
00024 void DynamicObject::setWorldMatrix(const Matrix4D& mat)
00025 {
00026         //does nothing, dynamic objects are in terms of world coordinates
00027 }
00028 
00029 Intersection DynamicObject::intersect(Ray& r) const
00030 {
00031         Intersection wIns = localTree.getBoundingBox().intersect(r);
00032         if(!wIns.isValid()){
00033                 return wIns;
00034         }       
00035         Intersection lIns = localTree.intersect(r);     
00036         return lIns;
00037 }
00038 
00039 const AABB& DynamicObject::getBoundingBox() const
00040 {
00041         return localTree.getBoundingBox();
00042 }
00043 
00044 const Point3D& DynamicObject::getCentroid() const
00045 {
00046         return localTree.getCentroid();
00047 }
00048 
00049 }

Generated on Thu Jan 31 19:26:19 2008 for RenderingCompetitionRayTracer by  doxygen 1.5.3