Diorama

Made for a big screen.

This site is one 3D scene, built for a computer: a wide window and a mouse. Open dioramajs.dev on a desktop or a laptop to see it.This site is one 3D scene, built for a wide window. Make this one wider, or open dioramajs.dev on a larger screen.

GitHub

DioramaDocs

@dioramajs/diorama/glsl

Exports of @dioramajs/diorama/glsl.

View as Markdown
On this page
import { applyShader, glslEffect, shaderNode } from '@dioramajs/diorama/glsl'

Functions

applyShaderAdds a shader to the surface from a custom effect's setup. Call the result to remove it.
glslEffectWraps a GLSL stage pair as an effect. Bindings, params and varyings are checked up front and reported together as one `EFFECT_DEFINITION`.
shaderNodeThe fragment shader as a vec4 node for a custom material. The element's image is `texture(map, coverUV(uv))` times the box mask.

Interfaces

GlslDiagnosticA problem or note found while converting GLSL.
GlslEffectOptionsOptions of `glslEffect`: definition fields plus how uniforms are bound.
GlslShaderDefault export of a `?shader` import. `build` needs nothing but `three/tsl`.
SamplerLikeA texture uniform that can be sampled at any UV.
ShaderScopeNodes a shader's `build` reads.
UniformInfoType and binding of one uniform.

Types

ApplyOptionsOptions of `applyShader` and `shaderNode`.
BindingWhere a uniform's value comes from.
GlslCodeCodes of conversion diagnostics: errors, warnings and notes.
GlslSourceOne converted shader, or a vertex and a fragment shader.
GlslTypeGLSL types a uniform or varying can have.
MergeParamsThe glue's params override the shader's. An untyped (wildcard `?shader`) shader adds none.
ShaderFunctionTSL 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'>) => …`.
ShaderInputBuilt-in inputs a uniform can bind to, as `input:<name>`.
TextureSourceA URL, a shared Texture (never disposed by us), or a loader whose Texture the instance owns.