Support glue-to-terrain and terrain offset in scene path creation and comparison
This commit is contained in:
@@ -593,6 +593,8 @@ export function createScenePath(
|
|||||||
| "loop"
|
| "loop"
|
||||||
| "curveMode"
|
| "curveMode"
|
||||||
| "sampledResolution"
|
| "sampledResolution"
|
||||||
|
| "glueToTerrain"
|
||||||
|
| "terrainOffset"
|
||||||
| "points"
|
| "points"
|
||||||
>
|
>
|
||||||
> = {}
|
> = {}
|
||||||
@@ -608,6 +610,11 @@ export function createScenePath(
|
|||||||
const sampledResolution = normalizeScenePathSampledResolution(
|
const sampledResolution = normalizeScenePathSampledResolution(
|
||||||
overrides.sampledResolution ?? DEFAULT_SCENE_PATH_SAMPLED_RESOLUTION
|
overrides.sampledResolution ?? DEFAULT_SCENE_PATH_SAMPLED_RESOLUTION
|
||||||
);
|
);
|
||||||
|
const glueToTerrain =
|
||||||
|
overrides.glueToTerrain ?? DEFAULT_SCENE_PATH_GLUE_TO_TERRAIN;
|
||||||
|
const terrainOffset = normalizeScenePathTerrainOffset(
|
||||||
|
overrides.terrainOffset ?? DEFAULT_SCENE_PATH_TERRAIN_OFFSET
|
||||||
|
);
|
||||||
|
|
||||||
if (points.length < MIN_SCENE_PATH_POINT_COUNT) {
|
if (points.length < MIN_SCENE_PATH_POINT_COUNT) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -631,6 +638,10 @@ export function createScenePath(
|
|||||||
throw new Error("Path curve mode must be linear or catmullRom.");
|
throw new Error("Path curve mode must be linear or catmullRom.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof glueToTerrain !== "boolean") {
|
||||||
|
throw new Error("Path glue to terrain must be a boolean.");
|
||||||
|
}
|
||||||
|
|
||||||
const seenPointIds = new Set<string>();
|
const seenPointIds = new Set<string>();
|
||||||
|
|
||||||
for (const point of points) {
|
for (const point of points) {
|
||||||
@@ -654,6 +665,8 @@ export function createScenePath(
|
|||||||
loop,
|
loop,
|
||||||
curveMode,
|
curveMode,
|
||||||
sampledResolution,
|
sampledResolution,
|
||||||
|
glueToTerrain,
|
||||||
|
terrainOffset,
|
||||||
points
|
points
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -672,6 +685,8 @@ export function areScenePathsEqual(left: ScenePath, right: ScenePath): boolean {
|
|||||||
left.loop === right.loop &&
|
left.loop === right.loop &&
|
||||||
left.curveMode === right.curveMode &&
|
left.curveMode === right.curveMode &&
|
||||||
left.sampledResolution === right.sampledResolution &&
|
left.sampledResolution === right.sampledResolution &&
|
||||||
|
left.glueToTerrain === right.glueToTerrain &&
|
||||||
|
left.terrainOffset === right.terrainOffset &&
|
||||||
left.points.length === right.points.length &&
|
left.points.length === right.points.length &&
|
||||||
left.points.every(
|
left.points.every(
|
||||||
(point, index) =>
|
(point, index) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user