本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.Model.GetBoundingBox方法的典型用法代码示例。如果您正苦于以下问题:C# Model.GetBoundingBox方法的具体用法?C# Model.GetBoundingBox怎么用?C# Model.GetBoundingBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.Model
的用法示例。
在下文中一共展示了Model.GetBoundingBox方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateMesh
public void CreateMesh(Model model)
{
var box = model.GetBoundingBox();
var vertices = new List<Vector3>();
// stairs
vertices.Add(new Vector3(box.Min.X, box.Min.Y, box.Max.Z));
vertices.Add(new Vector3(box.Min.X, box.Max.Y, box.Min.Z));
vertices.Add(new Vector3(box.Max.X, box.Max.Y, box.Min.Z));
vertices.Add(new Vector3(box.Max.X, box.Min.Y, box.Max.Z));
// west
vertices.Add(new Vector3(box.Min.X, box.Min.Y, box.Min.Z));
// east
vertices.Add(new Vector3(box.Max.X, box.Min.Y, box.Min.Z));
var indices = new List<TriangleVertexIndices>();
// stairs
indices.Add(new TriangleVertexIndices(2, 1, 0));
indices.Add(new TriangleVertexIndices(3, 2, 0));
// west
indices.Add(new TriangleVertexIndices(0, 1, 4));
// east
indices.Add(new TriangleVertexIndices(5, 2, 3));
// north
indices.Add(new TriangleVertexIndices(4, 1, 2));
indices.Add(new TriangleVertexIndices(4, 2, 5));
// bottom
indices.Add(new TriangleVertexIndices(0, 4, 5));
indices.Add(new TriangleVertexIndices(0, 5, 3));
CreateMesh(vertices, indices);
}