Function loadKtx2Texture2DArray
-
loadKtx2Texture2DArray(
engine: EngineContext,
url: string,
sRGB?: boolean,
): Promise<Texture2DArray>Parameters
- engine: EngineContext
Engine context.
- url: string
URL of a
.ktx2file whose layers become the array's layers, in order. - sRGB: boolean = false
Select the
*-srgbGPU format. Default false, matchingloadKtx2Texture2D.
Returns Promise<Texture2DArray>
A promise resolving to the populated
Texture2DArray. - engine: EngineContext
Fetch and decode a KTX2 file holding array layers (
layerCount>= 1) into aTexture2DArray— the single-file, single-request counterpart to createTexture2DArrayFromUrls, which needs one image per layer. A single-layer container is accepted and yields a one-layer array.The array is transcoded to the device's best GPU-compressed format (BC7/ETC2/ASTC) and stays compressed in VRAM, and the container's authored mip chain is uploaded as-is rather than regenerated.
Like every codec-decoded texture the data is uploaded unflipped with
invertY = true(GUIDANCE §8 path 2), unlikecreateTexture2DArrayFromUrlswhich flips on upload. No built-in material samples an array, so honour that flag in your own WGSL (v = 1 - v).Requires a KTX2 decoder with 2D array support (configure self-hosting via
setKtx2DecoderUrl).