@playcanvas/supersplat-viewer 1.16.5 → 1.16.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/package.json +1 -1
- package/public/index.css +42 -5
- package/public/index.html +70 -28
- package/public/index.js +421 -103
- package/public/index.js.map +1 -1
package/public/index.js
CHANGED
|
@@ -69478,7 +69478,7 @@ const initJoystick = (dom, events, state) => {
|
|
|
69478
69478
|
let lastTapTime = 0;
|
|
69479
69479
|
// Update joystick visibility based on camera mode and input mode
|
|
69480
69480
|
const updateJoystickVisibility = () => {
|
|
69481
|
-
if ((state.cameraMode === 'fly' || state.cameraMode === 'fps') && state.inputMode === 'touch' && state.
|
|
69481
|
+
if ((state.cameraMode === 'fly' || state.cameraMode === 'fps') && state.inputMode === 'touch' && state.gamingControls) {
|
|
69482
69482
|
dom.joystickBase.classList.remove('hidden');
|
|
69483
69483
|
dom.joystickBase.classList.toggle('mode-2d', joystickMode === '2d');
|
|
69484
69484
|
dom.joystickBase.style.left = `${joystickFixedX}px`;
|
|
@@ -69498,7 +69498,7 @@ const initJoystick = (dom, events, state) => {
|
|
|
69498
69498
|
};
|
|
69499
69499
|
events.on('cameraMode:changed', updateJoystickVisibility);
|
|
69500
69500
|
events.on('inputMode:changed', updateJoystickVisibility);
|
|
69501
|
-
events.on('
|
|
69501
|
+
events.on('gamingControls:changed', updateJoystickVisibility);
|
|
69502
69502
|
window.addEventListener('resize', updateJoystickVisibility);
|
|
69503
69503
|
// Handle joystick touch input directly on the joystick element
|
|
69504
69504
|
const updateJoystickStick = (clientX, clientY) => {
|
|
@@ -69648,10 +69648,12 @@ const initUI = (global) => {
|
|
|
69648
69648
|
'play', 'pause',
|
|
69649
69649
|
'settings', 'settingsPanel',
|
|
69650
69650
|
'orbitCamera', 'flyCamera', 'fpsCamera',
|
|
69651
|
-
'
|
|
69652
|
-
'
|
|
69653
|
-
'
|
|
69654
|
-
'
|
|
69651
|
+
'retinaDisplayRow', 'retinaDisplayCheck', 'retinaDisplayOption',
|
|
69652
|
+
'gamingControlsRow', 'gamingControlsCheck', 'gamingControlsOption',
|
|
69653
|
+
'desktopClickToWalk', 'desktopGamingControls',
|
|
69654
|
+
'touchFlyClickToWalk', 'touchFlyGamingControls',
|
|
69655
|
+
'touchClickToWalk', 'touchGamingControls',
|
|
69656
|
+
'walkHint',
|
|
69655
69657
|
'reset', 'frame',
|
|
69656
69658
|
'loadingText', 'loadingBar',
|
|
69657
69659
|
'joystickBase', 'joystick',
|
|
@@ -69740,47 +69742,32 @@ const initUI = (global) => {
|
|
|
69740
69742
|
dom.enterFullscreen.classList[value ? 'add' : 'remove']('hidden');
|
|
69741
69743
|
dom.exitFullscreen.classList[value ? 'remove' : 'add']('hidden');
|
|
69742
69744
|
});
|
|
69743
|
-
//
|
|
69744
|
-
dom.
|
|
69745
|
-
state.
|
|
69745
|
+
// Retina display toggle
|
|
69746
|
+
dom.retinaDisplayRow.addEventListener('click', () => {
|
|
69747
|
+
state.retinaDisplay = !state.retinaDisplay;
|
|
69746
69748
|
});
|
|
69747
|
-
|
|
69748
|
-
state.
|
|
69749
|
-
|
|
69750
|
-
const updateHQ = () => {
|
|
69751
|
-
dom.hqCheck.classList[state.hqMode ? 'add' : 'remove']('active');
|
|
69752
|
-
dom.lqCheck.classList[state.hqMode ? 'remove' : 'add']('active');
|
|
69749
|
+
const updateRetinaDisplay = () => {
|
|
69750
|
+
dom.retinaDisplayCheck.classList.toggle('active', state.retinaDisplay);
|
|
69751
|
+
localStorage.setItem('retinaDisplay', String(state.retinaDisplay));
|
|
69753
69752
|
};
|
|
69754
|
-
events.on('
|
|
69755
|
-
|
|
69756
|
-
|
|
69757
|
-
|
|
69758
|
-
|
|
69759
|
-
// Touch control scheme toggle (only visible on touch devices)
|
|
69760
|
-
dom.joystickSchemeRow.addEventListener('click', () => {
|
|
69761
|
-
state.touchControlScheme = 'joystick';
|
|
69762
|
-
});
|
|
69763
|
-
dom.pinchSchemeRow.addEventListener('click', () => {
|
|
69764
|
-
state.touchControlScheme = 'pinch';
|
|
69753
|
+
events.on('retinaDisplay:changed', updateRetinaDisplay);
|
|
69754
|
+
updateRetinaDisplay();
|
|
69755
|
+
// Gaming mode toggle
|
|
69756
|
+
dom.gamingControlsRow.addEventListener('click', () => {
|
|
69757
|
+
state.gamingControls = !state.gamingControls;
|
|
69765
69758
|
});
|
|
69766
|
-
const
|
|
69767
|
-
|
|
69768
|
-
dom.
|
|
69769
|
-
dom.
|
|
69770
|
-
dom.
|
|
69771
|
-
dom.
|
|
69772
|
-
|
|
69759
|
+
const updateGamingControls = () => {
|
|
69760
|
+
dom.gamingControlsCheck.classList.toggle('active', state.gamingControls);
|
|
69761
|
+
dom.desktopClickToWalk.classList.toggle('hidden', state.gamingControls);
|
|
69762
|
+
dom.desktopGamingControls.classList.toggle('hidden', !state.gamingControls);
|
|
69763
|
+
dom.touchFlyClickToWalk.classList.toggle('hidden', state.gamingControls);
|
|
69764
|
+
dom.touchFlyGamingControls.classList.toggle('hidden', !state.gamingControls);
|
|
69765
|
+
dom.touchClickToWalk.classList.toggle('hidden', state.gamingControls);
|
|
69766
|
+
dom.touchGamingControls.classList.toggle('hidden', !state.gamingControls);
|
|
69767
|
+
localStorage.setItem('gamingControls', String(state.gamingControls));
|
|
69773
69768
|
};
|
|
69774
|
-
|
|
69775
|
-
|
|
69776
|
-
dom.touchControlsDivider.classList.toggle('hidden', !isTouch);
|
|
69777
|
-
dom.joystickSchemeRow.classList.toggle('hidden', !isTouch);
|
|
69778
|
-
dom.pinchSchemeRow.classList.toggle('hidden', !isTouch);
|
|
69779
|
-
};
|
|
69780
|
-
events.on('touchControlScheme:changed', updateTouchControlScheme);
|
|
69781
|
-
events.on('inputMode:changed', updateTouchControlsVisibility);
|
|
69782
|
-
updateTouchControlScheme();
|
|
69783
|
-
updateTouchControlsVisibility();
|
|
69769
|
+
events.on('gamingControls:changed', updateGamingControls);
|
|
69770
|
+
updateGamingControls();
|
|
69784
69771
|
// AR/VR
|
|
69785
69772
|
const arChanged = () => dom.arMode.classList[state.hasAR ? 'remove' : 'add']('hidden');
|
|
69786
69773
|
const vrChanged = () => dom.vrMode.classList[state.hasVR ? 'remove' : 'add']('hidden');
|
|
@@ -69943,6 +69930,34 @@ const initUI = (global) => {
|
|
|
69943
69930
|
dom.fpsCamera.classList.toggle('active', state.cameraMode === 'fps');
|
|
69944
69931
|
};
|
|
69945
69932
|
events.on('cameraMode:changed', updateCameraModeUI);
|
|
69933
|
+
// Walk mode hint banner (shown once per session on first FPS entry)
|
|
69934
|
+
let walkHintShown = false;
|
|
69935
|
+
const getWalkHintText = () => {
|
|
69936
|
+
if (state.inputMode === 'desktop') {
|
|
69937
|
+
return state.gamingControls ?
|
|
69938
|
+
'WASD to move. Mouse to look around. Space to jump.' :
|
|
69939
|
+
'Click to walk. Click and drag to look around.';
|
|
69940
|
+
}
|
|
69941
|
+
return state.gamingControls ?
|
|
69942
|
+
'Use the joystick to move. Drag to look around. Tap to jump.' :
|
|
69943
|
+
'Tap to walk. Drag to look around.';
|
|
69944
|
+
};
|
|
69945
|
+
events.on('cameraMode:changed', (value) => {
|
|
69946
|
+
if (value === 'fps' && !walkHintShown) {
|
|
69947
|
+
walkHintShown = true;
|
|
69948
|
+
dom.walkHint.textContent = getWalkHintText();
|
|
69949
|
+
dom.walkHint.classList.remove('hidden');
|
|
69950
|
+
}
|
|
69951
|
+
else if (value !== 'fps') {
|
|
69952
|
+
dom.walkHint.classList.add('hidden');
|
|
69953
|
+
}
|
|
69954
|
+
});
|
|
69955
|
+
const dismissWalkHint = () => dom.walkHint.classList.add('hidden');
|
|
69956
|
+
dom.walkHint.addEventListener('click', dismissWalkHint);
|
|
69957
|
+
events.on('inputEvent', (type) => {
|
|
69958
|
+
if (type === 'interrupt')
|
|
69959
|
+
dismissWalkHint();
|
|
69960
|
+
});
|
|
69946
69961
|
// show/hide the FPS button based on voxel data availability
|
|
69947
69962
|
events.on('hasCollision:changed', (value) => {
|
|
69948
69963
|
dom.fpsCamera.classList.toggle('hidden', !value);
|
|
@@ -71797,9 +71812,12 @@ class InputController {
|
|
|
71797
71812
|
_tapTouches = 0;
|
|
71798
71813
|
_tapDelta = 0;
|
|
71799
71814
|
_tapJump = false;
|
|
71800
|
-
// Screen coordinates of the last
|
|
71801
|
-
|
|
71802
|
-
|
|
71815
|
+
// Screen coordinates of the last pointer start (for click/tap-to-walk picking)
|
|
71816
|
+
_lastPointerOffsetX = 0;
|
|
71817
|
+
_lastPointerOffsetY = 0;
|
|
71818
|
+
// Desktop click-to-walk tracking
|
|
71819
|
+
_mouseClickTracking = false;
|
|
71820
|
+
_mouseClickDelta = 0;
|
|
71803
71821
|
_picker = null;
|
|
71804
71822
|
moveSpeed = 4;
|
|
71805
71823
|
orbitSpeed = 18;
|
|
@@ -71821,6 +71839,14 @@ class InputController {
|
|
|
71821
71839
|
this._touchJoystick[1] = value.y;
|
|
71822
71840
|
});
|
|
71823
71841
|
this.global = global;
|
|
71842
|
+
const updateCanvasCursor = () => {
|
|
71843
|
+
if (state.cameraMode === 'fps' && !state.gamingControls && state.inputMode === 'desktop') {
|
|
71844
|
+
canvas.style.cursor = this._mouseClickTracking ? 'move' : 'pointer';
|
|
71845
|
+
}
|
|
71846
|
+
else {
|
|
71847
|
+
canvas.style.cursor = '';
|
|
71848
|
+
}
|
|
71849
|
+
};
|
|
71824
71850
|
// Generate input events
|
|
71825
71851
|
['wheel', 'pointerdown', 'contextmenu', 'keydown'].forEach((eventName) => {
|
|
71826
71852
|
canvas.addEventListener(eventName, (event) => {
|
|
@@ -71833,13 +71859,19 @@ class InputController {
|
|
|
71833
71859
|
// Detect double taps manually because iOS doesn't send dblclick events
|
|
71834
71860
|
const lastTap = { time: 0, x: 0, y: 0 };
|
|
71835
71861
|
canvas.addEventListener('pointerdown', (event) => {
|
|
71836
|
-
// Store
|
|
71837
|
-
this.
|
|
71838
|
-
this.
|
|
71839
|
-
// Cancel any active auto-walk
|
|
71840
|
-
if (state.cameraMode === 'fps' &&
|
|
71862
|
+
// Store coordinates for click/tap-to-walk picking
|
|
71863
|
+
this._lastPointerOffsetX = event.offsetX;
|
|
71864
|
+
this._lastPointerOffsetY = event.offsetY;
|
|
71865
|
+
// Cancel any active auto-walk in click-to-walk mode
|
|
71866
|
+
if (state.cameraMode === 'fps' && !state.gamingControls) {
|
|
71841
71867
|
events.fire('walkCancel');
|
|
71842
71868
|
}
|
|
71869
|
+
// Start desktop click-to-walk tracking
|
|
71870
|
+
if (event.pointerType !== 'touch' && event.button === 0) {
|
|
71871
|
+
this._mouseClickTracking = true;
|
|
71872
|
+
this._mouseClickDelta = 0;
|
|
71873
|
+
updateCanvasCursor();
|
|
71874
|
+
}
|
|
71843
71875
|
const now = Date.now();
|
|
71844
71876
|
const delay = Math.max(0, now - lastTap.time);
|
|
71845
71877
|
if (delay < 300 &&
|
|
@@ -71854,6 +71886,31 @@ class InputController {
|
|
|
71854
71886
|
lastTap.y = event.clientY;
|
|
71855
71887
|
}
|
|
71856
71888
|
});
|
|
71889
|
+
// Desktop click-to-walk: accumulate displacement during mouse drag
|
|
71890
|
+
canvas.addEventListener('pointermove', (event) => {
|
|
71891
|
+
if (this._mouseClickTracking && event.pointerType !== 'touch') {
|
|
71892
|
+
this._mouseClickDelta += Math.abs(event.movementX) + Math.abs(event.movementY);
|
|
71893
|
+
}
|
|
71894
|
+
});
|
|
71895
|
+
// Desktop click-to-walk: detect click (low displacement) on mouse button release
|
|
71896
|
+
canvas.addEventListener('pointerup', (event) => {
|
|
71897
|
+
if (this._mouseClickTracking && event.pointerType !== 'touch' && event.button === 0) {
|
|
71898
|
+
this._mouseClickTracking = false;
|
|
71899
|
+
updateCanvasCursor();
|
|
71900
|
+
if (this._mouseClickDelta < TAP_EPSILON && state.cameraMode === 'fps' && !state.gamingControls) {
|
|
71901
|
+
if (!this._picker) {
|
|
71902
|
+
this._picker = new Picker(app, camera);
|
|
71903
|
+
}
|
|
71904
|
+
const pickX = this._lastPointerOffsetX / canvas.clientWidth;
|
|
71905
|
+
const pickY = this._lastPointerOffsetY / canvas.clientHeight;
|
|
71906
|
+
this._picker.pick(pickX, pickY).then((result) => {
|
|
71907
|
+
if (result && state.cameraMode === 'fps' && !state.gamingControls) {
|
|
71908
|
+
events.fire('walkTo', result);
|
|
71909
|
+
}
|
|
71910
|
+
});
|
|
71911
|
+
}
|
|
71912
|
+
}
|
|
71913
|
+
});
|
|
71857
71914
|
// Calculate pick location on double click
|
|
71858
71915
|
events.on('inputEvent', async (eventName, event) => {
|
|
71859
71916
|
switch (eventName) {
|
|
@@ -71928,34 +71985,53 @@ class InputController {
|
|
|
71928
71985
|
navigator.keyboard.unlock();
|
|
71929
71986
|
}
|
|
71930
71987
|
};
|
|
71931
|
-
|
|
71932
|
-
|
|
71933
|
-
|
|
71934
|
-
|
|
71935
|
-
|
|
71988
|
+
const activatePointerLock = () => {
|
|
71989
|
+
this._desktopInput._pointerLock = true;
|
|
71990
|
+
canvas.requestPointerLock();
|
|
71991
|
+
if (state.isFullscreen) {
|
|
71992
|
+
lockEscape();
|
|
71993
|
+
}
|
|
71994
|
+
};
|
|
71995
|
+
const deactivatePointerLock = () => {
|
|
71996
|
+
unlockKeyboard();
|
|
71997
|
+
this._desktopInput._pointerLock = false;
|
|
71998
|
+
if (document.pointerLockElement === canvas) {
|
|
71936
71999
|
if (state.isFullscreen) {
|
|
71937
|
-
|
|
72000
|
+
events.fire('restoreFullscreen');
|
|
71938
72001
|
}
|
|
72002
|
+
document.exitPointerLock();
|
|
72003
|
+
}
|
|
72004
|
+
};
|
|
72005
|
+
// Pointer lock management for FPS mode on desktop (gaming controls only)
|
|
72006
|
+
events.on('cameraMode:changed', (value, prev) => {
|
|
72007
|
+
if (value === 'fps' && state.inputMode === 'desktop' && state.gamingControls) {
|
|
72008
|
+
activatePointerLock();
|
|
71939
72009
|
}
|
|
71940
72010
|
else if (prev === 'fps') {
|
|
71941
|
-
|
|
71942
|
-
|
|
71943
|
-
|
|
71944
|
-
|
|
71945
|
-
|
|
71946
|
-
|
|
71947
|
-
|
|
72011
|
+
deactivatePointerLock();
|
|
72012
|
+
}
|
|
72013
|
+
updateCanvasCursor();
|
|
72014
|
+
});
|
|
72015
|
+
// Toggle pointer lock when gaming controls changes while in FPS
|
|
72016
|
+
events.on('gamingControls:changed', (value) => {
|
|
72017
|
+
if (state.cameraMode === 'fps' && state.inputMode === 'desktop') {
|
|
72018
|
+
if (value) {
|
|
72019
|
+
activatePointerLock();
|
|
72020
|
+
}
|
|
72021
|
+
else {
|
|
72022
|
+
deactivatePointerLock();
|
|
71948
72023
|
}
|
|
71949
72024
|
}
|
|
72025
|
+
updateCanvasCursor();
|
|
71950
72026
|
});
|
|
71951
72027
|
// Also lock Escape if entering fullscreen while already in FPS mode
|
|
71952
72028
|
events.on('isFullscreen:changed', (value) => {
|
|
71953
|
-
if (value && state.cameraMode === 'fps' && state.inputMode === 'desktop') {
|
|
72029
|
+
if (value && state.cameraMode === 'fps' && state.inputMode === 'desktop' && state.gamingControls) {
|
|
71954
72030
|
lockEscape();
|
|
71955
72031
|
}
|
|
71956
72032
|
});
|
|
71957
72033
|
document.addEventListener('pointerlockchange', () => {
|
|
71958
|
-
if (!document.pointerLockElement && state.cameraMode === 'fps') {
|
|
72034
|
+
if (!document.pointerLockElement && state.cameraMode === 'fps' && state.gamingControls) {
|
|
71959
72035
|
recentlyExitedFps = true;
|
|
71960
72036
|
requestAnimationFrame(() => {
|
|
71961
72037
|
recentlyExitedFps = false;
|
|
@@ -72012,17 +72088,17 @@ class InputController {
|
|
|
72012
72088
|
// Touch just ended (1+ → 0): check if it was a tap
|
|
72013
72089
|
if (prevTaps > 0 && this._tapTouches === 0) {
|
|
72014
72090
|
if (this._tapDelta < TAP_EPSILON) {
|
|
72015
|
-
if (state.
|
|
72091
|
+
if (!state.gamingControls) {
|
|
72016
72092
|
// Tap-to-walk: pick the 3D location and auto-walk toward it
|
|
72017
72093
|
const { app, camera } = this.global;
|
|
72018
72094
|
const canvas = app.graphicsDevice.canvas;
|
|
72019
72095
|
if (!this._picker) {
|
|
72020
72096
|
this._picker = new Picker(app, camera);
|
|
72021
72097
|
}
|
|
72022
|
-
const pickX = this.
|
|
72023
|
-
const pickY = this.
|
|
72098
|
+
const pickX = this._lastPointerOffsetX / canvas.clientWidth;
|
|
72099
|
+
const pickY = this._lastPointerOffsetY / canvas.clientHeight;
|
|
72024
72100
|
this._picker.pick(pickX, pickY).then((result) => {
|
|
72025
|
-
if (result && state.cameraMode === 'fps') {
|
|
72101
|
+
if (result && state.cameraMode === 'fps' && !state.gamingControls) {
|
|
72026
72102
|
events.fire('walkTo', result);
|
|
72027
72103
|
}
|
|
72028
72104
|
});
|
|
@@ -72037,10 +72113,10 @@ class InputController {
|
|
|
72037
72113
|
this._tapTouches = 0;
|
|
72038
72114
|
}
|
|
72039
72115
|
const isFirstPerson = state.cameraMode === 'fly' || isFps;
|
|
72040
|
-
// Accumulate pinch and pan deltas into velocity when
|
|
72116
|
+
// Accumulate pinch and pan deltas into velocity when not in gaming controls
|
|
72041
72117
|
// pinch[0] = oldDist - newDist: negative when spreading, positive when closing
|
|
72042
72118
|
// Spreading = forward → subtract pinch delta
|
|
72043
|
-
if (isFirstPerson && state.
|
|
72119
|
+
if (isFirstPerson && !state.gamingControls && this._state.touches > 1) {
|
|
72044
72120
|
this._pinchVelocity -= pinch[0] * this.pinchVelocitySensitivity;
|
|
72045
72121
|
this._pinchVelocity = math.clamp(this._pinchVelocity, -1, 1.0);
|
|
72046
72122
|
this._panVelocity[0] += touch[0] * this.panVelocitySensitivity;
|
|
@@ -72061,6 +72137,7 @@ class InputController {
|
|
|
72061
72137
|
const double = +(this._state.touches > 1);
|
|
72062
72138
|
const pan = this._state.mouse[2] || +(button[2] === -1) || double;
|
|
72063
72139
|
const orbitFactor = fly ? camera.fov / 120 : 1;
|
|
72140
|
+
const dragInvert = (isFps && !state.gamingControls) ? -1 : 1;
|
|
72064
72141
|
const { deltas } = this.frame;
|
|
72065
72142
|
// desktop move
|
|
72066
72143
|
const v = tmpV1.set(0, 0, 0);
|
|
@@ -72086,14 +72163,14 @@ class InputController {
|
|
|
72086
72163
|
deltas.move.append([v.x, v.y, orbit ? -v.z : v.z]);
|
|
72087
72164
|
// desktop rotate
|
|
72088
72165
|
v.set(0, 0, 0);
|
|
72089
|
-
mouseRotate.set(mouse[0], mouse[1], 0);
|
|
72166
|
+
mouseRotate.set(mouse[0] * dragInvert, mouse[1] * dragInvert, 0);
|
|
72090
72167
|
v.add(mouseRotate.mulScalar((1 - pan) * this.orbitSpeed * orbitFactor * this.mouseRotateSensitivity * DISPLACEMENT_SCALE));
|
|
72091
72168
|
deltas.rotate.append([v.x, v.y, v.z]);
|
|
72092
72169
|
// mobile move
|
|
72093
72170
|
v.set(0, 0, 0);
|
|
72094
72171
|
const orbitMove = screenToWorld(camera, touch[0], touch[1], distance);
|
|
72095
72172
|
v.add(orbitMove.mulScalar(orbit * pan));
|
|
72096
|
-
if (state.
|
|
72173
|
+
if (state.gamingControls) {
|
|
72097
72174
|
// Use touch joystick values for fly movement (X = strafe, Y = forward/backward)
|
|
72098
72175
|
flyMove.set(this._touchJoystick[0], 0, -this._touchJoystick[1]);
|
|
72099
72176
|
v.add(flyMove.mulScalar(fly * this.moveSpeed * dt));
|
|
@@ -72120,7 +72197,7 @@ class InputController {
|
|
|
72120
72197
|
v.add(orbitRotate.mulScalar(orbit * (1 - pan) * this.orbitSpeed * this.touchRotateSensitivity * DISPLACEMENT_SCALE));
|
|
72121
72198
|
// In fly mode, use single touch for look-around (inverted direction)
|
|
72122
72199
|
// Exclude multi-touch (double) to avoid interference with pinch/strafe gestures
|
|
72123
|
-
flyRotate.set(touch[0], touch[1], 0);
|
|
72200
|
+
flyRotate.set(touch[0] * dragInvert, touch[1] * dragInvert, 0);
|
|
72124
72201
|
v.add(flyRotate.mulScalar(fly * (1 - double) * this.orbitSpeed * orbitFactor * this.touchRotateSensitivity * DISPLACEMENT_SCALE));
|
|
72125
72202
|
deltas.rotate.append([v.x, v.y, v.z]);
|
|
72126
72203
|
// gamepad move
|
|
@@ -72736,6 +72813,7 @@ class VoxelDebugOverlay {
|
|
|
72736
72813
|
}
|
|
72737
72814
|
}
|
|
72738
72815
|
|
|
72816
|
+
// ── gsplat fragment shader overrides (GLSL) ─────────────────────────────────
|
|
72739
72817
|
const gsplatPSGlsl = /* glsl */ `
|
|
72740
72818
|
|
|
72741
72819
|
#ifndef DITHER_NONE
|
|
@@ -72847,22 +72925,36 @@ void main(void) {
|
|
|
72847
72925
|
vec3 walkWorldPos = walkReconstructWorldPos();
|
|
72848
72926
|
float xzDist = length(walkWorldPos.xz - walk_target.xz);
|
|
72849
72927
|
|
|
72850
|
-
float
|
|
72851
|
-
|
|
72852
|
-
float
|
|
72853
|
-
float ringDist = abs(xzDist / walk_radius - ringPhase);
|
|
72854
|
-
float ring = smoothstep(0.12, 0.0, ringDist) * 0.4;
|
|
72928
|
+
float nd = xzDist / walk_radius;
|
|
72929
|
+
float lightFalloff = 1.0 / (1.0 + nd * nd * 8.0);
|
|
72930
|
+
float coreBoost = 1.0 / (1.0 + nd * nd * 200.0);
|
|
72855
72931
|
|
|
72856
|
-
float
|
|
72932
|
+
float pulse = 1.0 + 0.1 * sin(walk_time * 3.0);
|
|
72857
72933
|
|
|
72858
|
-
|
|
72859
|
-
|
|
72934
|
+
float ringPhase = fract(walk_time * 0.5);
|
|
72935
|
+
float ringPos = nd - ringPhase;
|
|
72936
|
+
float ringFade = 1.0 - ringPhase;
|
|
72937
|
+
float crest = smoothstep(0.1, 0.0, abs(ringPos)) * 1.0 * ringFade * (1.0 + lightFalloff);
|
|
72938
|
+
float trough = smoothstep(0.25, 0.0, abs(ringPos + 0.15)) * -1.0 * ringFade;
|
|
72939
|
+
float ring = crest + trough;
|
|
72940
|
+
|
|
72941
|
+
float intensity = (lightFalloff * 0.8 + coreBoost * 1.5 + ring) * pulse;
|
|
72942
|
+
|
|
72943
|
+
float lum = dot(gaussianColor.rgb, vec3(0.299, 0.587, 0.114));
|
|
72944
|
+
float adaptiveIntensity = intensity * (1.0 - lum * 0.7);
|
|
72945
|
+
vec3 litColor = gaussianColor.xyz * (1.0 + vec3(0.85, 0.92, 1.0) * adaptiveIntensity);
|
|
72946
|
+
float spatialFalloff = normExp(A);
|
|
72947
|
+
float boostedBase = mix(gaussianColor.a, 1.0, min(intensity * 0.3, 1.0));
|
|
72948
|
+
float glowAlpha = spatialFalloff * boostedBase;
|
|
72949
|
+
|
|
72950
|
+
gl_FragColor = vec4(litColor * glowAlpha, glowAlpha);
|
|
72860
72951
|
} else {
|
|
72861
72952
|
gl_FragColor = vec4(gaussianColor.xyz * alpha, alpha);
|
|
72862
72953
|
}
|
|
72863
72954
|
#endif
|
|
72864
72955
|
}
|
|
72865
72956
|
`;
|
|
72957
|
+
// ── gsplat fragment shader overrides (WGSL) ─────────────────────────────────
|
|
72866
72958
|
const gsplatPSWgsl = /* wgsl */ `
|
|
72867
72959
|
|
|
72868
72960
|
#ifndef DITHER_NONE
|
|
@@ -72917,7 +73009,7 @@ fn walkReconstructWorldPos(fragCoord: vec4f) -> vec3f {
|
|
|
72917
73009
|
let ndc = fragCoord.xy * uniform.viewport_size.zw * 2.0 - 1.0;
|
|
72918
73010
|
let viewPos = vec3f(
|
|
72919
73011
|
ndc.x * linearDepth / uniform.matrix_projection[0][0],
|
|
72920
|
-
ndc.y * linearDepth / uniform.matrix_projection[1][1],
|
|
73012
|
+
-ndc.y * linearDepth / uniform.matrix_projection[1][1],
|
|
72921
73013
|
-linearDepth
|
|
72922
73014
|
);
|
|
72923
73015
|
return (uniform.walk_viewInverse * vec4f(viewPos, 1.0)).xyz;
|
|
@@ -72978,16 +73070,29 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
|
|
|
72978
73070
|
let walkWorldPos = walkReconstructWorldPos(pcPosition);
|
|
72979
73071
|
let xzDist = length(walkWorldPos.xz - uniform.walk_target.xz);
|
|
72980
73072
|
|
|
72981
|
-
let
|
|
72982
|
-
|
|
72983
|
-
let
|
|
72984
|
-
let ringDist = abs(xzDist / uniform.walk_radius - ringPhase);
|
|
72985
|
-
let ring = smoothstep(0.12, 0.0, ringDist) * 0.4;
|
|
73073
|
+
let nd = xzDist / uniform.walk_radius;
|
|
73074
|
+
let lightFalloff = 1.0 / (1.0 + nd * nd * 8.0);
|
|
73075
|
+
let coreBoost = 1.0 / (1.0 + nd * nd * 200.0);
|
|
72986
73076
|
|
|
72987
|
-
let
|
|
73077
|
+
let pulse = 1.0 + 0.1 * sin(uniform.walk_time * 3.0);
|
|
72988
73078
|
|
|
72989
|
-
let
|
|
72990
|
-
|
|
73079
|
+
let ringPhase = fract(uniform.walk_time * 0.5);
|
|
73080
|
+
let ringPos = nd - ringPhase;
|
|
73081
|
+
let ringFade = 1.0 - ringPhase;
|
|
73082
|
+
let crest = smoothstep(0.1, 0.0, abs(ringPos)) * 1.0 * ringFade * (1.0 + lightFalloff);
|
|
73083
|
+
let trough = smoothstep(0.25, 0.0, abs(ringPos + 0.15)) * -1.0 * ringFade;
|
|
73084
|
+
let ring = crest + trough;
|
|
73085
|
+
|
|
73086
|
+
let intensity = (lightFalloff * 0.8 + coreBoost * 1.5 + ring) * pulse;
|
|
73087
|
+
|
|
73088
|
+
let lum = dot(gc, vec3f(0.299, 0.587, 0.114));
|
|
73089
|
+
let adaptiveIntensity = intensity * (1.0 - lum * 0.7);
|
|
73090
|
+
let litColor = gc * (1.0 + vec3f(0.85, 0.92, 1.0) * adaptiveIntensity);
|
|
73091
|
+
let spatialFalloff = normExp(A);
|
|
73092
|
+
let boostedBase = mix(f32(gaussianColor.a), 1.0, min(intensity * 0.3, 1.0));
|
|
73093
|
+
let glowAlpha = spatialFalloff * boostedBase;
|
|
73094
|
+
|
|
73095
|
+
output.color = vec4f(litColor * glowAlpha, glowAlpha);
|
|
72991
73096
|
} else {
|
|
72992
73097
|
output.color = vec4f(gc * alpha, alpha);
|
|
72993
73098
|
}
|
|
@@ -72995,14 +73100,148 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
|
|
|
72995
73100
|
|
|
72996
73101
|
return output;
|
|
72997
73102
|
}`;
|
|
73103
|
+
// ── Particle shaders ────────────────────────────────────────────────────────
|
|
73104
|
+
const particleVS = /* glsl */ `
|
|
73105
|
+
attribute vec3 vertex_position;
|
|
73106
|
+
attribute vec2 aQuadCorner;
|
|
73107
|
+
|
|
73108
|
+
uniform mat4 matrix_viewProjection;
|
|
73109
|
+
uniform mat4 walk_viewInverse;
|
|
73110
|
+
uniform vec3 walk_target;
|
|
73111
|
+
uniform float walk_time;
|
|
73112
|
+
|
|
73113
|
+
varying vec2 vUV;
|
|
73114
|
+
varying float vFade;
|
|
73115
|
+
|
|
73116
|
+
void main() {
|
|
73117
|
+
float rand0 = vertex_position.x;
|
|
73118
|
+
float rand1 = vertex_position.y;
|
|
73119
|
+
float rand2 = vertex_position.z;
|
|
73120
|
+
|
|
73121
|
+
float baseAngle = rand0 * 6.28318530718;
|
|
73122
|
+
float rBase = sqrt(rand2) * 0.4;
|
|
73123
|
+
float r = rBase * smoothstep(0.0, 0.5, walk_time);
|
|
73124
|
+
|
|
73125
|
+
float riseSpeed = 0.3 + rand2 * 0.4;
|
|
73126
|
+
float t = fract(max(walk_time - rand1 * 2.0, 0.0) * riseSpeed);
|
|
73127
|
+
float y = t * t * 1.5 - 0.1;
|
|
73128
|
+
|
|
73129
|
+
float swirl = baseAngle + t * (0.5 + rand1);
|
|
73130
|
+
float swirlR = r + 0.01;
|
|
73131
|
+
vec3 center = walk_target + vec3(swirlR * cos(swirl), y, swirlR * sin(swirl));
|
|
73132
|
+
|
|
73133
|
+
vec3 camRight = walk_viewInverse[0].xyz;
|
|
73134
|
+
vec3 camUp = walk_viewInverse[1].xyz;
|
|
73135
|
+
float halfSize = 0.00625;
|
|
73136
|
+
|
|
73137
|
+
vec3 worldPos = center
|
|
73138
|
+
+ camRight * aQuadCorner.x * halfSize
|
|
73139
|
+
+ camUp * aQuadCorner.y * halfSize;
|
|
73140
|
+
|
|
73141
|
+
gl_Position = matrix_viewProjection * vec4(worldPos, 1.0);
|
|
73142
|
+
vUV = aQuadCorner;
|
|
73143
|
+
float maxT = 1.0 - rBase;
|
|
73144
|
+
vFade = smoothstep(0.0, 0.1, t) * smoothstep(maxT, maxT - 0.15, t);
|
|
73145
|
+
}
|
|
73146
|
+
`;
|
|
73147
|
+
const particleVS_WGSL = /* wgsl */ `
|
|
73148
|
+
attribute vertex_position: vec3f;
|
|
73149
|
+
attribute aQuadCorner: vec2f;
|
|
73150
|
+
|
|
73151
|
+
uniform matrix_viewProjection: mat4x4f;
|
|
73152
|
+
uniform walk_viewInverse: mat4x4f;
|
|
73153
|
+
uniform walk_target: vec3f;
|
|
73154
|
+
uniform walk_time: f32;
|
|
73155
|
+
|
|
73156
|
+
varying vUV: vec2f;
|
|
73157
|
+
varying vFade: f32;
|
|
73158
|
+
|
|
73159
|
+
@vertex fn vertexMain(input: VertexInput) -> VertexOutput {
|
|
73160
|
+
var output: VertexOutput;
|
|
73161
|
+
|
|
73162
|
+
let rand0 = input.vertex_position.x;
|
|
73163
|
+
let rand1 = input.vertex_position.y;
|
|
73164
|
+
let rand2 = input.vertex_position.z;
|
|
73165
|
+
|
|
73166
|
+
let baseAngle = rand0 * 6.28318530718;
|
|
73167
|
+
let rBase = sqrt(rand2) * 0.4;
|
|
73168
|
+
let r = rBase * smoothstep(0.0, 0.5, uniform.walk_time);
|
|
73169
|
+
|
|
73170
|
+
let riseSpeed = 0.3 + rand2 * 0.4;
|
|
73171
|
+
let t = fract(max(uniform.walk_time - rand1 * 2.0, 0.0) * riseSpeed);
|
|
73172
|
+
let y = t * t * 1.5 - 0.1;
|
|
73173
|
+
|
|
73174
|
+
let swirl = baseAngle + t * (0.5 + rand1);
|
|
73175
|
+
let swirlR = r + 0.01;
|
|
73176
|
+
let center = uniform.walk_target + vec3f(swirlR * cos(swirl), y, swirlR * sin(swirl));
|
|
73177
|
+
|
|
73178
|
+
let camRight = uniform.walk_viewInverse[0].xyz;
|
|
73179
|
+
let camUp = uniform.walk_viewInverse[1].xyz;
|
|
73180
|
+
let halfSize = 0.00625;
|
|
73181
|
+
|
|
73182
|
+
let worldPos = center
|
|
73183
|
+
+ camRight * input.aQuadCorner.x * halfSize
|
|
73184
|
+
+ camUp * input.aQuadCorner.y * halfSize;
|
|
73185
|
+
|
|
73186
|
+
output.position = uniform.matrix_viewProjection * vec4f(worldPos, 1.0);
|
|
73187
|
+
output.vUV = input.aQuadCorner;
|
|
73188
|
+
let maxT = 1.0 - rBase;
|
|
73189
|
+
output.vFade = smoothstep(0.0, 0.1, t) * smoothstep(maxT, maxT - 0.15, t);
|
|
73190
|
+
return output;
|
|
73191
|
+
}
|
|
73192
|
+
`;
|
|
73193
|
+
const particleFS = /* glsl */ `
|
|
73194
|
+
precision highp float;
|
|
73195
|
+
|
|
73196
|
+
varying vec2 vUV;
|
|
73197
|
+
varying float vFade;
|
|
73198
|
+
|
|
73199
|
+
void main() {
|
|
73200
|
+
float r = length(vUV);
|
|
73201
|
+
if (r > 1.0 || vFade < 0.5) discard;
|
|
73202
|
+
gl_FragColor = vec4(2.55, 2.76, 3.0, 1.0);
|
|
73203
|
+
}
|
|
73204
|
+
`;
|
|
73205
|
+
const particleFS_WGSL = /* wgsl */ `
|
|
73206
|
+
varying vUV: vec2f;
|
|
73207
|
+
varying vFade: f32;
|
|
73208
|
+
|
|
73209
|
+
@fragment fn fragmentMain(input: FragmentInput) -> FragmentOutput {
|
|
73210
|
+
var output: FragmentOutput;
|
|
73211
|
+
|
|
73212
|
+
let r = length(input.vUV);
|
|
73213
|
+
if (r > 1.0 || input.vFade < 0.5) {
|
|
73214
|
+
discard;
|
|
73215
|
+
return output;
|
|
73216
|
+
}
|
|
73217
|
+
output.color = vec4f(2.55, 2.76, 3.0, 1.0);
|
|
73218
|
+
return output;
|
|
73219
|
+
}
|
|
73220
|
+
`;
|
|
73221
|
+
// ── Constants & helpers ─────────────────────────────────────────────────────
|
|
73222
|
+
const PARTICLE_COUNT = 250;
|
|
73223
|
+
const QUAD_CORNERS = [-1, -1, 1, -1, 1, 1, -1, 1];
|
|
72998
73224
|
const viewMat = new Mat4();
|
|
72999
73225
|
const invViewMat = new Mat4();
|
|
73226
|
+
const targetVec = new Float32Array(3);
|
|
73227
|
+
const mulberry32 = (seed) => {
|
|
73228
|
+
return () => {
|
|
73229
|
+
seed |= 0;
|
|
73230
|
+
seed = seed + 0x6D2B79F5 | 0;
|
|
73231
|
+
let t = Math.imul(seed ^ seed >>> 15, 1 | seed);
|
|
73232
|
+
t ^= t + Math.imul(t ^ t >>> 7, 61 | t);
|
|
73233
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
73234
|
+
};
|
|
73235
|
+
};
|
|
73236
|
+
// ── WalkIndicator ───────────────────────────────────────────────────────────
|
|
73000
73237
|
class WalkIndicator {
|
|
73001
73238
|
app;
|
|
73002
73239
|
target = null;
|
|
73003
73240
|
startTime = 0;
|
|
73241
|
+
visible = false;
|
|
73004
73242
|
origGlsl;
|
|
73005
73243
|
origWgsl;
|
|
73244
|
+
particleEntity;
|
|
73006
73245
|
constructor(app) {
|
|
73007
73246
|
this.app = app;
|
|
73008
73247
|
const device = app.graphicsDevice;
|
|
@@ -73012,6 +73251,72 @@ class WalkIndicator {
|
|
|
73012
73251
|
this.origWgsl = wgsl.get('gsplatPS');
|
|
73013
73252
|
glsl.set('gsplatPS', gsplatPSGlsl);
|
|
73014
73253
|
wgsl.set('gsplatPS', gsplatPSWgsl);
|
|
73254
|
+
this.particleEntity = this.createParticleEntity();
|
|
73255
|
+
app.on('framerender', () => {
|
|
73256
|
+
if (this.target && this.visible) {
|
|
73257
|
+
app.renderNextFrame = true;
|
|
73258
|
+
}
|
|
73259
|
+
});
|
|
73260
|
+
}
|
|
73261
|
+
createParticleEntity() {
|
|
73262
|
+
const device = this.app.graphicsDevice;
|
|
73263
|
+
const rng = mulberry32(42);
|
|
73264
|
+
const totalVerts = PARTICLE_COUNT * 4;
|
|
73265
|
+
const totalIndices = PARTICLE_COUNT * 6;
|
|
73266
|
+
const particleData = new Float32Array(totalVerts * 3);
|
|
73267
|
+
const corners = new Float32Array(totalVerts * 2);
|
|
73268
|
+
const indices = new Uint16Array(totalIndices);
|
|
73269
|
+
for (let i = 0; i < PARTICLE_COUNT; i++) {
|
|
73270
|
+
const rand0 = i / PARTICLE_COUNT;
|
|
73271
|
+
const rand1 = rng();
|
|
73272
|
+
const rand2 = rng();
|
|
73273
|
+
const base = i * 4;
|
|
73274
|
+
for (let j = 0; j < 4; j++) {
|
|
73275
|
+
const vi = base + j;
|
|
73276
|
+
particleData[vi * 3] = rand0;
|
|
73277
|
+
particleData[vi * 3 + 1] = rand1;
|
|
73278
|
+
particleData[vi * 3 + 2] = rand2;
|
|
73279
|
+
corners[vi * 2] = QUAD_CORNERS[j * 2];
|
|
73280
|
+
corners[vi * 2 + 1] = QUAD_CORNERS[j * 2 + 1];
|
|
73281
|
+
}
|
|
73282
|
+
const ii = i * 6;
|
|
73283
|
+
indices[ii] = base;
|
|
73284
|
+
indices[ii + 1] = base + 1;
|
|
73285
|
+
indices[ii + 2] = base + 2;
|
|
73286
|
+
indices[ii + 3] = base;
|
|
73287
|
+
indices[ii + 4] = base + 2;
|
|
73288
|
+
indices[ii + 5] = base + 3;
|
|
73289
|
+
}
|
|
73290
|
+
const mesh = new Mesh(device);
|
|
73291
|
+
mesh.setPositions(particleData, 3);
|
|
73292
|
+
mesh.setVertexStream(SEMANTIC_TEXCOORD1, corners, 2);
|
|
73293
|
+
mesh.setIndices(indices);
|
|
73294
|
+
mesh.update(PRIMITIVE_TRIANGLES);
|
|
73295
|
+
const material = new ShaderMaterial({
|
|
73296
|
+
uniqueName: 'walkParticleMaterial',
|
|
73297
|
+
vertexGLSL: particleVS,
|
|
73298
|
+
fragmentGLSL: particleFS,
|
|
73299
|
+
vertexWGSL: particleVS_WGSL,
|
|
73300
|
+
fragmentWGSL: particleFS_WGSL,
|
|
73301
|
+
attributes: {
|
|
73302
|
+
vertex_position: SEMANTIC_POSITION,
|
|
73303
|
+
aQuadCorner: SEMANTIC_TEXCOORD1
|
|
73304
|
+
}
|
|
73305
|
+
});
|
|
73306
|
+
material.blendType = BLEND_NONE;
|
|
73307
|
+
material.depthWrite = true;
|
|
73308
|
+
material.depthTest = true;
|
|
73309
|
+
material.cull = CULLFACE_NONE;
|
|
73310
|
+
material.update();
|
|
73311
|
+
const mi = new MeshInstance(mesh, material);
|
|
73312
|
+
mi.cull = false;
|
|
73313
|
+
const entity = new Entity('walkParticles');
|
|
73314
|
+
entity.addComponent('render', {
|
|
73315
|
+
meshInstances: [mi]
|
|
73316
|
+
});
|
|
73317
|
+
entity.enabled = false;
|
|
73318
|
+
this.app.root.addChild(entity);
|
|
73319
|
+
return entity;
|
|
73015
73320
|
}
|
|
73016
73321
|
/**
|
|
73017
73322
|
* Set or clear the walk target position.
|
|
@@ -73020,9 +73325,12 @@ class WalkIndicator {
|
|
|
73020
73325
|
*/
|
|
73021
73326
|
setTarget(pos) {
|
|
73022
73327
|
this.target = pos ? pos.clone() : null;
|
|
73328
|
+
this.visible = !!pos;
|
|
73023
73329
|
if (pos) {
|
|
73024
73330
|
this.startTime = performance.now() / 1000;
|
|
73025
73331
|
}
|
|
73332
|
+
this.particleEntity.enabled = this.visible;
|
|
73333
|
+
this.app.renderNextFrame = true;
|
|
73026
73334
|
}
|
|
73027
73335
|
/**
|
|
73028
73336
|
* Update uniforms for the walk highlight effect. Call from a prerender hook.
|
|
@@ -73037,14 +73345,23 @@ class WalkIndicator {
|
|
|
73037
73345
|
invViewMat.copy(viewMat).invert();
|
|
73038
73346
|
scope.resolve('walk_viewInverse').setValue(invViewMat.data);
|
|
73039
73347
|
if (this.target) {
|
|
73348
|
+
const camPos = camera.getPosition();
|
|
73349
|
+
const dist = camPos.distance(this.target);
|
|
73350
|
+
this.visible = dist > 2.0;
|
|
73351
|
+
this.particleEntity.enabled = this.visible;
|
|
73040
73352
|
const elapsed = performance.now() / 1000 - this.startTime;
|
|
73041
|
-
|
|
73042
|
-
|
|
73353
|
+
targetVec[0] = this.target.x;
|
|
73354
|
+
targetVec[1] = this.target.y;
|
|
73355
|
+
targetVec[2] = this.target.z;
|
|
73356
|
+
scope.resolve('walk_target').setValue(targetVec);
|
|
73357
|
+
scope.resolve('walk_radius').setValue(this.visible ? 1.5 : 0);
|
|
73043
73358
|
scope.resolve('walk_time').setValue(elapsed);
|
|
73044
|
-
this.app.renderNextFrame = true;
|
|
73045
73359
|
}
|
|
73046
73360
|
else {
|
|
73047
|
-
|
|
73361
|
+
targetVec[0] = 0;
|
|
73362
|
+
targetVec[1] = 0;
|
|
73363
|
+
targetVec[2] = 0;
|
|
73364
|
+
scope.resolve('walk_target').setValue(targetVec);
|
|
73048
73365
|
scope.resolve('walk_radius').setValue(0);
|
|
73049
73366
|
scope.resolve('walk_time').setValue(0);
|
|
73050
73367
|
}
|
|
@@ -73053,6 +73370,7 @@ class WalkIndicator {
|
|
|
73053
73370
|
const device = this.app.graphicsDevice;
|
|
73054
73371
|
ShaderChunks.get(device, 'glsl').set('gsplatPS', this.origGlsl);
|
|
73055
73372
|
ShaderChunks.get(device, 'wgsl').set('gsplatPS', this.origWgsl);
|
|
73373
|
+
this.particleEntity.destroy();
|
|
73056
73374
|
}
|
|
73057
73375
|
}
|
|
73058
73376
|
|
|
@@ -73338,10 +73656,10 @@ class Viewer {
|
|
|
73338
73656
|
state.readyToRender = true;
|
|
73339
73657
|
// handle quality mode changes
|
|
73340
73658
|
const updateLod = () => {
|
|
73341
|
-
const settings = state.
|
|
73659
|
+
const settings = state.retinaDisplay ? quality.high : quality.low;
|
|
73342
73660
|
results[0].gsplat.splatBudget = settings * 1000000;
|
|
73343
73661
|
};
|
|
73344
|
-
events.on('
|
|
73662
|
+
events.on('retinaDisplay:changed', updateLod);
|
|
73345
73663
|
updateLod();
|
|
73346
73664
|
// debug colorize lods
|
|
73347
73665
|
gsplat.colorizeLod = config.colorize;
|
|
@@ -75008,7 +75326,7 @@ const initXr = (global) => {
|
|
|
75008
75326
|
});
|
|
75009
75327
|
};
|
|
75010
75328
|
|
|
75011
|
-
var version = "1.16.
|
|
75329
|
+
var version = "1.16.7";
|
|
75012
75330
|
|
|
75013
75331
|
const loadGsplat = async (app, config, progressCallback) => {
|
|
75014
75332
|
const { contents, contentUrl, unified, aa } = config;
|
|
@@ -75122,7 +75440,7 @@ const initCanvas = (global) => {
|
|
|
75122
75440
|
// and resetting canvas dimensions can invalidate the XRWebGLLayer
|
|
75123
75441
|
if (app.xr?.active)
|
|
75124
75442
|
return;
|
|
75125
|
-
const s = state.
|
|
75443
|
+
const s = state.retinaDisplay ? 1.0 : 0.5;
|
|
75126
75444
|
const w = Math.ceil(deviceSize.width * s);
|
|
75127
75445
|
const h = Math.ceil(deviceSize.height * s);
|
|
75128
75446
|
if (w !== canvas.width || h !== canvas.height) {
|
|
@@ -75138,7 +75456,7 @@ const initCanvas = (global) => {
|
|
|
75138
75456
|
}
|
|
75139
75457
|
});
|
|
75140
75458
|
resizeObserver.observe(canvas);
|
|
75141
|
-
events.on('
|
|
75459
|
+
events.on('retinaDisplay:changed', () => {
|
|
75142
75460
|
app.renderNextFrame = true;
|
|
75143
75461
|
});
|
|
75144
75462
|
// Resize canvas before render() so the swap chain texture is acquired at the correct size.
|
|
@@ -75156,7 +75474,7 @@ const main = async (canvas, settingsJson, config) => {
|
|
|
75156
75474
|
const state = observe(events, {
|
|
75157
75475
|
loaded: false,
|
|
75158
75476
|
readyToRender: false,
|
|
75159
|
-
|
|
75477
|
+
retinaDisplay: platform.mobile ? localStorage.getItem('retinaDisplay') === 'true' : localStorage.getItem('retinaDisplay') !== 'false',
|
|
75160
75478
|
progress: 0,
|
|
75161
75479
|
inputMode: platform.mobile ? 'touch' : 'desktop',
|
|
75162
75480
|
cameraMode: 'orbit',
|
|
@@ -75171,7 +75489,7 @@ const main = async (canvas, settingsJson, config) => {
|
|
|
75171
75489
|
voxelOverlayEnabled: false,
|
|
75172
75490
|
isFullscreen: false,
|
|
75173
75491
|
controlsHidden: false,
|
|
75174
|
-
|
|
75492
|
+
gamingControls: localStorage.getItem('gamingControls') === 'true'
|
|
75175
75493
|
});
|
|
75176
75494
|
const global = {
|
|
75177
75495
|
app,
|