本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.VertexPositionTexture.Count方法的典型用法代码示例。如果您正苦于以下问题:C# VertexPositionTexture.Count方法的具体用法?C# VertexPositionTexture.Count怎么用?C# VertexPositionTexture.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.VertexPositionTexture
的用法示例。
在下文中一共展示了VertexPositionTexture.Count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadModel
protected override void LoadModel(GraphicFactory factory, out BatchInformation[][] BatchInformations, out TextureInformation[][] TextureInformations)
{
VertexPositionTexture[] billboardVertices = new VertexPositionTexture[positions.Count * 6];
int i = 0;
foreach (var position in positions)
{
billboardVertices[i++] = new VertexPositionTexture(position, new Vector2(0, 0));
billboardVertices[i++] = new VertexPositionTexture(position, new Vector2(1, 0));
billboardVertices[i++] = new VertexPositionTexture(position, new Vector2(1, 1));
billboardVertices[i++] = new VertexPositionTexture(position, new Vector2(0, 0));
billboardVertices[i++] = new VertexPositionTexture(position, new Vector2(1, 1));
billboardVertices[i++] = new VertexPositionTexture(position, new Vector2(0, 1));
}
VertexBuffer vertexBufferS = factory.CreateVertexBuffer(VertexPositionTexture.VertexDeclaration, billboardVertices.Count(), BufferUsage.WriteOnly);
vertexBufferS.SetData(billboardVertices);
int noVertices = billboardVertices.Count();
int noTriangles = noVertices / 3;
BatchInformations = new BatchInformation[1][];
BatchInformation[] b = new BatchInformation[1];
b[0] = new BatchInformation(0, 0, noTriangles, 0, 0, VertexPositionTexture.VertexDeclaration, VertexPositionTexture.VertexDeclaration.VertexStride, BatchType.NORMAL);
b[0].VertexBuffer = vertexBufferS;
b[0].IndexBuffer = null;
BatchInformations[0] = b;
TextureInformations = new TextureInformation[1][];
TextureInformations[0] = new TextureInformation[1];
TextureInformations[0][0] = new TextureInformation(isInternal, factory, diffuseTextureName, null, null, null);
TextureInformations[0][0].LoadTexture();
}
示例2: LoadModel
/// <summary>
/// Loads the model.
/// </summary>
/// <param name="factory">The factory.</param>
/// <param name="BatchInformations">The batch informations.</param>
/// <param name="TextureInformations">The texture informations.</param>
protected override void LoadModel(GraphicFactory factory, out BatchInformation[][] BatchInformations, out TextureInformation[][] TextureInformations)
{
VertexPositionTexture[] billboardVertices = new VertexPositionTexture[4];
int i = 0;
billboardVertices[i++] = new VertexPositionTexture(Vector3.Zero, new Vector2(0, 0));
billboardVertices[i++] = new VertexPositionTexture(Vector3.Zero, new Vector2(1, 0));
billboardVertices[i++] = new VertexPositionTexture(Vector3.Zero, new Vector2(0, 1));
billboardVertices[i++] = new VertexPositionTexture(Vector3.Zero, new Vector2(1, 1));
VertexElement v0 = new VertexElement(0,VertexElementFormat.Vector3,VertexElementUsage.TextureCoordinate,1);
VertexElement v1 = new VertexElement(sizeof(float) * 3,VertexElementFormat.Vector2,VertexElementUsage.TextureCoordinate,2);
vd = new VertexDeclaration(v0, v1);
VertexBuffer InstancedvertexBufferS;
if (dynamicBufferSize != -1)
{
InstancedvertexBufferS = factory.CreateDynamicVertexBuffer(vd, dynamicBufferSize, BufferUsage.WriteOnly);
}
else
{
InstancedvertexBufferS = factory.CreateDynamicVertexBuffer(vd, instances.Count(), BufferUsage.WriteOnly);
}
InstancedvertexBufferS.SetData(instances);
VertexBuffer vertexBufferS = factory.CreateVertexBuffer(VertexPositionTexture.VertexDeclaration, billboardVertices.Count(), BufferUsage.WriteOnly);
vertexBufferS.SetData(billboardVertices);
short[] indices = new short[] { 0,2,1,1,2,3};
IndexBuffer indexBufferS = factory.CreateIndexBuffer(IndexElementSize.SixteenBits, 6, BufferUsage.WriteOnly);
indexBufferS.SetData<short>(indices);
BatchInformations = new BatchInformation[1][];
BatchInformation[] b = new BatchInformation[1];
b[0] = new BatchInformation(0, 4, 2, 0, 0, VertexPositionTexture.VertexDeclaration, VertexPositionTexture.VertexDeclaration.VertexStride,instances.Count());
b[0].VertexBuffer = vertexBufferS;
b[0].IndexBuffer = indexBufferS;
b[0].InstancedVertexBuffer = InstancedvertexBufferS;
BatchInformations[0] = b;
TextureInformations = new TextureInformation[1][];
TextureInformations[0] = new TextureInformation[1];
TextureInformations[0][0] = new TextureInformation(isInternal, factory, diffuseTextureName, null, null, null);
TextureInformations[0][0].LoadTexture();
}
示例3: SetUpWaterVertices
private void SetUpWaterVertices()
{
VertexPositionTexture[] waterVertices = new VertexPositionTexture[6];
waterVertices[0] = new VertexPositionTexture(new Vector3(0, waterHeight, 0), new Vector2(0, 1));
waterVertices[1] = new VertexPositionTexture(new Vector3(terrainWidth, waterHeight, terrainWidth), new Vector2(1, 0));
waterVertices[2] = new VertexPositionTexture(new Vector3(0, waterHeight, terrainWidth), new Vector2(0, 0));
waterVertices[3] = new VertexPositionTexture(new Vector3(0, waterHeight, 0), new Vector2(0, 1));
waterVertices[4] = new VertexPositionTexture(new Vector3(terrainWidth, waterHeight, 0), new Vector2(1, 1));
waterVertices[5] = new VertexPositionTexture(new Vector3(terrainWidth, waterHeight, terrainLength), new Vector2(1, 0));
waterVertexBuffer = new VertexBuffer(device, VertexPositionTexture.VertexDeclaration, waterVertices.Count(), BufferUsage.WriteOnly);
waterVertexBuffer.SetData(waterVertices);
}
示例4: CreateTexcoordedVertexListWithoutNormals
public static VertexPositionTexture[] CreateTexcoordedVertexListWithoutNormals(int numQuads)
{
var verticies = new VertexPositionTexture[numQuads * 4];
for (int i = 0; i < verticies.Count(); i++) {
verticies[i] = new VertexPositionTexture();
}
for (int i = 0; i < verticies.Count(); i += 4) {
verticies[i].TextureCoordinate = new Vector2(0, 0);
verticies[i + 1].TextureCoordinate = new Vector2(0, 1);
verticies[i + 2].TextureCoordinate = new Vector2(1, 1);
verticies[i + 3].TextureCoordinate = new Vector2(1, 0);
}
return verticies;
}