Documentation is work in progress and not completeEditor
3D System

SceneManager

SceneManager maintains the registry of 3D objects in a scene. Each entry pairs an immutable config — the serializable state — with a live Three.js mesh or group.

Shape Registry

The registry is a Map<string, { config: Object3DConfig; mesh: THREE.Object3D }>. IDs are generated per instance:

let nextId = 1;
function generateId(): string {
  return `3d-${Date.now()}-${nextId++}`;
}

Methods

MethodDescription
addPrimitive(type, materialConfig, geometryConfig)Creates a mesh via createPrimitiveMesh(), positions it at (0, 0.5, 0), registers it and returns the config
extrudeFromSvgShapes(shapes, name, geometryConfig, materialConfig)Creates an extruded mesh from THREE.Shape arrays, for SVG icon shapes
importModel(object, name)Registers an externally loaded Object3D from ModelLoader. The config captures its current transform
selectObject(id)Sets selectedId. Does not attach any gizmo — that is the engine’s responsibility
getSelectedId()Returns the currently selected ID or null
getMesh(id) / getConfig(id)Returns the live mesh, or the config, for an ID
getAllConfigs()Returns all configs as an array
removeObject(id)Removes the mesh, traverses it to dispose all geometries and materials, deletes it from the map and clears selection if it was selected
removeAll()Removes every object in the map
raycast(raycaster)Collects all mesh children, runs intersectObjects() and walks up the parent chain to find userData.configId. Returns null if nothing was hit
updateTransform(id, pos?, rot?, scale?)Updates both the live mesh and the stored config. Only applies axes that are provided
syncTransformFromMesh(id)Reads the mesh's current transform back into the config. Called after gizmo drag-end
updateGeometry(id, config)Disposes the old geometry and creates a new one. Only works for non-imported, non-extruded types
updateMaterial(id, config)Traverses children and calls updateMeshMaterial() on each mesh
restoreFromConfig(config)Reconstructs a mesh from a saved config. Returns null for imported models
dispose()Calls removeAll()