group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
GripPose.hpp
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <array>
7#include <cstddef>
8#include <glm/glm.hpp>
9#include <glm/gtc/quaternion.hpp>
10#include <string>
11
15inline constexpr std::size_t kGripPoseBonesPerFinger = 4;
16
18inline constexpr std::size_t kGripPoseFingerCount = 5;
19
22
42{
44 std::array<glm::vec2, kGripPoseJointCount> jointAngles{};
45
49 [[nodiscard]] static constexpr std::size_t index(std::size_t finger, std::size_t joint) noexcept
50 {
51 return finger * kGripPoseBonesPerFinger + joint;
52 }
53};
54
63
80bool loadWeaponGripPose(const std::string& path, WeaponGripPose& out);
81
88bool saveWeaponGripPoseToml(const std::string& path,
89 const WeaponGripPose& pose,
90 bool rightHandValid,
91 bool leftHandValid);
constexpr std::size_t kGripPoseBonesPerFinger
Number of bones authored per finger.
Definition GripPose.hpp:15
bool loadWeaponGripPose(const std::string &path, WeaponGripPose &out)
Load a weapon grip pose from a TOML side-table.
Definition GripPose.cpp:92
bool saveWeaponGripPoseToml(const std::string &path, const WeaponGripPose &pose, bool rightHandValid, bool leftHandValid)
Save a grip pose back to a TOML file.
Definition GripPose.cpp:115
constexpr std::size_t kGripPoseFingerCount
Number of fingers per hand: thumb, index, middle, ring, pinky.
Definition GripPose.hpp:18
constexpr std::size_t kGripPoseJointCount
Total joint count per hand grip pose (5 fingers × 4 joints = 20 joints).
Definition GripPose.hpp:21
Authored local-space finger angles describing how a hand wraps a weapon.
Definition GripPose.hpp:42
std::array< glm::vec2, kGripPoseJointCount > jointAngles
(pitch, yaw) in degrees per joint. .x = pitch (curl), .y = yaw (splay).
Definition GripPose.hpp:44
static constexpr std::size_t index(std::size_t finger, std::size_t joint) noexcept
Helper: index into jointAngles for (finger, joint).
Definition GripPose.hpp:49
Per-weapon pair of hand grip poses.
Definition GripPose.hpp:57
bool leftHandValid
Definition GripPose.hpp:61
GripPose leftHand
Definition GripPose.hpp:59
GripPose rightHand
Definition GripPose.hpp:58
bool rightHandValid
Definition GripPose.hpp:60