Formatting

This commit is contained in:
Mario Zechner 2024-04-04 15:27:43 +02:00
parent e623140c99
commit 120577bfe6
20 changed files with 1131 additions and 1131 deletions

View File

@ -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();
}

View File

@ -43,7 +43,7 @@ RTTI_IMPL(InheritTimeline, Timeline)
InheritTimeline::InheritTimeline(size_t frameCount, int boneIndex) : Timeline(frameCount, ENTRIES),
_boneIndex(boneIndex) {
PropertyId ids[] = {((PropertyId) Property_Inherit << 32) | boneIndex };
PropertyId ids[] = {((PropertyId) Property_Inherit << 32) | boneIndex};
setPropertyIds(ids, 1);
}
@ -72,6 +72,5 @@ void InheritTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vect
return;
}
int idx = Animation::search(_frames, time, ENTRIES) + INHERIT;
bone->_inherit = (Inherit)_frames[idx];
bone->_inherit = (Inherit) _frames[idx];
}

View File

@ -338,12 +338,14 @@ void PhysicsConstraint::update(Physics physics) {
if (x || y) {
if (x) {
float u = (_ux - bx) * i;
_xOffset += u > q ? q : u < -q ? -q : u;
_xOffset += u > q ? q : u < -q ? -q
: u;
_ux = bx;
}
if (y) {
float u = (_uy - by) * i;
_yOffset += u > q ? q : u < -q ? -q : u;
_yOffset += u > q ? q : u < -q ? -q
: u;
_uy = by;
}
if (a >= t) {
@ -372,11 +374,11 @@ void PhysicsConstraint::update(Physics physics) {
float dx = _cx - bone->_worldX, dy = _cy - bone->_worldY;
if (dx > q)
dx = q;
else if (dx < -q) //
else if (dx < -q)//
dx = -q;
if (dy > q)
dy = q;
else if (dy < -q) //
else if (dy < -q)//
dy = -q;
if (rotateOrShearX) {
mr = (_data._rotate + _data._shearX) * mix;
@ -414,7 +416,7 @@ void PhysicsConstraint::update(Physics physics) {
float r = _rotateOffset * mr + ca;
c = MathUtil::cos(r);
s = MathUtil::sin(r);
} else if (a < t) //
} else if (a < t)//
break;
}
}

View File

@ -215,19 +215,19 @@ void Skeleton::printUpdateCache() {
for (size_t i = 0; i < _updateCache.size(); i++) {
Updatable *updatable = _updateCache[i];
if (updatable->getRTTI().isExactly(Bone::rtti)) {
printf("bone %s\n", ((Bone *)updatable)->getData().getName().buffer());
printf("bone %s\n", ((Bone *) updatable)->getData().getName().buffer());
} else if (updatable->getRTTI().isExactly(TransformConstraint::rtti)) {
printf("transform constraint %s\n",
((TransformConstraint *)updatable)->getData().getName().buffer());
((TransformConstraint *) updatable)->getData().getName().buffer());
} else if (updatable->getRTTI().isExactly(IkConstraint::rtti)) {
printf("ik constraint %s\n",
((IkConstraint *)updatable)->getData().getName().buffer());
((IkConstraint *) updatable)->getData().getName().buffer());
} else if (updatable->getRTTI().isExactly(PathConstraint::rtti)) {
printf("path constraint %s\n",
((PathConstraint *)updatable)->getData().getName().buffer());
((PathConstraint *) updatable)->getData().getName().buffer());
} else if (updatable->getRTTI().isExactly(PhysicsConstraint::rtti)) {
printf("physics constraint %s\n",
((PhysicsConstraint *)updatable)->getData().getName().buffer());
((PhysicsConstraint *) updatable)->getData().getName().buffer());
}
}
}
@ -386,7 +386,7 @@ void Skeleton::setAttachment(const String &slotName,
if (slot->_data.getName() == slotName) {
Attachment *attachment = NULL;
if (attachmentName.length() > 0) {
attachment = getAttachment((int)i, attachmentName);
attachment = getAttachment((int) i, attachmentName);
assert(attachment != NULL);
}
@ -734,13 +734,13 @@ void Skeleton::setTime(float time) { _time = time; }
void Skeleton::update(float delta) { _time += delta; }
void Skeleton::physicsTranslate(float x, float y) {
for (int i = 0; i < (int)_physicsConstraints.size(); i++) {
for (int i = 0; i < (int) _physicsConstraints.size(); i++) {
_physicsConstraints[i]->translate(x, y);
}
}
void Skeleton::physicsRotate(float x, float y, float degrees) {
for (int i = 0; i < (int)_physicsConstraints.size(); i++) {
for (int i = 0; i < (int) _physicsConstraints.size(); i++) {
_physicsConstraints[i]->rotate(x, y, degrees);
}
}

View File

@ -246,7 +246,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
data->_local = (flags & 2) != 0;
data->_relative = (flags & 4) != 0;
if ((flags & 8) != 0) data->_offsetRotation = readFloat(input);
if ((flags & 16) != 0) data->_offsetX =readFloat(input) * _scale;
if ((flags & 16) != 0) data->_offsetX = readFloat(input) * _scale;
if ((flags & 32) != 0) data->_offsetY = readFloat(input) * _scale;
if ((flags & 64) != 0) data->_offsetScaleX = readFloat(input);
if ((flags & 128) != 0) data->_offsetScaleY = readFloat(input);
@ -276,9 +276,9 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
data->_bones[ii] = skeletonData->_bones[readVarint(input, true)];
data->_target = skeletonData->_slots[readVarint(input, true)];
int flags = readByte(input);
data->_positionMode = (PositionMode)(flags & 1);
data->_spacingMode = (SpacingMode)((flags >> 1) & 3);
data->_rotateMode = (RotateMode)((flags >> 3) & 3);
data->_positionMode = (PositionMode) (flags & 1);
data->_spacingMode = (SpacingMode) ((flags >> 1) & 3);
data->_rotateMode = (RotateMode) ((flags >> 3) & 3);
if ((flags & 128) != 0) data->_offsetRotation = readFloat(input);
data->_position = readFloat(input);
if (data->_positionMode == PositionMode_Fixed) data->_position *= _scale;
@ -795,7 +795,7 @@ void SkeletonBinary::readFloatArray(DataInput *input, int n, float scale, Vector
void SkeletonBinary::readShortArray(DataInput *input, Vector<unsigned short> &array, int n) {
array.setSize(n, 0);
for (int i = 0; i < n; ++i) {
array[i] = (short)readVarint(input, true);
array[i] = (short) readVarint(input, true);
}
}
@ -809,7 +809,7 @@ void SkeletonBinary::setBezier(DataInput *input, CurveTimeline *timeline, int be
timeline->setBezier(bezier, frame, value, time1, value1, cx1, cy1 * scale, cx2, cy2 * scale, time2, value2);
}
void SkeletonBinary::readTimeline(DataInput *input, Vector<Timeline*> &timelines, CurveTimeline1 *timeline, float scale) {
void SkeletonBinary::readTimeline(DataInput *input, Vector<Timeline *> &timelines, CurveTimeline1 *timeline, float scale) {
float time = readFloat(input);
float value = readFloat(input) * scale;
for (int frame = 0, bezier = 0, frameLast = (int) timeline->getFrameCount() - 1;; frame++) {
@ -830,7 +830,7 @@ void SkeletonBinary::readTimeline(DataInput *input, Vector<Timeline*> &timelines
timelines.add(timeline);
}
void SkeletonBinary::readTimeline2(DataInput *input, Vector<Timeline*> &timelines, CurveTimeline2 *timeline, float scale) {
void SkeletonBinary::readTimeline2(DataInput *input, Vector<Timeline *> &timelines, CurveTimeline2 *timeline, float scale) {
float time = readFloat(input);
float value1 = readFloat(input) * scale;
float value2 = readFloat(input) * scale;
@ -1090,7 +1090,7 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S
InheritTimeline *timeline = new (__FILE__, __LINE__) InheritTimeline(frameCount, boneIndex);
for (int frame = 0; frame < frameCount; frame++) {
float time = readFloat(input);
Inherit inherit = (Inherit)readByte(input);
Inherit inherit = (Inherit) readByte(input);
timeline->setFrame(frame, time, inherit);
}
timelines.add(timeline);
@ -1104,7 +1104,7 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S
1);
break;
case BONE_TRANSLATE:
readTimeline2(input, timelines,new (__FILE__, __LINE__) TranslateTimeline(frameCount, bezierCount, boneIndex), scale);
readTimeline2(input, timelines, new (__FILE__, __LINE__) TranslateTimeline(frameCount, bezierCount, boneIndex), scale);
break;
case BONE_TRANSLATEX:
readTimeline(input, timelines, new (__FILE__, __LINE__) TranslateXTimeline(frameCount, bezierCount, boneIndex), scale);

View File

@ -1182,7 +1182,7 @@ Animation *SkeletonJson::readAnimation(Json *root, SkeletonData *skeletonData) {
if (!nextMap) break;
}
timelines.add(timeline);
}else {
} else {
ContainerUtil::cleanUpVectorOfPointers(timelines);
setError(NULL, "Invalid timeline type for a bone: ", timelineMap->_name);
return NULL;

View File

@ -2,4 +2,3 @@
#include "SpineUEGameMode.h"
#include "SpineUE.h"