-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathHandPoseData.h
More file actions
113 lines (98 loc) · 3.59 KB
/
Copy pathHandPoseData.h
File metadata and controls
113 lines (98 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#pragma once
#include <array>
#include <cstdint>
#include "RE/NetImmerse/NiPoint.h"
namespace frik
{
// Pose values for a single finger.
// Flex: 0.0 = bent/closed, 1.0 = straight/open.
// Splay: positive/negative Y-axis rotation on the proximal joint (side-to-side).
struct FingerPose
{
float prox = 0.0f; // proximal (MCP / knuckle) joint flex
float mid = 0.0f; // middle (PIP) joint flex
float dist = 0.0f; // distal (DIP / fingertip) joint flex
float splay = 0.0f; // lateral abduction/adduction of the proximal joint
constexpr FingerPose() noexcept = default;
constexpr FingerPose(const float proxValue, const float midValue, const float distValue, const float splayValue = 0.0f) noexcept
: prox(proxValue),
mid(midValue),
dist(distValue),
splay(splayValue)
{}
};
}
namespace frik::skeleton::data
{
enum class HandPoseKind : std::uint8_t
{
Unset,
Custom,
Open,
Pointing,
HoldingWeapon,
OffhandGrip,
Attaboy,
ThumbsUp,
};
}
namespace frik
{
// Full hand pose: all 5 fingers, each with flex + splay, plus optional palm motion.
struct HandFingersPose
{
FingerPose thumb;
FingerPose index;
FingerPose middle;
FingerPose ring;
FingerPose pinky;
float palmPitch = 0.0f; // wrist flexion (+) / extension (-), degrees
float palmYaw = 0.0f; // radial (+) / ulnar (-) deviation, degrees
skeleton::data::HandPoseKind kind = skeleton::data::HandPoseKind::Custom;
constexpr HandFingersPose() noexcept = default;
constexpr HandFingersPose(const FingerPose thumbPose, const FingerPose indexPose, const FingerPose middlePose, const FingerPose ringPose, const FingerPose pinkyPose,
const float palmPitch = 0.0f, const float palmYaw = 0.0f, const skeleton::data::HandPoseKind kindValue = skeleton::data::HandPoseKind::Custom) noexcept
: thumb(thumbPose),
index(indexPose),
middle(middlePose),
ring(ringPose),
pinky(pinkyPose),
palmPitch(palmPitch),
palmYaw(palmYaw),
kind(kindValue)
{}
/** Return a mutable finger pose by zero-based finger index. */
FingerPose& getFingerAt(int fingerIndex) noexcept;
/** Return a read-only finger pose by zero-based finger index. */
const FingerPose& getFingerAt(int fingerIndex) const noexcept;
/** Return the flat flex value for one of the 15 finger bones. */
float getFlexAt(int boneIndex) const noexcept;
};
}
namespace frik::skeleton::data
{
using RotationData = std::array<float, 12>;
enum class HandPoseOverrideTagState : std::uint8_t
{
None,
Active,
Overridden,
};
struct HandBonePoseData
{
const char* boneName;
RotationData closedRotation;
RotationData openRotation;
RE::NiPoint3 openTranslation;
RE::NiPoint3 openTranslationInPowerArmor;
};
const HandFingersPose& getOpenPose() noexcept;
const HandFingersPose& getGunGripPose() noexcept;
const HandFingersPose& getMeleeGripPose() noexcept;
const HandFingersPose& getPointingPose() noexcept;
const HandFingersPose& getAttaboyPose() noexcept;
const HandFingersPose& getOffhandWeaponGripPose() noexcept;
const HandFingersPose& getThumbsUpPose() noexcept;
const HandFingersPose& getFistPose() noexcept;
const std::array<HandBonePoseData, 30>& getHandBoneData() noexcept;
}