IPlanter

Description

interface Tinman.Terrain.Meshing.IPlanter

A planter puts instanced geometry on terrain mesh sectors by writing instance data into a byte buffer.

Public / Methods

Instance​Plant


public method InstancePlant → (9)

position in : Vec3D

Position on terrain surface, in terrain-space.

normal in : Vec3F

Unit-length normal vector, in terrain-space.

curvature in : float32

Curvature of the terrain surface, given as the minimum dot product between normal in and the surface normals in the planting area.

up in : Vec3F

Unit-length up vector, in terrain-space. For game-like terrains, the up vector is usually the same everywhere. For real-world terrains, the up vector is typically perpendicular to the ellipsoid surface.

spine in : Vec3F

Unit-length vector that is almost perpendicular to normal in and not collinear to up in.

weight in : float32

Relative weight, in the range [0..1].

random in : int32

Pseudo-random value for the geometry instance to plant. The bits of this value can be interpreted as white noise, for generating random details and variations.

color in : int64

The surface texture (see Semantic.Texture), with optional ambient occlusion (see Semantic.Horizon).

buffer in : ByteBuffer

The output buffer. Instance data for zero or one items must be written to it at its current position (see InstanceSize).

returns → float32

>= 0 :
If a valid instance data item has been written to the output buffer (see InstancePlantChunk. The return value should be the radius of the bounding sphere that contains the planted geometry instance, centered at position in.
< 0 :
If no instance data item has been generated.

Plants zero or one geometry instances on the terrain surface.

This method will only be called for new resp. updated geometry instances. It is fine to perform non-trivial computations here, for example computing perlin noise. Implementing methods should nevertheless finish as quickly as possible, to give a reasonable performance.

Instance​Plant​Chunk


public method InstancePlantChunk → (2)

options in : PlantingOptions

[not-null]
The used planting options.

origin in : Vec3D

The terrain-space coordinates of the chunk origin.

Prepares to plant geometry instances of a chunk.

Public / Attributes

Instance​Format


public attribute InstanceFormat → (get)

value : VertexElements

[not-null]
The vertex format.

The vertex format of this planter.

Instance​Size


public attribute InstanceSize → (get)

value : int32

[>0]
Size of a single instance, in bytes.

Returns the size of a single instance in the GPUs vertex buffer.