|
static std::optional< glm::dmat4x4 > | getNodeTransform (const CesiumGltf::Node &node) |
| Gets the transformation matrix for a given node.
|
|
static void | setNodeTransform (CesiumGltf::Node &node, const glm::dmat4x4 &newTransform) |
| Sets the transformation matrix for a given node.
|
|
static glm::dmat4x4 | applyRtcCenter (const CesiumGltf::Model &gltf, const glm::dmat4x4 &rootTransform) |
| Applies the glTF's RTC_CENTER, if any, to the given transform.
|
|
static glm::dmat4x4 | applyGltfUpAxisTransform (const CesiumGltf::Model &model, const glm::dmat4x4 &rootTransform) |
| Applies the glTF's gltfUpAxis , if any, to the given transform.
|
|
static CesiumGeospatial::BoundingRegion | computeBoundingRegion (const CesiumGltf::Model &gltf, const glm::dmat4 &transform, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84) |
| Computes a bounding region from the vertex positions in a glTF model.
|
|
static std::vector< std::string_view > | parseGltfCopyright (const CesiumGltf::Model &gltf) |
| Parse the copyright field of a glTF model and return the individual credits.
|
|
static void | collapseToSingleBuffer (CesiumGltf::Model &gltf) |
| Merges all of the glTF's buffers into a single buffer (the first one).
|
|
static void | moveBufferContent (CesiumGltf::Model &gltf, CesiumGltf::Buffer &destination, CesiumGltf::Buffer &source) |
| Copies the content of one CesiumGltf::Buffer to the end of another, updates all CesiumGltf::BufferView instances to refer to the destination buffer, and clears the contents of the original buffer.
|
|
static void | removeUnusedTextures (CesiumGltf::Model &gltf, const std::vector< int32_t > &extraUsedTextureIndices={}) |
| Removes unused textures from the given glTF model.
|
|
static void | removeUnusedSamplers (CesiumGltf::Model &gltf, const std::vector< int32_t > &extraUsedSamplerIndices={}) |
| Removes unused samplers from the given glTF model.
|
|
static void | removeUnusedImages (CesiumGltf::Model &gltf, const std::vector< int32_t > &extraUsedImageIndices={}) |
| Removes unused images from the given glTF model.
|
|
static void | removeUnusedAccessors (CesiumGltf::Model &gltf, const std::vector< int32_t > &extraUsedAccessorIndices={}) |
| Removes unused accessors from the given glTF model.
|
|
static void | removeUnusedBufferViews (CesiumGltf::Model &gltf, const std::vector< int32_t > &extraUsedBufferViewIndices={}) |
| Removes unused buffer views from the given glTF model.
|
|
static void | removeUnusedBuffers (CesiumGltf::Model &gltf, const std::vector< int32_t > &extraUsedBufferIndices={}) |
| Removes unused buffers from the given glTF model.
|
|
static void | removeUnusedMeshes (CesiumGltf::Model &gltf, const std::vector< int32_t > &extraUsedMeshIndices={}) |
| Removes unused meshes from the given glTF model.
|
|
static void | removeUnusedMaterials (CesiumGltf::Model &gltf, const std::vector< int32_t > &extraUsedMaterialIndices={}) |
| Removes unused materials from the given glTF model.
|
|
static void | compactBuffers (CesiumGltf::Model &gltf) |
| Shrink buffers by removing any sections that are not referenced by any BufferView.
|
|
static void | compactBuffer (CesiumGltf::Model &gltf, int32_t bufferIndex) |
| Shrink a buffer by removing any sections that are not referenced by any BufferView.
|
|
static IntersectResult | intersectRayGltfModel (const CesiumGeometry::Ray &ray, const CesiumGltf::Model &gltf, bool cullBackFaces=true, const glm::dmat4x4 &gltfTransform=glm::dmat4(1.0)) |
| Intersects a ray with a glTF model and returns the first intersection point.
|
|
A collection of utility functions that are used to process and transform a gltf model
Definition at line 31 of file GltfUtilities.h.
static glm::dmat4x4 CesiumGltfContent::GltfUtilities::applyGltfUpAxisTransform |
( |
const CesiumGltf::Model & | model, |
|
|
const glm::dmat4x4 & | rootTransform ) |
|
static |
Applies the glTF's gltfUpAxis
, if any, to the given transform.
By default, the up-axis of a glTF model will the the Y-axis.
If the tileset that contained the model had the asset.gltfUpAxis
string property, then the information about the up-axis has been stored in as a number property called gltfUpAxis
in the extras
of the given model.
Depending on whether this value is CesiumGeometry::Axis::X
, Y
, or Z
, the given matrix will be multiplied with a matrix that converts the respective axis to be the Z-axis, as required by the 3D Tiles standard.
- Parameters
-
model | The glTF model |
rootTransform | The matrix that will be multiplied with the transform |
- Returns
- The result of multiplying the
rootTransform
with the gltfUpAxis
.
static glm::dmat4x4 CesiumGltfContent::GltfUtilities::applyRtcCenter |
( |
const CesiumGltf::Model & | gltf, |
|
|
const glm::dmat4x4 & | rootTransform ) |
|
static |
Applies the glTF's RTC_CENTER, if any, to the given transform.
If the glTF has a CESIUM_RTC
extension, this function will multiply the given matrix with the (translation) matrix that is created from the RTC_CENTER
in the. If the given model does not have this extension, then this function will return the rootTransform
unchanged.
- Parameters
-
gltf | The glTF model |
rootTransform | The matrix that will be multiplied with the transform |
- Returns
- The result of multiplying the
RTC_CENTER
with the rootTransform
.
Computes a bounding region from the vertex positions in a glTF model.
If the glTF model spans the anti-meridian, the west and east longitude values will be in the usual -PI to PI range, but east will have a smaller value than west.
If the glTF contains no geometry, the returned region's rectangle will be CesiumGeospatial::GlobeRectangle::EMPTY
, its minimum height will be 1.0, and its maximum height will be -1.0 (the minimum will be greater than the maximum).
- Parameters
-
- Returns
- The computed bounding region.