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

    Fields
    Modifier and Type
    Field
    Description
    static final float
    Sentinel height meaning "no ground in this cell".
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a feature, routing it to the chunk that owns its position.
    Features whose anchor cell is currently loaded.
    int
    Column count for a bounded terrain, or -1 if unbounded.
    float
    getHeight(int x, int z)
     
    getMaterial(int x, int z)
    Material id at the cell (resolve via MaterialRegistry).
    int
    Row count for a bounded terrain, or -1 if unbounded.
    boolean
    hasGround(int x, int z)
     
    boolean
    True for a fixed-size terrain (#getCols()/#getRows() valid), false if unbounded.
    void
    setHeight(int x, int z, float height)
     
    void
    setMaterial(int x, int z, String materialId)
     
  • Field Details

    • NO_GROUND

      static final float NO_GROUND
      Sentinel 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

      String getMaterial(int x, int z)
      Material id at the cell (resolve via MaterialRegistry).
    • setMaterial

      void setMaterial(int x, int z, String materialId)
    • features

      List<TerrainFeature> features()
      Features whose anchor cell is currently loaded.
    • addFeature

      void addFeature(TerrainFeature feature)
      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.