updating IntersectList to new Shape::IntersectionList format

git-svn-id: svn://anubis/fart/branches/2009-02-23_Shape_IntersectList_Update@144 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop committed 2009-02-23 20:24:30 +00:00
1 parent 3b3a153559
commit 0c7f85db96
12 files changed
+54 -30

No files matched your search

+6 -4
View File
@@ -171,15 +171,17 @@ vector<Scene::ShapeDistance> Scene::getRayHits(const Ray & ray)
it != m_shapes.end();
it++)
{
Shape::IntersectList intersections = (*it)->intersect(ray);
Shape::IntersectionList intersections = (*it)->intersect(ray);
for (int i = 0, num_results = intersections.size();
i < num_results;
i++)
{
Vector normal = (*it)->getNormalAt(intersections[i]);
refptr<Shape> shape = intersections[i].first;
refptr<Vector> isect_point = intersections[i].second;
Vector normal = shape->getNormalAt(*isect_point);
double dot = normal % ray.getDirection();
double intersect_dist = (intersections[i] - ray.getOrigin()).mag();
double intersect_dist = ((*isect_point) - ray.getOrigin()).mag();
if (dot < 0.0) /* cull back faces */
{
double transparency = (*it)->getTransparency();
@@ -190,7 +192,7 @@ vector<Scene::ShapeDistance> Scene::getRayHits(const Ray & ray)
}
if (minSolidDist == 0.0 || minSolidDist >= intersect_dist)
{
hits.push_back(ShapeDistance(*it, intersect_dist));
hits.push_back(ShapeDistance(shape, intersect_dist));
}
}
}