public void Draw(GraphicsDevice device) { // nothing to do if (_batchItemList.Count == 0) { return; } // Determine how many iterations through the drawing code we need to make int batchIndex = 0; int batchCount = _batchItemList.Count; // Iterate through the batches, doing short.MaxValue sets of vertices only. while (batchCount > 0) { // setup the vertexArray array var startIndex = 0; var index = 0; Texture2D tex = null; int numBatchesToProcess = batchCount; if (numBatchesToProcess > MaxBatchSize) { numBatchesToProcess = MaxBatchSize; } EnsureArrayCapacity(numBatchesToProcess); // Draw the batches for (int i = 0; i < numBatchesToProcess; i++, batchIndex++) { SpriteBatchItem item = _batchItemList[batchIndex]; // if the texture changed, we need to flush and bind the new texture var shouldFlush = !ReferenceEquals(item.Texture, tex); if (shouldFlush) { FlushVertexArray(device, startIndex, index); tex = item.Texture; startIndex = index = 0; device.Textures[0] = tex; } // store the SpriteBatchItem data in our vertexArray _vertexArray[index++] = item.vertexTL; _vertexArray[index++] = item.vertexTR; _vertexArray[index++] = item.vertexBL; _vertexArray[index++] = item.vertexBR; // Release the texture and return the item to the queue. item.Texture = null; _freeBatchItemQueue.Enqueue(item); } // flush the remaining vertexArray data FlushVertexArray(device, startIndex, index); // Update our batch count to continue the process of culling down large batches batchCount -= numBatchesToProcess; } _batchItemList.Clear(); }
public void Draw(Skeleton skeleton) { List <Slot> drawOrder = skeleton.DrawOrder; for (int i = 0, n = drawOrder.Count; i < n; i++) { Slot slot = drawOrder[i]; Attachment attachment = slot.Attachment; if (attachment == null) { continue; } if (attachment is RegionAttachment) { RegionAttachment regionAttachment = (RegionAttachment)attachment; SpriteBatchItem item = batcher.CreateBatchItem(); item.Texture = ((XnaAtlasPage)regionAttachment.Region.Page).Texture; item.vertexTL.Color = new Color(slot.R, slot.G, slot.B, slot.A); item.vertexBL.Color = new Color(slot.R, slot.G, slot.B, slot.A); item.vertexBR.Color = new Color(slot.R, slot.G, slot.B, slot.A); item.vertexTR.Color = new Color(slot.R, slot.G, slot.B, slot.A); regionAttachment.UpdateVertices(slot.Bone); float[] vertices = regionAttachment.Vertices; item.vertexTL.Position.X = vertices[RegionAttachment.X1]; item.vertexTL.Position.Y = vertices[RegionAttachment.Y1]; item.vertexTL.Position.Z = 0; item.vertexBL.Position.X = vertices[RegionAttachment.X2]; item.vertexBL.Position.Y = vertices[RegionAttachment.Y2]; item.vertexBL.Position.Z = 0; item.vertexBR.Position.X = vertices[RegionAttachment.X3]; item.vertexBR.Position.Y = vertices[RegionAttachment.Y3]; item.vertexBR.Position.Z = 0; item.vertexTR.Position.X = vertices[RegionAttachment.X4]; item.vertexTR.Position.Y = vertices[RegionAttachment.Y4]; item.vertexTR.Position.Z = 0; float[] uvs = regionAttachment.UVs; item.vertexTL.TextureCoordinate.X = uvs[RegionAttachment.X1]; item.vertexTL.TextureCoordinate.Y = uvs[RegionAttachment.Y1]; item.vertexBL.TextureCoordinate.X = uvs[RegionAttachment.X2]; item.vertexBL.TextureCoordinate.Y = uvs[RegionAttachment.Y2]; item.vertexBR.TextureCoordinate.X = uvs[RegionAttachment.X3]; item.vertexBR.TextureCoordinate.Y = uvs[RegionAttachment.Y3]; item.vertexTR.TextureCoordinate.X = uvs[RegionAttachment.X4]; item.vertexTR.TextureCoordinate.Y = uvs[RegionAttachment.Y4]; } } }
public void Draw(Skeleton skeleton, float Z) { List <Slot> DrawOrder = skeleton.DrawOrder; float depth = Z; float depth_offset = 0.0001f; for (int i = 0; i < DrawOrder.Count; i++) { Slot slot = DrawOrder[i]; RegionAttachment regionAttachment = slot.Attachment as RegionAttachment; if (regionAttachment != null) { SpriteBatchItem item = new SpriteBatchItem(); AtlasRegion region = (AtlasRegion)regionAttachment.RendererObject; item.Texture = (Texture)region.page.rendererObject; byte r = (byte)(skeleton.R * slot.R * 255); byte g = (byte)(skeleton.G * slot.G * 255); byte b = (byte)(skeleton.B * slot.B * 255); byte a = (byte)(skeleton.A * slot.A * 255); item.vertexTL.Color = Color.FromArgb(r, g, b, a); item.vertexBL.Color = Color.FromArgb(r, g, b, a); item.vertexBR.Color = Color.FromArgb(r, g, b, a); item.vertexTR.Color = Color.FromArgb(r, g, b, a); float[] vertices = this.vertices; regionAttachment.ComputeVertices(skeleton.X, skeleton.Y, slot.Bone, vertices); item.vertexTL.Position.X = vertices[RegionAttachment.X1]; item.vertexTL.Position.Y = vertices[RegionAttachment.Y1]; item.vertexTL.Position.Z = depth; item.vertexBL.Position.X = vertices[RegionAttachment.X2]; item.vertexBL.Position.Y = vertices[RegionAttachment.Y2]; item.vertexBL.Position.Z = depth; item.vertexBR.Position.X = vertices[RegionAttachment.X3]; item.vertexBR.Position.Y = vertices[RegionAttachment.Y3]; item.vertexBR.Position.Z = depth; item.vertexTR.Position.X = vertices[RegionAttachment.X4]; item.vertexTR.Position.Y = vertices[RegionAttachment.Y4]; item.vertexTR.Position.Z = depth; float[] uvs = regionAttachment.UVs; item.vertexTL.TextureCoordinate.X = uvs[RegionAttachment.X1]; item.vertexTL.TextureCoordinate.Y = uvs[RegionAttachment.Y1]; item.vertexBL.TextureCoordinate.X = uvs[RegionAttachment.X2]; item.vertexBL.TextureCoordinate.Y = uvs[RegionAttachment.Y2]; item.vertexBR.TextureCoordinate.X = uvs[RegionAttachment.X3]; item.vertexBR.TextureCoordinate.Y = uvs[RegionAttachment.Y3]; item.vertexTR.TextureCoordinate.X = uvs[RegionAttachment.X4]; item.vertexTR.TextureCoordinate.Y = uvs[RegionAttachment.Y4]; this.DrawItem(item); depth += depth_offset; } } }
private void DrawItem(SpriteBatchItem item) { GL.BindTexture(TextureTarget.Texture2D, item.Texture.ID); GL.Begin(BeginMode.Quads); { GL.TexCoord2(item.vertexTL.TextureCoordinate); GL.Color3(item.vertexTL.Color); GL.Vertex3(item.vertexTL.Position); GL.TexCoord2(item.vertexTR.TextureCoordinate); GL.Color3(item.vertexTR.Color); GL.Vertex3(item.vertexTR.Position); GL.TexCoord2(item.vertexBR.TextureCoordinate); GL.Color3(item.vertexBR.Color); GL.Vertex3(item.vertexBR.Position); GL.TexCoord2(item.vertexBL.TextureCoordinate); GL.Color3(item.vertexBL.Color); GL.Vertex3(item.vertexBL.Position); } GL.End(); }
private void DrawItem(SpriteBatchItem item) { GL.BindTexture(TextureTarget.Texture2D, item.Texture); GL.Begin(PrimitiveType.Quads); { GL.TexCoord2(item.vertexTL.TextureCoordinate); GL.Color4(item.vertexTL.Color); GL.Vertex3(item.vertexTL.Position); GL.TexCoord2(item.vertexTR.TextureCoordinate); GL.Color4(item.vertexTR.Color); GL.Vertex3(item.vertexTR.Position); GL.TexCoord2(item.vertexBR.TextureCoordinate); GL.Color4(item.vertexBR.Color); GL.Vertex3(item.vertexBR.Position); GL.TexCoord2(item.vertexBL.TextureCoordinate); GL.Color4(item.vertexBL.Color); GL.Vertex3(item.vertexBL.Position); } GL.End(); }
public void Draw(Skeleton skeleton, Vector3 Position) { List<Slot> DrawOrder = skeleton.DrawOrder; float depth = Z; float depth_offset = 0.0001f; for (int i = 0; i < DrawOrder.Count; i++) { Slot slot = DrawOrder[i]; RegionAttachment regionAttachment = slot.Attachment as RegionAttachment; if (regionAttachment != null) { SpriteBatchItem item = new SpriteBatchItem(); AtlasRegion region = (AtlasRegion)regionAttachment.RendererObject; item.Texture = (int)region.page.rendererObject; byte r = (byte)(skeleton.R * slot.R * 255); byte g = (byte)(skeleton.G * slot.G * 255); byte b = (byte)(skeleton.B * slot.B * 255); byte a = (byte)(skeleton.A * slot.A * 255); item.vertexTL.Color = Color.FromArgb(a, r, g, b); item.vertexBL.Color = Color.FromArgb(a, r, g, b); item.vertexBR.Color = Color.FromArgb(a, r, g, b); item.vertexTR.Color = Color.FromArgb(a, r, g, b); float[] vertices = this.vertices; regionAttachment.ComputeWorldVertices(skeleton.X, skeleton.Y, slot.Bone, vertices); item.vertexTL.Position.X = vertices[RegionAttachment.X1]; item.vertexTL.Position.Y = vertices[RegionAttachment.Y1]; item.vertexTL.Position.Z = depth; item.vertexBL.Position.X = vertices[RegionAttachment.X2]; item.vertexBL.Position.Y = vertices[RegionAttachment.Y2]; item.vertexBL.Position.Z = depth; item.vertexBR.Position.X = vertices[RegionAttachment.X3]; item.vertexBR.Position.Y = vertices[RegionAttachment.Y3]; item.vertexBR.Position.Z = depth; item.vertexTR.Position.X = vertices[RegionAttachment.X4]; item.vertexTR.Position.Y = vertices[RegionAttachment.Y4]; item.vertexTR.Position.Z = depth; float[] uvs = regionAttachment.UVs; item.vertexTL.TextureCoordinate.X = uvs[RegionAttachment.X1]; item.vertexTL.TextureCoordinate.Y = uvs[RegionAttachment.Y1]; item.vertexBL.TextureCoordinate.X = uvs[RegionAttachment.X2]; item.vertexBL.TextureCoordinate.Y = uvs[RegionAttachment.Y2]; item.vertexBR.TextureCoordinate.X = uvs[RegionAttachment.X3]; item.vertexBR.TextureCoordinate.Y = uvs[RegionAttachment.Y3]; item.vertexTR.TextureCoordinate.X = uvs[RegionAttachment.X4]; item.vertexTR.TextureCoordinate.Y = uvs[RegionAttachment.Y4]; this.DrawItem(item); depth += depth_offset; } } }
/// <summary> /// Create an instance of SpriteBatchItem if there is none available in the free item queue. Otherwise, /// a previously allocated SpriteBatchItem is reused. /// </summary> /// <returns></returns> public SpriteBatchItem CreateBatchItem() { SpriteBatchItem item; if (_freeBatchItemQueue.Count > 0) { item = _freeBatchItemQueue.Dequeue(); } else { item = new SpriteBatchItem(); } _batchItemList.Add(item); return(item); }
/// <summary> /// A test method written by Dan. This is to sneak PattyPetitGiant's draw calls onto Spine's VertexArray. /// </summary> /// <param name="texture">Source texture.</param> /// <param name="srcRectangle">Source rectangle.</param> /// <param name="dstPosition">Destination location</param> /// <param name="color">Color tint.</param> /// <param name="rotation">Rotation around center of graphic to draw.</param> /// <param name="scale">Scale from centerpoint of graphic to draw.</param> public void DrawSpriteToSpineVertexArray(Texture2D texture, Rectangle srcRectangle, Vector2 dstPosition, Color color, float rotation, Vector2 scale) { Rectangle dstRectangle = new Rectangle((int)dstPosition.X, (int)dstPosition.Y, srcRectangle.Width + 1, srcRectangle.Height + 1); SpriteBatchItem item = batcher.CreateBatchItem(); item.Texture = texture; //set wall colors item.vertexTL.Color = color; item.vertexBL.Color = color; item.vertexBR.Color = color; item.vertexTR.Color = color; item.vertexTL.Position.X = dstRectangle.Left; item.vertexTL.Position.Y = dstRectangle.Top; item.vertexTL.Position.Z = 0; item.vertexBL.Position.X = dstRectangle.Left; item.vertexBL.Position.Y = dstRectangle.Bottom; item.vertexBL.Position.Z = 0; item.vertexBR.Position.X = dstRectangle.Right; item.vertexBR.Position.Y = dstRectangle.Bottom; item.vertexBR.Position.Z = 0; item.vertexTR.Position.X = dstRectangle.Right; item.vertexTR.Position.Y = dstRectangle.Top; item.vertexTR.Position.Z = 0; item.vertexTL.TextureCoordinate = GetUV(texture, srcRectangle.Left, srcRectangle.Top); item.vertexBL.TextureCoordinate = GetUV(texture, srcRectangle.Left, srcRectangle.Bottom); item.vertexBR.TextureCoordinate = GetUV(texture, srcRectangle.Right, srcRectangle.Bottom); item.vertexTR.TextureCoordinate = GetUV(texture, srcRectangle.Right, srcRectangle.Top); Matrix world = Matrix.CreateTranslation(((srcRectangle.Width / 2) + dstRectangle.X) * -1, ((srcRectangle.Height / 2) + dstRectangle.Y) * -1, 0) * Matrix.CreateRotationZ(rotation) * Matrix.CreateScale(scale.X, scale.Y, 0.0f) * Matrix.CreateTranslation(((srcRectangle.Width / 2) + dstRectangle.X), ((srcRectangle.Height / 2) + dstRectangle.Y), 0) * effect.World; Vector3.Transform(ref item.vertexTL.Position, ref world, out item.vertexTL.Position); Vector3.Transform(ref item.vertexBL.Position, ref world, out item.vertexBL.Position); Vector3.Transform(ref item.vertexBR.Position, ref world, out item.vertexBR.Position); Vector3.Transform(ref item.vertexTR.Position, ref world, out item.vertexTR.Position); }
/// <summary> /// A test method written by Dan. This is to sneak PattyPetitGiant's draw calls onto Spine's VertexArray. Used for tiles to save time /// </summary> /// <param name="texture">Source texture.</param> /// <param name="srcRectangle">Source rectangle.</param> /// <param name="dstPosition">Destination location</param> public void DrawSpriteToSpineVertexArray(Texture2D texture, Rectangle srcRectangle, Vector2 dstPosition) { Rectangle dstRectangle = new Rectangle((int)dstPosition.X, (int)dstPosition.Y, srcRectangle.Width + 1, srcRectangle.Height + 1); SpriteBatchItem item = batcher.CreateBatchItem(); item.Texture = texture; //set wall colors item.vertexTL.Color = Color.White; item.vertexBL.Color = Color.White; item.vertexBR.Color = Color.White; item.vertexTR.Color = Color.White; item.vertexTL.Position.X = dstRectangle.Left; item.vertexTL.Position.Y = dstRectangle.Top; item.vertexTL.Position.Z = 0; item.vertexBL.Position.X = dstRectangle.Left; item.vertexBL.Position.Y = dstRectangle.Bottom; item.vertexBL.Position.Z = 0; item.vertexBR.Position.X = dstRectangle.Right; item.vertexBR.Position.Y = dstRectangle.Bottom; item.vertexBR.Position.Z = 0; item.vertexTR.Position.X = dstRectangle.Right; item.vertexTR.Position.Y = dstRectangle.Top; item.vertexTR.Position.Z = 0; item.vertexTL.TextureCoordinate = GetUV(texture, srcRectangle.Left, srcRectangle.Top); item.vertexBL.TextureCoordinate = GetUV(texture, srcRectangle.Left, srcRectangle.Bottom); item.vertexBR.TextureCoordinate = GetUV(texture, srcRectangle.Right, srcRectangle.Bottom); item.vertexTR.TextureCoordinate = GetUV(texture, srcRectangle.Right, srcRectangle.Top); Matrix world = effect.World; Vector3.Transform(ref item.vertexTL.Position, ref world, out item.vertexTL.Position); Vector3.Transform(ref item.vertexBL.Position, ref world, out item.vertexBL.Position); Vector3.Transform(ref item.vertexBR.Position, ref world, out item.vertexBR.Position); Vector3.Transform(ref item.vertexTR.Position, ref world, out item.vertexTR.Position); }
public void Draw(Skeleton skeleton) { List <Slot> drawOrder = skeleton.DrawOrder; for (int i = 0, n = drawOrder.Count; i < n; i++) { Slot slot = drawOrder[i]; Attachment attachment = slot.Attachment; if (attachment is RegionAttachment) { RegionAttachment regionAttachment = (RegionAttachment)attachment; SpriteBatchItem item = batcher.CreateBatchItem(); item.Texture = (Texture2D)regionAttachment.Region.page.texture; byte r = (byte)(skeleton.R * slot.R * 255); byte g = (byte)(skeleton.G * slot.G * 255); byte b = (byte)(skeleton.B * slot.B * 255); byte a = (byte)(skeleton.A * slot.A * 255); item.vertexTL.Color.R = r; item.vertexTL.Color.G = g; item.vertexTL.Color.B = b; item.vertexTL.Color.A = a; item.vertexBL.Color.R = r; item.vertexBL.Color.G = g; item.vertexBL.Color.B = b; item.vertexBL.Color.A = a; item.vertexBR.Color.R = r; item.vertexBR.Color.G = g; item.vertexBR.Color.B = b; item.vertexBR.Color.A = a; item.vertexTR.Color.R = r; item.vertexTR.Color.G = g; item.vertexTR.Color.B = b; item.vertexTR.Color.A = a; regionAttachment.UpdateVertices(slot.Bone); float[] vertices = regionAttachment.Vertices; item.vertexTL.Position.X = vertices[RegionAttachment.X1]; item.vertexTL.Position.Y = vertices[RegionAttachment.Y1]; item.vertexTL.Position.Z = 0; item.vertexBL.Position.X = vertices[RegionAttachment.X2]; item.vertexBL.Position.Y = vertices[RegionAttachment.Y2]; item.vertexBL.Position.Z = 0; item.vertexBR.Position.X = vertices[RegionAttachment.X3]; item.vertexBR.Position.Y = vertices[RegionAttachment.Y3]; item.vertexBR.Position.Z = 0; item.vertexTR.Position.X = vertices[RegionAttachment.X4]; item.vertexTR.Position.Y = vertices[RegionAttachment.Y4]; item.vertexTR.Position.Z = 0; AtlasRegion region = regionAttachment.Region; if (region.rotate) { item.vertexBL.TextureCoordinate.X = region.u; item.vertexBL.TextureCoordinate.Y = region.v2; item.vertexBR.TextureCoordinate.X = region.u; item.vertexBR.TextureCoordinate.Y = region.v; item.vertexTR.TextureCoordinate.X = region.u2; item.vertexTR.TextureCoordinate.Y = region.v; item.vertexTL.TextureCoordinate.X = region.u2; item.vertexTL.TextureCoordinate.Y = region.v2; } else { item.vertexTL.TextureCoordinate.X = region.u; item.vertexTL.TextureCoordinate.Y = region.v2; item.vertexBL.TextureCoordinate.X = region.u; item.vertexBL.TextureCoordinate.Y = region.v; item.vertexBR.TextureCoordinate.X = region.u2; item.vertexBR.TextureCoordinate.Y = region.v; item.vertexTR.TextureCoordinate.X = region.u2; item.vertexTR.TextureCoordinate.Y = region.v2; } } } }
public void Draw(Skeleton skeleton) { List <Slot> drawOrder = skeleton.DrawOrder; float x = skeleton.X, y = skeleton.Y; float skeletonR = skeleton.R, skeletonG = skeleton.G, skeletonB = skeleton.B, skeletonA = skeleton.A; for (int i = 0, n = drawOrder.Count; i < n; i++) { Slot slot = drawOrder[i]; RegionAttachment regionAttachment = slot.Attachment as RegionAttachment; if (regionAttachment != null) { BlendState blend = slot.Data.AdditiveBlending ? BlendState.Additive : defaultBlendState; if (device.BlendState != blend) { End(); device.BlendState = blend; } SpriteBatchItem item = batcher.CreateBatchItem(); AtlasRegion region = (AtlasRegion)regionAttachment.RendererObject; item.Texture = (Texture2D)region.page.rendererObject; Color color; float a = skeletonA * slot.A; if (premultipliedAlpha) { color = new Color(skeletonR * slot.R * a, skeletonG * slot.G * a, skeletonB * slot.B * a, a); } else { color = new Color(skeletonR * slot.R, skeletonG * slot.G, skeletonB * slot.B, a); } item.vertexTL.Color = color; item.vertexBL.Color = color; item.vertexBR.Color = color; item.vertexTR.Color = color; float[] vertices = this.vertices; regionAttachment.ComputeWorldVertices(x, y, slot.Bone, vertices); item.vertexTL.Position.X = vertices[RegionAttachment.X1]; item.vertexTL.Position.Y = vertices[RegionAttachment.Y1]; item.vertexTL.Position.Z = 0; item.vertexBL.Position.X = vertices[RegionAttachment.X2]; item.vertexBL.Position.Y = vertices[RegionAttachment.Y2]; item.vertexBL.Position.Z = 0; item.vertexBR.Position.X = vertices[RegionAttachment.X3]; item.vertexBR.Position.Y = vertices[RegionAttachment.Y3]; item.vertexBR.Position.Z = 0; item.vertexTR.Position.X = vertices[RegionAttachment.X4]; item.vertexTR.Position.Y = vertices[RegionAttachment.Y4]; item.vertexTR.Position.Z = 0; float[] uvs = regionAttachment.UVs; item.vertexTL.TextureCoordinate.X = uvs[RegionAttachment.X1]; item.vertexTL.TextureCoordinate.Y = uvs[RegionAttachment.Y1]; item.vertexBL.TextureCoordinate.X = uvs[RegionAttachment.X2]; item.vertexBL.TextureCoordinate.Y = uvs[RegionAttachment.Y2]; item.vertexBR.TextureCoordinate.X = uvs[RegionAttachment.X3]; item.vertexBR.TextureCoordinate.Y = uvs[RegionAttachment.Y3]; item.vertexTR.TextureCoordinate.X = uvs[RegionAttachment.X4]; item.vertexTR.TextureCoordinate.Y = uvs[RegionAttachment.Y4]; } } }
public void Draw(Skeleton skeleton) { List <Slot> drawOrder = skeleton.DrawOrder; for (int i = 0, n = drawOrder.Count; i < n; i++) { Slot slot = drawOrder[i]; RegionAttachment regionAttachment = slot.Attachment as RegionAttachment; if (regionAttachment != null) { SpriteBatchItem item = batcher.CreateBatchItem(); item.Texture = (Texture2D)regionAttachment.RendererObject; byte r = (byte)(skeleton.R * slot.R * 255); byte g = (byte)(skeleton.G * slot.G * 255); byte b = (byte)(skeleton.B * slot.B * 255); byte a = (byte)(skeleton.A * slot.A * 255); item.vertexTL.Color.R = r; item.vertexTL.Color.G = g; item.vertexTL.Color.B = b; item.vertexTL.Color.A = a; item.vertexBL.Color.R = r; item.vertexBL.Color.G = g; item.vertexBL.Color.B = b; item.vertexBL.Color.A = a; item.vertexBR.Color.R = r; item.vertexBR.Color.G = g; item.vertexBR.Color.B = b; item.vertexBR.Color.A = a; item.vertexTR.Color.R = r; item.vertexTR.Color.G = g; item.vertexTR.Color.B = b; item.vertexTR.Color.A = a; float[] vertices = this.vertices; regionAttachment.ComputeVertices(slot.Bone, vertices); item.vertexTL.Position.X = vertices[RegionAttachment.X1]; item.vertexTL.Position.Y = vertices[RegionAttachment.Y1]; item.vertexTL.Position.Z = 0; item.vertexBL.Position.X = vertices[RegionAttachment.X2]; item.vertexBL.Position.Y = vertices[RegionAttachment.Y2]; item.vertexBL.Position.Z = 0; item.vertexBR.Position.X = vertices[RegionAttachment.X3]; item.vertexBR.Position.Y = vertices[RegionAttachment.Y3]; item.vertexBR.Position.Z = 0; item.vertexTR.Position.X = vertices[RegionAttachment.X4]; item.vertexTR.Position.Y = vertices[RegionAttachment.Y4]; item.vertexTR.Position.Z = 0; float[] uvs = regionAttachment.UVs; item.vertexTL.TextureCoordinate.X = uvs[RegionAttachment.X1]; item.vertexTL.TextureCoordinate.Y = uvs[RegionAttachment.Y1]; item.vertexBL.TextureCoordinate.X = uvs[RegionAttachment.X2]; item.vertexBL.TextureCoordinate.Y = uvs[RegionAttachment.Y2]; item.vertexBR.TextureCoordinate.X = uvs[RegionAttachment.X3]; item.vertexBR.TextureCoordinate.Y = uvs[RegionAttachment.Y3]; item.vertexTR.TextureCoordinate.X = uvs[RegionAttachment.X4]; item.vertexTR.TextureCoordinate.Y = uvs[RegionAttachment.Y4]; } } }