|
@@ -56,6 +56,12 @@ namespace Spine {
|
|
private bool premultipliedAlpha;
|
|
private bool premultipliedAlpha;
|
|
public bool PremultipliedAlpha { get { return premultipliedAlpha; } set { premultipliedAlpha = value; } }
|
|
public bool PremultipliedAlpha { get { return premultipliedAlpha; } set { premultipliedAlpha = value; } }
|
|
|
|
|
|
|
|
+ /// <summary>Attachments are rendered back to front in the x/y plane by the SkeletonRenderer.
|
|
|
|
+ /// Each attachment is offset by a customizable z-spacing value on the z-axis to avoid z-fighting
|
|
|
|
+ /// in shaders with ZWrite enabled. Typical values lie in the range [-0.1, 0].</summary>
|
|
|
|
+ private float zSpacing = 0.0f;
|
|
|
|
+ public float ZSpacing { get { return zSpacing; } set { zSpacing = value; } }
|
|
|
|
+
|
|
public SkeletonRenderer (GraphicsDevice device) {
|
|
public SkeletonRenderer (GraphicsDevice device) {
|
|
this.device = device;
|
|
this.device = device;
|
|
|
|
|
|
@@ -100,6 +106,7 @@ namespace Spine {
|
|
for (int i = 0, n = drawOrder.Count; i < n; i++) {
|
|
for (int i = 0, n = drawOrder.Count; i < n; i++) {
|
|
Slot slot = drawOrderItems[i];
|
|
Slot slot = drawOrderItems[i];
|
|
Attachment attachment = slot.Attachment;
|
|
Attachment attachment = slot.Attachment;
|
|
|
|
+ float attachmentZOffset = zSpacing * i;
|
|
|
|
|
|
float attachmentColorR, attachmentColorG, attachmentColorB, attachmentColorA;
|
|
float attachmentColorR, attachmentColorG, attachmentColorB, attachmentColorA;
|
|
Texture2D texture = null;
|
|
Texture2D texture = null;
|
|
@@ -199,7 +206,7 @@ namespace Spine {
|
|
itemVertices[ii].Color2 = darkColor;
|
|
itemVertices[ii].Color2 = darkColor;
|
|
itemVertices[ii].Position.X = vertices[v];
|
|
itemVertices[ii].Position.X = vertices[v];
|
|
itemVertices[ii].Position.Y = vertices[v + 1];
|
|
itemVertices[ii].Position.Y = vertices[v + 1];
|
|
- itemVertices[ii].Position.Z = 0;
|
|
|
|
|
|
+ itemVertices[ii].Position.Z = attachmentZOffset;
|
|
itemVertices[ii].TextureCoordinate.X = uvs[v];
|
|
itemVertices[ii].TextureCoordinate.X = uvs[v];
|
|
itemVertices[ii].TextureCoordinate.Y = uvs[v + 1];
|
|
itemVertices[ii].TextureCoordinate.Y = uvs[v + 1];
|
|
if (VertexEffect != null) VertexEffect.Transform(ref itemVertices[ii]);
|
|
if (VertexEffect != null) VertexEffect.Transform(ref itemVertices[ii]);
|