xna
绘制直线:
public void drawLine(GraphicsDevice gd, vector3 s, Vector3 e, Microsoft.Xna.Framework.color color)
{
VertexPositionColor[] playerVision = new VertexPositionColor[2];
playerVision[0].Position = s;
playerVision[0].Color = color;
playerVision[1].Position = e;
playerVision[1].Color = color;
BasicEffect effect = new BasicEffect(gd);
effect.Projection = Matrix.CreateOrthographicOffCenter(0, gd.Viewport.Width, gd.Viewport.Height, 0, 1, 0);
effect.VertexColorEnabled = true;
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.APPly();
gd.DrawUserPrimitives(PrimitiveType.LineList, playerVision, 0, 1);
}
}
相关阅读
参考链接: [1]http://mxa.codeplex.com/releases/view/630357 [2]https://www.reddit.com/r/csharp/comments/5ul5g0/xna_on_visua