本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.VertexDeclaration.GetVertexStrideSize方法的典型用法代码示例。如果您正苦于以下问题:C# VertexDeclaration.GetVertexStrideSize方法的具体用法?C# VertexDeclaration.GetVertexStrideSize怎么用?C# VertexDeclaration.GetVertexStrideSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.VertexDeclaration
的用法示例。
在下文中一共展示了VertexDeclaration.GetVertexStrideSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Mesh
/// <summary>
/// 创建一个mesh对象,不使用索引缓冲
/// </summary>
/// <param name="pt"></param>
/// <param name="vb"></param>
/// <param name="vd"></param>
public Mesh(PrimitiveType pt, VertexBuffer vb, VertexDeclaration vd)
{
this.is_visible = true;
this.vertices_count = vb.SizeInBytes / vd.GetVertexStrideSize(0);
this.draw_mode = DrawMode.Primitive;
this.primitive_type = pt;
this.vb = vb;
this.vd = vd;
this.primitive_count = CalcPrimitiveCount();
}
示例2: c0001a1
public c0001a1(int p0, int p1, int p2, int p3, int p4, VertexBuffer p5, IndexBuffer p6, VertexDeclaration p7, object p8)
{
this.f000095 = p5;
this.f0001c1 = p6;
this.f000016 = p0;
this.f00000b = p1;
this.f00000f = p2;
this.f000011 = p3;
this.f000010 = p4;
this.f000098 = p7;
this.f00000e = p8;
this.f000020 = p7.GetVertexStrideSize(0);
}
示例3: ModelMeshPart
internal ModelMeshPart(int streamOffset, int baseVertex, int numVertices, int startIndex, int primitiveCount, VertexBuffer vertexBuffer, IndexBuffer indexBuffer, VertexDeclaration vertexDeclaration, object tag)
{
this.vertexBuffer = vertexBuffer;
this.indexBuffer = indexBuffer;
this.streamOffset = streamOffset;
this.baseVertex = baseVertex;
this.numVertices = numVertices;
this.startIndex = startIndex;
this.primitiveCount = primitiveCount;
this.vertexDeclaration = vertexDeclaration;
this.tag = tag;
this.vertexStride = vertexDeclaration.GetVertexStrideSize(0);
}
示例4: CreateBuffers
void CreateBuffers()
{
vertexDecl = new VertexDeclaration(graphics.GraphicsDevice, VertexElements);
VertexPositionIndexTexture[] vertexData = new VertexPositionIndexTexture[256 * 6];
for (int i = 0; i < 256; i++)
{
vertexData[i * 6 + 0].Position = new Vector3(1, 1, 0);
vertexData[i * 6 + 1].Position = new Vector3(1, -1, 0);
vertexData[i * 6 + 2].Position = new Vector3(-1, -1, 0);
vertexData[i * 6 + 3].Position = new Vector3(-1, -1, 0);
vertexData[i * 6 + 4].Position = new Vector3(-1, 1, 0);
vertexData[i * 6 + 5].Position = new Vector3(1, 1, 0);
vertexData[i * 6 + 0].TexCoo = new GameVector(1, 1);
vertexData[i * 6 + 1].TexCoo = new GameVector(1, 0);
vertexData[i * 6 + 2].TexCoo = new GameVector(0, 0);
vertexData[i * 6 + 3].TexCoo = new GameVector(0, 0);
vertexData[i * 6 + 4].TexCoo = new GameVector(0, 1);
vertexData[i * 6 + 5].TexCoo = new GameVector(1, 1);
vertexData[i * 6 + 0].Index = i;
vertexData[i * 6 + 1].Index = i;
vertexData[i * 6 + 2].Index = i;
vertexData[i * 6 + 3].Index = i;
vertexData[i * 6 + 4].Index = i;
vertexData[i * 6 + 5].Index = i;
}
vertexBuffer = new VertexBuffer(graphics.GraphicsDevice, vertexData.Length * vertexDecl.GetVertexStrideSize(0),
BufferUsage.None);
vertexBuffer.SetData<VertexPositionIndexTexture>(vertexData);
indexBuffer = new IndexBuffer(graphics.GraphicsDevice, 16 * vertexData.Length,
BufferUsage.None, IndexElementSize.SixteenBits);
UInt16[] indexData = new ushort[vertexData.Length];
for (ushort i = 0; i < indexData.Length; i++)
indexData[i] = i;
indexBuffer.SetData<UInt16>(indexData);
}