Clear loaded content from a scene root, preserving lights and any
objects flagged with userData.isBackground = true.
For each remaining direct child, disposes its full subtree via
disposeObjectTree and removes it from the scene.
This is the dataset-switch teardown, so it ALSO drops every
depth-sort registration wholesale: the per-mesh release inside
disposeObjectTree covers meshes reachable from the scene walk, and
releaseAllDepthSortNodes sweeps any coordinator/worker state whose
mesh was never attached (or was detached before the switch) — the old
dataset's registrations must not outlive it either way.
Parameters
scene: Scene
Returns number
number of removed objects (for logging by the caller).
Clear loaded content from a scene root, preserving lights and any objects flagged with
userData.isBackground = true.For each remaining direct child, disposes its full subtree via
disposeObjectTreeand removes it from the scene.This is the dataset-switch teardown, so it ALSO drops every depth-sort registration wholesale: the per-mesh release inside
disposeObjectTreecovers meshes reachable from the scene walk, andreleaseAllDepthSortNodessweeps any coordinator/worker state whose mesh was never attached (or was detached before the switch) — the old dataset's registrations must not outlive it either way.