spoint 0.1.75 → 0.1.77
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/apps/environment/index.js +8 -1
- package/apps/tps-game/cleetus.glb +0 -0
- package/apps/tps-game/schwust-uncompressed.glb +0 -0
- package/apps/tps-game/schwust.glb +0 -0
- package/apps/world/index.js +2 -2
- package/client/anim-lib.glb +0 -0
- package/package.json +9 -2
- package/src/physics/GLBLoader.js +4 -3
- package/apps/tps-game/cleetus.vrm +0 -0
|
@@ -25,7 +25,14 @@ export default {
|
|
|
25
25
|
server: {
|
|
26
26
|
setup(ctx) {
|
|
27
27
|
ctx.physics.setStatic(true)
|
|
28
|
-
|
|
28
|
+
// schwust.glb decompressed - use real geometry-based collider
|
|
29
|
+
try {
|
|
30
|
+
ctx.physics.addTrimeshCollider()
|
|
31
|
+
} catch (e) {
|
|
32
|
+
// Fallback if convex hull extraction fails
|
|
33
|
+
console.log(`[Environment] Convex extraction failed: ${e.message}`); console.log(e.stack)
|
|
34
|
+
ctx.physics.addBoxCollider([50, 0.5, 50])
|
|
35
|
+
}
|
|
29
36
|
|
|
30
37
|
ctx.state.smartObjects = new Map()
|
|
31
38
|
ctx.state.editorMode = false
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/apps/world/index.js
CHANGED
|
@@ -58,13 +58,13 @@ export default {
|
|
|
58
58
|
fadeTime: 0.15
|
|
59
59
|
},
|
|
60
60
|
entities: [
|
|
61
|
-
{ id: 'environment', model: './apps/tps-game/schwust.glb', position: [0, -10, 0], app: 'environment' },
|
|
61
|
+
{ id: 'environment', model: './apps/tps-game/schwust-uncompressed.glb', position: [0, -10, 0], app: 'environment' },
|
|
62
62
|
{ id: 'game', position: [0, 0, 0], app: 'tps-game' },
|
|
63
63
|
{ id: 'power-crates', position: [0, 0, 0], app: 'power-crate' },
|
|
64
64
|
{ id: 'interact-box', position: [-100, 3, -100], app: 'interactable' }
|
|
65
65
|
// To use the primitive arena instead of schwust.glb, replace above with:
|
|
66
66
|
// { id: 'arena', position: [0, 0, 0], app: 'arena' }
|
|
67
67
|
],
|
|
68
|
-
playerModel: './apps/tps-game/cleetus.
|
|
68
|
+
playerModel: './apps/tps-game/cleetus.vrm',
|
|
69
69
|
spawnPoint: [-35, 3, -65]
|
|
70
70
|
}
|
package/client/anim-lib.glb
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spoint",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.77",
|
|
4
4
|
"description": "Physics and netcode SDK for multiplayer game servers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -41,8 +41,12 @@
|
|
|
41
41
|
"node": ">=18.0.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
+
"@gltf-transform/extensions": "^4.3.0",
|
|
44
45
|
"d3-octree": "^1.1.0",
|
|
46
|
+
"draco3d": "^1.5.7",
|
|
47
|
+
"draco3dgltf": "^1.5.7",
|
|
45
48
|
"jolt-physics": "^0.29.0",
|
|
49
|
+
"meshoptimizer": "^1.0.1",
|
|
46
50
|
"webjsx": "^0.0.73",
|
|
47
51
|
"ws": "^8.18.0"
|
|
48
52
|
},
|
|
@@ -51,6 +55,9 @@
|
|
|
51
55
|
"@fails-components/webtransport-transport-http3-quiche": "^1.5.3"
|
|
52
56
|
},
|
|
53
57
|
"devDependencies": {
|
|
54
|
-
"
|
|
58
|
+
"@gltf-transform/cli": "^4.3.0",
|
|
59
|
+
"@gltf-transform/core": "^4.3.0",
|
|
60
|
+
"playwright": "^1.58.1",
|
|
61
|
+
"three": "^0.183.1"
|
|
55
62
|
}
|
|
56
63
|
}
|
package/src/physics/GLBLoader.js
CHANGED
|
@@ -12,6 +12,7 @@ import { readFileSync } from 'node:fs'
|
|
|
12
12
|
* @throws {Error} If mesh is Draco-compressed or invalid
|
|
13
13
|
*/
|
|
14
14
|
export function extractMeshFromGLB(filepath, meshIndex = 0) {
|
|
15
|
+
console.log(`[GLBLoader] Extracting from: ${filepath}`)
|
|
15
16
|
const buf = readFileSync(filepath)
|
|
16
17
|
if (buf.toString('ascii', 0, 4) !== 'glTF') throw new Error('Not a GLB file')
|
|
17
18
|
|
|
@@ -40,7 +41,7 @@ export function extractMeshFromGLB(filepath, meshIndex = 0) {
|
|
|
40
41
|
const posAcc = json.accessors[prim.attributes.POSITION]
|
|
41
42
|
const posView = json.bufferViews[posAcc.bufferView]
|
|
42
43
|
const posOff = binOffset + (posView.byteOffset || 0) + (posAcc.byteOffset || 0)
|
|
43
|
-
const vertices = new Float32Array(buf.buffer.slice(
|
|
44
|
+
const vertices = new Float32Array(buf.buffer.slice(posOff, posOff + posAcc.count * 12))
|
|
44
45
|
|
|
45
46
|
let indices = null
|
|
46
47
|
if (prim.indices !== undefined) {
|
|
@@ -48,10 +49,10 @@ export function extractMeshFromGLB(filepath, meshIndex = 0) {
|
|
|
48
49
|
const idxView = json.bufferViews[idxAcc.bufferView]
|
|
49
50
|
const idxOff = binOffset + (idxView.byteOffset || 0) + (idxAcc.byteOffset || 0)
|
|
50
51
|
if (idxAcc.componentType === 5123) {
|
|
51
|
-
const raw = new Uint16Array(buf.buffer.slice(
|
|
52
|
+
const raw = new Uint16Array(buf.buffer.slice(idxOff, idxOff + idxAcc.count * 2))
|
|
52
53
|
indices = new Uint32Array(raw)
|
|
53
54
|
} else {
|
|
54
|
-
indices = new Uint32Array(buf.buffer.slice(
|
|
55
|
+
indices = new Uint32Array(buf.buffer.slice(idxOff, idxOff + idxAcc.count * 4))
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
|
|
Binary file
|