float startX = 100f;
float startY = 100f;
const float layerDepth1 = 0.2f;
vertices1 =
[
new VertexPositionColor(new Vector3(startX, startY, layerDepth1), Color.Green),
new VertexPositionColor(new Vector3(startX + 50, startY + 50, layerDepth1), Color.Green),
new VertexPositionColor(new Vector3(startX - 50, startY + 50, layerDepth1), Color.Green)
];
startX += 25f;
startY += 25f;
const float layerDepth2 = 0.1f;
vertices2 =
[
new VertexPositionColor(new Vector3(startX, startY, layerDepth2), Color.Red),
new VertexPositionColor(new Vector3(startX + 50, startY + 50, layerDepth2), Color.Red),
new VertexPositionColor(new Vector3(startX - 50, startY + 50, layerDepth2), Color.Red)
];
basicEffect = new BasicEffect(GraphicsDevice)
{
VertexColorEnabled = true,
LightingEnabled = false,
World = Matrix.Identity,
View = Matrix.Identity,
Projection = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0, -1)
};
foreach (var pass in basicEffect.CurrentTechnique.Passes)
{
pass.Apply();
GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices1, 0, 1);
GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices2, 0, 1);
}
base.Draw(gameTime);