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