Interface Terrain
- All Known Implementing Classes:
StreamingTerrain
public interface Terrain
Abstraction over a heightfield + per-cell material + placed
TerrainFeatures addressed by
world cell coordinates. The legacy TerrainGrid is a small fixed implementation; for
large/infinite worlds use StreamingTerrain, which pages TerrainChunks in and out through
a ChunkProvider. All coordinates are integer tile/cell coordinates (which may be negative
for an unbounded terrain). Heights equal to #NO_GROUND mean "no floor here" (a hole/gap).-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatSentinel height meaning "no ground in this cell". -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFeature(TerrainFeature feature) Adds a feature, routing it to the chunk that owns its position.features()Features whose anchor cell is currently loaded.intgetCols()Column count for a bounded terrain, or -1 if unbounded.floatgetHeight(int x, int z) getMaterial(int x, int z) Material id at the cell (resolve viaMaterialRegistry).intgetRows()Row count for a bounded terrain, or -1 if unbounded.booleanhasGround(int x, int z) booleanTrue for a fixed-size terrain (#getCols()/#getRows()valid), false if unbounded.voidsetHeight(int x, int z, float height) voidsetMaterial(int x, int z, String materialId)
-
Field Details
-
NO_GROUND
static final float NO_GROUNDSentinel height meaning "no ground in this cell".- See Also:
-
-
Method Details
-
getHeight
float getHeight(int x, int z) -
setHeight
void setHeight(int x, int z, float height) -
hasGround
boolean hasGround(int x, int z) -
getMaterial
Material id at the cell (resolve viaMaterialRegistry). -
setMaterial
-
features
List<TerrainFeature> features()Features whose anchor cell is currently loaded. -
addFeature
Adds a feature, routing it to the chunk that owns its position. -
isBounded
boolean isBounded()True for a fixed-size terrain (#getCols()/#getRows()valid), false if unbounded. -
getCols
int getCols()Column count for a bounded terrain, or -1 if unbounded. -
getRows
int getRows()Row count for a bounded terrain, or -1 if unbounded.
-