feat(web): studio worlds, camera-view/offscreen environment parity, material and undo coverage
Environment lighting: - ship all eight desktop studiolights/world datasets (WBENV1 float32) and a shared loader used by both the main viewport and the offscreen worker - add the N-panel "studio 环境" selector - rotate the world background together with the environment (backgroundRotation/backgroundIntensity), so camera view and offscreen renders match the desktop Mapping-node behaviour Verification (Chromium, OPFS, NOT_CLAIMED): - environment lighting + 8 world pixel identity - camera-view rotation correspondence (camera matrices, 207 samples) - offscreen vs on-screen background parity after hiding geometry (1305 samples) - metals case extended with material-field OPFS roundtrip - material Principled edits and rename undo/redo - eight studio worlds: pairwise frame differences + luminance rank correlation - undo history depth capped at 64 steps and undo across OPFS save/reopen Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -99,12 +99,28 @@ export function orbitStateFromPosition(position: readonly number[], target: read
|
||||
};
|
||||
}
|
||||
|
||||
export function applyOrbitDelta(state: ViewportOrbitState, deltaX: number, deltaY: number, zoom: number): ViewportOrbitState {
|
||||
/** User preferences that scale navigation; omitted values keep the desktop defaults. */
|
||||
export interface OrbitDeltaOptions {
|
||||
rotateSensitivity?: number;
|
||||
zoomSensitivity?: number;
|
||||
invertZoom?: boolean;
|
||||
}
|
||||
|
||||
export function applyOrbitDelta(
|
||||
state: ViewportOrbitState,
|
||||
deltaX: number,
|
||||
deltaY: number,
|
||||
zoom: number,
|
||||
options: OrbitDeltaOptions = {},
|
||||
): ViewportOrbitState {
|
||||
const rotate = VIEWPORT_ORBIT_ROTATE_SENSITIVITY * (options.rotateSensitivity ?? 1);
|
||||
const zoomScale = VIEWPORT_ORBIT_ZOOM_SENSITIVITY * (options.zoomSensitivity ?? 1);
|
||||
const wheelZoom = options.invertZoom ? -zoom : zoom;
|
||||
return {
|
||||
...state,
|
||||
yaw: state.yaw - deltaX * VIEWPORT_ORBIT_ROTATE_SENSITIVITY,
|
||||
pitch: Math.max(-1.45, Math.min(1.45, state.pitch + deltaY * VIEWPORT_ORBIT_ROTATE_SENSITIVITY)),
|
||||
distance: Math.max(VIEWPORT_ORBIT_MIN_DISTANCE, Math.min(VIEWPORT_ORBIT_MAX_DISTANCE, state.distance * Math.exp(zoom * VIEWPORT_ORBIT_ZOOM_SENSITIVITY))),
|
||||
yaw: state.yaw - deltaX * rotate,
|
||||
pitch: Math.max(-1.45, Math.min(1.45, state.pitch + deltaY * rotate)),
|
||||
distance: Math.max(VIEWPORT_ORBIT_MIN_DISTANCE, Math.min(VIEWPORT_ORBIT_MAX_DISTANCE, state.distance * Math.exp(wheelZoom * zoomScale))),
|
||||
target: [...state.target] as [number, number, number],
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user