载入中...
搜索中...
未找到
AnimPose.h
浏览该文件的文档.
1#pragma once
2
4
5#include <vector>
6
7namespace eve::animation {
8
9class AnimSkeleton;
10
15class AnimPose {
16public:
17 AnimPose() = default;
18 explicit AnimPose(int boneCount);
19 ~AnimPose() = default;
20
21 AnimPose(const AnimPose &) = delete;
22 AnimPose &operator=(const AnimPose &) = delete;
23
24 void resize(int boneCount);
25 int getBoneCount() const { return static_cast<int>(locals_.size()); }
26
27 void copyFrom(const AnimPose *other);
28 void blendFrom(const AnimPose *a, const AnimPose *b, float t);
29
30 void setLocalPosition(int boneIndex, float x, float y, float z);
31 void setLocalRotation(int boneIndex, float x, float y, float z, float w);
32 void setLocalScale(int boneIndex, float x, float y, float z);
33
34 float getLocalPositionX(int boneIndex) const;
35 float getLocalPositionY(int boneIndex) const;
36 float getLocalPositionZ(int boneIndex) const;
37 float getLocalRotationX(int boneIndex) const;
38 float getLocalRotationY(int boneIndex) const;
39 float getLocalRotationZ(int boneIndex) const;
40 float getLocalRotationW(int boneIndex) const;
41 float getLocalScaleX(int boneIndex) const;
42 float getLocalScaleY(int boneIndex) const;
43 float getLocalScaleZ(int boneIndex) const;
44
49 void computeWorld(const AnimSkeleton *skeleton);
50
51 float getWorldPositionX(int boneIndex) const;
52 float getWorldPositionY(int boneIndex) const;
53 float getWorldPositionZ(int boneIndex) const;
54 float getWorldRotationX(int boneIndex) const;
55 float getWorldRotationY(int boneIndex) const;
56 float getWorldRotationZ(int boneIndex) const;
57 float getWorldRotationW(int boneIndex) const;
58
63 float getWorldMatrixElement(int boneIndex, int elementIndex) const;
65 void getWorldMatrix(int boneIndex, float *out16) const;
66
67 TransformTRS &local(int boneIndex);
68 const TransformTRS &local(int boneIndex) const;
69 const TransformTRS &world(int boneIndex) const;
70
71private:
72 void requireBone(int boneIndex) const;
73
74 std::vector<TransformTRS> locals_;
75 std::vector<TransformTRS> worlds_;
76};
77
78} // namespace eve::animation
int y
Definition Grass.cpp:135
int z
Definition Grass.cpp:135
int x
Definition Grass.cpp:135
int w
uint32_t a
uint32_t b
Evaluated local (and optional world) pose for an AnimSkeleton. Script type: AnimPose.
Definition AnimPose.h:15
float getLocalRotationX(int boneIndex) const
Definition AnimPose.cpp:122
float getWorldRotationX(int boneIndex) const
Definition AnimPose.cpp:180
float getWorldPositionZ(int boneIndex) const
Definition AnimPose.cpp:176
float getLocalScaleZ(int boneIndex) const
Definition AnimPose.cpp:146
AnimPose(const AnimPose &)=delete
float getLocalPositionZ(int boneIndex) const
Definition AnimPose.cpp:118
void blendFrom(const AnimPose *a, const AnimPose *b, float t)
Definition AnimPose.cpp:62
int getBoneCount() const
Definition AnimPose.h:25
float getWorldMatrixElement(int boneIndex, int elementIndex) const
Column-major 4x4 world matrix for boneIndex after computeWorld(). elementIndex in [0,...
Definition AnimPose.cpp:202
float getLocalPositionX(int boneIndex) const
Definition AnimPose.cpp:110
float getLocalRotationW(int boneIndex) const
Definition AnimPose.cpp:134
float getWorldPositionX(int boneIndex) const
Definition AnimPose.cpp:168
AnimPose & operator=(const AnimPose &)=delete
void setLocalScale(int boneIndex, float x, float y, float z)
Definition AnimPose.cpp:102
const TransformTRS & world(int boneIndex) const
Definition AnimPose.cpp:197
float getLocalScaleX(int boneIndex) const
Definition AnimPose.cpp:138
float getWorldPositionY(int boneIndex) const
Definition AnimPose.cpp:172
void getWorldMatrix(int boneIndex, float *out16) const
Write 16 floats (column-major) into out16 (must not be null).
Definition AnimPose.cpp:211
void setLocalRotation(int boneIndex, float x, float y, float z, float w)
Definition AnimPose.cpp:92
float getWorldRotationW(int boneIndex) const
Definition AnimPose.cpp:192
float getWorldRotationZ(int boneIndex) const
Definition AnimPose.cpp:188
float getWorldRotationY(int boneIndex) const
Definition AnimPose.cpp:184
float getLocalScaleY(int boneIndex) const
Definition AnimPose.cpp:142
TransformTRS & local(int boneIndex)
Definition AnimPose.cpp:74
float getLocalRotationZ(int boneIndex) const
Definition AnimPose.cpp:130
void setLocalPosition(int boneIndex, float x, float y, float z)
Definition AnimPose.cpp:84
float getLocalPositionY(int boneIndex) const
Definition AnimPose.cpp:114
void copyFrom(const AnimPose *other)
Definition AnimPose.cpp:56
float getLocalRotationY(int boneIndex) const
Definition AnimPose.cpp:126
void computeWorld(const AnimSkeleton *skeleton)
Compute world transforms from local pose + skeleton hierarchy. World values readable via getWorld* af...
Definition AnimPose.cpp:151
void resize(int boneCount)
Definition AnimPose.cpp:44
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