@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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
1
2
|
import type { MeshIsland } from "./meshIslands.js";
|
|
2
3
|
export interface WheelAxle {
|
|
3
4
|
left: number[];
|
|
@@ -15,4 +16,5 @@ export interface SelectionBounds {
|
|
|
15
16
|
}
|
|
16
17
|
export declare function measureSelection(islands: readonly Pick<MeshIsland, "id" | "min" | "max">[], ids: readonly number[]): SelectionBounds;
|
|
17
18
|
export declare function suggestCarAxles(islands: readonly MeshIsland[]): WheelAxle[];
|
|
18
|
-
export declare function toggleIslandSelection(islands: readonly MeshIsland[], axles: readonly WheelAxle[], clickedId: number, _mode?: "car"): WheelAxle[];
|
|
19
|
+
export declare function toggleIslandSelection(islands: readonly MeshIsland[], axles: readonly WheelAxle[], clickedId: number, _mode?: "car", mirrorX?: boolean): WheelAxle[];
|
|
20
|
+
export declare function createFleet12GonWheelGroup(radius: number, width: number, nodeName?: string): THREE.Group;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import * as e from "three";
|
|
1
2
|
// src/importer/wheelAxlePairing.ts
|
|
2
|
-
function
|
|
3
|
+
function t(e, t) {
|
|
3
4
|
let n = new Map(e.map((e) => [e.id, e])), r = [
|
|
4
5
|
Infinity,
|
|
5
6
|
Infinity,
|
|
@@ -29,16 +30,16 @@ function e(e, t) {
|
|
|
29
30
|
halfWidth: (i[0] - r[0]) * .5
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
+
function n(e) {
|
|
33
34
|
let t = Math.max(e.size[1], e.size[2], 1e-5), n = Math.min(e.size[1], e.size[2]) / t, r = t / Math.max(e.size[0], 1e-5);
|
|
34
35
|
return n >= .56 && r >= 1.25;
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
-
let i =
|
|
37
|
+
function r(e, t, r) {
|
|
38
|
+
let i = t, a = Math.max(t.size[1], t.size[2]);
|
|
38
39
|
for (let o of e) {
|
|
39
|
-
if (o.id ===
|
|
40
|
+
if (o.id === t.id || r?.has(o.id) || !n(o)) continue;
|
|
40
41
|
let e = Math.max(o.size[1], o.size[2]);
|
|
41
|
-
if (!(e <= a * 1.32 || e > 1.3) && Math.hypot(o.center[0] -
|
|
42
|
+
if (!(e <= a * 1.32 || e > 1.3) && Math.hypot(o.center[0] - t.center[0], o.center[1] - t.center[1], o.center[2] - t.center[2]) <= e * .45) {
|
|
42
43
|
i = o;
|
|
43
44
|
break;
|
|
44
45
|
}
|
|
@@ -55,24 +56,24 @@ function n(e, n, r) {
|
|
|
55
56
|
}
|
|
56
57
|
return l;
|
|
57
58
|
}
|
|
58
|
-
function
|
|
59
|
-
if (
|
|
59
|
+
function i(e) {
|
|
60
|
+
if (e.length === 0) return [];
|
|
60
61
|
let i = Infinity, a = Infinity, o = -Infinity;
|
|
61
|
-
for (let
|
|
62
|
-
let s = Math.max(o - a, 1e-6), c = (e) => Math.max(e.size[1], e.size[2]), l =
|
|
63
|
-
let
|
|
64
|
-
return
|
|
65
|
-
}).sort((e, t) => c(t) - c(e)), u = /* @__PURE__ */ new Set(),
|
|
66
|
-
for (let
|
|
67
|
-
if (
|
|
68
|
-
let
|
|
69
|
-
c:
|
|
70
|
-
s: Math.hypot(
|
|
62
|
+
for (let t of e) i = Math.min(i, t.min[1]), a = Math.min(a, t.min[2]), o = Math.max(o, t.max[2]);
|
|
63
|
+
let s = Math.max(o - a, 1e-6), c = (e) => Math.max(e.size[1], e.size[2]), l = e.filter((e) => {
|
|
64
|
+
let t = c(e);
|
|
65
|
+
return n(e) && t >= s * .06 && t <= s * .65 && e.min[1] <= i + t * .2;
|
|
66
|
+
}).sort((e, t) => c(t) - c(e)), u = l.filter((e) => Math.abs(e.center[0]) > e.size[0] * .45), d = /* @__PURE__ */ new Set(), f = [];
|
|
67
|
+
for (let t of u) {
|
|
68
|
+
if (d.has(t.id)) continue;
|
|
69
|
+
let n = Math.max(...t.size, 1e-6), i = t.size[0] + t.size[1] + t.size[2] || 1e-6, a = u.filter((e) => e.id !== t.id && !d.has(e.id)).map((e) => ({
|
|
70
|
+
c: e,
|
|
71
|
+
s: Math.hypot(e.center[0] + t.center[0], e.center[1] - t.center[1], e.center[2] - t.center[2]) / n + (Math.abs(e.size[0] - t.size[0]) + Math.abs(e.size[1] - t.size[1]) + Math.abs(e.size[2] - t.size[2])) / i
|
|
71
72
|
})).filter((e) => e.s < .65).sort((e, t) => e.s - t.s)[0]?.c;
|
|
72
73
|
if (!a) continue;
|
|
73
|
-
|
|
74
|
-
let o =
|
|
75
|
-
o.forEach((e) =>
|
|
74
|
+
d.add(t.id), d.add(a.id);
|
|
75
|
+
let o = r(e, t, d), s = r(e, a, d);
|
|
76
|
+
o.forEach((e) => d.add(e)), s.forEach((e) => d.add(e)), f.push(t.center[0] >= 0 ? {
|
|
76
77
|
left: o,
|
|
77
78
|
right: s
|
|
78
79
|
} : {
|
|
@@ -80,23 +81,71 @@ function r(r) {
|
|
|
80
81
|
right: o
|
|
81
82
|
});
|
|
82
83
|
}
|
|
83
|
-
|
|
84
|
+
for (let t of l) {
|
|
85
|
+
if (d.has(t.id) || Math.abs(t.center[0]) > Math.max(t.size[0] * .65, .14)) continue;
|
|
86
|
+
d.add(t.id);
|
|
87
|
+
let n = r(e, t, d);
|
|
88
|
+
n.forEach((e) => d.add(e)), f.push({
|
|
89
|
+
left: n,
|
|
90
|
+
right: []
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return f.sort((n, r) => t(e, [...r.left, ...r.right]).center[2] - t(e, [...n.left, ...n.right]).center[2]);
|
|
84
94
|
}
|
|
85
|
-
function
|
|
86
|
-
let
|
|
87
|
-
if (
|
|
88
|
-
let
|
|
89
|
-
if (!
|
|
90
|
-
let
|
|
91
|
-
|
|
95
|
+
function a(e, n, i, a = "car", o = !0) {
|
|
96
|
+
let s = n.findIndex((e) => e.left.includes(i) || e.right.includes(i));
|
|
97
|
+
if (s >= 0) return n.filter((e, t) => t !== s);
|
|
98
|
+
let c = e.find((e) => e.id === i);
|
|
99
|
+
if (!c) return [...n];
|
|
100
|
+
let l = r(e, c), u = e.find((e) => e.id === l[0]) ?? c, d = [];
|
|
101
|
+
if (o && Math.abs(u.center[0]) > Math.max(u.size[0] * .45, .08)) {
|
|
102
|
+
let t = e.filter((e) => !l.includes(e.id)).sort((e, t) => Math.hypot(e.center[0] + u.center[0], e.center[1] - u.center[1], e.center[2] - u.center[2]) - Math.hypot(t.center[0] + u.center[0], t.center[1] - u.center[1], t.center[2] - u.center[2]))[0];
|
|
103
|
+
t && Math.hypot(t.center[0] + u.center[0], t.center[1] - u.center[1], t.center[2] - u.center[2]) < Math.max(...u.size) * .45 && (d = r(e, t));
|
|
104
|
+
}
|
|
105
|
+
let f = d.length > 0 ? u.center[0] >= 0 ? {
|
|
106
|
+
left: l,
|
|
92
107
|
right: d
|
|
93
108
|
} : {
|
|
94
109
|
left: d,
|
|
95
|
-
right:
|
|
110
|
+
right: l
|
|
111
|
+
} : u.center[0] < -.08 ? {
|
|
112
|
+
left: [],
|
|
113
|
+
right: l
|
|
96
114
|
} : {
|
|
97
|
-
left:
|
|
115
|
+
left: l,
|
|
98
116
|
right: []
|
|
99
117
|
};
|
|
100
|
-
return [...
|
|
118
|
+
return [...n, f].sort((n, r) => t(e, [...r.left, ...r.right]).center[2] - t(e, [...n.left, ...n.right]).center[2]);
|
|
119
|
+
}
|
|
120
|
+
function o(t, n, r = "Wheel_12gon") {
|
|
121
|
+
let i = new e.Group();
|
|
122
|
+
i.name = r;
|
|
123
|
+
let a = new e.CylinderGeometry(t, t, n, 12, 1);
|
|
124
|
+
a.rotateZ(Math.PI * .5);
|
|
125
|
+
let o = new e.CylinderGeometry(t * .62, t * .62, n * 1.04, 12, 1);
|
|
126
|
+
o.rotateZ(Math.PI * .5);
|
|
127
|
+
let s = new e.CylinderGeometry(t * .22, t * .22, n * 1.1, 6, 1);
|
|
128
|
+
s.rotateZ(Math.PI * .5);
|
|
129
|
+
let c = new e.Mesh(a, new e.MeshStandardMaterial({
|
|
130
|
+
color: "#1b2028",
|
|
131
|
+
roughness: .92,
|
|
132
|
+
metalness: .05,
|
|
133
|
+
flatShading: !0
|
|
134
|
+
}));
|
|
135
|
+
c.name = `${r}_tire`;
|
|
136
|
+
let l = new e.Mesh(o, new e.MeshStandardMaterial({
|
|
137
|
+
color: "#cbd5e1",
|
|
138
|
+
roughness: .36,
|
|
139
|
+
metalness: .72,
|
|
140
|
+
flatShading: !0
|
|
141
|
+
}));
|
|
142
|
+
l.name = `${r}_rim`;
|
|
143
|
+
let u = new e.Mesh(s, new e.MeshStandardMaterial({
|
|
144
|
+
color: "#f59e0b",
|
|
145
|
+
roughness: .45,
|
|
146
|
+
metalness: .6,
|
|
147
|
+
flatShading: !0
|
|
148
|
+
}));
|
|
149
|
+
return u.name = `${r}_hub`, i.add(c, l, u), i;
|
|
101
150
|
}
|
|
102
|
-
export {
|
|
151
|
+
export { o as createFleet12GonWheelGroup, t as measureSelection, i as suggestCarAxles, a as toggleIslandSelection };
|
package/dist/index.js
CHANGED
|
@@ -35,32 +35,35 @@ import { disposeImportedRoot as vt, ensureMeshAttributes as yt } from "./junk/ju
|
|
|
35
35
|
import { applySegmentsToImportedRoot as bt, loadImportedGlbUrl as xt, parseImportedGlbBuffer as St } from "./junk/junkImporter.js";
|
|
36
36
|
import { getProceduralLabelTexture as Ct, loadCustomLabelTexture as wt } from "./junk/junkLabels.js";
|
|
37
37
|
import { DestructibleTarget as Tt } from "./junk/DestructibleTarget.js";
|
|
38
|
-
import { KolmoEmitterRig as X, PARTICLE_FRAG as Et, PARTICLE_VERT as
|
|
39
|
-
import { KOLMO_EXTENSION_NAME as
|
|
40
|
-
import { KolmoJunk as
|
|
41
|
-
import { mountPS2WorldMeshes as
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
38
|
+
import { KolmoEmitterRig as X, PARTICLE_FRAG as Et, PARTICLE_VERT as Dt, PLUME_FRAG as Ot, PLUME_VERT as kt } from "./shaders/plumeAndSparkle.js";
|
|
39
|
+
import { KOLMO_EXTENSION_NAME as At, createDefaultSignals as jt, decodeKolmoRig as Mt, inferKolmoSocketRole as Nt, stampKolmoNodesIntoGlb as Pt } from "./schema/kolmoSchema.js";
|
|
40
|
+
import { KolmoJunk as Z } from "./junk/KolmoJunk.js";
|
|
41
|
+
import { mountPS2WorldMeshes as Ft } from "./shaders/ps2MaterialsWebGL.js";
|
|
42
|
+
import { DAMP_ZETA as It, FREQ_HZ as Lt, gateTelemetry as Q, isGateStep1Unlocked as Rt, useGateStore as zt } from "./importer/gateStore.js";
|
|
43
|
+
import { createFleet12GonWheelGroup as Bt, measureSelection as Vt, suggestCarAxles as Ht, toggleIslandSelection as Ut } from "./importer/wheelAxlePairing.js";
|
|
44
|
+
import { extractMeshIslands as Wt, normalizeSceneToSi as Gt, separateVehicleMeshes as Kt, sliceMeshTriangles as qt } from "./importer/meshIslands.js";
|
|
45
|
+
import { C12_TICK_M as Jt, UNIFIED_ANCHOR_NAMES as Yt, computeC12Metrics as Xt, computeMeshMassProps as Zt, defaultTargetMeters as Qt, detectSceneAnchors as $t, khrBoxToRapierHalfExtents as en, measureAssemblyCalibration as tn, measureNormalizedSceneCalibration as nn, snapMetersToC12 as rn, wrapSingleMeshWithPaperShellProxy as an } from "./importer/glbNormalizer.js";
|
|
46
|
+
import { buildCabinTubGroup as on, buildMixamoSeatedDummyGroup as sn, disposeObjectTree as cn } from "./importer/cabinMeshBuilders.js";
|
|
47
|
+
import { MIXAMO_SEATED as ln, autoFitCabinConfig as un, computeMixamoCabinPoints as dn, computeMixamoCabinSockets as fn, evaluateCabinFit as pn, seatXForLayout as mn } from "./importer/cabinMixamoRig.js";
|
|
48
|
+
import { CHOP_ROLES as hn, buildSurfaceTopology as gn, countSelectionFaces as _n, floodFillByCrease as vn, getIslandTopology as yn, mirrorTriangles as bn, selectionEntries as xn } from "./importer/surfaceTopology.js";
|
|
49
|
+
import { buildMultiSelectionOverlay as Sn, buildSelectionOverlayGeometry as Cn, findMirrorIslandId as wn, peelFaceSelection as Tn, peelIslandSelection as En, previewLoopPolyline as Dn, refineMeshAlongLoop as On, remapIslandIds as kn, selectFacesByClick as An, selectFacesByLoop as jn } from "./importer/surfaceCutter.js";
|
|
50
|
+
import { STEER_CURVE_IDS as Mn, TIRE_PRESET_IDS as Nn, TORQUE_CURVE_IDS as Pn, compileKhrAssetGlb as Fn, planArticulatedPanels as In } from "./importer/khrCompiler.js";
|
|
51
|
+
import { ChopShopPanel as Ln } from "./importer/ChopShopPanel.js";
|
|
52
|
+
import { bakeArticulatedLauncherGlb as Rn, buildLauncherSceneFromPlan as zn } from "./importer/launcherBake.js";
|
|
53
|
+
import { DomainWorkshopPanel as Bn, enforceRetroPersonMaterials as Vn } from "./importer/DomainWorkshopPanel.js";
|
|
54
|
+
import { GateHudBar as Hn } from "./importer/GateHudBar.js";
|
|
55
|
+
import { buildImporterWebMcpTools as Un, getNavigatorModelContext as Wn, useImporterWebMcp as Gn } from "./importer/importerWebMcp.js";
|
|
56
|
+
import { CabinPreviewRig as Kn } from "./importer/CabinPreviewRig.js";
|
|
57
|
+
import { makeStarterDomainScene as qn } from "./importer/ImporterPlinthUikitTags.js";
|
|
58
|
+
import { Step1CalibrationPlinth as Jn } from "./importer/Step1CalibrationPlinth.js";
|
|
59
|
+
import { ImperativeVehicleRig as Yn } from "./importer/ImperativeVehicleRig.js";
|
|
60
|
+
import { Step2UniversalPad as Xn } from "./importer/Step2UniversalPad.js";
|
|
61
|
+
import { VfxEmitterPool as Zn } from "./importer/VfxEmitterPool.js";
|
|
62
|
+
import { convertUsdToGlb as Qn, isUsdFileName as $n } from "./importer/usdToGlb.js";
|
|
63
|
+
import { bakeUniversalGateGlb as er } from "./importer/universalGateBake.js";
|
|
61
64
|
import { GlbImportGate as $ } from "./importer/GlbImportGate.js";
|
|
62
|
-
import { DOOR_HINGE_SPEC as
|
|
63
|
-
import { DEFAULT_VAULT_URL as
|
|
64
|
-
import { CARBINE_556 as
|
|
65
|
-
import { COUPE_2DOOR as
|
|
66
|
-
export { qe as ATMO_FRAG, Je as ATMO_VERT, z as Actor, w as ActorTrait, rt as BOTTLE_HEIGHT, Fe as C12TileKind,
|
|
65
|
+
import { DOOR_HINGE_SPEC as tr, Ex as nr, ROOT3 as rr, buildFootprint as ir, canPlace as ar, instanceBatches as or, latticePose as sr, planSettlement as cr, poseEq as lr, poseFromJSON as ur, poseToFloat as dr, poseToJSON as fr, snapPose as pr, socketFor as mr, triangleCorners as hr, vToFloat as gr, worldSockets as _r } from "@khr3/c12";
|
|
66
|
+
import { DEFAULT_VAULT_URL as vr, KOLMO_ASSETS_URL as yr, VAULT_CARS as br, VAULT_CATALOG as xr, VAULT_CITY as Sr, VAULT_WEAPONS as Cr, createAssetVault as wr, inspectGlbBuffer as Tr, normalizeGlbBuffer as Er, vaultAssetUrl as Dr } from "@khr3/assets";
|
|
67
|
+
import { CARBINE_556 as Or, LAUNCHER_RECIPES as kr, PISTOL_9MM as Ar, SHOTGUN_12G as jr, attachModule as Mr, createLauncherState as Nr, detachModule as Pr, findLauncherRecipe as Fr, planLauncher as Ir, stepLauncher as Lr } from "@khr3/launchers";
|
|
68
|
+
import { COUPE_2DOOR as Rr, FLEET as zr, SEDAN_4DOOR as Br, VEHICLE_DOMAINS as Vr, VEHICLE_DOMAIN_SPECS as Hr, carUrl as Ur, findCar as Wr, fleetByDomain as Gr, planCar as Kr } from "@khr3/vehicles";
|
|
69
|
+
export { qe as ATMO_FRAG, Je as ATMO_VERT, z as Actor, w as ActorTrait, rt as BOTTLE_HEIGHT, Fe as C12TileKind, Jt as C12_TICK_M, Ie as C12_TILE_M, it as CAN_LOD_THRESHOLD_M, Or as CARBINE_556, hn as CHOP_ROLES, Rr as COUPE_2DOOR, Kn as CabinPreviewRig, e as Canvas, Ln as ChopShopPanel, It as DAMP_ZETA, vr as DEFAULT_VAULT_URL, tr as DOOR_HINGE_SPEC, Tt as DestructibleTarget, Bn as DomainWorkshopPanel, v as EMPTY_KOLMO_INPUT, X as EmitterRig, nr as Ex, J as Exoplanet, zr as FLEET, Le as FLOATING_ORIGIN_STEP_M, Lt as FREQ_HZ, T as FloatingBodyTrait, ie as GLSL_BAYER_RGB555, ae as GLSL_RETRO_QUANTIZE, Hn as GateHudBar, $ as GlbImportGate, Yn as ImperativeVehicleRig, $ as ImporterWorkbench, Ve as InfiniteLongDrivePlanner, E as InteractableTrait, K as Island, Z as Junk, Ye as KEY_SUN_DIRECTION, yr as KOLMO_ASSETS_URL, At as KOLMO_EXTENSION_NAME, y as KOLMO_KEY_MAP, z as KolmoActor, e as KolmoCanvas, X as KolmoEmitterRig, J as KolmoExoplanet, m as KolmoGravityContext, K as KolmoIsland, Z as KolmoJunk, q as KolmoLongDrive, h as KolmoPhysics, W as KolmoProp, Y as KolmoSkybox, G as KolmoSurface, R as KolmoVehicle, t as KolmoWorld, kr as LAUNCHER_RECIPES, q as LongDrive, Re as MACRO_SIZE_M, ln as MIXAMO_SEATED, n as PALETTE_CRUNCHY_16, r as PALETTE_CRUNCHY_64, Et as PARTICLE_FRAG, Dt as PARTICLE_VERT, Ar as PISTOL_9MM, Ot as PLUME_FRAG, kt as PLUME_VERT, oe as PS1_SNAP_RESOLUTION, h as Physics, D as PilotLink, W as Prop, i as RETRO_COLOR_MODES, se as RETRO_PRESETS, ce as RETRO_UNIFORMS, Xe as RING_MOONLET_COUNT, rr as ROOT3, x as RetroViewportSync, S as RoomEnvRig, Br as SEDAN_4DOOR, jr as SHOTGUN_12G, Ce as SHOULDER_K, Qe as SPLAT_LAYER, Mn as STEER_CURVE_IDS, ke as SeededSimplex2D, C as ShadowSnapRig, ht as ShardPieces, Ke as ShiftedFixedBody, Y as Skybox, Ae as SplitMix32, Jn as Step1CalibrationPlinth, Xn as Step2UniversalPad, G as Surface, ze as TILES_PER_MACRO, at as TIN_CAN_HEIGHT, ot as TIN_CAN_RADIUS, Nn as TIRE_PRESET_IDS, Pn as TORQUE_CURVE_IDS, gt as TargetDecals, Yt as UNIFIED_ANCHOR_NAMES, br as VAULT_CARS, xr as VAULT_CATALOG, Sr as VAULT_CITY, Cr as VAULT_WEAPONS, Vr as VEHICLE_DOMAINS, Hr as VEHICLE_DOMAIN_SPECS, R as Vehicle, O as VehicleTrait, Zn as VfxEmitterPool, t as World, k as WorldSessionTrait, s as applyPs1Material, a as applyRetroFilteringToMaterial, c as applyRetroMaterial, o as applyRetroTextureFiltering, l as applySceneRetroMaterials, bt as applySegmentsToImportedRoot, Mr as attachModule, un as autoFitCabinConfig, Rn as bakeArticulatedLauncherGlb, er as bakeUniversalGateGlb, je as bakeWorldSplatMaps, on as buildCabinTubGroup, He as buildCarvedTerrainGeometry, Ne as buildDodecagonalCivicHub, ir as buildFootprint, st as buildGlassBottleGeometry, Ue as buildHighwayAsphaltTexture, Un as buildImporterWebMcpTools, zn as buildLauncherSceneFromPlan, sn as buildMixamoSeatedDummyGroup, Sn as buildMultiSelectionOverlay, ee as buildPaletteLutData, B as buildPatchPreviewEmitters, We as buildRoadRibbonGeometry, Cn as buildSelectionOverlayGeometry, gn as buildSurfaceTopology, ct as buildTinCanGeometry, ar as canPlace, Ur as carUrl, me as childSeed, ye as closedRoadFromPoints, pt as collectValidTris, Fn as compileKhrAssetGlb, Xt as computeC12Metrics, V as computeChopPartHinge, ue as computeIslandSpawnPose, fe as computeLongDriveBridgeheadSpawn, pe as computeLongDriveMainlandSpawn, Zt as computeMeshMassProps, dn as computeMixamoCabinPoints, fn as computeMixamoCabinSockets, te as computeRetroDpr, Qn as convertUsdToGlb, lt as countGeometryTriangles, _n as countSelectionFaces, wr as createAssetVault, jt as createDefaultSignals, Bt as createFleet12GonWheelGroup, ut as createGlassBottleMaterial, Nr as createLauncherState, tt as createPS2RoadMaterialWebGL, nt as createPS2TerrainMaterialWebGL, $e as createPS2WorldTextures, dt as createTinCanMaterials, H as createVehiclePanelAnimator, Mt as decodeKolmoRig, Qt as defaultTargetMeters, Pr as detachModule, $t as detectSceneAnchors, vt as disposeImportedRoot, cn as disposeObjectTree, Vn as enforceRetroPersonMaterials, yt as ensureMeshAttributes, A as ensureWorldSession, pn as evaluateCabinFit, Wt as extractMeshIslands, he as fbm2, Wr as findCar, Fr as findLauncherRecipe, wn as findMirrorIslandId, Gr as fleetByDomain, vn as floodFillByCrease, Ee as frontage, Q as gateTelemetry, et as generatePS2DetailSlices, _t as getBulletHoleTexture, de as getCachedIslandPlan, ne as getColorQuantVector, yn as getIslandTopology, Wn as getNavigatorModelContext, re as getPaletteLutTexture, Ct as getProceduralLabelTexture, u as getRetroPreset, d as getRetroShaderUniforms, be as growRoad, Me as hashSeed, Nt as inferKolmoSocketRole, Tr as inspectGlbBuffer, or as instanceBatches, Rt as isGateStep1Unlocked, $n as isUsdFileName, en as khrBoxToRapierHalfExtents, j as kolmoActions, M as kolmoTelemetry, N as kolmoWorld, sr as latticePose, wt as loadCustomLabelTexture, xt as loadImportedGlbUrl, De as makeIslandHeightfn, qn as makeStarterDomainScene, we as makeTerrain, xe as maxGrade, tn as measureAssemblyCalibration, nn as measureNormalizedSceneCalibration, Vt as measureSelection, bn as mirrorTriangles, Ft as mountPS2WorldMeshes, ge as mulberry32, U as normalToMinusZQuaternion, Er as normalizeGlbBuffer, Gt as normalizeSceneToSi, St as parseImportedGlbBuffer, Tn as peelFaceSelection, En as peelIslandSelection, In as planArticulatedPanels, Kr as planCar, Ge as planDirtSpurs, Oe as planIslandWorld, Ir as planLauncher, cr as planSettlement, Ze as populateMoonletMatrices, lr as poseEq, ur as poseFromJSON, dr as poseToFloat, fr as poseToJSON, Dn as previewLoopPolyline, Be as quantizeFloatingOrigin192, P as readFloatingOriginAnchorXZ, On as refineMeshAlongLoop, kn as remapIslandIds, Se as roadFromPoints, Pe as routeMacroKnightAStar, Te as sampleHeightfield, mn as seatXForLayout, _e as seedFrom, ft as selectCanLod, An as selectFacesByClick, jn as selectFacesByLoop, xn as selectionEntries, Kt as separateVehicleMeshes, F as shiftFloatingOriginEntities, qt as sliceMeshTriangles, rn as snapMetersToC12, pr as snapPose, mr as socketFor, mt as splitObjectIntoShards, Pt as stampKolmoNodesIntoGlb, Lr as stepLauncher, Ht as suggestCarAxles, f as syncRetroUniforms, p as syncRetroViewport, Ut as toggleIslandSelection, le as togglePropJoint, hr as triangleCorners, I as useActiveKolmoWorld, zt as useGateStore, Gn as useImporterWebMcp, g as useIsKolmoCustomGravity, b as useKolmoInput, _ as useOptionalKootaWorld, L as useWorldTrait, gr as vToFloat, ve as valueNoise2, Dr as vaultAssetUrl, _r as worldSockets, an as wrapSingleMeshWithPaperShellProxy };
|
package/dist/junk/ShardPieces.js
CHANGED
|
@@ -26,7 +26,9 @@ function f({ item: o, material: s }) {
|
|
|
26
26
|
}, !0)), () => {
|
|
27
27
|
t.destroy();
|
|
28
28
|
};
|
|
29
|
-
}, [f, o])
|
|
29
|
+
}, [f, o]), r(() => () => {
|
|
30
|
+
o.spec.geometry.dispose();
|
|
31
|
+
}, [o.spec.geometry]);
|
|
30
32
|
let h = [
|
|
31
33
|
Math.max(.01, o.spec.halfExtents[0] * n),
|
|
32
34
|
Math.max(.01, o.spec.halfExtents[1] * n),
|
|
@@ -60,8 +62,6 @@ function f({ item: o, material: s }) {
|
|
|
60
62
|
function p({ shards: e, material: t }) {
|
|
61
63
|
let n = s((e) => e.scene);
|
|
62
64
|
return r(() => () => {
|
|
63
|
-
for (let t of e) t.spec.geometry.dispose();
|
|
64
|
-
}, [e]), r(() => () => {
|
|
65
65
|
t?.dispose();
|
|
66
66
|
}, [t]), !t || e.length === 0 ? null : o(/* @__PURE__ */ c("group", {
|
|
67
67
|
name: "Kolmo_WorldShardPieces",
|
package/dist/physics/index.d.ts
CHANGED
|
@@ -12,6 +12,13 @@ export type KolmoPointGravity = {
|
|
|
12
12
|
export type KolmoGravityCallback = (pos: THREE.Vector3, out: THREE.Vector3) => THREE.Vector3;
|
|
13
13
|
export type KolmoGravitySpec = "planar" | "zero" | "custom" | readonly [number, number, number] | KolmoPointGravity | KolmoGravityCallback;
|
|
14
14
|
export declare const KolmoGravityContext: React.Context<boolean>;
|
|
15
|
+
export interface KolmoTimeContextValue {
|
|
16
|
+
readonly paused: boolean;
|
|
17
|
+
readonly timeScale: KolmoTimeControlValue;
|
|
18
|
+
readonly maxDelta: KolmoTimeControlValue;
|
|
19
|
+
}
|
|
20
|
+
export declare const KolmoTimeContext: React.Context<KolmoTimeContextValue>;
|
|
21
|
+
export declare function isKolmoPhysicsStepping(ctx: KolmoTimeContextValue): boolean;
|
|
15
22
|
export declare function useOptionalKootaWorld(): World | null;
|
|
16
23
|
export interface KolmoPhysicsProps extends Omit<PhysicsWorldProps, "gravity" | "debug" | "timeScale" | "maxDelta" | "children"> {
|
|
17
24
|
readonly gravity?: KolmoGravitySpec;
|
package/dist/physics/index.js
CHANGED
|
@@ -5,26 +5,36 @@ import { PhysicsWorld as c } from "@khr3/core";
|
|
|
5
5
|
import { useCustomGravity as l } from "@pinkaphant/ecctrl/gravity";
|
|
6
6
|
import { jsx as u } from "react/jsx-runtime";
|
|
7
7
|
// src/physics/index.tsx
|
|
8
|
-
var d = t(!1), f =
|
|
9
|
-
|
|
8
|
+
var d = t(!1), f = t({
|
|
9
|
+
paused: !1,
|
|
10
|
+
timeScale: 1,
|
|
11
|
+
maxDelta: 1 / 30
|
|
12
|
+
});
|
|
13
|
+
function p(e) {
|
|
14
|
+
if (e.paused) return !1;
|
|
15
|
+
let t = typeof e.timeScale == "number" ? e.timeScale : e.timeScale.current, n = typeof e.maxDelta == "number" ? e.maxDelta : e.maxDelta.current;
|
|
16
|
+
return t > 0 && n > 0;
|
|
17
|
+
}
|
|
18
|
+
var m = new a.Vector3();
|
|
19
|
+
function h() {
|
|
10
20
|
try {
|
|
11
21
|
return s();
|
|
12
22
|
} catch {
|
|
13
23
|
return null;
|
|
14
24
|
}
|
|
15
25
|
}
|
|
16
|
-
function
|
|
26
|
+
function g(e) {
|
|
17
27
|
return Array.isArray(e);
|
|
18
28
|
}
|
|
19
|
-
function
|
|
29
|
+
function _(e) {
|
|
20
30
|
return typeof e == "object" && !Array.isArray(e) && "kind" in e && e.kind === "point";
|
|
21
31
|
}
|
|
22
|
-
function
|
|
23
|
-
let
|
|
24
|
-
E,
|
|
32
|
+
function v({ gravity: t = "planar", paused: n = !1, timeScale: a = 1, maxDelta: s, physicsDebug: p = !1, world: v = null, children: y, ...b }) {
|
|
33
|
+
let x = h(), S = typeof t == "function", C = g(t), w = t === "custom", T = _(t), E = S || T || w, D = C ? t[0] : 0, O = C ? t[1] : -9.81, k = C ? t[2] : 0, A = T ? t.center[0] : 0, j = T ? t.center[1] : 0, M = T ? t.center[2] : 0, N = T ? t.surfaceG : t === "zero" ? 0 : 9.81, P = T && t.radius > 0 ? t.radius : 0, F = S ? t : null, I = i(() => C ? [
|
|
25
34
|
D,
|
|
26
|
-
O
|
|
27
|
-
|
|
35
|
+
O,
|
|
36
|
+
k
|
|
37
|
+
] : E || t === "zero" ? [
|
|
28
38
|
0,
|
|
29
39
|
0,
|
|
30
40
|
0
|
|
@@ -33,52 +43,68 @@ function g({ gravity: t = "planar", paused: n = !1, timeScale: a = 1, maxDelta:
|
|
|
33
43
|
-9.81,
|
|
34
44
|
0
|
|
35
45
|
], [
|
|
36
|
-
|
|
37
|
-
E,
|
|
46
|
+
C,
|
|
38
47
|
D,
|
|
39
48
|
O,
|
|
40
|
-
|
|
49
|
+
k,
|
|
50
|
+
E,
|
|
41
51
|
t === "zero"
|
|
42
52
|
]);
|
|
43
53
|
r(() => {
|
|
44
|
-
if (
|
|
54
|
+
if (w || !S && !T) return;
|
|
45
55
|
let e = l.getState().setGravityField;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
let t =
|
|
49
|
-
|
|
56
|
+
F ? e((e) => F(e, m)) : T && e((e) => {
|
|
57
|
+
m.set(e.x - A, e.y - j, e.z - M);
|
|
58
|
+
let t = m.lengthSq();
|
|
59
|
+
if (t < 1e-8) return m.set(0, -N, 0);
|
|
60
|
+
let n = Math.sqrt(t), r = m.multiplyScalar(-1 / n);
|
|
61
|
+
if (P <= 0) return r.multiplyScalar(N);
|
|
62
|
+
let i = n < P ? n / P * N : N * (P * P / (n * n));
|
|
63
|
+
return r.multiplyScalar(i);
|
|
50
64
|
});
|
|
51
65
|
}, [
|
|
52
|
-
C,
|
|
53
|
-
x,
|
|
54
66
|
w,
|
|
55
|
-
|
|
56
|
-
|
|
67
|
+
S,
|
|
68
|
+
T,
|
|
69
|
+
F,
|
|
57
70
|
A,
|
|
58
71
|
j,
|
|
59
|
-
M
|
|
72
|
+
M,
|
|
73
|
+
N,
|
|
74
|
+
P
|
|
60
75
|
]);
|
|
61
|
-
let
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
76
|
+
let L = s ?? 1 / 30, R = i(() => ({
|
|
77
|
+
paused: n,
|
|
78
|
+
timeScale: a,
|
|
79
|
+
maxDelta: L
|
|
80
|
+
}), [
|
|
81
|
+
n,
|
|
82
|
+
a,
|
|
83
|
+
L
|
|
84
|
+
]), z = /* @__PURE__ */ u(d.Provider, {
|
|
85
|
+
value: E,
|
|
86
|
+
children: /* @__PURE__ */ u(f.Provider, {
|
|
87
|
+
value: R,
|
|
88
|
+
children: /* @__PURE__ */ u(c, {
|
|
89
|
+
...b,
|
|
90
|
+
paused: n,
|
|
91
|
+
timeScale: a,
|
|
92
|
+
...s === void 0 ? {} : { maxDelta: s },
|
|
93
|
+
gravity: I,
|
|
94
|
+
debug: p,
|
|
95
|
+
children: /* @__PURE__ */ u(e, {
|
|
96
|
+
fallback: null,
|
|
97
|
+
children: y
|
|
98
|
+
})
|
|
73
99
|
})
|
|
74
100
|
})
|
|
75
101
|
});
|
|
76
|
-
return
|
|
77
|
-
world:
|
|
78
|
-
children:
|
|
79
|
-
}) :
|
|
102
|
+
return v && v !== x ? /* @__PURE__ */ u(o, {
|
|
103
|
+
world: v,
|
|
104
|
+
children: z
|
|
105
|
+
}) : z;
|
|
80
106
|
}
|
|
81
|
-
function
|
|
107
|
+
function y() {
|
|
82
108
|
return n(d);
|
|
83
109
|
}
|
|
84
|
-
export { d as KolmoGravityContext,
|
|
110
|
+
export { d as KolmoGravityContext, v as KolmoPhysics, f as KolmoTimeContext, p as isKolmoPhysicsStepping, y as useIsKolmoCustomGravity, h as useOptionalKootaWorld };
|