@playcanvas/supersplat-viewer 1.16.6 → 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/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.touchControlScheme === 'joystick') {
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('touchControlScheme:changed', updateJoystickVisibility);
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
- 'hqCheck', 'hqOption', 'lqCheck', 'lqOption',
69652
- 'touchControlsDivider', 'joystickSchemeRow', 'pinchSchemeRow',
69653
- 'joystickSchemeCheck', 'joystickSchemeOption', 'pinchSchemeCheck', 'pinchSchemeOption',
69654
- 'touchFlyJoystick', 'touchFlyPinch',
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
- // HQ mode (click anywhere in the row, not just the label)
69744
- dom.hqOption.parentElement.addEventListener('click', () => {
69745
- state.hqMode = true;
69745
+ // Retina display toggle
69746
+ dom.retinaDisplayRow.addEventListener('click', () => {
69747
+ state.retinaDisplay = !state.retinaDisplay;
69746
69748
  });
69747
- dom.lqOption.parentElement.addEventListener('click', () => {
69748
- state.hqMode = false;
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('hqMode:changed', () => {
69755
- updateHQ();
69756
- localStorage.setItem('hqMode', String(state.hqMode));
69757
- });
69758
- updateHQ();
69759
- // Touch control scheme toggle (only visible on touch devices)
69760
- dom.joystickSchemeRow.addEventListener('click', () => {
69761
- state.touchControlScheme = 'joystick';
69753
+ events.on('retinaDisplay:changed', updateRetinaDisplay);
69754
+ updateRetinaDisplay();
69755
+ // Gaming mode toggle
69756
+ dom.gamingControlsRow.addEventListener('click', () => {
69757
+ state.gamingControls = !state.gamingControls;
69762
69758
  });
69763
- dom.pinchSchemeRow.addEventListener('click', () => {
69764
- state.touchControlScheme = 'pinch';
69765
- });
69766
- const updateTouchControlScheme = () => {
69767
- const isJoystick = state.touchControlScheme === 'joystick';
69768
- dom.joystickSchemeCheck.classList.toggle('active', isJoystick);
69769
- dom.pinchSchemeCheck.classList.toggle('active', !isJoystick);
69770
- dom.touchFlyJoystick.classList.toggle('hidden', !isJoystick);
69771
- dom.touchFlyPinch.classList.toggle('hidden', isJoystick);
69772
- localStorage.setItem('touchControlScheme', state.touchControlScheme);
69773
- };
69774
- const updateTouchControlsVisibility = () => {
69775
- const isTouch = state.inputMode === 'touch';
69776
- dom.touchControlsDivider.classList.toggle('hidden', !isTouch);
69777
- dom.joystickSchemeRow.classList.toggle('hidden', !isTouch);
69778
- dom.pinchSchemeRow.classList.toggle('hidden', !isTouch);
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));
69779
69768
  };
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 touch start (for tap-to-walk picking)
71801
- _lastTouchOffsetX = 0;
71802
- _lastTouchOffsetY = 0;
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 touch coordinates for tap-to-walk picking
71837
- this._lastTouchOffsetX = event.offsetX;
71838
- this._lastTouchOffsetY = event.offsetY;
71839
- // Cancel any active auto-walk on new touch input
71840
- if (state.cameraMode === 'fps' && event.pointerType === 'touch') {
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
- // Pointer lock management for FPS mode on desktop
71932
- events.on('cameraMode:changed', (value, prev) => {
71933
- if (value === 'fps' && state.inputMode === 'desktop') {
71934
- this._desktopInput._pointerLock = true;
71935
- canvas.requestPointerLock();
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
- lockEscape();
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
- unlockKeyboard();
71942
- this._desktopInput._pointerLock = false;
71943
- if (document.pointerLockElement === canvas) {
71944
- if (state.isFullscreen) {
71945
- events.fire('restoreFullscreen');
71946
- }
71947
- document.exitPointerLock();
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.touchControlScheme === 'pinch') {
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._lastTouchOffsetX / canvas.clientWidth;
72023
- const pickY = this._lastTouchOffsetY / canvas.clientHeight;
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 using pinch control scheme
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.touchControlScheme === 'pinch' && this._state.touches > 1) {
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.touchControlScheme === 'joystick') {
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
@@ -73023,101 +73100,6 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
73023
73100
 
73024
73101
  return output;
73025
73102
  }`;
73026
- // ── Core billboard shaders ──────────────────────────────────────────────────
73027
- const coreVS = /* glsl */ `
73028
- attribute vec3 vertex_position;
73029
-
73030
- uniform mat4 matrix_viewProjection;
73031
- uniform mat4 walk_viewInverse;
73032
- uniform vec3 walk_target;
73033
- uniform vec4 viewport_size;
73034
-
73035
- varying vec2 vUV;
73036
-
73037
- void main() {
73038
- vec3 camRight = normalize(vec3(walk_viewInverse[0][0], 0.0, walk_viewInverse[0][2]));
73039
- vec3 up = vec3(0.0, 1.0, 0.0);
73040
-
73041
- float halfWidth = 0.0075;
73042
- float halfHeight = 10000.0;
73043
-
73044
- vec3 centerWorld = walk_target + up * vertex_position.y * halfHeight;
73045
-
73046
- vec4 targetClip = matrix_viewProjection * vec4(walk_target, 1.0);
73047
- float minPixelHalf = 1.0 / viewport_size.x * targetClip.w;
73048
- float effectiveHalfWidth = max(halfWidth, minPixelHalf);
73049
-
73050
- vec3 worldPos = centerWorld + camRight * vertex_position.x * effectiveHalfWidth;
73051
-
73052
- gl_Position = matrix_viewProjection * vec4(worldPos, 1.0);
73053
- vUV = vertex_position.xy;
73054
- }
73055
- `;
73056
- const coreVS_WGSL = /* wgsl */ `
73057
- attribute vertex_position: vec3f;
73058
- uniform matrix_viewProjection: mat4x4f;
73059
- uniform walk_viewInverse: mat4x4f;
73060
- uniform walk_target: vec3f;
73061
- uniform viewport_size: vec4f;
73062
- varying vUV: vec2f;
73063
-
73064
- @vertex fn vertexMain(input: VertexInput) -> VertexOutput {
73065
- var output: VertexOutput;
73066
-
73067
- let camRight = normalize(vec3f(uniform.walk_viewInverse[0][0], 0.0, uniform.walk_viewInverse[0][2]));
73068
- let up = vec3f(0.0, 1.0, 0.0);
73069
-
73070
- let halfWidth = 0.0075;
73071
- let halfHeight = 10000.0;
73072
-
73073
- let centerWorld = uniform.walk_target + up * input.vertex_position.y * halfHeight;
73074
-
73075
- let targetClip = uniform.matrix_viewProjection * vec4f(uniform.walk_target, 1.0);
73076
- let minPixelHalf = 1.0 / uniform.viewport_size.x * targetClip.w;
73077
- let effectiveHalfWidth = max(halfWidth, minPixelHalf);
73078
-
73079
- let worldPos = centerWorld + camRight * input.vertex_position.x * effectiveHalfWidth;
73080
-
73081
- output.position = uniform.matrix_viewProjection * vec4f(worldPos, 1.0);
73082
- output.vUV = input.vertex_position.xy;
73083
- return output;
73084
- }
73085
- `;
73086
- const coreFS = /* glsl */ `
73087
- precision highp float;
73088
-
73089
- uniform float walk_time;
73090
-
73091
- varying vec2 vUV;
73092
-
73093
- void main() {
73094
- if (abs(vUV.y) > 0.95) discard;
73095
-
73096
- float pulse = 1.0 + 0.08 * sin(walk_time * 3.0);
73097
- vec3 color = vec3(2.55, 2.76, 3.0) * pulse;
73098
-
73099
- gl_FragColor = vec4(color, 1.0);
73100
- }
73101
- `;
73102
- const coreFS_WGSL = /* wgsl */ `
73103
- uniform walk_time: f32;
73104
- varying vUV: vec2f;
73105
-
73106
- @fragment fn fragmentMain(input: FragmentInput) -> FragmentOutput {
73107
- var output: FragmentOutput;
73108
-
73109
- if (abs(input.vUV.y) > 0.95) {
73110
- discard;
73111
- return output;
73112
- }
73113
-
73114
- let pulse = 1.0 + 0.08 * sin(uniform.walk_time * 3.0);
73115
- let color = vec3f(2.55, 2.76, 3.0) * pulse;
73116
-
73117
- output.color = vec4f(color, 1.0);
73118
- return output;
73119
- }
73120
- `;
73121
73103
  // ── Particle shaders ────────────────────────────────────────────────────────
73122
73104
  const particleVS = /* glsl */ `
73123
73105
  attribute vec3 vertex_position;
@@ -73259,7 +73241,6 @@ class WalkIndicator {
73259
73241
  visible = false;
73260
73242
  origGlsl;
73261
73243
  origWgsl;
73262
- coreEntity;
73263
73244
  particleEntity;
73264
73245
  constructor(app) {
73265
73246
  this.app = app;
@@ -73270,7 +73251,6 @@ class WalkIndicator {
73270
73251
  this.origWgsl = wgsl.get('gsplatPS');
73271
73252
  glsl.set('gsplatPS', gsplatPSGlsl);
73272
73253
  wgsl.set('gsplatPS', gsplatPSWgsl);
73273
- this.coreEntity = this.createCoreEntity();
73274
73254
  this.particleEntity = this.createParticleEntity();
73275
73255
  app.on('framerender', () => {
73276
73256
  if (this.target && this.visible) {
@@ -73278,37 +73258,6 @@ class WalkIndicator {
73278
73258
  }
73279
73259
  });
73280
73260
  }
73281
- createCoreEntity() {
73282
- const device = this.app.graphicsDevice;
73283
- const mesh = new Mesh(device);
73284
- mesh.setPositions([-1, -1, 0, 1, -1, 0, 1, 1, 0, -1, 1, 0], 3);
73285
- mesh.setIndices([0, 1, 2, 0, 2, 3]);
73286
- mesh.update(PRIMITIVE_TRIANGLES);
73287
- const material = new ShaderMaterial({
73288
- uniqueName: 'walkCoreMaterial',
73289
- vertexGLSL: coreVS,
73290
- fragmentGLSL: coreFS,
73291
- vertexWGSL: coreVS_WGSL,
73292
- fragmentWGSL: coreFS_WGSL,
73293
- attributes: {
73294
- vertex_position: SEMANTIC_POSITION
73295
- }
73296
- });
73297
- material.blendType = BLEND_NONE;
73298
- material.depthWrite = true;
73299
- material.depthTest = true;
73300
- material.cull = CULLFACE_NONE;
73301
- material.update();
73302
- const mi = new MeshInstance(mesh, material);
73303
- mi.cull = false;
73304
- const entity = new Entity('walkCore');
73305
- entity.addComponent('render', {
73306
- meshInstances: [mi]
73307
- });
73308
- entity.enabled = false;
73309
- this.app.root.addChild(entity);
73310
- return entity;
73311
- }
73312
73261
  createParticleEntity() {
73313
73262
  const device = this.app.graphicsDevice;
73314
73263
  const rng = mulberry32(42);
@@ -73380,7 +73329,6 @@ class WalkIndicator {
73380
73329
  if (pos) {
73381
73330
  this.startTime = performance.now() / 1000;
73382
73331
  }
73383
- this.coreEntity.enabled = this.visible;
73384
73332
  this.particleEntity.enabled = this.visible;
73385
73333
  this.app.renderNextFrame = true;
73386
73334
  }
@@ -73400,7 +73348,6 @@ class WalkIndicator {
73400
73348
  const camPos = camera.getPosition();
73401
73349
  const dist = camPos.distance(this.target);
73402
73350
  this.visible = dist > 2.0;
73403
- this.coreEntity.enabled = this.visible;
73404
73351
  this.particleEntity.enabled = this.visible;
73405
73352
  const elapsed = performance.now() / 1000 - this.startTime;
73406
73353
  targetVec[0] = this.target.x;
@@ -73423,7 +73370,6 @@ class WalkIndicator {
73423
73370
  const device = this.app.graphicsDevice;
73424
73371
  ShaderChunks.get(device, 'glsl').set('gsplatPS', this.origGlsl);
73425
73372
  ShaderChunks.get(device, 'wgsl').set('gsplatPS', this.origWgsl);
73426
- this.coreEntity.destroy();
73427
73373
  this.particleEntity.destroy();
73428
73374
  }
73429
73375
  }
@@ -73710,10 +73656,10 @@ class Viewer {
73710
73656
  state.readyToRender = true;
73711
73657
  // handle quality mode changes
73712
73658
  const updateLod = () => {
73713
- const settings = state.hqMode ? quality.high : quality.low;
73659
+ const settings = state.retinaDisplay ? quality.high : quality.low;
73714
73660
  results[0].gsplat.splatBudget = settings * 1000000;
73715
73661
  };
73716
- events.on('hqMode:changed', updateLod);
73662
+ events.on('retinaDisplay:changed', updateLod);
73717
73663
  updateLod();
73718
73664
  // debug colorize lods
73719
73665
  gsplat.colorizeLod = config.colorize;
@@ -75380,7 +75326,7 @@ const initXr = (global) => {
75380
75326
  });
75381
75327
  };
75382
75328
 
75383
- var version = "1.16.6";
75329
+ var version = "1.16.7";
75384
75330
 
75385
75331
  const loadGsplat = async (app, config, progressCallback) => {
75386
75332
  const { contents, contentUrl, unified, aa } = config;
@@ -75494,7 +75440,7 @@ const initCanvas = (global) => {
75494
75440
  // and resetting canvas dimensions can invalidate the XRWebGLLayer
75495
75441
  if (app.xr?.active)
75496
75442
  return;
75497
- const s = state.hqMode ? 1.0 : 0.5;
75443
+ const s = state.retinaDisplay ? 1.0 : 0.5;
75498
75444
  const w = Math.ceil(deviceSize.width * s);
75499
75445
  const h = Math.ceil(deviceSize.height * s);
75500
75446
  if (w !== canvas.width || h !== canvas.height) {
@@ -75510,7 +75456,7 @@ const initCanvas = (global) => {
75510
75456
  }
75511
75457
  });
75512
75458
  resizeObserver.observe(canvas);
75513
- events.on('hqMode:changed', () => {
75459
+ events.on('retinaDisplay:changed', () => {
75514
75460
  app.renderNextFrame = true;
75515
75461
  });
75516
75462
  // Resize canvas before render() so the swap chain texture is acquired at the correct size.
@@ -75528,7 +75474,7 @@ const main = async (canvas, settingsJson, config) => {
75528
75474
  const state = observe(events, {
75529
75475
  loaded: false,
75530
75476
  readyToRender: false,
75531
- hqMode: localStorage.getItem('hqMode') !== 'false',
75477
+ retinaDisplay: platform.mobile ? localStorage.getItem('retinaDisplay') === 'true' : localStorage.getItem('retinaDisplay') !== 'false',
75532
75478
  progress: 0,
75533
75479
  inputMode: platform.mobile ? 'touch' : 'desktop',
75534
75480
  cameraMode: 'orbit',
@@ -75543,7 +75489,7 @@ const main = async (canvas, settingsJson, config) => {
75543
75489
  voxelOverlayEnabled: false,
75544
75490
  isFullscreen: false,
75545
75491
  controlsHidden: false,
75546
- touchControlScheme: localStorage.getItem('touchControlScheme') || 'joystick'
75492
+ gamingControls: localStorage.getItem('gamingControls') === 'true'
75547
75493
  });
75548
75494
  const global = {
75549
75495
  app,