17 lines
640 B
TypeScript
17 lines
640 B
TypeScript
import type { RuntimeScene, Scene, World } from "../../types";
|
|
import { depopulateRuntimeObject, populateRuntimeObject } from "./object";
|
|
|
|
export function populateRuntimeScene(scene: Scene, world: World): RuntimeScene {
|
|
return {
|
|
...scene,
|
|
objects: Object.fromEntries(Object.entries(scene.objects).map(([id, obj]) => [id, populateRuntimeObject(obj, world)])),
|
|
}
|
|
}
|
|
|
|
export function depopulateRuntimeScene(scene: RuntimeScene, world: World): Scene {
|
|
return {
|
|
...scene,
|
|
objects: Object.fromEntries(Object.entries(scene.objects).map(([id, obj]) => [id, depopulateRuntimeObject(obj, world)])),
|
|
}
|
|
}
|