Taos API Reference
    Preparing search index...

    Class TerrainSystem

    Index

    Properties

    residentCount: number = 0
    cameraVPageX: number = 0
    cameraVPageZ: number = 0
    heightScale: number
    wireframe: boolean = false

    When true, terrain G-buffer renders as line-list using lineIndexBuffer instead of triangle-list. Affects indirect-args indexCount written by update(). Shadow casters keep using triangles.

    featureFlags: number = 0

    Procedural-generation feature flags packed into the page-gen uniform. Bit 0 = erosion, bit 1 = plateaus/dunes. Toggle via setFeatureFlags.

    seed: number = 0

    World-generation seed (u32). Folded into the page-gen hash so each value yields a completely different terrain pattern. Toggle via setSeed.

    geomBindGroup: GPUBindGroup
    shadowGeomBgl: GPUBindGroupLayout
    shadowGeomBindGroup: GPUBindGroup

    Accessors

    • get patchIndexCount(): number

      Indices per patch triangle list — for callers building bind groups or draw calls without going through the indirect path.

      Returns number

    Methods

    • Parameters

      • maps: {
            albedo: readonly string[];
            normal?: readonly string[];
            roughness?: readonly string[];
            displacement?: readonly string[];
        }

      Returns Promise<void>

    • Per-frame uniform upload + page streaming. Also resets the indirect args (the LOD compute pass bumps instance_count from zero each frame).

      Parameters

      • camera: Camera
      • OptionalheightScale: number

      Returns void

    • Toggle erosion / plateau-dune features and trigger an immediate atlas rebake around the camera so the new formula is visible. No-op when both flags already match.

      Parameters

      • erosion: boolean
      • plateausDunes: boolean

      Returns void

    • Swap to a different quality preset at runtime. Destroys and rebuilds the VT atlas, the page-gen / geom / shadow-geom bind groups, and the patch index buffers; resets page residency so the new atlas refills on the next frame. No-op when the requested quality already matches.

      Pipelines and bind-group layouts are untouched — they describe binding shapes, not sizes, so they remain valid across the swap.

      Safe to call between frames (e.g. from a UI handler). The first frame after the call shows the old atlas's last residency invalidated and the new atlas progressively baking around the camera, same as the initial startup pass.

      Parameters

      Returns void

    • Set the world-generation seed and rebake all resident pages. No-op when the seed already matches.

      Parameters

      • seed: number

      Returns void

    • Switch the page-gen height source to a heightmap texture and rebake all resident pages. The texture's R channel is read as normalized height in [0, 1] and scaled by opts.heightScale (defaults to the current heightScale); the page-gen normals are still derived from finite differences of the sampled field, so they stay correct at page seams.

      The texture must be sampleable as texture_2d<f32> with a filtering sampler — r16float / rgba16float / rgba8unorm all work. The caller keeps ownership; it is bound, not copied. Pair this with a small worldExtent + bounded: true at create() for a self-contained island.

      Parameters

      Returns void