ITerrainTransform

Description

interface Tinman.Engine.Scenes.Util.ITerrainTransform

Derived from

IVersioned
IMeshBound

Extended by

IdentityTransform sealed
SimpleTransform sealed
TerrainTransform abstract

Base interface for classes that represent a transformation between terrain-space and model-space.

Iff an implementation depends on the terrain mesh of the scene for its computations, the NeedsMesh property will return true. If the return value is known at compile-time, the documentation will state that fact. The built-in scene entities and views handle mesh binding automatically (usually via mechanisms 4, 5 and 6 - see below). To bind a transform to a mesh in custom code, the following mechanisms can be used:

  1. Call IMeshBound.MeshBind, passing TerrainMesh.Mesh of IScene.Terrain of IScene.

  2. Call SceneObject.MeshAttach from the aggregating SceneObject class.

  3. Call SceneEntity.MeshBoundAdd from the aggregating SceneEntity class.

  4. Call SceneObject.ChildBinding1 from the aggregating SceneObject class.

  5. Call SceneObject.ChildBinding2 from the aggregating property of a SceneObject class.

  6. Set the ILocalSpaceProperty.LocalSpace property of an aggregating object.

A transform should be detached from the terrain mesh by calling IMeshBound.MeshUnbind when it is no longer being used, unless it is about to be deleted. The bind/unbind calls must be balanced and may be nested, as long as the passed IMesh object is the same. This allows sharing of ITerrainTransform objects by multiple objects in a scene. For mechanisms 2 and 3, using the paired method (i.e. SceneObject.MeshDetach and SceneEntity.MeshBoundRemove) will handle mesh binding. For the other mechanisms, mesh binding is handled automatically.

Public / Methods

Append


public method Append → (1)

other in : ITerrainTransform

[not-null]
The other terrain transform.

returns → ITerrainTransform

The resulting terrain transform.

Appends the given transform to this one.

The concatenated transforms are applied as follows:

  • V' = other.ToTerrain * this.ToTerrain * V

  • V = this.ToModel * other.ToModel * V'

where V is a point in model-space and V' is a point in terrain-space.

Compute


public method Compute → ()

Triggers all (re-)computations.

This method may be called repeatedly. It will only perform work when necessary.

Modify​Origin


public method ModifyOrigin → (1)

origin in : Vec3D

The point in terrain-space.

returns → bool

true if this terrain transform has been modified so that the coordinate origin in model-space is at the given origin in point in terrain-space.
false if this terrain transform has not been modified.

Tries to modify this terrain transform so that the coordinate origin in model-spaces moves to the given point in terrain-space.

Public / Attributes

Needs​Mesh


public attribute NeedsMesh → (get)

value : bool

true if a bound mesh is required,
false if not.

Does this ITerrainTransform require a bound IMesh object?

If this property is false, the Transform property will yield correct results, even if IMeshBound.HasMesh is false.
If this property is true, the Transform property will yield incorrect results when IMeshBound.HasMesh is false.

Transform


public attribute Transform → (get)

value : AffineTransform

The affine transformation or AffineTransform.Identity if NeedsMesh is true and IMeshBound.HasMesh is false.

Returns the affine transformation from model-space to terrain-space, (re-)computing it if necessary.

It is not necessary to call Compute before getting this property.

Extensions

Model​Origin


public static method ModelOrigin → ()

returns → Vec3D

The point in model-space that corresponds to the coordinate origin in terrain-space.

Transforms the coordinate origin in terrain-space to model-space.

Terrain​Origin


public static method TerrainOrigin → ()

returns → Vec3D

The point in terrain-space that corresponds to the coordinate origin in model-space.

Transforms the coordinate origin in model-space to terrain-space.