Classes
Methods
buildSPS()
Build Solid Particle System, e.g. trees and other objects seeded over the terrain.
Called during initialization, before the terrain is created.
This implementation does nothing.
- Source:
dig(x, y, depth, refresh)
Set height at given coordinates
Parameters:
Name | Type | Description |
---|---|---|
x |
coordinate | |
y |
coordinate | |
depth |
how deep to dig | |
refresh |
default true, triggers terrain update and renders the change |
- Source:
findIndex()
Returns index in mapData containing point closest to given x,y.
Mapdata then contains x of the point on returned index, y at index+1 and z at index+2.
- Source:
gridHeight(x, y, index, col, row)
Height function used in constructor, intended to be overridden by subclasses
Parameters:
Name | Type | Description |
---|---|---|
x |
coordinate of current grid element | |
y |
coordinate of current grid element | |
index |
index of of current element in mapData array | |
col |
current column | |
row |
current row |
- Source:
Returns:
0
isCreated()
Returns true if both this terrain and terrain mesh exist, i.e. safe to use
- Source:
raise(x, y, height, refresh)
Set height at given coordinates
Parameters:
Name | Type | Description |
---|---|---|
x |
coordinate | |
y |
coordinate | |
height |
how much to raise | |
refresh |
default true, triggers terrain update and renders the change |
- Source:
refresh(force)
Refresh (compute normals, update and render) the terrain.
Normally terrain only updates when moving around, update needs to be forced after grid data (e.g. height) changes.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
force |
true | default true |
- Source:
setHeight(x, y, height, refresh)
Set height at given coordinates
Parameters:
Name | Type | Description |
---|---|---|
x |
coordinate | |
y |
coordinate | |
height |
new height | |
refresh |
default true, triggers terrain update and renders the change |
- Source:
update()
Update a grid element at index to given coordinates.
- Source: