From 3f2d4ff9e59c2d105710418c5762f95069c84bff Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Tue, 22 Oct 2024 09:49:43 -0400 Subject: [PATCH 1/2] Additional component types --- .../include/CesiumGltf/AccessorSpec.h | 8 ++++++++ CesiumGltf/include/CesiumGltf/AccessorView.h | 20 +++++++++++++++++++ CesiumGltf/src/Accessor.cpp | 5 +++++ 3 files changed, 33 insertions(+) diff --git a/CesiumGltf/generated/include/CesiumGltf/AccessorSpec.h b/CesiumGltf/generated/include/CesiumGltf/AccessorSpec.h index 4bad735b4..a5cf56bca 100644 --- a/CesiumGltf/generated/include/CesiumGltf/AccessorSpec.h +++ b/CesiumGltf/generated/include/CesiumGltf/AccessorSpec.h @@ -30,9 +30,17 @@ struct CESIUMGLTF_API AccessorSpec : public CesiumGltf::NamedObject { static constexpr int32_t UNSIGNED_SHORT = 5123; + static constexpr int32_t INT = 5124; + static constexpr int32_t UNSIGNED_INT = 5125; + static constexpr int32_t INT64 = 5134; + + static constexpr int32_t UNSIGNED_INT64 = 5135; + static constexpr int32_t FLOAT = 5126; + + static constexpr int32_t DOUBLE = 5130; }; /** diff --git a/CesiumGltf/include/CesiumGltf/AccessorView.h b/CesiumGltf/include/CesiumGltf/AccessorView.h index 3d73bf2e7..49e723d71 100644 --- a/CesiumGltf/include/CesiumGltf/AccessorView.h +++ b/CesiumGltf/include/CesiumGltf/AccessorView.h @@ -449,16 +449,36 @@ createAccessorView( model, accessor, std::forward(callback)); + case Accessor::ComponentType::INT: + return ::CesiumGltf::CesiumImpl::createAccessorView( + model, + accessor, + std::forward(callback)); case Accessor::ComponentType::UNSIGNED_INT: return ::CesiumGltf::CesiumImpl::createAccessorView( model, accessor, std::forward(callback)); + case Accessor::ComponentType::INT64: + return ::CesiumGltf::CesiumImpl::createAccessorView( + model, + accessor, + std::forward(callback)); + case Accessor::ComponentType::UNSIGNED_INT64: + return ::CesiumGltf::CesiumImpl::createAccessorView( + model, + accessor, + std::forward(callback)); case Accessor::ComponentType::FLOAT: return ::CesiumGltf::CesiumImpl::createAccessorView( model, accessor, std::forward(callback)); + case Accessor::ComponentType::DOUBLE: + return ::CesiumGltf::CesiumImpl::createAccessorView( + model, + accessor, + std::forward(callback)); default: return callback(AccessorView>( AccessorViewStatus::InvalidComponentType)); diff --git a/CesiumGltf/src/Accessor.cpp b/CesiumGltf/src/Accessor.cpp index 8c87d616a..075df596c 100644 --- a/CesiumGltf/src/Accessor.cpp +++ b/CesiumGltf/src/Accessor.cpp @@ -39,9 +39,14 @@ Accessor::computeByteSizeOfComponent(int32_t componentType) noexcept { case CesiumGltf::Accessor::ComponentType::SHORT: case CesiumGltf::Accessor::ComponentType::UNSIGNED_SHORT: return 2; + case CesiumGltf::Accessor::ComponentType::INT: case CesiumGltf::Accessor::ComponentType::UNSIGNED_INT: case CesiumGltf::Accessor::ComponentType::FLOAT: return 4; + case CesiumGltf::Accessor::ComponentType::INT64: + case CesiumGltf::Accessor::ComponentType::UNSIGNED_INT64: + case CesiumGltf::Accessor::ComponentType::DOUBLE: + return 8; default: // TODO Print a warning here! return 0; From 1a3173550a47f5dcca815d418d06eb3cb6c772bc Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Tue, 22 Oct 2024 10:18:27 -0400 Subject: [PATCH 2/2] Update CHANGES.md --- CHANGES.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index a12aad35a..1274c97b6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,11 @@ # Change Log +### Not Released Yet + +##### Additions :tada: + +- Added support for `EXT_accessor_additional_types` in `AccessorView`. + ### v0.40.1 - 2024-10-01 ##### Fixes :wrench: