API

Interface ParseNodeMaterialOptions

Options for parseNodeMaterialFromSnippet().

interface ParseNodeMaterialOptions {
    blockLoader?: (className: string) => Promise<BlockEmitter>;
    hasInstances?: boolean;
    hasSkeleton?: boolean;
    json?: string | object;
    shadowGenerators?: readonly ShadowGenerator[];
    shadowLightIndices?: readonly number[];
    snippetServer?: string;
    textures?: Readonly<Record<string, Texture2D>>;
}
Index
blockLoader?: (className: string) => Promise<BlockEmitter>

Optional graph-specific block loader. Avoids the full default registry when callers know the exact block set. Custom emitters may preserve the established flag-only contracts by setting state.usesMorphTargets or state.usesLightsUbo; the async parser loads the corresponding feature when no private seam was installed.

hasInstances?: boolean

When true, InstancesBlock wires per-instance attributes. Default false.

hasSkeleton?: boolean

When true, BonesBlock produces a skinned world matrix (requires all meshes using this material to have a skeleton). Default false.

json?: string | object

Pre-resolved JSON (object or string). When provided, bypasses the network.

shadowGenerators?: readonly ShadowGenerator[]

Shadow generators to integrate into the material. Each contributes one shadow-light slot whose lightIndex is the position of its light in scene.lights at the time of rendering. Materials built without this option have zero shadow bindings / zero shadow WGSL.

shadowLightIndices?: readonly number[]

For each entry in shadowGenerators, the index of the owning light in scene.lights. When omitted, defaults to [0, 1, …] (first N lights).

snippetServer?: string
textures?: Readonly<Record<string, Texture2D>>

Texture overrides keyed by TextureBlock / ImageSourceBlock name.