@needle-tools/engine 4.8.0-next.9de3f45 → 4.8.0-next.d716e0e
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/dist/gltf-progressive-VTcU5sMu.min.js +8 -0
- package/dist/gltf-progressive-VXeY4K8o.js +1370 -0
- package/dist/gltf-progressive-_-uQwSK8.umd.cjs +8 -0
- package/dist/loader.worker-D5fjeWJO.js +27 -0
- package/dist/needle-engine.bundle-BYz57wrx.umd.cjs +1607 -0
- package/dist/needle-engine.bundle-CxDqrXwR.min.js +1607 -0
- package/dist/needle-engine.bundle-DNnYQtTS.js +42600 -0
- package/dist/needle-engine.d.ts +15 -15
- package/dist/needle-engine.js +591 -592
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{postprocessing-BzY0H7ry.min.js → postprocessing-ChsrvDkI.min.js} +54 -54
- package/dist/{postprocessing-vKBVFpSz.js → postprocessing-DElbMQgB.js} +479 -483
- package/dist/{postprocessing-Dw2OCMp4.umd.cjs → postprocessing-DtxaELce.umd.cjs} +66 -66
- package/dist/{three-examples-DUcCNw9s.umd.cjs → three-examples-BhQvv1B9.umd.cjs} +11 -11
- package/dist/{three-examples-tvuhV8Ne.js → three-examples-CM6Iip03.js} +23 -27
- package/dist/{three-examples-BMOhDaYR.min.js → three-examples-D2zemuAM.min.js} +12 -12
- package/dist/{three-mesh-ui-CxuWt7m-.js → three-mesh-ui-D6Mz5Yl7.js} +799 -810
- package/dist/three-mesh-ui-DWcMuyQ_.min.js +406 -0
- package/dist/three-mesh-ui-tt0buEDC.umd.cjs +406 -0
- package/dist/{vendor-BmYIgaS1.js → vendor-ClB-U1Hn.js} +10 -10
- package/dist/{vendor-Cavtu3CP.umd.cjs → vendor-bOWOWClg.umd.cjs} +1 -1
- package/package.json +3 -3
- package/plugins/vite/dependencies.js +28 -19
- package/plugins/vite/dependency-watcher.js +6 -1
- package/dist/gltf-progressive-Bz6FXMZ1.min.js +0 -8
- package/dist/gltf-progressive-DAdiYt1v.js +0 -1392
- package/dist/gltf-progressive-D_S7mZaT.umd.cjs +0 -8
- package/dist/loader.worker-qHzhYKEC.js +0 -1
- package/dist/needle-engine.bundle-C5vAAuK3.js +0 -43849
- package/dist/needle-engine.bundle-fg0LG9Pa.umd.cjs +0 -1607
- package/dist/needle-engine.bundle-tepIih-J.min.js +0 -1607
- package/dist/three-mesh-ui-B3p3gyUz.min.js +0 -406
- package/dist/three-mesh-ui-CQiIQIlA.umd.cjs +0 -406
|
@@ -1,1392 +0,0 @@
|
|
|
1
|
-
var rt = Object.defineProperty;
|
|
2
|
-
var Ge = (o) => {
|
|
3
|
-
throw TypeError(o);
|
|
4
|
-
};
|
|
5
|
-
var nt = (o, e, t) => e in o ? rt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
6
|
-
var u = (o, e, t) => nt(o, typeof e != "symbol" ? e + "" : e, t), Fe = (o, e, t) => e.has(o) || Ge("Cannot " + t);
|
|
7
|
-
var v = (o, e, t) => (Fe(o, e, "read from private field"), t ? t.call(o) : e.get(o)), j = (o, e, t) => e.has(o) ? Ge("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t), V = (o, e, t, s) => (Fe(o, e, "write to private field"), s ? s.call(o, t) : e.set(o, t), t);
|
|
8
|
-
import { BufferGeometry as fe, Mesh as re, Box3 as Ce, Vector3 as N, Sphere as Ve, CompressedTexture as it, Texture as te, Matrix3 as ot, InterleavedBuffer as at, InterleavedBufferAttribute as lt, BufferAttribute as ut, TextureLoader as dt, Matrix4 as Ne, Clock as ct, MeshStandardMaterial as ft } from "./three-DrqIzZTH.js";
|
|
9
|
-
import { DRACOLoader as ht, KTX2Loader as gt, MeshoptDecoder as pt, GLTFLoader as $e } from "./three-examples-tvuhV8Ne.js";
|
|
10
|
-
const Ke = "3.1.1";
|
|
11
|
-
globalThis.GLTF_PROGRESSIVE_VERSION = Ke;
|
|
12
|
-
console.debug(`[gltf-progressive] version ${Ke}`);
|
|
13
|
-
let W = "https://www.gstatic.com/draco/versioned/decoders/1.5.7/", ne = "https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";
|
|
14
|
-
const mt = W, yt = ne, Xe = new URL(W + "draco_decoder.js");
|
|
15
|
-
Xe.searchParams.append("range", "true");
|
|
16
|
-
fetch(Xe, {
|
|
17
|
-
method: "GET",
|
|
18
|
-
headers: {
|
|
19
|
-
Range: "bytes=0-1"
|
|
20
|
-
}
|
|
21
|
-
}).catch((o) => {
|
|
22
|
-
console.debug(`Failed to fetch remote Draco decoder from ${W} (offline: ${typeof navigator < "u" ? navigator.onLine : "unknown"})`), W === mt && wt("./include/draco/"), ne === yt && Lt("./include/ktx2/");
|
|
23
|
-
}).finally(() => {
|
|
24
|
-
He();
|
|
25
|
-
});
|
|
26
|
-
const xt = () => ({
|
|
27
|
-
dracoDecoderPath: W,
|
|
28
|
-
ktx2TranscoderPath: ne
|
|
29
|
-
});
|
|
30
|
-
function wt(o) {
|
|
31
|
-
W = o, G && G[ke] != W ? (console.debug("Updating Draco decoder path to " + o), G[ke] = W, G.setDecoderPath(W), G.preload()) : console.debug("Setting Draco decoder path to " + o);
|
|
32
|
-
}
|
|
33
|
-
function Lt(o) {
|
|
34
|
-
ne = o, z && z.transcoderPath != ne ? (console.debug("Updating KTX2 transcoder path to " + o), z.setTranscoderPath(ne), z.init()) : console.debug("Setting KTX2 transcoder path to " + o);
|
|
35
|
-
}
|
|
36
|
-
function Re(o) {
|
|
37
|
-
return He(), o ? z.detectSupport(o) : o !== null && console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures might fail"), { dracoLoader: G, ktx2Loader: z, meshoptDecoder: Le };
|
|
38
|
-
}
|
|
39
|
-
function Ye(o) {
|
|
40
|
-
o.dracoLoader || o.setDRACOLoader(G), o.ktx2Loader || o.setKTX2Loader(z), o.meshoptDecoder || o.setMeshoptDecoder(Le);
|
|
41
|
-
}
|
|
42
|
-
const ke = Symbol("dracoDecoderPath");
|
|
43
|
-
let G, Le, z;
|
|
44
|
-
function He() {
|
|
45
|
-
G || (G = new ht(), G[ke] = W, G.setDecoderPath(W), G.setDecoderConfig({ type: "js" }), G.preload()), z || (z = new gt(), z.setTranscoderPath(ne), z.init()), Le || (Le = pt);
|
|
46
|
-
}
|
|
47
|
-
const Ie = /* @__PURE__ */ new WeakMap();
|
|
48
|
-
function je(o, e) {
|
|
49
|
-
let t = Ie.get(o);
|
|
50
|
-
t ? t = Object.assign(t, e) : t = e, Ie.set(o, t);
|
|
51
|
-
}
|
|
52
|
-
const ve = $e.prototype.load;
|
|
53
|
-
function _t(...o) {
|
|
54
|
-
const e = Ie.get(this);
|
|
55
|
-
let t = o[0];
|
|
56
|
-
const s = new URL(t, window.location.href);
|
|
57
|
-
if (s.hostname.endsWith("needle.tools")) {
|
|
58
|
-
const r = (e == null ? void 0 : e.progressive) !== void 0 ? e.progressive : !0, i = e != null && e.usecase ? e.usecase : "default";
|
|
59
|
-
r ? this.requestHeader.Accept = `*/*;progressive=allowed;usecase=${i}` : this.requestHeader.Accept = `*/*;usecase=${i}`, t = s.toString();
|
|
60
|
-
}
|
|
61
|
-
return o[0] = t, ve == null ? void 0 : ve.call(this, ...o);
|
|
62
|
-
}
|
|
63
|
-
$e.prototype.load = _t;
|
|
64
|
-
ie("debugprogressive");
|
|
65
|
-
function ie(o) {
|
|
66
|
-
if (typeof window > "u")
|
|
67
|
-
return !1;
|
|
68
|
-
const t = new URL(window.location.href).searchParams.get(o);
|
|
69
|
-
return t == null || t === "0" || t === "false" ? !1 : t === "" ? !0 : t;
|
|
70
|
-
}
|
|
71
|
-
function Dt(o, e) {
|
|
72
|
-
if (e === void 0 || e.startsWith("./") || e.startsWith("http") || o === void 0)
|
|
73
|
-
return e;
|
|
74
|
-
const t = o.lastIndexOf("/");
|
|
75
|
-
if (t >= 0) {
|
|
76
|
-
const s = o.substring(0, t + 1);
|
|
77
|
-
for (; s.endsWith("/") && e.startsWith("/"); )
|
|
78
|
-
e = e.substring(1);
|
|
79
|
-
return s + e;
|
|
80
|
-
}
|
|
81
|
-
return e;
|
|
82
|
-
}
|
|
83
|
-
let le;
|
|
84
|
-
function Qe() {
|
|
85
|
-
return le !== void 0 || (le = /iPhone|iPad|iPod|Android|IEMobile/i.test(navigator.userAgent), ie("debugprogressive") && console.log("[glTF Progressive]: isMobileDevice", le)), le;
|
|
86
|
-
}
|
|
87
|
-
function Ue() {
|
|
88
|
-
if (typeof window > "u")
|
|
89
|
-
return !1;
|
|
90
|
-
const o = new URL(window.location.href), e = o.hostname === "localhost" || /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(o.hostname);
|
|
91
|
-
return o.hostname === "127.0.0.1" || e;
|
|
92
|
-
}
|
|
93
|
-
class Mt {
|
|
94
|
-
constructor(e = 100, t = {}) {
|
|
95
|
-
u(this, "maxConcurrent");
|
|
96
|
-
u(this, "_running", /* @__PURE__ */ new Map());
|
|
97
|
-
u(this, "_queue", []);
|
|
98
|
-
u(this, "debug", !1);
|
|
99
|
-
u(this, "tick", () => {
|
|
100
|
-
this.internalUpdate(), setTimeout(this.tick, 10);
|
|
101
|
-
});
|
|
102
|
-
this.maxConcurrent = e, this.debug = t.debug ?? !1, window.requestAnimationFrame(this.tick);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Request a slot for a promise with a specific key. This function returns a promise with a `use` method that can be called to add the promise to the queue.
|
|
106
|
-
*/
|
|
107
|
-
slot(e) {
|
|
108
|
-
return this.debug && console.debug(`[PromiseQueue]: Requesting slot for key ${e}, running: ${this._running.size}, waiting: ${this._queue.length}`), new Promise((t) => {
|
|
109
|
-
this._queue.push({ key: e, resolve: t });
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
add(e, t) {
|
|
113
|
-
this._running.has(e) || (this._running.set(e, t), t.finally(() => {
|
|
114
|
-
this._running.delete(e), this.debug && console.debug(`[PromiseQueue]: Promise finished now running: ${this._running.size}, waiting: ${this._queue.length}. (finished ${e})`);
|
|
115
|
-
}), this.debug && console.debug(`[PromiseQueue]: Added new promise, now running: ${this._running.size}, waiting: ${this._queue.length}. (added ${e})`));
|
|
116
|
-
}
|
|
117
|
-
internalUpdate() {
|
|
118
|
-
const e = this.maxConcurrent - this._running.size;
|
|
119
|
-
for (let t = 0; t < e && this._queue.length > 0; t++) {
|
|
120
|
-
this.debug && console.debug(`[PromiseQueue]: Running ${this._running.size} promises, waiting for ${this._queue.length} more.`);
|
|
121
|
-
const { key: s, resolve: n } = this._queue.shift();
|
|
122
|
-
n({
|
|
123
|
-
use: (r) => this.add(s, r)
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
const bt = typeof window > "u" && typeof document > "u", Be = Symbol("needle:raycast-mesh");
|
|
129
|
-
function he(o) {
|
|
130
|
-
return (o == null ? void 0 : o[Be]) instanceof fe ? o[Be] : null;
|
|
131
|
-
}
|
|
132
|
-
function Ot(o, e) {
|
|
133
|
-
if ((o.type === "Mesh" || o.type === "SkinnedMesh") && !he(o)) {
|
|
134
|
-
const s = St(e);
|
|
135
|
-
s.userData = { isRaycastMesh: !0 }, o[Be] = s;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
function vt(o = !0) {
|
|
139
|
-
if (o) {
|
|
140
|
-
if (ue)
|
|
141
|
-
return;
|
|
142
|
-
const e = ue = re.prototype.raycast;
|
|
143
|
-
re.prototype.raycast = function(t, s) {
|
|
144
|
-
const n = this, r = he(n);
|
|
145
|
-
let i;
|
|
146
|
-
r && n.isMesh && (i = n.geometry, n.geometry = r), e.call(this, t, s), i && (n.geometry = i);
|
|
147
|
-
};
|
|
148
|
-
} else {
|
|
149
|
-
if (!ue)
|
|
150
|
-
return;
|
|
151
|
-
re.prototype.raycast = ue, ue = null;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
let ue = null;
|
|
155
|
-
function St(o) {
|
|
156
|
-
const e = new fe();
|
|
157
|
-
for (const t in o.attributes)
|
|
158
|
-
e.setAttribute(t, o.getAttribute(t));
|
|
159
|
-
return e.setIndex(o.getIndex()), e;
|
|
160
|
-
}
|
|
161
|
-
const J = new Array(), x = ie("debugprogressive");
|
|
162
|
-
let xe, se = -1;
|
|
163
|
-
if (x) {
|
|
164
|
-
let e = function() {
|
|
165
|
-
se += 1, se >= o && (se = -1), console.log(`Toggle LOD level [${se}]`);
|
|
166
|
-
}, o = 6;
|
|
167
|
-
window.addEventListener("keyup", (t) => {
|
|
168
|
-
t.key === "p" && e(), t.key === "w" && (xe = !xe, console.log(`Toggle wireframe [${xe}]`));
|
|
169
|
-
const s = parseInt(t.key);
|
|
170
|
-
!isNaN(s) && s >= 0 && (se = s, console.log(`Set LOD level to [${se}]`));
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
function Je(o) {
|
|
174
|
-
if (x)
|
|
175
|
-
if (Array.isArray(o))
|
|
176
|
-
for (const e of o)
|
|
177
|
-
Je(e);
|
|
178
|
-
else o && "wireframe" in o && (o.wireframe = xe === !0);
|
|
179
|
-
}
|
|
180
|
-
const de = new Array();
|
|
181
|
-
let Tt = 0;
|
|
182
|
-
const Pt = Qe() ? 2 : 10;
|
|
183
|
-
function At(o) {
|
|
184
|
-
if (de.length < Pt) {
|
|
185
|
-
const s = de.length;
|
|
186
|
-
x && console.warn(`[Worker] Creating new worker #${s}`);
|
|
187
|
-
const n = Ee.createWorker(o || {});
|
|
188
|
-
return de.push(n), n;
|
|
189
|
-
}
|
|
190
|
-
const e = Tt++ % de.length;
|
|
191
|
-
return de[e];
|
|
192
|
-
}
|
|
193
|
-
class Ee {
|
|
194
|
-
constructor(e, t) {
|
|
195
|
-
u(this, "worker");
|
|
196
|
-
u(this, "_running", []);
|
|
197
|
-
u(this, "_webglRenderer", null);
|
|
198
|
-
u(this, "_debug", !1);
|
|
199
|
-
this.worker = e, this._debug = t.debug ?? !1, e.onmessage = (s) => {
|
|
200
|
-
const n = s.data;
|
|
201
|
-
switch (this._debug && console.log("[Worker] EVENT", n), n.type) {
|
|
202
|
-
case "loaded-gltf":
|
|
203
|
-
for (const r of this._running)
|
|
204
|
-
if (r.url === n.result.url) {
|
|
205
|
-
Ct(n.result), r.resolve(n.result);
|
|
206
|
-
const i = r.url;
|
|
207
|
-
i.startsWith("blob:") && URL.revokeObjectURL(i);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}, e.onerror = (s) => {
|
|
211
|
-
console.error("[Worker] Error in gltf-progressive worker:", s);
|
|
212
|
-
}, e.postMessage({
|
|
213
|
-
type: "init"
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
static async createWorker(e) {
|
|
217
|
-
const t = new Worker(new URL(
|
|
218
|
-
/* @vite-ignore */
|
|
219
|
-
"/loader.worker-qHzhYKEC.js",
|
|
220
|
-
import.meta.url
|
|
221
|
-
), {
|
|
222
|
-
type: "module"
|
|
223
|
-
});
|
|
224
|
-
return new Ee(t, e);
|
|
225
|
-
}
|
|
226
|
-
async load(e, t) {
|
|
227
|
-
const s = xt();
|
|
228
|
-
let n = t == null ? void 0 : t.renderer;
|
|
229
|
-
n || (this._webglRenderer ?? (this._webglRenderer = (async () => {
|
|
230
|
-
const { WebGLRenderer: d } = await import("./three-DrqIzZTH.js").then((f) => f.THREE);
|
|
231
|
-
return new d();
|
|
232
|
-
})()), n = await this._webglRenderer);
|
|
233
|
-
const a = Re(n).ktx2Loader.workerConfig;
|
|
234
|
-
e instanceof URL ? e = e.toString() : e.startsWith("file:") ? e = URL.createObjectURL(new Blob([e])) : !e.startsWith("blob:") && !e.startsWith("http:") && !e.startsWith("https:") && (e = new URL(e, window.location.href).toString());
|
|
235
|
-
const l = {
|
|
236
|
-
type: "load",
|
|
237
|
-
url: e,
|
|
238
|
-
dracoDecoderPath: s.dracoDecoderPath,
|
|
239
|
-
ktx2TranscoderPath: s.ktx2TranscoderPath,
|
|
240
|
-
ktx2LoaderConfig: a
|
|
241
|
-
};
|
|
242
|
-
return this._debug && console.debug("[Worker] Sending load request", l), this.worker.postMessage(l), new Promise((d) => {
|
|
243
|
-
this._running.push({
|
|
244
|
-
url: e.toString(),
|
|
245
|
-
resolve: d
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
function Ct(o) {
|
|
251
|
-
var e, t, s, n, r, i, a, l, d, f, m, M, w, T, b, I;
|
|
252
|
-
for (const S of o.geometries) {
|
|
253
|
-
const c = S.geometry, O = new fe();
|
|
254
|
-
if (O.name = c.name || "", c.index) {
|
|
255
|
-
const h = c.index;
|
|
256
|
-
O.setIndex(Se(h));
|
|
257
|
-
}
|
|
258
|
-
for (const h in c.attributes) {
|
|
259
|
-
const L = c.attributes[h], A = Se(L);
|
|
260
|
-
O.setAttribute(h, A);
|
|
261
|
-
}
|
|
262
|
-
if (c.morphAttributes)
|
|
263
|
-
for (const h in c.morphAttributes) {
|
|
264
|
-
const A = c.morphAttributes[h].map((F) => Se(F));
|
|
265
|
-
O.morphAttributes[h] = A;
|
|
266
|
-
}
|
|
267
|
-
if (O.morphTargetsRelative = c.morphTargetsRelative ?? !1, O.boundingBox = new Ce(), O.boundingBox.min = new N((e = c.boundingBox) == null ? void 0 : e.min.x, (t = c.boundingBox) == null ? void 0 : t.min.y, (s = c.boundingBox) == null ? void 0 : s.min.z), O.boundingBox.max = new N((n = c.boundingBox) == null ? void 0 : n.max.x, (r = c.boundingBox) == null ? void 0 : r.max.y, (i = c.boundingBox) == null ? void 0 : i.max.z), O.boundingSphere = new Ve(new N((a = c.boundingSphere) == null ? void 0 : a.center.x, (l = c.boundingSphere) == null ? void 0 : l.center.y, (d = c.boundingSphere) == null ? void 0 : d.center.z), (f = c.boundingSphere) == null ? void 0 : f.radius), c.groups)
|
|
268
|
-
for (const h of c.groups)
|
|
269
|
-
O.addGroup(h.start, h.count, h.materialIndex);
|
|
270
|
-
c.userData && (O.userData = c.userData), S.geometry = O;
|
|
271
|
-
}
|
|
272
|
-
for (const S of o.textures) {
|
|
273
|
-
const c = S.texture;
|
|
274
|
-
let O = null;
|
|
275
|
-
if (c.isCompressedTexture) {
|
|
276
|
-
const h = c.mipmaps, L = ((m = c.image) == null ? void 0 : m.width) || ((w = (M = c.source) == null ? void 0 : M.data) == null ? void 0 : w.width) || -1, A = ((T = c.image) == null ? void 0 : T.height) || ((I = (b = c.source) == null ? void 0 : b.data) == null ? void 0 : I.height) || -1;
|
|
277
|
-
O = new it(h, L, A, c.format, c.type, c.mapping, c.wrapS, c.wrapT, c.magFilter, c.minFilter, c.anisotropy, c.colorSpace);
|
|
278
|
-
} else
|
|
279
|
-
O = new te(c.image, c.mapping, c.wrapS, c.wrapT, c.magFilter, c.minFilter, c.format, c.type, c.anisotropy, c.colorSpace), O.mipmaps = c.mipmaps, O.channel = c.channel, O.source.data = c.source.data, O.flipY = c.flipY, O.premultiplyAlpha = c.premultiplyAlpha, O.unpackAlignment = c.unpackAlignment, O.matrix = new ot(...c.matrix.elements);
|
|
280
|
-
if (!O) {
|
|
281
|
-
console.error("[Worker] Failed to create new texture from received data. Texture is not a CompressedTexture or Texture.");
|
|
282
|
-
continue;
|
|
283
|
-
}
|
|
284
|
-
S.texture = O;
|
|
285
|
-
}
|
|
286
|
-
return o;
|
|
287
|
-
}
|
|
288
|
-
function Se(o) {
|
|
289
|
-
let e = o;
|
|
290
|
-
if ("isInterleavedBufferAttribute" in o && o.isInterleavedBufferAttribute) {
|
|
291
|
-
const t = o.data, s = t.array, n = new at(s, t.stride);
|
|
292
|
-
e = new lt(n, o.itemSize, s.byteOffset, o.normalized), e.offset = o.offset;
|
|
293
|
-
} else "isBufferAttribute" in o && o.isBufferAttribute && (e = new ut(o.array, o.itemSize, o.normalized), e.usage = o.usage, e.gpuType = o.gpuType, e.updateRanges = o.updateRanges);
|
|
294
|
-
return e;
|
|
295
|
-
}
|
|
296
|
-
const kt = ie("gltf-progressive-worker"), It = ie("gltf-progressive-reduce-mipmaps"), Te = Symbol("needle-progressive-texture"), X = "NEEDLE_progressive", _ = class _ {
|
|
297
|
-
constructor(e, t) {
|
|
298
|
-
u(this, "parser");
|
|
299
|
-
u(this, "url");
|
|
300
|
-
u(this, "_isLoadingMesh");
|
|
301
|
-
u(this, "loadMesh", (e) => {
|
|
302
|
-
var s, n;
|
|
303
|
-
if (this._isLoadingMesh)
|
|
304
|
-
return null;
|
|
305
|
-
const t = (n = (s = this.parser.json.meshes[e]) == null ? void 0 : s.extensions) == null ? void 0 : n[X];
|
|
306
|
-
return t ? (this._isLoadingMesh = !0, this.parser.getDependency("mesh", e).then((r) => {
|
|
307
|
-
var i;
|
|
308
|
-
return this._isLoadingMesh = !1, r && _.registerMesh(this.url, t.guid, r, (i = t.lods) == null ? void 0 : i.length, 0, t), r;
|
|
309
|
-
})) : null;
|
|
310
|
-
});
|
|
311
|
-
x && console.log("Progressive extension registered for", t), this.parser = e, this.url = t;
|
|
312
|
-
}
|
|
313
|
-
/** The name of the extension */
|
|
314
|
-
get name() {
|
|
315
|
-
return X;
|
|
316
|
-
}
|
|
317
|
-
static getMeshLODExtension(e) {
|
|
318
|
-
const t = this.getAssignedLODInformation(e);
|
|
319
|
-
return t != null && t.key ? this.lodInfos.get(t.key) : null;
|
|
320
|
-
}
|
|
321
|
-
static getPrimitiveIndex(e) {
|
|
322
|
-
var s;
|
|
323
|
-
const t = (s = this.getAssignedLODInformation(e)) == null ? void 0 : s.index;
|
|
324
|
-
return t ?? -1;
|
|
325
|
-
}
|
|
326
|
-
static getMaterialMinMaxLODsCount(e, t) {
|
|
327
|
-
const s = this, n = "LODS:minmax", r = e[n];
|
|
328
|
-
if (r != null)
|
|
329
|
-
return r;
|
|
330
|
-
if (t || (t = {
|
|
331
|
-
min_count: 1 / 0,
|
|
332
|
-
max_count: 0,
|
|
333
|
-
lods: []
|
|
334
|
-
}), Array.isArray(e)) {
|
|
335
|
-
for (const a of e)
|
|
336
|
-
this.getMaterialMinMaxLODsCount(a, t);
|
|
337
|
-
return e[n] = t, t;
|
|
338
|
-
}
|
|
339
|
-
if (x === "verbose" && console.log("getMaterialMinMaxLODsCount", e), e.type === "ShaderMaterial" || e.type === "RawShaderMaterial") {
|
|
340
|
-
const a = e;
|
|
341
|
-
for (const l of Object.keys(a.uniforms)) {
|
|
342
|
-
const d = a.uniforms[l].value;
|
|
343
|
-
(d == null ? void 0 : d.isTexture) === !0 && i(d, t);
|
|
344
|
-
}
|
|
345
|
-
} else if (e.isMaterial)
|
|
346
|
-
for (const a of Object.keys(e)) {
|
|
347
|
-
const l = e[a];
|
|
348
|
-
(l == null ? void 0 : l.isTexture) === !0 && i(l, t);
|
|
349
|
-
}
|
|
350
|
-
else
|
|
351
|
-
x && console.warn(`[getMaterialMinMaxLODsCount] Unsupported material type: ${e.type}`);
|
|
352
|
-
return e[n] = t, t;
|
|
353
|
-
function i(a, l) {
|
|
354
|
-
const d = s.getAssignedLODInformation(a);
|
|
355
|
-
if (d) {
|
|
356
|
-
const f = s.lodInfos.get(d.key);
|
|
357
|
-
if (f && f.lods) {
|
|
358
|
-
l.min_count = Math.min(l.min_count, f.lods.length), l.max_count = Math.max(l.max_count, f.lods.length);
|
|
359
|
-
for (let m = 0; m < f.lods.length; m++) {
|
|
360
|
-
const M = f.lods[m];
|
|
361
|
-
M.width && (l.lods[m] = l.lods[m] || { min_height: 1 / 0, max_height: 0 }, l.lods[m].min_height = Math.min(l.lods[m].min_height, M.height), l.lods[m].max_height = Math.max(l.lods[m].max_height, M.height));
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
/** Check if a LOD level is available for a mesh or a texture
|
|
368
|
-
* @param obj the mesh or texture to check
|
|
369
|
-
* @param level the level of detail to check for (0 is the highest resolution). If undefined, the function checks if any LOD level is available
|
|
370
|
-
* @returns true if the LOD level is available (or if any LOD level is available if level is undefined)
|
|
371
|
-
*/
|
|
372
|
-
static hasLODLevelAvailable(e, t) {
|
|
373
|
-
var r;
|
|
374
|
-
if (Array.isArray(e)) {
|
|
375
|
-
for (const i of e)
|
|
376
|
-
if (this.hasLODLevelAvailable(i, t))
|
|
377
|
-
return !0;
|
|
378
|
-
return !1;
|
|
379
|
-
}
|
|
380
|
-
if (e.isMaterial === !0) {
|
|
381
|
-
for (const i of Object.keys(e)) {
|
|
382
|
-
const a = e[i];
|
|
383
|
-
if (a && a.isTexture && this.hasLODLevelAvailable(a, t))
|
|
384
|
-
return !0;
|
|
385
|
-
}
|
|
386
|
-
return !1;
|
|
387
|
-
} else if (e.isGroup === !0) {
|
|
388
|
-
for (const i of e.children)
|
|
389
|
-
if (i.isMesh === !0 && this.hasLODLevelAvailable(i, t))
|
|
390
|
-
return !0;
|
|
391
|
-
}
|
|
392
|
-
let s, n;
|
|
393
|
-
if (e.isMesh ? s = e.geometry : (e.isBufferGeometry || e.isTexture) && (s = e), s && (r = s == null ? void 0 : s.userData) != null && r.LODS) {
|
|
394
|
-
const i = s.userData.LODS;
|
|
395
|
-
if (n = this.lodInfos.get(i.key), t === void 0)
|
|
396
|
-
return n != null;
|
|
397
|
-
if (n)
|
|
398
|
-
return Array.isArray(n.lods) ? t < n.lods.length : t === 0;
|
|
399
|
-
}
|
|
400
|
-
return !1;
|
|
401
|
-
}
|
|
402
|
-
/** Load a different resolution of a mesh (if available)
|
|
403
|
-
* @param context the context
|
|
404
|
-
* @param source the sourceid of the file from which the mesh is loaded (this is usually the component's sourceId)
|
|
405
|
-
* @param mesh the mesh to load the LOD for
|
|
406
|
-
* @param level the level of detail to load (0 is the highest resolution)
|
|
407
|
-
* @returns a promise that resolves to the mesh with the requested LOD level
|
|
408
|
-
* @example
|
|
409
|
-
* ```javascript
|
|
410
|
-
* const mesh = this.gameObject as Mesh;
|
|
411
|
-
* NEEDLE_progressive.assignMeshLOD(context, sourceId, mesh, 1).then(mesh => {
|
|
412
|
-
* console.log("Mesh with LOD level 1 loaded", mesh);
|
|
413
|
-
* });
|
|
414
|
-
* ```
|
|
415
|
-
*/
|
|
416
|
-
static assignMeshLOD(e, t) {
|
|
417
|
-
var s;
|
|
418
|
-
if (!e)
|
|
419
|
-
return Promise.resolve(null);
|
|
420
|
-
if (e instanceof re || e.isMesh === !0) {
|
|
421
|
-
const n = e.geometry, r = this.getAssignedLODInformation(n);
|
|
422
|
-
if (!r)
|
|
423
|
-
return Promise.resolve(null);
|
|
424
|
-
for (const i of J)
|
|
425
|
-
(s = i.onBeforeGetLODMesh) == null || s.call(i, e, t);
|
|
426
|
-
return e["LOD:requested level"] = t, _.getOrLoadLOD(n, t).then((i) => {
|
|
427
|
-
if (Array.isArray(i)) {
|
|
428
|
-
const a = r.index || 0;
|
|
429
|
-
i = i[a];
|
|
430
|
-
}
|
|
431
|
-
return e["LOD:requested level"] === t && (delete e["LOD:requested level"], i && n != i && ((i == null ? void 0 : i.isBufferGeometry) ? e.geometry = i : x && console.error("Invalid LOD geometry", i))), i;
|
|
432
|
-
}).catch((i) => (console.error("Error loading mesh LOD", e, i), null));
|
|
433
|
-
} else x && console.error("Invalid call to assignMeshLOD: Request mesh LOD but the object is not a mesh", e);
|
|
434
|
-
return Promise.resolve(null);
|
|
435
|
-
}
|
|
436
|
-
static assignTextureLOD(e, t = 0) {
|
|
437
|
-
if (!e)
|
|
438
|
-
return Promise.resolve(null);
|
|
439
|
-
if (e.isMesh === !0) {
|
|
440
|
-
const s = e;
|
|
441
|
-
if (Array.isArray(s.material)) {
|
|
442
|
-
const n = new Array();
|
|
443
|
-
for (const r of s.material) {
|
|
444
|
-
const i = this.assignTextureLOD(r, t);
|
|
445
|
-
n.push(i);
|
|
446
|
-
}
|
|
447
|
-
return Promise.all(n).then((r) => {
|
|
448
|
-
const i = new Array();
|
|
449
|
-
for (const a of r)
|
|
450
|
-
Array.isArray(a) && i.push(...a);
|
|
451
|
-
return i;
|
|
452
|
-
});
|
|
453
|
-
} else
|
|
454
|
-
return this.assignTextureLOD(s.material, t);
|
|
455
|
-
}
|
|
456
|
-
if (e.isMaterial === !0) {
|
|
457
|
-
const s = e, n = [], r = new Array();
|
|
458
|
-
if (s.uniforms && (s.isRawShaderMaterial || s.isShaderMaterial === !0)) {
|
|
459
|
-
const i = s;
|
|
460
|
-
for (const a of Object.keys(i.uniforms)) {
|
|
461
|
-
const l = i.uniforms[a].value;
|
|
462
|
-
if ((l == null ? void 0 : l.isTexture) === !0) {
|
|
463
|
-
const d = this.assignTextureLODForSlot(l, t, s, a).then((f) => (f && i.uniforms[a].value != f && (i.uniforms[a].value = f, i.uniformsNeedUpdate = !0), f));
|
|
464
|
-
n.push(d), r.push(a);
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
} else
|
|
468
|
-
for (const i of Object.keys(s)) {
|
|
469
|
-
const a = s[i];
|
|
470
|
-
if ((a == null ? void 0 : a.isTexture) === !0) {
|
|
471
|
-
const l = this.assignTextureLODForSlot(a, t, s, i);
|
|
472
|
-
n.push(l), r.push(i);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
return Promise.all(n).then((i) => {
|
|
476
|
-
const a = new Array();
|
|
477
|
-
for (let l = 0; l < i.length; l++) {
|
|
478
|
-
const d = i[l], f = r[l];
|
|
479
|
-
d && d.isTexture === !0 ? a.push({ material: s, slot: f, texture: d, level: t }) : a.push({ material: s, slot: f, texture: null, level: t });
|
|
480
|
-
}
|
|
481
|
-
return a;
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
if (e instanceof te || e.isTexture === !0) {
|
|
485
|
-
const s = e;
|
|
486
|
-
return this.assignTextureLODForSlot(s, t, null, null);
|
|
487
|
-
}
|
|
488
|
-
return Promise.resolve(null);
|
|
489
|
-
}
|
|
490
|
-
static assignTextureLODForSlot(e, t, s, n) {
|
|
491
|
-
return (e == null ? void 0 : e.isTexture) !== !0 ? Promise.resolve(null) : n === "glyphMap" ? Promise.resolve(e) : _.getOrLoadLOD(e, t).then((r) => {
|
|
492
|
-
var i, a;
|
|
493
|
-
if (Array.isArray(r))
|
|
494
|
-
return console.warn("Progressive: Got an array of textures for a texture slot, this should not happen..."), null;
|
|
495
|
-
if ((r == null ? void 0 : r.isTexture) === !0) {
|
|
496
|
-
if (r != e && s && n) {
|
|
497
|
-
const l = s[n];
|
|
498
|
-
if (l && !x) {
|
|
499
|
-
const d = this.getAssignedLODInformation(l);
|
|
500
|
-
if (d && (d == null ? void 0 : d.level) < t)
|
|
501
|
-
return x === "verbose" && console.warn("Assigned texture level is already higher: ", d.level, t, s, l, r), null;
|
|
502
|
-
}
|
|
503
|
-
if (It && r.mipmaps) {
|
|
504
|
-
const d = r.mipmaps.length;
|
|
505
|
-
r.mipmaps.length = Math.min(r.mipmaps.length, 3), d !== r.mipmaps.length && x && console.debug(`Reduced mipmap count from ${d} to ${r.mipmaps.length} for ${r.uuid}: ${(i = r.image) == null ? void 0 : i.width}x${(a = r.image) == null ? void 0 : a.height}.`);
|
|
506
|
-
}
|
|
507
|
-
s[n] = r;
|
|
508
|
-
}
|
|
509
|
-
return r;
|
|
510
|
-
} else x == "verbose" && console.warn("No LOD found for", e, t);
|
|
511
|
-
return null;
|
|
512
|
-
}).catch((r) => (console.error("Error loading LOD", e, r), null));
|
|
513
|
-
}
|
|
514
|
-
// private _isLoadingTexture;
|
|
515
|
-
// loadTexture = (textureIndex: number) => {
|
|
516
|
-
// if (this._isLoadingTexture) return null;
|
|
517
|
-
// const ext = this.parser.json.textures[textureIndex]?.extensions?.[EXTENSION_NAME] as NEEDLE_ext_progressive_texture;
|
|
518
|
-
// if (!ext) return null;
|
|
519
|
-
// this._isLoadingTexture = true;
|
|
520
|
-
// return this.parser.getDependency("texture", textureIndex).then(tex => {
|
|
521
|
-
// this._isLoadingTexture = false;
|
|
522
|
-
// if (tex) {
|
|
523
|
-
// NEEDLE_progressive.registerTexture(this.url, tex as Texture, ext.lods?.length, textureIndex, ext);
|
|
524
|
-
// }
|
|
525
|
-
// return tex;
|
|
526
|
-
// });
|
|
527
|
-
// }
|
|
528
|
-
afterRoot(e) {
|
|
529
|
-
var t, s;
|
|
530
|
-
return x && console.log("AFTER", this.url, e), (t = this.parser.json.textures) == null || t.forEach((n, r) => {
|
|
531
|
-
var i;
|
|
532
|
-
if (n != null && n.extensions) {
|
|
533
|
-
const a = n == null ? void 0 : n.extensions[X];
|
|
534
|
-
if (a) {
|
|
535
|
-
if (!a.lods) {
|
|
536
|
-
x && console.warn("Texture has no LODs", a);
|
|
537
|
-
return;
|
|
538
|
-
}
|
|
539
|
-
let l = !1;
|
|
540
|
-
for (const d of this.parser.associations.keys())
|
|
541
|
-
if (d.isTexture === !0) {
|
|
542
|
-
const f = this.parser.associations.get(d);
|
|
543
|
-
(f == null ? void 0 : f.textures) === r && (l = !0, _.registerTexture(this.url, d, (i = a.lods) == null ? void 0 : i.length, r, a));
|
|
544
|
-
}
|
|
545
|
-
l || this.parser.getDependency("texture", r).then((d) => {
|
|
546
|
-
var f;
|
|
547
|
-
d && _.registerTexture(this.url, d, (f = a.lods) == null ? void 0 : f.length, r, a);
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}), (s = this.parser.json.meshes) == null || s.forEach((n, r) => {
|
|
552
|
-
if (n != null && n.extensions) {
|
|
553
|
-
const i = n == null ? void 0 : n.extensions[X];
|
|
554
|
-
if (i && i.lods) {
|
|
555
|
-
for (const a of this.parser.associations.keys())
|
|
556
|
-
if (a.isMesh) {
|
|
557
|
-
const l = this.parser.associations.get(a);
|
|
558
|
-
(l == null ? void 0 : l.meshes) === r && _.registerMesh(this.url, i.guid, a, i.lods.length, l.primitives, i);
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
}), null;
|
|
563
|
-
}
|
|
564
|
-
static async getOrLoadLOD(e, t) {
|
|
565
|
-
var l, d, f, m;
|
|
566
|
-
const s = x == "verbose", n = this.getAssignedLODInformation(e);
|
|
567
|
-
if (!n)
|
|
568
|
-
return x && console.warn(`[gltf-progressive] No LOD information found: ${e.name}, uuid: ${e.uuid}, type: ${e.type}`, e), null;
|
|
569
|
-
const r = n == null ? void 0 : n.key;
|
|
570
|
-
let i;
|
|
571
|
-
if (e.isTexture === !0) {
|
|
572
|
-
const M = e;
|
|
573
|
-
M.source && M.source[Te] && (i = M.source[Te]);
|
|
574
|
-
}
|
|
575
|
-
if (i || (i = _.lodInfos.get(r)), i) {
|
|
576
|
-
if (t > 0) {
|
|
577
|
-
let T = !1;
|
|
578
|
-
const b = Array.isArray(i.lods);
|
|
579
|
-
if (b && t >= i.lods.length ? T = !0 : b || (T = !0), T)
|
|
580
|
-
return this.lowresCache.get(r);
|
|
581
|
-
}
|
|
582
|
-
const M = Array.isArray(i.lods) ? (l = i.lods[t]) == null ? void 0 : l.path : i.lods;
|
|
583
|
-
if (!M)
|
|
584
|
-
return x && !i["missing:uri"] && (i["missing:uri"] = !0, console.warn("Missing uri for progressive asset for LOD " + t, i)), null;
|
|
585
|
-
const w = Dt(n.url, M);
|
|
586
|
-
if (w.endsWith(".glb") || w.endsWith(".gltf")) {
|
|
587
|
-
if (!i.guid)
|
|
588
|
-
return console.warn("missing pointer for glb/gltf texture", i), null;
|
|
589
|
-
const T = w + "_" + i.guid, b = await this.queue.slot(w), I = this.previouslyLoaded.get(T);
|
|
590
|
-
if (I !== void 0) {
|
|
591
|
-
s && console.log(`LOD ${t} was already loading/loaded: ${T}`);
|
|
592
|
-
let h = await I.catch((A) => (console.error(`Error loading LOD ${t} from ${w}
|
|
593
|
-
`, A), null)), L = !1;
|
|
594
|
-
if (h == null || (h instanceof te && e instanceof te ? (d = h.image) != null && d.data || (f = h.source) != null && f.data ? h = this.copySettings(e, h) : (L = !0, this.previouslyLoaded.delete(T)) : h instanceof fe && e instanceof fe && ((m = h.attributes.position) != null && m.array || (L = !0, this.previouslyLoaded.delete(T)))), !L)
|
|
595
|
-
return h;
|
|
596
|
-
}
|
|
597
|
-
if (!b.use)
|
|
598
|
-
return x && console.log(`LOD ${t} was aborted: ${w}`), null;
|
|
599
|
-
const S = i, c = new Promise(async (h, L) => {
|
|
600
|
-
if (kt) {
|
|
601
|
-
const p = await (await At({})).load(w);
|
|
602
|
-
if (p.textures.length > 0)
|
|
603
|
-
for (const g of p.textures) {
|
|
604
|
-
let y = g.texture;
|
|
605
|
-
return _.assignLODInformation(n.url, y, r, t, void 0), e instanceof te && (y = this.copySettings(e, y)), y && (y.guid = S.guid), h(y);
|
|
606
|
-
}
|
|
607
|
-
if (p.geometries.length > 0) {
|
|
608
|
-
const g = new Array();
|
|
609
|
-
for (const y of p.geometries) {
|
|
610
|
-
const k = y.geometry;
|
|
611
|
-
_.assignLODInformation(n.url, k, r, t, y.primitiveIndex), g.push(k);
|
|
612
|
-
}
|
|
613
|
-
return h(g);
|
|
614
|
-
}
|
|
615
|
-
return h(null);
|
|
616
|
-
}
|
|
617
|
-
const A = new $e();
|
|
618
|
-
Ye(A), x && (await new Promise((P) => setTimeout(P, 1e3)), s && console.warn("Start loading (delayed) " + w, S.guid));
|
|
619
|
-
let F = w;
|
|
620
|
-
if (S && Array.isArray(S.lods)) {
|
|
621
|
-
const P = S.lods[t];
|
|
622
|
-
P.hash && (F += "?v=" + P.hash);
|
|
623
|
-
}
|
|
624
|
-
const C = await A.loadAsync(F).catch((P) => (console.error(`Error loading LOD ${t} from ${w}
|
|
625
|
-
`, P), h(null)));
|
|
626
|
-
if (!C)
|
|
627
|
-
return h(null);
|
|
628
|
-
const ee = C.parser;
|
|
629
|
-
s && console.log("Loading finished " + w, S.guid);
|
|
630
|
-
let $ = 0;
|
|
631
|
-
if (C.parser.json.textures) {
|
|
632
|
-
let P = !1;
|
|
633
|
-
for (const p of C.parser.json.textures) {
|
|
634
|
-
if (p != null && p.extensions) {
|
|
635
|
-
const g = p == null ? void 0 : p.extensions[X];
|
|
636
|
-
if (g != null && g.guid && g.guid === S.guid) {
|
|
637
|
-
P = !0;
|
|
638
|
-
break;
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
$++;
|
|
642
|
-
}
|
|
643
|
-
if (P) {
|
|
644
|
-
let p = await ee.getDependency("texture", $);
|
|
645
|
-
return p && _.assignLODInformation(n.url, p, r, t, void 0), s && console.log('change "' + e.name + '" → "' + p.name + '"', w, $, p, T), e instanceof te && (p = this.copySettings(e, p)), p && (p.guid = S.guid), h(p);
|
|
646
|
-
} else x && console.warn("Could not find texture with guid", S.guid, C.parser.json);
|
|
647
|
-
}
|
|
648
|
-
if ($ = 0, C.parser.json.meshes) {
|
|
649
|
-
let P = !1;
|
|
650
|
-
for (const p of C.parser.json.meshes) {
|
|
651
|
-
if (p != null && p.extensions) {
|
|
652
|
-
const g = p == null ? void 0 : p.extensions[X];
|
|
653
|
-
if (g != null && g.guid && g.guid === S.guid) {
|
|
654
|
-
P = !0;
|
|
655
|
-
break;
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
$++;
|
|
659
|
-
}
|
|
660
|
-
if (P) {
|
|
661
|
-
const p = await ee.getDependency("mesh", $);
|
|
662
|
-
if (s && console.log(`Loaded Mesh "${p.name}"`, w, $, p, T), p.isMesh === !0) {
|
|
663
|
-
const g = p.geometry;
|
|
664
|
-
return _.assignLODInformation(n.url, g, r, t, 0), h(g);
|
|
665
|
-
} else {
|
|
666
|
-
const g = new Array();
|
|
667
|
-
for (let y = 0; y < p.children.length; y++) {
|
|
668
|
-
const k = p.children[y];
|
|
669
|
-
if (k.isMesh === !0) {
|
|
670
|
-
const B = k.geometry;
|
|
671
|
-
_.assignLODInformation(n.url, B, r, t, y), g.push(B);
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
return h(g);
|
|
675
|
-
}
|
|
676
|
-
} else x && console.warn("Could not find mesh with guid", S.guid, C.parser.json);
|
|
677
|
-
}
|
|
678
|
-
return h(null);
|
|
679
|
-
});
|
|
680
|
-
return this.previouslyLoaded.set(T, c), b.use(c), await c;
|
|
681
|
-
} else if (e instanceof te) {
|
|
682
|
-
s && console.log("Load texture from uri: " + w);
|
|
683
|
-
const b = await new dt().loadAsync(w);
|
|
684
|
-
return b ? (b.guid = i.guid, b.flipY = !1, b.needsUpdate = !0, b.colorSpace = e.colorSpace, s && console.log(i, b)) : x && console.warn("failed loading", w), b;
|
|
685
|
-
}
|
|
686
|
-
} else
|
|
687
|
-
x && console.warn(`Can not load LOD ${t}: no LOD info found for "${r}" ${e.name}`, e.type);
|
|
688
|
-
return null;
|
|
689
|
-
}
|
|
690
|
-
static assignLODInformation(e, t, s, n, r) {
|
|
691
|
-
if (!t)
|
|
692
|
-
return;
|
|
693
|
-
t.userData || (t.userData = {});
|
|
694
|
-
const i = new Bt(e, s, n, r);
|
|
695
|
-
t.userData.LODS = i, "source" in t && typeof t.source == "object" && (t.source.LODS = i);
|
|
696
|
-
}
|
|
697
|
-
static getAssignedLODInformation(e) {
|
|
698
|
-
var t, s;
|
|
699
|
-
return e ? (t = e.userData) != null && t.LODS ? e.userData.LODS : "source" in e && ((s = e.source) != null && s.LODS) ? e.source.LODS : null : null;
|
|
700
|
-
}
|
|
701
|
-
// private static readonly _copiedTextures: WeakMap<Texture, Texture> = new Map();
|
|
702
|
-
static copySettings(e, t) {
|
|
703
|
-
return t ? (x === "verbose" && console.debug(`Copy texture settings
|
|
704
|
-
`, e.uuid, `
|
|
705
|
-
`, t.uuid), t = t.clone(), t.offset = e.offset, t.repeat = e.repeat, t.colorSpace = e.colorSpace, t.magFilter = e.magFilter, t.minFilter = e.minFilter, t.wrapS = e.wrapS, t.wrapT = e.wrapT, t.flipY = e.flipY, t.anisotropy = e.anisotropy, t.mipmaps || (t.generateMipmaps = e.generateMipmaps), t) : e;
|
|
706
|
-
}
|
|
707
|
-
};
|
|
708
|
-
/**
|
|
709
|
-
* Register a texture with LOD information
|
|
710
|
-
*/
|
|
711
|
-
u(_, "registerTexture", (e, t, s, n, r) => {
|
|
712
|
-
var a, l, d, f, m, M, w, T;
|
|
713
|
-
if (!t) {
|
|
714
|
-
x && console.error("gltf-progressive: Called register texture without texture");
|
|
715
|
-
return;
|
|
716
|
-
}
|
|
717
|
-
if (x) {
|
|
718
|
-
const b = ((a = t.image) == null ? void 0 : a.width) || ((d = (l = t.source) == null ? void 0 : l.data) == null ? void 0 : d.width) || 0, I = ((f = t.image) == null ? void 0 : f.height) || ((M = (m = t.source) == null ? void 0 : m.data) == null ? void 0 : M.height) || 0;
|
|
719
|
-
console.log(`> Progressive: register texture[${n}] "${t.name || t.uuid}", Current: ${b}x${I}, Max: ${(w = r.lods[0]) == null ? void 0 : w.width}x${(T = r.lods[0]) == null ? void 0 : T.height}, uuid: ${t.uuid}`, r, t);
|
|
720
|
-
}
|
|
721
|
-
t.source && (t.source[Te] = r);
|
|
722
|
-
const i = r.guid;
|
|
723
|
-
_.assignLODInformation(e, t, i, s, n), _.lodInfos.set(i, r), _.lowresCache.set(i, t);
|
|
724
|
-
}), /**
|
|
725
|
-
* Register a mesh with LOD information
|
|
726
|
-
*/
|
|
727
|
-
u(_, "registerMesh", (e, t, s, n, r, i) => {
|
|
728
|
-
var d;
|
|
729
|
-
const a = s.geometry;
|
|
730
|
-
if (!a) {
|
|
731
|
-
x && console.warn("gltf-progressive: Register mesh without geometry");
|
|
732
|
-
return;
|
|
733
|
-
}
|
|
734
|
-
a.userData || (a.userData = {}), x && console.log("> Progressive: register mesh " + s.name, { index: r, uuid: s.uuid }, i, s), _.assignLODInformation(e, a, t, n, r), _.lodInfos.set(t, i);
|
|
735
|
-
let l = _.lowresCache.get(t);
|
|
736
|
-
l ? l.push(s.geometry) : l = [s.geometry], _.lowresCache.set(t, l), n > 0 && !he(s) && Ot(s, a);
|
|
737
|
-
for (const f of J)
|
|
738
|
-
(d = f.onRegisteredNewMesh) == null || d.call(f, s, i);
|
|
739
|
-
}), /** A map of key = asset uuid and value = LOD information */
|
|
740
|
-
u(_, "lodInfos", /* @__PURE__ */ new Map()), /** cache of already loaded mesh lods */
|
|
741
|
-
u(_, "previouslyLoaded", /* @__PURE__ */ new Map()), /** this contains the geometry/textures that were originally loaded */
|
|
742
|
-
u(_, "lowresCache", /* @__PURE__ */ new Map()), u(_, "workers", []), u(_, "_workersIndex", 0), u(_, "maxConcurrent", 50), u(_, "queue", new Mt(_.maxConcurrent, { debug: x != !1 }));
|
|
743
|
-
let K = _;
|
|
744
|
-
class Bt {
|
|
745
|
-
constructor(e, t, s, n) {
|
|
746
|
-
u(this, "url");
|
|
747
|
-
/** the key to lookup the LOD information */
|
|
748
|
-
u(this, "key");
|
|
749
|
-
u(this, "level");
|
|
750
|
-
/** For multi objects (e.g. a group of meshes) this is the index of the object */
|
|
751
|
-
u(this, "index");
|
|
752
|
-
this.url = e, this.key = t, this.level = s, n != null && (this.index = n);
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
class we {
|
|
756
|
-
constructor(e, t) {
|
|
757
|
-
u(this, "frame_start");
|
|
758
|
-
u(this, "frame_capture_end");
|
|
759
|
-
u(this, "ready");
|
|
760
|
-
u(this, "_resolve");
|
|
761
|
-
u(this, "_signal");
|
|
762
|
-
u(this, "_resolved", !1);
|
|
763
|
-
u(this, "_addedCount", 0);
|
|
764
|
-
u(this, "_resolvedCount", 0);
|
|
765
|
-
/** These promises are currently being awaited */
|
|
766
|
-
u(this, "_awaiting", []);
|
|
767
|
-
u(this, "_maxPromisesPerObject", 1);
|
|
768
|
-
u(this, "_currentFrame", 0);
|
|
769
|
-
u(this, "_seen", /* @__PURE__ */ new WeakMap());
|
|
770
|
-
var r;
|
|
771
|
-
const n = Math.max(t.frames ?? 2, 2);
|
|
772
|
-
this.frame_start = e, this.frame_capture_end = e + n, this.ready = new Promise((i) => {
|
|
773
|
-
this._resolve = i;
|
|
774
|
-
}), this.ready.finally(() => {
|
|
775
|
-
this._resolved = !0, this._awaiting.length = 0;
|
|
776
|
-
}), this._signal = t.signal, (r = this._signal) == null || r.addEventListener("abort", () => {
|
|
777
|
-
this.resolveNow();
|
|
778
|
-
}), this._maxPromisesPerObject = Math.max(1, t.maxPromisesPerObject ?? 1);
|
|
779
|
-
}
|
|
780
|
-
/**
|
|
781
|
-
* The number of promises that have been added to this group so far.
|
|
782
|
-
*/
|
|
783
|
-
get awaitedCount() {
|
|
784
|
-
return this._addedCount;
|
|
785
|
-
}
|
|
786
|
-
get resolvedCount() {
|
|
787
|
-
return this._resolvedCount;
|
|
788
|
-
}
|
|
789
|
-
get currentlyAwaiting() {
|
|
790
|
-
return this._awaiting.length;
|
|
791
|
-
}
|
|
792
|
-
update(e) {
|
|
793
|
-
var t;
|
|
794
|
-
this._currentFrame = e, ((t = this._signal) != null && t.aborted || this._currentFrame > this.frame_capture_end && this._awaiting.length === 0) && this.resolveNow();
|
|
795
|
-
}
|
|
796
|
-
add(e, t, s) {
|
|
797
|
-
if (this._resolved) {
|
|
798
|
-
x && console.warn("PromiseGroup: Trying to add a promise to a resolved group, ignoring.");
|
|
799
|
-
return;
|
|
800
|
-
}
|
|
801
|
-
if (!(this._currentFrame > this.frame_capture_end)) {
|
|
802
|
-
if (this._maxPromisesPerObject >= 1)
|
|
803
|
-
if (this._seen.has(t)) {
|
|
804
|
-
let n = this._seen.get(t);
|
|
805
|
-
if (n >= this._maxPromisesPerObject) {
|
|
806
|
-
x && console.warn("PromiseGroup: Already awaiting object ignoring new promise for it.");
|
|
807
|
-
return;
|
|
808
|
-
}
|
|
809
|
-
this._seen.set(t, n + 1);
|
|
810
|
-
} else
|
|
811
|
-
this._seen.set(t, 1);
|
|
812
|
-
this._awaiting.push(s), this._addedCount++, s.finally(() => {
|
|
813
|
-
this._resolvedCount++, this._awaiting.splice(this._awaiting.indexOf(s), 1);
|
|
814
|
-
});
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
resolveNow() {
|
|
818
|
-
var e, t;
|
|
819
|
-
this._resolved || (t = this._resolve) == null || t.call(this, {
|
|
820
|
-
awaited_count: this._addedCount,
|
|
821
|
-
resolved_count: this._resolvedCount,
|
|
822
|
-
cancelled: ((e = this._signal) == null ? void 0 : e.aborted) ?? !1
|
|
823
|
-
});
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
u(we, "addPromise", (e, t, s, n) => {
|
|
827
|
-
n.forEach((r) => {
|
|
828
|
-
r.add(e, t, s);
|
|
829
|
-
});
|
|
830
|
-
});
|
|
831
|
-
const U = ie("debugprogressive"), $t = ie("noprogressive"), Pe = Symbol("Needle:LODSManager"), Ae = Symbol("Needle:LODState"), Q = Symbol("Needle:CurrentLOD"), R = { mesh_lod: -1, texture_lod: -1 };
|
|
832
|
-
var D, E, Y, De, Z, oe, Me, H;
|
|
833
|
-
let _e = (D = class {
|
|
834
|
-
// readonly plugins: NEEDLE_progressive_plugin[] = [];
|
|
835
|
-
constructor(e, t) {
|
|
836
|
-
u(this, "renderer");
|
|
837
|
-
u(this, "context");
|
|
838
|
-
u(this, "projectionScreenMatrix", new Ne());
|
|
839
|
-
/**
|
|
840
|
-
* The target triangle density is the desired max amount of triangles on screen when the mesh is filling the screen.
|
|
841
|
-
* @default 200_000
|
|
842
|
-
*/
|
|
843
|
-
u(this, "targetTriangleDensity", 2e5);
|
|
844
|
-
/**
|
|
845
|
-
* The interval in frames to automatically update the bounds of skinned meshes.
|
|
846
|
-
* Set to 0 or a negative value to disable automatic bounds updates.
|
|
847
|
-
* @default 30
|
|
848
|
-
*/
|
|
849
|
-
u(this, "skinnedMeshAutoUpdateBoundsInterval", 30);
|
|
850
|
-
/**
|
|
851
|
-
* The update interval in frames. If set to 0, the LODs will be updated every frame. If set to 2, the LODs will be updated every second frame, etc.
|
|
852
|
-
* @default "auto"
|
|
853
|
-
*/
|
|
854
|
-
u(this, "updateInterval", "auto");
|
|
855
|
-
j(this, E, 1);
|
|
856
|
-
/**
|
|
857
|
-
* If set to true, the LODsManager will not update the LODs.
|
|
858
|
-
* @default false
|
|
859
|
-
*/
|
|
860
|
-
u(this, "pause", !1);
|
|
861
|
-
/**
|
|
862
|
-
* When set to true the LODsManager will not update the LODs. This can be used to manually update the LODs using the `update` method.
|
|
863
|
-
* Otherwise the LODs will be updated automatically when the renderer renders the scene.
|
|
864
|
-
* @default false
|
|
865
|
-
*/
|
|
866
|
-
u(this, "manual", !1);
|
|
867
|
-
u(this, "_newPromiseGroups", []);
|
|
868
|
-
u(this, "_promiseGroupIds", 0);
|
|
869
|
-
u(this, "_lodchangedlisteners", []);
|
|
870
|
-
j(this, Y);
|
|
871
|
-
j(this, De, new ct());
|
|
872
|
-
j(this, Z, 0);
|
|
873
|
-
j(this, oe, 0);
|
|
874
|
-
j(this, Me, 0);
|
|
875
|
-
j(this, H, 0);
|
|
876
|
-
u(this, "_fpsBuffer", [60, 60, 60, 60, 60]);
|
|
877
|
-
// private testIfLODLevelsAreAvailable() {
|
|
878
|
-
u(this, "_sphere", new Ve());
|
|
879
|
-
u(this, "_tempBox", new Ce());
|
|
880
|
-
u(this, "_tempBox2", new Ce());
|
|
881
|
-
u(this, "tempMatrix", new Ne());
|
|
882
|
-
u(this, "_tempWorldPosition", new N());
|
|
883
|
-
u(this, "_tempBoxSize", new N());
|
|
884
|
-
u(this, "_tempBox2Size", new N());
|
|
885
|
-
this.renderer = e, this.context = { ...t };
|
|
886
|
-
}
|
|
887
|
-
/** @internal */
|
|
888
|
-
static getObjectLODState(e) {
|
|
889
|
-
return e[Ae];
|
|
890
|
-
}
|
|
891
|
-
static addPlugin(e) {
|
|
892
|
-
J.push(e);
|
|
893
|
-
}
|
|
894
|
-
static removePlugin(e) {
|
|
895
|
-
const t = J.indexOf(e);
|
|
896
|
-
t >= 0 && J.splice(t, 1);
|
|
897
|
-
}
|
|
898
|
-
/**
|
|
899
|
-
* Gets the LODsManager for the given renderer. If the LODsManager does not exist yet, it will be created.
|
|
900
|
-
* @param renderer The renderer to get the LODsManager for.
|
|
901
|
-
* @returns The LODsManager instance.
|
|
902
|
-
*/
|
|
903
|
-
static get(e, t) {
|
|
904
|
-
if (e[Pe])
|
|
905
|
-
return console.debug("[gltf-progressive] LODsManager already exists for this renderer"), e[Pe];
|
|
906
|
-
const s = new D(e, {
|
|
907
|
-
engine: "unknown",
|
|
908
|
-
...t
|
|
909
|
-
});
|
|
910
|
-
return e[Pe] = s, s;
|
|
911
|
-
}
|
|
912
|
-
/** @deprecated use static `LODsManager.addPlugin()` method. This getter will be removed in later versions */
|
|
913
|
-
get plugins() {
|
|
914
|
-
return J;
|
|
915
|
-
}
|
|
916
|
-
/**
|
|
917
|
-
* Call to await LODs loading during the next render cycle.
|
|
918
|
-
*/
|
|
919
|
-
awaitLoading(e) {
|
|
920
|
-
const t = this._promiseGroupIds++, s = new we(v(this, Z), { ...e });
|
|
921
|
-
this._newPromiseGroups.push(s);
|
|
922
|
-
const n = performance.now();
|
|
923
|
-
return s.ready.finally(() => {
|
|
924
|
-
const r = this._newPromiseGroups.indexOf(s);
|
|
925
|
-
r >= 0 && (this._newPromiseGroups.splice(r, 1), Ue() && performance.measure("LODsManager:awaitLoading", {
|
|
926
|
-
start: n,
|
|
927
|
-
detail: { id: t, name: e == null ? void 0 : e.name, awaited: s.awaitedCount, resolved: s.resolvedCount }
|
|
928
|
-
}));
|
|
929
|
-
}), s.ready;
|
|
930
|
-
}
|
|
931
|
-
_postprocessPromiseGroups() {
|
|
932
|
-
if (this._newPromiseGroups.length !== 0)
|
|
933
|
-
for (let e = this._newPromiseGroups.length - 1; e >= 0; e--)
|
|
934
|
-
this._newPromiseGroups[e].update(v(this, Z));
|
|
935
|
-
}
|
|
936
|
-
addEventListener(e, t) {
|
|
937
|
-
e === "changed" && this._lodchangedlisteners.push(t);
|
|
938
|
-
}
|
|
939
|
-
removeEventListener(e, t) {
|
|
940
|
-
if (e === "changed") {
|
|
941
|
-
const s = this._lodchangedlisteners.indexOf(t);
|
|
942
|
-
s >= 0 && this._lodchangedlisteners.splice(s, 1);
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
/**
|
|
946
|
-
* Enable the LODsManager. This will replace the render method of the renderer with a method that updates the LODs.
|
|
947
|
-
*/
|
|
948
|
-
enable() {
|
|
949
|
-
if (v(this, Y))
|
|
950
|
-
return;
|
|
951
|
-
console.debug("[gltf-progressive] Enabling LODsManager for renderer");
|
|
952
|
-
let e = 0;
|
|
953
|
-
V(this, Y, this.renderer.render);
|
|
954
|
-
const t = this;
|
|
955
|
-
Re(this.renderer), this.renderer.render = function(s, n) {
|
|
956
|
-
const r = t.renderer.getRenderTarget();
|
|
957
|
-
(r == null || "isXRRenderTarget" in r && r.isXRRenderTarget) && (e = 0, V(t, Z, v(t, Z) + 1), V(t, oe, v(t, De).getDelta()), V(t, Me, v(t, Me) + v(t, oe)), t._fpsBuffer.shift(), t._fpsBuffer.push(1 / v(t, oe)), V(t, H, t._fpsBuffer.reduce((a, l) => a + l) / t._fpsBuffer.length), U && v(t, Z) % 200 === 0 && console.log("FPS", Math.round(v(t, H)), "Interval:", v(t, E)));
|
|
958
|
-
const i = e++;
|
|
959
|
-
v(t, Y).call(this, s, n), t.onAfterRender(s, n, i);
|
|
960
|
-
};
|
|
961
|
-
}
|
|
962
|
-
disable() {
|
|
963
|
-
v(this, Y) && (console.debug("[gltf-progressive] Disabling LODsManager for renderer"), this.renderer.render = v(this, Y), V(this, Y, void 0));
|
|
964
|
-
}
|
|
965
|
-
update(e, t) {
|
|
966
|
-
this.internalUpdate(e, t);
|
|
967
|
-
}
|
|
968
|
-
onAfterRender(e, t, s) {
|
|
969
|
-
if (this.pause)
|
|
970
|
-
return;
|
|
971
|
-
const r = this.renderer.renderLists.get(e, 0).opaque;
|
|
972
|
-
let i = !0;
|
|
973
|
-
if (r.length === 1) {
|
|
974
|
-
const a = r[0].material;
|
|
975
|
-
(a.name === "EffectMaterial" || a.name === "CopyShader") && (i = !1);
|
|
976
|
-
}
|
|
977
|
-
if ((t.parent && t.parent.type === "CubeCamera" || s >= 1 && t.type === "OrthographicCamera") && (i = !1), i) {
|
|
978
|
-
if ($t || (this.updateInterval === "auto" ? v(this, H) < 40 && v(this, E) < 10 ? (V(this, E, v(this, E) + 1), U && console.warn("↓ Reducing LOD updates", v(this, E), v(this, H).toFixed(0))) : v(this, H) >= 60 && v(this, E) > 1 && (V(this, E, v(this, E) - 1), U && console.warn("↑ Increasing LOD updates", v(this, E), v(this, H).toFixed(0))) : V(this, E, this.updateInterval), v(this, E) > 0 && v(this, Z) % v(this, E) != 0))
|
|
979
|
-
return;
|
|
980
|
-
this.internalUpdate(e, t), this._postprocessPromiseGroups();
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
/**
|
|
984
|
-
* Update LODs in a scene
|
|
985
|
-
*/
|
|
986
|
-
internalUpdate(e, t) {
|
|
987
|
-
var l, d;
|
|
988
|
-
const s = this.renderer.renderLists.get(e, 0), n = s.opaque;
|
|
989
|
-
this.projectionScreenMatrix.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse);
|
|
990
|
-
const r = this.targetTriangleDensity;
|
|
991
|
-
for (const f of n) {
|
|
992
|
-
if (f.material && (((l = f.geometry) == null ? void 0 : l.type) === "BoxGeometry" || ((d = f.geometry) == null ? void 0 : d.type) === "BufferGeometry") && (f.material.name === "SphericalGaussianBlur" || f.material.name == "BackgroundCubeMaterial" || f.material.name === "CubemapFromEquirect" || f.material.name === "EquirectangularToCubeUV")) {
|
|
993
|
-
U && (f.material["NEEDLE_PROGRESSIVE:IGNORE-WARNING"] || (f.material["NEEDLE_PROGRESSIVE:IGNORE-WARNING"] = !0, console.warn("Ignoring skybox or BLIT object", f, f.material.name, f.material.type)));
|
|
994
|
-
continue;
|
|
995
|
-
}
|
|
996
|
-
switch (f.material.type) {
|
|
997
|
-
case "LineBasicMaterial":
|
|
998
|
-
case "LineDashedMaterial":
|
|
999
|
-
case "PointsMaterial":
|
|
1000
|
-
case "ShadowMaterial":
|
|
1001
|
-
case "MeshDistanceMaterial":
|
|
1002
|
-
case "MeshDepthMaterial":
|
|
1003
|
-
continue;
|
|
1004
|
-
}
|
|
1005
|
-
if (U === "color" && f.material && !f.object.progressive_debug_color) {
|
|
1006
|
-
f.object.progressive_debug_color = !0;
|
|
1007
|
-
const M = Math.random() * 16777215, w = new ft({ color: M });
|
|
1008
|
-
f.object.material = w;
|
|
1009
|
-
}
|
|
1010
|
-
const m = f.object;
|
|
1011
|
-
(m instanceof re || m.isMesh) && this.updateLODs(e, t, m, r);
|
|
1012
|
-
}
|
|
1013
|
-
const i = s.transparent;
|
|
1014
|
-
for (const f of i) {
|
|
1015
|
-
const m = f.object;
|
|
1016
|
-
(m instanceof re || m.isMesh) && this.updateLODs(e, t, m, r);
|
|
1017
|
-
}
|
|
1018
|
-
const a = s.transmissive;
|
|
1019
|
-
for (const f of a) {
|
|
1020
|
-
const m = f.object;
|
|
1021
|
-
(m instanceof re || m.isMesh) && this.updateLODs(e, t, m, r);
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
/** Update the LOD levels for the renderer. */
|
|
1025
|
-
updateLODs(e, t, s, n) {
|
|
1026
|
-
var a, l;
|
|
1027
|
-
s.userData || (s.userData = {});
|
|
1028
|
-
let r = s[Ae];
|
|
1029
|
-
if (r || (r = new Rt(), s[Ae] = r), r.frames++ < 2)
|
|
1030
|
-
return;
|
|
1031
|
-
for (const d of J)
|
|
1032
|
-
(a = d.onBeforeUpdateLOD) == null || a.call(d, this.renderer, e, t, s);
|
|
1033
|
-
const i = D.overrideGlobalLodLevel !== void 0 ? D.overrideGlobalLodLevel : se;
|
|
1034
|
-
i >= 0 ? (R.mesh_lod = i, R.texture_lod = i) : (this.calculateLodLevel(t, s, r, n, 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, i), x && s.material && !s.isGizmo && Je(s.material);
|
|
1035
|
-
for (const d of J)
|
|
1036
|
-
(l = d.onAfterUpdatedLOD) == null || l.call(d, this.renderer, e, t, s, R);
|
|
1037
|
-
r.lastLodLevel_Mesh = R.mesh_lod, r.lastLodLevel_Texture = R.texture_lod;
|
|
1038
|
-
}
|
|
1039
|
-
/** Load progressive textures for the given material
|
|
1040
|
-
* @param material the material to load the textures for
|
|
1041
|
-
* @param level the LOD level to load. Level 0 is the best quality, higher levels are lower quality
|
|
1042
|
-
* @returns Promise with true if the LOD was loaded, false if not
|
|
1043
|
-
*/
|
|
1044
|
-
loadProgressiveTextures(e, t, s) {
|
|
1045
|
-
if (!e)
|
|
1046
|
-
return;
|
|
1047
|
-
if (Array.isArray(e)) {
|
|
1048
|
-
for (const r of e)
|
|
1049
|
-
this.loadProgressiveTextures(r, t);
|
|
1050
|
-
return;
|
|
1051
|
-
}
|
|
1052
|
-
let n = !1;
|
|
1053
|
-
if ((e[Q] === void 0 || t < e[Q]) && (n = !0), s !== void 0 && s >= 0 && (n = e[Q] != s, t = s), n) {
|
|
1054
|
-
e[Q] = t;
|
|
1055
|
-
const r = K.assignTextureLOD(e, t).then((i) => {
|
|
1056
|
-
this._lodchangedlisteners.forEach((a) => a({ type: "texture", level: t, object: e }));
|
|
1057
|
-
});
|
|
1058
|
-
we.addPromise("texture", e, r, this._newPromiseGroups);
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
/** Load progressive meshes for the given mesh
|
|
1062
|
-
* @param mesh the mesh to load the LOD for
|
|
1063
|
-
* @param index the index of the mesh if it's part of a group
|
|
1064
|
-
* @param level the LOD level to load. Level 0 is the best quality, higher levels are lower quality
|
|
1065
|
-
* @returns Promise with true if the LOD was loaded, false if not
|
|
1066
|
-
*/
|
|
1067
|
-
loadProgressiveMeshes(e, t) {
|
|
1068
|
-
if (!e)
|
|
1069
|
-
return Promise.resolve(null);
|
|
1070
|
-
let s = e[Q] !== t;
|
|
1071
|
-
const n = e["DEBUG:LOD"];
|
|
1072
|
-
if (n != null && (s = e[Q] != n, t = n), s) {
|
|
1073
|
-
e[Q] = t;
|
|
1074
|
-
const r = e.geometry, i = K.assignMeshLOD(e, t).then((a) => (a && e[Q] == t && r != e.geometry && this._lodchangedlisteners.forEach((l) => l({ type: "mesh", level: t, object: e })), a));
|
|
1075
|
-
return we.addPromise("mesh", e, i, this._newPromiseGroups), i;
|
|
1076
|
-
}
|
|
1077
|
-
return Promise.resolve(null);
|
|
1078
|
-
}
|
|
1079
|
-
static isInside(e, t) {
|
|
1080
|
-
const s = e.min, n = e.max, r = (s.x + n.x) * 0.5, i = (s.y + n.y) * 0.5;
|
|
1081
|
-
return this._tempPtInside.set(r, i, s.z).applyMatrix4(t).z < 0;
|
|
1082
|
-
}
|
|
1083
|
-
// #region calculateLodLevel
|
|
1084
|
-
calculateLodLevel(e, t, s, n, r) {
|
|
1085
|
-
var I, S, c, O;
|
|
1086
|
-
if (!t) {
|
|
1087
|
-
r.mesh_lod = -1, r.texture_lod = -1;
|
|
1088
|
-
return;
|
|
1089
|
-
}
|
|
1090
|
-
if (!e) {
|
|
1091
|
-
r.mesh_lod = -1, r.texture_lod = -1;
|
|
1092
|
-
return;
|
|
1093
|
-
}
|
|
1094
|
-
let a = 10 + 1, l = !1;
|
|
1095
|
-
if (U && t["DEBUG:LOD"] != null)
|
|
1096
|
-
return t["DEBUG:LOD"];
|
|
1097
|
-
const d = (I = K.getMeshLODExtension(t.geometry)) == null ? void 0 : I.lods, f = K.getPrimitiveIndex(t.geometry), m = d && d.length > 0, M = K.getMaterialMinMaxLODsCount(t.material), w = M.min_count !== 1 / 0 && M.min_count >= 0 && M.max_count >= 0;
|
|
1098
|
-
if (!m && !w) {
|
|
1099
|
-
r.mesh_lod = 0, r.texture_lod = 0;
|
|
1100
|
-
return;
|
|
1101
|
-
}
|
|
1102
|
-
m || (l = !0, a = 0);
|
|
1103
|
-
const T = this.renderer.domElement.clientHeight || this.renderer.domElement.height;
|
|
1104
|
-
let b = t.geometry.boundingBox;
|
|
1105
|
-
if (t.type === "SkinnedMesh") {
|
|
1106
|
-
const h = t;
|
|
1107
|
-
if (!h.boundingBox)
|
|
1108
|
-
h.computeBoundingBox();
|
|
1109
|
-
else if (this.skinnedMeshAutoUpdateBoundsInterval > 0) {
|
|
1110
|
-
if (!h[D.$skinnedMeshBoundsOffset]) {
|
|
1111
|
-
const A = D.skinnedMeshBoundsFrameOffsetCounter++;
|
|
1112
|
-
h[D.$skinnedMeshBoundsOffset] = A;
|
|
1113
|
-
}
|
|
1114
|
-
const L = h[D.$skinnedMeshBoundsOffset];
|
|
1115
|
-
if ((s.frames + L) % this.skinnedMeshAutoUpdateBoundsInterval === 0) {
|
|
1116
|
-
const A = he(h), F = h.geometry;
|
|
1117
|
-
A && (h.geometry = A), h.computeBoundingBox(), h.geometry = F;
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
|
-
b = h.boundingBox;
|
|
1121
|
-
}
|
|
1122
|
-
if (b) {
|
|
1123
|
-
const h = e;
|
|
1124
|
-
if (t.geometry.attributes.color && t.geometry.attributes.color.count < 100 && t.geometry.boundingSphere) {
|
|
1125
|
-
this._sphere.copy(t.geometry.boundingSphere), this._sphere.applyMatrix4(t.matrixWorld);
|
|
1126
|
-
const g = e.getWorldPosition(this._tempWorldPosition);
|
|
1127
|
-
if (this._sphere.containsPoint(g)) {
|
|
1128
|
-
r.mesh_lod = 0, r.texture_lod = 0;
|
|
1129
|
-
return;
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
if (this._tempBox.copy(b), this._tempBox.applyMatrix4(t.matrixWorld), h.isPerspectiveCamera && D.isInside(this._tempBox, this.projectionScreenMatrix)) {
|
|
1133
|
-
r.mesh_lod = 0, r.texture_lod = 0;
|
|
1134
|
-
return;
|
|
1135
|
-
}
|
|
1136
|
-
if (this._tempBox.applyMatrix4(this.projectionScreenMatrix), this.renderer.xr.enabled && h.isPerspectiveCamera && h.fov > 70) {
|
|
1137
|
-
const g = this._tempBox.min, y = this._tempBox.max;
|
|
1138
|
-
let k = g.x, B = g.y, q = y.x, ae = y.y;
|
|
1139
|
-
const ge = 2, be = 1.5, pe = (g.x + y.x) * 0.5, me = (g.y + y.y) * 0.5;
|
|
1140
|
-
k = (k - pe) * ge + pe, B = (B - me) * ge + me, q = (q - pe) * ge + pe, ae = (ae - me) * ge + me;
|
|
1141
|
-
const tt = k < 0 && q > 0 ? 0 : Math.min(Math.abs(g.x), Math.abs(y.x)), st = B < 0 && ae > 0 ? 0 : Math.min(Math.abs(g.y), Math.abs(y.y)), Oe = Math.max(tt, st);
|
|
1142
|
-
s.lastCentrality = (be - Oe) * (be - Oe) * (be - Oe);
|
|
1143
|
-
} else
|
|
1144
|
-
s.lastCentrality = 1;
|
|
1145
|
-
const L = this._tempBox.getSize(this._tempBoxSize);
|
|
1146
|
-
L.multiplyScalar(0.5), screen.availHeight > 0 && T > 0 && L.multiplyScalar(T / screen.availHeight), e.isPerspectiveCamera ? L.x *= e.aspect : e.isOrthographicCamera;
|
|
1147
|
-
const A = e.matrixWorldInverse, F = this._tempBox2;
|
|
1148
|
-
F.copy(b), F.applyMatrix4(t.matrixWorld), F.applyMatrix4(A);
|
|
1149
|
-
const C = F.getSize(this._tempBox2Size), ee = Math.max(C.x, C.y);
|
|
1150
|
-
if (Math.max(L.x, L.y) != 0 && ee != 0 && (L.z = C.z / Math.max(C.x, C.y) * Math.max(L.x, L.y)), s.lastScreenCoverage = Math.max(L.x, L.y, L.z), s.lastScreenspaceVolume.copy(L), s.lastScreenCoverage *= s.lastCentrality, U && D.debugDrawLine) {
|
|
1151
|
-
const g = this.tempMatrix.copy(this.projectionScreenMatrix);
|
|
1152
|
-
g.invert();
|
|
1153
|
-
const y = D.corner0, k = D.corner1, B = D.corner2, q = D.corner3;
|
|
1154
|
-
y.copy(this._tempBox.min), k.copy(this._tempBox.max), k.x = y.x, B.copy(this._tempBox.max), B.y = y.y, q.copy(this._tempBox.max);
|
|
1155
|
-
const ae = (y.z + q.z) * 0.5;
|
|
1156
|
-
y.z = k.z = B.z = q.z = ae, y.applyMatrix4(g), k.applyMatrix4(g), B.applyMatrix4(g), q.applyMatrix4(g), D.debugDrawLine(y, k, 255), D.debugDrawLine(y, B, 255), D.debugDrawLine(k, q, 255), D.debugDrawLine(B, q, 255);
|
|
1157
|
-
}
|
|
1158
|
-
let P = 999;
|
|
1159
|
-
if (d && s.lastScreenCoverage > 0)
|
|
1160
|
-
for (let g = 0; g < d.length; g++) {
|
|
1161
|
-
const y = d[g], B = (((S = y.densities) == null ? void 0 : S[f]) || y.density || 1e-5) / s.lastScreenCoverage;
|
|
1162
|
-
if (f > 0 && Ue() && !y.densities && !globalThis["NEEDLE:MISSING_LOD_PRIMITIVE_DENSITIES"] && (window["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.")), B < n) {
|
|
1163
|
-
P = g;
|
|
1164
|
-
break;
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
P < a && (a = P, l = !0);
|
|
1168
|
-
}
|
|
1169
|
-
if (l ? r.mesh_lod = a : r.mesh_lod = s.lastLodLevel_Mesh, U && r.mesh_lod != s.lastLodLevel_Mesh) {
|
|
1170
|
-
const L = d == null ? void 0 : d[r.mesh_lod];
|
|
1171
|
-
L && console.debug(`Mesh LOD changed: ${s.lastLodLevel_Mesh} → ${r.mesh_lod} (density: ${(c = L.densities) == null ? void 0 : c[f].toFixed(0)}) | ${t.name}`);
|
|
1172
|
-
}
|
|
1173
|
-
if (w) {
|
|
1174
|
-
const h = "saveData" in globalThis.navigator && globalThis.navigator.saveData === !0;
|
|
1175
|
-
if (s.lastLodLevel_Texture < 0) {
|
|
1176
|
-
if (r.texture_lod = M.max_count - 1, U) {
|
|
1177
|
-
const L = M.lods[M.max_count - 1];
|
|
1178
|
-
U && console.log(`First Texture LOD ${r.texture_lod} (${L.max_height}px) - ${t.name}`);
|
|
1179
|
-
}
|
|
1180
|
-
} else {
|
|
1181
|
-
const L = s.lastScreenspaceVolume.x + s.lastScreenspaceVolume.y + s.lastScreenspaceVolume.z;
|
|
1182
|
-
let A = s.lastScreenCoverage * 4;
|
|
1183
|
-
((O = this.context) == null ? void 0 : O.engine) === "model-viewer" && (A *= 1.5);
|
|
1184
|
-
const C = T / window.devicePixelRatio * A;
|
|
1185
|
-
let ee = !1;
|
|
1186
|
-
for (let $ = M.lods.length - 1; $ >= 0; $--) {
|
|
1187
|
-
const P = M.lods[$];
|
|
1188
|
-
if (!(h && P.max_height >= 2048) && !(Qe() && P.max_height > 4096) && (P.max_height > C || !ee && $ === 0)) {
|
|
1189
|
-
if (ee = !0, r.texture_lod = $, U && r.texture_lod < s.lastLodLevel_Texture) {
|
|
1190
|
-
const p = P.max_height;
|
|
1191
|
-
console.log(`Texture LOD changed: ${s.lastLodLevel_Texture} → ${r.texture_lod} = ${p}px
|
|
1192
|
-
Screensize: ${C.toFixed(0)}px, Coverage: ${(100 * s.lastScreenCoverage).toFixed(2)}%, Volume ${L.toFixed(1)}
|
|
1193
|
-
${t.name}`);
|
|
1194
|
-
}
|
|
1195
|
-
break;
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
} else
|
|
1200
|
-
r.texture_lod = 0;
|
|
1201
|
-
}
|
|
1202
|
-
}, E = new WeakMap(), Y = new WeakMap(), De = new WeakMap(), Z = new WeakMap(), oe = new WeakMap(), Me = new WeakMap(), H = new WeakMap(), /**
|
|
1203
|
-
* Assign a function to draw debug lines for the LODs. This function will be called with the start and end position of the line and the color of the line when the `debugprogressive` query parameter is set.
|
|
1204
|
-
*/
|
|
1205
|
-
u(D, "debugDrawLine"), /**
|
|
1206
|
-
* Force override the LOD level for all objects in the scene
|
|
1207
|
-
*/
|
|
1208
|
-
u(D, "overrideGlobalLodLevel"), u(D, "corner0", new N()), u(D, "corner1", new N()), u(D, "corner2", new N()), u(D, "corner3", new N()), u(D, "_tempPtInside", new N()), u(D, "skinnedMeshBoundsFrameOffsetCounter", 0), u(D, "$skinnedMeshBoundsOffset", Symbol("gltf-progressive-skinnedMeshBoundsOffset")), D);
|
|
1209
|
-
class Rt {
|
|
1210
|
-
constructor() {
|
|
1211
|
-
u(this, "frames", 0);
|
|
1212
|
-
u(this, "lastLodLevel_Mesh", -1);
|
|
1213
|
-
u(this, "lastLodLevel_Texture", -1);
|
|
1214
|
-
u(this, "lastScreenCoverage", 0);
|
|
1215
|
-
u(this, "lastScreenspaceVolume", new N());
|
|
1216
|
-
u(this, "lastCentrality", 0);
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
const We = Symbol("NEEDLE_mesh_lod"), ye = Symbol("NEEDLE_texture_lod");
|
|
1220
|
-
let ce = null;
|
|
1221
|
-
function Ze() {
|
|
1222
|
-
const o = Et();
|
|
1223
|
-
o && (o.mapURLs(function(e) {
|
|
1224
|
-
return ze(), e;
|
|
1225
|
-
}), ze(), ce == null || ce.disconnect(), ce = new MutationObserver((e) => {
|
|
1226
|
-
e.forEach((t) => {
|
|
1227
|
-
t.addedNodes.forEach((s) => {
|
|
1228
|
-
s instanceof HTMLElement && s.tagName.toLowerCase() === "model-viewer" && et(s);
|
|
1229
|
-
});
|
|
1230
|
-
});
|
|
1231
|
-
}), ce.observe(document, { childList: !0, subtree: !0 }));
|
|
1232
|
-
}
|
|
1233
|
-
function Et() {
|
|
1234
|
-
if (typeof customElements > "u")
|
|
1235
|
-
return null;
|
|
1236
|
-
const o = customElements.get("model-viewer");
|
|
1237
|
-
return o || (customElements.whenDefined("model-viewer").then(() => {
|
|
1238
|
-
console.debug("[gltf-progressive] model-viewer defined"), Ze();
|
|
1239
|
-
}), null);
|
|
1240
|
-
}
|
|
1241
|
-
function ze() {
|
|
1242
|
-
if (typeof document > "u")
|
|
1243
|
-
return;
|
|
1244
|
-
document.querySelectorAll("model-viewer").forEach((e) => {
|
|
1245
|
-
et(e);
|
|
1246
|
-
});
|
|
1247
|
-
}
|
|
1248
|
-
const qe = /* @__PURE__ */ new WeakSet();
|
|
1249
|
-
let Gt = 0;
|
|
1250
|
-
function et(o) {
|
|
1251
|
-
if (!o || qe.has(o))
|
|
1252
|
-
return null;
|
|
1253
|
-
qe.add(o), console.debug("[gltf-progressive] found new model-viewer..." + ++Gt + `
|
|
1254
|
-
`, o.getAttribute("src"));
|
|
1255
|
-
let e = null, t = null, s = null;
|
|
1256
|
-
for (let n = o; n != null; n = Object.getPrototypeOf(n)) {
|
|
1257
|
-
const r = Object.getOwnPropertySymbols(n), i = r.find((d) => d.toString() == "Symbol(renderer)"), a = r.find((d) => d.toString() == "Symbol(scene)"), l = r.find((d) => d.toString() == "Symbol(needsRender)");
|
|
1258
|
-
!e && i != null && (e = o[i].threeRenderer), !t && a != null && (t = o[a]), !s && l != null && (s = o[l]);
|
|
1259
|
-
}
|
|
1260
|
-
if (e && t) {
|
|
1261
|
-
let r = function() {
|
|
1262
|
-
if (s) {
|
|
1263
|
-
let i = 0, a = setInterval(() => {
|
|
1264
|
-
if (i++ > 5) {
|
|
1265
|
-
clearInterval(a);
|
|
1266
|
-
return;
|
|
1267
|
-
}
|
|
1268
|
-
s == null || s.call(o);
|
|
1269
|
-
}, 300);
|
|
1270
|
-
}
|
|
1271
|
-
};
|
|
1272
|
-
console.debug("[gltf-progressive] setup model-viewer");
|
|
1273
|
-
const n = _e.get(e, { engine: "model-viewer" });
|
|
1274
|
-
return _e.addPlugin(new Ft()), n.enable(), n.addEventListener("changed", () => {
|
|
1275
|
-
s == null || s.call(o);
|
|
1276
|
-
}), o.addEventListener("model-visibility", (i) => {
|
|
1277
|
-
i.detail.visible && (s == null || s.call(o));
|
|
1278
|
-
}), o.addEventListener("load", () => {
|
|
1279
|
-
r();
|
|
1280
|
-
}), () => {
|
|
1281
|
-
n.disable();
|
|
1282
|
-
};
|
|
1283
|
-
}
|
|
1284
|
-
return null;
|
|
1285
|
-
}
|
|
1286
|
-
class Ft {
|
|
1287
|
-
constructor() {
|
|
1288
|
-
u(this, "_didWarnAboutMissingUrl", !1);
|
|
1289
|
-
}
|
|
1290
|
-
onBeforeUpdateLOD(e, t, s, n) {
|
|
1291
|
-
this.tryParseMeshLOD(t, n), this.tryParseTextureLOD(t, n);
|
|
1292
|
-
}
|
|
1293
|
-
getUrl(e) {
|
|
1294
|
-
if (!e)
|
|
1295
|
-
return null;
|
|
1296
|
-
let t = e.getAttribute("src");
|
|
1297
|
-
return t || (t = e.src), t || (this._didWarnAboutMissingUrl || console.warn("No url found in modelviewer", e), this._didWarnAboutMissingUrl = !0), t;
|
|
1298
|
-
}
|
|
1299
|
-
tryGetCurrentGLTF(e) {
|
|
1300
|
-
return e._currentGLTF;
|
|
1301
|
-
}
|
|
1302
|
-
tryGetCurrentModelViewer(e) {
|
|
1303
|
-
return e.element;
|
|
1304
|
-
}
|
|
1305
|
-
tryParseTextureLOD(e, t) {
|
|
1306
|
-
if (t[ye] == !0)
|
|
1307
|
-
return;
|
|
1308
|
-
t[ye] = !0;
|
|
1309
|
-
const s = this.tryGetCurrentGLTF(e), n = this.tryGetCurrentModelViewer(e), r = this.getUrl(n);
|
|
1310
|
-
if (r && s && t.material) {
|
|
1311
|
-
let a = function(l) {
|
|
1312
|
-
var f, m, M;
|
|
1313
|
-
if (l[ye] == !0)
|
|
1314
|
-
return;
|
|
1315
|
-
l[ye] = !0, l.userData && (l.userData.LOD = -1);
|
|
1316
|
-
const d = Object.keys(l);
|
|
1317
|
-
for (let w = 0; w < d.length; w++) {
|
|
1318
|
-
const T = d[w], b = l[T];
|
|
1319
|
-
if ((b == null ? void 0 : b.isTexture) === !0) {
|
|
1320
|
-
const I = (m = (f = b.userData) == null ? void 0 : f.associations) == null ? void 0 : m.textures;
|
|
1321
|
-
if (I == null)
|
|
1322
|
-
continue;
|
|
1323
|
-
const S = s.parser.json.textures[I];
|
|
1324
|
-
if (!S) {
|
|
1325
|
-
console.warn("Texture data not found for texture index " + I);
|
|
1326
|
-
continue;
|
|
1327
|
-
}
|
|
1328
|
-
if ((M = S == null ? void 0 : S.extensions) != null && M[X]) {
|
|
1329
|
-
const c = S.extensions[X];
|
|
1330
|
-
c && r && K.registerTexture(r, b, c.lods.length, I, c);
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
}
|
|
1334
|
-
};
|
|
1335
|
-
const i = t.material;
|
|
1336
|
-
if (Array.isArray(i))
|
|
1337
|
-
for (const l of i)
|
|
1338
|
-
a(l);
|
|
1339
|
-
else
|
|
1340
|
-
a(i);
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
tryParseMeshLOD(e, t) {
|
|
1344
|
-
var i, a;
|
|
1345
|
-
if (t[We] == !0)
|
|
1346
|
-
return;
|
|
1347
|
-
t[We] = !0;
|
|
1348
|
-
const s = this.tryGetCurrentModelViewer(e), n = this.getUrl(s);
|
|
1349
|
-
if (!n)
|
|
1350
|
-
return;
|
|
1351
|
-
const r = (a = (i = t.userData) == null ? void 0 : i.gltfExtensions) == null ? void 0 : a[X];
|
|
1352
|
-
if (r && n) {
|
|
1353
|
-
const l = t.uuid;
|
|
1354
|
-
K.registerMesh(n, l, t, 0, r.lods.length, r);
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
function Nt(o, e, t, s) {
|
|
1359
|
-
Re(e), Ye(t), je(t, {
|
|
1360
|
-
progressive: !0,
|
|
1361
|
-
...s == null ? void 0 : s.hints
|
|
1362
|
-
}), t.register((r) => new K(r, o));
|
|
1363
|
-
const n = _e.get(e);
|
|
1364
|
-
return (s == null ? void 0 : s.enableLODsManager) !== !1 && n.enable(), n;
|
|
1365
|
-
}
|
|
1366
|
-
Ze();
|
|
1367
|
-
if (!bt) {
|
|
1368
|
-
const o = {
|
|
1369
|
-
gltfProgressive: {
|
|
1370
|
-
useNeedleProgressive: Nt,
|
|
1371
|
-
LODsManager: _e,
|
|
1372
|
-
configureLoader: je,
|
|
1373
|
-
getRaycastMesh: he,
|
|
1374
|
-
useRaycastMeshes: vt
|
|
1375
|
-
}
|
|
1376
|
-
};
|
|
1377
|
-
if (!globalThis.Needle)
|
|
1378
|
-
globalThis.Needle = o;
|
|
1379
|
-
else
|
|
1380
|
-
for (const e in o)
|
|
1381
|
-
globalThis.Needle[e] = o[e];
|
|
1382
|
-
}
|
|
1383
|
-
export {
|
|
1384
|
-
_e as LODsManager,
|
|
1385
|
-
K as NEEDLE_progressive,
|
|
1386
|
-
Ye as addDracoAndKTX2Loaders,
|
|
1387
|
-
je as configureLoader,
|
|
1388
|
-
Re as createLoaders,
|
|
1389
|
-
he as getRaycastMesh,
|
|
1390
|
-
wt as setDracoDecoderLocation,
|
|
1391
|
-
Lt as setKTX2TranscoderLocation
|
|
1392
|
-
};
|