Refactor road surface update logic to use dedicated rebuild method
This commit is contained in:
@@ -7522,38 +7522,12 @@ export class ViewportHost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private updateRoadSurfaceRenderObjectState(path: ScenePath) {
|
private updateRoadSurfaceRenderObjectState(path: ScenePath) {
|
||||||
const existingRenderObjects = this.roadSurfaceRenderObjects.get(path.id);
|
|
||||||
|
|
||||||
if (existingRenderObjects !== undefined) {
|
|
||||||
for (const mesh of existingRenderObjects.meshes) {
|
|
||||||
this.roadSurfaceGroup.remove(mesh);
|
|
||||||
mesh.geometry.dispose();
|
|
||||||
mesh.material.dispose();
|
|
||||||
}
|
|
||||||
this.roadSurfaceRenderObjects.delete(path.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.currentDocument === null) {
|
if (this.currentDocument === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const terrains = getTerrains(this.currentDocument.terrains).filter(
|
void path;
|
||||||
(terrain) => terrain.enabled
|
this.rebuildRoadSurfaces(this.currentDocument);
|
||||||
);
|
|
||||||
const nextRenderObjects = this.createRoadSurfaceRenderObjects(
|
|
||||||
path,
|
|
||||||
terrains
|
|
||||||
);
|
|
||||||
|
|
||||||
if (nextRenderObjects === null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const mesh of nextRenderObjects.meshes) {
|
|
||||||
this.roadSurfaceGroup.add(mesh);
|
|
||||||
}
|
|
||||||
this.roadSurfaceRenderObjects.set(path.id, nextRenderObjects);
|
|
||||||
this.applyShadowState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private rebuildSplineRepeaters(document: SceneDocument) {
|
private rebuildSplineRepeaters(document: SceneDocument) {
|
||||||
|
|||||||
Reference in New Issue
Block a user