From 899f7d77efcddde36a9b27938720c51ffc6b7528 Mon Sep 17 00:00:00 2001 From: Nathan Sweet Date: Wed, 14 Sep 2022 10:20:57 -0400 Subject: [PATCH] [monogame] Fixed rendering for sequence attachments. A region attachment with a sequence has its texture region set by `computeWorldVertices`. That must be called before the texture region is assigned to a local. --- spine-monogame/spine-monogame/src/SkeletonRenderer.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spine-monogame/spine-monogame/src/SkeletonRenderer.cs b/spine-monogame/spine-monogame/src/SkeletonRenderer.cs index 17c9c712a..8389ca710 100644 --- a/spine-monogame/spine-monogame/src/SkeletonRenderer.cs +++ b/spine-monogame/spine-monogame/src/SkeletonRenderer.cs @@ -123,18 +123,16 @@ namespace Spine { if (attachment is RegionAttachment) { RegionAttachment regionAttachment = (RegionAttachment)attachment; attachmentColorR = regionAttachment.R; attachmentColorG = regionAttachment.G; attachmentColorB = regionAttachment.B; attachmentColorA = regionAttachment.A; - AtlasRegion region = (AtlasRegion)regionAttachment.Region; - textureObject = region.page.rendererObject; - verticesCount = 4; regionAttachment.ComputeWorldVertices(slot, vertices, 0, 2); + verticesCount = 4; indicesCount = 6; indices = quadTriangles; uvs = regionAttachment.UVs; + AtlasRegion region = (AtlasRegion)regionAttachment.Region; + textureObject = region.page.rendererObject; } else if (attachment is MeshAttachment) { MeshAttachment mesh = (MeshAttachment)attachment; attachmentColorR = mesh.R; attachmentColorG = mesh.G; attachmentColorB = mesh.B; attachmentColorA = mesh.A; - AtlasRegion region = (AtlasRegion)mesh.Region; - textureObject = region.page.rendererObject; int vertexCount = mesh.WorldVerticesLength; if (vertices.Length < vertexCount) vertices = new float[vertexCount]; verticesCount = vertexCount >> 1; @@ -142,6 +140,8 @@ namespace Spine { indicesCount = mesh.Triangles.Length; indices = mesh.Triangles; uvs = mesh.UVs; + AtlasRegion region = (AtlasRegion)mesh.Region; + textureObject = region.page.rendererObject; } else if (attachment is ClippingAttachment) { ClippingAttachment clip = (ClippingAttachment)attachment; clipper.ClipStart(slot, clip);