optimized intersect() test for Subtract and Intersect boolean objects to not attempt intersecting with object B when object A had no intersections.... had about a 26% speed improvement for DW test scene
git-svn-id: svn://anubis/fart/trunk@304 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
parent
f337831df6
commit
138c90c2c3
@ -33,6 +33,8 @@ Shape::IntersectionList Intersect::intersect(refptr<Shape> _this, const Ray & ra
|
|||||||
{
|
{
|
||||||
Ray ray_inv = m_inverse.transform_ray(ray);
|
Ray ray_inv = m_inverse.transform_ray(ray);
|
||||||
IntersectionList res1 = m_shape1->intersect(m_shape1, ray_inv);
|
IntersectionList res1 = m_shape1->intersect(m_shape1, ray_inv);
|
||||||
|
if (res1.size() == 0) /* optimization */
|
||||||
|
return res1;
|
||||||
IntersectionList res2 = m_shape2->intersect(m_shape2, ray_inv);
|
IntersectionList res2 = m_shape2->intersect(m_shape2, ray_inv);
|
||||||
BoolIntersectionList merged(res1, res2, ray_inv.getOrigin());
|
BoolIntersectionList merged(res1, res2, ray_inv.getOrigin());
|
||||||
|
|
||||||
|
@ -33,6 +33,8 @@ Shape::IntersectionList Subtract::intersect(refptr<Shape> _this, const Ray & ray
|
|||||||
{
|
{
|
||||||
Ray ray_inv = m_inverse.transform_ray(ray);
|
Ray ray_inv = m_inverse.transform_ray(ray);
|
||||||
IntersectionList res1 = m_shape1->intersect(m_shape1, ray_inv);
|
IntersectionList res1 = m_shape1->intersect(m_shape1, ray_inv);
|
||||||
|
if (res1.size() == 0) /* optimization */
|
||||||
|
return res1;
|
||||||
IntersectionList res2 = m_shape2->intersect(m_shape2, ray_inv);
|
IntersectionList res2 = m_shape2->intersect(m_shape2, ray_inv);
|
||||||
BoolIntersectionList merged(res1, res2, ray_inv.getOrigin());
|
BoolIntersectionList merged(res1, res2, ray_inv.getOrigin());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user