#pragma once #include "Vector.hpp" #include "Material.hpp" #include "BoundingBox.hpp" #include "HitRec.hpp" #include "Ray.hpp" #include "Transformation.hpp" #include class Occluder; class Radion; /*! \brief Base interface for all object types that can be ray-traced. The most important implementing classes are TriangleMesh and Transformed (usually referring to a TriangleMesh). A KDTree will build a hierarchy of Intersectables. TraingleMesh::Patch is also an implementing class, and a TriangleMesh contains a KDTree of patches. */ class Intersectable { protected: const Material* material; public: Intersectable(std::istream& isc, Material** materialTable, int nMaterials); Intersectable(); ~Intersectable(); //! bounding box for the kd-tree BoundingBox bbox; //! result of the last intersection test unsigned int lastTestedRayId; HitRec lastTestedRayResult; //! pure virtual function, must be implemented to carry out the intersection test virtual bool intersect(const Ray& ray, float& depth, float rayMin, float rayMax)=0; virtual bool intersectBackSide(const Ray& ray, float& depth, float rayMin, float rayMax)=0; virtual void getTransformedBoundingBox(const Transformation& tf, BoundingBox& bb) {bb = bbox;} const Material* getMaterial() const {return material;} //! return the surface area virtual float getSurfaceArea(); //! return a random surface point virtual void sampleSurface(Radion& radion); };