Default implementation of the IModel interface.
sealed class
|
Model
|
implements
|
IModel
|
The logger object of this class.
public
static
readonly
field
|
Logger
|
||
type
|
ILogger
|
The number of child models.
public
property
|
ChildCount
{
get
}
|
||
type
|
int32
|
||
value
|
|
The child model count. | |
implements
|
IModel.ChildCount
|
See also:
IModel.ChildAtThe collider object for this model.
public
property
|
Collider
{
get
}
|
||
type
|
IModelCollider
|
||
value
|
|
The collider object. | |
implements
|
IModel.Collider
|
The model flags.
public
property
|
Flags
{
get
set
}
|
||
type
|
ModelFlags
|
||
value
|
The model flags. | ||
implements
|
IModel.Flags
|
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
|
The number of model parts.
public
property
|
PartCount
{
get
}
|
||
type
|
int32
|
||
value
|
|
The model part count. | |
implements
|
IModel.PartCount
|
See also:
IModel.PartAtThe 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.
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
|
|
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:
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
|
|
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
|
|
The read model. |
Exceptions:
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. |
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
|
|
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
|
|
The model reader. |
Exceptions:
Adds a child model.
public
method
|
ChildAdd
(IModel child)
|
||
type
|
Model
|
||
params
|
child
|
[not-null]
|
The model to add as a child. |
returns
|
|
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
|
|
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
|
|
this |
See also:
AffineTransform.FromMatrixAdds 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
|
|
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
|
|
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
|
|
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.
Returns the index-th child model.
[Pure]
|
||||
public
method
|
ChildAt
(int32 index)
|
|||
type
|
IModel
|
|||
params
|
index
|
[0..ChildCount-1]
|
The child model index. | |
returns
|
|
The child model. | ||
implements
|
IModel.ChildAt
|
See also:
IModel.ChildTransformAtRemoves a child model.
public
method
|
ChildRemove
(IModel child)
|
||
type
|
Model
|
||
params
|
child
|
[not-null]
|
The model to remove. |
returns
|
|
this |
Remarks:
If the given model is not a child of this model, the method silently returns.
Removes all child models.
public
method
|
ChildRemoveAll
()
|
||
type
|
Model
|
||
returns
|
|
this |
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.ChildAtInvalidates 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:
ChildAdd*
ChildRemove*
PartRemove*
Initializes the Collider object from the given precomputed spatial data structures.
public
method
|
ColliderLoad
(ISerializable data)
|
||
params
|
data
|
The precomputed spatial data structures. | |
implements
|
IModel.ColliderLoad
|
Remarks:
As an alternative to this method, the ComplexGeometry flag may be used.
If the given data is unsuitable, this method will return silently and a new IModelCollider will be computed.
See also:
IModelCollider.SaveAdds a model part.
public
method
|
PartAdd
(IModelPart part)
|
||
type
|
Model
|
||
params
|
part
|
[not-null]
|
The model part to add. |
returns
|
|
this |
Returns the index-th model part.
[Pure]
|
||||
public
method
|
PartAt
(int32 index)
|
|||
type
|
IModelPart
|
|||
params
|
index
|
[0..PartCount-1]
|
The model part index. | |
returns
|
|
The model part. | ||
implements
|
IModel.PartAt
|
Removes a model part.
public
method
|
PartRemove
(IModelPart part)
|
||
type
|
Model
|
||
params
|
part
|
[not-null]
|
The model part to remove. |
returns
|
|
this |
Removes all model parts.
public
method
|
PartRemoveAll
()
|
||
type
|
Model
|
||
returns
|
|
this |
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
|
|
this |
Prepares all lazy-loaded data for this model.
public
method
|
PrepareLazy
()
|
||
type
|
IModel
|
||
returns
|
|
this | |
implements
|
IModel.PrepareLazy
|
Exceptions:
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
|
|
The resulting model. | |
implements
|
IModel.UseGeometryInstancing
|
See also:
IModelGeometry.InstanceBuffer