Refactor junction material handling to use MaterialDef
This commit is contained in:
@@ -4336,14 +4336,8 @@ export class RuntimeHost {
|
||||
}
|
||||
|
||||
private createRuntimeJunctionMaterial(
|
||||
runtimeScene: RuntimeSceneDefinition,
|
||||
materialId: string | null
|
||||
material: MaterialDef | null
|
||||
): Material {
|
||||
const material =
|
||||
materialId === null
|
||||
? null
|
||||
: (runtimeScene.materials?.[materialId] ?? null);
|
||||
|
||||
return this.createRuntimeRoadGeneratedMaterial(material, 0x6f624d);
|
||||
}
|
||||
|
||||
@@ -4427,7 +4421,7 @@ export class RuntimeHost {
|
||||
|
||||
const mesh = new Mesh(
|
||||
geometry,
|
||||
this.createRuntimeJunctionMaterial(runtimeScene, junction.materialId)
|
||||
this.createRuntimeJunctionMaterial(junction.material)
|
||||
);
|
||||
mesh.castShadow = false;
|
||||
mesh.receiveShadow = true;
|
||||
|
||||
@@ -2057,7 +2057,14 @@ export function buildRuntimeSceneFromDocument(
|
||||
.map((path) => buildRuntimePath(path, enabledTerrains, document));
|
||||
const splineCorridorJunctions = getSplineCorridorJunctions(
|
||||
document.splineCorridorJunctions
|
||||
).filter((junction) => junction.enabled);
|
||||
)
|
||||
.filter((junction) => junction.enabled)
|
||||
.map((junction): RuntimeSplineCorridorJunction => ({
|
||||
...junction,
|
||||
connections: junction.connections.map((connection) => ({ ...connection })),
|
||||
center: cloneVec3(junction.center),
|
||||
material: resolveRuntimeMaterial(document, junction.materialId)
|
||||
}));
|
||||
const splineCorridorClipIntervalsByPath =
|
||||
resolveSplineCorridorJunctionClipIntervals({
|
||||
paths: getScenePaths(document.paths),
|
||||
|
||||
Reference in New Issue
Block a user