| 4663 | } |
| 4664 | |
| 4665 | VerifyApplication::TestReturnValue run(VerifyApplication* state, bool silent) |
| 4666 | { |
| 4667 | RTCDeviceRef device = rtcNewDevice(nullptr); |
| 4668 | RTCSceneRef scene = rtcNewScene(device); |
| 4669 | rtcSetSceneFlags(scene, RTC_SCENE_FLAG_FILTER_FUNCTION_IN_ARGUMENTS | RTC_SCENE_FLAG_ROBUST); |
| 4670 | |
| 4671 | createSphere(device, scene, 0, 0, 0, 1); |
| 4672 | createSphere(device, scene, 0, 0, 3, 1); |
| 4673 | |
| 4674 | rtcCommitScene(scene); |
| 4675 | |
| 4676 | RayQueryContext intersectContext; |
| 4677 | std::vector<embree::Vec3f> hits; |
| 4678 | intersectContext.userRayExt = &hits; |
| 4679 | rtcInitRayQueryContext(&(intersectContext.context)); |
| 4680 | |
| 4681 | RTCIntersectArguments args; |
| 4682 | rtcInitIntersectArguments(&args); |
| 4683 | args.context = &intersectContext.context; |
| 4684 | args.filter = countHits; |
| 4685 | args.flags = RTC_RAY_QUERY_FLAG_INVOKE_ARGUMENT_FILTER; |
| 4686 | |
| 4687 | RTCRayHit rayHit; |
| 4688 | rayHit.ray.org_x = 0; |
| 4689 | rayHit.ray.org_y = 0; |
| 4690 | rayHit.ray.org_z = -5; |
| 4691 | rayHit.ray.dir_x = 0; |
| 4692 | rayHit.ray.dir_y = 0; |
| 4693 | rayHit.ray.dir_z = 1; |
| 4694 | rayHit.ray.tnear = 0; |
| 4695 | rayHit.ray.tfar = 100000; |
| 4696 | rayHit.ray.mask = 0xFF; |
| 4697 | rayHit.ray.flags = 0u; |
| 4698 | rayHit.hit.geomID = RTC_INVALID_GEOMETRY_ID; |
| 4699 | rayHit.hit.instID[0] = RTC_INVALID_GEOMETRY_ID; |
| 4700 | |
| 4701 | rtcIntersect1(scene, &rayHit, &args); |
| 4702 | |
| 4703 | bool cullingEnabled = rtcGetDeviceProperty(device, RTC_DEVICE_PROPERTY_BACKFACE_CULLING_ENABLED); |
| 4704 | |
| 4705 | if (cullingEnabled) { |
| 4706 | if (hits.size() != 2) { |
| 4707 | return VerifyApplication::FAILED; |
| 4708 | } |
| 4709 | if(std::fabs(hits[0].z + 1.f) > 1.e-6) { |
| 4710 | return VerifyApplication::FAILED; |
| 4711 | } |
| 4712 | if(std::fabs(hits[1].z - 1.f) > 1.e-6) { |
| 4713 | return VerifyApplication::FAILED; |
| 4714 | } |
| 4715 | } else { |
| 4716 | if (hits.size() != 4) { |
| 4717 | return VerifyApplication::FAILED; |
| 4718 | } |
| 4719 | if(std::fabs(hits[0].z + 1.f) > 1.e-6) { |
| 4720 | return VerifyApplication::FAILED; |
| 4721 | } |
| 4722 | if(std::fabs(hits[1].z - 1.f) > 1.e-6) { |
nothing calls this directly
no test coverage detected