source: GTP/trunk/App/Demos/Illum/pathmap/Intersectable.hpp @ 2197

Revision 2197, 1.4 KB checked in by szirmay, 18 years ago (diff)
Line 
1#pragma once
2#include "Vector.hpp"
3#include "Material.hpp"
4#include "BoundingBox.hpp"
5#include "HitRec.hpp"
6#include "Ray.hpp"
7#include "Transformation.hpp"
8#include <iostream>
9
10class Occluder;
11class Radion;
12
13/*!
14\brief Base interface for all object types that can be ray-traced.
15The most important implementing classes are TriangleMesh and Transformed (usually referring to a TriangleMesh).
16A KDTree will build a hierarchy of Intersectables.
17TraingleMesh::Patch is also an implementing class, and a TriangleMesh contains a KDTree of patches.
18*/
19class Intersectable {
20protected:
21        const Material*         material;
22public:
23        Intersectable(std::istream& isc, Material** materialTable, int nMaterials);
24        Intersectable();
25        ~Intersectable();
26        //! bounding box for the kd-tree
27        BoundingBox     bbox;
28        //! result of the last intersection test
29        unsigned int    lastTestedRayId;               
30        HitRec                  lastTestedRayResult;
31
32        //! pure virtual function, must be implemented to carry out the intersection test
33        virtual bool intersect(const Ray& ray, float& depth, float rayMin, float rayMax)=0;
34        virtual bool intersectBackSide(const Ray& ray, float& depth, float rayMin, float rayMax)=0;
35        virtual void getTransformedBoundingBox(const Transformation& tf, BoundingBox& bb) {bb = bbox;}
36       
37        const Material* getMaterial() const {return material;}
38
39        //! return the surface area
40        virtual float getSurfaceArea();
41
42        //! return a random surface point
43        virtual void sampleSurface(Radion& radion);
44};
Note: See TracBrowser for help on using the repository browser.