spoint 0.1.30 → 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 +25 -1
  2. package/package.json +1 -1
package/client/app.js CHANGED
@@ -750,6 +750,13 @@ async function createPlayerVRM(id) {
750
750
  if (head) cam.setHeadBone(head)
751
751
  if (cam.getMode() === 'fps' && head) head.scale.set(0, 0, 0)
752
752
  }
753
+ if (!_vrmWarmupDone) {
754
+ _vrmWarmupDone = true
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
+ })
759
+ }
753
760
  } catch (e) { console.error('[vrm]', id, e.message) }
754
761
  return group
755
762
  }
@@ -1066,6 +1073,23 @@ let firstSnapshotReceived = false
1066
1073
  let lastShootState = false
1067
1074
  let lastHealth = 100
1068
1075
 
1076
+ let _shaderWarmupDone = false
1077
+ let _vrmWarmupDone = false
1078
+
1079
+ async function warmupShaders() {
1080
+ if (_shaderWarmupDone) return
1081
+ _shaderWarmupDone = true
1082
+ const ext = renderer.extensions.get('KHR_parallel_shader_compile')
1083
+ if (ext) console.log('[shader] KHR_parallel_shader_compile active')
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
+ }
1091
+ }
1092
+
1069
1093
  function checkAllLoaded() {
1070
1094
  if (loadingScreenHidden) return
1071
1095
  if (!assetsLoaded) return
@@ -1073,7 +1097,7 @@ function checkAllLoaded() {
1073
1097
  if (!firstSnapshotReceived) return
1074
1098
  loadingMgr.setStage('INIT')
1075
1099
  loadingMgr.complete()
1076
- loadingScreen.hide().catch(() => {})
1100
+ loadingScreen.hide().then(() => warmupShaders()).catch(() => warmupShaders())
1077
1101
  loadingScreenHidden = true
1078
1102
  }
1079
1103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spoint",
3
- "version": "0.1.30",
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",