| 3702 | : VerifyApplication::IntersectTest(name,isa,imode,VARIANT_INTERSECT,VerifyApplication::TEST_SHOULD_PASS), sflags(sflags), pos(pos), radius(radius) {} |
| 3703 | |
| 3704 | VerifyApplication::TestReturnValue run(VerifyApplication* state, bool silent) |
| 3705 | { |
| 3706 | std::string cfg = state->rtcore + ",isa="+stringOfISA(isa); |
| 3707 | RTCDeviceRef device = rtcNewDevice(cfg.c_str()); |
| 3708 | errorHandler(nullptr,rtcGetDeviceError(device)); |
| 3709 | |
| 3710 | VerifyScene scene(device,sflags); |
| 3711 | LinearSpace3fa space(Vec3fa(1.0f,0.0f,0.0f),Vec3fa(0.0f,1.0f,0.0f),Vec3fa(0.0f,0.0f,1.0f)); |
| 3712 | space *= LinearSpace3fa::rotate(Vec3fa(4.0f,7.0f,-1.0f),4.34f); |
| 3713 | const Vec3fa dx = 100.0f*normalize(space.vx); |
| 3714 | const Vec3fa dy = 100.0f*normalize(space.vy); |
| 3715 | const Vec3fa p = pos-0.5f*(dx+dy); |
| 3716 | Ref<SceneGraph::TriangleMeshNode> plane = SceneGraph::createTrianglePlane (p,dx,dy,100,100).dynamicCast<SceneGraph::TriangleMeshNode>(); |
| 3717 | scene.addGeometry(RTC_BUILD_QUALITY_MEDIUM,plane.dynamicCast<SceneGraph::Node>()); |
| 3718 | rtcCommitScene (scene); |
| 3719 | AssertNoError(device); |
| 3720 | |
| 3721 | size_t numTests = 0; |
| 3722 | size_t numFailures = 0; |
| 3723 | //for (auto ivariant : state->intersectVariants) |
| 3724 | IntersectVariant ivariant = VARIANT_INTERSECT_INCOHERENT; |
| 3725 | size_t numRays = size_t(N*state->intensity); |
| 3726 | for (size_t i=0; i<numRays; i+=maxStreamSize) |
| 3727 | { |
| 3728 | unsigned int M = (unsigned int)min(maxStreamSize,numRays-i); |
| 3729 | unsigned int primIDs[maxStreamSize]; |
| 3730 | __aligned(16) RTCRayHit rays[maxStreamSize]; |
| 3731 | for (size_t j=0; j<M; j++) |
| 3732 | { |
| 3733 | Vec3fa org = pos + radius*(2.0f*random_Vec3fa() - Vec3fa(1.0f)); |
| 3734 | unsigned int primID = random_int() % plane->triangles.size(); |
| 3735 | Vec3fa v0 = plane->positions[0][plane->triangles[primID].v0]; |
| 3736 | Vec3fa v1 = plane->positions[0][plane->triangles[primID].v1]; |
| 3737 | Vec3fa v2 = plane->positions[0][plane->triangles[primID].v2]; |
| 3738 | Vec3fa c = (v0+v1+v2)/3.0f; |
| 3739 | primIDs[j] = primID; |
| 3740 | rays[j] = makeRay(org,c-org); |
| 3741 | } |
| 3742 | IntersectWithMode(imode,ivariant,scene,rays,M); |
| 3743 | for (size_t j=0; j<M; j++) { |
| 3744 | Vec3fa dir(rays[j].ray.dir_x,rays[j].ray.dir_y,rays[j].ray.dir_z); |
| 3745 | //if (abs(dot(normalize(dir),space.vz)) < 0.9f) continue; |
| 3746 | numTests++; |
| 3747 | numFailures += rays[j].hit.primID != primIDs[j]; |
| 3748 | } |
| 3749 | } |
| 3750 | AssertNoError(device); |
| 3751 | |
| 3752 | double failRate = double(numFailures) / double(max(size_t(1),numTests)); |
| 3753 | bool failed = failRate > 0.00002; |
| 3754 | if (!silent) { printf(" (%f%%)", 100.0f*failRate); fflush(stdout); } |
| 3755 | return (VerifyApplication::TestReturnValue)(!failed); |
| 3756 | } |
| 3757 | }; |
| 3758 | |
| 3759 | struct RayAlignmentTest : public VerifyApplication::IntersectTest |
nothing calls this directly
no test coverage detected