Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class Terrain
- Object
- Terrain
Ground. Layers are chosen per pixel from height and slope, so any mesh
(a heightfield, a
Primitives.grid displaced by VERTEX_OFFSET, a level
built from boxes) is painted without UVs or splat textures. Use with
Material.Type.PBR or Material.Type.LAMBERT.Fields
public static final String SAND = "terSand" | VEC3 colour below LEVELS.x: beach, mud. |
public static final String GRASS = "terGrass" | VEC3 colour of flat ground. |
public static final String ROCK = "terRock" | VEC3 colour of steep ground. |
public static final String SNOW = "terSnow" | VEC3 colour above LEVELS.y. |
public static final String LEVELS = "terLevels" | VEC4: sand top height, snow line height, the slope (normal y) below which rock shows, and the blend width. |
public static final String SCALE = "terScale" | FLOAT repeats of the detail noise per world unit. |
public static final String WATERLINE = "terWater" | FLOAT world height of the waterline, under which ground darkens as if wet. |
Methods
public static ShaderMaterial layered() | Sand, grass, rock and snow by height and slope, with noise breaking up every boundary and wet ground along the waterline. |
public static ShaderMaterial rock() | Bare stone on every face, its strata and grain mapped by Shading.boxUv so cliffs and boulders need no UVs. |
Inherited methods
Field details
SAND
public static final String SAND = "terSand"VEC3 colour below LEVELS.x: beach, mud.GRASS
public static final String GRASS = "terGrass"VEC3 colour of flat ground.ROCK
public static final String ROCK = "terRock"VEC3 colour of steep ground.SNOW
public static final String SNOW = "terSnow"VEC3 colour above LEVELS.y.LEVELS
public static final String LEVELS = "terLevels"VEC4: sand top height, snow line height, the slope (normal y) below
which rock shows, and the blend width.SCALE
public static final String SCALE = "terScale"FLOAT repeats of the detail noise per world unit.WATERLINE
public static final String WATERLINE = "terWater"FLOAT world height of the waterline, under which ground darkens as
if wet. Set it below the terrain to turn it off.Method details
layered
public static ShaderMaterial layered()Sand, grass, rock and snow by height and slope, with noise breaking
up every boundary and wet ground along the waterline.
Returns
a new shader material
rock
public static ShaderMaterial rock()Bare stone on every face, its strata and grain mapped by
Shading.boxUv
so cliffs and boulders need no UVs.Returns
a new shader material