pymomentum-cpu 0.1.82.post0__cp312-cp312-macosx_14_0_arm64.whl → 0.1.83.post0__cp312-cp312-macosx_14_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pymomentum-cpu might be problematic. Click here for more details.
- include/axel/DualContouring.h +1 -1
- include/axel/MeshToSdf.h +10 -10
- include/axel/SimdKdTree.h +19 -19
- include/axel/math/CoplanarityCheck.h +4 -4
- include/axel/math/MeshHoleFilling.h +9 -9
- include/momentum/character/blend_shape.h +4 -4
- include/momentum/character/blend_shape_base.h +1 -1
- include/momentum/character/character_utility.h +1 -1
- include/momentum/character/linear_skinning.h +2 -2
- include/momentum/character/parameter_transform.h +2 -2
- include/momentum/character_sequence_solver/model_parameters_sequence_error_function.h +9 -9
- include/momentum/character_sequence_solver/multipose_solver_function.h +1 -1
- include/momentum/character_sequence_solver/sequence_error_function.h +9 -9
- include/momentum/character_sequence_solver/sequence_solver_function.h +1 -1
- include/momentum/character_sequence_solver/state_sequence_error_function.h +9 -9
- include/momentum/character_sequence_solver/vertex_sequence_error_function.h +14 -14
- include/momentum/character_solver/constraint_error_function.h +2 -2
- include/momentum/character_solver/pose_prior_error_function.h +1 -1
- include/momentum/character_solver/skeleton_solver_function.h +2 -2
- include/momentum/gui/rerun/logger.h +6 -6
- include/momentum/io/character_io.h +3 -3
- include/momentum/io/common/gsl_utils.h +2 -2
- include/momentum/io/common/stream_utils.h +4 -4
- include/momentum/io/fbx/fbx_io.h +59 -12
- include/momentum/io/fbx/fbx_memory_stream.h +3 -3
- include/momentum/io/fbx/openfbx_loader.h +10 -3
- include/momentum/io/fbx/polygon_data.h +3 -3
- include/momentum/io/gltf/gltf_builder.h +2 -2
- include/momentum/io/gltf/gltf_io.h +6 -6
- include/momentum/io/gltf/utils/accessor_utils.h +6 -6
- include/momentum/io/legacy_json/legacy_json_io.h +2 -2
- include/momentum/io/marker/marker_io.h +1 -1
- include/momentum/io/motion/mmo_io.h +7 -7
- include/momentum/io/skeleton/locator_io.h +2 -2
- include/momentum/io/skeleton/mppca_io.h +2 -2
- include/momentum/io/skeleton/parameter_transform_io.h +3 -3
- include/momentum/io/urdf/urdf_io.h +3 -3
- include/momentum/io/usd/usd_io.h +2 -2
- include/momentum/marker_tracking/app_utils.h +1 -1
- include/momentum/marker_tracking/marker_tracker.h +8 -8
- include/momentum/marker_tracking/tracker_utils.h +2 -2
- include/momentum/math/mppca.h +1 -1
- include/momentum/math/online_householder_qr.h +5 -5
- include/momentum/math/transform.h +2 -2
- include/momentum/math/types.h +10 -10
- include/momentum/math/utility.h +2 -2
- include/momentum/rasterizer/rasterizer.h +24 -24
- lib/cmake/axel/axelTargets.cmake +1 -1
- lib/libarrow.a +0 -0
- lib/libarrow_bundled_dependencies.a +0 -0
- lib/libaxel.a +0 -0
- lib/libmomentum_app_utils.a +0 -0
- lib/libmomentum_character.a +0 -0
- lib/libmomentum_character_sequence_solver.a +0 -0
- lib/libmomentum_character_solver.a +0 -0
- lib/libmomentum_common.a +0 -0
- lib/libmomentum_diff_ik.a +0 -0
- lib/libmomentum_io.a +0 -0
- lib/libmomentum_io_common.a +0 -0
- lib/libmomentum_io_fbx.a +0 -0
- lib/libmomentum_io_gltf.a +0 -0
- lib/libmomentum_io_legacy_json.a +0 -0
- lib/libmomentum_io_marker.a +0 -0
- lib/libmomentum_io_motion.a +0 -0
- lib/libmomentum_io_shape.a +0 -0
- lib/libmomentum_io_skeleton.a +0 -0
- lib/libmomentum_io_urdf.a +0 -0
- lib/libmomentum_marker_tracker.a +0 -0
- lib/libmomentum_math.a +0 -0
- lib/libmomentum_online_qr.a +0 -0
- lib/libmomentum_process_markers.a +0 -0
- lib/libmomentum_rerun.a +0 -0
- lib/libmomentum_simd_constraints.a +0 -0
- lib/libmomentum_simd_generalized_loss.a +0 -0
- lib/libmomentum_skeleton.a +0 -0
- lib/libmomentum_solver.a +0 -0
- lib/librerun_sdk.a +0 -0
- pymomentum/axel.cpython-312-darwin.so +0 -0
- pymomentum/geometry.cpython-312-darwin.so +0 -0
- pymomentum/marker_tracking.cpython-312-darwin.so +0 -0
- pymomentum/solver.cpython-312-darwin.so +0 -0
- pymomentum/solver2.cpython-312-darwin.so +0 -0
- {pymomentum_cpu-0.1.82.post0.dist-info → pymomentum_cpu-0.1.83.post0.dist-info}/METADATA +6 -4
- {pymomentum_cpu-0.1.82.post0.dist-info → pymomentum_cpu-0.1.83.post0.dist-info}/RECORD +86 -86
- {pymomentum_cpu-0.1.82.post0.dist-info → pymomentum_cpu-0.1.83.post0.dist-info}/WHEEL +0 -0
- {pymomentum_cpu-0.1.82.post0.dist-info → pymomentum_cpu-0.1.83.post0.dist-info}/licenses/LICENSE +0 -0
|
@@ -22,8 +22,8 @@ namespace momentum {
|
|
|
22
22
|
struct spanstreambuf : std::streambuf {
|
|
23
23
|
/// Construct a spanstreambuf with an optional buffer.
|
|
24
24
|
///
|
|
25
|
-
/// @param buffer A
|
|
26
|
-
spanstreambuf(
|
|
25
|
+
/// @param buffer A std::span of const std::byte (default: empty span).
|
|
26
|
+
spanstreambuf(std::span<const std::byte> buffer = {});
|
|
27
27
|
|
|
28
28
|
/// Destructor.
|
|
29
29
|
virtual ~spanstreambuf() override;
|
|
@@ -41,8 +41,8 @@ struct spanstreambuf : std::streambuf {
|
|
|
41
41
|
struct ispanstream : std::istream {
|
|
42
42
|
/// Construct an ispanstream with a buffer.
|
|
43
43
|
///
|
|
44
|
-
/// @param buffer A
|
|
45
|
-
explicit ispanstream(
|
|
44
|
+
/// @param buffer A std::span of const std::byte.
|
|
45
|
+
explicit ispanstream(std::span<const std::byte> buffer);
|
|
46
46
|
|
|
47
47
|
/// Destructor.
|
|
48
48
|
virtual ~ispanstream();
|
include/momentum/io/fbx/fbx_io.h
CHANGED
|
@@ -8,10 +8,13 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
#include <momentum/character/fwd.h>
|
|
11
|
+
#include <momentum/character/marker.h>
|
|
11
12
|
#include <momentum/common/filesystem.h>
|
|
12
13
|
#include <momentum/math/types.h>
|
|
13
14
|
|
|
14
|
-
#include <
|
|
15
|
+
#include <span>
|
|
16
|
+
|
|
17
|
+
#include <string_view>
|
|
15
18
|
|
|
16
19
|
namespace momentum {
|
|
17
20
|
|
|
@@ -58,7 +61,7 @@ Character loadFbxCharacter(
|
|
|
58
61
|
// This is different from historical momentum behavior so it's off by default.
|
|
59
62
|
// Permissive mode allows loading mesh-only characters (without skin weights).
|
|
60
63
|
Character loadFbxCharacter(
|
|
61
|
-
|
|
64
|
+
std::span<const std::byte> inputSpan,
|
|
62
65
|
KeepLocators keepLocators = KeepLocators::No,
|
|
63
66
|
bool permissive = false,
|
|
64
67
|
LoadBlendShapes loadBlendShapes = LoadBlendShapes::No);
|
|
@@ -72,12 +75,22 @@ std::tuple<Character, std::vector<MatrixXf>, float> loadFbxCharacterWithMotion(
|
|
|
72
75
|
|
|
73
76
|
// Permissive mode allows loading mesh-only characters (without skin weights).
|
|
74
77
|
std::tuple<Character, std::vector<MatrixXf>, float> loadFbxCharacterWithMotion(
|
|
75
|
-
|
|
78
|
+
std::span<const std::byte> inputSpan,
|
|
76
79
|
KeepLocators keepLocatorss = KeepLocators::No,
|
|
77
80
|
bool permissive = false,
|
|
78
81
|
LoadBlendShapes loadBlendShape = LoadBlendShapes::No);
|
|
79
82
|
|
|
80
|
-
|
|
83
|
+
/// Save a character with animation to an FBX file.
|
|
84
|
+
/// @param filename Path to the output FBX file
|
|
85
|
+
/// @param character The character to save
|
|
86
|
+
/// @param poses Model parameters for each frame (empty for bind pose only)
|
|
87
|
+
/// @param identity Identity pose parameters (empty to use bind pose)
|
|
88
|
+
/// @param framerate Animation framerate in frames per second
|
|
89
|
+
/// @param saveMesh Whether to include mesh geometry in the output
|
|
90
|
+
/// @param coordSystemInfo Coordinate system configuration for the FBX file
|
|
91
|
+
/// @param permissive Permissive mode allows saving mesh-only characters (without skin weights)
|
|
92
|
+
/// @param fbxNamespace Optional namespace to prepend to all node names (e.g., "ns" will become
|
|
93
|
+
/// "ns:")
|
|
81
94
|
void saveFbx(
|
|
82
95
|
const filesystem::path& filename,
|
|
83
96
|
const Character& character,
|
|
@@ -86,9 +99,21 @@ void saveFbx(
|
|
|
86
99
|
double framerate = 120.0,
|
|
87
100
|
bool saveMesh = false,
|
|
88
101
|
const FBXCoordSystemInfo& coordSystemInfo = FBXCoordSystemInfo(),
|
|
89
|
-
bool permissive = false
|
|
90
|
-
|
|
91
|
-
|
|
102
|
+
bool permissive = false,
|
|
103
|
+
const std::vector<std::vector<Marker>>& markerSequence = {},
|
|
104
|
+
std::string_view fbxNamespace = "");
|
|
105
|
+
|
|
106
|
+
/// Save a character with animation using joint parameters directly.
|
|
107
|
+
/// @param filename Path to the output FBX file
|
|
108
|
+
/// @param character The character to save
|
|
109
|
+
/// @param jointParams Joint parameters for each frame (empty for bind pose only)
|
|
110
|
+
/// @param framerate Animation framerate in frames per second
|
|
111
|
+
/// @param saveMesh Whether to include mesh geometry in the output
|
|
112
|
+
/// @param coordSystemInfo Coordinate system configuration for the FBX file
|
|
113
|
+
/// @param permissive Permissive mode allows saving mesh-only characters (without skin weights)
|
|
114
|
+
/// @param markerSequence Optional marker sequence data to save with the character
|
|
115
|
+
/// @param fbxNamespace Optional namespace to prepend to all node names (e.g., "ns" will become
|
|
116
|
+
/// "ns:")
|
|
92
117
|
void saveFbxWithJointParams(
|
|
93
118
|
const filesystem::path& filename,
|
|
94
119
|
const Character& character,
|
|
@@ -96,14 +121,36 @@ void saveFbxWithJointParams(
|
|
|
96
121
|
double framerate = 120.0,
|
|
97
122
|
bool saveMesh = false,
|
|
98
123
|
const FBXCoordSystemInfo& coordSystemInfo = FBXCoordSystemInfo(),
|
|
99
|
-
bool permissive = false
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
124
|
+
bool permissive = false,
|
|
125
|
+
const std::vector<std::vector<Marker>>& markerSequence = {},
|
|
126
|
+
std::string_view fbxNamespace = "");
|
|
127
|
+
|
|
128
|
+
/// Save a character model (skeleton and mesh) without animation.
|
|
129
|
+
/// @param filename Path to the output FBX file
|
|
130
|
+
/// @param character The character to save
|
|
131
|
+
/// @param coordSystemInfo Coordinate system configuration for the FBX file
|
|
132
|
+
/// @param permissive Permissive mode allows saving mesh-only characters (without skin weights)
|
|
133
|
+
/// @param fbxNamespace Optional namespace to prepend to all node names (e.g., "ns" will become
|
|
134
|
+
/// "ns:")
|
|
103
135
|
void saveFbxModel(
|
|
104
136
|
const filesystem::path& filename,
|
|
105
137
|
const Character& character,
|
|
106
138
|
const FBXCoordSystemInfo& coordSystemInfo = FBXCoordSystemInfo(),
|
|
107
|
-
bool permissive = false
|
|
139
|
+
bool permissive = false,
|
|
140
|
+
std::string_view fbxNamespace = "");
|
|
141
|
+
|
|
142
|
+
/// Loads a MarkerSequence from an FBX file.
|
|
143
|
+
///
|
|
144
|
+
/// This function reads motion capture marker data from an FBX file and returns
|
|
145
|
+
/// it as a MarkerSequence. The markers must be stored in the FBX scene hierarchy
|
|
146
|
+
/// under a "Markers" root node, and each marker node must have the custom property
|
|
147
|
+
/// "Momentum_Marker" to be recognized. The Markers root node must have the custom
|
|
148
|
+
/// property "Momentum_Markers_Root" to be identified.
|
|
149
|
+
///
|
|
150
|
+
/// @param[in] filename Path to the FBX file containing marker data.
|
|
151
|
+
/// @return A MarkerSequence object containing the marker animation data, including
|
|
152
|
+
/// marker positions per frame and fps. Returns an empty sequence if no
|
|
153
|
+
/// markers or animations are found.
|
|
154
|
+
MarkerSequence loadFbxMarkerSequence(const filesystem::path& filename);
|
|
108
155
|
|
|
109
156
|
} // namespace momentum
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
#include <fbxsdk.h>
|
|
11
11
|
#include <fbxsdk/core/fbxstream.h>
|
|
12
|
-
#include <
|
|
12
|
+
#include <span>
|
|
13
13
|
|
|
14
14
|
#include <string_view>
|
|
15
15
|
|
|
@@ -24,7 +24,7 @@ namespace momentum {
|
|
|
24
24
|
// Simplest FbxStream to read file from a string_view memory buffer
|
|
25
25
|
class FbxMemoryStream : public FbxStream {
|
|
26
26
|
public:
|
|
27
|
-
FbxMemoryStream(
|
|
27
|
+
FbxMemoryStream(std::span<const std::byte> buffer, int pReaderId);
|
|
28
28
|
~FbxMemoryStream() override;
|
|
29
29
|
EState GetState() override;
|
|
30
30
|
bool Open(void* pStreamData) override;
|
|
@@ -51,7 +51,7 @@ class FbxMemoryStream : public FbxStream {
|
|
|
51
51
|
void ClearError() override;
|
|
52
52
|
|
|
53
53
|
private:
|
|
54
|
-
|
|
54
|
+
std::span<const std::byte> buffer_;
|
|
55
55
|
long length_;
|
|
56
56
|
#if FBX_VERSION_GE(2020, 3, 2)
|
|
57
57
|
mutable FbxInt64 position_{0};
|
|
@@ -8,14 +8,19 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
#include <momentum/character/fwd.h>
|
|
11
|
+
#include <momentum/character/marker.h>
|
|
11
12
|
#include <momentum/common/filesystem.h>
|
|
12
13
|
#include <momentum/io/fbx/fbx_io.h>
|
|
13
14
|
#include <momentum/math/types.h>
|
|
14
15
|
|
|
15
|
-
#include <
|
|
16
|
+
#include <span>
|
|
16
17
|
|
|
17
18
|
namespace momentum {
|
|
18
19
|
|
|
20
|
+
// Custom property names for identifying Momentum-specific FBX nodes
|
|
21
|
+
constexpr const char* kMomentumMarkersRootProperty = "Momentum_Markers_Root";
|
|
22
|
+
constexpr const char* kMomentumMarkerProperty = "Momentum_Marker";
|
|
23
|
+
|
|
19
24
|
// Using keepLocators means the Nulls in the transform hierarchy will be turned into Locators.
|
|
20
25
|
// This is different from historical momentum behavior so it's off by default.
|
|
21
26
|
// Permissive mode allows loading mesh-only characters (without skin weights).
|
|
@@ -27,7 +32,7 @@ Character loadOpenFbxCharacter(
|
|
|
27
32
|
|
|
28
33
|
// Permissive mode allows loading mesh-only characters (without skin weights).
|
|
29
34
|
Character loadOpenFbxCharacter(
|
|
30
|
-
|
|
35
|
+
std::span<const std::byte> inputData,
|
|
31
36
|
KeepLocators keepLocators = KeepLocators::No,
|
|
32
37
|
bool permissive = false,
|
|
33
38
|
LoadBlendShapes loadBlendShapes = LoadBlendShapes::No);
|
|
@@ -41,9 +46,11 @@ std::tuple<Character, std::vector<MatrixXf>, float> loadOpenFbxCharacterWithMoti
|
|
|
41
46
|
|
|
42
47
|
// Permissive mode allows loading mesh-only characters (without skin weights).
|
|
43
48
|
std::tuple<Character, std::vector<MatrixXf>, float> loadOpenFbxCharacterWithMotion(
|
|
44
|
-
|
|
49
|
+
std::span<const std::byte> inputData,
|
|
45
50
|
KeepLocators keepLocators = KeepLocators::No,
|
|
46
51
|
bool permissive = false,
|
|
47
52
|
LoadBlendShapes loadBlendShapes = LoadBlendShapes::No);
|
|
48
53
|
|
|
54
|
+
MarkerSequence loadOpenFbxMarkerSequence(const filesystem::path& filename);
|
|
55
|
+
|
|
49
56
|
} // namespace momentum
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
#include <momentum/math/types.h>
|
|
11
11
|
|
|
12
|
-
#include <
|
|
12
|
+
#include <span>
|
|
13
13
|
|
|
14
14
|
#include <string>
|
|
15
15
|
#include <vector>
|
|
@@ -54,7 +54,7 @@ struct PolygonData {
|
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
std::vector<Eigen::Vector3i> triangulate(
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
std::span<const uint32_t> indices,
|
|
58
|
+
std::span<const uint32_t> offsets);
|
|
59
59
|
|
|
60
60
|
} // namespace momentum
|
|
@@ -72,7 +72,7 @@ class GltfBuilder final {
|
|
|
72
72
|
void addSkeletonStates(
|
|
73
73
|
const Character& character,
|
|
74
74
|
float fps,
|
|
75
|
-
|
|
75
|
+
std::span<const SkeletonState> skeletonStates,
|
|
76
76
|
const std::string& customName = "default");
|
|
77
77
|
|
|
78
78
|
/// Add marker data to the file
|
|
@@ -85,7 +85,7 @@ class GltfBuilder final {
|
|
|
85
85
|
/// @param[in] animName Optional parameter specifying the animation name (default is "default").
|
|
86
86
|
void addMarkerSequence(
|
|
87
87
|
float fps,
|
|
88
|
-
|
|
88
|
+
std::span<const std::vector<momentum::Marker>> markerSequence,
|
|
89
89
|
MarkerMesh markerMesh = MarkerMesh::None,
|
|
90
90
|
const std::string& animName = "default");
|
|
91
91
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
#include <momentum/math/types.h>
|
|
15
15
|
|
|
16
16
|
#include <fx/gltf.h>
|
|
17
|
-
#include <
|
|
17
|
+
#include <span>
|
|
18
18
|
|
|
19
19
|
#include <tuple>
|
|
20
20
|
#include <vector>
|
|
@@ -33,7 +33,7 @@ Character loadGltfCharacter(const fx::gltf::Document& model);
|
|
|
33
33
|
|
|
34
34
|
Character loadGltfCharacter(const filesystem::path& gltfFilename);
|
|
35
35
|
|
|
36
|
-
Character loadGltfCharacter(
|
|
36
|
+
Character loadGltfCharacter(std::span<const std::byte> byteSpan);
|
|
37
37
|
|
|
38
38
|
std::tuple<MotionParameters, IdentityParameters, float> loadMotion(
|
|
39
39
|
const filesystem::path& gltfFilename);
|
|
@@ -55,7 +55,7 @@ std::tuple<Character, MatrixXf, VectorXf, float> loadCharacterWithMotion(
|
|
|
55
55
|
/// @return A tuple containing the loaded Character object, the motion represented in model
|
|
56
56
|
/// parameters, the identity vector represented as joint parameters, and the fps.
|
|
57
57
|
std::tuple<Character, MatrixXf, VectorXf, float> loadCharacterWithMotion(
|
|
58
|
-
|
|
58
|
+
std::span<const std::byte> byteSpan);
|
|
59
59
|
|
|
60
60
|
/// Load a GLTF Character with motion in the form of skeleton states (transform matrices)
|
|
61
61
|
///
|
|
@@ -63,7 +63,7 @@ std::tuple<Character, MatrixXf, VectorXf, float> loadCharacterWithMotion(
|
|
|
63
63
|
/// file to be saved using momentum's functionality that saves model parameters in a
|
|
64
64
|
/// custom GTLF extension, however the resulting skeleton states may be harder to work with.
|
|
65
65
|
std::tuple<Character, std::vector<SkeletonState>, std::vector<float>>
|
|
66
|
-
loadCharacterWithSkeletonStates(
|
|
66
|
+
loadCharacterWithSkeletonStates(std::span<const std::byte> byteSpan);
|
|
67
67
|
|
|
68
68
|
std::tuple<Character, std::vector<SkeletonState>, std::vector<float>>
|
|
69
69
|
loadCharacterWithSkeletonStates(const filesystem::path& gltfFilename);
|
|
@@ -90,7 +90,7 @@ std::tuple<MatrixXf, VectorXf, float> loadMotionOnCharacter(
|
|
|
90
90
|
/// represented as joint parameters, and the fps. The model parameters and joint parameters are
|
|
91
91
|
/// mapped to the input character by name matching.
|
|
92
92
|
std::tuple<MatrixXf, VectorXf, float> loadMotionOnCharacter(
|
|
93
|
-
|
|
93
|
+
std::span<const std::byte> byteSpan,
|
|
94
94
|
const Character& character);
|
|
95
95
|
|
|
96
96
|
/// Loads a MarkerSequence from a file.
|
|
@@ -132,7 +132,7 @@ void saveCharacter(
|
|
|
132
132
|
const filesystem::path& filename,
|
|
133
133
|
const Character& Character,
|
|
134
134
|
float fps,
|
|
135
|
-
|
|
135
|
+
std::span<const SkeletonState> skeletonStates,
|
|
136
136
|
const std::vector<std::vector<Marker>>& markerSequence = {},
|
|
137
137
|
GltfFileFormat fileFormat = GltfFileFormat::Extension,
|
|
138
138
|
const GltfOptions& options = GltfOptions());
|
|
@@ -73,7 +73,7 @@ std::vector<T> copyAccessorBuffer(const fx::gltf::Document& model, int32_t id) {
|
|
|
73
73
|
const auto stride = view.byteStride == 0 ? elsize : view.byteStride;
|
|
74
74
|
|
|
75
75
|
const auto& buf = model.buffers[view.buffer];
|
|
76
|
-
auto bytes =
|
|
76
|
+
auto bytes = std::as_bytes(std::span<const uint8_t>(buf.data));
|
|
77
77
|
bytes = bytes.subspan(view.byteOffset, view.byteLength);
|
|
78
78
|
bytes = bytes.subspan(accessor.byteOffset);
|
|
79
79
|
|
|
@@ -111,7 +111,7 @@ std::vector<T> copyAlignedAccessorBuffer(const fx::gltf::Document& model, int32_
|
|
|
111
111
|
const auto stride = view.byteStride == 0 ? elsize : view.byteStride;
|
|
112
112
|
|
|
113
113
|
const auto& buf = model.buffers[view.buffer];
|
|
114
|
-
auto bytes =
|
|
114
|
+
auto bytes = std::as_bytes(std::span<const uint8_t>(buf.data));
|
|
115
115
|
bytes = bytes.subspan(view.byteOffset, view.byteLength);
|
|
116
116
|
bytes = bytes.subspan(accessor.byteOffset);
|
|
117
117
|
|
|
@@ -133,7 +133,7 @@ void setAccessorType(fx::gltf::Accessor& /* accessor */) {
|
|
|
133
133
|
template <typename T>
|
|
134
134
|
int32_t createAccessorBuffer(
|
|
135
135
|
fx::gltf::Document& model,
|
|
136
|
-
|
|
136
|
+
std::span<T> data,
|
|
137
137
|
const bool align = false,
|
|
138
138
|
const bool normalized = false) {
|
|
139
139
|
// gltf 2.0 allows multiple buffers, but only the first buffer will be stored in
|
|
@@ -261,8 +261,8 @@ template <typename T>
|
|
|
261
261
|
int32_t createSampler(
|
|
262
262
|
fx::gltf::Document& model,
|
|
263
263
|
fx::gltf::Animation& anim,
|
|
264
|
-
|
|
265
|
-
const
|
|
264
|
+
std::span<T> data,
|
|
265
|
+
const std::span<float>& timestamps) {
|
|
266
266
|
MT_CHECK(
|
|
267
267
|
data.size() == timestamps.size(), "data: {}, timestmaps: {}", data.size(), timestamps.size());
|
|
268
268
|
|
|
@@ -282,7 +282,7 @@ template <typename T>
|
|
|
282
282
|
int32_t createSampler(
|
|
283
283
|
fx::gltf::Document& model,
|
|
284
284
|
fx::gltf::Animation& anim,
|
|
285
|
-
|
|
285
|
+
std::span<T> data,
|
|
286
286
|
const int32_t timestampAccessor) {
|
|
287
287
|
// create new sampler
|
|
288
288
|
const int32_t index = anim.samplers.size();
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
#include <momentum/math/fwd.h>
|
|
14
14
|
|
|
15
15
|
#include <nlohmann/json.hpp>
|
|
16
|
-
#include <
|
|
16
|
+
#include <span>
|
|
17
17
|
#include <string>
|
|
18
18
|
|
|
19
19
|
namespace momentum {
|
|
@@ -36,7 +36,7 @@ namespace momentum {
|
|
|
36
36
|
/// @param[in] jsonBuffer Buffer containing the legacy JSON data
|
|
37
37
|
/// @return The loaded Character object
|
|
38
38
|
/// @throws std::runtime_error if the buffer cannot be parsed
|
|
39
|
-
[[nodiscard]] Character loadCharacterFromLegacyJsonBuffer(
|
|
39
|
+
[[nodiscard]] Character loadCharacterFromLegacyJsonBuffer(std::span<const std::byte> jsonBuffer);
|
|
40
40
|
|
|
41
41
|
/// Loads a Character from a legacy JSON string.
|
|
42
42
|
///
|
|
@@ -51,6 +51,6 @@ namespace momentum {
|
|
|
51
51
|
/// @return int The main subject's index in the input vector. If no main subject found, -1 is
|
|
52
52
|
/// returned.
|
|
53
53
|
/// @note This function is exposed mainly for unit tests.
|
|
54
|
-
[[nodiscard]] int findMainSubjectIndex(
|
|
54
|
+
[[nodiscard]] int findMainSubjectIndex(std::span<const MarkerSequence> markerSequences);
|
|
55
55
|
|
|
56
56
|
} // namespace momentum
|
|
@@ -20,7 +20,7 @@ namespace momentum {
|
|
|
20
20
|
/// @param character Character definition for parameter mapping
|
|
21
21
|
void saveMmo(
|
|
22
22
|
const std::string& filename,
|
|
23
|
-
|
|
23
|
+
std::span<const VectorXf> poses,
|
|
24
24
|
const VectorXf& scale,
|
|
25
25
|
const Character& character);
|
|
26
26
|
|
|
@@ -38,7 +38,7 @@ void saveMmo(
|
|
|
38
38
|
const VectorXf& scale,
|
|
39
39
|
const Character& character,
|
|
40
40
|
const MatrixXf& additionalParameters = MatrixXf(),
|
|
41
|
-
|
|
41
|
+
std::span<const std::string> additionalParameterNames = std::vector<std::string>());
|
|
42
42
|
|
|
43
43
|
/// Save motion data with explicit parameter and joint names
|
|
44
44
|
///
|
|
@@ -51,8 +51,8 @@ void saveMmo(
|
|
|
51
51
|
const std::string& filename,
|
|
52
52
|
const MatrixXf& poses,
|
|
53
53
|
const VectorXf& scale,
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
std::span<const std::string> parameterNames,
|
|
55
|
+
std::span<const std::string> jointNames);
|
|
56
56
|
|
|
57
57
|
/// Load motion data from file
|
|
58
58
|
///
|
|
@@ -77,7 +77,7 @@ std::tuple<MatrixXf, VectorXf> loadMmo(const std::string& filename, const Charac
|
|
|
77
77
|
/// @return Tuple of (auxiliary data matrix, auxiliary parameter names without underscores)
|
|
78
78
|
std::tuple<MatrixXf, std::vector<std::string>> getAuxiliaryDataFromMotion(
|
|
79
79
|
const MatrixXf& poses,
|
|
80
|
-
|
|
80
|
+
std::span<const std::string> parameterNames);
|
|
81
81
|
|
|
82
82
|
/// Map motion data from one parameter space to character parameter space
|
|
83
83
|
///
|
|
@@ -90,8 +90,8 @@ std::tuple<MatrixXf, std::vector<std::string>> getAuxiliaryDataFromMotion(
|
|
|
90
90
|
std::tuple<MatrixXf, VectorXf> mapMotionToCharacter(
|
|
91
91
|
const MatrixXf& poses,
|
|
92
92
|
const VectorXf& offsets,
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
std::span<const std::string> parameterNames,
|
|
94
|
+
std::span<const std::string> jointNames,
|
|
95
95
|
const Character& character);
|
|
96
96
|
|
|
97
97
|
} // namespace momentum
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
#include <momentum/character/locator.h>
|
|
12
12
|
|
|
13
13
|
#include <momentum/common/filesystem.h>
|
|
14
|
-
#include <
|
|
14
|
+
#include <span>
|
|
15
15
|
|
|
16
16
|
namespace momentum {
|
|
17
17
|
|
|
@@ -28,7 +28,7 @@ LocatorList loadLocators(
|
|
|
28
28
|
const ParameterTransform& parameterTransform);
|
|
29
29
|
|
|
30
30
|
LocatorList loadLocatorsFromBuffer(
|
|
31
|
-
|
|
31
|
+
std::span<const std::byte> rawData,
|
|
32
32
|
const Skeleton& skeleton,
|
|
33
33
|
const ParameterTransform& parameterTransform);
|
|
34
34
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
#include <momentum/math/fwd.h>
|
|
11
11
|
|
|
12
|
-
#include <
|
|
12
|
+
#include <span>
|
|
13
13
|
|
|
14
14
|
#include <istream>
|
|
15
15
|
|
|
@@ -19,7 +19,7 @@ std::shared_ptr<const Mppca> loadMppca(std::istream& inputStream);
|
|
|
19
19
|
|
|
20
20
|
std::shared_ptr<const Mppca> loadMppca(const std::string& name);
|
|
21
21
|
|
|
22
|
-
std::shared_ptr<const Mppca> loadMppca(
|
|
22
|
+
std::shared_ptr<const Mppca> loadMppca(std::span<const unsigned char> posePriorDataRaw);
|
|
23
23
|
|
|
24
24
|
void saveMppca(const Mppca& mppca, const std::string& name);
|
|
25
25
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
#include <momentum/character/parameter_transform.h>
|
|
12
12
|
#include <momentum/common/filesystem.h>
|
|
13
13
|
|
|
14
|
-
#include <
|
|
14
|
+
#include <span>
|
|
15
15
|
|
|
16
16
|
#include <string>
|
|
17
17
|
#include <unordered_map>
|
|
@@ -21,7 +21,7 @@ namespace momentum {
|
|
|
21
21
|
std::unordered_map<std::string, std::string> loadMomentumModel(const filesystem::path& filename);
|
|
22
22
|
|
|
23
23
|
std::unordered_map<std::string, std::string> loadMomentumModelFromBuffer(
|
|
24
|
-
|
|
24
|
+
std::span<const std::byte> buffer);
|
|
25
25
|
|
|
26
26
|
ParameterTransform parseParameterTransform(const std::string& data, const Skeleton& skeleton);
|
|
27
27
|
|
|
@@ -35,7 +35,7 @@ std::tuple<ParameterTransform, ParameterLimits> loadModelDefinition(
|
|
|
35
35
|
const Skeleton& skeleton);
|
|
36
36
|
|
|
37
37
|
std::tuple<ParameterTransform, ParameterLimits> loadModelDefinition(
|
|
38
|
-
|
|
38
|
+
std::span<const std::byte> rawData,
|
|
39
39
|
const Skeleton& skeleton);
|
|
40
40
|
|
|
41
41
|
} // namespace momentum
|
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
#include <momentum/common/filesystem.h>
|
|
12
12
|
#include <momentum/math/types.h>
|
|
13
13
|
|
|
14
|
-
#include <
|
|
14
|
+
#include <span>
|
|
15
15
|
|
|
16
16
|
namespace momentum {
|
|
17
17
|
|
|
18
18
|
/// Loads a character from a URDF file.
|
|
19
19
|
template <typename T = float>
|
|
20
|
-
|
|
20
|
+
CharacterT<T> loadUrdfCharacter(const filesystem::path& filepath);
|
|
21
21
|
|
|
22
22
|
/// Loads a character from a URDF file using the provided byte data.
|
|
23
23
|
template <typename T = float>
|
|
24
|
-
[[nodiscard]] CharacterT<T> loadUrdfCharacter(
|
|
24
|
+
[[nodiscard]] CharacterT<T> loadUrdfCharacter(std::span<const std::byte> bytes);
|
|
25
25
|
|
|
26
26
|
} // namespace momentum
|
include/momentum/io/usd/usd_io.h
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
#include <momentum/common/filesystem.h>
|
|
12
12
|
#include <momentum/math/types.h>
|
|
13
13
|
|
|
14
|
-
#include <
|
|
14
|
+
#include <span>
|
|
15
15
|
|
|
16
16
|
namespace momentum {
|
|
17
17
|
|
|
@@ -25,7 +25,7 @@ Character loadUsdCharacter(const filesystem::path& inputPath);
|
|
|
25
25
|
///
|
|
26
26
|
/// @param[in] inputSpan The buffer containing the USD character data.
|
|
27
27
|
/// @return The loaded Character object.
|
|
28
|
-
Character loadUsdCharacter(
|
|
28
|
+
Character loadUsdCharacter(std::span<const std::byte> inputSpan);
|
|
29
29
|
|
|
30
30
|
/// Save a character to a USD file.
|
|
31
31
|
///
|
|
@@ -55,7 +55,7 @@ void saveMotion(
|
|
|
55
55
|
const momentum::Character& character,
|
|
56
56
|
const momentum::ModelParameters& identity,
|
|
57
57
|
Eigen::MatrixXf& finalMotion,
|
|
58
|
-
|
|
58
|
+
std::span<const std::vector<momentum::Marker>> markerData,
|
|
59
59
|
double fps,
|
|
60
60
|
bool saveMarkerMesh = true);
|
|
61
61
|
|
|
@@ -91,7 +91,7 @@ struct RefineConfig : public TrackingConfig {
|
|
|
91
91
|
/// @return The solved motion. It has the same length as markerData. It repeats the same solved pose
|
|
92
92
|
/// within a frame stride.
|
|
93
93
|
Eigen::MatrixXf trackSequence(
|
|
94
|
-
|
|
94
|
+
std::span<const std::vector<momentum::Marker>> markerData,
|
|
95
95
|
const momentum::Character& character,
|
|
96
96
|
const momentum::ParameterSet& globalParams,
|
|
97
97
|
const Eigen::MatrixXf& initialMotion,
|
|
@@ -119,7 +119,7 @@ Eigen::MatrixXf trackSequence(
|
|
|
119
119
|
/// @return The solved motion. It has the same length as markerData. It repeats the same solved pose
|
|
120
120
|
/// within a frame stride.
|
|
121
121
|
Eigen::MatrixXf trackSequence(
|
|
122
|
-
|
|
122
|
+
std::span<const std::vector<momentum::Marker>> markerData,
|
|
123
123
|
const momentum::Character& character,
|
|
124
124
|
const momentum::ParameterSet& globalParams,
|
|
125
125
|
const Eigen::MatrixXf& initialMotion,
|
|
@@ -141,7 +141,7 @@ Eigen::MatrixXf trackSequence(
|
|
|
141
141
|
/// @return The solved motion. It has the same length as markerData. It repeats the same solved pose
|
|
142
142
|
/// within a frame stride.
|
|
143
143
|
Eigen::MatrixXf trackPosesPerframe(
|
|
144
|
-
|
|
144
|
+
std::span<const std::vector<momentum::Marker>> markerData,
|
|
145
145
|
const momentum::Character& character,
|
|
146
146
|
const momentum::ModelParameters& globalParams,
|
|
147
147
|
const TrackingConfig& config,
|
|
@@ -159,7 +159,7 @@ Eigen::MatrixXf trackPosesPerframe(
|
|
|
159
159
|
/// @return The solved motion. It has the same length as markerData. It repeats the same solved pose
|
|
160
160
|
/// within a frame stride.
|
|
161
161
|
Eigen::MatrixXf trackPosesForFrames(
|
|
162
|
-
|
|
162
|
+
std::span<const std::vector<momentum::Marker>> markerData,
|
|
163
163
|
const momentum::Character& character,
|
|
164
164
|
const Eigen::MatrixXf& initialMotion,
|
|
165
165
|
const TrackingConfig& config,
|
|
@@ -174,7 +174,7 @@ Eigen::MatrixXf trackPosesForFrames(
|
|
|
174
174
|
/// @param[in,out] identity Initial identity parameters that get updated in return. It could also
|
|
175
175
|
/// hold the pose of the first frame for better initialization for tracking later.
|
|
176
176
|
void calibrateModel(
|
|
177
|
-
|
|
177
|
+
std::span<const std::vector<momentum::Marker>> markerData,
|
|
178
178
|
const CalibrationConfig& config,
|
|
179
179
|
momentum::Character& character,
|
|
180
180
|
momentum::ModelParameters& identity);
|
|
@@ -188,13 +188,13 @@ void calibrateModel(
|
|
|
188
188
|
/// updated in return. We overwrite the locators in the input character so we don't have to
|
|
189
189
|
/// duplicate the character object inside the function.
|
|
190
190
|
void calibrateLocators(
|
|
191
|
-
|
|
191
|
+
std::span<const std::vector<momentum::Marker>> markerData,
|
|
192
192
|
const CalibrationConfig& config,
|
|
193
193
|
const momentum::ModelParameters& identity,
|
|
194
194
|
momentum::Character& character);
|
|
195
195
|
|
|
196
196
|
Eigen::MatrixXf refineMotion(
|
|
197
|
-
|
|
197
|
+
std::span<const std::vector<momentum::Marker>> markerData,
|
|
198
198
|
const Eigen::MatrixXf& motion,
|
|
199
199
|
const RefineConfig& config,
|
|
200
200
|
momentum::Character& character);
|
|
@@ -206,7 +206,7 @@ Eigen::MatrixXf refineMotion(
|
|
|
206
206
|
/// @param[in] character Character definition
|
|
207
207
|
/// @return average per frame error and max marker error
|
|
208
208
|
std::pair<float, float> getLocatorError(
|
|
209
|
-
|
|
209
|
+
std::span<const std::vector<momentum::Marker>> markerData,
|
|
210
210
|
const Eigen::MatrixXf& motion,
|
|
211
211
|
momentum::Character& character);
|
|
212
212
|
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
namespace momentum {
|
|
17
17
|
|
|
18
18
|
std::vector<std::vector<momentum::PositionData>> createConstraintData(
|
|
19
|
-
|
|
19
|
+
std::span<const std::vector<momentum::Marker>> markerData,
|
|
20
20
|
const momentum::LocatorList& locators);
|
|
21
21
|
|
|
22
22
|
std::vector<std::vector<momentum::SkinnedLocatorConstraint>> createSkinnedConstraintData(
|
|
23
|
-
|
|
23
|
+
std::span<const std::vector<momentum::Marker>> markerData,
|
|
24
24
|
const momentum::SkinnedLocatorList& locators);
|
|
25
25
|
|
|
26
26
|
// TODO: remove the one in momentum
|
include/momentum/math/mppca.h
CHANGED