Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
character_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
15#include <momentum/math/fwd.h>
16#include <momentum/math/types.h>
17
18#include <string>
19#include <vector>
20
21namespace momentum {
22
24enum class CharacterFormat : uint8_t {
29};
30
44[[nodiscard]] Character loadFullCharacter(
45 const std::string& characterPath,
46 const std::string& parametersPath = std::string(),
47 const std::string& locatorsPath = std::string(),
48 LoadBlendShapes loadBlendShapes = LoadBlendShapes::No);
49
58[[nodiscard]] Character loadFullCharacterFromBuffer(
59 CharacterFormat format,
60 std::span<const std::byte> characterBuffer,
61 std::span<const std::byte> paramBuffer = std::span<const std::byte>(),
62 std::span<const std::byte> locBuffer = std::span<const std::byte>(),
63 LoadBlendShapes loadBlendShapes = LoadBlendShapes::No);
64
77void saveCharacter(
78 const filesystem::path& filename,
79 const Character& character,
80 float fps = 120.f,
81 const MatrixXf& motion = MatrixXf(),
82 std::span<const std::vector<Marker>> markerSequence = {},
83 const FileSaveOptions& options = FileSaveOptions());
84
98void saveCharacter(
99 const filesystem::path& filename,
100 const Character& character,
101 float fps,
102 std::span<const SkeletonState> skeletonStates,
103 std::span<const std::vector<Marker>> markerSequence = {},
104 const FileSaveOptions& options = FileSaveOptions());
105} // namespace momentum
void saveCharacter(const filesystem::path &filename, const Character &character, const float fps, const MatrixXf &motion, std::span< const std::vector< Marker > > markerSequence, const FileSaveOptions &options)
High level function to save a character with motion and markers to any supported format.
CharacterFormat
Represents the supported character formats.
@ Fbx
FBX file format.
@ Unknown
Unknown or unsupported file format.
@ Usd
USD file format.
@ Gltf
glTF file format.
Character loadFullCharacter(const std::string &characterPath, const std::string &parametersPath, const std::string &locatorsPath, LoadBlendShapes loadBlendShapes)
High level function to load a character of any type, with a local path.
LoadBlendShapes
Definition fbx_io.h:26
MatrixX< float > MatrixXf
Definition types.h:82
Character loadFullCharacterFromBuffer(CharacterFormat format, const std::span< const std::byte > characterBuffer, const std::span< const std::byte > paramBuffer, const std::span< const std::byte > locBuffer, LoadBlendShapes loadBlendShapes)
Buffer version of loadFullCharacter function, supports .glb and .fbx file formats.
A character model with skeletal structure, mesh, and optional components.
Definition character.h:32
Unified options for saving files in both FBX and GLTF formats.