本文整理匯總了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);
}