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

Method run

tutorials/verify/verify.cpp:2703–2759  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2701 : VerifyApplication::IntersectTest(name,isa,imode,ivariant,VerifyApplication::TEST_SHOULD_PASS), sflags(sflags), quality(quality), gtype(gtype) {}
2702
2703 VerifyApplication::TestReturnValue run(VerifyApplication* state, bool silent)
2704 {
2705 std::string cfg = state->rtcore + ",isa="+stringOfISA(isa);
2706 RTCDeviceRef device = rtcNewDevice(cfg.c_str());
2707 errorHandler(nullptr,rtcGetDeviceError(device));
2708
2709 /* create triangle that is front facing for a right handed
2710 coordinate system if looking along the z direction */
2711 VerifyScene scene(device,sflags);
2712 AssertNoError(device);
2713 const Vec3fa p0 = Vec3fa(0.0f);
2714 const Vec3fa dx = Vec3fa(0.0f,1.0f,0.0f);
2715 const Vec3fa dy = Vec3fa(1.0f,0.0f,0.0f);
2716 switch (gtype) {
2717 case TRIANGLE_MESH: scene.addGeometry(RTC_BUILD_QUALITY_MEDIUM,SceneGraph::createTrianglePlane(p0,dx,dy,1,1)); break;
2718 case TRIANGLE_MESH_MB: scene.addGeometry(RTC_BUILD_QUALITY_MEDIUM,SceneGraph::createTrianglePlane(p0,dx,dy,1,1)->set_motion_vector(zero)); break;
2719 case QUAD_MESH: scene.addGeometry(RTC_BUILD_QUALITY_MEDIUM,SceneGraph::createQuadPlane(p0,dx,dy,1,1)); break;
2720 case QUAD_MESH_MB: scene.addGeometry(RTC_BUILD_QUALITY_MEDIUM,SceneGraph::createQuadPlane(p0,dx,dy,1,1)->set_motion_vector(zero)); break;
2721 case GRID_MESH: scene.addGeometry(RTC_BUILD_QUALITY_MEDIUM,SceneGraph::createGridPlane(p0,dx,dy,1,1)); break;
2722 case GRID_MESH_MB: scene.addGeometry(RTC_BUILD_QUALITY_MEDIUM,SceneGraph::createGridPlane(p0,dx,dy,1,1)->set_motion_vector(zero)); break;
2723 case SUBDIV_MESH: scene.addGeometry(RTC_BUILD_QUALITY_MEDIUM,SceneGraph::createSubdivPlane(p0,dx,dy,1,1,4.0f)); break;
2724 case SUBDIV_MESH_MB: scene.addGeometry(RTC_BUILD_QUALITY_MEDIUM,SceneGraph::createSubdivPlane(p0,dx,dy,1,1,4.0f)->set_motion_vector(zero)); break;
2725 default: throw std::runtime_error("unsupported geometry type: "+to_string(gtype));
2726 }
2727
2728 AssertNoError(device);
2729 rtcCommitScene (scene);
2730 AssertNoError(device);
2731
2732 const size_t numRays = 1000;
2733 RTCRayHit rays[numRays];
2734 bool passed = true;
2735
2736 for (size_t i=0; i<numRays; i++) {
2737 const float rx = random_float();
2738 const float ry = random_float();
2739 if (i%2) rays[i] = makeRay(Vec3fa(rx,ry,+1),Vec3fa(0,0,-1));
2740 else rays[i] = makeRay(Vec3fa(rx,ry,-1),Vec3fa(0,0,+1));
2741 }
2742
2743 IntersectWithMode(imode,ivariant,scene,rays,numRays);
2744
2745 for (size_t i=0; i<numRays; i++)
2746 {
2747 Vec3fa dir(rays[i].ray.dir_x,rays[i].ray.dir_y,rays[i].ray.dir_z);
2748 Vec3fa Ng (rays[i].hit.Ng_x, rays[i].hit.Ng_y, rays[i].hit.Ng_z);
2749 if (i%2) passed &= rays[i].hit.geomID == RTC_INVALID_GEOMETRY_ID;
2750 else {
2751 passed &= rays[i].hit.geomID == 0;
2752 if (ivariant & VARIANT_INTERSECT)
2753 passed &= dot(dir,Ng) < 0.0f;
2754 }
2755 }
2756 AssertNoError(device);
2757
2758 return (VerifyApplication::TestReturnValue) passed;
2759 }
2760 };

Callers

nothing calls this directly

Calls 14

stringOfISAFunction · 0.85
rtcNewDeviceFunction · 0.85
errorHandlerFunction · 0.85
rtcGetDeviceErrorFunction · 0.85
AssertNoErrorFunction · 0.85
rtcCommitSceneFunction · 0.85
makeRayFunction · 0.85
IntersectWithModeFunction · 0.85
addGeometryMethod · 0.80
to_stringFunction · 0.70
Vec3faClass · 0.50
dotFunction · 0.50

Tested by

no test coverage detected