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

Method run

tutorials/verify/verify.cpp:1852–1912  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1850 }
1851
1852 VerifyApplication::TestReturnValue run(VerifyApplication* state, bool silent)
1853 {
1854 std::string cfg = state->rtcore + ",isa="+stringOfISA(isa);
1855 RTCDeviceRef device = rtcNewDevice(cfg.c_str());
1856 errorHandler(nullptr,rtcGetDeviceError(device));
1857
1858 VerifyScene scene(device,sflags);
1859 AssertNoError(device);
1860 size_t numPhi = 10;
1861 size_t numVertices = 2*numPhi*(numPhi+1);
1862 Vec3fa pos0 = Vec3fa(-10,0,-10);
1863 Vec3fa pos1 = Vec3fa(-10,0,+10);
1864 Vec3fa pos2 = Vec3fa(+10,0,-10);
1865 Vec3fa pos3 = Vec3fa(+10,0,+10);
1866 unsigned geom0 = scene.addSphere (sampler,quality,pos0,1.0f,numPhi).first;
1867 unsigned geom1 = scene.addQuadSphere (sampler,quality,pos1,1.0f,numPhi).first;
1868 unsigned geom2 = scene.addSubdivSphere(sampler,quality,pos2,1.0f,numPhi,4).first;
1869 unsigned geom3 = scene.addSphereHair (sampler,quality,pos3,1.0f).first;
1870 RTCGeometry hgeom0 = rtcGetGeometry(scene,geom0);
1871 RTCGeometry hgeom1 = rtcGetGeometry(scene,geom1);
1872 RTCGeometry hgeom2 = rtcGetGeometry(scene,geom2);
1873 RTCGeometry hgeom3 = rtcGetGeometry(scene,geom3);
1874 AssertNoError(device);
1875
1876 for (size_t i=0; i<16; i++)
1877 {
1878 bool move0 = i & 1, move1 = i & 2, move2 = i & 4, move3 = i & 8;
1879 Vec3fa ds(2,0.1f,2);
1880 if (move0) { move_mesh(hgeom0,numVertices,ds); pos0 += ds; }
1881 if (move1) { move_mesh(hgeom1,numVertices,ds); pos1 += ds; }
1882 if (move2) { move_mesh(hgeom2,numVertices,ds); pos2 += ds; }
1883 if (move3) { move_mesh(hgeom3,4,ds); pos3 += ds; }
1884 rtcCommitScene (scene);
1885 AssertNoError(device);
1886
1887 RTCRayHit ray0 = makeRay(pos0+Vec3fa(0.1f,10,0.1f),Vec3fa(0,-1,0)); // hits geomID == 0
1888 RTCRayHit ray1 = makeRay(pos1+Vec3fa(0.1f,10,0.1f),Vec3fa(0,-1,0)); // hits geomID == 1
1889 RTCRayHit ray2 = makeRay(pos2+Vec3fa(0.1f,10,0.1f),Vec3fa(0,-1,0)); // hits geomID == 2
1890 RTCRayHit ray3 = makeRay(pos3+Vec3fa(0.1f,10,0.1f),Vec3fa(0,-1,0)); // hits geomID == 3
1891 RTCRayHit testRays[4] = { ray0, ray1, ray2, ray3 };
1892
1893 const unsigned int maxRays = 100;
1894 RTCRayHit rays[maxRays];
1895 for (unsigned int numRays=1; numRays<maxRays; numRays++) {
1896 for (size_t i=0; i<numRays; i++) rays[i] = testRays[i%4];
1897 IntersectWithMode(imode,ivariant,scene,rays,numRays);
1898 for (size_t i=0; i<numRays; i++)
1899 if (ivariant & VARIANT_INTERSECT) {
1900 if (rays[i].hit.geomID == RTC_INVALID_GEOMETRY_ID)
1901 return VerifyApplication::FAILED;
1902 }
1903 else {
1904 if (rays[i].ray.tfar != float(neg_inf))
1905 return VerifyApplication::FAILED;
1906 }
1907 }
1908 }
1909 AssertNoError(device);

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
addSphereMethod · 0.80
addQuadSphereMethod · 0.80
addSubdivSphereMethod · 0.80
addSphereHairMethod · 0.80

Tested by

no test coverage detected