C# XNA:DrawUserPrimitives-图形填充矩形

C# XNA:DrawUserPrimitives-图形填充矩形,c#,xna,primitive,C#,Xna,Primitive,我有一个使用“DrawUserPrimitives”的工作线绘制代码 我已经设置了一个函数,使用线条带和矢量位置颜色“绘制矩形” VertexPositionColor[] lineVertices = new VertexPositionColor[5]; lineVertices[0].Position = new Vector3(inMidPoint.X - halfWidth, inMidPoint.Y - halfLength, 0); lineVertices[0].Color =

我有一个使用“DrawUserPrimitives”的工作线绘制代码 我已经设置了一个函数,使用线条带和矢量位置颜色“绘制矩形”

VertexPositionColor[] lineVertices = new VertexPositionColor[5];
lineVertices[0].Position = new Vector3(inMidPoint.X - halfWidth, inMidPoint.Y - halfLength, 0);
lineVertices[0].Color = inLineColor;
等等

basicEffect.currentTechnology.Passes[0].Apply();
mGraphics.GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineStrip,lineVertices,0,lineVertices.Length-1);

使用此方法,我可以创建矩形的彩色轮廓。现在,如何使用此系统用颜色填充矩形?

使用三角形笔划而不是线条-

basicEffect.CurrentTechnique.Passes[0].Apply();
mGraphics.GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineStrip, lineVertices, 0, lineVertices.Length - 1);