当前位置: 首页>>代码示例>>C#>>正文


C# VertexPositionColor.Count方法代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.VertexPositionColor.Count方法的典型用法代码示例。如果您正苦于以下问题:C# VertexPositionColor.Count方法的具体用法?C# VertexPositionColor.Count怎么用?C# VertexPositionColor.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Xna.Framework.Graphics.VertexPositionColor的用法示例。


在下文中一共展示了VertexPositionColor.Count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: drawSkeleton

 private void drawSkeleton(float[] output, Color color)
 {
     int totalVertices = output.Length/2;
     var vertices = new VertexPositionColor[totalVertices];
     for (int j = 0, i=0; j < totalVertices; j = j + 4, i = i+2)
     {
         vertices[i].Position = new Vector3(output[j], output[j + 1], 0);
         vertices[i + 1].Position = new Vector3(output[j + 2], output[j + 3], 0);
         vertices[i].Color = color;
         vertices[i + 1].Color = color;
     }
     if (totalVertices > 0)
     {
         basicEffect.CurrentTechnique.Passes[0].Apply();
         GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineList, vertices, 0, vertices.Count() / 2);
     }
 }
开发者ID:jtavandenheuvel,项目名称:pcg-decoration-new,代码行数:17,代码来源:Game1.cs

示例2: DrawCircle

        public void DrawCircle(Fixture ObjectPhysic, Color colorFill)
        {
            CircleShape circle = (CircleShape)ObjectPhysic.Shape;
            Transform xf;
            ObjectPhysic.Body.GetTransform(out xf);
            Vector2 center = MathUtils.Multiply(ref xf, circle.Position);
            float radius = circle.Radius;

            const int segments = 32;
            const double increment = Math.PI * 2.0 / segments;
            double theta = 0.0;

            Vector2 v0 = center + radius * new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta));
            theta += increment;

            VertexPositionColor[] _vertsFill = new VertexPositionColor[(segments-2)*3];
            for (int i = 1; i < segments - 1; i++)
            {
                Vector2 v1 = center + radius * new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta));
                Vector2 v2 = center +
                             radius *
                             new Vector2((float)Math.Cos(theta + increment), (float)Math.Sin(theta + increment));

                _vertsFill[(i-1) * 3].Position = new Vector3(v0, 0.0f);
                _vertsFill[(i - 1) * 3].Color = colorFill;

                _vertsFill[(i - 1) * 3 + 1].Position = new Vector3(v1, 0.0f);
                _vertsFill[(i - 1) * 3 + 1].Color = colorFill;

                _vertsFill[(i - 1) * 3 + 2].Position = new Vector3(v2, 0.0f);
                _vertsFill[(i - 1) * 3 + 2].Color = colorFill;

                theta += increment;
            }
            EnvironmentVariable.graphics.GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, _vertsFill, 0, (_vertsFill.Count() / 3)  );
        }
开发者ID:stickman,项目名称:gameBungee,代码行数:36,代码来源:AnimationManager.cs


注:本文中的Microsoft.Xna.Framework.Graphics.VertexPositionColor.Count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。