本文整理匯總了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) );
}