本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.VertexPositionNormalTexture.Count方法的典型用法代码示例。如果您正苦于以下问题:C# VertexPositionNormalTexture.Count方法的具体用法?C# VertexPositionNormalTexture.Count怎么用?C# VertexPositionNormalTexture.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.VertexPositionNormalTexture
的用法示例。
在下文中一共展示了VertexPositionNormalTexture.Count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTexcoordedVertexList
public static VertexPositionNormalTexture[] CreateTexcoordedVertexList(int numQuads)
{
var verticies = new VertexPositionNormalTexture[numQuads*4];
for (int i = 0; i < verticies.Count(); i++){
verticies[i] = new VertexPositionNormalTexture();
}
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;
}
示例2: LoadModel
protected override void LoadModel(GraphicFactory factory, out BatchInformation[][] BatchInformations, out TextureInformation[][] TextureInformations)
{
List<VertexPositionNormalTexture> vertexList = new List<VertexPositionNormalTexture>();
#if WINDOWS_PHONE || REACH
////gambi shortcut
List<int> indexList2 = new List<int>();
GetVertexData(vertexList, indexList2, terrainObject);
List<short> indexList = new List<short>();
foreach (var item in indexList2)
{
indexList.Add( (short) item);
}
indexList2.Clear();
#else
List<int> indexList = new List<int>();
GetVertexData(vertexList, indexList, terrainObject);
#endif
modelRadius = (terrainObject.BoundingBox.Value.Max - terrainObject.BoundingBox.Value.Max).Length() / 2;
var newVertices = new VertexPositionNormalTexture[vertexList.Count];
vertexList.CopyTo(newVertices);
#if WINDOWS_PHONE|| REACH
var newIndices = new short[indexList.Count];
#else
var newIndices = new int[indexList.Count];
#endif
indexList.CopyTo(newIndices);
VertexBuffer vertexBufferS = factory.CreateVertexBuffer(VertexPositionNormalTexture.VertexDeclaration, newVertices.Count(), BufferUsage.WriteOnly);
vertexBufferS.SetData(newVertices);
#if WINDOWS_PHONE || REACH
IndexBuffer indexBufferS = factory.CreateIndexBuffer(IndexElementSize.SixteenBits,newIndices.Count(),BufferUsage.WriteOnly);
#else
IndexBuffer indexBufferS = factory.CreateIndexBuffer(IndexElementSize.ThirtyTwoBits, newIndices.Count(), BufferUsage.WriteOnly);
#endif
indexBufferS.SetData(newIndices);
BatchInformations = new BatchInformation[1][];
BatchInformation[] b = new BatchInformation[1];
b[0] = new BatchInformation(0, newVertices.Count(), newIndices.Count() / 3, 0, 0, VertexPositionNormalTexture.VertexDeclaration,VertexPositionNormalTexture.VertexDeclaration.VertexStride);
b[0].VertexBuffer = vertexBufferS;
b[0].IndexBuffer = indexBufferS;
b[0].ModelLocalTransformation = Matrix.Identity;
BatchInformations[0] = b;
TextureInformations = new TextureInformation[1][];
TextureInformations[0] = new TextureInformation[1];
TextureInformations[0][0] = new TextureInformation(isInternal, factory, null, null, null, null);
TextureInformations[0][0].LoadTexture();
}
示例3: LoadContent
//.........这里部分代码省略.........
// update: Skybox is verified to be correct with clown-colored reference texture.
// Front face
cubeVertices[0] = new VertexPositionNormalTexture(topLeftFront, Vector3.UnitX, topLeft+Zneg); // NOTE: the normals are bogus but it doesn't matter as we're not doing any kind of lighting with the skybox! duh!
cubeVertices[1] = new VertexPositionNormalTexture(bottomLeftFront, Vector3.UnitX, bottomLeft+Zneg);
cubeVertices[2] = new VertexPositionNormalTexture(topRightFront, Vector3.UnitX, topRight+Zneg);
cubeVertices[3] = new VertexPositionNormalTexture(bottomRightFront, Vector3.UnitX, bottomRight+Zneg);
// Back face
cubeVertices[4] = new VertexPositionNormalTexture(topLeftBack, Vector3.UnitX, topRight+Zpos);
cubeVertices[5] = new VertexPositionNormalTexture(topRightBack, Vector3.UnitX, topLeft+Zpos);
cubeVertices[6] = new VertexPositionNormalTexture(bottomLeftBack, Vector3.UnitX, bottomRight+Zpos);
cubeVertices[7] = new VertexPositionNormalTexture(bottomRightBack, Vector3.UnitX, bottomLeft+Zpos);
// Top face
cubeVertices[8] = new VertexPositionNormalTexture(topLeftFront, Vector3.UnitX, bottomLeft+Ypos);
cubeVertices[9] = new VertexPositionNormalTexture(topRightBack, Vector3.UnitX, topRight+Ypos);
cubeVertices[10] = new VertexPositionNormalTexture(topLeftBack, Vector3.UnitX, topLeft+Ypos);
cubeVertices[11] = new VertexPositionNormalTexture(topRightFront, Vector3.UnitX, bottomRight+Ypos);
// Bottom face
cubeVertices[12] = new VertexPositionNormalTexture(bottomLeftFront, Vector3.UnitX, topLeft+Yneg);
cubeVertices[13] = new VertexPositionNormalTexture(bottomLeftBack, Vector3.UnitX, bottomLeft+Yneg);
cubeVertices[14] = new VertexPositionNormalTexture(bottomRightBack, Vector3.UnitX, bottomRight+Yneg);
cubeVertices[15] = new VertexPositionNormalTexture(bottomRightFront, Vector3.UnitX, topRight+Yneg);
// Left face
cubeVertices[16] = new VertexPositionNormalTexture(topLeftFront, Vector3.UnitX, topRight+Xneg);
cubeVertices[17] = new VertexPositionNormalTexture(bottomLeftBack, Vector3.UnitX, bottomLeft+Xneg);
cubeVertices[18] = new VertexPositionNormalTexture(bottomLeftFront, Vector3.UnitX, bottomRight+Xneg);
cubeVertices[19] = new VertexPositionNormalTexture(topLeftBack, Vector3.UnitX, topLeft+Xneg);
// Right face
cubeVertices[20] = new VertexPositionNormalTexture(topRightFront, Vector3.UnitX, topLeft+Xpos);
cubeVertices[21] = new VertexPositionNormalTexture(bottomRightFront, Vector3.UnitX, bottomLeft+Xpos);
cubeVertices[22] = new VertexPositionNormalTexture(bottomRightBack, Vector3.UnitX, bottomRight+Xpos);
cubeVertices[23] = new VertexPositionNormalTexture(topRightBack, Vector3.UnitX, topRight+Xpos);
#if true
// these are outward-facing triangles, naturally... we want inward-facing ones, I guess?
// but does that mess up our texture-stitching?
// is our texture correctly mapped to begin with??? feck.
// nevermind! handled by resetting rasterizerstate :D
short[] cubeIndices = new short[] {
0, 1, 2, // front face
1, 3, 2,
4, 5, 6, // back face
6, 5, 7,
8, 9, 10, // top face
8, 11, 9,
12, 13, 14, // bottom face
12, 14, 15,
16, 17, 18, // left face
19, 17, 16,
20, 21, 22, // right face
23, 20, 22 };
#else
short[] cubeIndices = new short[] {
0, 2, 1, // front face
1, 2, 3,
4, 6, 5, // back face
6, 7, 5,
8, 10, 9, // top face
8, 9, 11,
12, 14, 13, // bottom face
12, 15, 14,
16, 18, 17, // left face
19, 16, 17,
20, 22, 21, // right face
23, 22, 20 };
#endif
// wow, these sure changed with 4.0:
vertexBuffer = new VertexBuffer(
game.GraphicsDevice,
cubeVertices[0].GetType(),
cubeVertices.Count(),
BufferUsage.WriteOnly);
vertexBuffer.SetData(cubeVertices);
indexBuffer = new IndexBuffer(game.GraphicsDevice,
cubeIndices[0].GetType(),
cubeIndices.Count(),
BufferUsage.WriteOnly);
indexBuffer.SetData(cubeIndices);
// (for the better :D)
depthThingy.DepthBufferEnable = false; // always draw sky box... also, it's drawn first anyway
depthThingy.StencilEnable = false;
rasterThingy.CullMode = CullMode.None; // draw the stupid ugly triangles without culling! woo! no need to rearrange them!
saneRasterizer.CullMode = CullMode.CullCounterClockwiseFace;
base.LoadContent();
}