diff -r fbd1d2f7d94e -r fc18ac4833f2 src/scene.h --- a/src/scene.h Sat Nov 24 23:55:54 2007 +0100 +++ b/src/scene.h Sun Nov 25 15:50:01 2007 +0100 @@ -29,11 +29,12 @@ { public: Vector3 L; - Vector3 R; - BBox(): L(), R() {}; - float w() { return R.x-L.x; }; - float h() { return R.y-L.y; }; - float d() { return R.z-L.z; }; + Vector3 H; + BBox(): L(), H() {}; + BBox(const Vector3 aL, const Vector3 aH): L(aL), H(aH) {}; + float w() { return H.x-L.x; }; + float h() { return H.y-L.y; }; + float d() { return H.z-L.z; }; bool intersect(const Ray &ray, float &a, float &b); }; @@ -118,20 +119,22 @@ BBox get_bbox(); }; -class Plane: public Shape +class Box: public Shape { + Vector3 L; + Vector3 H; public: - Vector3 N; - float d; - - Plane(const Vector3 &normal, const float ad, Material *amaterial): - N(normal), d(ad) { material = amaterial; }; - Plane(const Vector3 &normal, const Vector3 &point): - N(normal), d(0) { /*TODO*/}; + Box(const Vector3 &aL, const Vector3 &aH, Material *amaterial): L(aL), H(aH) + { + for (int i = 0; i < 3; i++) + if (L.cell[i] > H.cell[i]) + swap(L.cell[i], H.cell[i]); + material = amaterial; + }; bool intersect(const Ray &ray, float &dist); bool intersect_all(const Ray &ray, float dist, vector &allts) {return false;}; - Vector3 normal(Vector3 &) { return N; }; - BBox get_bbox(); + Vector3 normal(Vector3 &P); + BBox get_bbox() { return BBox(L, H); }; }; class Triangle: public Shape