API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classMeshMaterial

@codexo/exojs / rendering / stable

Material specialization for Mesh drawables. Carries the mesh contract conceptually: fixed vertex attribute locations (0 = position, 1 = texcoord, 2 = color), the auto-bound uniforms `u_projection`/`u_translation`/`u_tint`/`u_texture`, and the WGSL group(0)=mesh-uniforms / group(1)=texture / group(2)=user binding scheme. Renderer wiring is added in a later phase.

11
props
6
methods
0
events
Import
import { MeshMaterial } from '@codexo/exojs'

Material specialization for Mesh drawables.

Carries the mesh contract conceptually: fixed vertex attribute locations (0 = position, 1 = texcoord, 2 = color), the auto-bound uniforms `u_projection`/`u_translation`/`u_tint`/`u_texture`, and the WGSL group(0)=mesh-uniforms / group(1)=texture / group(2)=user binding scheme. Renderer wiring is added in a later phase.

Constructors1
new(options: MeshMaterialOptionsConstruction options for a MeshMaterial.<F, B>): MeshMaterial<F, B>
Methods6
destroy(): void
Release GPU resources cached against this material on every backend that has compiled it. Safe to call multiple times. After destroy, the material can still be re-used - renderers recompile on next draw - but typical usage is to drop the reference.
onDispose(callback: () => void): void
Hook for renderers to register a per-material-instance cleanup callback (release compiled program, pipeline, or bind groups). The callback fires on destroy; renderers MUST also tolerate the material being garbage-collected without destroy ever being called. Part of the renderer SDK contract for extension renderers.
Replace a declared uniform value, returning this for chaining. Unknown names and scalar↔texture kind changes are rejected. Only available on a material whose shader source declares no uniform schema; a typed material writes through uniforms instead.
Build a MeshMaterial from an existing Shader. Equivalent to new MeshMaterial({ shader, ...options }).
Properties11
target: "mesh"
Which drawable class this material can serve; renderers check compatibility.
writesDepth: boolean
Whether draws with this material write into the target's depth attachment.
bindKey: number
Stable bind key: identical ⇒ same bindings (textures unchanged). Derived from this material's identity, base-texture sampler override, and the identities of its bound textures. Changes when a texture is swapped or sampler state changes; drives bind-group/slot reuse.
pipelineKey: number
Stable pipeline key: identical ⇒ same GPU pipeline/program can be used. Derived from shader identity and blend mode, and is independent of the owning material instance so identically configured materials share a pipeline. Drives grouping and the pipeline cache.
The declared named uniform blocks, each owning its own values.
The typed accessors of the declared uniform block, or - on a source without a schema - the live user uniform values, where construction declares the fixed set of names and each name's scalar/texture kind: material.uniforms.u_time = performance.now() / 1000; material.uniforms.u_color = [1, 0.5, 0, 1];
Source