From 097bf986bbf680cfd5d0af37067e7c67e8995dc0 Mon Sep 17 00:00:00 2001 From: Nathan Sweet Date: Mon, 30 Oct 2017 13:57:54 +0100 Subject: [PATCH] Fixed deform additive blend after last frame. #1030 --- .../com/esotericsoftware/spine/Animation.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java index 43fb2f14b..a358e47e5 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java @@ -1038,7 +1038,7 @@ public class Animation { } } else { switch (blend) { - case setup: + case setup: { VertexAttachment vertexAttachment = (VertexAttachment)slotAttachment; if (vertexAttachment.getBones() == null) { // Unweighted vertex positions, with alpha. @@ -1053,6 +1053,7 @@ public class Animation { vertices[i] = lastVertices[i] * alpha; } break; + } case first: case replace: // Vertex positions or deform offsets, with alpha. @@ -1060,8 +1061,17 @@ public class Animation { vertices[i] += (lastVertices[i] - vertices[i]) * alpha; break; case add: - for (int i = 0; i < vertexCount; i++) - vertices[i] += lastVertices[i] * alpha; + VertexAttachment vertexAttachment = (VertexAttachment)slotAttachment; + 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;