ANIMATION: added more parameters and tweaked models
parent
445b960d00
commit
0768606d5c
Binary file not shown.
Binary file not shown.
|
@ -15,6 +15,7 @@ namespace animation {
|
|||
|
||||
static const SkeletonAttributeMeta BirdSkeletonAttributeMetaArray[] = {
|
||||
SKELETONATTRIBUTEBIRD(scaler),
|
||||
SKELETONATTRIBUTEBIRD(headScale),
|
||||
SKELETONATTRIBUTEBIRD(origin),
|
||||
SKELETONATTRIBUTEBIRD(invisibleLegHeight),
|
||||
SKELETONATTRIBUTEBIRD(headHeight),
|
||||
|
@ -22,6 +23,7 @@ static const SkeletonAttributeMeta BirdSkeletonAttributeMetaArray[] = {
|
|||
SKELETONATTRIBUTEBIRD(footRight),
|
||||
SKELETONATTRIBUTEBIRD(wingHeight),
|
||||
SKELETONATTRIBUTEBIRD(wingRight),
|
||||
SKELETONATTRIBUTEBIRD(bodyHeight),
|
||||
SKELETONATTRIBUTE_END
|
||||
};
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ struct BirdSkeletonAttribute : public SkeletonAttribute {
|
|||
BirdSkeletonAttribute();
|
||||
|
||||
float scaler = 0.5f;
|
||||
float headScale = 1.0f;
|
||||
float origin = 0.0f;
|
||||
float footHeight = 3.0f;
|
||||
float footRight = -3.2f;
|
||||
|
@ -26,9 +27,11 @@ struct BirdSkeletonAttribute : public SkeletonAttribute {
|
|||
float wingRight = -4.2f;
|
||||
float invisibleLegHeight = 0.5f;
|
||||
float headHeight = 9.0f;
|
||||
float bodyHeight = 3.0f;
|
||||
|
||||
// not exposed but calculated
|
||||
float footY = 0.0f;
|
||||
float bodyY = 0.0f;
|
||||
float headY = 0.0f;
|
||||
|
||||
/**
|
||||
|
@ -37,6 +40,8 @@ struct BirdSkeletonAttribute : public SkeletonAttribute {
|
|||
*/
|
||||
bool init() {
|
||||
footY = origin;
|
||||
bodyY = footY + footHeight;
|
||||
headY = bodyY + bodyHeight;
|
||||
// TODO: perform sanity checks
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -18,11 +18,13 @@ void update(float animTime, BirdSkeleton &skeleton, const BirdSkeletonAttribute
|
|||
const float cosine = glm::cos(animTime);
|
||||
|
||||
Bone &head = skeleton.bone(BoneId::Head);
|
||||
head.scale = glm::vec3(skeletonAttr.headScale);
|
||||
head.translation = glm::vec3(skeletonAttr.headY);
|
||||
head.orientation = rotateYZ(sine * 0.1f, cosine * 0.05f);
|
||||
|
||||
Bone &torso = skeleton.bone(BoneId::Torso);
|
||||
torso.translation = glm::zero<glm::vec3>();
|
||||
torso.scale = glm::vec3(_private::defaultScale * skeletonAttr.scaler);
|
||||
torso.translation = glm::vec3(skeletonAttr.bodyY);
|
||||
torso.orientation = glm::quat_identity<float, glm::defaultp>();
|
||||
|
||||
skeleton.bone(BoneId::RightWing) = translate(skeletonAttr.wingRight, skeletonAttr.wingHeight, 0.0f);
|
||||
|
|
|
@ -10,7 +10,8 @@ function defaultSkeletonAttributes()
|
|||
wingRight = -3.2,
|
||||
wingHeight = 3.0,
|
||||
invisibleLegHeight = 0.5,
|
||||
headHeight = 9.0
|
||||
headHeight = 9.0,
|
||||
bodyHeight = 3.0
|
||||
}
|
||||
return attributes
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue