3 #include <CesiumGltf/Library.h>
4 #include <CesiumGltf/ModelSpec.h>
5 #include <CesiumUtility/ErrorList.h>
7 #include <glm/mat4x4.hpp>
61 std::function<ForEachRootNodeInSceneCallback>&& callback);
66 std::function<ForEachRootNodeInSceneConstCallback>&& callback)
const;
74 const glm::dmat4& transform);
98 std::function<ForEachNodeInSceneCallback>&& callback);
106 const glm::dmat4& transform);
111 std::function<ForEachNodeInSceneConstCallback>&& callback)
const;
121 const glm::dmat4& transform);
146 std::function<ForEachPrimitiveInSceneCallback>&& callback);
156 const glm::dmat4& transform);
161 std::function<ForEachPrimitiveInSceneConstCallback>&& callback)
const;
178 template <
typename T>
179 static const T&
getSafe(
const std::vector<T>& items, int32_t index) {
180 static T defaultObject;
181 if (index < 0 ||
size_t(index) >= items.size()) {
182 return defaultObject;
184 return items[size_t(index)];
198 template <
typename T>
200 getSafe(
const std::vector<T>* pItems, int32_t index) noexcept {
201 if (index < 0 ||
size_t(index) >= pItems->size()) {
204 return &(*pItems)[size_t(index)];
218 template <
typename T>
219 static T*
getSafe(std::vector<T>* pItems, int32_t index) noexcept {
220 if (index < 0 ||
size_t(index) >= pItems->size()) {
223 return &(*pItems)[size_t(index)];
Classes for working with glTF models.
Geometry to be rendered with the given material.
A set of primitives to be rendered. Its global transform is defined by a node that references it.
The root object for a glTF asset.
The root object for a glTF asset.
void removeExtensionRequired(const std::string &extensionName)
Removes an extension from the ModelSpec::extensionsRequired property.
void ForEachPrimitiveInSceneCallback(Model &gltf, Node &node, Mesh &mesh, MeshPrimitive &primitive, const glm::dmat4 &transform)
A callback function for forEachPrimitiveInScene.
void addExtensionRequired(const std::string &extensionName)
Adds an extension to the ModelSpec::extensionsRequired property, if it is not already present.
void ForEachNodeInSceneCallback(Model &gltf, Node &node, const glm::dmat4 &transform)
A callback function for forEachNodeInScene.
void ForEachNodeInSceneConstCallback(const Model &gltf, const Node &node, const glm::dmat4 &transform)
A callback function for forEachNodeInScene.
void forEachNodeInScene(int32_t sceneID, std::function< ForEachNodeInSceneConstCallback > &&callback) const
bool isExtensionUsed(const std::string &extensionName) const noexcept
Determines whether a given extension name is listed in the model's ModelSpec::extensionsUsed property...
bool isExtensionRequired(const std::string &extensionName) const noexcept
Determines whether a given extension name is listed in the model's ModelSpec::extensionsRequired prop...
void generateMissingNormalsSmooth()
Fills in smooth normals for any primitives with missing normals.
void forEachPrimitiveInScene(int32_t sceneID, std::function< ForEachPrimitiveInSceneCallback > &&callback)
Apply the given callback to all relevant primitives.
static const T & getSafe(const std::vector< T > &items, int32_t index)
Safely gets the element with a given index, returning a default instance if the index is outside the ...
void ForEachRootNodeInSceneConstCallback(const Model &gltf, const Node &node)
A callback function for forEachRootNodeInScene.
void forEachRootNodeInScene(int32_t sceneID, std::function< ForEachRootNodeInSceneCallback > &&callback)
Apply the given callback to the root nodes of the scene.
void forEachNodeInScene(int32_t sceneID, std::function< ForEachNodeInSceneCallback > &&callback)
Apply the given callback to all nodes in the scene.
void forEachRootNodeInScene(int32_t sceneID, std::function< ForEachRootNodeInSceneConstCallback > &&callback) const
void removeExtensionUsed(const std::string &extensionName)
Removes an extension from the ModelSpec::extensionsUsed property.
void addExtensionUsed(const std::string &extensionName)
Adds an extension to the ModelSpec::extensionsUsed property, if it is not already present.
void ForEachPrimitiveInSceneConstCallback(const Model &gltf, const Node &node, const Mesh &mesh, const MeshPrimitive &primitive, const glm::dmat4 &transform)
A callback function for forEachPrimitiveInScene.
static const T * getSafe(const std::vector< T > *pItems, int32_t index) noexcept
Safely gets a pointer to the element with a given index, returning nullptr if the index is outside th...
void forEachPrimitiveInScene(int32_t sceneID, std::function< ForEachPrimitiveInSceneConstCallback > &&callback) const
static T * getSafe(std::vector< T > *pItems, int32_t index) noexcept
Safely gets a pointer to the element with a given index, returning nullptr if the index is outside th...
CesiumUtility::ErrorList merge(Model &&rhs)
Merges another model into this one.
void ForEachRootNodeInSceneCallback(Model &gltf, Node &node)
A callback function for forEachRootNodeInScene.
A node in the node hierarchy. When the node contains skin, all mesh.primitives MUST contain JOINTS_0 ...
The container to store the error and warning list when loading a tile or glTF content.