@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.
Files changed (131) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -14
  3. package/bin/kolmo.mjs +19 -54
  4. package/dist/body/HeldItem.d.ts +22 -0
  5. package/dist/body/HeldItem.js +171 -0
  6. package/dist/body/KhrBody.d.ts +26 -0
  7. package/dist/body/KhrBody.js +179 -0
  8. package/dist/body/bodySi.d.ts +59 -0
  9. package/dist/body/bodySi.js +61 -0
  10. package/dist/body/index.d.ts +3 -0
  11. package/dist/body/index.js +4 -0
  12. package/dist/engine/index.d.ts +4 -4
  13. package/dist/engine/index.js +12 -3
  14. package/dist/engine/kolmoActor.d.ts +11 -4
  15. package/dist/engine/kolmoActor.js +197 -0
  16. package/dist/engine/kolmoInput.d.ts +12 -0
  17. package/dist/engine/kolmoInput.js +80 -0
  18. package/dist/engine/kolmoIsland.d.ts +3 -1
  19. package/dist/engine/kolmoIsland.js +311 -0
  20. package/dist/engine/kolmoLongDrive.js +223 -0
  21. package/dist/engine/kolmoRigs.js +59 -0
  22. package/dist/engine/kolmoStore.d.ts +53 -27
  23. package/dist/engine/kolmoStore.js +211 -0
  24. package/dist/engine/kolmoSurface.d.ts +1 -1
  25. package/dist/engine/kolmoSurface.js +182 -0
  26. package/dist/engine/kolmoVehicle.d.ts +2 -1
  27. package/dist/engine/kolmoVehicle.js +244 -0
  28. package/dist/engine/kolmoVehicleDriver.d.ts +30 -0
  29. package/dist/engine/kolmoVehicleDriver.js +38 -0
  30. package/dist/engine/kolmoWorld.d.ts +7 -15
  31. package/dist/engine/kolmoWorld.js +136 -0
  32. package/dist/engine/longDriveKit.d.ts +4 -2
  33. package/dist/engine/longDriveKit.js +254 -0
  34. package/dist/engine/mainlandMacroCell.d.ts +3 -7
  35. package/dist/engine/mainlandMacroCell.js +247 -0
  36. package/dist/engine/shiftedFixedBody.d.ts +13 -0
  37. package/dist/engine/shiftedFixedBody.js +64 -0
  38. package/dist/importer/ChopShopPanel.js +465 -0
  39. package/dist/importer/DomainWorkshopPanel.d.ts +9 -4
  40. package/dist/importer/DomainWorkshopPanel.js +385 -0
  41. package/dist/importer/GateHudBar.js +312 -0
  42. package/dist/importer/GlbImportGate.js +250 -0
  43. package/dist/importer/ImperativeVehicleRig.js +336 -0
  44. package/dist/importer/ImporterPlinthUikitTags.js +112 -0
  45. package/dist/importer/Step1CalibrationPlinth.js +275 -0
  46. package/dist/importer/Step2UniversalPad.js +244 -0
  47. package/dist/importer/VfxEmitterPool.js +91 -0
  48. package/dist/importer/chopShopActions.d.ts +22 -2
  49. package/dist/importer/chopShopActions.js +232 -0
  50. package/dist/importer/gateStore.d.ts +1 -1
  51. package/dist/importer/gateStore.js +92 -0
  52. package/dist/importer/glbNormalizer.js +133 -0
  53. package/dist/importer/importerWebMcp.d.ts +17 -6
  54. package/dist/importer/importerWebMcp.js +343 -0
  55. package/dist/importer/index.js +22 -3
  56. package/dist/importer/khrCompiler.d.ts +1 -1
  57. package/dist/importer/khrCompiler.js +434 -0
  58. package/dist/importer/launcherBake.js +51 -0
  59. package/dist/importer/meshIslands.d.ts +1 -1
  60. package/dist/importer/meshIslands.js +301 -0
  61. package/dist/importer/surfaceCutter.js +254 -0
  62. package/dist/importer/surfaceTopology.js +183 -0
  63. package/dist/importer/universalGateBake.js +162 -0
  64. package/dist/importer/usdToGlb.js +294 -0
  65. package/dist/importer/useChopShopController.d.ts +11 -2
  66. package/dist/importer/useChopShopController.js +364 -0
  67. package/dist/importer/vehiclePanelAnim.js +214 -0
  68. package/dist/importer/wheelAxlePairing.d.ts +1 -2
  69. package/dist/importer/wheelAxlePairing.js +102 -0
  70. package/dist/index.d.ts +2 -3
  71. package/dist/index.js +69 -14
  72. package/dist/junk/DestructibleTarget.js +154 -0
  73. package/dist/junk/KolmoJunk.js +65 -0
  74. package/dist/junk/ShardPieces.d.ts +6 -4
  75. package/dist/junk/ShardPieces.js +74 -0
  76. package/dist/junk/TargetDecals.js +51 -0
  77. package/dist/junk/bvhShatter.js +55 -0
  78. package/dist/junk/bvhTriCollector.js +78 -0
  79. package/dist/junk/index.js +11 -1
  80. package/dist/junk/junkGeometry.js +69 -0
  81. package/dist/junk/junkImportSanitize.js +54 -0
  82. package/dist/junk/junkImporter.js +95 -0
  83. package/dist/junk/junkLabelCanvas.js +67 -0
  84. package/dist/junk/junkLabels.js +35 -0
  85. package/dist/junk/targetHelpers.js +103 -0
  86. package/dist/junk/targetHitLogic.js +128 -0
  87. package/dist/junk/useTargetAssets.js +102 -0
  88. package/dist/physics/index.d.ts +26 -0
  89. package/dist/physics/index.js +84 -0
  90. package/dist/schema/kolmoSchema.d.ts +2 -1
  91. package/dist/schema/kolmoSchema.js +184 -0
  92. package/dist/shaders/celestialBackdrop.d.ts +1 -1
  93. package/dist/shaders/celestialBackdrop.js +344 -0
  94. package/dist/shaders/index.d.ts +0 -1
  95. package/dist/shaders/index.js +9 -1
  96. package/dist/shaders/plumeAndSparkle.js +271 -0
  97. package/dist/shaders/ps2GlslShared.d.ts +1 -1
  98. package/dist/shaders/ps2GlslShared.js +3 -0
  99. package/dist/shaders/ps2MaterialsTSL.js +65 -0
  100. package/dist/shaders/ps2MaterialsWebGL.js +40 -0
  101. package/dist/shaders/ps2RoadWebGL.js +101 -0
  102. package/dist/shaders/ps2TerrainWebGL.js +54 -0
  103. package/dist/shaders/ps2Textures.js +224 -0
  104. package/dist/shaders/retroPalettes.js +188 -0
  105. package/dist/shaders/retroShader.d.ts +31 -3
  106. package/dist/shaders/retroShader.js +249 -0
  107. package/dist/shaders/tsl.d.ts +1 -0
  108. package/dist/shaders/tsl.js +1 -0
  109. package/dist/vite/index.d.ts +15 -0
  110. package/dist/vite/index.js +90 -0
  111. package/dist/world/frontage.js +32 -0
  112. package/dist/world/index.d.ts +1 -1
  113. package/dist/world/index.js +11 -3
  114. package/dist/world/infiniteWorld2D.js +244 -0
  115. package/dist/world/island.js +201 -0
  116. package/dist/world/macroCellSchema.js +27 -0
  117. package/dist/world/macroKnightAStar.js +171 -0
  118. package/dist/world/random.js +33 -0
  119. package/dist/world/road.js +136 -0
  120. package/dist/world/roadRibbon.d.ts +6 -6
  121. package/dist/world/roadRibbon.js +161 -0
  122. package/dist/world/terrain.js +87 -0
  123. package/dist/world/worldTypes.js +111 -0
  124. package/package.json +36 -19
  125. package/dist/engine-BeKvBM8d.js +0 -1745
  126. package/dist/importer-D9bdcGTh.js +0 -5113
  127. package/dist/junk-B4bC1zAl.js +0 -1049
  128. package/dist/kolmoSurface-DTnrFXH0.js +0 -558
  129. package/dist/shaders-GS71Ek1A.js +0 -1383
  130. package/dist/world-PRWPYrlx.js +0 -947
  131. package/dist/worldTypes-Z0KfdCd0.js +0 -226
