Model

Description

sealed class Tinman.Engine.Models.Model

Derived from

IModel

Default implementation of the IModel interface.

Public / Constructors

Build


public static method Build → ()

returns → ModelBuilder

The builder.

Builds a new model.

Chunk


public static method Chunk → (2)

chunk in : MeshChunk

[not-null]
The terrain mesh chunk.

local opt : bool = true

Output the model part vertices in the local coordinate system of the mesh chunk (see MeshChunk.Matrix), instead of the terrain coordinate system?

returns → Model

The 3D model.

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

This method delegates to ModelPart.Chunk and wraps the returned ModelPart in a new Model.

Load

2 overloads


public static method Load1 → (3)

file in : Path

[not-null]
The file path.

format opt : ModelFormat = null

The model format to use, if null, ModelFormat.Any will be used.

flags opt : ReadModelFlags = ReadModelFlags.None

Optional model reader flags to use, if the matching ModelFormat.ReadModel instance returns a ModelReader object. Will be ignored otherwise. Defaults to ReadModelFlags.None.

returns → IModel

The read model.

Loads a 3D model from a file using ModelFormat.Any.

ValidatingException

If file in is not an existing file or directory or if the model reader has reported an error, for example because of an unsupported file format feature.

IOException

If an I/O error has occurred while loading file in.


public static method Load2 → (3)

file in : IFileData

[not-null]
The file data.

format opt : ModelFormat = null

The model format to use, if null, ModelFormat.Any will be used.

flags opt : ReadModelFlags = ReadModelFlags.None

Optional model reader flags to use, if the matching ModelFormat.ReadModel instance returns a ModelReader object. Will be ignored otherwise. Defaults to ReadModelFlags.None.

returns → IModel

The read model.

Loads a 3D model from a file using ModelFormat.Any.

ValidatingException

If file in is invalid or if the model reader has reported an error, for example because of an unsupported file format feature.

IOException

If an I/O error has occurred while loading file in.

Model

3 overloads


public constructor Model1 → ()

Creates a new instance of Model.


public constructor Model2 → (1)

name in : string

Initial value for Name.

Creates a new instance of Model.


public constructor Model3 → (2)

unit in : UnitOfMeasure

Initial value for Unit.

flags opt : ModelFlags = ModelFlags.None

Initial value for Flags.

Creates a new instance of Model.

Read

2 overloads


[OwnerReturn]
public static method Read1 → (2)

file in : Path

[not-null]
The file path.

format opt : ModelFormat = null

The model format to use, if null, ModelFormat.Any will be used.

returns → IModelReader

The model reader.

Reads a 3D model from a file using ModelFormat.Any.

ValidatingException

If file in is not an existing file or directory or if the model reader has reported an error, for example because of an unsupported file format feature.

IOException

If an I/O error has occurred while loading file in.


[OwnerReturn]
public static method Read2 → (2)

file in : IFileData

[not-null]
The file data.

format opt : ModelFormat = null

The model format to use, if null, ModelFormat.Any will be used.

returns → IModelReader

The model reader.

Reads a 3D model from a file using ModelFormat.Any.

ValidatingException

If file in is invalid or if the model reader has reported an error, for example because of an unsupported file format feature.

IOException

If an I/O error has occurred while loading file in.

Public / Methods

Child​Add

6 overloads


public method ChildAdd1 → (1)

child in : IModel

[not-null]
The model to add as a child.

returns → Model

this

Adds a child model.


public method ChildAdd2 → (2)

child in : IModel

[not-null]
The model to add as a child.

translation in : Vec3D

The translation component of the child-to-parent transformation.

returns → Model

this

Adds a child model.

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


public method ChildAdd3 → (3)

child in : IModel

[not-null]
The model to add as a child.

translation in : Vec3D

The translation component of the child-to-parent transformation.

rotation in : Mat3D

The rotation component of the child-to-parent transformation.

returns → Model

this

Adds a child model.

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


public method ChildAdd4 → (4)

child in : IModel

[not-null]
The model to add as a child.

translation in : Vec3D

The translation component of the child-to-parent transformation.

rotation in : Mat3D

The rotation component of the child-to-parent transformation.

scale in : float64

The scale component of the child-to-parent transformation.

returns → Model

this

Adds a child model.

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.


public method ChildAdd5 → (2)

child in : IModel

[not-null]
The model to add as a child.

matrix in : Mat4D

The child-to-parent transformation matrix to use. The matrix is expected to be decomposable into a translation, rotation and scaling component.

returns → Model

this

Adds a child model.


public method ChildAdd6 → (2)

child in : IModel

[not-null]
The model to add as a child.

transform in : AffineTransform

The child-to-parent model transformation.

returns → Model

this

Adds a child model.

Child​Remove


public method ChildRemove → (1)

child in : IModel

[not-null]
The model to remove.

returns → Model

this

Removes a child model.

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

Child​Remove​All


public method ChildRemoveAll → ()

returns → Model

this

Removes all child models.

Collider​Dirty


public method ColliderDirty → ()

Invalidates the model hierarchy of the current IModel.Collider instance.

Call this method when the model structure or geometry has been modified. A new model collider will be created the next time the IModel.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:

Part​Add


public method PartAdd → (1)

part in : IModelPart

[not-null]
The model part to add.

returns → Model

this

Adds a model part.

Part​Remove


public method PartRemove → (1)

part in : IModelPart

[not-null]
The model part to remove.

returns → Model

this

Removes a model part.

Part​Remove​All


public method PartRemoveAll → ()

returns → Model

this

Removes all model parts.

Part​Remove​Where


public method PartRemoveWhere → (1)

predicate in : PredicateDelegate<IModelPart>

[not-null]
The predicate to evaluate for each model part.

returns → Model

this

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

Public / Attributes

Fade​In


public attribute FadeIn → (get,set)

value : Fade

The fade-in range for the view distance, in model-space.

The fade-in range of this model.

When Fade.Compute returns 0, the model will not be visible at all.

Defaults to Fade.AlwaysOne, i.e. always faded in.

Fade​Out


public attribute FadeOut → (get,set)

value : Fade

The fade-out range for the view distance, in model-space.

The fade-out range of this model.

When Fade.Compute returns 1, the model will not be visible at all.

Defaults to Fade.AlwaysZero, i.e. never faded out.

Flags


public attribute Flags → (get,set)

value : ModelFlags

The model flags.

The model flags.

Defaults to ModelFlags.None.

Name


public attribute Name → (get,set)

value : string

The model name, will either be null or non-empty.

The name of this model.

Defaults to null.

Unit


public attribute Unit → (get,set)

value : UnitOfMeasure

The model-space unit. If set to null, the default value is returned instead.

The unit of measure in which the vertex coordinates of the model parts are expressed.

Defaults to UnitOfMeasure.Metre.

Logging

Logger


public static readonly attribute Logger → (ILogger)

The logger object of this class.