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

Add support for EXT_accessor_additional_types #968

Merged
merged 3 commits into from
Nov 5, 2024
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
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
Loading