spoint 0.1.37 → 0.1.39

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 +11 -1
  2. package/package.json +1 -1
package/client/app.js CHANGED
@@ -616,6 +616,9 @@ sun.shadow.camera.near = 0.5; sun.shadow.camera.far = 200
616
616
  scene.add(sun)
617
617
  scene.add(sun.target)
618
618
 
619
+ const _warmupPointLight = new THREE.PointLight(0xffffff, 0, 1)
620
+ scene.add(_warmupPointLight)
621
+
619
622
  function fitShadowFrustum() {
620
623
  const box = new THREE.Box3()
621
624
  scene.traverse(o => { if (o.isMesh && (o.castShadow || o.receiveShadow) && o.geometry) box.expandByObject(o) })
@@ -1093,6 +1096,13 @@ async function warmupShaders() {
1093
1096
  renderer.compile(scene, camera)
1094
1097
  console.log('[shader] warmup compile done (fallback)')
1095
1098
  }
1099
+ const culled = []
1100
+ scene.traverse(obj => { if (obj.frustumCulled) { culled.push(obj); obj.frustumCulled = false } })
1101
+ renderer.render(scene, camera)
1102
+ await new Promise(r => requestAnimationFrame(r))
1103
+ renderer.render(scene, camera)
1104
+ for (const obj of culled) obj.frustumCulled = true
1105
+ console.log('[shader] GPU upload render done, culled restored:', culled.length)
1096
1106
  }
1097
1107
 
1098
1108
  function checkAllLoaded() {
@@ -1102,8 +1112,8 @@ function checkAllLoaded() {
1102
1112
  if (!firstSnapshotReceived) return
1103
1113
  loadingMgr.setStage('INIT')
1104
1114
  loadingMgr.complete()
1105
- loadingScreen.hide().then(() => warmupShaders()).catch(() => warmupShaders())
1106
1115
  loadingScreenHidden = true
1116
+ warmupShaders().then(() => loadingScreen.hide()).catch(() => loadingScreen.hide())
1107
1117
  }
1108
1118
 
1109
1119
  function initInputHandler() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spoint",
3
- "version": "0.1.37",
3
+ "version": "0.1.39",
4
4
  "description": "Physics and netcode SDK for multiplayer game servers",
5
5
  "type": "module",
6
6
  "main": "src/index.js",