@pinkaphant/kolmo 0.1.2 → 0.2.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/LICENSE +21 -0
- package/README.md +16 -14
- package/bin/kolmo.mjs +22 -54
- package/dist/body/HeldItem.js +171 -0
- package/dist/body/KhrBody.js +171 -0
- package/dist/body/bodySi.d.ts +0 -11
- package/dist/body/bodySi.js +52 -0
- package/dist/body/index.d.ts +1 -1
- package/dist/body/index.js +4 -1
- 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 +17 -0
- package/dist/engine/kolmoInput.js +78 -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 +3 -1
- package/dist/engine/kolmoVehicle.js +250 -0
- package/dist/engine/kolmoVehicleDriver.d.ts +30 -0
- package/dist/engine/kolmoVehicleDriver.js +29 -0
- package/dist/engine/kolmoWorld.d.ts +7 -15
- package/dist/engine/kolmoWorld.js +139 -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 +1 -1
- package/dist/index.js +69 -13
- 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 +32 -18
- package/dist/body-B7FTf67o.js +0 -362
- package/dist/engine-BeKvBM8d.js +0 -1745
- package/dist/importer-B2-S-N_e.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
package/dist/junk-B4bC1zAl.js
DELETED
|
@@ -1,1049 +0,0 @@
|
|
|
1
|
-
import { Fragment as e, forwardRef as t, useCallback as n, useEffect as r, useImperativeHandle as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
2
|
-
import * as c from "three";
|
|
3
|
-
import { createPortal as l, useFrame as u } from "@react-three/fiber";
|
|
4
|
-
import { Decal as d } from "@react-three/drei";
|
|
5
|
-
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
6
|
-
import { CuboidCollider as h, CylinderCollider as g, RigidBody as _ } from "@react-three/rapier";
|
|
7
|
-
import { GLTFLoader as v } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
8
|
-
// src/junk/junkGeometry.ts
|
|
9
|
-
var y = .085, b = .25, x = .32, S = 14;
|
|
10
|
-
function C(e, t) {
|
|
11
|
-
return t === "3-gon" || t === "12-gon" ? t : e > 14 ? "3-gon" : "12-gon";
|
|
12
|
-
}
|
|
13
|
-
function w(e) {
|
|
14
|
-
if (e.index) return Math.floor(e.index.count / 3);
|
|
15
|
-
let t = e.attributes.position;
|
|
16
|
-
return t ? Math.floor(t.count / 3) : 0;
|
|
17
|
-
}
|
|
18
|
-
function T(e) {
|
|
19
|
-
if (e === "3-gon") {
|
|
20
|
-
let e = new c.CylinderGeometry(y, y, b, 3, 1, !1, Math.PI, Math.PI * 2), t = e.toNonIndexed();
|
|
21
|
-
return e.dispose(), t.computeVertexNormals(), t.computeBoundingBox(), t.computeBoundingSphere(), t;
|
|
22
|
-
}
|
|
23
|
-
let t = new c.CylinderGeometry(y, y, b, 12, 2, !1, Math.PI, Math.PI * 2);
|
|
24
|
-
return t.computeBoundingBox(), t.computeBoundingSphere(), t;
|
|
25
|
-
}
|
|
26
|
-
function E() {
|
|
27
|
-
let e = x * .5, t = [
|
|
28
|
-
new c.Vector2(1e-4, -.16),
|
|
29
|
-
new c.Vector2(.048, -.16),
|
|
30
|
-
new c.Vector2(.055, -.16 + .015),
|
|
31
|
-
new c.Vector2(.055, .01),
|
|
32
|
-
new c.Vector2(.046, .045),
|
|
33
|
-
new c.Vector2(.022, .085),
|
|
34
|
-
new c.Vector2(.02, .135),
|
|
35
|
-
new c.Vector2(.025, .148),
|
|
36
|
-
new c.Vector2(.024, e),
|
|
37
|
-
new c.Vector2(1e-4, e)
|
|
38
|
-
], n = new c.LatheGeometry(t, 12, Math.PI, Math.PI * 2), r = n.attributes.position, i = n.attributes.uv, a = x;
|
|
39
|
-
for (let t = 0; t < r.count; t++) {
|
|
40
|
-
let n = c.MathUtils.clamp((r.getY(t) + e) / a, 0, 1);
|
|
41
|
-
i.setY(t, n);
|
|
42
|
-
}
|
|
43
|
-
return i.needsUpdate = !0, n.attributes.normal || n.computeVertexNormals(), n.computeBoundingBox(), n.computeBoundingSphere(), n;
|
|
44
|
-
}
|
|
45
|
-
function D() {
|
|
46
|
-
return new c.MeshStandardMaterial({
|
|
47
|
-
color: "#a7f3d0",
|
|
48
|
-
transparent: !0,
|
|
49
|
-
opacity: .42,
|
|
50
|
-
roughness: .12,
|
|
51
|
-
metalness: .1,
|
|
52
|
-
depthWrite: !1
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
function O(e) {
|
|
56
|
-
return [
|
|
57
|
-
new c.MeshStandardMaterial({
|
|
58
|
-
color: e ? "#ffffff" : "#e2e8f0",
|
|
59
|
-
map: e ?? null,
|
|
60
|
-
roughness: .48,
|
|
61
|
-
metalness: .15
|
|
62
|
-
}),
|
|
63
|
-
new c.MeshStandardMaterial({
|
|
64
|
-
color: "#cbd5e1",
|
|
65
|
-
roughness: .34,
|
|
66
|
-
metalness: .78
|
|
67
|
-
}),
|
|
68
|
-
new c.MeshStandardMaterial({
|
|
69
|
-
color: "#94a3b8",
|
|
70
|
-
roughness: .38,
|
|
71
|
-
metalness: .78
|
|
72
|
-
})
|
|
73
|
-
];
|
|
74
|
-
}
|
|
75
|
-
// src/junk/bvhTriCollector.ts
|
|
76
|
-
var k = 1e-10;
|
|
77
|
-
function A(...e) {
|
|
78
|
-
for (let t = 0; t < e.length; t++) if (!Number.isFinite(e[t])) return !1;
|
|
79
|
-
return !0;
|
|
80
|
-
}
|
|
81
|
-
function j(e) {
|
|
82
|
-
e.updateMatrixWorld(!0);
|
|
83
|
-
let t = new c.Matrix4().copy(e.matrixWorld).invert(), n = new c.Matrix4(), r = new c.Matrix3(), i = [];
|
|
84
|
-
e.traverse((e) => {
|
|
85
|
-
e instanceof c.Mesh && (e.userData.isDecal || e.userData.isGizmo || e.material instanceof c.ShaderMaterial || Array.isArray(e.material) && e.material.every((e) => e instanceof c.ShaderMaterial) || e.geometry?.attributes?.position && i.push(e));
|
|
86
|
-
});
|
|
87
|
-
let a = i.some((e) => e.userData.destructible !== !1), o = [], s = new c.Vector3(), l = new c.Vector3(), u = new c.Vector3(), d = new c.Vector3(), f = new c.Vector3(), p = new c.Vector3(), m = new c.Vector3(), h = new c.Vector3(), g = new c.Vector3();
|
|
88
|
-
for (let e of i) {
|
|
89
|
-
if (a && e.userData.destructible === !1) continue;
|
|
90
|
-
let i = e.geometry, c = i.index !== null, _ = c ? i.toNonIndexed() : i;
|
|
91
|
-
try {
|
|
92
|
-
let i = _.attributes.position, a = _.attributes.normal, c = _.attributes.uv, v = Math.floor(i.count / 3);
|
|
93
|
-
if (v <= 0) continue;
|
|
94
|
-
n.multiplyMatrices(t, e.matrixWorld), r.getNormalMatrix(n);
|
|
95
|
-
for (let e = 0; e < v; e++) {
|
|
96
|
-
let t = e * 3;
|
|
97
|
-
if (s.fromBufferAttribute(i, t).applyMatrix4(n), l.fromBufferAttribute(i, t + 1).applyMatrix4(n), u.fromBufferAttribute(i, t + 2).applyMatrix4(n), !A(s.x, s.y, s.z, l.x, l.y, l.z, u.x, u.y, u.z)) continue;
|
|
98
|
-
d.subVectors(l, s), f.subVectors(u, s), p.crossVectors(d, f);
|
|
99
|
-
let _ = p.length();
|
|
100
|
-
if (!Number.isFinite(_) || _ < k) continue;
|
|
101
|
-
p.divideScalar(_), a ? (m.fromBufferAttribute(a, t).applyMatrix3(r), h.fromBufferAttribute(a, t + 1).applyMatrix3(r), g.fromBufferAttribute(a, t + 2).applyMatrix3(r), m.lengthSq() > 1e-10 ? m.normalize() : m.copy(p), h.lengthSq() > 1e-10 ? h.normalize() : h.copy(p), g.lengthSq() > 1e-10 ? g.normalize() : g.copy(p)) : (m.copy(p), h.copy(p), g.copy(p));
|
|
102
|
-
let v = c ? c.getX(t) : 0, y = c ? c.getY(t) : 0, b = c ? c.getX(t + 1) : 0, x = c ? c.getY(t + 1) : 0, S = c ? c.getX(t + 2) : 0, C = c ? c.getY(t + 2) : 0;
|
|
103
|
-
o.push({
|
|
104
|
-
p: [
|
|
105
|
-
s.x,
|
|
106
|
-
s.y,
|
|
107
|
-
s.z,
|
|
108
|
-
l.x,
|
|
109
|
-
l.y,
|
|
110
|
-
l.z,
|
|
111
|
-
u.x,
|
|
112
|
-
u.y,
|
|
113
|
-
u.z
|
|
114
|
-
],
|
|
115
|
-
n: [
|
|
116
|
-
m.x,
|
|
117
|
-
m.y,
|
|
118
|
-
m.z,
|
|
119
|
-
h.x,
|
|
120
|
-
h.y,
|
|
121
|
-
h.z,
|
|
122
|
-
g.x,
|
|
123
|
-
g.y,
|
|
124
|
-
g.z
|
|
125
|
-
],
|
|
126
|
-
uv: [
|
|
127
|
-
Number.isFinite(v) ? v : 0,
|
|
128
|
-
Number.isFinite(y) ? y : 0,
|
|
129
|
-
Number.isFinite(b) ? b : 0,
|
|
130
|
-
Number.isFinite(x) ? x : 0,
|
|
131
|
-
Number.isFinite(S) ? S : 0,
|
|
132
|
-
Number.isFinite(C) ? C : 0
|
|
133
|
-
],
|
|
134
|
-
cx: (s.x + l.x + u.x) / 3,
|
|
135
|
-
cy: (s.y + l.y + u.y) / 3,
|
|
136
|
-
cz: (s.z + l.z + u.z) / 3,
|
|
137
|
-
minX: Math.min(s.x, l.x, u.x),
|
|
138
|
-
minY: Math.min(s.y, l.y, u.y),
|
|
139
|
-
minZ: Math.min(s.z, l.z, u.z),
|
|
140
|
-
maxX: Math.max(s.x, l.x, u.x),
|
|
141
|
-
maxY: Math.max(s.y, l.y, u.y),
|
|
142
|
-
maxZ: Math.max(s.z, l.z, u.z)
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
} finally {
|
|
146
|
-
c && _.dispose();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return o;
|
|
150
|
-
}
|
|
151
|
-
// src/junk/bvhShatter.ts
|
|
152
|
-
var M = .015;
|
|
153
|
-
function N(e, t, n, r) {
|
|
154
|
-
if (r <= 1 || n <= 1) return [[t, n]];
|
|
155
|
-
let i = Infinity, a = Infinity, o = Infinity, s = -Infinity, c = -Infinity, l = -Infinity;
|
|
156
|
-
for (let r = t; r < t + n; r++) {
|
|
157
|
-
let t = e[r];
|
|
158
|
-
t.minX < i && (i = t.minX), t.minY < a && (a = t.minY), t.minZ < o && (o = t.minZ), t.maxX > s && (s = t.maxX), t.maxY > c && (c = t.maxY), t.maxZ > l && (l = t.maxZ);
|
|
159
|
-
}
|
|
160
|
-
let u = s - i, d = c - a, f = l - o, p = u >= d && u >= f ? 0 : d >= f ? 1 : 2, m = e.slice(t, t + n);
|
|
161
|
-
m.sort((e, t) => p === 0 ? e.cx - t.cx : p === 1 ? e.cy - t.cy : e.cz - t.cz);
|
|
162
|
-
for (let r = 0; r < n; r++) e[t + r] = m[r];
|
|
163
|
-
let h = Math.floor(r / 2), g = r - h, _ = Math.max(1, Math.min(n - 1, Math.round(h / r * n)));
|
|
164
|
-
return [...N(e, t, _, h), ...N(e, t + _, n - _, g)];
|
|
165
|
-
}
|
|
166
|
-
function P(e, t) {
|
|
167
|
-
let n = j(e);
|
|
168
|
-
if (n.length === 0) return [];
|
|
169
|
-
let r = Math.max(1, Math.min(Math.round(Number.isFinite(t) ? t : 6), n.length)), i = N(n, 0, n.length, r), a = [], o = 0, s = i.map(([e, t], r) => {
|
|
170
|
-
let s = Infinity, l = Infinity, u = Infinity, d = -Infinity, f = -Infinity, p = -Infinity;
|
|
171
|
-
for (let r = e; r < e + t; r++) {
|
|
172
|
-
let e = n[r];
|
|
173
|
-
e.minX < s && (s = e.minX), e.minY < l && (l = e.minY), e.minZ < u && (u = e.minZ), e.maxX > d && (d = e.maxX), e.maxY > f && (f = e.maxY), e.maxZ > p && (p = e.maxZ);
|
|
174
|
-
}
|
|
175
|
-
let m = (s + d) * .5, h = (l + f) * .5, g = (u + p) * .5, _ = new Float32Array(t * 9), v = new Float32Array(t * 9), y = new Float32Array(t * 6);
|
|
176
|
-
for (let r = 0; r < t; r++) {
|
|
177
|
-
let t = n[e + r], i = r * 9;
|
|
178
|
-
for (let e = 0; e < 3; e++) _[i + e * 3] = t.p[e * 3] - m, _[i + e * 3 + 1] = t.p[e * 3 + 1] - h, _[i + e * 3 + 2] = t.p[e * 3 + 2] - g, v[i + e * 3] = t.n[e * 3], v[i + e * 3 + 1] = t.n[e * 3 + 1], v[i + e * 3 + 2] = t.n[e * 3 + 2];
|
|
179
|
-
y.set(t.uv, r * 6);
|
|
180
|
-
}
|
|
181
|
-
let b = new c.BufferGeometry();
|
|
182
|
-
b.setAttribute("position", new c.Float32BufferAttribute(_, 3)), b.setAttribute("normal", new c.Float32BufferAttribute(v, 3)), b.setAttribute("uv", new c.Float32BufferAttribute(y, 2)), b.computeBoundingBox(), b.computeBoundingSphere();
|
|
183
|
-
let x = Math.max(M, (d - s) * .5), S = Math.max(M, (f - l) * .5), C = Math.max(M, (p - u) * .5), w = 8 * x * S * C;
|
|
184
|
-
return a.push(w), o += w, {
|
|
185
|
-
id: `shard_${r}`,
|
|
186
|
-
geometry: b,
|
|
187
|
-
centroid: [
|
|
188
|
-
m,
|
|
189
|
-
h,
|
|
190
|
-
g
|
|
191
|
-
],
|
|
192
|
-
halfExtents: [
|
|
193
|
-
x,
|
|
194
|
-
S,
|
|
195
|
-
C
|
|
196
|
-
],
|
|
197
|
-
volumeFraction: 1 / i.length
|
|
198
|
-
};
|
|
199
|
-
});
|
|
200
|
-
if (o > 0) for (let e = 0; e < s.length; e++) s[e].volumeFraction = a[e] / o;
|
|
201
|
-
return s;
|
|
202
|
-
}
|
|
203
|
-
// src/junk/targetHelpers.ts
|
|
204
|
-
var F = .65;
|
|
205
|
-
function I(e) {
|
|
206
|
-
return e === "glass-bottle" ? 1200 : e === "imported-glb" ? 800 : 220;
|
|
207
|
-
}
|
|
208
|
-
var L = new c.Vector3(), R = new c.Vector3(), z = new c.Vector3(0, 0, 1), B = new c.Quaternion(), V = new c.Euler(), H = new c.Matrix4(), U = new c.Matrix3(), W = new c.Box3();
|
|
209
|
-
function G(e, t, n) {
|
|
210
|
-
return e.updateMatrixWorld(!0), L.set(t[0], t[1], t[2]), e.worldToLocal(L), H.copy(e.matrixWorld).invert(), U.getNormalMatrix(H), R.set(n[0], n[1], n[2]).applyMatrix3(U), R.lengthSq() > 1e-8 ? R.normalize() : R.set(0, 0, 1), B.setFromUnitVectors(z, R), V.setFromQuaternion(B, "XYZ"), {
|
|
211
|
-
position: [
|
|
212
|
-
L.x,
|
|
213
|
-
L.y,
|
|
214
|
-
L.z
|
|
215
|
-
],
|
|
216
|
-
rotation: [
|
|
217
|
-
V.x,
|
|
218
|
-
V.y,
|
|
219
|
-
V.z
|
|
220
|
-
]
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
function K(e, t) {
|
|
224
|
-
L.set(t[0], t[1], t[2]);
|
|
225
|
-
let n = null, r = Infinity;
|
|
226
|
-
return e.traverse((e) => {
|
|
227
|
-
if (!(e instanceof c.Mesh) || e.userData.isDecal || e.userData.isGizmo) return;
|
|
228
|
-
W.setFromObject(e);
|
|
229
|
-
let t = W.distanceToPoint(L);
|
|
230
|
-
t < r && (r = t, n = e);
|
|
231
|
-
}), n;
|
|
232
|
-
}
|
|
233
|
-
function q(e, t, n, r, i, a = "tin-can") {
|
|
234
|
-
let o = P(e, t), s = I(a), l = new c.Vector3(...i.impulse), u = Math.min(1.5, Math.max(.75, .75 + l.length() * .12)), d = l.lengthSq() > 1e-6 ? l.clone().normalize() : new c.Vector3(0, .25, -1).normalize();
|
|
235
|
-
return {
|
|
236
|
-
states: o.map((e, t) => {
|
|
237
|
-
let i = new c.Vector3(...e.centroid).clone().applyQuaternion(r), a = i.lengthSq() > 1e-6 ? i.clone().normalize() : new c.Vector3(t % 3 - 1, .5, (t + 1) % 3 - 1).normalize(), o = n.clone().add(i).addScaledVector(a, .008), l = Math.max(.01, e.halfExtents[0] * F), f = Math.max(.01, e.halfExtents[1] * F), p = Math.max(.01, e.halfExtents[2] * F), m = Math.max(.008, 8 * l * f * p * s), h = a.clone().multiplyScalar(1.25 * u).addScaledVector(d, .85 * u);
|
|
238
|
-
h.y += .8 * u;
|
|
239
|
-
let g = h.clone().multiplyScalar(m), _ = t % 2 == 0 ? 1 : -1, v = new c.Vector3(_ * (.6 + a.z * .4), _ * (.7 + a.x * .4), -_ * (.5 + a.y * .4)).multiplyScalar(7.5), y = Math.max(1e-5, m * (l * l + f * f + p * p) * .35), b = v.clone().multiplyScalar(y);
|
|
240
|
-
return {
|
|
241
|
-
spec: e,
|
|
242
|
-
worldPos: [
|
|
243
|
-
o.x,
|
|
244
|
-
o.y,
|
|
245
|
-
o.z
|
|
246
|
-
],
|
|
247
|
-
worldQuat: [
|
|
248
|
-
r.x,
|
|
249
|
-
r.y,
|
|
250
|
-
r.z,
|
|
251
|
-
r.w
|
|
252
|
-
],
|
|
253
|
-
impulse: [
|
|
254
|
-
g.x,
|
|
255
|
-
g.y,
|
|
256
|
-
g.z
|
|
257
|
-
],
|
|
258
|
-
torque: [
|
|
259
|
-
b.x,
|
|
260
|
-
b.y,
|
|
261
|
-
b.z
|
|
262
|
-
],
|
|
263
|
-
linvel: [
|
|
264
|
-
h.x,
|
|
265
|
-
h.y,
|
|
266
|
-
h.z
|
|
267
|
-
],
|
|
268
|
-
angvel: [
|
|
269
|
-
v.x,
|
|
270
|
-
v.y,
|
|
271
|
-
v.z
|
|
272
|
-
],
|
|
273
|
-
density: s
|
|
274
|
-
};
|
|
275
|
-
}),
|
|
276
|
-
specs: o
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
function J(e, t, n) {
|
|
280
|
-
if (e === "glass-bottle") return D();
|
|
281
|
-
if (e === "tin-can") return new c.MeshStandardMaterial({
|
|
282
|
-
color: t ? "#e2e8f0" : "#94a3b8",
|
|
283
|
-
map: t ?? null,
|
|
284
|
-
roughness: .45,
|
|
285
|
-
metalness: .35,
|
|
286
|
-
side: c.DoubleSide
|
|
287
|
-
});
|
|
288
|
-
let r = null;
|
|
289
|
-
if (n?.traverse((e) => {
|
|
290
|
-
!r && e instanceof c.Mesh && (e.userData.isDecal || e.userData.isGizmo || (r = Array.isArray(e.material) ? e.material[0] ?? null : e.material ?? null));
|
|
291
|
-
}), r) {
|
|
292
|
-
let e = r.clone();
|
|
293
|
-
return e.side = c.DoubleSide, e;
|
|
294
|
-
}
|
|
295
|
-
return new c.MeshStandardMaterial({
|
|
296
|
-
color: "#cbd5e1",
|
|
297
|
-
roughness: .6,
|
|
298
|
-
metalness: .2,
|
|
299
|
-
side: c.DoubleSide
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
// src/junk/ShardPieces.tsx
|
|
303
|
-
function ee({ item: e, material: t }) {
|
|
304
|
-
let n = o(null);
|
|
305
|
-
r(() => {
|
|
306
|
-
let t = n.current;
|
|
307
|
-
t && (t.setLinvel({
|
|
308
|
-
x: e.linvel[0],
|
|
309
|
-
y: e.linvel[1],
|
|
310
|
-
z: e.linvel[2]
|
|
311
|
-
}, !0), t.setAngvel({
|
|
312
|
-
x: e.angvel[0],
|
|
313
|
-
y: e.angvel[1],
|
|
314
|
-
z: e.angvel[2]
|
|
315
|
-
}, !0));
|
|
316
|
-
}, [e]);
|
|
317
|
-
let i = [
|
|
318
|
-
Math.max(.01, e.spec.halfExtents[0] * F),
|
|
319
|
-
Math.max(.01, e.spec.halfExtents[1] * F),
|
|
320
|
-
Math.max(.01, e.spec.halfExtents[2] * F)
|
|
321
|
-
];
|
|
322
|
-
return /* @__PURE__ */ m(_, {
|
|
323
|
-
ref: n,
|
|
324
|
-
type: "dynamic",
|
|
325
|
-
colliders: !1,
|
|
326
|
-
position: e.worldPos,
|
|
327
|
-
quaternion: e.worldQuat,
|
|
328
|
-
restitution: .18,
|
|
329
|
-
friction: .8,
|
|
330
|
-
linearDamping: .45,
|
|
331
|
-
angularDamping: .45,
|
|
332
|
-
children: [/* @__PURE__ */ p(h, {
|
|
333
|
-
args: i,
|
|
334
|
-
density: e.density
|
|
335
|
-
}), /* @__PURE__ */ p("mesh", {
|
|
336
|
-
geometry: e.spec.geometry,
|
|
337
|
-
material: t,
|
|
338
|
-
castShadow: !0,
|
|
339
|
-
receiveShadow: !0
|
|
340
|
-
})]
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
function te({ shards: e, material: t }) {
|
|
344
|
-
return r(() => () => {
|
|
345
|
-
for (let t of e) t.spec.geometry.dispose();
|
|
346
|
-
}, [e]), r(() => () => {
|
|
347
|
-
t?.dispose();
|
|
348
|
-
}, [t]), !t || e.length === 0 ? null : /* @__PURE__ */ p("group", { children: e.map((e) => /* @__PURE__ */ p(ee, {
|
|
349
|
-
item: e,
|
|
350
|
-
material: t
|
|
351
|
-
}, e.spec.id)) });
|
|
352
|
-
}
|
|
353
|
-
// src/junk/TargetDecals.tsx
|
|
354
|
-
var Y = null;
|
|
355
|
-
function ne() {
|
|
356
|
-
if (typeof document > "u") return null;
|
|
357
|
-
if (Y) return Y;
|
|
358
|
-
let e = document.createElement("canvas");
|
|
359
|
-
e.width = 128, e.height = 128;
|
|
360
|
-
let t = e.getContext("2d");
|
|
361
|
-
if (!t) return null;
|
|
362
|
-
t.clearRect(0, 0, 128, 128);
|
|
363
|
-
let n = t.createRadialGradient(64, 64, 8, 64, 64, 54);
|
|
364
|
-
n.addColorStop(0, "rgba(15, 15, 18, 0.92)"), n.addColorStop(.45, "rgba(39, 39, 42, 0.55)"), n.addColorStop(1, "rgba(24, 24, 27, 0)"), t.fillStyle = n, t.beginPath(), t.arc(64, 64, 54, 0, Math.PI * 2), t.fill(), t.strokeStyle = "rgba(24, 24, 27, 0.85)", t.lineWidth = 2.5;
|
|
365
|
-
for (let e = 0; e < 8; e++) {
|
|
366
|
-
let n = e / 8 * Math.PI * 2 + .25;
|
|
367
|
-
t.beginPath(), t.moveTo(64 + Math.cos(n) * 16, 64 + Math.sin(n) * 16), t.lineTo(64 + Math.cos(n) * 44, 64 + Math.sin(n) * 44), t.stroke();
|
|
368
|
-
}
|
|
369
|
-
t.beginPath(), t.arc(64, 64, 21, 0, Math.PI * 2), t.fillStyle = "#94a3b8", t.fill(), t.beginPath(), t.arc(64, 64, 15, 0, Math.PI * 2), t.fillStyle = "#09090b", t.fill();
|
|
370
|
-
let r = new c.CanvasTexture(e);
|
|
371
|
-
return r.colorSpace = c.SRGBColorSpace, r.flipY = !0, r.needsUpdate = !0, Y = r, r;
|
|
372
|
-
}
|
|
373
|
-
function X({ decals: t, lodKey: n = "default", meshRefMap: r }) {
|
|
374
|
-
let i = a(() => ne(), []);
|
|
375
|
-
return t.length === 0 ? null : /* @__PURE__ */ p(f, { children: t.map((t) => {
|
|
376
|
-
let a = /* @__PURE__ */ p(d, {
|
|
377
|
-
position: t.position,
|
|
378
|
-
rotation: t.rotation,
|
|
379
|
-
scale: [
|
|
380
|
-
t.scale,
|
|
381
|
-
t.scale,
|
|
382
|
-
t.scale * 1.4
|
|
383
|
-
],
|
|
384
|
-
depthTest: !0,
|
|
385
|
-
polygonOffsetFactor: -4,
|
|
386
|
-
"material-depthWrite": !1,
|
|
387
|
-
raycast: () => null,
|
|
388
|
-
userData: { isDecal: !0 },
|
|
389
|
-
map: i ?? void 0
|
|
390
|
-
});
|
|
391
|
-
if (r) {
|
|
392
|
-
let i = r.get(t.id)?.current;
|
|
393
|
-
return i ? /* @__PURE__ */ p(e, { children: l(a, i) }, `${t.id}-${n}`) : null;
|
|
394
|
-
}
|
|
395
|
-
return /* @__PURE__ */ p(e, { children: a }, `${t.id}-${n}`);
|
|
396
|
-
}) });
|
|
397
|
-
}
|
|
398
|
-
// src/junk/targetHitLogic.ts
|
|
399
|
-
var Z = new c.Vector3();
|
|
400
|
-
function re(e, t, n, r, i, a, o, s) {
|
|
401
|
-
let l;
|
|
402
|
-
if (n) {
|
|
403
|
-
n.recomputeMassPropertiesFromColliders?.();
|
|
404
|
-
let e = Math.max(.001, n.mass()) * 3.5, t = Math.hypot(s.impulse[0], s.impulse[1], s.impulse[2]), r = t > e && t > 1e-6 ? e / t : 1;
|
|
405
|
-
n.applyImpulseAtPoint({
|
|
406
|
-
x: s.impulse[0] * r,
|
|
407
|
-
y: s.impulse[1] * r,
|
|
408
|
-
z: s.impulse[2] * r
|
|
409
|
-
}, {
|
|
410
|
-
x: s.point[0],
|
|
411
|
-
y: s.point[1],
|
|
412
|
-
z: s.point[2]
|
|
413
|
-
}, !0);
|
|
414
|
-
let i = n.translation();
|
|
415
|
-
l = [
|
|
416
|
-
i.x,
|
|
417
|
-
i.y,
|
|
418
|
-
i.z
|
|
419
|
-
];
|
|
420
|
-
}
|
|
421
|
-
let u = Math.hypot(s.impulse[0], s.impulse[1], s.impulse[2]), d = Math.max(1, Math.round(e.maxHp * Math.min(1, Math.max(.28, u / 8)))), f = Math.max(0, a - d);
|
|
422
|
-
if ((e.fragile || f <= 0) && r) {
|
|
423
|
-
let i = new c.Vector3(...e.position), a = new c.Quaternion();
|
|
424
|
-
if (n) {
|
|
425
|
-
let e = n.translation(), t = n.rotation();
|
|
426
|
-
i.set(e.x, e.y, e.z), a.set(t.x, t.y, t.z, t.w);
|
|
427
|
-
} else r.getWorldPosition(i), r.getWorldQuaternion(a);
|
|
428
|
-
let { states: o, specs: l } = q(r, e.shatterPieceCount, i, a, s, e.kind), u = J(e.kind, t.activeLabelTex, t.importedRoot);
|
|
429
|
-
return {
|
|
430
|
-
shattered: !0,
|
|
431
|
-
nextHp: 0,
|
|
432
|
-
shatterPos: [
|
|
433
|
-
i.x,
|
|
434
|
-
i.y,
|
|
435
|
-
i.z
|
|
436
|
-
],
|
|
437
|
-
shardStates: o,
|
|
438
|
-
shardSpecs: l,
|
|
439
|
-
shardMaterial: u
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
let p = i ?? (r ? K(r, s.point) : null);
|
|
443
|
-
if (!p) return {
|
|
444
|
-
shattered: !1,
|
|
445
|
-
nextHp: f,
|
|
446
|
-
bodyPos: l
|
|
447
|
-
};
|
|
448
|
-
let m = G(p, s.point, s.normal);
|
|
449
|
-
p.getWorldScale(Z);
|
|
450
|
-
let h = Math.max(1e-4, (Math.abs(Z.x) + Math.abs(Z.y) + Math.abs(Z.z)) / 3);
|
|
451
|
-
return {
|
|
452
|
-
shattered: !1,
|
|
453
|
-
nextHp: f,
|
|
454
|
-
bodyPos: l,
|
|
455
|
-
newDecal: {
|
|
456
|
-
id: o,
|
|
457
|
-
position: m.position,
|
|
458
|
-
rotation: m.rotation,
|
|
459
|
-
scale: .045 / h
|
|
460
|
-
},
|
|
461
|
-
newDecalMesh: i ? void 0 : p
|
|
462
|
-
};
|
|
463
|
-
}
|
|
464
|
-
function ie(e, t, n, r, i, a, o, s) {
|
|
465
|
-
let c = null, l = null;
|
|
466
|
-
if (i && n) try {
|
|
467
|
-
c = n.translation(), l = n.linvel();
|
|
468
|
-
} catch {
|
|
469
|
-
c = null, l = null;
|
|
470
|
-
}
|
|
471
|
-
let u = s ?? e.position;
|
|
472
|
-
return {
|
|
473
|
-
id: e.id,
|
|
474
|
-
kind: e.kind,
|
|
475
|
-
lodMode: e.canLodMode,
|
|
476
|
-
activeLod: t.effectiveLod,
|
|
477
|
-
triCount: t.triCount,
|
|
478
|
-
labelId: e.labelId,
|
|
479
|
-
customLabelLoaded: t.customLabelLoaded,
|
|
480
|
-
materialTransparent: e.kind === "glass-bottle",
|
|
481
|
-
opacity: e.kind === "glass-bottle" ? .42 : 1,
|
|
482
|
-
hp: r,
|
|
483
|
-
maxHp: e.maxHp,
|
|
484
|
-
alive: i,
|
|
485
|
-
decalCount: i ? a : 0,
|
|
486
|
-
activeShardCount: i ? 0 : o,
|
|
487
|
-
position: c ? [
|
|
488
|
-
c.x,
|
|
489
|
-
c.y,
|
|
490
|
-
c.z
|
|
491
|
-
] : [...u],
|
|
492
|
-
linearVelocity: l ? [
|
|
493
|
-
l.x,
|
|
494
|
-
l.y,
|
|
495
|
-
l.z
|
|
496
|
-
] : [
|
|
497
|
-
0,
|
|
498
|
-
0,
|
|
499
|
-
0
|
|
500
|
-
]
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
function ae(e, t, n) {
|
|
504
|
-
n && e.set(t, { current: n });
|
|
505
|
-
}
|
|
506
|
-
function oe(e, t, n, r, i = 16) {
|
|
507
|
-
let a = [...e, t], o = Math.max(0, a.length - i);
|
|
508
|
-
for (let e = 0; e < o; e++) n.delete(a[e].id);
|
|
509
|
-
return ae(n, t.id, r), o > 0 ? a.slice(o) : a;
|
|
510
|
-
}
|
|
511
|
-
function se(e, t, n) {
|
|
512
|
-
e?.traverse((e) => {
|
|
513
|
-
e instanceof c.Mesh && !e.userData.isDecal && (e.userData.targetId = t, e.userData.destructibleTarget = !0, e.userData.isDestructibleTarget = !0, e.userData.applyHit = n);
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
|
-
function ce(e, t, n) {
|
|
517
|
-
if (e) try {
|
|
518
|
-
let t = e.translation();
|
|
519
|
-
return n.set(t.x, t.y, t.z), !0;
|
|
520
|
-
} catch {}
|
|
521
|
-
return t ? (t.getWorldPosition(n), !0) : !1;
|
|
522
|
-
}
|
|
523
|
-
// src/junk/junkImportSanitize.ts
|
|
524
|
-
var le = [
|
|
525
|
-
"map",
|
|
526
|
-
"normalMap",
|
|
527
|
-
"roughnessMap",
|
|
528
|
-
"metalnessMap",
|
|
529
|
-
"emissiveMap",
|
|
530
|
-
"aoMap",
|
|
531
|
-
"alphaMap"
|
|
532
|
-
];
|
|
533
|
-
function ue(e, t) {
|
|
534
|
-
let n = e.geometry, r = n?.attributes?.position;
|
|
535
|
-
if (r) {
|
|
536
|
-
for (let e = 0; e < r.count; e++) if (!Number.isFinite(r.getX(e)) || !Number.isFinite(r.getY(e)) || !Number.isFinite(r.getZ(e))) throw Error(`GLB "${t}" contains non-finite vertex coordinates.`);
|
|
537
|
-
if (n.index) {
|
|
538
|
-
let e = n.index;
|
|
539
|
-
for (let n = 0; n < e.count; n++) {
|
|
540
|
-
let i = e.getX(n);
|
|
541
|
-
if (!Number.isInteger(i) || i < 0 || i >= r.count) throw Error(`GLB "${t}" contains out-of-bounds triangle indices.`);
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
if (n.attributes.normal) {
|
|
545
|
-
let e = n.attributes.normal, t = !1;
|
|
546
|
-
for (let n = 0; n < e.count; n++) Number.isFinite(e.getX(n)) && Number.isFinite(e.getY(n)) && Number.isFinite(e.getZ(n)) || (e.setXYZ(n, 0, 1, 0), t = !0);
|
|
547
|
-
t && (e.needsUpdate = !0);
|
|
548
|
-
}
|
|
549
|
-
if (n.computeBoundingBox(), n.attributes.normal || n.computeVertexNormals(), n.attributes.uv) {
|
|
550
|
-
let e = n.attributes.uv, t = !1;
|
|
551
|
-
for (let n = 0; n < e.count; n++) Number.isFinite(e.getX(n)) && Number.isFinite(e.getY(n)) || (e.setXY(n, 0, 0), t = !0);
|
|
552
|
-
t && (e.needsUpdate = !0);
|
|
553
|
-
} else n.setAttribute("uv", new c.Float32BufferAttribute(new Float32Array(r.count * 2), 2));
|
|
554
|
-
e.castShadow = !0, e.receiveShadow = !0;
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
function Q(e) {
|
|
558
|
-
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
559
|
-
e.traverse((e) => {
|
|
560
|
-
if (!(e instanceof c.Mesh)) return;
|
|
561
|
-
e.geometry?.dispose();
|
|
562
|
-
let r = Array.isArray(e.material) ? e.material : [e.material];
|
|
563
|
-
for (let e of r) {
|
|
564
|
-
if (!e || t.has(e)) continue;
|
|
565
|
-
t.add(e);
|
|
566
|
-
let r = e;
|
|
567
|
-
for (let e of le) {
|
|
568
|
-
let t = r[e];
|
|
569
|
-
t instanceof c.Texture && !n.has(t) && (n.add(t), t.dispose());
|
|
570
|
-
}
|
|
571
|
-
e.dispose();
|
|
572
|
-
}
|
|
573
|
-
});
|
|
574
|
-
}
|
|
575
|
-
// src/junk/junkImporter.ts
|
|
576
|
-
var de = /(base|stand|pedestal|mount|anchor|frame)/i;
|
|
577
|
-
function $(e) {
|
|
578
|
-
return Math.round(e * 1e4) / 1e4;
|
|
579
|
-
}
|
|
580
|
-
function fe(e) {
|
|
581
|
-
if (e.index) return Math.floor(e.index.count / 3);
|
|
582
|
-
let t = e.attributes.position;
|
|
583
|
-
return t ? Math.floor(t.count / 3) : 0;
|
|
584
|
-
}
|
|
585
|
-
function pe(e, t) {
|
|
586
|
-
let n = new Map(t.map((e) => [e.segmentId, e]));
|
|
587
|
-
e.traverse((e) => {
|
|
588
|
-
if (!(e instanceof c.Mesh)) return;
|
|
589
|
-
let t = e.userData.segmentId;
|
|
590
|
-
if (!t) return;
|
|
591
|
-
let r = n.get(t);
|
|
592
|
-
r && (e.userData.destructible = r.destructible, e.userData.customName = r.customName);
|
|
593
|
-
});
|
|
594
|
-
}
|
|
595
|
-
async function me(e, t = "imported.glb") {
|
|
596
|
-
if (!e || e.byteLength === 0) throw Error(`Cannot import "${t}": file is empty (0 bytes).`);
|
|
597
|
-
let n = new v(), r;
|
|
598
|
-
try {
|
|
599
|
-
r = await n.parseAsync(e.slice(0), "");
|
|
600
|
-
} catch (e) {
|
|
601
|
-
let n = e instanceof Error ? e.message : String(e);
|
|
602
|
-
throw Error(`Failed to parse GLB "${t}": ${n}`);
|
|
603
|
-
}
|
|
604
|
-
let i = r.scene, a = [];
|
|
605
|
-
try {
|
|
606
|
-
i.traverse((e) => {
|
|
607
|
-
e instanceof c.Mesh && e.geometry?.attributes?.position && (ue(e, t), a.push(e));
|
|
608
|
-
});
|
|
609
|
-
} catch (e) {
|
|
610
|
-
throw Q(i), e;
|
|
611
|
-
}
|
|
612
|
-
if (a.length === 0) throw Q(i), Error(`GLB "${t}" contains no valid renderable meshes.`);
|
|
613
|
-
i.updateMatrixWorld(!0);
|
|
614
|
-
let o = new c.Box3().setFromObject(i), s = new c.Vector3();
|
|
615
|
-
o.getSize(s);
|
|
616
|
-
let l = Math.max(s.x, s.y, s.z);
|
|
617
|
-
if (!Number.isFinite(l) || l <= 1e-6) throw Q(i), Error(`GLB "${t}" has invalid or zero-size bounds.`);
|
|
618
|
-
let u = l > 1.2 || l < .25 ? .55 / l : 1, d = l * u;
|
|
619
|
-
d < .1 && (u = .1 / l), d > 2.5 && (u = 2.5 / l), i.scale.multiplyScalar(u), i.updateMatrixWorld(!0);
|
|
620
|
-
let f = new c.Box3().setFromObject(i), p = new c.Vector3(), m = new c.Vector3();
|
|
621
|
-
f.getCenter(p), f.getSize(m), i.position.sub(p);
|
|
622
|
-
let h = new c.Group();
|
|
623
|
-
h.name = t, h.add(i), h.updateMatrixWorld(!0);
|
|
624
|
-
let g = a.some((e) => {
|
|
625
|
-
let t = e.name || e.parent?.name || "";
|
|
626
|
-
return !de.test(t);
|
|
627
|
-
}), _ = new c.Box3(), y = new c.Vector3(), b = a.map((e, t) => {
|
|
628
|
-
let n = `seg_${t}`, r = e.name?.trim() || e.parent?.name?.trim() || `Segment ${t + 1}`, i = !g || !de.test(r);
|
|
629
|
-
return _.setFromObject(e), _.getSize(y), e.userData.segmentId = n, e.userData.destructible = i, e.userData.customName = r, {
|
|
630
|
-
segmentId: n,
|
|
631
|
-
originalName: r,
|
|
632
|
-
customName: r,
|
|
633
|
-
destructible: i,
|
|
634
|
-
triCount: fe(e.geometry),
|
|
635
|
-
bboxSizeM: [
|
|
636
|
-
$(Math.max(.002, y.x)),
|
|
637
|
-
$(Math.max(.002, y.y)),
|
|
638
|
-
$(Math.max(.002, y.z))
|
|
639
|
-
]
|
|
640
|
-
};
|
|
641
|
-
}), x = [
|
|
642
|
-
$(Math.max(.02, m.x)),
|
|
643
|
-
$(Math.max(.02, m.y)),
|
|
644
|
-
$(Math.max(.02, m.z))
|
|
645
|
-
];
|
|
646
|
-
return {
|
|
647
|
-
root: h,
|
|
648
|
-
fileName: t,
|
|
649
|
-
segments: b,
|
|
650
|
-
bboxSizeM: x,
|
|
651
|
-
normalizedExtent: $(Math.max(...x)),
|
|
652
|
-
halfExtents: [
|
|
653
|
-
Math.max(.015, x[0] * .5),
|
|
654
|
-
Math.max(.015, x[1] * .5),
|
|
655
|
-
Math.max(.015, x[2] * .5)
|
|
656
|
-
],
|
|
657
|
-
dispose: () => Q(h)
|
|
658
|
-
};
|
|
659
|
-
}
|
|
660
|
-
async function he(e, t = "imported.glb") {
|
|
661
|
-
if (!e) throw Error("No GLB URL provided.");
|
|
662
|
-
let n = await fetch(e);
|
|
663
|
-
if (!n.ok) throw Error(`Failed to fetch GLB "${t}" (${n.status}).`);
|
|
664
|
-
return me(await n.arrayBuffer(), t);
|
|
665
|
-
}
|
|
666
|
-
function ge(e, t, n) {
|
|
667
|
-
e.fillStyle = "#f8fafc", e.fillRect(0, 0, t, n), e.fillStyle = "#0f172a", e.fillRect(0, 0, t * .14, n), e.fillRect(t * .86, 0, t * .14, n);
|
|
668
|
-
let r = t * .5, i = n * .5;
|
|
669
|
-
for (let [t, n] of [
|
|
670
|
-
[108, "#0f172a"],
|
|
671
|
-
[86, "#f8fafc"],
|
|
672
|
-
[64, "#dc2626"],
|
|
673
|
-
[42, "#f8fafc"],
|
|
674
|
-
[22, "#ef4444"],
|
|
675
|
-
[9, "#facc15"]
|
|
676
|
-
]) e.beginPath(), e.arc(r, i, t, 0, Math.PI * 2), e.fillStyle = n, e.fill();
|
|
677
|
-
e.strokeStyle = "#0f172a", e.lineWidth = 3, e.beginPath(), e.moveTo(r - 118, i), e.lineTo(r - 90, i), e.moveTo(r + 90, i), e.lineTo(r + 118, i), e.moveTo(r, i - 118), e.lineTo(r, i - 90), e.moveTo(r, i + 90), e.lineTo(r, i + 118), e.stroke();
|
|
678
|
-
}
|
|
679
|
-
function _e(e, t, n) {
|
|
680
|
-
e.fillStyle = "#facc15", e.fillRect(0, 0, t, n), e.fillStyle = "#eab308";
|
|
681
|
-
for (let r = 24; r < t; r += 48) for (let t = 24; t < n; t += 48) e.beginPath(), e.arc(r, t, 8, 0, Math.PI * 2), e.fill();
|
|
682
|
-
let r = t * .5, i = n * .5;
|
|
683
|
-
e.beginPath(), e.arc(r, i, 96, 0, Math.PI * 2), e.fillStyle = "#fde047", e.fill(), e.lineWidth = 7, e.strokeStyle = "#18181b", e.stroke(), e.fillStyle = "#ffffff", e.beginPath(), e.arc(r - 34, i - 22, 24, 0, Math.PI * 2), e.arc(r + 34, i - 26, 17, 0, Math.PI * 2), e.fill(), e.stroke(), e.fillStyle = "#18181b", e.beginPath(), e.arc(r - 26, i - 18, 9, 0, Math.PI * 2), e.arc(r + 38, i - 30, 8, 0, Math.PI * 2), e.fill(), e.beginPath(), e.arc(r, i + 12, 52, .1 * Math.PI, .9 * Math.PI), e.fillStyle = "#7f1d1d", e.fill(), e.stroke(), e.fillStyle = "#fb7185", e.beginPath(), e.ellipse(r + 12, i + 56, 20, 24, .12, 0, Math.PI * 2), e.fill(), e.stroke(), e.fillStyle = "#ffffff", e.fillRect(r - 22, i + 16, 16, 14), e.fillRect(r + 4, i + 16, 16, 14);
|
|
684
|
-
}
|
|
685
|
-
function ve(e, t, n) {
|
|
686
|
-
let r = e.createLinearGradient(0, 0, t, n);
|
|
687
|
-
r.addColorStop(0, "#0284c7"), r.addColorStop(.5, "#06b6d4"), r.addColorStop(1, "#2563eb"), e.fillStyle = r, e.fillRect(0, 0, t, n), e.fillStyle = "#ec4899", e.beginPath(), e.moveTo(0, n * .72), e.lineTo(t, n * .25), e.lineTo(t, n * .42), e.lineTo(0, n * .89), e.closePath(), e.fill(), e.fillStyle = "#fde047", e.fillRect(0, 14, t, 14), e.fillRect(0, n - 28, t, 14), e.fillStyle = "rgba(255,255,255,0.45)";
|
|
688
|
-
for (let [t, n, r] of [
|
|
689
|
-
[
|
|
690
|
-
130,
|
|
691
|
-
70,
|
|
692
|
-
10
|
|
693
|
-
],
|
|
694
|
-
[
|
|
695
|
-
165,
|
|
696
|
-
190,
|
|
697
|
-
14
|
|
698
|
-
],
|
|
699
|
-
[
|
|
700
|
-
350,
|
|
701
|
-
62,
|
|
702
|
-
12
|
|
703
|
-
],
|
|
704
|
-
[
|
|
705
|
-
380,
|
|
706
|
-
185,
|
|
707
|
-
9
|
|
708
|
-
]
|
|
709
|
-
]) e.beginPath(), e.arc(t, n, r, 0, Math.PI * 2), e.fill();
|
|
710
|
-
let i = t * .5, a = n * .5;
|
|
711
|
-
e.fillStyle = "#0f172a", e.fillRect(i - 122, a - 48, 244, 96), e.strokeStyle = "#fde047", e.lineWidth = 5, e.strokeRect(i - 122, a - 48, 244, 96), e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = "#fde047", e.font = "bold 34px sans-serif", e.fillText("TRIS' SODA", i, a - 12), e.fillStyle = "#67e8f9", e.font = "bold 18px monospace", e.fillText("DREAMCAST FIZZ", i, a + 24);
|
|
712
|
-
}
|
|
713
|
-
function ye(e, t, n) {
|
|
714
|
-
e.fillStyle = "#fef3c7", e.fillRect(0, 0, t, n), e.fillStyle = "#b91c1c", e.fillRect(0, 0, t, n * .46), e.fillStyle = "#1e3a8a", e.fillRect(0, n * .8, t, n * .2), e.fillStyle = "#f59e0b", e.fillRect(0, n * .45, t, 10);
|
|
715
|
-
let r = t * .5;
|
|
716
|
-
e.beginPath(), e.ellipse(r, n * .62, 62, 34, 0, 0, Math.PI * 2), e.fillStyle = "#78350f", e.fill(), e.lineWidth = 4, e.strokeStyle = "#f59e0b", e.stroke(), e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = "#fef3c7", e.font = "bold 36px serif", e.fillText("GARY'S", r, 46), e.fillStyle = "#fde047", e.font = "bold 28px sans-serif", e.fillText("BEANS", r, 88), e.fillStyle = "#fef3c7", e.font = "bold 18px sans-serif", e.fillText("BAKED IN SAUCE", r, n * .62);
|
|
717
|
-
}
|
|
718
|
-
function be(e, t, n = 512, r = 256) {
|
|
719
|
-
switch (t) {
|
|
720
|
-
case "target":
|
|
721
|
-
ge(e, n, r);
|
|
722
|
-
break;
|
|
723
|
-
case "goofy-emoji":
|
|
724
|
-
_e(e, n, r);
|
|
725
|
-
break;
|
|
726
|
-
case "tris-soda":
|
|
727
|
-
ve(e, n, r);
|
|
728
|
-
break;
|
|
729
|
-
case "garys-beans": ye(e, n, r);
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
// src/junk/junkLabels.ts
|
|
733
|
-
var xe = /* @__PURE__ */ new Map();
|
|
734
|
-
function Se(e) {
|
|
735
|
-
return e.colorSpace = c.SRGBColorSpace, e.wrapS = c.RepeatWrapping, e.wrapT = c.ClampToEdgeWrapping, e.flipY = !0, e.anisotropy = 1, e.needsUpdate = !0, e;
|
|
736
|
-
}
|
|
737
|
-
function Ce(e, t) {
|
|
738
|
-
if (typeof document > "u") return null;
|
|
739
|
-
let n = e === "custom" ? "target" : e, r = t?.cache !== !1;
|
|
740
|
-
if (r) {
|
|
741
|
-
let e = xe.get(n);
|
|
742
|
-
if (e) return e;
|
|
743
|
-
}
|
|
744
|
-
let i = document.createElement("canvas");
|
|
745
|
-
i.width = 512, i.height = 256;
|
|
746
|
-
let a = i.getContext("2d");
|
|
747
|
-
if (!a) return null;
|
|
748
|
-
be(a, n, i.width, i.height);
|
|
749
|
-
let o = Se(new c.CanvasTexture(i));
|
|
750
|
-
return r && xe.set(n, o), o;
|
|
751
|
-
}
|
|
752
|
-
function we(e) {
|
|
753
|
-
return new Promise((t, n) => {
|
|
754
|
-
!e || typeof e != "string" ? n(/* @__PURE__ */ Error("Invalid custom label URL.")) : new c.TextureLoader().load(e, (e) => {
|
|
755
|
-
Se(e), t({
|
|
756
|
-
texture: e,
|
|
757
|
-
dispose: () => e.dispose()
|
|
758
|
-
});
|
|
759
|
-
}, void 0, () => {
|
|
760
|
-
n(/* @__PURE__ */ Error("Failed to decode custom label image from URL."));
|
|
761
|
-
});
|
|
762
|
-
});
|
|
763
|
-
}
|
|
764
|
-
// src/junk/useTargetAssets.ts
|
|
765
|
-
function Te(e, t) {
|
|
766
|
-
let [n, i] = s(() => C(10, e.canLodMode)), [o, c] = s(null), [l, u] = s(null), d = e.canLodMode === "auto" ? n : e.canLodMode;
|
|
767
|
-
r(() => {
|
|
768
|
-
e.canLodMode !== "auto" && i(e.canLodMode);
|
|
769
|
-
}, [e.canLodMode]), r(() => {
|
|
770
|
-
if (e.labelId !== "custom" || !e.customAlbedoUrl) {
|
|
771
|
-
c(null);
|
|
772
|
-
return;
|
|
773
|
-
}
|
|
774
|
-
let t = !1, n = null;
|
|
775
|
-
return we(e.customAlbedoUrl).then((e) => {
|
|
776
|
-
t ? e.dispose() : (n = e.dispose, c(e.texture));
|
|
777
|
-
}).catch(() => {
|
|
778
|
-
t || c(null);
|
|
779
|
-
}), () => {
|
|
780
|
-
t = !0, n?.();
|
|
781
|
-
};
|
|
782
|
-
}, [e.labelId, e.customAlbedoUrl]), r(() => {
|
|
783
|
-
if (e.kind !== "imported-glb" || t || !e.importedUrl) {
|
|
784
|
-
u(null);
|
|
785
|
-
return;
|
|
786
|
-
}
|
|
787
|
-
let n = !1, r = null;
|
|
788
|
-
return he(e.importedUrl, e.id).then((e) => {
|
|
789
|
-
n ? e.dispose() : (r = e, u(e));
|
|
790
|
-
}).catch(() => {
|
|
791
|
-
n || u(null);
|
|
792
|
-
}), () => {
|
|
793
|
-
n = !0, r?.dispose();
|
|
794
|
-
};
|
|
795
|
-
}, [
|
|
796
|
-
e.kind,
|
|
797
|
-
e.importedUrl,
|
|
798
|
-
e.id,
|
|
799
|
-
t
|
|
800
|
-
]);
|
|
801
|
-
let f = t ?? l, p = a(() => f ? t ? f.root.clone(!0) : f.root : null, [f, t]);
|
|
802
|
-
r(() => {
|
|
803
|
-
p && e.segments && pe(p, e.segments);
|
|
804
|
-
}, [p, e.segments]);
|
|
805
|
-
let m = a(() => e.kind === "tin-can" ? T("3-gon") : null, [e.kind]), h = a(() => e.kind === "tin-can" ? T("12-gon") : null, [e.kind]), g = a(() => e.kind === "glass-bottle" ? E() : null, [e.kind]), _ = a(() => e.kind === "glass-bottle" ? D() : null, [e.kind]);
|
|
806
|
-
r(() => () => {
|
|
807
|
-
m?.dispose(), h?.dispose(), g?.dispose(), _?.dispose();
|
|
808
|
-
}, [
|
|
809
|
-
m,
|
|
810
|
-
h,
|
|
811
|
-
g,
|
|
812
|
-
_
|
|
813
|
-
]);
|
|
814
|
-
let v = a(() => e.labelId === "custom" && o ? o : Ce(e.labelId), [e.labelId, o]), y = a(() => e.kind === "tin-can" ? O(v) : null, [e.kind, v]);
|
|
815
|
-
r(() => () => {
|
|
816
|
-
y?.forEach((e) => e.dispose());
|
|
817
|
-
}, [y]);
|
|
818
|
-
let b = a(() => {
|
|
819
|
-
if (e.kind === "tin-can") {
|
|
820
|
-
let e = d === "3-gon" ? m : h;
|
|
821
|
-
return e ? w(e) : 0;
|
|
822
|
-
}
|
|
823
|
-
return e.kind === "glass-bottle" ? g ? w(g) : 0 : f ? f.segments.reduce((e, t) => e + t.triCount, 0) : 0;
|
|
824
|
-
}, [
|
|
825
|
-
e.kind,
|
|
826
|
-
d,
|
|
827
|
-
m,
|
|
828
|
-
h,
|
|
829
|
-
g,
|
|
830
|
-
f
|
|
831
|
-
]), x = !!(e.labelId === "custom" && e.customAlbedoUrl && o), S = f?.halfExtents ?? null, k = f?.fileName ?? "glb";
|
|
832
|
-
return a(() => ({
|
|
833
|
-
effectiveLod: d,
|
|
834
|
-
setActiveLod: i,
|
|
835
|
-
can3Geo: m,
|
|
836
|
-
can12Geo: h,
|
|
837
|
-
canMats: y,
|
|
838
|
-
bottleGeo: g,
|
|
839
|
-
bottleMat: _,
|
|
840
|
-
activeLabelTex: v,
|
|
841
|
-
customLabelLoaded: x,
|
|
842
|
-
importedRoot: p,
|
|
843
|
-
importedHalfExtents: S,
|
|
844
|
-
importedKey: k,
|
|
845
|
-
triCount: b
|
|
846
|
-
}), [
|
|
847
|
-
d,
|
|
848
|
-
m,
|
|
849
|
-
h,
|
|
850
|
-
y,
|
|
851
|
-
g,
|
|
852
|
-
_,
|
|
853
|
-
v,
|
|
854
|
-
x,
|
|
855
|
-
p,
|
|
856
|
-
S,
|
|
857
|
-
k,
|
|
858
|
-
b
|
|
859
|
-
]);
|
|
860
|
-
}
|
|
861
|
-
// src/junk/DestructibleTarget.tsx
|
|
862
|
-
var Ee = new c.Vector3(), De = t(function({ spec: e, active: t = !0, importedAsset: c, onHit: l, onShatter: d, onStateChange: v, registerTarget: y }, b) {
|
|
863
|
-
let x = o(null), S = o(null), w = o(null), T = o(/* @__PURE__ */ new Map()), [E, D] = s(!0), [O, k] = s(e.hp), [A, j] = s([]), [M, N] = s([]), [P, F] = s(null), I = o(!0), L = o(e.hp), R = o(0), z = o([]), B = o([]), V = o([...e.position]), H = Te(e, c), U = o(e);
|
|
864
|
-
U.current = e;
|
|
865
|
-
let W = o(H);
|
|
866
|
-
W.current = H;
|
|
867
|
-
let G = o({
|
|
868
|
-
onHit: l,
|
|
869
|
-
onShatter: d,
|
|
870
|
-
onStateChange: v,
|
|
871
|
-
registerTarget: y
|
|
872
|
-
});
|
|
873
|
-
G.current = {
|
|
874
|
-
onHit: l,
|
|
875
|
-
onShatter: d,
|
|
876
|
-
onStateChange: v,
|
|
877
|
-
registerTarget: y
|
|
878
|
-
};
|
|
879
|
-
let K = n(() => ie(U.current, W.current, x.current, L.current, I.current, z.current.length, B.current.length, V.current), []), q = n((e) => {
|
|
880
|
-
if (!I.current) return;
|
|
881
|
-
let t = U.current, n = re(t, W.current, x.current, S.current, w.current, L.current, `${t.id}-d-${++R.current}`, e);
|
|
882
|
-
if (n.shattered && n.shardStates && n.shardMaterial) n.shatterPos && (V.current = n.shatterPos), x.current = null, I.current = !1, L.current = 0, z.current = [], B.current = n.shardStates, T.current.clear(), k(0), j([]), F(n.shardMaterial), N(n.shardStates), D(!1), G.current.onShatter?.(t.id, n.shardSpecs ?? [], e);
|
|
883
|
-
else if (n.bodyPos && (V.current = n.bodyPos), L.current = n.nextHp, k(n.nextHp), n.newDecal) {
|
|
884
|
-
let r = oe(z.current, n.newDecal, T.current, n.newDecalMesh);
|
|
885
|
-
z.current = r, j(r), G.current.onHit?.(t.id, e, n.nextHp, r);
|
|
886
|
-
} else G.current.onHit?.(t.id, e, n.nextHp, z.current);
|
|
887
|
-
}, []), J = a(() => ({
|
|
888
|
-
applyHit: q,
|
|
889
|
-
getSnapshot: K
|
|
890
|
-
}), [q, K]);
|
|
891
|
-
if (i(b, () => J, [J]), r(() => (G.current.registerTarget?.(e.id, J), x.current?.recomputeMassPropertiesFromColliders?.(), () => G.current.registerTarget?.(e.id, null)), [e.id, J]), r(() => {
|
|
892
|
-
G.current.onStateChange?.(K());
|
|
893
|
-
}, [
|
|
894
|
-
K,
|
|
895
|
-
E,
|
|
896
|
-
O,
|
|
897
|
-
A.length,
|
|
898
|
-
M.length,
|
|
899
|
-
H.effectiveLod,
|
|
900
|
-
H.triCount,
|
|
901
|
-
H.customLabelLoaded
|
|
902
|
-
]), r(() => {
|
|
903
|
-
se(H.importedRoot, e.id, q);
|
|
904
|
-
}, [
|
|
905
|
-
H.importedRoot,
|
|
906
|
-
e.id,
|
|
907
|
-
q
|
|
908
|
-
]), u(({ camera: n }) => {
|
|
909
|
-
if (!t || !I.current || e.kind !== "tin-can" || e.canLodMode !== "auto" || !ce(x.current, S.current, Ee)) return;
|
|
910
|
-
let r = C(n.position.distanceTo(Ee), "auto");
|
|
911
|
-
r !== H.effectiveLod && H.setActiveLod(r);
|
|
912
|
-
}), !E) return /* @__PURE__ */ p(te, {
|
|
913
|
-
shards: M,
|
|
914
|
-
material: P
|
|
915
|
-
});
|
|
916
|
-
let ee = e.kind === "imported-glb" && !H.importedHalfExtents, Y = {
|
|
917
|
-
targetId: e.id,
|
|
918
|
-
destructibleTarget: !0,
|
|
919
|
-
isDestructibleTarget: !0,
|
|
920
|
-
applyHit: q
|
|
921
|
-
};
|
|
922
|
-
return /* @__PURE__ */ m(_, {
|
|
923
|
-
ref: x,
|
|
924
|
-
type: ee ? "fixed" : "dynamic",
|
|
925
|
-
colliders: !1,
|
|
926
|
-
position: e.position,
|
|
927
|
-
restitution: .18,
|
|
928
|
-
friction: .45,
|
|
929
|
-
linearDamping: 1.2,
|
|
930
|
-
angularDamping: 8,
|
|
931
|
-
userData: Y,
|
|
932
|
-
children: [
|
|
933
|
-
e.kind === "tin-can" && /* @__PURE__ */ p(g, {
|
|
934
|
-
args: [.125, .085],
|
|
935
|
-
density: 180
|
|
936
|
-
}),
|
|
937
|
-
e.kind === "glass-bottle" && /* @__PURE__ */ p(g, {
|
|
938
|
-
args: [.16, .055],
|
|
939
|
-
density: 1200
|
|
940
|
-
}),
|
|
941
|
-
e.kind === "imported-glb" && /* @__PURE__ */ p(h, {
|
|
942
|
-
args: H.importedHalfExtents ?? [
|
|
943
|
-
.2,
|
|
944
|
-
.2,
|
|
945
|
-
.2
|
|
946
|
-
],
|
|
947
|
-
density: 800
|
|
948
|
-
}),
|
|
949
|
-
/* @__PURE__ */ m("group", {
|
|
950
|
-
ref: S,
|
|
951
|
-
userData: Y,
|
|
952
|
-
children: [
|
|
953
|
-
e.kind === "tin-can" && H.canMats && /* @__PURE__ */ p("mesh", {
|
|
954
|
-
ref: w,
|
|
955
|
-
geometry: (H.effectiveLod === "3-gon" ? H.can3Geo : H.can12Geo) ?? void 0,
|
|
956
|
-
material: H.canMats,
|
|
957
|
-
castShadow: !0,
|
|
958
|
-
receiveShadow: !0,
|
|
959
|
-
userData: Y,
|
|
960
|
-
children: /* @__PURE__ */ p(X, {
|
|
961
|
-
decals: A,
|
|
962
|
-
lodKey: H.effectiveLod
|
|
963
|
-
})
|
|
964
|
-
}),
|
|
965
|
-
e.kind === "glass-bottle" && H.bottleGeo && H.bottleMat && /* @__PURE__ */ p("mesh", {
|
|
966
|
-
ref: w,
|
|
967
|
-
geometry: H.bottleGeo,
|
|
968
|
-
material: H.bottleMat,
|
|
969
|
-
castShadow: !0,
|
|
970
|
-
userData: Y,
|
|
971
|
-
children: /* @__PURE__ */ p(X, {
|
|
972
|
-
decals: A,
|
|
973
|
-
lodKey: "bottle"
|
|
974
|
-
})
|
|
975
|
-
}),
|
|
976
|
-
e.kind === "imported-glb" && H.importedRoot && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("primitive", { object: H.importedRoot }), /* @__PURE__ */ p(X, {
|
|
977
|
-
decals: A,
|
|
978
|
-
lodKey: H.importedKey,
|
|
979
|
-
meshRefMap: T.current
|
|
980
|
-
})] })
|
|
981
|
-
]
|
|
982
|
-
})
|
|
983
|
-
]
|
|
984
|
-
});
|
|
985
|
-
});
|
|
986
|
-
// src/junk/KolmoJunk.tsx
|
|
987
|
-
function Oe({ id: e, kind: t = "glass-bottle", labelId: n = "tris-soda", position: r = [
|
|
988
|
-
0,
|
|
989
|
-
.4,
|
|
990
|
-
0
|
|
991
|
-
], hp: i = t === "glass-bottle" ? 25 : 60, fragile: s = t === "glass-bottle", shatterPieceCount: c = 7, canLodMode: l = "auto", importedUrl: u = null }) {
|
|
992
|
-
let d = o(null), f = a(() => ({
|
|
993
|
-
id: e,
|
|
994
|
-
kind: t,
|
|
995
|
-
labelId: n,
|
|
996
|
-
customAlbedoUrl: null,
|
|
997
|
-
canLodMode: l,
|
|
998
|
-
position: r,
|
|
999
|
-
hp: i,
|
|
1000
|
-
maxHp: i,
|
|
1001
|
-
fragile: s,
|
|
1002
|
-
shatterPieceCount: c,
|
|
1003
|
-
importedUrl: u
|
|
1004
|
-
}), [
|
|
1005
|
-
e,
|
|
1006
|
-
t,
|
|
1007
|
-
n,
|
|
1008
|
-
l,
|
|
1009
|
-
r,
|
|
1010
|
-
i,
|
|
1011
|
-
s,
|
|
1012
|
-
c,
|
|
1013
|
-
u
|
|
1014
|
-
]);
|
|
1015
|
-
return /* @__PURE__ */ p("group", {
|
|
1016
|
-
onClick: (t) => {
|
|
1017
|
-
t.stopPropagation();
|
|
1018
|
-
let n = t.point, r = t.face?.normal;
|
|
1019
|
-
d.current?.applyHit({
|
|
1020
|
-
targetId: e,
|
|
1021
|
-
point: [
|
|
1022
|
-
n.x,
|
|
1023
|
-
n.y,
|
|
1024
|
-
n.z
|
|
1025
|
-
],
|
|
1026
|
-
normal: r ? [
|
|
1027
|
-
r.x,
|
|
1028
|
-
r.y,
|
|
1029
|
-
r.z
|
|
1030
|
-
] : [
|
|
1031
|
-
0,
|
|
1032
|
-
0,
|
|
1033
|
-
1
|
|
1034
|
-
],
|
|
1035
|
-
impulse: [
|
|
1036
|
-
0,
|
|
1037
|
-
1.4,
|
|
1038
|
-
-3.2
|
|
1039
|
-
],
|
|
1040
|
-
distance: t.distance
|
|
1041
|
-
});
|
|
1042
|
-
},
|
|
1043
|
-
children: /* @__PURE__ */ p(De, {
|
|
1044
|
-
ref: d,
|
|
1045
|
-
spec: f
|
|
1046
|
-
})
|
|
1047
|
-
});
|
|
1048
|
-
}
|
|
1049
|
-
export { O as C, D as S, b as _, pe as a, T as b, Q as c, ne as d, te as f, S as g, x as h, we as i, ue as l, j as m, De as n, he as o, P as p, Ce as r, me as s, Oe as t, X as u, y as v, C as w, w as x, E as y };
|