API

Function createTexture2DArrayFromPixels

  • Create a 2D texture array from a tightly-packed RGBA8 byte buffer covering every layer — the array analog of createTexture3DFromPixels, and the raw-bytes counterpart to createTexture2DArrayFromUrls. Use it when the layer contents are CPU-generated (procedural tiles, decoded asset payloads, lookup tables) rather than decoded images.

    If the array is created with mipmaps, a full mip chain is generated for each layer after the upload.

    Parameters

    • engine: EngineContext

      Engine context.

    • data: Uint8Array

      width * height * layers * 4 bytes, RGBA8, layer-major (all of layer 0's rows, then layer 1's, ...).

    • width: number

      Layer width in texels (>= 1).

    • height: number

      Layer height in texels (>= 1).

    • layers: number

      Number of array layers (>= 1).

    • options: TextureArrayOptions = {}

      Sampler / format overrides.

    Returns Texture2DArray