mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 15:24:55 +08:00
Added Bone_isYDown.
Fixes bad commit.
This commit is contained in:
parent
028769f54f
commit
d11b90c4e8
@ -57,6 +57,7 @@ struct spBone {
|
||||
};
|
||||
|
||||
void spBone_setYDown (int/*bool*/yDown);
|
||||
int/*bool*/spBone_isYDown ();
|
||||
|
||||
/* @param parent May be 0. */
|
||||
spBone* spBone_create (spBoneData* data, struct spSkeleton* skeleton, spBone* parent);
|
||||
@ -72,6 +73,7 @@ void spBone_localToWorld (spBone* self, float localX, float localY, float* world
|
||||
#ifdef SPINE_SHORT_NAMES
|
||||
typedef spBone Bone;
|
||||
#define Bone_setYDown(...) spBone_setYDown(__VA_ARGS__)
|
||||
#define Bone_isYDown() spBone_isYDown()
|
||||
#define Bone_create(...) spBone_create(__VA_ARGS__)
|
||||
#define Bone_dispose(...) spBone_dispose(__VA_ARGS__)
|
||||
#define Bone_setToSetupPose(...) spBone_setToSetupPose(__VA_ARGS__)
|
||||
|
||||
@ -37,6 +37,10 @@ void spBone_setYDown (int value) {
|
||||
yDown = value;
|
||||
}
|
||||
|
||||
int spBone_isYDown () {
|
||||
return yDown;
|
||||
}
|
||||
|
||||
spBone* spBone_create (spBoneData* data, spSkeleton* skeleton, spBone* parent) {
|
||||
spBone* self = NEW(spBone);
|
||||
CONST_CAST(spBoneData*, self->data) = data;
|
||||
|
||||
@ -70,7 +70,7 @@ void spIkConstraint_apply1 (spBone* bone, float targetX, float targetY, float al
|
||||
float parentRotation = (!bone->data->inheritRotation || !bone->parent) ? 0 : bone->parent->worldRotation;
|
||||
float rotation = bone->rotation;
|
||||
float rotationIK = ATAN2(targetY - bone->worldY, targetX - bone->worldX) * RAD_DEG;
|
||||
if (bone->worldFlipX != (bone->worldFlipY != yDown)) rotationIK = -rotationIK;
|
||||
if (bone->worldFlipX != (bone->worldFlipY != Bone_isYDown())) rotationIK = -rotationIK;
|
||||
rotationIK -= parentRotation;
|
||||
bone->rotationIK = rotation + (rotationIK - rotation) * alpha;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user