diff --git a/SpineViewer/Spine/Implementations/Spine/Spine21.cs b/SpineViewer/Spine/Implementations/Spine/Spine21.cs
index 1162317..cccab10 100644
--- a/SpineViewer/Spine/Implementations/Spine/Spine21.cs
+++ b/SpineViewer/Spine/Implementations/Spine/Spine21.cs
@@ -380,6 +380,17 @@ namespace SpineViewer.Spine.Implementations.Spine
states.Shader = null;
target.Draw(vertexArray, states);
//clipping.ClipEnd();
+
+ // 包围盒
+ if (IsDebug && IsSelected && DebugBounds)
+ {
+ var bounds = Bounds;
+ boundsVertices[0] = boundsVertices[4] = new(new(bounds.Left, bounds.Top), BoundsColor);
+ boundsVertices[1] = new(new(bounds.Right, bounds.Top), BoundsColor);
+ boundsVertices[2] = new(new(bounds.Right, bounds.Bottom), BoundsColor);
+ boundsVertices[3] = new(new(bounds.Left, bounds.Bottom), BoundsColor);
+ target.Draw(boundsVertices);
+ }
}
}
}
diff --git a/SpineViewer/Spine/Implementations/Spine/Spine36.cs b/SpineViewer/Spine/Implementations/Spine/Spine36.cs
index 11a0ce6..dbff10d 100644
--- a/SpineViewer/Spine/Implementations/Spine/Spine36.cs
+++ b/SpineViewer/Spine/Implementations/Spine/Spine36.cs
@@ -336,6 +336,17 @@ namespace SpineViewer.Spine.Implementations.Spine
states.Shader = null;
target.Draw(vertexArray, states);
clipping.ClipEnd();
+
+ // 包围盒
+ if (IsDebug && IsSelected && DebugBounds)
+ {
+ var bounds = Bounds;
+ boundsVertices[0] = boundsVertices[4] = new(new(bounds.Left, bounds.Top), BoundsColor);
+ boundsVertices[1] = new(new(bounds.Right, bounds.Top), BoundsColor);
+ boundsVertices[2] = new(new(bounds.Right, bounds.Bottom), BoundsColor);
+ boundsVertices[3] = new(new(bounds.Left, bounds.Bottom), BoundsColor);
+ target.Draw(boundsVertices);
+ }
}
}
}
diff --git a/SpineViewer/Spine/Implementations/Spine/Spine37.cs b/SpineViewer/Spine/Implementations/Spine/Spine37.cs
index 521c815..5f3bc2b 100644
--- a/SpineViewer/Spine/Implementations/Spine/Spine37.cs
+++ b/SpineViewer/Spine/Implementations/Spine/Spine37.cs
@@ -344,6 +344,17 @@ namespace SpineViewer.Spine.Implementations.Spine
states.Shader = null;
target.Draw(vertexArray, states);
clipping.ClipEnd();
+
+ // 包围盒
+ if (IsDebug && IsSelected && DebugBounds)
+ {
+ var bounds = Bounds;
+ boundsVertices[0] = boundsVertices[4] = new(new(bounds.Left, bounds.Top), BoundsColor);
+ boundsVertices[1] = new(new(bounds.Right, bounds.Top), BoundsColor);
+ boundsVertices[2] = new(new(bounds.Right, bounds.Bottom), BoundsColor);
+ boundsVertices[3] = new(new(bounds.Left, bounds.Bottom), BoundsColor);
+ target.Draw(boundsVertices);
+ }
}
}
}
diff --git a/SpineViewer/Spine/Implementations/Spine/Spine38.cs b/SpineViewer/Spine/Implementations/Spine/Spine38.cs
index 8cfc2de..8e3ebf5 100644
--- a/SpineViewer/Spine/Implementations/Spine/Spine38.cs
+++ b/SpineViewer/Spine/Implementations/Spine/Spine38.cs
@@ -347,6 +347,17 @@ namespace SpineViewer.Spine.Implementations.Spine
states.Shader = null;
target.Draw(vertexArray, states);
clipping.ClipEnd();
+
+ // 包围盒
+ if (IsDebug && IsSelected && DebugBounds)
+ {
+ var bounds = Bounds;
+ boundsVertices[0] = boundsVertices[4] = new(new(bounds.Left, bounds.Top), BoundsColor);
+ boundsVertices[1] = new(new(bounds.Right, bounds.Top), BoundsColor);
+ boundsVertices[2] = new(new(bounds.Right, bounds.Bottom), BoundsColor);
+ boundsVertices[3] = new(new(bounds.Left, bounds.Bottom), BoundsColor);
+ target.Draw(boundsVertices);
+ }
}
}
}
diff --git a/SpineViewer/Spine/Implementations/Spine/Spine40.cs b/SpineViewer/Spine/Implementations/Spine/Spine40.cs
index bbe847b..a20786a 100644
--- a/SpineViewer/Spine/Implementations/Spine/Spine40.cs
+++ b/SpineViewer/Spine/Implementations/Spine/Spine40.cs
@@ -346,6 +346,17 @@ namespace SpineViewer.Spine.Implementations.Spine
states.Shader = null;
target.Draw(vertexArray, states);
clipping.ClipEnd();
+
+ // 包围盒
+ if (IsDebug && IsSelected && DebugBounds)
+ {
+ var bounds = Bounds;
+ boundsVertices[0] = boundsVertices[4] = new(new(bounds.Left, bounds.Top), BoundsColor);
+ boundsVertices[1] = new(new(bounds.Right, bounds.Top), BoundsColor);
+ boundsVertices[2] = new(new(bounds.Right, bounds.Bottom), BoundsColor);
+ boundsVertices[3] = new(new(bounds.Left, bounds.Bottom), BoundsColor);
+ target.Draw(boundsVertices);
+ }
}
}
}
diff --git a/SpineViewer/Spine/Implementations/Spine/Spine41.cs b/SpineViewer/Spine/Implementations/Spine/Spine41.cs
index 45324a9..3bdd638 100644
--- a/SpineViewer/Spine/Implementations/Spine/Spine41.cs
+++ b/SpineViewer/Spine/Implementations/Spine/Spine41.cs
@@ -346,6 +346,17 @@ namespace SpineViewer.Spine.Implementations.Spine
states.Shader = null;
target.Draw(vertexArray, states);
clipping.ClipEnd();
+
+ // 包围盒
+ if (IsDebug && IsSelected && DebugBounds)
+ {
+ var bounds = Bounds;
+ boundsVertices[0] = boundsVertices[4] = new(new(bounds.Left, bounds.Top), BoundsColor);
+ boundsVertices[1] = new(new(bounds.Right, bounds.Top), BoundsColor);
+ boundsVertices[2] = new(new(bounds.Right, bounds.Bottom), BoundsColor);
+ boundsVertices[3] = new(new(bounds.Left, bounds.Bottom), BoundsColor);
+ target.Draw(boundsVertices);
+ }
}
}
}
diff --git a/SpineViewer/Spine/Implementations/Spine/Spine42.cs b/SpineViewer/Spine/Implementations/Spine/Spine42.cs
index 3dfd280..b801c39 100644
--- a/SpineViewer/Spine/Implementations/Spine/Spine42.cs
+++ b/SpineViewer/Spine/Implementations/Spine/Spine42.cs
@@ -346,6 +346,17 @@ namespace SpineViewer.Spine.Implementations.Spine
states.Shader = null;
target.Draw(vertexArray, states);
clipping.ClipEnd();
+
+ // 包围盒
+ if (IsDebug && IsSelected && DebugBounds)
+ {
+ var bounds = Bounds;
+ boundsVertices[0] = boundsVertices[4] = new(new(bounds.Left, bounds.Top), BoundsColor);
+ boundsVertices[1] = new(new(bounds.Right, bounds.Top), BoundsColor);
+ boundsVertices[2] = new(new(bounds.Right, bounds.Bottom), BoundsColor);
+ boundsVertices[3] = new(new(bounds.Left, bounds.Bottom), BoundsColor);
+ target.Draw(boundsVertices);
+ }
}
}
}
diff --git a/SpineViewer/Spine/Spine.cs b/SpineViewer/Spine/Spine.cs
index d6f72de..5fd964f 100644
--- a/SpineViewer/Spine/Spine.cs
+++ b/SpineViewer/Spine/Spine.cs
@@ -434,16 +434,26 @@ namespace SpineViewer.Spine
[Browsable(false)]
public bool IsDebug { get; set; } = false;
+ ///
+ /// 包围盒颜色
+ ///
+ protected static readonly SFML.Graphics.Color BoundsColor = new(120, 200, 0);
+
+ ///
+ /// 包围盒顶点数组
+ ///
+ protected readonly SFML.Graphics.VertexArray boundsVertices = new(SFML.Graphics.PrimitiveType.LineStrip, 5);
+
///
/// 显示包围盒
///
- [Browsable(false)]
+ [Category("调试"), DisplayName("显示包围盒")]
public bool DebugBounds { get; set; } = true;
///
/// 显示骨骼
///
- [Browsable(false)]
+ [Category("调试"), DisplayName("显示骨骼(TODO)")]
public bool DebugBones { get; set; } = false;
#region SFML.Graphics.Drawable 接口实现
@@ -456,10 +466,10 @@ namespace SpineViewer.Spine
///
/// 顶点缓冲区
///
- protected SFML.Graphics.VertexArray vertexArray = new(SFML.Graphics.PrimitiveType.Triangles);
+ protected readonly SFML.Graphics.VertexArray vertexArray = new(SFML.Graphics.PrimitiveType.Triangles);
///
- /// SFML.Graphics.Drawable 接口实现 TODO: 增加调试内容绘制
+ /// SFML.Graphics.Drawable 接口实现
///
public abstract void Draw(SFML.Graphics.RenderTarget target, SFML.Graphics.RenderStates states);