| 3975 | : VerifyApplication::Test(name,isa,VerifyApplication::TEST_SHOULD_PASS), sflags(sflags) {} |
| 3976 | |
| 3977 | VerifyApplication::TestReturnValue run(VerifyApplication *state, bool silent) |
| 3978 | { |
| 3979 | // This test assures that the expected internal point query calls are made |
| 3980 | // for supported primitive/geometry types |
| 3981 | |
| 3982 | std::string cfg = state->rtcore + ",isa=" + stringOfISA(isa); |
| 3983 | |
| 3984 | auto queryFunc = [](RTCPointQueryFunctionArguments* args) -> bool |
| 3985 | { |
| 3986 | assert(args->userPtr); |
| 3987 | //printf("query callback called for geomID %u and primID %u\n", args->geomID, args->primID); |
| 3988 | uint32_t *numCalls = (uint32_t*)args->userPtr; |
| 3989 | (*numCalls)++; |
| 3990 | return false; |
| 3991 | }; |
| 3992 | RTCPointQuery query; |
| 3993 | query.x = query.y = query.z = query.time = 0.f; |
| 3994 | query.radius = inf; |
| 3995 | |
| 3996 | RTCDeviceRef device = rtcNewDevice(cfg.c_str()); |
| 3997 | errorHandler(nullptr, rtcGetDeviceError(device)); |
| 3998 | |
| 3999 | // triangle mesh |
| 4000 | if (1) { |
| 4001 | RTCSceneRef scene = rtcNewScene(device); |
| 4002 | rtcSetSceneFlags(scene, sflags.sflags); |
| 4003 | rtcSetSceneBuildQuality(scene, sflags.qflags); |
| 4004 | |
| 4005 | RTCGeometry geom = rtcNewGeometry(device, RTC_GEOMETRY_TYPE_TRIANGLE); |
| 4006 | rtcSetGeometryBuildQuality(geom, sflags.qflags); |
| 4007 | |
| 4008 | Vec3f *vertices = (Vec3f *)rtcSetNewGeometryBuffer(geom, RTC_BUFFER_TYPE_VERTEX, 0, RTC_FORMAT_FLOAT3, sizeof(Vec3f), 3); |
| 4009 | Triangle *triangles = (Triangle *)rtcSetNewGeometryBuffer(geom, RTC_BUFFER_TYPE_INDEX, 0, RTC_FORMAT_UINT3, sizeof(Triangle), 1); |
| 4010 | vertices[0] = Vec3f(-1.0f, 0.0f, -1.0f); |
| 4011 | vertices[1] = Vec3f(+1.0f, 0.0f, -1.0f); |
| 4012 | vertices[2] = Vec3f(+0.0f, 0.0f, +1.0f); |
| 4013 | triangles[0] = Triangle(0, 1, 2); |
| 4014 | |
| 4015 | rtcCommitGeometry(geom); |
| 4016 | rtcAttachGeometry(scene, geom); |
| 4017 | rtcReleaseGeometry(geom); |
| 4018 | rtcCommitScene(scene); |
| 4019 | AssertNoError(device); |
| 4020 | |
| 4021 | RTCPointQueryContext context; |
| 4022 | rtcInitPointQueryContext(&context); |
| 4023 | uint32_t numCalls = 0; |
| 4024 | rtcPointQuery(scene, &query, &context, queryFunc, (void*)&numCalls); |
| 4025 | if (numCalls != 1) |
| 4026 | return VerifyApplication::FAILED; |
| 4027 | AssertNoError(device); |
| 4028 | } |
| 4029 | |
| 4030 | // flat linear curve |
| 4031 | if (1) { |
| 4032 | RTCSceneRef scene = rtcNewScene(device); |
| 4033 | rtcSetSceneFlags(scene, sflags.sflags); |
| 4034 | rtcSetSceneBuildQuality(scene, sflags.qflags); |
nothing calls this directly
no test coverage detected