mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 09:16:01 +08:00
Formatting
This commit is contained in:
parent
83ac01e76c
commit
1d0b33fb69
@ -122,20 +122,20 @@ void spPhysicsConstraint_update(spPhysicsConstraint *self, spPhysics physics) {
|
|||||||
self->uy = by;
|
self->uy = by;
|
||||||
} else {
|
} else {
|
||||||
// float a = self->remaining, i = self->inertia, q = self->data->limit * delta, t = self->data->step, f = self->skeleton->data->referenceScale, d = -1;
|
// float a = self->remaining, i = self->inertia, q = self->data->limit * delta, t = self->data->step, f = self->skeleton->data->referenceScale, d = -1;
|
||||||
float a = self->remaining, i = self->inertia, t = self->data->step, f = self->skeleton->data->referenceScale;
|
float a = self->remaining, i = self->inertia, t = self->data->step, f = self->skeleton->data->referenceScale;
|
||||||
float qx = self->data->limit * delta, qy = qx * ABS(self->skeleton->scaleX);
|
float qx = self->data->limit * delta, qy = qx * ABS(self->skeleton->scaleX);
|
||||||
qx *= ABS(self->skeleton->scaleY);
|
qx *= ABS(self->skeleton->scaleY);
|
||||||
if (x || y) {
|
if (x || y) {
|
||||||
if (x) {
|
if (x) {
|
||||||
float u = (self->ux - bx) * i;
|
float u = (self->ux - bx) * i;
|
||||||
self->xOffset += u > qx ? qx : u < -qx ? -qx
|
self->xOffset += u > qx ? qx : u < -qx ? -qx
|
||||||
: u;
|
: u;
|
||||||
self->ux = bx;
|
self->ux = bx;
|
||||||
}
|
}
|
||||||
if (y) {
|
if (y) {
|
||||||
float u = (self->uy - by) * i;
|
float u = (self->uy - by) * i;
|
||||||
self->yOffset += u > qy ? qy : u < -qy ? -qy
|
self->yOffset += u > qy ? qy : u < -qy ? -qy
|
||||||
: u;
|
: u;
|
||||||
self->uy = by;
|
self->uy = by;
|
||||||
}
|
}
|
||||||
if (a >= t) {
|
if (a >= t) {
|
||||||
@ -190,7 +190,7 @@ void spPhysicsConstraint_update(spPhysicsConstraint *self, spPhysics physics) {
|
|||||||
a = self->remaining;
|
a = self->remaining;
|
||||||
if (a >= t) {
|
if (a >= t) {
|
||||||
float m = self->massInverse * t, e = self->strength, w = self->wind, g = self->gravity, h = l / f;
|
float m = self->massInverse * t, e = self->strength, w = self->wind, g = self->gravity, h = l / f;
|
||||||
float d = POW(self->damping, 60 * t);
|
float d = POW(self->damping, 60 * t);
|
||||||
while (-1) {
|
while (-1) {
|
||||||
a -= t;
|
a -= t;
|
||||||
if (scaleX) {
|
if (scaleX) {
|
||||||
|
|||||||
@ -105,7 +105,7 @@ bool MathUtil::isNan(float v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float MathUtil::quietNan() {
|
float MathUtil::quietNan() {
|
||||||
return std::nan("");
|
return std::nan("");
|
||||||
}
|
}
|
||||||
|
|
||||||
float MathUtil::random() {
|
float MathUtil::random() {
|
||||||
|
|||||||
@ -334,20 +334,20 @@ void PhysicsConstraint::update(Physics physics) {
|
|||||||
_ux = bx;
|
_ux = bx;
|
||||||
_uy = by;
|
_uy = by;
|
||||||
} else {
|
} else {
|
||||||
float a = _remaining, i = _inertia, t = _data._step, f = _skeleton.getData()->getReferenceScale();
|
float a = _remaining, i = _inertia, t = _data._step, f = _skeleton.getData()->getReferenceScale();
|
||||||
float qx = _data._limit * delta, qy = qx * MathUtil::abs(_skeleton.getScaleX());
|
float qx = _data._limit * delta, qy = qx * MathUtil::abs(_skeleton.getScaleX());
|
||||||
qx *= MathUtil::abs(_skeleton.getScaleY());
|
qx *= MathUtil::abs(_skeleton.getScaleY());
|
||||||
if (x || y) {
|
if (x || y) {
|
||||||
if (x) {
|
if (x) {
|
||||||
float u = (_ux - bx) * i;
|
float u = (_ux - bx) * i;
|
||||||
_xOffset += u > qx ? qx : u < -qx ? -qx
|
_xOffset += u > qx ? qx : u < -qx ? -qx
|
||||||
: u;
|
: u;
|
||||||
_ux = bx;
|
_ux = bx;
|
||||||
}
|
}
|
||||||
if (y) {
|
if (y) {
|
||||||
float u = (_uy - by) * i;
|
float u = (_uy - by) * i;
|
||||||
_yOffset += u > qy ? qy : u < -qy ? -qy
|
_yOffset += u > qy ? qy : u < -qy ? -qy
|
||||||
: u;
|
: u;
|
||||||
_uy = by;
|
_uy = by;
|
||||||
}
|
}
|
||||||
if (a >= t) {
|
if (a >= t) {
|
||||||
@ -402,7 +402,7 @@ void PhysicsConstraint::update(Physics physics) {
|
|||||||
a = _remaining;
|
a = _remaining;
|
||||||
if (a >= t) {
|
if (a >= t) {
|
||||||
float m = _massInverse * t, e = _strength, w = _wind, g = _gravity * (Bone::yDown ? -1 : 1), h = l / f;
|
float m = _massInverse * t, e = _strength, w = _wind, g = _gravity * (Bone::yDown ? -1 : 1), h = l / f;
|
||||||
float d = MathUtil::pow(_damping, 60 * t);
|
float d = MathUtil::pow(_damping, 60 * t);
|
||||||
while (true) {
|
while (true) {
|
||||||
a -= t;
|
a -= t;
|
||||||
if (scaleX) {
|
if (scaleX) {
|
||||||
|
|||||||
@ -363,10 +363,10 @@ bool SkeletonClipping::clip(float x1, float y1, float x2, float y2, float x3, fl
|
|||||||
} else
|
} else
|
||||||
originalOutput->setSize(originalOutput->size() - 2, 0);
|
originalOutput->setSize(originalOutput->size() - 2, 0);
|
||||||
|
|
||||||
if (originalOutput->size() < 6) {
|
if (originalOutput->size() < 6) {
|
||||||
originalOutput->clear();
|
originalOutput->clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return clipped;
|
return clipped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user