Эх сурвалжийг харах

[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.
Nathan Sweet 3 жил өмнө
parent
commit
899f7d77ef

+ 5 - 5
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);