mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 09:16:01 +08:00
[c][cpp] Formatter pass.
This commit is contained in:
parent
7cf42c814b
commit
2022713bd2
@ -26,7 +26,7 @@ spotless {
|
|||||||
'spine-sfml/**/*.h',
|
'spine-sfml/**/*.h',
|
||||||
'spine-ue4/**/*.cpp',
|
'spine-ue4/**/*.cpp',
|
||||||
'spine-ue4/**/*.h'
|
'spine-ue4/**/*.h'
|
||||||
clangFormat("12.0.1").pathToExe("$System.env.CLANGFORMAT").style('file')
|
clangFormat("13.0.1").pathToExe("$System.env.CLANGFORMAT").style('file')
|
||||||
}
|
}
|
||||||
|
|
||||||
typescript {
|
typescript {
|
||||||
|
|||||||
@ -28,9 +28,11 @@ setup
|
|||||||
# Execute spotless and dotnet-format
|
# Execute spotless and dotnet-format
|
||||||
pushd $dir/..
|
pushd $dir/..
|
||||||
./formatters/gradlew spotlessApply
|
./formatters/gradlew spotlessApply
|
||||||
dotnet-format spine-csharp/spine-csharp.sln
|
if [ "$1" != "skipdotnet" ] ; then
|
||||||
dotnet-format -f spine-monogame
|
dotnet-format spine-csharp/spine-csharp.sln
|
||||||
dotnet-format -f spine-unity
|
dotnet-format -f spine-monogame
|
||||||
|
dotnet-format -f spine-unity
|
||||||
|
fi
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# Delete Gradle, dotnet-format, and clang-format config files in root
|
# Delete Gradle, dotnet-format, and clang-format config files in root
|
||||||
|
|||||||
@ -101,7 +101,7 @@ static char *string_append(char *str, const char *b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char *string_append_int(char *str, int value) {
|
static char *string_append_int(char *str, int value) {
|
||||||
char intStr[20];;
|
char intStr[20];
|
||||||
sprintf(intStr, "%i", value);
|
sprintf(intStr, "%i", value);
|
||||||
return string_append(str, intStr);
|
return string_append(str, intStr);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -109,7 +109,7 @@ static int readInt(_dataInput *input) {
|
|||||||
result |= readByte(input);
|
result |= readByte(input);
|
||||||
result <<= 8;
|
result <<= 8;
|
||||||
result |= readByte(input);
|
result |= readByte(input);
|
||||||
return (int)result;
|
return (int) result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int readVarint(_dataInput *input, int /*bool*/ optimizePositive) {
|
static int readVarint(_dataInput *input, int /*bool*/ optimizePositive) {
|
||||||
@ -124,12 +124,12 @@ static int readVarint(_dataInput *input, int /*bool*/ optimizePositive) {
|
|||||||
if (b & 0x80) {
|
if (b & 0x80) {
|
||||||
b = readByte(input);
|
b = readByte(input);
|
||||||
value |= (b & 0x7F) << 21;
|
value |= (b & 0x7F) << 21;
|
||||||
if (b & 0x80) value |= (uint32_t)(readByte(input) & 0x7F) << 28;
|
if (b & 0x80) value |= (uint32_t) (readByte(input) & 0x7F) << 28;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!optimizePositive) value = (((unsigned int) value >> 1) ^ -(value & 1));
|
if (!optimizePositive) value = (((unsigned int) value >> 1) ^ -(value & 1));
|
||||||
return (int)value;
|
return (int) value;
|
||||||
}
|
}
|
||||||
|
|
||||||
float readFloat(_dataInput *input) {
|
float readFloat(_dataInput *input) {
|
||||||
|
|||||||
@ -94,14 +94,14 @@ void Animation::setDuration(float inValue) {
|
|||||||
int Animation::search(Vector<float> &frames, float target) {
|
int Animation::search(Vector<float> &frames, float target) {
|
||||||
size_t n = (int) frames.size();
|
size_t n = (int) frames.size();
|
||||||
for (size_t i = 1; i < n; i++) {
|
for (size_t i = 1; i < n; i++) {
|
||||||
if (frames[i] > target) return (int)(i - 1);
|
if (frames[i] > target) return (int) (i - 1);
|
||||||
}
|
}
|
||||||
return (int)(n - 1);
|
return (int) (n - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Animation::search(Vector<float> &frames, float target, int step) {
|
int Animation::search(Vector<float> &frames, float target, int step) {
|
||||||
size_t n = frames.size();
|
size_t n = frames.size();
|
||||||
for (size_t i = step; i < n; i += step)
|
for (size_t i = step; i < n; i += step)
|
||||||
if (frames[i] > target) return (int)(i - step);
|
if (frames[i] > target) return (int) (i - step);
|
||||||
return (int)(n - step);
|
return (int) (n - step);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -489,7 +489,7 @@ bool AnimationState::apply(Skeleton &skeleton) {
|
|||||||
|
|
||||||
int setupState = _unkeyedState + Setup;
|
int setupState = _unkeyedState + Setup;
|
||||||
Vector<Slot *> &slots = skeleton.getSlots();
|
Vector<Slot *> &slots = skeleton.getSlots();
|
||||||
for (int i = 0, n = (int)slots.size(); i < n; i++) {
|
for (int i = 0, n = (int) slots.size(); i < n; i++) {
|
||||||
Slot *slot = slots[i];
|
Slot *slot = slots[i];
|
||||||
if (slot->getAttachmentState() == setupState) {
|
if (slot->getAttachmentState() == setupState) {
|
||||||
const String &attachmentName = slot->getData().getAttachmentName();
|
const String &attachmentName = slot->getData().getAttachmentName();
|
||||||
@ -951,7 +951,7 @@ TrackEntry *AnimationState::newTrackEntry(size_t trackIndex, Animation *animatio
|
|||||||
TrackEntry *entryP = _trackEntryPool.obtain();// Pooling
|
TrackEntry *entryP = _trackEntryPool.obtain();// Pooling
|
||||||
TrackEntry &entry = *entryP;
|
TrackEntry &entry = *entryP;
|
||||||
|
|
||||||
entry._trackIndex = (int)trackIndex;
|
entry._trackIndex = (int) trackIndex;
|
||||||
entry._animation = animation;
|
entry._animation = animation;
|
||||||
entry._loop = loop;
|
entry._loop = loop;
|
||||||
entry._holdPrevious = 0;
|
entry._holdPrevious = 0;
|
||||||
|
|||||||
@ -155,7 +155,7 @@ struct SimpleString {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool equals(const char *str) {
|
bool equals(const char *str) {
|
||||||
int otherLen = (int)strlen(str);
|
int otherLen = (int) strlen(str);
|
||||||
if (length != otherLen) return false;
|
if (length != otherLen) return false;
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
if (start[i] != str[i]) return false;
|
if (start[i] != str[i]) return false;
|
||||||
|
|||||||
@ -46,7 +46,7 @@ namespace spine {
|
|||||||
|
|
||||||
bool loadSequence(Atlas *atlas, const String &basePath, Sequence *sequence) {
|
bool loadSequence(Atlas *atlas, const String &basePath, Sequence *sequence) {
|
||||||
Vector<TextureRegion *> ®ions = sequence->getRegions();
|
Vector<TextureRegion *> ®ions = sequence->getRegions();
|
||||||
for (int i = 0, n = (int)regions.size(); i < n; i++) {
|
for (int i = 0, n = (int) regions.size(); i < n; i++) {
|
||||||
String path = sequence->getPath(basePath, i);
|
String path = sequence->getPath(basePath, i);
|
||||||
regions[i] = atlas->findRegion(path);
|
regions[i] = atlas->findRegion(path);
|
||||||
if (!regions[i]) return false;
|
if (!regions[i]) return false;
|
||||||
|
|||||||
@ -111,7 +111,7 @@ void CurveTimeline1::setFrame(size_t frame, float time, float value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float CurveTimeline1::getCurveValue(float time) {
|
float CurveTimeline1::getCurveValue(float time) {
|
||||||
int i = (int)_frames.size() - 2;
|
int i = (int) _frames.size() - 2;
|
||||||
for (int ii = 2; ii <= i; ii += 2) {
|
for (int ii = 2; ii <= i; ii += 2) {
|
||||||
if (_frames[ii] > time) {
|
if (_frames[ii] > time) {
|
||||||
i = ii - 2;
|
i = ii - 2;
|
||||||
|
|||||||
@ -288,7 +288,7 @@ void IkConstraint::update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int IkConstraint::getOrder() {
|
int IkConstraint::getOrder() {
|
||||||
return (int)_data.getOrder();
|
return (int) _data.getOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
IkConstraintData &IkConstraint::getData() {
|
IkConstraintData &IkConstraint::getData() {
|
||||||
|
|||||||
@ -37,7 +37,7 @@ void spine::spDebug_printSkeletonData(SkeletonData *skeletonData) {
|
|||||||
int i, n;
|
int i, n;
|
||||||
spDebug_printBoneDatas(skeletonData->getBones());
|
spDebug_printBoneDatas(skeletonData->getBones());
|
||||||
|
|
||||||
for (i = 0, n = (int)skeletonData->getAnimations().size(); i < n; i++) {
|
for (i = 0, n = (int) skeletonData->getAnimations().size(); i < n; i++) {
|
||||||
spDebug_printAnimation(skeletonData->getAnimations()[i]);
|
spDebug_printAnimation(skeletonData->getAnimations()[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ void spine::spDebug_printAnimation(Animation *animation) {
|
|||||||
int i, n;
|
int i, n;
|
||||||
printf("Animation %s: %zu timelines\n", animation->getName().buffer(), animation->getTimelines().size());
|
printf("Animation %s: %zu timelines\n", animation->getName().buffer(), animation->getTimelines().size());
|
||||||
|
|
||||||
for (i = 0, n = (int)animation->getTimelines().size(); i < n; i++) {
|
for (i = 0, n = (int) animation->getTimelines().size(); i < n; i++) {
|
||||||
Timeline *timeline = animation->getTimelines()[i];
|
Timeline *timeline = animation->getTimelines()[i];
|
||||||
spDebug_printTimeline(timeline);
|
spDebug_printTimeline(timeline);
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ void spine::spDebug_printAnimation(Animation *animation) {
|
|||||||
|
|
||||||
void spine::spDebug_printBoneDatas(Vector<BoneData *> &boneDatas) {
|
void spine::spDebug_printBoneDatas(Vector<BoneData *> &boneDatas) {
|
||||||
int i, n;
|
int i, n;
|
||||||
for (i = 0, n = (int)boneDatas.size(); i < n; i++) {
|
for (i = 0, n = (int) boneDatas.size(); i < n; i++) {
|
||||||
spDebug_printBoneData(boneDatas[i]);
|
spDebug_printBoneData(boneDatas[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ void spine::spDebug_printSkeleton(Skeleton *skeleton) {
|
|||||||
|
|
||||||
void spine::spDebug_printBones(Vector<Bone *> &bones) {
|
void spine::spDebug_printBones(Vector<Bone *> &bones) {
|
||||||
int i, n;
|
int i, n;
|
||||||
for (i = 0, n = (int)bones.size(); i < n; i++) {
|
for (i = 0, n = (int) bones.size(); i < n; i++) {
|
||||||
spDebug_printBone(bones[i]);
|
spDebug_printBone(bones[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ void spine::spDebug_printFloats(float *values, int numFloats) {
|
|||||||
void spine::spDebug_printFloats(Vector<float> &values) {
|
void spine::spDebug_printFloats(Vector<float> &values) {
|
||||||
int i, n;
|
int i, n;
|
||||||
printf("(%zu) [", values.size());
|
printf("(%zu) [", values.size());
|
||||||
for (i = 0, n = (int)values.size(); i < n; i++) {
|
for (i = 0, n = (int) values.size(); i < n; i++) {
|
||||||
printf("%f, ", values[i]);
|
printf("%f, ", values[i]);
|
||||||
}
|
}
|
||||||
printf("]");
|
printf("]");
|
||||||
|
|||||||
@ -53,7 +53,7 @@ void MeshAttachment::updateRegion() {
|
|||||||
_uvs.setSize(_regionUVs.size(), 0);
|
_uvs.setSize(_regionUVs.size(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = 0, n = (int)_regionUVs.size();
|
int i = 0, n = (int) _regionUVs.size();
|
||||||
float u = _region->u, v = _region->v;
|
float u = _region->u, v = _region->v;
|
||||||
float width = 0, height = 0;
|
float width = 0, height = 0;
|
||||||
|
|
||||||
|
|||||||
@ -148,7 +148,7 @@ void PathConstraint::update() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<float> &positions = computeWorldPositions(*attachment, (int)spacesCount, tangents);
|
Vector<float> &positions = computeWorldPositions(*attachment, (int) spacesCount, tangents);
|
||||||
float boneX = positions[0];
|
float boneX = positions[0];
|
||||||
float boneY = positions[1];
|
float boneY = positions[1];
|
||||||
float offsetRotation = data.getOffsetRotation();
|
float offsetRotation = data.getOffsetRotation();
|
||||||
@ -221,7 +221,7 @@ void PathConstraint::update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int PathConstraint::getOrder() {
|
int PathConstraint::getOrder() {
|
||||||
return (int)_data.getOrder();
|
return (int) _data.getOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
float PathConstraint::getPosition() {
|
float PathConstraint::getPosition() {
|
||||||
@ -288,7 +288,7 @@ PathConstraint::computeWorldPositions(PathAttachment &path, int spacesCount, boo
|
|||||||
Vector<float> &out = _positions;
|
Vector<float> &out = _positions;
|
||||||
Vector<float> &world = _world;
|
Vector<float> &world = _world;
|
||||||
bool closed = path.isClosed();
|
bool closed = path.isClosed();
|
||||||
int verticesLength = (int)path.getWorldVerticesLength();
|
int verticesLength = (int) path.getWorldVerticesLength();
|
||||||
int curveCount = verticesLength / 6;
|
int curveCount = verticesLength / 6;
|
||||||
int prevCurve = NONE;
|
int prevCurve = NONE;
|
||||||
|
|
||||||
|
|||||||
@ -47,7 +47,7 @@ Sequence::~Sequence() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Sequence *Sequence::copy() {
|
Sequence *Sequence::copy() {
|
||||||
Sequence *copy = new (__FILE__, __LINE__) Sequence((int)_regions.size());
|
Sequence *copy = new (__FILE__, __LINE__) Sequence((int) _regions.size());
|
||||||
for (size_t i = 0; i < _regions.size(); i++) {
|
for (size_t i = 0; i < _regions.size(); i++) {
|
||||||
copy->_regions[i] = _regions[i];
|
copy->_regions[i] = _regions[i];
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ Sequence *Sequence::copy() {
|
|||||||
void Sequence::apply(Slot *slot, Attachment *attachment) {
|
void Sequence::apply(Slot *slot, Attachment *attachment) {
|
||||||
int index = slot->getSequenceIndex();
|
int index = slot->getSequenceIndex();
|
||||||
if (index == -1) index = _setupIndex;
|
if (index == -1) index = _setupIndex;
|
||||||
if (index >= (int) _regions.size()) index = (int)_regions.size() - 1;
|
if (index >= (int) _regions.size()) index = (int) _regions.size() - 1;
|
||||||
TextureRegion *region = _regions[index];
|
TextureRegion *region = _regions[index];
|
||||||
|
|
||||||
if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) {
|
if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) {
|
||||||
@ -86,7 +86,7 @@ String Sequence::getPath(const String &basePath, int index) {
|
|||||||
String result(basePath);
|
String result(basePath);
|
||||||
String frame;
|
String frame;
|
||||||
frame.append(_start + index);
|
frame.append(_start + index);
|
||||||
for (int i = _digits - (int)frame.length(); i > 0; i--)
|
for (int i = _digits - (int) frame.length(); i > 0; i--)
|
||||||
result.append("0");
|
result.append("0");
|
||||||
result.append(frame);
|
result.append(frame);
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@ -89,7 +89,7 @@ void SequenceTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vec
|
|||||||
Sequence *sequence = NULL;
|
Sequence *sequence = NULL;
|
||||||
if (_attachment->getRTTI().instanceOf(RegionAttachment::rtti)) sequence = ((RegionAttachment *) _attachment)->getSequence();
|
if (_attachment->getRTTI().instanceOf(RegionAttachment::rtti)) sequence = ((RegionAttachment *) _attachment)->getSequence();
|
||||||
if (_attachment->getRTTI().instanceOf(MeshAttachment::rtti)) sequence = ((MeshAttachment *) _attachment)->getSequence();
|
if (_attachment->getRTTI().instanceOf(MeshAttachment::rtti)) sequence = ((MeshAttachment *) _attachment)->getSequence();
|
||||||
int index = modeAndIndex >> 4, count = (int)sequence->getRegions().size();
|
int index = modeAndIndex >> 4, count = (int) sequence->getRegions().size();
|
||||||
int mode = modeAndIndex & 0xf;
|
int mode = modeAndIndex & 0xf;
|
||||||
if (mode != SequenceMode::hold) {
|
if (mode != SequenceMode::hold) {
|
||||||
index += (int) (((time - before) / delay + 0.00001));
|
index += (int) (((time - before) / delay + 0.00001));
|
||||||
|
|||||||
@ -368,7 +368,7 @@ void Skeleton::setAttachment(const String &slotName, const String &attachmentNam
|
|||||||
if (slot->_data.getName() == slotName) {
|
if (slot->_data.getName() == slotName) {
|
||||||
Attachment *attachment = NULL;
|
Attachment *attachment = NULL;
|
||||||
if (attachmentName.length() > 0) {
|
if (attachmentName.length() > 0) {
|
||||||
attachment = getAttachment((int)i, attachmentName);
|
attachment = getAttachment((int) i, attachmentName);
|
||||||
|
|
||||||
assert(attachment != NULL);
|
assert(attachment != NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -287,7 +287,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Linked meshes. */
|
/* Linked meshes. */
|
||||||
for (int i = 0, n = (int)_linkedMeshes.size(); i < n; ++i) {
|
for (int i = 0, n = (int) _linkedMeshes.size(); i < n; ++i) {
|
||||||
LinkedMesh *linkedMesh = _linkedMeshes[i];
|
LinkedMesh *linkedMesh = _linkedMeshes[i];
|
||||||
Skin *skin = linkedMesh->_skin.length() == 0 ? skeletonData->getDefaultSkin() : skeletonData->findSkin(linkedMesh->_skin);
|
Skin *skin = linkedMesh->_skin.length() == 0 ? skeletonData->getDefaultSkin() : skeletonData->findSkin(linkedMesh->_skin);
|
||||||
if (skin == NULL) {
|
if (skin == NULL) {
|
||||||
@ -753,7 +753,7 @@ void SkeletonBinary::setBezier(DataInput *input, CurveTimeline *timeline, int be
|
|||||||
Timeline *SkeletonBinary::readTimeline(DataInput *input, CurveTimeline1 *timeline, float scale) {
|
Timeline *SkeletonBinary::readTimeline(DataInput *input, CurveTimeline1 *timeline, float scale) {
|
||||||
float time = readFloat(input);
|
float time = readFloat(input);
|
||||||
float value = readFloat(input) * scale;
|
float value = readFloat(input) * scale;
|
||||||
for (int frame = 0, bezier = 0, frameLast = (int)timeline->getFrameCount() - 1;; frame++) {
|
for (int frame = 0, bezier = 0, frameLast = (int) timeline->getFrameCount() - 1;; frame++) {
|
||||||
timeline->setFrame(frame, time, value);
|
timeline->setFrame(frame, time, value);
|
||||||
if (frame == frameLast) break;
|
if (frame == frameLast) break;
|
||||||
float time2 = readFloat(input);
|
float time2 = readFloat(input);
|
||||||
@ -775,7 +775,7 @@ Timeline *SkeletonBinary::readTimeline2(DataInput *input, CurveTimeline2 *timeli
|
|||||||
float time = readFloat(input);
|
float time = readFloat(input);
|
||||||
float value1 = readFloat(input) * scale;
|
float value1 = readFloat(input) * scale;
|
||||||
float value2 = readFloat(input) * scale;
|
float value2 = readFloat(input) * scale;
|
||||||
for (int frame = 0, bezier = 0, frameLast = (int)timeline->getFrameCount() - 1;; frame++) {
|
for (int frame = 0, bezier = 0, frameLast = (int) timeline->getFrameCount() - 1;; frame++) {
|
||||||
timeline->setFrame(frame, time, value1, value2);
|
timeline->setFrame(frame, time, value1, value2);
|
||||||
if (frame == frameLast) break;
|
if (frame == frameLast) break;
|
||||||
float time2 = readFloat(input);
|
float time2 = readFloat(input);
|
||||||
@ -1198,7 +1198,7 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S
|
|||||||
float mixRotate = readFloat(input);
|
float mixRotate = readFloat(input);
|
||||||
float mixX = readFloat(input);
|
float mixX = readFloat(input);
|
||||||
float mixY = readFloat(input);
|
float mixY = readFloat(input);
|
||||||
for (int frame = 0, bezier = 0, frameLast = (int)timeline->getFrameCount() - 1;; frame++) {
|
for (int frame = 0, bezier = 0, frameLast = (int) timeline->getFrameCount() - 1;; frame++) {
|
||||||
timeline->setFrame(frame, time, mixRotate, mixX, mixY);
|
timeline->setFrame(frame, time, mixRotate, mixX, mixY);
|
||||||
if (frame == frameLast) break;
|
if (frame == frameLast) break;
|
||||||
float time2 = readFloat(input);
|
float time2 = readFloat(input);
|
||||||
@ -1246,7 +1246,7 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S
|
|||||||
case ATTACHMENT_DEFORM: {
|
case ATTACHMENT_DEFORM: {
|
||||||
bool weighted = attachment->_bones.size() > 0;
|
bool weighted = attachment->_bones.size() > 0;
|
||||||
Vector<float> &vertices = attachment->_vertices;
|
Vector<float> &vertices = attachment->_vertices;
|
||||||
int deformLength = weighted ? (int)vertices.size() / 3 * 2 : (int)vertices.size();
|
int deformLength = weighted ? (int) vertices.size() / 3 * 2 : (int) vertices.size();
|
||||||
|
|
||||||
int bezierCount = readVarint(input, true);
|
int bezierCount = readVarint(input, true);
|
||||||
DeformTimeline *timeline = new (__FILE__, __LINE__) DeformTimeline(frameCount, bezierCount, slotIndex,
|
DeformTimeline *timeline = new (__FILE__, __LINE__) DeformTimeline(frameCount, bezierCount, slotIndex,
|
||||||
@ -1336,15 +1336,15 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S
|
|||||||
size_t slotIndex = (size_t) readVarint(input, true);
|
size_t slotIndex = (size_t) readVarint(input, true);
|
||||||
// Collect unchanged items.
|
// Collect unchanged items.
|
||||||
while (originalIndex != slotIndex)
|
while (originalIndex != slotIndex)
|
||||||
unchanged[unchangedIndex++] = (int)originalIndex++;
|
unchanged[unchangedIndex++] = (int) originalIndex++;
|
||||||
// Set changed items.
|
// Set changed items.
|
||||||
size_t index = originalIndex;
|
size_t index = originalIndex;
|
||||||
drawOrder[index + (size_t) readVarint(input, true)] = (int)originalIndex++;
|
drawOrder[index + (size_t) readVarint(input, true)] = (int) originalIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect remaining unchanged items.
|
// Collect remaining unchanged items.
|
||||||
while (originalIndex < slotCount) {
|
while (originalIndex < slotCount) {
|
||||||
unchanged[unchangedIndex++] = (int)originalIndex++;
|
unchanged[unchangedIndex++] = (int) originalIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill in unchanged items.
|
// Fill in unchanged items.
|
||||||
@ -1382,7 +1382,7 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S
|
|||||||
}
|
}
|
||||||
|
|
||||||
float duration = 0;
|
float duration = 0;
|
||||||
for (int i = 0, n = (int)timelines.size(); i < n; i++) {
|
for (int i = 0, n = (int) timelines.size(); i < n; i++) {
|
||||||
duration = MathUtil::max(duration, (timelines[i])->getDuration());
|
duration = MathUtil::max(duration, (timelines[i])->getDuration());
|
||||||
}
|
}
|
||||||
return new (__FILE__, __LINE__) Animation(String(name), timelines, duration);
|
return new (__FILE__, __LINE__) Animation(String(name), timelines, duration);
|
||||||
|
|||||||
@ -74,7 +74,7 @@ void SkeletonBounds::update(Skeleton &skeleton, bool updateAabb) {
|
|||||||
Polygon &polygon = *polygonP;
|
Polygon &polygon = *polygonP;
|
||||||
|
|
||||||
size_t count = boundingBox->getWorldVerticesLength();
|
size_t count = boundingBox->getWorldVerticesLength();
|
||||||
polygon._count = (int)count;
|
polygon._count = (int) count;
|
||||||
if (polygon._vertices.size() < count) {
|
if (polygon._vertices.size() < count) {
|
||||||
polygon._vertices.setSize(count, 0);
|
polygon._vertices.setSize(count, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,7 +48,7 @@ size_t SkeletonClipping::clipStart(Slot &slot, ClippingAttachment *clip) {
|
|||||||
|
|
||||||
_clipAttachment = clip;
|
_clipAttachment = clip;
|
||||||
|
|
||||||
int n = (int)clip->getWorldVerticesLength();
|
int n = (int) clip->getWorldVerticesLength();
|
||||||
_clippingPolygon.setSize(n, 0);
|
_clippingPolygon.setSize(n, 0);
|
||||||
clip->computeWorldVertices(slot, 0, n, _clippingPolygon, 0, 2);
|
clip->computeWorldVertices(slot, 0, n, _clippingPolygon, 0, 2);
|
||||||
makeClockwise(_clippingPolygon);
|
makeClockwise(_clippingPolygon);
|
||||||
@ -103,15 +103,15 @@ void SkeletonClipping::clipTriangles(float *vertices, unsigned short *triangles,
|
|||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
continue_outer:
|
continue_outer:
|
||||||
for (; i < trianglesLength; i += 3) {
|
for (; i < trianglesLength; i += 3) {
|
||||||
int vertexOffset = triangles[i] * (int)stride;
|
int vertexOffset = triangles[i] * (int) stride;
|
||||||
float x1 = vertices[vertexOffset], y1 = vertices[vertexOffset + 1];
|
float x1 = vertices[vertexOffset], y1 = vertices[vertexOffset + 1];
|
||||||
float u1 = uvs[vertexOffset], v1 = uvs[vertexOffset + 1];
|
float u1 = uvs[vertexOffset], v1 = uvs[vertexOffset + 1];
|
||||||
|
|
||||||
vertexOffset = triangles[i + 1] * (int)stride;
|
vertexOffset = triangles[i + 1] * (int) stride;
|
||||||
float x2 = vertices[vertexOffset], y2 = vertices[vertexOffset + 1];
|
float x2 = vertices[vertexOffset], y2 = vertices[vertexOffset + 1];
|
||||||
float u2 = uvs[vertexOffset], v2 = uvs[vertexOffset + 1];
|
float u2 = uvs[vertexOffset], v2 = uvs[vertexOffset + 1];
|
||||||
|
|
||||||
vertexOffset = triangles[i + 2] * (int)stride;
|
vertexOffset = triangles[i + 2] * (int) stride;
|
||||||
float x3 = vertices[vertexOffset], y3 = vertices[vertexOffset + 1];
|
float x3 = vertices[vertexOffset], y3 = vertices[vertexOffset + 1];
|
||||||
float u3 = uvs[vertexOffset], v3 = uvs[vertexOffset + 1];
|
float u3 = uvs[vertexOffset], v3 = uvs[vertexOffset + 1];
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ void SkeletonClipping::makeClockwise(Vector<float> &polygon) {
|
|||||||
|
|
||||||
for (size_t i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) {
|
for (size_t i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) {
|
||||||
float x = polygon[i], y = polygon[i + 1];
|
float x = polygon[i], y = polygon[i + 1];
|
||||||
int other = (int)(lastX - i);
|
int other = (int) (lastX - i);
|
||||||
polygon[i] = polygon[other];
|
polygon[i] = polygon[other];
|
||||||
polygon[i + 1] = polygon[other + 1];
|
polygon[i + 1] = polygon[other + 1];
|
||||||
polygon[other] = x;
|
polygon[other] = x;
|
||||||
|
|||||||
@ -711,7 +711,7 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Linked meshes. */
|
/* Linked meshes. */
|
||||||
int n = (int)_linkedMeshes.size();
|
int n = (int) _linkedMeshes.size();
|
||||||
for (i = 0; i < n; ++i) {
|
for (i = 0; i < n; ++i) {
|
||||||
LinkedMesh *linkedMesh = _linkedMeshes[i];
|
LinkedMesh *linkedMesh = _linkedMeshes[i];
|
||||||
Skin *skin = linkedMesh->_skin.length() == 0 ? skeletonData->getDefaultSkin() : skeletonData->findSkin(linkedMesh->_skin);
|
Skin *skin = linkedMesh->_skin.length() == 0 ? skeletonData->getDefaultSkin() : skeletonData->findSkin(linkedMesh->_skin);
|
||||||
@ -1276,7 +1276,7 @@ Animation *SkeletonJson::readAnimation(Json *root, SkeletonData *skeletonData) {
|
|||||||
VertexAttachment *vertexAttachment = static_cast<VertexAttachment *>(attachment);
|
VertexAttachment *vertexAttachment = static_cast<VertexAttachment *>(attachment);
|
||||||
bool weighted = vertexAttachment->_bones.size() != 0;
|
bool weighted = vertexAttachment->_bones.size() != 0;
|
||||||
Vector<float> &verts = vertexAttachment->_vertices;
|
Vector<float> &verts = vertexAttachment->_vertices;
|
||||||
int deformLength = weighted ? (int)verts.size() / 3 * 2 : (int)verts.size();
|
int deformLength = weighted ? (int) verts.size() / 3 * 2 : (int) verts.size();
|
||||||
|
|
||||||
DeformTimeline *timeline = new (__FILE__, __LINE__) DeformTimeline(frames,
|
DeformTimeline *timeline = new (__FILE__, __LINE__) DeformTimeline(frames,
|
||||||
frames, slotIndex, vertexAttachment);
|
frames, slotIndex, vertexAttachment);
|
||||||
@ -1376,14 +1376,14 @@ Animation *SkeletonJson::readAnimation(Json *root, SkeletonData *skeletonData) {
|
|||||||
|
|
||||||
/* Collect unchanged items. */
|
/* Collect unchanged items. */
|
||||||
while (originalIndex != (size_t) slotIndex)
|
while (originalIndex != (size_t) slotIndex)
|
||||||
unchanged[unchangedIndex++] = (int)originalIndex++;
|
unchanged[unchangedIndex++] = (int) originalIndex++;
|
||||||
/* Set changed items. */
|
/* Set changed items. */
|
||||||
drawOrder2[originalIndex + Json::getInt(offsetMap, "offset", 0)] = (int)originalIndex;
|
drawOrder2[originalIndex + Json::getInt(offsetMap, "offset", 0)] = (int) originalIndex;
|
||||||
originalIndex++;
|
originalIndex++;
|
||||||
}
|
}
|
||||||
/* Collect remaining unchanged items. */
|
/* Collect remaining unchanged items. */
|
||||||
while ((int)originalIndex < (int)skeletonData->_slots.size())
|
while ((int) originalIndex < (int) skeletonData->_slots.size())
|
||||||
unchanged[unchangedIndex++] = (int)originalIndex++;
|
unchanged[unchangedIndex++] = (int) originalIndex++;
|
||||||
/* Fill in unchanged items. */
|
/* Fill in unchanged items. */
|
||||||
for (ii = (int) skeletonData->_slots.size() - 1; ii >= 0; ii--)
|
for (ii = (int) skeletonData->_slots.size() - 1; ii >= 0; ii--)
|
||||||
if (drawOrder2[ii] == -1) drawOrder2[ii] = unchanged[--unchangedIndex];
|
if (drawOrder2[ii] == -1) drawOrder2[ii] = unchanged[--unchangedIndex];
|
||||||
|
|||||||
@ -80,7 +80,7 @@ void Skin::AttachmentMap::remove(size_t slotIndex, const String &attachmentName)
|
|||||||
|
|
||||||
int Skin::AttachmentMap::findInBucket(Vector<Entry> &bucket, const String &attachmentName) {
|
int Skin::AttachmentMap::findInBucket(Vector<Entry> &bucket, const String &attachmentName) {
|
||||||
for (size_t i = 0; i < bucket.size(); i++)
|
for (size_t i = 0; i < bucket.size(); i++)
|
||||||
if (bucket[i]._name == attachmentName) return (int)i;
|
if (bucket[i]._name == attachmentName) return (int) i;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ void Skin::attachAll(Skeleton &skeleton, Skin &oldSkin) {
|
|||||||
Skin::AttachmentMap::Entries entries = oldSkin.getAttachments();
|
Skin::AttachmentMap::Entries entries = oldSkin.getAttachments();
|
||||||
while (entries.hasNext()) {
|
while (entries.hasNext()) {
|
||||||
Skin::AttachmentMap::Entry &entry = entries.next();
|
Skin::AttachmentMap::Entry &entry = entries.next();
|
||||||
int slotIndex = (int)entry._slotIndex;
|
int slotIndex = (int) entry._slotIndex;
|
||||||
Slot *slot = slots[slotIndex];
|
Slot *slot = slots[slotIndex];
|
||||||
|
|
||||||
if (slot->getAttachment() == entry._attachment) {
|
if (slot->getAttachment() == entry._attachment) {
|
||||||
|
|||||||
@ -78,7 +78,7 @@ void TransformConstraint::update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int TransformConstraint::getOrder() {
|
int TransformConstraint::getOrder() {
|
||||||
return (int)_data.getOrder();
|
return (int) _data.getOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
TransformConstraintData &TransformConstraint::getData() {
|
TransformConstraintData &TransformConstraint::getData() {
|
||||||
|
|||||||
@ -45,15 +45,15 @@ Vector<int> &Triangulator::triangulate(Vector<float> &vertices) {
|
|||||||
indices.clear();
|
indices.clear();
|
||||||
indices.ensureCapacity(vertexCount);
|
indices.ensureCapacity(vertexCount);
|
||||||
indices.setSize(vertexCount, 0);
|
indices.setSize(vertexCount, 0);
|
||||||
for (int i = 0; i < (int)vertexCount; ++i) {
|
for (int i = 0; i < (int) vertexCount; ++i) {
|
||||||
indices[i] = i;
|
indices[i] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<bool> &isConcaveArray = _isConcaveArray;
|
Vector<bool> &isConcaveArray = _isConcaveArray;
|
||||||
isConcaveArray.ensureCapacity(vertexCount);
|
isConcaveArray.ensureCapacity(vertexCount);
|
||||||
isConcaveArray.setSize(vertexCount, 0);
|
isConcaveArray.setSize(vertexCount, 0);
|
||||||
for (int i = 0, n = (int)vertexCount; i < n; ++i) {
|
for (int i = 0, n = (int) vertexCount; i < n; ++i) {
|
||||||
isConcaveArray[i] = isConcave(i, (int)vertexCount, vertices, indices);
|
isConcaveArray[i] = isConcave(i, (int) vertexCount, vertices, indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<int> &triangles = _triangles;
|
Vector<int> &triangles = _triangles;
|
||||||
@ -109,10 +109,10 @@ Vector<int> &Triangulator::triangulate(Vector<float> &vertices) {
|
|||||||
isConcaveArray.removeAt(i);
|
isConcaveArray.removeAt(i);
|
||||||
vertexCount--;
|
vertexCount--;
|
||||||
|
|
||||||
int previousIndex = (int)((vertexCount + i - 1) % vertexCount);
|
int previousIndex = (int) ((vertexCount + i - 1) % vertexCount);
|
||||||
int nextIndex = (int)(i == vertexCount ? 0 : i);
|
int nextIndex = (int) (i == vertexCount ? 0 : i);
|
||||||
isConcaveArray[previousIndex] = isConcave(previousIndex, (int)vertexCount, vertices, indices);
|
isConcaveArray[previousIndex] = isConcave(previousIndex, (int) vertexCount, vertices, indices);
|
||||||
isConcaveArray[nextIndex] = isConcave(nextIndex, (int)vertexCount, vertices, indices);
|
isConcaveArray[nextIndex] = isConcave(nextIndex, (int) vertexCount, vertices, indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vertexCount == 3) {
|
if (vertexCount == 3) {
|
||||||
|
|||||||
@ -83,7 +83,7 @@ void VertexAttachment::computeWorldVertices(Slot &slot, size_t start, size_t cou
|
|||||||
|
|
||||||
int v = 0, skip = 0;
|
int v = 0, skip = 0;
|
||||||
for (size_t i = 0; i < start; i += 2) {
|
for (size_t i = 0; i < start; i += 2) {
|
||||||
int n = (int)bones[v];
|
int n = (int) bones[v];
|
||||||
v += n + 1;
|
v += n + 1;
|
||||||
skip += n;
|
skip += n;
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ void VertexAttachment::computeWorldVertices(Slot &slot, size_t start, size_t cou
|
|||||||
if (deformArray->size() == 0) {
|
if (deformArray->size() == 0) {
|
||||||
for (size_t w = offset, b = skip * 3; w < count; w += stride) {
|
for (size_t w = offset, b = skip * 3; w < count; w += stride) {
|
||||||
float wx = 0, wy = 0;
|
float wx = 0, wy = 0;
|
||||||
int n = (int)bones[v++];
|
int n = (int) bones[v++];
|
||||||
n += v;
|
n += v;
|
||||||
for (; v < n; v++, b += 3) {
|
for (; v < n; v++, b += 3) {
|
||||||
Bone *boneP = skeletonBones[bones[v]];
|
Bone *boneP = skeletonBones[bones[v]];
|
||||||
@ -109,7 +109,7 @@ void VertexAttachment::computeWorldVertices(Slot &slot, size_t start, size_t cou
|
|||||||
} else {
|
} else {
|
||||||
for (size_t w = offset, b = skip * 3, f = skip << 1; w < count; w += stride) {
|
for (size_t w = offset, b = skip * 3, f = skip << 1; w < count; w += stride) {
|
||||||
float wx = 0, wy = 0;
|
float wx = 0, wy = 0;
|
||||||
int n = (int)bones[v++];
|
int n = (int) bones[v++];
|
||||||
n += v;
|
n += v;
|
||||||
for (; v < n; v++, b += 3, f += 2) {
|
for (; v < n; v++, b += 3, f += 2) {
|
||||||
Bone *boneP = skeletonBones[bones[v]];
|
Bone *boneP = skeletonBones[bones[v]];
|
||||||
|
|||||||
@ -137,7 +137,7 @@ void USpineSkeletonDataAsset::SetRawData(TArray<uint8> &Data) {
|
|||||||
|
|
||||||
static bool checkVersion(const char *version) {
|
static bool checkVersion(const char *version) {
|
||||||
if (!version) return false;
|
if (!version) return false;
|
||||||
char* result = (char*)(strstr(version, SPINE_VERSION_STRING) - version);
|
char *result = (char *) (strstr(version, SPINE_VERSION_STRING) - version);
|
||||||
return result == 0;
|
return result == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user