GlobalUniforms
Defined in: packages/three-flatland/src/GlobalUniforms.ts:30
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
// Flatland creates and owns the global uniformsconst globals = flatland.globals
// Access TSL nodes in custom colorTransformconst 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() / 1000globals.globalTint = new Color(0.8, 0.9, 1.0) // moonlightConstructors
Constructor
new GlobalUniforms():
GlobalUniforms
Defined in: packages/three-flatland/src/GlobalUniforms.ts:82
Returns
GlobalUniforms
Properties
fogColorNode
readonlyfogColorNode:UniformNode<"color",Color>
Defined in: packages/three-flatland/src/GlobalUniforms.ts:78
Fog color uniform node (vec3/color)
fogRangeNode
readonlyfogRangeNode:UniformNode<"vec2",Vector2>
Defined in: packages/three-flatland/src/GlobalUniforms.ts:80
Fog range uniform node (vec2 — near, far)
globalTintNode
readonlyglobalTintNode:UniformNode<"color",Color>
Defined in: packages/three-flatland/src/GlobalUniforms.ts:70
Global tint uniform node (vec3/color)
pixelRatioNode
readonlypixelRatioNode:UniformNode<"float",number>
Defined in: packages/three-flatland/src/GlobalUniforms.ts:74
Pixel ratio uniform node (float)
timeNode
readonlytimeNode:UniformNode<"float",number>
Defined in: packages/three-flatland/src/GlobalUniforms.ts:68
Time uniform node (float)
viewportSizeNode
readonlyviewportSizeNode:UniformNode<"vec2",Vector2>
Defined in: packages/three-flatland/src/GlobalUniforms.ts:72
Viewport size uniform node (vec2)
windNode
readonlywindNode:UniformNode<"vec2",Vector2>
Defined in: packages/three-flatland/src/GlobalUniforms.ts:76
Wind uniform node (vec2 — direction * strength)
Accessors
effectiveTime
Get Signature
get effectiveTime():
number
Defined in: packages/three-flatland/src/GlobalUniforms.ts:117
Get the current effective time value (what the shader sees).
Returns
number
fogColor
Get Signature
get fogColor():
Color
Defined in: packages/three-flatland/src/GlobalUniforms.ts:167
Returns
Set Signature
set fogColor(
value):void
Defined in: packages/three-flatland/src/GlobalUniforms.ts:171
Parameters
value
Returns
void
fogRange
Get Signature
get fogRange():
Vector2
Defined in: packages/three-flatland/src/GlobalUniforms.ts:175
Returns
Set Signature
set fogRange(
value):void
Defined in: packages/three-flatland/src/GlobalUniforms.ts:179
Parameters
value
Returns
void
globalTint
Get Signature
get globalTint():
Color
Defined in: packages/three-flatland/src/GlobalUniforms.ts:134
Returns
Set Signature
set globalTint(
value):void
Defined in: packages/three-flatland/src/GlobalUniforms.ts:138
Parameters
value
Returns
void
pixelRatio
Get Signature
get pixelRatio():
number
Defined in: packages/three-flatland/src/GlobalUniforms.ts:150
Returns
number
Set Signature
set pixelRatio(
value):void
Defined in: packages/three-flatland/src/GlobalUniforms.ts:154
Parameters
value
number
Returns
void
time
Get Signature
get time():
number|undefined
Defined in: packages/three-flatland/src/GlobalUniforms.ts:103
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.
Returns
number | undefined
Set Signature
set time(
value):void
Defined in: packages/three-flatland/src/GlobalUniforms.ts:107
Parameters
value
number | undefined
Returns
void
viewportSize
Get Signature
get viewportSize():
Vector2
Defined in: packages/three-flatland/src/GlobalUniforms.ts:142
Returns
Set Signature
set viewportSize(
value):void
Defined in: packages/three-flatland/src/GlobalUniforms.ts:146
Parameters
value
Returns
void
wind
Get Signature
get wind():
Vector2
Defined in: packages/three-flatland/src/GlobalUniforms.ts:159
Returns
Set Signature
set wind(
value):void
Defined in: packages/three-flatland/src/GlobalUniforms.ts:163
Parameters
value
Returns
void
Methods
updateTime()
updateTime(
delta):void
Defined in: packages/three-flatland/src/GlobalUniforms.ts:127
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).
Parameters
delta
number
Returns
void