@needle-tools/engine 5.1.0-next.1780579670.dramatic-pierogi.b8fa941 → 5.1.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/CHANGELOG.md +119 -0
- package/components.needle.json +1 -1
- package/dist/gltf-progressive-BGQ-cjly.umd.cjs +10 -0
- package/dist/gltf-progressive-BvQHrERj.min.js +10 -0
- package/dist/{gltf-progressive-CH7aqHHr.js → gltf-progressive-CtYnVfLc.js} +420 -351
- package/dist/{materialx-B85WjP7E.min.js → materialx-B5gKeM65.min.js} +1 -1
- package/dist/{materialx-B47Bz-xs.umd.cjs → materialx-CFRcCYWy.umd.cjs} +1 -1
- package/dist/{materialx-jkHmVPez.js → materialx-DqGmteNO.js} +1 -1
- package/dist/{needle-engine.bundle-WQeWxmZD.js → needle-engine.bundle-5oIL49YP.js} +6826 -6685
- package/dist/{needle-engine.bundle-BSPk6RkD.min.js → needle-engine.bundle-DAAfj8Cs.min.js} +161 -149
- package/dist/{needle-engine.bundle-DCPHDPAd.umd.cjs → needle-engine.bundle-DvOrfXws.umd.cjs} +159 -147
- package/dist/needle-engine.d.ts +106 -44
- package/dist/needle-engine.js +610 -608
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/three.js +3 -0
- package/dist/three.min.js +22 -22
- package/dist/three.umd.cjs +24 -24
- package/dist/{vendor-BQ2Vuntm.min.js → vendor-2--bD1c9.min.js} +19 -19
- package/dist/{vendor-BslSKZPo.js → vendor-BNtcIZkv.js} +1141 -1138
- package/dist/{vendor-1UvpPPSB.umd.cjs → vendor-vbe9sv1t.umd.cjs} +20 -20
- package/lib/engine/api.d.ts +1 -1
- package/lib/engine/api.js +1 -1
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/engine_context.js +16 -3
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_init.js +2 -2
- package/lib/engine/engine_init.js.map +1 -1
- package/lib/engine/engine_license.d.ts +7 -7
- package/lib/engine/engine_license.js +72 -72
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine/engine_networking_blob.js +3 -3
- package/lib/engine/engine_networking_blob.js.map +1 -1
- package/lib/engine/engine_utils_qrcode.js +2 -2
- package/lib/engine/engine_utils_qrcode.js.map +1 -1
- package/lib/engine/postprocessing/postprocessing.d.ts +2 -1
- package/lib/engine/postprocessing/postprocessing.js +3 -2
- package/lib/engine/postprocessing/postprocessing.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
- package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +2 -2
- package/lib/engine/webcomponents/needle menu/needle-menu.js +9 -9
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.js +2 -2
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
- package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
- package/lib/engine/xr/NeedleXRSession.d.ts +24 -0
- package/lib/engine/xr/NeedleXRSession.js +52 -7
- package/lib/engine/xr/NeedleXRSession.js.map +1 -1
- package/lib/engine/xr/TempXRContext.js +2 -2
- package/lib/engine/xr/TempXRContext.js.map +1 -1
- package/lib/engine/xr/init.js +2 -3
- package/lib/engine/xr/init.js.map +1 -1
- package/lib/engine-components/Component.js +14 -1
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/ContactShadows.d.ts +7 -2
- package/lib/engine-components/ContactShadows.js +65 -45
- package/lib/engine-components/ContactShadows.js.map +1 -1
- package/lib/engine-components/GroundProjection.d.ts +6 -0
- package/lib/engine-components/GroundProjection.js +69 -7
- package/lib/engine-components/GroundProjection.js.map +1 -1
- package/lib/engine-components/NeedleMenu.d.ts +1 -1
- package/lib/engine-components/NeedleMenu.js +5 -2
- package/lib/engine-components/NeedleMenu.js.map +1 -1
- package/lib/engine-components/SceneSwitcher.d.ts +2 -0
- package/lib/engine-components/SceneSwitcher.js +26 -14
- package/lib/engine-components/SceneSwitcher.js.map +1 -1
- package/lib/engine-components/SeeThrough.d.ts +39 -0
- package/lib/engine-components/SeeThrough.js +69 -1
- package/lib/engine-components/SeeThrough.js.map +1 -1
- package/lib/engine-components/Skybox.js +9 -0
- package/lib/engine-components/Skybox.js.map +1 -1
- package/lib/engine-components/api.d.ts +1 -0
- package/lib/engine-components/api.js +1 -0
- package/lib/engine-components/api.js.map +1 -1
- package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
- package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +9 -5
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
- package/lib/engine-components/particlesystem/ParticleSystem.js +4 -0
- package/lib/engine-components/particlesystem/ParticleSystem.js.map +1 -1
- package/lib/engine-components/postprocessing/Volume.d.ts +1 -9
- package/lib/engine-components/postprocessing/Volume.js +2 -14
- package/lib/engine-components/postprocessing/Volume.js.map +1 -1
- package/lib/engine-components/webxr/WebXRImageTracking.js +3 -0
- package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
- package/package.json +4 -4
- package/plugins/common/license.js +4 -4
- package/plugins/types/userconfig.d.ts +10 -0
- package/plugins/vite/build-pipeline.d.ts +19 -0
- package/plugins/vite/build-pipeline.js +67 -5
- package/plugins/vite/license.js +4 -4
- package/src/engine/api.ts +1 -1
- package/src/engine/engine_context.ts +15 -2
- package/src/engine/engine_gameobject.ts +1 -1
- package/src/engine/engine_init.ts +2 -2
- package/src/engine/engine_license.ts +69 -69
- package/src/engine/engine_networking_blob.ts +3 -3
- package/src/engine/engine_utils_qrcode.ts +2 -2
- package/src/engine/postprocessing/postprocessing.ts +3 -2
- package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
- package/src/engine/webcomponents/needle menu/needle-menu.ts +10 -10
- package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
- package/src/engine/webcomponents/needle-engine.ts +2 -2
- package/src/engine/xr/NeedleXRSession.ts +53 -7
- package/src/engine/xr/TempXRContext.ts +2 -2
- package/src/engine/xr/init.ts +2 -3
- package/src/engine-components/Component.ts +13 -1
- package/src/engine-components/ContactShadows.ts +75 -49
- package/src/engine-components/GroundProjection.ts +71 -7
- package/src/engine-components/NeedleMenu.ts +6 -3
- package/src/engine-components/SceneSwitcher.ts +23 -13
- package/src/engine-components/SeeThrough.ts +75 -1
- package/src/engine-components/Skybox.ts +8 -0
- package/src/engine-components/api.ts +1 -0
- package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
- package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +12 -5
- package/src/engine-components/particlesystem/ParticleSystem.ts +4 -0
- package/src/engine-components/postprocessing/Volume.ts +2 -13
- package/src/engine-components/webxr/WebXRImageTracking.ts +1 -0
- package/dist/gltf-progressive-9tlS5iCx.umd.cjs +0 -10
- package/dist/gltf-progressive-CVg80COO.min.js +0 -10
|
@@ -1,66 +1,95 @@
|
|
|
1
|
-
import { BufferGeometry as j, Mesh as
|
|
2
|
-
import { DRACOLoader as
|
|
3
|
-
const
|
|
4
|
-
globalThis.GLTF_PROGRESSIVE_VERSION =
|
|
1
|
+
import { RedFormat as je, RedIntegerFormat as He, RGFormat as Ke, RGIntegerFormat as Ye, RGBFormat as Qe, RGBAFormat as Je, RGBAIntegerFormat as Ze, BufferGeometry as j, Mesh as H, Box3 as ce, Vector3 as k, Sphere as Ie, CompressedTexture as et, Texture as G, Matrix3 as tt, InterleavedBuffer as st, InterleavedBufferAttribute as rt, BufferAttribute as nt, TextureLoader as it, Matrix4 as $e, THREE as ot, Color as Be } from "./three.js";
|
|
2
|
+
import { DRACOLoader as at, KTX2Loader as lt, MeshoptDecoder as ut, GLTFLoader as Me } from "./three-examples.js";
|
|
3
|
+
const ct = "";
|
|
4
|
+
globalThis.GLTF_PROGRESSIVE_VERSION = ct;
|
|
5
5
|
console.debug("[gltf-progressive] version -");
|
|
6
|
-
let I = "https://www.gstatic.com/draco/versioned/decoders/1.5.7/",
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
fetch(
|
|
6
|
+
let I = "https://www.gstatic.com/draco/versioned/decoders/1.5.7/", K = "https://cdn.needle.tools/static/three/0.179.1/basis2/";
|
|
7
|
+
const ft = I, dt = K, Ge = new URL(I + "draco_decoder.js");
|
|
8
|
+
Ge.searchParams.append("range", "true");
|
|
9
|
+
fetch(Ge, {
|
|
10
10
|
method: "GET",
|
|
11
11
|
headers: {
|
|
12
12
|
Range: "bytes=0-1"
|
|
13
13
|
}
|
|
14
14
|
}).catch((i) => {
|
|
15
|
-
console.debug(`Failed to fetch remote Draco decoder from ${I} (offline: ${typeof navigator < "u" ? navigator.onLine : "unknown"})`), I ===
|
|
15
|
+
console.debug(`Failed to fetch remote Draco decoder from ${I} (offline: ${typeof navigator < "u" ? navigator.onLine : "unknown"})`), I === ft && gt("./include/draco/"), K === dt && pt("./include/ktx2/");
|
|
16
16
|
}).finally(() => {
|
|
17
|
-
|
|
17
|
+
We();
|
|
18
18
|
});
|
|
19
|
-
const
|
|
19
|
+
const ht = () => ({
|
|
20
20
|
dracoDecoderPath: I,
|
|
21
|
-
ktx2TranscoderPath:
|
|
21
|
+
ktx2TranscoderPath: K
|
|
22
22
|
});
|
|
23
|
-
function
|
|
23
|
+
function gt(i) {
|
|
24
24
|
I = i, P && P[xe] != I ? (console.debug("Updating Draco decoder path to " + i), P[xe] = I, P.setDecoderPath(I), P.preload()) : console.debug("Setting Draco decoder path to " + i);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
26
|
+
function pt(i) {
|
|
27
|
+
K = i, $ && $.transcoderPath != K ? (console.debug("Updating KTX2 transcoder path to " + i), $.setTranscoderPath(K), $.init()) : console.debug("Setting KTX2 transcoder path to " + i);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
return
|
|
29
|
+
function _e(i) {
|
|
30
|
+
return We(), i ? $.detectSupport(i) : i !== null && console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures might fail"), { dracoLoader: P, ktx2Loader: $, meshoptDecoder: le };
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function qe(i) {
|
|
33
33
|
i.dracoLoader || i.setDRACOLoader(P), i.ktx2Loader || i.setKTX2Loader($), i.meshoptDecoder || i.setMeshoptDecoder(le);
|
|
34
34
|
}
|
|
35
35
|
const xe = /* @__PURE__ */ Symbol("dracoDecoderPath");
|
|
36
36
|
let P, le, $;
|
|
37
|
-
function
|
|
38
|
-
P || (P = new
|
|
37
|
+
function We() {
|
|
38
|
+
P || (P = new at(), P[xe] = I, P.setDecoderPath(I), P.setDecoderConfig({ type: "js" }), P.preload()), $ || ($ = new lt(), $.setTranscoderPath(K), $.init()), le || (le = ut);
|
|
39
39
|
}
|
|
40
|
-
const
|
|
41
|
-
function
|
|
42
|
-
let e =
|
|
43
|
-
e ? e = Object.assign(e, t) : e = t,
|
|
40
|
+
const Le = /* @__PURE__ */ new WeakMap();
|
|
41
|
+
function Fe(i, t) {
|
|
42
|
+
let e = Le.get(i);
|
|
43
|
+
e ? e = Object.assign(e, t) : e = t, Le.set(i, e);
|
|
44
44
|
}
|
|
45
|
-
const
|
|
46
|
-
function
|
|
47
|
-
const t =
|
|
45
|
+
const mt = Me.prototype.load;
|
|
46
|
+
function yt(...i) {
|
|
47
|
+
const t = Le.get(this);
|
|
48
48
|
let e = i[0];
|
|
49
|
-
const s =
|
|
50
|
-
if (s
|
|
49
|
+
const s = xt(e);
|
|
50
|
+
if (s?.hostname.endsWith("needle.tools")) {
|
|
51
51
|
const n = t?.progressive !== void 0 ? t.progressive : !0, o = t?.usecase ? t.usecase : "default";
|
|
52
52
|
n ? this.requestHeader.Accept = `*/*;progressive=allowed;usecase=${o}` : this.requestHeader.Accept = `*/*;usecase=${o}`, e = s.toString();
|
|
53
53
|
}
|
|
54
|
-
return i[0] = e,
|
|
54
|
+
return i[0] = e, mt?.call(this, ...i);
|
|
55
|
+
}
|
|
56
|
+
Me.prototype.load = yt;
|
|
57
|
+
function xt(i) {
|
|
58
|
+
try {
|
|
59
|
+
if (i instanceof URL)
|
|
60
|
+
return i;
|
|
61
|
+
const t = globalThis.location?.href;
|
|
62
|
+
return t ? new URL(i, t) : new URL(i);
|
|
63
|
+
} catch {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function Te(i) {
|
|
68
|
+
return i != null && i.data != null;
|
|
55
69
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (typeof window > "u") return !1;
|
|
60
|
-
const e = new URL(window.location.href).searchParams.get(i);
|
|
61
|
-
return e == null || e === "0" || e === "false" ? !1 : e === "" ? !0 : e;
|
|
70
|
+
function we(i) {
|
|
71
|
+
const t = i.source?.data;
|
|
72
|
+
return t != null && typeof t == "object" ? t : null;
|
|
62
73
|
}
|
|
63
|
-
function
|
|
74
|
+
function Lt(i) {
|
|
75
|
+
const t = i.image;
|
|
76
|
+
return t != null && typeof t == "object" ? t : null;
|
|
77
|
+
}
|
|
78
|
+
function De(i) {
|
|
79
|
+
const t = Lt(i), e = we(i);
|
|
80
|
+
return {
|
|
81
|
+
width: t?.width || e?.width || 0,
|
|
82
|
+
height: t?.height || e?.height || 0
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
N("debugprogressive");
|
|
86
|
+
function N(i) {
|
|
87
|
+
const t = globalThis.location?.href;
|
|
88
|
+
if (!t) return !1;
|
|
89
|
+
const s = new URL(t).searchParams.get(i);
|
|
90
|
+
return s == null || s === "0" || s === "false" ? !1 : s === "" ? !0 : s;
|
|
91
|
+
}
|
|
92
|
+
function wt(i, t) {
|
|
64
93
|
if (t === void 0 || i === void 0 || t.startsWith("./") || t.startsWith("http") || t.startsWith("data:") || t.startsWith("blob:"))
|
|
65
94
|
return t;
|
|
66
95
|
const e = i.lastIndexOf("/");
|
|
@@ -71,18 +100,21 @@ function at(i, t) {
|
|
|
71
100
|
}
|
|
72
101
|
return t;
|
|
73
102
|
}
|
|
74
|
-
function
|
|
75
|
-
|
|
103
|
+
function be() {
|
|
104
|
+
if (Z !== void 0) return Z;
|
|
105
|
+
const i = globalThis.navigator?.userAgent || "";
|
|
106
|
+
return Z = /iPhone|iPad|iPod|Android|IEMobile/i.test(i), N("debugprogressive") && console.log("[glTF Progressive]: isMobileDevice", Z), Z;
|
|
76
107
|
}
|
|
77
108
|
let Z;
|
|
78
|
-
function
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
109
|
+
function Ue() {
|
|
110
|
+
const i = globalThis.location?.href;
|
|
111
|
+
if (!i) return !1;
|
|
112
|
+
const t = new URL(i), e = t.hostname === "localhost" || /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(t.hostname);
|
|
113
|
+
return t.hostname === "127.0.0.1" || e;
|
|
82
114
|
}
|
|
83
|
-
class
|
|
115
|
+
class Dt {
|
|
84
116
|
constructor(t, e = {}) {
|
|
85
|
-
this.maxConcurrent = t, this.debug = e.debug ?? !1, typeof
|
|
117
|
+
this.maxConcurrent = t, this.debug = e.debug ?? !1, typeof globalThis.requestAnimationFrame == "function" ? globalThis.requestAnimationFrame(this.tick) : setTimeout(this.tick, 0);
|
|
86
118
|
}
|
|
87
119
|
_running = /* @__PURE__ */ new Map();
|
|
88
120
|
_queue = [];
|
|
@@ -114,52 +146,52 @@ class lt {
|
|
|
114
146
|
}
|
|
115
147
|
}
|
|
116
148
|
}
|
|
117
|
-
function
|
|
118
|
-
const t = i.image?.width ?? 0,
|
|
119
|
-
return
|
|
149
|
+
function vt(i) {
|
|
150
|
+
const t = i.image, e = t?.width ?? 0, s = t?.height ?? 0, r = t?.depth ?? 1, n = Math.floor(Math.log2(Math.max(e, s, r))) + 1, o = Mt(i);
|
|
151
|
+
return e * s * r * o * (1 - Math.pow(0.25, n)) / (1 - 0.25);
|
|
120
152
|
}
|
|
121
|
-
function
|
|
153
|
+
function Mt(i) {
|
|
122
154
|
let t = 4;
|
|
123
155
|
const e = i.format;
|
|
124
|
-
e ===
|
|
156
|
+
e === je || e === He ? t = 1 : e === Ke || e === Ye ? t = 2 : e === Qe || e === 1029 ? t = 3 : (e === Je || e === Ze) && (t = 4);
|
|
125
157
|
let s = 1;
|
|
126
158
|
const r = i.type;
|
|
127
159
|
return r === 1009 || r === 1010 ? s = 1 : r === 1011 || r === 1012 ? s = 2 : r === 1013 || r === 1014 || r === 1015 ? s = 4 : r === 1016 && (s = 2), t * s;
|
|
128
160
|
}
|
|
129
|
-
const
|
|
161
|
+
const _t = typeof window > "u" && typeof document > "u", ve = /* @__PURE__ */ Symbol("needle:raycast-mesh");
|
|
130
162
|
function ne(i) {
|
|
131
|
-
return i?.[
|
|
163
|
+
return i?.[ve] instanceof j ? i[ve] : null;
|
|
132
164
|
}
|
|
133
|
-
function
|
|
165
|
+
function bt(i, t) {
|
|
134
166
|
if ((i.type === "Mesh" || i.type === "SkinnedMesh") && !ne(i)) {
|
|
135
|
-
const s =
|
|
136
|
-
s.userData = { isRaycastMesh: !0 }, i[
|
|
167
|
+
const s = Tt(t);
|
|
168
|
+
s.userData = { isRaycastMesh: !0 }, i[ve] = s;
|
|
137
169
|
}
|
|
138
170
|
}
|
|
139
|
-
function
|
|
171
|
+
function Ot(i = !0) {
|
|
140
172
|
if (i) {
|
|
141
173
|
if (ee) return;
|
|
142
|
-
const t = ee =
|
|
143
|
-
|
|
174
|
+
const t = ee = H.prototype.raycast;
|
|
175
|
+
H.prototype.raycast = function(e, s) {
|
|
144
176
|
const r = this, n = ne(r);
|
|
145
177
|
let o;
|
|
146
178
|
n && r.isMesh && (o = r.geometry, r.geometry = n), t.call(this, e, s), o && (r.geometry = o);
|
|
147
179
|
};
|
|
148
180
|
} else {
|
|
149
181
|
if (!ee) return;
|
|
150
|
-
|
|
182
|
+
H.prototype.raycast = ee, ee = null;
|
|
151
183
|
}
|
|
152
184
|
}
|
|
153
185
|
let ee = null;
|
|
154
|
-
function
|
|
186
|
+
function Tt(i) {
|
|
155
187
|
const t = new j();
|
|
156
188
|
for (const e in i.attributes)
|
|
157
189
|
t.setAttribute(e, i.getAttribute(e));
|
|
158
190
|
return t.setIndex(i.getIndex()), t;
|
|
159
191
|
}
|
|
160
|
-
const W = new Array(), h =
|
|
192
|
+
const W = new Array(), h = N("debugprogressive");
|
|
161
193
|
let re, V = -1;
|
|
162
|
-
if (h) {
|
|
194
|
+
if (h && typeof window < "u") {
|
|
163
195
|
let i = function() {
|
|
164
196
|
V += 1, V >= t && (V = -1), console.log(`Toggle LOD level [${V}]`);
|
|
165
197
|
};
|
|
@@ -170,27 +202,27 @@ if (h) {
|
|
|
170
202
|
!isNaN(s) && s >= 0 && (V = s, console.log(`Set LOD level to [${V}]`));
|
|
171
203
|
});
|
|
172
204
|
}
|
|
173
|
-
function
|
|
205
|
+
function ze(i) {
|
|
174
206
|
if (h && re !== void 0)
|
|
175
207
|
if (Array.isArray(i))
|
|
176
208
|
for (const t of i)
|
|
177
|
-
|
|
209
|
+
ze(t);
|
|
178
210
|
else i && "wireframe" in i && (i.wireframe = re === !0);
|
|
179
211
|
}
|
|
180
212
|
const te = new Array();
|
|
181
|
-
let
|
|
182
|
-
const
|
|
183
|
-
function
|
|
184
|
-
if (te.length <
|
|
213
|
+
let St = 0;
|
|
214
|
+
const Rt = be() ? 2 : 10;
|
|
215
|
+
function Pt(i) {
|
|
216
|
+
if (te.length < Rt) {
|
|
185
217
|
const s = te.length;
|
|
186
218
|
h && console.warn(`[Worker] Creating new worker #${s}`);
|
|
187
|
-
const r =
|
|
219
|
+
const r = Oe.createWorker(i || {});
|
|
188
220
|
return te.push(r), r;
|
|
189
221
|
}
|
|
190
|
-
const t =
|
|
222
|
+
const t = St++ % te.length;
|
|
191
223
|
return te[t];
|
|
192
224
|
}
|
|
193
|
-
class
|
|
225
|
+
class Oe {
|
|
194
226
|
constructor(t, e) {
|
|
195
227
|
this.worker = t, this._debug = e.debug ?? !1, t.onmessage = (s) => {
|
|
196
228
|
const r = s.data;
|
|
@@ -198,7 +230,7 @@ class _e {
|
|
|
198
230
|
case "loaded-gltf":
|
|
199
231
|
for (const n of this._running)
|
|
200
232
|
if (n.url === r.result.url) {
|
|
201
|
-
|
|
233
|
+
Ct(r.result), n.resolve(r.result);
|
|
202
234
|
const o = n.url;
|
|
203
235
|
o.startsWith("blob:") && URL.revokeObjectURL(o);
|
|
204
236
|
}
|
|
@@ -213,19 +245,26 @@ class _e {
|
|
|
213
245
|
const e = /* new-worker */ new Worker(URL.createObjectURL(new Blob(["import '" + `${new URL('./gltf-progressive.worker-BqODMeeW.js', import.meta.url).toString()}` + "';"], { type: 'text/javascript' })), {
|
|
214
246
|
type: "module"
|
|
215
247
|
});
|
|
216
|
-
return new
|
|
248
|
+
return new Oe(e, t);
|
|
217
249
|
}
|
|
218
250
|
_running = [];
|
|
219
251
|
_webglRenderer = null;
|
|
220
252
|
async load(t, e) {
|
|
221
|
-
const s =
|
|
253
|
+
const s = ht();
|
|
222
254
|
let r = e?.renderer;
|
|
223
255
|
r || (this._webglRenderer ??= (async () => {
|
|
224
256
|
const { WebGLRenderer: u } = await import("./three.js").then((c) => c.THREE);
|
|
225
257
|
return new u();
|
|
226
258
|
})(), r = await this._webglRenderer);
|
|
227
|
-
const a =
|
|
228
|
-
|
|
259
|
+
const a = _e(r).ktx2Loader.workerConfig;
|
|
260
|
+
if (t instanceof URL)
|
|
261
|
+
t = t.toString();
|
|
262
|
+
else if (t.startsWith("file:"))
|
|
263
|
+
t = URL.createObjectURL(new Blob([t]));
|
|
264
|
+
else if (!t.startsWith("blob:") && !t.startsWith("http:") && !t.startsWith("https:")) {
|
|
265
|
+
const u = globalThis.location?.href;
|
|
266
|
+
u && (t = new URL(t, u).toString());
|
|
267
|
+
}
|
|
229
268
|
const l = {
|
|
230
269
|
type: "load",
|
|
231
270
|
url: t,
|
|
@@ -242,20 +281,20 @@ class _e {
|
|
|
242
281
|
}
|
|
243
282
|
_debug = !1;
|
|
244
283
|
}
|
|
245
|
-
function
|
|
284
|
+
function Ct(i) {
|
|
246
285
|
for (const t of i.geometries) {
|
|
247
286
|
const e = t.geometry, s = new j();
|
|
248
287
|
if (s.name = e.name || "", e.index) {
|
|
249
288
|
const r = e.index;
|
|
250
|
-
s.setIndex(
|
|
289
|
+
s.setIndex(de(r));
|
|
251
290
|
}
|
|
252
291
|
for (const r in e.attributes) {
|
|
253
|
-
const n = e.attributes[r], o =
|
|
292
|
+
const n = e.attributes[r], o = de(n);
|
|
254
293
|
s.setAttribute(r, o);
|
|
255
294
|
}
|
|
256
295
|
if (e.morphAttributes)
|
|
257
296
|
for (const r in e.morphAttributes) {
|
|
258
|
-
const o = e.morphAttributes[r].map((a) =>
|
|
297
|
+
const o = e.morphAttributes[r].map((a) => de(a));
|
|
259
298
|
s.morphAttributes[r] = o;
|
|
260
299
|
}
|
|
261
300
|
if (s.morphTargetsRelative = e.morphTargetsRelative ?? !1, s.boundingBox = new ce(), s.boundingBox.min = new k(
|
|
@@ -266,7 +305,7 @@ function xt(i) {
|
|
|
266
305
|
e.boundingBox?.max.x,
|
|
267
306
|
e.boundingBox?.max.y,
|
|
268
307
|
e.boundingBox?.max.z
|
|
269
|
-
), s.boundingSphere = new
|
|
308
|
+
), s.boundingSphere = new Ie(
|
|
270
309
|
new k(
|
|
271
310
|
e.boundingSphere?.center.x,
|
|
272
311
|
e.boundingSphere?.center.y,
|
|
@@ -282,8 +321,8 @@ function xt(i) {
|
|
|
282
321
|
const e = t.texture;
|
|
283
322
|
let s = null;
|
|
284
323
|
if (e.isCompressedTexture) {
|
|
285
|
-
const r = e.mipmaps,
|
|
286
|
-
s = new
|
|
324
|
+
const r = e.mipmaps, { width: n, height: o } = De(e);
|
|
325
|
+
s = new et(
|
|
287
326
|
r,
|
|
288
327
|
n,
|
|
289
328
|
o,
|
|
@@ -309,7 +348,7 @@ function xt(i) {
|
|
|
309
348
|
e.type,
|
|
310
349
|
e.anisotropy,
|
|
311
350
|
e.colorSpace
|
|
312
|
-
), s.mipmaps = e.mipmaps, s.channel = e.channel, s.source.data = e.source.data, s.flipY = e.flipY, s.premultiplyAlpha = e.premultiplyAlpha, s.unpackAlignment = e.unpackAlignment, s.matrix = new
|
|
351
|
+
), s.mipmaps = e.mipmaps, s.channel = e.channel, s.source.data = e.source.data, s.flipY = e.flipY, s.premultiplyAlpha = e.premultiplyAlpha, s.unpackAlignment = e.unpackAlignment, s.matrix = new tt(...e.matrix.elements);
|
|
313
352
|
if (!s) {
|
|
314
353
|
console.error("[Worker] Failed to create new texture from received data. Texture is not a CompressedTexture or Texture.");
|
|
315
354
|
continue;
|
|
@@ -318,21 +357,21 @@ function xt(i) {
|
|
|
318
357
|
}
|
|
319
358
|
return i;
|
|
320
359
|
}
|
|
321
|
-
function
|
|
360
|
+
function de(i) {
|
|
322
361
|
let t = i;
|
|
323
362
|
if ("isInterleavedBufferAttribute" in i && i.isInterleavedBufferAttribute) {
|
|
324
|
-
const e = i.data, s = e.array, r = new
|
|
325
|
-
t = new
|
|
326
|
-
} else "isBufferAttribute" in i && i.isBufferAttribute && (t = new
|
|
363
|
+
const e = i.data, s = e.array, r = new st(s, e.stride);
|
|
364
|
+
t = new rt(r, i.itemSize, s.byteOffset, i.normalized), t.offset = i.offset;
|
|
365
|
+
} else "isBufferAttribute" in i && i.isBufferAttribute && (t = new nt(i.array, i.itemSize, i.normalized), t.usage = i.usage, t.gpuType = i.gpuType, t.updateRanges = i.updateRanges);
|
|
327
366
|
return t;
|
|
328
367
|
}
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
const se =
|
|
332
|
-
class
|
|
368
|
+
const kt = N("gltf-progressive-worker");
|
|
369
|
+
N("gltf-progressive-reduce-mipmaps");
|
|
370
|
+
const se = N("gltf-progressive-gc"), he = /* @__PURE__ */ Symbol("needle-progressive-texture"), F = "NEEDLE_progressive";
|
|
371
|
+
class g {
|
|
333
372
|
/** The name of the extension */
|
|
334
373
|
get name() {
|
|
335
|
-
return
|
|
374
|
+
return F;
|
|
336
375
|
}
|
|
337
376
|
// #region PUBLIC API
|
|
338
377
|
/**
|
|
@@ -398,9 +437,9 @@ class p {
|
|
|
398
437
|
const c = s.lodInfos.get(u.key);
|
|
399
438
|
if (c && c.lods) {
|
|
400
439
|
l.min_count = Math.min(l.min_count, c.lods.length), l.max_count = Math.max(l.max_count, c.lods.length);
|
|
401
|
-
for (let
|
|
402
|
-
const
|
|
403
|
-
|
|
440
|
+
for (let f = 0; f < c.lods.length; f++) {
|
|
441
|
+
const d = c.lods[f];
|
|
442
|
+
d.width && (l.lods[f] = l.lods[f] || { min_height: 1 / 0, max_height: 0 }, l.lods[f].min_height = Math.min(l.lods[f].min_height, d.height), l.lods[f].max_height = Math.max(l.lods[f].max_height, d.height));
|
|
404
443
|
}
|
|
405
444
|
}
|
|
406
445
|
}
|
|
@@ -454,7 +493,7 @@ class p {
|
|
|
454
493
|
*/
|
|
455
494
|
static assignMeshLOD(t, e, s) {
|
|
456
495
|
if (!t) return Promise.resolve(null);
|
|
457
|
-
if (t instanceof
|
|
496
|
+
if (t instanceof H || t.isMesh === !0) {
|
|
458
497
|
const r = t.geometry, n = this.getAssignedLODInformation(r);
|
|
459
498
|
if (!n)
|
|
460
499
|
return Promise.resolve(null);
|
|
@@ -462,7 +501,7 @@ class p {
|
|
|
462
501
|
a.onBeforeGetLODMesh?.(t, e);
|
|
463
502
|
t["LOD:requested level"] = e;
|
|
464
503
|
const o = () => t["LOD:requested level"] === e || this.shouldApplyStaleMeshLOD(t, e);
|
|
465
|
-
return
|
|
504
|
+
return g.getOrLoadLOD(r, e, {
|
|
466
505
|
isCurrent: o
|
|
467
506
|
}).then((a) => {
|
|
468
507
|
if (Array.isArray(a)) {
|
|
@@ -502,8 +541,8 @@ class p {
|
|
|
502
541
|
for (const u of Object.keys(l.uniforms)) {
|
|
503
542
|
const c = l.uniforms[u].value;
|
|
504
543
|
if (c?.isTexture === !0) {
|
|
505
|
-
const
|
|
506
|
-
o.push(
|
|
544
|
+
const f = this.assignTextureLODForSlot(c, e, n, u, r).then((d) => (d && l.uniforms[u].value != d && (l.uniforms[u].value = d, l.uniformsNeedUpdate = !0), d));
|
|
545
|
+
o.push(f), a.push(u);
|
|
507
546
|
}
|
|
508
547
|
}
|
|
509
548
|
} else
|
|
@@ -517,8 +556,8 @@ class p {
|
|
|
517
556
|
return Promise.all(o).then((l) => {
|
|
518
557
|
const u = new Array();
|
|
519
558
|
for (let c = 0; c < l.length; c++) {
|
|
520
|
-
const
|
|
521
|
-
|
|
559
|
+
const f = l[c], d = a[c];
|
|
560
|
+
f && f.isTexture === !0 ? u.push({ material: n, slot: d, texture: f, level: e }) : u.push({ material: n, slot: d, texture: null, level: e });
|
|
522
561
|
}
|
|
523
562
|
return u;
|
|
524
563
|
});
|
|
@@ -534,10 +573,10 @@ class p {
|
|
|
534
573
|
* @default 50 on desktop, 20 on mobile devices
|
|
535
574
|
*/
|
|
536
575
|
static set maxConcurrentLoadingTasks(t) {
|
|
537
|
-
|
|
576
|
+
g.queue.maxConcurrent = t;
|
|
538
577
|
}
|
|
539
578
|
static get maxConcurrentLoadingTasks() {
|
|
540
|
-
return
|
|
579
|
+
return g.queue.maxConcurrent;
|
|
541
580
|
}
|
|
542
581
|
// #region INTERNAL
|
|
543
582
|
static assignTextureLODForSlot(t, e, s, r, n) {
|
|
@@ -549,30 +588,30 @@ class p {
|
|
|
549
588
|
if (o && (o.level === e || !n && o.level < e))
|
|
550
589
|
return Promise.resolve(t);
|
|
551
590
|
if (s && r) {
|
|
552
|
-
const
|
|
553
|
-
if (
|
|
554
|
-
return
|
|
591
|
+
const f = this.getPendingTextureSlotRequest(s, r);
|
|
592
|
+
if (f && f.level === e && f.force === n)
|
|
593
|
+
return f.promise;
|
|
555
594
|
}
|
|
556
|
-
const a = s && r ? this.nextTextureSlotRequestId(s, r, e, n) : 0, l = () => !s || !r || this.getLatestTextureSlotRequest(s, r)?.id === a, u = () => l() || this.shouldApplyStaleTextureSlotLOD(s, r, e, n), c =
|
|
595
|
+
const a = s && r ? this.nextTextureSlotRequestId(s, r, e, n) : 0, l = () => !s || !r || this.getLatestTextureSlotRequest(s, r)?.id === a, u = () => l() || this.shouldApplyStaleTextureSlotLOD(s, r, e, n), c = g.getOrLoadLOD(t, e, {
|
|
557
596
|
isCurrent: u
|
|
558
|
-
}).then((
|
|
597
|
+
}).then((f) => {
|
|
559
598
|
if (!l() && !this.shouldApplyStaleTextureSlotLOD(s, r, e, n)) return null;
|
|
560
|
-
if (Array.isArray(
|
|
599
|
+
if (Array.isArray(f))
|
|
561
600
|
return console.warn("Progressive: Got an array of textures for a texture slot, this should not happen..."), null;
|
|
562
|
-
if (
|
|
563
|
-
if (
|
|
564
|
-
const
|
|
565
|
-
if (
|
|
566
|
-
const
|
|
567
|
-
if (
|
|
568
|
-
return h === "verbose" && console.warn("Assigned texture level is already higher: ",
|
|
601
|
+
if (f?.isTexture === !0) {
|
|
602
|
+
if (f != t && s && r) {
|
|
603
|
+
const d = this.getMaterialTextureSlot(s, r) ?? t;
|
|
604
|
+
if (d && !n) {
|
|
605
|
+
const p = this.getAssignedLODInformation(d);
|
|
606
|
+
if (p && p?.level < e)
|
|
607
|
+
return h === "verbose" && console.warn("Assigned texture level is already higher: ", p.level, e, s, d, f), null;
|
|
569
608
|
}
|
|
570
|
-
this.assignTrackedTextureSlot(s, r,
|
|
609
|
+
this.assignTrackedTextureSlot(s, r, f);
|
|
571
610
|
}
|
|
572
|
-
return
|
|
611
|
+
return f;
|
|
573
612
|
} else h == "verbose" && console.warn("No LOD found for", t, e);
|
|
574
613
|
return null;
|
|
575
|
-
}).catch((
|
|
614
|
+
}).catch((f) => (console.error("Error loading LOD", t, f), null));
|
|
576
615
|
return s && r && this.setPendingTextureSlotRequest(s, r, e, n, a, c), c;
|
|
577
616
|
}
|
|
578
617
|
// Track material slots, not just texture objects. A shared fallback texture can be
|
|
@@ -670,8 +709,8 @@ class p {
|
|
|
670
709
|
_isLoadingMesh;
|
|
671
710
|
loadMesh = (t) => {
|
|
672
711
|
if (this._isLoadingMesh) return null;
|
|
673
|
-
const e = this.parser.json.meshes[t]?.extensions?.[
|
|
674
|
-
return e ? (this._isLoadingMesh = !0, this.parser.getDependency("mesh", t).then((s) => (this._isLoadingMesh = !1, s &&
|
|
712
|
+
const e = this.parser.json.meshes[t]?.extensions?.[F];
|
|
713
|
+
return e ? (this._isLoadingMesh = !0, this.parser.getDependency("mesh", t).then((s) => (this._isLoadingMesh = !1, s && g.registerMesh(this.url, e.guid, s, e.lods?.length, 0, e), s))) : null;
|
|
675
714
|
};
|
|
676
715
|
// private _isLoadingTexture;
|
|
677
716
|
// loadTexture = (textureIndex: number) => {
|
|
@@ -690,7 +729,7 @@ class p {
|
|
|
690
729
|
afterRoot(t) {
|
|
691
730
|
return h && console.log("AFTER", this.url, t), this.parser.json.textures?.forEach((e, s) => {
|
|
692
731
|
if (e?.extensions) {
|
|
693
|
-
const r = e?.extensions[
|
|
732
|
+
const r = e?.extensions[F];
|
|
694
733
|
if (r) {
|
|
695
734
|
if (!r.lods) {
|
|
696
735
|
h && console.warn("Texture has no LODs", r);
|
|
@@ -698,20 +737,20 @@ class p {
|
|
|
698
737
|
}
|
|
699
738
|
let n = !1;
|
|
700
739
|
for (const o of this.parser.associations.keys())
|
|
701
|
-
o.isTexture === !0 && this.parser.associations.get(o)?.textures === s && (n = !0,
|
|
740
|
+
o.isTexture === !0 && this.parser.associations.get(o)?.textures === s && (n = !0, g.registerTexture(this.url, o, r.lods?.length, s, r));
|
|
702
741
|
n || this.parser.getDependency("texture", s).then((o) => {
|
|
703
|
-
o &&
|
|
742
|
+
o && g.registerTexture(this.url, o, r.lods?.length, s, r);
|
|
704
743
|
});
|
|
705
744
|
}
|
|
706
745
|
}
|
|
707
746
|
}), this.parser.json.meshes?.forEach((e, s) => {
|
|
708
747
|
if (e?.extensions) {
|
|
709
|
-
const r = e?.extensions[
|
|
748
|
+
const r = e?.extensions[F];
|
|
710
749
|
if (r && r.lods) {
|
|
711
750
|
for (const n of this.parser.associations.keys())
|
|
712
751
|
if (n.isMesh) {
|
|
713
752
|
const o = this.parser.associations.get(n);
|
|
714
|
-
o?.meshes === s &&
|
|
753
|
+
o?.meshes === s && g.registerMesh(this.url, r.guid, n, r.lods.length, o.primitives, r);
|
|
715
754
|
}
|
|
716
755
|
}
|
|
717
756
|
}
|
|
@@ -734,12 +773,12 @@ class p {
|
|
|
734
773
|
return;
|
|
735
774
|
}
|
|
736
775
|
if (h) {
|
|
737
|
-
const
|
|
776
|
+
const { width: a, height: l } = De(e);
|
|
738
777
|
console.log(`> gltf-progressive: register texture[${r}] "${e.name || e.uuid}", Current: ${a}x${l}, Max: ${n.lods[0]?.width}x${n.lods[0]?.height}, uuid: ${e.uuid}`, n, e);
|
|
739
778
|
}
|
|
740
779
|
e.source && (e.source[he] = n);
|
|
741
780
|
const o = n.guid;
|
|
742
|
-
|
|
781
|
+
g.assignLODInformation(t, e, o, s, r), g.lodInfos.set(o, n), g.lowresCache.set(o, new WeakRef(e));
|
|
743
782
|
};
|
|
744
783
|
/**
|
|
745
784
|
* Register a mesh with progressive LOD information. This associates the mesh geometry with its LOD extension data
|
|
@@ -760,9 +799,9 @@ class p {
|
|
|
760
799
|
h && console.warn("gltf-progressive: Register mesh without geometry");
|
|
761
800
|
return;
|
|
762
801
|
}
|
|
763
|
-
a.userData || (a.userData = {}), h && console.log("> Progressive: register mesh " + s.name, { index: n, uuid: s.uuid }, o, s),
|
|
764
|
-
let u =
|
|
765
|
-
u ? u.push(s.geometry) : u = [s.geometry],
|
|
802
|
+
a.userData || (a.userData = {}), h && console.log("> Progressive: register mesh " + s.name, { index: n, uuid: s.uuid }, o, s), g.assignLODInformation(t, a, e, r, n), g.lodInfos.set(e, o);
|
|
803
|
+
let u = g.lowresCache.get(e)?.deref();
|
|
804
|
+
u ? u.push(s.geometry) : u = [s.geometry], g.lowresCache.set(e, new WeakRef(u)), r > 0 && !ne(s) && bt(s, a);
|
|
766
805
|
for (const c of W)
|
|
767
806
|
c.onRegisteredNewMesh?.(s, o);
|
|
768
807
|
};
|
|
@@ -837,9 +876,9 @@ class p {
|
|
|
837
876
|
* The held value is the cache key string used in `previouslyLoaded`.
|
|
838
877
|
*/
|
|
839
878
|
static _resourceRegistry = new FinalizationRegistry((t) => {
|
|
840
|
-
const e =
|
|
879
|
+
const e = g.cache.get(t);
|
|
841
880
|
(h || se) && console.debug(`[gltf-progressive] Memory: Resource GC'd
|
|
842
|
-
${t}`), e instanceof WeakRef && (e.deref() || (
|
|
881
|
+
${t}`), e instanceof WeakRef && (e.deref() || (g.cache.delete(t), (h || se) && console.log("[gltf-progressive] ↪ Cache entry deleted (GC)")));
|
|
843
882
|
});
|
|
844
883
|
/**
|
|
845
884
|
* Track texture usage by incrementing reference count
|
|
@@ -862,9 +901,10 @@ ${t}`), e instanceof WeakRef && (e.deref() || (p.cache.delete(t), (h || se) && c
|
|
|
862
901
|
return this.textureRefCounts.delete(e), (h || se) && n("[gltf-progressive] Memory: Dispose texture", r), t.dispose(), !0;
|
|
863
902
|
return this.textureRefCounts.set(e, r), h === "verbose" && n("[gltf-progressive] Memory: Untrack texture", r), !1;
|
|
864
903
|
function n(o, a) {
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
904
|
+
let { width: l, height: u } = De(t);
|
|
905
|
+
const c = l && u ? `${l}x${u}` : "N/A";
|
|
906
|
+
let f = "N/A";
|
|
907
|
+
l && u && (f = `~${(vt(t) / (1024 * 1024)).toFixed(2)} MB`), console.log(`${o} — ${t.name} ${c} (${f}), refCount: ${s} → ${a}
|
|
868
908
|
${e}`);
|
|
869
909
|
}
|
|
870
910
|
}
|
|
@@ -880,17 +920,17 @@ ${e}`);
|
|
|
880
920
|
const u = t;
|
|
881
921
|
u.source && u.source[he] && (a = u.source[he]);
|
|
882
922
|
}
|
|
883
|
-
if (a || (a =
|
|
884
|
-
h && console.warn(`Can not load LOD ${e}: no LOD info found for "${o}" ${t.name}`, t.type,
|
|
923
|
+
if (a || (a = g.lodInfos.get(o)), !a)
|
|
924
|
+
h && console.warn(`Can not load LOD ${e}: no LOD info found for "${o}" ${t.name}`, t.type, g.lodInfos);
|
|
885
925
|
else {
|
|
886
926
|
if (e > 0) {
|
|
887
|
-
let
|
|
888
|
-
const
|
|
889
|
-
if (
|
|
890
|
-
const
|
|
891
|
-
if (
|
|
892
|
-
const
|
|
893
|
-
if (
|
|
927
|
+
let f = !1;
|
|
928
|
+
const d = Array.isArray(a.lods);
|
|
929
|
+
if (d && e >= a.lods.length ? f = !0 : d || (f = !0), f) {
|
|
930
|
+
const p = this.lowresCache.get(o);
|
|
931
|
+
if (p) {
|
|
932
|
+
const b = p.deref();
|
|
933
|
+
if (b) return b;
|
|
894
934
|
this.lowresCache.delete(o), h && console.log(`[gltf-progressive] Lowres cache entry was GC'd: ${o}`);
|
|
895
935
|
}
|
|
896
936
|
return null;
|
|
@@ -899,111 +939,111 @@ ${e}`);
|
|
|
899
939
|
const u = Array.isArray(a.lods) ? a.lods[e]?.path : a.lods;
|
|
900
940
|
if (!u)
|
|
901
941
|
return h && !a["missing:uri"] && (a["missing:uri"] = !0, console.warn("Missing uri for progressive asset for LOD " + e, a)), null;
|
|
902
|
-
const c =
|
|
942
|
+
const c = wt(n.url, u);
|
|
903
943
|
if (c.endsWith(".glb") || c.endsWith(".gltf")) {
|
|
904
944
|
if (!a.guid)
|
|
905
945
|
return console.warn("missing pointer for glb/gltf texture", a), null;
|
|
906
|
-
const
|
|
907
|
-
if (
|
|
946
|
+
const f = c + "_" + a.guid, d = await this.tryResolveLODCacheEntry(this.cache.get(f), f, c, t, e, r);
|
|
947
|
+
if (d.found) return d.value;
|
|
908
948
|
if (s?.isCurrent?.() === !1)
|
|
909
949
|
return r && console.log(`Skipping stale LOD ${e} request before queue: ${c}`), null;
|
|
910
|
-
const
|
|
950
|
+
const p = await this.queue.slot(c);
|
|
911
951
|
if (s?.isCurrent?.() === !1)
|
|
912
952
|
return r && console.log(`Skipping stale LOD ${e} request after queue: ${c}`), null;
|
|
913
|
-
const
|
|
914
|
-
if (
|
|
915
|
-
if (!
|
|
953
|
+
const b = await this.tryResolveLODCacheEntry(this.cache.get(f), f, c, t, e, r);
|
|
954
|
+
if (b.found) return b.value;
|
|
955
|
+
if (!p.use)
|
|
916
956
|
return h && console.log(`LOD ${e} was aborted: ${c}`), null;
|
|
917
|
-
const y = a, x = new Promise(async (L,
|
|
918
|
-
if (
|
|
919
|
-
const m = await (await
|
|
957
|
+
const y = a, x = new Promise(async (L, U) => {
|
|
958
|
+
if (kt) {
|
|
959
|
+
const m = await (await Pt({})).load(c);
|
|
920
960
|
if (m.textures.length > 0)
|
|
921
|
-
for (const
|
|
922
|
-
let _ =
|
|
923
|
-
return
|
|
961
|
+
for (const v of m.textures) {
|
|
962
|
+
let _ = v.texture;
|
|
963
|
+
return g.assignLODInformation(n.url, _, o, e, void 0), t instanceof G && (_ = this.copySettings(t, _)), _ && (_.guid = y.guid), L(_);
|
|
924
964
|
}
|
|
925
965
|
if (m.geometries.length > 0) {
|
|
926
|
-
const
|
|
966
|
+
const v = new Array();
|
|
927
967
|
for (const _ of m.geometries) {
|
|
928
968
|
const B = _.geometry;
|
|
929
|
-
|
|
969
|
+
g.assignLODInformation(n.url, B, o, e, _.primitiveIndex), v.push(B);
|
|
930
970
|
}
|
|
931
|
-
return L(
|
|
971
|
+
return L(v);
|
|
932
972
|
}
|
|
933
973
|
return L(null);
|
|
934
974
|
}
|
|
935
|
-
const
|
|
936
|
-
|
|
937
|
-
let
|
|
975
|
+
const D = new Me();
|
|
976
|
+
qe(D), h && (await new Promise((M) => setTimeout(M, 1e3)), r && console.warn("Start loading (delayed) " + c, y.guid));
|
|
977
|
+
let O = c;
|
|
938
978
|
if (y && Array.isArray(y.lods)) {
|
|
939
|
-
const
|
|
940
|
-
|
|
979
|
+
const M = y.lods[e];
|
|
980
|
+
M.hash && (O += "?v=" + M.hash);
|
|
941
981
|
}
|
|
942
|
-
const
|
|
943
|
-
`,
|
|
944
|
-
if (!
|
|
982
|
+
const T = await D.loadAsync(O).catch((M) => (console.error(`Error loading LOD ${e} from ${c}
|
|
983
|
+
`, M), L(null)));
|
|
984
|
+
if (!T)
|
|
945
985
|
return L(null);
|
|
946
|
-
const
|
|
986
|
+
const C = T.parser;
|
|
947
987
|
r && console.log("Loading finished " + c, y.guid);
|
|
948
|
-
let
|
|
949
|
-
if (
|
|
950
|
-
let
|
|
951
|
-
for (const m of
|
|
988
|
+
let S = 0;
|
|
989
|
+
if (T.parser.json.textures) {
|
|
990
|
+
let M = !1;
|
|
991
|
+
for (const m of T.parser.json.textures) {
|
|
952
992
|
if (m?.extensions) {
|
|
953
|
-
const
|
|
954
|
-
if (
|
|
955
|
-
|
|
993
|
+
const v = m?.extensions[F];
|
|
994
|
+
if (v?.guid && v.guid === y.guid) {
|
|
995
|
+
M = !0;
|
|
956
996
|
break;
|
|
957
997
|
}
|
|
958
998
|
}
|
|
959
|
-
|
|
999
|
+
S++;
|
|
960
1000
|
}
|
|
961
|
-
if (
|
|
962
|
-
let m = await
|
|
963
|
-
return m &&
|
|
964
|
-
} else h && console.warn("Could not find texture with guid", y.guid,
|
|
1001
|
+
if (M) {
|
|
1002
|
+
let m = await C.getDependency("texture", S);
|
|
1003
|
+
return m && g.assignLODInformation(n.url, m, o, e, void 0), r && console.log('change "' + t.name + '" → "' + m.name + '"', c, S, m, f), t instanceof G && (m = this.copySettings(t, m)), m && (m.guid = y.guid), L(m);
|
|
1004
|
+
} else h && console.warn("Could not find texture with guid", y.guid, T.parser.json);
|
|
965
1005
|
}
|
|
966
|
-
if (
|
|
967
|
-
let
|
|
968
|
-
for (const m of
|
|
1006
|
+
if (S = 0, T.parser.json.meshes) {
|
|
1007
|
+
let M = !1;
|
|
1008
|
+
for (const m of T.parser.json.meshes) {
|
|
969
1009
|
if (m?.extensions) {
|
|
970
|
-
const
|
|
971
|
-
if (
|
|
972
|
-
|
|
1010
|
+
const v = m?.extensions[F];
|
|
1011
|
+
if (v?.guid && v.guid === y.guid) {
|
|
1012
|
+
M = !0;
|
|
973
1013
|
break;
|
|
974
1014
|
}
|
|
975
1015
|
}
|
|
976
|
-
|
|
1016
|
+
S++;
|
|
977
1017
|
}
|
|
978
|
-
if (
|
|
979
|
-
const m = await
|
|
980
|
-
if (r && console.log(`Loaded Mesh "${m.name}"`, c,
|
|
981
|
-
const
|
|
982
|
-
return
|
|
1018
|
+
if (M) {
|
|
1019
|
+
const m = await C.getDependency("mesh", S);
|
|
1020
|
+
if (r && console.log(`Loaded Mesh "${m.name}"`, c, S, m, f), m.isMesh === !0) {
|
|
1021
|
+
const v = m.geometry;
|
|
1022
|
+
return g.assignLODInformation(n.url, v, o, e, 0), L(v);
|
|
983
1023
|
} else {
|
|
984
|
-
const
|
|
1024
|
+
const v = new Array();
|
|
985
1025
|
for (let _ = 0; _ < m.children.length; _++) {
|
|
986
1026
|
const B = m.children[_];
|
|
987
1027
|
if (B.isMesh === !0) {
|
|
988
1028
|
const ie = B.geometry;
|
|
989
|
-
|
|
1029
|
+
g.assignLODInformation(n.url, ie, o, e, _), v.push(ie);
|
|
990
1030
|
}
|
|
991
1031
|
}
|
|
992
|
-
return L(
|
|
1032
|
+
return L(v);
|
|
993
1033
|
}
|
|
994
|
-
} else h && console.warn("Could not find mesh with guid", y.guid,
|
|
1034
|
+
} else h && console.warn("Could not find mesh with guid", y.guid, T.parser.json);
|
|
995
1035
|
}
|
|
996
1036
|
return L(null);
|
|
997
1037
|
});
|
|
998
|
-
this.cache.set(
|
|
999
|
-
const
|
|
1000
|
-
return
|
|
1038
|
+
this.cache.set(f, x), p.use(x);
|
|
1039
|
+
const w = await x;
|
|
1040
|
+
return w != null ? w instanceof G ? (this.cache.set(f, new WeakRef(w)), g._resourceRegistry.register(w, f)) : Array.isArray(w) ? this.cache.set(f, Promise.resolve(w)) : this.cache.set(f, Promise.resolve(w)) : this.cache.set(f, Promise.resolve(null)), w;
|
|
1001
1041
|
} else if (t instanceof G) {
|
|
1002
1042
|
if (s?.isCurrent?.() === !1)
|
|
1003
1043
|
return r && console.log(`Skipping stale texture LOD ${e} request: ${c}`), null;
|
|
1004
1044
|
r && console.log("Load texture from uri: " + c);
|
|
1005
|
-
const
|
|
1006
|
-
return s?.isCurrent?.() === !1 ? (
|
|
1045
|
+
const d = await new it().loadAsync(c);
|
|
1046
|
+
return s?.isCurrent?.() === !1 ? (d?.dispose(), null) : (d ? (d.guid = a.guid, d.flipY = !1, d.needsUpdate = !0, d.colorSpace = t.colorSpace, r && console.log(a, d)) : h && console.warn("failed loading", c), d);
|
|
1007
1047
|
}
|
|
1008
1048
|
}
|
|
1009
1049
|
return null;
|
|
@@ -1014,24 +1054,24 @@ ${e}`);
|
|
|
1014
1054
|
if (o && console.log(`LOD ${n} was already loading/loaded: ${e}`), t instanceof WeakRef) {
|
|
1015
1055
|
const u = t.deref();
|
|
1016
1056
|
if (u) {
|
|
1017
|
-
let c = u,
|
|
1018
|
-
if (c instanceof G && r instanceof G ? c.image
|
|
1057
|
+
let c = u, f = !1;
|
|
1058
|
+
if (c instanceof G && r instanceof G ? Te(c.image) || we(c) ? c = this.copySettings(r, c) : f = !0 : c instanceof j && r instanceof j && (c.attributes.position?.array || (f = !0)), !f)
|
|
1019
1059
|
return { found: !0, value: c };
|
|
1020
1060
|
}
|
|
1021
1061
|
return this.cache.delete(e), h && console.log(`[gltf-progressive] Re-loading GC'd/disposed resource: ${e}`), { found: !1 };
|
|
1022
1062
|
}
|
|
1023
1063
|
let a = await t.catch((u) => (console.error(`Error loading LOD ${n} from ${s}
|
|
1024
1064
|
`, u), null)), l = !1;
|
|
1025
|
-
return a == null || (a instanceof G && r instanceof G ? a.image
|
|
1065
|
+
return a == null || (a instanceof G && r instanceof G ? Te(a.image) || we(a) ? a = this.copySettings(r, a) : (l = !0, this.cache.delete(e)) : a instanceof j && r instanceof j && (a.attributes.position?.array || (l = !0, this.cache.delete(e)))), l ? { found: !1 } : { found: !0, value: a };
|
|
1026
1066
|
}
|
|
1027
1067
|
static _queue;
|
|
1028
1068
|
static get queue() {
|
|
1029
|
-
return this._queue ??= new
|
|
1069
|
+
return this._queue ??= new Dt(be() ? 20 : 50, { debug: h != !1 });
|
|
1030
1070
|
}
|
|
1031
1071
|
static assignLODInformation(t, e, s, r, n) {
|
|
1032
1072
|
if (!e) return;
|
|
1033
1073
|
e.userData || (e.userData = {});
|
|
1034
|
-
const o = new
|
|
1074
|
+
const o = new At(t, s, r, n);
|
|
1035
1075
|
e.userData.LODS = o, "source" in e && typeof e.source == "object" && (e.source.LODS = o);
|
|
1036
1076
|
}
|
|
1037
1077
|
static getAssignedLODInformation(t) {
|
|
@@ -1044,7 +1084,7 @@ ${e}`);
|
|
|
1044
1084
|
`, e.uuid), e = e.clone(), e.offset = t.offset, e.repeat = t.repeat, e.colorSpace = t.colorSpace, e.magFilter = t.magFilter, e.minFilter = t.minFilter, e.wrapS = t.wrapS, e.wrapT = t.wrapT, e.flipY = t.flipY, e.anisotropy = t.anisotropy, e.mipmaps || (e.generateMipmaps = t.generateMipmaps), e) : t;
|
|
1045
1085
|
}
|
|
1046
1086
|
}
|
|
1047
|
-
class
|
|
1087
|
+
class At {
|
|
1048
1088
|
url;
|
|
1049
1089
|
/** the key to lookup the LOD information */
|
|
1050
1090
|
key;
|
|
@@ -1131,7 +1171,7 @@ class oe {
|
|
|
1131
1171
|
});
|
|
1132
1172
|
}
|
|
1133
1173
|
}
|
|
1134
|
-
const A =
|
|
1174
|
+
const A = N("debugprogressive"), It = A === "colors", $t = N("noprogressive"), ge = /* @__PURE__ */ Symbol("Needle:LODSManager"), pe = /* @__PURE__ */ Symbol("Needle:LODState"), z = /* @__PURE__ */ Symbol("Needle:CurrentLOD"), Se = ot, R = { mesh_lod: -1, texture_lod: -1 }, Bt = new Be(), Re = [
|
|
1135
1175
|
3526751,
|
|
1136
1176
|
11065402,
|
|
1137
1177
|
15978811,
|
|
@@ -1164,12 +1204,17 @@ const A = E("debugprogressive"), vt = A === "colors", Dt = E("noprogressive"), g
|
|
|
1164
1204
|
15817653,
|
|
1165
1205
|
5083278,
|
|
1166
1206
|
5592405
|
|
1167
|
-
]
|
|
1168
|
-
function
|
|
1207
|
+
];
|
|
1208
|
+
function Gt() {
|
|
1209
|
+
const i = Se.Timer || Se.Clock;
|
|
1210
|
+
return new i();
|
|
1211
|
+
}
|
|
1212
|
+
const me = new ce(), E = new ce(), Pe = new ce(), qt = new k(), Wt = new k(), Ft = new $e(), q = new k(), Y = new k(), Q = new k(), J = new k();
|
|
1213
|
+
function Ut(i, t) {
|
|
1169
1214
|
const e = i.min, s = i.max, r = (e.x + s.x) * 0.5, n = (e.y + s.y) * 0.5;
|
|
1170
1215
|
return q.set(r, n, e.z).applyMatrix4(t).z < 0;
|
|
1171
1216
|
}
|
|
1172
|
-
function
|
|
1217
|
+
function zt(i) {
|
|
1173
1218
|
const {
|
|
1174
1219
|
geometry: t,
|
|
1175
1220
|
matrixWorld: e,
|
|
@@ -1181,46 +1226,47 @@ function Tt(i) {
|
|
|
1181
1226
|
xrEnabled: l = !1,
|
|
1182
1227
|
debugDrawLine: u,
|
|
1183
1228
|
warnMissingPrimitiveDensities: c = !1
|
|
1184
|
-
} = i,
|
|
1229
|
+
} = i, f = g.getMeshLODExtension(t)?.lods, d = g.getPrimitiveIndex(t), p = i.target ?? {
|
|
1185
1230
|
level: a,
|
|
1186
|
-
primitiveIndex:
|
|
1231
|
+
primitiveIndex: d,
|
|
1187
1232
|
screenCoverage: 0,
|
|
1188
1233
|
screenspaceVolume: new k(),
|
|
1189
1234
|
centrality: 1
|
|
1190
1235
|
};
|
|
1191
|
-
|
|
1192
|
-
let
|
|
1193
|
-
if (
|
|
1194
|
-
if (me.copy(
|
|
1195
|
-
return
|
|
1196
|
-
if (
|
|
1197
|
-
const
|
|
1198
|
-
let
|
|
1199
|
-
const m = 2,
|
|
1200
|
-
|
|
1201
|
-
const ie =
|
|
1202
|
-
|
|
1203
|
-
}
|
|
1204
|
-
const y =
|
|
1205
|
-
y.multiplyScalar(0.5), globalThis.screen?.availHeight > 0 && o > 0 && y.multiplyScalar(o / globalThis.screen.availHeight), s.isPerspectiveCamera && (y.x *= s.aspect),
|
|
1206
|
-
const x =
|
|
1207
|
-
|
|
1208
|
-
const
|
|
1209
|
-
if (
|
|
1236
|
+
p.level = a, p.primitiveIndex = d, p.screenCoverage = 0, p.screenspaceVolume.set(0, 0, 0), p.centrality = 1;
|
|
1237
|
+
let b = i.boundingBox ?? t.boundingBox;
|
|
1238
|
+
if (b || (t.computeBoundingBox(), b = t.boundingBox), !b) return p;
|
|
1239
|
+
if (me.copy(b).applyMatrix4(e), s.isPerspectiveCamera && Ut(me, r))
|
|
1240
|
+
return p.level = 0, p.screenCoverage = 1 / 0, p.screenspaceVolume.set(1 / 0, 1 / 0, 1 / 0), p;
|
|
1241
|
+
if (E.copy(me).applyMatrix4(r), l && s.isPerspectiveCamera && s.fov > 70) {
|
|
1242
|
+
const D = E.min, O = E.max;
|
|
1243
|
+
let T = D.x, C = D.y, S = O.x, M = O.y;
|
|
1244
|
+
const m = 2, v = 1.5, _ = (D.x + O.x) * 0.5, B = (D.y + O.y) * 0.5;
|
|
1245
|
+
T = (T - _) * m + _, C = (C - B) * m + B, S = (S - _) * m + _, M = (M - B) * m + B;
|
|
1246
|
+
const ie = T < 0 && S > 0 ? 0 : Math.min(Math.abs(D.x), Math.abs(O.x)), Xe = C < 0 && M > 0 ? 0 : Math.min(Math.abs(D.y), Math.abs(O.y)), fe = Math.max(ie, Xe);
|
|
1247
|
+
p.centrality = (v - fe) * (v - fe) * (v - fe);
|
|
1248
|
+
}
|
|
1249
|
+
const y = E.getSize(qt);
|
|
1250
|
+
y.multiplyScalar(0.5), globalThis.screen?.availHeight > 0 && o > 0 && y.multiplyScalar(o / globalThis.screen.availHeight), s.isPerspectiveCamera && (y.x *= s.aspect), Pe.copy(b).applyMatrix4(e).applyMatrix4(s.matrixWorldInverse);
|
|
1251
|
+
const x = Pe.getSize(Wt), w = Math.max(y.x, y.y), L = Math.max(x.x, x.y);
|
|
1252
|
+
w !== 0 && L !== 0 && (y.z = x.z / L * w);
|
|
1253
|
+
const U = Math.max(y.x, y.y, y.z) * p.centrality;
|
|
1254
|
+
if (p.screenCoverage = U, p.screenspaceVolume.copy(y), U <= 0) return p;
|
|
1210
1255
|
if (u) {
|
|
1211
|
-
const
|
|
1212
|
-
|
|
1213
|
-
const
|
|
1214
|
-
q.z = Y.z = Q.z = J.z =
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1256
|
+
const D = Ft.copy(r);
|
|
1257
|
+
D.invert(), q.copy(E.min), Y.copy(E.max), Y.x = q.x, Q.copy(E.max), Q.y = q.y, J.copy(E.max);
|
|
1258
|
+
const O = (q.z + J.z) * 0.5;
|
|
1259
|
+
q.z = Y.z = Q.z = J.z = O, q.applyMatrix4(D), Y.applyMatrix4(D), Q.applyMatrix4(D), J.applyMatrix4(D), u(q, Y, 255), u(q, Q, 255), u(Y, J, 255), u(Q, J, 255);
|
|
1260
|
+
}
|
|
1261
|
+
if (f?.length)
|
|
1262
|
+
for (let D = 0; D < f.length; D++) {
|
|
1263
|
+
const O = f[D], T = O.densities?.[d] || O.density || 1e-5;
|
|
1264
|
+
if (d > 0 && c && Ue() && !O.densities && !globalThis["NEEDLE:MISSING_LOD_PRIMITIVE_DENSITIES"] && (globalThis["NEEDLE:MISSING_LOD_PRIMITIVE_DENSITIES"] = !0, console.warn("[Needle Progressive] Detected usage of mesh without primitive densities. This might cause incorrect LOD level selection: Consider re-optimizing your model by updating your Needle Integration, Needle glTF Pipeline or running optimization again on Needle Cloud.")), T / U < n) {
|
|
1265
|
+
p.level = D;
|
|
1266
|
+
break;
|
|
1267
|
+
}
|
|
1221
1268
|
}
|
|
1222
|
-
|
|
1223
|
-
return g;
|
|
1269
|
+
return p;
|
|
1224
1270
|
}
|
|
1225
1271
|
let ue = class X {
|
|
1226
1272
|
/**
|
|
@@ -1258,7 +1304,7 @@ let ue = class X {
|
|
|
1258
1304
|
}
|
|
1259
1305
|
renderer;
|
|
1260
1306
|
context;
|
|
1261
|
-
projectionScreenMatrix = new
|
|
1307
|
+
projectionScreenMatrix = new $e();
|
|
1262
1308
|
/** @deprecated use static `LODsManager.addPlugin()` method. This getter will be removed in later versions */
|
|
1263
1309
|
get plugins() {
|
|
1264
1310
|
return W;
|
|
@@ -1331,7 +1377,7 @@ let ue = class X {
|
|
|
1331
1377
|
const r = performance.now();
|
|
1332
1378
|
return s.ready.finally(() => {
|
|
1333
1379
|
const n = this._newPromiseGroups.indexOf(s);
|
|
1334
|
-
n >= 0 && (this._newPromiseGroups.splice(n, 1),
|
|
1380
|
+
n >= 0 && (this._newPromiseGroups.splice(n, 1), Ue() && performance.measure("LODsManager:awaitLoading", {
|
|
1335
1381
|
start: r,
|
|
1336
1382
|
detail: { id: e, name: t?.name, awaited: s.awaitedCount, resolved: s.resolvedCount }
|
|
1337
1383
|
}));
|
|
@@ -1387,11 +1433,11 @@ let ue = class X {
|
|
|
1387
1433
|
this.renderer = t, this.context = { ...e };
|
|
1388
1434
|
}
|
|
1389
1435
|
#t;
|
|
1390
|
-
#i = new He();
|
|
1391
1436
|
#r = 0;
|
|
1392
1437
|
#n = 0;
|
|
1393
1438
|
#o = 0;
|
|
1394
1439
|
#s = 0;
|
|
1440
|
+
#i = Gt();
|
|
1395
1441
|
_fpsBuffer = [60, 60, 60, 60, 60];
|
|
1396
1442
|
/**
|
|
1397
1443
|
* Enable the LODsManager. This will replace the render method of the renderer with a method that updates the LODs.
|
|
@@ -1402,9 +1448,9 @@ let ue = class X {
|
|
|
1402
1448
|
let t = 0;
|
|
1403
1449
|
this.#t = this.renderer.render;
|
|
1404
1450
|
const e = this;
|
|
1405
|
-
|
|
1451
|
+
_e(this.renderer), this.renderer.render = function(s, r) {
|
|
1406
1452
|
const n = e.renderer.getRenderTarget();
|
|
1407
|
-
(n == null || "isXRRenderTarget" in n && n.isXRRenderTarget) && (t = 0, e.#r += 1, e.#n = e.#i.getDelta(), e.#o += e.#n, e._fpsBuffer.shift(), e._fpsBuffer.push(1 / e.#n), e.#s = e._fpsBuffer.reduce((a, l) => a + l) / e._fpsBuffer.length, A && e.#r % 200 === 0 && console.log("FPS", Math.round(e.#s), "Interval:", e.#e));
|
|
1453
|
+
(n == null || "isXRRenderTarget" in n && n.isXRRenderTarget) && (t = 0, e.#r += 1, e.#i.update?.(), e.#n = Math.max(e.#i.getDelta(), 1 / 1e3), e.#o += e.#n, e._fpsBuffer.shift(), e._fpsBuffer.push(1 / e.#n), e.#s = e._fpsBuffer.reduce((a, l) => a + l) / e._fpsBuffer.length, A && e.#r % 200 === 0 && console.log("FPS", Math.round(e.#s), "Interval:", e.#e));
|
|
1408
1454
|
const o = t++;
|
|
1409
1455
|
e.#t.call(this, s, r), e.onAfterRender(s, r, o);
|
|
1410
1456
|
};
|
|
@@ -1432,14 +1478,16 @@ let ue = class X {
|
|
|
1432
1478
|
}
|
|
1433
1479
|
onAfterRender(t, e, s) {
|
|
1434
1480
|
if (this.pause) return;
|
|
1435
|
-
const
|
|
1481
|
+
const r = this.getRenderList(t, e, s);
|
|
1482
|
+
if (!r) return;
|
|
1483
|
+
const n = r.opaque;
|
|
1436
1484
|
let o = !0;
|
|
1437
1485
|
if (n.length === 1) {
|
|
1438
1486
|
const a = n[0].material;
|
|
1439
1487
|
(a.name === "EffectMaterial" || a.name === "CopyShader") && (o = !1);
|
|
1440
1488
|
}
|
|
1441
1489
|
if ((e.parent && e.parent.type === "CubeCamera" || s >= 1 && e.type === "OrthographicCamera") && (o = !1), o) {
|
|
1442
|
-
if (
|
|
1490
|
+
if ($t || (this.updateInterval === "auto" ? this.#s < 40 && this.#e < 10 ? (this.#e += 1, A && console.warn("↓ Reducing LOD updates", this.#e, this.#s.toFixed(0))) : this.#s >= 60 && this.#e > 1 && (this.#e -= 1, A && console.warn("↑ Increasing LOD updates", this.#e, this.#s.toFixed(0))) : this.#e = this.updateInterval, this.#e > 0 && this.#r % this.#e != 0))
|
|
1443
1491
|
return;
|
|
1444
1492
|
this.internalUpdate(t, e), this._postprocessPromiseGroups();
|
|
1445
1493
|
}
|
|
@@ -1448,7 +1496,9 @@ let ue = class X {
|
|
|
1448
1496
|
* Update LODs in a scene
|
|
1449
1497
|
*/
|
|
1450
1498
|
internalUpdate(t, e) {
|
|
1451
|
-
const s = this.
|
|
1499
|
+
const s = this.getRenderList(t, e, 0);
|
|
1500
|
+
if (!s) return;
|
|
1501
|
+
const r = s.opaque;
|
|
1452
1502
|
this.projectionScreenMatrix.multiplyMatrices(e.projectionMatrix, e.matrixWorldInverse);
|
|
1453
1503
|
const n = this.targetTriangleDensity;
|
|
1454
1504
|
for (const l of r) {
|
|
@@ -1466,32 +1516,51 @@ let ue = class X {
|
|
|
1466
1516
|
continue;
|
|
1467
1517
|
}
|
|
1468
1518
|
const u = l.object;
|
|
1469
|
-
(u instanceof
|
|
1519
|
+
(u instanceof H || u.isMesh) && this.updateLODs(t, e, u, n);
|
|
1470
1520
|
}
|
|
1471
1521
|
const o = s.transparent;
|
|
1472
1522
|
for (const l of o) {
|
|
1473
1523
|
const u = l.object;
|
|
1474
|
-
(u instanceof
|
|
1524
|
+
(u instanceof H || u.isMesh) && this.updateLODs(t, e, u, n);
|
|
1475
1525
|
}
|
|
1476
1526
|
const a = s.transmissive;
|
|
1477
1527
|
for (const l of a) {
|
|
1478
1528
|
const u = l.object;
|
|
1479
|
-
(u instanceof
|
|
1529
|
+
(u instanceof H || u.isMesh) && this.updateLODs(t, e, u, n);
|
|
1480
1530
|
}
|
|
1481
1531
|
}
|
|
1532
|
+
getRenderList(t, e, s) {
|
|
1533
|
+
const r = this.renderer;
|
|
1534
|
+
let n = null;
|
|
1535
|
+
if (r.isWebGPURenderer === !0) {
|
|
1536
|
+
const o = r._renderLists;
|
|
1537
|
+
if (!o) return null;
|
|
1538
|
+
n = o.get(t, e);
|
|
1539
|
+
} else if (r.isWebGLRenderer === !0) {
|
|
1540
|
+
const o = r.renderLists;
|
|
1541
|
+
if (!o) return null;
|
|
1542
|
+
n = o.get(t, s);
|
|
1543
|
+
}
|
|
1544
|
+
return n ? {
|
|
1545
|
+
opaque: n.opaque || [],
|
|
1546
|
+
transparent: n.transparent || [],
|
|
1547
|
+
transmissive: n.transmissive || n.transparentDoublePass || [],
|
|
1548
|
+
transparentDoublePass: n.transparentDoublePass || []
|
|
1549
|
+
} : null;
|
|
1550
|
+
}
|
|
1482
1551
|
/** Update the LOD levels for the renderer. */
|
|
1483
1552
|
updateLODs(t, e, s, r) {
|
|
1484
1553
|
s.userData || (s.userData = {});
|
|
1485
1554
|
let n = s[pe];
|
|
1486
|
-
if (n || (n = new
|
|
1555
|
+
if (n || (n = new Et(), s[pe] = n), n.frames++ < 2)
|
|
1487
1556
|
return;
|
|
1488
1557
|
for (const a of W)
|
|
1489
1558
|
a.onBeforeUpdateLOD?.(this.renderer, t, e, s);
|
|
1490
1559
|
const o = this.overrideLodLevel !== void 0 ? this.overrideLodLevel : V;
|
|
1491
|
-
o >= 0 ? (
|
|
1560
|
+
o >= 0 ? (R.mesh_lod = o, R.texture_lod = o) : (this.calculateLodLevel(e, s, n, r, R), R.mesh_lod = Math.round(R.mesh_lod), R.texture_lod = Math.round(R.texture_lod)), R.mesh_lod >= 0 && this.loadProgressiveMeshes(s, R.mesh_lod), s.material && R.texture_lod >= 0 && this.loadProgressiveTextures(s.material, R.texture_lod, o), h && s.material && !s.isGizmo && ze(s.material), It && s.material && !s.isGizmo && !s.isBatchedMesh && Ee(s.material, R.mesh_lod);
|
|
1492
1561
|
for (const a of W)
|
|
1493
|
-
a.onAfterUpdatedLOD?.(this.renderer, t, e, s,
|
|
1494
|
-
n.lastLodLevel_Mesh =
|
|
1562
|
+
a.onAfterUpdatedLOD?.(this.renderer, t, e, s, R);
|
|
1563
|
+
n.lastLodLevel_Mesh = R.mesh_lod, n.lastLodLevel_Texture = R.texture_lod;
|
|
1495
1564
|
}
|
|
1496
1565
|
/** Load progressive textures for the given material
|
|
1497
1566
|
* @param material the material to load the textures for
|
|
@@ -1506,11 +1575,11 @@ let ue = class X {
|
|
|
1506
1575
|
return;
|
|
1507
1576
|
}
|
|
1508
1577
|
let r = !1;
|
|
1509
|
-
(t[
|
|
1578
|
+
(t[z] === void 0 || e < t[z]) && (r = !0);
|
|
1510
1579
|
const n = s !== void 0 && s >= 0;
|
|
1511
|
-
if (n && (r = t[
|
|
1512
|
-
t[
|
|
1513
|
-
const o = n ? { force: !0 } : void 0, a =
|
|
1580
|
+
if (n && (r = t[z] != s, e = s), r) {
|
|
1581
|
+
t[z] = e;
|
|
1582
|
+
const o = n ? { force: !0 } : void 0, a = g.assignTextureLOD(t, e, o).then((l) => {
|
|
1514
1583
|
this._lodchangedlisteners.forEach((u) => u({ type: "texture", level: e, object: t }));
|
|
1515
1584
|
});
|
|
1516
1585
|
oe.addPromise("texture", t, a, this._newPromiseGroups);
|
|
@@ -1524,17 +1593,17 @@ let ue = class X {
|
|
|
1524
1593
|
*/
|
|
1525
1594
|
loadProgressiveMeshes(t, e) {
|
|
1526
1595
|
if (!t) return Promise.resolve(null);
|
|
1527
|
-
let s = t[
|
|
1596
|
+
let s = t[z] !== e;
|
|
1528
1597
|
const r = t["DEBUG:LOD"];
|
|
1529
|
-
if (r != null && (s = t[
|
|
1530
|
-
t[
|
|
1531
|
-
const n = t.geometry, o =
|
|
1598
|
+
if (r != null && (s = t[z] != r, e = r), s) {
|
|
1599
|
+
t[z] = e;
|
|
1600
|
+
const n = t.geometry, o = g.assignMeshLOD(t, e).then((a) => (a && t[z] == e && n != t.geometry && this._lodchangedlisteners.forEach((l) => l({ type: "mesh", level: e, object: t })), a));
|
|
1532
1601
|
return oe.addPromise("mesh", t, o, this._newPromiseGroups), o;
|
|
1533
1602
|
}
|
|
1534
1603
|
return Promise.resolve(null);
|
|
1535
1604
|
}
|
|
1536
1605
|
// private testIfLODLevelsAreAvailable() {
|
|
1537
|
-
_sphere = new
|
|
1606
|
+
_sphere = new Ie();
|
|
1538
1607
|
_tempWorldPosition = new k();
|
|
1539
1608
|
static skinnedMeshBoundsFrameOffsetCounter = 0;
|
|
1540
1609
|
static $skinnedMeshBoundsOffset = /* @__PURE__ */ Symbol("gltf-progressive-skinnedMeshBoundsOffset");
|
|
@@ -1551,13 +1620,13 @@ let ue = class X {
|
|
|
1551
1620
|
let a = 10 + 1, l = !1;
|
|
1552
1621
|
if (A && e["DEBUG:LOD"] != null)
|
|
1553
1622
|
return e["DEBUG:LOD"];
|
|
1554
|
-
const u =
|
|
1555
|
-
if (!
|
|
1623
|
+
const u = g.getMeshLODExtension(e.geometry)?.lods, c = g.getPrimitiveIndex(e.geometry), f = u && u.length > 0, d = g.getMaterialMinMaxLODsCount(e.material), p = d.min_count !== 1 / 0 && d.min_count >= 0 && d.max_count >= 0;
|
|
1624
|
+
if (!f && !p) {
|
|
1556
1625
|
n.mesh_lod = 0, n.texture_lod = 0;
|
|
1557
1626
|
return;
|
|
1558
1627
|
}
|
|
1559
|
-
|
|
1560
|
-
const
|
|
1628
|
+
f || (l = !0, a = 0);
|
|
1629
|
+
const b = this.renderer.domElement.clientHeight || this.renderer.domElement.height;
|
|
1561
1630
|
let y = e.geometry.boundingBox;
|
|
1562
1631
|
if (e.type === "SkinnedMesh") {
|
|
1563
1632
|
const x = e;
|
|
@@ -1568,10 +1637,10 @@ let ue = class X {
|
|
|
1568
1637
|
const L = X.skinnedMeshBoundsFrameOffsetCounter++;
|
|
1569
1638
|
x[X.$skinnedMeshBoundsOffset] = L;
|
|
1570
1639
|
}
|
|
1571
|
-
const
|
|
1572
|
-
if ((s.frames +
|
|
1573
|
-
const L = ne(x),
|
|
1574
|
-
L && (x.geometry = L), x.computeBoundingBox(), x.geometry =
|
|
1640
|
+
const w = x[X.$skinnedMeshBoundsOffset];
|
|
1641
|
+
if ((s.frames + w) % this.skinnedMeshAutoUpdateBoundsInterval === 0) {
|
|
1642
|
+
const L = ne(x), U = x.geometry;
|
|
1643
|
+
L && (x.geometry = L), x.computeBoundingBox(), x.geometry = U;
|
|
1575
1644
|
}
|
|
1576
1645
|
}
|
|
1577
1646
|
y = x.boundingBox;
|
|
@@ -1585,13 +1654,13 @@ let ue = class X {
|
|
|
1585
1654
|
return;
|
|
1586
1655
|
}
|
|
1587
1656
|
}
|
|
1588
|
-
const x =
|
|
1657
|
+
const x = zt({
|
|
1589
1658
|
geometry: e.geometry,
|
|
1590
1659
|
matrixWorld: e.matrixWorld,
|
|
1591
1660
|
camera: t,
|
|
1592
1661
|
projectionScreenMatrix: this.projectionScreenMatrix,
|
|
1593
1662
|
desiredDensity: r,
|
|
1594
|
-
canvasHeight:
|
|
1663
|
+
canvasHeight: b,
|
|
1595
1664
|
currentLevel: s.lastLodLevel_Mesh,
|
|
1596
1665
|
boundingBox: y,
|
|
1597
1666
|
xrEnabled: this.renderer.xr.enabled,
|
|
@@ -1605,29 +1674,29 @@ let ue = class X {
|
|
|
1605
1674
|
x.level >= 0 && x.level < a && (a = x.level, l = !0);
|
|
1606
1675
|
}
|
|
1607
1676
|
if (l ? n.mesh_lod = a : n.mesh_lod = s.lastLodLevel_Mesh, A && n.mesh_lod != s.lastLodLevel_Mesh) {
|
|
1608
|
-
const
|
|
1609
|
-
|
|
1677
|
+
const w = u?.[n.mesh_lod];
|
|
1678
|
+
w && console.log(`Mesh LOD changed: ${s.lastLodLevel_Mesh} → ${n.mesh_lod} (density: ${w.densities?.[c].toFixed(0)}) | ${e.name}`);
|
|
1610
1679
|
}
|
|
1611
|
-
if (
|
|
1680
|
+
if (p) {
|
|
1612
1681
|
const x = "saveData" in globalThis.navigator && globalThis.navigator.saveData === !0;
|
|
1613
1682
|
if (s.lastLodLevel_Texture < 0) {
|
|
1614
|
-
if (n.texture_lod =
|
|
1615
|
-
const
|
|
1616
|
-
A && console.log(`First Texture LOD ${n.texture_lod} (${
|
|
1683
|
+
if (n.texture_lod = d.max_count - 1, A) {
|
|
1684
|
+
const w = d.lods[d.max_count - 1];
|
|
1685
|
+
A && console.log(`First Texture LOD ${n.texture_lod} (${w.max_height}px) - ${e.name}`);
|
|
1617
1686
|
}
|
|
1618
1687
|
} else {
|
|
1619
|
-
const
|
|
1688
|
+
const w = s.lastScreenspaceVolume.x + s.lastScreenspaceVolume.y + s.lastScreenspaceVolume.z;
|
|
1620
1689
|
let L = s.lastScreenCoverage * 4;
|
|
1621
1690
|
this.context?.engine === "model-viewer" && (L *= 1.5);
|
|
1622
|
-
const
|
|
1623
|
-
let
|
|
1624
|
-
for (let
|
|
1625
|
-
const
|
|
1626
|
-
if (!(x &&
|
|
1627
|
-
if (
|
|
1628
|
-
const
|
|
1629
|
-
console.log(`Texture LOD changed: ${s.lastLodLevel_Texture} → ${n.texture_lod} = ${
|
|
1630
|
-
Screensize: ${
|
|
1691
|
+
const U = this.renderer.getPixelRatio?.() || globalThis.devicePixelRatio || 1, O = b / U * L;
|
|
1692
|
+
let T = !1;
|
|
1693
|
+
for (let C = d.lods.length - 1; C >= 0; C--) {
|
|
1694
|
+
const S = d.lods[C];
|
|
1695
|
+
if (!(x && S.max_height >= 2048) && !(be() && S.max_height > 4096) && (S.max_height > O || !T && C === 0)) {
|
|
1696
|
+
if (T = !0, n.texture_lod = C, A && n.texture_lod < s.lastLodLevel_Texture) {
|
|
1697
|
+
const M = S.max_height;
|
|
1698
|
+
console.log(`Texture LOD changed: ${s.lastLodLevel_Texture} → ${n.texture_lod} = ${M}px
|
|
1699
|
+
Screensize: ${O.toFixed(0)}px, Coverage: ${(100 * s.lastScreenCoverage).toFixed(2)}%, Volume ${w.toFixed(1)}
|
|
1631
1700
|
${e.name}`);
|
|
1632
1701
|
}
|
|
1633
1702
|
break;
|
|
@@ -1638,7 +1707,7 @@ ${e.name}`);
|
|
|
1638
1707
|
n.texture_lod = 0;
|
|
1639
1708
|
}
|
|
1640
1709
|
};
|
|
1641
|
-
class
|
|
1710
|
+
class Et {
|
|
1642
1711
|
frames = 0;
|
|
1643
1712
|
lastLodLevel_Mesh = -1;
|
|
1644
1713
|
lastLodLevel_Texture = -1;
|
|
@@ -1646,53 +1715,53 @@ class Ct {
|
|
|
1646
1715
|
lastScreenspaceVolume = new k();
|
|
1647
1716
|
lastCentrality = 0;
|
|
1648
1717
|
}
|
|
1649
|
-
function
|
|
1718
|
+
function Ee(i, t) {
|
|
1650
1719
|
if (!(t < 0)) {
|
|
1651
1720
|
if (Array.isArray(i)) {
|
|
1652
1721
|
for (const e of i)
|
|
1653
|
-
|
|
1722
|
+
Ee(e, t);
|
|
1654
1723
|
return;
|
|
1655
1724
|
}
|
|
1656
|
-
"color" in i && i.color instanceof
|
|
1725
|
+
"color" in i && i.color instanceof Be && (i.color.copy(Nt(t, Bt)), i.needsUpdate = !0);
|
|
1657
1726
|
}
|
|
1658
1727
|
}
|
|
1659
|
-
function
|
|
1660
|
-
const e = Math.max(0, Math.min(
|
|
1661
|
-
return t.setHex(
|
|
1728
|
+
function Nt(i, t) {
|
|
1729
|
+
const e = Math.max(0, Math.min(Re.length - 1, Math.floor(i)));
|
|
1730
|
+
return t.setHex(Re[e]);
|
|
1662
1731
|
}
|
|
1663
|
-
const
|
|
1732
|
+
const Ce = /* @__PURE__ */ Symbol("NEEDLE_mesh_lod"), ae = /* @__PURE__ */ Symbol("NEEDLE_texture_lod");
|
|
1664
1733
|
let ye = null;
|
|
1665
|
-
function
|
|
1666
|
-
const i =
|
|
1734
|
+
function Ne() {
|
|
1735
|
+
const i = Vt();
|
|
1667
1736
|
i && (i.mapURLs(function(t) {
|
|
1668
|
-
return
|
|
1669
|
-
}),
|
|
1737
|
+
return ke(), t;
|
|
1738
|
+
}), ke(), ye?.disconnect(), ye = new MutationObserver((t) => {
|
|
1670
1739
|
t.forEach((e) => {
|
|
1671
1740
|
e.addedNodes.forEach((s) => {
|
|
1672
|
-
s instanceof HTMLElement && s.tagName.toLowerCase() === "model-viewer" &&
|
|
1741
|
+
s instanceof HTMLElement && s.tagName.toLowerCase() === "model-viewer" && Ve(s);
|
|
1673
1742
|
});
|
|
1674
1743
|
});
|
|
1675
1744
|
}), ye.observe(document, { childList: !0, subtree: !0 }));
|
|
1676
1745
|
}
|
|
1677
|
-
function
|
|
1746
|
+
function Vt() {
|
|
1678
1747
|
if (typeof customElements > "u") return null;
|
|
1679
1748
|
const i = customElements.get("model-viewer");
|
|
1680
1749
|
return i || (customElements.whenDefined("model-viewer").then(() => {
|
|
1681
|
-
console.debug("[gltf-progressive] model-viewer defined"),
|
|
1750
|
+
console.debug("[gltf-progressive] model-viewer defined"), Ne();
|
|
1682
1751
|
}), null);
|
|
1683
1752
|
}
|
|
1684
|
-
function
|
|
1753
|
+
function ke() {
|
|
1685
1754
|
if (typeof document > "u") return;
|
|
1686
1755
|
document.querySelectorAll("model-viewer").forEach((t) => {
|
|
1687
|
-
|
|
1756
|
+
Ve(t);
|
|
1688
1757
|
});
|
|
1689
1758
|
}
|
|
1690
|
-
const
|
|
1691
|
-
let
|
|
1692
|
-
function
|
|
1693
|
-
if (!i ||
|
|
1759
|
+
const Ae = /* @__PURE__ */ new WeakSet();
|
|
1760
|
+
let Xt = 0;
|
|
1761
|
+
function Ve(i) {
|
|
1762
|
+
if (!i || Ae.has(i))
|
|
1694
1763
|
return null;
|
|
1695
|
-
|
|
1764
|
+
Ae.add(i), console.debug("[gltf-progressive] found new model-viewer..." + ++Xt + `
|
|
1696
1765
|
`, i.getAttribute("src"));
|
|
1697
1766
|
let t = null, e = null, s = null;
|
|
1698
1767
|
for (let r = i; r != null; r = Object.getPrototypeOf(r)) {
|
|
@@ -1714,7 +1783,7 @@ function Fe(i) {
|
|
|
1714
1783
|
};
|
|
1715
1784
|
console.debug("[gltf-progressive] setup model-viewer");
|
|
1716
1785
|
const n = ue.get(t, { engine: "model-viewer" });
|
|
1717
|
-
return ue.addPlugin(new
|
|
1786
|
+
return ue.addPlugin(new jt()), n.enable(), n.addEventListener("changed", () => {
|
|
1718
1787
|
s?.call(i);
|
|
1719
1788
|
}), i.addEventListener("model-visibility", (o) => {
|
|
1720
1789
|
o.detail.visible && s?.call(i);
|
|
@@ -1726,7 +1795,7 @@ function Fe(i) {
|
|
|
1726
1795
|
}
|
|
1727
1796
|
return null;
|
|
1728
1797
|
}
|
|
1729
|
-
class
|
|
1798
|
+
class jt {
|
|
1730
1799
|
_didWarnAboutMissingUrl = !1;
|
|
1731
1800
|
onBeforeUpdateLOD(t, e, s, r) {
|
|
1732
1801
|
this.tryParseMeshLOD(e, r), this.tryParseTextureLOD(e, r);
|
|
@@ -1753,18 +1822,18 @@ class At {
|
|
|
1753
1822
|
l[ae] = !0, l.userData && (l.userData.LOD = -1);
|
|
1754
1823
|
const u = Object.keys(l);
|
|
1755
1824
|
for (let c = 0; c < u.length; c++) {
|
|
1756
|
-
const
|
|
1757
|
-
if (
|
|
1758
|
-
const
|
|
1759
|
-
if (
|
|
1760
|
-
const
|
|
1761
|
-
if (!
|
|
1762
|
-
console.warn("Texture data not found for texture index " +
|
|
1825
|
+
const f = u[c], d = l[f];
|
|
1826
|
+
if (d?.isTexture === !0) {
|
|
1827
|
+
const p = d.userData?.associations?.textures;
|
|
1828
|
+
if (p == null) continue;
|
|
1829
|
+
const b = s.parser.json.textures[p];
|
|
1830
|
+
if (!b) {
|
|
1831
|
+
console.warn("Texture data not found for texture index " + p);
|
|
1763
1832
|
continue;
|
|
1764
1833
|
}
|
|
1765
|
-
if (
|
|
1766
|
-
const y =
|
|
1767
|
-
y && n &&
|
|
1834
|
+
if (b?.extensions?.[F]) {
|
|
1835
|
+
const y = b.extensions[F];
|
|
1836
|
+
y && n && g.registerTexture(n, d, y.lods.length, p, y);
|
|
1768
1837
|
}
|
|
1769
1838
|
}
|
|
1770
1839
|
}
|
|
@@ -1775,19 +1844,19 @@ class At {
|
|
|
1775
1844
|
}
|
|
1776
1845
|
}
|
|
1777
1846
|
tryParseMeshLOD(t, e) {
|
|
1778
|
-
if (e[
|
|
1779
|
-
e[
|
|
1847
|
+
if (e[Ce] == !0) return;
|
|
1848
|
+
e[Ce] = !0;
|
|
1780
1849
|
const s = this.tryGetCurrentModelViewer(t), r = this.getUrl(s);
|
|
1781
1850
|
if (!r)
|
|
1782
1851
|
return;
|
|
1783
|
-
const n = e.userData?.gltfExtensions?.[
|
|
1852
|
+
const n = e.userData?.gltfExtensions?.[F];
|
|
1784
1853
|
if (n && r) {
|
|
1785
1854
|
const o = e.uuid;
|
|
1786
|
-
|
|
1855
|
+
g.registerMesh(r, o, e, 0, n.lods.length, n);
|
|
1787
1856
|
}
|
|
1788
1857
|
}
|
|
1789
1858
|
}
|
|
1790
|
-
function
|
|
1859
|
+
function Ht(...i) {
|
|
1791
1860
|
let t, e, s, r;
|
|
1792
1861
|
switch (i.length) {
|
|
1793
1862
|
case 2:
|
|
@@ -1802,22 +1871,22 @@ function It(...i) {
|
|
|
1802
1871
|
default:
|
|
1803
1872
|
throw new Error("Invalid arguments");
|
|
1804
1873
|
}
|
|
1805
|
-
|
|
1874
|
+
_e(e), qe(s), Fe(s, {
|
|
1806
1875
|
progressive: !0,
|
|
1807
1876
|
...r?.hints
|
|
1808
|
-
}), s.register((o) => new
|
|
1877
|
+
}), s.register((o) => new g(o));
|
|
1809
1878
|
const n = ue.get(e);
|
|
1810
1879
|
return r?.enableLODsManager !== !1 && n.enable(), n;
|
|
1811
1880
|
}
|
|
1812
|
-
|
|
1813
|
-
if (!
|
|
1881
|
+
Ne();
|
|
1882
|
+
if (!_t) {
|
|
1814
1883
|
const i = {
|
|
1815
1884
|
gltfProgressive: {
|
|
1816
|
-
useNeedleProgressive:
|
|
1885
|
+
useNeedleProgressive: Ht,
|
|
1817
1886
|
LODsManager: ue,
|
|
1818
|
-
configureLoader:
|
|
1887
|
+
configureLoader: Fe,
|
|
1819
1888
|
getRaycastMesh: ne,
|
|
1820
|
-
useRaycastMeshes:
|
|
1889
|
+
useRaycastMeshes: Ot
|
|
1821
1890
|
}
|
|
1822
1891
|
};
|
|
1823
1892
|
if (!globalThis.Needle)
|
|
@@ -1828,13 +1897,13 @@ if (!dt) {
|
|
|
1828
1897
|
}
|
|
1829
1898
|
export {
|
|
1830
1899
|
ue as LODsManager,
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1900
|
+
g as NEEDLE_progressive,
|
|
1901
|
+
qe as addDracoAndKTX2Loaders,
|
|
1902
|
+
zt as calculateMeshLODLevel,
|
|
1903
|
+
Fe as configureLoader,
|
|
1904
|
+
_e as createLoaders,
|
|
1905
|
+
Nt as getLODColor,
|
|
1837
1906
|
ne as getRaycastMesh,
|
|
1838
|
-
|
|
1839
|
-
|
|
1907
|
+
gt as setDracoDecoderLocation,
|
|
1908
|
+
pt as setKTX2TranscoderLocation
|
|
1840
1909
|
};
|