include/scene.h
branchpyrit
changeset 36 b490093b0ac3
parent 34 28f6e8b9d5d1
child 38 5d043eeb09d9
--- a/include/scene.h	Wed Dec 12 19:59:19 2007 +0100
+++ b/include/scene.h	Thu Dec 13 00:08:11 2007 +0100
@@ -130,6 +130,9 @@
 	// all intersections (only for CSG)
 	virtual bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const = 0;
 
+	// intersection with AABB
+	virtual bool intersect_bbox(const BBox &bbox) const = 0;
+
 	// normal at point P
 	virtual const Vector3 normal(const Vector3 &P) const = 0;
 
@@ -153,6 +156,7 @@
 		center(acenter), radius(aradius) { material = amaterial; }
 	bool intersect(const Ray &ray, Float &dist) const;
 	bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const;
+	bool intersect_bbox(const BBox &bbox) const { return true; };
 	const Vector3 normal(const Vector3 &P) const { return (P - center) * inv_radius; };
 	BBox get_bbox() const;
 };
@@ -171,6 +175,7 @@
 	};
 	bool intersect(const Ray &ray, Float &dist) const;
 	bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const { return false; };
+	bool intersect_bbox(const BBox &bbox) const { return true; };
 	const Vector3 normal(const Vector3 &P) const;
 	BBox get_bbox() const { return BBox(L, H); };
 };
@@ -235,6 +240,7 @@
 	Triangle(Vertex *aA, Vertex *aB, Vertex *aC, Material *amaterial);
 	bool intersect(const Ray &ray, Float &dist) const;
 	bool intersect_all(const Ray &ray, Float dist, vector<Float> &allts) const {return false;};
+	bool intersect_bbox(const BBox &bbox) const;
 	const Vector3 normal(const Vector3 &P) const { return (smooth ? smooth_normal(P) : N); };
 	const Vector3 getNormal() const { return N; };
 	void setSmooth() { smooth = true; };//(typeid(*A) == typeid(*B) == typeid(*C) == typeid(NormalVertex)); };