fix(simulation): isolate semantics and correct clipping and orthographic LOD
This commit is contained in:
@@ -16,3 +16,10 @@ export const QUALITY_PROFILES: Record<GaussianQuality, {
|
||||
maximum: { lodBaseDistance: 7, lodMultiplier: 3, lodRangeMin: 0, lodRangeMax: 5, pixelRatio: 2, splatBudget: 0, targetFps: 60 },
|
||||
};
|
||||
|
||||
|
||||
/** PlayCanvas 2.21 chooses streamed LOD from distance × tan(fov/2), even for
|
||||
* orthographic cameras. Supply the equivalent focal-plane FOV so an ortho zoom
|
||||
* refines the stream. The orthographic projection itself is unchanged. */
|
||||
export function orthographicLodFov(halfSpan: number, focusDepth: number): number {
|
||||
return 2 * Math.atan(halfSpan / focusDepth) * 180 / Math.PI;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import {heightSlice} from "../heightSlice";
|
||||
|
||||
/** Scene-space height range, independent of the reduced collision proxy. */
|
||||
export function sceneClipBounds(visual: readonly [number, number], collision: readonly [number, number] | null): [number, number] {
|
||||
const low = Math.floor(Math.min(visual[0], collision?.[0] ?? visual[0]));
|
||||
@@ -9,3 +11,14 @@ export function sceneClipBounds(visual: readonly [number, number], collision: re
|
||||
export function sceneClipValue(value: number, [low, high]: readonly [number, number]): number {
|
||||
return value >= high - Math.max(1, high - low) * 1e-9 ? Infinity : value;
|
||||
}
|
||||
|
||||
/** Project stored unbounded planes onto the finite slider without changing their meaning. */
|
||||
export function sceneClipRange(clip: readonly [number | null, number | null], [low, high]: readonly [number, number]): [number, number] {
|
||||
const lower=Math.max(low,Math.min(high,clip[0]??low));
|
||||
return [lower,Math.max(lower,Math.min(high,clip[1]??high))];
|
||||
}
|
||||
|
||||
export function sceneClipLabel(value: number, bounds: readonly [number, number]): string {
|
||||
const slice=heightSlice([value,value],bounds);
|
||||
return slice.floor===null ? "−∞" : slice.ceiling===null ? "+∞" : `${value.toFixed(1)} м`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user