Improve scene path sampling logic to support curve modes and sampled resolution options
This commit is contained in:
@@ -303,6 +303,10 @@ import { type SequenceClip } from "../sequencer/project-sequence-steps";
|
|||||||
import {
|
import {
|
||||||
createScenePath,
|
createScenePath,
|
||||||
createScenePathPoint,
|
createScenePathPoint,
|
||||||
|
DEFAULT_SCENE_PATH_CURVE_MODE,
|
||||||
|
DEFAULT_SCENE_PATH_SAMPLED_RESOLUTION,
|
||||||
|
isScenePathCurveMode,
|
||||||
|
normalizeScenePathSampledResolution,
|
||||||
type ScenePath,
|
type ScenePath,
|
||||||
type ScenePathPoint
|
type ScenePathPoint
|
||||||
} from "./paths";
|
} from "./paths";
|
||||||
|
|||||||
@@ -894,7 +894,7 @@ export function sampleResolvedScenePathPosition(
|
|||||||
progress: number,
|
progress: number,
|
||||||
options: { smooth?: boolean } = {}
|
options: { smooth?: boolean } = {}
|
||||||
): Vec3 {
|
): Vec3 {
|
||||||
if (options.smooth) {
|
if (options.smooth && path.curveMode !== "catmullRom") {
|
||||||
return sampleSmoothedPath(path, progress).position;
|
return sampleSmoothedPath(path, progress).position;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1084,7 +1084,8 @@ export function resolveNearestPointOnResolvedScenePath(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function sampleScenePathPosition(
|
export function sampleScenePathPosition(
|
||||||
path: Pick<ScenePath, "loop" | "points">,
|
path: Pick<ScenePath, "loop" | "points"> &
|
||||||
|
Partial<Pick<ScenePath, "curveMode" | "sampledResolution">>,
|
||||||
progress: number,
|
progress: number,
|
||||||
options: { smooth?: boolean } = {}
|
options: { smooth?: boolean } = {}
|
||||||
): Vec3 {
|
): Vec3 {
|
||||||
@@ -1096,7 +1097,7 @@ export function sampleResolvedScenePathTangent(
|
|||||||
progress: number,
|
progress: number,
|
||||||
options: { smooth?: boolean } = {}
|
options: { smooth?: boolean } = {}
|
||||||
): Vec3 {
|
): Vec3 {
|
||||||
if (options.smooth) {
|
if (options.smooth && path.curveMode !== "catmullRom") {
|
||||||
return sampleSmoothedPath(path, progress).tangent;
|
return sampleSmoothedPath(path, progress).tangent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1114,7 +1115,8 @@ export function sampleResolvedScenePathTangent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function sampleScenePathTangent(
|
export function sampleScenePathTangent(
|
||||||
path: Pick<ScenePath, "loop" | "points">,
|
path: Pick<ScenePath, "loop" | "points"> &
|
||||||
|
Partial<Pick<ScenePath, "curveMode" | "sampledResolution">>,
|
||||||
progress: number,
|
progress: number,
|
||||||
options: { smooth?: boolean } = {}
|
options: { smooth?: boolean } = {}
|
||||||
): Vec3 {
|
): Vec3 {
|
||||||
|
|||||||
Reference in New Issue
Block a user