spoint 0.1.31 → 0.1.32

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.
Files changed (2) hide show
  1. package/client/app.js +13 -5
  2. package/package.json +1 -1
package/client/app.js CHANGED
@@ -752,7 +752,10 @@ async function createPlayerVRM(id) {
752
752
  }
753
753
  if (!_vrmWarmupDone) {
754
754
  _vrmWarmupDone = true
755
- requestAnimationFrame(() => { renderer.compile(scene, camera); console.log('[shader] vrm warmup compile done') })
755
+ renderer.compileAsync(scene, camera).then(() => console.log('[shader] vrm warmup compileAsync done')).catch(() => {
756
+ renderer.compile(scene, camera)
757
+ console.log('[shader] vrm warmup compile done (fallback)')
758
+ })
756
759
  }
757
760
  } catch (e) { console.error('[vrm]', id, e.message) }
758
761
  return group
@@ -1073,13 +1076,18 @@ let lastHealth = 100
1073
1076
  let _shaderWarmupDone = false
1074
1077
  let _vrmWarmupDone = false
1075
1078
 
1076
- function warmupShaders() {
1079
+ async function warmupShaders() {
1077
1080
  if (_shaderWarmupDone) return
1078
1081
  _shaderWarmupDone = true
1079
1082
  const ext = renderer.extensions.get('KHR_parallel_shader_compile')
1080
1083
  if (ext) console.log('[shader] KHR_parallel_shader_compile active')
1081
- renderer.compile(scene, camera)
1082
- console.log('[shader] warmup compile done')
1084
+ try {
1085
+ await renderer.compileAsync(scene, camera)
1086
+ console.log('[shader] warmup compileAsync done')
1087
+ } catch {
1088
+ renderer.compile(scene, camera)
1089
+ console.log('[shader] warmup compile done (fallback)')
1090
+ }
1083
1091
  }
1084
1092
 
1085
1093
  function checkAllLoaded() {
@@ -1089,7 +1097,7 @@ function checkAllLoaded() {
1089
1097
  if (!firstSnapshotReceived) return
1090
1098
  loadingMgr.setStage('INIT')
1091
1099
  loadingMgr.complete()
1092
- loadingScreen.hide().then(() => requestAnimationFrame(warmupShaders)).catch(() => requestAnimationFrame(warmupShaders))
1100
+ loadingScreen.hide().then(() => warmupShaders()).catch(() => warmupShaders())
1093
1101
  loadingScreenHidden = true
1094
1102
  }
1095
1103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spoint",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "Physics and netcode SDK for multiplayer game servers",
5
5
  "type": "module",
6
6
  "main": "src/index.js",