TerrainView
Description
A view onto a 3D terrain mesh.
At runtime, the application loop callbacks of all terrain views of a terrain mesh must be called, as described by IApplication and ApplicationLoop.MainLoop. The time deltas that are passed to IUpdateableFrameTime.UpdateFrameTime will be processed so that all terrain views receive the same time delta for each update cycle.
Updating the terrain views of a terrain mesh with IUpdateableFrameTime.UpdateFrameTime will trigger calls to MeshBuffer.MeshUpdate, to make sure that exactly one mesh buffer update is performed at the beginning of each update cycle. If there are no terrain views, the MeshBuffer.MeshUpdate method will not be called automatically.
Public / Constants
ProfileDataRender
CPU time spent in MeshBuffer.MeshUpdateData and TriangulationBuffer.Update (milli-seconds).
ProfileDataUpdate
CPU time spent in MeshBuffer.MeshUpdate and TextureAtlas.TextureUpdate (milli-seconds).
Public / Methods
Public / Attributes
CullingDistance
The distance to use for culling, see DistanceCulling.Distance.
When this property is set to 0
, the culling distance will be computed automatically.
DisplacementThreshold
The tessellation threshold for GPU terrain displacement, given as the average edge length of the triangles in the terrain mesh.
LightingNorth
Defines the north-direction in terrain-space to use for setting up the local coordinate system for lighting and material coordinates.
If this vector is equal to Vec4D.Zero, the north-direction will be computed using IGeometry.ComputeNorth, passing in the heightmap coordinates that correspond to the current camera position.
If the Vec4D.W component of this vector is zero, this vector is normalized and used as the north-direction.
If the Vec4D.W component of this vector is not zero, this vector will be scaled by 1/W (resulting in the north position) and the north-direction is computed so that it points from the current camera position towards the north position.
The local coordinate system for lighting and material coordinates is defined as follows:
-
Y+ (up-vector)
The Y-axis is mapped to the up-vector of the terrain.
For planar terrains, the up-vector is computed via IGeometry.ComputeUp.
For geocentric terrains, the up-vector is computed by normalizing the terrain-space position. -
X+ (side-vector)
The X-axis is mapped to the cross product of the north-direction and the up-vector. -
Z+
The Z-axis is mapped to the cross product of the side-vector and the up-vector. -
The coordinate origin is coincident with the camera position in terrain-space.
A terrain is considered to be geocentric iff IGeometry.ToGeocentric returns a non-null value; otherwise it is considered to be planar.
Defaults to Vec4D.Zero
LightingSpace
Returns the helper object that provides coordinate transformation methods between terrain-space, light-space and material-space.
Shadows
The aggregated ShadowMapping object.
The ShadowMapping.CascadeRange property is updated automatically by this TerrainView object. To tweak the range, use ShadowTweak.