softbox 4.5.0 → 4.6.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 +10 -1
- package/dist/{ThreePathTracingService-rw6SCxcL.cjs → ThreePathTracingService-DdrIay3N.cjs} +1 -1
- package/dist/{ThreePathTracingService-DDmobGTv.js → ThreePathTracingService-DlCiqA08.js} +1 -1
- package/dist/index-BA_1qZxy.cjs +11 -0
- package/dist/{index-CC3LzFRV.js → index-DoB8YjQ9.js} +1024 -979
- 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() {
|
|
@@ -4706,7 +4752,7 @@ class Wl {
|
|
|
4706
4752
|
u = new Ja(d), u.target.position.set(0, 0, -1), u.add(u.target);
|
|
4707
4753
|
break;
|
|
4708
4754
|
case "point":
|
|
4709
|
-
u = new
|
|
4755
|
+
u = new bo(d), u.distance = h;
|
|
4710
4756
|
break;
|
|
4711
4757
|
case "spot":
|
|
4712
4758
|
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 +5046,14 @@ class ah {
|
|
|
5000
5046
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((u) => {
|
|
5001
5047
|
const d = u.pop(), h = d.isGroup ? d.children : [d], p = u[0].count, f = [];
|
|
5002
5048
|
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
|
|
5049
|
+
const S = new ut(), _ = new $(), A = new An(), E = new $(1, 1, 1), T = new So(y.geometry, y.material, p);
|
|
5050
|
+
for (let b = 0; b < p; b++)
|
|
5051
|
+
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));
|
|
5052
|
+
for (const b in c)
|
|
5053
|
+
if (b === "_COLOR_0") {
|
|
5054
|
+
const x = c[b];
|
|
5055
|
+
T.instanceColor = new ec(x.array, x.itemSize, x.normalized);
|
|
5056
|
+
} else b !== "TRANSLATION" && b !== "ROTATION" && b !== "SCALE" && y.geometry.setAttribute(b, c[b]);
|
|
5011
5057
|
Ji.prototype.copy.call(T, y), this.parser.assignFinalMaterial(T), f.push(T);
|
|
5012
5058
|
}
|
|
5013
5059
|
return d.isGroup ? (d.clear(), d.add(...f), d) : f[0];
|
|
@@ -5061,7 +5107,7 @@ class lh {
|
|
|
5061
5107
|
for (const d in e.attributes) {
|
|
5062
5108
|
const h = Ui[d] || d.toLowerCase();
|
|
5063
5109
|
if (r[d] !== void 0) {
|
|
5064
|
-
const p = n.accessors[e.attributes[d]], f =
|
|
5110
|
+
const p = n.accessors[e.attributes[d]], f = bn[p.componentType];
|
|
5065
5111
|
u[h] = f.name, c[h] = p.normalized === !0;
|
|
5066
5112
|
}
|
|
5067
5113
|
}
|
|
@@ -5069,8 +5115,8 @@ class lh {
|
|
|
5069
5115
|
return new Promise(function(h, p) {
|
|
5070
5116
|
s.decodeDracoFile(d, function(f) {
|
|
5071
5117
|
for (const y in f.attributes) {
|
|
5072
|
-
const
|
|
5073
|
-
_ !== void 0 && (
|
|
5118
|
+
const S = f.attributes[y], _ = c[y];
|
|
5119
|
+
_ !== void 0 && (S.normalized = _);
|
|
5074
5120
|
}
|
|
5075
5121
|
h(f);
|
|
5076
5122
|
}, a, u, je, p);
|
|
@@ -5102,10 +5148,10 @@ class jo extends _c {
|
|
|
5102
5148
|
return t;
|
|
5103
5149
|
}
|
|
5104
5150
|
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[
|
|
5151
|
+
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;
|
|
5152
|
+
for (let b = 0; b !== a; b++) {
|
|
5153
|
+
const x = r[S + b + a], P = r[S + b + c] * d, C = r[y + b + a], M = r[y + b] * d;
|
|
5154
|
+
o[b] = E * x + T * P + _ * C + A * M;
|
|
5109
5155
|
}
|
|
5110
5156
|
return o;
|
|
5111
5157
|
}
|
|
@@ -5125,7 +5171,7 @@ const ct = {
|
|
|
5125
5171
|
TRIANGLES: 4,
|
|
5126
5172
|
TRIANGLE_STRIP: 5,
|
|
5127
5173
|
TRIANGLE_FAN: 6
|
|
5128
|
-
},
|
|
5174
|
+
}, bn = {
|
|
5129
5175
|
5120: Int8Array,
|
|
5130
5176
|
5121: Uint8Array,
|
|
5131
5177
|
5122: Int16Array,
|
|
@@ -5143,7 +5189,7 @@ const ct = {
|
|
|
5143
5189
|
33071: lc,
|
|
5144
5190
|
33648: cc,
|
|
5145
5191
|
10497: Ri
|
|
5146
|
-
},
|
|
5192
|
+
}, fi = {
|
|
5147
5193
|
SCALAR: 1,
|
|
5148
5194
|
VEC2: 2,
|
|
5149
5195
|
VEC3: 3,
|
|
@@ -5173,13 +5219,13 @@ const ct = {
|
|
|
5173
5219
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
5174
5220
|
LINEAR: vo,
|
|
5175
5221
|
STEP: Tc
|
|
5176
|
-
},
|
|
5222
|
+
}, mi = {
|
|
5177
5223
|
OPAQUE: "OPAQUE",
|
|
5178
5224
|
MASK: "MASK",
|
|
5179
5225
|
BLEND: "BLEND"
|
|
5180
5226
|
};
|
|
5181
5227
|
function mh(i) {
|
|
5182
|
-
return i.DefaultMaterial === void 0 && (i.DefaultMaterial = new
|
|
5228
|
+
return i.DefaultMaterial === void 0 && (i.DefaultMaterial = new js({
|
|
5183
5229
|
color: 16777215,
|
|
5184
5230
|
emissive: 0,
|
|
5185
5231
|
metalness: 1,
|
|
@@ -5245,12 +5291,12 @@ function yh(i, e) {
|
|
|
5245
5291
|
function wh(i) {
|
|
5246
5292
|
let e;
|
|
5247
5293
|
const t = i.extensions && i.extensions[ce.KHR_DRACO_MESH_COMPRESSION];
|
|
5248
|
-
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" +
|
|
5294
|
+
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + gi(t.attributes) : e = i.indices + ":" + gi(i.attributes) + ":" + i.mode, i.targets !== void 0)
|
|
5249
5295
|
for (let n = 0, s = i.targets.length; n < s; n++)
|
|
5250
|
-
e += ":" +
|
|
5296
|
+
e += ":" + gi(i.targets[n]);
|
|
5251
5297
|
return e;
|
|
5252
5298
|
}
|
|
5253
|
-
function
|
|
5299
|
+
function gi(i) {
|
|
5254
5300
|
let e = "";
|
|
5255
5301
|
const t = Object.keys(i).sort();
|
|
5256
5302
|
for (let n = 0, s = t.length; n < s; n++)
|
|
@@ -5525,25 +5571,25 @@ class _h {
|
|
|
5525
5571
|
loadAccessor(e) {
|
|
5526
5572
|
const t = this, n = this.json, s = this.json.accessors[e];
|
|
5527
5573
|
if (s.bufferView === void 0 && s.sparse === void 0) {
|
|
5528
|
-
const r =
|
|
5574
|
+
const r = fi[s.type], a = bn[s.componentType], c = s.normalized === !0, u = new a(s.count * r);
|
|
5529
5575
|
return Promise.resolve(new Wn(u, r, c));
|
|
5530
5576
|
}
|
|
5531
5577
|
const o = [];
|
|
5532
5578
|
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
|
|
5579
|
+
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;
|
|
5580
|
+
let S, _;
|
|
5535
5581
|
if (f && f !== h) {
|
|
5536
|
-
const
|
|
5582
|
+
const A = Math.floor(p / f), E = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + A + ":" + s.count;
|
|
5537
5583
|
let T = t.cache.get(E);
|
|
5538
|
-
T || (
|
|
5584
|
+
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
5585
|
} else
|
|
5540
|
-
a === null ?
|
|
5586
|
+
a === null ? S = new u(s.count * c) : S = new u(a, p, s.count * c), _ = new Wn(S, c, y);
|
|
5541
5587
|
if (s.sparse !== void 0) {
|
|
5542
|
-
const
|
|
5588
|
+
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
5589
|
a !== null && (_ = new Wn(_.array.slice(), _.itemSize, _.normalized)), _.normalized = !1;
|
|
5544
|
-
for (let
|
|
5545
|
-
const O =
|
|
5546
|
-
if (_.setX(O, P[
|
|
5590
|
+
for (let C = 0, M = x.length; C < M; C++) {
|
|
5591
|
+
const O = x[C];
|
|
5592
|
+
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
5593
|
}
|
|
5548
5594
|
_.normalized = y;
|
|
5549
5595
|
}
|
|
@@ -5596,8 +5642,8 @@ class _h {
|
|
|
5596
5642
|
const d = Promise.resolve(c).then(function(h) {
|
|
5597
5643
|
return new Promise(function(p, f) {
|
|
5598
5644
|
let y = p;
|
|
5599
|
-
t.isImageBitmapLoader === !0 && (y = function(
|
|
5600
|
-
const _ = new
|
|
5645
|
+
t.isImageBitmapLoader === !0 && (y = function(S) {
|
|
5646
|
+
const _ = new Sr(S);
|
|
5601
5647
|
_.needsUpdate = !0, p(_);
|
|
5602
5648
|
}), t.load(Zn.resolveURL(h, o.path), y, void 0, f);
|
|
5603
5649
|
});
|
|
@@ -5649,11 +5695,11 @@ class _h {
|
|
|
5649
5695
|
if (e.isPoints) {
|
|
5650
5696
|
const a = "PointsMaterial:" + n.uuid;
|
|
5651
5697
|
let c = this.cache.get(a);
|
|
5652
|
-
c || (c = new hc(),
|
|
5698
|
+
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
5699
|
} else if (e.isLine) {
|
|
5654
5700
|
const a = "LineBasicMaterial:" + n.uuid;
|
|
5655
5701
|
let c = this.cache.get(a);
|
|
5656
|
-
c || (c = new uc(),
|
|
5702
|
+
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
5703
|
}
|
|
5658
5704
|
if (s || o || r) {
|
|
5659
5705
|
let a = "ClonedMaterial:" + n.uuid + ":";
|
|
@@ -5664,7 +5710,7 @@ class _h {
|
|
|
5664
5710
|
e.material = n;
|
|
5665
5711
|
}
|
|
5666
5712
|
getMaterialType() {
|
|
5667
|
-
return
|
|
5713
|
+
return js;
|
|
5668
5714
|
}
|
|
5669
5715
|
/**
|
|
5670
5716
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -5693,8 +5739,8 @@ class _h {
|
|
|
5693
5739
|
})));
|
|
5694
5740
|
}
|
|
5695
5741
|
o.doubleSided === !0 && (a.side = yo);
|
|
5696
|
-
const d = o.alphaMode ||
|
|
5697
|
-
if (d ===
|
|
5742
|
+
const d = o.alphaMode || mi.OPAQUE;
|
|
5743
|
+
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
5744
|
const h = o.normalTexture.scale;
|
|
5699
5745
|
a.normalScale.set(h, h);
|
|
5700
5746
|
}
|
|
@@ -5762,22 +5808,22 @@ class _h {
|
|
|
5762
5808
|
return a.push(t.loadGeometries(r)), Promise.all(a).then(function(c) {
|
|
5763
5809
|
const u = c.slice(0, c.length - 1), d = c[c.length - 1], h = [];
|
|
5764
5810
|
for (let f = 0, y = d.length; f < y; f++) {
|
|
5765
|
-
const
|
|
5766
|
-
let
|
|
5811
|
+
const S = d[f], _ = r[f];
|
|
5812
|
+
let A;
|
|
5767
5813
|
const E = u[f];
|
|
5768
5814
|
if (_.mode === ct.TRIANGLES || _.mode === ct.TRIANGLE_STRIP || _.mode === ct.TRIANGLE_FAN || _.mode === void 0)
|
|
5769
|
-
|
|
5815
|
+
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
5816
|
else if (_.mode === ct.LINES)
|
|
5771
|
-
|
|
5817
|
+
A = new Yi(S, E);
|
|
5772
5818
|
else if (_.mode === ct.LINE_STRIP)
|
|
5773
|
-
|
|
5819
|
+
A = new $i(S, E);
|
|
5774
5820
|
else if (_.mode === ct.LINE_LOOP)
|
|
5775
|
-
|
|
5821
|
+
A = new qi(S, E);
|
|
5776
5822
|
else if (_.mode === ct.POINTS)
|
|
5777
|
-
|
|
5823
|
+
A = new Qi(S, E);
|
|
5778
5824
|
else
|
|
5779
5825
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + _.mode);
|
|
5780
|
-
Object.keys(
|
|
5826
|
+
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
5827
|
}
|
|
5782
5828
|
for (let f = 0, y = h.length; f < y; f++)
|
|
5783
5829
|
t.associations.set(h[f], {
|
|
@@ -5786,7 +5832,7 @@ class _h {
|
|
|
5786
5832
|
});
|
|
5787
5833
|
if (h.length === 1)
|
|
5788
5834
|
return o.extensions && en(s, h[0], o), h[0];
|
|
5789
|
-
const p = new
|
|
5835
|
+
const p = new ni();
|
|
5790
5836
|
o.extensions && en(s, p, o), t.associations.set(p, { meshes: e });
|
|
5791
5837
|
for (let f = 0, y = h.length; f < y; f++)
|
|
5792
5838
|
p.add(h[f]);
|
|
@@ -5844,8 +5890,8 @@ class _h {
|
|
|
5844
5890
|
loadAnimation(e) {
|
|
5845
5891
|
const t = this.json, n = this, s = t.animations[e], o = s.name ? s.name : "animation_" + e, r = [], a = [], c = [], u = [], d = [];
|
|
5846
5892
|
for (let h = 0, p = s.channels.length; h < p; h++) {
|
|
5847
|
-
const f = s.channels[h], y = s.samplers[f.sampler],
|
|
5848
|
-
|
|
5893
|
+
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;
|
|
5894
|
+
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
5895
|
}
|
|
5850
5896
|
return Promise.all([
|
|
5851
5897
|
Promise.all(r),
|
|
@@ -5854,17 +5900,17 @@ class _h {
|
|
|
5854
5900
|
Promise.all(u),
|
|
5855
5901
|
Promise.all(d)
|
|
5856
5902
|
]).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,
|
|
5903
|
+
const p = h[0], f = h[1], y = h[2], S = h[3], _ = h[4], A = [];
|
|
5904
|
+
for (let T = 0, b = p.length; T < b; T++) {
|
|
5905
|
+
const x = p[T], P = f[T], C = y[T], M = S[T], O = _[T];
|
|
5906
|
+
if (x === void 0) continue;
|
|
5907
|
+
x.updateMatrix && x.updateMatrix();
|
|
5908
|
+
const I = n._createAnimationTracks(x, P, C, M, O);
|
|
5909
|
+
if (I)
|
|
5910
|
+
for (let k = 0; k < I.length; k++)
|
|
5911
|
+
A.push(I[k]);
|
|
5912
|
+
}
|
|
5913
|
+
const E = new wc(o, void 0, A);
|
|
5868
5914
|
return vt(E, s), E;
|
|
5869
5915
|
});
|
|
5870
5916
|
}
|
|
@@ -5926,7 +5972,7 @@ class _h {
|
|
|
5926
5972
|
a.push(u);
|
|
5927
5973
|
}), this.nodeCache[e] = Promise.all(a).then(function(u) {
|
|
5928
5974
|
let d;
|
|
5929
|
-
if (o.isBone === !0 ? d = new Ec() : u.length > 1 ? d = new
|
|
5975
|
+
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
5976
|
for (let h = 0, p = u.length; h < p; h++)
|
|
5931
5977
|
d.add(u[h]);
|
|
5932
5978
|
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 +5997,7 @@ class _h {
|
|
|
5951
5997
|
* @return {Promise<Group>}
|
|
5952
5998
|
*/
|
|
5953
5999
|
loadScene(e) {
|
|
5954
|
-
const t = this.extensions, n = this.json.scenes[e], s = this, o = new
|
|
6000
|
+
const t = this.extensions, n = this.json.scenes[e], s = this, o = new ni();
|
|
5955
6001
|
n.name && (o.name = s.createUniqueName(n.name)), vt(o, n), n.extensions && en(t, o, n);
|
|
5956
6002
|
const r = n.nodes || [], a = [];
|
|
5957
6003
|
for (let c = 0, u = r.length; c < u; c++)
|
|
@@ -5964,7 +6010,7 @@ class _h {
|
|
|
5964
6010
|
const u = (d) => {
|
|
5965
6011
|
const h = /* @__PURE__ */ new Map();
|
|
5966
6012
|
for (const [p, f] of s.associations)
|
|
5967
|
-
(p instanceof
|
|
6013
|
+
(p instanceof ti || p instanceof Sr) && h.set(p, f);
|
|
5968
6014
|
return d.traverse((p) => {
|
|
5969
6015
|
const f = s.associations.get(p);
|
|
5970
6016
|
f != null && h.set(p, f);
|
|
@@ -6006,13 +6052,13 @@ class _h {
|
|
|
6006
6052
|
}
|
|
6007
6053
|
const h = s.interpolation !== void 0 ? fh[s.interpolation] : vo, p = this._getArrayFromAccessor(n);
|
|
6008
6054
|
for (let f = 0, y = c.length; f < y; f++) {
|
|
6009
|
-
const
|
|
6055
|
+
const S = new d(
|
|
6010
6056
|
c[f] + "." + Ht[o.path],
|
|
6011
6057
|
t.array,
|
|
6012
6058
|
p,
|
|
6013
6059
|
h
|
|
6014
6060
|
);
|
|
6015
|
-
s.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(
|
|
6061
|
+
s.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(S), r.push(S);
|
|
6016
6062
|
}
|
|
6017
6063
|
return r;
|
|
6018
6064
|
}
|
|
@@ -6033,7 +6079,7 @@ class _h {
|
|
|
6033
6079
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
6034
6080
|
}
|
|
6035
6081
|
}
|
|
6036
|
-
function
|
|
6082
|
+
function bh(i, e, t) {
|
|
6037
6083
|
const n = e.attributes, s = new _t();
|
|
6038
6084
|
if (n.POSITION !== void 0) {
|
|
6039
6085
|
const a = t.json.accessors[n.POSITION], c = a.min, u = a.max;
|
|
@@ -6042,7 +6088,7 @@ function Sh(i, e, t) {
|
|
|
6042
6088
|
new $(c[0], c[1], c[2]),
|
|
6043
6089
|
new $(u[0], u[1], u[2])
|
|
6044
6090
|
), a.normalized) {
|
|
6045
|
-
const d = Hi(
|
|
6091
|
+
const d = Hi(bn[a.componentType]);
|
|
6046
6092
|
s.min.multiplyScalar(d), s.max.multiplyScalar(d);
|
|
6047
6093
|
}
|
|
6048
6094
|
} else {
|
|
@@ -6060,8 +6106,8 @@ function Sh(i, e, t) {
|
|
|
6060
6106
|
const p = t.json.accessors[h.POSITION], f = p.min, y = p.max;
|
|
6061
6107
|
if (f !== void 0 && y !== void 0) {
|
|
6062
6108
|
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(
|
|
6109
|
+
const S = Hi(bn[p.componentType]);
|
|
6110
|
+
c.multiplyScalar(S);
|
|
6065
6111
|
}
|
|
6066
6112
|
a.max(c);
|
|
6067
6113
|
} else
|
|
@@ -6091,11 +6137,11 @@ function no(i, e, t) {
|
|
|
6091
6137
|
});
|
|
6092
6138
|
s.push(r);
|
|
6093
6139
|
}
|
|
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),
|
|
6140
|
+
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
6141
|
return e.targets !== void 0 ? gh(i, e.targets, t) : i;
|
|
6096
6142
|
});
|
|
6097
6143
|
}
|
|
6098
|
-
const
|
|
6144
|
+
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
6145
|
class vh {
|
|
6100
6146
|
constructor(e = {}) {
|
|
6101
6147
|
this.loadingManager = new w.LoadingManager(), this.loader = new Gl(this.loadingManager), this.config = e;
|
|
@@ -6233,7 +6279,7 @@ const io = { type: "change" }, lr = { type: "start" }, Vo = { type: "end" }, Ls
|
|
|
6233
6279
|
TOUCH_PAN: 4,
|
|
6234
6280
|
TOUCH_DOLLY_PAN: 5,
|
|
6235
6281
|
TOUCH_DOLLY_ROTATE: 6
|
|
6236
|
-
},
|
|
6282
|
+
}, yi = 1e-6;
|
|
6237
6283
|
class Wo extends Ro {
|
|
6238
6284
|
/**
|
|
6239
6285
|
* Constructs a new controls instance.
|
|
@@ -6242,7 +6288,7 @@ class Wo extends Ro {
|
|
|
6242
6288
|
* @param {?HTMLElement} domElement - The HTML element used for event listeners.
|
|
6243
6289
|
*/
|
|
6244
6290
|
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
|
|
6291
|
+
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
6292
|
}
|
|
6247
6293
|
/**
|
|
6248
6294
|
* Defines the visual representation of the cursor.
|
|
@@ -6391,7 +6437,7 @@ class Wo extends Ro {
|
|
|
6391
6437
|
const r = this.object.zoom;
|
|
6392
6438
|
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
6439
|
}
|
|
6394
|
-
return this._scale = 1, this._performCursorZoom = !1, o || this._lastPosition.distanceToSquared(this.object.position) >
|
|
6440
|
+
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
6441
|
}
|
|
6396
6442
|
_getAutoRotationAngle(e) {
|
|
6397
6443
|
return e !== null ? tt / 60 * this.autoRotateSpeed * e : tt / 60 / 60 * this.autoRotateSpeed;
|
|
@@ -6731,16 +6777,16 @@ function zh(i) {
|
|
|
6731
6777
|
function Bh(i) {
|
|
6732
6778
|
i.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
6733
6779
|
}
|
|
6734
|
-
const
|
|
6780
|
+
const wi = new Jn(), Os = new bc(), gn = new fe(), Ei = new $();
|
|
6735
6781
|
class Uh extends Wo {
|
|
6736
6782
|
constructor(e, t) {
|
|
6737
6783
|
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
6784
|
}
|
|
6739
6785
|
_handleMouseDownPan(e) {
|
|
6740
6786
|
if (super._handleMouseDownPan(e), this._panOffset.set(0, 0, 0), this.screenSpacePanning === !0) return;
|
|
6741
|
-
|
|
6787
|
+
wi.setFromNormalAndCoplanarPoint(this.object.up, this.target);
|
|
6742
6788
|
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(
|
|
6789
|
+
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
6790
|
}
|
|
6745
6791
|
_handleMouseMovePan(e) {
|
|
6746
6792
|
if (this.screenSpacePanning === !0) {
|
|
@@ -6748,7 +6794,7 @@ class Uh extends Wo {
|
|
|
6748
6794
|
return;
|
|
6749
6795
|
}
|
|
6750
6796
|
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(
|
|
6797
|
+
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
6798
|
}
|
|
6753
6799
|
}
|
|
6754
6800
|
class Zo {
|
|
@@ -6910,7 +6956,7 @@ class jh extends Zo {
|
|
|
6910
6956
|
set screenSpacePanning(e) {
|
|
6911
6957
|
}
|
|
6912
6958
|
}
|
|
6913
|
-
const ji = "contact-shadow-baked",
|
|
6959
|
+
const ji = "contact-shadow-baked", Sn = "contact-shadow-live", Ko = "softboxContactShadowHelper", oo = Math.PI * (3 - Math.sqrt(5)), xe = class xe {
|
|
6914
6960
|
constructor(e) {
|
|
6915
6961
|
this.explicitPasses = e == null ? void 0 : e.passes;
|
|
6916
6962
|
}
|
|
@@ -6923,7 +6969,7 @@ const ji = "contact-shadow-baked", bn = "contact-shadow-live", Ko = "softboxCont
|
|
|
6923
6969
|
const r = this.measureBakeRegion(s);
|
|
6924
6970
|
if (!r)
|
|
6925
6971
|
return;
|
|
6926
|
-
const a = n.getObjectByName(
|
|
6972
|
+
const a = n.getObjectByName(Sn);
|
|
6927
6973
|
(a == null ? void 0 : a.geometry) instanceof w.CircleGeometry && (r.halfExtent = Math.min(r.halfExtent, a.geometry.parameters.radius));
|
|
6928
6974
|
const c = new w.WebGLRenderTarget(
|
|
6929
6975
|
xe.ACCUMULATION_TEXTURE_SIZE,
|
|
@@ -6948,12 +6994,12 @@ const ji = "contact-shadow-baked", bn = "contact-shadow-live", Ko = "softboxCont
|
|
|
6948
6994
|
*/
|
|
6949
6995
|
leaveLiveCatcherInCharge(e) {
|
|
6950
6996
|
this.evictBakedMesh(e);
|
|
6951
|
-
const t = e.getObjectByName(
|
|
6997
|
+
const t = e.getObjectByName(Sn);
|
|
6952
6998
|
t && (t.visible = !0);
|
|
6953
6999
|
}
|
|
6954
7000
|
evictBakedMesh(e) {
|
|
6955
7001
|
const t = e.getObjectByName(ji);
|
|
6956
|
-
t && (e.remove(t),
|
|
7002
|
+
t && (e.remove(t), Qs(t));
|
|
6957
7003
|
}
|
|
6958
7004
|
measureBakeRegion(e) {
|
|
6959
7005
|
const t = new w.Box3().setFromObject(e);
|
|
@@ -6981,15 +7027,15 @@ const ji = "contact-shadow-baked", bn = "contact-shadow-live", Ko = "softboxCont
|
|
|
6981
7027
|
p.rotation.x = -Math.PI / 2, p.position.set(s.center.x, 0, s.center.z), p.receiveShadow = !0, a.add(p);
|
|
6982
7028
|
const f = this.createBakeCamera(s);
|
|
6983
7029
|
a.add(f);
|
|
6984
|
-
const y = e.getRenderTarget(),
|
|
7030
|
+
const y = e.getRenderTarget(), S = e.autoClear, _ = e.getClearColor(new w.Color()), A = e.getClearAlpha(), E = e.shadowMap.autoUpdate;
|
|
6985
7031
|
try {
|
|
6986
7032
|
e.shadowMap.autoUpdate = !0, e.setRenderTarget(o), e.setClearColor(0, 0), e.clear(!0, !1, !1), e.autoClear = !1;
|
|
6987
7033
|
const T = this.explicitPasses ?? this.measureAffordablePasses(e, a, f, n, d, o);
|
|
6988
7034
|
h.opacity = 1 / T;
|
|
6989
|
-
for (const
|
|
6990
|
-
d.position.copy(
|
|
7035
|
+
for (const b of this.sampleLightPositions(n, T))
|
|
7036
|
+
d.position.copy(b), e.render(a, f);
|
|
6991
7037
|
} finally {
|
|
6992
|
-
e.autoClear =
|
|
7038
|
+
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
7039
|
}
|
|
6994
7040
|
}
|
|
6995
7041
|
/**
|
|
@@ -7062,22 +7108,22 @@ const ji = "contact-shadow-baked", bn = "contact-shadow-live", Ko = "softboxCont
|
|
|
7062
7108
|
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
7109
|
c.lengthSq() < 1e-6 && c.set(1, 0, 0), c.normalize();
|
|
7064
7110
|
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((
|
|
7111
|
+
for (let A = 0; A < h; A++) {
|
|
7112
|
+
const E = f * Math.sqrt((A + 0.5) / h), T = A * oo;
|
|
7067
7113
|
y.push(
|
|
7068
7114
|
n.clone().addScaledVector(c, E * Math.cos(T)).addScaledVector(u, E * Math.sin(T))
|
|
7069
7115
|
);
|
|
7070
7116
|
}
|
|
7071
|
-
const
|
|
7117
|
+
const S = Math.sin(
|
|
7072
7118
|
w.MathUtils.degToRad(xe.AMBIENT_MIN_ELEVATION_DEGREES)
|
|
7073
7119
|
), _ = 0.98;
|
|
7074
|
-
for (let
|
|
7075
|
-
const E = Math.sqrt((
|
|
7120
|
+
for (let A = 0; A < d; A++) {
|
|
7121
|
+
const E = Math.sqrt((A + 0.5) / d), T = S + (_ - S) * E, b = Math.sqrt(1 - T * T), x = A * oo;
|
|
7076
7122
|
y.push(
|
|
7077
7123
|
new w.Vector3(
|
|
7078
|
-
|
|
7124
|
+
b * Math.cos(x),
|
|
7079
7125
|
T,
|
|
7080
|
-
|
|
7126
|
+
b * Math.sin(x)
|
|
7081
7127
|
).multiplyScalar(r).add(s)
|
|
7082
7128
|
);
|
|
7083
7129
|
}
|
|
@@ -7103,7 +7149,7 @@ const ji = "contact-shadow-baked", bn = "contact-shadow-live", Ko = "softboxCont
|
|
|
7103
7149
|
r.name = ji, r.userData[Ko] = !0, r.rotation.x = -Math.PI / 2;
|
|
7104
7150
|
const a = w.MathUtils.clamp(t.objectHeight * 25e-4, 2e-4, 0.01);
|
|
7105
7151
|
r.position.set(t.center.x, a, t.center.z), r.userData.renderTarget = n, e.add(r);
|
|
7106
|
-
const c = e.getObjectByName(
|
|
7152
|
+
const c = e.getObjectByName(Sn);
|
|
7107
7153
|
c && (c.visible = !1);
|
|
7108
7154
|
}
|
|
7109
7155
|
disableColorWrite(e) {
|
|
@@ -7181,13 +7227,13 @@ class Wh {
|
|
|
7181
7227
|
for (let h = -n; h <= n; h++) {
|
|
7182
7228
|
const p = Math.max(-n, -h - n), f = Math.min(n, -h + n);
|
|
7183
7229
|
for (let y = p; y <= f; y++) {
|
|
7184
|
-
const
|
|
7185
|
-
for (let
|
|
7186
|
-
const P =
|
|
7187
|
-
|
|
7230
|
+
const S = c * (h + y / 2), _ = u * 0.75 * y, A = [], E = Math.PI * 2 / 6;
|
|
7231
|
+
for (let x = 0; x <= 6; x++) {
|
|
7232
|
+
const P = x * E + Math.PI / 6, C = S + s * Math.cos(P), M = _ + s * Math.sin(P);
|
|
7233
|
+
A.push(new w.Vector3(C, 0, M));
|
|
7188
7234
|
}
|
|
7189
|
-
const T = new w.BufferGeometry().setFromPoints(
|
|
7190
|
-
t.add(
|
|
7235
|
+
const T = new w.BufferGeometry().setFromPoints(A), b = new w.Line(T, a);
|
|
7236
|
+
t.add(b);
|
|
7191
7237
|
}
|
|
7192
7238
|
}
|
|
7193
7239
|
return t;
|
|
@@ -7326,18 +7372,18 @@ class Xh {
|
|
|
7326
7372
|
this.name = "Hexagonal Glass Grid";
|
|
7327
7373
|
}
|
|
7328
7374
|
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 = ((
|
|
7375
|
+
var y, S, _, A, E, T, b;
|
|
7376
|
+
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
7377
|
metalness: (_ = e.styleOptions) == null ? void 0 : _.metalness,
|
|
7332
|
-
roughness: (
|
|
7378
|
+
roughness: (A = e.styleOptions) == null ? void 0 : A.roughness,
|
|
7333
7379
|
transmission: (E = e.styleOptions) == null ? void 0 : E.transmission,
|
|
7334
7380
|
thickness: (T = e.styleOptions) == null ? void 0 : T.thickness,
|
|
7335
|
-
ior: (
|
|
7381
|
+
ior: (b = e.styleOptions) == null ? void 0 : b.ior
|
|
7336
7382
|
}), 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 * (
|
|
7383
|
+
for (let x = -n; x <= n; x++) {
|
|
7384
|
+
const P = Math.max(-n, -x - n), C = Math.min(n, -x + n);
|
|
7385
|
+
for (let M = P; M <= C; M++)
|
|
7386
|
+
p.push(new w.Vector3(a * (x + M / 2), h, c * 0.75 * M));
|
|
7341
7387
|
}
|
|
7342
7388
|
const f = new w.Mesh(
|
|
7343
7389
|
Kh(d, p),
|
|
@@ -7350,7 +7396,7 @@ class Xh {
|
|
|
7350
7396
|
new w.CircleGeometry(Math.max(e, 1), 64),
|
|
7351
7397
|
new w.ShadowMaterial({ opacity: 0.35 })
|
|
7352
7398
|
);
|
|
7353
|
-
return t.name =
|
|
7399
|
+
return t.name = Sn, t.userData[Ko] = !0, t.rotation.x = -Math.PI / 2, t.position.y = 2e-3, t.receiveShadow = !0, t;
|
|
7354
7400
|
}
|
|
7355
7401
|
dispose() {
|
|
7356
7402
|
}
|
|
@@ -7360,22 +7406,22 @@ class Yh {
|
|
|
7360
7406
|
this.name = "Stone Tile Grid", this.textureLoader = new w.TextureLoader();
|
|
7361
7407
|
}
|
|
7362
7408
|
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
|
|
7409
|
+
var f, y, S, _;
|
|
7410
|
+
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);
|
|
7411
|
+
for (let A = 0; A < s; A++)
|
|
7366
7412
|
for (let E = 0; E < s; E++) {
|
|
7367
|
-
const T = (
|
|
7368
|
-
P.moveTo(-
|
|
7413
|
+
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;
|
|
7414
|
+
P.moveTo(-C, -C), P.lineTo(C, -C), P.lineTo(C, C), P.lineTo(-C, C), P.closePath();
|
|
7369
7415
|
const M = {
|
|
7370
|
-
depth:
|
|
7416
|
+
depth: x,
|
|
7371
7417
|
bevelEnabled: !0,
|
|
7372
7418
|
bevelSize: u,
|
|
7373
7419
|
bevelThickness: u,
|
|
7374
7420
|
bevelSegments: 2
|
|
7375
7421
|
}, O = new w.ExtrudeGeometry(P, M);
|
|
7376
7422
|
O.rotateX(-Math.PI / 2);
|
|
7377
|
-
const
|
|
7378
|
-
|
|
7423
|
+
const I = new w.Mesh(O, p);
|
|
7424
|
+
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
7425
|
}
|
|
7380
7426
|
return t;
|
|
7381
7427
|
}
|
|
@@ -7454,7 +7500,7 @@ dr.gridStyles = /* @__PURE__ */ new Map([
|
|
|
7454
7500
|
[Dt.HEXAGONAL_GLASS, new Xh()],
|
|
7455
7501
|
[Dt.STONE_TILES, new Yh()]
|
|
7456
7502
|
]);
|
|
7457
|
-
let
|
|
7503
|
+
let Ks = dr;
|
|
7458
7504
|
function qh(i, e) {
|
|
7459
7505
|
try {
|
|
7460
7506
|
const t = It(i);
|
|
@@ -7487,7 +7533,7 @@ function qh(i, e) {
|
|
|
7487
7533
|
tileSize: 1,
|
|
7488
7534
|
...o.styleOptions
|
|
7489
7535
|
}
|
|
7490
|
-
}, d =
|
|
7536
|
+
}, d = Ks.createGrid(r, u);
|
|
7491
7537
|
d.userData.isGrid = !0, d.userData.isDefaultGrid = !0, t.add(d);
|
|
7492
7538
|
}
|
|
7493
7539
|
}
|
|
@@ -7522,10 +7568,10 @@ function $h(i, e, t = 1.2) {
|
|
|
7522
7568
|
return N.ok(void 0);
|
|
7523
7569
|
const a = [];
|
|
7524
7570
|
s.traverse((M) => {
|
|
7525
|
-
var O,
|
|
7526
|
-
((O = M.userData) != null && O.isGrid || (
|
|
7571
|
+
var O, I, k;
|
|
7572
|
+
((O = M.userData) != null && O.isGrid || (I = M.userData) != null && I.isHexGrid || (k = M.userData) != null && k.isDefaultGrid) && a.push(M);
|
|
7527
7573
|
}), a.forEach((M) => {
|
|
7528
|
-
|
|
7574
|
+
Qs(M), s.remove(M);
|
|
7529
7575
|
});
|
|
7530
7576
|
const c = Ct(e);
|
|
7531
7577
|
if (!c)
|
|
@@ -7538,13 +7584,13 @@ function $h(i, e, t = 1.2) {
|
|
|
7538
7584
|
const u = new w.Box3().setFromObject(c), d = u.getSize(new w.Vector3());
|
|
7539
7585
|
if (u.isEmpty() || !Number.isFinite(d.x) || !Number.isFinite(d.z))
|
|
7540
7586
|
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,
|
|
7587
|
+
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;
|
|
7588
|
+
let _ = S <= y ? 0 : Math.ceil((S / y - 1) / 2);
|
|
7589
|
+
const A = 60;
|
|
7590
|
+
_ > A && (console.warn(
|
|
7591
|
+
`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.`
|
|
7592
|
+
), _ = A), S < y * 0.8 ? _ = 0 : _ < 3 && S > y * 2 && (_ = 3);
|
|
7593
|
+
const E = r.type || Dt.HEXAGONAL_GLASS, b = {
|
|
7548
7594
|
size: Math.max(d.x, d.z) * t,
|
|
7549
7595
|
divisions: _ * 2 + 1,
|
|
7550
7596
|
color: r.color,
|
|
@@ -7554,12 +7600,12 @@ function $h(i, e, t = 1.2) {
|
|
|
7554
7600
|
tileSize: p,
|
|
7555
7601
|
...r.styleOptions
|
|
7556
7602
|
}
|
|
7557
|
-
},
|
|
7558
|
-
|
|
7559
|
-
const P =
|
|
7603
|
+
}, x = Ks.createGrid(E, b);
|
|
7604
|
+
x.userData.isGrid = !0, x.userData.isHexGrid = !0;
|
|
7605
|
+
const P = x.getObjectByName(Sn);
|
|
7560
7606
|
P && (P.position.y = w.MathUtils.clamp(d.y * 25e-4, 2e-4, 2e-3));
|
|
7561
|
-
const
|
|
7562
|
-
return
|
|
7607
|
+
const C = u.getCenter(new w.Vector3());
|
|
7608
|
+
return x.position.set(C.x, 0, C.z), s.add(x), N.ok(void 0);
|
|
7563
7609
|
} catch (s) {
|
|
7564
7610
|
return N.err(
|
|
7565
7611
|
new W(
|
|
@@ -7589,12 +7635,12 @@ function Qh(i, e) {
|
|
|
7589
7635
|
)
|
|
7590
7636
|
);
|
|
7591
7637
|
const s = (T) => {
|
|
7592
|
-
var
|
|
7593
|
-
let
|
|
7594
|
-
for (;
|
|
7595
|
-
if ((
|
|
7638
|
+
var x, P, C;
|
|
7639
|
+
let b = T;
|
|
7640
|
+
for (; b; ) {
|
|
7641
|
+
if ((x = b.userData) != null && x.isGrid || (P = b.userData) != null && P.isHexGrid || (C = b.userData) != null && C.isDefaultGrid)
|
|
7596
7642
|
return !0;
|
|
7597
|
-
|
|
7643
|
+
b = b.parent;
|
|
7598
7644
|
}
|
|
7599
7645
|
return !1;
|
|
7600
7646
|
};
|
|
@@ -7617,20 +7663,20 @@ function Qh(i, e) {
|
|
|
7617
7663
|
const u = new w.Box3().setFromObject(n);
|
|
7618
7664
|
if (u.isEmpty() || !Number.isFinite(u.min.x) || !Number.isFinite(u.max.x))
|
|
7619
7665
|
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
|
-
|
|
7666
|
+
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);
|
|
7667
|
+
let A = 1 / 0;
|
|
7668
|
+
const E = (T, b, x, P) => {
|
|
7669
|
+
y.set(new w.Vector3(T, b, x), P);
|
|
7670
|
+
for (const C of y.intersectObjects(r, !1))
|
|
7671
|
+
C.point.y < A && (A = C.point.y);
|
|
7626
7672
|
};
|
|
7627
7673
|
for (let T = 0; T <= d; T++)
|
|
7628
|
-
for (let
|
|
7629
|
-
const
|
|
7630
|
-
E(
|
|
7674
|
+
for (let b = 0; b <= d; b++) {
|
|
7675
|
+
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);
|
|
7676
|
+
E(x, p, P, S), E(x, f, P, _);
|
|
7631
7677
|
}
|
|
7632
|
-
if (Number.isFinite(
|
|
7633
|
-
const T =
|
|
7678
|
+
if (Number.isFinite(A)) {
|
|
7679
|
+
const T = A - a;
|
|
7634
7680
|
Math.abs(T) > 1e-4 && (n.position.y -= T);
|
|
7635
7681
|
}
|
|
7636
7682
|
return N.ok(void 0);
|
|
@@ -7738,7 +7784,7 @@ function tu(i, e) {
|
|
|
7738
7784
|
K.INVALID_PARAMETER
|
|
7739
7785
|
)
|
|
7740
7786
|
);
|
|
7741
|
-
const n = t.getObjectByName(ji), s = t.getObjectByName(
|
|
7787
|
+
const n = t.getObjectByName(ji), s = t.getObjectByName(Sn);
|
|
7742
7788
|
return e === "baked" && !n || (n && (n.visible = e === "baked"), s && (s.visible = e === "live")), N.ok(void 0);
|
|
7743
7789
|
} catch (t) {
|
|
7744
7790
|
return N.err(
|
|
@@ -7892,8 +7938,8 @@ function ru(i, e, t) {
|
|
|
7892
7938
|
"fov" in s ? d = s.fov * (Math.PI / 180) : d = 50 * (Math.PI / 180);
|
|
7893
7939
|
let h = Math.abs(u / 2 / Math.tan(d / 2));
|
|
7894
7940
|
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,
|
|
7941
|
+
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);
|
|
7942
|
+
return s.position.set(y, S, _), s.lookAt(a), s.updateProjectionMatrix(), o.target && (o.target.copy(a), o.update()), N.ok(void 0);
|
|
7897
7943
|
} catch (n) {
|
|
7898
7944
|
return N.err(
|
|
7899
7945
|
new W(
|
|
@@ -7944,7 +7990,7 @@ class au {
|
|
|
7944
7990
|
this.events = new tr(), this.disposed = !1;
|
|
7945
7991
|
}
|
|
7946
7992
|
async initialize(e) {
|
|
7947
|
-
const { ThreePathTracingService: t } = await import("./ThreePathTracingService-
|
|
7993
|
+
const { ThreePathTracingService: t } = await import("./ThreePathTracingService-DlCiqA08.js");
|
|
7948
7994
|
if (this.disposed)
|
|
7949
7995
|
return N.ok(void 0);
|
|
7950
7996
|
const n = new t();
|
|
@@ -8075,9 +8121,9 @@ var lt = Uint8Array, _n = Uint16Array, cu = Int32Array, qo = new lt([
|
|
|
8075
8121
|
}, Jo = Qo(qo, 2), ea = Jo.b, hu = Jo.r;
|
|
8076
8122
|
ea[28] = 258, hu[258] = 28;
|
|
8077
8123
|
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[
|
|
8124
|
+
for (var be = 0; be < 32768; ++be) {
|
|
8125
|
+
var jt = (be & 43690) >> 1 | (be & 21845) << 1;
|
|
8126
|
+
jt = (jt & 52428) >> 2 | (jt & 13107) << 2, jt = (jt & 61680) >> 4 | (jt & 3855) << 4, Vi[be] = ((jt & 65280) >> 8 | (jt & 255) << 8) >> 1;
|
|
8081
8127
|
}
|
|
8082
8128
|
var Yn = (function(i, e, t) {
|
|
8083
8129
|
for (var n = i.length, s = 0, o = new _n(e); s < n; ++s)
|
|
@@ -8098,25 +8144,25 @@ var Yn = (function(i, e, t) {
|
|
|
8098
8144
|
i[s] && (a[s] = Vi[r[i[s] - 1]++] >> 15 - i[s]);
|
|
8099
8145
|
return a;
|
|
8100
8146
|
}), ts = new lt(288);
|
|
8101
|
-
for (var
|
|
8102
|
-
ts[
|
|
8103
|
-
for (var
|
|
8104
|
-
ts[
|
|
8105
|
-
for (var
|
|
8106
|
-
ts[
|
|
8107
|
-
for (var
|
|
8108
|
-
ts[
|
|
8147
|
+
for (var be = 0; be < 144; ++be)
|
|
8148
|
+
ts[be] = 8;
|
|
8149
|
+
for (var be = 144; be < 256; ++be)
|
|
8150
|
+
ts[be] = 9;
|
|
8151
|
+
for (var be = 256; be < 280; ++be)
|
|
8152
|
+
ts[be] = 7;
|
|
8153
|
+
for (var be = 280; be < 288; ++be)
|
|
8154
|
+
ts[be] = 8;
|
|
8109
8155
|
var ta = new lt(32);
|
|
8110
|
-
for (var
|
|
8111
|
-
ta[
|
|
8112
|
-
var pu = /* @__PURE__ */ Yn(ts, 9, 1), fu = /* @__PURE__ */ Yn(ta, 5, 1),
|
|
8156
|
+
for (var be = 0; be < 32; ++be)
|
|
8157
|
+
ta[be] = 5;
|
|
8158
|
+
var pu = /* @__PURE__ */ Yn(ts, 9, 1), fu = /* @__PURE__ */ Yn(ta, 5, 1), Ti = function(i) {
|
|
8113
8159
|
for (var e = i[0], t = 1; t < i.length; ++t)
|
|
8114
8160
|
i[t] > e && (e = i[t]);
|
|
8115
8161
|
return e;
|
|
8116
8162
|
}, mt = function(i, e, t) {
|
|
8117
8163
|
var n = e / 8 | 0;
|
|
8118
8164
|
return (i[n] | i[n + 1] << 8) >> (e & 7) & t;
|
|
8119
|
-
},
|
|
8165
|
+
}, _i = function(i, e) {
|
|
8120
8166
|
var t = e / 8 | 0;
|
|
8121
8167
|
return (i[t] | i[t + 1] << 8 | i[t + 2] << 16) >> (e & 7);
|
|
8122
8168
|
}, mu = function(i) {
|
|
@@ -8156,21 +8202,21 @@ var pu = /* @__PURE__ */ Yn(ts, 9, 1), fu = /* @__PURE__ */ Yn(ta, 5, 1), Ei = f
|
|
|
8156
8202
|
var ns = new lt(Math.max(Pt * 2, rn));
|
|
8157
8203
|
ns.set(t), t = ns;
|
|
8158
8204
|
}
|
|
8159
|
-
}, d = e.f || 0, h = e.p || 0, p = e.b || 0, f = e.l, y = e.d,
|
|
8205
|
+
}, 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
8206
|
do {
|
|
8161
8207
|
if (!f) {
|
|
8162
8208
|
d = mt(i, h, 1);
|
|
8163
8209
|
var E = mt(i, h + 1, 3);
|
|
8164
8210
|
if (h += 3, E)
|
|
8165
8211
|
if (E == 1)
|
|
8166
|
-
f = pu, y = fu,
|
|
8212
|
+
f = pu, y = fu, S = 9, _ = 5;
|
|
8167
8213
|
else if (E == 2) {
|
|
8168
|
-
var P = mt(i, h, 31) + 257,
|
|
8214
|
+
var P = mt(i, h, 31) + 257, C = mt(i, h + 10, 15) + 4, M = P + mt(i, h + 5, 31) + 1;
|
|
8169
8215
|
h += 14;
|
|
8170
|
-
for (var O = new lt(M),
|
|
8171
|
-
|
|
8172
|
-
h +=
|
|
8173
|
-
for (var D =
|
|
8216
|
+
for (var O = new lt(M), I = new lt(19), k = 0; k < C; ++k)
|
|
8217
|
+
I[lu[k]] = mt(i, h + k * 3, 7);
|
|
8218
|
+
h += C * 3;
|
|
8219
|
+
for (var D = Ti(I), H = (1 << D) - 1, G = Yn(I, D, 1), k = 0; k < M; ) {
|
|
8174
8220
|
var q = G[mt(i, h, H)];
|
|
8175
8221
|
h += q & 15;
|
|
8176
8222
|
var T = q >> 4;
|
|
@@ -8183,27 +8229,27 @@ var pu = /* @__PURE__ */ Yn(ts, 9, 1), fu = /* @__PURE__ */ Yn(ta, 5, 1), Ei = f
|
|
|
8183
8229
|
}
|
|
8184
8230
|
}
|
|
8185
8231
|
var dt = O.subarray(0, P), Me = O.subarray(P);
|
|
8186
|
-
|
|
8232
|
+
S = Ti(dt), _ = Ti(Me), f = Yn(dt, S, 1), y = Yn(Me, _, 1);
|
|
8187
8233
|
} else
|
|
8188
8234
|
yt(1);
|
|
8189
8235
|
else {
|
|
8190
|
-
var T = mu(h) + 4,
|
|
8191
|
-
if (
|
|
8236
|
+
var T = mu(h) + 4, b = i[T - 4] | i[T - 3] << 8, x = T + b;
|
|
8237
|
+
if (x > s) {
|
|
8192
8238
|
c && yt(0);
|
|
8193
8239
|
break;
|
|
8194
8240
|
}
|
|
8195
|
-
a && u(p +
|
|
8241
|
+
a && u(p + b), t.set(i.subarray(T, x), p), e.b = p += b, e.p = h = x * 8, e.f = d;
|
|
8196
8242
|
continue;
|
|
8197
8243
|
}
|
|
8198
|
-
if (h >
|
|
8244
|
+
if (h > A) {
|
|
8199
8245
|
c && yt(0);
|
|
8200
8246
|
break;
|
|
8201
8247
|
}
|
|
8202
8248
|
}
|
|
8203
8249
|
a && u(p + 131072);
|
|
8204
|
-
for (var Ue = (1 <<
|
|
8205
|
-
var ie = f[
|
|
8206
|
-
if (h += ie & 15, h >
|
|
8250
|
+
for (var Ue = (1 << S) - 1, Ve = (1 << _) - 1, ve = h; ; ve = h) {
|
|
8251
|
+
var ie = f[_i(i, h) & Ue], ge = ie >> 4;
|
|
8252
|
+
if (h += ie & 15, h > A) {
|
|
8207
8253
|
c && yt(0);
|
|
8208
8254
|
break;
|
|
8209
8255
|
}
|
|
@@ -8213,24 +8259,24 @@ var pu = /* @__PURE__ */ Yn(ts, 9, 1), fu = /* @__PURE__ */ Yn(ta, 5, 1), Ei = f
|
|
|
8213
8259
|
ve = h, f = null;
|
|
8214
8260
|
break;
|
|
8215
8261
|
} else {
|
|
8216
|
-
var
|
|
8262
|
+
var bt = ge - 254;
|
|
8217
8263
|
if (ge > 264) {
|
|
8218
8264
|
var k = ge - 257, We = qo[k];
|
|
8219
|
-
|
|
8265
|
+
bt = mt(i, h, (1 << We) - 1) + ea[k], h += We;
|
|
8220
8266
|
}
|
|
8221
|
-
var zt = y[
|
|
8267
|
+
var zt = y[_i(i, h) & Ve], me = zt >> 4;
|
|
8222
8268
|
zt || yt(3), h += zt & 15;
|
|
8223
8269
|
var Me = du[me];
|
|
8224
8270
|
if (me > 3) {
|
|
8225
8271
|
var We = $o[me];
|
|
8226
|
-
Me +=
|
|
8272
|
+
Me += _i(i, h) & (1 << We) - 1, h += We;
|
|
8227
8273
|
}
|
|
8228
|
-
if (h >
|
|
8274
|
+
if (h > A) {
|
|
8229
8275
|
c && yt(0);
|
|
8230
8276
|
break;
|
|
8231
8277
|
}
|
|
8232
8278
|
a && u(p + 131072);
|
|
8233
|
-
var pt = p +
|
|
8279
|
+
var pt = p + bt;
|
|
8234
8280
|
if (p < Me) {
|
|
8235
8281
|
var ft = o - Me, Rn = Math.min(Me, pt);
|
|
8236
8282
|
for (ft + p < 0 && yt(3); p < Rn; ++p)
|
|
@@ -8240,7 +8286,7 @@ var pu = /* @__PURE__ */ Yn(ts, 9, 1), fu = /* @__PURE__ */ Yn(ta, 5, 1), Ei = f
|
|
|
8240
8286
|
t[p] = t[p - Me];
|
|
8241
8287
|
}
|
|
8242
8288
|
}
|
|
8243
|
-
e.l = f, e.p = ve, e.b = p, e.f = d, f && (d = 1, e.m =
|
|
8289
|
+
e.l = f, e.p = ve, e.b = p, e.f = d, f && (d = 1, e.m = S, e.d = y, e.n = _);
|
|
8244
8290
|
} while (!d);
|
|
8245
8291
|
return p != t.length && r ? gu(t, 0, p) : t.subarray(0, p);
|
|
8246
8292
|
}, Eu = /* @__PURE__ */ new lt(0), Tu = function(i, e) {
|
|
@@ -8249,12 +8295,12 @@ var pu = /* @__PURE__ */ Yn(ts, 9, 1), fu = /* @__PURE__ */ Yn(ta, 5, 1), Ei = f
|
|
|
8249
8295
|
function Un(i, e) {
|
|
8250
8296
|
return wu(i.subarray(Tu(i), -4), { i: 2 }, e, e);
|
|
8251
8297
|
}
|
|
8252
|
-
var _u = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(),
|
|
8298
|
+
var _u = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), bu = 0;
|
|
8253
8299
|
try {
|
|
8254
|
-
_u.decode(Eu, { stream: !0 }),
|
|
8300
|
+
_u.decode(Eu, { stream: !0 }), bu = 1;
|
|
8255
8301
|
} catch {
|
|
8256
8302
|
}
|
|
8257
|
-
class
|
|
8303
|
+
class Su extends Mo {
|
|
8258
8304
|
/**
|
|
8259
8305
|
* Constructs a new EXR loader.
|
|
8260
8306
|
*
|
|
@@ -8271,7 +8317,7 @@ class bu extends Mo {
|
|
|
8271
8317
|
*/
|
|
8272
8318
|
parse(e) {
|
|
8273
8319
|
const O = Math.pow(2.7182818, 2.2);
|
|
8274
|
-
let
|
|
8320
|
+
let I = null;
|
|
8275
8321
|
function k(l, m) {
|
|
8276
8322
|
let g = 0;
|
|
8277
8323
|
for (let L = 0; L < 65536; ++L)
|
|
@@ -8370,7 +8416,7 @@ class bu extends Mo {
|
|
|
8370
8416
|
l = l << 8 | wr(g, R), m += 8, Ve.c = l, Ve.lc = m;
|
|
8371
8417
|
}
|
|
8372
8418
|
const ge = { c: 0, lc: 0 };
|
|
8373
|
-
function
|
|
8419
|
+
function bt(l, m, g, R, L, z, v, U, F) {
|
|
8374
8420
|
if (l == m) {
|
|
8375
8421
|
R < 8 && (ve(g, R, L, z), g = Ve.c, R = Ve.lc), R -= 8;
|
|
8376
8422
|
let B = g >> R;
|
|
@@ -8440,7 +8486,7 @@ class bu extends Mo {
|
|
|
8440
8486
|
for (ve(B, j, g, R), B = Ve.c, j = Ve.lc; j >= 14; ) {
|
|
8441
8487
|
const ee = B >> j - 14 & 16383, X = m[ee];
|
|
8442
8488
|
if (X.len)
|
|
8443
|
-
j -= X.len,
|
|
8489
|
+
j -= X.len, bt(X.lit, z, B, j, g, R, U, F, Z), B = ge.c, j = ge.lc;
|
|
8444
8490
|
else {
|
|
8445
8491
|
if (!X.p)
|
|
8446
8492
|
throw new Error("THREE.EXRLoader: hufDecode issues");
|
|
@@ -8450,7 +8496,7 @@ class bu extends Mo {
|
|
|
8450
8496
|
for (; j < re && R.value < V; )
|
|
8451
8497
|
ve(B, j, g, R), B = Ve.c, j = Ve.lc;
|
|
8452
8498
|
if (j >= re && Me(l[X.p[Q]]) == (B >> j - re & (1 << re) - 1)) {
|
|
8453
|
-
j -= re,
|
|
8499
|
+
j -= re, bt(X.p[Q], z, B, j, g, R, U, F, Z), B = ge.c, j = ge.lc;
|
|
8454
8500
|
break;
|
|
8455
8501
|
}
|
|
8456
8502
|
}
|
|
@@ -8462,7 +8508,7 @@ class bu extends Mo {
|
|
|
8462
8508
|
for (B >>= Y, j -= Y; j > 0; ) {
|
|
8463
8509
|
const ee = m[B << 14 - j & 16383];
|
|
8464
8510
|
if (ee.len)
|
|
8465
|
-
j -= ee.len,
|
|
8511
|
+
j -= ee.len, bt(ee.lit, z, B, j, g, R, U, F, Z), B = ge.c, j = ge.lc;
|
|
8466
8512
|
else
|
|
8467
8513
|
throw new Error("THREE.EXRLoader: hufDecode issues");
|
|
8468
8514
|
}
|
|
@@ -8497,7 +8543,7 @@ class bu extends Mo {
|
|
|
8497
8543
|
for (; !(L > z || (m[L++] = l[g++], L > z)); )
|
|
8498
8544
|
m[L++] = l[R++];
|
|
8499
8545
|
}
|
|
8500
|
-
function
|
|
8546
|
+
function Js(l) {
|
|
8501
8547
|
let m = l.byteLength;
|
|
8502
8548
|
const g = new Array();
|
|
8503
8549
|
let R = 0;
|
|
@@ -8549,8 +8595,8 @@ class bu extends Mo {
|
|
|
8549
8595
|
if (j != Z)
|
|
8550
8596
|
for (let Ce = 8 * te; Ce < 8 * te + se; ++Ce) {
|
|
8551
8597
|
const it = ue[ae][Ce] + 8 * j * 2 * he, _e = j * 64 + (Ce & 7) * 8;
|
|
8552
|
-
for (let
|
|
8553
|
-
v.setUint16(it +
|
|
8598
|
+
for (let St = 0; St < ye; ++St)
|
|
8599
|
+
v.setUint16(it + St * 2 * he, oe[ae][_e + St], !0);
|
|
8554
8600
|
}
|
|
8555
8601
|
}
|
|
8556
8602
|
}
|
|
@@ -8629,10 +8675,10 @@ class bu extends Mo {
|
|
|
8629
8675
|
return new DataView(l.array.buffer, l.offset.value, l.size);
|
|
8630
8676
|
}
|
|
8631
8677
|
function ya(l) {
|
|
8632
|
-
const m = l.viewer.buffer.slice(l.offset.value, l.offset.value + l.size), g = new Uint8Array(
|
|
8678
|
+
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
8679
|
return ss(g), is(g, R), new DataView(R.buffer);
|
|
8634
8680
|
}
|
|
8635
|
-
function
|
|
8681
|
+
function ei(l) {
|
|
8636
8682
|
const m = l.array.slice(l.offset.value, l.offset.value + l.size), g = Un(m), R = new Uint8Array(g.length);
|
|
8637
8683
|
return ss(g), is(g, R), new DataView(R.buffer);
|
|
8638
8684
|
}
|
|
@@ -8724,23 +8770,23 @@ class bu extends Mo {
|
|
|
8724
8770
|
const ne = m[g] << 8 | m[g + 1], te = ne & 32768 ? ne & 32767 : ~ne & 65535;
|
|
8725
8771
|
B.fill(te), g += 3;
|
|
8726
8772
|
} 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,
|
|
8773
|
+
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
8774
|
for (let an = 0; an < 16; an++)
|
|
8729
8775
|
B[an] = In[an] & 32768 ? In[an] & 32767 : ~In[an] & 65535;
|
|
8730
8776
|
g += 14;
|
|
8731
8777
|
}
|
|
8732
8778
|
if (V.pLinear) {
|
|
8733
|
-
if (
|
|
8734
|
-
|
|
8779
|
+
if (I === null) {
|
|
8780
|
+
I = new Uint16Array(65536);
|
|
8735
8781
|
for (let ne = 0; ne < 65536; ne++)
|
|
8736
8782
|
if ((ne & 31744) === 31744 || ne > 32768)
|
|
8737
|
-
|
|
8783
|
+
I[ne] = 0;
|
|
8738
8784
|
else {
|
|
8739
8785
|
const te = J(ne);
|
|
8740
|
-
|
|
8786
|
+
I[ne] = te <= 0 ? 0 : Et.toHalfFloat(8 * Math.log(te));
|
|
8741
8787
|
}
|
|
8742
8788
|
}
|
|
8743
|
-
for (let ne = 0; ne < 16; ne++) B[ne] =
|
|
8789
|
+
for (let ne = 0; ne < 16; ne++) B[ne] = I[B[ne]];
|
|
8744
8790
|
}
|
|
8745
8791
|
for (let ne = 0; ne < 4; ne++) {
|
|
8746
8792
|
const te = oe * 4 + ne;
|
|
@@ -8825,11 +8871,11 @@ class bu extends Mo {
|
|
|
8825
8871
|
offset: g,
|
|
8826
8872
|
size: L.dcCompressedSize
|
|
8827
8873
|
};
|
|
8828
|
-
Z = new Uint16Array(
|
|
8874
|
+
Z = new Uint16Array(ei(X).buffer), g.value += L.dcCompressedSize;
|
|
8829
8875
|
}
|
|
8830
8876
|
if (L.rleRawSize > 0) {
|
|
8831
8877
|
const X = l.array.slice(g.value, g.value + L.rleCompressedSize), Q = Un(X);
|
|
8832
|
-
V =
|
|
8878
|
+
V = Js(Q.buffer), g.value += L.rleCompressedSize;
|
|
8833
8879
|
}
|
|
8834
8880
|
let Y = 0;
|
|
8835
8881
|
const ee = new Array(F.length);
|
|
@@ -8880,11 +8926,11 @@ class bu extends Mo {
|
|
|
8880
8926
|
);
|
|
8881
8927
|
return m.value = m.value + g, R;
|
|
8882
8928
|
}
|
|
8883
|
-
function
|
|
8929
|
+
function ba(l, m) {
|
|
8884
8930
|
const g = et(l, m), R = st(l, m);
|
|
8885
8931
|
return [g, R];
|
|
8886
8932
|
}
|
|
8887
|
-
function
|
|
8933
|
+
function Sa(l, m) {
|
|
8888
8934
|
const g = st(l, m), R = st(l, m);
|
|
8889
8935
|
return [g, R];
|
|
8890
8936
|
}
|
|
@@ -9030,9 +9076,9 @@ class bu extends Mo {
|
|
|
9030
9076
|
if (R === "int")
|
|
9031
9077
|
return et(l, g);
|
|
9032
9078
|
if (R === "rational")
|
|
9033
|
-
return Sa(l, g);
|
|
9034
|
-
if (R === "timecode")
|
|
9035
9079
|
return ba(l, g);
|
|
9080
|
+
if (R === "timecode")
|
|
9081
|
+
return Sa(l, g);
|
|
9036
9082
|
if (R === "preview" || R === "deepImageState" || R === "idmanifest")
|
|
9037
9083
|
return g.value += L, "skipped";
|
|
9038
9084
|
g.value += L;
|
|
@@ -9145,7 +9191,7 @@ class bu extends Mo {
|
|
|
9145
9191
|
case "NO_COMPRESSION":
|
|
9146
9192
|
return new DataView(L.buffer, L.byteOffset, L.byteLength);
|
|
9147
9193
|
case "RLE_COMPRESSION": {
|
|
9148
|
-
const z = new Uint8Array(
|
|
9194
|
+
const z = new Uint8Array(Js(L.buffer.slice(L.byteOffset, L.byteOffset + L.byteLength))), v = new Uint8Array(z.length);
|
|
9149
9195
|
return ss(z), is(z, v), new DataView(v.buffer);
|
|
9150
9196
|
}
|
|
9151
9197
|
case "ZIPS_COMPRESSION": {
|
|
@@ -9190,17 +9236,17 @@ class bu extends Mo {
|
|
|
9190
9236
|
const he = new Float32Array(F);
|
|
9191
9237
|
let Ce = 0;
|
|
9192
9238
|
for (let _e = 0; _e < ae; _e++) {
|
|
9193
|
-
const
|
|
9239
|
+
const St = ye + _e, on = 1 - Ce;
|
|
9194
9240
|
if (on <= 0) break;
|
|
9195
9241
|
let Cn = 1;
|
|
9196
9242
|
if (j >= 0) {
|
|
9197
|
-
const xt = L[j].bytesPerSample, Yt = ue[j] +
|
|
9243
|
+
const xt = L[j].bytesPerSample, Yt = ue[j] + St * xt;
|
|
9198
9244
|
Cn = xt === 2 ? J(oe.getUint16(Yt, !0)) : oe.getFloat32(Yt, !0);
|
|
9199
9245
|
}
|
|
9200
9246
|
for (let xt = 0; xt < L.length; xt++) {
|
|
9201
9247
|
const Yt = L[xt], hs = U[Yt.name];
|
|
9202
9248
|
if (hs === void 0) continue;
|
|
9203
|
-
const us = Yt.bytesPerSample, ds = ue[xt] +
|
|
9249
|
+
const us = Yt.bytesPerSample, ds = ue[xt] + St * us, In = us === 2 ? J(oe.getUint16(ds, !0)) : oe.getFloat32(ds, !0);
|
|
9204
9250
|
he[hs] += In * on;
|
|
9205
9251
|
}
|
|
9206
9252
|
Ce += Cn * on;
|
|
@@ -9278,10 +9324,10 @@ class bu extends Mo {
|
|
|
9278
9324
|
v.blockHeight = 1, v.uncompress = ya;
|
|
9279
9325
|
break;
|
|
9280
9326
|
case "ZIPS_COMPRESSION":
|
|
9281
|
-
v.blockHeight = 1, v.uncompress =
|
|
9327
|
+
v.blockHeight = 1, v.uncompress = ei;
|
|
9282
9328
|
break;
|
|
9283
9329
|
case "ZIP_COMPRESSION":
|
|
9284
|
-
v.blockHeight = 16, v.uncompress =
|
|
9330
|
+
v.blockHeight = 16, v.uncompress = ei;
|
|
9285
9331
|
break;
|
|
9286
9332
|
case "PIZ_COMPRESSION":
|
|
9287
9333
|
v.blockHeight = 32, v.uncompress = wa;
|
|
@@ -9401,11 +9447,11 @@ class bu extends Mo {
|
|
|
9401
9447
|
}
|
|
9402
9448
|
return v;
|
|
9403
9449
|
}
|
|
9404
|
-
const as = { value: 0 }, cs = new DataView(e), Va = new Uint8Array(e), ls = ja(cs, e, as),
|
|
9450
|
+
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
9451
|
if (Ke.spec.multiPart || Ke.spec.deepFormat)
|
|
9406
9452
|
for (let l = 0; l < ls.length; l++) {
|
|
9407
9453
|
const m = ls[l].chunkCount;
|
|
9408
|
-
if (l ===
|
|
9454
|
+
if (l === br) {
|
|
9409
9455
|
Ke._chunkOffsets = [];
|
|
9410
9456
|
for (let g = 0; g < m; g++)
|
|
9411
9457
|
Ke._chunkOffsets.push(ke(cs, as));
|
|
@@ -9506,7 +9552,7 @@ class xu extends Mo {
|
|
|
9506
9552
|
case 4:
|
|
9507
9553
|
throw new Error("THREE.HDRLoader: Memory Error: " + (O || ""));
|
|
9508
9554
|
}
|
|
9509
|
-
}, h = function(M, O,
|
|
9555
|
+
}, h = function(M, O, I) {
|
|
9510
9556
|
O = O || 1024;
|
|
9511
9557
|
let D = M.pos, H = -1, G = 0, q = "", ie = String.fromCharCode.apply(null, new Uint16Array(M.subarray(D, D + 128)));
|
|
9512
9558
|
for (; 0 > (H = ie.indexOf(`
|
|
@@ -9514,7 +9560,7 @@ class xu extends Mo {
|
|
|
9514
9560
|
q += ie, G += ie.length, D += 128, ie = String.fromCharCode.apply(null, new Uint16Array(M.subarray(D, D + 128)));
|
|
9515
9561
|
return -1 < H ? (M.pos += G + H + 1, q + ie.slice(0, H)) : !1;
|
|
9516
9562
|
}, p = function(M) {
|
|
9517
|
-
const O = /^#\?(\S+)/,
|
|
9563
|
+
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
9564
|
valid: 0,
|
|
9519
9565
|
/* indicate which fields are valid */
|
|
9520
9566
|
string: "",
|
|
@@ -9542,10 +9588,10 @@ class xu extends Mo {
|
|
|
9542
9588
|
`;
|
|
9543
9589
|
continue;
|
|
9544
9590
|
}
|
|
9545
|
-
if ((ie = q.match(
|
|
9591
|
+
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
9592
|
}
|
|
9547
9593
|
return G.valid & 2 || r(3, "missing format specifier"), G.valid & 4 || r(3, "missing image size specifier"), G;
|
|
9548
|
-
}, f = function(M, O,
|
|
9594
|
+
}, f = function(M, O, I) {
|
|
9549
9595
|
const k = O;
|
|
9550
9596
|
if (
|
|
9551
9597
|
// run length encoding is not allowed so read flat
|
|
@@ -9554,11 +9600,11 @@ class xu extends Mo {
|
|
|
9554
9600
|
)
|
|
9555
9601
|
return new Uint8Array(M);
|
|
9556
9602
|
k !== (M[2] << 8 | M[3]) && r(3, "wrong scanline width");
|
|
9557
|
-
const D = new Uint8Array(4 * O *
|
|
9603
|
+
const D = new Uint8Array(4 * O * I);
|
|
9558
9604
|
D.length || r(4, "unable to allocate buffer space");
|
|
9559
9605
|
let H = 0, G = 0;
|
|
9560
9606
|
const q = 4 * k, ie = new Uint8Array(4), Ne = new Uint8Array(q);
|
|
9561
|
-
let dt =
|
|
9607
|
+
let dt = I;
|
|
9562
9608
|
for (; dt > 0 && G < M.byteLength; ) {
|
|
9563
9609
|
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
9610
|
let Me = 0, Ue;
|
|
@@ -9567,7 +9613,7 @@ class xu extends Mo {
|
|
|
9567
9613
|
const ve = Ue > 128;
|
|
9568
9614
|
if (ve && (Ue -= 128), (Ue === 0 || Me + Ue > q) && r(3, "bad scanline data"), ve) {
|
|
9569
9615
|
const ge = M[G++];
|
|
9570
|
-
for (let
|
|
9616
|
+
for (let bt = 0; bt < Ue; bt++)
|
|
9571
9617
|
Ne[Me++] = ge;
|
|
9572
9618
|
} else
|
|
9573
9619
|
Ne.set(M.subarray(G, G + Ue), Me), Me += Ue, G += Ue;
|
|
@@ -9580,30 +9626,30 @@ class xu extends Mo {
|
|
|
9580
9626
|
dt--;
|
|
9581
9627
|
}
|
|
9582
9628
|
return D;
|
|
9583
|
-
}, y = function(M, O,
|
|
9629
|
+
}, y = function(M, O, I, k) {
|
|
9584
9630
|
const D = M[O + 3], H = Math.pow(2, D - 128) / 255;
|
|
9585
|
-
|
|
9586
|
-
},
|
|
9631
|
+
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;
|
|
9632
|
+
}, S = function(M, O, I, k) {
|
|
9587
9633
|
const D = M[O + 3], H = Math.pow(2, D - 128) / 255;
|
|
9588
|
-
|
|
9634
|
+
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
9635
|
}, _ = new Uint8Array(e);
|
|
9590
9636
|
_.pos = 0;
|
|
9591
|
-
const
|
|
9592
|
-
let
|
|
9637
|
+
const A = p(_), E = A.width, T = A.height, b = f(_.subarray(_.pos), E, T);
|
|
9638
|
+
let x, P, C;
|
|
9593
9639
|
switch (this.type) {
|
|
9594
9640
|
case Kn:
|
|
9595
|
-
|
|
9596
|
-
const M = new Float32Array(
|
|
9597
|
-
for (let
|
|
9598
|
-
y(
|
|
9599
|
-
|
|
9641
|
+
C = b.length / 4;
|
|
9642
|
+
const M = new Float32Array(C * 4);
|
|
9643
|
+
for (let I = 0; I < C; I++)
|
|
9644
|
+
y(b, I * 4, M, I * 4);
|
|
9645
|
+
x = M, P = Kn;
|
|
9600
9646
|
break;
|
|
9601
9647
|
case Wt:
|
|
9602
|
-
|
|
9603
|
-
const O = new Uint16Array(
|
|
9604
|
-
for (let
|
|
9605
|
-
b
|
|
9606
|
-
|
|
9648
|
+
C = b.length / 4;
|
|
9649
|
+
const O = new Uint16Array(C * 4);
|
|
9650
|
+
for (let I = 0; I < C; I++)
|
|
9651
|
+
S(b, I * 4, O, I * 4);
|
|
9652
|
+
x = O, P = Wt;
|
|
9607
9653
|
break;
|
|
9608
9654
|
default:
|
|
9609
9655
|
throw new Error("THREE.HDRLoader: Unsupported type: " + this.type);
|
|
@@ -9611,10 +9657,10 @@ class xu extends Mo {
|
|
|
9611
9657
|
return {
|
|
9612
9658
|
width: E,
|
|
9613
9659
|
height: T,
|
|
9614
|
-
data:
|
|
9615
|
-
header:
|
|
9616
|
-
gamma:
|
|
9617
|
-
exposure:
|
|
9660
|
+
data: x,
|
|
9661
|
+
header: A.string,
|
|
9662
|
+
gamma: A.gamma,
|
|
9663
|
+
exposure: A.exposure,
|
|
9618
9664
|
type: P,
|
|
9619
9665
|
colorSpace: je,
|
|
9620
9666
|
minFilter: nn,
|
|
@@ -9638,16 +9684,16 @@ class Au extends xu {
|
|
|
9638
9684
|
console.warn("RGBELoader has been deprecated. Please use HDRLoader instead."), super(e);
|
|
9639
9685
|
}
|
|
9640
9686
|
}
|
|
9641
|
-
class vu extends
|
|
9687
|
+
class vu extends Sc {
|
|
9642
9688
|
constructor() {
|
|
9643
9689
|
super(), this.name = "RoomEnvironment", this.position.y = -3.5;
|
|
9644
9690
|
const e = new xc();
|
|
9645
9691
|
e.deleteAttribute("uv");
|
|
9646
|
-
const t = new
|
|
9692
|
+
const t = new js({ side: go }), n = new js(), s = new bo(16777215, 900, 28, 2);
|
|
9647
9693
|
s.position.set(0.418, 16.199, 0.3), this.add(s);
|
|
9648
9694
|
const o = new wt(e, t);
|
|
9649
9695
|
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
|
|
9696
|
+
const r = new So(e, n, 6), a = new Ji();
|
|
9651
9697
|
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
9698
|
const c = new wt(e, yn(50));
|
|
9653
9699
|
c.position.set(-16.116, 14.37, 8.208), c.scale.set(0.1, 2.428, 2.739), this.add(c);
|
|
@@ -9727,7 +9773,7 @@ class Ru {
|
|
|
9727
9773
|
o = new Au();
|
|
9728
9774
|
break;
|
|
9729
9775
|
case "exr":
|
|
9730
|
-
o = new
|
|
9776
|
+
o = new Su();
|
|
9731
9777
|
break;
|
|
9732
9778
|
case "jpg":
|
|
9733
9779
|
case "jpeg":
|
|
@@ -10115,7 +10161,7 @@ function Nu(i) {
|
|
|
10115
10161
|
!e && (((n = t.animations) == null ? void 0 : n.length) ?? 0) > 0 && (e = t);
|
|
10116
10162
|
}), e;
|
|
10117
10163
|
}
|
|
10118
|
-
var
|
|
10164
|
+
var Xs = /* @__PURE__ */ ((i) => (i.MapControls = "MapControls", i.OrbitControls = "OrbitControls", i))(Xs || {});
|
|
10119
10165
|
class ku {
|
|
10120
10166
|
static convertRendererOptions(e) {
|
|
10121
10167
|
const t = {
|
|
@@ -10159,7 +10205,7 @@ class Fu {
|
|
|
10159
10205
|
* Create a ViewerCore instance with Three.js implementations
|
|
10160
10206
|
*/
|
|
10161
10207
|
static createViewer(e, t) {
|
|
10162
|
-
var
|
|
10208
|
+
var A;
|
|
10163
10209
|
Co(t.units);
|
|
10164
10210
|
const n = new Hl(e), s = new zo(), o = this.createCamera(t), r = this.createControls(
|
|
10165
10211
|
o.getThreeCamera(),
|
|
@@ -10167,32 +10213,29 @@ class Fu {
|
|
|
10167
10213
|
t
|
|
10168
10214
|
), a = new zu().createDefaultLoader({
|
|
10169
10215
|
renderer: n.getThreeRenderer() ?? void 0,
|
|
10170
|
-
bvh: (
|
|
10216
|
+
bvh: (A = t.selection) == null ? void 0 : A.bvh,
|
|
10171
10217
|
...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(
|
|
10218
|
+
}), 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
10219
|
t.renderer || {}
|
|
10177
10220
|
);
|
|
10178
|
-
|
|
10179
|
-
const
|
|
10221
|
+
S.preserveDrawingBuffer = !0;
|
|
10222
|
+
const _ = {
|
|
10180
10223
|
renderer: n,
|
|
10181
10224
|
scene: s,
|
|
10182
10225
|
camera: o,
|
|
10183
10226
|
controls: r,
|
|
10184
10227
|
modelLoader: a,
|
|
10185
10228
|
options: t,
|
|
10186
|
-
rendererOptions:
|
|
10229
|
+
rendererOptions: S,
|
|
10187
10230
|
sceneSetupService: c,
|
|
10188
10231
|
environmentService: u,
|
|
10189
10232
|
pathTracingService: d,
|
|
10190
|
-
floorAlignmentService:
|
|
10191
|
-
selectionService:
|
|
10192
|
-
anchorProjectionService:
|
|
10193
|
-
animationService:
|
|
10233
|
+
floorAlignmentService: h,
|
|
10234
|
+
selectionService: p,
|
|
10235
|
+
anchorProjectionService: f,
|
|
10236
|
+
animationService: y
|
|
10194
10237
|
};
|
|
10195
|
-
return new kc(
|
|
10238
|
+
return new kc(_);
|
|
10196
10239
|
}
|
|
10197
10240
|
static createCamera(e) {
|
|
10198
10241
|
const n = e.camera || {}, s = n.fov || n.cameraFov || 75, 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(
|
|
@@ -10224,9 +10267,9 @@ class Fu {
|
|
|
10224
10267
|
}), u;
|
|
10225
10268
|
}
|
|
10226
10269
|
static createControls(e, t, n) {
|
|
10227
|
-
const s = n.controls || {}, o = s.type ||
|
|
10270
|
+
const s = n.controls || {}, o = s.type || Xs.OrbitControls;
|
|
10228
10271
|
let r;
|
|
10229
|
-
o ===
|
|
10272
|
+
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
10273
|
const c = n.camera || {}, u = c.target || c.cameraTarget;
|
|
10231
10274
|
return u && r.target && (r.target.set(u[0], u[1], u[2]), r.update()), r;
|
|
10232
10275
|
}
|
|
@@ -10236,9 +10279,9 @@ class zu extends so {
|
|
|
10236
10279
|
return so.createLoader("model.glb", e);
|
|
10237
10280
|
}
|
|
10238
10281
|
}
|
|
10239
|
-
const Bu = ["toneMappingExposure"], Uu = ["environmentIntensity"], Hu = ["autoRotate", "autoRotateSpeed"];
|
|
10282
|
+
const Bu = ["toneMappingExposure"], Uu = ["environmentIntensity"], Hu = ["autoRotate", "autoRotateSpeed"], ju = ["enabled"];
|
|
10240
10283
|
function na(i) {
|
|
10241
|
-
var t, n, s, o, r, a, c, u, d, h;
|
|
10284
|
+
var t, n, s, o, r, a, c, u, d, h, p;
|
|
10242
10285
|
const e = {
|
|
10243
10286
|
backgroundColor: i.backgroundColor
|
|
10244
10287
|
};
|
|
@@ -10248,7 +10291,7 @@ function na(i) {
|
|
|
10248
10291
|
}), (((c = i.animations) == null ? void 0 : c.autoplay) !== void 0 || ((u = i.animations) == null ? void 0 : u.speed) !== void 0) && (e.animations = {
|
|
10249
10292
|
autoplay: (d = i.animations) == null ? void 0 : d.autoplay,
|
|
10250
10293
|
speed: (h = i.animations) == null ? void 0 : h.speed
|
|
10251
|
-
}), e;
|
|
10294
|
+
}), ((p = i.pathTracing) == null ? void 0 : p.enabled) !== void 0 && (e.pathTracing = { enabled: i.pathTracing.enabled }), e;
|
|
10252
10295
|
}
|
|
10253
10296
|
const Wi = {
|
|
10254
10297
|
// Scene settings
|
|
@@ -10353,7 +10396,7 @@ const Wi = {
|
|
|
10353
10396
|
},
|
|
10354
10397
|
// Controls
|
|
10355
10398
|
controls: {
|
|
10356
|
-
type:
|
|
10399
|
+
type: Xs.OrbitControls,
|
|
10357
10400
|
enabled: !0,
|
|
10358
10401
|
enableDamping: !0,
|
|
10359
10402
|
dampingFactor: 0.25,
|
|
@@ -10422,13 +10465,13 @@ const Wi = {
|
|
|
10422
10465
|
environment: { environmentIntensity: 0.85 }
|
|
10423
10466
|
}
|
|
10424
10467
|
};
|
|
10425
|
-
function
|
|
10468
|
+
function Gu(i) {
|
|
10426
10469
|
return i ? sa[i] : {};
|
|
10427
10470
|
}
|
|
10428
10471
|
function Zi(i, e) {
|
|
10429
|
-
return
|
|
10472
|
+
return Vs(Vs(i, Gu(e.preset)), e);
|
|
10430
10473
|
}
|
|
10431
|
-
const
|
|
10474
|
+
const Ds = (i, ...e) => {
|
|
10432
10475
|
if (!i)
|
|
10433
10476
|
return;
|
|
10434
10477
|
const t = { ...i };
|
|
@@ -10436,22 +10479,26 @@ const _i = (i, ...e) => {
|
|
|
10436
10479
|
delete t[n];
|
|
10437
10480
|
return Object.keys(t).length > 0 ? t : void 0;
|
|
10438
10481
|
};
|
|
10439
|
-
function
|
|
10482
|
+
function Vu(i) {
|
|
10440
10483
|
const e = Nt(
|
|
10441
10484
|
() => {
|
|
10442
10485
|
var s;
|
|
10443
10486
|
return JSON.stringify({
|
|
10444
|
-
pathTracing
|
|
10487
|
+
// pathTracing minus `enabled`: toggling the tracer applies live
|
|
10488
|
+
// (updateOptions) — flipping it must not rebuild or re-fetch the model.
|
|
10489
|
+
// The other fields (samples, bounces, …) configure the tracer at
|
|
10490
|
+
// construction, so a change to them still rebuilds.
|
|
10491
|
+
pathTracing: Ds(i.pathTracing, ...ju),
|
|
10445
10492
|
staticScene: i.staticScene,
|
|
10446
10493
|
// renderer/environment minus their runtime-tunable fields: a direct
|
|
10447
10494
|
// toneMappingExposure / environmentIntensity change is exactly what
|
|
10448
10495
|
// the live updateOptions path exists for and must not rebuild.
|
|
10449
|
-
renderer:
|
|
10496
|
+
renderer: Ds(i.renderer, ...Bu),
|
|
10450
10497
|
camera: i.camera,
|
|
10451
10498
|
// The turntable fields toggle live (updateOptions), like the look
|
|
10452
10499
|
// fields — flipping auto-rotate must not reload the model.
|
|
10453
|
-
controls:
|
|
10454
|
-
environment:
|
|
10500
|
+
controls: Ds(i.controls, ...Hu),
|
|
10501
|
+
environment: Ds(i.environment, ...Uu),
|
|
10455
10502
|
lighting: i.lighting,
|
|
10456
10503
|
helpers: i.helpers,
|
|
10457
10504
|
rendering: i.rendering,
|
|
@@ -10485,11 +10532,11 @@ function Gu(i) {
|
|
|
10485
10532
|
), t = Nt(() => {
|
|
10486
10533
|
const s = Zi(Wi, i);
|
|
10487
10534
|
return JSON.stringify(na(s));
|
|
10488
|
-
}, [i.preset, i.backgroundColor, i.renderer, i.environment, i.controls, i.animations]);
|
|
10535
|
+
}, [i.preset, i.backgroundColor, i.renderer, i.environment, i.controls, i.animations, i.pathTracing]);
|
|
10489
10536
|
return { options: Nt(() => i, [e, t]), structuralKey: e, runtimeKey: t };
|
|
10490
10537
|
}
|
|
10491
|
-
const
|
|
10492
|
-
function
|
|
10538
|
+
const Wu = "200px";
|
|
10539
|
+
function Zu(i, e) {
|
|
10493
10540
|
const [t, n] = xn(!e);
|
|
10494
10541
|
return rt(() => {
|
|
10495
10542
|
if (t)
|
|
@@ -10507,70 +10554,68 @@ function Wu(i, e) {
|
|
|
10507
10554
|
(r) => {
|
|
10508
10555
|
r.some((a) => a.isIntersecting) && n(!0);
|
|
10509
10556
|
},
|
|
10510
|
-
{ rootMargin:
|
|
10557
|
+
{ rootMargin: Wu }
|
|
10511
10558
|
);
|
|
10512
10559
|
return o.observe(s), () => o.disconnect();
|
|
10513
10560
|
}, [i, e, t]), t;
|
|
10514
10561
|
}
|
|
10515
|
-
function
|
|
10516
|
-
const t = Ge(null),
|
|
10517
|
-
rt(() => {
|
|
10518
|
-
if (!
|
|
10562
|
+
function Ku(i, e) {
|
|
10563
|
+
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");
|
|
10564
|
+
return rt(() => {
|
|
10565
|
+
if (!h || !i.current || t.current)
|
|
10519
10566
|
return;
|
|
10520
|
-
|
|
10521
|
-
const p = Zi(Wi,
|
|
10567
|
+
a(null);
|
|
10568
|
+
const p = Zi(Wi, c);
|
|
10522
10569
|
let f;
|
|
10523
10570
|
try {
|
|
10524
10571
|
f = Fu.createViewer(i.current, p);
|
|
10525
|
-
} catch (
|
|
10526
|
-
console.error("Failed to create viewer:",
|
|
10572
|
+
} catch (S) {
|
|
10573
|
+
console.error("Failed to create viewer:", S), a(S instanceof Error ? S : new Error(String(S)));
|
|
10527
10574
|
return;
|
|
10528
10575
|
}
|
|
10529
|
-
t.current = f;
|
|
10576
|
+
t.current = f, n.current = { width: 0, height: 0 };
|
|
10530
10577
|
let y = !1;
|
|
10531
|
-
return f.initialize().then((
|
|
10532
|
-
y || (
|
|
10578
|
+
return f.initialize().then((S) => {
|
|
10579
|
+
y || (S.ok ? o(!0) : (console.error("Failed to initialize viewer:", S.error), a(S.error)));
|
|
10533
10580
|
}), () => {
|
|
10534
|
-
y = !0, f.dispose(), t.current = null,
|
|
10581
|
+
y = !0, f.dispose(), t.current = null, o(!1);
|
|
10535
10582
|
};
|
|
10536
|
-
}, [i,
|
|
10537
|
-
if (!t.current || !
|
|
10583
|
+
}, [i, u, h]), rt(() => {
|
|
10584
|
+
if (!t.current || !s)
|
|
10538
10585
|
return;
|
|
10539
|
-
const p = Zi(Wi,
|
|
10586
|
+
const p = Zi(Wi, c);
|
|
10540
10587
|
t.current.updateOptions(na(p));
|
|
10541
|
-
}, [
|
|
10542
|
-
const h = Ge({ width: 0, height: 0 });
|
|
10543
|
-
return rt(() => {
|
|
10588
|
+
}, [d, s]), rt(() => {
|
|
10544
10589
|
if (!t.current || !i.current)
|
|
10545
10590
|
return;
|
|
10546
10591
|
let p = null;
|
|
10547
10592
|
const f = (_) => {
|
|
10548
10593
|
if (i.current && t.current) {
|
|
10549
|
-
const
|
|
10550
|
-
let { clientWidth: E, clientHeight: T } =
|
|
10594
|
+
const A = i.current.parentElement || i.current;
|
|
10595
|
+
let { clientWidth: E, clientHeight: T } = A;
|
|
10551
10596
|
if (_ && _[0]) {
|
|
10552
|
-
const { width:
|
|
10553
|
-
E = Math.floor(
|
|
10597
|
+
const { width: b, height: x } = _[0].contentRect;
|
|
10598
|
+
E = Math.floor(b), T = Math.floor(x);
|
|
10554
10599
|
}
|
|
10555
|
-
if (
|
|
10600
|
+
if (n.current.width === E && n.current.height === T)
|
|
10556
10601
|
return;
|
|
10557
10602
|
p !== null && cancelAnimationFrame(p), p = requestAnimationFrame(() => {
|
|
10558
|
-
t.current && i.current && (t.current.resize(E, T),
|
|
10603
|
+
t.current && i.current && (t.current.resize(E, T), n.current = { width: E, height: T });
|
|
10559
10604
|
});
|
|
10560
10605
|
}
|
|
10561
10606
|
};
|
|
10562
10607
|
f();
|
|
10563
10608
|
const y = () => f();
|
|
10564
10609
|
window.addEventListener("resize", y);
|
|
10565
|
-
let
|
|
10566
|
-
return typeof ResizeObserver < "u" && i.current.parentElement && (
|
|
10567
|
-
window.removeEventListener("resize", y),
|
|
10610
|
+
let S = null;
|
|
10611
|
+
return typeof ResizeObserver < "u" && i.current.parentElement && (S = new ResizeObserver(f), S.observe(i.current.parentElement)), () => {
|
|
10612
|
+
window.removeEventListener("resize", y), S == null || S.disconnect(), p !== null && cancelAnimationFrame(p);
|
|
10568
10613
|
};
|
|
10569
|
-
}, [
|
|
10614
|
+
}, [s, i]), {
|
|
10570
10615
|
viewer: t.current,
|
|
10571
|
-
isInitialized:
|
|
10616
|
+
isInitialized: s,
|
|
10572
10617
|
/** Set when viewer construction or initialization failed (e.g. WebGL unavailable). */
|
|
10573
|
-
initError:
|
|
10618
|
+
initError: r
|
|
10574
10619
|
};
|
|
10575
10620
|
}
|
|
10576
10621
|
function ia(i, e) {
|
|
@@ -10592,7 +10637,7 @@ function ia(i, e) {
|
|
|
10592
10637
|
};
|
|
10593
10638
|
}, [i]);
|
|
10594
10639
|
}
|
|
10595
|
-
function
|
|
10640
|
+
function Xu(i, e) {
|
|
10596
10641
|
const [t, n] = xn(null), s = Ge(/* @__PURE__ */ new Set());
|
|
10597
10642
|
rt(() => {
|
|
10598
10643
|
if (i !== void 0 && s.current.has(i)) {
|
|
@@ -10617,7 +10662,7 @@ function Ku(i, e) {
|
|
|
10617
10662
|
selectPreset: a
|
|
10618
10663
|
};
|
|
10619
10664
|
}
|
|
10620
|
-
function
|
|
10665
|
+
function Yu(i, e, t, n, s) {
|
|
10621
10666
|
return Nt(() => {
|
|
10622
10667
|
var u, d, h;
|
|
10623
10668
|
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 +10675,7 @@ function Xu(i, e, t, n, s) {
|
|
|
10630
10675
|
};
|
|
10631
10676
|
}, [i, e, t, n, s]);
|
|
10632
10677
|
}
|
|
10633
|
-
function
|
|
10678
|
+
function qu(i, e, t) {
|
|
10634
10679
|
const n = Nt(() => {
|
|
10635
10680
|
if (typeof t == "string")
|
|
10636
10681
|
return t;
|
|
@@ -10653,7 +10698,7 @@ function Yu(i, e, t) {
|
|
|
10653
10698
|
};
|
|
10654
10699
|
}, [i, e, n]), s;
|
|
10655
10700
|
}
|
|
10656
|
-
class
|
|
10701
|
+
class bi {
|
|
10657
10702
|
/**
|
|
10658
10703
|
* Convert IObject3D to THREE.Object3D
|
|
10659
10704
|
*/
|
|
@@ -10722,16 +10767,16 @@ class Si {
|
|
|
10722
10767
|
};
|
|
10723
10768
|
}
|
|
10724
10769
|
}
|
|
10725
|
-
function
|
|
10770
|
+
function $u(i) {
|
|
10726
10771
|
const e = Ge(new tr()), t = Nt(
|
|
10727
10772
|
() => ({
|
|
10728
10773
|
"model:loading": (n) => e.current.emit("model:loading", n),
|
|
10729
10774
|
"model:progress": (n) => e.current.emit("model:progress", n),
|
|
10730
|
-
"model:loaded": (n) => e.current.emit("model:loaded",
|
|
10775
|
+
"model:loaded": (n) => e.current.emit("model:loaded", bi.convertModelLoaded(n)),
|
|
10731
10776
|
"model:error": (n) => e.current.emit("model:error", n),
|
|
10732
10777
|
"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",
|
|
10778
|
+
"controls:change": (n) => e.current.emit("controls:change", bi.convertControlsChange(n)),
|
|
10779
|
+
"object:selected": (n) => e.current.emit("object:selected", bi.convertObjectSelected(n)),
|
|
10735
10780
|
error: (n) => e.current.emit("error", n)
|
|
10736
10781
|
}),
|
|
10737
10782
|
[]
|
|
@@ -10739,7 +10784,7 @@ function qu(i) {
|
|
|
10739
10784
|
);
|
|
10740
10785
|
return ia(i, t), e.current;
|
|
10741
10786
|
}
|
|
10742
|
-
function
|
|
10787
|
+
function Qu(i, e, t) {
|
|
10743
10788
|
const n = Ge(t);
|
|
10744
10789
|
n.current = t;
|
|
10745
10790
|
const s = Nt(
|
|
@@ -10775,7 +10820,7 @@ function $u(i, e, t) {
|
|
|
10775
10820
|
});
|
|
10776
10821
|
}
|
|
10777
10822
|
const ra = Wa(null);
|
|
10778
|
-
function
|
|
10823
|
+
function Ju({ viewer: i, canvasRef: e, children: t }) {
|
|
10779
10824
|
const n = Nt(() => ({ viewer: i, canvasRef: e }), [i, e]);
|
|
10780
10825
|
return /* @__PURE__ */ Te(ra.Provider, { value: n, children: t });
|
|
10781
10826
|
}
|
|
@@ -10785,7 +10830,7 @@ function oa() {
|
|
|
10785
10830
|
throw new Error("useViewerContext must be used within ViewerProvider");
|
|
10786
10831
|
return i;
|
|
10787
10832
|
}
|
|
10788
|
-
function
|
|
10833
|
+
function ed() {
|
|
10789
10834
|
const { canvasRef: i } = oa();
|
|
10790
10835
|
return /* @__PURE__ */ Te(
|
|
10791
10836
|
"canvas",
|
|
@@ -10813,13 +10858,13 @@ function Ju() {
|
|
|
10813
10858
|
console.error("vite-plugin-css-injected-by-js", e);
|
|
10814
10859
|
}
|
|
10815
10860
|
})();
|
|
10816
|
-
const
|
|
10861
|
+
const td = (i, e, t, n, s, o) => {
|
|
10817
10862
|
const r = performance.now(), a = () => {
|
|
10818
10863
|
const c = performance.now() - r, u = Math.min(c / s, 1);
|
|
10819
10864
|
i.position.lerpVectors(t, n, u), e == null || e.update(), o(), u < 1 && requestAnimationFrame(a);
|
|
10820
10865
|
};
|
|
10821
10866
|
requestAnimationFrame(a);
|
|
10822
|
-
}, lo = { type: "change" }, ur = { type: "start" }, aa = { type: "end" },
|
|
10867
|
+
}, 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
10868
|
NONE: -1,
|
|
10824
10869
|
ROTATE: 0,
|
|
10825
10870
|
DOLLY: 1,
|
|
@@ -10828,7 +10873,7 @@ const ed = (i, e, t, n, s, o) => {
|
|
|
10828
10873
|
TOUCH_PAN: 4,
|
|
10829
10874
|
TOUCH_DOLLY_PAN: 5,
|
|
10830
10875
|
TOUCH_DOLLY_ROTATE: 6
|
|
10831
|
-
},
|
|
10876
|
+
}, Si = 1e-6;
|
|
10832
10877
|
class ca extends Ro {
|
|
10833
10878
|
/**
|
|
10834
10879
|
* Constructs a new controls instance.
|
|
@@ -10837,7 +10882,7 @@ class ca extends Ro {
|
|
|
10837
10882
|
* @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
|
|
10838
10883
|
*/
|
|
10839
10884
|
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
|
|
10885
|
+
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
10886
|
}
|
|
10842
10887
|
connect(e) {
|
|
10843
10888
|
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 +10973,12 @@ class ca extends Ro {
|
|
|
10928
10973
|
u.unproject(this.object), this.object.position.sub(u).add(a), this.object.updateMatrixWorld(), r = Le.length();
|
|
10929
10974
|
} else
|
|
10930
10975
|
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) : (
|
|
10976
|
+
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
10977
|
} else if (this.object.isOrthographicCamera) {
|
|
10933
10978
|
const r = this.object.zoom;
|
|
10934
10979
|
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
10980
|
}
|
|
10936
|
-
return this._scale = 1, this._performCursorZoom = !1, o || this._lastPosition.distanceToSquared(this.object.position) >
|
|
10981
|
+
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
10982
|
}
|
|
10938
10983
|
_getAutoRotationAngle(e) {
|
|
10939
10984
|
return e !== null ? nt / 60 * this.autoRotateSpeed * e : nt / 60 / 60 * this.autoRotateSpeed;
|
|
@@ -11125,13 +11170,13 @@ class ca extends Ro {
|
|
|
11125
11170
|
return e.ctrlKey && !this._controlActive && (n.deltaY *= 10), n;
|
|
11126
11171
|
}
|
|
11127
11172
|
}
|
|
11128
|
-
function
|
|
11173
|
+
function sd(i) {
|
|
11129
11174
|
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
11175
|
}
|
|
11131
|
-
function
|
|
11176
|
+
function id(i) {
|
|
11132
11177
|
this.enabled !== !1 && (i.pointerType === "touch" ? this._onTouchMove(i) : this._onMouseMove(i));
|
|
11133
11178
|
}
|
|
11134
|
-
function
|
|
11179
|
+
function rd(i) {
|
|
11135
11180
|
switch (this._removePointer(i), this._pointers.length) {
|
|
11136
11181
|
case 0:
|
|
11137
11182
|
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 +11187,7 @@ function id(i) {
|
|
|
11142
11187
|
break;
|
|
11143
11188
|
}
|
|
11144
11189
|
}
|
|
11145
|
-
function
|
|
11190
|
+
function od(i) {
|
|
11146
11191
|
let e;
|
|
11147
11192
|
switch (i.button) {
|
|
11148
11193
|
case 0:
|
|
@@ -11185,7 +11230,7 @@ function rd(i) {
|
|
|
11185
11230
|
}
|
|
11186
11231
|
this.state !== Ee.NONE && this.dispatchEvent(ur);
|
|
11187
11232
|
}
|
|
11188
|
-
function
|
|
11233
|
+
function ad(i) {
|
|
11189
11234
|
switch (this.state) {
|
|
11190
11235
|
case Ee.ROTATE:
|
|
11191
11236
|
if (this.enableRotate === !1) return;
|
|
@@ -11201,13 +11246,13 @@ function od(i) {
|
|
|
11201
11246
|
break;
|
|
11202
11247
|
}
|
|
11203
11248
|
}
|
|
11204
|
-
function
|
|
11249
|
+
function cd(i) {
|
|
11205
11250
|
this.enabled === !1 || this.enableZoom === !1 || this.state !== Ee.NONE || (i.preventDefault(), this.dispatchEvent(ur), this._handleMouseWheel(this._customWheelEvent(i)), this.dispatchEvent(aa));
|
|
11206
11251
|
}
|
|
11207
|
-
function
|
|
11252
|
+
function ld(i) {
|
|
11208
11253
|
this.enabled !== !1 && this._handleKeyDown(i);
|
|
11209
11254
|
}
|
|
11210
|
-
function
|
|
11255
|
+
function hd(i) {
|
|
11211
11256
|
switch (this._trackPointer(i), this._pointers.length) {
|
|
11212
11257
|
case 1:
|
|
11213
11258
|
switch (this.touches.ONE) {
|
|
@@ -11242,7 +11287,7 @@ function ld(i) {
|
|
|
11242
11287
|
}
|
|
11243
11288
|
this.state !== Ee.NONE && this.dispatchEvent(ur);
|
|
11244
11289
|
}
|
|
11245
|
-
function
|
|
11290
|
+
function ud(i) {
|
|
11246
11291
|
switch (this._trackPointer(i), this.state) {
|
|
11247
11292
|
case Ee.TOUCH_ROTATE:
|
|
11248
11293
|
if (this.enableRotate === !1) return;
|
|
@@ -11264,16 +11309,16 @@ function hd(i) {
|
|
|
11264
11309
|
this.state = Ee.NONE;
|
|
11265
11310
|
}
|
|
11266
11311
|
}
|
|
11267
|
-
function
|
|
11312
|
+
function dd(i) {
|
|
11268
11313
|
this.enabled !== !1 && i.preventDefault();
|
|
11269
11314
|
}
|
|
11270
|
-
function
|
|
11315
|
+
function pd(i) {
|
|
11271
11316
|
i.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
11272
11317
|
}
|
|
11273
|
-
function
|
|
11318
|
+
function fd(i) {
|
|
11274
11319
|
i.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
11275
11320
|
}
|
|
11276
|
-
class
|
|
11321
|
+
class md extends ca {
|
|
11277
11322
|
constructor(e, t) {
|
|
11278
11323
|
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
11324
|
}
|
|
@@ -11294,15 +11339,15 @@ const de = {
|
|
|
11294
11339
|
};
|
|
11295
11340
|
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
11341
|
new w.Vector3(0, 1, 0);
|
|
11297
|
-
const Qn = "rotation-arrows-name", Ki = "left-rotation-arrow-name",
|
|
11298
|
-
|
|
11342
|
+
const Qn = "rotation-arrows-name", Ki = "left-rotation-arrow-name", Ys = "right-rotation-arrow-name", gd = "gizmo-group-name", yd = [
|
|
11343
|
+
Ys,
|
|
11299
11344
|
Ki
|
|
11300
|
-
],
|
|
11345
|
+
], Hs = {
|
|
11301
11346
|
GIZMO_DISTANCE: 8,
|
|
11302
11347
|
DEFAULT_UP: new w.Vector3(0, 1, 0),
|
|
11303
11348
|
FORWARD: new w.Vector3(0, 0, -1)
|
|
11304
|
-
}, xi = (i) =>
|
|
11305
|
-
class
|
|
11349
|
+
}, xi = (i) => Hs.FORWARD.clone().applyQuaternion(i), uo = (i, e, t = new w.Vector3()) => t.clone().add(i.multiplyScalar(-e));
|
|
11350
|
+
class wd {
|
|
11306
11351
|
constructor(e, t = Qn) {
|
|
11307
11352
|
this.gizmoScene = e, this.gizmoArrowsName = t;
|
|
11308
11353
|
}
|
|
@@ -11310,29 +11355,29 @@ class yd {
|
|
|
11310
11355
|
e.quaternion.copy(t.quaternion), e.up.copy(t.up);
|
|
11311
11356
|
const n = xi(e.quaternion).normalize();
|
|
11312
11357
|
e.position.copy(
|
|
11313
|
-
uo(n,
|
|
11358
|
+
uo(n, Hs.GIZMO_DISTANCE)
|
|
11314
11359
|
), e.camera.updateMatrixWorld(!0);
|
|
11315
11360
|
const s = this.gizmoScene.getObjectByName(this.gizmoArrowsName);
|
|
11316
11361
|
s && s.rotation.copy(e.camera.rotation);
|
|
11317
11362
|
}
|
|
11318
11363
|
syncMainWithGizmo(e, t, n) {
|
|
11319
11364
|
const s = n.target.clone(), o = e.position.distanceTo(s), r = e.camera instanceof w.PerspectiveCamera;
|
|
11320
|
-
n instanceof
|
|
11365
|
+
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
11366
|
}
|
|
11322
11367
|
syncMapControls(e, t, n, s) {
|
|
11323
11368
|
const o = e.position.y - n.y, r = xi(t.quaternion);
|
|
11324
11369
|
r.y = 0, r.normalize();
|
|
11325
11370
|
const a = n.clone();
|
|
11326
|
-
a.y += o, a.add(r.multiplyScalar(-s)), e.position.copy(a), e.up.copy(
|
|
11371
|
+
a.y += o, a.add(r.multiplyScalar(-s)), e.position.copy(a), e.up.copy(Hs.DEFAULT_UP), e.camera.lookAt(n);
|
|
11327
11372
|
}
|
|
11328
11373
|
syncOrbitControls(e, t, n, s) {
|
|
11329
|
-
const o = xi(t.quaternion), r =
|
|
11374
|
+
const o = xi(t.quaternion), r = Hs.DEFAULT_UP.clone().applyQuaternion(
|
|
11330
11375
|
t.quaternion
|
|
11331
11376
|
), a = uo(o, s, n);
|
|
11332
11377
|
e.position.copy(a), e.up.copy(r), e.camera.lookAt(n);
|
|
11333
11378
|
}
|
|
11334
11379
|
}
|
|
11335
|
-
const la = (i) => new
|
|
11380
|
+
const la = (i) => new wd(i), po = (i, e, t) => {
|
|
11336
11381
|
la(t).syncGizmoWithMain(
|
|
11337
11382
|
{
|
|
11338
11383
|
camera: i,
|
|
@@ -11347,7 +11392,7 @@ const la = (i) => new yd(i), po = (i, e, t) => {
|
|
|
11347
11392
|
up: e.up
|
|
11348
11393
|
}
|
|
11349
11394
|
);
|
|
11350
|
-
},
|
|
11395
|
+
}, Ed = (i, e, t) => {
|
|
11351
11396
|
la(e.userData.scene).syncMainWithGizmo(
|
|
11352
11397
|
{
|
|
11353
11398
|
camera: i,
|
|
@@ -11363,14 +11408,14 @@ const la = (i) => new yd(i), po = (i, e, t) => {
|
|
|
11363
11408
|
},
|
|
11364
11409
|
t
|
|
11365
11410
|
);
|
|
11366
|
-
},
|
|
11411
|
+
}, Td = () => {
|
|
11367
11412
|
try {
|
|
11368
11413
|
const i = document.createElement("canvas");
|
|
11369
11414
|
return !!(window.WebGLRenderingContext && (i.getContext("webgl") || i.getContext("experimental-webgl")));
|
|
11370
11415
|
} catch {
|
|
11371
11416
|
return !1;
|
|
11372
11417
|
}
|
|
11373
|
-
},
|
|
11418
|
+
}, _d = () => Td() ? new w.WebGLRenderer({ alpha: !0, antialias: !1 }) : (console.error("WebGL is not supported in this environment."), null), bd = (i) => {
|
|
11374
11419
|
const e = new w.AmbientLight(16777215, 1);
|
|
11375
11420
|
i.add(e);
|
|
11376
11421
|
const t = new w.DirectionalLight(16777215, 1);
|
|
@@ -11388,7 +11433,7 @@ class Sd {
|
|
|
11388
11433
|
return s.needsUpdate = !0, s;
|
|
11389
11434
|
}
|
|
11390
11435
|
}
|
|
11391
|
-
class
|
|
11436
|
+
class ks {
|
|
11392
11437
|
static createWireframe([e, t, n]) {
|
|
11393
11438
|
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
11439
|
return a.name = "Wireframe", a;
|
|
@@ -11429,7 +11474,7 @@ class Ns {
|
|
|
11429
11474
|
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
11475
|
}
|
|
11431
11476
|
}
|
|
11432
|
-
const
|
|
11477
|
+
const xd = (i, e) => {
|
|
11433
11478
|
const t = document.createElement("canvas");
|
|
11434
11479
|
t.width = 64, t.height = 64;
|
|
11435
11480
|
const n = t.getContext("2d");
|
|
@@ -11437,7 +11482,7 @@ const bd = (i, e) => {
|
|
|
11437
11482
|
const s = new w.CanvasTexture(t), o = new w.SpriteMaterial({ map: s }), r = new w.Sprite(o);
|
|
11438
11483
|
return r.scale.set(0.5, 0.5, 0.5), r;
|
|
11439
11484
|
};
|
|
11440
|
-
class
|
|
11485
|
+
class Ad {
|
|
11441
11486
|
constructor(e) {
|
|
11442
11487
|
this.hoveredObject = null, this.originalColor = null, this.config = e;
|
|
11443
11488
|
}
|
|
@@ -11463,19 +11508,19 @@ class xd {
|
|
|
11463
11508
|
}
|
|
11464
11509
|
}
|
|
11465
11510
|
createWireframe() {
|
|
11466
|
-
const e = de.CUBE_SIZE + de.EDGE_SECTION_SIZE, t =
|
|
11511
|
+
const e = de.CUBE_SIZE + de.EDGE_SECTION_SIZE, t = ks.createWireframe([e, e, e]);
|
|
11467
11512
|
return t.userData.gizmoCube = this, t;
|
|
11468
11513
|
}
|
|
11469
11514
|
createEdgeBox(e, t, n) {
|
|
11470
|
-
const s =
|
|
11515
|
+
const s = ks.createEdgeBox(e, t, n);
|
|
11471
11516
|
return s.userData.gizmoCube = this, s;
|
|
11472
11517
|
}
|
|
11473
11518
|
createCornerCube(e, t) {
|
|
11474
|
-
const n =
|
|
11519
|
+
const n = ks.createCornerCube(e, t);
|
|
11475
11520
|
return n.userData.gizmoCube = this, n;
|
|
11476
11521
|
}
|
|
11477
11522
|
createFace(e, t, n) {
|
|
11478
|
-
const s =
|
|
11523
|
+
const s = ks.createFace(e, t, n), o = s.getObjectByName(`Face Box ${n}`);
|
|
11479
11524
|
return o.userData.gizmoCube = this, s;
|
|
11480
11525
|
}
|
|
11481
11526
|
createEdges(e) {
|
|
@@ -11555,11 +11600,11 @@ class xd {
|
|
|
11555
11600
|
createAxis(e) {
|
|
11556
11601
|
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
11602
|
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,
|
|
11603
|
+
const y = new w.Vector3(0, 1, 0).cross(n).normalize(), S = Math.acos(new w.Vector3(0, 1, 0).dot(n));
|
|
11604
|
+
p.setRotationFromAxisAngle(y, S);
|
|
11560
11605
|
}
|
|
11561
11606
|
c.add(p);
|
|
11562
|
-
const f =
|
|
11607
|
+
const f = xd(a, t);
|
|
11563
11608
|
return f.position.copy(o).add(n.clone().multiplyScalar(s + 0.1)), c.add(f), c;
|
|
11564
11609
|
}
|
|
11565
11610
|
createCoordinateAxes() {
|
|
@@ -11602,7 +11647,7 @@ class xd {
|
|
|
11602
11647
|
}
|
|
11603
11648
|
create() {
|
|
11604
11649
|
const e = new w.Group();
|
|
11605
|
-
e.name =
|
|
11650
|
+
e.name = gd;
|
|
11606
11651
|
const t = this.createWireframe();
|
|
11607
11652
|
e.add(t), this.createEdges(e), this.createCorners(e), this.createFaces(e);
|
|
11608
11653
|
const n = this.createCoordinateAxes();
|
|
@@ -11627,7 +11672,7 @@ class xd {
|
|
|
11627
11672
|
}
|
|
11628
11673
|
}
|
|
11629
11674
|
}
|
|
11630
|
-
class
|
|
11675
|
+
class vd {
|
|
11631
11676
|
constructor(e) {
|
|
11632
11677
|
this.onChangeMainControlsListener = () => {
|
|
11633
11678
|
}, this.onChangeGizmoControlsListener = () => {
|
|
@@ -11649,10 +11694,10 @@ class Ad {
|
|
|
11649
11694
|
}
|
|
11650
11695
|
initializeScene() {
|
|
11651
11696
|
var e;
|
|
11652
|
-
const t = new
|
|
11697
|
+
const t = new Ad({
|
|
11653
11698
|
initialFace: ((e = this.options) == null ? void 0 : e.initialFace) ?? Vt.FRONT
|
|
11654
11699
|
}).create();
|
|
11655
|
-
this.gizmoScene.add(t),
|
|
11700
|
+
this.gizmoScene.add(t), bd(this.gizmoScene);
|
|
11656
11701
|
}
|
|
11657
11702
|
initializeControls() {
|
|
11658
11703
|
this.onChangeMainControlsListener = () => this.syncFunctions.syncGizmoCameraWithMain(
|
|
@@ -11692,7 +11737,7 @@ class Ad {
|
|
|
11692
11737
|
), this.gizmoScene.clear(), cancelAnimationFrame(this.animationId);
|
|
11693
11738
|
}
|
|
11694
11739
|
}
|
|
11695
|
-
const
|
|
11740
|
+
const Rd = (i, e) => {
|
|
11696
11741
|
let t;
|
|
11697
11742
|
return function(...n) {
|
|
11698
11743
|
t || (i.apply(this, n), t = !0, setTimeout(() => t = !1, e));
|
|
@@ -11708,12 +11753,12 @@ const ha = (i, e, t, n) => (n.setFromCamera(i, e), n.intersectObjects(t.children
|
|
|
11708
11753
|
const t = ["Wireframe", ""];
|
|
11709
11754
|
return ((e = i.find((n) => !t.includes(n.object.name))) == null ? void 0 : e.object) || null;
|
|
11710
11755
|
};
|
|
11711
|
-
function
|
|
11756
|
+
function Md(i, e, t, n) {
|
|
11712
11757
|
if (!e || !t) return null;
|
|
11713
11758
|
const s = ha(i, e, t, n);
|
|
11714
11759
|
return ua(s);
|
|
11715
11760
|
}
|
|
11716
|
-
function
|
|
11761
|
+
function Cd(i, e) {
|
|
11717
11762
|
const t = i == null ? void 0 : i.userData.gizmoCube;
|
|
11718
11763
|
if (i && t) {
|
|
11719
11764
|
t.handleClick();
|
|
@@ -11721,22 +11766,22 @@ function Md(i, e) {
|
|
|
11721
11766
|
n && e(n);
|
|
11722
11767
|
}
|
|
11723
11768
|
}
|
|
11724
|
-
const
|
|
11769
|
+
const Id = {
|
|
11725
11770
|
radius: 2.1,
|
|
11726
11771
|
color: 12369854,
|
|
11727
11772
|
tubeRadius: 0.1,
|
|
11728
11773
|
tubeSegments: 8,
|
|
11729
11774
|
numPoints: 64,
|
|
11730
11775
|
tubeOffset: 1.5
|
|
11731
|
-
},
|
|
11776
|
+
}, Pd = {
|
|
11732
11777
|
size: 0.2,
|
|
11733
11778
|
depth: 0.1,
|
|
11734
11779
|
heightRatio: 1.4,
|
|
11735
11780
|
segments: 1
|
|
11736
11781
|
};
|
|
11737
|
-
class
|
|
11782
|
+
class Ld {
|
|
11738
11783
|
constructor(e = {}) {
|
|
11739
|
-
this.config = { ...
|
|
11784
|
+
this.config = { ...Id, ...e }, this.material = new w.MeshBasicMaterial({ color: this.config.color });
|
|
11740
11785
|
}
|
|
11741
11786
|
create() {
|
|
11742
11787
|
const e = new w.Group(), t = this.createQuarterCircleCurves();
|
|
@@ -11773,11 +11818,11 @@ class Pd {
|
|
|
11773
11818
|
};
|
|
11774
11819
|
return [
|
|
11775
11820
|
n(e, Ki),
|
|
11776
|
-
n(t,
|
|
11821
|
+
n(t, Ys)
|
|
11777
11822
|
];
|
|
11778
11823
|
}
|
|
11779
11824
|
createArrowHeads([e, t]) {
|
|
11780
|
-
const { size: n, depth: s, heightRatio: o, segments: r } =
|
|
11825
|
+
const { size: n, depth: s, heightRatio: o, segments: r } = Pd, a = this.createArrowShape(n, o), c = new w.ExtrudeGeometry(a, {
|
|
11781
11826
|
steps: r,
|
|
11782
11827
|
depth: s,
|
|
11783
11828
|
bevelEnabled: !1
|
|
@@ -11794,7 +11839,7 @@ class Pd {
|
|
|
11794
11839
|
u(
|
|
11795
11840
|
t.getPoint(1),
|
|
11796
11841
|
this.calculateArrowRotation(t.getTangent(1)) - Math.PI / 2,
|
|
11797
|
-
|
|
11842
|
+
Ys
|
|
11798
11843
|
)
|
|
11799
11844
|
];
|
|
11800
11845
|
}
|
|
@@ -11805,11 +11850,11 @@ class Pd {
|
|
|
11805
11850
|
return Math.atan2(e.y, e.x);
|
|
11806
11851
|
}
|
|
11807
11852
|
}
|
|
11808
|
-
const
|
|
11853
|
+
const Od = (i) => {
|
|
11809
11854
|
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
11855
|
return !(r || a);
|
|
11811
|
-
},
|
|
11812
|
-
function
|
|
11856
|
+
}, Dd = 25, Nd = 200;
|
|
11857
|
+
function kd({
|
|
11813
11858
|
gizmoRenderer: i,
|
|
11814
11859
|
gizmoScene: e,
|
|
11815
11860
|
gizmoCamera: t,
|
|
@@ -11817,31 +11862,31 @@ function Nd({
|
|
|
11817
11862
|
gizmoControlRef: s
|
|
11818
11863
|
}) {
|
|
11819
11864
|
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(
|
|
11865
|
+
const S = e.getObjectByName(Qn), _ = Od(t);
|
|
11866
|
+
if (S && _) {
|
|
11867
|
+
e.remove(S);
|
|
11823
11868
|
return;
|
|
11824
11869
|
}
|
|
11825
|
-
if (
|
|
11826
|
-
const
|
|
11827
|
-
|
|
11870
|
+
if (S || _) return;
|
|
11871
|
+
const A = new Ld().create();
|
|
11872
|
+
A.rotation.copy(t.rotation), e.add(A);
|
|
11828
11873
|
}, [e, t]), d = Rt(() => {
|
|
11829
|
-
const
|
|
11830
|
-
|
|
11874
|
+
const S = e.getObjectByName(Qn);
|
|
11875
|
+
S && e.remove(S);
|
|
11831
11876
|
}, [e]), h = Rt(
|
|
11832
|
-
|
|
11877
|
+
Rd((S) => {
|
|
11833
11878
|
if (!s.current || !i) return;
|
|
11834
|
-
fo(
|
|
11879
|
+
fo(S, i, c);
|
|
11835
11880
|
const _ = ha(
|
|
11836
11881
|
c,
|
|
11837
11882
|
t,
|
|
11838
11883
|
e,
|
|
11839
11884
|
a
|
|
11840
|
-
),
|
|
11841
|
-
|
|
11885
|
+
), A = ua(_);
|
|
11886
|
+
A != null && A.userData.gizmoCube ? A.userData.gizmoCube.highlightObject(A) : e.traverse((E) => {
|
|
11842
11887
|
E.userData.gizmoCube && E.userData.gizmoCube.highlightObject(null);
|
|
11843
11888
|
}), _.length > 0 ? u() : d();
|
|
11844
|
-
}, 1e3 /
|
|
11889
|
+
}, 1e3 / Dd),
|
|
11845
11890
|
[
|
|
11846
11891
|
s,
|
|
11847
11892
|
i,
|
|
@@ -11852,26 +11897,26 @@ function Nd({
|
|
|
11852
11897
|
u,
|
|
11853
11898
|
d
|
|
11854
11899
|
]
|
|
11855
|
-
), p = Rt((
|
|
11856
|
-
o.current = Date.now(), r.current = { x:
|
|
11900
|
+
), p = Rt((S) => {
|
|
11901
|
+
o.current = Date.now(), r.current = { x: S.clientX, y: S.clientY };
|
|
11857
11902
|
}, []), f = Rt(
|
|
11858
|
-
(
|
|
11903
|
+
(S) => {
|
|
11859
11904
|
var _;
|
|
11860
|
-
const
|
|
11861
|
-
|
|
11905
|
+
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();
|
|
11906
|
+
x.makeRotationZ(b), t.up.applyMatrix4(x), t.lookAt(T), (_ = s.current) == null || _.gizmoControls.update();
|
|
11862
11907
|
},
|
|
11863
11908
|
[t, s]
|
|
11864
11909
|
), y = Rt(
|
|
11865
|
-
(
|
|
11866
|
-
if ((o.current ? Date.now() - o.current : 0) <
|
|
11867
|
-
fo(
|
|
11868
|
-
const _ =
|
|
11910
|
+
(S) => {
|
|
11911
|
+
if ((o.current ? Date.now() - o.current : 0) < Nd) {
|
|
11912
|
+
fo(S, i, c);
|
|
11913
|
+
const _ = Md(
|
|
11869
11914
|
c,
|
|
11870
11915
|
t,
|
|
11871
11916
|
e,
|
|
11872
11917
|
a
|
|
11873
11918
|
);
|
|
11874
|
-
_ != null && _.name &&
|
|
11919
|
+
_ != null && _.name && yd.includes(_.name) ? f(_) : Cd(_, n);
|
|
11875
11920
|
}
|
|
11876
11921
|
o.current = null, r.current = null;
|
|
11877
11922
|
},
|
|
@@ -11892,37 +11937,37 @@ function Nd({
|
|
|
11892
11937
|
onMouseLeave: d
|
|
11893
11938
|
};
|
|
11894
11939
|
}
|
|
11895
|
-
const
|
|
11940
|
+
const Fd = ({
|
|
11896
11941
|
camera: i,
|
|
11897
11942
|
controls: e,
|
|
11898
11943
|
className: t,
|
|
11899
11944
|
render: n,
|
|
11900
11945
|
options: s
|
|
11901
11946
|
}) => {
|
|
11902
|
-
const o = Ge(null), r = Ge(new w.Scene()).current, [a] = xn(() =>
|
|
11947
|
+
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
11948
|
c,
|
|
11904
11949
|
u,
|
|
11905
11950
|
d,
|
|
11906
11951
|
h
|
|
11907
|
-
), f = Ge(p).current, y = Ge(null),
|
|
11952
|
+
), f = Ge(p).current, y = Ge(null), S = Rt(() => {
|
|
11908
11953
|
a && (n(), a.render(r, f));
|
|
11909
11954
|
}, [n, a, r, f]), _ = Rt(
|
|
11910
|
-
(
|
|
11955
|
+
(x) => {
|
|
11911
11956
|
if (!i || !e) return;
|
|
11912
|
-
const P = i.position.length(),
|
|
11913
|
-
O.lookAt(
|
|
11914
|
-
const
|
|
11915
|
-
|
|
11957
|
+
const P = i.position.length(), C = x.clone().multiplyScalar(P), M = 400, O = new w.Matrix4();
|
|
11958
|
+
O.lookAt(C, new w.Vector3(0, 0, 0), new w.Vector3(0, 1, 0));
|
|
11959
|
+
const I = new w.Quaternion();
|
|
11960
|
+
I.setFromRotationMatrix(O), i.quaternion.copy(I), td(
|
|
11916
11961
|
i,
|
|
11917
11962
|
e,
|
|
11918
11963
|
i.position.clone(),
|
|
11919
|
-
|
|
11964
|
+
C,
|
|
11920
11965
|
M,
|
|
11921
|
-
|
|
11966
|
+
S
|
|
11922
11967
|
), i.up.set(0, 1, 0), i.lookAt(new w.Vector3(0, 0, 0)), e.target.set(0, 0, 0), e.update();
|
|
11923
11968
|
},
|
|
11924
|
-
[i, e,
|
|
11925
|
-
), { onMouseDown:
|
|
11969
|
+
[i, e, S, r]
|
|
11970
|
+
), { onMouseDown: A, onMouseMove: E, onMouseUp: T, onMouseLeave: b } = kd({
|
|
11926
11971
|
gizmoRenderer: a,
|
|
11927
11972
|
gizmoScene: r,
|
|
11928
11973
|
gizmoCamera: f,
|
|
@@ -11930,45 +11975,45 @@ const kd = ({
|
|
|
11930
11975
|
gizmoControlRef: y
|
|
11931
11976
|
});
|
|
11932
11977
|
return rt(() => {
|
|
11933
|
-
const
|
|
11934
|
-
if (!
|
|
11978
|
+
const x = o.current;
|
|
11979
|
+
if (!x || !i || !e || !a) return;
|
|
11935
11980
|
y.current && y.current.dispose();
|
|
11936
11981
|
const P = {
|
|
11937
|
-
gizmoDiv:
|
|
11982
|
+
gizmoDiv: x,
|
|
11938
11983
|
gizmoScene: r,
|
|
11939
11984
|
gizmoRenderer: a,
|
|
11940
11985
|
gizmoCamera: f
|
|
11941
|
-
},
|
|
11986
|
+
}, C = {
|
|
11942
11987
|
mainCamera: i,
|
|
11943
11988
|
mainControls: e,
|
|
11944
|
-
renderGizmo:
|
|
11989
|
+
renderGizmo: S
|
|
11945
11990
|
}, M = {
|
|
11946
11991
|
syncGizmoCameraWithMain: po,
|
|
11947
|
-
syncMainCameraWithGizmo:
|
|
11992
|
+
syncMainCameraWithGizmo: Ed
|
|
11948
11993
|
};
|
|
11949
|
-
return y.current = new
|
|
11994
|
+
return y.current = new vd({
|
|
11950
11995
|
gizmoParams: P,
|
|
11951
|
-
mainParams:
|
|
11996
|
+
mainParams: C,
|
|
11952
11997
|
syncFunctions: M,
|
|
11953
11998
|
options: s
|
|
11954
|
-
}),
|
|
11955
|
-
y.current && (y.current.dispose(), y.current = null),
|
|
11999
|
+
}), x.addEventListener("mousedown", A), x.addEventListener("mousemove", E), x.addEventListener("mouseup", T), x.addEventListener("mouseleave", b), () => {
|
|
12000
|
+
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
12001
|
};
|
|
11957
|
-
}, [i, e,
|
|
11958
|
-
i && (po(f, i, r),
|
|
11959
|
-
}, [i,
|
|
12002
|
+
}, [i, e, S, E, A, T]), rt(() => {
|
|
12003
|
+
i && (po(f, i, r), S());
|
|
12004
|
+
}, [i, S]), /* @__PURE__ */ Te(
|
|
11960
12005
|
"div",
|
|
11961
12006
|
{
|
|
11962
12007
|
className: t ? `${t}` : "gizmo-default",
|
|
11963
12008
|
ref: o
|
|
11964
12009
|
}
|
|
11965
12010
|
);
|
|
11966
|
-
},
|
|
11967
|
-
top: i.startsWith("top") ?
|
|
11968
|
-
bottom: i.startsWith("bottom") ?
|
|
11969
|
-
left: i.endsWith("left") ?
|
|
11970
|
-
right: i.endsWith("right") ?
|
|
11971
|
-
}),
|
|
12011
|
+
}, Fs = 10, zd = (i) => ({
|
|
12012
|
+
top: i.startsWith("top") ? Fs : "auto",
|
|
12013
|
+
bottom: i.startsWith("bottom") ? Fs : "auto",
|
|
12014
|
+
left: i.endsWith("left") ? Fs : "auto",
|
|
12015
|
+
right: i.endsWith("right") ? Fs : "auto"
|
|
12016
|
+
}), Bd = ({
|
|
11972
12017
|
camera: i,
|
|
11973
12018
|
controls: e,
|
|
11974
12019
|
render: t,
|
|
@@ -11987,10 +12032,10 @@ const kd = ({
|
|
|
11987
12032
|
width: s,
|
|
11988
12033
|
height: s,
|
|
11989
12034
|
zIndex: 1e3,
|
|
11990
|
-
...
|
|
12035
|
+
...zd(n)
|
|
11991
12036
|
},
|
|
11992
12037
|
children: /* @__PURE__ */ Te(
|
|
11993
|
-
|
|
12038
|
+
Fd,
|
|
11994
12039
|
{
|
|
11995
12040
|
camera: i,
|
|
11996
12041
|
controls: o,
|
|
@@ -12000,7 +12045,7 @@ const kd = ({
|
|
|
12000
12045
|
}
|
|
12001
12046
|
);
|
|
12002
12047
|
};
|
|
12003
|
-
class
|
|
12048
|
+
class Ud extends Ka {
|
|
12004
12049
|
constructor(e) {
|
|
12005
12050
|
super(e), this.reset = () => {
|
|
12006
12051
|
this.setState({ hasError: !1, error: null });
|
|
@@ -12032,7 +12077,7 @@ class Bd extends Ka {
|
|
|
12032
12077
|
] }) }) : this.props.children;
|
|
12033
12078
|
}
|
|
12034
12079
|
}
|
|
12035
|
-
function
|
|
12080
|
+
function Hd({ status: i, label: e, color: t, backdrop: n }) {
|
|
12036
12081
|
const s = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
12037
12082
|
return /* @__PURE__ */ Vn(
|
|
12038
12083
|
"div",
|
|
@@ -12082,14 +12127,14 @@ function Ud({ status: i, label: e, color: t, backdrop: n }) {
|
|
|
12082
12127
|
}
|
|
12083
12128
|
);
|
|
12084
12129
|
}
|
|
12085
|
-
const
|
|
12130
|
+
const jd = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif', Gd = {
|
|
12086
12131
|
background: "rgba(255,255,255,0.78)",
|
|
12087
12132
|
backdropFilter: "blur(16px)",
|
|
12088
12133
|
WebkitBackdropFilter: "blur(16px)",
|
|
12089
12134
|
border: "1px solid rgba(0,0,0,0.06)",
|
|
12090
12135
|
boxShadow: "0 8px 30px rgba(0,0,0,0.10)"
|
|
12091
|
-
},
|
|
12092
|
-
function
|
|
12136
|
+
}, Vd = Object.keys(sa);
|
|
12137
|
+
function Wd({ active: i, onSelect: e }) {
|
|
12093
12138
|
return /* @__PURE__ */ Te(
|
|
12094
12139
|
"div",
|
|
12095
12140
|
{
|
|
@@ -12110,9 +12155,9 @@ function Vd({ active: i, onSelect: e }) {
|
|
|
12110
12155
|
// instead of bleeding past the canvas edges.
|
|
12111
12156
|
maxWidth: "calc(100% - 16px)",
|
|
12112
12157
|
overflowX: "auto",
|
|
12113
|
-
...
|
|
12158
|
+
...Gd
|
|
12114
12159
|
},
|
|
12115
|
-
children:
|
|
12160
|
+
children: Vd.map((t) => /* @__PURE__ */ Te(
|
|
12116
12161
|
"button",
|
|
12117
12162
|
{
|
|
12118
12163
|
type: "button",
|
|
@@ -12127,7 +12172,7 @@ function Vd({ active: i, onSelect: e }) {
|
|
|
12127
12172
|
border: t === i ? "1px solid #111318" : "1px solid transparent",
|
|
12128
12173
|
background: t === i ? "#111318" : "transparent",
|
|
12129
12174
|
color: t === i ? "#fff" : "#3f3f4a",
|
|
12130
|
-
fontFamily:
|
|
12175
|
+
fontFamily: jd,
|
|
12131
12176
|
fontSize: 13,
|
|
12132
12177
|
fontWeight: 500,
|
|
12133
12178
|
lineHeight: 1,
|
|
@@ -12152,7 +12197,7 @@ const jn = {
|
|
|
12152
12197
|
// default light background (#f0f0f7) and dark studio mode.
|
|
12153
12198
|
backdrop: "rgba(15,16,20,0.6)"
|
|
12154
12199
|
};
|
|
12155
|
-
function
|
|
12200
|
+
function Zd(i) {
|
|
12156
12201
|
return i === void 0 || i === !0 ? jn : i === !1 ? { ...jn, enabled: !1 } : {
|
|
12157
12202
|
enabled: i.enabled ?? !0,
|
|
12158
12203
|
label: i.label ?? jn.label,
|
|
@@ -12161,42 +12206,42 @@ function Wd(i) {
|
|
|
12161
12206
|
backdrop: i.backdrop ?? jn.backdrop
|
|
12162
12207
|
};
|
|
12163
12208
|
}
|
|
12164
|
-
const
|
|
12209
|
+
const zs = () => new W("Viewer is not ready yet", K.COMPONENT_NOT_MOUNTED), da = mo(
|
|
12165
12210
|
({ object: i, options: e = {}, preset: t, pathTraced: n, turntable: s, animations: o, children: r }, a) => {
|
|
12166
12211
|
var D, H;
|
|
12167
|
-
const c = Ge(null), u = e.preset ?? t, { activePreset: d, pickerEnabled: h, selectPreset: p } =
|
|
12212
|
+
const c = Ge(null), u = e.preset ?? t, { activePreset: d, pickerEnabled: h, selectPreset: p } = Xu(
|
|
12168
12213
|
u,
|
|
12169
12214
|
e.ui
|
|
12170
|
-
), f =
|
|
12215
|
+
), f = Yu(
|
|
12171
12216
|
e,
|
|
12172
12217
|
d,
|
|
12173
12218
|
n,
|
|
12174
12219
|
s,
|
|
12175
12220
|
o
|
|
12176
|
-
), { viewer: y, isInitialized:
|
|
12177
|
-
|
|
12178
|
-
const T = y ? es(y.getCamera()) : null,
|
|
12221
|
+
), { viewer: y, isInitialized: S, initError: _ } = Ku(c, f), A = qu(y, S, i), E = $u(y);
|
|
12222
|
+
Qu(y, _, e);
|
|
12223
|
+
const T = y ? es(y.getCamera()) : null, b = y ? hr(y.getControls()) : null, x = y ? Xo(y.getRenderer()) : null, P = Rt(() => {
|
|
12179
12224
|
y == null || y.requestRender();
|
|
12180
|
-
}, [y]),
|
|
12181
|
-
() =>
|
|
12225
|
+
}, [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(
|
|
12226
|
+
() => Zd(e.loadingIndicator),
|
|
12182
12227
|
[e.loadingIndicator]
|
|
12183
|
-
),
|
|
12228
|
+
), I = A.status === "error" || !!_, k = O.enabled && (A.status === "loading" || I);
|
|
12184
12229
|
return Xa(a, () => ({
|
|
12185
12230
|
scene: y ? It(y.getScene()) : null,
|
|
12186
12231
|
camera: T,
|
|
12187
|
-
renderer:
|
|
12188
|
-
controls:
|
|
12232
|
+
renderer: x,
|
|
12233
|
+
controls: b,
|
|
12189
12234
|
events: E,
|
|
12190
12235
|
loadModel: async (G) => {
|
|
12191
12236
|
if (!y)
|
|
12192
|
-
throw
|
|
12237
|
+
throw zs();
|
|
12193
12238
|
const q = typeof G == "string" ? G : new Xe(G), ie = await y.loadModel(q);
|
|
12194
12239
|
if (!ie.ok)
|
|
12195
12240
|
throw ie.error;
|
|
12196
12241
|
},
|
|
12197
12242
|
captureStill: async (G) => {
|
|
12198
12243
|
if (!y)
|
|
12199
|
-
throw
|
|
12244
|
+
throw zs();
|
|
12200
12245
|
const q = await y.captureStill(G);
|
|
12201
12246
|
if (!q.ok)
|
|
12202
12247
|
throw q.error;
|
|
@@ -12204,7 +12249,7 @@ const Fs = () => new W("Viewer is not ready yet", K.COMPONENT_NOT_MOUNTED), da =
|
|
|
12204
12249
|
},
|
|
12205
12250
|
captureVideo: async (G) => {
|
|
12206
12251
|
if (!y)
|
|
12207
|
-
throw
|
|
12252
|
+
throw zs();
|
|
12208
12253
|
const q = await y.captureVideo(G);
|
|
12209
12254
|
if (!q.ok)
|
|
12210
12255
|
throw q.error;
|
|
@@ -12213,7 +12258,7 @@ const Fs = () => new W("Viewer is not ready yet", K.COMPONENT_NOT_MOUNTED), da =
|
|
|
12213
12258
|
getAnimationNames: () => (y == null ? void 0 : y.getAnimationNames()) ?? [],
|
|
12214
12259
|
playAnimations: (G) => {
|
|
12215
12260
|
if (!y)
|
|
12216
|
-
throw
|
|
12261
|
+
throw zs();
|
|
12217
12262
|
const q = y.playAnimations(G);
|
|
12218
12263
|
if (!q.ok)
|
|
12219
12264
|
throw q.error;
|
|
@@ -12224,40 +12269,40 @@ const Fs = () => new W("Viewer is not ready yet", K.COMPONENT_NOT_MOUNTED), da =
|
|
|
12224
12269
|
dispose: () => {
|
|
12225
12270
|
y == null || y.dispose();
|
|
12226
12271
|
}
|
|
12227
|
-
}), [y, T,
|
|
12228
|
-
/* @__PURE__ */ Te(
|
|
12229
|
-
|
|
12230
|
-
|
|
12272
|
+
}), [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: [
|
|
12273
|
+
/* @__PURE__ */ Te(ed, {}),
|
|
12274
|
+
C && S && T && b && /* @__PURE__ */ Te(
|
|
12275
|
+
Bd,
|
|
12231
12276
|
{
|
|
12232
12277
|
camera: T,
|
|
12233
|
-
controls:
|
|
12278
|
+
controls: b,
|
|
12234
12279
|
render: P,
|
|
12235
12280
|
placement: M.placement,
|
|
12236
12281
|
size: M.size
|
|
12237
12282
|
}
|
|
12238
12283
|
),
|
|
12239
12284
|
k && /* @__PURE__ */ Te(
|
|
12240
|
-
|
|
12285
|
+
Hd,
|
|
12241
12286
|
{
|
|
12242
|
-
status:
|
|
12243
|
-
label:
|
|
12287
|
+
status: I ? "error" : "loading",
|
|
12288
|
+
label: I ? O.errorLabel ?? (_ == null ? void 0 : _.message) ?? A.error ?? "Failed to load model" : O.label,
|
|
12244
12289
|
color: O.color,
|
|
12245
12290
|
backdrop: O.backdrop
|
|
12246
12291
|
}
|
|
12247
12292
|
),
|
|
12248
12293
|
h && /* The defaults ARE the studio look (pinned by presets.test.ts),
|
|
12249
12294
|
so with no preset set the studio chip is the honest active one. */
|
|
12250
|
-
/* @__PURE__ */ Te(
|
|
12295
|
+
/* @__PURE__ */ Te(Wd, { active: d ?? "studio", onSelect: p }),
|
|
12251
12296
|
r
|
|
12252
12297
|
] }) }) });
|
|
12253
12298
|
}
|
|
12254
12299
|
);
|
|
12255
12300
|
da.displayName = "SimpleViewer";
|
|
12256
|
-
const
|
|
12301
|
+
const Kd = mo(
|
|
12257
12302
|
(i, e) => /* @__PURE__ */ Te(da, { ref: e, ...i })
|
|
12258
12303
|
);
|
|
12259
|
-
|
|
12260
|
-
const
|
|
12304
|
+
Kd.displayName = "SimpleViewer";
|
|
12305
|
+
const Xd = () => /* @__PURE__ */ Te(
|
|
12261
12306
|
"span",
|
|
12262
12307
|
{
|
|
12263
12308
|
"aria-hidden": "true",
|
|
@@ -12272,7 +12317,7 @@ const Kd = () => /* @__PURE__ */ Te(
|
|
|
12272
12317
|
}
|
|
12273
12318
|
}
|
|
12274
12319
|
);
|
|
12275
|
-
function
|
|
12320
|
+
function tp({ position: i, occlude: e = !1, children: t }) {
|
|
12276
12321
|
const { viewer: n } = oa(), s = Ge(null), [o, r, a] = i;
|
|
12277
12322
|
rt(() => {
|
|
12278
12323
|
if (!n)
|
|
@@ -12296,13 +12341,13 @@ function ep({ position: i, occlude: e = !1, children: t }) {
|
|
|
12296
12341
|
d.invalidate(), p();
|
|
12297
12342
|
};
|
|
12298
12343
|
p();
|
|
12299
|
-
const y = n.getEvents(),
|
|
12344
|
+
const y = n.getEvents(), S = [
|
|
12300
12345
|
y.on("render:complete", p),
|
|
12301
12346
|
y.on("controls:change", p),
|
|
12302
12347
|
y.on("model:loaded", f)
|
|
12303
12348
|
];
|
|
12304
12349
|
return window.addEventListener("resize", f), () => {
|
|
12305
|
-
|
|
12350
|
+
S.forEach((_) => _()), window.removeEventListener("resize", f);
|
|
12306
12351
|
};
|
|
12307
12352
|
}, [n, o, r, a, e]);
|
|
12308
12353
|
const c = t != null && t !== !1;
|
|
@@ -12323,7 +12368,7 @@ function ep({ position: i, occlude: e = !1, children: t }) {
|
|
|
12323
12368
|
// interactive custom children keep receiving pointer events.
|
|
12324
12369
|
pointerEvents: c ? "auto" : "none"
|
|
12325
12370
|
},
|
|
12326
|
-
children: c ? t : /* @__PURE__ */ Te(
|
|
12371
|
+
children: c ? t : /* @__PURE__ */ Te(Xd, {})
|
|
12327
12372
|
}
|
|
12328
12373
|
);
|
|
12329
12374
|
}
|
|
@@ -12332,23 +12377,23 @@ export {
|
|
|
12332
12377
|
Qe as C,
|
|
12333
12378
|
Mr as D,
|
|
12334
12379
|
K as E,
|
|
12335
|
-
|
|
12380
|
+
tp as H,
|
|
12336
12381
|
De as I,
|
|
12337
|
-
|
|
12338
|
-
|
|
12382
|
+
Qd as L,
|
|
12383
|
+
Zs as M,
|
|
12339
12384
|
$e as O,
|
|
12340
12385
|
N as R,
|
|
12341
12386
|
ir as S,
|
|
12342
12387
|
tr as T,
|
|
12343
12388
|
sa as V,
|
|
12344
12389
|
or as a,
|
|
12345
|
-
|
|
12390
|
+
Jd as b,
|
|
12346
12391
|
zc as c,
|
|
12347
12392
|
Ko as d,
|
|
12348
12393
|
W as e,
|
|
12349
|
-
|
|
12394
|
+
Xs as f,
|
|
12350
12395
|
Qc as g,
|
|
12351
|
-
|
|
12396
|
+
Kd as h,
|
|
12352
12397
|
Wi as i,
|
|
12353
|
-
|
|
12398
|
+
Gu as r
|
|
12354
12399
|
};
|