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.

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 supported. See ModelReaderOptions.Flags.

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.

See also

IModel.Save


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 supported. See ModelReaderOptions.Flags.

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.

See also

IModel.Save

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.

See also

IModel.Write


[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.

See also

IModel.Write

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​Index


[Pure]
public method ChildIndex → (1)

child in : IModel

The child model.

returns → int32

The child model index or -1 iff child in is not a child of this model.

Returns the index of the given 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.

Child​Remove​At


public method ChildRemoveAt → (1)

index in : int32

[0..IModel.ChildCount-1]
The child model index.

returns → Model

this

Removes a child model.

Child​Transform​At

2 overloads


[Pure]
public method ChildTransformAt2 → (2)

index in : int32

[0..IModel.ChildCount-1]
The child model index.

transform in : AffineTransform

The transformation from the child model to this model as parent, using the unit of measure of the parent model (see Unit).

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

See also

IModel.ChildAt

Child​Transform​With​Unit​Scale​At

2 overloads


[Pure]
public method ChildTransformWithUnitScaleAt2 → (2)

index in : int32

[0..IModel.ChildCount-1]
The child model index.

transform in : AffineTransform

The transformation from the child model to this model as parent, using the unit of measure of the child model, see Unit.

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

See also

IModel.ChildAt

Collider​Dirty


public method ColliderDirty → ()

Invalidates the model hierarchy of the current IModel.Collider and IModel.Bounds objects.

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

Collider​Dirty​Parts


public method ColliderDirtyParts → ()

Invalidates the model parts of the current IModel.Collider and IModel.Bounds objects.

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

The following methods resp. setter will invalidate the model parts automatically; when using these, it is not necessary to call the ColliderDirtyParts 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.

Update​Flags


public method UpdateFlags → (3)

set in : ModelFlags

Specifies the flags to set.

clear in : ModelFlags

Specifies the flags to clear.

recursive opt : bool = true

Apply set in and clear in to the children of this model?

returns → Model

this

Updates the value of Flags.

Flags that are present in both set in and clear in will be cleared.

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 would 0 for all points on model surface, the model will not be visible at all. Rendering of the model and its descendants will be skipped entirely if Fade.Compute would return 0 for all points on the surface of the bounding sphere (see ISpatialBounds.Sphere of Bounds).

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 would 1 for all points on model surface, the model will not be visible at all. Rendering of the model and its descendants will be skipped entirely if Fade.Compute would return 1 for all points on the surface of the bounding sphere (see ISpatialBounds.Sphere of Bounds).

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.