Sprites.Media.Shader.Globals
The Globals window is a code editor over the shared global GLSL added to every layer ahead of the layer's own code. Helpers defined here are in scope in each layer's LayerMain, so common functions live once and every layer can call them. The editor is the generic Sprites.Ui.Code, two-way bound to the document's globals string.
Sprites.Media.Shader.Globals.Window Void
Sprites.Media.Shader.Globals.Window(visible, globals)
The Globals window: a resizable floating panel holding one code editor over the shared global code. That code is added to every layer's GLSL, ahead of the layer's own code, so helpers defined here are in scope in each layer's LayerMain. The window owns its live rect, so it keeps its dragged corner and size across a close and reopen. It shows while visible is true.
| Input | Type | Description |
|---|---|---|
visible | Sprites.Reactive.Value | Shows the window while true. |
globals | Sprites.Reactive.Value | The two-way shared global GLSL string the editor shows and writes back. |
Returns nothing.
const globals = Sprites.Reactive.Binding'float Circle(vec2 p, float r) {\n return 1.0 - smoothstep(r - 0.01, r, length(p));\n}');
const visible = Sprites.Reactive.Value(false);
Sprites.Ui.Button.SetValue(visible, true, 'Show Globals window');
Sprites.Media.Shader.Globals.Window(visible, globals);