Represents a terrain mesh.
sealed class
|
TerrainMesh
|
extends
|
Disposable
|
The TerrainMesh class provides a high-level API that wraps the terrain features of the Tinman 3D SDK in an easy to use way:
-0.5
is
used
to
render
the
terrain
materials
with
additive
blending:
| ... | +-------+ | Layer | SortIndex = -2 +-------+ | Layer | SortIndex = -1 +-------+ (Materials) SortIndex = -0.5 (implicit layer for materials) +-------+ | Layer | SortIndex = 0 +-------+ | Layer | SortIndex = +1 +-------+ | ... |The surface materials textures (see Material), defined by MaterialAdd.
Returns the DistanceToGround helper object for this terrain mesh.
public
property
|
Distance
{
get
}
|
||
type
|
DistanceToGround
|
||
value
|
|
The helper object. |
The Geocentric helper object of the terrain mesh.
public
property
|
Geocentric
{
get
}
|
||
type
|
Geocentric
|
||
value
|
The
Geocentric
object
or
null
if
the
terrain
mesh
does
not
have
a
geocentric
reference.
|
Remarks:
The returned object is obtained from ToGeocentric and then augmented with the following data, if possible:
Optional heightmap that stores gravity-related offsets from the ellipsoid surface (see Gravity)
public
property
|
Gravity
{
get
}
|
||
type
|
IHeightmap
|
||
value
|
The
gravity-related
heightmap
or
null . |
Does this layer have terrain materials?
public
property
|
HasMaterials
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
layer
has
terrain
materials,
false
if
not. |
See also:
TerrainLayerFlags.ShowTextureReturns the HeightAboveGround helper object for this terrain mesh.
public
property
|
Height
{
get
}
|
||
type
|
HeightAboveGround
|
||
value
|
|
The helper object. |
Returns the number of terrain layers (excluding the implicit material layer).
public
property
|
LayerCount
{
get
}
|
||
type
|
int32
|
||
value
|
|
The terrain layer count. |
Returns the lifecycle state of this object.
public
virtual
property
|
LifecycleState
{
get
}
|
||
type
|
LifecycleState
|
||
value
|
The lifecycle state. | ||
inherited
|
Disposable.LifecycleState
|
The material chunking coefficient.
public
property
|
MaterialChunks
{
get
set
}
|
||
type
|
float64
|
||
value
|
The chunking coefficient. |
Remarks:
The material chunking coefficient must be divisible by all material scale factors (i.e. global factor MaterialScale multiplied with texture factor Scale).
The
default
value
is
1
.
Flags of the implicit terrain material layer.
public
property
|
MaterialFlags
{
get
set
}
|
||
type
|
TerrainLayerFlags
|
||
value
|
The terrain material layer flags. |
Remarks:
Only the following flags are used by the implicit material layer (all others are ignored):
The distance range in which the implicit terrain material layer is visible.
public
property
|
MaterialRange
{
get
set
}
|
||
type
|
Vec2F
|
||
value
|
The layer distance range. |
Remarks:
The terrain layer is fully faded in when the camera distance is equal to X and fully faded out when the distance is equal to Y.
If X is equal to Y, the distance range is disabled and the terrain layer is visible everywhere.
Defaults to Zero.
The global material texture scale, in terrain-space.
public
property
|
MaterialScale
{
get
set
}
|
||
type
|
float32
|
||
value
|
The global material texture scale, in terrain-space. |
Remarks:
The scale of each terrain texture (see Scale) is multiplied with this value before being used for rendering.
Defaults
to
1
(i.e.
a
material
texture
covers
an
area
of
1x1
terrain-space
units).
The CLOD mesh of this terrain.
public
property
|
Mesh
{
get
}
|
||
type
|
IMeshDynamic
|
||
value
|
|
The IMesh object. |
Returns the number of terrain 3D models.
public
property
|
ModelCount
{
get
}
|
||
type
|
int32
|
||
value
|
|
The number of terrain 3D models. |
See also:
ModelAddReturns the Picking helper object for this terrain mesh.
public
property
|
Picking
{
get
}
|
||
type
|
Picking
|
||
value
|
|
The helper object. |
public
property
|
PlantingCount
{
get
}
|
||
type
|
int32
|
||
value
|
Returns the TerrainBuffer object that this terrain mesh is using.
public
property
|
TerrainBuffer
{
get
}
|
||
type
|
TerrainBuffer
|
||
value
|
|
The terrain buffer object. |
Returns the ICameraWorld helper object for this terrain mesh.
public
property
|
World
{
get
}
|
||
type
|
MeshCameraWorld
|
||
value
|
|
The helper object. |
Creates a new instance of TerrainMesh.
public
constructor
|
TerrainMesh
(TerrainBuffer buffer,
[Owner]
MeshOptions options,
IHeightmap gravity = null)
|
||
params
|
buffer
|
[not-null]
|
The terrain buffer to use. |
options
|
[not-null]
|
The terrain mesh options. The Visibility option will be ignored. Instead, a separate instance of ScreenVisibleCheck will be used for each TerrainView. | |
gravity
|
Optional
heightmap
that
stores
gravity-related
offsets
from
the
ellipsoid
surface
(see
Gravity).
Defaults
to
null .
|
Remarks:
Elevation values of the given mesh heightmap (see Heightmap) are interpreted as relative offsets to the ellipsoid surface.
Acquires a strong reference to this disposable object.
[OwnerReturn, ThreadSafe]
|
||||
public
method
|
AcquireTry
()
|
|||
type
|
IDisposable
|
|||
returns
|
this
if
a
new
strong
reference
has
been
acquired,
null
if
this
object
is
already
being
disposed.
|
|||
inherited
|
Disposable.AcquireTry
|
Remarks:
The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls the AcquireTry method is responsible for calling the Dispose method accordingly.
This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.
Adds the given terrain decal.
public
method
|
DecalAdd
(TerrainDecal decal)
|
||
params
|
decal
|
[not-null]
|
The terrain decal to add. |
Removes the given terrain decal.
public
method
|
DecalRemove
(TerrainDecal decal)
|
||
params
|
decal
|
[not-null]
|
The terrain decal to remove. |
Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.
[Dispose, OwnerThis, ThreadSafe]
|
||||
public
method
|
Dispose
()
|
|||
inherited
|
Disposable.Dispose
|
Remarks:
The Dispose method silently returns if the object has already been disposed.
public
method
|
LayerAt
(int32 sortIndex)
|
||
type
|
TerrainLayer
|
||
params
|
sortIndex
|
Creates a new instance of TerrainLayer for this terrain.
public
method
|
LayerCreate
(int32 sortIndex = 0,
TerrainLayerFlags flags = TerrainLayerFlags.None)
|
||
type
|
TerrainLayer
|
||
params
|
sortIndex
|
Initial
value
for
SortIndex.
Defaults
to
0 .
|
|
flags
|
Initial value for Flags. Defaults to None. | ||
returns
|
|
The created terrain layer. |
Returns an existing terrain layer.
public
method
|
LayerGet
(int32 index)
|
||
type
|
TerrainLayer
|
||
params
|
index
|
[0..LayerCount-1]
|
The layer index. |
returns
|
|
The terrain layer. |
Removes an existing terrain layer.
public
method
|
LayerRemove
(TerrainLayer layer)
|
||
params
|
layer
|
[not-null]
|
The terrain layer to remove. |
Adds the given material to this layer, replacing any existing one.
public
method
|
MaterialAdd
(TerrainMaterial material)
|
||
params
|
material
|
[not-null]
|
The material to add. |
See also:
TerrainLayerFlags.ShowTextureAdds the given materials to this layer, replacing any existing ones.
public
method
|
MaterialAddAll
(IEnumerable<TerrainMaterial> materials)
|
||
params
|
materials
|
[not-null]
|
The materials to add. |
See also:
TerrainLayerFlags.ShowTextureRemoves all materials from this layer.
public
method
|
MaterialClear
()
|
See also:
TerrainLayerFlags.ShowTextureReturns a terrain material.
public
method
|
MaterialGet
(int32 materialId)
|
||
type
|
TerrainMaterial
|
||
params
|
materialId
|
[0..255]
|
The material ID (see MaterialToken). |
returns
|
The
TerrainMaterial
object
or
null
if
no
terrain
material
has
been
defined.
|
See also:
TerrainLayerFlags.ShowTextureRemoves the given material from this layer.
public
method
|
MaterialRemove
(TerrainMaterial material)
|
||
params
|
material
|
[not-null]
|
The material to remove. |
See also:
TerrainLayerFlags.ShowTextureAdds a terrain 3D model.
public
method
|
ModelAdd
(TerrainModel model)
|
||
params
|
model
|
[not-null]
|
The model to add. |
Returns the index-th terrain model.
public
method
|
ModelGet
(int32 index)
|
||
type
|
TerrainModel
|
||
params
|
index
|
[0..ModelCount-1]
|
The terrain model index. |
returns
|
|
The terrain model. |
Removes a terrain 3D model.
public
method
|
ModelRemove
(TerrainModel model)
|
||
params
|
model
|
[not-null]
|
The model to remove. |
Adds the given terrain planting options.
public
method
|
PlantingAdd
(TerrainPlanting planting)
|
||
params
|
planting
|
[not-null]
|
The terrain planting options to add. |
Returns the index-th terrain planting options.
public
method
|
PlantingGet
(int32 index)
|
||
type
|
TerrainPlanting
|
||
params
|
index
|
[0..PlantingCount-1]
|
The terrain planting options index. |
returns
|
|
The terrain planting options. |
Removes the given terrain planting options.
public
method
|
PlantingRemove
(TerrainPlanting planting)
|
||
params
|
planting
|
[not-null]
|
The terrain planting options to remove. |