Taos API Reference
    Preparing search index...

    Class BlockTexture

    A set of three aligned block atlases (color, normal, MER) for voxel-style rendering.

    All three atlases share a common tile size and layout. Each atlas is stored horizontally as a strip of blockSize-pixel square tiles. Owns the underlying GPU textures; call destroy() to release them.

    Index

    Properties

    colorAtlas: Texture
    normalAtlas: Texture
    merAtlas: Texture
    blockSize: number
    blockCount: number

    Methods

    • Fetches and uploads the three atlas images, creating sRGB color and linear data textures.

      Parameters

      • device: GPUDevice

        The WebGPU device.

      • colorUrl: string

        URL of the albedo atlas (uploaded as sRGB).

      • normalUrl: string

        URL of the tangent-space normal atlas (linear).

      • merUrl: string

        URL of the MER atlas (R=metallic, G=emissive, B=roughness, linear).

      • blockSize: number = 16

        Pixels per tile (default 16).

      Returns Promise<BlockTexture>

      A BlockTexture owning the three uploaded GPU textures.

    • Computes the atlas UV transform for sampling a specific tile.

      Mesh UVs in [0,1] should be multiplied by (uvScaleX, uvScaleY) then offset by (uvOffsetX, uvOffsetY) to land on the requested tile.

      Parameters

      • blockId: number

        Linear tile index, laid out row-major from the top-left of the atlas (blockId = row * cols + col). For a 25-col × N-row atlas, blockId 0 is the top-left tile, 24 is the rightmost tile of row 0, 25 is the leftmost tile of row 1, and so on.

      Returns [number, number, number, number]

      Tuple [uvOffsetX, uvOffsetY, uvScaleX, uvScaleY].