本文整理汇总了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);
}
}
示例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) );
}