[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.
This commit is contained in:
Nathan Sweet 2022-09-14 10:20:57 -04:00
parent b6e6712145
commit 899f7d77ef

View File

@ -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);