@dioramajs/glsl
Converted GLSL stages as effects, without the transpiler.
On this page
import { applyShader, glslEffect, shaderNode } from '@dioramajs/glsl'Functions
applyShader | Adds a shader to the surface from a custom effect's setup. Call the result to remove it. |
glslEffect | Wraps a GLSL stage pair as an effect. Bindings, params and varyings are checked up front and reported together as one `EFFECT_DEFINITION`. |
shaderNode | The fragment shader as a vec4 node for a custom material. The element's image is `texture(map, coverUV(uv))` times the box mask. |
Interfaces
GlslDiagnostic | A problem or note found while converting GLSL. |
GlslEffectOptions | Options of `glslEffect`: definition fields plus how uniforms are bound. |
GlslShader | Default export of a `?shader` import. `build` needs nothing but `three/tsl`. |
SamplerLike | A texture uniform that can be sampled at any UV. |
ShaderScope | Nodes a shader's `build` reads. |
UniformInfo | Type and binding of one uniform. |
Types
ApplyOptions | Options of `applyShader` and `shaderNode`. |
Binding | Where a uniform's value comes from. |
GlslCode | Codes of conversion diagnostics: errors, warnings and notes. |
GlslSource | One converted shader, or a vertex and a fragment shader. |
GlslType | GLSL types a uniform or varying can have. |
MergeParams | The glue's params override the shader's. An untyped (wildcard `?shader`) shader adds none. |
ShaderFunction | TSL body of a GLSL prototype, called with the arguments in GLSL order. Their node types are known only in the shader, so an argument fits any TSL call; annotate it to narrow it: `(p: Node<'vec2'>) => …`. |
ShaderInput | Built-in inputs a uniform can bind to, as `input:<name>`. |
TextureSource | A URL, a shared Texture (never disposed by us), or a loader whose Texture the instance owns. |