3#include <Cesium3DTilesContent/GltfConverters.h>
4#include <CesiumAsync/IAssetAccessor.h>
5#include <CesiumAsync/IAssetRequest.h>
6#include <CesiumGltf/AccessorView.h>
7#include <CesiumGltf/PropertyTransformations.h>
8#include <CesiumUtility/ErrorList.h>
11#include <rapidjson/document.h>
24namespace GltfConverterUtility {
25std::optional<uint32_t> parseOffsetForSemantic(
26 const rapidjson::Document& document,
30typedef bool (rapidjson::Value::*ValuePredicate)()
const;
32template <
typename T>
bool isValue(
const rapidjson::Value& value);
33template <
typename T> T getValue(
const rapidjson::Value& value);
36std::optional<T> getOptional(
const rapidjson::Value& value) {
37 if (isValue<T>(value)) {
38 return std::make_optional(getValue<T>(value));
45getValue(
const rapidjson::Document& document,
const char* semantic) {
46 const auto valueIt = document.FindMember(semantic);
47 if (valueIt == document.MemberEnd() || !isValue<T>(valueIt->value)) {
50 return std::make_optional(getValue<T>(valueIt->value));
53template <>
inline bool isValue<bool>(
const rapidjson::Value& value) {
54 return value.IsBool();
57template <>
inline bool getValue<bool>(
const rapidjson::Value& value) {
58 return value.GetBool();
61template <>
inline bool isValue<uint32_t>(
const rapidjson::Value& value) {
62 return value.IsUint();
65template <>
inline uint32_t getValue<uint32_t>(
const rapidjson::Value& value) {
66 return value.GetUint();
69bool validateJsonArrayValues(
70 const rapidjson::Value& arrayValue,
71 uint32_t expectedLength,
72 ValuePredicate predicate);
74std::optional<glm::dvec3>
75parseArrayValueDVec3(
const rapidjson::Value& arrayValue);
77std::optional<glm::dvec3>
78parseArrayValueDVec3(
const rapidjson::Document& document,
const char* name);
83int32_t createBufferViewInGltf(
85 const int32_t bufferId,
86 const int64_t byteLength,
87 const int64_t byteStride);
89int32_t createAccessorInGltf(
91 const int32_t bufferViewId,
92 const int32_t componentType,
94 const std::string type);
105template <
typename GlmType,
typename GLTFType>
106GlmType toGlm(
const GLTFType& gltfVal);
108template <
typename GlmType,
typename ComponentType>
113template <
typename GlmType,
typename ComponentType>
116 if constexpr (std::is_same<ComponentType, float>()) {
Classes that support loading and converting 3D Tiles tile content.
Classes for working with glTF models.
double normalize(T value)
Normalizes the given value between [0, 1] if unsigned or [-1, 1] if signed, based on the type's maxim...
A 3D vector element for an AccessorView.
T value[3]
The component values of this element.
A 4D vector element for an AccessorView.
T value[4]
The component values of this element.
This class is not meant to be instantiated directly. Use Buffer instead.
This class is not meant to be instantiated directly. Use Model instead.
The container to store the error and warning list when loading a tile or glTF content.