Skip to content

createScene#findAllGlyphFieldsByName

Summary

createScene#findAllGlyphFieldsByName returns all glyph fields whose name equals the given value. This supports grouped glyph workflows where several fields share one logical identifier. Returns an empty array when nothing matches.

Syntax

Scene.findAllGlyphFieldsByName(name: string): GlyphField[]
const fields = scene.findAllGlyphFieldsByName(name);

Parameters

Name Type Required Description
name string Yes Exact glyph field name to match.

Returns

GlyphField[] - Array of matching glyph fields.

Example

const canvas = document.querySelector("canvas");
const wgpu = await WasmGPU.create(canvas);

const scene = wgpu.createScene();
for (let i = 0; i < 2; i++) {
    const glyphs = wgpu.createGlyphField({ instanceCount: 0, scaleTransform: { mode: "linear", domainMin: 0, domainMax: 1 } });
    glyphs.name = "vectors";
    scene.add(glyphs);
}
console.log(scene.findAllGlyphFieldsByName("vectors").length);

See Also