當前位置: 首頁>>代碼示例>>C#>>正文


C# GraphicsDevice.DrawUserIndexedPrimitives方法代碼示例

本文整理匯總了C#中Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawUserIndexedPrimitives方法的典型用法代碼示例。如果您正苦於以下問題:C# GraphicsDevice.DrawUserIndexedPrimitives方法的具體用法?C# GraphicsDevice.DrawUserIndexedPrimitives怎麽用?C# GraphicsDevice.DrawUserIndexedPrimitives使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Microsoft.Xna.Framework.Graphics.GraphicsDevice的用法示例。


在下文中一共展示了GraphicsDevice.DrawUserIndexedPrimitives方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DrawQuad

        public static void DrawQuad(Effect effect, Quad quad, GraphicsDevice gd)
        {
            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                gd.DrawUserIndexedPrimitives<VertexPositionNormalTexture>(PrimitiveType.TriangleList, quad.Vertices, 0, 4, quad.Indexes, 0, 2);
            }
        }
開發者ID:GarethIW,項目名稱:Psuedo3DRacer,代碼行數:9,代碼來源:Drawing.cs

示例2: Render

 public void Render (GraphicsDevice device, Texture defaultTexture)
 {
     device.Textures[0] = _texture ?? defaultTexture;
     device.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, _vertexBuffer, 0, _vertexBuffer.Length, _indexBuffer, 0, _indexBuffer.Length / 3);
 }
開發者ID:460189852,項目名稱:cocos-sharp-samples,代碼行數:5,代碼來源:DrawCache.cs

示例3: Render

        //float x = 0;
        public void Render(GraphicsDevice device, CQT.Model.Point p1, CQT.Model.Point p2, CQT.Model.Point p3, Color color)
        {
            BasicEffect _effect = new BasicEffect(device);
            _effect.Texture = ColorToTexture(device, color, 1, 1);
            _effect.TextureEnabled = true;
            //_effect.VertexColorEnabled = true;

            VertexPositionTexture[] _vertices = new VertexPositionTexture[3];

            _vertices[0].Position = PointToVector3(ref p1);
            _vertices[1].Position = PointToVector3(ref p2);
            _vertices[2].Position = PointToVector3(ref p3);

            foreach (var pass in _effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                device.DrawUserIndexedPrimitives<VertexPositionTexture>
                (
                    PrimitiveType.TriangleStrip, // same result with TriangleList
                    _vertices,
                    0,
                    _vertices.Length,
                    new int[] { 0, 1, 2 },
                    0,
                    1
                );
            }
        }
開發者ID:Jeremy-Gaillard,項目名稱:Close-Quarters-Tactics,代碼行數:30,代碼來源:VisionView.cs


注:本文中的Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawUserIndexedPrimitives方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。