mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[xna] Also draw decomposed convex clipping polygons
This commit is contained in:
parent
a5d2519f86
commit
4b93db20fd
@ -83,6 +83,7 @@ namespace Spine {
|
|||||||
skeletonDebugRenderer = new SkeletonDebugRenderer(GraphicsDevice);
|
skeletonDebugRenderer = new SkeletonDebugRenderer(GraphicsDevice);
|
||||||
skeletonDebugRenderer.DisableAll();
|
skeletonDebugRenderer.DisableAll();
|
||||||
skeletonDebugRenderer.DrawClipping = true;
|
skeletonDebugRenderer.DrawClipping = true;
|
||||||
|
skeletonDebugRenderer.DrawClippingDecomposed = true;
|
||||||
|
|
||||||
// String name = "spineboy-ess";
|
// String name = "spineboy-ess";
|
||||||
// String name = "goblins-pro";
|
// String name = "goblins-pro";
|
||||||
|
|||||||
@ -46,6 +46,7 @@ namespace Spine {
|
|||||||
private static Color triangleLineColor = new Color(1f, 0.64f, 0f, 0.5f);
|
private static Color triangleLineColor = new Color(1f, 0.64f, 0f, 0.5f);
|
||||||
private static Color pathColor = new Color(1f, 0.5f, 0f, 1f);
|
private static Color pathColor = new Color(1f, 0.5f, 0f, 1f);
|
||||||
private static Color clipColor = new Color(0.8f, 0f, 0f, 1f);
|
private static Color clipColor = new Color(0.8f, 0f, 0f, 1f);
|
||||||
|
private static Color clipDecomposedColor = new Color(0.8f, 0.8f, 0f, 1f);
|
||||||
private static Color aabbColor = new Color(0f, 1f, 0f, 0.5f);
|
private static Color aabbColor = new Color(0f, 1f, 0f, 0.5f);
|
||||||
|
|
||||||
public BasicEffect Effect { get { return renderer.Effect; } set { renderer.Effect = value; } }
|
public BasicEffect Effect { get { return renderer.Effect; } set { renderer.Effect = value; } }
|
||||||
@ -56,6 +57,7 @@ namespace Spine {
|
|||||||
public bool DrawMeshTriangles { get; set; }
|
public bool DrawMeshTriangles { get; set; }
|
||||||
public bool DrawPaths { get; set; }
|
public bool DrawPaths { get; set; }
|
||||||
public bool DrawClipping { get; set; }
|
public bool DrawClipping { get; set; }
|
||||||
|
public bool DrawClippingDecomposed { get; set; }
|
||||||
public bool DrawSkeletonXY { get; set; }
|
public bool DrawSkeletonXY { get; set; }
|
||||||
public void DisableAll() {
|
public void DisableAll() {
|
||||||
DrawBones = false;
|
DrawBones = false;
|
||||||
@ -205,8 +207,10 @@ namespace Spine {
|
|||||||
clippingPolygon.Add(y);
|
clippingPolygon.Add(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DrawClippingDecomposed) {
|
||||||
if (!skeleton.FlipY) SkeletonClipping.MakeClockwise(clippingPolygon);
|
if (!skeleton.FlipY) SkeletonClipping.MakeClockwise(clippingPolygon);
|
||||||
var clippingPolygons = triangulator.Decompose(clippingPolygon, triangulator.Triangulate(clippingPolygon));
|
var clippingPolygons = triangulator.Decompose(clippingPolygon, triangulator.Triangulate(clippingPolygon));
|
||||||
|
renderer.SetColor(clipDecomposedColor);
|
||||||
foreach (var polygon in clippingPolygons) {
|
foreach (var polygon in clippingPolygons) {
|
||||||
if (!skeleton.FlipY) SkeletonClipping.MakeClockwise(polygon);
|
if (!skeleton.FlipY) SkeletonClipping.MakeClockwise(polygon);
|
||||||
polygon.Add(polygon.Items[0]);
|
polygon.Add(polygon.Items[0]);
|
||||||
@ -216,6 +220,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void End() {
|
public void End() {
|
||||||
renderer.End();
|
renderer.End();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user