/*
* Actual draw. Pipeline is 'deferred' list of GDI calls
*/
public static void Draw(Skeleton skeleton, Pipeline pipeline)
{
skeleton.UpdateWorldTransform();
foreach (Slot slot in skeleton.Slots)
{
if (slot.Attachment == null)
{
continue;
}
if (slot.Attachment.GetType() == typeof(RegionAttachment))
{
RegionAttachment attach = (RegionAttachment)slot.Attachment;
AtlasRegion region = (AtlasRegion)attach.RendererObject;
float[] worldVertices = new float[2 * 4];
attach.ComputeWorldVertices(slot.Bone, worldVertices);
var color = Color.FromArgb((int)(slot.A * 255), (int)(slot.R * 255), (int)(slot.G * 255), (int)(slot.B * 255));
DrawRegionAttachmnent(pipeline, region, worldVertices, color, slot.Data.BlendMode);
}
else if (slot.Attachment.GetType() == typeof(MeshAttachment))
{
MeshAttachment attach = (MeshAttachment)slot.Attachment;
AtlasRegion region = (AtlasRegion)attach.RendererObject;
float[] worldVertices = new float[attach.WorldVerticesLength];
attach.ComputeWorldVertices(slot, worldVertices);
int[] triangles = attach.Triangles;
var color = Color.FromArgb((int)(slot.A * 255), (int)(slot.R * 255), (int)(slot.G * 255), (int)(slot.B * 255));
DrawMeshAttachmnent(pipeline, region, attach.RegionUVs, worldVertices, triangles, color, slot.Data.BlendMode);
}
else
{
}
}
}