| 4331 | : VerifyApplication::Test(name,isa,VerifyApplication::TEST_SHOULD_PASS), sflags(sflags), tri_accel(tri_accel) {} |
| 4332 | |
| 4333 | VerifyApplication::TestReturnValue run(VerifyApplication* state, bool silent) |
| 4334 | { |
| 4335 | std::string cfg = state->rtcore + ",isa="+stringOfISA(isa) + (tri_accel != "" ? ",tri_accel="+tri_accel : ""); |
| 4336 | RTCDeviceRef device = rtcNewDevice(cfg.c_str()); |
| 4337 | errorHandler(nullptr,rtcGetDeviceError(device)); |
| 4338 | |
| 4339 | Vec3f vertices_t0[4] = { |
| 4340 | Vec3f(-1.f, -1.f, -1.f), |
| 4341 | Vec3f( 1.f, -1.f, -1.f), |
| 4342 | Vec3f( 0.f, 1.f, -1.f), |
| 4343 | Vec3f(0.f) // 16 byte padding |
| 4344 | }; |
| 4345 | Vec3f vertices_t1[4] = { |
| 4346 | Vec3f(-1.f, -1.f, 1.f), |
| 4347 | Vec3f( 1.f, -1.f, 1.f), |
| 4348 | Vec3f( 0.f, 1.f, 1.f), |
| 4349 | Vec3f(0.f) // 16 byte padding |
| 4350 | }; |
| 4351 | |
| 4352 | // duplicate triangle to make sure the bvh is not only a leaf node |
| 4353 | Triangle triangles[64]; |
| 4354 | for (int i = 0; i < 64; ++i) |
| 4355 | triangles[i] = Triangle(0, 1, 2); |
| 4356 | |
| 4357 | RTCSceneRef scene = rtcNewScene(device); |
| 4358 | rtcSetSceneFlags(scene,sflags.sflags); |
| 4359 | rtcSetSceneBuildQuality(scene,sflags.qflags); |
| 4360 | |
| 4361 | RTCGeometry geom = rtcNewGeometry (device, RTC_GEOMETRY_TYPE_TRIANGLE); |
| 4362 | rtcSetGeometryBuildQuality(geom,sflags.qflags); |
| 4363 | rtcSetGeometryTimeStepCount(geom,2); |
| 4364 | rtcSetGeometryPointQueryFunction(geom, [](RTCPointQueryFunctionArguments* args) -> bool |
| 4365 | { |
| 4366 | // set primID (userPtr) to something != RTC_INVALID_GEOMETRY_ID to signal that |
| 4367 | // the query overlapped some geometry |
| 4368 | *((unsigned int*)args->userPtr) = 0; |
| 4369 | return true; |
| 4370 | }); |
| 4371 | rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_VERTEX, 0, RTC_FORMAT_FLOAT3, vertices_t0, 0, sizeof(Vec3f), 3); |
| 4372 | rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_VERTEX, 1, RTC_FORMAT_FLOAT3, vertices_t1, 0, sizeof(Vec3f), 3); |
| 4373 | rtcSetSharedGeometryBuffer(geom, RTC_BUFFER_TYPE_INDEX , 0, RTC_FORMAT_UINT3, triangles, 0, sizeof(Triangle), 64); |
| 4374 | rtcCommitGeometry(geom); |
| 4375 | rtcAttachGeometry(scene,geom); |
| 4376 | rtcReleaseGeometry(geom); |
| 4377 | rtcCommitScene (scene); |
| 4378 | AssertNoError(device); |
| 4379 | |
| 4380 | RTCPointQuery query0; |
| 4381 | query0.x = 0.0f; |
| 4382 | query0.y = 0.0f; |
| 4383 | query0.z = -1.0f; |
| 4384 | query0.radius = 0.1f; |
| 4385 | |
| 4386 | RTCPointQuery query1; |
| 4387 | query1.x = 0.0f; |
| 4388 | query1.y = 0.0f; |
| 4389 | query1.z = 0.0f; |
| 4390 | query1.radius = 0.1f; |
nothing calls this directly
no test coverage detected