Improve scene path sampling logic to support curve modes and sampled resolution options

This commit is contained in:
2026-05-12 22:46:12 +02:00
parent 2c7197e6eb
commit 3da575da72
2 changed files with 10 additions and 4 deletions

View File

@@ -303,6 +303,10 @@ import { type SequenceClip } from "../sequencer/project-sequence-steps";
import {
createScenePath,
createScenePathPoint,
DEFAULT_SCENE_PATH_CURVE_MODE,
DEFAULT_SCENE_PATH_SAMPLED_RESOLUTION,
isScenePathCurveMode,
normalizeScenePathSampledResolution,
type ScenePath,
type ScenePathPoint
} from "./paths";

View File

@@ -894,7 +894,7 @@ export function sampleResolvedScenePathPosition(
progress: number,
options: { smooth?: boolean } = {}
): Vec3 {
if (options.smooth) {
if (options.smooth && path.curveMode !== "catmullRom") {
return sampleSmoothedPath(path, progress).position;
}
@@ -1084,7 +1084,8 @@ export function resolveNearestPointOnResolvedScenePath(
}
export function sampleScenePathPosition(
path: Pick<ScenePath, "loop" | "points">,
path: Pick<ScenePath, "loop" | "points"> &
Partial<Pick<ScenePath, "curveMode" | "sampledResolution">>,
progress: number,
options: { smooth?: boolean } = {}
): Vec3 {
@@ -1096,7 +1097,7 @@ export function sampleResolvedScenePathTangent(
progress: number,
options: { smooth?: boolean } = {}
): Vec3 {
if (options.smooth) {
if (options.smooth && path.curveMode !== "catmullRom") {
return sampleSmoothedPath(path, progress).tangent;
}
@@ -1114,7 +1115,8 @@ export function sampleResolvedScenePathTangent(
}
export function sampleScenePathTangent(
path: Pick<ScenePath, "loop" | "points">,
path: Pick<ScenePath, "loop" | "points"> &
Partial<Pick<ScenePath, "curveMode" | "sampledResolution">>,
progress: number,
options: { smooth?: boolean } = {}
): Vec3 {