import type { ModelImage } from './model'; /** * A box-filtered mip chain over RGBA8 pixels and a trilinear region sampler. The material atlas uses it to render a * source texture's UV footprint into an atlas rectangle: wrapping (repeat, mirrored repeat, clamp) is honoured, the * rectangle's gutter is sampled from the real neighbouring texels, and a rectangle much smaller than the footprint reads * from the matching mip level so it is filtered rather than aliased. */ export interface MipLevel { width: number; height: number; data: Uint8Array; } export interface MipChain { levels: MipLevel[]; } /** Source images larger than this are reduced first: a level never keeps more than 512 px, and tiled footprints need only a few texels per tile. */ export declare const MIP_BASE_EDGE = 2048; export declare const CLAMP_TO_EDGE = 33071, MIRRORED_REPEAT = 33648, REPEAT = 10497; export declare function buildMipChain(data: Uint8Array, width: number, height: number): MipChain; /** Decodes a source image to RGBA8 (KTX2 through the Basis transcoder) no larger than `MIP_BASE_EDGE` and builds its mip chain. */ export declare function decodeMipChain(image: ModelImage): Promise; export interface UvRegion { u0: number; u1: number; v0: number; v1: number; } /** * Renders `region` of the texture into a `(width + 2 gutter) x (height + 2 gutter)` RGBA image: pixel (i, j) of the inner * rectangle samples the region at ((i + 0.5) / width, (j + 0.5) / height), and the gutter continues the same mapping past * the region's edge (real neighbouring texels, wrapped or clamped as the texture says). */ export declare function sampleRegion(chain: MipChain, region: UvRegion, width: number, height: number, gutter: number, wrapS: number, wrapT: number): Uint8Array; /** Mean RGBA (0..255) of the whole texture, from the last mip. */ export declare function meanPixel(chain: MipChain): [number, number, number, number]; export declare const srgbToLinear: (value: number) => number; export declare const linearToSrgb: (linear: number) => number;