UNPKG

@loaders.gl/textures

Version:

Framework-independent loaders for compressed and super compressed (basis) textures

50 lines 2.17 kB
import type { TextureFormat, TextureLevel } from '@loaders.gl/schema'; import type { GLTextureFormat } from "../gl-types.js"; import type { BasisLoaderOptions } from "../../basis-loader.js"; export type BasisFormat = 'etc1' | 'etc2' | 'bc1' | 'bc3' | 'bc4' | 'bc5' | 'bc7-m6-opaque-only' | 'bc7-m5' | 'pvrtc1-4-rgb' | 'pvrtc1-4-rgba' | 'astc-4x4' | 'atc-rgb' | 'atc-rgba-interpolated-alpha' | 'rgba32' | 'rgb565' | 'bgr565' | 'rgba4444'; type BasisOutputOptions = { basisFormat: number; compressed: boolean; format?: GLTextureFormat; textureFormat?: TextureFormat; }; export declare const BASIS_FORMAT_TO_OUTPUT_OPTIONS: Record<BasisFormat, BasisOutputOptions>; export declare const BASIS_FORMATS: readonly BasisFormat[]; export type ParseBasisOptions = { format: 'auto' | BasisFormat | { alpha: BasisFormat; noAlpha: BasisFormat; }; containerFormat: 'auto' | 'ktx2' | 'basis'; module: 'transcoder' | 'encoder'; supportedTextureFormats?: TextureFormat[]; }; /** * Serializes access to the Basis transcoder so concurrent callers do not enter the non-reentrant * decoder path at the same time. * @param transcode - Transcode operation to run with exclusive access. * @returns The transcode result. */ export declare function withBasisTranscodingLock<T>(transcode: () => Promise<T> | T): Promise<T>; /** * parse data with a Binomial Basis_Universal module * @param data * @param options * @returns compressed texture data */ export declare function parseBasis(data: ArrayBuffer, options?: BasisLoaderOptions): Promise<TextureLevel[][]>; /** * Select transcode format from the list of supported formats * @returns key for OutputFormat map */ export declare function selectSupportedBasisFormat(): BasisFormat | { alpha: BasisFormat; noAlpha: BasisFormat; }; export declare function selectSupportedBasisFormat(supportedTextureFormats?: Iterable<TextureFormat>): BasisFormat | { alpha: BasisFormat; noAlpha: BasisFormat; }; export declare function getSupportedBasisFormats(supportedTextureFormats?: Iterable<TextureFormat>): BasisFormat[]; export {}; //# sourceMappingURL=parse-basis.d.ts.map