--- a/src/scene.h Sun Nov 18 11:20:56 2007 +0100
+++ b/src/scene.h Thu Nov 22 17:53:34 2007 +0100
@@ -16,6 +16,15 @@
using namespace std;
+/* axis-aligned bounding box */
+class BBox
+{
+public:
+ Vector3 L;
+ Vector3 R;
+ BBox(): L(), R() {};
+};
+
class Ray
{
public:
@@ -84,6 +93,8 @@
// normal at point P
virtual Vector3 normal(Vector3 &P) = 0;
+
+ virtual BBox get_bbox();
};
class Sphere: public Shape
@@ -130,6 +141,7 @@
bool intersect(const Ray &ray, float &dist);
bool intersect_all(const Ray &ray, float dist, vector<float> &allts) {return false;};
Vector3 normal(Vector3 &) { return N; };
+ BBox get_bbox();
};
#endif