hillIsland static method
- Float32List g,
- TerrainOptions options, [
- InfluenceType feature = InfluenceType.hill
Generate random terrain using the Hill method, centered on the terrain.
The only difference between this and the Hill method is that the locations of the points to place small hills are not uniformly randomly distributed but instead are more likely to occur close to the center of the terrain.
Float32List g
The geometry's z-positions to modify with heightmap data.
TerrainOptions options
A map of settings that control how the terrain is constructed and
displayed. Valid values are the same as those for the options parameter
of {@link THREE.Terrain}().
InfluenceType feature = InfluenceType.hill
A function describing the feature. The function should accept one
parameter representing the distance from the feature's origin expressed as
a number between -1 and 1 inclusive. Optionally it can accept a second and
third parameter, which are the x- and y- distances from the feature's
origin, respectively. It should return a number between -1 and 1
representing the height of the feature at the given coordinate.
static Influences contains some useful functions for this
purpose.
Implementation
static void hillIsland(Float32List g, TerrainOptions options, [InfluenceType feature = InfluenceType.hill]) {
hill(g, options, feature, (Vector2 coords) {
final theta = math.Random().nextDouble() * math.pi * 2;
coords.x = 0.5 + math.cos(theta) * coords.x * 0.4;
coords.y = 0.5 + math.sin(theta) * coords.y * 0.4;
});
}