nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
moves.h
Go to the documentation of this file.
1#ifndef NANOMMO_CLIENT_MOVES_H_
2#define NANOMMO_CLIENT_MOVES_H_
3
4#include <raylib.h>
5
6#include <array>
7
8#include "content/skills.pb.h"
9
10namespace nanommo {
11
12/// Each joint's bone in the rig, in the order of the joints.
13inline constexpr std::array<const char*, 13> kJointBones = {
14 "Hips", "Spine", "Spine2", "Head", "RightArm",
15 "RightForeArm", "RightHand", "LeftArm", "LeftForeArm", "RightUpLeg",
16 "RightLeg", "LeftUpLeg", "LeftLeg"};
17
18/// Where a model's bones are, by joint, or -1 for one it doesn't have.
19using Joints = std::array<int, kJointBones.size()>;
20
21/// A move at one moment: each joint's turn, and how far the whole body's
22/// moved, in metres.
23struct Bend {
24 std::array<Quaternion, kJointBones.size()> turns;
25 Vector3 shift{0.0f, 0.0f, 0.0f};
26};
27
28Joints FindJoints(const Model& model);
29
30/// The move, `ms` into it, between the keys either side.
31Bend BendAt(const skills::Move& move, float ms);
32
33/// Turns the bones of a pose, as the skeleton's bones, by the bend: each joint
34/// takes the bones below it round with it. A metre is this many of the
35/// model's units.
36void Turn(const Bend& bend, const Joints& joints, float metre,
37 const ModelSkeleton& skeleton, Transform* pose);
38
39/// Turns a model's bones, as a clip posed them, by the bend, and works out
40/// the matrices the GPU skins it with.
41void Apply(const Bend& bend, const Joints& joints, float metre, Model& model);
42
43} // namespace nanommo
44
45#endif // NANOMMO_CLIENT_MOVES_H_
Definition chat.cc:9
void Turn(const Bend &bend, const Joints &joints, float metre, const ModelSkeleton &skeleton, Transform *pose)
Definition moves.cc:76
void Apply(const Bend &bend, const Joints &joints, float metre, Model &model)
Definition moves.cc:107
constexpr std::array< const char *, 13 > kJointBones
Each joint's bone in the rig, in the order of the joints.
Definition moves.h:13
Joints FindJoints(const Model &model)
Definition moves.cc:34
Bend BendAt(const skills::Move &move, float ms)
The move, ms into it, between the keys either side.
Definition moves.cc:49
std::array< int, kJointBones.size()> Joints
Where a model's bones are, by joint, or -1 for one it doesn't have.
Definition moves.h:19
std::array< Quaternion, kJointBones.size()> turns
Definition moves.h:24
Vector3 shift
Definition moves.h:25