import { Color, Vector2 } from "three"; import UniformNode from "three/src/nodes/core/UniformNode.js"; //#region src/GlobalUniforms.d.ts /** * Global uniforms shared across all sprite materials in a Flatland instance. * * These uniforms are set once per frame and shared by all sprites. * They avoid per-sprite duplication and never cause shader recompilation. * * @example * ```typescript * // Flatland creates and owns the global uniforms * const globals = flatland.globals * * // Access TSL nodes in custom colorTransform * const material = new Sprite2DMaterial({ * colorTransform: (ctx) => { * const tinted = ctx.color.rgb.mul(globals.globalTintNode) * return tinted.toVec4(ctx.color.a) * } * }) * * // Each frame, Flatland updates the values * // (or set them directly for manual control) * globals.time = performance.now() / 1000 * globals.globalTint = new Color(0.8, 0.9, 1.0) // moonlight * ``` */ declare class GlobalUniforms { /** * User-facing time value. * - `undefined` = auto mode (Flatland accumulates elapsed time) * - `number` = manual mode (use this exact value) */ private _time; /** Auto-accumulated elapsed time (seconds), used when _time is undefined */ private _autoTime; /** Global color tint applied to all sprites */ private _globalTint; /** Viewport size in pixels */ private _viewportSize; /** Device pixel ratio */ private _pixelRatio; /** Wind direction and strength (xy = direction, magnitude = strength) */ private _wind; /** Fog color */ private _fogColor; /** Fog range: x = near, y = far */ private _fogRange; /** Time uniform node (float) */ readonly timeNode: UniformNode<'float', number>; /** Global tint uniform node (vec3/color) */ readonly globalTintNode: UniformNode<'color', Color>; /** Viewport size uniform node (vec2) */ readonly viewportSizeNode: UniformNode<'vec2', Vector2>; /** Pixel ratio uniform node (float) */ readonly pixelRatioNode: UniformNode<'float', number>; /** Wind uniform node (vec2 — direction * strength) */ readonly windNode: UniformNode<'vec2', Vector2>; /** Fog color uniform node (vec3/color) */ readonly fogColorNode: UniformNode<'color', Color>; /** Fog range uniform node (vec2 — near, far) */ readonly fogRangeNode: UniformNode<'vec2', Vector2>; constructor(); /** * Get/set time. * - `undefined` = auto mode (accumulates elapsed time via updateTime()) * - `number` = manual mode (exact value used for shader time) * * Setting back to `undefined` resumes auto-accumulation from where it left off. */ get time(): number | undefined; set time(value: number | undefined); /** * Get the current effective time value (what the shader sees). */ get effectiveTime(): number; /** * Advance auto-time by delta seconds. * Called by Flatland each frame. In auto mode, this accumulates * and updates the time node. In manual mode, this is a no-op * (the manual value is already set via the setter). */ updateTime(delta: number): void; get globalTint(): Color; set globalTint(value: Color); get viewportSize(): Vector2; set viewportSize(value: Vector2); get pixelRatio(): number; set pixelRatio(value: number); get wind(): Vector2; set wind(value: Vector2); get fogColor(): Color; set fogColor(value: Color); get fogRange(): Vector2; set fogRange(value: Vector2); } //#endregion export { GlobalUniforms }; //# sourceMappingURL=GlobalUniforms.d.ts.map