Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
badlogic committed Apr 4, 2024
1 parent e623140 commit 120577b
Show file tree
Hide file tree
Showing 20 changed files with 1,166 additions and 1,166 deletions.
26 changes: 13 additions & 13 deletions spine-cpp/spine-cpp/src/spine/AnimationState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ float TrackEntry::getMixDuration() { return _mixDuration; }
void TrackEntry::setMixDuration(float inValue) { _mixDuration = inValue; }

void TrackEntry::setMixDuration(float mixDuration, float delay) {
_mixDuration = mixDuration;
if (_previous && delay <= 0) delay += _previous->getTrackComplete() - mixDuration;
this->_delay = delay;
_mixDuration = mixDuration;
if (_previous && delay <= 0) delay += _previous->getTrackComplete() - mixDuration;
this->_delay = delay;
}

TrackEntry *TrackEntry::getMixingFrom() { return _mixingFrom; }
Expand Down Expand Up @@ -935,15 +935,15 @@ void AnimationState::queueEvents(TrackEntry *entry, float animationTime) {
// Queue complete if completed a loop iteration or the animation.
bool complete = false;
if (entry->_loop) {
if (duration == 0)
complete = true;
else {
int cycles = (int) (entry->_trackTime / duration);
complete = cycles > 0 && cycles > (int) (entry->_trackLast / duration);
}
} else {
complete = animationTime >= animationEnd && entry->_animationLast < animationEnd;
}
if (duration == 0)
complete = true;
else {
int cycles = (int) (entry->_trackTime / duration);
complete = cycles > 0 && cycles > (int) (entry->_trackLast / duration);
}
} else {
complete = animationTime >= animationEnd && entry->_animationLast < animationEnd;
}
if (complete) _queue->complete(entry);

