[c] Fixed DeformTimeline, see #1016.

This commit is contained in:
badlogic 2017-10-11 11:27:29 +02:00
parent bb97951cf9
commit dc16e55647

View File

@ -851,7 +851,7 @@ void _spDeformTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton,
slot->attachmentVerticesCapacity = vertexCount;
}
}
slot->attachmentVerticesCount = vertexCount;
if (slot->attachmentVerticesCount == 0) alpha = 1;
frameVertices = self->frameVertices;
vertices = slot->attachmentVertices;
@ -860,15 +860,15 @@ void _spDeformTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton,
spVertexAttachment* vertexAttachment = SUB_CAST(spVertexAttachment, slot->attachment);
switch (pose) {
case SP_MIX_POSE_SETUP:
if (!vertexAttachment->bones) {
memcpy(vertices, vertexAttachment->vertices, vertexCount * sizeof(float));
} else {
for (i = 0; i < vertexCount; i++) vertices[i] = 0;
}
slot->attachmentVerticesCount = 0;
return;
case SP_MIX_POSE_CURRENT:
case SP_MIX_POSE_CURRENT_LAYERED: /* to appease compiler */
if (alpha == 1) break;
if (alpha == 1) {
slot->attachmentVerticesCount = 0;
return;
}
slot->attachmentVerticesCount = vertexCount;
if (!vertexAttachment->bones) {
float* setupVertices = vertexAttachment->vertices;
for (i = 0; i < vertexCount; i++) {
@ -884,6 +884,7 @@ void _spDeformTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton,
return;
}
slot->attachmentVerticesCount = vertexCount;
if (time >= frames[framesCount - 1]) { /* Time is after last frame. */
const float* lastVertices = self->frameVertices[framesCount - 1];
if (alpha == 1) {