added getInverse() to util/Transform, fixed transform_*() functions

git-svn-id: svn://anubis/fart/trunk@39 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop committed 2009-01-23 15:28:53 +00:00
1 parent 7d461477b3
commit 97b9fa9eab
3 files changed
+33 -17

No files matched your search

+12 -4
View File
@@ -117,8 +117,16 @@ void Scene::renderPixel(int x, int y, unsigned char * pixel)
Ray ray(Vector(0, 0, 0), Vector(rx, ry, rz));
// TODO: um... real work
pixel[BMP_RED] = 0;
pixel[BMP_GREEN] = 0;
pixel[BMP_BLUE] = 0;
/* loop through all shapes in the scene */
for (vector<Shape *>::iterator it = m_shapes.begin();
it != m_shapes.end();
it++)
{
/* transform the ray by the inverse of the shape's transform */
Transform inv = (*it)->getTransform().getInverse();
Ray transformed_ray = inv.transform_ray(ray);
/* then intersect this inversely transformed ray with the shape */
Solver::Result intersections = (*it)->intersect(transformed_ray);
}
}