/// <summary> /// Creates a model of a textured box. /// </summary> /// <param name="engine">The <see cref="Engine"/> to use for rendering.</param> /// <param name="texture">The texture to place on the model; <c>null</c> for no texture.</param> /// <param name="width">The width of the box</param> /// <param name="height">The height of the box</param> /// <param name="depth">The depth of the box</param> public static Model Box(Engine engine, ITextureProvider texture = null, float width = 5, float height = 5, float depth = 5) { #region Sanity checks if (engine == null) { throw new ArgumentNullException(nameof(engine)); } #endregion Log.Info("Generate predefined model: Box"); Mesh mesh = MeshGenerator.Box(engine.Device, width, height, depth); MeshHelper.GenerateNormals(engine.Device, ref mesh); return(new Model(mesh, new XMaterial(texture)) { BoundingBox = new BoundingBox(default(Vector3), new Vector3(width, height, depth)) }); }