@pinkaphant/kolmo 0.2.3 → 0.3.0
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/bin/kolmo.mjs +1 -1
- package/dist/engine/kolmoActor.js +125 -83
- package/dist/engine/kolmoLongDrive.js +136 -91
- package/dist/engine/kolmoStore.d.ts +6 -5
- package/dist/engine/kolmoStore.js +115 -79
- package/dist/engine/kolmoVehicle.d.ts +1 -1
- package/dist/engine/kolmoVehicle.js +160 -147
- package/dist/engine/kolmoVehicleDriver.d.ts +12 -4
- package/dist/engine/kolmoVehicleDriver.js +40 -20
- package/dist/engine/kolmoWorld.js +55 -35
- package/dist/importer/CabinPreviewRig.d.ts +13 -0
- package/dist/importer/CabinPreviewRig.js +138 -0
- package/dist/importer/CabinStepSection.d.ts +17 -0
- package/dist/importer/CabinStepSection.js +222 -0
- package/dist/importer/ChopShopPanel.d.ts +31 -1
- package/dist/importer/ChopShopPanel.js +474 -380
- package/dist/importer/GateHudBar.d.ts +3 -0
- package/dist/importer/GateHudBar.js +8 -2
- package/dist/importer/GlbImportGate.js +183 -147
- package/dist/importer/ImporterPlinthUikitTags.d.ts +2 -1
- package/dist/importer/ImporterPlinthUikitTags.js +23 -16
- package/dist/importer/Step1CalibrationPlinth.d.ts +10 -0
- package/dist/importer/Step1CalibrationPlinth.js +203 -141
- package/dist/importer/Step2UniversalPad.d.ts +8 -1
- package/dist/importer/Step2UniversalPad.js +112 -90
- package/dist/importer/cabinMeshBuilders.d.ts +13 -0
- package/dist/importer/cabinMeshBuilders.js +104 -0
- package/dist/importer/cabinMixamoRig.d.ts +53 -0
- package/dist/importer/cabinMixamoRig.js +150 -0
- package/dist/importer/chopShopActions.d.ts +6 -0
- package/dist/importer/chopShopActions.js +86 -61
- package/dist/importer/chopShopUiComponents.d.ts +22 -0
- package/dist/importer/chopShopUiComponents.js +91 -0
- package/dist/importer/gateStore.d.ts +5 -2
- package/dist/importer/gateStore.js +13 -10
- package/dist/importer/glbNormalizer.d.ts +10 -1
- package/dist/importer/glbNormalizer.js +114 -49
- package/dist/importer/importerWebMcp.js +4 -1
- package/dist/importer/index.d.ts +4 -2
- package/dist/importer/index.js +24 -21
- package/dist/importer/khrCompiler.d.ts +20 -1
- package/dist/importer/khrCompiler.js +539 -290
- package/dist/importer/launcherBake.js +12 -8
- package/dist/importer/meshIslands.d.ts +4 -0
- package/dist/importer/meshIslands.js +104 -99
- package/dist/importer/surfaceCutter.d.ts +12 -3
- package/dist/importer/surfaceCutter.js +220 -127
- package/dist/importer/surfaceTopology.d.ts +13 -2
- package/dist/importer/surfaceTopology.js +57 -29
- package/dist/importer/universalGateBake.d.ts +7 -1
- package/dist/importer/universalGateBake.js +63 -60
- package/dist/importer/usdToGlb.js +19 -7
- package/dist/importer/useChopShopController.d.ts +27 -1
- package/dist/importer/useChopShopController.js +369 -255
- package/dist/importer/wheelAxlePairing.d.ts +3 -1
- package/dist/importer/wheelAxlePairing.js +82 -33
- package/dist/index.js +31 -28
- package/dist/junk/ShardPieces.js +3 -3
- package/dist/physics/index.d.ts +7 -0
- package/dist/physics/index.js +66 -40
- package/package.json +1 -1
|
@@ -15,13 +15,18 @@ export declare function executeCloseLoop(params: {
|
|
|
15
15
|
readonly splitCoarse: boolean;
|
|
16
16
|
readonly mirrorX: boolean;
|
|
17
17
|
readonly axles: readonly WheelAxle[];
|
|
18
|
+
readonly propellerIds?: readonly number[];
|
|
19
|
+
readonly prevPicks?: Readonly<Record<number, ChopPartRole>>;
|
|
18
20
|
}): {
|
|
19
21
|
selection: FaceSelection;
|
|
20
22
|
refinedUndo?: () => void;
|
|
21
23
|
nextAxles?: WheelAxle[];
|
|
24
|
+
nextPropellers?: number[];
|
|
25
|
+
nextPicks?: Record<number, ChopPartRole>;
|
|
22
26
|
};
|
|
23
27
|
export interface PeelTransactionResult {
|
|
24
28
|
readonly nextAxles: WheelAxle[];
|
|
29
|
+
readonly nextPropellers: number[];
|
|
25
30
|
readonly nextPicks: Record<number, ChopPartRole>;
|
|
26
31
|
readonly undo: () => void;
|
|
27
32
|
readonly status: string;
|
|
@@ -34,6 +39,7 @@ export declare function executePeelTransaction(params: {
|
|
|
34
39
|
readonly activeRole: ActiveChopRole;
|
|
35
40
|
readonly cutName: string;
|
|
36
41
|
readonly prevAxles: readonly WheelAxle[];
|
|
42
|
+
readonly prevPropellers?: readonly number[];
|
|
37
43
|
readonly prevPicks: Readonly<Record<number, ChopPartRole>>;
|
|
38
44
|
readonly mode: "car";
|
|
39
45
|
}): PeelTransactionResult;
|
|
@@ -2,76 +2,101 @@ import { inferKolmoSocketRole as e } from "../schema/kolmoSchema.js";
|
|
|
2
2
|
import { normalToMinusZQuaternion as t } from "./vehiclePanelAnim.js";
|
|
3
3
|
import { toggleIslandSelection as n } from "./wheelAxlePairing.js";
|
|
4
4
|
import { convertUsdToGlb as r, isUsdFileName as i } from "./usdToGlb.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
5
|
+
import { countSelectionFaces as a } from "./surfaceTopology.js";
|
|
6
|
+
import { extractMeshIslands as o } from "./meshIslands.js";
|
|
7
|
+
import { peelFaceSelection as s, refineMeshAlongLoop as c, remapIslandIds as l, selectFacesByClick as u, selectFacesByLoop as d } from "./surfaceCutter.js";
|
|
8
|
+
import * as f from "three";
|
|
9
|
+
import { GLTFLoader as p } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
10
|
+
import { createAssetVault as m, normalizeVaultKey as h } from "@khr3/assets";
|
|
10
11
|
// src/importer/chopShopActions.ts
|
|
11
|
-
function
|
|
12
|
+
function g(e) {
|
|
12
13
|
let t = e.islands.find((t) => t.id === e.loopDots.islandId);
|
|
13
14
|
if (!t) throw Error("Loop island no longer exists.");
|
|
14
|
-
let n, r;
|
|
15
|
+
let n, r, i, a, s = e.islands, u = [];
|
|
15
16
|
if (e.splitCoarse) {
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
let
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
let d = t.mesh, f = d.geometry;
|
|
18
|
+
d.geometry = c(f, e.loopDots.points).geometry;
|
|
19
|
+
let p = o(e.workingScene), m = l(e.islands, p), h = (e) => e.flatMap((e) => {
|
|
20
|
+
let t = m.get(e);
|
|
21
|
+
return t == null ? [] : [t];
|
|
22
|
+
});
|
|
23
|
+
if (n = () => {
|
|
24
|
+
d.geometry = f;
|
|
21
25
|
}, r = e.axles.map((e) => ({
|
|
22
|
-
left: e.left
|
|
23
|
-
right: e.right
|
|
26
|
+
left: h(e.left),
|
|
27
|
+
right: h(e.right),
|
|
24
28
|
steered: e.steered,
|
|
25
29
|
driven: e.driven,
|
|
26
30
|
brake: e.brake
|
|
27
|
-
}))
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
})).filter((e) => e.left.length > 0 || e.right.length > 0), i = h(e.propellerIds ?? []), e.prevPicks) {
|
|
32
|
+
a = {};
|
|
33
|
+
for (let [t, n] of Object.entries(e.prevPicks)) {
|
|
34
|
+
let e = m.get(Number(t));
|
|
35
|
+
e != null && (a[e] = n);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
let g = e.loopDots.points[0];
|
|
39
|
+
if (t = p.find((e) => e.mesh === d && g.every((t, n) => t >= e.min[n] - .01 && t <= e.max[n] + .01)) ?? p[0], s = p, u = p, !t) {
|
|
40
|
+
for (let e of p) e.geometry.dispose();
|
|
41
|
+
throw Error("Refined surface lost seam anchor.");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
return {
|
|
46
|
+
selection: d(t, e.loopDots.points, {
|
|
47
|
+
mirrorX: e.mirrorX,
|
|
48
|
+
exact: e.splitCoarse,
|
|
49
|
+
allIslands: s
|
|
50
|
+
}),
|
|
51
|
+
refinedUndo: n,
|
|
52
|
+
nextAxles: r,
|
|
53
|
+
nextPropellers: i,
|
|
54
|
+
nextPicks: a
|
|
55
|
+
};
|
|
56
|
+
} finally {
|
|
57
|
+
for (let e of u) e.geometry.dispose();
|
|
32
58
|
}
|
|
33
|
-
return {
|
|
34
|
-
selection: u(t, e.loopDots.points, {
|
|
35
|
-
mirrorX: e.mirrorX,
|
|
36
|
-
exact: e.splitCoarse
|
|
37
|
-
}),
|
|
38
|
-
refinedUndo: n,
|
|
39
|
-
nextAxles: r
|
|
40
|
-
};
|
|
41
59
|
}
|
|
42
|
-
function
|
|
43
|
-
let t =
|
|
44
|
-
if (
|
|
45
|
-
let { mintedMeshes: r, undo: i } =
|
|
60
|
+
function _(e) {
|
|
61
|
+
let t = a(e.faceSelection);
|
|
62
|
+
if (t.primary + t.mirrored === 0) throw Error("No faces selected to peel.");
|
|
63
|
+
let { mintedMeshes: r, undo: i } = s(e.islands, e.faceSelection, e.cutName, e.workingScene), c = o(e.workingScene), u = l(e.islands, c), d = (e) => e.flatMap((e) => u.get(e) ?? []), f = e.prevAxles.map((e) => ({
|
|
46
64
|
...e,
|
|
47
|
-
left:
|
|
48
|
-
right:
|
|
49
|
-
})).filter((e) => e.left.length > 0 || e.right.length > 0),
|
|
65
|
+
left: d(e.left),
|
|
66
|
+
right: d(e.right)
|
|
67
|
+
})).filter((e) => e.left.length > 0 || e.right.length > 0), p = new Set(d(e.prevPropellers ?? [])), m = {};
|
|
50
68
|
for (let [t, n] of Object.entries(e.prevPicks)) {
|
|
51
|
-
let e =
|
|
52
|
-
e != null && (
|
|
69
|
+
let e = u.get(Number(t));
|
|
70
|
+
e != null && (m[e] = n);
|
|
53
71
|
}
|
|
54
|
-
let
|
|
72
|
+
let h = new Set(r), g = c.filter((e) => h.has(e.mesh)).map((e) => e.id), _, v = !1;
|
|
55
73
|
if (e.activeRole === "wheel") {
|
|
56
|
-
for (let t of
|
|
57
|
-
|
|
74
|
+
for (let t of g) f.some((e) => e.left.includes(t) || e.right.includes(t)) || (f = n(c, f, t, e.mode, !1));
|
|
75
|
+
_ = `Peeled ${g.length} wheel mesh(es) and paired axle!`;
|
|
76
|
+
} else if (e.activeRole === "propeller") {
|
|
77
|
+
for (let e of g) p.add(e);
|
|
78
|
+
_ = `Peeled ${t.primary + t.mirrored} faces → ${g.length} propeller rotor(s)!`;
|
|
79
|
+
} else if (e.activeRole === "glass") {
|
|
80
|
+
for (let e of g) m[e] = "glass";
|
|
81
|
+
_ = `Peeled ${t.primary + t.mirrored} faces → tinted GLASS window!`;
|
|
58
82
|
} else {
|
|
59
|
-
for (let t of
|
|
60
|
-
|
|
83
|
+
for (let t of g) m[t] = e.activeRole;
|
|
84
|
+
v = !0, _ = `Peeled ${t.primary + t.mirrored} faces → hinged ${e.activeRole.toUpperCase()}!`;
|
|
61
85
|
}
|
|
62
|
-
for (let e of
|
|
86
|
+
for (let e of c) e.geometry.dispose();
|
|
63
87
|
return {
|
|
64
|
-
nextAxles:
|
|
65
|
-
|
|
88
|
+
nextAxles: f,
|
|
89
|
+
nextPropellers: [...p],
|
|
90
|
+
nextPicks: m,
|
|
66
91
|
undo: i,
|
|
67
|
-
status:
|
|
68
|
-
bumpHinge:
|
|
92
|
+
status: _,
|
|
93
|
+
bumpHinge: v
|
|
69
94
|
};
|
|
70
95
|
}
|
|
71
|
-
function
|
|
96
|
+
function v(n, r, i) {
|
|
72
97
|
if (r === "none" || n.delta > 5) return null;
|
|
73
98
|
n.stopPropagation();
|
|
74
|
-
let a = n.face ? n.face.normal.clone().transformDirection(n.object.matrixWorld).normalize() : new
|
|
99
|
+
let a = n.face ? n.face.normal.clone().transformDirection(n.object.matrixWorld).normalize() : new f.Vector3(0, 1, 0), o = n.point.clone().addScaledVector(a, .015), s = [
|
|
75
100
|
Number(o.x.toFixed(4)),
|
|
76
101
|
Number(o.y.toFixed(4)),
|
|
77
102
|
Number(o.z.toFixed(4))
|
|
@@ -143,7 +168,7 @@ function _(n, r, i) {
|
|
|
143
168
|
extension: { socket: e(u, r) }
|
|
144
169
|
};
|
|
145
170
|
}
|
|
146
|
-
async function
|
|
171
|
+
async function y(e) {
|
|
147
172
|
let t = await e.arrayBuffer(), n = e.name.replace(/\.[^.]+$/, "") || "ImportedCar";
|
|
148
173
|
if (i(e.name)) {
|
|
149
174
|
let e = await r(t);
|
|
@@ -155,12 +180,12 @@ async function v(e) {
|
|
|
155
180
|
}
|
|
156
181
|
return {
|
|
157
182
|
baseName: n,
|
|
158
|
-
scene: await new Promise((e, n) => new
|
|
183
|
+
scene: await new Promise((e, n) => new p().parse(t, "", (t) => e(t.scene), n)),
|
|
159
184
|
usdInfo: null
|
|
160
185
|
};
|
|
161
186
|
}
|
|
162
|
-
async function
|
|
163
|
-
let a =
|
|
187
|
+
async function b(e, t, n, r, i) {
|
|
188
|
+
let a = m(i), o = t.toLowerCase().replace(/[^a-z0-9_-]+/g, "_").replace(/^_+|_+$/g, "") || "asset", s = h(`${e.replace(/^\/+|\/+$/g, "")}/${o}.glb`), c = r.trim(), l = { "Content-Type": "model/gltf-binary" };
|
|
164
189
|
c && (l.Authorization = `Bearer ${c}`);
|
|
165
190
|
let u = await fetch(`${a.baseUrl}/admin/assets/${s}`, {
|
|
166
191
|
method: "PUT",
|
|
@@ -174,20 +199,20 @@ async function y(e, t, n, r, i) {
|
|
|
174
199
|
url: a.url(s)
|
|
175
200
|
};
|
|
176
201
|
}
|
|
177
|
-
function
|
|
202
|
+
function x(e) {
|
|
178
203
|
let { req: t, workingScene: n, islands: r, creaseDeg: i, mirrorX: a, onPeel: o, onBucket: s } = e;
|
|
179
204
|
if (!n || r.length === 0) return {
|
|
180
205
|
ok: !1,
|
|
181
206
|
status: "No mesh islands available to cut."
|
|
182
207
|
};
|
|
183
|
-
let c = r.reduce((e, t) => t.triangleIndices.length > e.triangleIndices.length ? t : e, r[0]),
|
|
184
|
-
if (!
|
|
208
|
+
let c = r.reduce((e, t) => t.triangleIndices.length > e.triangleIndices.length ? t : e, r[0]), l = t.islandId === void 0 ? c : r.find((e) => e.id === t.islandId);
|
|
209
|
+
if (!l) return {
|
|
185
210
|
ok: !1,
|
|
186
211
|
status: `Island ${t.islandId} not found.`
|
|
187
212
|
};
|
|
188
213
|
try {
|
|
189
214
|
if (t.loopPoints && t.loopPoints.length >= 3) {
|
|
190
|
-
let e = o(
|
|
215
|
+
let e = o(d(l, t.loopPoints, {
|
|
191
216
|
mirrorX: t.mirrorX ?? a,
|
|
192
217
|
exact: !1
|
|
193
218
|
}), t.role);
|
|
@@ -200,7 +225,7 @@ function b(e) {
|
|
|
200
225
|
};
|
|
201
226
|
}
|
|
202
227
|
if (t.faceIndex !== void 0) {
|
|
203
|
-
let e = o(l
|
|
228
|
+
let e = o(u(l, t.faceIndex, "crease", {
|
|
204
229
|
creaseDeg: t.creaseDeg ?? i,
|
|
205
230
|
mirrorX: t.mirrorX ?? a,
|
|
206
231
|
current: null,
|
|
@@ -214,9 +239,9 @@ function b(e) {
|
|
|
214
239
|
status: "Face selection empty."
|
|
215
240
|
};
|
|
216
241
|
}
|
|
217
|
-
return s(
|
|
242
|
+
return s(l.id, t.role), {
|
|
218
243
|
ok: !0,
|
|
219
|
-
status: `Tagged island ${
|
|
244
|
+
status: `Tagged island ${l.id} as ${t.role}.`
|
|
220
245
|
};
|
|
221
246
|
} catch (e) {
|
|
222
247
|
return {
|
|
@@ -225,8 +250,8 @@ function b(e) {
|
|
|
225
250
|
};
|
|
226
251
|
}
|
|
227
252
|
}
|
|
228
|
-
function
|
|
253
|
+
function S(e, t) {
|
|
229
254
|
let n = URL.createObjectURL(new Blob([t], { type: "model/gltf-binary" })), r = document.createElement("a");
|
|
230
255
|
r.href = n, r.download = `${e}_khr3.glb`, r.click(), URL.revokeObjectURL(n);
|
|
231
256
|
}
|
|
232
|
-
export {
|
|
257
|
+
export { v as buildSurfaceStampPatch, S as downloadBlobGlb, g as executeCloseLoop, x as executeCutPartMcp, _ as executePeelTransaction, y as parseIngestedAssetFile, b as putAuthenticatedVaultGlb };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare const S_PANEL: React.CSSProperties;
|
|
3
|
+
export declare const S_SEC: React.CSSProperties;
|
|
4
|
+
export declare const S_SEL: React.CSSProperties;
|
|
5
|
+
export declare function PillBtn({ label, active, disabled, color, center, onClick, }: {
|
|
6
|
+
readonly label: string;
|
|
7
|
+
readonly active?: boolean;
|
|
8
|
+
readonly disabled?: boolean;
|
|
9
|
+
readonly color?: string;
|
|
10
|
+
readonly center?: boolean;
|
|
11
|
+
readonly onClick: () => void;
|
|
12
|
+
}): React.JSX.Element;
|
|
13
|
+
export declare function SliderRow({ label, value, min, max, step, display, accent, onChange, }: {
|
|
14
|
+
readonly label: string;
|
|
15
|
+
readonly value: number;
|
|
16
|
+
readonly min: number;
|
|
17
|
+
readonly max: number;
|
|
18
|
+
readonly step: number;
|
|
19
|
+
readonly display: string;
|
|
20
|
+
readonly accent?: string;
|
|
21
|
+
readonly onChange: (v: number) => void;
|
|
22
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
3
|
+
// src/importer/chopShopUiComponents.tsx
|
|
4
|
+
var n = {
|
|
5
|
+
position: "absolute",
|
|
6
|
+
top: 52,
|
|
7
|
+
right: 10,
|
|
8
|
+
bottom: 48,
|
|
9
|
+
width: 320,
|
|
10
|
+
display: "flex",
|
|
11
|
+
flexDirection: "column",
|
|
12
|
+
gap: 7,
|
|
13
|
+
padding: "9px 10px",
|
|
14
|
+
background: "rgba(10, 13, 18, 0.94)",
|
|
15
|
+
border: "1px solid #1C2632",
|
|
16
|
+
borderRadius: 6,
|
|
17
|
+
fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
18
|
+
color: "#E6EDF3",
|
|
19
|
+
overflowY: "auto",
|
|
20
|
+
zIndex: 18,
|
|
21
|
+
backdropFilter: "blur(6px)"
|
|
22
|
+
}, r = {
|
|
23
|
+
border: "1px solid #1E293B",
|
|
24
|
+
borderRadius: 4,
|
|
25
|
+
padding: "7px 8px",
|
|
26
|
+
display: "grid",
|
|
27
|
+
gap: 5
|
|
28
|
+
}, i = {
|
|
29
|
+
background: "#0F151E",
|
|
30
|
+
color: "#E2E8F0",
|
|
31
|
+
border: "1px solid #2B3A4E",
|
|
32
|
+
borderRadius: 3,
|
|
33
|
+
fontSize: 10,
|
|
34
|
+
fontFamily: "inherit",
|
|
35
|
+
padding: "3px 5px"
|
|
36
|
+
};
|
|
37
|
+
function a({ label: t, active: n = !1, disabled: r = !1, color: i = "#FFB000", center: a = !1, onClick: o }) {
|
|
38
|
+
return /* @__PURE__ */ e("button", {
|
|
39
|
+
type: "button",
|
|
40
|
+
disabled: r,
|
|
41
|
+
onClick: o,
|
|
42
|
+
style: {
|
|
43
|
+
padding: "5px 7px",
|
|
44
|
+
borderRadius: 3,
|
|
45
|
+
fontSize: 10.5,
|
|
46
|
+
fontWeight: n ? 700 : 600,
|
|
47
|
+
fontFamily: "inherit",
|
|
48
|
+
cursor: r ? "not-allowed" : "pointer",
|
|
49
|
+
textAlign: a ? "center" : "left",
|
|
50
|
+
border: `1px solid ${r ? "#1E293B" : n ? i : "#2B3A4E"}`,
|
|
51
|
+
background: n ? i : "#0F151E",
|
|
52
|
+
color: r ? "#475569" : n ? "#080B10" : "#E2E8F0"
|
|
53
|
+
},
|
|
54
|
+
children: t
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function o({ label: n, value: r, min: i, max: a, step: o, display: s, accent: c = "#00E5FF", onChange: l }) {
|
|
58
|
+
return /* @__PURE__ */ t("label", {
|
|
59
|
+
style: {
|
|
60
|
+
display: "grid",
|
|
61
|
+
gridTemplateColumns: "68px 1fr 48px",
|
|
62
|
+
alignItems: "center",
|
|
63
|
+
gap: 5,
|
|
64
|
+
fontSize: 10.5
|
|
65
|
+
},
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ e("span", {
|
|
68
|
+
style: { color: "#CBD5E1" },
|
|
69
|
+
children: n
|
|
70
|
+
}),
|
|
71
|
+
/* @__PURE__ */ e("input", {
|
|
72
|
+
type: "range",
|
|
73
|
+
min: i,
|
|
74
|
+
max: a,
|
|
75
|
+
step: o,
|
|
76
|
+
value: r,
|
|
77
|
+
onChange: (e) => l(Number(e.target.value)),
|
|
78
|
+
style: { accentColor: c }
|
|
79
|
+
}),
|
|
80
|
+
/* @__PURE__ */ e("span", {
|
|
81
|
+
style: {
|
|
82
|
+
textAlign: "right",
|
|
83
|
+
color: c,
|
|
84
|
+
fontWeight: 700
|
|
85
|
+
},
|
|
86
|
+
children: s
|
|
87
|
+
})
|
|
88
|
+
]
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
export { a as PillBtn, n as S_PANEL, r as S_SEC, i as S_SEL, o as SliderRow };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PaperShellPresetId, type ShadingMode, type ShellPartId } from "@khr3/vehicles/paper-shell";
|
|
2
|
-
import type { CarDriveMode } from "./khrCompiler.js";
|
|
2
|
+
import type { CarDriveMode, EngineTorqueCurveId, SteerSpeedCurveId, TireArchetypeId } from "./khrCompiler.js";
|
|
3
3
|
export type GateStep = 1 | 2;
|
|
4
4
|
export type GateDomain = "vehicle" | "c12" | "launcher" | "person" | "prop" | "junk";
|
|
5
5
|
export type VehicleSubArchetype = "car" | "starcraft";
|
|
@@ -12,7 +12,7 @@ export declare const DAMP_ZETA: Readonly<Record<DampBucket, number>>;
|
|
|
12
12
|
export interface CalibrationMetrics {
|
|
13
13
|
readonly wheelbase: number;
|
|
14
14
|
readonly trackWidth: number;
|
|
15
|
-
readonly wheelRadii: readonly [
|
|
15
|
+
readonly wheelRadii: readonly number[];
|
|
16
16
|
readonly minY: number;
|
|
17
17
|
readonly aabbSize: readonly [number, number, number];
|
|
18
18
|
readonly c12Ticks: readonly [number, number, number];
|
|
@@ -55,6 +55,9 @@ export interface GateState {
|
|
|
55
55
|
dampBucket: DampBucket;
|
|
56
56
|
wrenchMode: WrenchMode;
|
|
57
57
|
driveType: CarDriveMode;
|
|
58
|
+
tirePreset: TireArchetypeId;
|
|
59
|
+
torqueCurve: EngineTorqueCurveId;
|
|
60
|
+
steerCurve: SteerSpeedCurveId;
|
|
58
61
|
staticProp: boolean;
|
|
59
62
|
massKg: number;
|
|
60
63
|
powerOrThrust: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ALL_PANELS_ATTACHED_MASK as e } from "@khr3/vehicles/paper-shell";
|
|
2
|
+
import { create as t } from "zustand";
|
|
3
3
|
// src/importer/gateStore.ts
|
|
4
4
|
var n = Object.freeze({
|
|
5
5
|
TRUCK: 1.4,
|
|
@@ -28,12 +28,12 @@ function a(e, t, n, r) {
|
|
|
28
28
|
if (!s || !c) return !1;
|
|
29
29
|
if (t === "c12") return e.c12Aligned;
|
|
30
30
|
if (t === "vehicle" && (r || n === "car")) {
|
|
31
|
-
let t = e.wheelbase >=
|
|
31
|
+
let t = e.wheelbase >= 0 && e.wheelbase <= 30, n = e.wheelRadii.every((e) => e >= .05 && e <= 2.5);
|
|
32
32
|
return t && n;
|
|
33
33
|
}
|
|
34
34
|
return !0;
|
|
35
35
|
}
|
|
36
|
-
var o =
|
|
36
|
+
var o = t((t) => ({
|
|
37
37
|
step: 1,
|
|
38
38
|
domain: "vehicle",
|
|
39
39
|
vehicleArchetype: "car",
|
|
@@ -45,10 +45,13 @@ var o = e((e) => ({
|
|
|
45
45
|
dampBucket: "BALANCED",
|
|
46
46
|
wrenchMode: "UNLATCH_200",
|
|
47
47
|
driveType: "AWD",
|
|
48
|
+
tirePreset: "streetDrift90s",
|
|
49
|
+
torqueCurve: "naScreamer",
|
|
50
|
+
steerCurve: "driftCountersteer",
|
|
48
51
|
staticProp: !1,
|
|
49
52
|
massKg: 1380,
|
|
50
53
|
powerOrThrust: 240,
|
|
51
|
-
attachedMask:
|
|
54
|
+
attachedMask: e,
|
|
52
55
|
unlatchedMask: 0,
|
|
53
56
|
fuelLiters: 42,
|
|
54
57
|
dropTrigger: 0,
|
|
@@ -78,12 +81,12 @@ var o = e((e) => ({
|
|
|
78
81
|
detectedAnchors: [],
|
|
79
82
|
isSingleMeshProxy: !1
|
|
80
83
|
},
|
|
81
|
-
setField: (
|
|
82
|
-
setCalibration: (
|
|
83
|
-
triggerDrop: () =>
|
|
84
|
+
setField: (e, n) => t({ [e]: n }),
|
|
85
|
+
setCalibration: (e) => t({ calibration: e }),
|
|
86
|
+
triggerDrop: () => t((e) => ({ dropTrigger: e.dropTrigger + 1 })),
|
|
84
87
|
resetAllPanels: () => {
|
|
85
|
-
i.massDirty = !0,
|
|
86
|
-
attachedMask:
|
|
88
|
+
i.massDirty = !0, t({
|
|
89
|
+
attachedMask: e,
|
|
87
90
|
unlatchedMask: 0,
|
|
88
91
|
detachedDebris: []
|
|
89
92
|
});
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
2
|
import { type PaperShellAssembly, type PaperShellPresetId, type ShadingMode } from "@khr3/vehicles/paper-shell";
|
|
3
3
|
import { type CalibrationMetrics, type GateDomain, type VehicleSubArchetype } from "./gateStore.js";
|
|
4
|
+
import { type MeshIsland, type WheelAxle } from "./meshIslands.js";
|
|
5
|
+
export interface MeshMassProps {
|
|
6
|
+
readonly centerOfMass: [number, number, number];
|
|
7
|
+
readonly inertiaDiagonal: [number, number, number];
|
|
8
|
+
readonly area: number;
|
|
9
|
+
readonly hasMesh: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Compute real surface-area-weighted CoM & diagonal principal moments from triangle geometry (box fallback only when empty). */
|
|
12
|
+
export declare function computeMeshMassProps(root: THREE.Object3D, massKg: number, fallbackCenter: readonly [number, number, number], fallbackSize: readonly [number, number, number]): MeshMassProps;
|
|
4
13
|
export declare const C12_TICK_M: number;
|
|
5
14
|
export declare const UNIFIED_ANCHOR_NAMES: readonly string[];
|
|
6
15
|
/** Convert KHR_implicit_shapes box.size (FULL [w, h, d] in meters) to Rapier CuboidCollider half-extents. */
|
|
@@ -17,6 +26,6 @@ export declare function defaultTargetMeters(domain: GateDomain, sub: VehicleSubA
|
|
|
17
26
|
power: number;
|
|
18
27
|
};
|
|
19
28
|
export declare function measureAssemblyCalibration(assembly: PaperShellAssembly, scaleFactor?: number, yOffset?: number, isProxy?: boolean, importedRoot?: THREE.Object3D | null): CalibrationMetrics;
|
|
20
|
-
export declare function measureNormalizedSceneCalibration(scene: THREE.Object3D, yOffset?: number): CalibrationMetrics;
|
|
29
|
+
export declare function measureNormalizedSceneCalibration(scene: THREE.Object3D, yOffset?: number, axles?: readonly WheelAxle[], islands?: readonly MeshIsland[]): CalibrationMetrics;
|
|
21
30
|
/** Wrap an unsegmented single-mesh GLB import with a synchronized C0 paper-shell collider + breakaway lattice. */
|
|
22
31
|
export declare function wrapSingleMeshWithPaperShellProxy(importedRoot: THREE.Object3D | null, fallbackPreset?: PaperShellPresetId, shadingMode?: ShadingMode): PaperShellAssembly;
|