Function createTexture2DArrayFromKtx2
-
createTexture2DArrayFromKtx2(
engine: EngineContext,
buffer: ArrayBuffer | ArrayBufferView<ArrayBufferLike>,
options?: Ktx2TextureArrayOptions,
): Promise<Texture2DArray>Parameters
- engine: EngineContext
- buffer: ArrayBuffer | ArrayBufferView<ArrayBufferLike>
- options: Ktx2TextureArrayOptions = {}
Returns Promise<Texture2DArray>
Decode a single KTX2 file that stores several array layers (
layerCount> 1) and upload it as oneTexture2DArray. The single-file counterpart to createTexture2DArrayFromUrls: the whole array travels in one container. This compatibility path exposes sampler and regenerated-mipmap options. UseuploadKtx2Texture2DArraywhen preserving the device-selected compressed format and the container's complete authored mip chain is preferred.The data is transcoded to uncompressed RGBA8 (
forceRGBA), so the GPU cost matches a plain RGBA array texture. Only the base mip level from the file is uploaded; whengenerateMipMapsis on, the remaining levels are regenerated on upload.The decoder orders mipmaps level-by-level and, within a level, layer-by-layer, so the base level occupies the first
layerCountentries in ascending layer order — matched by slicingmipmaps[0 .. layerCount)and concatenating each layer back-to-back into the single flat buffercreateTexture2DArrayFromPixelsexpects.