@@ -0,0 +1,275 @@
1
+ import { useGateStore as e } from "./gateStore.js";
2
+ import { ImporterPlinthUikitTags as t, makeStarterDomainScene as n } from "./ImporterPlinthUikitTags.js";
3
+ import { CHOP_ROLES as r } from "./surfaceTopology.js";
4
+ import { computeChopPartHinge as i } from "./vehiclePanelAnim.js";
5
+ import { buildSelectionOverlayGeometry as a, createFleet12GonWheelGroup as o, previewLoopPolyline as s } from "./surfaceCutter.js";
6
+ import { measureSelection as c } from "./wheelAxlePairing.js";
7
+ import { useEffect as l, useMemo as u, useRef as d } from "react";
8
+ import * as f from "three";
9
+ import { Bounds as p, Bvh as m, Line as h } from "@react-three/drei";
10
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
11
+ // src/importer/Step1CalibrationPlinth.tsx
12
+ function y(e, t) {
13
+ let n = new f.BufferGeometry();
14
+ return n.setAttribute("position", new f.BufferAttribute(e, 3)), n.setAttribute("normal", new f.BufferAttribute(t, 3)), n;
15
+ }
16
+ var b = Object.fromEntries(r.filter((e) => e.role !== "wheel").map((e) => [e.role, e.color]));
17
+ function x(n) {
18
+ let r = e((e) => e.calibration), x = d(!1), S = u(() => n.assembly.panels.map((e) => y(e.localPositions, e.localNormals)), [n.assembly]), C = u(() => y(n.assembly.wheels[0].positions, n.assembly.wheels[0].normals), [n.assembly]);
19
+ l(() => () => {
20
+ for (let e of S) e.dispose();
21
+ C.dispose();
22
+ }, [S, C]), l(() => {
23
+ let e = () => {
24
+ x.current = !1;
25
+ };
26
+ return window.addEventListener("pointerup", e), () => window.removeEventListener("pointerup", e);
27
+ }, []);
28
+ let w = u(() => n.faceSelection ? n.islands.find((e) => e.id === n.faceSelection.islandId) ?? null : null, [n.faceSelection, n.islands]), T = u(() => w && n.faceSelection && n.faceSelection.triangles.length > 0 ? a(w.geometry, n.faceSelection.triangles, .0045) : null, [w, n.faceSelection]), E = u(() => w && n.faceSelection && n.faceSelection.mirrored.length > 0 ? a(w.geometry, n.faceSelection.mirrored, .0045) : null, [w, n.faceSelection]);
29
+ l(() => () => {
30
+ T?.dispose();
31
+ }, [T]), l(() => () => {
32
+ E?.dispose();
33
+ }, [E]);
34
+ let D = u(() => {
35
+ if (!n.loopDots || n.loopDots.points.length < 2) return null;
36
+ let e = n.islands.find((e) => e.id === n.loopDots.islandId);
37
+ return e ? s(e, n.loopDots.points) : null;
38
+ }, [n.loopDots, n.islands]), O = u(() => {
39
+ if (n.wheelSource !== "fleet12" || n.islands.length === 0) return [];
40
+ let e = [];
41
+ return n.axles.forEach((t, r) => {
42
+ for (let [i, a] of [["L", t.left], ["R", t.right]]) {
43
+ if (a.length === 0) continue;
44
+ let t = c(n.islands, a), s = Math.max(.14, t.radius), l = Math.max(.1, t.halfWidth * 2);
45
+ e.push({
46
+ key: `f12_${r}_${i}`,
47
+ pos: t.center,
48
+ group: o(s, l)
49
+ });
50
+ }
51
+ }), e;
52
+ }, [
53
+ n.wheelSource,
54
+ n.axles,
55
+ n.islands
56
+ ]);
57
+ l(() => () => {
58
+ for (let e of O) e.group.traverse((e) => {
59
+ let t = e;
60
+ if (t.geometry && t.geometry.dispose(), t.material) for (let e of Array.isArray(t.material) ? t.material : [t.material]) e.dispose();
61
+ });
62
+ }, [O]);
63
+ let k = (e, t, r) => {
64
+ e.faceIndex != null && (e.stopPropagation(), n.onPickFace({
65
+ islandId: t,
66
+ faceIndex: e.faceIndex,
67
+ point: [
68
+ e.point.x,
69
+ e.point.y,
70
+ e.point.z
71
+ ],
72
+ erase: !!(e.altKey || e.button === 2),
73
+ isDrag: r
74
+ }));
75
+ };
76
+ return /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(p, {
77
+ fit: !0,
78
+ clip: !0,
79
+ margin: 1.38,
80
+ children: /* @__PURE__ */ v(m, {
81
+ firstHitOnly: !0,
82
+ children: [/* @__PURE__ */ v("group", {
83
+ ref: n.rootObjRef,
84
+ children: [n.useProxy ? /* @__PURE__ */ v(g, { children: [
85
+ n.previewScene && /* @__PURE__ */ _("primitive", { object: n.previewScene }),
86
+ n.assembly.panels.map((e, t) => /* @__PURE__ */ _("mesh", {
87
+ position: e.anchorChassis,
88
+ geometry: S[t],
89
+ children: /* @__PURE__ */ _("meshStandardMaterial", {
90
+ color: e.colorHex,
91
+ roughness: e.isGlass ? .15 : .88,
92
+ transparent: e.isGlass || !!n.previewScene,
93
+ opacity: n.previewScene ? .28 : e.isGlass ? .32 : 1,
94
+ wireframe: !!n.previewScene,
95
+ flatShading: n.assembly.shadingMode === "psx-flat"
96
+ })
97
+ }, e.partId)),
98
+ n.assembly.wheels.map((e) => /* @__PURE__ */ _("group", {
99
+ position: e.position,
100
+ children: /* @__PURE__ */ _("mesh", {
101
+ geometry: C,
102
+ children: /* @__PURE__ */ _("meshStandardMaterial", {
103
+ color: 1843753,
104
+ roughness: .9,
105
+ flatShading: !0
106
+ })
107
+ })
108
+ }, e.slotId))
109
+ ] }) : n.islands.length > 0 ? /* @__PURE__ */ v(g, { children: [
110
+ n.islands.map((e) => {
111
+ let t = n.wheelColors.get(e.id), r = t ? void 0 : n.partPicks[e.id], a = t ?? (r ? b[r] : void 0);
112
+ if (t && n.wheelSource === "fleet12") return null;
113
+ let o = [
114
+ 0,
115
+ 0,
116
+ 0
117
+ ], s = [
118
+ 0,
119
+ 0,
120
+ 0
121
+ ], c = new f.Quaternion();
122
+ if (r && (n.hingeScrub > 0 || n.explodeAmount > 0)) {
123
+ let t = i(e, r);
124
+ s = t.anchor, n.hingeScrub > 0 && c.setFromAxisAngle(new f.Vector3(...t.axis).normalize(), t.openAngle * n.hingeScrub), n.explodeAmount > 0 && (o = [
125
+ t.explodeDir[0] * n.explodeAmount,
126
+ t.explodeDir[1] * n.explodeAmount,
127
+ t.explodeDir[2] * n.explodeAmount
128
+ ]);
129
+ } else t && n.explodeAmount > 0 && (o = [
130
+ Math.sign(e.center[0] || 1) * n.explodeAmount * .65,
131
+ 0,
132
+ 0
133
+ ]);
134
+ return /* @__PURE__ */ _("group", {
135
+ position: [
136
+ s[0] + o[0],
137
+ s[1] + o[1],
138
+ s[2] + o[2]
139
+ ],
140
+ quaternion: c,
141
+ children: /* @__PURE__ */ v("group", {
142
+ position: [
143
+ -s[0],
144
+ -s[1],
145
+ -s[2]
146
+ ],
147
+ children: [/* @__PURE__ */ _("mesh", {
148
+ geometry: e.geometry,
149
+ material: e.material,
150
+ onClick: (t) => {
151
+ t.delta > 5 || (n.surfaceMode === "island" ? (t.stopPropagation(), n.onClickIsland(e.id)) : n.surfaceMode !== "triangle" && k(t, e.id, !1));
152
+ },
153
+ onContextMenu: (t) => {
154
+ n.surfaceMode !== "island" && k(t, e.id, !1);
155
+ },
156
+ onPointerDown: (t) => {
157
+ n.surfaceMode === "triangle" && (t.button === 0 || t.button === 2) && (x.current = !0, k(t, e.id, !1));
158
+ },
159
+ onPointerMove: (t) => {
160
+ n.surfaceMode === "triangle" && x.current && k(t, e.id, !0);
161
+ }
162
+ }), a && /* @__PURE__ */ _("mesh", {
163
+ geometry: e.geometry,
164
+ raycast: () => null,
165
+ children: /* @__PURE__ */ _("meshBasicMaterial", {
166
+ color: a,
167
+ transparent: !0,
168
+ opacity: .38,
169
+ depthWrite: !1
170
+ })
171
+ })]
172
+ })
173
+ }, e.id);
174
+ }),
175
+ O.map((e) => /* @__PURE__ */ _("primitive", {
176
+ object: e.group,
177
+ position: [
178
+ e.pos[0] + Math.sign(e.pos[0] || 1) * n.explodeAmount * .65,
179
+ e.pos[1],
180
+ e.pos[2]
181
+ ]
182
+ }, e.key)),
183
+ T && /* @__PURE__ */ _("mesh", {
184
+ geometry: T,
185
+ raycast: () => null,
186
+ children: /* @__PURE__ */ _("meshBasicMaterial", {
187
+ color: n.activeRoleColor,
188
+ transparent: !0,
189
+ opacity: .62,
190
+ side: f.DoubleSide,
191
+ depthWrite: !1
192
+ })
193
+ }),
194
+ E && /* @__PURE__ */ _("mesh", {
195
+ geometry: E,
196
+ raycast: () => null,
197
+ children: /* @__PURE__ */ _("meshBasicMaterial", {
198
+ color: "#00E5FF",
199
+ transparent: !0,
200
+ opacity: .48,
201
+ side: f.DoubleSide,
202
+ depthWrite: !1
203
+ })
204
+ }),
205
+ n.loopDots?.points.map((e, t) => /* @__PURE__ */ v("mesh", {
206
+ position: [
207
+ e[0],
208
+ e[1],
209
+ e[2]
210
+ ],
211
+ raycast: () => null,
212
+ children: [/* @__PURE__ */ _("sphereGeometry", { args: [
213
+ .032,
214
+ 10,
215
+ 10
216
+ ] }), /* @__PURE__ */ _("meshBasicMaterial", {
217
+ color: t === 0 ? "#10B981" : "#FFB000",
218
+ depthTest: !1
219
+ })]
220
+ }, `dot_${t}`)),
221
+ D && D.length >= 2 && /* @__PURE__ */ _(h, {
222
+ points: D,
223
+ color: "#FFB000",
224
+ lineWidth: 2.5
225
+ })
226
+ ] }) : n.previewScene && /* @__PURE__ */ _("primitive", { object: n.previewScene }), /* @__PURE__ */ v("mesh", {
227
+ position: [
228
+ 0,
229
+ r.aabbSize[1] * .5 + r.minY,
230
+ 0
231
+ ],
232
+ raycast: () => null,
233
+ children: [/* @__PURE__ */ _("boxGeometry", { args: [
234
+ r.aabbSize[0],
235
+ r.aabbSize[1],
236
+ r.aabbSize[2]
237
+ ] }), /* @__PURE__ */ _("meshBasicMaterial", {
238
+ color: 58879,
239
+ wireframe: !0,
240
+ transparent: !0,
241
+ opacity: .28
242
+ })]
243
+ })]
244
+ }), /* @__PURE__ */ v("mesh", {
245
+ position: [
246
+ 0,
247
+ .01,
248
+ Math.max(2.6, r.aabbSize[2] * .6)
249
+ ],
250
+ rotation: [
251
+ -Math.PI * .5,
252
+ 0,
253
+ 0
254
+ ],
255
+ raycast: () => null,
256
+ children: [/* @__PURE__ */ _("coneGeometry", { args: [
257
+ .25,
258
+ .6,
259
+ 3
260
+ ] }), /* @__PURE__ */ _("meshBasicMaterial", {
261
+ color: 58879,
262
+ wireframe: !0
263
+ })]
264
+ })]
265
+ })
266
+ }), /* @__PURE__ */ _(t, {
267
+ cal: r,
268
+ islands: n.islands,
269
+ wheelColors: n.wheelColors,
270
+ partPicks: n.partPicks,
271
+ explodeAmount: n.explodeAmount,
272
+ onClickIsland: n.onClickIsland
273
+ })] });
274
+ }
275
+ export { x as Step1CalibrationPlinth, n as makeStarterDomainScene };
@@ -0,0 +1,244 @@
1
+ import { togglePropJoint as e } from "../engine/kolmoSurface.js";
2
+ import { createDefaultSignals as t } from "../schema/kolmoSchema.js";
3
+ import { KolmoEmitterRig as n } from "../shaders/plumeAndSparkle.js";
4
+ import { ImperativeVehicleRig as r } from "./ImperativeVehicleRig.js";
5
+ import { gateTelemetry as i, useGateStore as a } from "./gateStore.js";
6
+ import { buildPatchPreviewEmitters as o, createVehiclePanelAnimator as s } from "./vehiclePanelAnim.js";
7
+ import { useEffect as c, useMemo as l, useRef as u } from "react";
8
+ import * as d from "three";
9
+ import { useFrame as f } from "@react-three/fiber";
10
+ import { KhrAssembly as p, PhysicsWorld as m, cloneKhrBundle as h } from "@khr3/core";
11
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
12
+ import { CuboidCollider as v, RigidBody as y } from "@react-three/rapier";
13
+ import { KhrVehicle as b } from "@khr3/core/vehicle";
14
+ import { easing as x } from "maath";
15
+ // src/importer/Step2UniversalPad.tsx
16
+ var S = new d.Vector3(), C = new d.Vector3(0, 1, 0), w = new d.Vector3(), T = new d.Vector3(), E = new d.Vector3();
17
+ function D({ bundle: e, subArchetype: r, patches: p, stampActive: m, panelAnimRef: _, onStampSurface: v }) {
18
+ let y = u(null), D = a((e) => e.chaseCam), O = u(a.getState().dropTrigger), k = u({
19
+ w: !1,
20
+ s: !1,
21
+ a: !1,
22
+ d: !1,
23
+ space: !1,
24
+ shift: !1
25
+ }), A = u(new d.Vector3(0, 1, 4)), j = u({
26
+ ...t(),
27
+ throttle: 0,
28
+ boost: 0,
29
+ brake: 0,
30
+ headlight: 1,
31
+ always: 1
32
+ }), M = l(() => h(e), [e]), N = l(() => o(p), [p]), P = l(() => s(M), [M]);
33
+ return c(() => (_.current = P, () => {
34
+ _.current === P && (_.current = null);
35
+ }), [P, _]), c(() => {
36
+ i.massKg = M.totalDynamicMass, i.com = [...M.centerOfMass];
37
+ let e = (e) => (t) => {
38
+ (t.code === "KeyW" || t.code === "ArrowUp") && (k.current.w = e), (t.code === "KeyS" || t.code === "ArrowDown") && (k.current.s = e), (t.code === "KeyA" || t.code === "ArrowLeft") && (k.current.a = e), (t.code === "KeyD" || t.code === "ArrowRight") && (k.current.d = e), t.code === "Space" && (k.current.space = e), (t.code === "ShiftLeft" || t.code === "ShiftRight") && (k.current.shift = e);
39
+ }, t = e(!0), n = e(!1);
40
+ return window.addEventListener("keydown", t), window.addEventListener("keyup", n), () => {
41
+ window.removeEventListener("keydown", t), window.removeEventListener("keyup", n);
42
+ };
43
+ }, [M]), f((e, t) => {
44
+ let n = Math.min(Math.max(t, 1e-4), .05);
45
+ P.step(n);
46
+ let o = y.current;
47
+ if (!o?.body) return;
48
+ let s = a.getState().dropTrigger;
49
+ s !== O.current && (O.current = s, o.body.setTranslation({
50
+ x: 0,
51
+ y: 1.35,
52
+ z: 0
53
+ }, !0), o.body.setRotation({
54
+ x: 0,
55
+ y: 0,
56
+ z: 0,
57
+ w: 1
58
+ }, !0), o.body.setLinvel({
59
+ x: 0,
60
+ y: 0,
61
+ z: 0
62
+ }, !0), o.body.setAngvel({
63
+ x: 0,
64
+ y: 0,
65
+ z: 0
66
+ }, !0));
67
+ let c = k.current;
68
+ r === "starcraft" ? o.setMovement({
69
+ pitchForward: c.w,
70
+ pitchBackward: c.s,
71
+ yawLeft: c.a,
72
+ yawRight: c.d,
73
+ throttleUp: c.space
74
+ }) : (o.setMovement({
75
+ forward: c.w,
76
+ backward: c.s,
77
+ steerLeft: c.a,
78
+ steerRight: c.d,
79
+ brake: c.space
80
+ }), c.shift && c.w && o.body.applyImpulse(E.copy(o.bodyZAxis).multiplyScalar(o.body.mass() * 6.2 * n), !0));
81
+ let l = j.current;
82
+ l.throttle = +!!c.w, l.boost = c.w && c.shift ? 1 : 0, l.brake = c.space || c.s ? 1 : 0, i.speedKmh = o.currLinVel.length() * 3.6, i.rpm = Math.max(850, o.engineRPM), D && !m && (S.copy(o.bodyZAxis).projectOnPlane(C), S.lengthSq() < 1e-6 ? S.set(0, 0, 1) : S.normalize(), w.copy(o.currPos).addScaledVector(S, -6.8).addScaledVector(C, 2.25), T.copy(o.currPos).addScaledVector(S, 3.5).addScaledVector(C, .65), x.damp3(e.camera.position, w, .14, n), x.damp3(A.current, T, .08, n), e.camera.lookAt(A.current));
83
+ }), /* @__PURE__ */ g("group", {
84
+ onClick: (e) => {
85
+ m ? v(e) : e.delta <= 5 && P.toggleHitObject(e.object) && e.stopPropagation();
86
+ },
87
+ children: /* @__PURE__ */ g(b, {
88
+ ref: y,
89
+ bundle: M,
90
+ position: [
91
+ 0,
92
+ r === "starcraft" ? 1.4 : .35,
93
+ 0
94
+ ],
95
+ children: /* @__PURE__ */ g(n, {
96
+ emitters: N,
97
+ signalsRef: j
98
+ })
99
+ })
100
+ });
101
+ }
102
+ function O({ bundle: r, domain: s, staticProp: d, patches: f, onStampSurface: m }) {
103
+ let v = u(null), y = u(!1), b = a((e) => e.dropTrigger), x = u({
104
+ ...t(),
105
+ throttle: .9,
106
+ boost: 1,
107
+ brake: 1,
108
+ headlight: 1,
109
+ fire: 1,
110
+ always: 1
111
+ }), S = l(() => h(r), [r, b]), C = l(() => o(f), [f]), w = s === "c12" || s === "prop" && d;
112
+ return c(() => {
113
+ i.massKg = S.totalDynamicMass, i.com = [...S.centerOfMass], i.speedKmh = 0;
114
+ }, [S]), /* @__PURE__ */ _("group", {
115
+ onClick: (t) => {
116
+ m(t), y.current = e(v.current, S, y.current);
117
+ },
118
+ children: [/* @__PURE__ */ g(p, {
119
+ ref: v,
120
+ bundle: S,
121
+ position: [
122
+ 0,
123
+ w ? 0 : 1.2,
124
+ 0
125
+ ],
126
+ fixedRoot: w
127
+ }, `asm_${b}`), /* @__PURE__ */ g(n, {
128
+ emitters: C,
129
+ signalsRef: x
130
+ })]
131
+ });
132
+ }
133
+ function k({ assembly: e, importedRoot: t, rootObjRef: n, liveBundle: i, patches: o, stampActive: s, panelAnimRef: c, onStampSurface: l }) {
134
+ let u = a((e) => e.domain), d = a((e) => e.vehicleArchetype), f = a((e) => e.usePaperShellProxy), p = a((e) => e.staticProp);
135
+ return /* @__PURE__ */ _(m, {
136
+ gravity: [
137
+ 0,
138
+ -9.81,
139
+ 0
140
+ ],
141
+ children: [
142
+ /* @__PURE__ */ g(y, {
143
+ type: "fixed",
144
+ position: [
145
+ 0,
146
+ -.25,
147
+ 0
148
+ ],
149
+ colliders: !1,
150
+ children: /* @__PURE__ */ g(v, {
151
+ args: [
152
+ 180,
153
+ .25,
154
+ 180
155
+ ],
156
+ friction: .92
157
+ })
158
+ }),
159
+ /* @__PURE__ */ _("mesh", {
160
+ rotation: [
161
+ -Math.PI * .5,
162
+ 0,
163
+ 0
164
+ ],
165
+ position: [
166
+ 0,
167
+ -.004,
168
+ 0
169
+ ],
170
+ receiveShadow: !0,
171
+ children: [/* @__PURE__ */ g("planeGeometry", { args: [360, 360] }), /* @__PURE__ */ g("meshStandardMaterial", {
172
+ color: "#11161d",
173
+ roughness: .95
174
+ })]
175
+ }),
176
+ /* @__PURE__ */ g(y, {
177
+ type: "fixed",
178
+ position: [
179
+ 0,
180
+ .36,
181
+ 18
182
+ ],
183
+ rotation: [
184
+ -.19,
185
+ 0,
186
+ 0
187
+ ],
188
+ colliders: "cuboid",
189
+ children: /* @__PURE__ */ _("mesh", { children: [/* @__PURE__ */ g("boxGeometry", { args: [
190
+ 4.4,
191
+ .22,
192
+ 6.2
193
+ ] }), /* @__PURE__ */ g("meshStandardMaterial", {
194
+ color: "#f59e0b",
195
+ roughness: .75,
196
+ flatShading: !0
197
+ })] })
198
+ }),
199
+ [-12, 12].flatMap((e) => [
200
+ -24,
201
+ -12,
202
+ 0,
203
+ 12,
204
+ 24,
205
+ 36,
206
+ 48
207
+ ].map((t) => /* @__PURE__ */ _("mesh", {
208
+ position: [
209
+ e,
210
+ .35,
211
+ t
212
+ ],
213
+ children: [/* @__PURE__ */ g("coneGeometry", { args: [
214
+ .28,
215
+ .7,
216
+ 8
217
+ ] }), /* @__PURE__ */ g("meshStandardMaterial", {
218
+ color: "#ff5a1f",
219
+ roughness: .6,
220
+ flatShading: !0
221
+ })]
222
+ }, `cone_${e}_${t}`))),
223
+ u === "vehicle" && f ? /* @__PURE__ */ g(r, {
224
+ assembly: e,
225
+ importedRoot: t,
226
+ chassisGroupRef: n
227
+ }) : i ? u === "vehicle" ? /* @__PURE__ */ g(D, {
228
+ bundle: i,
229
+ subArchetype: d,
230
+ patches: o,
231
+ stampActive: s,
232
+ panelAnimRef: c,
233
+ onStampSurface: l
234
+ }) : /* @__PURE__ */ g(O, {
235
+ bundle: i,
236
+ domain: u,
237
+ staticProp: p,
238
+ patches: o,
239
+ onStampSurface: l
240
+ }) : null
241
+ ]
242
+ });
243
+ }
244
+ export { k as Step2UniversalPad };
@@ -0,0 +1,91 @@
1
+ import { gateTelemetry as e } from "./gateStore.js";
2
+ import { useEffect as t, useMemo as n, useRef as r } from "react";
3
+ import * as i from "three";
4
+ import { useFrame as a } from "@react-three/fiber";
5
+ import { jsx as o } from "react/jsx-runtime";
6
+ // src/importer/VfxEmitterPool.tsx
7
+ var s = 256, c = new i.Vector3(), l = new i.Vector3(), u = new i.Vector3(), d = new i.Quaternion(), f = new i.Matrix4(), p = new i.Color();
8
+ function m({ chassisObjRef: m, emitters: h }) {
9
+ let g = r(null), _ = r(0), v = r(0), y = n(() => {
10
+ let e = new Float32Array(s * 3), t = new Float32Array(s * 3), n = new Float32Array(s), r = new Float32Array(s), i = new Float32Array(s * 2), a = new Float32Array(s * 3), o = new Float32Array(s * 3);
11
+ return n.fill(999), r.fill(1), {
12
+ pos: e,
13
+ vel: t,
14
+ age: n,
15
+ life: r,
16
+ sizeStartEnd: i,
17
+ colorStart: a,
18
+ colorEnd: o
19
+ };
20
+ }, []), b = n(() => new i.PlaneGeometry(1, 1), []), x = n(() => new i.MeshBasicMaterial({
21
+ color: 16777215,
22
+ side: i.DoubleSide,
23
+ transparent: !0,
24
+ opacity: .85,
25
+ depthWrite: !1
26
+ }), []);
27
+ t(() => () => {
28
+ b.dispose(), x.dispose();
29
+ }, [b, x]), t(() => {
30
+ let e = g.current;
31
+ if (e) {
32
+ f.makeScale(0, 0, 0), p.setRGB(1, 1, 1);
33
+ for (let t = 0; t < s; t++) e.setMatrixAt(t, f), e.setColorAt(t, p);
34
+ e.instanceMatrix.needsUpdate = !0, e.instanceColor && (e.instanceColor.needsUpdate = !0);
35
+ }
36
+ }, []);
37
+ let S = (e, t, n, r, i, a, o, s, c, l, u, d, f, p) => {
38
+ let m = _.current;
39
+ _.current = m + 1 & 255;
40
+ let h = m * 3, g = m * 2;
41
+ y.pos[h] = e, y.pos[h + 1] = t, y.pos[h + 2] = n;
42
+ let v = o + Math.random() * (s - o);
43
+ y.vel[h] = (r + (Math.random() - .5) * c) * v, y.vel[h + 1] = (i + (Math.random() - .5) * c) * v + .35, y.vel[h + 2] = (a + (Math.random() - .5) * c) * v, y.age[m] = 0, y.life[m] = Math.max(.05, d), y.sizeStartEnd[g] = l, y.sizeStartEnd[g + 1] = u, y.colorStart[h] = f[0], y.colorStart[h + 1] = f[1], y.colorStart[h + 2] = f[2], y.colorEnd[h] = p[0], y.colorEnd[h + 1] = p[1], y.colorEnd[h + 2] = p[2];
44
+ };
45
+ return a((t, n) => {
46
+ let r = g.current;
47
+ if (!r) return;
48
+ let i = Math.min(.05, n), a = m.current;
49
+ a ? (a.getWorldPosition(c), a.getWorldQuaternion(d)) : (c.set(0, 0, 0), d.identity());
50
+ let o = h[0];
51
+ if (o) {
52
+ let t = Math.max(.15, Math.min(1, e.rpm / 6500));
53
+ for (v.current += o.desc.rateHz * t * i; v.current >= 1;) {
54
+ --v.current, l.set(o.position[0], o.position[1], o.position[2]).applyQuaternion(d).add(c), u.set(0, 0, -1).applyQuaternion(d);
55
+ let e = o.desc;
56
+ S(l.x, l.y, l.z, u.x, u.y, u.z, e.speedMinMax[0], e.speedMinMax[1], e.coneOuterAngle, e.sizeStartEnd[0], e.sizeStartEnd[1], e.lifetimeSec, e.colorStart, e.colorEnd);
57
+ }
58
+ }
59
+ let _ = e.sparkBurst;
60
+ if (_ && h[1]) {
61
+ e.sparkBurst = null;
62
+ let t = h[1].desc;
63
+ u.set(0, 0, -1).applyQuaternion(d);
64
+ for (let e = 0; e < 18; e++) S(_[0], _[1], _[2], u.x, u.y + .4, u.z, t.speedMinMax[0], t.speedMinMax[1], t.coneOuterAngle, t.sizeStartEnd[0], t.sizeStartEnd[1], t.lifetimeSec, t.colorStart, t.colorEnd);
65
+ }
66
+ let b = t.camera.quaternion;
67
+ for (let e = 0; e < s; e++) {
68
+ let t = y.age[e], n = y.life[e];
69
+ if (t >= n) {
70
+ f.makeScale(0, 0, 0), r.setMatrixAt(e, f);
71
+ continue;
72
+ }
73
+ let a = t + i;
74
+ y.age[e] = a;
75
+ let o = Math.min(1, a / n), s = e * 3, c = e * 2;
76
+ y.pos[s] += y.vel[s] * i, y.pos[s + 1] += y.vel[s + 1] * i, y.pos[s + 2] += y.vel[s + 2] * i;
77
+ let d = y.sizeStartEnd[c] + (y.sizeStartEnd[c + 1] - y.sizeStartEnd[c]) * o;
78
+ l.set(y.pos[s], y.pos[s + 1], y.pos[s + 2]), u.set(d, d, d), f.compose(l, b, u), r.setMatrixAt(e, f), p.setRGB(y.colorStart[s] + (y.colorEnd[s] - y.colorStart[s]) * o, y.colorStart[s + 1] + (y.colorEnd[s + 1] - y.colorStart[s + 1]) * o, y.colorStart[s + 2] + (y.colorEnd[s + 2] - y.colorStart[s + 2]) * o), r.setColorAt(e, p);
79
+ }
80
+ r.instanceMatrix.needsUpdate = !0, r.instanceColor && (r.instanceColor.needsUpdate = !0);
81
+ }), /* @__PURE__ */ o("instancedMesh", {
82
+ ref: g,
83
+ args: [
84
+ b,
85
+ x,
86
+ s
87
+ ],
88
+ frustumCulled: !1
89
+ });
90
+ }
91
+ export { m as VfxEmitterPool };
@@ -1,9 +1,10 @@
1
1
  import type { ThreeEvent } from "@react-three/fiber";
