Taos API Reference
    Preparing search index...

    Class TerrainRegionSource

    Index

    Constructors

    Properties

    regionSize: number
    regionTexels: number
    heightScale: number
    floorHeight: number
    residentRadius: number
    windowDim: number
    onRegionChanged:
        | (
            (
                minX: number,
                minZ: number,
                maxX: number,
                maxZ: number,
                minH: number,
                maxH: number,
            ) => void
        )
        | null = null

    Fired after a region's data changed on the GPU (loaded, evicted, or resolved empty) with its world rect + normalized height bounds — the TerrainSystem re-bakes overlapping VT pages from this.

    onRegionLoaded: ((rx: number, rz: number, mirror: Float32Array) => void) | null = null

    Optional hooks for per-region collider management.

    onRegionEvicted: ((rx: number, rz: number) => void) | null = null
    changeCounter: number = 0

    Bumped on every region data change (load/evict/edit) — pollers with no claim on the single onRegionChanged slot (the ocean depth cache) re-derive from it.

    Accessors

    Methods

    • Advance streaming for a camera position: evict regions that left the window, kick loads for missing ones (center-out, bounded concurrency) and rebuild the region table. Returns true when the table changed and the system must re-upload it.

      Parameters

      • camX: number
      • camZ: number

      Returns boolean

    • World-space height from the resident CPU mirrors (bilinear over the vertex-convention sample grid). Regions that are empty or not yet loaded return the floor height — the same surface the renderer shows.

      Parameters

      • x: number
      • z: number

      Returns number

    • Upload an edited texel rect of a resident region's mirror to its GPU layer, refresh the tile's normalized bounds, and fire onRegionChanged so the system re-bakes the overlapping VT pages (padded — the bake's normal taps cross borders). Rect is in TILE texels (0..regionTexels).

      Parameters

      • rx: number
      • rz: number
      • x0: number
      • y0: number
      • x1: number
      • y1: number

      Returns void

    • Re-fire the load hooks for a resident region — the editor calls this after a sculpt stroke so per-region consumers (physics bodies) rebuild from the edited mirror.

      Parameters

      • rx: number
      • rz: number

      Returns void

    • Resident region grid coords (physics glue iterates this).

      Returns { rx: number; rz: number }[]

    • Normalized-height bounds of a resident region (page culling AABBs); floor-flat for empty/unloaded regions.

      Parameters

      • rx: number
      • rz: number

      Returns { minH: number; maxH: number }