@pinkaphant/kolmo 0.1.1 → 0.1.3
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/LICENSE +21 -0
- package/README.md +16 -14
- package/bin/kolmo.mjs +19 -54
- package/dist/body/HeldItem.d.ts +22 -0
- package/dist/body/HeldItem.js +171 -0
- package/dist/body/KhrBody.d.ts +26 -0
- package/dist/body/KhrBody.js +179 -0
- package/dist/body/bodySi.d.ts +59 -0
- package/dist/body/bodySi.js +61 -0
- package/dist/body/index.d.ts +3 -0
- package/dist/body/index.js +4 -0
- package/dist/engine/index.d.ts +4 -4
- package/dist/engine/index.js +12 -3
- package/dist/engine/kolmoActor.d.ts +11 -4
- package/dist/engine/kolmoActor.js +197 -0
- package/dist/engine/kolmoInput.d.ts +12 -0
- package/dist/engine/kolmoInput.js +80 -0
- package/dist/engine/kolmoIsland.d.ts +3 -1
- package/dist/engine/kolmoIsland.js +311 -0
- package/dist/engine/kolmoLongDrive.js +223 -0
- package/dist/engine/kolmoRigs.js +59 -0
- package/dist/engine/kolmoStore.d.ts +53 -27
- package/dist/engine/kolmoStore.js +211 -0
- package/dist/engine/kolmoSurface.d.ts +1 -1
- package/dist/engine/kolmoSurface.js +182 -0
- package/dist/engine/kolmoVehicle.d.ts +2 -1
- package/dist/engine/kolmoVehicle.js +244 -0
- package/dist/engine/kolmoVehicleDriver.d.ts +30 -0
- package/dist/engine/kolmoVehicleDriver.js +38 -0
- package/dist/engine/kolmoWorld.d.ts +7 -15
- package/dist/engine/kolmoWorld.js +136 -0
- package/dist/engine/longDriveKit.d.ts +4 -2
- package/dist/engine/longDriveKit.js +254 -0
- package/dist/engine/mainlandMacroCell.d.ts +3 -7
- package/dist/engine/mainlandMacroCell.js +247 -0
- package/dist/engine/shiftedFixedBody.d.ts +13 -0
- package/dist/engine/shiftedFixedBody.js +64 -0
- package/dist/importer/ChopShopPanel.js +465 -0
- package/dist/importer/DomainWorkshopPanel.d.ts +9 -4
- package/dist/importer/DomainWorkshopPanel.js +385 -0
- package/dist/importer/GateHudBar.js +312 -0
- package/dist/importer/GlbImportGate.js +250 -0
- package/dist/importer/ImperativeVehicleRig.js +336 -0
- package/dist/importer/ImporterPlinthUikitTags.js +112 -0
- package/dist/importer/Step1CalibrationPlinth.js +275 -0
- package/dist/importer/Step2UniversalPad.js +244 -0
- package/dist/importer/VfxEmitterPool.js +91 -0
- package/dist/importer/chopShopActions.d.ts +22 -2
- package/dist/importer/chopShopActions.js +232 -0
- package/dist/importer/gateStore.d.ts +1 -1
- package/dist/importer/gateStore.js +92 -0
- package/dist/importer/glbNormalizer.js +133 -0
- package/dist/importer/importerWebMcp.d.ts +17 -6
- package/dist/importer/importerWebMcp.js +343 -0
- package/dist/importer/index.js +22 -3
- package/dist/importer/khrCompiler.d.ts +1 -1
- package/dist/importer/khrCompiler.js +434 -0
- package/dist/importer/launcherBake.js +51 -0
- package/dist/importer/meshIslands.d.ts +1 -1
- package/dist/importer/meshIslands.js +301 -0
- package/dist/importer/surfaceCutter.js +254 -0
- package/dist/importer/surfaceTopology.js +183 -0
- package/dist/importer/universalGateBake.js +162 -0
- package/dist/importer/usdToGlb.js +294 -0
- package/dist/importer/useChopShopController.d.ts +11 -2
- package/dist/importer/useChopShopController.js +364 -0
- package/dist/importer/vehiclePanelAnim.js +214 -0
- package/dist/importer/wheelAxlePairing.d.ts +1 -2
- package/dist/importer/wheelAxlePairing.js +102 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +69 -14
- package/dist/junk/DestructibleTarget.js +154 -0
- package/dist/junk/KolmoJunk.js +65 -0
- package/dist/junk/ShardPieces.d.ts +6 -4
- package/dist/junk/ShardPieces.js +74 -0
- package/dist/junk/TargetDecals.js +51 -0
- package/dist/junk/bvhShatter.js +55 -0
- package/dist/junk/bvhTriCollector.js +78 -0
- package/dist/junk/index.js +11 -1
- package/dist/junk/junkGeometry.js +69 -0
- package/dist/junk/junkImportSanitize.js +54 -0
- package/dist/junk/junkImporter.js +95 -0
- package/dist/junk/junkLabelCanvas.js +67 -0
- package/dist/junk/junkLabels.js +35 -0
- package/dist/junk/targetHelpers.js +103 -0
- package/dist/junk/targetHitLogic.js +128 -0
- package/dist/junk/useTargetAssets.js +102 -0
- package/dist/physics/index.d.ts +26 -0
- package/dist/physics/index.js +84 -0
- package/dist/schema/kolmoSchema.d.ts +2 -1
- package/dist/schema/kolmoSchema.js +184 -0
- package/dist/shaders/celestialBackdrop.d.ts +1 -1
- package/dist/shaders/celestialBackdrop.js +344 -0
- package/dist/shaders/index.d.ts +0 -1
- package/dist/shaders/index.js +9 -1
- package/dist/shaders/plumeAndSparkle.js +271 -0
- package/dist/shaders/ps2GlslShared.d.ts +1 -1
- package/dist/shaders/ps2GlslShared.js +3 -0
- package/dist/shaders/ps2MaterialsTSL.js +65 -0
- package/dist/shaders/ps2MaterialsWebGL.js +40 -0
- package/dist/shaders/ps2RoadWebGL.js +101 -0
- package/dist/shaders/ps2TerrainWebGL.js +54 -0
- package/dist/shaders/ps2Textures.js +224 -0
- package/dist/shaders/retroPalettes.js +188 -0
- package/dist/shaders/retroShader.d.ts +31 -3
- package/dist/shaders/retroShader.js +249 -0
- package/dist/shaders/tsl.d.ts +1 -0
- package/dist/shaders/tsl.js +1 -0
- package/dist/vite/index.d.ts +15 -0
- package/dist/vite/index.js +90 -0
- package/dist/world/frontage.js +32 -0
- package/dist/world/index.d.ts +1 -1
- package/dist/world/index.js +11 -3
- package/dist/world/infiniteWorld2D.js +244 -0
- package/dist/world/island.js +201 -0
- package/dist/world/macroCellSchema.js +27 -0
- package/dist/world/macroKnightAStar.js +171 -0
- package/dist/world/random.js +33 -0
- package/dist/world/road.js +136 -0
- package/dist/world/roadRibbon.d.ts +6 -6
- package/dist/world/roadRibbon.js +161 -0
- package/dist/world/terrain.js +87 -0
- package/dist/world/worldTypes.js +111 -0
- package/package.json +36 -19
- package/dist/engine-BeKvBM8d.js +0 -1745
- package/dist/importer-D9bdcGTh.js +0 -5113
- package/dist/junk-B4bC1zAl.js +0 -1049
- package/dist/kolmoSurface-DTnrFXH0.js +0 -558
- package/dist/shaders-GS71Ek1A.js +0 -1383
- package/dist/world-PRWPYrlx.js +0 -947
- package/dist/worldTypes-Z0KfdCd0.js +0 -226
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { createPS2RoadMaterialWebGL as e } from "../shaders/ps2RoadWebGL.js";
|
|
2
|
+
import { createPS2TerrainMaterialWebGL as t } from "../shaders/ps2TerrainWebGL.js";
|
|
3
|
+
import { createPS2WorldTextures as n } from "../shaders/ps2Textures.js";
|
|
4
|
+
import { applyRetroMaterial as r } from "../shaders/retroShader.js";
|
|
5
|
+
import { bakeWorldSplatMaps as i } from "../world/worldTypes.js";
|
|
6
|
+
import { buildCarvedTerrainGeometry as a, buildRoadRibbonGeometry as o, planDirtSpurs as s } from "../world/roadRibbon.js";
|
|
7
|
+
import { childSeed as c, mulberry32 as l } from "../world/random.js";
|
|
8
|
+
import { planIslandWorld as u } from "../world/island.js";
|
|
9
|
+
import { ShiftedFixedBody as d } from "./shiftedFixedBody.js";
|
|
10
|
+
import { useEffect as f, useLayoutEffect as p, useMemo as m, useRef as h } from "react";
|
|
11
|
+
import * as g from "three";
|
|
12
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
13
|
+
import { CuboidCollider as y, TrimeshCollider as b } from "@react-three/rapier";
|
|
14
|
+
import { instanceBatches as x, planSettlement as S, poseToFloat as C } from "@khr3/c12";
|
|
15
|
+
import { mergeGeometries as w } from "three/examples/jsm/utils/BufferGeometryUtils.js";
|
|
16
|
+
// src/engine/kolmoIsland.tsx
|
|
17
|
+
var T = /* @__PURE__ */ new Map();
|
|
18
|
+
function E(e = 77, t = 960) {
|
|
19
|
+
let n = `${e}:${t}`, r = T.get(n);
|
|
20
|
+
return r || (r = u(e, { size: t }), T.set(n, r)), r;
|
|
21
|
+
}
|
|
22
|
+
function D(e = 77, t = 960) {
|
|
23
|
+
let n = E(e, t), r = n.road.at(n.road.length * .48), i = Math.atan2(r.tangent[0], r.tangent[2]);
|
|
24
|
+
return {
|
|
25
|
+
vehiclePos: [
|
|
26
|
+
r.pos[0],
|
|
27
|
+
r.pos[1] + .45,
|
|
28
|
+
r.pos[2]
|
|
29
|
+
],
|
|
30
|
+
vehicleRot: [
|
|
31
|
+
0,
|
|
32
|
+
i,
|
|
33
|
+
0
|
|
34
|
+
],
|
|
35
|
+
actorPos: [
|
|
36
|
+
r.pos[0] + r.left[0] * (n.road.halfWidth + 2),
|
|
37
|
+
r.pos[1] + 1.5,
|
|
38
|
+
r.pos[2] + r.left[2] * (n.road.halfWidth + 2)
|
|
39
|
+
]
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function O(e) {
|
|
43
|
+
if (e === "FoundationSquare") {
|
|
44
|
+
let e = new g.BoxGeometry(3, .36, 3);
|
|
45
|
+
return e.translate(0, -.18, 0), {
|
|
46
|
+
geo: e,
|
|
47
|
+
color: "#64748b"
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (e === "Street") {
|
|
51
|
+
let e = new g.BoxGeometry(3, .14, 3);
|
|
52
|
+
return e.translate(0, .05, 0), {
|
|
53
|
+
geo: e,
|
|
54
|
+
color: "#475569"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (e === "Wall") {
|
|
58
|
+
let e = new g.BoxGeometry(3, 3, .22);
|
|
59
|
+
return e.translate(0, 1.5, 0), {
|
|
60
|
+
geo: e,
|
|
61
|
+
color: "#cbd5e1"
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (e === "Doorway") {
|
|
65
|
+
let e = new g.BoxGeometry(1.05, 3, .24);
|
|
66
|
+
e.translate(-.975, 1.5, 0);
|
|
67
|
+
let t = new g.BoxGeometry(1.05, 3, .24);
|
|
68
|
+
t.translate(.975, 1.5, 0);
|
|
69
|
+
let n = new g.BoxGeometry(.9, .9, .24);
|
|
70
|
+
n.translate(0, 2.55, 0);
|
|
71
|
+
let r = w([
|
|
72
|
+
e,
|
|
73
|
+
t,
|
|
74
|
+
n
|
|
75
|
+
], !1);
|
|
76
|
+
return e.dispose(), t.dispose(), n.dispose(), {
|
|
77
|
+
geo: r,
|
|
78
|
+
color: "#94a3b8"
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (e === "DoorLeaf") {
|
|
82
|
+
let e = new g.BoxGeometry(.9, 2.1, .1);
|
|
83
|
+
return e.translate(0, 1.05, 0), {
|
|
84
|
+
geo: e,
|
|
85
|
+
color: "#d97706"
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (e === "Stairs") {
|
|
89
|
+
let e = new g.BoxGeometry(1.4, .24, 3.8);
|
|
90
|
+
return e.rotateX(-Math.PI / 4), e.translate(0, 1.5, 0), {
|
|
91
|
+
geo: e,
|
|
92
|
+
color: "#a16207"
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
if (e === "Roof") {
|
|
96
|
+
let e = new g.BoxGeometry(3.16, .26, 3.16);
|
|
97
|
+
return e.translate(0, .13, 0), {
|
|
98
|
+
geo: e,
|
|
99
|
+
color: "#be123c"
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
let t = new g.BoxGeometry(3, .2, 3);
|
|
103
|
+
return t.translate(0, .1, 0), {
|
|
104
|
+
geo: t,
|
|
105
|
+
color: "#94a3b8"
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function k({ matrices: e, count: t, geo: n, mat: r }) {
|
|
109
|
+
let i = h(null);
|
|
110
|
+
return p(() => {
|
|
111
|
+
let t = i.current;
|
|
112
|
+
t && (t.instanceMatrix.array.set(e), t.instanceMatrix.needsUpdate = !0, t.computeBoundingSphere());
|
|
113
|
+
}, [e, t]), /* @__PURE__ */ _("instancedMesh", {
|
|
114
|
+
ref: i,
|
|
115
|
+
args: [
|
|
116
|
+
n,
|
|
117
|
+
r,
|
|
118
|
+
t
|
|
119
|
+
],
|
|
120
|
+
frustumCulled: !1
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function A({ seed: u = 77, size: p = 960, segments: h = 160, settlementTier: w = "town", offX: T = 0, offZ: D = 0 }) {
|
|
124
|
+
let A = m(() => E(u, p), [u, p]), { spurs: j, junctions: M } = m(() => s(A, 2), [A]), N = m(() => i(A, 256, j), [A, j]), P = m(() => a(A.terrain, A.size, h), [A, h]), F = m(() => o(A.road, { tJunctions: M }), [A, M]), I = m(() => j.map((e) => o(e, { crownHeight: .03 })), [j]), L = m(() => S(A.road, w, u), [
|
|
125
|
+
A,
|
|
126
|
+
w,
|
|
127
|
+
u
|
|
128
|
+
]), R = m(() => x(L.pieces), [L]), z = m(() => new g.PlaneGeometry(A.size * 1.8, A.size * 1.8), [A.size]), B = m(() => {
|
|
129
|
+
let i = n(N), { material: a, depthMaterial: o } = t(i, {
|
|
130
|
+
ditherTexelsPerMeter: 16,
|
|
131
|
+
ps2ColorQuantize: .85
|
|
132
|
+
}), { material: s } = e(i, {
|
|
133
|
+
preset: "ASPHALT",
|
|
134
|
+
ditherTexelsPerMeter: 16,
|
|
135
|
+
ps2ColorQuantize: .85
|
|
136
|
+
}), { material: c } = e(i, {
|
|
137
|
+
preset: "DIRT",
|
|
138
|
+
ditherTexelsPerMeter: 16,
|
|
139
|
+
ps2ColorQuantize: .85
|
|
140
|
+
}), l = new g.MeshLambertMaterial({
|
|
141
|
+
color: "#125274",
|
|
142
|
+
transparent: !0,
|
|
143
|
+
opacity: .84,
|
|
144
|
+
fog: !0
|
|
145
|
+
}), u = new g.MeshLambertMaterial({
|
|
146
|
+
color: "#2d4c24",
|
|
147
|
+
flatShading: !0,
|
|
148
|
+
fog: !0
|
|
149
|
+
});
|
|
150
|
+
return r(u, { flatShading: !0 }), {
|
|
151
|
+
tex: i,
|
|
152
|
+
terrainMat: a,
|
|
153
|
+
terrainDepthMat: o,
|
|
154
|
+
asphaltMat: s,
|
|
155
|
+
dirtMat: c,
|
|
156
|
+
waterMat: l,
|
|
157
|
+
treeMat: u
|
|
158
|
+
};
|
|
159
|
+
}, [N]), V = m(() => {
|
|
160
|
+
let e = /* @__PURE__ */ new Map();
|
|
161
|
+
for (let t of R) {
|
|
162
|
+
let { geo: n, color: i } = O(t.kind), a = new g.MeshStandardMaterial({
|
|
163
|
+
color: i,
|
|
164
|
+
roughness: .82,
|
|
165
|
+
flatShading: !0
|
|
166
|
+
});
|
|
167
|
+
r(a, { flatShading: !0 }), e.set(t.kind, {
|
|
168
|
+
geo: n,
|
|
169
|
+
mat: a
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
return e;
|
|
173
|
+
}, [R]), H = m(() => {
|
|
174
|
+
let e = l(c(u, "island-trees")), t = [], n = new g.Object3D(), r = L.buildings.map((e) => ({
|
|
175
|
+
p: C(e.pose).position,
|
|
176
|
+
r: Math.hypot(e.width, e.depth) * 2.2
|
|
177
|
+
}));
|
|
178
|
+
for (let i = 0; i < 950 && t.length < 3520; i++) {
|
|
179
|
+
let i = (e() - .5) * A.size * .82, a = (e() - .5) * A.size * .82, o = A.terrain.height(i, a);
|
|
180
|
+
if (o < A.waterLevel + 2.4 || o > 40 || A.terrain.roadMask(i, a).exclude || r.some((e) => Math.hypot(i - e.p[0], a - e.p[2]) < e.r)) continue;
|
|
181
|
+
let s = .85 + e() * .8;
|
|
182
|
+
n.position.set(i, o + 2.1 * s, a), n.rotation.set(0, e() * Math.PI * 2, 0), n.scale.set(s, s, s), n.updateMatrix(), t.push(...n.matrix.elements);
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
geo: new g.ConeGeometry(1.5, 4.6, 6),
|
|
186
|
+
matrices: new Float32Array(t),
|
|
187
|
+
count: t.length / 16
|
|
188
|
+
};
|
|
189
|
+
}, [
|
|
190
|
+
A,
|
|
191
|
+
L,
|
|
192
|
+
u
|
|
193
|
+
]);
|
|
194
|
+
return f(() => () => {
|
|
195
|
+
B.terrainMat.dispose(), B.terrainDepthMat.dispose(), B.asphaltMat.dispose(), B.dirtMat.dispose(), B.waterMat.dispose(), B.treeMat.dispose(), B.tex.dispose(), P.geometry.dispose(), F.geometry.dispose(), I.forEach((e) => e.geometry.dispose()), H.geo.dispose(), z.dispose();
|
|
196
|
+
for (let e of V.values()) e.geo.dispose(), e.mat.dispose();
|
|
197
|
+
}, [
|
|
198
|
+
B,
|
|
199
|
+
P,
|
|
200
|
+
F,
|
|
201
|
+
I,
|
|
202
|
+
H,
|
|
203
|
+
z,
|
|
204
|
+
V
|
|
205
|
+
]), /* @__PURE__ */ v("group", { children: [
|
|
206
|
+
/* @__PURE__ */ _("fogExp2", {
|
|
207
|
+
attach: "fog",
|
|
208
|
+
args: [10335428, .00145]
|
|
209
|
+
}),
|
|
210
|
+
/* @__PURE__ */ _("hemisphereLight", { args: [
|
|
211
|
+
11059416,
|
|
212
|
+
5392440,
|
|
213
|
+
.72
|
|
214
|
+
] }),
|
|
215
|
+
/* @__PURE__ */ v(d, {
|
|
216
|
+
x: T,
|
|
217
|
+
z: D,
|
|
218
|
+
friction: .9,
|
|
219
|
+
children: [/* @__PURE__ */ _(b, { args: [P.colliderVertices, P.colliderIndices] }), /* @__PURE__ */ _("mesh", {
|
|
220
|
+
geometry: P.geometry,
|
|
221
|
+
material: B.terrainMat,
|
|
222
|
+
customDepthMaterial: B.terrainDepthMat,
|
|
223
|
+
castShadow: !0,
|
|
224
|
+
receiveShadow: !0
|
|
225
|
+
})]
|
|
226
|
+
}),
|
|
227
|
+
/* @__PURE__ */ v(d, {
|
|
228
|
+
x: T,
|
|
229
|
+
z: D,
|
|
230
|
+
friction: 1.05,
|
|
231
|
+
children: [/* @__PURE__ */ _(b, { args: [F.colliderVertices, F.colliderIndices] }), /* @__PURE__ */ _("mesh", {
|
|
232
|
+
geometry: F.geometry,
|
|
233
|
+
material: B.asphaltMat,
|
|
234
|
+
receiveShadow: !0
|
|
235
|
+
})]
|
|
236
|
+
}),
|
|
237
|
+
I.map((e, t) => /* @__PURE__ */ v(d, {
|
|
238
|
+
x: T,
|
|
239
|
+
z: D,
|
|
240
|
+
friction: .85,
|
|
241
|
+
children: [/* @__PURE__ */ _(b, { args: [e.colliderVertices, e.colliderIndices] }), /* @__PURE__ */ _("mesh", {
|
|
242
|
+
geometry: e.geometry,
|
|
243
|
+
material: B.dirtMat,
|
|
244
|
+
receiveShadow: !0
|
|
245
|
+
})]
|
|
246
|
+
}, `spur_${t}`)),
|
|
247
|
+
/* @__PURE__ */ _(d, {
|
|
248
|
+
x: T,
|
|
249
|
+
z: D,
|
|
250
|
+
children: L.buildings.map((e) => {
|
|
251
|
+
let { position: t, yaw: n } = C(e.pose);
|
|
252
|
+
return /* @__PURE__ */ _(y, {
|
|
253
|
+
position: [
|
|
254
|
+
t[0],
|
|
255
|
+
t[1] + e.storeys * 1.5,
|
|
256
|
+
t[2]
|
|
257
|
+
],
|
|
258
|
+
rotation: [
|
|
259
|
+
0,
|
|
260
|
+
n,
|
|
261
|
+
0
|
|
262
|
+
],
|
|
263
|
+
args: [
|
|
264
|
+
e.width * 1.5,
|
|
265
|
+
e.storeys * 1.5,
|
|
266
|
+
e.depth * 1.5
|
|
267
|
+
]
|
|
268
|
+
}, e.id);
|
|
269
|
+
})
|
|
270
|
+
}),
|
|
271
|
+
/* @__PURE__ */ v("group", {
|
|
272
|
+
position: [
|
|
273
|
+
T,
|
|
274
|
+
0,
|
|
275
|
+
D
|
|
276
|
+
],
|
|
277
|
+
children: [
|
|
278
|
+
/* @__PURE__ */ _("mesh", {
|
|
279
|
+
position: [
|
|
280
|
+
0,
|
|
281
|
+
A.waterLevel,
|
|
282
|
+
0
|
|
283
|
+
],
|
|
284
|
+
rotation: [
|
|
285
|
+
-Math.PI * .5,
|
|
286
|
+
0,
|
|
287
|
+
0
|
|
288
|
+
],
|
|
289
|
+
geometry: z,
|
|
290
|
+
material: B.waterMat
|
|
291
|
+
}),
|
|
292
|
+
R.map((e) => {
|
|
293
|
+
let t = V.get(e.kind);
|
|
294
|
+
return /* @__PURE__ */ _(k, {
|
|
295
|
+
matrices: e.matrices,
|
|
296
|
+
count: e.count,
|
|
297
|
+
geo: t.geo,
|
|
298
|
+
mat: t.mat
|
|
299
|
+
}, e.kind);
|
|
300
|
+
}),
|
|
301
|
+
H.count > 0 && /* @__PURE__ */ _(k, {
|
|
302
|
+
matrices: H.matrices,
|
|
303
|
+
count: H.count,
|
|
304
|
+
geo: H.geo,
|
|
305
|
+
mat: B.treeMat
|
|
306
|
+
})
|
|
307
|
+
]
|
|
308
|
+
})
|
|
309
|
+
] });
|
|
310
|
+
}
|
|
311
|
+
export { A as KolmoIsland, D as computeIslandSpawnPose, E as getCachedIslandPlan };
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { createPS2RoadMaterialWebGL as e } from "../shaders/ps2RoadWebGL.js";
|
|
2
|
+
import { createPS2WorldTextures as t } from "../shaders/ps2Textures.js";
|
|
3
|
+
import { MACRO_SIZE_M as n, quantizeFloatingOrigin192 as r } from "../world/macroCellSchema.js";
|
|
4
|
+
import { InfiniteLongDrivePlanner as i } from "../world/infiniteWorld2D.js";
|
|
5
|
+
import { bakeWorldSplatMaps as a } from "../world/worldTypes.js";
|
|
6
|
+
import { buildRoadRibbonGeometry as o } from "../world/roadRibbon.js";
|
|
7
|
+
import { ShiftedFixedBody as s } from "./shiftedFixedBody.js";
|
|
8
|
+
import { roadFromPoints as c } from "../world/road.js";
|
|
9
|
+
import { KolmoIsland as l, getCachedIslandPlan as u } from "./kolmoIsland.js";
|
|
10
|
+
import { readFloatingOriginAnchorXZ as d, shiftFloatingOriginEntities as f, useActiveKolmoWorld as p } from "./kolmoStore.js";
|
|
11
|
+
import { InstancedC12Piece as m, InstancedWorldGlb as h } from "./longDriveKit.js";
|
|
12
|
+
import { MainlandMacroCell as g } from "./mainlandMacroCell.js";
|
|
13
|
+
import { useEffect as _, useLayoutEffect as v, useMemo as y, useRef as b, useState as x } from "react";
|
|
14
|
+
import * as S from "three";
|
|
15
|
+
import { useFrame as C, useThree as w } from "@react-three/fiber";
|
|
16
|
+
import { jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
17
|
+
import { TrimeshCollider as D, useRapier as O } from "@react-three/rapier";
|
|
18
|
+
// src/engine/kolmoLongDrive.tsx
|
|
19
|
+
function k(e = 77, t = 960) {
|
|
20
|
+
let n = u(e, t), r = n.road.samples[0];
|
|
21
|
+
for (let e of n.road.samples) e.pos[0] > r.pos[0] && (r = e);
|
|
22
|
+
return {
|
|
23
|
+
vehiclePos: [
|
|
24
|
+
r.pos[0] + 10,
|
|
25
|
+
r.pos[1] + .6,
|
|
26
|
+
r.pos[2]
|
|
27
|
+
],
|
|
28
|
+
vehicleRot: [
|
|
29
|
+
0,
|
|
30
|
+
Math.PI * .5,
|
|
31
|
+
0
|
|
32
|
+
],
|
|
33
|
+
actorPos: [
|
|
34
|
+
r.pos[0] + 8,
|
|
35
|
+
r.pos[1] + 1.6,
|
|
36
|
+
r.pos[2] + 3.5
|
|
37
|
+
]
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function A(e = 77, t = 1, n = 0) {
|
|
41
|
+
let r = new i(e), a = r.generateMacroCell2D(t, n), o = a.highwayPolylines[0];
|
|
42
|
+
if (o && o.length >= 2) {
|
|
43
|
+
let e = o[1], t = o[Math.min(o.length - 1, 2)], n = Math.max(2, r.sampleMainlandHeight(e[0], e[1])), i = Math.atan2(t[0] - e[0], t[1] - e[1]);
|
|
44
|
+
return {
|
|
45
|
+
vehiclePos: [
|
|
46
|
+
e[0],
|
|
47
|
+
n + .45,
|
|
48
|
+
e[1]
|
|
49
|
+
],
|
|
50
|
+
vehicleRot: [
|
|
51
|
+
0,
|
|
52
|
+
i,
|
|
53
|
+
0
|
|
54
|
+
],
|
|
55
|
+
actorPos: [
|
|
56
|
+
e[0] - 2.6,
|
|
57
|
+
n + 1.35,
|
|
58
|
+
e[1] + 2.2
|
|
59
|
+
]
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
let s = Math.max(2.5, r.sampleMainlandHeight(a.hubX, a.hubZ));
|
|
63
|
+
return {
|
|
64
|
+
vehiclePos: [
|
|
65
|
+
a.hubX,
|
|
66
|
+
s + .45,
|
|
67
|
+
a.hubZ
|
|
68
|
+
],
|
|
69
|
+
vehicleRot: [
|
|
70
|
+
0,
|
|
71
|
+
Math.PI * .5,
|
|
72
|
+
0
|
|
73
|
+
],
|
|
74
|
+
actorPos: [
|
|
75
|
+
a.hubX - 2.5,
|
|
76
|
+
s + 1.35,
|
|
77
|
+
a.hubZ + 2.5
|
|
78
|
+
]
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function j({ seed: e, islandSize: t, planner: r, roadMat: i, offX: a, offZ: l }) {
|
|
82
|
+
let d = y(() => {
|
|
83
|
+
let i = u(e, t), a = i.road.samples[0];
|
|
84
|
+
for (let e of i.road.samples) e.pos[0] > a.pos[0] && (a = e);
|
|
85
|
+
let s = r.evalVerticalBorder(0, 0), l = n * .5, d = s.offsetMeters, f = r.sampleMainlandHeight(l, d), p = [];
|
|
86
|
+
for (let e = 0; e <= 28; e++) {
|
|
87
|
+
let t = e / 28, n = Math.sin(Math.PI * t), r = a.pos[0] + (l - a.pos[0]) * t, i = a.pos[2] + (d - a.pos[2]) * (t * t * (3 - 2 * t)), o = a.pos[1] * (1 - t) + f * t;
|
|
88
|
+
p.push([
|
|
89
|
+
r,
|
|
90
|
+
o * (1 - n) + 14 * n,
|
|
91
|
+
i
|
|
92
|
+
]);
|
|
93
|
+
}
|
|
94
|
+
let m = c(p, 5, 3, !1), h = o(m, {
|
|
95
|
+
skirtDrop: .6,
|
|
96
|
+
crownHeight: .04
|
|
97
|
+
}), g = [], _ = [], v = new S.Object3D();
|
|
98
|
+
for (let e = 24; e < m.length - 24; e += 24) {
|
|
99
|
+
let t = m.at(e), n = Math.atan2(t.tangent[0], t.tangent[2]);
|
|
100
|
+
for (let e of [-3.6, 3.6]) {
|
|
101
|
+
let r = t.pos[0] + t.left[0] * e, i = t.pos[2] + t.left[2] * e, a = t.pos[1] + 14;
|
|
102
|
+
v.position.set(r, t.pos[1] - a * .5, i), v.rotation.set(0, n, 0), v.scale.set(.45, a / .24, .45), v.updateMatrix(), g.push(...v.matrix.elements);
|
|
103
|
+
}
|
|
104
|
+
v.position.set(t.pos[0] + t.left[0] * 4.8, t.pos[1], t.pos[2] + t.left[2] * 4.8), v.rotation.set(0, n, 0), v.scale.set(1, 1, 1), v.updateMatrix(), _.push(...v.matrix.elements);
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
ribbon: h,
|
|
108
|
+
piers: new Float32Array(g),
|
|
109
|
+
lamps: new Float32Array(_)
|
|
110
|
+
};
|
|
111
|
+
}, [
|
|
112
|
+
e,
|
|
113
|
+
t,
|
|
114
|
+
r
|
|
115
|
+
]);
|
|
116
|
+
return _(() => () => {
|
|
117
|
+
d.ribbon.geometry.dispose();
|
|
118
|
+
}, [d]), /* @__PURE__ */ E("group", { children: [/* @__PURE__ */ E(s, {
|
|
119
|
+
x: a,
|
|
120
|
+
z: l,
|
|
121
|
+
friction: 1.05,
|
|
122
|
+
children: [/* @__PURE__ */ T(D, { args: [d.ribbon.colliderVertices, d.ribbon.colliderIndices] }), /* @__PURE__ */ T("mesh", {
|
|
123
|
+
geometry: d.ribbon.geometry,
|
|
124
|
+
material: i,
|
|
125
|
+
receiveShadow: !0
|
|
126
|
+
})]
|
|
127
|
+
}), /* @__PURE__ */ E("group", {
|
|
128
|
+
position: [
|
|
129
|
+
a,
|
|
130
|
+
0,
|
|
131
|
+
l
|
|
132
|
+
],
|
|
133
|
+
children: [/* @__PURE__ */ T(m, {
|
|
134
|
+
matrices: d.piers,
|
|
135
|
+
kind: "square",
|
|
136
|
+
color: "#64748b"
|
|
137
|
+
}), /* @__PURE__ */ T(h, {
|
|
138
|
+
kitKey: "light_pole",
|
|
139
|
+
fitSpan: [
|
|
140
|
+
.6,
|
|
141
|
+
6.5,
|
|
142
|
+
.6
|
|
143
|
+
],
|
|
144
|
+
matrices: d.lamps
|
|
145
|
+
})]
|
|
146
|
+
})] });
|
|
147
|
+
}
|
|
148
|
+
function M({ seed: o = 77, pureMainland: s = !1, initialOrigin: c = [0, 0], onOriginRebase: m, renderCellExtra: h }) {
|
|
149
|
+
let S = p(), D = w((e) => e.camera), k = O(), A = y(() => new i(o), [o]), [M, N] = x(c), P = b([c[0], c[1]]), F = b([c[0], c[1]]), [I, L] = x(() => [Math.max(+!!s, Math.round(c[0] / n)), Math.round(c[1] / n)]), [R, z] = x(() => {
|
|
150
|
+
let e = Math.max(1, Math.round(c[0] / n)), t = Math.round(c[1] / n);
|
|
151
|
+
return s ? [
|
|
152
|
+
[e, t],
|
|
153
|
+
[e, t - 1],
|
|
154
|
+
[e, t + 1],
|
|
155
|
+
[e + 1, t]
|
|
156
|
+
] : [[1, 0]];
|
|
157
|
+
}), B = y(() => {
|
|
158
|
+
let n = u(o, 960), r = t(a(n, 64));
|
|
159
|
+
return {
|
|
160
|
+
tex: r,
|
|
161
|
+
roadMat: e(r, { preset: "ASPHALT" }).material
|
|
162
|
+
};
|
|
163
|
+
}, [o]);
|
|
164
|
+
_(() => () => {
|
|
165
|
+
B.roadMat.dispose(), B.tex.dispose();
|
|
166
|
+
}, [B]);
|
|
167
|
+
let V = y(() => {
|
|
168
|
+
let [e, t] = I, n = [];
|
|
169
|
+
for (let r = -1; r <= 1; r++) for (let i = -1; i <= 1; i++) {
|
|
170
|
+
let a = e + r, o = t + i;
|
|
171
|
+
a >= 1 && n.push([a, o]);
|
|
172
|
+
}
|
|
173
|
+
return n.sort((n, r) => Math.hypot(n[0] - e, n[1] - t) - Math.hypot(r[0] - e, r[1] - t)), n;
|
|
174
|
+
}, [I]);
|
|
175
|
+
v(() => {
|
|
176
|
+
let e = M[0] - P.current[0], t = M[1] - P.current[1];
|
|
177
|
+
(e !== 0 || t !== 0) && (P.current = [M[0], M[1]], F.current = [M[0], M[1]], f(S, D, e, t, k), m?.(M[0], M[1], e, t));
|
|
178
|
+
}, [
|
|
179
|
+
M,
|
|
180
|
+
S,
|
|
181
|
+
D,
|
|
182
|
+
k,
|
|
183
|
+
m
|
|
184
|
+
]), C(() => {
|
|
185
|
+
z((e) => {
|
|
186
|
+
let t = e.filter(([e, t]) => V.some(([n, r]) => n === e && r === t)), n = V.find(([e, n]) => !t.some(([t, r]) => t === e && r === n));
|
|
187
|
+
return !n && t.length === e.length ? e : n ? [...t, n] : t;
|
|
188
|
+
});
|
|
189
|
+
let [e, t] = P.current, [i, a] = d(S, D), o = e + i, c = t + a, l = r(o, c), u = l.chunkOriginX - e, f = l.chunkOriginZ - t;
|
|
190
|
+
(Math.abs(u) >= 192 || Math.abs(f) >= 192) && (l.chunkOriginX !== F.current[0] || l.chunkOriginZ !== F.current[1]) && (F.current = [l.chunkOriginX, l.chunkOriginZ], N([l.chunkOriginX, l.chunkOriginZ]));
|
|
191
|
+
let p = Math.max(+!!s, Math.round(o / n)), m = Math.round(c / n);
|
|
192
|
+
(p !== I[0] || m !== I[1]) && L([p, m]);
|
|
193
|
+
});
|
|
194
|
+
let H = -M[0], U = -M[1];
|
|
195
|
+
return /* @__PURE__ */ E("group", { children: [
|
|
196
|
+
!s && I[0] <= 1 && Math.abs(I[1]) <= 1 && /* @__PURE__ */ T(l, {
|
|
197
|
+
seed: o,
|
|
198
|
+
size: 960,
|
|
199
|
+
segments: 144,
|
|
200
|
+
settlementTier: "town",
|
|
201
|
+
offX: H,
|
|
202
|
+
offZ: U
|
|
203
|
+
}),
|
|
204
|
+
!s && I[0] <= 2 && Math.abs(I[1]) <= 1 && /* @__PURE__ */ T(j, {
|
|
205
|
+
seed: o,
|
|
206
|
+
islandSize: 960,
|
|
207
|
+
planner: A,
|
|
208
|
+
roadMat: B.roadMat,
|
|
209
|
+
offX: H,
|
|
210
|
+
offZ: U
|
|
211
|
+
}),
|
|
212
|
+
R.map(([e, t]) => /* @__PURE__ */ T(g, {
|
|
213
|
+
mx: e,
|
|
214
|
+
mz: t,
|
|
215
|
+
planner: A,
|
|
216
|
+
roadMat: B.roadMat,
|
|
217
|
+
offX: H,
|
|
218
|
+
offZ: U,
|
|
219
|
+
renderExtra: h
|
|
220
|
+
}, `mc_${e}_${t}`))
|
|
221
|
+
] });
|
|
222
|
+
}
|
|
223
|
+
export { M as KolmoLongDrive, k as computeLongDriveBridgeheadSpawn, A as computeLongDriveMainlandSpawn };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { syncRetroViewport as e } from "../shaders/retroShader.js";
|
|
2
|
+
import { useEffect as t, useRef as n } from "react";
|
|
3
|
+
import * as r from "three";
|
|
4
|
+
import { useFrame as i, useThree as a } from "@react-three/fiber";
|
|
5
|
+
import { RoomEnvironment as o } from "three/examples/jsm/environments/RoomEnvironment.js";
|
|
6
|
+
// src/engine/kolmoRigs.tsx
|
|
7
|
+
function s({ intensity: e = .65 }) {
|
|
8
|
+
let { gl: n, scene: i } = a();
|
|
9
|
+
return t(() => {
|
|
10
|
+
let t = new r.PMREMGenerator(n), a = new o(), s = t.fromScene(a, .04), c = i.environment, l = i.environmentIntensity;
|
|
11
|
+
return i.environment = s.texture, i.environmentIntensity = e, a.dispose(), t.dispose(), () => {
|
|
12
|
+
i.environment = c, i.environmentIntensity = l, s.dispose();
|
|
13
|
+
};
|
|
14
|
+
}, [
|
|
15
|
+
n,
|
|
16
|
+
i,
|
|
17
|
+
e
|
|
18
|
+
]), null;
|
|
19
|
+
}
|
|
20
|
+
var c = new r.Vector2();
|
|
21
|
+
function l({ onViewportChange: r } = {}) {
|
|
22
|
+
let { gl: o } = a(), s = n({
|
|
23
|
+
w: 0,
|
|
24
|
+
h: 0,
|
|
25
|
+
dpr: 0
|
|
26
|
+
});
|
|
27
|
+
return t(() => {
|
|
28
|
+
o.getDrawingBufferSize(c);
|
|
29
|
+
let t = o.getPixelRatio();
|
|
30
|
+
s.current = {
|
|
31
|
+
w: c.x,
|
|
32
|
+
h: c.y,
|
|
33
|
+
dpr: t
|
|
34
|
+
}, e(c.x, c.y, t), r?.(c.x, c.y, t);
|
|
35
|
+
}, [o, r]), i(() => {
|
|
36
|
+
o.getDrawingBufferSize(c);
|
|
37
|
+
let t = o.getPixelRatio(), n = s.current;
|
|
38
|
+
(c.x !== n.w || c.y !== n.h || t !== n.dpr) && (n.w = c.x, n.h = c.y, n.dpr = t, e(c.x, c.y, t), r?.(c.x, c.y, t));
|
|
39
|
+
}), null;
|
|
40
|
+
}
|
|
41
|
+
var u = new r.Vector3(-120, 85, -120), d = new r.Vector3(0, 0, 0), f = new r.Vector3(0, 1, 0), p = new r.Vector3(), m = new r.Vector3(), h = new r.Vector3();
|
|
42
|
+
new r.Matrix4().lookAt(u, d, f).extractBasis(p, m, h);
|
|
43
|
+
function g({ sunLightRef: e }) {
|
|
44
|
+
return t(() => {
|
|
45
|
+
let t = e.current;
|
|
46
|
+
if (!t) return;
|
|
47
|
+
let n = t.shadow, r = n.updateMatrices;
|
|
48
|
+
return n.updateMatrices = function(e) {
|
|
49
|
+
if (e === t && t.castShadow) {
|
|
50
|
+
let e = n.camera, r = n.mapSize.x || 1024, i = Math.max(1, e.right - e.left) / r, a = Math.round(t.target.position.dot(p) / i) * i, o = Math.round(t.target.position.dot(m) / i) * i, s = t.target.position.dot(h);
|
|
51
|
+
t.target.position.set(0, 0, 0).addScaledVector(p, a).addScaledVector(m, o).addScaledVector(h, s), t.position.copy(t.target.position).add(u), t.updateMatrixWorld(), t.target.updateMatrixWorld();
|
|
52
|
+
}
|
|
53
|
+
return r.call(this, e);
|
|
54
|
+
}, () => {
|
|
55
|
+
n.updateMatrices = r;
|
|
56
|
+
};
|
|
57
|
+
}, [e]), null;
|
|
58
|
+
}
|
|
59
|
+
export { l as RetroViewportSync, s as RoomEnvRig, g as ShadowSnapRig };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { type Trait, type TraitRecord, type World } from "koota";
|
|
2
3
|
import type { EcctrlHandle } from "@pinkaphant/ecctrl";
|
|
3
4
|
import type { EcctrlVehicleHandle } from "@pinkaphant/ecctrl/vehicle";
|
|
4
|
-
import { type RetroPresetId } from "../shaders/
|
|
5
|
-
export type KolmoControlMode = "foot" | "car" | "
|
|
5
|
+
import { type RetroPresetId } from "../shaders/retroShader.js";
|
|
6
|
+
export type KolmoControlMode = "foot" | "car" | "flight";
|
|
6
7
|
export interface VehicleTraitData {
|
|
7
8
|
id: string;
|
|
8
9
|
handle: EcctrlVehicleHandle | null;
|
|
@@ -10,7 +11,7 @@ export interface VehicleTraitData {
|
|
|
10
11
|
seatOffset: [number, number, number];
|
|
11
12
|
exitOffset: [number, number, number];
|
|
12
13
|
isFlight: boolean;
|
|
13
|
-
|
|
14
|
+
onOriginShift?: (dx: number, dz: number) => void;
|
|
14
15
|
}
|
|
15
16
|
export interface ActorTraitData {
|
|
16
17
|
id: string;
|
|
@@ -18,43 +19,67 @@ export interface ActorTraitData {
|
|
|
18
19
|
exitSpawnPos: [number, number, number] | null;
|
|
19
20
|
exitSpawnYaw: number;
|
|
20
21
|
exitLinVel: [number, number, number] | null;
|
|
22
|
+
onOriginShift?: (dx: number, dz: number) => void;
|
|
21
23
|
}
|
|
22
|
-
|
|
23
|
-
export declare const
|
|
24
|
-
|
|
25
|
-
export declare const ActorTrait: import("koota").Trait<() => ActorTraitData>;
|
|
26
|
-
/** True SoA scalar schema trait (`trait({ ... })`) for fast proximity queries. */
|
|
27
|
-
export declare const InteractableTrait: import("koota").Trait<{
|
|
24
|
+
export declare const VehicleTrait: Trait<() => VehicleTraitData>;
|
|
25
|
+
export declare const ActorTrait: Trait<() => ActorTraitData>;
|
|
26
|
+
export declare const InteractableTrait: Trait<{
|
|
28
27
|
id: string;
|
|
29
28
|
radius: number;
|
|
30
29
|
kind: "vehicle" | "prop";
|
|
31
30
|
}>;
|
|
31
|
+
export interface FloatingOriginRapierSync {
|
|
32
|
+
world: {
|
|
33
|
+
timestep: number;
|
|
34
|
+
propagateModifiedBodyPositionsToColliders(): void;
|
|
35
|
+
step(): void;
|
|
36
|
+
};
|
|
37
|
+
rigidBodyStates?: Map<number, {
|
|
38
|
+
object: THREE.Object3D;
|
|
39
|
+
invertedWorldMatrix: THREE.Matrix4;
|
|
40
|
+
scale: THREE.Vector3;
|
|
41
|
+
meshType?: string;
|
|
42
|
+
}>;
|
|
43
|
+
}
|
|
44
|
+
type ShiftableBody = {
|
|
45
|
+
handle?: number;
|
|
46
|
+
translation(): {
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
z: number;
|
|
50
|
+
};
|
|
51
|
+
rotation?(): {
|
|
52
|
+
x: number;
|
|
53
|
+
y: number;
|
|
54
|
+
z: number;
|
|
55
|
+
w: number;
|
|
56
|
+
};
|
|
57
|
+
setTranslation(t: {
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
z: number;
|
|
61
|
+
}, wake: boolean): void;
|
|
62
|
+
};
|
|
32
63
|
export interface FloatingBodyTraitData {
|
|
33
64
|
id: string;
|
|
34
|
-
getBody: () =>
|
|
35
|
-
translation(): {
|
|
36
|
-
x: number;
|
|
37
|
-
y: number;
|
|
38
|
-
z: number;
|
|
39
|
-
};
|
|
40
|
-
setTranslation(t: {
|
|
41
|
-
x: number;
|
|
42
|
-
y: number;
|
|
43
|
-
z: number;
|
|
44
|
-
}, wake: boolean): void;
|
|
45
|
-
} | null;
|
|
65
|
+
getBody: () => ShiftableBody | null;
|
|
46
66
|
}
|
|
47
|
-
export declare const FloatingBodyTrait:
|
|
48
|
-
export declare const PilotLink: import("koota").Relation<
|
|
49
|
-
|
|
50
|
-
export declare const WorldSessionTrait: import("koota").Trait<{
|
|
67
|
+
export declare const FloatingBodyTrait: Trait<() => FloatingBodyTraitData>;
|
|
68
|
+
export declare const PilotLink: import("koota").Relation<Trait<Record<string, never>>>;
|
|
69
|
+
export declare const WorldSessionTrait: Trait<{
|
|
51
70
|
activeVehicleId: string;
|
|
52
71
|
activeRetroPreset: RetroPresetId;
|
|
53
72
|
}>;
|
|
54
73
|
export declare const kolmoWorld: World;
|
|
55
|
-
/** Safely resolves the active Koota `World` from `<WorldProvider>` (falling back to `kolmoWorld` when rendered standalone in tests). */
|
|
56
74
|
export declare function useActiveKolmoWorld(): World;
|
|
57
75
|
export declare function ensureWorldSession(w: World): void;
|
|
76
|
+
/**
|
|
77
|
+
* Subscribes to a world-level Koota trait directly on `world` without calling `useWorld()`,
|
|
78
|
+
* so `<KolmoWorld world={null}>` and standalone `<KolmoPhysics>` never throw without `<WorldProvider>`.
|
|
79
|
+
*/
|
|
80
|
+
export declare function useWorldTrait<T extends Trait>(world: World | null | undefined, t: T): TraitRecord<T> | undefined;
|
|
81
|
+
export declare function readFloatingOriginAnchorXZ(world: World, camera: THREE.Camera | null): [number, number];
|
|
82
|
+
export declare function shiftFloatingOriginEntities(world: World, camera: THREE.Camera | null, dx: number, dz: number, rapier?: FloatingOriginRapierSync | null): void;
|
|
58
83
|
export interface KolmoTelemetryState {
|
|
59
84
|
speedKmh: number;
|
|
60
85
|
rpm: number;
|
|
@@ -72,3 +97,4 @@ export declare const kolmoActions: import("koota").Actions<{
|
|
|
72
97
|
exitVehicle: () => void;
|
|
73
98
|
setRetroPreset: (preset: RetroPresetId) => void;
|
|
74
99
|
}>;
|
|
100
|
+
export {};
|