cesium-native
0.41.0
|
The root object for a glTF asset. More...
#include <CesiumGltf/Model.h>
Public Types | |
typedef void | ForEachRootNodeInSceneCallback(Model &gltf, Node &node) |
A callback function for forEachRootNodeInScene. | |
typedef void | ForEachRootNodeInSceneConstCallback(const Model &gltf, const Node &node) |
A callback function for forEachRootNodeInScene. | |
typedef void | ForEachNodeInSceneCallback(Model &gltf, Node &node, const glm::dmat4 &transform) |
A callback function for forEachNodeInScene. | |
typedef void | ForEachNodeInSceneConstCallback(const Model &gltf, const Node &node, const glm::dmat4 &transform) |
A callback function for forEachNodeInScene. | |
typedef void | ForEachPrimitiveInSceneCallback(Model &gltf, Node &node, Mesh &mesh, MeshPrimitive &primitive, const glm::dmat4 &transform) |
A callback function for forEachPrimitiveInScene. | |
typedef void | ForEachPrimitiveInSceneConstCallback(const Model &gltf, const Node &node, const Mesh &mesh, const MeshPrimitive &primitive, const glm::dmat4 &transform) |
A callback function for forEachPrimitiveInScene. | |
Public Member Functions | |
CesiumUtility::ErrorList | merge (Model &&rhs) |
Merges another model into this one. More... | |
void | forEachRootNodeInScene (int32_t sceneID, std::function< ForEachRootNodeInSceneCallback > &&callback) |
Apply the given callback to the root nodes of the scene. More... | |
void | forEachRootNodeInScene (int32_t sceneID, std::function< ForEachRootNodeInSceneConstCallback > &&callback) const |
void | forEachNodeInScene (int32_t sceneID, std::function< ForEachNodeInSceneCallback > &&callback) |
Apply the given callback to all nodes in the scene. More... | |
void | forEachNodeInScene (int32_t sceneID, std::function< ForEachNodeInSceneConstCallback > &&callback) const |
void | forEachPrimitiveInScene (int32_t sceneID, std::function< ForEachPrimitiveInSceneCallback > &&callback) |
Apply the given callback to all relevant primitives. More... | |
void | forEachPrimitiveInScene (int32_t sceneID, std::function< ForEachPrimitiveInSceneConstCallback > &&callback) const |
void | generateMissingNormalsSmooth () |
Fills in smooth normals for any primitives with missing normals. | |
void | addExtensionUsed (const std::string &extensionName) |
Adds an extension to the ModelSpec::extensionsUsed property, if it is not already present. More... | |
void | addExtensionRequired (const std::string &extensionName) |
Adds an extension to the ModelSpec::extensionsRequired property, if it is not already present. More... | |
void | removeExtensionUsed (const std::string &extensionName) |
Removes an extension from the ModelSpec::extensionsUsed property. More... | |
void | removeExtensionRequired (const std::string &extensionName) |
Removes an extension from the ModelSpec::extensionsRequired property. More... | |
bool | isExtensionUsed (const std::string &extensionName) const noexcept |
Determines whether a given extension name is listed in the model's ModelSpec::extensionsUsed property. More... | |
bool | isExtensionRequired (const std::string &extensionName) const noexcept |
Determines whether a given extension name is listed in the model's ModelSpec::extensionsRequired property. More... | |
Public Member Functions inherited from CesiumUtility::ExtensibleObject | |
template<typename T > | |
bool | hasExtension () const noexcept |
Checks if an extension exists given its static type. More... | |
template<typename T > | |
const T * | getExtension () const noexcept |
Gets an extension given its static type. More... | |
template<typename T > | |
T * | getExtension () noexcept |
Gets an extension given its static type. More... | |
const JsonValue * | getGenericExtension (const std::string &extensionName) const noexcept |
Gets a generic extension with the given name as a CesiumUtility::JsonValue. More... | |
JsonValue * | getGenericExtension (const std::string &extensionName) noexcept |
Gets a generic extension with the given name as a CesiumUtility::JsonValue. More... | |
template<typename T , typename... ConstructorArgumentTypes> | |
T & | addExtension (ConstructorArgumentTypes &&... constructorArguments) |
Adds a statically-typed extension to this object. More... | |
template<typename T > | |
void | removeExtension () |
Removes a statically-typed extension from this object. More... | |
Static Public Member Functions | |
template<typename T > | |
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 range. More... | |
template<typename T > | |
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 the range. More... | |
template<typename T > | |
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 the range. More... | |
Additional Inherited Members | |
Public Attributes inherited from CesiumGltf::ModelSpec | |
std::vector< std::string > | extensionsUsed |
Names of glTF extensions used in this asset. | |
std::vector< std::string > | extensionsRequired |
Names of glTF extensions required to properly load this asset. | |
std::vector< CesiumGltf::Accessor > | accessors |
An array of accessors. More... | |
std::vector< CesiumGltf::Animation > | animations |
An array of keyframe animations. | |
CesiumGltf::Asset | asset |
Metadata about the glTF asset. | |
std::vector< CesiumGltf::Buffer > | buffers |
An array of buffers. More... | |
std::vector< CesiumGltf::BufferView > | bufferViews |
An array of bufferViews. More... | |
std::vector< CesiumGltf::Camera > | cameras |
An array of cameras. More... | |
std::vector< CesiumGltf::Image > | images |
An array of images. More... | |
std::vector< CesiumGltf::Material > | materials |
An array of materials. More... | |
std::vector< CesiumGltf::Mesh > | meshes |
An array of meshes. More... | |
std::vector< CesiumGltf::Node > | nodes |
An array of nodes. | |
std::vector< CesiumGltf::Sampler > | samplers |
An array of samplers. More... | |
int32_t | scene = -1 |
The index of the default scene. More... | |
std::vector< CesiumGltf::Scene > | scenes |
An array of scenes. | |
std::vector< CesiumGltf::Skin > | skins |
An array of skins. More... | |
std::vector< CesiumGltf::Texture > | textures |
An array of textures. | |
Public Attributes inherited from CesiumUtility::ExtensibleObject | |
std::unordered_map< std::string, std::any > | extensions |
The extensions attached to this object. More... | |
JsonValue::Object | extras |
Application-specific data. More... | |
JsonValue::Object | unknownProperties |
Unknown properties that exist on this object but do not have any representation in the statically-typed classes. More... | |
Static Public Attributes inherited from CesiumGltf::ModelSpec | |
static constexpr const char * | TypeName = "Model" |
void CesiumGltf::Model::addExtensionRequired | ( | const std::string & | extensionName | ) |
Adds an extension to the ModelSpec::extensionsRequired property, if it is not already present.
Calling this function also adds the extension to extensionsUsed
, if it's not already present.
extensionName | The name of the required extension. |
void CesiumGltf::Model::addExtensionUsed | ( | const std::string & | extensionName | ) |
Adds an extension to the ModelSpec::extensionsUsed property, if it is not already present.
extensionName | The name of the used extension. |
void CesiumGltf::Model::forEachNodeInScene | ( | int32_t | sceneID, |
std::function< ForEachNodeInSceneCallback > && | callback | ||
) |
Apply the given callback to all nodes in the scene.
If the given sceneID
is non-negative and exists in the given glTF, then the given callback will be applied to all nodes in this scene.
If the given sceneId
is negative, then the nodes that the callback will be applied to depends on the structure of the glTF model:
sceneID | The scene ID (index) |
callback | The callback to apply |
void CesiumGltf::Model::forEachNodeInScene | ( | int32_t | sceneID, |
std::function< ForEachNodeInSceneConstCallback > && | callback | ||
) | const |
void CesiumGltf::Model::forEachPrimitiveInScene | ( | int32_t | sceneID, |
std::function< ForEachPrimitiveInSceneCallback > && | callback | ||
) |
Apply the given callback to all relevant primitives.
If the given sceneID
is non-negative and exists in the given glTF, then the given callback will be applied to all meshes of this scene.
If the given sceneId
is negative, then the meshes that the callback will be applied to depends on the structure of the glTF model:
sceneID | The scene ID (index) |
callback | The callback to apply |
void CesiumGltf::Model::forEachPrimitiveInScene | ( | int32_t | sceneID, |
std::function< ForEachPrimitiveInSceneConstCallback > && | callback | ||
) | const |
void CesiumGltf::Model::forEachRootNodeInScene | ( | int32_t | sceneID, |
std::function< ForEachRootNodeInSceneCallback > && | callback | ||
) |
Apply the given callback to the root nodes of the scene.
If the given sceneID
is non-negative and exists in the given glTF, then the given callback will be applied to all root nodes of this scene.
If the given sceneId
is negative, then the nodes that the callback will be applied to depends on the structure of the glTF model:
sceneID | The scene ID (index) |
callback | The callback to apply |
void CesiumGltf::Model::forEachRootNodeInScene | ( | int32_t | sceneID, |
std::function< ForEachRootNodeInSceneConstCallback > && | callback | ||
) | const |
|
inlinestatic |
Safely gets the element with a given index, returning a default instance if the index is outside the range.
T | The type of the array. |
items | The array. |
index | The index of the array element to retrieve. |
|
inlinestaticnoexcept |
Safely gets a pointer to the element with a given index, returning nullptr
if the index is outside the range.
T | The type of the array. |
pItems | The array. |
index | The index of the array element to retrieve. |
nullptr
if the index is invalid.
|
inlinestaticnoexcept |
Safely gets a pointer to the element with a given index, returning nullptr
if the index is outside the range.
T | The type of the array. |
pItems | The array. |
index | The index of the array element to retrieve. |
nullptr
if the index is invalid.
|
noexcept |
Determines whether a given extension name is listed in the model's ModelSpec::extensionsRequired property.
extensionName | The extension name to check. |
extensionsRequired
; otherwise, false.
|
noexcept |
Determines whether a given extension name is listed in the model's ModelSpec::extensionsUsed property.
extensionName | The extension name to check. |
extensionsUsed
; otherwise, false. CesiumUtility::ErrorList CesiumGltf::Model::merge | ( | Model && | rhs | ) |
Merges another model into this one.
After this method returns, this Model
contains all of the elements that were originally in it plus all of the elements that were in rhs
. Element indices are updated accordingly. However, element indices in ExtensibleObject::extras, if any, are not updated.
rhs | The model to merge into this one. |
void CesiumGltf::Model::removeExtensionRequired | ( | const std::string & | extensionName | ) |
Removes an extension from the ModelSpec::extensionsRequired property.
Calling this function also removes the extension from extensionsUsed
.
extensionName | The name of the required extension. |
void CesiumGltf::Model::removeExtensionUsed | ( | const std::string & | extensionName | ) |
Removes an extension from the ModelSpec::extensionsUsed property.
extensionName | The name of the used extension. |