| 504 | |
| 505 | template <typename TCallback> |
| 506 | void 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 | |
| 535 | template <typename TCallback> |
| 536 | void forEachNode( |
no test coverage detected