MCPcopy Create free account
hub / github.com/CesiumGS/cesium-native / forEachPrimitiveInNodeObject

Function forEachPrimitiveInNodeObject

CesiumGltf/src/Model.cpp:506–533  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

504
505template <typename TCallback>
506void forEachPrimitiveInNodeObject(
507 const glm::dmat4x4& transform,
508 const Model& model,
509 const Node& node,
510 TCallback& callback) {
511
512 // This should just call GltfUtilities::getNodeTransform, but it can't because
513 // it's in CesiumGltfContent. We should merge these two libraries, but until
514 // then, it's duplicated.
515 glm::dmat4x4 nodeTransform =
516 transform * getNodeTransform(node).value_or(glm::dmat4x4(1.0));
517
518 const int32_t meshId = node.mesh;
519 if (meshId >= 0 && size_t(meshId) < model.meshes.size()) {
520 const Mesh& mesh = model.meshes[size_t(meshId)];
521 forEachPrimitiveInMeshObject(nodeTransform, model, node, mesh, callback);
522 }
523
524 for (const int32_t childNodeId : node.children) {
525 if (childNodeId >= 0 && size_t(childNodeId) < model.nodes.size()) {
526 forEachPrimitiveInNodeObject(
527 nodeTransform,
528 model,
529 model.nodes[size_t(childNodeId)],
530 callback);
531 }
532 }
533}
534
535template <typename TCallback>
536void forEachNode(

Callers 1

Calls 3

getNodeTransformFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected