gdk-graphics 0a0aef92e917cfbac53dffbc32c295e4de914093
Loading...
Searching...
No Matches
ik.h
1// © Joseph Cameron - MIT License
2
3#ifndef GDK_GRAPHICS_EXT_ANIMATION_IK_H
4#define GDK_GRAPHICS_EXT_ANIMATION_IK_H
5
6#include <gdk/graphics/ext/animation/skeleton.h>
7
8#include <functional>
9#include <vector>
10#include <span>
11
12namespace gdk::graphics::animation {
13 [[nodiscard]] pose with_limb_reaching(const skeleton &aSkeleton, const pose &aPose,
14 const std::size_t aUpper, const vector3_type &aTarget, const vector3_type &aPoleDirection);
15
16 [[nodiscard]] pose with_limb_reaching_in_world(const skeleton &aSkeleton, const pose &aPose,
17 const std::size_t aUpper, const vector3_type &aWorldTarget,
18 const vector3_type &aWorldPoleDirection, const vector3_type &aCharacterPosition,
19 const quaternion_type &aCharacterRotation);
20
21 struct foot_arc final {
22 float lowest = 0;
23 float highest = 0;
24
25 [[nodiscard]] float range() const { return highest - lowest; }
26 };
27
28 [[nodiscard]] foot_arc measure_foot_arc(const skeleton &aSkeleton, const clip &aClip,
29 const std::size_t aFoot);
30
31 [[nodiscard]] pose with_bone_oriented(const skeleton &aSkeleton, const pose &aPose,
32 const std::size_t aBone, const quaternion_type &aWorldRotation);
33
34 [[nodiscard]] pose with_bone_oriented_in_world(const skeleton &aSkeleton, const pose &aPose,
35 const std::size_t aBone, const quaternion_type &aWorldRotation,
36 const quaternion_type &aCharacterRotation);
37
38 [[nodiscard]] float stance_weight(const foot_arc &aArc, const float aFootHeight,
39 const float aBand = 0.25f);
40
41 [[nodiscard]] float pelvis_lift(std::span<const matrix4x4_type> aWorld,
42 std::span<const std::size_t> aFeet, const vector3_type &aCharacterPosition,
43 const quaternion_type &aCharacterRotation,
44 const std::function<float(float, float)> &aGroundHeight);
45}
46
47#endif
a looping sequence of keyframed poses
Definition skeleton.h:86
one bone rotation per bone, relative to its parent.
Definition skeleton.h:57
a chain of bones in bind pose.
Definition skeleton.h:16