當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。