From 44548618e8b0af5418ca722085b36ce56a241cb9 Mon Sep 17 00:00:00 2001 From: ww-rm Date: Wed, 1 Oct 2025 19:58:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B2=BE=E7=AE=80=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Attachments/ISkinnedMeshAttachment.cs | 40 +----------- Spine/SpineObject.cs | 63 ------------------- 2 files changed, 1 insertion(+), 102 deletions(-) diff --git a/Spine/Interfaces/Attachments/ISkinnedMeshAttachment.cs b/Spine/Interfaces/Attachments/ISkinnedMeshAttachment.cs index 169e535..687da97 100644 --- a/Spine/Interfaces/Attachments/ISkinnedMeshAttachment.cs +++ b/Spine/Interfaces/Attachments/ISkinnedMeshAttachment.cs @@ -7,46 +7,8 @@ using System.Threading.Tasks; namespace Spine.Interfaces.Attachments { - public interface ISkinnedMeshAttachment : IAttachment + public interface ISkinnedMeshAttachment : IMeshAttachment { - /// - /// R - /// - public float R { get; set; } - /// - /// G - /// - public float G { get; set; } - - /// - /// B - /// - public float B { get; set; } - - /// - /// A - /// - public float A { get; set; } - - /// - /// 用于渲染的纹理对象 - /// - public SFML.Graphics.Texture RendererObject { get; } - - /// - /// 顶点纹理坐标, 每个坐标有 u 和 v 两个数, 有效长度和 返回值一致 - /// - public float[] UVs { get; } - - /// - /// 三角形索引顶点数组, 每 3 个为一组, 指向顶点的下标 (不是顶点坐标数组下标) - /// - public int[] Triangles { get; } - - /// - /// 边缘顶点数组长度 - /// - public int HullLength { get; } } } diff --git a/Spine/SpineObject.cs b/Spine/SpineObject.cs index 564440e..0b1ce25 100644 --- a/Spine/SpineObject.cs +++ b/Spine/SpineObject.cs @@ -558,18 +558,6 @@ namespace Spine tintA *= meshAttachment.A; texture = meshAttachment.RendererObject; break; - case ISkinnedMeshAttachment skinnedMeshAttachment: - worldVerticesLength = skinnedMeshAttachment.ComputeWorldVertices(slot, ref _worldVertices); - worldVertices = _worldVertices; - triangles = skinnedMeshAttachment.Triangles; - trianglesLength = triangles.Length; - uvs = skinnedMeshAttachment.UVs; - tintR *= skinnedMeshAttachment.R; - tintG *= skinnedMeshAttachment.G; - tintB *= skinnedMeshAttachment.B; - tintA *= skinnedMeshAttachment.A; - texture = skinnedMeshAttachment.RendererObject; - break; case IClippingAttachment clippingAttachment: _clipping.ClipStart(slot, clippingAttachment); continue; @@ -697,34 +685,6 @@ namespace Spine vt.Position.Y = _worldVertices[idx2 + 1]; _lineVertices.Append(vt); _lineVertices.Append(vt); - vt.Position.X = _worldVertices[idx0]; - vt.Position.Y = _worldVertices[idx0 + 1]; - _lineVertices.Append(vt); - } - } - else if (slot.Attachment is ISkinnedMeshAttachment skinnedMeshAttachment) - { - skinnedMeshAttachment.ComputeWorldVertices(slot, ref _worldVertices); - - var triangles = skinnedMeshAttachment.Triangles; - for (int i = 0; i < triangles.Length - 2; i += 3) - { - var idx0 = triangles[i] << 1; - var idx1 = triangles[i + 1] << 1; - var idx2 = triangles[i + 2] << 1; - - vt.Position.X = _worldVertices[idx0]; - vt.Position.Y = _worldVertices[idx0 + 1]; - _lineVertices.Append(vt); - - vt.Position.X = _worldVertices[idx1]; - vt.Position.Y = _worldVertices[idx1 + 1]; - _lineVertices.Append(vt); _lineVertices.Append(vt); - - vt.Position.X = _worldVertices[idx2]; - vt.Position.Y = _worldVertices[idx2 + 1]; - _lineVertices.Append(vt); _lineVertices.Append(vt); - vt.Position.X = _worldVertices[idx0]; vt.Position.Y = _worldVertices[idx0 + 1]; _lineVertices.Append(vt); @@ -757,29 +717,6 @@ namespace Spine _lineVertices.Append(vt); } - vt.Position.X = _worldVertices[0]; - vt.Position.Y = _worldVertices[1]; - _lineVertices.Append(vt); - } - else if (slot.Attachment is ISkinnedMeshAttachment skinnedMeshAttachment) - { - skinnedMeshAttachment.ComputeWorldVertices(slot, ref _worldVertices); - - var hullLength = skinnedMeshAttachment.HullLength; - if (hullLength < 4) continue; - - vt.Position.X = _worldVertices[0]; - vt.Position.Y = _worldVertices[1]; - _lineVertices.Append(vt); - - for (int i = 2; i < hullLength - 1; i += 2) - { - vt.Position.X = _worldVertices[i]; - vt.Position.Y = _worldVertices[i + 1]; - _lineVertices.Append(vt); - _lineVertices.Append(vt); - } - vt.Position.X = _worldVertices[0]; vt.Position.Y = _worldVertices[1]; _lineVertices.Append(vt);