MCPcopy Create free account
hub / github.com/RenderKit/embree / run

Method run

tutorials/verify/verify.cpp:2634–2691  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2632 : VerifyApplication::IntersectTest(name,isa,imode,ivariant,VerifyApplication::TEST_SHOULD_PASS), sflags(sflags), quality(quality) {}
2633
2634 VerifyApplication::TestReturnValue run(VerifyApplication* state, bool silent)
2635 {
2636 std::string cfg = state->rtcore + ",isa="+stringOfISA(isa);
2637 RTCDeviceRef device = rtcNewDevice(cfg.c_str());
2638 errorHandler(nullptr,rtcGetDeviceError(device));
2639
2640 bool passed = true;
2641 Vec3fa pos0 = Vec3fa(-10,0,-10);
2642 Vec3fa pos1 = Vec3fa(-10,0,+10);
2643 Vec3fa pos2 = Vec3fa(+10,0,-10);
2644 Vec3fa pos3 = Vec3fa(+10,0,+10);
2645
2646 VerifyScene scene(device,sflags);
2647 unsigned int geom0 = scene.addSphere (sampler,quality,pos0,1.0f,50).first;
2648 unsigned int geom1 = scene.addQuadSphere (sampler,quality,pos1,1.0f,50).first;
2649 unsigned int geom2 = scene.addSubdivSphere(sampler,quality,pos2,1.0f,5,4).first;
2650 unsigned int geom3 = scene.addHair (sampler,quality,pos3,1.0f,1.0f,1).first;
2651 RTCGeometry hgeom0 = rtcGetGeometry(scene,geom0);
2652 RTCGeometry hgeom1 = rtcGetGeometry(scene,geom1);
2653 RTCGeometry hgeom2 = rtcGetGeometry(scene,geom2);
2654 RTCGeometry hgeom3 = rtcGetGeometry(scene,geom3);
2655 rtcSetGeometryMask(hgeom0,1);
2656 rtcSetGeometryMask(hgeom1,2);
2657 rtcSetGeometryMask(hgeom2,4);
2658 rtcSetGeometryMask(hgeom3,8);
2659 rtcCommitGeometry(hgeom0);
2660 rtcCommitGeometry(hgeom1);
2661 rtcCommitGeometry(hgeom2);
2662 rtcCommitGeometry(hgeom3);
2663 rtcCommitScene (scene);
2664 AssertNoError(device);
2665
2666 for (unsigned i=0; i<16; i++)
2667 {
2668 unsigned mask0 = i;
2669 unsigned mask1 = i+1;
2670 unsigned mask2 = i+2;
2671 unsigned mask3 = i+3;
2672 unsigned masks[4] = { mask0, mask1, mask2, mask3 };
2673 RTCRayHit ray0 = makeRay(pos0+Vec3fa(0,10,0),Vec3fa(0,-1,0)); ray0.ray.mask = mask0;
2674 RTCRayHit ray1 = makeRay(pos1+Vec3fa(0,10,0),Vec3fa(0,-1,0)); ray1.ray.mask = mask1;
2675 RTCRayHit ray2 = makeRay(pos2+Vec3fa(0,10,0),Vec3fa(0,-1,0)); ray2.ray.mask = mask2;
2676 RTCRayHit ray3 = makeRay(pos3+Vec3fa(0,10,0),Vec3fa(0,-1,0)); ray3.ray.mask = mask3;
2677 RTCRayHit rays[4] = { ray0, ray1, ray2, ray3 };
2678 IntersectWithMode(imode,ivariant,scene,rays,4);
2679
2680 for (size_t j=0; j<4; j++)
2681 {
2682 if ((ivariant & VARIANT_INTERSECT) == VARIANT_INTERSECT)
2683 passed &= (bool)(masks[j] & (1<<j)) == (rays[j].hit.geomID != RTC_INVALID_GEOMETRY_ID);
2684 else
2685 passed &= (bool)(masks[j] & (1<<j)) == (rays[j].ray.tfar == float(neg_inf));
2686 }
2687 }
2688 AssertNoError(device);
2689
2690 return (VerifyApplication::TestReturnValue) passed;
2691 }

Callers

nothing calls this directly

Calls 15

stringOfISAFunction · 0.85
rtcNewDeviceFunction · 0.85
errorHandlerFunction · 0.85
rtcGetDeviceErrorFunction · 0.85
rtcSetGeometryMaskFunction · 0.85
rtcCommitGeometryFunction · 0.85
rtcCommitSceneFunction · 0.85
AssertNoErrorFunction · 0.85
makeRayFunction · 0.85
IntersectWithModeFunction · 0.85
addSphereMethod · 0.80
addQuadSphereMethod · 0.80

Tested by

no test coverage detected