/** * TextNode - TSL Node for Text geometry transformation. * * Follows the same pattern as InstanceNode and BatchNode from three.js. * This node modifies positionLocal and normalLocal with text-specific * geometry transformations (glyph bounds, SDF calculations, etc.). * * Uses the shared textGlyphTransform for core glyph transformation logic, * which is also used by BatchedTextNode for code reuse. * * @module TextNode */ import { Node } from 'three/webgpu'; import type { Color, Matrix3, NodeBuilder, Vector2, Vector4 } from 'three/webgpu'; import type { TSLNodeFactory, TSLUniformNode, TSLVec3Node, TSLVoidNode } from '../types/tsl.cjs'; export interface TextNodeUniforms { uThreeBlocksSdfDebug: TSLUniformNode<'float', number>; uThreeBlocksSDFTextureSize: TSLUniformNode<'vec2', Vector2>; uThreeBlocksSDFGlyphSize: TSLUniformNode<'float', number>; uThreeBlocksSDFExponent: TSLUniformNode<'float', number>; uThreeBlocksTotalBounds: TSLUniformNode<'vec4', Vector4>; uThreeBlocksClipRect: TSLUniformNode<'vec4', Vector4>; uThreeBlocksDistanceOffset: TSLUniformNode<'float', number>; uThreeBlocksOutlineOpacity: TSLUniformNode<'float', number>; uThreeBlocksFillOpacity: TSLUniformNode<'float', number>; uThreeBlocksBaseColor: TSLUniformNode<'color', Color>; uThreeBlocksOutlineColor: TSLUniformNode<'color', Color>; uThreeBlocksPositionOffset: TSLUniformNode<'vec2', Vector2>; uThreeBlocksBlurRadius: TSLUniformNode<'float', number>; uThreeBlocksOrient: TSLUniformNode<'mat3', Matrix3>; uThreeBlocksBillboard: TSLUniformNode<'float', number>; } export interface TextNodeSource { uniforms: TextNodeUniforms; } export interface TextNodeFactory extends TSLNodeFactory<[text: TextNodeSource], TSLVoidNode> { setParameterLength(length: number): this; } /** * TextNode implements vertex shader logic for Text rendering. * It transforms positionLocal based on glyph bounds and SDF atlas data. * * Uses textGlyphTransform with uniform-based parameters for single Text instances. * * @augments Node */ declare class TextNode extends Node<'void'> { static get type(): string; /** * Constructs a new TextNode. * * @param {Text} text - Reference to the Text instance. */ text: TextNodeSource; constructor(text: TextNodeSource); /** * Sets up the text geometry transformation. * Modifies positionLocal and normalLocal, and sets up varyings * for fragment shader (TSL accessor compatibility). * * @param {NodeBuilder} builder - The current node builder. */ setup(_builder: NodeBuilder): TSLVec3Node; } export default TextNode; /** * TSL function for creating a TextNode. * * TextNode implements vertex shader logic for Text rendering. * It transforms positionLocal based on glyph bounds and SDF atlas data. * This node should be used in `material.setupVertex` to handle text geometry transformation. * * Uses textGlyphTransform with uniform-based parameters for single Text instances. * * This implementation-level API is intentionally internal and has no public package import. */ export declare const text: TextNodeFactory;