Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove GLM_FORCE_SIZE_T_LENGTH #1056

Merged
merged 6 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

### v0.44.0 - 2025-02-03

##### Breaking Changes :mega:

- cesium-native no longer uses the `GLM_FORCE_SIZE_T_LENGTH` option with the `glm` library

##### Additions :tada:

- Added conversion of I3dm batch table metadata to `EXT_structural_metadata` and `EXT_instance_features` extensions.
Expand Down
3 changes: 2 additions & 1 deletion Cesium3DTilesContent/src/I3dmToGltfConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <CesiumUtility/Uri.h>

#include <fmt/format.h>
#include <glm/detail/setup.hpp>
#include <glm/ext/matrix_double4x4.hpp>
#include <glm/ext/matrix_transform.hpp>
#include <glm/ext/vector_double3.hpp>
Expand Down Expand Up @@ -492,7 +493,7 @@ CesiumAsync::Future<ConvertedI3dm> convertI3dmContent(
decodedInstances.positions.begin(),
[&parsedContent](auto&& posQuantized) {
glm::vec3 position;
for (unsigned j = 0; j < 3; ++j) {
for (glm::length_t j = 0; j < 3; ++j) {
position[j] = static_cast<float>(
posQuantized[j] / 65535.0 *
(*parsedContent.quantizedVolumeScale)[j] +
Expand Down
4 changes: 2 additions & 2 deletions CesiumGeometry/src/IntersectionTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <CesiumUtility/Math.h>

#include <glm/common.hpp>
#include <glm/detail/setup.hpp>
#include <glm/exponential.hpp>
#include <glm/ext/matrix_double3x3.hpp>
#include <glm/ext/vector_double2.hpp>
Expand All @@ -16,7 +17,6 @@
#include <glm/matrix.hpp>

#include <cmath>
#include <cstdint>
#include <limits>
#include <optional>
#include <utility>
Expand Down Expand Up @@ -205,7 +205,7 @@ std::optional<double> IntersectionTests::rayAABBParametric(
double tmin = greatestMin;
double tmax = smallestMax;

for (uint32_t i = 0; i < 3; ++i) {
for (glm::length_t i = 0; i < 3; ++i) {
if (glm::abs(dir[i]) < Math::Epsilon6) {
continue;
} else {
Expand Down
4 changes: 2 additions & 2 deletions CesiumGltfReader/test/TestGltfReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ T getRange(const CesiumGltf::AccessorView<T>& accessorView) {
T max{std::numeric_limits<float>::lowest()};
for (int32_t i = 0; i < accessorView.size(); ++i) {
const T& value = accessorView[i];
for (uint32_t j = 0; j < static_cast<uint32_t>(value.length()); ++j) {
for (glm::length_t j = 0; j < value.length(); ++j) {
min[j] = glm::min<float>(min[j], value[j]);
max[j] = glm::max<float>(max[j], value[j]);
}
Expand Down Expand Up @@ -181,7 +181,7 @@ VertexAttributeRange getVertexAttributeRange(const Model& model) {

template <typename T>
bool epsilonCompare(const T& v1, const T& v2, double epsilon) {
for (uint32_t i = 0; i < static_cast<uint32_t>(v1.length()); ++i) {
for (glm::length_t i = 0; i < v1.length(); ++i) {
if (!CesiumUtility::Math::equalsEpsilon(v1[i], v2[i], epsilon)) {
return false;
}
Expand Down
9 changes: 6 additions & 3 deletions CesiumRasterOverlays/src/RasterOverlayUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <CesiumUtility/Tracing.h>

#include <glm/common.hpp>
#include <glm/detail/setup.hpp>
#include <glm/ext/matrix_double4x4.hpp>
#include <glm/ext/vector_double3.hpp>
#include <glm/ext/vector_float2.hpp>
Expand Down Expand Up @@ -1477,9 +1478,11 @@ void addSkirt(
position -= center;

for (uint32_t c = 0; c < 3; ++c) {
output.push_back(static_cast<float>(position[c]));
attribute.minimums[c] = glm::min(attribute.minimums[c], position[c]);
attribute.maximums[c] = glm::max(attribute.maximums[c], position[c]);
output.push_back(static_cast<float>(position[glm::length_t(c)]));
attribute.minimums[c] =
glm::min(attribute.minimums[c], position[glm::length_t(c)]);
attribute.maximums[c] =
glm::max(attribute.maximums[c], position[glm::length_t(c)]);
}
} else {
for (uint32_t c = 0;
Expand Down
1 change: 0 additions & 1 deletion cmake/macros/configure_cesium_library.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ function(configure_cesium_library targetName)
PUBLIC
GLM_FORCE_XYZW_ONLY # Disable .rgba and .stpq to make it easier to view values from debugger
GLM_FORCE_EXPLICIT_CTOR # Disallow implicit conversions between dvec3 <-> dvec4, dvec3 <-> fvec3, etc
GLM_FORCE_SIZE_T_LENGTH # Make vec.length() and vec[idx] use size_t instead of int
)
endif()

Expand Down
4 changes: 2 additions & 2 deletions doc/topics/developer-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ cmake -B build -S .
3. Next, we run the clang-tidy target of Cesium Native's cmake build, which will run clang-tidy. clang-tidy produces a lot of not-very-useful output, so we send it to a file instead of the console:

```
cmake --build build-tidy --target clang-tidy > clang-tidy.log
cmake --build build --target clang-tidy > clang-tidy.log
```

4. Finally, we use `sed` to extract the errors and warnings from the log:
Expand Down Expand Up @@ -187,7 +187,7 @@ cmake -B build -S . -DCLANG_TIDY_PATH=$(brew --prefix llvm)/bin/clang-tidy -DCLA
3. Next, we run the clang-tidy target of Cesium Native's cmake build, which will run clang-tidy. clang-tidy produces a lot of not-very-useful output, so we send it to a file instead of the console:

```
cmake --build build-tidy --target clang-tidy > clang-tidy.log
cmake --build build --target clang-tidy > clang-tidy.log
```

4. Finally, we use `sed` to extract the errors and warnings from the log:
Expand Down