| 785 | } |
| 786 | |
| 787 | void IntersectWithMode(IntersectMode mode, IntersectVariant ivariant, RTCScene scene, RTCRayHit* rays, unsigned int N, RTCIntersectArguments* args = nullptr) |
| 788 | { |
| 789 | /* verify occluded result against intersect */ |
| 790 | if ((ivariant & VARIANT_INTERSECT_OCCLUDED) == VARIANT_INTERSECT_OCCLUDED) |
| 791 | { |
| 792 | vector<bool> valid(N); |
| 793 | vector_t<RTCRayHit,aligned_allocator<RTCRayHit,16>> rays2(N); |
| 794 | for (size_t i=0; i<N; i++) { |
| 795 | valid[i] = rays[i].ray.tnear <= rays[i].ray.tfar; |
| 796 | rays2[i] = rays[i]; |
| 797 | } |
| 798 | IntersectWithModeInternal(mode,IntersectVariant(ivariant & ~VARIANT_OCCLUDED),scene,rays,N,args); |
| 799 | IntersectWithModeInternal(mode,IntersectVariant(ivariant & ~VARIANT_INTERSECT),scene,rays2.data(),N,args); |
| 800 | for (size_t i=0; i<N; i++) |
| 801 | { |
| 802 | if (valid[i] && ((rays[i].hit.geomID == RTC_INVALID_GEOMETRY_ID) != (rays2[i].ray.tfar != float(neg_inf)))) { |
| 803 | throw std::runtime_error("Intersect/Occluded mismatch"); |
| 804 | } |
| 805 | } |
| 806 | } |
| 807 | else |
| 808 | IntersectWithModeInternal(mode,ivariant,scene,rays,N,args); |
| 809 | } |
| 810 | |
| 811 | enum GeometryType |
| 812 | { |