Enhance runtime path building to include road material definitions
This commit is contained in:
@@ -514,7 +514,9 @@ export interface RuntimePath {
|
|||||||
sampledResolution: number;
|
sampledResolution: number;
|
||||||
glueToTerrain: boolean;
|
glueToTerrain: boolean;
|
||||||
terrainOffset: number;
|
terrainOffset: number;
|
||||||
road: ScenePathRoadSettings;
|
road: ScenePathRoadSettings & {
|
||||||
|
material: MaterialDef | null;
|
||||||
|
};
|
||||||
points: RuntimePathPoint[];
|
points: RuntimePathPoint[];
|
||||||
segments: RuntimePathSegment[];
|
segments: RuntimePathSegment[];
|
||||||
totalLength: number;
|
totalLength: number;
|
||||||
@@ -1001,7 +1003,8 @@ function buildRuntimePathPoint(point: ScenePathPoint): RuntimePathPoint {
|
|||||||
|
|
||||||
function buildRuntimePath(
|
function buildRuntimePath(
|
||||||
path: ScenePath,
|
path: ScenePath,
|
||||||
terrains: readonly Terrain[]
|
terrains: readonly Terrain[],
|
||||||
|
document: SceneDocument
|
||||||
): RuntimePath {
|
): RuntimePath {
|
||||||
const resolvedPath = resolveScenePath(path, { terrains });
|
const resolvedPath = resolveScenePath(path, { terrains });
|
||||||
|
|
||||||
@@ -1015,7 +1018,10 @@ function buildRuntimePath(
|
|||||||
sampledResolution: resolvedPath.sampledResolution,
|
sampledResolution: resolvedPath.sampledResolution,
|
||||||
glueToTerrain: resolvedPath.glueToTerrain,
|
glueToTerrain: resolvedPath.glueToTerrain,
|
||||||
terrainOffset: resolvedPath.terrainOffset,
|
terrainOffset: resolvedPath.terrainOffset,
|
||||||
road: { ...path.road },
|
road: {
|
||||||
|
...path.road,
|
||||||
|
material: resolveRuntimeMaterial(document, path.road.materialId)
|
||||||
|
},
|
||||||
points: resolvedPath.points.map(buildRuntimePathPoint),
|
points: resolvedPath.points.map(buildRuntimePathPoint),
|
||||||
segments: resolvedPath.segments.map((segment) => ({
|
segments: resolvedPath.segments.map((segment) => ({
|
||||||
index: segment.index,
|
index: segment.index,
|
||||||
@@ -2001,7 +2007,7 @@ export function buildRuntimeSceneFromDocument(
|
|||||||
const modelInstances = enabledModelInstances.map(buildRuntimeModelInstance);
|
const modelInstances = enabledModelInstances.map(buildRuntimeModelInstance);
|
||||||
const paths = getScenePaths(document.paths)
|
const paths = getScenePaths(document.paths)
|
||||||
.filter((path) => path.enabled)
|
.filter((path) => path.enabled)
|
||||||
.map((path) => buildRuntimePath(path, enabledTerrains));
|
.map((path) => buildRuntimePath(path, enabledTerrains, document));
|
||||||
const collections = buildRuntimeSceneCollections(
|
const collections = buildRuntimeSceneCollections(
|
||||||
document,
|
document,
|
||||||
options.runtimeClock ?? null,
|
options.runtimeClock ?? null,
|
||||||
|
|||||||
Reference in New Issue
Block a user