mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-10 09:08:42 +08:00
Minor clean up.
This commit is contained in:
parent
59204db7f8
commit
31848ad22a
@ -664,14 +664,14 @@ void _spFFDTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, flo
|
||||
return; /* Time is before first frame. */
|
||||
}
|
||||
|
||||
if (slot->attachmentVerticesCount != self->frameVerticesCount) alpha = 1; /* Don't mix from uninitialized slot vertices. */
|
||||
if (slot->attachmentVerticesCount < self->frameVerticesCount) {
|
||||
if (slot->attachmentVerticesCapacity < self->frameVerticesCount) {
|
||||
FREE(slot->attachmentVertices);
|
||||
slot->attachmentVertices = MALLOC(float, self->frameVerticesCount);
|
||||
slot->attachmentVerticesCapacity = self->frameVerticesCount;
|
||||
}
|
||||
}
|
||||
} else if (slot->attachmentVerticesCount > self->frameVerticesCount)
|
||||
alpha = 1; /* Don't mix from uninitialized slot vertices. */
|
||||
slot->attachmentVerticesCount = self->frameVerticesCount;
|
||||
|
||||
if (time >= self->frames[self->framesCount - 1]) {
|
||||
|
||||
@ -580,18 +580,20 @@ namespace Spine {
|
||||
int vertexCount = frameVertices[0].Length;
|
||||
|
||||
float[] vertices = slot.attachmentVertices;
|
||||
if (vertices.Length != vertexCount) alpha = 1; // Don't mix from uninitialized slot vertices.
|
||||
if (vertices.Length < vertexCount) {
|
||||
vertices = new float[vertexCount];
|
||||
slot.attachmentVertices = vertices;
|
||||
}
|
||||
} else if (vertices.Length > vertexCount)
|
||||
alpha = 1; // Don't mix from uninitialized slot vertices.
|
||||
slot.attachmentVerticesCount = vertexCount;
|
||||
|
||||
if (time >= frames[frames.Length - 1]) { // Time is after last frame.
|
||||
float[] lastVertices = frameVertices[frames.Length - 1];
|
||||
if (alpha < 1) {
|
||||
for (int i = 0; i < vertexCount; i++)
|
||||
vertices[i] += (lastVertices[i] - vertices[i]) * alpha;
|
||||
for (int i = 0; i < vertexCount; i++) {
|
||||
float vertex = vertices[i];
|
||||
vertices[i] = vertex + (lastVertices[i] - vertex) * alpha;
|
||||
}
|
||||
} else
|
||||
Array.Copy(lastVertices, 0, vertices, 0, vertexCount);
|
||||
return;
|
||||
@ -609,7 +611,8 @@ namespace Spine {
|
||||
if (alpha < 1) {
|
||||
for (int i = 0; i < vertexCount; i++) {
|
||||
float prev = prevVertices[i];
|
||||
vertices[i] += (prev + (nextVertices[i] - prev) * percent - vertices[i]) * alpha;
|
||||
float vertex = vertices[i];
|
||||
vertices[i] = vertex + (prev + (nextVertices[i] - prev) * percent - vertex) * alpha;
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < vertexCount; i++) {
|
||||
|
||||
@ -85,7 +85,6 @@ namespace Spine {
|
||||
/// <summary>Computes the world SRT using the parent bone and the local SRT.</summary>
|
||||
public void UpdateWorldTransform () {
|
||||
Bone parent = this.parent;
|
||||
Skeleton skeleton = this.skeleton;
|
||||
float x = this.x, y = this.y;
|
||||
if (parent != null) {
|
||||
worldX = x * parent.m00 + y * parent.m01 + parent.worldX;
|
||||
@ -98,17 +97,18 @@ namespace Spine {
|
||||
worldScaleY = scaleY;
|
||||
}
|
||||
worldRotation = data.inheritRotation ? parent.worldRotation + rotationIK : rotationIK;
|
||||
worldFlipX = parent.worldFlipX ^ flipX;
|
||||
worldFlipY = parent.worldFlipY ^ flipY;
|
||||
worldFlipX = parent.worldFlipX != flipX;
|
||||
worldFlipY = parent.worldFlipY != flipY;
|
||||
} else {
|
||||
Skeleton skeleton = this.skeleton;
|
||||
bool skeletonFlipX = skeleton.flipX, skeletonFlipY = skeleton.flipY;
|
||||
worldX = skeletonFlipX ? -x : x;
|
||||
worldY = skeletonFlipY != yDown ? -y : y;
|
||||
worldScaleX = scaleX;
|
||||
worldScaleY = scaleY;
|
||||
worldRotation = rotationIK;
|
||||
worldFlipX = skeletonFlipX ^ flipX;
|
||||
worldFlipY = skeletonFlipY ^ flipY;
|
||||
worldFlipX = skeletonFlipX != flipX;
|
||||
worldFlipY = skeletonFlipY != flipY;
|
||||
}
|
||||
float radians = worldRotation * (float)Math.PI / 180;
|
||||
float cos = (float)Math.Cos(radians);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user