import { DrawConfig } from './draw'; /** The texture covers design units [-PAD, 100 + PAD]. */ export declare const PAD = 3; export declare const SPAN: number; /** the matcap's side, in cells */ export declare const MATCAP_SIZE = 64; type V3 = [number, number, number]; export interface Form { N: number; /** bilinear cell in the matcap: index of the top-left cell … */ i00: Uint16Array; /** … and the weights inside it, 0–255 */ wx: Uint8Array; wy: Uint8Array; /** baked occlusion × edge darkening, gamma-compensated, 0–255; 0 = not drawn */ ao: Uint8Array; } /** * The form of one outline from its coverage raster (N × N, 0–255, over * design units [-PAD, 100 + PAD]): a pillow height field, its normals as * matcap cells, and baked occlusion; outside texels near the edge borrow * their nearest inside texel so upscaling never bleeds transparent black. */ export declare function buildForm(cov: Uint8Array | Uint8ClampedArray, N: number, halfDepth: number): Form; /** Coverage raster of the outline: N × N over design units [-PAD, 100 + PAD]. */ export declare function rasterize(path: Path2D, N: number): Uint8ClampedArray | null; /** Build a form ahead of time (call from an idle callback at mount). */ export declare function warmPlastic(key: string, path: Path2D, devicePx?: number, depth?: number): void; /** Texture size for an avatar `devicePx` wide (CSS px × device pixel ratio). */ export declare function tierFor(devicePx: number): number; export interface Material { shadow: number; highlight: number; spread: number; rim: number; } export interface Frame { L: V3; V: V3; H: V3; U: V3; W: V3; A: V3; B: V3; } /** Fill `out` (M × M × rgb, sRGB 0–255) with the lit sphere for body colour `c` (linear). */ export declare function buildMatcap(out: Float32Array, c: V3, f: Frame, p: Material): void; /** Per frame: matcap lookup × baked AO into the texture's pixels. */ export declare function shadeTexels(form: Form, mc: Float32Array, px: Uint8ClampedArray, aoMul: Float32Array): void; export interface Rig { /** the rig's (floored) cos/sin of yaw and pitch, as used by the slice affines */ cy: number; sy: number; cp: number; sp: number; /** cos(yaw)·cos(pitch), unfloored: the front cap faces the viewer while positive */ facing: number; roll: number; halfDepth: number; cap: number; /** unit vector toward the light on screen */ lx: number; ly: number; /** the avatar box in device pixels (CSS px × dpr) */ dev: number; /** the context's transform for body space (a, b, c, d, e, f): the slices set theirs from it directly rather than through save/restore */ ctm: readonly number[]; /** no animation loop will follow: build the form now rather than on idle time */ still?: boolean; } /** Screen-space vectors into the cap's frame: un-roll, then the transpose of the rig's rotation; the back cap is the front mirrored in z. */ export declare function capFrame(r: Rig): Frame; /** A · B for canvas affines (a, b, c, d, e, f) */ export declare function mulAffine(A: readonly number[], B: readonly number[]): number[]; export declare function drawPlasticCap(ctx: CanvasRenderingContext2D, cfg: DrawConfig, rig: Rig, pal: { base: string; }, union: Path2D | null, mat: Material): boolean; export {};