Skip to content

Commit

Permalink
Merge pull request #968 from CesiumGS/additional-component-types
Browse files Browse the repository at this point in the history
Add support for EXT_accessor_additional_types
  • Loading branch information
kring authored Nov 5, 2024
2 parents 9b29b67 + 6d56282 commit be7cfe2
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

### Not Released Yet

##### Additions :tada:

- Added support for `EXT_accessor_additional_types` in `AccessorView`.

### v0.41.0 - 2024-11-01

##### Breaking Changes :mega:
Expand Down
8 changes: 8 additions & 0 deletions CesiumGltf/generated/include/CesiumGltf/AccessorSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

/**
Expand Down
20 changes: 20 additions & 0 deletions CesiumGltf/include/CesiumGltf/AccessorView.h
Original file line number Diff line number Diff line change
Expand Up @@ -449,16 +449,36 @@ createAccessorView(
model,
accessor,
std::forward<TCallback>(callback));
case Accessor::ComponentType::INT:
return ::CesiumGltf::CesiumImpl::createAccessorView<TCallback, int32_t>(
model,
accessor,
std::forward<TCallback>(callback));
case Accessor::ComponentType::UNSIGNED_INT:
return ::CesiumGltf::CesiumImpl::createAccessorView<TCallback, uint32_t>(
model,
accessor,
std::forward<TCallback>(callback));
case Accessor::ComponentType::INT64:
return ::CesiumGltf::CesiumImpl::createAccessorView<TCallback, int64_t>(
model,
accessor,
std::forward<TCallback>(callback));
case Accessor::ComponentType::UNSIGNED_INT64:
return ::CesiumGltf::CesiumImpl::createAccessorView<TCallback, uint64_t>(
model,
accessor,
std::forward<TCallback>(callback));
case Accessor::ComponentType::FLOAT:
return ::CesiumGltf::CesiumImpl::createAccessorView<TCallback, float>(
model,
accessor,
std::forward<TCallback>(callback));
case Accessor::ComponentType::DOUBLE:
return ::CesiumGltf::CesiumImpl::createAccessorView<TCallback, double>(
model,
accessor,
std::forward<TCallback>(callback));
default:
return callback(AccessorView<AccessorTypes::SCALAR<float>>(
AccessorViewStatus::InvalidComponentType));
Expand Down
5 changes: 5 additions & 0 deletions CesiumGltf/src/Accessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit be7cfe2

Please sign in to comment.