import * as THREE from 'three/webgpu'; import type { TSLTextureNode, TSLUniformNode } from '../types/tsl.js'; /** Instanced attribute names consumed by {@link MSDFTextNodeMaterial}. */ export declare const MSDF_TEXT_ATTRIBUTES: { /** vec4 — glyph quad (x, y, width, height); x/y = bottom-left, y-up layout units. */ readonly rect: "msdfRect"; /** vec2 — glyph pen origin (baseline-left), y-up layout units. */ readonly origin: "msdfOrigin"; /** vec4 — atlas UV rect (u0, v0, u1, v1); v0 at the glyph's TOP edge. */ readonly uvRect: "msdfUvRect"; /** float — normalized glyph index across the text (0‥1), for per-letter effects. */ readonly letter: "msdfLetter"; }; export interface MSDFTextNodeMaterialOptions { map?: THREE.Texture | null; screenSpace?: boolean; pixelSnap?: boolean; color?: THREE.ColorRepresentation; opacity?: number; distanceRange?: number; } /** * Minimal TSL material for instanced MSDF glyph quads. * * Fragment: median-of-RGB signed distance, antialiased over exactly one screen pixel via * the screen-px-range term (`distanceRange` atlas px → on-screen px through `fwidth`), so * glyphs stay crisp at any scale and any DPR with no per-size tuning. * * Vertex: two modes — * - world (default): quads live on the XY plane of the mesh's local space; the regular * model/view/projection chain applies (`positionNode`). * - screenSpace: quads are laid out in CSS pixels relative to `offset` (top-left origin, * y-down) and projected straight to clip space from `viewport` (CSS px). With `pixelSnap` * (default) each glyph's origin is snapped to the drawing buffer's physical pixel grid — * whole-quad translation, no distortion — so stems land on a uniform subpixel phase and * small text stays crisp at any DPR. Disable it for smoothly animated text, where * whole-pixel stepping would show as jitter. * * @class MSDFTextNodeMaterial * @augments THREE.MeshBasicNodeMaterial * @short TSL node material decoding MSDF atlases with pixel-exact antialiasing. * @category Text * @tags WebGPU, WebGL */ export declare class MSDFTextNodeMaterial extends THREE.MeshBasicNodeMaterial { static get type(): string; /** * @param {Object} [options] * @param {THREE.Texture|null} [options.map=null] - MSDF atlas texture (KTX2/DataTexture). * @param {boolean} [options.screenSpace=false] - Project from CSS pixels instead of the camera. * @param {boolean} [options.pixelSnap=true] - screenSpace only: snap glyph origins to * physical pixels for uniformly crisp stems at any DPR. Disable for smoothly animated text. * @param {THREE.Color|number|string} [options.color=0xffffff] * @param {number} [options.opacity=1] * @param {number} [options.distanceRange=4] - Atlas distance range in px (from the font JSON). */ isScreenSpace: boolean; isPixelSnap: boolean; colorUniform: TSLUniformNode<'color', THREE.Color>; opacityUniform: TSLUniformNode<'float', number>; distanceRangeUniform: TSLUniformNode<'float', number>; weightBiasUniform: TSLUniformNode<'float', number>; offsetUniform: TSLUniformNode<'vec2', THREE.Vector2>; viewportUniform: TSLUniformNode<'vec2', THREE.Vector2>; depthUniform: TSLUniformNode<'float', number>; _atlasNode: TSLTextureNode; constructor({ map, screenSpace, pixelSnap, color, opacity, distanceRange }?: MSDFTextNodeMaterialOptions); /** * Binds an atlas texture, normalizing its sampling state: MSDF atlases must sample * linearly, without mips, and as data (KTX2Loader's raw path arrives NearestFilter). * * @param {THREE.Texture|null} map */ setMap(map: THREE.Texture | null): void; }