--- a/src/raytracer.cc Thu Nov 22 17:53:34 2007 +0100
+++ b/src/raytracer.cc Thu Nov 22 18:10:10 2007 +0100
@@ -230,7 +230,7 @@
vy = starty;
#ifdef PTHREADS
- int num_threads = 2;
+ int num_threads = 4;
printf("* pthreads enabled, using %d threads\n", num_threads);
pthread_t threads[num_threads];
for (int t = 0; t < num_threads; t++)
--- a/src/scene.cc Thu Nov 22 17:53:34 2007 +0100
+++ b/src/scene.cc Thu Nov 22 18:10:10 2007 +0100
@@ -71,6 +71,18 @@
return false;
}
+BBox Sphere::get_bbox()
+{
+ BBox bbox = BBox();
+ bbox.L.x = center.x - radius;
+ bbox.L.y = center.y - radius;
+ bbox.L.z = center.z - radius;
+ bbox.R.x = center.x + radius;
+ bbox.R.y = center.y + radius;
+ bbox.R.z = center.z + radius;
+ return bbox;
+}
+
bool Plane::intersect(const Ray &ray, float &dist)
{
float dir = dot(N, ray.dir);
@@ -85,6 +97,11 @@
return false;
}
+BBox Plane::get_bbox()
+{
+ return BBox();
+}
+
// this initialization and following intersection methods implements
// Fast Triangle Intersection algorithm from
// http://www.mpi-inf.mpg.de/~wald/PhD/
--- a/src/scene.h Thu Nov 22 17:53:34 2007 +0100
+++ b/src/scene.h Thu Nov 22 18:10:10 2007 +0100
@@ -94,7 +94,7 @@
// normal at point P
virtual Vector3 normal(Vector3 &P) = 0;
- virtual BBox get_bbox();
+ virtual BBox get_bbox() = 0;
};
class Sphere: public Shape
@@ -111,6 +111,7 @@
bool intersect(const Ray &ray, float &dist);
bool intersect_all(const Ray &ray, float dist, vector<float> &allts);
Vector3 normal(Vector3 &P) { return (P - center) * inv_radius; };
+ BBox get_bbox();
};
class Plane: public Shape
@@ -126,6 +127,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();
};
class Triangle: public Shape