2
2
  import * as THREE from "three";
3
- import type { KolmoAuthoredNodePatch } from "../schema/kolmoSchema.js";
3
+ import { type KolmoAuthoredNodePatch } from "../schema/kolmoSchema.js";
4
4
  import type { StampToolId } from "./GateHudBar.js";
5
5
  import { type MeshIsland, type WheelAxle } from "./meshIslands.js";
6
6
  import { type ActiveChopRole, type ChopPartRole, type CutVec3, type FaceSelection } from "./surfaceCutter.js";
7
+ import type { CutPartMcpRequest } from "./importerWebMcp.js";
7
8
  export declare function executeCloseLoop(params: {
8
9
  readonly workingScene: THREE.Object3D;
9
10
  readonly islands: readonly MeshIsland[];
@@ -34,7 +35,7 @@ export declare function executePeelTransaction(params: {
34
35
  readonly cutName: string;
35
36
  readonly prevAxles: readonly WheelAxle[];
36
37
  readonly prevPicks: Readonly<Record<number, ChopPartRole>>;
37
- readonly mode: "car" | "motorcycle";
38
+ readonly mode: "car";
38
39
  }): PeelTransactionResult;
39
40
  export declare function buildSurfaceStampPatch(e: ThreeEvent<MouseEvent>, stampTool: StampToolId, index: number): KolmoAuthoredNodePatch | null;
40
41
  export declare function parseIngestedAssetFile(file: File): Promise<{
@@ -42,3 +43,22 @@ export declare function parseIngestedAssetFile(file: File): Promise<{
42
43
  scene: THREE.Group;
43
44
  usdInfo: string | null;
44
45
  }>;
46
+ export declare function putAuthenticatedVaultGlb(category: string, assetName: string, glbBytes: Uint8Array, token: string, baseUrl?: string): Promise<{
47
+ key: string;
48
+ url: string;
49
+ }>;
50
+ export declare function executeCutPartMcp(params: {
51
+ readonly req: CutPartMcpRequest;
52
+ readonly workingScene: THREE.Object3D | null;
53
+ readonly islands: readonly MeshIsland[];
54
+ readonly creaseDeg: number;
55
+ readonly mirrorX: boolean;
56
+ readonly onPeel: (sel: FaceSelection, role: ActiveChopRole) => {
57
+ status: string;
58
+ } | null;
59
+ readonly onBucket: (islandId: number, role: ActiveChopRole) => void;
60
+ }): {
61
+ ok: boolean;
62
+ status: string;
63
+ };
64
+ export declare function downloadBlobGlb(assetName: string, glbBytes: Uint8Array): void;