TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class Model in Tinman.Engine.Models

Default implementation of the IModel interface.

sealed class Model implements IModel

Public / Attributes

ChildCount

The number of child models.

public property ChildCount { get }
type int32
value [>=0] The child model count.
implements IModel.ChildCount

See also:

IModel.ChildAt
IModel.ChildTransformAt

Collider

The collider object for this model.

public property Collider { get }
type IModelCollider
value [not-null] The collider object.
implements IModel.Collider

Flags

The model flags.

public property Flags { get set }
type ModelFlags
value The model flags.
implements IModel.Flags

Name

The name of this model.

public property Name { get set }
type string
value The model name, will either be null or non-empty.
implements IModel.Name

PartCount

The number of model parts.

public property PartCount { get }
type int32
value [>=0] The model part count.
implements IModel.PartCount

See also:

IModel.PartAt

Unit

The unit of measure in which model-space coordinates are expressed.

public property Unit { get set }
type UnitOfMeasure
value The model-space unit. If set to null, the default value is returned instead.
implements IModel.Unit

Remarks:

Defaults to Metre.

Public / Constructors

Chunk

Creates a 3D model for the given terrain mesh chunk.

public static method Chunk (MeshChunk chunk)
type IModel
params chunk [not-null] The terrain mesh chunk.
returns [not-null] The 3D model.

Remarks:

The model vertices will be in the local coordinate system of the mesh chunk (see Matrix).

If present, layer textures of the model chunk will be mapped as follows:

Load

Loads a 3D model from a file using Any.

public static method Load (Path file, ReadModelFlags flags = ReadModelFlags.None)
type IModel
params file [not-null] The file path.
  flags Optional model reader flags to use, if the matching ReadModel instance returns a ModelReader object. Will be ignored otherwise. Defaults to None.
returns [not-null] The read model.

Exceptions:


Loads a 3D model from a file using Any.

public static method Load (IFileData file, ReadModelFlags flags = ReadModelFlags.None)
type IModel
params file [not-null] The file data.
  flags Optional model reader flags to use, if the matching ReadModel instance returns a ModelReader object. Will be ignored otherwise. Defaults to None.
returns [not-null] The read model.

Exceptions:

Model

Creates a new instance of Model.

public constructor Model ()

Creates a new instance of Model.

public constructor Model (string name)
params name Initial value for Name.

Creates a new instance of Model.

public constructor Model (UnitOfMeasure unit)
params unit Initial value for Unit.

Read

Reads a 3D model from a file using Any.

[OwnerReturn]
public static method Read (Path file)
type IModelReader
params file [not-null] The file path.
returns [not-null] The model reader.

Exceptions:


Reads a 3D model from a file using Any.

[OwnerReturn]
public static method Read (IFileData file)
type IModelReader
params file [not-null] The file data.
returns [not-null] The model reader.

Exceptions:

Public / Methods

ChildAdd

Adds a child model.

public method ChildAdd (IModel child)
type Model
params child [not-null] The model to add as a child.
returns [not-null] this

Adds a child model.

public method ChildAdd (IModel child, Vec3D translation)
type Model
params child [not-null] The model to add as a child.
  translation The translation component of the child-to-parent transformation.
returns [not-null] this

Remarks:

The child-to-parent transformation is specified with the given translation.


Adds a child model.

public method ChildAdd (IModel child, Mat4D matrix)
type Model
params child [not-null] The model to add as a child.
  matrix The child-to-parent transformation matrix to use. The matrix is expected to be decomposable into a translation, rotation and scaling component.
returns [not-null] this

See also:

AffineTransform.FromMatrix

Adds a child model.

public method ChildAdd (IModel child, AffineTransform transform)
type Model
params child [not-null] The model to add as a child.
  transform The child-to-parent model transformation.
returns [not-null] this

Adds a child model.

public method ChildAdd (IModel child, Vec3D translation, Mat3D rotation)
type Model
params child [not-null] The model to add as a child.
  translation The translation component of the child-to-parent transformation.
  rotation The rotation component of the child-to-parent transformation.
returns [not-null] this

Remarks:

The child-to-parent transformation is specified with the given translation and rotation, i.e. the child model is rotated first and then translated.


Adds a child model.

public method ChildAdd (IModel child, Vec3D translation, Mat3D rotation, float64 scale)
type Model
params child [not-null] The model to add as a child.
  translation The translation component of the child-to-parent transformation.
  rotation The rotation component of the child-to-parent transformation.
  scale The scale component of the child-to-parent transformation.
returns [not-null] this

Remarks:

The child-to-parent transformation is specified with the given translation, rotation and scale components, i.e. the child model is scaled first, then rotated and finally translated.

ChildAt

Returns the index-th child model.

[Pure]
public method ChildAt (int32 index)
type IModel
params index [0..ChildCount-1] The child model index.
returns [not-null] The child model.
implements IModel.ChildAt

See also:

IModel.ChildTransformAt

ChildRemove

Removes a child model.

public method ChildRemove (IModel child)
type Model
params child [not-null] The model to remove.
returns [not-null] this

Remarks:

If the given model is not a child of this model, the method silently returns.

ChildRemoveAll

Removes all child models.

public method ChildRemoveAll ()
type Model
returns [not-null] this

ChildTransformAt

Returns the child-to-parent transformation matrix of the index-th child model.

[Pure]
public method ChildTransformAt (int32 index)
type AffineTransform
params index [0..ChildCount-1] The child model index.
returns The transformation from the child model to this model as parent.
implements IModel.ChildTransformAt

Remarks:

The transformation matrix uses the unit of measure of the parent model (see Unit).

See also:

IModel.ChildAt

ColliderDirty

Invalidates the model hierarchy of the current Collider instance.

public method ColliderDirty ()

Remarks:

Call this method when the model structure or geometry has been modified. A new model collider will be created the next time the Collider property is get.

The following methods resp. setter will invalidate the model hierarchy automatically; when using these, it is not necessary to call the ColliderDirty method:

PartAdd

Adds a model part.

public method PartAdd (IModelPart part)
type Model
params part [not-null] The model part to add.
returns [not-null] this

PartAt

Returns the index-th model part.

[Pure]
public method PartAt (int32 index)
type IModelPart
params index [0..PartCount-1] The model part index.
returns [not-null] The model part.
implements IModel.PartAt

PartRemove

Removes a model part.

public method PartRemove (IModelPart part)
type Model
params part [not-null] The model part to remove.
returns [not-null] this

PartRemoveAll

Removes all model parts.

public method PartRemoveAll ()
type Model
returns [not-null] this

PartRemoveWhere

Removes all model parts for which the given predicate evaluates to true.

public method PartRemoveWhere (PredicateDelegate<IModelPart> predicate)
type Model
params predicate [not-null] The predicate to evaluate for each model part.
returns [not-null] this

PrepareLazy

Prepares all lazy-loaded data for this model.

public method PrepareLazy ()
type IModel
returns [not-null] this
implements IModel.PrepareLazy

Exceptions:

UseGeometryInstancing

Configures geometry instancing for this model.

public method UseGeometryInstancing (IResourceHandle instanceBuffer)
type IModel
params instanceBuffer The resource handle that returns an IVertexBuffer object that holds instance data to use for this model object or null to disable geometry instancing. The instanceBuffer value will be returned by the InstanceBuffer property of the geometry objects of the returned model and all its descendants.
returns [not-null] The resulting model.
implements IModel.UseGeometryInstancing

See also:

IModelGeometry.InstanceBuffer

Logging

Logger

The logger object of this class.

public static readonly field Logger
type ILogger