Add support for spline corridor junction edge meshes

This commit is contained in:
2026-05-13 16:53:24 +02:00
parent b7653af075
commit ae6a28e3f2
2 changed files with 49 additions and 14 deletions

View File

@@ -4419,23 +4419,54 @@ export class RuntimeHost {
paths: runtimeScene.paths, paths: runtimeScene.paths,
terrains: runtimeScene.foliage.terrains terrains: runtimeScene.foliage.terrains
}); });
const meshes: Array<Mesh<BufferGeometry, Material>> = [];
if (geometry === null) { if (geometry !== null) {
continue; const mesh = new Mesh(
geometry,
this.createRuntimeJunctionMaterial(junction.material)
);
mesh.castShadow = false;
mesh.receiveShadow = true;
mesh.userData.splineCorridorJunctionId = junction.id;
applyRendererRenderCategoryFromMaterial(mesh);
this.roadSurfaceGroup.add(mesh);
meshes.push(mesh);
} }
const mesh = new Mesh( const edge = resolveSplineCorridorJunctionEdgeSettings({
geometry, junction,
this.createRuntimeJunctionMaterial(junction.material) paths: runtimeScene.paths
);
mesh.castShadow = false;
mesh.receiveShadow = true;
mesh.userData.splineCorridorJunctionId = junction.id;
applyRendererRenderCategoryFromMaterial(mesh);
this.roadSurfaceGroup.add(mesh);
this.roadSurfaceMeshes.set(`junction:${junction.id}`, {
meshes: [mesh]
}); });
const edgeGeometry =
edge === null
? null
: buildSplineCorridorJunctionEdgeMeshGeometry({
junction,
paths: runtimeScene.paths,
terrains: runtimeScene.foliage.terrains,
edge
});
if (edge !== null && edgeGeometry !== null) {
const edgeMesh = new Mesh(
edgeGeometry,
this.createRuntimeRoadEdgeMaterial(edge)
);
edgeMesh.castShadow = false;
edgeMesh.receiveShadow = true;
edgeMesh.userData.splineCorridorJunctionId = junction.id;
edgeMesh.userData.roadEdgeSide = "junction";
applyRendererRenderCategoryFromMaterial(edgeMesh);
this.roadSurfaceGroup.add(edgeMesh);
meshes.push(edgeMesh);
}
if (meshes.length > 0) {
this.roadSurfaceMeshes.set(`junction:${junction.id}`, {
meshes
});
}
} }
this.applyShadowState(); this.applyShadowState();

View File

@@ -6,7 +6,11 @@ import {
buildSplineCorridorJunctionFootprint, buildSplineCorridorJunctionFootprint,
sampleSplineCorridorJunctionFootprintInfluence sampleSplineCorridorJunctionFootprintInfluence
} from "../../src/geometry/spline-corridor-junction-footprint"; } from "../../src/geometry/spline-corridor-junction-footprint";
import { buildSplineCorridorJunctionMeshGeometry } from "../../src/geometry/spline-corridor-junction-mesh"; import {
buildSplineCorridorJunctionEdgeMeshData,
buildSplineCorridorJunctionMeshGeometry,
resolveSplineCorridorJunctionEdgeSettings
} from "../../src/geometry/spline-corridor-junction-mesh";
function createRoadPath( function createRoadPath(
id: string, id: string,