00001 #ifndef AFFINEOBJECT_H_ 00002 #define AFFINEOBJECT_H_ 00003 00004 #include "SolidObject.h" 00005 #include <vector> 00006 #include "../BIH.hpp" 00007 #include "../SAHKDtree.hpp" 00008 #include "../math/rcrtmath.h" 00009 #include "../primitives/AABB.h" 00010 00011 namespace rcrt 00012 { 00013 00019 class AffineObject : public rcrt::SolidObject 00020 { 00021 private: 00022 SAHKDtree<Primitive> localTree; 00023 AABB worldBox;//save runtime by precalculating the worldBox 00024 00025 void updateWorldBox(); 00026 00027 public: 00028 AffineObject(std::string name); 00029 virtual ~AffineObject(); 00030 00034 void setPrimitives(std::vector<Primitive*>* prList); 00035 00036 virtual void setWorldMatrix(const Matrix4D& mat); 00037 virtual Intersection intersect(Ray& r) const; 00038 virtual const AABB& getBoundingBox() const; 00039 virtual const Point3D& getCentroid() const; 00040 00041 }; 00042 00043 } 00044 00045 #endif /*AFFINEOBJECT_H_*/