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.
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 },
};
}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.
This is a deliberate consequence of keeping the snapshot JSON-safe. Embedding mesh binaries would make project files large and slow to parse.