Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
gltf_mesh_io.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#pragma once
9
13#include <momentum/math/mesh.h>
14
15#include <fx/gltf.h>
16
17#include <tuple>
18#include <vector>
19
20namespace momentum {
21
28size_t addMesh(const fx::gltf::Document& model, const fx::gltf::Primitive& primitive, Mesh_u& mesh);
29
37size_t addBlendShapes(
38 const fx::gltf::Document& model,
39 const fx::gltf::Primitive& primitive,
40 BlendShape_u& blendShape);
41
47std::vector<Vector4f> loadWeightsFromAccessor(const fx::gltf::Document& model, int32_t accessorIdx);
48
58 const fx::gltf::Document& model,
59 const fx::gltf::Skin& skin,
60 const fx::gltf::Primitive& primitive,
61 const std::vector<size_t>& nodeToObjectMap,
62 size_t kNumVertices,
63 SkinWeights_u& skinWeights);
64
71std::tuple<Mesh_u, SkinWeights_u, BlendShape_u> loadSkinnedMesh(
72 const fx::gltf::Document& model,
73 const std::vector<size_t>& meshNodes,
74 const std::vector<size_t>& nodeToObjectMap);
75
81SkinWeights_u bindMeshToJoint(const Mesh_u& mesh, size_t jointId);
82
83} // namespace momentum
::std::unique_ptr< BlendShape > BlendShape_u
Definition fwd.h:21
::std::unique_ptr< Mesh > Mesh_u
Definition fwd.h:24
void addSkinWeights(const fx::gltf::Document &model, const fx::gltf::Skin &skin, const fx::gltf::Primitive &primitive, const std::vector< size_t > &nodeToObjectMap, const size_t kNumVertices, SkinWeights_u &skinWeights)
Add skin weights from a glTF primitive.
SkinWeights_u bindMeshToJoint(const Mesh_u &mesh, size_t jointId)
Bind a mesh to a single joint.
size_t addBlendShapes(const fx::gltf::Document &model, const fx::gltf::Primitive &primitive, BlendShape_u &blendShape)
Add blend shapes from a glTF primitive.
::std::unique_ptr< SkinWeights > SkinWeights_u
Definition fwd.h:75
std::vector< Vector4f > loadWeightsFromAccessor(const fx::gltf::Document &model, int32_t accessorIdx)
Load skin weights from a glTF accessor.
std::tuple< Mesh_u, SkinWeights_u, BlendShape_u > loadSkinnedMesh(const fx::gltf::Document &model, const std::vector< size_t > &meshNodes, const std::vector< size_t > &nodeToObjectMap)
Load skinned mesh, skin weights, and blend shapes from the model.
size_t addMesh(const fx::gltf::Document &model, const fx::gltf::Primitive &primitive, Mesh_u &mesh)
Add mesh data from a glTF primitive.