载入中...
搜索中...
未找到
AnimConstraintStack.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include <vector>
6
7namespace eve::animation {
8
9class AnimPose;
10class AnimSkeleton;
11
18public:
20 explicit AnimConstraintStack(AnimSkeleton* skeleton);
25
27 void setSkeleton(AnimSkeleton* skeleton);
33 AnimSkeleton* getSkeleton() const { return skeleton_; }
34
36 void clear() { constraints_.clear(); }
38 int getCount() const { return static_cast<int>(constraints_.size()); }
40 void addAim(int bone, float targetX, float targetY, float targetZ, float weight = 1.f);
42 void addTwoBoneIK(int root, int mid, int tip, float targetX, float targetY, float targetZ,
43 float weight = 1.f);
45 void addFootIK(int hip, int knee, int foot, float groundY, float normalX = 0.f, float normalY = 1.f,
46 float normalZ = 0.f, float soleOffset = 0.f, float weight = 1.f);
48 void apply(AnimPose* pose) const;
49
50private:
51 enum class Type { Aim, TwoBone, Foot };
52 struct Constraint {
53 Type type = Type::Aim;
54 int a = -1, b = -1, c = -1;
55 float x = 0.f, y = 0.f, z = 0.f;
56 float nx = 0.f, ny = 1.f, nz = 0.f;
57 float offset = 0.f, weight = 1.f;
58 };
59 AnimSkeleton* skeleton_ = nullptr;
60 std::vector<Constraint> constraints_;
61};
62
63} // namespace eve::animation
float y
Definition AnimClip.cpp:738
float x
Definition AnimClip.cpp:738
float z
Definition AnimClip.cpp:738
int tip
Definition AnimSmr.cpp:121
int root
Definition AnimSmr.cpp:119
int mid
Definition AnimSmr.cpp:120
eve::EntitySpatialPose pose
float nx
float nz
float ny
#define EVENGINE_API_WORLD
Definition Export.h:109
std::int32_t c
size_t offset
std::uint32_t bone
MeleePoint3 b
Definition MeleeHit.cpp:41
MeleePoint3 a
Definition MeleeHit.cpp:40
float targetX
Ordered main-thread post-process stack with aim, limb IK and foot planting.
AnimConstraintStack & operator=(const AnimConstraintStack &)=default
Operator =.
int getCount() const
Return constraint count.
void clear()
Remove all constraints.
AnimConstraintStack(const AnimConstraintStack &)=default
Anim constraint stack.
AnimSkeleton * getSkeleton() const
Return the borrowed skeleton, or null after explicit unbinding. @ownership Borrowed; ownership remain...
Evaluated local (and optional world) pose for an AnimSkeleton. Script type: AnimPose.
Definition AnimPose.h:17
3D bone hierarchy + bind-pose local TRS for skeletal animation. Independent of ik::Skeleton3D (FABRIK...