Skip to content

Commit

Permalink
Verify accessor min/max after conv from quantized-mesh.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Apr 8, 2024
1 parent 48613c9 commit 8fb6de4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions CesiumLegacyTerrain/test/TestQuantizedMeshContent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,28 @@ static void checkGltfSanity(const Model& model) {
REQUIRE(pAttributeBufferView);

CHECK(pAttributeBufferView->target == BufferView::Target::ARRAY_BUFFER);

std::vector<double> min = pAttributeAccessor->min;
std::vector<double> max = pAttributeAccessor->max;
CHECK(min.size() == max.size());

if (!min.empty()) {
createAccessorView(
model,
*pAttributeAccessor,
[min, max](const auto& accessorView) {
using ElementType = decltype(accessorView[0].value[0]);
for (int64_t i = 0; i < accessorView.size(); ++i) {
auto v = accessorView[i];
REQUIRE(sizeof(v.value) / sizeof(ElementType) == min.size());
REQUIRE(sizeof(v.value) / sizeof(ElementType) == max.size());
for (size_t j = 0; j < min.size(); ++j) {
CHECK(v.value[j] >= ElementType(min[j]));
CHECK(v.value[j] <= ElementType(max[j]));
}
}
});
}
}
}
}
Expand Down

0 comments on commit 8fb6de4

Please sign in to comment.