softbox 4.5.0 → 4.7.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/README.md +14 -3
- package/dist/{ThreePathTracingService-rw6SCxcL.cjs → ThreePathTracingService-CL_k3WTj.cjs} +13 -13
- package/dist/{ThreePathTracingService-DDmobGTv.js → ThreePathTracingService-DbqedkL2.js} +87 -87
- package/dist/index-BtN2xOzS.cjs +11 -0
- package/dist/{index-CC3LzFRV.js → index-DXbG9xpu.js} +1071 -1009
- package/dist/simple-viewer.cjs +1 -1
- package/dist/simple-viewer.es.js +1 -1
- package/package.json +1 -1
- package/dist/index-CadyonSB.cjs +0 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as Te, jsxs as Vn } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as Nt, useState as xn, useEffect as rt, useRef as Ge, useCallback as Rt, createContext as Wa, useContext as Za, Component as Ka, forwardRef as mo, useImperativeHandle as Xa } from "react";
|
|
3
3
|
import * as w from "three";
|
|
4
|
-
import { Box3 as _t, Matrix4 as ut, BufferAttribute as Wn, Vector3 as $, Line3 as kt, Plane as Jn, Vector2 as fe, Triangle as wn, BackSide as go, DoubleSide as yo, REVISION as wo, Ray as Xi, FrontSide as Ai, Mesh as wt, LineSegments as Yi, LineLoop as qi, Line as $i, Points as Qi, Sphere as Eo, BatchedMesh as Ya, TrianglesDrawMode as qa, TriangleFanDrawMode as vi, TriangleStripDrawMode as To, Loader as $a, LoaderUtils as Zn, FileLoader as _o, MeshPhysicalMaterial as Mt, Color as tn, LinearSRGBColorSpace as je, SRGBColorSpace as $n, SpotLight as Qa, PointLight as
|
|
4
|
+
import { Box3 as _t, Matrix4 as ut, BufferAttribute as Wn, Vector3 as $, Line3 as kt, Plane as Jn, Vector2 as fe, Triangle as wn, BackSide as go, DoubleSide as yo, REVISION as wo, Ray as Xi, FrontSide as Ai, Mesh as wt, LineSegments as Yi, LineLoop as qi, Line as $i, Points as Qi, Sphere as Eo, BatchedMesh as Ya, TrianglesDrawMode as qa, TriangleFanDrawMode as vi, TriangleStripDrawMode as To, Loader as $a, LoaderUtils as Zn, FileLoader as _o, MeshPhysicalMaterial as Mt, Color as tn, LinearSRGBColorSpace as je, SRGBColorSpace as $n, SpotLight as Qa, PointLight as bo, DirectionalLight as Ja, Quaternion as An, InstancedMesh as So, InstancedBufferAttribute as ec, Object3D as Ji, TextureLoader as tc, ImageBitmapLoader as nc, InterleavedBuffer as sc, InterleavedBufferAttribute as ic, LinearMipmapLinearFilter as xo, NearestMipmapLinearFilter as rc, LinearMipmapNearestFilter as oc, NearestMipmapNearestFilter as ac, LinearFilter as nn, NearestFilter as Ao, RepeatWrapping as Ri, MirroredRepeatWrapping as cc, ClampToEdgeWrapping as lc, PointsMaterial as hc, Material as ti, LineBasicMaterial as uc, MeshStandardMaterial as js, MeshBasicMaterial as Gn, PropertyBinding as dc, BufferGeometry as pc, SkinnedMesh as fc, Group as ni, PerspectiveCamera as mc, MathUtils as er, OrthographicCamera as gc, Skeleton as yc, AnimationClip as wc, Bone as Ec, InterpolateDiscrete as Tc, InterpolateLinear as vo, Texture as Sr, VectorKeyframeTrack as xr, NumberKeyframeTrack as Ar, QuaternionKeyframeTrack as vr, ColorManagement as Rr, Interpolant as _c, Controls as Ro, MOUSE as Be, TOUCH as Ye, Spherical as Gs, Raycaster as bc, DataTextureLoader as Mo, HalfFloatType as Wt, RGBAFormat as qt, RGFormat as Pn, DataUtils as Et, RedFormat as ps, FloatType as Kn, Scene as Sc, BoxGeometry as xc, MeshLambertMaterial as Ac } from "three";
|
|
5
5
|
class W extends Error {
|
|
6
6
|
constructor(e, t, n) {
|
|
7
7
|
super(e), this.code = t, this.context = n, this.name = "ThreeViewerError", this.timestamp = /* @__PURE__ */ new Date(), Error.captureStackTrace && Error.captureStackTrace(this, W);
|
|
@@ -91,7 +91,7 @@ class tr {
|
|
|
91
91
|
this.off(e, t);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
const Mr = 300,
|
|
94
|
+
const Mr = 300, si = {
|
|
95
95
|
meters: 1,
|
|
96
96
|
centimeters: 0.01,
|
|
97
97
|
millimeters: 1e-3,
|
|
@@ -100,12 +100,12 @@ const Mr = 300, ni = {
|
|
|
100
100
|
}, vc = "softbox-units-scale";
|
|
101
101
|
function Co(i) {
|
|
102
102
|
const e = i ?? "meters";
|
|
103
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
103
|
+
if (!Object.prototype.hasOwnProperty.call(si, e))
|
|
104
104
|
throw new W(
|
|
105
|
-
`Unknown units '${String(e)}'. Valid values: ${Object.keys(
|
|
105
|
+
`Unknown units '${String(e)}'. Valid values: ${Object.keys(si).join(", ")}`,
|
|
106
106
|
K.INVALID_PARAMETER
|
|
107
107
|
);
|
|
108
|
-
return
|
|
108
|
+
return si[e];
|
|
109
109
|
}
|
|
110
110
|
const Cr = "#1a1a1f";
|
|
111
111
|
class Rc {
|
|
@@ -161,7 +161,7 @@ class Rc {
|
|
|
161
161
|
* aborts before touching a disposed renderer/scene.
|
|
162
162
|
*/
|
|
163
163
|
async configureEnvironment(e, t, n, s, o, r) {
|
|
164
|
-
var d, h, p, f, y,
|
|
164
|
+
var d, h, p, f, y, S;
|
|
165
165
|
const a = await t.initialize({ renderer: s, autoDispose: !0 });
|
|
166
166
|
if (r())
|
|
167
167
|
return;
|
|
@@ -182,12 +182,12 @@ class Rc {
|
|
|
182
182
|
if (t.applyToScene(e, _.value, {
|
|
183
183
|
...c,
|
|
184
184
|
setBackground: !1
|
|
185
|
-
}), (
|
|
186
|
-
const
|
|
185
|
+
}), (S = o.helpers) != null && S.darkStudioMode && n) {
|
|
186
|
+
const A = n.createGradientBackground(e, {
|
|
187
187
|
topColor: Cr,
|
|
188
188
|
bottomColor: Cr
|
|
189
189
|
});
|
|
190
|
-
|
|
190
|
+
A.ok || console.warn("Failed to set dark studio background:", A.error);
|
|
191
191
|
}
|
|
192
192
|
} else
|
|
193
193
|
console.warn("Failed to create studio environment:", _.error);
|
|
@@ -280,7 +280,7 @@ class Mc {
|
|
|
280
280
|
function fs(i) {
|
|
281
281
|
return typeof i == "object" && i !== null && !Array.isArray(i);
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function Vs(i, e) {
|
|
284
284
|
if (!fs(i) || !fs(e))
|
|
285
285
|
return e === void 0 ? i : e;
|
|
286
286
|
const t = e, n = { ...i };
|
|
@@ -289,7 +289,7 @@ function Gs(i, e) {
|
|
|
289
289
|
if (o === void 0)
|
|
290
290
|
continue;
|
|
291
291
|
const r = n[s];
|
|
292
|
-
n[s] = fs(r) && fs(o) ?
|
|
292
|
+
n[s] = fs(r) && fs(o) ? Vs(r, o) : o;
|
|
293
293
|
}
|
|
294
294
|
return n;
|
|
295
295
|
}
|
|
@@ -784,7 +784,7 @@ class Lc {
|
|
|
784
784
|
}
|
|
785
785
|
class Oc {
|
|
786
786
|
constructor(e) {
|
|
787
|
-
this.completeHandled = !1, this.suspendedForAnimation = !1, this.selfPauseListeners = /* @__PURE__ */ new Set(), this.deps = e;
|
|
787
|
+
this.completeHandled = !1, this.suspendedForAnimation = !1, this.initialized = !1, this.initializing = !1, this.selfPauseListeners = /* @__PURE__ */ new Set(), this.deps = e;
|
|
788
788
|
}
|
|
789
789
|
/** True when a service exists and the options ask for path tracing. */
|
|
790
790
|
isEnabled() {
|
|
@@ -814,31 +814,65 @@ class Oc {
|
|
|
814
814
|
return this.selfPauseListeners.add(e), () => this.selfPauseListeners.delete(e);
|
|
815
815
|
}
|
|
816
816
|
async initialize() {
|
|
817
|
-
|
|
817
|
+
this.isEnabled() && await this.ensureInitialized();
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* Load and configure the tracer once — on boot if it starts enabled, or on
|
|
821
|
+
* the first runtime enable. The three-gpu-pathtracer chunk imports here, so
|
|
822
|
+
* keeping it out of the boot path when path tracing is off is what the lazy
|
|
823
|
+
* service buys us. Idempotent: repeated calls after the first are no-ops.
|
|
824
|
+
*/
|
|
825
|
+
async ensureInitialized() {
|
|
818
826
|
const { service: e, getOptions: t, isDisposed: n, renderer: s, renderLoopManager: o, schedule: r } = this.deps;
|
|
819
|
-
if (!e ||
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
+
if (!(!e || this.initialized || this.initializing)) {
|
|
828
|
+
this.initializing = !0;
|
|
829
|
+
try {
|
|
830
|
+
const a = await e.initialize({ enabled: !0, renderer: s });
|
|
831
|
+
if (n())
|
|
832
|
+
return;
|
|
833
|
+
if (!a.ok) {
|
|
834
|
+
console.warn("Failed to initialize path tracing:", a.error);
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
837
|
+
this.initialized = !0;
|
|
838
|
+
const c = t().pathTracing;
|
|
839
|
+
c && e.updateSettings({
|
|
840
|
+
samples: c.maxSamples ?? Mr,
|
|
841
|
+
bounces: c.bounces,
|
|
842
|
+
transmissiveBounces: c.transmissiveBounces,
|
|
843
|
+
renderScale: c.renderScale,
|
|
844
|
+
lowResScale: c.lowResScale,
|
|
845
|
+
dynamicLowRes: c.dynamicLowRes,
|
|
846
|
+
enablePathTracing: c.enabled ?? !0
|
|
847
|
+
}), e.events.on("pathtracing:paused", ({ reason: u }) => {
|
|
848
|
+
o.releaseContinuous("path-tracing"), t().staticScene || o.setAlwaysRender(!1), r(() => {
|
|
849
|
+
o.hasContinuousDemand() || o.stop();
|
|
850
|
+
}, 100), u === "gave-up" && this.selfPauseListeners.forEach((d) => d());
|
|
851
|
+
});
|
|
852
|
+
} finally {
|
|
853
|
+
this.initializing = !1;
|
|
854
|
+
}
|
|
827
855
|
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
856
|
+
}
|
|
857
|
+
/**
|
|
858
|
+
* Turn path tracing on for a live viewer (no rebuild, no model refetch).
|
|
859
|
+
* Loads the tracer on first use, ingests the current scene from scratch, and
|
|
860
|
+
* demands continuous frames so accumulation runs. Returns whether the tracer
|
|
861
|
+
* is now active — false when it could not initialize (e.g. no WebGL2).
|
|
862
|
+
*/
|
|
863
|
+
async enableRuntime() {
|
|
864
|
+
var s;
|
|
865
|
+
const { service: e, renderLoopManager: t, getOptions: n } = this.deps;
|
|
866
|
+
return !e || (await this.ensureInitialized(), !this.initialized) || !(((s = n().pathTracing) == null ? void 0 : s.enabled) ?? !1) ? !1 : (e.setEnabled(!0), e.reset(!0), this.completeHandled = !1, this.suspendedForAnimation = !1, t.requireContinuous("path-tracing"), !0);
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* Turn path tracing off for a live viewer: hand the canvas back to the raster
|
|
870
|
+
* renderer and drop the loop demand. The tracer stays loaded for a cheap
|
|
871
|
+
* re-enable.
|
|
872
|
+
*/
|
|
873
|
+
disableRuntime() {
|
|
874
|
+
const { service: e, renderLoopManager: t } = this.deps;
|
|
875
|
+
e && (e.setEnabled(!1), e.reset(), t.releaseContinuous("path-tracing"), this.completeHandled = !1, this.suspendedForAnimation = !1, this.selfPauseListeners.forEach((n) => n()));
|
|
842
876
|
}
|
|
843
877
|
/**
|
|
844
878
|
* Drop the accumulation (new model, camera move) so it restarts cleanly.
|
|
@@ -1030,10 +1064,10 @@ class Nc {
|
|
|
1030
1064
|
return this.deps.renderLoopManager.requireContinuous(u), this.deps.reviveRenderLoop(), this.deps.renderLoopManager.requestRender(), new Promise((h) => {
|
|
1031
1065
|
const p = [];
|
|
1032
1066
|
let f = null, y = !1;
|
|
1033
|
-
const
|
|
1034
|
-
y || (y = !0, this.pendingSettlers.delete(_), c(), f !== null && clearTimeout(f), this.deps.renderLoopManager.releaseContinuous(u), s.getTracks().forEach((E) => E.stop()), h(
|
|
1067
|
+
const S = (A) => {
|
|
1068
|
+
y || (y = !0, this.pendingSettlers.delete(_), c(), f !== null && clearTimeout(f), this.deps.renderLoopManager.releaseContinuous(u), s.getTracks().forEach((E) => E.stop()), h(A));
|
|
1035
1069
|
}, _ = () => {
|
|
1036
|
-
|
|
1070
|
+
S(
|
|
1037
1071
|
N.err(
|
|
1038
1072
|
new W("Viewer was disposed during video capture", K.INVALID_STATE)
|
|
1039
1073
|
)
|
|
@@ -1043,12 +1077,12 @@ class Nc {
|
|
|
1043
1077
|
} catch {
|
|
1044
1078
|
}
|
|
1045
1079
|
};
|
|
1046
|
-
this.pendingSettlers.add(_), o.ondataavailable = (
|
|
1047
|
-
|
|
1080
|
+
this.pendingSettlers.add(_), o.ondataavailable = (A) => {
|
|
1081
|
+
A.data.size > 0 && p.push(A.data);
|
|
1048
1082
|
}, o.onstop = () => {
|
|
1049
|
-
|
|
1083
|
+
S(N.ok(new Blob(p, { type: o.mimeType || "video/webm" })));
|
|
1050
1084
|
}, o.onerror = () => {
|
|
1051
|
-
|
|
1085
|
+
S(
|
|
1052
1086
|
N.err(
|
|
1053
1087
|
new W("Video recording failed", K.OPERATION_FAILED)
|
|
1054
1088
|
)
|
|
@@ -1128,7 +1162,7 @@ class Nc {
|
|
|
1128
1162
|
)
|
|
1129
1163
|
);
|
|
1130
1164
|
t.setPixelRatio(1), t.setSize(p, f), Mi(s, p / f);
|
|
1131
|
-
const
|
|
1165
|
+
const S = t.render(n, s), _ = S.ok ? this.readCanvasPng() : N.err(S.error);
|
|
1132
1166
|
return t.setSize(u, d), t.setPixelRatio(a), Mi(s, h), t.render(n, s), o.requestRender(), _;
|
|
1133
1167
|
}
|
|
1134
1168
|
readCanvasPng() {
|
|
@@ -1336,25 +1370,27 @@ class kc {
|
|
|
1336
1370
|
* helpers — take effect at construction time and require a rebuild.
|
|
1337
1371
|
*/
|
|
1338
1372
|
updateOptions(e) {
|
|
1339
|
-
var
|
|
1373
|
+
var f, y, S, _, A, E, T, b, x, P, C;
|
|
1340
1374
|
if (this.disposed)
|
|
1341
1375
|
return;
|
|
1342
|
-
const t = (
|
|
1343
|
-
this.options =
|
|
1344
|
-
let
|
|
1376
|
+
const t = (f = this.options.animations) == null ? void 0 : f.autoplay, n = (y = this.options.controls) == null ? void 0 : y.autoRotate, s = ((S = this.options.pathTracing) == null ? void 0 : S.enabled) ?? !1;
|
|
1377
|
+
this.options = Vs(this.options, e);
|
|
1378
|
+
let o = !1;
|
|
1345
1379
|
e.backgroundColor !== void 0 && this.applyBackgroundColor(e.backgroundColor);
|
|
1346
|
-
const
|
|
1347
|
-
|
|
1348
|
-
const
|
|
1349
|
-
|
|
1350
|
-
const
|
|
1351
|
-
|
|
1352
|
-
const
|
|
1353
|
-
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1356
|
-
const
|
|
1357
|
-
|
|
1380
|
+
const r = (_ = e.renderer) == null ? void 0 : _.toneMappingExposure;
|
|
1381
|
+
r !== void 0 && (this.renderer.setToneMappingExposure(r), o = !0);
|
|
1382
|
+
const a = (A = e.environment) == null ? void 0 : A.environmentIntensity;
|
|
1383
|
+
a !== void 0 && (this.scene.setEnvironmentIntensity(a), o = !0);
|
|
1384
|
+
const c = (E = e.controls) == null ? void 0 : E.autoRotate;
|
|
1385
|
+
c !== void 0 && c !== n && (this.controls.autoRotate = c, c ? (this.renderLoopManager.requireContinuous("turntable"), this.capture.notifyTurntableEnabled()) : this.renderLoopManager.releaseContinuous("turntable"), o = !0);
|
|
1386
|
+
const u = (T = e.controls) == null ? void 0 : T.autoRotateSpeed;
|
|
1387
|
+
u !== void 0 && (this.controls.autoRotateSpeed = u, o = !0);
|
|
1388
|
+
const d = (b = e.animations) == null ? void 0 : b.autoplay;
|
|
1389
|
+
d !== void 0 && d !== t && (d ? this.modelManager.getCurrentModel() && this.autoplayFromOptions(d) : this.pauseAnimations(), o = !0);
|
|
1390
|
+
const h = (x = e.animations) == null ? void 0 : x.speed;
|
|
1391
|
+
h !== void 0 && ((P = this.animationService) == null || P.setSpeed(h), o = !0);
|
|
1392
|
+
const p = (C = e.pathTracing) == null ? void 0 : C.enabled;
|
|
1393
|
+
p !== void 0 && p !== s && (this.setPathTracingEnabled(p), o = !0), o && (this.reviveRenderLoop(), this.renderLoopManager.requestRender());
|
|
1358
1394
|
}
|
|
1359
1395
|
applyBackgroundColor(e) {
|
|
1360
1396
|
var n;
|
|
@@ -1428,6 +1464,16 @@ class kc {
|
|
|
1428
1464
|
reviveRenderLoop() {
|
|
1429
1465
|
this.stateManager.isInitialized() && !this.renderLoopManager.isRunning() && this.startRenderLoop();
|
|
1430
1466
|
}
|
|
1467
|
+
/**
|
|
1468
|
+
* Toggle path tracing on a live viewer — no rebuild, no model refetch. The
|
|
1469
|
+
* enable path loads the tracer lazily, so it awaits; both paths then revive a
|
|
1470
|
+
* wound-down loop and request a frame. A dispose mid-await is guarded.
|
|
1471
|
+
*/
|
|
1472
|
+
setPathTracingEnabled(e) {
|
|
1473
|
+
e ? this.pathTracing.enableRuntime().then((t) => {
|
|
1474
|
+
t && !this.disposed && (this.reviveRenderLoop(), this.renderLoopManager.requestRender());
|
|
1475
|
+
}) : (this.pathTracing.disableRuntime(), this.reviveRenderLoop(), this.renderLoopManager.requestRender());
|
|
1476
|
+
}
|
|
1431
1477
|
/** Clip names of the loaded model, in file order (empty when none). */
|
|
1432
1478
|
getAnimationNames() {
|
|
1433
1479
|
var e;
|
|
@@ -1590,7 +1636,7 @@ class Kt {
|
|
|
1590
1636
|
return new Kt(new w.Vector3(e, t, n));
|
|
1591
1637
|
}
|
|
1592
1638
|
}
|
|
1593
|
-
const Oo = 0, Fc = 1, zc = 2, Ir = 2,
|
|
1639
|
+
const Oo = 0, Fc = 1, zc = 2, Ir = 2, ii = 1.25, Pr = 1, qe = 32, Oe = qe / 4, nr = 65535, Qd = nr << 16, Bs = Math.pow(2, -24), sr = Symbol("SKIP_GENERATION"), Do = {
|
|
1594
1640
|
strategy: Oo,
|
|
1595
1641
|
maxDepth: 40,
|
|
1596
1642
|
maxLeafSize: 10,
|
|
@@ -1652,21 +1698,21 @@ function ze(i, e) {
|
|
|
1652
1698
|
function ir(i, e) {
|
|
1653
1699
|
return e[i + 7];
|
|
1654
1700
|
}
|
|
1655
|
-
function
|
|
1701
|
+
function Jd(i) {
|
|
1656
1702
|
return i;
|
|
1657
1703
|
}
|
|
1658
|
-
function
|
|
1659
|
-
let o = 1 / 0, r = 1 / 0, a = 1 / 0, c = -1 / 0, u = -1 / 0, d = -1 / 0, h = 1 / 0, p = 1 / 0, f = 1 / 0, y = -1 / 0,
|
|
1660
|
-
const
|
|
1661
|
-
for (let E = (e -
|
|
1662
|
-
const
|
|
1663
|
-
P < o && (o = P),
|
|
1664
|
-
const M = i[E + 2], O = i[E + 3],
|
|
1665
|
-
|
|
1704
|
+
function ri(i, e, t, n, s) {
|
|
1705
|
+
let o = 1 / 0, r = 1 / 0, a = 1 / 0, c = -1 / 0, u = -1 / 0, d = -1 / 0, h = 1 / 0, p = 1 / 0, f = 1 / 0, y = -1 / 0, S = -1 / 0, _ = -1 / 0;
|
|
1706
|
+
const A = i.offset || 0;
|
|
1707
|
+
for (let E = (e - A) * 6, T = (e + t - A) * 6; E < T; E += 6) {
|
|
1708
|
+
const b = i[E + 0], x = i[E + 1], P = b - x, C = b + x;
|
|
1709
|
+
P < o && (o = P), C > c && (c = C), b < h && (h = b), b > y && (y = b);
|
|
1710
|
+
const M = i[E + 2], O = i[E + 3], I = M - O, k = M + O;
|
|
1711
|
+
I < r && (r = I), k > u && (u = k), M < p && (p = M), M > S && (S = M);
|
|
1666
1712
|
const D = i[E + 4], H = i[E + 5], G = D - H, q = D + H;
|
|
1667
1713
|
G < a && (a = G), q > d && (d = q), D < f && (f = D), D > _ && (_ = D);
|
|
1668
1714
|
}
|
|
1669
|
-
n[0] = o, n[1] = r, n[2] = a, n[3] = c, n[4] = u, n[5] = d, s[0] = h, s[1] = p, s[2] = f, s[3] = y, s[4] =
|
|
1715
|
+
n[0] = o, n[1] = r, n[2] = a, n[3] = c, n[4] = u, n[5] = d, s[0] = h, s[1] = p, s[2] = f, s[3] = y, s[4] = S, s[5] = _;
|
|
1670
1716
|
}
|
|
1671
1717
|
const Lt = 32, Bc = (i, e) => i.candidate - e.candidate, Ut = /* @__PURE__ */ new Array(Lt).fill().map(() => ({
|
|
1672
1718
|
count: 0,
|
|
@@ -1683,79 +1729,79 @@ function Uc(i, e, t, n, s, o) {
|
|
|
1683
1729
|
r = Lr(i), r !== -1 && (a = Hc(t, n, s, r));
|
|
1684
1730
|
else if (o === zc) {
|
|
1685
1731
|
const c = Ln(i);
|
|
1686
|
-
let u =
|
|
1732
|
+
let u = ii * s;
|
|
1687
1733
|
const d = t.offset || 0, h = (n - d) * 6, p = (n + s - d) * 6;
|
|
1688
1734
|
for (let f = 0; f < 3; f++) {
|
|
1689
|
-
const y = e[f],
|
|
1735
|
+
const y = e[f], A = (e[f + 3] - y) / Lt;
|
|
1690
1736
|
if (s < Lt / 4) {
|
|
1691
1737
|
const E = [...Ut];
|
|
1692
1738
|
E.length = s;
|
|
1693
1739
|
let T = 0;
|
|
1694
|
-
for (let
|
|
1740
|
+
for (let x = h; x < p; x += 6, T++) {
|
|
1695
1741
|
const P = E[T];
|
|
1696
|
-
P.candidate = t[
|
|
1742
|
+
P.candidate = t[x + 2 * f], P.count = 0;
|
|
1697
1743
|
const {
|
|
1698
|
-
bounds:
|
|
1744
|
+
bounds: C,
|
|
1699
1745
|
leftCacheBounds: M,
|
|
1700
1746
|
rightCacheBounds: O
|
|
1701
1747
|
} = P;
|
|
1702
|
-
for (let
|
|
1703
|
-
O[
|
|
1704
|
-
ms(
|
|
1748
|
+
for (let I = 0; I < 3; I++)
|
|
1749
|
+
O[I] = 1 / 0, O[I + 3] = -1 / 0, M[I] = 1 / 0, M[I + 3] = -1 / 0, C[I] = 1 / 0, C[I + 3] = -1 / 0;
|
|
1750
|
+
ms(x, t, C);
|
|
1705
1751
|
}
|
|
1706
1752
|
E.sort(Bc);
|
|
1707
|
-
let
|
|
1708
|
-
for (let
|
|
1709
|
-
const P = E[
|
|
1710
|
-
for (;
|
|
1711
|
-
E.splice(
|
|
1753
|
+
let b = s;
|
|
1754
|
+
for (let x = 0; x < b; x++) {
|
|
1755
|
+
const P = E[x];
|
|
1756
|
+
for (; x + 1 < b && E[x + 1].candidate === P.candidate; )
|
|
1757
|
+
E.splice(x + 1, 1), b--;
|
|
1712
1758
|
}
|
|
1713
|
-
for (let
|
|
1714
|
-
const P = t[
|
|
1715
|
-
for (let
|
|
1716
|
-
const M = E[
|
|
1717
|
-
P >= M.candidate ? ms(
|
|
1759
|
+
for (let x = h; x < p; x += 6) {
|
|
1760
|
+
const P = t[x + 2 * f];
|
|
1761
|
+
for (let C = 0; C < b; C++) {
|
|
1762
|
+
const M = E[C];
|
|
1763
|
+
P >= M.candidate ? ms(x, t, M.rightCacheBounds) : (ms(x, t, M.leftCacheBounds), M.count++);
|
|
1718
1764
|
}
|
|
1719
1765
|
}
|
|
1720
|
-
for (let
|
|
1721
|
-
const P = E[
|
|
1766
|
+
for (let x = 0; x < b; x++) {
|
|
1767
|
+
const P = E[x], C = P.count, M = s - P.count, O = P.leftCacheBounds, I = P.rightCacheBounds;
|
|
1722
1768
|
let k = 0;
|
|
1723
|
-
|
|
1769
|
+
C !== 0 && (k = Ln(O) / c);
|
|
1724
1770
|
let D = 0;
|
|
1725
|
-
M !== 0 && (D = Ln(
|
|
1726
|
-
const H = Pr +
|
|
1771
|
+
M !== 0 && (D = Ln(I) / c);
|
|
1772
|
+
const H = Pr + ii * (k * C + D * M);
|
|
1727
1773
|
H < u && (r = f, u = H, a = P.candidate);
|
|
1728
1774
|
}
|
|
1729
1775
|
} else {
|
|
1730
|
-
for (let
|
|
1731
|
-
const
|
|
1732
|
-
|
|
1733
|
-
const P =
|
|
1734
|
-
for (let
|
|
1735
|
-
P[
|
|
1776
|
+
for (let b = 0; b < Lt; b++) {
|
|
1777
|
+
const x = Ut[b];
|
|
1778
|
+
x.count = 0, x.candidate = y + A + b * A;
|
|
1779
|
+
const P = x.bounds;
|
|
1780
|
+
for (let C = 0; C < 3; C++)
|
|
1781
|
+
P[C] = 1 / 0, P[C + 3] = -1 / 0;
|
|
1736
1782
|
}
|
|
1737
|
-
for (let
|
|
1738
|
-
let
|
|
1739
|
-
|
|
1740
|
-
const M = Ut[
|
|
1741
|
-
M.count++, ms(
|
|
1783
|
+
for (let b = h; b < p; b += 6) {
|
|
1784
|
+
let C = ~~((t[b + 2 * f] - y) / A);
|
|
1785
|
+
C >= Lt && (C = Lt - 1);
|
|
1786
|
+
const M = Ut[C];
|
|
1787
|
+
M.count++, ms(b, t, M.bounds);
|
|
1742
1788
|
}
|
|
1743
1789
|
const E = Ut[Lt - 1];
|
|
1744
1790
|
Or(E.bounds, E.rightCacheBounds);
|
|
1745
|
-
for (let
|
|
1746
|
-
const
|
|
1747
|
-
Dr(
|
|
1791
|
+
for (let b = Lt - 2; b >= 0; b--) {
|
|
1792
|
+
const x = Ut[b], P = Ut[b + 1];
|
|
1793
|
+
Dr(x.bounds, P.rightCacheBounds, x.rightCacheBounds);
|
|
1748
1794
|
}
|
|
1749
1795
|
let T = 0;
|
|
1750
|
-
for (let
|
|
1751
|
-
const
|
|
1752
|
-
P !== 0 && (T === 0 ? Or(
|
|
1753
|
-
let
|
|
1754
|
-
T !== 0 && (
|
|
1796
|
+
for (let b = 0; b < Lt - 1; b++) {
|
|
1797
|
+
const x = Ut[b], P = x.count, C = x.bounds, O = Ut[b + 1].rightCacheBounds;
|
|
1798
|
+
P !== 0 && (T === 0 ? Or(C, gs) : Dr(C, gs, gs)), T += P;
|
|
1799
|
+
let I = 0, k = 0;
|
|
1800
|
+
T !== 0 && (I = Ln(gs) / c);
|
|
1755
1801
|
const D = s - T;
|
|
1756
1802
|
D !== 0 && (k = Ln(O) / c);
|
|
1757
|
-
const H = Pr +
|
|
1758
|
-
H < u && (r = f, u = H, a =
|
|
1803
|
+
const H = Pr + ii * (I * T + k * D);
|
|
1804
|
+
H < u && (r = f, u = H, a = x.candidate);
|
|
1759
1805
|
}
|
|
1760
1806
|
}
|
|
1761
1807
|
}
|
|
@@ -1770,7 +1816,7 @@ function Hc(i, e, t, n) {
|
|
|
1770
1816
|
s += i[(r - o) * 6 + n * 2];
|
|
1771
1817
|
return s / t;
|
|
1772
1818
|
}
|
|
1773
|
-
class
|
|
1819
|
+
class oi {
|
|
1774
1820
|
constructor() {
|
|
1775
1821
|
this.boundingData = new Float32Array(6);
|
|
1776
1822
|
}
|
|
@@ -1797,27 +1843,27 @@ function jc(i, e, t, n, s, o) {
|
|
|
1797
1843
|
return r;
|
|
1798
1844
|
}
|
|
1799
1845
|
}
|
|
1800
|
-
let No,
|
|
1846
|
+
let No, Us, Ci, ko;
|
|
1801
1847
|
const Gc = Math.pow(2, 32);
|
|
1802
1848
|
function Ii(i) {
|
|
1803
1849
|
return "count" in i ? 1 : 1 + Ii(i.left) + Ii(i.right);
|
|
1804
1850
|
}
|
|
1805
1851
|
function Vc(i, e, t) {
|
|
1806
|
-
return No = new Float32Array(t),
|
|
1852
|
+
return No = new Float32Array(t), Us = new Uint32Array(t), Ci = new Uint16Array(t), ko = new Uint8Array(t), Pi(i, e);
|
|
1807
1853
|
}
|
|
1808
1854
|
function Pi(i, e) {
|
|
1809
1855
|
const t = i / 4, n = i / 2, s = "count" in e, o = e.boundingData;
|
|
1810
1856
|
for (let r = 0; r < 6; r++)
|
|
1811
1857
|
No[t + r] = o[r];
|
|
1812
1858
|
if (s)
|
|
1813
|
-
return e.buffer ? (ko.set(new Uint8Array(e.buffer), i), i + e.buffer.byteLength) : (
|
|
1859
|
+
return e.buffer ? (ko.set(new Uint8Array(e.buffer), i), i + e.buffer.byteLength) : (Us[t + 6] = e.offset, Ci[n + 14] = e.count, Ci[n + 15] = nr, i + qe);
|
|
1814
1860
|
{
|
|
1815
1861
|
const { left: r, right: a, splitAxis: c } = e, u = i + qe;
|
|
1816
1862
|
let d = Pi(u, r);
|
|
1817
1863
|
const h = i / qe, f = d / qe - h;
|
|
1818
1864
|
if (f > Gc)
|
|
1819
1865
|
throw new Error("MeshBVH: Cannot store relative child node offset greater than 32 bits.");
|
|
1820
|
-
return
|
|
1866
|
+
return Us[t + 6] = f, Us[t + 7] = c, Pi(d, a);
|
|
1821
1867
|
}
|
|
1822
1868
|
}
|
|
1823
1869
|
function Wc(i, e, t, n, s, o) {
|
|
@@ -1829,26 +1875,26 @@ function Wc(i, e, t, n, s, o) {
|
|
|
1829
1875
|
onProgress: d
|
|
1830
1876
|
} = s, h = i.primitiveBuffer, p = i.primitiveBufferStride, f = new Float32Array(6);
|
|
1831
1877
|
let y = !1;
|
|
1832
|
-
const
|
|
1833
|
-
return
|
|
1878
|
+
const S = new oi();
|
|
1879
|
+
return ri(e, t, n, S.boundingData, f), A(S, t, n, f), S;
|
|
1834
1880
|
function _(E) {
|
|
1835
1881
|
d && d((E - o.offset) / o.count);
|
|
1836
1882
|
}
|
|
1837
|
-
function
|
|
1838
|
-
if (!y && P >= r && (y = !0, a && console.warn(`BVH: Max depth of ${r} reached when generating BVH. Consider increasing maxDepth.`)),
|
|
1839
|
-
return _(T +
|
|
1840
|
-
const
|
|
1841
|
-
if (
|
|
1842
|
-
return _(T +
|
|
1843
|
-
const M = jc(h, p, e, T,
|
|
1844
|
-
if (M === T || M === T +
|
|
1845
|
-
_(T +
|
|
1883
|
+
function A(E, T, b, x = null, P = 0) {
|
|
1884
|
+
if (!y && P >= r && (y = !0, a && console.warn(`BVH: Max depth of ${r} reached when generating BVH. Consider increasing maxDepth.`)), b <= c || P >= r)
|
|
1885
|
+
return _(T + b), E.offset = T, E.count = b, E;
|
|
1886
|
+
const C = Uc(E.boundingData, x, e, T, b, u);
|
|
1887
|
+
if (C.axis === -1)
|
|
1888
|
+
return _(T + b), E.offset = T, E.count = b, E;
|
|
1889
|
+
const M = jc(h, p, e, T, b, C);
|
|
1890
|
+
if (M === T || M === T + b)
|
|
1891
|
+
_(T + b), E.offset = T, E.count = b;
|
|
1846
1892
|
else {
|
|
1847
|
-
E.splitAxis =
|
|
1848
|
-
const O = new
|
|
1849
|
-
E.left = O,
|
|
1850
|
-
const D = new
|
|
1851
|
-
E.right = D,
|
|
1893
|
+
E.splitAxis = C.axis;
|
|
1894
|
+
const O = new oi(), I = T, k = M - T;
|
|
1895
|
+
E.left = O, ri(e, I, k, O.boundingData, f), A(O, I, k, f, P + 1);
|
|
1896
|
+
const D = new oi(), H = M, G = b - k;
|
|
1897
|
+
E.right = D, ri(e, H, G, D.boundingData, f), A(D, H, G, f, P + 1);
|
|
1852
1898
|
}
|
|
1853
1899
|
return E;
|
|
1854
1900
|
}
|
|
@@ -1887,51 +1933,51 @@ class Kc {
|
|
|
1887
1933
|
};
|
|
1888
1934
|
}
|
|
1889
1935
|
}
|
|
1890
|
-
const
|
|
1936
|
+
const Se = /* @__PURE__ */ new Kc();
|
|
1891
1937
|
let Zt, Tn;
|
|
1892
1938
|
const cn = [], ys = /* @__PURE__ */ new rr(() => new _t());
|
|
1893
1939
|
function Xc(i, e, t, n, s, o) {
|
|
1894
|
-
Zt = ys.getPrimitive(), Tn = ys.getPrimitive(), cn.push(Zt, Tn),
|
|
1940
|
+
Zt = ys.getPrimitive(), Tn = ys.getPrimitive(), cn.push(Zt, Tn), Se.setBuffer(i._roots[e]);
|
|
1895
1941
|
const r = Li(0, i.geometry, t, n, s, o);
|
|
1896
|
-
|
|
1942
|
+
Se.clearBuffer(), ys.releasePrimitive(Zt), ys.releasePrimitive(Tn), cn.pop(), cn.pop();
|
|
1897
1943
|
const a = cn.length;
|
|
1898
1944
|
return a > 0 && (Tn = cn[a - 1], Zt = cn[a - 2]), r;
|
|
1899
1945
|
}
|
|
1900
1946
|
function Li(i, e, t, n, s = null, o = 0, r = 0) {
|
|
1901
|
-
const { float32Array: a, uint16Array: c, uint32Array: u } =
|
|
1947
|
+
const { float32Array: a, uint16Array: c, uint32Array: u } = Se;
|
|
1902
1948
|
let d = i * 2;
|
|
1903
1949
|
if (De(d, c)) {
|
|
1904
1950
|
const p = $e(i, u), f = Qe(d, c);
|
|
1905
1951
|
return Ae(i, a, Zt), n(p, f, !1, r, o + i / Oe, Zt);
|
|
1906
1952
|
} else {
|
|
1907
|
-
let
|
|
1908
|
-
const { uint16Array: H, uint32Array: G } =
|
|
1953
|
+
let I = function(D) {
|
|
1954
|
+
const { uint16Array: H, uint32Array: G } = Se;
|
|
1909
1955
|
let q = D * 2;
|
|
1910
1956
|
for (; !De(q, H); )
|
|
1911
1957
|
D = Fe(D), q = D * 2;
|
|
1912
1958
|
return $e(D, G);
|
|
1913
1959
|
}, k = function(D) {
|
|
1914
|
-
const { uint16Array: H, uint32Array: G } =
|
|
1960
|
+
const { uint16Array: H, uint32Array: G } = Se;
|
|
1915
1961
|
let q = D * 2;
|
|
1916
1962
|
for (; !De(q, H); )
|
|
1917
1963
|
D = ze(D, G), q = D * 2;
|
|
1918
1964
|
return $e(D, G) + Qe(q, H);
|
|
1919
1965
|
};
|
|
1920
1966
|
const p = Fe(i), f = ze(i, u);
|
|
1921
|
-
let y = p,
|
|
1922
|
-
if (s && (E = Zt, T = Tn, Ae(y, a, E), Ae(
|
|
1923
|
-
y = f,
|
|
1967
|
+
let y = p, S = f, _, A, E, T;
|
|
1968
|
+
if (s && (E = Zt, T = Tn, Ae(y, a, E), Ae(S, a, T), _ = s(E), A = s(T), A < _)) {
|
|
1969
|
+
y = f, S = p;
|
|
1924
1970
|
const D = _;
|
|
1925
|
-
_ =
|
|
1971
|
+
_ = A, A = D, E = T;
|
|
1926
1972
|
}
|
|
1927
1973
|
E || (E = Zt, Ae(y, a, E));
|
|
1928
|
-
const
|
|
1974
|
+
const b = De(y * 2, c), x = t(E, b, _, r + 1, o + y / Oe);
|
|
1929
1975
|
let P;
|
|
1930
|
-
if (
|
|
1931
|
-
const D =
|
|
1976
|
+
if (x === Ir) {
|
|
1977
|
+
const D = I(y), G = k(y) - D;
|
|
1932
1978
|
P = n(D, G, !0, r + 1, o + y / Oe, E);
|
|
1933
1979
|
} else
|
|
1934
|
-
P =
|
|
1980
|
+
P = x && Li(
|
|
1935
1981
|
y,
|
|
1936
1982
|
e,
|
|
1937
1983
|
t,
|
|
@@ -1941,15 +1987,15 @@ function Li(i, e, t, n, s = null, o = 0, r = 0) {
|
|
|
1941
1987
|
r + 1
|
|
1942
1988
|
);
|
|
1943
1989
|
if (P) return !0;
|
|
1944
|
-
T = Tn, Ae(
|
|
1945
|
-
const
|
|
1990
|
+
T = Tn, Ae(S, a, T);
|
|
1991
|
+
const C = De(S * 2, c), M = t(T, C, A, r + 1, o + S / Oe);
|
|
1946
1992
|
let O;
|
|
1947
1993
|
if (M === Ir) {
|
|
1948
|
-
const D =
|
|
1949
|
-
O = n(D, G, !0, r + 1, o +
|
|
1994
|
+
const D = I(S), G = k(S) - D;
|
|
1995
|
+
O = n(D, G, !0, r + 1, o + S / Oe, T);
|
|
1950
1996
|
} else
|
|
1951
1997
|
O = M && Li(
|
|
1952
|
-
|
|
1998
|
+
S,
|
|
1953
1999
|
e,
|
|
1954
2000
|
t,
|
|
1955
2001
|
n,
|
|
@@ -1960,12 +2006,12 @@ function Li(i, e, t, n, s = null, o = 0, r = 0) {
|
|
|
1960
2006
|
return !!O;
|
|
1961
2007
|
}
|
|
1962
2008
|
}
|
|
1963
|
-
const Xn = /* @__PURE__ */ new
|
|
1964
|
-
let
|
|
2009
|
+
const Xn = /* @__PURE__ */ new Se.constructor(), Ws = /* @__PURE__ */ new Se.constructor(), Gt = /* @__PURE__ */ new rr(() => new _t()), ln = /* @__PURE__ */ new _t(), hn = /* @__PURE__ */ new _t(), ai = /* @__PURE__ */ new _t(), ci = /* @__PURE__ */ new _t();
|
|
2010
|
+
let li = !1;
|
|
1965
2011
|
function Yc(i, e, t, n) {
|
|
1966
|
-
if (
|
|
2012
|
+
if (li)
|
|
1967
2013
|
throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");
|
|
1968
|
-
|
|
2014
|
+
li = !0;
|
|
1969
2015
|
const s = i._roots, o = e._roots;
|
|
1970
2016
|
let r, a = 0, c = 0;
|
|
1971
2017
|
const u = new ut().copy(t).invert();
|
|
@@ -1973,7 +2019,7 @@ function Yc(i, e, t, n) {
|
|
|
1973
2019
|
Xn.setBuffer(s[d]), c = 0;
|
|
1974
2020
|
const p = Gt.getPrimitive();
|
|
1975
2021
|
Ae(0, Xn.float32Array, p), p.applyMatrix4(u);
|
|
1976
|
-
for (let f = 0, y = o.length; f < y && (
|
|
2022
|
+
for (let f = 0, y = o.length; f < y && (Ws.setBuffer(o[f]), r = gt(
|
|
1977
2023
|
0,
|
|
1978
2024
|
0,
|
|
1979
2025
|
t,
|
|
@@ -1984,32 +2030,32 @@ function Yc(i, e, t, n) {
|
|
|
1984
2030
|
0,
|
|
1985
2031
|
0,
|
|
1986
2032
|
p
|
|
1987
|
-
),
|
|
2033
|
+
), Ws.clearBuffer(), c += o[f].byteLength / qe, !r); f++)
|
|
1988
2034
|
;
|
|
1989
2035
|
if (Gt.releasePrimitive(p), Xn.clearBuffer(), a += s[d].byteLength / qe, r)
|
|
1990
2036
|
break;
|
|
1991
2037
|
}
|
|
1992
|
-
return
|
|
2038
|
+
return li = !1, r;
|
|
1993
2039
|
}
|
|
1994
2040
|
function gt(i, e, t, n, s, o = 0, r = 0, a = 0, c = 0, u = null, d = !1) {
|
|
1995
2041
|
let h, p;
|
|
1996
|
-
d ? (h =
|
|
1997
|
-
const f = h.float32Array, y = h.uint32Array,
|
|
1998
|
-
let
|
|
1999
|
-
if (P &&
|
|
2000
|
-
d ?
|
|
2001
|
-
$e(e,
|
|
2042
|
+
d ? (h = Ws, p = Xn) : (h = Xn, p = Ws);
|
|
2043
|
+
const f = h.float32Array, y = h.uint32Array, S = h.uint16Array, _ = p.float32Array, A = p.uint32Array, E = p.uint16Array, T = i * 2, b = e * 2, x = De(T, S), P = De(b, E);
|
|
2044
|
+
let C = !1;
|
|
2045
|
+
if (P && x)
|
|
2046
|
+
d ? C = s(
|
|
2047
|
+
$e(e, A),
|
|
2002
2048
|
Qe(e * 2, E),
|
|
2003
2049
|
$e(i, y),
|
|
2004
|
-
Qe(i * 2,
|
|
2050
|
+
Qe(i * 2, S),
|
|
2005
2051
|
c,
|
|
2006
2052
|
r + e / Oe,
|
|
2007
2053
|
a,
|
|
2008
2054
|
o + i / Oe
|
|
2009
|
-
) :
|
|
2055
|
+
) : C = s(
|
|
2010
2056
|
$e(i, y),
|
|
2011
|
-
Qe(i * 2,
|
|
2012
|
-
$e(e,
|
|
2057
|
+
Qe(i * 2, S),
|
|
2058
|
+
$e(e, A),
|
|
2013
2059
|
Qe(e * 2, E),
|
|
2014
2060
|
a,
|
|
2015
2061
|
o + i / Oe,
|
|
@@ -2019,10 +2065,10 @@ function gt(i, e, t, n, s, o = 0, r = 0, a = 0, c = 0, u = null, d = !1) {
|
|
|
2019
2065
|
else if (P) {
|
|
2020
2066
|
const M = Gt.getPrimitive();
|
|
2021
2067
|
Ae(e, _, M), M.applyMatrix4(t);
|
|
2022
|
-
const O = Fe(i),
|
|
2023
|
-
Ae(O, f, ln), Ae(
|
|
2068
|
+
const O = Fe(i), I = ze(i, y);
|
|
2069
|
+
Ae(O, f, ln), Ae(I, f, hn);
|
|
2024
2070
|
const k = M.intersectsBox(ln), D = M.intersectsBox(hn);
|
|
2025
|
-
|
|
2071
|
+
C = k && gt(
|
|
2026
2072
|
e,
|
|
2027
2073
|
O,
|
|
2028
2074
|
n,
|
|
@@ -2036,7 +2082,7 @@ function gt(i, e, t, n, s, o = 0, r = 0, a = 0, c = 0, u = null, d = !1) {
|
|
|
2036
2082
|
!d
|
|
2037
2083
|
) || D && gt(
|
|
2038
2084
|
e,
|
|
2039
|
-
|
|
2085
|
+
I,
|
|
2040
2086
|
n,
|
|
2041
2087
|
t,
|
|
2042
2088
|
s,
|
|
@@ -2048,11 +2094,11 @@ function gt(i, e, t, n, s, o = 0, r = 0, a = 0, c = 0, u = null, d = !1) {
|
|
|
2048
2094
|
!d
|
|
2049
2095
|
), Gt.releasePrimitive(M);
|
|
2050
2096
|
} else {
|
|
2051
|
-
const M = Fe(e), O = ze(e,
|
|
2052
|
-
Ae(M, _,
|
|
2053
|
-
const
|
|
2054
|
-
if (
|
|
2055
|
-
|
|
2097
|
+
const M = Fe(e), O = ze(e, A);
|
|
2098
|
+
Ae(M, _, ai), Ae(O, _, ci);
|
|
2099
|
+
const I = u.intersectsBox(ai), k = u.intersectsBox(ci);
|
|
2100
|
+
if (I && k)
|
|
2101
|
+
C = gt(
|
|
2056
2102
|
i,
|
|
2057
2103
|
M,
|
|
2058
2104
|
t,
|
|
@@ -2077,9 +2123,9 @@ function gt(i, e, t, n, s, o = 0, r = 0, a = 0, c = 0, u = null, d = !1) {
|
|
|
2077
2123
|
u,
|
|
2078
2124
|
d
|
|
2079
2125
|
);
|
|
2080
|
-
else if (
|
|
2081
|
-
if (
|
|
2082
|
-
|
|
2126
|
+
else if (I)
|
|
2127
|
+
if (x)
|
|
2128
|
+
C = gt(
|
|
2083
2129
|
i,
|
|
2084
2130
|
M,
|
|
2085
2131
|
t,
|
|
@@ -2094,11 +2140,11 @@ function gt(i, e, t, n, s, o = 0, r = 0, a = 0, c = 0, u = null, d = !1) {
|
|
|
2094
2140
|
);
|
|
2095
2141
|
else {
|
|
2096
2142
|
const D = Gt.getPrimitive();
|
|
2097
|
-
D.copy(
|
|
2143
|
+
D.copy(ai).applyMatrix4(t);
|
|
2098
2144
|
const H = Fe(i), G = ze(i, y);
|
|
2099
2145
|
Ae(H, f, ln), Ae(G, f, hn);
|
|
2100
2146
|
const q = D.intersectsBox(ln), ie = D.intersectsBox(hn);
|
|
2101
|
-
|
|
2147
|
+
C = q && gt(
|
|
2102
2148
|
M,
|
|
2103
2149
|
H,
|
|
2104
2150
|
n,
|
|
@@ -2125,8 +2171,8 @@ function gt(i, e, t, n, s, o = 0, r = 0, a = 0, c = 0, u = null, d = !1) {
|
|
|
2125
2171
|
), Gt.releasePrimitive(D);
|
|
2126
2172
|
}
|
|
2127
2173
|
else if (k)
|
|
2128
|
-
if (
|
|
2129
|
-
|
|
2174
|
+
if (x)
|
|
2175
|
+
C = gt(
|
|
2130
2176
|
i,
|
|
2131
2177
|
O,
|
|
2132
2178
|
t,
|
|
@@ -2141,11 +2187,11 @@ function gt(i, e, t, n, s, o = 0, r = 0, a = 0, c = 0, u = null, d = !1) {
|
|
|
2141
2187
|
);
|
|
2142
2188
|
else {
|
|
2143
2189
|
const D = Gt.getPrimitive();
|
|
2144
|
-
D.copy(
|
|
2190
|
+
D.copy(ci).applyMatrix4(t);
|
|
2145
2191
|
const H = Fe(i), G = ze(i, y);
|
|
2146
2192
|
Ae(H, f, ln), Ae(G, f, hn);
|
|
2147
2193
|
const q = D.intersectsBox(ln), ie = D.intersectsBox(hn);
|
|
2148
|
-
|
|
2194
|
+
C = q && gt(
|
|
2149
2195
|
O,
|
|
2150
2196
|
H,
|
|
2151
2197
|
n,
|
|
@@ -2172,7 +2218,7 @@ function gt(i, e, t, n, s, o = 0, r = 0, a = 0, c = 0, u = null, d = !1) {
|
|
|
2172
2218
|
), Gt.releasePrimitive(D);
|
|
2173
2219
|
}
|
|
2174
2220
|
}
|
|
2175
|
-
return
|
|
2221
|
+
return C;
|
|
2176
2222
|
}
|
|
2177
2223
|
const Nr = /* @__PURE__ */ new _t(), un = /* @__PURE__ */ new Float32Array(6);
|
|
2178
2224
|
class qc {
|
|
@@ -2199,8 +2245,8 @@ class qc {
|
|
|
2199
2245
|
let o = 1 / 0, r = 1 / 0, a = 1 / 0, c = -1 / 0, u = -1 / 0, d = -1 / 0;
|
|
2200
2246
|
for (let h = e, p = e + t; h < p; h++) {
|
|
2201
2247
|
this.writePrimitiveBounds(h, un, 0);
|
|
2202
|
-
const [f, y,
|
|
2203
|
-
f < o && (o = f), _ > c && (c = _), y < r && (r = y),
|
|
2248
|
+
const [f, y, S, _, A, E] = un;
|
|
2249
|
+
f < o && (o = f), _ > c && (c = _), y < r && (r = y), A > u && (u = A), S < a && (a = S), E > d && (d = E);
|
|
2204
2250
|
}
|
|
2205
2251
|
return n[s + 0] = o, n[s + 1] = r, n[s + 2] = a, n[s + 3] = c, n[s + 4] = u, n[s + 5] = d, n;
|
|
2206
2252
|
}
|
|
@@ -2208,8 +2254,8 @@ class qc {
|
|
|
2208
2254
|
const s = n.offset || 0;
|
|
2209
2255
|
for (let o = e, r = e + t; o < r; o++) {
|
|
2210
2256
|
this.writePrimitiveBounds(o, un, 0);
|
|
2211
|
-
const [a, c, u, d, h, p] = un, f = (a + d) / 2, y = (c + h) / 2,
|
|
2212
|
-
n[T + 0] = f, n[T + 1] = _ + (Math.abs(f) + _) *
|
|
2257
|
+
const [a, c, u, d, h, p] = un, f = (a + d) / 2, y = (c + h) / 2, S = (u + p) / 2, _ = (d - a) / 2, A = (h - c) / 2, E = (p - u) / 2, T = (o - s) * 6;
|
|
2258
|
+
n[T + 0] = f, n[T + 1] = _ + (Math.abs(f) + _) * Bs, n[T + 2] = y, n[T + 3] = A + (Math.abs(y) + A) * Bs, n[T + 4] = S, n[T + 5] = E + (Math.abs(S) + E) * Bs;
|
|
2213
2259
|
}
|
|
2214
2260
|
return n;
|
|
2215
2261
|
}
|
|
@@ -2273,9 +2319,9 @@ class qc {
|
|
|
2273
2319
|
this.writePrimitiveRangeBounds(f, y, un, 0), a.set(un, d);
|
|
2274
2320
|
} else {
|
|
2275
2321
|
const f = Fe(d), y = ze(d, o);
|
|
2276
|
-
for (let
|
|
2277
|
-
const _ = a[f +
|
|
2278
|
-
a[d +
|
|
2322
|
+
for (let S = 0; S < 3; S++) {
|
|
2323
|
+
const _ = a[f + S], A = a[f + S + 3], E = a[y + S], T = a[y + S + 3];
|
|
2324
|
+
a[d + S] = _ < E ? _ : E, a[d + S + 3] = A > T ? A : T;
|
|
2279
2325
|
}
|
|
2280
2326
|
}
|
|
2281
2327
|
}
|
|
@@ -2317,7 +2363,7 @@ class qc {
|
|
|
2317
2363
|
} = e;
|
|
2318
2364
|
if (s && o) {
|
|
2319
2365
|
const h = s;
|
|
2320
|
-
s = (p, f, y,
|
|
2366
|
+
s = (p, f, y, S, _) => h(p, f, y, S, _) ? !0 : a(p, f, this, o, y, S, r);
|
|
2321
2367
|
} else s || (o ? s = (h, p, f, y) => a(h, p, this, o, f, y, r) : s = (h, p, f) => f);
|
|
2322
2368
|
let c = !1, u = 0;
|
|
2323
2369
|
const d = this._roots;
|
|
@@ -2351,7 +2397,7 @@ function $c() {
|
|
|
2351
2397
|
function or(i) {
|
|
2352
2398
|
return i.index ? i.index.count : i.attributes.position.count;
|
|
2353
2399
|
}
|
|
2354
|
-
function
|
|
2400
|
+
function qs(i) {
|
|
2355
2401
|
return or(i) / 3;
|
|
2356
2402
|
}
|
|
2357
2403
|
function Qc(i, e = ArrayBuffer) {
|
|
@@ -2384,8 +2430,8 @@ function kr(i, e, t) {
|
|
|
2384
2430
|
return [n];
|
|
2385
2431
|
const o = [], r = n.offset, a = n.offset + n.count, c = or(i) / t, u = [];
|
|
2386
2432
|
for (const p of s) {
|
|
2387
|
-
const { offset: f, count: y } = p,
|
|
2388
|
-
|
|
2433
|
+
const { offset: f, count: y } = p, S = f, _ = isFinite(y) ? y : c - f, A = f + _;
|
|
2434
|
+
S < a && A > r && (u.push({ pos: Math.max(r, S), isStart: !0 }), u.push({ pos: Math.min(a, A), isStart: !1 }));
|
|
2389
2435
|
}
|
|
2390
2436
|
u.sort((p, f) => p.pos !== f.pos ? p.pos - f.pos : p.type === "end" ? -1 : 1);
|
|
2391
2437
|
let d = 0, h = null;
|
|
@@ -2505,8 +2551,8 @@ const il = /* @__PURE__ */ (function() {
|
|
|
2505
2551
|
const a = s.start, c = i, u = o.start, d = e;
|
|
2506
2552
|
t.subVectors(a, u), i.subVectors(s.end, s.start), e.subVectors(o.end, o.start);
|
|
2507
2553
|
const h = t.dot(d), p = d.dot(c), f = d.dot(d), y = t.dot(c), _ = c.dot(c) * f - p * p;
|
|
2508
|
-
let
|
|
2509
|
-
_ !== 0 ?
|
|
2554
|
+
let A, E;
|
|
2555
|
+
_ !== 0 ? A = (h * p - y * f) / _ : A = 0, E = (h + A * p) / f, r.x = A, r.y = E;
|
|
2510
2556
|
};
|
|
2511
2557
|
})(), ar = /* @__PURE__ */ (function() {
|
|
2512
2558
|
const i = /* @__PURE__ */ new fe(), e = /* @__PURE__ */ new $(), t = /* @__PURE__ */ new $();
|
|
@@ -2542,10 +2588,10 @@ const il = /* @__PURE__ */ (function() {
|
|
|
2542
2588
|
return function(o, r) {
|
|
2543
2589
|
const { radius: a, center: c } = o, { a: u, b: d, c: h } = r;
|
|
2544
2590
|
if (n.start = u, n.end = d, n.closestPointToPoint(c, !0, i).distanceTo(c) <= a || (n.start = u, n.end = h, n.closestPointToPoint(c, !0, i).distanceTo(c) <= a) || (n.start = d, n.end = h, n.closestPointToPoint(c, !0, i).distanceTo(c) <= a)) return !0;
|
|
2545
|
-
const
|
|
2546
|
-
if (Math.abs(
|
|
2547
|
-
const
|
|
2548
|
-
if (r.containsPoint(
|
|
2591
|
+
const S = r.getPlane(t);
|
|
2592
|
+
if (Math.abs(S.distanceToPoint(c)) <= a) {
|
|
2593
|
+
const A = S.projectPoint(c, e);
|
|
2594
|
+
if (r.containsPoint(A)) return !0;
|
|
2549
2595
|
}
|
|
2550
2596
|
return !1;
|
|
2551
2597
|
};
|
|
@@ -2574,8 +2620,8 @@ class Tt extends wn {
|
|
|
2574
2620
|
h.subVectors(t, n), p.setFromPoints(h, s);
|
|
2575
2621
|
const f = o[3], y = r[3];
|
|
2576
2622
|
f.subVectors(n, e), y.setFromPoints(f, s);
|
|
2577
|
-
const
|
|
2578
|
-
this.isDegenerateIntoPoint = !1, this.isDegenerateIntoSegment = !1,
|
|
2623
|
+
const S = u.length(), _ = h.length(), A = f.length();
|
|
2624
|
+
this.isDegenerateIntoPoint = !1, this.isDegenerateIntoSegment = !1, S < Ot ? _ < Ot || A < Ot ? this.isDegenerateIntoPoint = !0 : (this.isDegenerateIntoSegment = !0, this.degenerateSegment.start.copy(e), this.degenerateSegment.end.copy(n)) : _ < Ot ? A < Ot ? this.isDegenerateIntoPoint = !0 : (this.isDegenerateIntoSegment = !0, this.degenerateSegment.start.copy(t), this.degenerateSegment.end.copy(e)) : A < Ot && (this.isDegenerateIntoSegment = !0, this.degenerateSegment.start.copy(n), this.degenerateSegment.end.copy(t)), this.plane.setFromNormalAndCoplanarPoint(a, e), this.needsUpdate = !1;
|
|
2579
2625
|
}
|
|
2580
2626
|
}
|
|
2581
2627
|
Tt.prototype.closestPointToSegment = /* @__PURE__ */ (function() {
|
|
@@ -2592,87 +2638,87 @@ Tt.prototype.closestPointToSegment = /* @__PURE__ */ (function() {
|
|
|
2592
2638
|
})();
|
|
2593
2639
|
Tt.prototype.intersectsTriangle = /* @__PURE__ */ (function() {
|
|
2594
2640
|
const i = /* @__PURE__ */ new Tt(), e = /* @__PURE__ */ new Ft(), t = /* @__PURE__ */ new Ft(), n = /* @__PURE__ */ new $(), s = /* @__PURE__ */ new $(), o = /* @__PURE__ */ new $(), r = /* @__PURE__ */ new $(), a = /* @__PURE__ */ new kt(), c = /* @__PURE__ */ new kt(), u = /* @__PURE__ */ new $(), d = /* @__PURE__ */ new fe(), h = /* @__PURE__ */ new fe();
|
|
2595
|
-
function p(T,
|
|
2596
|
-
const
|
|
2597
|
-
!T.isDegenerateIntoPoint && !T.isDegenerateIntoSegment ?
|
|
2641
|
+
function p(T, b, x, P) {
|
|
2642
|
+
const C = n;
|
|
2643
|
+
!T.isDegenerateIntoPoint && !T.isDegenerateIntoSegment ? C.copy(T.plane.normal) : C.copy(b.plane.normal);
|
|
2598
2644
|
const M = T.satBounds, O = T.satAxes;
|
|
2599
2645
|
for (let D = 1; D < 4; D++) {
|
|
2600
2646
|
const H = M[D], G = O[D];
|
|
2601
|
-
if (e.setFromPoints(G,
|
|
2647
|
+
if (e.setFromPoints(G, b.points), H.isSeparated(e) || (r.copy(C).cross(G), e.setFromPoints(r, T.points), t.setFromPoints(r, b.points), e.isSeparated(t))) return !1;
|
|
2602
2648
|
}
|
|
2603
|
-
const
|
|
2649
|
+
const I = b.satBounds, k = b.satAxes;
|
|
2604
2650
|
for (let D = 1; D < 4; D++) {
|
|
2605
|
-
const H =
|
|
2606
|
-
if (e.setFromPoints(G, T.points), H.isSeparated(e) || (r.crossVectors(
|
|
2651
|
+
const H = I[D], G = k[D];
|
|
2652
|
+
if (e.setFromPoints(G, T.points), H.isSeparated(e) || (r.crossVectors(C, G), e.setFromPoints(r, T.points), t.setFromPoints(r, b.points), e.isSeparated(t))) return !1;
|
|
2607
2653
|
}
|
|
2608
|
-
return
|
|
2654
|
+
return x && (P || console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."), x.start.set(0, 0, 0), x.end.set(0, 0, 0)), !0;
|
|
2609
2655
|
}
|
|
2610
|
-
function f(T,
|
|
2611
|
-
let G = O / (O -
|
|
2612
|
-
D.x = P + (
|
|
2656
|
+
function f(T, b, x, P, C, M, O, I, k, D, H) {
|
|
2657
|
+
let G = O / (O - I);
|
|
2658
|
+
D.x = P + (C - P) * G, H.start.subVectors(b, T).multiplyScalar(G).add(T), G = O / (O - k), D.y = P + (M - P) * G, H.end.subVectors(x, T).multiplyScalar(G).add(T);
|
|
2613
2659
|
}
|
|
2614
|
-
function y(T,
|
|
2615
|
-
if (
|
|
2616
|
-
f(T.c, T.a, T.b, P,
|
|
2660
|
+
function y(T, b, x, P, C, M, O, I, k, D, H) {
|
|
2661
|
+
if (C > 0)
|
|
2662
|
+
f(T.c, T.a, T.b, P, b, x, k, O, I, D, H);
|
|
2617
2663
|
else if (M > 0)
|
|
2618
|
-
f(T.b, T.a, T.c,
|
|
2619
|
-
else if (
|
|
2620
|
-
f(T.a, T.b, T.c,
|
|
2621
|
-
else if (
|
|
2622
|
-
f(T.b, T.a, T.c,
|
|
2664
|
+
f(T.b, T.a, T.c, x, b, P, I, O, k, D, H);
|
|
2665
|
+
else if (I * k > 0 || O != 0)
|
|
2666
|
+
f(T.a, T.b, T.c, b, x, P, O, I, k, D, H);
|
|
2667
|
+
else if (I != 0)
|
|
2668
|
+
f(T.b, T.a, T.c, x, b, P, I, O, k, D, H);
|
|
2623
2669
|
else if (k != 0)
|
|
2624
|
-
f(T.c, T.a, T.b, P,
|
|
2670
|
+
f(T.c, T.a, T.b, P, b, x, k, O, I, D, H);
|
|
2625
2671
|
else
|
|
2626
2672
|
return !0;
|
|
2627
2673
|
return !1;
|
|
2628
2674
|
}
|
|
2629
|
-
function
|
|
2630
|
-
const
|
|
2631
|
-
return at(M) ? at(O) ? p(T,
|
|
2675
|
+
function S(T, b, x, P) {
|
|
2676
|
+
const C = b.degenerateSegment, M = T.plane.distanceToPoint(C.start), O = T.plane.distanceToPoint(C.end);
|
|
2677
|
+
return at(M) ? at(O) ? p(T, b, x, P) : (x && (x.start.copy(C.start), x.end.copy(C.start)), T.containsPoint(C.start)) : at(O) ? (x && (x.start.copy(C.end), x.end.copy(C.end)), T.containsPoint(C.end)) : T.plane.intersectLine(C, n) != null ? (x && (x.start.copy(n), x.end.copy(n)), T.containsPoint(n)) : !1;
|
|
2632
2678
|
}
|
|
2633
|
-
function _(T,
|
|
2634
|
-
const P =
|
|
2635
|
-
return at(T.plane.distanceToPoint(P)) && T.containsPoint(P) ? (
|
|
2679
|
+
function _(T, b, x) {
|
|
2680
|
+
const P = b.a;
|
|
2681
|
+
return at(T.plane.distanceToPoint(P)) && T.containsPoint(P) ? (x && (x.start.copy(P), x.end.copy(P)), !0) : !1;
|
|
2636
2682
|
}
|
|
2637
|
-
function
|
|
2638
|
-
const P = T.degenerateSegment,
|
|
2639
|
-
return P.closestPointToPoint(
|
|
2683
|
+
function A(T, b, x) {
|
|
2684
|
+
const P = T.degenerateSegment, C = b.a;
|
|
2685
|
+
return P.closestPointToPoint(C, !0, n), C.distanceToSquared(n) < Fr ? (x && (x.start.copy(C), x.end.copy(C)), !0) : !1;
|
|
2640
2686
|
}
|
|
2641
|
-
function E(T,
|
|
2687
|
+
function E(T, b, x, P) {
|
|
2642
2688
|
if (T.isDegenerateIntoSegment)
|
|
2643
|
-
if (
|
|
2644
|
-
const
|
|
2645
|
-
|
|
2646
|
-
const k = n.subVectors(M.start,
|
|
2689
|
+
if (b.isDegenerateIntoSegment) {
|
|
2690
|
+
const C = T.degenerateSegment, M = b.degenerateSegment, O = s, I = o;
|
|
2691
|
+
C.delta(O), M.delta(I);
|
|
2692
|
+
const k = n.subVectors(M.start, C.start), D = O.x * I.y - O.y * I.x;
|
|
2647
2693
|
if (at(D))
|
|
2648
2694
|
return !1;
|
|
2649
|
-
const H = (k.x *
|
|
2695
|
+
const H = (k.x * I.y - k.y * I.x) / D, G = -(O.x * k.y - O.y * k.x) / D;
|
|
2650
2696
|
if (H < 0 || H > 1 || G < 0 || G > 1)
|
|
2651
2697
|
return !1;
|
|
2652
|
-
const q =
|
|
2653
|
-
return at(q - ie) ? (
|
|
2654
|
-
} else return
|
|
2698
|
+
const q = C.start.z + O.z * H, ie = M.start.z + I.z * G;
|
|
2699
|
+
return at(q - ie) ? (x && (x.start.copy(C.start).addScaledVector(O, H), x.end.copy(C.start).addScaledVector(O, H)), !0) : !1;
|
|
2700
|
+
} else return b.isDegenerateIntoPoint ? A(T, b, x) : S(b, T, x, P);
|
|
2655
2701
|
else {
|
|
2656
2702
|
if (T.isDegenerateIntoPoint)
|
|
2657
|
-
return
|
|
2658
|
-
if (
|
|
2659
|
-
return _(T,
|
|
2660
|
-
if (
|
|
2661
|
-
return
|
|
2662
|
-
}
|
|
2663
|
-
}
|
|
2664
|
-
return function(
|
|
2665
|
-
this.needsUpdate && this.update(),
|
|
2666
|
-
const
|
|
2667
|
-
if (
|
|
2668
|
-
return
|
|
2669
|
-
const M = this.plane, O =
|
|
2670
|
-
let
|
|
2671
|
-
at(
|
|
2672
|
-
const H =
|
|
2703
|
+
return b.isDegenerateIntoPoint ? b.a.distanceToSquared(T.a) < Fr ? (x && (x.start.copy(T.a), x.end.copy(T.a)), !0) : !1 : b.isDegenerateIntoSegment ? A(b, T, x) : _(b, T, x);
|
|
2704
|
+
if (b.isDegenerateIntoPoint)
|
|
2705
|
+
return _(T, b, x);
|
|
2706
|
+
if (b.isDegenerateIntoSegment)
|
|
2707
|
+
return S(T, b, x, P);
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
return function(b, x = null, P = !1) {
|
|
2711
|
+
this.needsUpdate && this.update(), b.isExtendedTriangle ? b.needsUpdate && b.update() : (i.copy(b), i.update(), b = i);
|
|
2712
|
+
const C = E(this, b, x, P);
|
|
2713
|
+
if (C !== void 0)
|
|
2714
|
+
return C;
|
|
2715
|
+
const M = this.plane, O = b.plane;
|
|
2716
|
+
let I = O.distanceToPoint(this.a), k = O.distanceToPoint(this.b), D = O.distanceToPoint(this.c);
|
|
2717
|
+
at(I) && (I = 0), at(k) && (k = 0), at(D) && (D = 0);
|
|
2718
|
+
const H = I * k, G = I * D;
|
|
2673
2719
|
if (H > 0 && G > 0)
|
|
2674
2720
|
return !1;
|
|
2675
|
-
let q = M.distanceToPoint(
|
|
2721
|
+
let q = M.distanceToPoint(b.a), ie = M.distanceToPoint(b.b), Ne = M.distanceToPoint(b.c);
|
|
2676
2722
|
at(q) && (q = 0), at(ie) && (ie = 0), at(Ne) && (Ne = 0);
|
|
2677
2723
|
const dt = q * ie, Me = q * Ne;
|
|
2678
2724
|
if (dt > 0 && Me > 0)
|
|
@@ -2682,11 +2728,11 @@ Tt.prototype.intersectsTriangle = /* @__PURE__ */ (function() {
|
|
|
2682
2728
|
let Ve = 0, ve = Math.abs(Ue.x);
|
|
2683
2729
|
const ge = Math.abs(Ue.y);
|
|
2684
2730
|
ge > ve && (ve = ge, Ve = 1), Math.abs(Ue.z) > ve && (Ve = 2);
|
|
2685
|
-
const We = ol[Ve], zt = this.a[We], me = this.b[We], pt = this.c[We], ft =
|
|
2686
|
-
if (y(this, zt, me, pt, H, G,
|
|
2687
|
-
return p(this,
|
|
2688
|
-
if (y(
|
|
2689
|
-
return p(this,
|
|
2731
|
+
const We = ol[Ve], zt = this.a[We], me = this.b[We], pt = this.c[We], ft = b.a[We], Rn = b.b[We], rn = b.c[We];
|
|
2732
|
+
if (y(this, zt, me, pt, H, G, I, k, D, d, a))
|
|
2733
|
+
return p(this, b, x, P);
|
|
2734
|
+
if (y(b, ft, Rn, rn, dt, Me, q, ie, Ne, h, c))
|
|
2735
|
+
return p(this, b, x, P);
|
|
2690
2736
|
if (d.y < d.x) {
|
|
2691
2737
|
const Pt = d.y;
|
|
2692
2738
|
d.y = d.x, d.x = Pt, u.copy(a.start), a.start.copy(a.end), a.end.copy(u);
|
|
@@ -2695,7 +2741,7 @@ Tt.prototype.intersectsTriangle = /* @__PURE__ */ (function() {
|
|
|
2695
2741
|
const Pt = h.y;
|
|
2696
2742
|
h.y = h.x, h.x = Pt, u.copy(c.start), c.start.copy(c.end), c.end.copy(u);
|
|
2697
2743
|
}
|
|
2698
|
-
return d.y < h.x || h.y < d.x ? !1 : (
|
|
2744
|
+
return d.y < h.x || h.y < d.x ? !1 : (x && (h.x > d.x ? x.start.copy(c.start) : x.start.copy(a.start), h.y < d.y ? x.end.copy(c.end) : x.end.copy(a.end)), !0);
|
|
2699
2745
|
};
|
|
2700
2746
|
})();
|
|
2701
2747
|
Tt.prototype.distanceToPoint = /* @__PURE__ */ (function() {
|
|
@@ -2715,17 +2761,17 @@ Tt.prototype.distanceToTriangle = /* @__PURE__ */ (function() {
|
|
|
2715
2761
|
let p;
|
|
2716
2762
|
const f = t[h], y = r[f];
|
|
2717
2763
|
this.closestPointToPoint(y, i), p = y.distanceToSquared(i), p < d && (d = p, a && a.copy(i), c && c.copy(y));
|
|
2718
|
-
const
|
|
2719
|
-
r.closestPointToPoint(
|
|
2764
|
+
const S = this[f];
|
|
2765
|
+
r.closestPointToPoint(S, i), p = S.distanceToSquared(i), p < d && (d = p, a && a.copy(S), c && c.copy(i));
|
|
2720
2766
|
}
|
|
2721
2767
|
for (let h = 0; h < 3; h++) {
|
|
2722
2768
|
const p = t[h], f = t[(h + 1) % 3];
|
|
2723
2769
|
n.set(this[p], this[f]);
|
|
2724
2770
|
for (let y = 0; y < 3; y++) {
|
|
2725
|
-
const
|
|
2726
|
-
s.set(r[
|
|
2727
|
-
const
|
|
2728
|
-
|
|
2771
|
+
const S = t[y], _ = t[(y + 1) % 3];
|
|
2772
|
+
s.set(r[S], r[_]), ar(n, s, i, e);
|
|
2773
|
+
const A = i.distanceToSquared(e);
|
|
2774
|
+
A < d && (d = A, a && a.copy(i), c && c.copy(e));
|
|
2729
2775
|
}
|
|
2730
2776
|
}
|
|
2731
2777
|
return Math.sqrt(d);
|
|
@@ -2797,8 +2843,8 @@ Je.prototype.intersectsTriangle = /* @__PURE__ */ (function() {
|
|
|
2797
2843
|
for (let p = 0; p < 3; p++) {
|
|
2798
2844
|
const f = c[p];
|
|
2799
2845
|
for (let y = 0; y < 4; y++) {
|
|
2800
|
-
const
|
|
2801
|
-
if (s.crossVectors(f,
|
|
2846
|
+
const S = d[y];
|
|
2847
|
+
if (s.crossVectors(f, S), t.setFromPoints(s, e), n.setFromPoints(s, h), t.isSeparated(n)) return !1;
|
|
2802
2848
|
}
|
|
2803
2849
|
}
|
|
2804
2850
|
return !0;
|
|
@@ -2823,37 +2869,37 @@ Je.prototype.distanceToBox = /* @__PURE__ */ (function() {
|
|
|
2823
2869
|
const d = a * a, h = r.min, p = r.max, f = this.points;
|
|
2824
2870
|
let y = 1 / 0;
|
|
2825
2871
|
for (let _ = 0; _ < 8; _++) {
|
|
2826
|
-
const
|
|
2827
|
-
s.copy(
|
|
2828
|
-
const E =
|
|
2829
|
-
if (E < y && (y = E, c && c.copy(
|
|
2872
|
+
const A = f[_];
|
|
2873
|
+
s.copy(A).clamp(h, p);
|
|
2874
|
+
const E = A.distanceToSquared(s);
|
|
2875
|
+
if (E < y && (y = E, c && c.copy(A), u && u.copy(s), E < d))
|
|
2830
2876
|
return Math.sqrt(E);
|
|
2831
2877
|
}
|
|
2832
|
-
let
|
|
2878
|
+
let S = 0;
|
|
2833
2879
|
for (let _ = 0; _ < 3; _++)
|
|
2834
|
-
for (let
|
|
2880
|
+
for (let A = 0; A <= 1; A++)
|
|
2835
2881
|
for (let E = 0; E <= 1; E++) {
|
|
2836
|
-
const T = (_ + 1) % 3,
|
|
2837
|
-
e[
|
|
2838
|
-
const
|
|
2839
|
-
G[
|
|
2882
|
+
const T = (_ + 1) % 3, b = (_ + 2) % 3, x = A << T | E << b, P = 1 << _ | A << T | E << b, C = f[x], M = f[P];
|
|
2883
|
+
e[S].set(C, M);
|
|
2884
|
+
const I = i[_], k = i[T], D = i[b], H = t[S], G = H.start, q = H.end;
|
|
2885
|
+
G[I] = h[I], G[k] = A ? h[k] : p[k], G[D] = E ? h[D] : p[k], q[I] = p[I], q[k] = A ? h[k] : p[k], q[D] = E ? h[D] : p[k], S++;
|
|
2840
2886
|
}
|
|
2841
2887
|
for (let _ = 0; _ <= 1; _++)
|
|
2842
|
-
for (let
|
|
2888
|
+
for (let A = 0; A <= 1; A++)
|
|
2843
2889
|
for (let E = 0; E <= 1; E++) {
|
|
2844
|
-
s.x = _ ? p.x : h.x, s.y =
|
|
2890
|
+
s.x = _ ? p.x : h.x, s.y = A ? p.y : h.y, s.z = E ? p.z : h.z, this.closestPointToPoint(s, n);
|
|
2845
2891
|
const T = s.distanceToSquared(n);
|
|
2846
2892
|
if (T < y && (y = T, c && c.copy(n), u && u.copy(s), T < d))
|
|
2847
2893
|
return Math.sqrt(T);
|
|
2848
2894
|
}
|
|
2849
2895
|
for (let _ = 0; _ < 12; _++) {
|
|
2850
|
-
const
|
|
2896
|
+
const A = e[_];
|
|
2851
2897
|
for (let E = 0; E < 12; E++) {
|
|
2852
2898
|
const T = t[E];
|
|
2853
|
-
ar(
|
|
2854
|
-
const
|
|
2855
|
-
if (
|
|
2856
|
-
return Math.sqrt(
|
|
2899
|
+
ar(A, T, n, s);
|
|
2900
|
+
const b = n.distanceToSquared(s);
|
|
2901
|
+
if (b < y && (y = b, c && c.copy(n), u && u.copy(s), b < d))
|
|
2902
|
+
return Math.sqrt(b);
|
|
2857
2903
|
}
|
|
2858
2904
|
}
|
|
2859
2905
|
return Math.sqrt(y);
|
|
@@ -2864,7 +2910,7 @@ class al extends rr {
|
|
|
2864
2910
|
super(() => new Tt());
|
|
2865
2911
|
}
|
|
2866
2912
|
}
|
|
2867
|
-
const ht = /* @__PURE__ */ new al(), On = /* @__PURE__ */ new $(),
|
|
2913
|
+
const ht = /* @__PURE__ */ new al(), On = /* @__PURE__ */ new $(), hi = /* @__PURE__ */ new $();
|
|
2868
2914
|
function cl(i, e, t = {}, n = 0, s = 1 / 0) {
|
|
2869
2915
|
const o = n * n, r = s * s;
|
|
2870
2916
|
let a = 1 / 0, c = null;
|
|
@@ -2875,12 +2921,12 @@ function cl(i, e, t = {}, n = 0, s = 1 / 0) {
|
|
|
2875
2921
|
intersectsTriangle: (d, h) => {
|
|
2876
2922
|
d.closestPointToPoint(e, On);
|
|
2877
2923
|
const p = e.distanceToSquared(On);
|
|
2878
|
-
return p < a && (
|
|
2924
|
+
return p < a && (hi.copy(On), a = p, c = h), p < o;
|
|
2879
2925
|
}
|
|
2880
2926
|
}
|
|
2881
2927
|
), a === 1 / 0) return null;
|
|
2882
2928
|
const u = Math.sqrt(a);
|
|
2883
|
-
return t.point ? t.point.copy(
|
|
2929
|
+
return t.point ? t.point.copy(hi) : t.point = hi.clone(), t.distance = u, t.faceIndex = c, t;
|
|
2884
2930
|
}
|
|
2885
2931
|
const ws = parseInt(wo) >= 169, ll = parseInt(wo) <= 161, $t = /* @__PURE__ */ new $(), Qt = /* @__PURE__ */ new $(), Jt = /* @__PURE__ */ new $(), Es = /* @__PURE__ */ new fe(), Ts = /* @__PURE__ */ new fe(), _s = /* @__PURE__ */ new fe(), zr = /* @__PURE__ */ new $(), Br = /* @__PURE__ */ new $(), Ur = /* @__PURE__ */ new $(), Dn = /* @__PURE__ */ new $();
|
|
2886
2932
|
function hl(i, e, t, n, s, o, r, a) {
|
|
@@ -2928,18 +2974,18 @@ function Hr(i, e, t, n, s, o, r, a, c, u, d) {
|
|
|
2928
2974
|
function jr(i) {
|
|
2929
2975
|
return i && i.isMaterial ? i.side : i;
|
|
2930
2976
|
}
|
|
2931
|
-
function
|
|
2977
|
+
function $s(i, e, t, n, s, o, r) {
|
|
2932
2978
|
const a = n * 3;
|
|
2933
2979
|
let c = a + 0, u = a + 1, d = a + 2;
|
|
2934
2980
|
const { index: h, groups: p } = i;
|
|
2935
2981
|
i.index && (c = h.getX(c), u = h.getX(u), d = h.getX(d));
|
|
2936
|
-
const { position: f, normal: y, uv:
|
|
2982
|
+
const { position: f, normal: y, uv: S, uv1: _ } = i.attributes;
|
|
2937
2983
|
if (Array.isArray(e)) {
|
|
2938
|
-
const
|
|
2984
|
+
const A = n * 3;
|
|
2939
2985
|
for (let E = 0, T = p.length; E < T; E++) {
|
|
2940
|
-
const { start:
|
|
2941
|
-
if (
|
|
2942
|
-
const
|
|
2986
|
+
const { start: b, count: x, materialIndex: P } = p[E];
|
|
2987
|
+
if (A >= b && A < b + x) {
|
|
2988
|
+
const C = jr(e[P]), M = Hr(t, f, y, S, _, c, u, d, C, o, r);
|
|
2943
2989
|
if (M)
|
|
2944
2990
|
if (M.faceIndex = n, M.face.materialIndex = P, s)
|
|
2945
2991
|
s.push(M);
|
|
@@ -2948,7 +2994,7 @@ function qs(i, e, t, n, s, o, r) {
|
|
|
2948
2994
|
}
|
|
2949
2995
|
}
|
|
2950
2996
|
} else {
|
|
2951
|
-
const
|
|
2997
|
+
const A = jr(e), E = Hr(t, f, y, S, _, c, u, d, A, o, r);
|
|
2952
2998
|
if (E)
|
|
2953
2999
|
if (E.faceIndex = n, E.face.materialIndex = 0, s)
|
|
2954
3000
|
s.push(E);
|
|
@@ -2965,14 +3011,14 @@ function Ie(i, e, t, n) {
|
|
|
2965
3011
|
function ul(i, e, t, n, s, o, r, a) {
|
|
2966
3012
|
const { geometry: c, _indirectBuffer: u } = i;
|
|
2967
3013
|
for (let d = n, h = n + s; d < h; d++)
|
|
2968
|
-
|
|
3014
|
+
$s(c, e, t, d, o, r, a);
|
|
2969
3015
|
}
|
|
2970
3016
|
function dl(i, e, t, n, s, o, r) {
|
|
2971
3017
|
const { geometry: a, _indirectBuffer: c } = i;
|
|
2972
3018
|
let u = 1 / 0, d = null;
|
|
2973
3019
|
for (let h = n, p = n + s; h < p; h++) {
|
|
2974
3020
|
let f;
|
|
2975
|
-
f =
|
|
3021
|
+
f = $s(a, e, t, h, null, o, r), f && f.distance < u && (d = f, u = f.distance);
|
|
2976
3022
|
}
|
|
2977
3023
|
return d;
|
|
2978
3024
|
}
|
|
@@ -2993,36 +3039,36 @@ function fl(i, e = null) {
|
|
|
2993
3039
|
for (let p = 0, f = d.length; p < f; p++)
|
|
2994
3040
|
o = d[p], r = new Uint32Array(o), a = new Uint16Array(o), c = new Float32Array(o), h(0, u), u += o.byteLength;
|
|
2995
3041
|
function h(p, f, y = !1) {
|
|
2996
|
-
const
|
|
2997
|
-
if (De(
|
|
2998
|
-
const _ = $e(p, r),
|
|
2999
|
-
let E = 1 / 0, T = 1 / 0,
|
|
3000
|
-
for (let M = 3 * _, O = 3 * (_ +
|
|
3001
|
-
let
|
|
3002
|
-
const k = s.getX(
|
|
3003
|
-
k < E && (E = k), k >
|
|
3004
|
-
}
|
|
3005
|
-
return c[p + 0] !== E || c[p + 1] !== T || c[p + 2] !==
|
|
3042
|
+
const S = p * 2;
|
|
3043
|
+
if (De(S, a)) {
|
|
3044
|
+
const _ = $e(p, r), A = Qe(S, a);
|
|
3045
|
+
let E = 1 / 0, T = 1 / 0, b = 1 / 0, x = -1 / 0, P = -1 / 0, C = -1 / 0;
|
|
3046
|
+
for (let M = 3 * _, O = 3 * (_ + A); M < O; M++) {
|
|
3047
|
+
let I = n[M];
|
|
3048
|
+
const k = s.getX(I), D = s.getY(I), H = s.getZ(I);
|
|
3049
|
+
k < E && (E = k), k > x && (x = k), D < T && (T = D), D > P && (P = D), H < b && (b = H), H > C && (C = H);
|
|
3050
|
+
}
|
|
3051
|
+
return c[p + 0] !== E || c[p + 1] !== T || c[p + 2] !== b || c[p + 3] !== x || c[p + 4] !== P || c[p + 5] !== C ? (c[p + 0] = E, c[p + 1] = T, c[p + 2] = b, c[p + 3] = x, c[p + 4] = P, c[p + 5] = C, !0) : !1;
|
|
3006
3052
|
} else {
|
|
3007
|
-
const _ = Fe(p),
|
|
3008
|
-
let E = y, T = !1,
|
|
3053
|
+
const _ = Fe(p), A = ze(p, r);
|
|
3054
|
+
let E = y, T = !1, b = !1;
|
|
3009
3055
|
if (e) {
|
|
3010
3056
|
if (!E) {
|
|
3011
|
-
const
|
|
3012
|
-
T = e.has(
|
|
3057
|
+
const I = _ / Oe + f / qe, k = A / Oe + f / qe;
|
|
3058
|
+
T = e.has(I), b = e.has(k), E = !T && !b;
|
|
3013
3059
|
}
|
|
3014
3060
|
} else
|
|
3015
|
-
T = !0,
|
|
3016
|
-
const
|
|
3017
|
-
let
|
|
3018
|
-
|
|
3061
|
+
T = !0, b = !0;
|
|
3062
|
+
const x = E || T, P = E || b;
|
|
3063
|
+
let C = !1;
|
|
3064
|
+
x && (C = h(_, f, E));
|
|
3019
3065
|
let M = !1;
|
|
3020
|
-
P && (M = h(
|
|
3021
|
-
const O =
|
|
3066
|
+
P && (M = h(A, f, E));
|
|
3067
|
+
const O = C || M;
|
|
3022
3068
|
if (O)
|
|
3023
|
-
for (let
|
|
3024
|
-
const k = _ +
|
|
3025
|
-
c[p +
|
|
3069
|
+
for (let I = 0; I < 3; I++) {
|
|
3070
|
+
const k = _ + I, D = A + I, H = c[k], G = c[k + 3], q = c[D], ie = c[D + 3];
|
|
3071
|
+
c[p + I] = H < q ? H : q, c[p + I + 3] = G > ie ? G : ie;
|
|
3026
3072
|
}
|
|
3027
3073
|
return O;
|
|
3028
3074
|
}
|
|
@@ -3030,15 +3076,15 @@ function fl(i, e = null) {
|
|
|
3030
3076
|
}
|
|
3031
3077
|
function Xt(i, e, t, n, s) {
|
|
3032
3078
|
let o, r, a, c, u, d;
|
|
3033
|
-
const h = 1 / t.direction.x, p = 1 / t.direction.y, f = 1 / t.direction.z, y = t.origin.x,
|
|
3034
|
-
let
|
|
3035
|
-
return h >= 0 ? (o = (
|
|
3079
|
+
const h = 1 / t.direction.x, p = 1 / t.direction.y, f = 1 / t.direction.z, y = t.origin.x, S = t.origin.y, _ = t.origin.z;
|
|
3080
|
+
let A = e[i], E = e[i + 3], T = e[i + 1], b = e[i + 3 + 1], x = e[i + 2], P = e[i + 3 + 2];
|
|
3081
|
+
return h >= 0 ? (o = (A - y) * h, r = (E - y) * h) : (o = (E - y) * h, r = (A - y) * h), p >= 0 ? (a = (T - S) * p, c = (b - S) * p) : (a = (b - S) * p, c = (T - S) * p), o > c || a > r || ((a > o || isNaN(o)) && (o = a), (c < r || isNaN(r)) && (r = c), f >= 0 ? (u = (x - _) * f, d = (P - _) * f) : (u = (P - _) * f, d = (x - _) * f), o > d || u > r) ? !1 : ((u > o || o !== o) && (o = u), (d < r || r !== r) && (r = d), o <= s && r >= n);
|
|
3036
3082
|
}
|
|
3037
3083
|
function ml(i, e, t, n, s, o, r, a) {
|
|
3038
3084
|
const { geometry: c, _indirectBuffer: u } = i;
|
|
3039
3085
|
for (let d = n, h = n + s; d < h; d++) {
|
|
3040
3086
|
let p = u ? u[d] : d;
|
|
3041
|
-
|
|
3087
|
+
$s(c, e, t, p, o, r, a);
|
|
3042
3088
|
}
|
|
3043
3089
|
}
|
|
3044
3090
|
function gl(i, e, t, n, s, o, r) {
|
|
@@ -3046,7 +3092,7 @@ function gl(i, e, t, n, s, o, r) {
|
|
|
3046
3092
|
let u = 1 / 0, d = null;
|
|
3047
3093
|
for (let h = n, p = n + s; h < p; h++) {
|
|
3048
3094
|
let f;
|
|
3049
|
-
f =
|
|
3095
|
+
f = $s(a, e, t, c ? c[h] : h, null, o, r), f && f.distance < u && (d = f, u = f.distance);
|
|
3050
3096
|
}
|
|
3051
3097
|
return d;
|
|
3052
3098
|
}
|
|
@@ -3060,10 +3106,10 @@ function yl(i, e, t, n, s, o, r) {
|
|
|
3060
3106
|
return !1;
|
|
3061
3107
|
}
|
|
3062
3108
|
function wl(i, e, t, n, s, o, r) {
|
|
3063
|
-
|
|
3109
|
+
Se.setBuffer(i._roots[e]), Oi(0, i, t, n, s, o, r), Se.clearBuffer();
|
|
3064
3110
|
}
|
|
3065
3111
|
function Oi(i, e, t, n, s, o, r) {
|
|
3066
|
-
const { float32Array: a, uint16Array: c, uint32Array: u } =
|
|
3112
|
+
const { float32Array: a, uint16Array: c, uint32Array: u } = Se, d = i * 2;
|
|
3067
3113
|
if (De(d, c)) {
|
|
3068
3114
|
const p = $e(i, u), f = Qe(d, c);
|
|
3069
3115
|
ul(e, t, n, p, f, s, o, r);
|
|
@@ -3076,112 +3122,112 @@ function Oi(i, e, t, n, s, o, r) {
|
|
|
3076
3122
|
}
|
|
3077
3123
|
const El = ["x", "y", "z"];
|
|
3078
3124
|
function Tl(i, e, t, n, s, o) {
|
|
3079
|
-
|
|
3125
|
+
Se.setBuffer(i._roots[e]);
|
|
3080
3126
|
const r = Di(0, i, t, n, s, o);
|
|
3081
|
-
return
|
|
3127
|
+
return Se.clearBuffer(), r;
|
|
3082
3128
|
}
|
|
3083
3129
|
function Di(i, e, t, n, s, o) {
|
|
3084
|
-
const { float32Array: r, uint16Array: a, uint32Array: c } =
|
|
3130
|
+
const { float32Array: r, uint16Array: a, uint32Array: c } = Se;
|
|
3085
3131
|
let u = i * 2;
|
|
3086
3132
|
if (De(u, a)) {
|
|
3087
3133
|
const h = $e(i, c), p = Qe(u, a);
|
|
3088
3134
|
return dl(e, t, n, h, p, s, o);
|
|
3089
3135
|
} else {
|
|
3090
3136
|
const h = ir(i, c), p = El[h], y = n.direction[p] >= 0;
|
|
3091
|
-
let
|
|
3092
|
-
y ? (
|
|
3093
|
-
const E = Xt(
|
|
3137
|
+
let S, _;
|
|
3138
|
+
y ? (S = Fe(i), _ = ze(i, c)) : (S = ze(i, c), _ = Fe(i));
|
|
3139
|
+
const E = Xt(S, r, n, s, o) ? Di(S, e, t, n, s, o) : null;
|
|
3094
3140
|
if (E) {
|
|
3095
|
-
const
|
|
3096
|
-
if (y ?
|
|
3141
|
+
const x = E.point[p];
|
|
3142
|
+
if (y ? x <= r[_ + h] : (
|
|
3097
3143
|
// min bounding data
|
|
3098
|
-
|
|
3144
|
+
x >= r[_ + h + 3]
|
|
3099
3145
|
))
|
|
3100
3146
|
return E;
|
|
3101
3147
|
}
|
|
3102
|
-
const
|
|
3103
|
-
return E &&
|
|
3148
|
+
const b = Xt(_, r, n, s, o) ? Di(_, e, t, n, s, o) : null;
|
|
3149
|
+
return E && b ? E.distance <= b.distance ? E : b : E || b || null;
|
|
3104
3150
|
}
|
|
3105
3151
|
}
|
|
3106
|
-
const
|
|
3152
|
+
const bs = /* @__PURE__ */ new _t(), dn = /* @__PURE__ */ new Tt(), pn = /* @__PURE__ */ new Tt(), Nn = /* @__PURE__ */ new ut(), Gr = /* @__PURE__ */ new Je(), Ss = /* @__PURE__ */ new Je();
|
|
3107
3153
|
function _l(i, e, t, n) {
|
|
3108
|
-
|
|
3154
|
+
Se.setBuffer(i._roots[e]);
|
|
3109
3155
|
const s = Ni(0, i, t, n);
|
|
3110
|
-
return
|
|
3156
|
+
return Se.clearBuffer(), s;
|
|
3111
3157
|
}
|
|
3112
3158
|
function Ni(i, e, t, n, s = null) {
|
|
3113
|
-
const { float32Array: o, uint16Array: r, uint32Array: a } =
|
|
3159
|
+
const { float32Array: o, uint16Array: r, uint32Array: a } = Se;
|
|
3114
3160
|
let c = i * 2;
|
|
3115
3161
|
if (s === null && (t.boundingBox || t.computeBoundingBox(), Gr.set(t.boundingBox.min, t.boundingBox.max, n), s = Gr), De(c, r)) {
|
|
3116
|
-
const d = e.geometry, h = d.index, p = d.attributes.position, f = t.index, y = t.attributes.position,
|
|
3162
|
+
const d = e.geometry, h = d.index, p = d.attributes.position, f = t.index, y = t.attributes.position, S = $e(i, a), _ = Qe(c, r);
|
|
3117
3163
|
if (Nn.copy(n).invert(), t.boundsTree)
|
|
3118
|
-
return Ae(i, o,
|
|
3119
|
-
intersectsBounds: (E) =>
|
|
3164
|
+
return Ae(i, o, Ss), Ss.matrix.copy(Nn), Ss.needsUpdate = !0, t.boundsTree.shapecast({
|
|
3165
|
+
intersectsBounds: (E) => Ss.intersectsBox(E),
|
|
3120
3166
|
intersectsTriangle: (E) => {
|
|
3121
3167
|
E.a.applyMatrix4(n), E.b.applyMatrix4(n), E.c.applyMatrix4(n), E.needsUpdate = !0;
|
|
3122
|
-
for (let T =
|
|
3168
|
+
for (let T = S * 3, b = (_ + S) * 3; T < b; T += 3)
|
|
3123
3169
|
if (Ie(pn, T, h, p), pn.needsUpdate = !0, E.intersectsTriangle(pn))
|
|
3124
3170
|
return !0;
|
|
3125
3171
|
return !1;
|
|
3126
3172
|
}
|
|
3127
3173
|
});
|
|
3128
3174
|
{
|
|
3129
|
-
const
|
|
3130
|
-
for (let E =
|
|
3175
|
+
const A = qs(t);
|
|
3176
|
+
for (let E = S * 3, T = (_ + S) * 3; E < T; E += 3) {
|
|
3131
3177
|
Ie(dn, E, h, p), dn.a.applyMatrix4(Nn), dn.b.applyMatrix4(Nn), dn.c.applyMatrix4(Nn), dn.needsUpdate = !0;
|
|
3132
|
-
for (let
|
|
3133
|
-
if (Ie(pn,
|
|
3178
|
+
for (let b = 0, x = A * 3; b < x; b += 3)
|
|
3179
|
+
if (Ie(pn, b, f, y), pn.needsUpdate = !0, dn.intersectsTriangle(pn))
|
|
3134
3180
|
return !0;
|
|
3135
3181
|
}
|
|
3136
3182
|
}
|
|
3137
3183
|
} else {
|
|
3138
3184
|
const d = Fe(i), h = ze(i, a);
|
|
3139
|
-
return Ae(d, o,
|
|
3185
|
+
return Ae(d, o, bs), !!(s.intersectsBox(bs) && Ni(d, e, t, n, s) || (Ae(h, o, bs), s.intersectsBox(bs) && Ni(h, e, t, n, s)));
|
|
3140
3186
|
}
|
|
3141
3187
|
}
|
|
3142
|
-
const xs = /* @__PURE__ */ new ut(),
|
|
3188
|
+
const xs = /* @__PURE__ */ new ut(), ui = /* @__PURE__ */ new Je(), kn = /* @__PURE__ */ new Je(), bl = /* @__PURE__ */ new $(), Sl = /* @__PURE__ */ new $(), xl = /* @__PURE__ */ new $(), Al = /* @__PURE__ */ new $();
|
|
3143
3189
|
function vl(i, e, t, n = {}, s = {}, o = 0, r = 1 / 0) {
|
|
3144
|
-
e.boundingBox || e.computeBoundingBox(),
|
|
3190
|
+
e.boundingBox || e.computeBoundingBox(), ui.set(e.boundingBox.min, e.boundingBox.max, t), ui.needsUpdate = !0;
|
|
3145
3191
|
const a = i.geometry, c = a.attributes.position, u = a.index, d = e.attributes.position, h = e.index, p = ht.getPrimitive(), f = ht.getPrimitive();
|
|
3146
|
-
let y =
|
|
3147
|
-
s && (_ = xl,
|
|
3148
|
-
let E = 1 / 0, T = null,
|
|
3192
|
+
let y = bl, S = Sl, _ = null, A = null;
|
|
3193
|
+
s && (_ = xl, A = Al);
|
|
3194
|
+
let E = 1 / 0, T = null, b = null;
|
|
3149
3195
|
return xs.copy(t).invert(), kn.matrix.copy(xs), i.shapecast(
|
|
3150
3196
|
{
|
|
3151
|
-
boundsTraverseOrder: (
|
|
3152
|
-
intersectsBounds: (
|
|
3153
|
-
intersectsRange: (
|
|
3197
|
+
boundsTraverseOrder: (x) => ui.distanceToBox(x),
|
|
3198
|
+
intersectsBounds: (x, P, C) => C < E && C < r ? (P && (kn.min.copy(x.min), kn.max.copy(x.max), kn.needsUpdate = !0), !0) : !1,
|
|
3199
|
+
intersectsRange: (x, P) => {
|
|
3154
3200
|
if (e.boundsTree)
|
|
3155
3201
|
return e.boundsTree.shapecast({
|
|
3156
3202
|
boundsTraverseOrder: (M) => kn.distanceToBox(M),
|
|
3157
|
-
intersectsBounds: (M, O,
|
|
3203
|
+
intersectsBounds: (M, O, I) => I < E && I < r,
|
|
3158
3204
|
intersectsRange: (M, O) => {
|
|
3159
|
-
for (let
|
|
3160
|
-
Ie(f, 3 *
|
|
3161
|
-
for (let D =
|
|
3205
|
+
for (let I = M, k = M + O; I < k; I++) {
|
|
3206
|
+
Ie(f, 3 * I, h, d), f.a.applyMatrix4(t), f.b.applyMatrix4(t), f.c.applyMatrix4(t), f.needsUpdate = !0;
|
|
3207
|
+
for (let D = x, H = x + P; D < H; D++) {
|
|
3162
3208
|
Ie(p, 3 * D, u, c), p.needsUpdate = !0;
|
|
3163
3209
|
const G = p.distanceToTriangle(f, y, _);
|
|
3164
|
-
if (G < E && (
|
|
3210
|
+
if (G < E && (S.copy(y), A && A.copy(_), E = G, T = D, b = I), G < o)
|
|
3165
3211
|
return !0;
|
|
3166
3212
|
}
|
|
3167
3213
|
}
|
|
3168
3214
|
}
|
|
3169
3215
|
});
|
|
3170
3216
|
{
|
|
3171
|
-
const
|
|
3172
|
-
for (let M = 0, O =
|
|
3217
|
+
const C = qs(e);
|
|
3218
|
+
for (let M = 0, O = C; M < O; M++) {
|
|
3173
3219
|
Ie(f, 3 * M, h, d), f.a.applyMatrix4(t), f.b.applyMatrix4(t), f.c.applyMatrix4(t), f.needsUpdate = !0;
|
|
3174
|
-
for (let
|
|
3175
|
-
Ie(p, 3 *
|
|
3220
|
+
for (let I = x, k = x + P; I < k; I++) {
|
|
3221
|
+
Ie(p, 3 * I, u, c), p.needsUpdate = !0;
|
|
3176
3222
|
const D = p.distanceToTriangle(f, y, _);
|
|
3177
|
-
if (D < E && (
|
|
3223
|
+
if (D < E && (S.copy(y), A && A.copy(_), E = D, T = I, b = M), D < o)
|
|
3178
3224
|
return !0;
|
|
3179
3225
|
}
|
|
3180
3226
|
}
|
|
3181
3227
|
}
|
|
3182
3228
|
}
|
|
3183
3229
|
}
|
|
3184
|
-
), ht.releasePrimitive(p), ht.releasePrimitive(f), E === 1 / 0 ? null : (n.point ? n.point.copy(
|
|
3230
|
+
), ht.releasePrimitive(p), ht.releasePrimitive(f), E === 1 / 0 ? null : (n.point ? n.point.copy(S) : n.point = S.clone(), n.distance = E, n.faceIndex = T, s && (s.point ? s.point.copy(A) : s.point = A.clone(), s.point.applyMatrix4(xs), S.applyMatrix4(xs), s.distance = S.sub(s.point).length(), s.faceIndex = b), n);
|
|
3185
3231
|
}
|
|
3186
3232
|
function Rl(i, e = null) {
|
|
3187
3233
|
e && Array.isArray(e) && (e = new Set(e));
|
|
@@ -3191,50 +3237,50 @@ function Rl(i, e = null) {
|
|
|
3191
3237
|
for (let p = 0, f = d.length; p < f; p++)
|
|
3192
3238
|
o = d[p], r = new Uint32Array(o), a = new Uint16Array(o), c = new Float32Array(o), h(0, u), u += o.byteLength;
|
|
3193
3239
|
function h(p, f, y = !1) {
|
|
3194
|
-
const
|
|
3195
|
-
if (De(
|
|
3196
|
-
const _ = $e(p, r),
|
|
3197
|
-
let E = 1 / 0, T = 1 / 0,
|
|
3198
|
-
for (let M = _, O = _ +
|
|
3199
|
-
const
|
|
3240
|
+
const S = p * 2;
|
|
3241
|
+
if (De(S, a)) {
|
|
3242
|
+
const _ = $e(p, r), A = Qe(S, a);
|
|
3243
|
+
let E = 1 / 0, T = 1 / 0, b = 1 / 0, x = -1 / 0, P = -1 / 0, C = -1 / 0;
|
|
3244
|
+
for (let M = _, O = _ + A; M < O; M++) {
|
|
3245
|
+
const I = 3 * i.resolveTriangleIndex(M);
|
|
3200
3246
|
for (let k = 0; k < 3; k++) {
|
|
3201
|
-
let D =
|
|
3247
|
+
let D = I + k;
|
|
3202
3248
|
D = n ? n[D] : D;
|
|
3203
3249
|
const H = s.getX(D), G = s.getY(D), q = s.getZ(D);
|
|
3204
|
-
H < E && (E = H), H >
|
|
3250
|
+
H < E && (E = H), H > x && (x = H), G < T && (T = G), G > P && (P = G), q < b && (b = q), q > C && (C = q);
|
|
3205
3251
|
}
|
|
3206
3252
|
}
|
|
3207
|
-
return c[p + 0] !== E || c[p + 1] !== T || c[p + 2] !==
|
|
3253
|
+
return c[p + 0] !== E || c[p + 1] !== T || c[p + 2] !== b || c[p + 3] !== x || c[p + 4] !== P || c[p + 5] !== C ? (c[p + 0] = E, c[p + 1] = T, c[p + 2] = b, c[p + 3] = x, c[p + 4] = P, c[p + 5] = C, !0) : !1;
|
|
3208
3254
|
} else {
|
|
3209
|
-
const _ = Fe(p),
|
|
3210
|
-
let E = y, T = !1,
|
|
3255
|
+
const _ = Fe(p), A = ze(p, r);
|
|
3256
|
+
let E = y, T = !1, b = !1;
|
|
3211
3257
|
if (e) {
|
|
3212
3258
|
if (!E) {
|
|
3213
|
-
const
|
|
3214
|
-
T = e.has(
|
|
3259
|
+
const I = _ / Oe + f / qe, k = A / Oe + f / qe;
|
|
3260
|
+
T = e.has(I), b = e.has(k), E = !T && !b;
|
|
3215
3261
|
}
|
|
3216
3262
|
} else
|
|
3217
|
-
T = !0,
|
|
3218
|
-
const
|
|
3219
|
-
let
|
|
3220
|
-
|
|
3263
|
+
T = !0, b = !0;
|
|
3264
|
+
const x = E || T, P = E || b;
|
|
3265
|
+
let C = !1;
|
|
3266
|
+
x && (C = h(_, f, E));
|
|
3221
3267
|
let M = !1;
|
|
3222
|
-
P && (M = h(
|
|
3223
|
-
const O =
|
|
3268
|
+
P && (M = h(A, f, E));
|
|
3269
|
+
const O = C || M;
|
|
3224
3270
|
if (O)
|
|
3225
|
-
for (let
|
|
3226
|
-
const k = _ +
|
|
3227
|
-
c[p +
|
|
3271
|
+
for (let I = 0; I < 3; I++) {
|
|
3272
|
+
const k = _ + I, D = A + I, H = c[k], G = c[k + 3], q = c[D], ie = c[D + 3];
|
|
3273
|
+
c[p + I] = H < q ? H : q, c[p + I + 3] = G > ie ? G : ie;
|
|
3228
3274
|
}
|
|
3229
3275
|
return O;
|
|
3230
3276
|
}
|
|
3231
3277
|
}
|
|
3232
3278
|
}
|
|
3233
3279
|
function Ml(i, e, t, n, s, o, r) {
|
|
3234
|
-
|
|
3280
|
+
Se.setBuffer(i._roots[e]), ki(0, i, t, n, s, o, r), Se.clearBuffer();
|
|
3235
3281
|
}
|
|
3236
3282
|
function ki(i, e, t, n, s, o, r) {
|
|
3237
|
-
const { float32Array: a, uint16Array: c, uint32Array: u } =
|
|
3283
|
+
const { float32Array: a, uint16Array: c, uint32Array: u } = Se, d = i * 2;
|
|
3238
3284
|
if (De(d, c)) {
|
|
3239
3285
|
const p = $e(i, u), f = Qe(d, c);
|
|
3240
3286
|
ml(e, t, n, p, f, s, o, r);
|
|
@@ -3247,62 +3293,62 @@ function ki(i, e, t, n, s, o, r) {
|
|
|
3247
3293
|
}
|
|
3248
3294
|
const Cl = ["x", "y", "z"];
|
|
3249
3295
|
function Il(i, e, t, n, s, o) {
|
|
3250
|
-
|
|
3296
|
+
Se.setBuffer(i._roots[e]);
|
|
3251
3297
|
const r = Fi(0, i, t, n, s, o);
|
|
3252
|
-
return
|
|
3298
|
+
return Se.clearBuffer(), r;
|
|
3253
3299
|
}
|
|
3254
3300
|
function Fi(i, e, t, n, s, o) {
|
|
3255
|
-
const { float32Array: r, uint16Array: a, uint32Array: c } =
|
|
3301
|
+
const { float32Array: r, uint16Array: a, uint32Array: c } = Se;
|
|
3256
3302
|
let u = i * 2;
|
|
3257
3303
|
if (De(u, a)) {
|
|
3258
3304
|
const h = $e(i, c), p = Qe(u, a);
|
|
3259
3305
|
return gl(e, t, n, h, p, s, o);
|
|
3260
3306
|
} else {
|
|
3261
3307
|
const h = ir(i, c), p = Cl[h], y = n.direction[p] >= 0;
|
|
3262
|
-
let
|
|
3263
|
-
y ? (
|
|
3264
|
-
const E = Xt(
|
|
3308
|
+
let S, _;
|
|
3309
|
+
y ? (S = Fe(i), _ = ze(i, c)) : (S = ze(i, c), _ = Fe(i));
|
|
3310
|
+
const E = Xt(S, r, n, s, o) ? Fi(S, e, t, n, s, o) : null;
|
|
3265
3311
|
if (E) {
|
|
3266
|
-
const
|
|
3267
|
-
if (y ?
|
|
3312
|
+
const x = E.point[p];
|
|
3313
|
+
if (y ? x <= r[_ + h] : (
|
|
3268
3314
|
// min bounding data
|
|
3269
|
-
|
|
3315
|
+
x >= r[_ + h + 3]
|
|
3270
3316
|
))
|
|
3271
3317
|
return E;
|
|
3272
3318
|
}
|
|
3273
|
-
const
|
|
3274
|
-
return E &&
|
|
3319
|
+
const b = Xt(_, r, n, s, o) ? Fi(_, e, t, n, s, o) : null;
|
|
3320
|
+
return E && b ? E.distance <= b.distance ? E : b : E || b || null;
|
|
3275
3321
|
}
|
|
3276
3322
|
}
|
|
3277
3323
|
const As = /* @__PURE__ */ new _t(), fn = /* @__PURE__ */ new Tt(), mn = /* @__PURE__ */ new Tt(), Fn = /* @__PURE__ */ new ut(), Vr = /* @__PURE__ */ new Je(), vs = /* @__PURE__ */ new Je();
|
|
3278
3324
|
function Pl(i, e, t, n) {
|
|
3279
|
-
|
|
3325
|
+
Se.setBuffer(i._roots[e]);
|
|
3280
3326
|
const s = zi(0, i, t, n);
|
|
3281
|
-
return
|
|
3327
|
+
return Se.clearBuffer(), s;
|
|
3282
3328
|
}
|
|
3283
3329
|
function zi(i, e, t, n, s = null) {
|
|
3284
|
-
const { float32Array: o, uint16Array: r, uint32Array: a } =
|
|
3330
|
+
const { float32Array: o, uint16Array: r, uint32Array: a } = Se;
|
|
3285
3331
|
let c = i * 2;
|
|
3286
3332
|
if (s === null && (t.boundingBox || t.computeBoundingBox(), Vr.set(t.boundingBox.min, t.boundingBox.max, n), s = Vr), De(c, r)) {
|
|
3287
|
-
const d = e.geometry, h = d.index, p = d.attributes.position, f = t.index, y = t.attributes.position,
|
|
3333
|
+
const d = e.geometry, h = d.index, p = d.attributes.position, f = t.index, y = t.attributes.position, S = $e(i, a), _ = Qe(c, r);
|
|
3288
3334
|
if (Fn.copy(n).invert(), t.boundsTree)
|
|
3289
3335
|
return Ae(i, o, vs), vs.matrix.copy(Fn), vs.needsUpdate = !0, t.boundsTree.shapecast({
|
|
3290
3336
|
intersectsBounds: (E) => vs.intersectsBox(E),
|
|
3291
3337
|
intersectsTriangle: (E) => {
|
|
3292
3338
|
E.a.applyMatrix4(n), E.b.applyMatrix4(n), E.c.applyMatrix4(n), E.needsUpdate = !0;
|
|
3293
|
-
for (let T =
|
|
3339
|
+
for (let T = S, b = _ + S; T < b; T++)
|
|
3294
3340
|
if (Ie(mn, 3 * e.resolveTriangleIndex(T), h, p), mn.needsUpdate = !0, E.intersectsTriangle(mn))
|
|
3295
3341
|
return !0;
|
|
3296
3342
|
return !1;
|
|
3297
3343
|
}
|
|
3298
3344
|
});
|
|
3299
3345
|
{
|
|
3300
|
-
const
|
|
3301
|
-
for (let E =
|
|
3302
|
-
const
|
|
3303
|
-
Ie(fn, 3 *
|
|
3304
|
-
for (let
|
|
3305
|
-
if (Ie(mn,
|
|
3346
|
+
const A = qs(t);
|
|
3347
|
+
for (let E = S, T = _ + S; E < T; E++) {
|
|
3348
|
+
const b = e.resolveTriangleIndex(E);
|
|
3349
|
+
Ie(fn, 3 * b, h, p), fn.a.applyMatrix4(Fn), fn.b.applyMatrix4(Fn), fn.c.applyMatrix4(Fn), fn.needsUpdate = !0;
|
|
3350
|
+
for (let x = 0, P = A * 3; x < P; x += 3)
|
|
3351
|
+
if (Ie(mn, x, f, y), mn.needsUpdate = !0, fn.intersectsTriangle(mn))
|
|
3306
3352
|
return !0;
|
|
3307
3353
|
}
|
|
3308
3354
|
}
|
|
@@ -3311,59 +3357,59 @@ function zi(i, e, t, n, s = null) {
|
|
|
3311
3357
|
return Ae(d, o, As), !!(s.intersectsBox(As) && zi(d, e, t, n, s) || (Ae(h, o, As), s.intersectsBox(As) && zi(h, e, t, n, s)));
|
|
3312
3358
|
}
|
|
3313
3359
|
}
|
|
3314
|
-
const Rs = /* @__PURE__ */ new ut(),
|
|
3360
|
+
const Rs = /* @__PURE__ */ new ut(), di = /* @__PURE__ */ new Je(), zn = /* @__PURE__ */ new Je(), Ll = /* @__PURE__ */ new $(), Ol = /* @__PURE__ */ new $(), Dl = /* @__PURE__ */ new $(), Nl = /* @__PURE__ */ new $();
|
|
3315
3361
|
function kl(i, e, t, n = {}, s = {}, o = 0, r = 1 / 0) {
|
|
3316
|
-
e.boundingBox || e.computeBoundingBox(),
|
|
3362
|
+
e.boundingBox || e.computeBoundingBox(), di.set(e.boundingBox.min, e.boundingBox.max, t), di.needsUpdate = !0;
|
|
3317
3363
|
const a = i.geometry, c = a.attributes.position, u = a.index, d = e.attributes.position, h = e.index, p = ht.getPrimitive(), f = ht.getPrimitive();
|
|
3318
|
-
let y = Ll,
|
|
3319
|
-
s && (_ = Dl,
|
|
3320
|
-
let E = 1 / 0, T = null,
|
|
3364
|
+
let y = Ll, S = Ol, _ = null, A = null;
|
|
3365
|
+
s && (_ = Dl, A = Nl);
|
|
3366
|
+
let E = 1 / 0, T = null, b = null;
|
|
3321
3367
|
return Rs.copy(t).invert(), zn.matrix.copy(Rs), i.shapecast(
|
|
3322
3368
|
{
|
|
3323
|
-
boundsTraverseOrder: (
|
|
3324
|
-
intersectsBounds: (
|
|
3325
|
-
intersectsRange: (
|
|
3369
|
+
boundsTraverseOrder: (x) => di.distanceToBox(x),
|
|
3370
|
+
intersectsBounds: (x, P, C) => C < E && C < r ? (P && (zn.min.copy(x.min), zn.max.copy(x.max), zn.needsUpdate = !0), !0) : !1,
|
|
3371
|
+
intersectsRange: (x, P) => {
|
|
3326
3372
|
if (e.boundsTree) {
|
|
3327
|
-
const
|
|
3328
|
-
return
|
|
3373
|
+
const C = e.boundsTree;
|
|
3374
|
+
return C.shapecast({
|
|
3329
3375
|
boundsTraverseOrder: (M) => zn.distanceToBox(M),
|
|
3330
|
-
intersectsBounds: (M, O,
|
|
3376
|
+
intersectsBounds: (M, O, I) => I < E && I < r,
|
|
3331
3377
|
intersectsRange: (M, O) => {
|
|
3332
|
-
for (let
|
|
3333
|
-
const D =
|
|
3378
|
+
for (let I = M, k = M + O; I < k; I++) {
|
|
3379
|
+
const D = C.resolveTriangleIndex(I);
|
|
3334
3380
|
Ie(f, 3 * D, h, d), f.a.applyMatrix4(t), f.b.applyMatrix4(t), f.c.applyMatrix4(t), f.needsUpdate = !0;
|
|
3335
|
-
for (let H =
|
|
3381
|
+
for (let H = x, G = x + P; H < G; H++) {
|
|
3336
3382
|
const q = i.resolveTriangleIndex(H);
|
|
3337
3383
|
Ie(p, 3 * q, u, c), p.needsUpdate = !0;
|
|
3338
3384
|
const ie = p.distanceToTriangle(f, y, _);
|
|
3339
|
-
if (ie < E && (
|
|
3385
|
+
if (ie < E && (S.copy(y), A && A.copy(_), E = ie, T = H, b = I), ie < o)
|
|
3340
3386
|
return !0;
|
|
3341
3387
|
}
|
|
3342
3388
|
}
|
|
3343
3389
|
}
|
|
3344
3390
|
});
|
|
3345
3391
|
} else {
|
|
3346
|
-
const
|
|
3347
|
-
for (let M = 0, O =
|
|
3392
|
+
const C = qs(e);
|
|
3393
|
+
for (let M = 0, O = C; M < O; M++) {
|
|
3348
3394
|
Ie(f, 3 * M, h, d), f.a.applyMatrix4(t), f.b.applyMatrix4(t), f.c.applyMatrix4(t), f.needsUpdate = !0;
|
|
3349
|
-
for (let
|
|
3350
|
-
const D = i.resolveTriangleIndex(
|
|
3395
|
+
for (let I = x, k = x + P; I < k; I++) {
|
|
3396
|
+
const D = i.resolveTriangleIndex(I);
|
|
3351
3397
|
Ie(p, 3 * D, u, c), p.needsUpdate = !0;
|
|
3352
3398
|
const H = p.distanceToTriangle(f, y, _);
|
|
3353
|
-
if (H < E && (
|
|
3399
|
+
if (H < E && (S.copy(y), A && A.copy(_), E = H, T = I, b = M), H < o)
|
|
3354
3400
|
return !0;
|
|
3355
3401
|
}
|
|
3356
3402
|
}
|
|
3357
3403
|
}
|
|
3358
3404
|
}
|
|
3359
3405
|
}
|
|
3360
|
-
), ht.releasePrimitive(p), ht.releasePrimitive(f), E === 1 / 0 ? null : (n.point ? n.point.copy(
|
|
3406
|
+
), ht.releasePrimitive(p), ht.releasePrimitive(f), E === 1 / 0 ? null : (n.point ? n.point.copy(S) : n.point = S.clone(), n.distance = E, n.faceIndex = T, s && (s.point ? s.point.copy(A) : s.point = A.clone(), s.point.applyMatrix4(Rs), S.applyMatrix4(Rs), s.distance = S.sub(s.point).length(), s.faceIndex = b), n);
|
|
3361
3407
|
}
|
|
3362
3408
|
function Wr(i, e, t) {
|
|
3363
3409
|
return i === null ? null : (i.point.applyMatrix4(e.matrixWorld), i.distance = i.point.distanceTo(t.ray.origin), i.object = e, i);
|
|
3364
3410
|
}
|
|
3365
|
-
const Ms = /* @__PURE__ */ new Je(), Cs = /* @__PURE__ */ new Xi(), Zr = /* @__PURE__ */ new $(), Kr = /* @__PURE__ */ new ut(), Xr = /* @__PURE__ */ new $(),
|
|
3366
|
-
class
|
|
3411
|
+
const Ms = /* @__PURE__ */ new Je(), Cs = /* @__PURE__ */ new Xi(), Zr = /* @__PURE__ */ new $(), Kr = /* @__PURE__ */ new ut(), Xr = /* @__PURE__ */ new $(), pi = ["getX", "getY", "getZ"];
|
|
3412
|
+
class Zs extends sl {
|
|
3367
3413
|
/**
|
|
3368
3414
|
* Generates a representation of the complete bounds tree and the geometry index buffer which
|
|
3369
3415
|
* can be used to recreate a bounds tree using the `deserialize` function. The `serialize` and
|
|
@@ -3416,7 +3462,7 @@ class Ws extends sl {
|
|
|
3416
3462
|
e.version || (console.warn(
|
|
3417
3463
|
"MeshBVH.deserialize: Serialization format has been changed and will be fixed up. It is recommended to regenerate any stored serialized data."
|
|
3418
3464
|
), c(o));
|
|
3419
|
-
const a = new
|
|
3465
|
+
const a = new Zs(t, { ...n, [sr]: !0 });
|
|
3420
3466
|
if (a._roots = o, a._indirectBuffer = r || null, n.setIndex) {
|
|
3421
3467
|
const u = t.getIndex();
|
|
3422
3468
|
if (u === null) {
|
|
@@ -3428,9 +3474,9 @@ class Ws extends sl {
|
|
|
3428
3474
|
function c(u) {
|
|
3429
3475
|
for (let d = 0; d < u.length; d++) {
|
|
3430
3476
|
const h = u[d], p = new Uint32Array(h), f = new Uint16Array(h);
|
|
3431
|
-
for (let y = 0,
|
|
3432
|
-
const _ = Oe * y,
|
|
3433
|
-
De(
|
|
3477
|
+
for (let y = 0, S = h.byteLength / qe; y < S; y++) {
|
|
3478
|
+
const _ = Oe * y, A = 2 * _;
|
|
3479
|
+
De(A, f) || (p[_ + 6] = p[_ + 6] / Oe - y);
|
|
3434
3480
|
}
|
|
3435
3481
|
}
|
|
3436
3482
|
}
|
|
@@ -3474,11 +3520,11 @@ class Ws extends sl {
|
|
|
3474
3520
|
let d = u + 0, h = u + 1, p = u + 2;
|
|
3475
3521
|
a && (d = a[d], h = a[h], p = a[p]);
|
|
3476
3522
|
for (let f = 0; f < 3; f++) {
|
|
3477
|
-
const y = r[
|
|
3478
|
-
let
|
|
3479
|
-
|
|
3523
|
+
const y = r[pi[f]](d), S = r[pi[f]](h), _ = r[pi[f]](p);
|
|
3524
|
+
let A = y;
|
|
3525
|
+
S < A && (A = S), _ < A && (A = _);
|
|
3480
3526
|
let E = y;
|
|
3481
|
-
|
|
3527
|
+
S > E && (E = S), _ > E && (E = _), t[n + f] = A, t[n + f + 3] = E;
|
|
3482
3528
|
}
|
|
3483
3529
|
return t;
|
|
3484
3530
|
}
|
|
@@ -3494,19 +3540,19 @@ class Ws extends sl {
|
|
|
3494
3540
|
let h = 3;
|
|
3495
3541
|
r.isInterleavedBufferAttribute && (h = r.data.stride);
|
|
3496
3542
|
const p = ["getX", "getY", "getZ"], f = n.offset;
|
|
3497
|
-
for (let y = e,
|
|
3498
|
-
const
|
|
3499
|
-
let T =
|
|
3500
|
-
a && (T = a[T],
|
|
3543
|
+
for (let y = e, S = e + t; y < S; y++) {
|
|
3544
|
+
const A = (o ? o[y] : y) * 3, E = (y - f) * 6;
|
|
3545
|
+
let T = A + 0, b = A + 1, x = A + 2;
|
|
3546
|
+
a && (T = a[T], b = a[b], x = a[x]), c || (T = T * h + d, b = b * h + d, x = x * h + d);
|
|
3501
3547
|
for (let P = 0; P < 3; P++) {
|
|
3502
|
-
let
|
|
3503
|
-
c ? (
|
|
3504
|
-
let
|
|
3505
|
-
M <
|
|
3506
|
-
let k =
|
|
3548
|
+
let C, M, O;
|
|
3549
|
+
c ? (C = r[p[P]](T), M = r[p[P]](b), O = r[p[P]](x)) : (C = u[T + P], M = u[b + P], O = u[x + P]);
|
|
3550
|
+
let I = C;
|
|
3551
|
+
M < I && (I = M), O < I && (I = O);
|
|
3552
|
+
let k = C;
|
|
3507
3553
|
M > k && (k = M), O > k && (k = O);
|
|
3508
|
-
const D = (k -
|
|
3509
|
-
n[E + H + 0] =
|
|
3554
|
+
const D = (k - I) / 2, H = P * 2;
|
|
3555
|
+
n[E + H + 0] = I + D, n[E + H + 1] = D + (Math.abs(I) + D) * Bs;
|
|
3510
3556
|
}
|
|
3511
3557
|
}
|
|
3512
3558
|
return n;
|
|
@@ -3663,32 +3709,32 @@ class Ws extends sl {
|
|
|
3663
3709
|
intersectsTriangles: o
|
|
3664
3710
|
} = n;
|
|
3665
3711
|
const r = ht.getPrimitive(), a = this.geometry.index, c = this.geometry.attributes.position, u = this.indirect ? (y) => {
|
|
3666
|
-
const
|
|
3667
|
-
Ie(r,
|
|
3712
|
+
const S = this.resolveTriangleIndex(y);
|
|
3713
|
+
Ie(r, S * 3, a, c);
|
|
3668
3714
|
} : (y) => {
|
|
3669
3715
|
Ie(r, y * 3, a, c);
|
|
3670
3716
|
}, d = ht.getPrimitive(), h = e.geometry.index, p = e.geometry.attributes.position, f = e.indirect ? (y) => {
|
|
3671
|
-
const
|
|
3672
|
-
Ie(d,
|
|
3717
|
+
const S = e.resolveTriangleIndex(y);
|
|
3718
|
+
Ie(d, S * 3, h, p);
|
|
3673
3719
|
} : (y) => {
|
|
3674
3720
|
Ie(d, y * 3, h, p);
|
|
3675
3721
|
};
|
|
3676
3722
|
if (o) {
|
|
3677
|
-
if (!(e instanceof
|
|
3723
|
+
if (!(e instanceof Zs))
|
|
3678
3724
|
throw new Error('MeshBVH: "intersectsTriangles" callback can only be used with another MeshBVH.');
|
|
3679
|
-
const y = (
|
|
3680
|
-
for (let
|
|
3681
|
-
f(
|
|
3682
|
-
for (let O =
|
|
3683
|
-
if (u(O), r.needsUpdate = !0, o(r, d, O,
|
|
3725
|
+
const y = (S, _, A, E, T, b, x, P) => {
|
|
3726
|
+
for (let C = A, M = A + E; C < M; C++) {
|
|
3727
|
+
f(C), d.a.applyMatrix4(t), d.b.applyMatrix4(t), d.c.applyMatrix4(t), d.needsUpdate = !0;
|
|
3728
|
+
for (let O = S, I = S + _; O < I; O++)
|
|
3729
|
+
if (u(O), r.needsUpdate = !0, o(r, d, O, C, T, b, x, P))
|
|
3684
3730
|
return !0;
|
|
3685
3731
|
}
|
|
3686
3732
|
return !1;
|
|
3687
3733
|
};
|
|
3688
3734
|
if (s) {
|
|
3689
|
-
const
|
|
3690
|
-
s = function(_,
|
|
3691
|
-
return
|
|
3735
|
+
const S = s;
|
|
3736
|
+
s = function(_, A, E, T, b, x, P, C) {
|
|
3737
|
+
return S(_, A, E, T, b, x, P, C) ? !0 : y(_, A, E, T, b, x, P, C);
|
|
3692
3738
|
};
|
|
3693
3739
|
} else
|
|
3694
3740
|
s = y;
|
|
@@ -3862,7 +3908,7 @@ function Fo(i) {
|
|
|
3862
3908
|
if (!t.isMesh || t.isSkinnedMesh || t.isInstancedMesh || t.isBatchedMesh)
|
|
3863
3909
|
return;
|
|
3864
3910
|
const n = t.geometry;
|
|
3865
|
-
!((s = n == null ? void 0 : n.attributes) != null && s.position) || (r = (o = n.morphAttributes) == null ? void 0 : o.position) != null && r.length || (n.boundsTree || (n.boundsTree = new
|
|
3911
|
+
!((s = n == null ? void 0 : n.attributes) != null && s.position) || (r = (o = n.morphAttributes) == null ? void 0 : o.position) != null && r.length || (n.boundsTree || (n.boundsTree = new Zs(n)), t.raycast = Fl);
|
|
3866
3912
|
});
|
|
3867
3913
|
}
|
|
3868
3914
|
function Bl(i) {
|
|
@@ -3880,7 +3926,7 @@ function Yr(i) {
|
|
|
3880
3926
|
(n == null ? void 0 : n.value) instanceof w.Texture && n.value.dispose();
|
|
3881
3927
|
i.dispose();
|
|
3882
3928
|
}
|
|
3883
|
-
function
|
|
3929
|
+
function Qs(i) {
|
|
3884
3930
|
i.traverse((e) => {
|
|
3885
3931
|
var o;
|
|
3886
3932
|
const t = e;
|
|
@@ -3898,7 +3944,7 @@ function Ul(i, e) {
|
|
|
3898
3944
|
t.__originalEnvironmentTexture && (t.__originalEnvironmentTexture = void 0);
|
|
3899
3945
|
}
|
|
3900
3946
|
for (const t of [...i.children])
|
|
3901
|
-
|
|
3947
|
+
Qs(t), i.remove(t);
|
|
3902
3948
|
}
|
|
3903
3949
|
class Xe {
|
|
3904
3950
|
constructor(e) {
|
|
@@ -3985,7 +4031,7 @@ class Xe {
|
|
|
3985
4031
|
return new Xe(this.object.clone());
|
|
3986
4032
|
}
|
|
3987
4033
|
dispose() {
|
|
3988
|
-
|
|
4034
|
+
Qs(this.object);
|
|
3989
4035
|
}
|
|
3990
4036
|
// Get the underlying Three.js object
|
|
3991
4037
|
getThreeObject() {
|
|
@@ -4226,7 +4272,7 @@ class cr extends Bo {
|
|
|
4226
4272
|
set aspect(e) {
|
|
4227
4273
|
this.perspectiveCamera.aspect = e;
|
|
4228
4274
|
}
|
|
4229
|
-
static create(e =
|
|
4275
|
+
static create(e = 45, t = 1, n = 0.1, s = 1e3) {
|
|
4230
4276
|
return new cr(
|
|
4231
4277
|
new w.PerspectiveCamera(e, t, n, s)
|
|
4232
4278
|
);
|
|
@@ -4263,7 +4309,12 @@ class Hl {
|
|
|
4263
4309
|
linear: w.LinearToneMapping,
|
|
4264
4310
|
reinhard: w.ReinhardToneMapping,
|
|
4265
4311
|
cineon: w.CineonToneMapping,
|
|
4266
|
-
aces: w.ACESFilmicToneMapping
|
|
4312
|
+
aces: w.ACESFilmicToneMapping,
|
|
4313
|
+
agx: w.AgXToneMapping,
|
|
4314
|
+
// Khronos PBR Neutral: rolls highlights off filmically while
|
|
4315
|
+
// preserving material hue/saturation (unlike ACES, which desaturates
|
|
4316
|
+
// bright values toward white) — the default for this product viewer.
|
|
4317
|
+
neutral: w.NeutralToneMapping
|
|
4267
4318
|
};
|
|
4268
4319
|
this.renderer.toneMapping = t[e.toneMapping.type], this.renderer.toneMappingExposure = e.toneMapping.exposure;
|
|
4269
4320
|
}
|
|
@@ -4706,7 +4757,7 @@ class Wl {
|
|
|
4706
4757
|
u = new Ja(d), u.target.position.set(0, 0, -1), u.add(u.target);
|
|
4707
4758
|
break;
|
|
4708
4759
|
case "point":
|
|
4709
|
-
u = new
|
|
4760
|
+
u = new bo(d), u.distance = h;
|
|
4710
4761
|
break;
|
|
4711
4762
|
case "spot":
|
|
4712
4763
|
u = new Qa(d), u.distance = h, c.spot = c.spot || {}, c.spot.innerConeAngle = c.spot.innerConeAngle !== void 0 ? c.spot.innerConeAngle : 0, c.spot.outerConeAngle = c.spot.outerConeAngle !== void 0 ? c.spot.outerConeAngle : Math.PI / 4, u.angle = c.spot.outerConeAngle, u.penumbra = 1 - c.spot.innerConeAngle / c.spot.outerConeAngle, u.target.position.set(0, 0, -1), u.add(u.target);
|
|
@@ -5000,14 +5051,14 @@ class ah {
|
|
|
5000
5051
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((u) => {
|
|
5001
5052
|
const d = u.pop(), h = d.isGroup ? d.children : [d], p = u[0].count, f = [];
|
|
5002
5053
|
for (const y of h) {
|
|
5003
|
-
const
|
|
5004
|
-
for (let
|
|
5005
|
-
c.TRANSLATION && _.fromBufferAttribute(c.TRANSLATION,
|
|
5006
|
-
for (const
|
|
5007
|
-
if (
|
|
5008
|
-
const
|
|
5009
|
-
T.instanceColor = new ec(
|
|
5010
|
-
} else
|
|
5054
|
+
const S = new ut(), _ = new $(), A = new An(), E = new $(1, 1, 1), T = new So(y.geometry, y.material, p);
|
|
5055
|
+
for (let b = 0; b < p; b++)
|
|
5056
|
+
c.TRANSLATION && _.fromBufferAttribute(c.TRANSLATION, b), c.ROTATION && A.fromBufferAttribute(c.ROTATION, b), c.SCALE && E.fromBufferAttribute(c.SCALE, b), T.setMatrixAt(b, S.compose(_, A, E));
|
|
5057
|
+
for (const b in c)
|
|
5058
|
+
if (b === "_COLOR_0") {
|
|
5059
|
+
const x = c[b];
|
|
5060
|
+
T.instanceColor = new ec(x.array, x.itemSize, x.normalized);
|
|
5061
|
+
} else b !== "TRANSLATION" && b !== "ROTATION" && b !== "SCALE" && y.geometry.setAttribute(b, c[b]);
|
|
5011
5062
|
Ji.prototype.copy.call(T, y), this.parser.assignFinalMaterial(T), f.push(T);
|
|
5012
5063
|
}
|
|
5013
5064
|
return d.isGroup ? (d.clear(), d.add(...f), d) : f[0];
|
|
@@ -5061,7 +5112,7 @@ class lh {
|
|
|
5061
5112
|
for (const d in e.attributes) {
|
|
5062
5113
|
const h = Ui[d] || d.toLowerCase();
|
|
5063
5114
|
if (r[d] !== void 0) {
|
|
5064
|
-
const p = n.accessors[e.attributes[d]], f =
|
|
5115
|
+
const p = n.accessors[e.attributes[d]], f = bn[p.componentType];
|
|
5065
5116
|
u[h] = f.name, c[h] = p.normalized === !0;
|
|
5066
5117
|
}
|
|
5067
5118
|
}
|
|
@@ -5069,8 +5120,8 @@ class lh {
|
|
|
5069
5120
|
return new Promise(function(h, p) {
|
|
5070
5121
|
s.decodeDracoFile(d, function(f) {
|
|
5071
5122
|
for (const y in f.attributes) {
|
|
5072
|
-
const
|
|
5073
|
-
_ !== void 0 && (
|
|
5123
|
+
const S = f.attributes[y], _ = c[y];
|
|
5124
|
+
_ !== void 0 && (S.normalized = _);
|
|
5074
5125
|
}
|
|
5075
5126
|
h(f);
|
|
5076
5127
|
}, a, u, je, p);
|
|
@@ -5102,10 +5153,10 @@ class jo extends _c {
|
|
|
5102
5153
|
return t;
|
|
5103
5154
|
}
|
|
5104
5155
|
interpolate_(e, t, n, s) {
|
|
5105
|
-
const o = this.resultBuffer, r = this.sampleValues, a = this.valueSize, c = a * 2, u = a * 3, d = s - t, h = (n - t) / d, p = h * h, f = p * h, y = e * u,
|
|
5106
|
-
for (let
|
|
5107
|
-
const
|
|
5108
|
-
o[
|
|
5156
|
+
const o = this.resultBuffer, r = this.sampleValues, a = this.valueSize, c = a * 2, u = a * 3, d = s - t, h = (n - t) / d, p = h * h, f = p * h, y = e * u, S = y - u, _ = -2 * f + 3 * p, A = f - p, E = 1 - _, T = A - p + h;
|
|
5157
|
+
for (let b = 0; b !== a; b++) {
|
|
5158
|
+
const x = r[S + b + a], P = r[S + b + c] * d, C = r[y + b + a], M = r[y + b] * d;
|
|
5159
|
+
o[b] = E * x + T * P + _ * C + A * M;
|
|
5109
5160
|
}
|
|
5110
5161
|
return o;
|
|
5111
5162
|
}
|
|
@@ -5125,7 +5176,7 @@ const ct = {
|
|
|
5125
5176
|
TRIANGLES: 4,
|
|
5126
5177
|
TRIANGLE_STRIP: 5,
|
|
5127
5178
|
TRIANGLE_FAN: 6
|
|
5128
|
-
},
|
|
5179
|
+
}, bn = {
|
|
5129
5180
|
5120: Int8Array,
|
|
5130
5181
|
5121: Uint8Array,
|
|
5131
5182
|
5122: Int16Array,
|
|
@@ -5143,7 +5194,7 @@ const ct = {
|
|
|
5143
5194
|
33071: lc,
|
|
5144
5195
|
33648: cc,
|
|
5145
5196
|
10497: Ri
|
|
5146
|
-
},
|
|
5197
|
+
}, fi = {
|
|
5147
5198
|
SCALAR: 1,
|
|
5148
5199
|
VEC2: 2,
|
|
5149
5200
|
VEC3: 3,
|
|
@@ -5173,13 +5224,13 @@ const ct = {
|
|
|
5173
5224
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
5174
5225
|
LINEAR: vo,
|
|
5175
5226
|
STEP: Tc
|
|
5176
|
-
},
|
|
5227
|
+
}, mi = {
|
|
5177
5228
|
OPAQUE: "OPAQUE",
|
|
5178
5229
|
MASK: "MASK",
|
|
5179
5230
|
BLEND: "BLEND"
|
|
5180
5231
|
};
|
|
5181
5232
|
function mh(i) {
|
|
5182
|
-
return i.DefaultMaterial === void 0 && (i.DefaultMaterial = new
|
|
5233
|
+
return i.DefaultMaterial === void 0 && (i.DefaultMaterial = new js({
|
|
5183
5234
|
color: 16777215,
|
|
5184
5235
|
emissive: 0,
|
|
5185
5236
|
metalness: 1,
|
|
@@ -5245,12 +5296,12 @@ function yh(i, e) {
|
|
|
5245
5296
|
function wh(i) {
|
|
5246
5297
|
let e;
|
|
5247
5298
|
const t = i.extensions && i.extensions[ce.KHR_DRACO_MESH_COMPRESSION];
|
|
5248
|
-
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" +
|
|
5299
|
+
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + gi(t.attributes) : e = i.indices + ":" + gi(i.attributes) + ":" + i.mode, i.targets !== void 0)
|
|
5249
5300
|
for (let n = 0, s = i.targets.length; n < s; n++)
|
|
5250
|
-
e += ":" +
|
|
5301
|
+
e += ":" + gi(i.targets[n]);
|
|
5251
5302
|
return e;
|
|
5252
5303
|
}
|
|
5253
|
-
function
|
|
5304
|
+
function gi(i) {
|
|
5254
5305
|
let e = "";
|
|
5255
5306
|
const t = Object.keys(i).sort();
|
|
5256
5307
|
for (let n = 0, s = t.length; n < s; n++)
|
|
@@ -5525,25 +5576,25 @@ class _h {
|
|
|
5525
5576
|
loadAccessor(e) {
|
|
5526
5577
|
const t = this, n = this.json, s = this.json.accessors[e];
|
|
5527
5578
|
if (s.bufferView === void 0 && s.sparse === void 0) {
|
|
5528
|
-
const r =
|
|
5579
|
+
const r = fi[s.type], a = bn[s.componentType], c = s.normalized === !0, u = new a(s.count * r);
|
|
5529
5580
|
return Promise.resolve(new Wn(u, r, c));
|
|
5530
5581
|
}
|
|
5531
5582
|
const o = [];
|
|
5532
5583
|
return s.bufferView !== void 0 ? o.push(this.getDependency("bufferView", s.bufferView)) : o.push(null), s.sparse !== void 0 && (o.push(this.getDependency("bufferView", s.sparse.indices.bufferView)), o.push(this.getDependency("bufferView", s.sparse.values.bufferView))), Promise.all(o).then(function(r) {
|
|
5533
|
-
const a = r[0], c =
|
|
5534
|
-
let
|
|
5584
|
+
const a = r[0], c = fi[s.type], u = bn[s.componentType], d = u.BYTES_PER_ELEMENT, h = d * c, p = s.byteOffset || 0, f = s.bufferView !== void 0 ? n.bufferViews[s.bufferView].byteStride : void 0, y = s.normalized === !0;
|
|
5585
|
+
let S, _;
|
|
5535
5586
|
if (f && f !== h) {
|
|
5536
|
-
const
|
|
5587
|
+
const A = Math.floor(p / f), E = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + A + ":" + s.count;
|
|
5537
5588
|
let T = t.cache.get(E);
|
|
5538
|
-
T || (
|
|
5589
|
+
T || (S = new u(a, A * f, s.count * f / d), T = new sc(S, f / d), t.cache.add(E, T)), _ = new ic(T, c, p % f / d, y);
|
|
5539
5590
|
} else
|
|
5540
|
-
a === null ?
|
|
5591
|
+
a === null ? S = new u(s.count * c) : S = new u(a, p, s.count * c), _ = new Wn(S, c, y);
|
|
5541
5592
|
if (s.sparse !== void 0) {
|
|
5542
|
-
const
|
|
5593
|
+
const A = fi.SCALAR, E = bn[s.sparse.indices.componentType], T = s.sparse.indices.byteOffset || 0, b = s.sparse.values.byteOffset || 0, x = new E(r[1], T, s.sparse.count * A), P = new u(r[2], b, s.sparse.count * c);
|
|
5543
5594
|
a !== null && (_ = new Wn(_.array.slice(), _.itemSize, _.normalized)), _.normalized = !1;
|
|
5544
|
-
for (let
|
|
5545
|
-
const O =
|
|
5546
|
-
if (_.setX(O, P[
|
|
5595
|
+
for (let C = 0, M = x.length; C < M; C++) {
|
|
5596
|
+
const O = x[C];
|
|
5597
|
+
if (_.setX(O, P[C * c]), c >= 2 && _.setY(O, P[C * c + 1]), c >= 3 && _.setZ(O, P[C * c + 2]), c >= 4 && _.setW(O, P[C * c + 3]), c >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
5547
5598
|
}
|
|
5548
5599
|
_.normalized = y;
|
|
5549
5600
|
}
|
|
@@ -5596,8 +5647,8 @@ class _h {
|
|
|
5596
5647
|
const d = Promise.resolve(c).then(function(h) {
|
|
5597
5648
|
return new Promise(function(p, f) {
|
|
5598
5649
|
let y = p;
|
|
5599
|
-
t.isImageBitmapLoader === !0 && (y = function(
|
|
5600
|
-
const _ = new
|
|
5650
|
+
t.isImageBitmapLoader === !0 && (y = function(S) {
|
|
5651
|
+
const _ = new Sr(S);
|
|
5601
5652
|
_.needsUpdate = !0, p(_);
|
|
5602
5653
|
}), t.load(Zn.resolveURL(h, o.path), y, void 0, f);
|
|
5603
5654
|
});
|
|
@@ -5649,11 +5700,11 @@ class _h {
|
|
|
5649
5700
|
if (e.isPoints) {
|
|
5650
5701
|
const a = "PointsMaterial:" + n.uuid;
|
|
5651
5702
|
let c = this.cache.get(a);
|
|
5652
|
-
c || (c = new hc(),
|
|
5703
|
+
c || (c = new hc(), ti.prototype.copy.call(c, n), c.color.copy(n.color), c.map = n.map, c.sizeAttenuation = !1, this.cache.add(a, c)), n = c;
|
|
5653
5704
|
} else if (e.isLine) {
|
|
5654
5705
|
const a = "LineBasicMaterial:" + n.uuid;
|
|
5655
5706
|
let c = this.cache.get(a);
|
|
5656
|
-
c || (c = new uc(),
|
|
5707
|
+
c || (c = new uc(), ti.prototype.copy.call(c, n), c.color.copy(n.color), c.map = n.map, this.cache.add(a, c)), n = c;
|
|
5657
5708
|
}
|
|
5658
5709
|
if (s || o || r) {
|
|
5659
5710
|
let a = "ClonedMaterial:" + n.uuid + ":";
|
|
@@ -5664,7 +5715,7 @@ class _h {
|
|
|
5664
5715
|
e.material = n;
|
|
5665
5716
|
}
|
|
5666
5717
|
getMaterialType() {
|
|
5667
|
-
return
|
|
5718
|
+
return js;
|
|
5668
5719
|
}
|
|
5669
5720
|
/**
|
|
5670
5721
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -5693,8 +5744,8 @@ class _h {
|
|
|
5693
5744
|
})));
|
|
5694
5745
|
}
|
|
5695
5746
|
o.doubleSided === !0 && (a.side = yo);
|
|
5696
|
-
const d = o.alphaMode ||
|
|
5697
|
-
if (d ===
|
|
5747
|
+
const d = o.alphaMode || mi.OPAQUE;
|
|
5748
|
+
if (d === mi.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, d === mi.MASK && (a.alphaTest = o.alphaCutoff !== void 0 ? o.alphaCutoff : 0.5)), o.normalTexture !== void 0 && r !== Gn && (u.push(t.assignTexture(a, "normalMap", o.normalTexture)), a.normalScale = new fe(1, 1), o.normalTexture.scale !== void 0)) {
|
|
5698
5749
|
const h = o.normalTexture.scale;
|
|
5699
5750
|
a.normalScale.set(h, h);
|
|
5700
5751
|
}
|
|
@@ -5762,22 +5813,22 @@ class _h {
|
|
|
5762
5813
|
return a.push(t.loadGeometries(r)), Promise.all(a).then(function(c) {
|
|
5763
5814
|
const u = c.slice(0, c.length - 1), d = c[c.length - 1], h = [];
|
|
5764
5815
|
for (let f = 0, y = d.length; f < y; f++) {
|
|
5765
|
-
const
|
|
5766
|
-
let
|
|
5816
|
+
const S = d[f], _ = r[f];
|
|
5817
|
+
let A;
|
|
5767
5818
|
const E = u[f];
|
|
5768
5819
|
if (_.mode === ct.TRIANGLES || _.mode === ct.TRIANGLE_STRIP || _.mode === ct.TRIANGLE_FAN || _.mode === void 0)
|
|
5769
|
-
|
|
5820
|
+
A = o.isSkinnedMesh === !0 ? new fc(S, E) : new wt(S, E), A.isSkinnedMesh === !0 && A.normalizeSkinWeights(), _.mode === ct.TRIANGLE_STRIP ? A.geometry = $r(A.geometry, To) : _.mode === ct.TRIANGLE_FAN && (A.geometry = $r(A.geometry, vi));
|
|
5770
5821
|
else if (_.mode === ct.LINES)
|
|
5771
|
-
|
|
5822
|
+
A = new Yi(S, E);
|
|
5772
5823
|
else if (_.mode === ct.LINE_STRIP)
|
|
5773
|
-
|
|
5824
|
+
A = new $i(S, E);
|
|
5774
5825
|
else if (_.mode === ct.LINE_LOOP)
|
|
5775
|
-
|
|
5826
|
+
A = new qi(S, E);
|
|
5776
5827
|
else if (_.mode === ct.POINTS)
|
|
5777
|
-
|
|
5828
|
+
A = new Qi(S, E);
|
|
5778
5829
|
else
|
|
5779
5830
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + _.mode);
|
|
5780
|
-
Object.keys(
|
|
5831
|
+
Object.keys(A.geometry.morphAttributes).length > 0 && yh(A, o), A.name = t.createUniqueName(o.name || "mesh_" + e), vt(A, o), _.extensions && en(s, A, _), t.assignFinalMaterial(A), h.push(A);
|
|
5781
5832
|
}
|
|
5782
5833
|
for (let f = 0, y = h.length; f < y; f++)
|
|
5783
5834
|
t.associations.set(h[f], {
|
|
@@ -5786,7 +5837,7 @@ class _h {
|
|
|
5786
5837
|
});
|
|
5787
5838
|
if (h.length === 1)
|
|
5788
5839
|
return o.extensions && en(s, h[0], o), h[0];
|
|
5789
|
-
const p = new
|
|
5840
|
+
const p = new ni();
|
|
5790
5841
|
o.extensions && en(s, p, o), t.associations.set(p, { meshes: e });
|
|
5791
5842
|
for (let f = 0, y = h.length; f < y; f++)
|
|
5792
5843
|
p.add(h[f]);
|
|
@@ -5844,8 +5895,8 @@ class _h {
|
|
|
5844
5895
|
loadAnimation(e) {
|
|
5845
5896
|
const t = this.json, n = this, s = t.animations[e], o = s.name ? s.name : "animation_" + e, r = [], a = [], c = [], u = [], d = [];
|
|
5846
5897
|
for (let h = 0, p = s.channels.length; h < p; h++) {
|
|
5847
|
-
const f = s.channels[h], y = s.samplers[f.sampler],
|
|
5848
|
-
|
|
5898
|
+
const f = s.channels[h], y = s.samplers[f.sampler], S = f.target, _ = S.node, A = s.parameters !== void 0 ? s.parameters[y.input] : y.input, E = s.parameters !== void 0 ? s.parameters[y.output] : y.output;
|
|
5899
|
+
S.node !== void 0 && (r.push(this.getDependency("node", _)), a.push(this.getDependency("accessor", A)), c.push(this.getDependency("accessor", E)), u.push(y), d.push(S));
|
|
5849
5900
|
}
|
|
5850
5901
|
return Promise.all([
|
|
5851
5902
|
Promise.all(r),
|
|
@@ -5854,17 +5905,17 @@ class _h {
|
|
|
5854
5905
|
Promise.all(u),
|
|
5855
5906
|
Promise.all(d)
|
|
5856
5907
|
]).then(function(h) {
|
|
5857
|
-
const p = h[0], f = h[1], y = h[2],
|
|
5858
|
-
for (let T = 0,
|
|
5859
|
-
const
|
|
5860
|
-
if (
|
|
5861
|
-
|
|
5862
|
-
const
|
|
5863
|
-
if (
|
|
5864
|
-
for (let k = 0; k <
|
|
5865
|
-
|
|
5866
|
-
}
|
|
5867
|
-
const E = new wc(o, void 0,
|
|
5908
|
+
const p = h[0], f = h[1], y = h[2], S = h[3], _ = h[4], A = [];
|
|
5909
|
+
for (let T = 0, b = p.length; T < b; T++) {
|
|
5910
|
+
const x = p[T], P = f[T], C = y[T], M = S[T], O = _[T];
|
|
5911
|
+
if (x === void 0) continue;
|
|
5912
|
+
x.updateMatrix && x.updateMatrix();
|
|
5913
|
+
const I = n._createAnimationTracks(x, P, C, M, O);
|
|
5914
|
+
if (I)
|
|
5915
|
+
for (let k = 0; k < I.length; k++)
|
|
5916
|
+
A.push(I[k]);
|
|
5917
|
+
}
|
|
5918
|
+
const E = new wc(o, void 0, A);
|
|
5868
5919
|
return vt(E, s), E;
|
|
5869
5920
|
});
|
|
5870
5921
|
}
|
|
@@ -5926,7 +5977,7 @@ class _h {
|
|
|
5926
5977
|
a.push(u);
|
|
5927
5978
|
}), this.nodeCache[e] = Promise.all(a).then(function(u) {
|
|
5928
5979
|
let d;
|
|
5929
|
-
if (o.isBone === !0 ? d = new Ec() : u.length > 1 ? d = new
|
|
5980
|
+
if (o.isBone === !0 ? d = new Ec() : u.length > 1 ? d = new ni() : u.length === 1 ? d = u[0] : d = new Ji(), d !== u[0])
|
|
5930
5981
|
for (let h = 0, p = u.length; h < p; h++)
|
|
5931
5982
|
d.add(u[h]);
|
|
5932
5983
|
if (o.name && (d.userData.name = o.name, d.name = r), vt(d, o), o.extensions && en(n, d, o), o.matrix !== void 0) {
|
|
@@ -5951,7 +6002,7 @@ class _h {
|
|
|
5951
6002
|
* @return {Promise<Group>}
|
|
5952
6003
|
*/
|
|
5953
6004
|
loadScene(e) {
|
|
5954
|
-
const t = this.extensions, n = this.json.scenes[e], s = this, o = new
|
|
6005
|
+
const t = this.extensions, n = this.json.scenes[e], s = this, o = new ni();
|
|
5955
6006
|
n.name && (o.name = s.createUniqueName(n.name)), vt(o, n), n.extensions && en(t, o, n);
|
|
5956
6007
|
const r = n.nodes || [], a = [];
|
|
5957
6008
|
for (let c = 0, u = r.length; c < u; c++)
|
|
@@ -5964,7 +6015,7 @@ class _h {
|
|
|
5964
6015
|
const u = (d) => {
|
|
5965
6016
|
const h = /* @__PURE__ */ new Map();
|
|
5966
6017
|
for (const [p, f] of s.associations)
|
|
5967
|
-
(p instanceof
|
|
6018
|
+
(p instanceof ti || p instanceof Sr) && h.set(p, f);
|
|
5968
6019
|
return d.traverse((p) => {
|
|
5969
6020
|
const f = s.associations.get(p);
|
|
5970
6021
|
f != null && h.set(p, f);
|
|
@@ -6006,13 +6057,13 @@ class _h {
|
|
|
6006
6057
|
}
|
|
6007
6058
|
const h = s.interpolation !== void 0 ? fh[s.interpolation] : vo, p = this._getArrayFromAccessor(n);
|
|
6008
6059
|
for (let f = 0, y = c.length; f < y; f++) {
|
|
6009
|
-
const
|
|
6060
|
+
const S = new d(
|
|
6010
6061
|
c[f] + "." + Ht[o.path],
|
|
6011
6062
|
t.array,
|
|
6012
6063
|
p,
|
|
6013
6064
|
h
|
|
6014
6065
|
);
|
|
6015
|
-
s.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(
|
|
6066
|
+
s.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(S), r.push(S);
|
|
6016
6067
|
}
|
|
6017
6068
|
return r;
|
|
6018
6069
|
}
|
|
@@ -6033,7 +6084,7 @@ class _h {
|
|
|
6033
6084
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
6034
6085
|
}
|
|
6035
6086
|
}
|
|
6036
|
-
function
|
|
6087
|
+
function bh(i, e, t) {
|
|
6037
6088
|
const n = e.attributes, s = new _t();
|
|
6038
6089
|
if (n.POSITION !== void 0) {
|
|
6039
6090
|
const a = t.json.accessors[n.POSITION], c = a.min, u = a.max;
|
|
@@ -6042,7 +6093,7 @@ function Sh(i, e, t) {
|
|
|
6042
6093
|
new $(c[0], c[1], c[2]),
|
|
6043
6094
|
new $(u[0], u[1], u[2])
|
|
6044
6095
|
), a.normalized) {
|
|
6045
|
-
const d = Hi(
|
|
6096
|
+
const d = Hi(bn[a.componentType]);
|
|
6046
6097
|
s.min.multiplyScalar(d), s.max.multiplyScalar(d);
|
|
6047
6098
|
}
|
|
6048
6099
|
} else {
|
|
@@ -6060,8 +6111,8 @@ function Sh(i, e, t) {
|
|
|
6060
6111
|
const p = t.json.accessors[h.POSITION], f = p.min, y = p.max;
|
|
6061
6112
|
if (f !== void 0 && y !== void 0) {
|
|
6062
6113
|
if (c.setX(Math.max(Math.abs(f[0]), Math.abs(y[0]))), c.setY(Math.max(Math.abs(f[1]), Math.abs(y[1]))), c.setZ(Math.max(Math.abs(f[2]), Math.abs(y[2]))), p.normalized) {
|
|
6063
|
-
const
|
|
6064
|
-
c.multiplyScalar(
|
|
6114
|
+
const S = Hi(bn[p.componentType]);
|
|
6115
|
+
c.multiplyScalar(S);
|
|
6065
6116
|
}
|
|
6066
6117
|
a.max(c);
|
|
6067
6118
|
} else
|
|
@@ -6091,11 +6142,11 @@ function no(i, e, t) {
|
|
|
6091
6142
|
});
|
|
6092
6143
|
s.push(r);
|
|
6093
6144
|
}
|
|
6094
|
-
return Rr.workingColorSpace !== je && "COLOR_0" in n && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Rr.workingColorSpace}" not supported.`), vt(i, e),
|
|
6145
|
+
return Rr.workingColorSpace !== je && "COLOR_0" in n && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Rr.workingColorSpace}" not supported.`), vt(i, e), bh(i, e, t), Promise.all(s).then(function() {
|
|
6095
6146
|
return e.targets !== void 0 ? gh(i, e.targets, t) : i;
|
|
6096
6147
|
});
|
|
6097
6148
|
}
|
|
6098
|
-
const
|
|
6149
|
+
const Sh = w.REVISION.replace(/\D/g, ""), Go = `https://cdn.jsdelivr.net/npm/three@0.${Sh}/examples/jsm/libs`, xh = `${Go}/draco/`, Ah = `${Go}/basis/`;
|
|
6099
6150
|
class vh {
|
|
6100
6151
|
constructor(e = {}) {
|
|
6101
6152
|
this.loadingManager = new w.LoadingManager(), this.loader = new Gl(this.loadingManager), this.config = e;
|
|
@@ -6233,7 +6284,7 @@ const io = { type: "change" }, lr = { type: "start" }, Vo = { type: "end" }, Ls
|
|
|
6233
6284
|
TOUCH_PAN: 4,
|
|
6234
6285
|
TOUCH_DOLLY_PAN: 5,
|
|
6235
6286
|
TOUCH_DOLLY_ROTATE: 6
|
|
6236
|
-
},
|
|
6287
|
+
}, yi = 1e-6;
|
|
6237
6288
|
class Wo extends Ro {
|
|
6238
6289
|
/**
|
|
6239
6290
|
* Constructs a new controls instance.
|
|
@@ -6242,7 +6293,7 @@ class Wo extends Ro {
|
|
|
6242
6293
|
* @param {?HTMLElement} domElement - The HTML element used for event listeners.
|
|
6243
6294
|
*/
|
|
6244
6295
|
constructor(e, t = null) {
|
|
6245
|
-
super(e, t), this.state = we.NONE, this.target = new $(), this.cursor = new $(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: Be.ROTATE, MIDDLE: Be.DOLLY, RIGHT: Be.PAN }, this.touches = { ONE: Ye.ROTATE, TWO: Ye.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._cursorStyle = "auto", this._domElementKeyEvents = null, this._lastPosition = new $(), this._lastQuaternion = new An(), this._lastTargetPosition = new $(), this._quat = new An().setFromUnitVectors(e.up, new $(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new
|
|
6296
|
+
super(e, t), this.state = we.NONE, this.target = new $(), this.cursor = new $(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: Be.ROTATE, MIDDLE: Be.DOLLY, RIGHT: Be.PAN }, this.touches = { ONE: Ye.ROTATE, TWO: Ye.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._cursorStyle = "auto", this._domElementKeyEvents = null, this._lastPosition = new $(), this._lastQuaternion = new An(), this._lastTargetPosition = new $(), this._quat = new An().setFromUnitVectors(e.up, new $(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new Gs(), this._sphericalDelta = new Gs(), this._scale = 1, this._panOffset = new $(), this._rotateStart = new fe(), this._rotateEnd = new fe(), this._rotateDelta = new fe(), this._panStart = new fe(), this._panEnd = new fe(), this._panDelta = new fe(), this._dollyStart = new fe(), this._dollyEnd = new fe(), this._dollyDelta = new fe(), this._dollyDirection = new $(), this._mouse = new fe(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = Ch.bind(this), this._onPointerDown = Mh.bind(this), this._onPointerUp = Ih.bind(this), this._onContextMenu = Fh.bind(this), this._onMouseWheel = Oh.bind(this), this._onKeyDown = Dh.bind(this), this._onTouchStart = Nh.bind(this), this._onTouchMove = kh.bind(this), this._onMouseDown = Ph.bind(this), this._onMouseMove = Lh.bind(this), this._interceptControlDown = zh.bind(this), this._interceptControlUp = Bh.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
6246
6297
|
}
|
|
6247
6298
|
/**
|
|
6248
6299
|
* Defines the visual representation of the cursor.
|
|
@@ -6391,7 +6442,7 @@ class Wo extends Ro {
|
|
|
6391
6442
|
const r = this.object.zoom;
|
|
6392
6443
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), r !== this.object.zoom && (this.object.updateProjectionMatrix(), o = !0);
|
|
6393
6444
|
}
|
|
6394
|
-
return this._scale = 1, this._performCursorZoom = !1, o || this._lastPosition.distanceToSquared(this.object.position) >
|
|
6445
|
+
return this._scale = 1, this._performCursorZoom = !1, o || this._lastPosition.distanceToSquared(this.object.position) > yi || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > yi || this._lastTargetPosition.distanceToSquared(this.target) > yi ? (this.dispatchEvent(io), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
|
|
6395
6446
|
}
|
|
6396
6447
|
_getAutoRotationAngle(e) {
|
|
6397
6448
|
return e !== null ? tt / 60 * this.autoRotateSpeed * e : tt / 60 / 60 * this.autoRotateSpeed;
|
|
@@ -6731,16 +6782,16 @@ function zh(i) {
|
|
|
6731
6782
|
function Bh(i) {
|
|
6732
6783
|
i.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
6733
6784
|
}
|
|
6734
|
-
const
|
|
6785
|
+
const wi = new Jn(), Os = new bc(), gn = new fe(), Ei = new $();
|
|
6735
6786
|
class Uh extends Wo {
|
|
6736
6787
|
constructor(e, t) {
|
|
6737
6788
|
super(e, t), this.screenSpacePanning = !1, this.mouseButtons = { LEFT: Be.PAN, MIDDLE: Be.DOLLY, RIGHT: Be.ROTATE }, this.touches = { ONE: Ye.PAN, TWO: Ye.DOLLY_ROTATE }, this._panWorldStart = new $();
|
|
6738
6789
|
}
|
|
6739
6790
|
_handleMouseDownPan(e) {
|
|
6740
6791
|
if (super._handleMouseDownPan(e), this._panOffset.set(0, 0, 0), this.screenSpacePanning === !0) return;
|
|
6741
|
-
|
|
6792
|
+
wi.setFromNormalAndCoplanarPoint(this.object.up, this.target);
|
|
6742
6793
|
const n = this.domElement.getBoundingClientRect();
|
|
6743
|
-
gn.x = (e.clientX - n.left) / n.width * 2 - 1, gn.y = -((e.clientY - n.top) / n.height) * 2 + 1, Os.setFromCamera(gn, this.object), Os.ray.intersectPlane(
|
|
6794
|
+
gn.x = (e.clientX - n.left) / n.width * 2 - 1, gn.y = -((e.clientY - n.top) / n.height) * 2 + 1, Os.setFromCamera(gn, this.object), Os.ray.intersectPlane(wi, this._panWorldStart);
|
|
6744
6795
|
}
|
|
6745
6796
|
_handleMouseMovePan(e) {
|
|
6746
6797
|
if (this.screenSpacePanning === !0) {
|
|
@@ -6748,7 +6799,7 @@ class Uh extends Wo {
|
|
|
6748
6799
|
return;
|
|
6749
6800
|
}
|
|
6750
6801
|
const n = this.domElement.getBoundingClientRect();
|
|
6751
|
-
gn.x = (e.clientX - n.left) / n.width * 2 - 1, gn.y = -((e.clientY - n.top) / n.height) * 2 + 1, Os.setFromCamera(gn, this.object), Os.ray.intersectPlane(
|
|
6802
|
+
gn.x = (e.clientX - n.left) / n.width * 2 - 1, gn.y = -((e.clientY - n.top) / n.height) * 2 + 1, Os.setFromCamera(gn, this.object), Os.ray.intersectPlane(wi, Ei) && (Ei.sub(this._panWorldStart), this._panOffset.copy(Ei).negate(), this.update());
|
|
6752
6803
|
}
|
|
6753
6804
|
}
|
|
6754
6805
|
class Zo {
|
|
@@ -6910,7 +6961,7 @@ class jh extends Zo {
|
|
|
6910
6961
|
set screenSpacePanning(e) {
|
|
6911
6962
|
}
|
|
6912
6963
|
}
|
|
6913
|
-
const ji = "contact-shadow-baked",
|
|
6964
|
+
const ji = "contact-shadow-baked", Sn = "contact-shadow-live", Ko = "softboxContactShadowHelper", oo = Math.PI * (3 - Math.sqrt(5)), xe = class xe {
|
|
6914
6965
|
constructor(e) {
|
|
6915
6966
|
this.explicitPasses = e == null ? void 0 : e.passes;
|
|
6916
6967
|
}
|
|
@@ -6923,7 +6974,7 @@ const ji = "contact-shadow-baked", bn = "contact-shadow-live", Ko = "softboxCont
|
|
|
6923
6974
|
const r = this.measureBakeRegion(s);
|
|
6924
6975
|
if (!r)
|
|
6925
6976
|
return;
|
|
6926
|
-
const a = n.getObjectByName(
|
|
6977
|
+
const a = n.getObjectByName(Sn);
|
|
6927
6978
|
(a == null ? void 0 : a.geometry) instanceof w.CircleGeometry && (r.halfExtent = Math.min(r.halfExtent, a.geometry.parameters.radius));
|
|
6928
6979
|
const c = new w.WebGLRenderTarget(
|
|
6929
6980
|
xe.ACCUMULATION_TEXTURE_SIZE,
|
|
@@ -6948,12 +6999,12 @@ const ji = "contact-shadow-baked", bn = "contact-shadow-live", Ko = "softboxCont
|
|
|
6948
6999
|
*/
|
|
6949
7000
|
leaveLiveCatcherInCharge(e) {
|
|
6950
7001
|
this.evictBakedMesh(e);
|
|
6951
|
-
const t = e.getObjectByName(
|
|
7002
|
+
const t = e.getObjectByName(Sn);
|
|
6952
7003
|
t && (t.visible = !0);
|
|
6953
7004
|
}
|
|
6954
7005
|
evictBakedMesh(e) {
|
|
6955
7006
|
const t = e.getObjectByName(ji);
|
|
6956
|
-
t && (e.remove(t),
|
|
7007
|
+
t && (e.remove(t), Qs(t));
|
|
6957
7008
|
}
|
|
6958
7009
|
measureBakeRegion(e) {
|
|
6959
7010
|
const t = new w.Box3().setFromObject(e);
|
|
@@ -6981,15 +7032,15 @@ const ji = "contact-shadow-baked", bn = "contact-shadow-live", Ko = "softboxCont
|
|
|
6981
7032
|
p.rotation.x = -Math.PI / 2, p.position.set(s.center.x, 0, s.center.z), p.receiveShadow = !0, a.add(p);
|
|
6982
7033
|
const f = this.createBakeCamera(s);
|
|
6983
7034
|
a.add(f);
|
|
6984
|
-
const y = e.getRenderTarget(),
|
|
7035
|
+
const y = e.getRenderTarget(), S = e.autoClear, _ = e.getClearColor(new w.Color()), A = e.getClearAlpha(), E = e.shadowMap.autoUpdate;
|
|
6985
7036
|
try {
|
|
6986
7037
|
e.shadowMap.autoUpdate = !0, e.setRenderTarget(o), e.setClearColor(0, 0), e.clear(!0, !1, !1), e.autoClear = !1;
|
|
6987
7038
|
const T = this.explicitPasses ?? this.measureAffordablePasses(e, a, f, n, d, o);
|
|
6988
7039
|
h.opacity = 1 / T;
|
|
6989
|
-
for (const
|
|
6990
|
-
d.position.copy(
|
|
7040
|
+
for (const b of this.sampleLightPositions(n, T))
|
|
7041
|
+
d.position.copy(b), e.render(a, f);
|
|
6991
7042
|
} finally {
|
|
6992
|
-
e.autoClear =
|
|
7043
|
+
e.autoClear = S, e.setClearColor(_, A), e.setRenderTarget(y), e.shadowMap.autoUpdate = E, this.restoreColorWrite(u), c ? c.add(t) : a.remove(t), d.dispose(), h.dispose();
|
|
6993
7044
|
}
|
|
6994
7045
|
}
|
|
6995
7046
|
/**
|
|
@@ -7062,22 +7113,22 @@ const ji = "contact-shadow-baked", bn = "contact-shadow-live", Ko = "softboxCont
|
|
|
7062
7113
|
const n = e.position.clone(), s = e.target.parent ? e.target.getWorldPosition(new w.Vector3()) : e.target.position.clone(), o = s.clone().sub(n), r = o.length(), a = o.normalize(), c = new w.Vector3().crossVectors(a, new w.Vector3(0, 1, 0));
|
|
7063
7114
|
c.lengthSq() < 1e-6 && c.set(1, 0, 0), c.normalize();
|
|
7064
7115
|
const u = new w.Vector3().crossVectors(a, c), d = Math.round(t * xe.AMBIENT_RATIO), h = t - d, p = w.MathUtils.degToRad(xe.LIGHT_APERTURE_DEGREES), f = Math.tan(p / 2) * r, y = [];
|
|
7065
|
-
for (let
|
|
7066
|
-
const E = f * Math.sqrt((
|
|
7116
|
+
for (let A = 0; A < h; A++) {
|
|
7117
|
+
const E = f * Math.sqrt((A + 0.5) / h), T = A * oo;
|
|
7067
7118
|
y.push(
|
|
7068
7119
|
n.clone().addScaledVector(c, E * Math.cos(T)).addScaledVector(u, E * Math.sin(T))
|
|
7069
7120
|
);
|
|
7070
7121
|
}
|
|
7071
|
-
const
|
|
7122
|
+
const S = Math.sin(
|
|
7072
7123
|
w.MathUtils.degToRad(xe.AMBIENT_MIN_ELEVATION_DEGREES)
|
|
7073
7124
|
), _ = 0.98;
|
|
7074
|
-
for (let
|
|
7075
|
-
const E = Math.sqrt((
|
|
7125
|
+
for (let A = 0; A < d; A++) {
|
|
7126
|
+
const E = Math.sqrt((A + 0.5) / d), T = S + (_ - S) * E, b = Math.sqrt(1 - T * T), x = A * oo;
|
|
7076
7127
|
y.push(
|
|
7077
7128
|
new w.Vector3(
|
|
7078
|
-
|
|
7129
|
+
b * Math.cos(x),
|
|
7079
7130
|
T,
|
|
7080
|
-
|
|
7131
|
+
b * Math.sin(x)
|
|
7081
7132
|
).multiplyScalar(r).add(s)
|
|
7082
7133
|
);
|
|
7083
7134
|
}
|
|
@@ -7103,7 +7154,7 @@ const ji = "contact-shadow-baked", bn = "contact-shadow-live", Ko = "softboxCont
|
|
|
7103
7154
|
r.name = ji, r.userData[Ko] = !0, r.rotation.x = -Math.PI / 2;
|
|
7104
7155
|
const a = w.MathUtils.clamp(t.objectHeight * 25e-4, 2e-4, 0.01);
|
|
7105
7156
|
r.position.set(t.center.x, a, t.center.z), r.userData.renderTarget = n, e.add(r);
|
|
7106
|
-
const c = e.getObjectByName(
|
|
7157
|
+
const c = e.getObjectByName(Sn);
|
|
7107
7158
|
c && (c.visible = !1);
|
|
7108
7159
|
}
|
|
7109
7160
|
disableColorWrite(e) {
|
|
@@ -7181,13 +7232,13 @@ class Wh {
|
|
|
7181
7232
|
for (let h = -n; h <= n; h++) {
|
|
7182
7233
|
const p = Math.max(-n, -h - n), f = Math.min(n, -h + n);
|
|
7183
7234
|
for (let y = p; y <= f; y++) {
|
|
7184
|
-
const
|
|
7185
|
-
for (let
|
|
7186
|
-
const P =
|
|
7187
|
-
|
|
7235
|
+
const S = c * (h + y / 2), _ = u * 0.75 * y, A = [], E = Math.PI * 2 / 6;
|
|
7236
|
+
for (let x = 0; x <= 6; x++) {
|
|
7237
|
+
const P = x * E + Math.PI / 6, C = S + s * Math.cos(P), M = _ + s * Math.sin(P);
|
|
7238
|
+
A.push(new w.Vector3(C, 0, M));
|
|
7188
7239
|
}
|
|
7189
|
-
const T = new w.BufferGeometry().setFromPoints(
|
|
7190
|
-
t.add(
|
|
7240
|
+
const T = new w.BufferGeometry().setFromPoints(A), b = new w.Line(T, a);
|
|
7241
|
+
t.add(b);
|
|
7191
7242
|
}
|
|
7192
7243
|
}
|
|
7193
7244
|
return t;
|
|
@@ -7326,18 +7377,18 @@ class Xh {
|
|
|
7326
7377
|
this.name = "Hexagonal Glass Grid";
|
|
7327
7378
|
}
|
|
7328
7379
|
createGrid(e) {
|
|
7329
|
-
var y,
|
|
7330
|
-
const t = new w.Group(), n = ((y = e.styleOptions) == null ? void 0 : y.hexRadius) ?? Math.floor(e.divisions / 2), s = ((
|
|
7380
|
+
var y, S, _, A, E, T, b;
|
|
7381
|
+
const t = new w.Group(), n = ((y = e.styleOptions) == null ? void 0 : y.hexRadius) ?? Math.floor(e.divisions / 2), s = ((S = e.styleOptions) == null ? void 0 : S.tileSize) || 1, o = String(e.color || "#ffffff"), r = sn.getGridSpacing(s), a = r.width, c = r.height, u = new Zh(new w.Vector3(0, 0, 0), s, o, {
|
|
7331
7382
|
metalness: (_ = e.styleOptions) == null ? void 0 : _.metalness,
|
|
7332
|
-
roughness: (
|
|
7383
|
+
roughness: (A = e.styleOptions) == null ? void 0 : A.roughness,
|
|
7333
7384
|
transmission: (E = e.styleOptions) == null ? void 0 : E.transmission,
|
|
7334
7385
|
thickness: (T = e.styleOptions) == null ? void 0 : T.thickness,
|
|
7335
|
-
ior: (
|
|
7386
|
+
ior: (b = e.styleOptions) == null ? void 0 : b.ior
|
|
7336
7387
|
}), d = u.createGeometry(), h = sn.getYPosition(s), p = [];
|
|
7337
|
-
for (let
|
|
7338
|
-
const P = Math.max(-n, -
|
|
7339
|
-
for (let M = P; M <=
|
|
7340
|
-
p.push(new w.Vector3(a * (
|
|
7388
|
+
for (let x = -n; x <= n; x++) {
|
|
7389
|
+
const P = Math.max(-n, -x - n), C = Math.min(n, -x + n);
|
|
7390
|
+
for (let M = P; M <= C; M++)
|
|
7391
|
+
p.push(new w.Vector3(a * (x + M / 2), h, c * 0.75 * M));
|
|
7341
7392
|
}
|
|
7342
7393
|
const f = new w.Mesh(
|
|
7343
7394
|
Kh(d, p),
|
|
@@ -7350,7 +7401,7 @@ class Xh {
|
|
|
7350
7401
|
new w.CircleGeometry(Math.max(e, 1), 64),
|
|
7351
7402
|
new w.ShadowMaterial({ opacity: 0.35 })
|
|
7352
7403
|
);
|
|
7353
|
-
return t.name =
|
|
7404
|
+
return t.name = Sn, t.userData[Ko] = !0, t.rotation.x = -Math.PI / 2, t.position.y = 2e-3, t.receiveShadow = !0, t;
|
|
7354
7405
|
}
|
|
7355
7406
|
dispose() {
|
|
7356
7407
|
}
|
|
@@ -7360,22 +7411,22 @@ class Yh {
|
|
|
7360
7411
|
this.name = "Stone Tile Grid", this.textureLoader = new w.TextureLoader();
|
|
7361
7412
|
}
|
|
7362
7413
|
createGrid(e) {
|
|
7363
|
-
var f, y,
|
|
7364
|
-
const t = new w.Group(), n = e.size, s = Math.max(1, e.divisions), o = n / s, r = o * 0.02, a = o - r, c = ((f = e.styleOptions) == null ? void 0 : f.height) || o * 0.05, u = ((y = e.styleOptions) == null ? void 0 : y.bevelSize) || c * 0.2, d = ((
|
|
7365
|
-
for (let
|
|
7414
|
+
var f, y, S, _;
|
|
7415
|
+
const t = new w.Group(), n = e.size, s = Math.max(1, e.divisions), o = n / s, r = o * 0.02, a = o - r, c = ((f = e.styleOptions) == null ? void 0 : f.height) || o * 0.05, u = ((y = e.styleOptions) == null ? void 0 : y.bevelSize) || c * 0.2, d = ((S = e.styleOptions) == null ? void 0 : S.randomHeight) || !1, h = ((_ = e.styleOptions) == null ? void 0 : _.randomRotation) || !1, p = this.createStoneMaterial(e);
|
|
7416
|
+
for (let A = 0; A < s; A++)
|
|
7366
7417
|
for (let E = 0; E < s; E++) {
|
|
7367
|
-
const T = (
|
|
7368
|
-
P.moveTo(-
|
|
7418
|
+
const T = (A - s / 2) * o + o / 2, b = (E - s / 2) * o + o / 2, x = d ? c * (0.8 + Math.random() * 0.4) : c, P = new w.Shape(), C = a / 2;
|
|
7419
|
+
P.moveTo(-C, -C), P.lineTo(C, -C), P.lineTo(C, C), P.lineTo(-C, C), P.closePath();
|
|
7369
7420
|
const M = {
|
|
7370
|
-
depth:
|
|
7421
|
+
depth: x,
|
|
7371
7422
|
bevelEnabled: !0,
|
|
7372
7423
|
bevelSize: u,
|
|
7373
7424
|
bevelThickness: u,
|
|
7374
7425
|
bevelSegments: 2
|
|
7375
7426
|
}, O = new w.ExtrudeGeometry(P, M);
|
|
7376
7427
|
O.rotateX(-Math.PI / 2);
|
|
7377
|
-
const
|
|
7378
|
-
|
|
7428
|
+
const I = new w.Mesh(O, p);
|
|
7429
|
+
I.position.set(T, -x / 2, b), I.castShadow = !0, I.receiveShadow = !0, h && (I.rotation.y = Math.floor(Math.random() * 4) * (Math.PI / 2)), t.add(I);
|
|
7379
7430
|
}
|
|
7380
7431
|
return t;
|
|
7381
7432
|
}
|
|
@@ -7454,7 +7505,7 @@ dr.gridStyles = /* @__PURE__ */ new Map([
|
|
|
7454
7505
|
[Dt.HEXAGONAL_GLASS, new Xh()],
|
|
7455
7506
|
[Dt.STONE_TILES, new Yh()]
|
|
7456
7507
|
]);
|
|
7457
|
-
let
|
|
7508
|
+
let Ks = dr;
|
|
7458
7509
|
function qh(i, e) {
|
|
7459
7510
|
try {
|
|
7460
7511
|
const t = It(i);
|
|
@@ -7487,7 +7538,7 @@ function qh(i, e) {
|
|
|
7487
7538
|
tileSize: 1,
|
|
7488
7539
|
...o.styleOptions
|
|
7489
7540
|
}
|
|
7490
|
-
}, d =
|
|
7541
|
+
}, d = Ks.createGrid(r, u);
|
|
7491
7542
|
d.userData.isGrid = !0, d.userData.isDefaultGrid = !0, t.add(d);
|
|
7492
7543
|
}
|
|
7493
7544
|
}
|
|
@@ -7522,10 +7573,10 @@ function $h(i, e, t = 1.2) {
|
|
|
7522
7573
|
return N.ok(void 0);
|
|
7523
7574
|
const a = [];
|
|
7524
7575
|
s.traverse((M) => {
|
|
7525
|
-
var O,
|
|
7526
|
-
((O = M.userData) != null && O.isGrid || (
|
|
7576
|
+
var O, I, k;
|
|
7577
|
+
((O = M.userData) != null && O.isGrid || (I = M.userData) != null && I.isHexGrid || (k = M.userData) != null && k.isDefaultGrid) && a.push(M);
|
|
7527
7578
|
}), a.forEach((M) => {
|
|
7528
|
-
|
|
7579
|
+
Qs(M), s.remove(M);
|
|
7529
7580
|
});
|
|
7530
7581
|
const c = Ct(e);
|
|
7531
7582
|
if (!c)
|
|
@@ -7538,13 +7589,13 @@ function $h(i, e, t = 1.2) {
|
|
|
7538
7589
|
const u = new w.Box3().setFromObject(c), d = u.getSize(new w.Vector3());
|
|
7539
7590
|
if (u.isEmpty() || !Number.isFinite(d.x) || !Number.isFinite(d.z))
|
|
7540
7591
|
return console.warn("Skipping dynamic grid: object has an empty or non-finite bounding box"), N.ok(void 0);
|
|
7541
|
-
const h = (n = r.styleOptions) == null ? void 0 : n.tileSize, p = typeof h == "number" ? h : 1, y = sn.getGridSpacing(p).width,
|
|
7542
|
-
let _ =
|
|
7543
|
-
const
|
|
7544
|
-
_ >
|
|
7545
|
-
`Dynamic grid would need ${_} rings to cover the object; capping at ${
|
|
7546
|
-
), _ =
|
|
7547
|
-
const E = r.type || Dt.HEXAGONAL_GLASS,
|
|
7592
|
+
const h = (n = r.styleOptions) == null ? void 0 : n.tileSize, p = typeof h == "number" ? h : 1, y = sn.getGridSpacing(p).width, S = Math.max(d.x, d.z) * t + d.y;
|
|
7593
|
+
let _ = S <= y ? 0 : Math.ceil((S / y - 1) / 2);
|
|
7594
|
+
const A = 60;
|
|
7595
|
+
_ > A && (console.warn(
|
|
7596
|
+
`Dynamic grid would need ${_} rings to cover the object; capping at ${A}. The floor will not fully reach the configured coverage for this tileSize/object-size combination.`
|
|
7597
|
+
), _ = A), S < y * 0.8 ? _ = 0 : _ < 3 && S > y * 2 && (_ = 3);
|
|
7598
|
+
const E = r.type || Dt.HEXAGONAL_GLASS, b = {
|
|
7548
7599
|
size: Math.max(d.x, d.z) * t,
|
|
7549
7600
|
divisions: _ * 2 + 1,
|
|
7550
7601
|
color: r.color,
|
|
@@ -7554,12 +7605,12 @@ function $h(i, e, t = 1.2) {
|
|
|
7554
7605
|
tileSize: p,
|
|
7555
7606
|
...r.styleOptions
|
|
7556
7607
|
}
|
|
7557
|
-
},
|
|
7558
|
-
|
|
7559
|
-
const P =
|
|
7608
|
+
}, x = Ks.createGrid(E, b);
|
|
7609
|
+
x.userData.isGrid = !0, x.userData.isHexGrid = !0;
|
|
7610
|
+
const P = x.getObjectByName(Sn);
|
|
7560
7611
|
P && (P.position.y = w.MathUtils.clamp(d.y * 25e-4, 2e-4, 2e-3));
|
|
7561
|
-
const
|
|
7562
|
-
return
|
|
7612
|
+
const C = u.getCenter(new w.Vector3());
|
|
7613
|
+
return x.position.set(C.x, 0, C.z), s.add(x), N.ok(void 0);
|
|
7563
7614
|
} catch (s) {
|
|
7564
7615
|
return N.err(
|
|
7565
7616
|
new W(
|
|
@@ -7589,12 +7640,12 @@ function Qh(i, e) {
|
|
|
7589
7640
|
)
|
|
7590
7641
|
);
|
|
7591
7642
|
const s = (T) => {
|
|
7592
|
-
var
|
|
7593
|
-
let
|
|
7594
|
-
for (;
|
|
7595
|
-
if ((
|
|
7643
|
+
var x, P, C;
|
|
7644
|
+
let b = T;
|
|
7645
|
+
for (; b; ) {
|
|
7646
|
+
if ((x = b.userData) != null && x.isGrid || (P = b.userData) != null && P.isHexGrid || (C = b.userData) != null && C.isDefaultGrid)
|
|
7596
7647
|
return !0;
|
|
7597
|
-
|
|
7648
|
+
b = b.parent;
|
|
7598
7649
|
}
|
|
7599
7650
|
return !1;
|
|
7600
7651
|
};
|
|
@@ -7617,20 +7668,20 @@ function Qh(i, e) {
|
|
|
7617
7668
|
const u = new w.Box3().setFromObject(n);
|
|
7618
7669
|
if (u.isEmpty() || !Number.isFinite(u.min.x) || !Number.isFinite(u.max.x))
|
|
7619
7670
|
return N.ok(void 0);
|
|
7620
|
-
const d = 40, h = Math.max(1, u.max.y - u.min.y), p = u.max.y + h, f = u.min.y - h, y = new w.Raycaster(),
|
|
7621
|
-
let
|
|
7622
|
-
const E = (T,
|
|
7623
|
-
y.set(new w.Vector3(T,
|
|
7624
|
-
for (const
|
|
7625
|
-
|
|
7671
|
+
const d = 40, h = Math.max(1, u.max.y - u.min.y), p = u.max.y + h, f = u.min.y - h, y = new w.Raycaster(), S = new w.Vector3(0, -1, 0), _ = new w.Vector3(0, 1, 0);
|
|
7672
|
+
let A = 1 / 0;
|
|
7673
|
+
const E = (T, b, x, P) => {
|
|
7674
|
+
y.set(new w.Vector3(T, b, x), P);
|
|
7675
|
+
for (const C of y.intersectObjects(r, !1))
|
|
7676
|
+
C.point.y < A && (A = C.point.y);
|
|
7626
7677
|
};
|
|
7627
7678
|
for (let T = 0; T <= d; T++)
|
|
7628
|
-
for (let
|
|
7629
|
-
const
|
|
7630
|
-
E(
|
|
7679
|
+
for (let b = 0; b <= d; b++) {
|
|
7680
|
+
const x = u.min.x + (u.max.x - u.min.x) * (T / d), P = u.min.z + (u.max.z - u.min.z) * (b / d);
|
|
7681
|
+
E(x, p, P, S), E(x, f, P, _);
|
|
7631
7682
|
}
|
|
7632
|
-
if (Number.isFinite(
|
|
7633
|
-
const T =
|
|
7683
|
+
if (Number.isFinite(A)) {
|
|
7684
|
+
const T = A - a;
|
|
7634
7685
|
Math.abs(T) > 1e-4 && (n.position.y -= T);
|
|
7635
7686
|
}
|
|
7636
7687
|
return N.ok(void 0);
|
|
@@ -7738,7 +7789,7 @@ function tu(i, e) {
|
|
|
7738
7789
|
K.INVALID_PARAMETER
|
|
7739
7790
|
)
|
|
7740
7791
|
);
|
|
7741
|
-
const n = t.getObjectByName(ji), s = t.getObjectByName(
|
|
7792
|
+
const n = t.getObjectByName(ji), s = t.getObjectByName(Sn);
|
|
7742
7793
|
return e === "baked" && !n || (n && (n.visible = e === "baked"), s && (s.visible = e === "live")), N.ok(void 0);
|
|
7743
7794
|
} catch (t) {
|
|
7744
7795
|
return N.err(
|
|
@@ -7892,8 +7943,8 @@ function ru(i, e, t) {
|
|
|
7892
7943
|
"fov" in s ? d = s.fov * (Math.PI / 180) : d = 50 * (Math.PI / 180);
|
|
7893
7944
|
let h = Math.abs(u / 2 / Math.tan(d / 2));
|
|
7894
7945
|
h *= 2;
|
|
7895
|
-
const p = -Math.PI / 4, f = Math.PI / 8, y = a.x + h * Math.sin(p) * Math.cos(f),
|
|
7896
|
-
return s.position.set(y,
|
|
7946
|
+
const p = -Math.PI / 4, f = Math.PI / 8, y = a.x + h * Math.sin(p) * Math.cos(f), S = a.y + h * Math.sin(f), _ = a.z + h * Math.cos(p) * Math.cos(f);
|
|
7947
|
+
return s.position.set(y, S, _), s.lookAt(a), s.updateProjectionMatrix(), o.target && (o.target.copy(a), o.update()), N.ok(void 0);
|
|
7897
7948
|
} catch (n) {
|
|
7898
7949
|
return N.err(
|
|
7899
7950
|
new W(
|
|
@@ -7944,7 +7995,7 @@ class au {
|
|
|
7944
7995
|
this.events = new tr(), this.disposed = !1;
|
|
7945
7996
|
}
|
|
7946
7997
|
async initialize(e) {
|
|
7947
|
-
const { ThreePathTracingService: t } = await import("./ThreePathTracingService-
|
|
7998
|
+
const { ThreePathTracingService: t } = await import("./ThreePathTracingService-DbqedkL2.js");
|
|
7948
7999
|
if (this.disposed)
|
|
7949
8000
|
return N.ok(void 0);
|
|
7950
8001
|
const n = new t();
|
|
@@ -8075,9 +8126,9 @@ var lt = Uint8Array, _n = Uint16Array, cu = Int32Array, qo = new lt([
|
|
|
8075
8126
|
}, Jo = Qo(qo, 2), ea = Jo.b, hu = Jo.r;
|
|
8076
8127
|
ea[28] = 258, hu[258] = 28;
|
|
8077
8128
|
var uu = Qo($o, 0), du = uu.b, Vi = new _n(32768);
|
|
8078
|
-
for (var
|
|
8079
|
-
var jt = (
|
|
8080
|
-
jt = (jt & 52428) >> 2 | (jt & 13107) << 2, jt = (jt & 61680) >> 4 | (jt & 3855) << 4, Vi[
|
|
8129
|
+
for (var be = 0; be < 32768; ++be) {
|
|
8130
|
+
var jt = (be & 43690) >> 1 | (be & 21845) << 1;
|
|
8131
|
+
jt = (jt & 52428) >> 2 | (jt & 13107) << 2, jt = (jt & 61680) >> 4 | (jt & 3855) << 4, Vi[be] = ((jt & 65280) >> 8 | (jt & 255) << 8) >> 1;
|
|
8081
8132
|
}
|
|
8082
8133
|
var Yn = (function(i, e, t) {
|
|
8083
8134
|
for (var n = i.length, s = 0, o = new _n(e); s < n; ++s)
|
|
@@ -8098,25 +8149,25 @@ var Yn = (function(i, e, t) {
|
|
|
8098
8149
|
i[s] && (a[s] = Vi[r[i[s] - 1]++] >> 15 - i[s]);
|
|
8099
8150
|
return a;
|
|
8100
8151
|
}), ts = new lt(288);
|
|
8101
|
-
for (var
|
|
8102
|
-
ts[
|
|
8103
|
-
for (var
|
|
8104
|
-
ts[
|
|
8105
|
-
for (var
|
|
8106
|
-
ts[
|
|
8107
|
-
for (var
|
|
8108
|
-
ts[
|
|
8152
|
+
for (var be = 0; be < 144; ++be)
|
|
8153
|
+
ts[be] = 8;
|
|
8154
|
+
for (var be = 144; be < 256; ++be)
|
|
8155
|
+
ts[be] = 9;
|
|
8156
|
+
for (var be = 256; be < 280; ++be)
|
|
8157
|
+
ts[be] = 7;
|
|
8158
|
+
for (var be = 280; be < 288; ++be)
|
|
8159
|
+
ts[be] = 8;
|
|
8109
8160
|
var ta = new lt(32);
|
|
8110
|
-
for (var
|
|
8111
|
-
ta[
|
|
8112
|
-
var pu = /* @__PURE__ */ Yn(ts, 9, 1), fu = /* @__PURE__ */ Yn(ta, 5, 1),
|
|
8161
|
+
for (var be = 0; be < 32; ++be)
|
|
8162
|
+
ta[be] = 5;
|
|
8163
|
+
var pu = /* @__PURE__ */ Yn(ts, 9, 1), fu = /* @__PURE__ */ Yn(ta, 5, 1), Ti = function(i) {
|
|
8113
8164
|
for (var e = i[0], t = 1; t < i.length; ++t)
|
|
8114
8165
|
i[t] > e && (e = i[t]);
|
|
8115
8166
|
return e;
|
|
8116
8167
|
}, mt = function(i, e, t) {
|
|
8117
8168
|
var n = e / 8 | 0;
|
|
8118
8169
|
return (i[n] | i[n + 1] << 8) >> (e & 7) & t;
|
|
8119
|
-
},
|
|
8170
|
+
}, _i = function(i, e) {
|
|
8120
8171
|
var t = e / 8 | 0;
|
|
8121
8172
|
return (i[t] | i[t + 1] << 8 | i[t + 2] << 16) >> (e & 7);
|
|
8122
8173
|
}, mu = function(i) {
|
|
@@ -8156,21 +8207,21 @@ var pu = /* @__PURE__ */ Yn(ts, 9, 1), fu = /* @__PURE__ */ Yn(ta, 5, 1), Ei = f
|
|
|
8156
8207
|
var ns = new lt(Math.max(Pt * 2, rn));
|
|
8157
8208
|
ns.set(t), t = ns;
|
|
8158
8209
|
}
|
|
8159
|
-
}, d = e.f || 0, h = e.p || 0, p = e.b || 0, f = e.l, y = e.d,
|
|
8210
|
+
}, d = e.f || 0, h = e.p || 0, p = e.b || 0, f = e.l, y = e.d, S = e.m, _ = e.n, A = s * 8;
|
|
8160
8211
|
do {
|
|
8161
8212
|
if (!f) {
|
|
8162
8213
|
d = mt(i, h, 1);
|
|
8163
8214
|
var E = mt(i, h + 1, 3);
|
|
8164
8215
|
if (h += 3, E)
|
|
8165
8216
|
if (E == 1)
|
|
8166
|
-
f = pu, y = fu,
|
|
8217
|
+
f = pu, y = fu, S = 9, _ = 5;
|
|
8167
8218
|
else if (E == 2) {
|
|
8168
|
-
var P = mt(i, h, 31) + 257,
|
|
8219
|
+
var P = mt(i, h, 31) + 257, C = mt(i, h + 10, 15) + 4, M = P + mt(i, h + 5, 31) + 1;
|
|
8169
8220
|
h += 14;
|
|
8170
|
-
for (var O = new lt(M),
|
|
8171
|
-
|
|
8172
|
-
h +=
|
|
8173
|
-
for (var D =
|
|
8221
|
+
for (var O = new lt(M), I = new lt(19), k = 0; k < C; ++k)
|
|
8222
|
+
I[lu[k]] = mt(i, h + k * 3, 7);
|
|
8223
|
+
h += C * 3;
|
|
8224
|
+
for (var D = Ti(I), H = (1 << D) - 1, G = Yn(I, D, 1), k = 0; k < M; ) {
|
|
8174
8225
|
var q = G[mt(i, h, H)];
|
|
8175
8226
|
h += q & 15;
|
|
8176
8227
|
var T = q >> 4;
|
|
@@ -8183,27 +8234,27 @@ var pu = /* @__PURE__ */ Yn(ts, 9, 1), fu = /* @__PURE__ */ Yn(ta, 5, 1), Ei = f
|
|
|
8183
8234
|
}
|
|
8184
8235
|
}
|
|
8185
8236
|
var dt = O.subarray(0, P), Me = O.subarray(P);
|
|
8186
|
-
|
|
8237
|
+
S = Ti(dt), _ = Ti(Me), f = Yn(dt, S, 1), y = Yn(Me, _, 1);
|
|
8187
8238
|
} else
|
|
8188
8239
|
yt(1);
|
|
8189
8240
|
else {
|
|
8190
|
-
var T = mu(h) + 4,
|
|
8191
|
-
if (
|
|
8241
|
+
var T = mu(h) + 4, b = i[T - 4] | i[T - 3] << 8, x = T + b;
|
|
8242
|
+
if (x > s) {
|
|
8192
8243
|
c && yt(0);
|
|
8193
8244
|
break;
|
|
8194
8245
|
}
|
|
8195
|
-
a && u(p +
|
|
8246
|
+
a && u(p + b), t.set(i.subarray(T, x), p), e.b = p += b, e.p = h = x * 8, e.f = d;
|
|
8196
8247
|
continue;
|
|
8197
8248
|
}
|
|
8198
|
-
if (h >
|
|
8249
|
+
if (h > A) {
|
|
8199
8250
|
c && yt(0);
|
|
8200
8251
|
break;
|
|
8201
8252
|
}
|
|
8202
8253
|
}
|
|
8203
8254
|
a && u(p + 131072);
|
|
8204
|
-
for (var Ue = (1 <<
|
|
8205
|
-
var ie = f[
|
|
8206
|
-
if (h += ie & 15, h >
|
|
8255
|
+
for (var Ue = (1 << S) - 1, Ve = (1 << _) - 1, ve = h; ; ve = h) {
|
|
8256
|
+
var ie = f[_i(i, h) & Ue], ge = ie >> 4;
|
|
8257
|
+
if (h += ie & 15, h > A) {
|
|
8207
8258
|
c && yt(0);
|
|
8208
8259
|
break;
|
|
8209
8260
|
}
|
|
@@ -8213,24 +8264,24 @@ var pu = /* @__PURE__ */ Yn(ts, 9, 1), fu = /* @__PURE__ */ Yn(ta, 5, 1), Ei = f
|
|
|
8213
8264
|
ve = h, f = null;
|
|
8214
8265
|
break;
|
|
8215
8266
|
} else {
|
|
8216
|
-
var
|
|
8267
|
+
var bt = ge - 254;
|
|
8217
8268
|
if (ge > 264) {
|
|
8218
8269
|
var k = ge - 257, We = qo[k];
|
|
8219
|
-
|
|
8270
|
+
bt = mt(i, h, (1 << We) - 1) + ea[k], h += We;
|
|
8220
8271
|
}
|
|
8221
|
-
var zt = y[
|
|
8272
|
+
var zt = y[_i(i, h) & Ve], me = zt >> 4;
|
|
8222
8273
|
zt || yt(3), h += zt & 15;
|
|
8223
8274
|
var Me = du[me];
|
|
8224
8275
|
if (me > 3) {
|
|
8225
8276
|
var We = $o[me];
|
|
8226
|
-
Me +=
|
|
8277
|
+
Me += _i(i, h) & (1 << We) - 1, h += We;
|
|
8227
8278
|
}
|
|
8228
|
-
if (h >
|
|
8279
|
+
if (h > A) {
|
|
8229
8280
|
c && yt(0);
|
|
8230
8281
|
break;
|
|
8231
8282
|
}
|
|
8232
8283
|
a && u(p + 131072);
|
|
8233
|
-
var pt = p +
|
|
8284
|
+
var pt = p + bt;
|
|
8234
8285
|
if (p < Me) {
|
|
8235
8286
|
var ft = o - Me, Rn = Math.min(Me, pt);
|
|
8236
8287
|
for (ft + p < 0 && yt(3); p < Rn; ++p)
|
|
@@ -8240,7 +8291,7 @@ var pu = /* @__PURE__ */ Yn(ts, 9, 1), fu = /* @__PURE__ */ Yn(ta, 5, 1), Ei = f
|
|
|
8240
8291
|
t[p] = t[p - Me];
|
|
8241
8292
|
}
|
|
8242
8293
|
}
|
|
8243
|
-
e.l = f, e.p = ve, e.b = p, e.f = d, f && (d = 1, e.m =
|
|
8294
|
+
e.l = f, e.p = ve, e.b = p, e.f = d, f && (d = 1, e.m = S, e.d = y, e.n = _);
|
|
8244
8295
|
} while (!d);
|
|
8245
8296
|
return p != t.length && r ? gu(t, 0, p) : t.subarray(0, p);
|
|
8246
8297
|
}, Eu = /* @__PURE__ */ new lt(0), Tu = function(i, e) {
|
|
@@ -8249,12 +8300,12 @@ var pu = /* @__PURE__ */ Yn(ts, 9, 1), fu = /* @__PURE__ */ Yn(ta, 5, 1), Ei = f
|
|
|
8249
8300
|
function Un(i, e) {
|
|
8250
8301
|
return wu(i.subarray(Tu(i), -4), { i: 2 }, e, e);
|
|
8251
8302
|
}
|
|
8252
|
-
var _u = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(),
|
|
8303
|
+
var _u = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), bu = 0;
|
|
8253
8304
|
try {
|
|
8254
|
-
_u.decode(Eu, { stream: !0 }),
|
|
8305
|
+
_u.decode(Eu, { stream: !0 }), bu = 1;
|
|
8255
8306
|
} catch {
|
|
8256
8307
|
}
|
|
8257
|
-
class
|
|
8308
|
+
class Su extends Mo {
|
|
8258
8309
|
/**
|
|
8259
8310
|
* Constructs a new EXR loader.
|
|
8260
8311
|
*
|
|
@@ -8271,7 +8322,7 @@ class bu extends Mo {
|
|
|
8271
8322
|
*/
|
|
8272
8323
|
parse(e) {
|
|
8273
8324
|
const O = Math.pow(2.7182818, 2.2);
|
|
8274
|
-
let
|
|
8325
|
+
let I = null;
|
|
8275
8326
|
function k(l, m) {
|
|
8276
8327
|
let g = 0;
|
|
8277
8328
|
for (let L = 0; L < 65536; ++L)
|
|
@@ -8370,7 +8421,7 @@ class bu extends Mo {
|
|
|
8370
8421
|
l = l << 8 | wr(g, R), m += 8, Ve.c = l, Ve.lc = m;
|
|
8371
8422
|
}
|
|
8372
8423
|
const ge = { c: 0, lc: 0 };
|
|
8373
|
-
function
|
|
8424
|
+
function bt(l, m, g, R, L, z, v, U, F) {
|
|
8374
8425
|
if (l == m) {
|
|
8375
8426
|
R < 8 && (ve(g, R, L, z), g = Ve.c, R = Ve.lc), R -= 8;
|
|
8376
8427
|
let B = g >> R;
|
|
@@ -8440,7 +8491,7 @@ class bu extends Mo {
|
|
|
8440
8491
|
for (ve(B, j, g, R), B = Ve.c, j = Ve.lc; j >= 14; ) {
|
|
8441
8492
|
const ee = B >> j - 14 & 16383, X = m[ee];
|
|
8442
8493
|
if (X.len)
|
|
8443
|
-
j -= X.len,
|
|
8494
|
+
j -= X.len, bt(X.lit, z, B, j, g, R, U, F, Z), B = ge.c, j = ge.lc;
|
|
8444
8495
|
else {
|
|
8445
8496
|
if (!X.p)
|
|
8446
8497
|
throw new Error("THREE.EXRLoader: hufDecode issues");
|
|
@@ -8450,7 +8501,7 @@ class bu extends Mo {
|
|
|
8450
8501
|
for (; j < re && R.value < V; )
|
|
8451
8502
|
ve(B, j, g, R), B = Ve.c, j = Ve.lc;
|
|
8452
8503
|
if (j >= re && Me(l[X.p[Q]]) == (B >> j - re & (1 << re) - 1)) {
|
|
8453
|
-
j -= re,
|
|
8504
|
+
j -= re, bt(X.p[Q], z, B, j, g, R, U, F, Z), B = ge.c, j = ge.lc;
|
|
8454
8505
|
break;
|
|
8455
8506
|
}
|
|
8456
8507
|
}
|
|
@@ -8462,7 +8513,7 @@ class bu extends Mo {
|
|
|
8462
8513
|
for (B >>= Y, j -= Y; j > 0; ) {
|
|
8463
8514
|
const ee = m[B << 14 - j & 16383];
|
|
8464
8515
|
if (ee.len)
|
|
8465
|
-
j -= ee.len,
|
|
8516
|
+
j -= ee.len, bt(ee.lit, z, B, j, g, R, U, F, Z), B = ge.c, j = ge.lc;
|
|
8466
8517
|
else
|
|
8467
8518
|
throw new Error("THREE.EXRLoader: hufDecode issues");
|
|
8468
8519
|
}
|
|
@@ -8497,7 +8548,7 @@ class bu extends Mo {
|
|
|
8497
8548
|
for (; !(L > z || (m[L++] = l[g++], L > z)); )
|
|
8498
8549
|
m[L++] = l[R++];
|
|
8499
8550
|
}
|
|
8500
|
-
function
|
|
8551
|
+
function Js(l) {
|
|
8501
8552
|
let m = l.byteLength;
|
|
8502
8553
|
const g = new Array();
|
|
8503
8554
|
let R = 0;
|
|
@@ -8549,8 +8600,8 @@ class bu extends Mo {
|
|
|
8549
8600
|
if (j != Z)
|
|
8550
8601
|
for (let Ce = 8 * te; Ce < 8 * te + se; ++Ce) {
|
|
8551
8602
|
const it = ue[ae][Ce] + 8 * j * 2 * he, _e = j * 64 + (Ce & 7) * 8;
|
|
8552
|
-
for (let
|
|
8553
|
-
v.setUint16(it +
|
|
8603
|
+
for (let St = 0; St < ye; ++St)
|
|
8604
|
+
v.setUint16(it + St * 2 * he, oe[ae][_e + St], !0);
|
|
8554
8605
|
}
|
|
8555
8606
|
}
|
|
8556
8607
|
}
|
|
@@ -8629,10 +8680,10 @@ class bu extends Mo {
|
|
|
8629
8680
|
return new DataView(l.array.buffer, l.offset.value, l.size);
|
|
8630
8681
|
}
|
|
8631
8682
|
function ya(l) {
|
|
8632
|
-
const m = l.viewer.buffer.slice(l.offset.value, l.offset.value + l.size), g = new Uint8Array(
|
|
8683
|
+
const m = l.viewer.buffer.slice(l.offset.value, l.offset.value + l.size), g = new Uint8Array(Js(m)), R = new Uint8Array(g.length);
|
|
8633
8684
|
return ss(g), is(g, R), new DataView(R.buffer);
|
|
8634
8685
|
}
|
|
8635
|
-
function
|
|
8686
|
+
function ei(l) {
|
|
8636
8687
|
const m = l.array.slice(l.offset.value, l.offset.value + l.size), g = Un(m), R = new Uint8Array(g.length);
|
|
8637
8688
|
return ss(g), is(g, R), new DataView(R.buffer);
|
|
8638
8689
|
}
|
|
@@ -8724,23 +8775,23 @@ class bu extends Mo {
|
|
|
8724
8775
|
const ne = m[g] << 8 | m[g + 1], te = ne & 32768 ? ne & 32767 : ~ne & 65535;
|
|
8725
8776
|
B.fill(te), g += 3;
|
|
8726
8777
|
} else {
|
|
8727
|
-
const ne = m[g] << 8 | m[g + 1], te = m[g + 2] >> 2, se = 32 << te, ye = ne + ((m[g + 2] << 4 | m[g + 3] >> 4) & 63) * (1 << te) - se & 65535, pe = ye + ((m[g + 3] << 2 | m[g + 4] >> 6) & 63) * (1 << te) - se & 65535, ae = pe + (m[g + 4] & 63) * (1 << te) - se & 65535, he = ne + (m[g + 5] >> 2 & 63) * (1 << te) - se & 65535, Ce = ye + ((m[g + 5] << 4 | m[g + 6] >> 4) & 63) * (1 << te) - se & 65535, it = pe + ((m[g + 6] << 2 | m[g + 7] >> 6) & 63) * (1 << te) - se & 65535, _e = ae + (m[g + 7] & 63) * (1 << te) - se & 65535,
|
|
8778
|
+
const ne = m[g] << 8 | m[g + 1], te = m[g + 2] >> 2, se = 32 << te, ye = ne + ((m[g + 2] << 4 | m[g + 3] >> 4) & 63) * (1 << te) - se & 65535, pe = ye + ((m[g + 3] << 2 | m[g + 4] >> 6) & 63) * (1 << te) - se & 65535, ae = pe + (m[g + 4] & 63) * (1 << te) - se & 65535, he = ne + (m[g + 5] >> 2 & 63) * (1 << te) - se & 65535, Ce = ye + ((m[g + 5] << 4 | m[g + 6] >> 4) & 63) * (1 << te) - se & 65535, it = pe + ((m[g + 6] << 2 | m[g + 7] >> 6) & 63) * (1 << te) - se & 65535, _e = ae + (m[g + 7] & 63) * (1 << te) - se & 65535, St = he + (m[g + 8] >> 2 & 63) * (1 << te) - se & 65535, on = Ce + ((m[g + 8] << 4 | m[g + 9] >> 4) & 63) * (1 << te) - se & 65535, Cn = it + ((m[g + 9] << 2 | m[g + 10] >> 6) & 63) * (1 << te) - se & 65535, xt = _e + (m[g + 10] & 63) * (1 << te) - se & 65535, Yt = St + (m[g + 11] >> 2 & 63) * (1 << te) - se & 65535, hs = on + ((m[g + 11] << 4 | m[g + 12] >> 4) & 63) * (1 << te) - se & 65535, us = Cn + ((m[g + 12] << 2 | m[g + 13] >> 6) & 63) * (1 << te) - se & 65535, ds = xt + (m[g + 13] & 63) * (1 << te) - se & 65535, In = [ne, he, St, Yt, ye, Ce, on, hs, pe, it, Cn, us, ae, _e, xt, ds];
|
|
8728
8779
|
for (let an = 0; an < 16; an++)
|
|
8729
8780
|
B[an] = In[an] & 32768 ? In[an] & 32767 : ~In[an] & 65535;
|
|
8730
8781
|
g += 14;
|
|
8731
8782
|
}
|
|
8732
8783
|
if (V.pLinear) {
|
|
8733
|
-
if (
|
|
8734
|
-
|
|
8784
|
+
if (I === null) {
|
|
8785
|
+
I = new Uint16Array(65536);
|
|
8735
8786
|
for (let ne = 0; ne < 65536; ne++)
|
|
8736
8787
|
if ((ne & 31744) === 31744 || ne > 32768)
|
|
8737
|
-
|
|
8788
|
+
I[ne] = 0;
|
|
8738
8789
|
else {
|
|
8739
8790
|
const te = J(ne);
|
|
8740
|
-
|
|
8791
|
+
I[ne] = te <= 0 ? 0 : Et.toHalfFloat(8 * Math.log(te));
|
|
8741
8792
|
}
|
|
8742
8793
|
}
|
|
8743
|
-
for (let ne = 0; ne < 16; ne++) B[ne] =
|
|
8794
|
+
for (let ne = 0; ne < 16; ne++) B[ne] = I[B[ne]];
|
|
8744
8795
|
}
|
|
8745
8796
|
for (let ne = 0; ne < 4; ne++) {
|
|
8746
8797
|
const te = oe * 4 + ne;
|
|
@@ -8825,11 +8876,11 @@ class bu extends Mo {
|
|
|
8825
8876
|
offset: g,
|
|
8826
8877
|
size: L.dcCompressedSize
|
|
8827
8878
|
};
|
|
8828
|
-
Z = new Uint16Array(
|
|
8879
|
+
Z = new Uint16Array(ei(X).buffer), g.value += L.dcCompressedSize;
|
|
8829
8880
|
}
|
|
8830
8881
|
if (L.rleRawSize > 0) {
|
|
8831
8882
|
const X = l.array.slice(g.value, g.value + L.rleCompressedSize), Q = Un(X);
|
|
8832
|
-
V =
|
|
8883
|
+
V = Js(Q.buffer), g.value += L.rleCompressedSize;
|
|
8833
8884
|
}
|
|
8834
8885
|
let Y = 0;
|
|
8835
8886
|
const ee = new Array(F.length);
|
|
@@ -8880,11 +8931,11 @@ class bu extends Mo {
|
|
|
8880
8931
|
);
|
|
8881
8932
|
return m.value = m.value + g, R;
|
|
8882
8933
|
}
|
|
8883
|
-
function
|
|
8934
|
+
function ba(l, m) {
|
|
8884
8935
|
const g = et(l, m), R = st(l, m);
|
|
8885
8936
|
return [g, R];
|
|
8886
8937
|
}
|
|
8887
|
-
function
|
|
8938
|
+
function Sa(l, m) {
|
|
8888
8939
|
const g = st(l, m), R = st(l, m);
|
|
8889
8940
|
return [g, R];
|
|
8890
8941
|
}
|
|
@@ -9030,9 +9081,9 @@ class bu extends Mo {
|
|
|
9030
9081
|
if (R === "int")
|
|
9031
9082
|
return et(l, g);
|
|
9032
9083
|
if (R === "rational")
|
|
9033
|
-
return Sa(l, g);
|
|
9034
|
-
if (R === "timecode")
|
|
9035
9084
|
return ba(l, g);
|
|
9085
|
+
if (R === "timecode")
|
|
9086
|
+
return Sa(l, g);
|
|
9036
9087
|
if (R === "preview" || R === "deepImageState" || R === "idmanifest")
|
|
9037
9088
|
return g.value += L, "skipped";
|
|
9038
9089
|
g.value += L;
|
|
@@ -9145,7 +9196,7 @@ class bu extends Mo {
|
|
|
9145
9196
|
case "NO_COMPRESSION":
|
|
9146
9197
|
return new DataView(L.buffer, L.byteOffset, L.byteLength);
|
|
9147
9198
|
case "RLE_COMPRESSION": {
|
|
9148
|
-
const z = new Uint8Array(
|
|
9199
|
+
const z = new Uint8Array(Js(L.buffer.slice(L.byteOffset, L.byteOffset + L.byteLength))), v = new Uint8Array(z.length);
|
|
9149
9200
|
return ss(z), is(z, v), new DataView(v.buffer);
|
|
9150
9201
|
}
|
|
9151
9202
|
case "ZIPS_COMPRESSION": {
|
|
@@ -9190,17 +9241,17 @@ class bu extends Mo {
|
|
|
9190
9241
|
const he = new Float32Array(F);
|
|
9191
9242
|
let Ce = 0;
|
|
9192
9243
|
for (let _e = 0; _e < ae; _e++) {
|
|
9193
|
-
const
|
|
9244
|
+
const St = ye + _e, on = 1 - Ce;
|
|
9194
9245
|
if (on <= 0) break;
|
|
9195
9246
|
let Cn = 1;
|
|
9196
9247
|
if (j >= 0) {
|
|
9197
|
-
const xt = L[j].bytesPerSample, Yt = ue[j] +
|
|
9248
|
+
const xt = L[j].bytesPerSample, Yt = ue[j] + St * xt;
|
|
9198
9249
|
Cn = xt === 2 ? J(oe.getUint16(Yt, !0)) : oe.getFloat32(Yt, !0);
|
|
9199
9250
|
}
|
|
9200
9251
|
for (let xt = 0; xt < L.length; xt++) {
|
|
9201
9252
|
const Yt = L[xt], hs = U[Yt.name];
|
|
9202
9253
|
if (hs === void 0) continue;
|
|
9203
|
-
const us = Yt.bytesPerSample, ds = ue[xt] +
|
|
9254
|
+
const us = Yt.bytesPerSample, ds = ue[xt] + St * us, In = us === 2 ? J(oe.getUint16(ds, !0)) : oe.getFloat32(ds, !0);
|
|
9204
9255
|
he[hs] += In * on;
|
|
9205
9256
|
}
|
|
9206
9257
|
Ce += Cn * on;
|
|
@@ -9278,10 +9329,10 @@ class bu extends Mo {
|
|
|
9278
9329
|
v.blockHeight = 1, v.uncompress = ya;
|
|
9279
9330
|
break;
|
|
9280
9331
|
case "ZIPS_COMPRESSION":
|
|
9281
|
-
v.blockHeight = 1, v.uncompress =
|
|
9332
|
+
v.blockHeight = 1, v.uncompress = ei;
|
|
9282
9333
|
break;
|
|
9283
9334
|
case "ZIP_COMPRESSION":
|
|
9284
|
-
v.blockHeight = 16, v.uncompress =
|
|
9335
|
+
v.blockHeight = 16, v.uncompress = ei;
|
|
9285
9336
|
break;
|
|
9286
9337
|
case "PIZ_COMPRESSION":
|
|
9287
9338
|
v.blockHeight = 32, v.uncompress = wa;
|
|
@@ -9401,11 +9452,11 @@ class bu extends Mo {
|
|
|
9401
9452
|
}
|
|
9402
9453
|
return v;
|
|
9403
9454
|
}
|
|
9404
|
-
const as = { value: 0 }, cs = new DataView(e), Va = new Uint8Array(e), ls = ja(cs, e, as),
|
|
9455
|
+
const as = { value: 0 }, cs = new DataView(e), Va = new Uint8Array(e), ls = ja(cs, e, as), br = Math.max(0, Math.min(this.part, ls.length - 1)), Ke = ls[br];
|
|
9405
9456
|
if (Ke.spec.multiPart || Ke.spec.deepFormat)
|
|
9406
9457
|
for (let l = 0; l < ls.length; l++) {
|
|
9407
9458
|
const m = ls[l].chunkCount;
|
|
9408
|
-
if (l ===
|
|
9459
|
+
if (l === br) {
|
|
9409
9460
|
Ke._chunkOffsets = [];
|
|
9410
9461
|
for (let g = 0; g < m; g++)
|
|
9411
9462
|
Ke._chunkOffsets.push(ke(cs, as));
|
|
@@ -9506,7 +9557,7 @@ class xu extends Mo {
|
|
|
9506
9557
|
case 4:
|
|
9507
9558
|
throw new Error("THREE.HDRLoader: Memory Error: " + (O || ""));
|
|
9508
9559
|
}
|
|
9509
|
-
}, h = function(M, O,
|
|
9560
|
+
}, h = function(M, O, I) {
|
|
9510
9561
|
O = O || 1024;
|
|
9511
9562
|
let D = M.pos, H = -1, G = 0, q = "", ie = String.fromCharCode.apply(null, new Uint16Array(M.subarray(D, D + 128)));
|
|
9512
9563
|
for (; 0 > (H = ie.indexOf(`
|
|
@@ -9514,7 +9565,7 @@ class xu extends Mo {
|
|
|
9514
9565
|
q += ie, G += ie.length, D += 128, ie = String.fromCharCode.apply(null, new Uint16Array(M.subarray(D, D + 128)));
|
|
9515
9566
|
return -1 < H ? (M.pos += G + H + 1, q + ie.slice(0, H)) : !1;
|
|
9516
9567
|
}, p = function(M) {
|
|
9517
|
-
const O = /^#\?(\S+)/,
|
|
9568
|
+
const O = /^#\?(\S+)/, I = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, k = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, D = /^\s*FORMAT=(\S+)\s*$/, H = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, G = {
|
|
9518
9569
|
valid: 0,
|
|
9519
9570
|
/* indicate which fields are valid */
|
|
9520
9571
|
string: "",
|
|
@@ -9542,10 +9593,10 @@ class xu extends Mo {
|
|
|
9542
9593
|
`;
|
|
9543
9594
|
continue;
|
|
9544
9595
|
}
|
|
9545
|
-
if ((ie = q.match(
|
|
9596
|
+
if ((ie = q.match(I)) && (G.gamma = parseFloat(ie[1])), (ie = q.match(k)) && (G.exposure = parseFloat(ie[1])), (ie = q.match(D)) && (G.valid |= 2, G.format = ie[1]), (ie = q.match(H)) && (G.valid |= 4, G.height = parseInt(ie[1], 10), G.width = parseInt(ie[2], 10)), G.valid & 2 && G.valid & 4) break;
|
|
9546
9597
|
}
|
|
9547
9598
|
return G.valid & 2 || r(3, "missing format specifier"), G.valid & 4 || r(3, "missing image size specifier"), G;
|
|
9548
|
-
}, f = function(M, O,
|
|
9599
|
+
}, f = function(M, O, I) {
|
|
9549
9600
|
const k = O;
|
|
9550
9601
|
if (
|
|
9551
9602
|
// run length encoding is not allowed so read flat
|
|
@@ -9554,11 +9605,11 @@ class xu extends Mo {
|
|
|
9554
9605
|
)
|
|
9555
9606
|
return new Uint8Array(M);
|
|
9556
9607
|
k !== (M[2] << 8 | M[3]) && r(3, "wrong scanline width");
|
|
9557
|
-
const D = new Uint8Array(4 * O *
|
|
9608
|
+
const D = new Uint8Array(4 * O * I);
|
|
9558
9609
|
D.length || r(4, "unable to allocate buffer space");
|
|
9559
9610
|
let H = 0, G = 0;
|
|
9560
9611
|
const q = 4 * k, ie = new Uint8Array(4), Ne = new Uint8Array(q);
|
|
9561
|
-
let dt =
|
|
9612
|
+
let dt = I;
|
|
9562
9613
|
for (; dt > 0 && G < M.byteLength; ) {
|
|
9563
9614
|
G + 4 > M.byteLength && r(1), ie[0] = M[G++], ie[1] = M[G++], ie[2] = M[G++], ie[3] = M[G++], (ie[0] != 2 || ie[1] != 2 || (ie[2] << 8 | ie[3]) != k) && r(3, "bad rgbe scanline format");
|
|
9564
9615
|
let Me = 0, Ue;
|
|
@@ -9567,7 +9618,7 @@ class xu extends Mo {
|
|
|
9567
9618
|
const ve = Ue > 128;
|
|
9568
9619
|
if (ve && (Ue -= 128), (Ue === 0 || Me + Ue > q) && r(3, "bad scanline data"), ve) {
|
|
9569
9620
|
const ge = M[G++];
|
|
9570
|
-
for (let
|
|
9621
|
+
for (let bt = 0; bt < Ue; bt++)
|
|
9571
9622
|
Ne[Me++] = ge;
|
|
9572
9623
|
} else
|
|
9573
9624
|
Ne.set(M.subarray(G, G + Ue), Me), Me += Ue, G += Ue;
|
|
@@ -9580,30 +9631,30 @@ class xu extends Mo {
|
|
|
9580
9631
|
dt--;
|
|
9581
9632
|
}
|
|
9582
9633
|
return D;
|
|
9583
|
-
}, y = function(M, O,
|
|
9634
|
+
}, y = function(M, O, I, k) {
|
|
9584
9635
|
const D = M[O + 3], H = Math.pow(2, D - 128) / 255;
|
|
9585
|
-
|
|
9586
|
-
},
|
|
9636
|
+
I[k + 0] = M[O + 0] * H, I[k + 1] = M[O + 1] * H, I[k + 2] = M[O + 2] * H, I[k + 3] = 1;
|
|
9637
|
+
}, S = function(M, O, I, k) {
|
|
9587
9638
|
const D = M[O + 3], H = Math.pow(2, D - 128) / 255;
|
|
9588
|
-
|
|
9639
|
+
I[k + 0] = Et.toHalfFloat(Math.min(M[O + 0] * H, 65504)), I[k + 1] = Et.toHalfFloat(Math.min(M[O + 1] * H, 65504)), I[k + 2] = Et.toHalfFloat(Math.min(M[O + 2] * H, 65504)), I[k + 3] = Et.toHalfFloat(1);
|
|
9589
9640
|
}, _ = new Uint8Array(e);
|
|
9590
9641
|
_.pos = 0;
|
|
9591
|
-
const
|
|
9592
|
-
let
|
|
9642
|
+
const A = p(_), E = A.width, T = A.height, b = f(_.subarray(_.pos), E, T);
|
|
9643
|
+
let x, P, C;
|
|
9593
9644
|
switch (this.type) {
|
|
9594
9645
|
case Kn:
|
|
9595
|
-
|
|
9596
|
-
const M = new Float32Array(
|
|
9597
|
-
for (let
|
|
9598
|
-
y(
|
|
9599
|
-
|
|
9646
|
+
C = b.length / 4;
|
|
9647
|
+
const M = new Float32Array(C * 4);
|
|
9648
|
+
for (let I = 0; I < C; I++)
|
|
9649
|
+
y(b, I * 4, M, I * 4);
|
|
9650
|
+
x = M, P = Kn;
|
|
9600
9651
|
break;
|
|
9601
9652
|
case Wt:
|
|
9602
|
-
|
|
9603
|
-
const O = new Uint16Array(
|
|
9604
|
-
for (let
|
|
9605
|
-
b
|
|
9606
|
-
|
|
9653
|
+
C = b.length / 4;
|
|
9654
|
+
const O = new Uint16Array(C * 4);
|
|
9655
|
+
for (let I = 0; I < C; I++)
|
|
9656
|
+
S(b, I * 4, O, I * 4);
|
|
9657
|
+
x = O, P = Wt;
|
|
9607
9658
|
break;
|
|
9608
9659
|
default:
|
|
9609
9660
|
throw new Error("THREE.HDRLoader: Unsupported type: " + this.type);
|
|
@@ -9611,10 +9662,10 @@ class xu extends Mo {
|
|
|
9611
9662
|
return {
|
|
9612
9663
|
width: E,
|
|
9613
9664
|
height: T,
|
|
9614
|
-
data:
|
|
9615
|
-
header:
|
|
9616
|
-
gamma:
|
|
9617
|
-
exposure:
|
|
9665
|
+
data: x,
|
|
9666
|
+
header: A.string,
|
|
9667
|
+
gamma: A.gamma,
|
|
9668
|
+
exposure: A.exposure,
|
|
9618
9669
|
type: P,
|
|
9619
9670
|
colorSpace: je,
|
|
9620
9671
|
minFilter: nn,
|
|
@@ -9638,16 +9689,16 @@ class Au extends xu {
|
|
|
9638
9689
|
console.warn("RGBELoader has been deprecated. Please use HDRLoader instead."), super(e);
|
|
9639
9690
|
}
|
|
9640
9691
|
}
|
|
9641
|
-
class vu extends
|
|
9692
|
+
class vu extends Sc {
|
|
9642
9693
|
constructor() {
|
|
9643
9694
|
super(), this.name = "RoomEnvironment", this.position.y = -3.5;
|
|
9644
9695
|
const e = new xc();
|
|
9645
9696
|
e.deleteAttribute("uv");
|
|
9646
|
-
const t = new
|
|
9697
|
+
const t = new js({ side: go }), n = new js(), s = new bo(16777215, 900, 28, 2);
|
|
9647
9698
|
s.position.set(0.418, 16.199, 0.3), this.add(s);
|
|
9648
9699
|
const o = new wt(e, t);
|
|
9649
9700
|
o.position.set(-0.757, 13.219, 0.717), o.scale.set(31.713, 28.305, 28.591), this.add(o);
|
|
9650
|
-
const r = new
|
|
9701
|
+
const r = new So(e, n, 6), a = new Ji();
|
|
9651
9702
|
a.position.set(-10.906, 2.009, 1.846), a.rotation.set(0, -0.195, 0), a.scale.set(2.328, 7.905, 4.651), a.updateMatrix(), r.setMatrixAt(0, a.matrix), a.position.set(-5.607, -0.754, -0.758), a.rotation.set(0, 0.994, 0), a.scale.set(1.97, 1.534, 3.955), a.updateMatrix(), r.setMatrixAt(1, a.matrix), a.position.set(6.167, 0.857, 7.803), a.rotation.set(0, 0.561, 0), a.scale.set(3.927, 6.285, 3.687), a.updateMatrix(), r.setMatrixAt(2, a.matrix), a.position.set(-2.017, 0.018, 6.124), a.rotation.set(0, 0.333, 0), a.scale.set(2.002, 4.566, 2.064), a.updateMatrix(), r.setMatrixAt(3, a.matrix), a.position.set(2.291, -0.756, -2.621), a.rotation.set(0, -0.286, 0), a.scale.set(1.546, 1.552, 1.496), a.updateMatrix(), r.setMatrixAt(4, a.matrix), a.position.set(-2.193, -0.369, -5.547), a.rotation.set(0, 0.516, 0), a.scale.set(3.875, 3.487, 2.986), a.updateMatrix(), r.setMatrixAt(5, a.matrix), this.add(r);
|
|
9652
9703
|
const c = new wt(e, yn(50));
|
|
9653
9704
|
c.position.set(-16.116, 14.37, 8.208), c.scale.set(0.1, 2.428, 2.739), this.add(c);
|
|
@@ -9727,7 +9778,7 @@ class Ru {
|
|
|
9727
9778
|
o = new Au();
|
|
9728
9779
|
break;
|
|
9729
9780
|
case "exr":
|
|
9730
|
-
o = new
|
|
9781
|
+
o = new Su();
|
|
9731
9782
|
break;
|
|
9732
9783
|
case "jpg":
|
|
9733
9784
|
case "jpeg":
|
|
@@ -10115,7 +10166,7 @@ function Nu(i) {
|
|
|
10115
10166
|
!e && (((n = t.animations) == null ? void 0 : n.length) ?? 0) > 0 && (e = t);
|
|
10116
10167
|
}), e;
|
|
10117
10168
|
}
|
|
10118
|
-
var
|
|
10169
|
+
var Xs = /* @__PURE__ */ ((i) => (i.MapControls = "MapControls", i.OrbitControls = "OrbitControls", i))(Xs || {});
|
|
10119
10170
|
class ku {
|
|
10120
10171
|
static convertRendererOptions(e) {
|
|
10121
10172
|
const t = {
|
|
@@ -10150,8 +10201,10 @@ class ku {
|
|
|
10150
10201
|
if (e === w.ReinhardToneMapping) return "reinhard";
|
|
10151
10202
|
if (e === w.CineonToneMapping) return "cineon";
|
|
10152
10203
|
if (e === w.ACESFilmicToneMapping) return "aces";
|
|
10204
|
+
if (e === w.AgXToneMapping) return "agx";
|
|
10205
|
+
if (e === w.NeutralToneMapping) return "neutral";
|
|
10153
10206
|
}
|
|
10154
|
-
return typeof e == "string" ? e : "
|
|
10207
|
+
return typeof e == "string" ? e : "neutral";
|
|
10155
10208
|
}
|
|
10156
10209
|
}
|
|
10157
10210
|
class Fu {
|
|
@@ -10159,7 +10212,7 @@ class Fu {
|
|
|
10159
10212
|
* Create a ViewerCore instance with Three.js implementations
|
|
10160
10213
|
*/
|
|
10161
10214
|
static createViewer(e, t) {
|
|
10162
|
-
var
|
|
10215
|
+
var A;
|
|
10163
10216
|
Co(t.units);
|
|
10164
10217
|
const n = new Hl(e), s = new zo(), o = this.createCamera(t), r = this.createControls(
|
|
10165
10218
|
o.getThreeCamera(),
|
|
@@ -10167,35 +10220,32 @@ class Fu {
|
|
|
10167
10220
|
t
|
|
10168
10221
|
), a = new zu().createDefaultLoader({
|
|
10169
10222
|
renderer: n.getThreeRenderer() ?? void 0,
|
|
10170
|
-
bvh: (
|
|
10223
|
+
bvh: (A = t.selection) == null ? void 0 : A.bvh,
|
|
10171
10224
|
...t.loaders
|
|
10172
|
-
}), c = new ou(), u = new Ru()
|
|
10173
|
-
let d;
|
|
10174
|
-
(((T = t.pathTracing) == null ? void 0 : T.enabled) ?? !1) && (d = new au());
|
|
10175
|
-
const p = new Cu(), f = new Iu(), y = new Ou(), b = new Du(), _ = ku.convertRendererOptions(
|
|
10225
|
+
}), c = new ou(), u = new Ru(), d = new au(), h = new Cu(), p = new Iu(), f = new Ou(), y = new Du(), S = ku.convertRendererOptions(
|
|
10176
10226
|
t.renderer || {}
|
|
10177
10227
|
);
|
|
10178
|
-
|
|
10179
|
-
const
|
|
10228
|
+
S.preserveDrawingBuffer = !0;
|
|
10229
|
+
const _ = {
|
|
10180
10230
|
renderer: n,
|
|
10181
10231
|
scene: s,
|
|
10182
10232
|
camera: o,
|
|
10183
10233
|
controls: r,
|
|
10184
10234
|
modelLoader: a,
|
|
10185
10235
|
options: t,
|
|
10186
|
-
rendererOptions:
|
|
10236
|
+
rendererOptions: S,
|
|
10187
10237
|
sceneSetupService: c,
|
|
10188
10238
|
environmentService: u,
|
|
10189
10239
|
pathTracingService: d,
|
|
10190
|
-
floorAlignmentService:
|
|
10191
|
-
selectionService:
|
|
10192
|
-
anchorProjectionService:
|
|
10193
|
-
animationService:
|
|
10240
|
+
floorAlignmentService: h,
|
|
10241
|
+
selectionService: p,
|
|
10242
|
+
anchorProjectionService: f,
|
|
10243
|
+
animationService: y
|
|
10194
10244
|
};
|
|
10195
|
-
return new kc(
|
|
10245
|
+
return new kc(_);
|
|
10196
10246
|
}
|
|
10197
10247
|
static createCamera(e) {
|
|
10198
|
-
const n = e.camera || {}, s = n.fov || n.cameraFov ||
|
|
10248
|
+
const n = e.camera || {}, s = n.fov || n.cameraFov || 45, o = n.near || n.cameraNear || 0.1, r = n.far || n.cameraFar || 1e5, a = n.position || n.cameraPosition, c = n.target || n.cameraTarget, u = cr.create(
|
|
10199
10249
|
s,
|
|
10200
10250
|
1,
|
|
10201
10251
|
// Aspect ratio will be set by resize
|
|
@@ -10224,9 +10274,9 @@ class Fu {
|
|
|
10224
10274
|
}), u;
|
|
10225
10275
|
}
|
|
10226
10276
|
static createControls(e, t, n) {
|
|
10227
|
-
const s = n.controls || {}, o = s.type ||
|
|
10277
|
+
const s = n.controls || {}, o = s.type || Xs.OrbitControls;
|
|
10228
10278
|
let r;
|
|
10229
|
-
o ===
|
|
10279
|
+
o === Xs.MapControls ? r = new jh(e, t) : r = new Hh(e, t), r.enabled = s.enabled ?? !0, r.enableDamping = s.enableDamping ?? !0, r.dampingFactor = s.dampingFactor ?? 0.25, r.enableZoom = s.enableZoom ?? !0, r.enableRotate = s.enableRotate ?? !0, r.enablePan = s.enablePan ?? !0, r.autoRotate = s.autoRotate ?? !1, s.autoRotateSpeed !== void 0 && (r.autoRotateSpeed = s.autoRotateSpeed), s.minDistance !== void 0 && (r.minDistance = s.minDistance), s.maxDistance !== void 0 && (r.maxDistance = s.maxDistance), s.minPolarAngle !== void 0 && (r.minPolarAngle = s.minPolarAngle), s.maxPolarAngle !== void 0 && (r.maxPolarAngle = s.maxPolarAngle);
|
|
10230
10280
|
const c = n.camera || {}, u = c.target || c.cameraTarget;
|
|
10231
10281
|
return u && r.target && (r.target.set(u[0], u[1], u[2]), r.update()), r;
|
|
10232
10282
|
}
|
|
@@ -10236,9 +10286,9 @@ class zu extends so {
|
|
|
10236
10286
|
return so.createLoader("model.glb", e);
|
|
10237
10287
|
}
|
|
10238
10288
|
}
|
|
10239
|
-
const Bu = ["toneMappingExposure"], Uu = ["environmentIntensity"], Hu = ["autoRotate", "autoRotateSpeed"];
|
|
10289
|
+
const Bu = ["toneMappingExposure"], Uu = ["environmentIntensity"], Hu = ["autoRotate", "autoRotateSpeed"], ju = ["enabled"];
|
|
10240
10290
|
function na(i) {
|
|
10241
|
-
var t, n, s, o, r, a, c, u, d, h;
|
|
10291
|
+
var t, n, s, o, r, a, c, u, d, h, p;
|
|
10242
10292
|
const e = {
|
|
10243
10293
|
backgroundColor: i.backgroundColor
|
|
10244
10294
|
};
|
|
@@ -10248,7 +10298,7 @@ function na(i) {
|
|
|
10248
10298
|
}), (((c = i.animations) == null ? void 0 : c.autoplay) !== void 0 || ((u = i.animations) == null ? void 0 : u.speed) !== void 0) && (e.animations = {
|
|
10249
10299
|
autoplay: (d = i.animations) == null ? void 0 : d.autoplay,
|
|
10250
10300
|
speed: (h = i.animations) == null ? void 0 : h.speed
|
|
10251
|
-
}), e;
|
|
10301
|
+
}), ((p = i.pathTracing) == null ? void 0 : p.enabled) !== void 0 && (e.pathTracing = { enabled: i.pathTracing.enabled }), e;
|
|
10252
10302
|
}
|
|
10253
10303
|
const Wi = {
|
|
10254
10304
|
// Scene settings
|
|
@@ -10286,26 +10336,34 @@ const Wi = {
|
|
|
10286
10336
|
// Set `environment.url` to an HDR/EXR/image to use a custom environment map.
|
|
10287
10337
|
environment: {
|
|
10288
10338
|
backgroundIntensity: 1,
|
|
10289
|
-
//
|
|
10290
|
-
//
|
|
10291
|
-
|
|
10339
|
+
// Kept moderate: environmentIntensity drives the IBL REFLECTION strength
|
|
10340
|
+
// as well as the fill, so pushing it high to brighten also makes the paint
|
|
10341
|
+
// read glossy/plasticky. Brightness instead comes from the diffuse
|
|
10342
|
+
// ambient/hemisphere fill below, keeping a bright-but-matte studio look.
|
|
10343
|
+
environmentIntensity: 0.5
|
|
10292
10344
|
},
|
|
10293
|
-
// Lighting:
|
|
10294
|
-
//
|
|
10295
|
-
//
|
|
10345
|
+
// Lighting: a near-neutral directional key gives gentle form and the contact
|
|
10346
|
+
// shadow, while a generous ambient/hemisphere fill keeps the shadowed side
|
|
10347
|
+
// and crevices bright and open — a soft high-key studio look. Warmth is left
|
|
10348
|
+
// to the model's own materials rather than a tinted key, so genuinely
|
|
10349
|
+
// white/neutral models are not pushed yellow.
|
|
10296
10350
|
lighting: {
|
|
10297
10351
|
ambientLight: {
|
|
10298
|
-
color: "#
|
|
10299
|
-
intensity: 0.
|
|
10352
|
+
color: "#4a4a4a",
|
|
10353
|
+
intensity: 0.5
|
|
10300
10354
|
},
|
|
10301
10355
|
hemisphereLight: {
|
|
10302
|
-
skyColor: "#
|
|
10303
|
-
|
|
10304
|
-
|
|
10356
|
+
skyColor: "#fff6ec",
|
|
10357
|
+
// Warm-neutral bounce (not a cold blue, which cooled the shadowed side).
|
|
10358
|
+
groundColor: "#3c3630",
|
|
10359
|
+
intensity: 0.45
|
|
10305
10360
|
},
|
|
10306
10361
|
directionalLight: {
|
|
10307
|
-
|
|
10308
|
-
|
|
10362
|
+
// Barely-warm, near-white key: enough to avoid a clinical cool cast but
|
|
10363
|
+
// not enough to tint the render orange — the model's albedo carries the
|
|
10364
|
+
// warmth. Restrained intensity so the specular hotspot stays soft.
|
|
10365
|
+
color: "#fff8f2",
|
|
10366
|
+
intensity: 1.9,
|
|
10309
10367
|
// Steeper than a 45-degree key light so the cast shadow falls mostly
|
|
10310
10368
|
// directly under the model (a tight contact shadow) instead of
|
|
10311
10369
|
// streaking off to one side.
|
|
@@ -10347,13 +10405,15 @@ const Wi = {
|
|
|
10347
10405
|
// enough that a moderate radius already reads soft and clean.
|
|
10348
10406
|
shadowMapType: 1,
|
|
10349
10407
|
// PCFShadowMap
|
|
10350
|
-
|
|
10351
|
-
//
|
|
10352
|
-
|
|
10408
|
+
// Khronos PBR Neutral (THREE.NeutralToneMapping = 7): keeps saturated
|
|
10409
|
+
// material colours through the highlight rolloff instead of clipping them
|
|
10410
|
+
// to white the way ACES does — the right operator for a product viewer.
|
|
10411
|
+
toneMapping: 7,
|
|
10412
|
+
toneMappingExposure: 1.15
|
|
10353
10413
|
},
|
|
10354
10414
|
// Controls
|
|
10355
10415
|
controls: {
|
|
10356
|
-
type:
|
|
10416
|
+
type: Xs.OrbitControls,
|
|
10357
10417
|
enabled: !0,
|
|
10358
10418
|
enableDamping: !0,
|
|
10359
10419
|
dampingFactor: 0.25,
|
|
@@ -10398,37 +10458,37 @@ const Wi = {
|
|
|
10398
10458
|
}, sa = {
|
|
10399
10459
|
studio: {
|
|
10400
10460
|
backgroundColor: "#f0f0f7",
|
|
10401
|
-
renderer: { toneMappingExposure: 1.
|
|
10402
|
-
environment: { environmentIntensity: 0.
|
|
10461
|
+
renderer: { toneMappingExposure: 1.15 },
|
|
10462
|
+
environment: { environmentIntensity: 0.5 }
|
|
10403
10463
|
},
|
|
10404
10464
|
product: {
|
|
10405
10465
|
backgroundColor: "#ffffff",
|
|
10406
|
-
renderer: { toneMappingExposure: 1.
|
|
10407
|
-
environment: { environmentIntensity: 0.
|
|
10466
|
+
renderer: { toneMappingExposure: 1.2 },
|
|
10467
|
+
environment: { environmentIntensity: 0.55 }
|
|
10408
10468
|
},
|
|
10409
10469
|
neutral: {
|
|
10410
10470
|
backgroundColor: "#d9d9de",
|
|
10411
|
-
renderer: { toneMappingExposure: 1 },
|
|
10412
|
-
environment: { environmentIntensity: 0.
|
|
10471
|
+
renderer: { toneMappingExposure: 1.1 },
|
|
10472
|
+
environment: { environmentIntensity: 0.45 }
|
|
10413
10473
|
},
|
|
10414
10474
|
dark: {
|
|
10415
10475
|
backgroundColor: "#1a1a1f",
|
|
10416
|
-
renderer: { toneMappingExposure: 1.
|
|
10417
|
-
environment: { environmentIntensity: 0.
|
|
10476
|
+
renderer: { toneMappingExposure: 1.2 },
|
|
10477
|
+
environment: { environmentIntensity: 0.5 }
|
|
10418
10478
|
},
|
|
10419
10479
|
outdoor: {
|
|
10420
10480
|
backgroundColor: "#bcd4e6",
|
|
10421
|
-
renderer: { toneMappingExposure: 1.
|
|
10422
|
-
environment: { environmentIntensity: 0.
|
|
10481
|
+
renderer: { toneMappingExposure: 1.2 },
|
|
10482
|
+
environment: { environmentIntensity: 0.6 }
|
|
10423
10483
|
}
|
|
10424
10484
|
};
|
|
10425
|
-
function
|
|
10485
|
+
function Gu(i) {
|
|
10426
10486
|
return i ? sa[i] : {};
|
|
10427
10487
|
}
|
|
10428
10488
|
function Zi(i, e) {
|
|
10429
|
-
return
|
|
10489
|
+
return Vs(Vs(i, Gu(e.preset)), e);
|
|
10430
10490
|
}
|
|
10431
|
-
const
|
|
10491
|
+
const Ds = (i, ...e) => {
|
|
10432
10492
|
if (!i)
|
|
10433
10493
|
return;
|
|
10434
10494
|
const t = { ...i };
|
|
@@ -10436,22 +10496,26 @@ const _i = (i, ...e) => {
|
|
|
10436
10496
|
delete t[n];
|
|
10437
10497
|
return Object.keys(t).length > 0 ? t : void 0;
|
|
10438
10498
|
};
|
|
10439
|
-
function
|
|
10499
|
+
function Vu(i) {
|
|
10440
10500
|
const e = Nt(
|
|
10441
10501
|
() => {
|
|
10442
10502
|
var s;
|
|
10443
10503
|
return JSON.stringify({
|
|
10444
|
-
pathTracing
|
|
10504
|
+
// pathTracing minus `enabled`: toggling the tracer applies live
|
|
10505
|
+
// (updateOptions) — flipping it must not rebuild or re-fetch the model.
|
|
10506
|
+
// The other fields (samples, bounces, …) configure the tracer at
|
|
10507
|
+
// construction, so a change to them still rebuilds.
|
|
10508
|
+
pathTracing: Ds(i.pathTracing, ...ju),
|
|
10445
10509
|
staticScene: i.staticScene,
|
|
10446
10510
|
// renderer/environment minus their runtime-tunable fields: a direct
|
|
10447
10511
|
// toneMappingExposure / environmentIntensity change is exactly what
|
|
10448
10512
|
// the live updateOptions path exists for and must not rebuild.
|
|
10449
|
-
renderer:
|
|
10513
|
+
renderer: Ds(i.renderer, ...Bu),
|
|
10450
10514
|
camera: i.camera,
|
|
10451
10515
|
// The turntable fields toggle live (updateOptions), like the look
|
|
10452
10516
|
// fields — flipping auto-rotate must not reload the model.
|
|
10453
|
-
controls:
|
|
10454
|
-
environment:
|
|
10517
|
+
controls: Ds(i.controls, ...Hu),
|
|
10518
|
+
environment: Ds(i.environment, ...Uu),
|
|
10455
10519
|
lighting: i.lighting,
|
|
10456
10520
|
helpers: i.helpers,
|
|
10457
10521
|
rendering: i.rendering,
|
|
@@ -10485,11 +10549,11 @@ function Gu(i) {
|
|
|
10485
10549
|
), t = Nt(() => {
|
|
10486
10550
|
const s = Zi(Wi, i);
|
|
10487
10551
|
return JSON.stringify(na(s));
|
|
10488
|
-
}, [i.preset, i.backgroundColor, i.renderer, i.environment, i.controls, i.animations]);
|
|
10552
|
+
}, [i.preset, i.backgroundColor, i.renderer, i.environment, i.controls, i.animations, i.pathTracing]);
|
|
10489
10553
|
return { options: Nt(() => i, [e, t]), structuralKey: e, runtimeKey: t };
|
|
10490
10554
|
}
|
|
10491
|
-
const
|
|
10492
|
-
function
|
|
10555
|
+
const Wu = "200px";
|
|
10556
|
+
function Zu(i, e) {
|
|
10493
10557
|
const [t, n] = xn(!e);
|
|
10494
10558
|
return rt(() => {
|
|
10495
10559
|
if (t)
|
|
@@ -10507,70 +10571,68 @@ function Wu(i, e) {
|
|
|
10507
10571
|
(r) => {
|
|
10508
10572
|
r.some((a) => a.isIntersecting) && n(!0);
|
|
10509
10573
|
},
|
|
10510
|
-
{ rootMargin:
|
|
10574
|
+
{ rootMargin: Wu }
|
|
10511
10575
|
);
|
|
10512
10576
|
return o.observe(s), () => o.disconnect();
|
|
10513
10577
|
}, [i, e, t]), t;
|
|
10514
10578
|
}
|
|
10515
|
-
function
|
|
10516
|
-
const t = Ge(null),
|
|
10517
|
-
rt(() => {
|
|
10518
|
-
if (!
|
|
10579
|
+
function Ku(i, e) {
|
|
10580
|
+
const t = Ge(null), n = Ge({ width: 0, height: 0 }), [s, o] = xn(!1), [r, a] = xn(null), { options: c, structuralKey: u, runtimeKey: d } = Vu(e), h = Zu(i, (e.loading ?? "eager") === "lazy");
|
|
10581
|
+
return rt(() => {
|
|
10582
|
+
if (!h || !i.current || t.current)
|
|
10519
10583
|
return;
|
|
10520
|
-
|
|
10521
|
-
const p = Zi(Wi,
|
|
10584
|
+
a(null);
|
|
10585
|
+
const p = Zi(Wi, c);
|
|
10522
10586
|
let f;
|
|
10523
10587
|
try {
|
|
10524
10588
|
f = Fu.createViewer(i.current, p);
|
|
10525
|
-
} catch (
|
|
10526
|
-
console.error("Failed to create viewer:",
|
|
10589
|
+
} catch (S) {
|
|
10590
|
+
console.error("Failed to create viewer:", S), a(S instanceof Error ? S : new Error(String(S)));
|
|
10527
10591
|
return;
|
|
10528
10592
|
}
|
|
10529
|
-
t.current = f;
|
|
10593
|
+
t.current = f, n.current = { width: 0, height: 0 };
|
|
10530
10594
|
let y = !1;
|
|
10531
|
-
return f.initialize().then((
|
|
10532
|
-
y || (
|
|
10595
|
+
return f.initialize().then((S) => {
|
|
10596
|
+
y || (S.ok ? o(!0) : (console.error("Failed to initialize viewer:", S.error), a(S.error)));
|
|
10533
10597
|
}), () => {
|
|
10534
|
-
y = !0, f.dispose(), t.current = null,
|
|
10598
|
+
y = !0, f.dispose(), t.current = null, o(!1);
|
|
10535
10599
|
};
|
|
10536
|
-
}, [i,
|
|
10537
|
-
if (!t.current || !
|
|
10600
|
+
}, [i, u, h]), rt(() => {
|
|
10601
|
+
if (!t.current || !s)
|
|
10538
10602
|
return;
|
|
10539
|
-
const p = Zi(Wi,
|
|
10603
|
+
const p = Zi(Wi, c);
|
|
10540
10604
|
t.current.updateOptions(na(p));
|
|
10541
|
-
}, [
|
|
10542
|
-
const h = Ge({ width: 0, height: 0 });
|
|
10543
|
-
return rt(() => {
|
|
10605
|
+
}, [d, s]), rt(() => {
|
|
10544
10606
|
if (!t.current || !i.current)
|
|
10545
10607
|
return;
|
|
10546
10608
|
let p = null;
|
|
10547
10609
|
const f = (_) => {
|
|
10548
10610
|
if (i.current && t.current) {
|
|
10549
|
-
const
|
|
10550
|
-
let { clientWidth: E, clientHeight: T } =
|
|
10611
|
+
const A = i.current.parentElement || i.current;
|
|
10612
|
+
let { clientWidth: E, clientHeight: T } = A;
|
|
10551
10613
|
if (_ && _[0]) {
|
|
10552
|
-
const { width:
|
|
10553
|
-
E = Math.floor(
|
|
10614
|
+
const { width: b, height: x } = _[0].contentRect;
|
|
10615
|
+
E = Math.floor(b), T = Math.floor(x);
|
|
10554
10616
|
}
|
|
10555
|
-
if (
|
|
10617
|
+
if (n.current.width === E && n.current.height === T)
|
|
10556
10618
|
return;
|
|
10557
10619
|
p !== null && cancelAnimationFrame(p), p = requestAnimationFrame(() => {
|
|
10558
|
-
t.current && i.current && (t.current.resize(E, T),
|
|
10620
|
+
t.current && i.current && (t.current.resize(E, T), n.current = { width: E, height: T });
|
|
10559
10621
|
});
|
|
10560
10622
|
}
|
|
10561
10623
|
};
|
|
10562
10624
|
f();
|
|
10563
10625
|
const y = () => f();
|
|
10564
10626
|
window.addEventListener("resize", y);
|
|
10565
|
-
let
|
|
10566
|
-
return typeof ResizeObserver < "u" && i.current.parentElement && (
|
|
10567
|
-
window.removeEventListener("resize", y),
|
|
10627
|
+
let S = null;
|
|
10628
|
+
return typeof ResizeObserver < "u" && i.current.parentElement && (S = new ResizeObserver(f), S.observe(i.current.parentElement)), () => {
|
|
10629
|
+
window.removeEventListener("resize", y), S == null || S.disconnect(), p !== null && cancelAnimationFrame(p);
|
|
10568
10630
|
};
|
|
10569
|
-
}, [
|
|
10631
|
+
}, [s, i]), {
|
|
10570
10632
|
viewer: t.current,
|
|
10571
|
-
isInitialized:
|
|
10633
|
+
isInitialized: s,
|
|
10572
10634
|
/** Set when viewer construction or initialization failed (e.g. WebGL unavailable). */
|
|
10573
|
-
initError:
|
|
10635
|
+
initError: r
|
|
10574
10636
|
};
|
|
10575
10637
|
}
|
|
10576
10638
|
function ia(i, e) {
|
|
@@ -10592,7 +10654,7 @@ function ia(i, e) {
|
|
|
10592
10654
|
};
|
|
10593
10655
|
}, [i]);
|
|
10594
10656
|
}
|
|
10595
|
-
function
|
|
10657
|
+
function Xu(i, e) {
|
|
10596
10658
|
const [t, n] = xn(null), s = Ge(/* @__PURE__ */ new Set());
|
|
10597
10659
|
rt(() => {
|
|
10598
10660
|
if (i !== void 0 && s.current.has(i)) {
|
|
@@ -10617,7 +10679,7 @@ function Ku(i, e) {
|
|
|
10617
10679
|
selectPreset: a
|
|
10618
10680
|
};
|
|
10619
10681
|
}
|
|
10620
|
-
function
|
|
10682
|
+
function Yu(i, e, t, n, s) {
|
|
10621
10683
|
return Nt(() => {
|
|
10622
10684
|
var u, d, h;
|
|
10623
10685
|
const o = i.preset !== e, r = t === !0 && ((u = i.pathTracing) == null ? void 0 : u.enabled) === void 0, a = n !== void 0 && ((d = i.controls) == null ? void 0 : d.autoRotate) === void 0, c = s !== void 0 && ((h = i.animations) == null ? void 0 : h.autoplay) === void 0;
|
|
@@ -10630,7 +10692,7 @@ function Xu(i, e, t, n, s) {
|
|
|
10630
10692
|
};
|
|
10631
10693
|
}, [i, e, t, n, s]);
|
|
10632
10694
|
}
|
|
10633
|
-
function
|
|
10695
|
+
function qu(i, e, t) {
|
|
10634
10696
|
const n = Nt(() => {
|
|
10635
10697
|
if (typeof t == "string")
|
|
10636
10698
|
return t;
|
|
@@ -10653,7 +10715,7 @@ function Yu(i, e, t) {
|
|
|
10653
10715
|
};
|
|
10654
10716
|
}, [i, e, n]), s;
|
|
10655
10717
|
}
|
|
10656
|
-
class
|
|
10718
|
+
class bi {
|
|
10657
10719
|
/**
|
|
10658
10720
|
* Convert IObject3D to THREE.Object3D
|
|
10659
10721
|
*/
|
|
@@ -10722,16 +10784,16 @@ class Si {
|
|
|
10722
10784
|
};
|
|
10723
10785
|
}
|
|
10724
10786
|
}
|
|
10725
|
-
function
|
|
10787
|
+
function $u(i) {
|
|
10726
10788
|
const e = Ge(new tr()), t = Nt(
|
|
10727
10789
|
() => ({
|
|
10728
10790
|
"model:loading": (n) => e.current.emit("model:loading", n),
|
|
10729
10791
|
"model:progress": (n) => e.current.emit("model:progress", n),
|
|
10730
|
-
"model:loaded": (n) => e.current.emit("model:loaded",
|
|
10792
|
+
"model:loaded": (n) => e.current.emit("model:loaded", bi.convertModelLoaded(n)),
|
|
10731
10793
|
"model:error": (n) => e.current.emit("model:error", n),
|
|
10732
10794
|
"render:complete": (n) => e.current.emit("render:complete", n),
|
|
10733
|
-
"controls:change": (n) => e.current.emit("controls:change",
|
|
10734
|
-
"object:selected": (n) => e.current.emit("object:selected",
|
|
10795
|
+
"controls:change": (n) => e.current.emit("controls:change", bi.convertControlsChange(n)),
|
|
10796
|
+
"object:selected": (n) => e.current.emit("object:selected", bi.convertObjectSelected(n)),
|
|
10735
10797
|
error: (n) => e.current.emit("error", n)
|
|
10736
10798
|
}),
|
|
10737
10799
|
[]
|
|
@@ -10739,7 +10801,7 @@ function qu(i) {
|
|
|
10739
10801
|
);
|
|
10740
10802
|
return ia(i, t), e.current;
|
|
10741
10803
|
}
|
|
10742
|
-
function
|
|
10804
|
+
function Qu(i, e, t) {
|
|
10743
10805
|
const n = Ge(t);
|
|
10744
10806
|
n.current = t;
|
|
10745
10807
|
const s = Nt(
|
|
@@ -10775,7 +10837,7 @@ function $u(i, e, t) {
|
|
|
10775
10837
|
});
|
|
10776
10838
|
}
|
|
10777
10839
|
const ra = Wa(null);
|
|
10778
|
-
function
|
|
10840
|
+
function Ju({ viewer: i, canvasRef: e, children: t }) {
|
|
10779
10841
|
const n = Nt(() => ({ viewer: i, canvasRef: e }), [i, e]);
|
|
10780
10842
|
return /* @__PURE__ */ Te(ra.Provider, { value: n, children: t });
|
|
10781
10843
|
}
|
|
@@ -10785,7 +10847,7 @@ function oa() {
|
|
|
10785
10847
|
throw new Error("useViewerContext must be used within ViewerProvider");
|
|
10786
10848
|
return i;
|
|
10787
10849
|
}
|
|
10788
|
-
function
|
|
10850
|
+
function ed() {
|
|
10789
10851
|
const { canvasRef: i } = oa();
|
|
10790
10852
|
return /* @__PURE__ */ Te(
|
|
10791
10853
|
"canvas",
|
|
@@ -10813,13 +10875,13 @@ function Ju() {
|
|
|
10813
10875
|
console.error("vite-plugin-css-injected-by-js", e);
|
|
10814
10876
|
}
|
|
10815
10877
|
})();
|
|
10816
|
-
const
|
|
10878
|
+
const td = (i, e, t, n, s, o) => {
|
|
10817
10879
|
const r = performance.now(), a = () => {
|
|
10818
10880
|
const c = performance.now() - r, u = Math.min(c / s, 1);
|
|
10819
10881
|
i.position.lerpVectors(t, n, u), e == null || e.update(), o(), u < 1 && requestAnimationFrame(a);
|
|
10820
10882
|
};
|
|
10821
10883
|
requestAnimationFrame(a);
|
|
10822
|
-
}, lo = { type: "change" }, ur = { type: "start" }, aa = { type: "end" },
|
|
10884
|
+
}, lo = { type: "change" }, ur = { type: "start" }, aa = { type: "end" }, Ns = new Xi(), ho = new Jn(), nd = Math.cos(70 * er.DEG2RAD), Le = new $(), nt = 2 * Math.PI, Ee = {
|
|
10823
10885
|
NONE: -1,
|
|
10824
10886
|
ROTATE: 0,
|
|
10825
10887
|
DOLLY: 1,
|
|
@@ -10828,7 +10890,7 @@ const ed = (i, e, t, n, s, o) => {
|
|
|
10828
10890
|
TOUCH_PAN: 4,
|
|
10829
10891
|
TOUCH_DOLLY_PAN: 5,
|
|
10830
10892
|
TOUCH_DOLLY_ROTATE: 6
|
|
10831
|
-
},
|
|
10893
|
+
}, Si = 1e-6;
|
|
10832
10894
|
class ca extends Ro {
|
|
10833
10895
|
/**
|
|
10834
10896
|
* Constructs a new controls instance.
|
|
@@ -10837,7 +10899,7 @@ class ca extends Ro {
|
|
|
10837
10899
|
* @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
|
|
10838
10900
|
*/
|
|
10839
10901
|
constructor(e, t = null) {
|
|
10840
|
-
super(e, t), this.state = Ee.NONE, this.target = new $(), this.cursor = new $(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: Be.ROTATE, MIDDLE: Be.DOLLY, RIGHT: Be.PAN }, this.touches = { ONE: Ye.ROTATE, TWO: Ye.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new $(), this._lastQuaternion = new An(), this._lastTargetPosition = new $(), this._quat = new An().setFromUnitVectors(e.up, new $(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new
|
|
10902
|
+
super(e, t), this.state = Ee.NONE, this.target = new $(), this.cursor = new $(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: Be.ROTATE, MIDDLE: Be.DOLLY, RIGHT: Be.PAN }, this.touches = { ONE: Ye.ROTATE, TWO: Ye.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new $(), this._lastQuaternion = new An(), this._lastTargetPosition = new $(), this._quat = new An().setFromUnitVectors(e.up, new $(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new Gs(), this._sphericalDelta = new Gs(), this._scale = 1, this._panOffset = new $(), this._rotateStart = new fe(), this._rotateEnd = new fe(), this._rotateDelta = new fe(), this._panStart = new fe(), this._panEnd = new fe(), this._panDelta = new fe(), this._dollyStart = new fe(), this._dollyEnd = new fe(), this._dollyDelta = new fe(), this._dollyDirection = new $(), this._mouse = new fe(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = id.bind(this), this._onPointerDown = sd.bind(this), this._onPointerUp = rd.bind(this), this._onContextMenu = dd.bind(this), this._onMouseWheel = cd.bind(this), this._onKeyDown = ld.bind(this), this._onTouchStart = hd.bind(this), this._onTouchMove = ud.bind(this), this._onMouseDown = od.bind(this), this._onMouseMove = ad.bind(this), this._interceptControlDown = pd.bind(this), this._interceptControlUp = fd.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
10841
10903
|
}
|
|
10842
10904
|
connect(e) {
|
|
10843
10905
|
super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
|
|
@@ -10928,12 +10990,12 @@ class ca extends Ro {
|
|
|
10928
10990
|
u.unproject(this.object), this.object.position.sub(u).add(a), this.object.updateMatrixWorld(), r = Le.length();
|
|
10929
10991
|
} else
|
|
10930
10992
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
10931
|
-
r !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(r).add(this.object.position) : (
|
|
10993
|
+
r !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(r).add(this.object.position) : (Ns.origin.copy(this.object.position), Ns.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(Ns.direction)) < nd ? this.object.lookAt(this.target) : (ho.setFromNormalAndCoplanarPoint(this.object.up, this.target), Ns.intersectPlane(ho, this.target))));
|
|
10932
10994
|
} else if (this.object.isOrthographicCamera) {
|
|
10933
10995
|
const r = this.object.zoom;
|
|
10934
10996
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), r !== this.object.zoom && (this.object.updateProjectionMatrix(), o = !0);
|
|
10935
10997
|
}
|
|
10936
|
-
return this._scale = 1, this._performCursorZoom = !1, o || this._lastPosition.distanceToSquared(this.object.position) >
|
|
10998
|
+
return this._scale = 1, this._performCursorZoom = !1, o || this._lastPosition.distanceToSquared(this.object.position) > Si || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > Si || this._lastTargetPosition.distanceToSquared(this.target) > Si ? (this.dispatchEvent(lo), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
|
|
10937
10999
|
}
|
|
10938
11000
|
_getAutoRotationAngle(e) {
|
|
10939
11001
|
return e !== null ? nt / 60 * this.autoRotateSpeed * e : nt / 60 / 60 * this.autoRotateSpeed;
|
|
@@ -11125,13 +11187,13 @@ class ca extends Ro {
|
|
|
11125
11187
|
return e.ctrlKey && !this._controlActive && (n.deltaY *= 10), n;
|
|
11126
11188
|
}
|
|
11127
11189
|
}
|
|
11128
|
-
function
|
|
11190
|
+
function sd(i) {
|
|
11129
11191
|
this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(i.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(i) && (this._addPointer(i), i.pointerType === "touch" ? this._onTouchStart(i) : this._onMouseDown(i)));
|
|
11130
11192
|
}
|
|
11131
|
-
function
|
|
11193
|
+
function id(i) {
|
|
11132
11194
|
this.enabled !== !1 && (i.pointerType === "touch" ? this._onTouchMove(i) : this._onMouseMove(i));
|
|
11133
11195
|
}
|
|
11134
|
-
function
|
|
11196
|
+
function rd(i) {
|
|
11135
11197
|
switch (this._removePointer(i), this._pointers.length) {
|
|
11136
11198
|
case 0:
|
|
11137
11199
|
this.domElement.releasePointerCapture(i.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(aa), this.state = Ee.NONE;
|
|
@@ -11142,7 +11204,7 @@ function id(i) {
|
|
|
11142
11204
|
break;
|
|
11143
11205
|
}
|
|
11144
11206
|
}
|
|
11145
|
-
function
|
|
11207
|
+
function od(i) {
|
|
11146
11208
|
let e;
|
|
11147
11209
|
switch (i.button) {
|
|
11148
11210
|
case 0:
|
|
@@ -11185,7 +11247,7 @@ function rd(i) {
|
|
|
11185
11247
|
}
|
|
11186
11248
|
this.state !== Ee.NONE && this.dispatchEvent(ur);
|
|
11187
11249
|
}
|
|
11188
|
-
function
|
|
11250
|
+
function ad(i) {
|
|
11189
11251
|
switch (this.state) {
|
|
11190
11252
|
case Ee.ROTATE:
|
|
11191
11253
|
if (this.enableRotate === !1) return;
|
|
@@ -11201,13 +11263,13 @@ function od(i) {
|
|
|
11201
11263
|
break;
|
|
11202
11264
|
}
|
|
11203
11265
|
}
|
|
11204
|
-
function
|
|
11266
|
+
function cd(i) {
|
|
11205
11267
|
this.enabled === !1 || this.enableZoom === !1 || this.state !== Ee.NONE || (i.preventDefault(), this.dispatchEvent(ur), this._handleMouseWheel(this._customWheelEvent(i)), this.dispatchEvent(aa));
|
|
11206
11268
|
}
|
|
11207
|
-
function
|
|
11269
|
+
function ld(i) {
|
|
11208
11270
|
this.enabled !== !1 && this._handleKeyDown(i);
|
|
11209
11271
|
}
|
|
11210
|
-
function
|
|
11272
|
+
function hd(i) {
|
|
11211
11273
|
switch (this._trackPointer(i), this._pointers.length) {
|
|
11212
11274
|
case 1:
|
|
11213
11275
|
switch (this.touches.ONE) {
|
|
@@ -11242,7 +11304,7 @@ function ld(i) {
|
|
|
11242
11304
|
}
|
|
11243
11305
|
this.state !== Ee.NONE && this.dispatchEvent(ur);
|
|
11244
11306
|
}
|
|
11245
|
-
function
|
|
11307
|
+
function ud(i) {
|
|
11246
11308
|
switch (this._trackPointer(i), this.state) {
|
|
11247
11309
|
case Ee.TOUCH_ROTATE:
|
|
11248
11310
|
if (this.enableRotate === !1) return;
|
|
@@ -11264,16 +11326,16 @@ function hd(i) {
|
|
|
11264
11326
|
this.state = Ee.NONE;
|
|
11265
11327
|
}
|
|
11266
11328
|
}
|
|
11267
|
-
function
|
|
11329
|
+
function dd(i) {
|
|
11268
11330
|
this.enabled !== !1 && i.preventDefault();
|
|
11269
11331
|
}
|
|
11270
|
-
function
|
|
11332
|
+
function pd(i) {
|
|
11271
11333
|
i.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
11272
11334
|
}
|
|
11273
|
-
function
|
|
11335
|
+
function fd(i) {
|
|
11274
11336
|
i.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
11275
11337
|
}
|
|
11276
|
-
class
|
|
11338
|
+
class md extends ca {
|
|
11277
11339
|
constructor(e, t) {
|
|
11278
11340
|
super(e, t), this.screenSpacePanning = !1, this.mouseButtons = { LEFT: Be.PAN, MIDDLE: Be.DOLLY, RIGHT: Be.ROTATE }, this.touches = { ONE: Ye.PAN, TWO: Ye.DOLLY_ROTATE };
|
|
11279
11341
|
}
|
|
@@ -11294,15 +11356,15 @@ const de = {
|
|
|
11294
11356
|
};
|
|
11295
11357
|
var Vt = /* @__PURE__ */ ((i) => (i.FRONT = "FRONT", i.BACK = "BACK", i.RIGHT = "RIGHT", i.LEFT = "LEFT", i.TOP = "TOP", i.BOTTOM = "BOTTOM", i))(Vt || {});
|
|
11296
11358
|
new w.Vector3(0, 1, 0);
|
|
11297
|
-
const Qn = "rotation-arrows-name", Ki = "left-rotation-arrow-name",
|
|
11298
|
-
|
|
11359
|
+
const Qn = "rotation-arrows-name", Ki = "left-rotation-arrow-name", Ys = "right-rotation-arrow-name", gd = "gizmo-group-name", yd = [
|
|
11360
|
+
Ys,
|
|
11299
11361
|
Ki
|
|
11300
|
-
],
|
|
11362
|
+
], Hs = {
|
|
11301
11363
|
GIZMO_DISTANCE: 8,
|
|
11302
11364
|
DEFAULT_UP: new w.Vector3(0, 1, 0),
|
|
11303
11365
|
FORWARD: new w.Vector3(0, 0, -1)
|
|
11304
|
-
}, xi = (i) =>
|
|
11305
|
-
class
|
|
11366
|
+
}, xi = (i) => Hs.FORWARD.clone().applyQuaternion(i), uo = (i, e, t = new w.Vector3()) => t.clone().add(i.multiplyScalar(-e));
|
|
11367
|
+
class wd {
|
|
11306
11368
|
constructor(e, t = Qn) {
|
|
11307
11369
|
this.gizmoScene = e, this.gizmoArrowsName = t;
|
|
11308
11370
|
}
|
|
@@ -11310,29 +11372,29 @@ class yd {
|
|
|
11310
11372
|
e.quaternion.copy(t.quaternion), e.up.copy(t.up);
|
|
11311
11373
|
const n = xi(e.quaternion).normalize();
|
|
11312
11374
|
e.position.copy(
|
|
11313
|
-
uo(n,
|
|
11375
|
+
uo(n, Hs.GIZMO_DISTANCE)
|
|
11314
11376
|
), e.camera.updateMatrixWorld(!0);
|
|
11315
11377
|
const s = this.gizmoScene.getObjectByName(this.gizmoArrowsName);
|
|
11316
11378
|
s && s.rotation.copy(e.camera.rotation);
|
|
11317
11379
|
}
|
|
11318
11380
|
syncMainWithGizmo(e, t, n) {
|
|
11319
11381
|
const s = n.target.clone(), o = e.position.distanceTo(s), r = e.camera instanceof w.PerspectiveCamera;
|
|
11320
|
-
n instanceof
|
|
11382
|
+
n instanceof md && !r ? this.syncMapControls(e, t, s, o) : this.syncOrbitControls(e, t, s, o), e.camera.updateMatrix(), e.camera.updateMatrixWorld(!0), n.update();
|
|
11321
11383
|
}
|
|
11322
11384
|
syncMapControls(e, t, n, s) {
|
|
11323
11385
|
const o = e.position.y - n.y, r = xi(t.quaternion);
|
|
11324
11386
|
r.y = 0, r.normalize();
|
|
11325
11387
|
const a = n.clone();
|
|
11326
|
-
a.y += o, a.add(r.multiplyScalar(-s)), e.position.copy(a), e.up.copy(
|
|
11388
|
+
a.y += o, a.add(r.multiplyScalar(-s)), e.position.copy(a), e.up.copy(Hs.DEFAULT_UP), e.camera.lookAt(n);
|
|
11327
11389
|
}
|
|
11328
11390
|
syncOrbitControls(e, t, n, s) {
|
|
11329
|
-
const o = xi(t.quaternion), r =
|
|
11391
|
+
const o = xi(t.quaternion), r = Hs.DEFAULT_UP.clone().applyQuaternion(
|
|
11330
11392
|
t.quaternion
|
|
11331
11393
|
), a = uo(o, s, n);
|
|
11332
11394
|
e.position.copy(a), e.up.copy(r), e.camera.lookAt(n);
|
|
11333
11395
|
}
|
|
11334
11396
|
}
|
|
11335
|
-
const la = (i) => new
|
|
11397
|
+
const la = (i) => new wd(i), po = (i, e, t) => {
|
|
11336
11398
|
la(t).syncGizmoWithMain(
|
|
11337
11399
|
{
|
|
11338
11400
|
camera: i,
|
|
@@ -11347,7 +11409,7 @@ const la = (i) => new yd(i), po = (i, e, t) => {
|
|
|
11347
11409
|
up: e.up
|
|
11348
11410
|
}
|
|
11349
11411
|
);
|
|
11350
|
-
},
|
|
11412
|
+
}, Ed = (i, e, t) => {
|
|
11351
11413
|
la(e.userData.scene).syncMainWithGizmo(
|
|
11352
11414
|
{
|
|
11353
11415
|
camera: i,
|
|
@@ -11363,14 +11425,14 @@ const la = (i) => new yd(i), po = (i, e, t) => {
|
|
|
11363
11425
|
},
|
|
11364
11426
|
t
|
|
11365
11427
|
);
|
|
11366
|
-
},
|
|
11428
|
+
}, Td = () => {
|
|
11367
11429
|
try {
|
|
11368
11430
|
const i = document.createElement("canvas");
|
|
11369
11431
|
return !!(window.WebGLRenderingContext && (i.getContext("webgl") || i.getContext("experimental-webgl")));
|
|
11370
11432
|
} catch {
|
|
11371
11433
|
return !1;
|
|
11372
11434
|
}
|
|
11373
|
-
},
|
|
11435
|
+
}, _d = () => Td() ? new w.WebGLRenderer({ alpha: !0, antialias: !1 }) : (console.error("WebGL is not supported in this environment."), null), bd = (i) => {
|
|
11374
11436
|
const e = new w.AmbientLight(16777215, 1);
|
|
11375
11437
|
i.add(e);
|
|
11376
11438
|
const t = new w.DirectionalLight(16777215, 1);
|
|
@@ -11388,7 +11450,7 @@ class Sd {
|
|
|
11388
11450
|
return s.needsUpdate = !0, s;
|
|
11389
11451
|
}
|
|
11390
11452
|
}
|
|
11391
|
-
class
|
|
11453
|
+
class ks {
|
|
11392
11454
|
static createWireframe([e, t, n]) {
|
|
11393
11455
|
const s = new w.BoxGeometry(e, t, n), o = new w.EdgesGeometry(s), r = new w.LineBasicMaterial({ color: de.LINE_COLOR }), a = new w.LineSegments(o, r);
|
|
11394
11456
|
return a.name = "Wireframe", a;
|
|
@@ -11429,7 +11491,7 @@ class Ns {
|
|
|
11429
11491
|
return d.position.set(0, 0, de.FACE_THICKNESS / 2 + 0.01), s.add(d), s.position.copy(e), s.rotation.copy(t), s;
|
|
11430
11492
|
}
|
|
11431
11493
|
}
|
|
11432
|
-
const
|
|
11494
|
+
const xd = (i, e) => {
|
|
11433
11495
|
const t = document.createElement("canvas");
|
|
11434
11496
|
t.width = 64, t.height = 64;
|
|
11435
11497
|
const n = t.getContext("2d");
|
|
@@ -11437,7 +11499,7 @@ const bd = (i, e) => {
|
|
|
11437
11499
|
const s = new w.CanvasTexture(t), o = new w.SpriteMaterial({ map: s }), r = new w.Sprite(o);
|
|
11438
11500
|
return r.scale.set(0.5, 0.5, 0.5), r;
|
|
11439
11501
|
};
|
|
11440
|
-
class
|
|
11502
|
+
class Ad {
|
|
11441
11503
|
constructor(e) {
|
|
11442
11504
|
this.hoveredObject = null, this.originalColor = null, this.config = e;
|
|
11443
11505
|
}
|
|
@@ -11463,19 +11525,19 @@ class xd {
|
|
|
11463
11525
|
}
|
|
11464
11526
|
}
|
|
11465
11527
|
createWireframe() {
|
|
11466
|
-
const e = de.CUBE_SIZE + de.EDGE_SECTION_SIZE, t =
|
|
11528
|
+
const e = de.CUBE_SIZE + de.EDGE_SECTION_SIZE, t = ks.createWireframe([e, e, e]);
|
|
11467
11529
|
return t.userData.gizmoCube = this, t;
|
|
11468
11530
|
}
|
|
11469
11531
|
createEdgeBox(e, t, n) {
|
|
11470
|
-
const s =
|
|
11532
|
+
const s = ks.createEdgeBox(e, t, n);
|
|
11471
11533
|
return s.userData.gizmoCube = this, s;
|
|
11472
11534
|
}
|
|
11473
11535
|
createCornerCube(e, t) {
|
|
11474
|
-
const n =
|
|
11536
|
+
const n = ks.createCornerCube(e, t);
|
|
11475
11537
|
return n.userData.gizmoCube = this, n;
|
|
11476
11538
|
}
|
|
11477
11539
|
createFace(e, t, n) {
|
|
11478
|
-
const s =
|
|
11540
|
+
const s = ks.createFace(e, t, n), o = s.getObjectByName(`Face Box ${n}`);
|
|
11479
11541
|
return o.userData.gizmoCube = this, s;
|
|
11480
11542
|
}
|
|
11481
11543
|
createEdges(e) {
|
|
@@ -11555,11 +11617,11 @@ class xd {
|
|
|
11555
11617
|
createAxis(e) {
|
|
11556
11618
|
const { color: t, direction: n, length: s, origin: o, lineWidth: r, label: a } = e, c = new w.Group(), u = r / 2, d = new w.CylinderGeometry(u, u, s, 32), h = new w.MeshBasicMaterial({ color: t }), p = new w.Mesh(d, h);
|
|
11557
11619
|
if (p.position.copy(o).add(n.clone().multiplyScalar(s / 2)), !n.equals(new w.Vector3(0, 1, 0))) {
|
|
11558
|
-
const y = new w.Vector3(0, 1, 0).cross(n).normalize(),
|
|
11559
|
-
p.setRotationFromAxisAngle(y,
|
|
11620
|
+
const y = new w.Vector3(0, 1, 0).cross(n).normalize(), S = Math.acos(new w.Vector3(0, 1, 0).dot(n));
|
|
11621
|
+
p.setRotationFromAxisAngle(y, S);
|
|
11560
11622
|
}
|
|
11561
11623
|
c.add(p);
|
|
11562
|
-
const f =
|
|
11624
|
+
const f = xd(a, t);
|
|
11563
11625
|
return f.position.copy(o).add(n.clone().multiplyScalar(s + 0.1)), c.add(f), c;
|
|
11564
11626
|
}
|
|
11565
11627
|
createCoordinateAxes() {
|
|
@@ -11602,7 +11664,7 @@ class xd {
|
|
|
11602
11664
|
}
|
|
11603
11665
|
create() {
|
|
11604
11666
|
const e = new w.Group();
|
|
11605
|
-
e.name =
|
|
11667
|
+
e.name = gd;
|
|
11606
11668
|
const t = this.createWireframe();
|
|
11607
11669
|
e.add(t), this.createEdges(e), this.createCorners(e), this.createFaces(e);
|
|
11608
11670
|
const n = this.createCoordinateAxes();
|
|
@@ -11627,7 +11689,7 @@ class xd {
|
|
|
11627
11689
|
}
|
|
11628
11690
|
}
|
|
11629
11691
|
}
|
|
11630
|
-
class
|
|
11692
|
+
class vd {
|
|
11631
11693
|
constructor(e) {
|
|
11632
11694
|
this.onChangeMainControlsListener = () => {
|
|
11633
11695
|
}, this.onChangeGizmoControlsListener = () => {
|
|
@@ -11649,10 +11711,10 @@ class Ad {
|
|
|
11649
11711
|
}
|
|
11650
11712
|
initializeScene() {
|
|
11651
11713
|
var e;
|
|
11652
|
-
const t = new
|
|
11714
|
+
const t = new Ad({
|
|
11653
11715
|
initialFace: ((e = this.options) == null ? void 0 : e.initialFace) ?? Vt.FRONT
|
|
11654
11716
|
}).create();
|
|
11655
|
-
this.gizmoScene.add(t),
|
|
11717
|
+
this.gizmoScene.add(t), bd(this.gizmoScene);
|
|
11656
11718
|
}
|
|
11657
11719
|
initializeControls() {
|
|
11658
11720
|
this.onChangeMainControlsListener = () => this.syncFunctions.syncGizmoCameraWithMain(
|
|
@@ -11692,7 +11754,7 @@ class Ad {
|
|
|
11692
11754
|
), this.gizmoScene.clear(), cancelAnimationFrame(this.animationId);
|
|
11693
11755
|
}
|
|
11694
11756
|
}
|
|
11695
|
-
const
|
|
11757
|
+
const Rd = (i, e) => {
|
|
11696
11758
|
let t;
|
|
11697
11759
|
return function(...n) {
|
|
11698
11760
|
t || (i.apply(this, n), t = !0, setTimeout(() => t = !1, e));
|
|
@@ -11708,12 +11770,12 @@ const ha = (i, e, t, n) => (n.setFromCamera(i, e), n.intersectObjects(t.children
|
|
|
11708
11770
|
const t = ["Wireframe", ""];
|
|
11709
11771
|
return ((e = i.find((n) => !t.includes(n.object.name))) == null ? void 0 : e.object) || null;
|
|
11710
11772
|
};
|
|
11711
|
-
function
|
|
11773
|
+
function Md(i, e, t, n) {
|
|
11712
11774
|
if (!e || !t) return null;
|
|
11713
11775
|
const s = ha(i, e, t, n);
|
|
11714
11776
|
return ua(s);
|
|
11715
11777
|
}
|
|
11716
|
-
function
|
|
11778
|
+
function Cd(i, e) {
|
|
11717
11779
|
const t = i == null ? void 0 : i.userData.gizmoCube;
|
|
11718
11780
|
if (i && t) {
|
|
11719
11781
|
t.handleClick();
|
|
@@ -11721,22 +11783,22 @@ function Md(i, e) {
|
|
|
11721
11783
|
n && e(n);
|
|
11722
11784
|
}
|
|
11723
11785
|
}
|
|
11724
|
-
const
|
|
11786
|
+
const Id = {
|
|
11725
11787
|
radius: 2.1,
|
|
11726
11788
|
color: 12369854,
|
|
11727
11789
|
tubeRadius: 0.1,
|
|
11728
11790
|
tubeSegments: 8,
|
|
11729
11791
|
numPoints: 64,
|
|
11730
11792
|
tubeOffset: 1.5
|
|
11731
|
-
},
|
|
11793
|
+
}, Pd = {
|
|
11732
11794
|
size: 0.2,
|
|
11733
11795
|
depth: 0.1,
|
|
11734
11796
|
heightRatio: 1.4,
|
|
11735
11797
|
segments: 1
|
|
11736
11798
|
};
|
|
11737
|
-
class
|
|
11799
|
+
class Ld {
|
|
11738
11800
|
constructor(e = {}) {
|
|
11739
|
-
this.config = { ...
|
|
11801
|
+
this.config = { ...Id, ...e }, this.material = new w.MeshBasicMaterial({ color: this.config.color });
|
|
11740
11802
|
}
|
|
11741
11803
|
create() {
|
|
11742
11804
|
const e = new w.Group(), t = this.createQuarterCircleCurves();
|
|
@@ -11773,11 +11835,11 @@ class Pd {
|
|
|
11773
11835
|
};
|
|
11774
11836
|
return [
|
|
11775
11837
|
n(e, Ki),
|
|
11776
|
-
n(t,
|
|
11838
|
+
n(t, Ys)
|
|
11777
11839
|
];
|
|
11778
11840
|
}
|
|
11779
11841
|
createArrowHeads([e, t]) {
|
|
11780
|
-
const { size: n, depth: s, heightRatio: o, segments: r } =
|
|
11842
|
+
const { size: n, depth: s, heightRatio: o, segments: r } = Pd, a = this.createArrowShape(n, o), c = new w.ExtrudeGeometry(a, {
|
|
11781
11843
|
steps: r,
|
|
11782
11844
|
depth: s,
|
|
11783
11845
|
bevelEnabled: !1
|
|
@@ -11794,7 +11856,7 @@ class Pd {
|
|
|
11794
11856
|
u(
|
|
11795
11857
|
t.getPoint(1),
|
|
11796
11858
|
this.calculateArrowRotation(t.getTangent(1)) - Math.PI / 2,
|
|
11797
|
-
|
|
11859
|
+
Ys
|
|
11798
11860
|
)
|
|
11799
11861
|
];
|
|
11800
11862
|
}
|
|
@@ -11805,11 +11867,11 @@ class Pd {
|
|
|
11805
11867
|
return Math.atan2(e.y, e.x);
|
|
11806
11868
|
}
|
|
11807
11869
|
}
|
|
11808
|
-
const
|
|
11870
|
+
const Od = (i) => {
|
|
11809
11871
|
const e = i.rotation, t = 0.01, n = Math.PI, s = (Math.abs(e.x) % (2 * n) + 2 * n) % (2 * n), o = (Math.abs(e.y) % (2 * n) + 2 * n) % (2 * n), r = Math.abs(s - n / 2) < t || Math.abs(s - 3 * n / 2) < t || Math.abs(o - n / 2) < t || Math.abs(o - 3 * n / 2) < t, a = (Math.abs(s) < t || Math.abs(s - n) < t) && (Math.abs(o) < t || Math.abs(o - n) < t);
|
|
11810
11872
|
return !(r || a);
|
|
11811
|
-
},
|
|
11812
|
-
function
|
|
11873
|
+
}, Dd = 25, Nd = 200;
|
|
11874
|
+
function kd({
|
|
11813
11875
|
gizmoRenderer: i,
|
|
11814
11876
|
gizmoScene: e,
|
|
11815
11877
|
gizmoCamera: t,
|
|
@@ -11817,31 +11879,31 @@ function Nd({
|
|
|
11817
11879
|
gizmoControlRef: s
|
|
11818
11880
|
}) {
|
|
11819
11881
|
const o = Ge(null), r = Ge(null), a = Ge(new w.Raycaster()).current, c = Ge(new w.Vector2()).current, u = Rt(() => {
|
|
11820
|
-
const
|
|
11821
|
-
if (
|
|
11822
|
-
e.remove(
|
|
11882
|
+
const S = e.getObjectByName(Qn), _ = Od(t);
|
|
11883
|
+
if (S && _) {
|
|
11884
|
+
e.remove(S);
|
|
11823
11885
|
return;
|
|
11824
11886
|
}
|
|
11825
|
-
if (
|
|
11826
|
-
const
|
|
11827
|
-
|
|
11887
|
+
if (S || _) return;
|
|
11888
|
+
const A = new Ld().create();
|
|
11889
|
+
A.rotation.copy(t.rotation), e.add(A);
|
|
11828
11890
|
}, [e, t]), d = Rt(() => {
|
|
11829
|
-
const
|
|
11830
|
-
|
|
11891
|
+
const S = e.getObjectByName(Qn);
|
|
11892
|
+
S && e.remove(S);
|
|
11831
11893
|
}, [e]), h = Rt(
|
|
11832
|
-
|
|
11894
|
+
Rd((S) => {
|
|
11833
11895
|
if (!s.current || !i) return;
|
|
11834
|
-
fo(
|
|
11896
|
+
fo(S, i, c);
|
|
11835
11897
|
const _ = ha(
|
|
11836
11898
|
c,
|
|
11837
11899
|
t,
|
|
11838
11900
|
e,
|
|
11839
11901
|
a
|
|
11840
|
-
),
|
|
11841
|
-
|
|
11902
|
+
), A = ua(_);
|
|
11903
|
+
A != null && A.userData.gizmoCube ? A.userData.gizmoCube.highlightObject(A) : e.traverse((E) => {
|
|
11842
11904
|
E.userData.gizmoCube && E.userData.gizmoCube.highlightObject(null);
|
|
11843
11905
|
}), _.length > 0 ? u() : d();
|
|
11844
|
-
}, 1e3 /
|
|
11906
|
+
}, 1e3 / Dd),
|
|
11845
11907
|
[
|
|
11846
11908
|
s,
|
|
11847
11909
|
i,
|
|
@@ -11852,26 +11914,26 @@ function Nd({
|
|
|
11852
11914
|
u,
|
|
11853
11915
|
d
|
|
11854
11916
|
]
|
|
11855
|
-
), p = Rt((
|
|
11856
|
-
o.current = Date.now(), r.current = { x:
|
|
11917
|
+
), p = Rt((S) => {
|
|
11918
|
+
o.current = Date.now(), r.current = { x: S.clientX, y: S.clientY };
|
|
11857
11919
|
}, []), f = Rt(
|
|
11858
|
-
(
|
|
11920
|
+
(S) => {
|
|
11859
11921
|
var _;
|
|
11860
|
-
const
|
|
11861
|
-
|
|
11922
|
+
const A = S.name === Ys ? 1 : -1, E = 90 * Math.PI / 180, T = new w.Vector3(0, 0, 0), b = A * E, x = new w.Matrix4();
|
|
11923
|
+
x.makeRotationZ(b), t.up.applyMatrix4(x), t.lookAt(T), (_ = s.current) == null || _.gizmoControls.update();
|
|
11862
11924
|
},
|
|
11863
11925
|
[t, s]
|
|
11864
11926
|
), y = Rt(
|
|
11865
|
-
(
|
|
11866
|
-
if ((o.current ? Date.now() - o.current : 0) <
|
|
11867
|
-
fo(
|
|
11868
|
-
const _ =
|
|
11927
|
+
(S) => {
|
|
11928
|
+
if ((o.current ? Date.now() - o.current : 0) < Nd) {
|
|
11929
|
+
fo(S, i, c);
|
|
11930
|
+
const _ = Md(
|
|
11869
11931
|
c,
|
|
11870
11932
|
t,
|
|
11871
11933
|
e,
|
|
11872
11934
|
a
|
|
11873
11935
|
);
|
|
11874
|
-
_ != null && _.name &&
|
|
11936
|
+
_ != null && _.name && yd.includes(_.name) ? f(_) : Cd(_, n);
|
|
11875
11937
|
}
|
|
11876
11938
|
o.current = null, r.current = null;
|
|
11877
11939
|
},
|
|
@@ -11892,37 +11954,37 @@ function Nd({
|
|
|
11892
11954
|
onMouseLeave: d
|
|
11893
11955
|
};
|
|
11894
11956
|
}
|
|
11895
|
-
const
|
|
11957
|
+
const Fd = ({
|
|
11896
11958
|
camera: i,
|
|
11897
11959
|
controls: e,
|
|
11898
11960
|
className: t,
|
|
11899
11961
|
render: n,
|
|
11900
11962
|
options: s
|
|
11901
11963
|
}) => {
|
|
11902
|
-
const o = Ge(null), r = Ge(new w.Scene()).current, [a] = xn(() =>
|
|
11964
|
+
const o = Ge(null), r = Ge(new w.Scene()).current, [a] = xn(() => _d()), c = 30, u = 1, d = 0.1, h = 10, p = new w.PerspectiveCamera(
|
|
11903
11965
|
c,
|
|
11904
11966
|
u,
|
|
11905
11967
|
d,
|
|
11906
11968
|
h
|
|
11907
|
-
), f = Ge(p).current, y = Ge(null),
|
|
11969
|
+
), f = Ge(p).current, y = Ge(null), S = Rt(() => {
|
|
11908
11970
|
a && (n(), a.render(r, f));
|
|
11909
11971
|
}, [n, a, r, f]), _ = Rt(
|
|
11910
|
-
(
|
|
11972
|
+
(x) => {
|
|
11911
11973
|
if (!i || !e) return;
|
|
11912
|
-
const P = i.position.length(),
|
|
11913
|
-
O.lookAt(
|
|
11914
|
-
const
|
|
11915
|
-
|
|
11974
|
+
const P = i.position.length(), C = x.clone().multiplyScalar(P), M = 400, O = new w.Matrix4();
|
|
11975
|
+
O.lookAt(C, new w.Vector3(0, 0, 0), new w.Vector3(0, 1, 0));
|
|
11976
|
+
const I = new w.Quaternion();
|
|
11977
|
+
I.setFromRotationMatrix(O), i.quaternion.copy(I), td(
|
|
11916
11978
|
i,
|
|
11917
11979
|
e,
|
|
11918
11980
|
i.position.clone(),
|
|
11919
|
-
|
|
11981
|
+
C,
|
|
11920
11982
|
M,
|
|
11921
|
-
|
|
11983
|
+
S
|
|
11922
11984
|
), i.up.set(0, 1, 0), i.lookAt(new w.Vector3(0, 0, 0)), e.target.set(0, 0, 0), e.update();
|
|
11923
11985
|
},
|
|
11924
|
-
[i, e,
|
|
11925
|
-
), { onMouseDown:
|
|
11986
|
+
[i, e, S, r]
|
|
11987
|
+
), { onMouseDown: A, onMouseMove: E, onMouseUp: T, onMouseLeave: b } = kd({
|
|
11926
11988
|
gizmoRenderer: a,
|
|
11927
11989
|
gizmoScene: r,
|
|
11928
11990
|
gizmoCamera: f,
|
|
@@ -11930,45 +11992,45 @@ const kd = ({
|
|
|
11930
11992
|
gizmoControlRef: y
|
|
11931
11993
|
});
|
|
11932
11994
|
return rt(() => {
|
|
11933
|
-
const
|
|
11934
|
-
if (!
|
|
11995
|
+
const x = o.current;
|
|
11996
|
+
if (!x || !i || !e || !a) return;
|
|
11935
11997
|
y.current && y.current.dispose();
|
|
11936
11998
|
const P = {
|
|
11937
|
-
gizmoDiv:
|
|
11999
|
+
gizmoDiv: x,
|
|
11938
12000
|
gizmoScene: r,
|
|
11939
12001
|
gizmoRenderer: a,
|
|
11940
12002
|
gizmoCamera: f
|
|
11941
|
-
},
|
|
12003
|
+
}, C = {
|
|
11942
12004
|
mainCamera: i,
|
|
11943
12005
|
mainControls: e,
|
|
11944
|
-
renderGizmo:
|
|
12006
|
+
renderGizmo: S
|
|
11945
12007
|
}, M = {
|
|
11946
12008
|
syncGizmoCameraWithMain: po,
|
|
11947
|
-
syncMainCameraWithGizmo:
|
|
12009
|
+
syncMainCameraWithGizmo: Ed
|
|
11948
12010
|
};
|
|
11949
|
-
return y.current = new
|
|
12011
|
+
return y.current = new vd({
|
|
11950
12012
|
gizmoParams: P,
|
|
11951
|
-
mainParams:
|
|
12013
|
+
mainParams: C,
|
|
11952
12014
|
syncFunctions: M,
|
|
11953
12015
|
options: s
|
|
11954
|
-
}),
|
|
11955
|
-
y.current && (y.current.dispose(), y.current = null),
|
|
12016
|
+
}), x.addEventListener("mousedown", A), x.addEventListener("mousemove", E), x.addEventListener("mouseup", T), x.addEventListener("mouseleave", b), () => {
|
|
12017
|
+
y.current && (y.current.dispose(), y.current = null), x.removeEventListener("mousedown", A), x.removeEventListener("mousemove", E), x.removeEventListener("mouseup", T), x.removeEventListener("mouseleave", b);
|
|
11956
12018
|
};
|
|
11957
|
-
}, [i, e,
|
|
11958
|
-
i && (po(f, i, r),
|
|
11959
|
-
}, [i,
|
|
12019
|
+
}, [i, e, S, E, A, T]), rt(() => {
|
|
12020
|
+
i && (po(f, i, r), S());
|
|
12021
|
+
}, [i, S]), /* @__PURE__ */ Te(
|
|
11960
12022
|
"div",
|
|
11961
12023
|
{
|
|
11962
12024
|
className: t ? `${t}` : "gizmo-default",
|
|
11963
12025
|
ref: o
|
|
11964
12026
|
}
|
|
11965
12027
|
);
|
|
11966
|
-
},
|
|
11967
|
-
top: i.startsWith("top") ?
|
|
11968
|
-
bottom: i.startsWith("bottom") ?
|
|
11969
|
-
left: i.endsWith("left") ?
|
|
11970
|
-
right: i.endsWith("right") ?
|
|
11971
|
-
}),
|
|
12028
|
+
}, Fs = 10, zd = (i) => ({
|
|
12029
|
+
top: i.startsWith("top") ? Fs : "auto",
|
|
12030
|
+
bottom: i.startsWith("bottom") ? Fs : "auto",
|
|
12031
|
+
left: i.endsWith("left") ? Fs : "auto",
|
|
12032
|
+
right: i.endsWith("right") ? Fs : "auto"
|
|
12033
|
+
}), Bd = ({
|
|
11972
12034
|
camera: i,
|
|
11973
12035
|
controls: e,
|
|
11974
12036
|
render: t,
|
|
@@ -11987,10 +12049,10 @@ const kd = ({
|
|
|
11987
12049
|
width: s,
|
|
11988
12050
|
height: s,
|
|
11989
12051
|
zIndex: 1e3,
|
|
11990
|
-
...
|
|
12052
|
+
...zd(n)
|
|
11991
12053
|
},
|
|
11992
12054
|
children: /* @__PURE__ */ Te(
|
|
11993
|
-
|
|
12055
|
+
Fd,
|
|
11994
12056
|
{
|
|
11995
12057
|
camera: i,
|
|
11996
12058
|
controls: o,
|
|
@@ -12000,7 +12062,7 @@ const kd = ({
|
|
|
12000
12062
|
}
|
|
12001
12063
|
);
|
|
12002
12064
|
};
|
|
12003
|
-
class
|
|
12065
|
+
class Ud extends Ka {
|
|
12004
12066
|
constructor(e) {
|
|
12005
12067
|
super(e), this.reset = () => {
|
|
12006
12068
|
this.setState({ hasError: !1, error: null });
|
|
@@ -12032,7 +12094,7 @@ class Bd extends Ka {
|
|
|
12032
12094
|
] }) }) : this.props.children;
|
|
12033
12095
|
}
|
|
12034
12096
|
}
|
|
12035
|
-
function
|
|
12097
|
+
function Hd({ status: i, label: e, color: t, backdrop: n }) {
|
|
12036
12098
|
const s = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
12037
12099
|
return /* @__PURE__ */ Vn(
|
|
12038
12100
|
"div",
|
|
@@ -12082,14 +12144,14 @@ function Ud({ status: i, label: e, color: t, backdrop: n }) {
|
|
|
12082
12144
|
}
|
|
12083
12145
|
);
|
|
12084
12146
|
}
|
|
12085
|
-
const
|
|
12147
|
+
const jd = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif', Gd = {
|
|
12086
12148
|
background: "rgba(255,255,255,0.78)",
|
|
12087
12149
|
backdropFilter: "blur(16px)",
|
|
12088
12150
|
WebkitBackdropFilter: "blur(16px)",
|
|
12089
12151
|
border: "1px solid rgba(0,0,0,0.06)",
|
|
12090
12152
|
boxShadow: "0 8px 30px rgba(0,0,0,0.10)"
|
|
12091
|
-
},
|
|
12092
|
-
function
|
|
12153
|
+
}, Vd = Object.keys(sa);
|
|
12154
|
+
function Wd({ active: i, onSelect: e }) {
|
|
12093
12155
|
return /* @__PURE__ */ Te(
|
|
12094
12156
|
"div",
|
|
12095
12157
|
{
|
|
@@ -12110,9 +12172,9 @@ function Vd({ active: i, onSelect: e }) {
|
|
|
12110
12172
|
// instead of bleeding past the canvas edges.
|
|
12111
12173
|
maxWidth: "calc(100% - 16px)",
|
|
12112
12174
|
overflowX: "auto",
|
|
12113
|
-
...
|
|
12175
|
+
...Gd
|
|
12114
12176
|
},
|
|
12115
|
-
children:
|
|
12177
|
+
children: Vd.map((t) => /* @__PURE__ */ Te(
|
|
12116
12178
|
"button",
|
|
12117
12179
|
{
|
|
12118
12180
|
type: "button",
|
|
@@ -12127,7 +12189,7 @@ function Vd({ active: i, onSelect: e }) {
|
|
|
12127
12189
|
border: t === i ? "1px solid #111318" : "1px solid transparent",
|
|
12128
12190
|
background: t === i ? "#111318" : "transparent",
|
|
12129
12191
|
color: t === i ? "#fff" : "#3f3f4a",
|
|
12130
|
-
fontFamily:
|
|
12192
|
+
fontFamily: jd,
|
|
12131
12193
|
fontSize: 13,
|
|
12132
12194
|
fontWeight: 500,
|
|
12133
12195
|
lineHeight: 1,
|
|
@@ -12152,7 +12214,7 @@ const jn = {
|
|
|
12152
12214
|
// default light background (#f0f0f7) and dark studio mode.
|
|
12153
12215
|
backdrop: "rgba(15,16,20,0.6)"
|
|
12154
12216
|
};
|
|
12155
|
-
function
|
|
12217
|
+
function Zd(i) {
|
|
12156
12218
|
return i === void 0 || i === !0 ? jn : i === !1 ? { ...jn, enabled: !1 } : {
|
|
12157
12219
|
enabled: i.enabled ?? !0,
|
|
12158
12220
|
label: i.label ?? jn.label,
|
|
@@ -12161,42 +12223,42 @@ function Wd(i) {
|
|
|
12161
12223
|
backdrop: i.backdrop ?? jn.backdrop
|
|
12162
12224
|
};
|
|
12163
12225
|
}
|
|
12164
|
-
const
|
|
12226
|
+
const zs = () => new W("Viewer is not ready yet", K.COMPONENT_NOT_MOUNTED), da = mo(
|
|
12165
12227
|
({ object: i, options: e = {}, preset: t, pathTraced: n, turntable: s, animations: o, children: r }, a) => {
|
|
12166
12228
|
var D, H;
|
|
12167
|
-
const c = Ge(null), u = e.preset ?? t, { activePreset: d, pickerEnabled: h, selectPreset: p } =
|
|
12229
|
+
const c = Ge(null), u = e.preset ?? t, { activePreset: d, pickerEnabled: h, selectPreset: p } = Xu(
|
|
12168
12230
|
u,
|
|
12169
12231
|
e.ui
|
|
12170
|
-
), f =
|
|
12232
|
+
), f = Yu(
|
|
12171
12233
|
e,
|
|
12172
12234
|
d,
|
|
12173
12235
|
n,
|
|
12174
12236
|
s,
|
|
12175
12237
|
o
|
|
12176
|
-
), { viewer: y, isInitialized:
|
|
12177
|
-
|
|
12178
|
-
const T = y ? es(y.getCamera()) : null,
|
|
12238
|
+
), { viewer: y, isInitialized: S, initError: _ } = Ku(c, f), A = qu(y, S, i), E = $u(y);
|
|
12239
|
+
Qu(y, _, e);
|
|
12240
|
+
const T = y ? es(y.getCamera()) : null, b = y ? hr(y.getControls()) : null, x = y ? Xo(y.getRenderer()) : null, P = Rt(() => {
|
|
12179
12241
|
y == null || y.requestRender();
|
|
12180
|
-
}, [y]),
|
|
12181
|
-
() =>
|
|
12242
|
+
}, [y]), C = ((D = e.helpers) == null ? void 0 : D.gizmo) !== void 0 && e.helpers.gizmo !== !1, M = typeof ((H = e.helpers) == null ? void 0 : H.gizmo) == "object" ? e.helpers.gizmo : {}, O = Nt(
|
|
12243
|
+
() => Zd(e.loadingIndicator),
|
|
12182
12244
|
[e.loadingIndicator]
|
|
12183
|
-
),
|
|
12245
|
+
), I = A.status === "error" || !!_, k = O.enabled && (A.status === "loading" || I);
|
|
12184
12246
|
return Xa(a, () => ({
|
|
12185
12247
|
scene: y ? It(y.getScene()) : null,
|
|
12186
12248
|
camera: T,
|
|
12187
|
-
renderer:
|
|
12188
|
-
controls:
|
|
12249
|
+
renderer: x,
|
|
12250
|
+
controls: b,
|
|
12189
12251
|
events: E,
|
|
12190
12252
|
loadModel: async (G) => {
|
|
12191
12253
|
if (!y)
|
|
12192
|
-
throw
|
|
12254
|
+
throw zs();
|
|
12193
12255
|
const q = typeof G == "string" ? G : new Xe(G), ie = await y.loadModel(q);
|
|
12194
12256
|
if (!ie.ok)
|
|
12195
12257
|
throw ie.error;
|
|
12196
12258
|
},
|
|
12197
12259
|
captureStill: async (G) => {
|
|
12198
12260
|
if (!y)
|
|
12199
|
-
throw
|
|
12261
|
+
throw zs();
|
|
12200
12262
|
const q = await y.captureStill(G);
|
|
12201
12263
|
if (!q.ok)
|
|
12202
12264
|
throw q.error;
|
|
@@ -12204,7 +12266,7 @@ const Fs = () => new W("Viewer is not ready yet", K.COMPONENT_NOT_MOUNTED), da =
|
|
|
12204
12266
|
},
|
|
12205
12267
|
captureVideo: async (G) => {
|
|
12206
12268
|
if (!y)
|
|
12207
|
-
throw
|
|
12269
|
+
throw zs();
|
|
12208
12270
|
const q = await y.captureVideo(G);
|
|
12209
12271
|
if (!q.ok)
|
|
12210
12272
|
throw q.error;
|
|
@@ -12213,7 +12275,7 @@ const Fs = () => new W("Viewer is not ready yet", K.COMPONENT_NOT_MOUNTED), da =
|
|
|
12213
12275
|
getAnimationNames: () => (y == null ? void 0 : y.getAnimationNames()) ?? [],
|
|
12214
12276
|
playAnimations: (G) => {
|
|
12215
12277
|
if (!y)
|
|
12216
|
-
throw
|
|
12278
|
+
throw zs();
|
|
12217
12279
|
const q = y.playAnimations(G);
|
|
12218
12280
|
if (!q.ok)
|
|
12219
12281
|
throw q.error;
|
|
@@ -12224,40 +12286,40 @@ const Fs = () => new W("Viewer is not ready yet", K.COMPONENT_NOT_MOUNTED), da =
|
|
|
12224
12286
|
dispose: () => {
|
|
12225
12287
|
y == null || y.dispose();
|
|
12226
12288
|
}
|
|
12227
|
-
}), [y, T,
|
|
12228
|
-
/* @__PURE__ */ Te(
|
|
12229
|
-
|
|
12230
|
-
|
|
12289
|
+
}), [y, T, x, b, E]), /* @__PURE__ */ Te(Ud, { children: /* @__PURE__ */ Te(Ju, { viewer: y, canvasRef: c, children: /* @__PURE__ */ Vn("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
|
|
12290
|
+
/* @__PURE__ */ Te(ed, {}),
|
|
12291
|
+
C && S && T && b && /* @__PURE__ */ Te(
|
|
12292
|
+
Bd,
|
|
12231
12293
|
{
|
|
12232
12294
|
camera: T,
|
|
12233
|
-
controls:
|
|
12295
|
+
controls: b,
|
|
12234
12296
|
render: P,
|
|
12235
12297
|
placement: M.placement,
|
|
12236
12298
|
size: M.size
|
|
12237
12299
|
}
|
|
12238
12300
|
),
|
|
12239
12301
|
k && /* @__PURE__ */ Te(
|
|
12240
|
-
|
|
12302
|
+
Hd,
|
|
12241
12303
|
{
|
|
12242
|
-
status:
|
|
12243
|
-
label:
|
|
12304
|
+
status: I ? "error" : "loading",
|
|
12305
|
+
label: I ? O.errorLabel ?? (_ == null ? void 0 : _.message) ?? A.error ?? "Failed to load model" : O.label,
|
|
12244
12306
|
color: O.color,
|
|
12245
12307
|
backdrop: O.backdrop
|
|
12246
12308
|
}
|
|
12247
12309
|
),
|
|
12248
12310
|
h && /* The defaults ARE the studio look (pinned by presets.test.ts),
|
|
12249
12311
|
so with no preset set the studio chip is the honest active one. */
|
|
12250
|
-
/* @__PURE__ */ Te(
|
|
12312
|
+
/* @__PURE__ */ Te(Wd, { active: d ?? "studio", onSelect: p }),
|
|
12251
12313
|
r
|
|
12252
12314
|
] }) }) });
|
|
12253
12315
|
}
|
|
12254
12316
|
);
|
|
12255
12317
|
da.displayName = "SimpleViewer";
|
|
12256
|
-
const
|
|
12318
|
+
const Kd = mo(
|
|
12257
12319
|
(i, e) => /* @__PURE__ */ Te(da, { ref: e, ...i })
|
|
12258
12320
|
);
|
|
12259
|
-
|
|
12260
|
-
const
|
|
12321
|
+
Kd.displayName = "SimpleViewer";
|
|
12322
|
+
const Xd = () => /* @__PURE__ */ Te(
|
|
12261
12323
|
"span",
|
|
12262
12324
|
{
|
|
12263
12325
|
"aria-hidden": "true",
|
|
@@ -12272,7 +12334,7 @@ const Kd = () => /* @__PURE__ */ Te(
|
|
|
12272
12334
|
}
|
|
12273
12335
|
}
|
|
12274
12336
|
);
|
|
12275
|
-
function
|
|
12337
|
+
function tp({ position: i, occlude: e = !1, children: t }) {
|
|
12276
12338
|
const { viewer: n } = oa(), s = Ge(null), [o, r, a] = i;
|
|
12277
12339
|
rt(() => {
|
|
12278
12340
|
if (!n)
|
|
@@ -12296,13 +12358,13 @@ function ep({ position: i, occlude: e = !1, children: t }) {
|
|
|
12296
12358
|
d.invalidate(), p();
|
|
12297
12359
|
};
|
|
12298
12360
|
p();
|
|
12299
|
-
const y = n.getEvents(),
|
|
12361
|
+
const y = n.getEvents(), S = [
|
|
12300
12362
|
y.on("render:complete", p),
|
|
12301
12363
|
y.on("controls:change", p),
|
|
12302
12364
|
y.on("model:loaded", f)
|
|
12303
12365
|
];
|
|
12304
12366
|
return window.addEventListener("resize", f), () => {
|
|
12305
|
-
|
|
12367
|
+
S.forEach((_) => _()), window.removeEventListener("resize", f);
|
|
12306
12368
|
};
|
|
12307
12369
|
}, [n, o, r, a, e]);
|
|
12308
12370
|
const c = t != null && t !== !1;
|
|
@@ -12323,7 +12385,7 @@ function ep({ position: i, occlude: e = !1, children: t }) {
|
|
|
12323
12385
|
// interactive custom children keep receiving pointer events.
|
|
12324
12386
|
pointerEvents: c ? "auto" : "none"
|
|
12325
12387
|
},
|
|
12326
|
-
children: c ? t : /* @__PURE__ */ Te(
|
|
12388
|
+
children: c ? t : /* @__PURE__ */ Te(Xd, {})
|
|
12327
12389
|
}
|
|
12328
12390
|
);
|
|
12329
12391
|
}
|
|
@@ -12332,23 +12394,23 @@ export {
|
|
|
12332
12394
|
Qe as C,
|
|
12333
12395
|
Mr as D,
|
|
12334
12396
|
K as E,
|
|
12335
|
-
|
|
12397
|
+
tp as H,
|
|
12336
12398
|
De as I,
|
|
12337
|
-
|
|
12338
|
-
|
|
12399
|
+
Qd as L,
|
|
12400
|
+
Zs as M,
|
|
12339
12401
|
$e as O,
|
|
12340
12402
|
N as R,
|
|
12341
12403
|
ir as S,
|
|
12342
12404
|
tr as T,
|
|
12343
12405
|
sa as V,
|
|
12344
12406
|
or as a,
|
|
12345
|
-
|
|
12407
|
+
Jd as b,
|
|
12346
12408
|
zc as c,
|
|
12347
12409
|
Ko as d,
|
|
12348
12410
|
W as e,
|
|
12349
|
-
|
|
12411
|
+
Xs as f,
|
|
12350
12412
|
Qc as g,
|
|
12351
|
-
|
|
12413
|
+
Kd as h,
|
|
12352
12414
|
Wi as i,
|
|
12353
|
-
|
|
12415
|
+
Gu as r
|
|
12354
12416
|
};
|