00001 #ifndef SCENE_H_ 00002 #define SCENE_H_ 00003 00004 #include "Traceable.h" 00005 #include "BIH.hpp" 00006 #include "SAHKDtree.hpp" 00007 #include <vector> 00008 00009 namespace rcrt 00010 { 00011 00012 class Light; 00013 00019 class Scene : public rcrt::Traceable 00020 { 00021 private: 00022 BIH<Traceable> sceneTree; 00023 // SAHKDtree<Traceable> sceneTree; 00024 std::vector<Light*>* lights; 00025 bool shadows, ownLights; 00026 std::string name; 00027 00028 public: 00034 Scene(std::vector<Traceable*>* trList, std::vector<Light*>* ls=0, bool shadows=false); 00035 00039 Scene(bool shadows=false); 00040 virtual ~Scene(); 00041 00048 bool isOccluded(const Point3D& point, const Vec3D& dir, const float& maxDir) const; 00049 00053 void addLight(Light* light); 00054 00055 std::vector<Light*>* const getLights() const; 00056 00057 virtual Intersection intersect(Ray& r) const; 00058 virtual const AABB& getBoundingBox() const; 00059 virtual const Point3D& getCentroid() const; 00060 00061 void setShadows(bool shadows); 00062 bool castShadows() const; 00063 00067 void setTraceables(std::vector<Traceable*>* trList); 00068 void setLights(std::vector<Light*>* ls); 00069 00070 void setName(std::string name); 00071 const std::string& getName() const; 00072 00073 AABB clipBox(AABB& cbox) const; 00074 00075 }; 00076 00077 } 00078 00079 #endif /*SCENE_H_*/