Documentation is work in progress and not completeEditor
3D System

Scene Serialization

Scene state is serialized to a JSON-safe object by SceneSerializer.ts so it can travel with the saved project. Primitives round-trip completely; imported models do not.

What Is Captured

  • All objects in the scene — id, name, geometry type, geometry config, material config, position, rotation, scale and imported model name.
  • Camera position and orbit target.
  • Environment configuration — light intensities, colors and background color.
export function serializeScene(engine: ThreeDEngine, environment: EnvironmentConfig): SceneStateSnapshot {
  const objects: SerializedObject[] = engine.getAllObjects().map((obj) => ({
    id: obj.id,
    name: obj.name,
    geometryType: obj.geometryType,
    geometry: { ...obj.geometry },
    material: { ...obj.material },
    position: { ...obj.position },
    rotation: { ...obj.rotation },
    scale: { ...obj.scale },
    importedModelName: obj.importedModelName,
  }));

  return {
    objects,
    cameraPosition: engine.getCameraPosition(),
    cameraTarget: engine.getCameraTarget(),
    environment: { ...environment },
  };
}

Restoration

restoreScene() clears the engine scene, iterates the serialized objects and calls sceneManager.restoreFromConfig() for each. Once objects are restored, the camera position and environment are applied and markDirty() is called.

The Imported Model Limitation

Imported models are skipped during restoration. Their binary mesh data is not stored in the snapshot, so only primitive shapes can be fully reconstructed. If a project containing an imported model is saved and reloaded, the model must be re-imported.

This is a deliberate consequence of keeping the snapshot JSON-safe. Embedding mesh binaries would make project files large and slow to parse.