hex-world
    Preparing search index...

    Class MapSkirt

    The wall of earth that closes the map's open edges — the map as a block cut out of the world, landscape intact on top, soil strata down the sides.

    Without one, a camera low enough to see the horizon also sees under the map: the terrain is a surface, not a solid, and its edges are simply where the triangles stop. The skirt gives it a bottom and four sides.

    The top follows the terrain's own contour, sharing the exact perturbation the chunk builder uses, so it meets the ground with no seam — which is why the geometry options must match the ones the terrain was built with. The base is a single flat Y under the entire map, deep enough that the lowest ground still has MapSkirtOptions.depth of soil beneath it.

    It follows the ground, including where the ground is a sea bed, so the cut shows a coastline honestly: soil up to the bed, then the water's own cross-section above it.

    Only the perimeter is built, so this is O(width + height) and cheap to rebuild outright — there is no chunked or streamed version and none is needed.

    const skirt = new MapSkirt(map, layout, { depth: 3 }).addTo(scene);
    // after editing elevations near the edge:
    skirt.rebuild();
    Index

    Constructors

    Properties

    mesh: Mesh
    material: ShaderMaterial

    Accessors

    • get baseY(): number

      The flat Y the base sits at — below every piece of ground on the map.

      Returns number

    Methods

    • Add to a scene (or any Object3D). Returns this for chaining.

      Parameters

      • parent: Object3D

      Returns this

    • Show or hide the wall.

      Parameters

      • enabled: boolean

      Returns void

    • Rebuild from the current map. Call after editing elevations, water, or the map's size — the perimeter is small, so this is cheap enough to do on every brush stroke rather than tracking which edge cells moved.

      Returns void

    • Detach and free the geometry (and the material, unless one was supplied).

      Returns void