Spine.RegionAttachment.ComputeWorldVertices C# (CSharp) Method

ComputeWorldVertices() public method

public ComputeWorldVertices ( Bone bone, float worldVertices ) : void
bone Bone
worldVertices float
return void
		public void ComputeWorldVertices (Bone bone, float[] worldVertices) {
			float x = bone.worldX, y = bone.worldY;			
			float a = bone.a, b = bone.b, c = bone.c, d = bone.d;
			float[] offset = this.offset;
			worldVertices[X1] = offset[X1] * a + offset[Y1] * b + x;
			worldVertices[Y1] = offset[X1] * c + offset[Y1] * d + y;
			worldVertices[X2] = offset[X2] * a + offset[Y2] * b + x;
			worldVertices[Y2] = offset[X2] * c + offset[Y2] * d + y;
			worldVertices[X3] = offset[X3] * a + offset[Y3] * b + x;
			worldVertices[Y3] = offset[X3] * c + offset[Y3] * d + y;
			worldVertices[X4] = offset[X4] * a + offset[Y4] * b + x;
			worldVertices[Y4] = offset[X4] * c + offset[Y4] * d + y;
		}
	}

Usage Example

        /*
         *  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
                {
                }
            }
        }
All Usage Examples Of Spine.RegionAttachment::ComputeWorldVertices