载入中...
搜索中...
未找到
AnimPose.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
6
7#include <vector>
8
9namespace eve::animation {
10
11class AnimSkeleton;
12
18public:
20 AnimPose() = default;
22 explicit AnimPose(int boneCount);
24 ~AnimPose() = default;
25
26 AnimPose(const AnimPose &) = delete;
27 AnimPose &operator=(const AnimPose &) = delete;
29 AnimPose(AnimPose &&) noexcept = default;
31 AnimPose &operator=(AnimPose &&) noexcept = default;
32
34 void resize(int boneCount);
36 int getBoneCount() const { return static_cast<int>(locals_.size()); }
37
39 void copyFrom(const AnimPose *other);
41 void blendFrom(const AnimPose *a, const AnimPose *b, float t);
42
44 void setLocalPosition(int boneIndex, float x, float y, float z);
46 void setLocalRotation(int boneIndex, float x, float y, float z, float w);
48 void setLocalScale(int boneIndex, float x, float y, float z);
49
51 float getLocalPositionX(int boneIndex) const;
53 float getLocalPositionY(int boneIndex) const;
55 float getLocalPositionZ(int boneIndex) const;
57 float getLocalRotationX(int boneIndex) const;
59 float getLocalRotationY(int boneIndex) const;
61 float getLocalRotationZ(int boneIndex) const;
63 float getLocalRotationW(int boneIndex) const;
65 float getLocalScaleX(int boneIndex) const;
67 float getLocalScaleY(int boneIndex) const;
69 float getLocalScaleZ(int boneIndex) const;
70
75 void computeWorld(const AnimSkeleton* skeleton);
76
90 bool aimBone(const AnimSkeleton* skeleton, int boneIndex, float targetX, float targetY, float targetZ,
91 float weight = 1.f);
92
114 bool solveTwoBoneIK(const AnimSkeleton* skeleton, int rootBone, int midBone, int tipBone, float targetX,
115 float targetY, float targetZ, float weight = 1.f);
116
118 float getWorldPositionX(int boneIndex) const;
120 float getWorldPositionY(int boneIndex) const;
122 float getWorldPositionZ(int boneIndex) const;
124 float getWorldRotationX(int boneIndex) const;
126 float getWorldRotationY(int boneIndex) const;
128 float getWorldRotationZ(int boneIndex) const;
130 float getWorldRotationW(int boneIndex) const;
131
136 float getWorldMatrixElement(int boneIndex, int elementIndex) const;
138 void getWorldMatrix(int boneIndex, float *out16) const;
139
141 TransformTRS &local(int boneIndex);
143 const TransformTRS &local(int boneIndex) const;
145 const TransformTRS &world(int boneIndex) const;
146
147private:
148 void requireBone(int boneIndex) const;
149 bool solveTwoBoneIKPoleImpl(const AnimSkeleton* skeleton, int rootBone, int midBone, int tipBone, float targetX,
150 float targetY, float targetZ, float poleX, float poleY, float poleZ, float weight);
151
152 std::vector<TransformTRS> locals_;
153 std::vector<TransformTRS> worlds_;
154};
155
156} // namespace eve::animation
float w
Definition AnimClip.cpp:738
float y
Definition AnimClip.cpp:738
float x
Definition AnimClip.cpp:738
float z
Definition AnimClip.cpp:738
#define EVENGINE_API_WORLD
Definition Export.h:109
std::string local
MeleePoint3 b
Definition MeleeHit.cpp:41
MeleePoint3 a
Definition MeleeHit.cpp:40
World3D * world
float t
float targetX
Evaluated local (and optional world) pose for an AnimSkeleton. Script type: AnimPose.
Definition AnimPose.h:17
AnimPose()=default
Anim pose.
AnimPose(const AnimPose &)=delete
~AnimPose()=default
Anim pose.
AnimPose(AnimPose &&) noexcept=default
Anim pose.
AnimPose & operator=(const AnimPose &)=delete
3D bone hierarchy + bind-pose local TRS for skeletal animation. Independent of ik::Skeleton3D (FABRIK...
Local TRS used by skeletal animation (quaternion xyzw).
Definition AnimMath.h:9