Table of Contents

Class Model

Namespace
Microsoft.Xna.Framework.Graphics
Assembly
MonoGame.Framework.dll

A basic 3D model with per mesh parent bones.

public sealed class Model
Inheritance
Model
Inherited Members

Constructors

Model(GraphicsDevice, List<ModelBone>, List<ModelMesh>)

Constructs a model.

public Model(GraphicsDevice graphicsDevice, List<ModelBone> bones, List<ModelMesh> meshes)

Parameters

graphicsDevice GraphicsDevice

A valid reference to GraphicsDevice.

bones List<ModelBone>

The collection of bones.

meshes List<ModelMesh>

The collection of meshes.

Exceptions

ArgumentNullException

graphicsDevice is null.

ArgumentNullException

bones is null.

ArgumentNullException

meshes is null.

Properties

Bones

A collection of ModelBone objects which describe how each mesh in the mesh collection for this model relates to its parent mesh.

public ModelBoneCollection Bones { get; }

Property Value

ModelBoneCollection

Meshes

A collection of ModelMesh objects which compose the model. Each ModelMesh in a model may be moved independently and may be composed of multiple materials identified as ModelMeshPart objects.

public ModelMeshCollection Meshes { get; }

Property Value

ModelMeshCollection

Root

Root bone for this model.

public ModelBone Root { get; set; }

Property Value

ModelBone

Tag

Custom attached object. Skinning data is example of attached object for model.

public object Tag { get; set; }

Property Value

object

Methods

CopyAbsoluteBoneTransformsTo(Matrix[])

Copies bone transforms relative to all parent bones of the each bone from this model to a given array.

public void CopyAbsoluteBoneTransformsTo(Matrix[] destinationBoneTransforms)

Parameters

destinationBoneTransforms Matrix[]

The array receiving the transformed bones.

CopyBoneTransformsFrom(Matrix[])

Copies bone transforms relative to Root bone from a given array to this model.

public void CopyBoneTransformsFrom(Matrix[] sourceBoneTransforms)

Parameters

sourceBoneTransforms Matrix[]

The array of prepared bone transform data.

Exceptions

ArgumentNullException

sourceBoneTransforms is null.

ArgumentOutOfRangeException

sourceBoneTransforms is invalid.

CopyBoneTransformsTo(Matrix[])

Copies bone transforms relative to Root bone from this model to a given array.

public void CopyBoneTransformsTo(Matrix[] destinationBoneTransforms)

Parameters

destinationBoneTransforms Matrix[]

The array receiving the transformed bones.

Exceptions

ArgumentNullException

destinationBoneTransforms is null.

ArgumentOutOfRangeException

destinationBoneTransforms is invalid.

Draw(Matrix, Matrix, Matrix)

Draws the model meshes.

public void Draw(Matrix world, Matrix view, Matrix projection)

Parameters

world Matrix

The world transform.

view Matrix

The view transform.

projection Matrix

The projection transform.