import * as THREE from 'three'; import type { Disposable } from '../types.js'; /** Paints one procedural texture onto a square 2D canvas of `size` pixels. */ export type PaintFn = (ctx: CanvasRenderingContext2D, size: number) => void; /** An owned, keyed `CanvasTexture` cache — prefer this over the module-global {@link createProceduralTexture} so texture lifetime follows your scene. `dispose()` frees every cached texture. */ export interface TextureCache extends Disposable { get(key: string, paint: PaintFn, size?: number): THREE.CanvasTexture | null; } /** * Create an owned procedural-texture cache. `get(key, paint, size)` paints a * square canvas once per key, wraps it in a repeat-wrapping `CanvasTexture`, * and returns the cached instance thereafter. * * @returns A {@link TextureCache}; `get` returns `null` in DOM-less runtimes * so headless code degrades to flat colour instead of crashing. */ export declare function createTextureCache(): TextureCache; /** Fetch-or-paint a texture from the shared module-global cache. Same contract as {@link TextureCache.get}; returns `null` headless. */ export declare function createProceduralTexture(key: string, paint: PaintFn, size?: number): THREE.CanvasTexture | null; /** Disposer for the shared module-global texture cache used by {@link createProceduralTexture}. */ export declare const proceduralTextureCache: Disposable; //# sourceMappingURL=procedural-texture.d.ts.map