本文整理汇总了C#中Side.GenerateNormals方法的典型用法代码示例。如果您正苦于以下问题:C# Side.GenerateNormals方法的具体用法?C# Side.GenerateNormals怎么用?C# Side.GenerateNormals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Side
的用法示例。
在下文中一共展示了Side.GenerateNormals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public void Create(short prismSides, float baseRadius, float height)
{
topBase = new Base();
bottomBase = new Base();
side = new Side();
topBase.Create(prismSides, baseRadius, height, true);
bottomBase.Create(prismSides, baseRadius, 0, false, topBase.Vertices.Length);
side.Create(prismSides, bottomBase, topBase);
side.GenerateNormals();
indices = new short[topBase.Indices.Length * 2 + side.Indices.Length];
topBase.Indices.CopyTo(indices, 0);
bottomBase.Indices.CopyTo(indices, topBase.Indices.Length);
side.Indices.CopyTo(indices, topBase.Indices.Length + bottomBase.Indices.Length);
vertices = new VertexPositionNormalTexture[topBase.Vertices.Length * 4];
topBase.Vertices.CopyTo(vertices, 0);
bottomBase.Vertices.CopyTo(vertices, topBase.Vertices.Length);
side.Vertices.CopyTo(vertices, topBase.Vertices.Length + bottomBase.Vertices.Length);
primitiveCountPerBase = prismSides*2-1;
primitiveCountSide = prismSides*2;
indexBuffer = new IndexBuffer(graphicsDevice, typeof(short),
indices.Length, BufferUsage.WriteOnly);
vertexBuffer = new VertexBuffer(graphicsDevice, VertexPositionNormalTexture.VertexDeclaration,
vertices.Length, BufferUsage.WriteOnly);
vertexBuffer.SetData(vertices);
indexBuffer.SetData(indices);
}