interface
|
IPlanter
|
property
|
InstanceFormat
{
get
}
|
||
type
|
VertexElements
|
||
value
|
Returns the size of a single instance in the GPUs vertex buffer.
property
|
InstanceSize
{
get
}
|
||
type
|
int32
|
||
value
|
|
Size of a single instance, in bytes. |
Plants zero or one geometry instances on the terrain surface.
method
|
InstancePlant
(Vec3D position,
Vec3F normal,
float32 curvature,
Vec3F up,
Vec3F spine,
float32 weight,
int32 random,
int64 color,
ByteBuffer buffer)
|
||
type
|
float32
|
||
params
|
position
|
Position on terrain surface, in terrain-space. | |
normal
|
Unit-length normal vector, in terrain-space. | ||
curvature
|
Curvature of the terrain surface, given as the minimum dot product between normal and the surface normals in the planting area. | ||
up
|
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
|
Unit-length vector that is almost perpendicular to normal and not collinear to up. | ||
weight
|
Relative weight, in the range [0..1]. | ||
random
|
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
|
The surface texture (see Texture), with optional ambient occlusion (see Horizon). | ||
buffer
|
The output buffer. Instance data for zero or one items must be written to it at its current position (see InstanceSize). | ||
returns
|
>=
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. <
0 :
If no instance data item has been generated. |
Remarks:
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.
Prepares to plant geometry instances of a chunk.
method
|
InstancePlantChunk
(PlantingOptions options,
Vec3D origin)
|
||
params
|
options
|
[not-null]
|
The used planting options. |
origin
|
The terrain-space coordinates of the chunk origin. |