1 #ifndef PRIMITIVE_HXX
 2 #define PRIMITIVE_HXX
 3 
 4 #include "Box.hxx"
 5 #include "Ray.hxx"
 6 #include "Shader.hxx"
 7 #include "PhotonDistributor.hxx"
 8 #include "Material.hxx"
 9 
10 class Primitive
11 {
12 public:
13 	Shader            *shader;
14 	PhotonDistributor *photon_distributor;
15 
16 	Primitive(Shader *shader = NULL, PhotonDistributor *photon_distributor = NULL)
17 		: shader(shader), photon_distributor(photon_distributor)
18 	{};
19 
20 	virtual ~Primitive()
21 	{};
22 
23 	virtual bool Intersect(Ray &ray) = 0;
24 	virtual bool Occluded(Ray &ray) {return Intersect(ray);}
25 	virtual Vec3f GetNormal(Ray &ray) = 0;
26 
27 	virtual Box CalcBounds() = 0;
28 
29 	virtual void GetUV(Ray &ray, float &u, float &v)
30 	{
31 		u = ray.org.x + ray.t * ray.dir.x;
32 		v = ray.org.z + ray.t * ray.dir.z;
33 	};
34 };
35 
36 #endif


syntax highlighted by Code2HTML, v. 0.9.1