// Queue events after complete.
Expand Down Expand Up @@ -998,7 +998,7 @@ TrackEntry *AnimationState::newTrackEntry(size_t trackIndex, Animation *animatio

entry._eventThreshold = 0;
entry._alphaAttachmentThreshold = 0;
entry._mixAttachmentThreshold = 0;
entry._mixAttachmentThreshold = 0;
entry._mixDrawOrderThreshold = 0;

entry._animationStart = 0;
Expand Down
42 changes: 21 additions & 21 deletions spine-cpp/spine-cpp/src/spine/Bone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Bone::Bone(BoneData &data, Skeleton &skeleton, Bone *parent) : Updatable(),
_worldY(0),
_sorted(false),
_active(false),
_inherit(Inherit_Normal){
_inherit(Inherit_Normal) {
setToSetupPose();
}

Expand Down Expand Up @@ -214,7 +214,7 @@ void Bone::setToSetupPose() {
_scaleY = data.getScaleY();
_shearX = data.getShearX();
_shearY = data.getShearY();
_inherit = data.getInherit();
_inherit = data.getInherit();
}

void Bone::worldToLocal(float worldX, float worldY, float &outLocalX, float &outLocalY) {
Expand All @@ -232,12 +232,12 @@ void Bone::worldToLocal(float worldX, float worldY, float &outLocalX, float &out
}

void Bone::worldToParent(float worldX, float worldY, float &outParentX, float &outParentY) {
if (!_parent) {
outParentX = worldX;
outParentY = worldY;
} else {
_parent->worldToLocal(worldX, worldY, outParentX, outParentY);
}
if (!_parent) {
outParentX = worldX;
outParentY = worldY;
} else {
_parent->worldToLocal(worldX, worldY, outParentX, outParentY);
}
}

void Bone::localToWorld(float localX, float localY, float &outWorldX, float &outWorldY) {
Expand All @@ -246,24 +246,24 @@ void Bone::localToWorld(float localX, float localY, float &outWorldX, float &out
}

void Bone::parentToWorld(float worldX, float worldY, float &outX, float &outY) {
if (!_parent) {
outX = worldX;
outY = worldY;
} else {
_parent->localToWorld(worldX, worldY, outX, outY);
}
if (!_parent) {
outX = worldX;
outY = worldY;
} else {
_parent->localToWorld(worldX, worldY, outX, outY);
}
}

float Bone::worldToLocalRotation(float worldRotation) {
worldRotation *= MathUtil::Deg_Rad;
float sine = MathUtil::sin(worldRotation), cosine = MathUtil::cos(worldRotation);
return MathUtil::atan2Deg(_a * sine - _c * cosine, _d * cosine - _b * sine) + _rotation - _shearX;
worldRotation *= MathUtil::Deg_Rad;
float sine = MathUtil::sin(worldRotation), cosine = MathUtil::cos(worldRotation);
return MathUtil::atan2Deg(_a * sine - _c * cosine, _d * cosine - _b * sine) + _rotation - _shearX;
}

float Bone::localToWorldRotation(float localRotation) {
localRotation = (localRotation - _rotation - _shearX) * MathUtil::Deg_Rad;
float sine = MathUtil::sin(localRotation), cosine = MathUtil::cos(localRotation);
return MathUtil::atan2Deg(cosine * _c + sine * _d, cosine * _a + sine * _b);
localRotation = (localRotation - _rotation - _shearX) * MathUtil::Deg_Rad;
float sine = MathUtil::sin(localRotation), cosine = MathUtil::cos(localRotation);
return MathUtil::atan2Deg(cosine * _c + sine * _d, cosine * _a + sine * _b);
}

void Bone::rotateWorld(float degrees) {
Expand Down Expand Up @@ -540,7 +540,7 @@ void Bone::updateAppliedTransform() {
case Inherit_NoScale:
case Inherit_NoScaleOrReflection: {
float r = _rotation * MathUtil::Deg_Rad;
float cos = MathUtil::cos(r), sin = MathUtil::sin(r);
float cos = MathUtil::cos(r), sin = MathUtil::sin(r);
pa = (pa * cos + pb * sin) / _skeleton.getScaleX();
pc = (pc * cos + pd * sin) / _skeleton.getScaleY();
float s = MathUtil::sqrt(pa * pa + pc * pc);
Expand Down
32 changes: 16 additions & 16 deletions spine-cpp/spine-cpp/src/spine/BoneData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@
using namespace spine;

BoneData::BoneData(int index, const String &name, BoneData *parent) : _index(index),
_name(name),
_parent(parent),
_length(0),
_x(0),
_y(0),
_rotation(0),
_scaleX(1),
_scaleY(1),
_shearX(0),
_shearY(0),
_inherit(Inherit_Normal),
_skinRequired(false),
_color(),
_icon(),
_visible(true) {
_name(name),
_parent(parent),
_length(0),
_x(0),
_y(0),
_rotation(0),
_scaleX(1),
_scaleY(1),
_shearX(0),
_shearY(0),
_inherit(Inherit_Normal),
_skinRequired(false),
_color(),
_icon(),
_visible(true) {
assert(index >= 0);
assert(_name.length() > 0);
}
Expand Down Expand Up @@ -134,7 +134,7 @@ Inherit BoneData::getInherit() {
}

void BoneData::setInherit(Inherit inValue) {
_inherit = inValue;
_inherit = inValue;
}

bool BoneData::isSkinRequired() {
Expand Down
4 changes: 2 additions & 2 deletions spine-cpp/spine-cpp/src/spine/IkConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ void IkConstraint::apply(Bone &parent, Bone &child, float targetX, float targetY
Bone *pp = parent.getParent();
float tx, ty, dx, dy, dd, l1, l2, a1, a2, r, td, sd, p;
float id, x, y;
if (parent._inherit != Inherit_Normal || child._inherit != Inherit_Normal) return;
px = parent._ax;
if (parent._inherit != Inherit_Normal || child._inherit != Inherit_Normal) return;
px = parent._ax;
py = parent._ay;
psx = parent._ascaleX;
psy = parent._ascaleY;
Expand Down
31 changes: 15 additions & 16 deletions spine-cpp/spine-cpp/src/spine/InheritTimeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,36 +42,35 @@ using namespace spine;
RTTI_IMPL(InheritTimeline, Timeline)

InheritTimeline::InheritTimeline(size_t frameCount, int boneIndex) : Timeline(frameCount, ENTRIES),
_boneIndex(boneIndex) {
PropertyId ids[] = {((PropertyId) Property_Inherit << 32) | boneIndex };
_boneIndex(boneIndex) {
PropertyId ids[] = {((PropertyId) Property_Inherit << 32) | boneIndex};
setPropertyIds(ids, 1);
}

InheritTimeline::~InheritTimeline() {
}

void InheritTimeline::setFrame(int frame, float time, Inherit inherit) {
frame *= ENTRIES;
_frames[frame] = time;
_frames[frame + INHERIT] = inherit;
frame *= ENTRIES;
_frames[frame] = time;
_frames[frame + INHERIT] = inherit;
}


void InheritTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha,
MixBlend blend, MixDirection direction) {
MixBlend blend, MixDirection direction) {
SP_UNUSED(lastTime);
SP_UNUSED(pEvents);
SP_UNUSED(direction);
SP_UNUSED(alpha);
SP_UNUSED(alpha);

Bone *bone = skeleton.getBones()[_boneIndex];
if (!bone->isActive()) return;
Bone *bone = skeleton.getBones()[_boneIndex];
if (!bone->isActive()) return;

if (time < _frames[0]) {
if (blend == MixBlend_Setup || blend == MixBlend_First) bone->_inherit = bone->_data.getInherit();
return;
}
int idx = Animation::search(_frames, time, ENTRIES) + INHERIT;
bone->_inherit = (Inherit)_frames[idx];
if (time < _frames[0]) {
if (blend == MixBlend_Setup || blend == MixBlend_First) bone->_inherit = bone->_data.getInherit();
return;
}
int idx = Animation::search(_frames, time, ENTRIES) + INHERIT;
bone->_inherit = (Inherit) _frames[idx];
}

24 changes: 12 additions & 12 deletions spine-cpp/spine-cpp/src/spine/LinkedMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@
using namespace spine;

LinkedMesh::LinkedMesh(MeshAttachment *mesh, const int skinIndex, size_t slotIndex, const String &parent,
bool inheritTimeline) : _mesh(mesh),
_skinIndex(skinIndex),
_skin(""),
_slotIndex(slotIndex),
_parent(parent),
_inheritTimeline(inheritTimeline) {
bool inheritTimeline) : _mesh(mesh),
_skinIndex(skinIndex),
_skin(""),
_slotIndex(slotIndex),
_parent(parent),
_inheritTimeline(inheritTimeline) {
}

LinkedMesh::LinkedMesh(MeshAttachment *mesh, const String &skin, size_t slotIndex, const String &parent,
bool inheritTimeline) : _mesh(mesh),
_skinIndex(-1),
_skin(skin),
_slotIndex(slotIndex),
_parent(parent),
_inheritTimeline(inheritTimeline) {
bool inheritTimeline) : _mesh(mesh),
_skinIndex(-1),
_skin(skin),
_slotIndex(slotIndex),
_parent(parent),
_inheritTimeline(inheritTimeline) {
}
Loading

0 comments on commit 120577b

Please sign in to comment.