Skip to content
glyphcss

Loading Meshes

Loading…

Pick a format to load the same way: GLB, OBJ with its MTL, STL, or a MagicaVoxel .vox. Each fits the viewport; Code shows the loader call.

FormatParserNotes
OBJparseObj(string)Optional MTL materials
glTF / GLBparseGltf(ArrayBuffer)Embedded textures supported
VOXparseVox(ArrayBuffer)MagicaVoxel palette colors
STLparseStl(ArrayBuffer)Binary or ASCII; no colors

These parsers live in @glyphcss/core. loadMesh detects the format and returns polygons plus texture/animation data.

import { loadMesh } from "glyphcss";
const model = await loadMesh("/gallery/glb/apple.glb");
const mesh = scene.add(model.polygons);
// On teardown:
mesh.dispose();
model.dispose?.();

Use your own asset URL. Recenter with recenterPolygons or the binding’s autoCenter; choose camera zoom for its world-unit size. For built-in and procedural geometry, see creating shapes.