Implement road surface render object state update logic

This commit is contained in:
2026-05-13 01:14:35 +02:00
parent 7501d9de42
commit fea716d693

View File

@@ -7368,6 +7368,37 @@ export class ViewportHost {
this.applyShadowState();
}
private updateRoadSurfaceRenderObjectState(path: ScenePath) {
const existingRenderObjects = this.roadSurfaceRenderObjects.get(path.id);
if (existingRenderObjects !== undefined) {
this.roadSurfaceGroup.remove(existingRenderObjects.mesh);
existingRenderObjects.mesh.geometry.dispose();
existingRenderObjects.mesh.material.dispose();
this.roadSurfaceRenderObjects.delete(path.id);
}
if (this.currentDocument === null) {
return;
}
const terrains = getTerrains(this.currentDocument.terrains).filter(
(terrain) => terrain.enabled
);
const nextRenderObjects = this.createRoadSurfaceRenderObjects(
path,
terrains
);
if (nextRenderObjects === null) {
return;
}
this.roadSurfaceGroup.add(nextRenderObjects.mesh);
this.roadSurfaceRenderObjects.set(path.id, nextRenderObjects);
this.applyShadowState();
}
private rebuildTerrains(
document: SceneDocument,
_selection: EditorSelection,