--- a/src/scene.cc Sun Nov 25 15:50:01 2007 +0100
+++ b/src/scene.cc Sun Nov 25 17:58:29 2007 +0100
@@ -21,13 +21,13 @@
{
if (ray.dir.cell[i] == 0) {
/* ray is parallel to these planes */
- if (ray.a.cell[i] < L.cell[i] || ray.a.cell[i] > H.cell[i])
+ if (ray.o.cell[i] < L.cell[i] || ray.o.cell[i] > H.cell[i])
return false;
} else
{
/* compute the intersection distance of the planes */
- t1 = (L.cell[i] - ray.a.cell[i]) / ray.dir.cell[i];
- t2 = (H.cell[i] - ray.a.cell[i]) / ray.dir.cell[i];
+ t1 = (L.cell[i] - ray.o.cell[i]) / ray.dir.cell[i];
+ t2 = (H.cell[i] - ray.o.cell[i]) / ray.dir.cell[i];
if (t1 > t2)
swap(t1, t2);
@@ -50,7 +50,7 @@
bool Sphere::intersect(const Ray &ray, float &dist)
{
- Vector3 V = ((Ray)ray).a - center;
+ Vector3 V = ((Ray)ray).o - center;
float Vd = - dot(V, ray.dir);
float Det = Vd * Vd - (dot(V,V) - sqr_radius);
@@ -81,7 +81,7 @@
{
//allts = new vector<float>();
- Vector3 V = ((Ray)ray).a - center;
+ Vector3 V = ((Ray)ray).o - center;
float Vd = - dot(V, ray.dir);
float Det = Vd * Vd - (dot(V,V) - sqr_radius);
@@ -115,11 +115,7 @@
{
BBox bbox = BBox();
bbox.L = center - radius;
- //bbox.L.y = center.y - radius;
- //bbox.L.z = center.z - radius;
bbox.H = center + radius;
- //bbox.H.y = center.y + radius;
- //bbox.H.z = center.z + radius;
return bbox;
}
@@ -131,8 +127,8 @@
Vector3 Box::normal(Vector3 &P)
{
- Vector3 N(0,1,0);
- /*for (int i = 0; i < 3; i++)
+ Vector3 N;
+ for (int i = 0; i < 3; i++)
{
if (P.cell[i] >= L.cell[i]-Eps && P.cell[i] <= L.cell[i]+Eps)
//if (P.cell[i] == L.cell[i])
@@ -146,7 +142,7 @@
N.cell[i] = +1.0;
break;
}
- }*/
+ }
return N;
}
@@ -201,7 +197,7 @@
// see comment for previous method
bool Triangle::intersect(const Ray &ray, float &dist)
{
- Vector3 O = ray.a;
+ Vector3 O = ray.o;
Vector3 D = ray.dir;
const int modulo3[5] = {0,1,2,0,1};