Feature: Implement road surface rendering and management in ViewportHost

This commit is contained in:
2026-05-13 01:09:59 +02:00
parent 7c404aab85
commit 0a38c7dccf

View File

@@ -366,6 +366,10 @@ interface PathRenderObjects {
}>; }>;
} }
interface RoadSurfaceRenderObjects {
mesh: Mesh<BufferGeometry, Material>;
}
interface TerrainRenderObjects { interface TerrainRenderObjects {
group: Group; group: Group;
chunks: TerrainRenderChunkObjects[]; chunks: TerrainRenderChunkObjects[];
@@ -901,6 +905,7 @@ export class ViewportHost {
private readonly lightVolumeGroup = new Group(); private readonly lightVolumeGroup = new Group();
private readonly brushGroup = new Group(); private readonly brushGroup = new Group();
private readonly terrainGroup = new Group(); private readonly terrainGroup = new Group();
private readonly roadSurfaceGroup = new Group();
private readonly terrainBrushPreviewGroup = new Group(); private readonly terrainBrushPreviewGroup = new Group();
private readonly terrainBrushPreviewLine = new Line( private readonly terrainBrushPreviewLine = new Line(
new BufferGeometry(), new BufferGeometry(),
@@ -933,6 +938,10 @@ export class ViewportHost {
TerrainRenderObjects TerrainRenderObjects
>(); >();
private readonly terrainRenderRevisions = new Map<string, number>(); private readonly terrainRenderRevisions = new Map<string, number>();
private readonly roadSurfaceRenderObjects = new Map<
string,
RoadSurfaceRenderObjects
>();
private readonly pathRenderObjects = new Map<string, PathRenderObjects>(); private readonly pathRenderObjects = new Map<string, PathRenderObjects>();
private readonly entityRenderObjects = new Map<string, EntityRenderObjects>(); private readonly entityRenderObjects = new Map<string, EntityRenderObjects>();
private readonly localLightRenderObjects = new Map< private readonly localLightRenderObjects = new Map<
@@ -1152,6 +1161,7 @@ export class ViewportHost {
this.scene.add(this.lightVolumeGroup); this.scene.add(this.lightVolumeGroup);
this.scene.add(this.brushGroup); this.scene.add(this.brushGroup);
this.scene.add(this.terrainGroup); this.scene.add(this.terrainGroup);
this.scene.add(this.roadSurfaceGroup);
this.scene.add(this.foliageRenderer.group); this.scene.add(this.foliageRenderer.group);
this.syncFoliageVisibility(); this.syncFoliageVisibility();
this.terrainBrushPreviewGroup.visible = false; this.terrainBrushPreviewGroup.visible = false;
@@ -1472,6 +1482,7 @@ export class ViewportHost {
this.currentActiveSelectionId this.currentActiveSelectionId
); );
} }
this.rebuildRoadSurfaces(document);
this.rebuildFoliage(document); this.rebuildFoliage(document);
this.rebuildPaths(document, this.currentSelection); this.rebuildPaths(document, this.currentSelection);
this.rebuildEntityMarkers(document, this.currentSelection); this.rebuildEntityMarkers(document, this.currentSelection);
@@ -1935,6 +1946,7 @@ export class ViewportHost {
this.clearLightVolumes(); this.clearLightVolumes();
this.clearBrushMeshes(); this.clearBrushMeshes();
this.clearTerrains(); this.clearTerrains();
this.clearRoadSurfaces();
this.foliageRenderer.dispose(); this.foliageRenderer.dispose();
this.clearPaths(); this.clearPaths();
this.clearEntityMarkers(); this.clearEntityMarkers();