|
8 | 8 |
|
9 | 9 | using namespace openvkl;
|
10 | 10 |
|
| 11 | +using openvkl::testing::TestingVdbTorusVolume; |
11 | 12 | using openvkl::testing::WaveletVdbVolumeFloat;
|
12 | 13 | using openvkl::testing::XYZVdbVolumeFloat;
|
13 | 14 |
|
@@ -276,7 +277,8 @@ TEST_CASE("VDB volume sampling", "[volume_sampling]")
|
276 | 277 | vklCommit(vklSampler);
|
277 | 278 | const vec3i step(2);
|
278 | 279 |
|
279 |
| - // tricubic support span; ignore coordinates here since they will interpolate with background |
| 280 | + // tricubic support span; ignore coordinates here since they will |
| 281 | + // interpolate with background |
280 | 282 | const int lowerSpan = 1;
|
281 | 283 | const int upperSpan = 2;
|
282 | 284 |
|
@@ -399,7 +401,8 @@ TEST_CASE("VDB volume sampling", "[volume_sampling]")
|
399 | 401 | vklCommit(vklSampler);
|
400 | 402 | const vec3i step(2);
|
401 | 403 |
|
402 |
| - // tricubic support span; ignore coordinates here since they will interpolate with background |
| 404 | + // tricubic support span; ignore coordinates here since they will |
| 405 | + // interpolate with background |
403 | 406 | const int lowerSpan = 1;
|
404 | 407 | const int upperSpan = 2;
|
405 | 408 |
|
@@ -828,3 +831,79 @@ TEST_CASE("VDB volume strides", "[volume_strides]")
|
828 | 831 |
|
829 | 832 | shutdownOpenVKL();
|
830 | 833 | }
|
| 834 | + |
| 835 | +TEST_CASE("VDB volume special cases", "[interval_iterators]") |
| 836 | +{ |
| 837 | + initializeOpenVKL(); |
| 838 | + |
| 839 | + SECTION("torus interval iteration") |
| 840 | + { |
| 841 | + TestingVdbTorusVolume *volume = nullptr; |
| 842 | + REQUIRE_NOTHROW(volume = new TestingVdbTorusVolume()); |
| 843 | + |
| 844 | + VKLVolume vklVolume = volume->getVKLVolume(getOpenVKLDevice()); |
| 845 | + |
| 846 | + VKLSampler sampler = vklNewSampler(vklVolume); |
| 847 | + vklCommit(sampler); |
| 848 | + |
| 849 | + VKLIntervalIteratorContext intervalContext = |
| 850 | + vklNewIntervalIteratorContext(sampler); |
| 851 | + vklCommit(intervalContext); |
| 852 | + |
| 853 | + std::vector<char> buffer(vklGetIntervalIteratorSize(intervalContext)); |
| 854 | + |
| 855 | + // failure case found from OSPRay |
| 856 | + { |
| 857 | + // intbits() representation of ray |
| 858 | + const uint32_t rayOrigin[] = {1112900070, 1116163650, 1103628776}; |
| 859 | + const uint32_t rayDirection[] = {1081551625, 1098411576, 2984533223}; |
| 860 | + |
| 861 | + const vkl_range1f rayTRange = {0.f, inf}; |
| 862 | + const float time = 0.f; |
| 863 | + |
| 864 | + VKLIntervalIterator intervalIterator = |
| 865 | + vklInitIntervalIterator(intervalContext, |
| 866 | + (vkl_vec3f *)&rayOrigin, |
| 867 | + (vkl_vec3f *)&rayDirection, |
| 868 | + &rayTRange, |
| 869 | + time, |
| 870 | + buffer.data()); |
| 871 | + |
| 872 | + int numIntervalsFound = 0; |
| 873 | + VKLInterval prevInterval; |
| 874 | + |
| 875 | + while (true) { |
| 876 | + VKLInterval interval; |
| 877 | + int result = vklIterateInterval(intervalIterator, &interval); |
| 878 | + if (!result) |
| 879 | + break; |
| 880 | + |
| 881 | + INFO("tRange = " << interval.tRange.lower << " " |
| 882 | + << interval.tRange.upper |
| 883 | + << "\nvalueRange = " << interval.valueRange.lower |
| 884 | + << " " << interval.valueRange.upper |
| 885 | + << "\nnominalDeltaT = " << interval.nominalDeltaT); |
| 886 | + |
| 887 | + REQUIRE(interval.tRange.lower >= 0.f); |
| 888 | + REQUIRE(interval.tRange.upper >= 0.f); |
| 889 | + REQUIRE(interval.tRange.upper > interval.tRange.lower); |
| 890 | + |
| 891 | + if (numIntervalsFound > 0) { |
| 892 | + REQUIRE(interval.tRange.lower == prevInterval.tRange.upper); |
| 893 | + } |
| 894 | + |
| 895 | + numIntervalsFound++; |
| 896 | + prevInterval = interval; |
| 897 | + } |
| 898 | + |
| 899 | + REQUIRE(numIntervalsFound > 0); |
| 900 | + } |
| 901 | + |
| 902 | + vklRelease(intervalContext); |
| 903 | + vklRelease(sampler); |
| 904 | + |
| 905 | + REQUIRE_NOTHROW(delete volume); |
| 906 | + } |
| 907 | + |
| 908 | + shutdownOpenVKL(); |
| 909 | +} |
0 commit comments