| 73 | } |
| 74 | |
| 75 | bool intersect_triangle_triangle (Scene* scene0, unsigned geomID0, unsigned primID0, Scene* scene1, unsigned geomID1, unsigned primID1) |
| 76 | { |
| 77 | CSTAT(bvh_collide_prim_intersections1++); |
| 78 | const TriangleMesh* mesh0 = scene0->get<TriangleMesh>(geomID0); |
| 79 | const TriangleMesh* mesh1 = scene1->get<TriangleMesh>(geomID1); |
| 80 | const TriangleMesh::Triangle& tri0 = mesh0->triangle(primID0); |
| 81 | const TriangleMesh::Triangle& tri1 = mesh1->triangle(primID1); |
| 82 | |
| 83 | /* special culling for scene intersection with itself */ |
| 84 | if (scene0 == scene1 && geomID0 == geomID1) |
| 85 | { |
| 86 | /* ignore self intersections */ |
| 87 | if (primID0 == primID1) |
| 88 | return false; |
| 89 | } |
| 90 | CSTAT(bvh_collide_prim_intersections2++); |
| 91 | |
| 92 | if (scene0 == scene1 && geomID0 == geomID1) |
| 93 | { |
| 94 | /* ignore intersection with topological neighbors */ |
| 95 | const vint4 t0(tri0.v[0],tri0.v[1],tri0.v[2],tri0.v[2]); |
| 96 | if (any(vint4(tri1.v[0]) == t0)) return false; |
| 97 | if (any(vint4(tri1.v[1]) == t0)) return false; |
| 98 | if (any(vint4(tri1.v[2]) == t0)) return false; |
| 99 | } |
| 100 | CSTAT(bvh_collide_prim_intersections3++); |
| 101 | |
| 102 | const Vec3fa a0 = mesh0->vertex(tri0.v[0]); |
| 103 | const Vec3fa a1 = mesh0->vertex(tri0.v[1]); |
| 104 | const Vec3fa a2 = mesh0->vertex(tri0.v[2]); |
| 105 | const Vec3fa b0 = mesh1->vertex(tri1.v[0]); |
| 106 | const Vec3fa b1 = mesh1->vertex(tri1.v[1]); |
| 107 | const Vec3fa b2 = mesh1->vertex(tri1.v[2]); |
| 108 | |
| 109 | return TriangleTriangleIntersector::intersect_triangle_triangle(a0,a1,a2,b0,b1,b2); |
| 110 | } |
| 111 | |
| 112 | template<int N> |
| 113 | __forceinline void BVHNColliderUserGeom<N>::processLeaf(NodeRef node0, NodeRef node1) |
no test coverage detected