Skip to content

Commit

Permalink
Additional component types
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Oct 22, 2024
1 parent f8b38ab commit 4050f05
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ CMakeSettings.json
test.db
build-wsl
.idea
build-debug
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 4050f05

Please sign in to comment.