Fixed deform additive blend after last frame.

#1030
This commit is contained in:
Nathan Sweet 2017-10-30 13:57:54 +01:00
parent a75e166cbb
commit 097bf986bb

View File

@ -1038,7 +1038,7 @@ public class Animation {
} }
} else { } else {
switch (blend) { switch (blend) {
case setup: case setup: {
VertexAttachment vertexAttachment = (VertexAttachment)slotAttachment; VertexAttachment vertexAttachment = (VertexAttachment)slotAttachment;
if (vertexAttachment.getBones() == null) { if (vertexAttachment.getBones() == null) {
// Unweighted vertex positions, with alpha. // Unweighted vertex positions, with alpha.
@ -1053,6 +1053,7 @@ public class Animation {
vertices[i] = lastVertices[i] * alpha; vertices[i] = lastVertices[i] * alpha;
} }
break; break;
}
case first: case first:
case replace: case replace:
// Vertex positions or deform offsets, with alpha. // Vertex positions or deform offsets, with alpha.
@ -1060,8 +1061,17 @@ public class Animation {
vertices[i] += (lastVertices[i] - vertices[i]) * alpha; vertices[i] += (lastVertices[i] - vertices[i]) * alpha;
break; break;
case add: case add:
for (int i = 0; i < vertexCount; i++) VertexAttachment vertexAttachment = (VertexAttachment)slotAttachment;
vertices[i] += lastVertices[i] * alpha; if (vertexAttachment.getBones() == null) {
// Unweighted vertex positions, no alpha.
float[] setupVertices = vertexAttachment.getVertices();
for (int i = 0; i < vertexCount; i++)
vertices[i] += (lastVertices[i] - setupVertices[i]) * alpha;
} else {
// Weighted deform offsets, alpha.
for (int i = 0; i < vertexCount; i++)
vertices[i] += lastVertices[i] * alpha;
}
} }
} }
return; return;