必威体育Betway必威体育官网
当前位置:首页 > IT技术

XNA几何图形绘制

时间:2019-10-06 02:44:26来源:IT技术作者:seo实验室小编阅读:69次「手机版」
 

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);
            } 
        }

相关阅读

如何在VS2017上部署XNA

参考链接: [1]http://mxa.codeplex.com/releases/view/630357 [2]https://www.reddit.com/r/csharp/comments/5ul5g0/xna_on_visua

分享到:

栏目导航

推荐阅读

热门阅读