AdvancedReadonlybindThe bind groups the shader binds, in @group index order
A template that draws meshes lists global then camera, since the engine binds those by
index, and a material's template adds batch after them for the material's data. List
global as { name: 'global', ubo: true } wherever it appears, or the compile throws.
Optional ReadonlyglThe GLSL sources for WebGL, one per stage, each with a #version 300 es line
Readonlyfragment: stringGLSL fragment shader template
Readonlyvertex: stringGLSL vertex shader template
Optional ReadonlygpuThe WGSL source for WebGPU, holding both entry points, named mainVertex and mainFragment
The source a shader compiles from: its entry points, with
{{slot}}markers the bits fill{{header}}takes every bit's header code and the generated declarations for the attributes, varyings and bindings. Every other marker takes the bits' code for that slot, in bit order, and a marker no bit fills is removed.The WGSL template holds both entry points, so its slots carry the stage as a prefix: a bit's
vertex.bodyfills{{vertexBody}}. Each GLSL template holds one stage, sovertex.bodyfills the vertex template's{{body}}. To write the bits'outputs, a template adds the slots ShaderBit#outputs lists; any other template writes its fragment outputs itself.Shaders are cached by template identity, so build a template once and don't change it.
Example