@needle-tools/gltf-progressive 3.1.0-next.f550970 → 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 +924 -747
- 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 +62 -9
- package/lib/loaders.d.ts +8 -0
- package/lib/loaders.js +33 -22
- package/lib/lods.manager.js +20 -11
- package/lib/utils.internal.d.ts +4 -5
- 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 +1 -1
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 q = "https://www.gstatic.com/draco/versioned/decoders/1.5.7/",
|
|
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 ${q} (offline: ${typeof navigator < "u" ? navigator.onLine : "unknown"})`), q ===
|
|
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 Ne() {
|
|
42
|
-
k || (k = new st(), k[Pe] = q, k.setDecoderPath(q), k.setDecoderConfig({ type: "js" }), k.preload()), N || (N = new rt(), N.setTranscoderPath(re), N.init()), xe || (xe = tt);
|
|
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]: Added new promise, now running: ${this._running.size}, waiting: ${this._queue.length}. (added ${
|
|
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
|
|
165
|
-
if (
|
|
167
|
+
const Z = new Array(), x = oe("debugprogressive");
|
|
168
|
+
let we, re = -1;
|
|
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
|
|
176
|
-
if (
|
|
179
|
+
function He(o) {
|
|
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);
|
|
182
186
|
}
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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;
|
|
328
|
+
}
|
|
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
|
-
|
|
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 (
|
|
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"), O = 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,100 +455,105 @@ const X = "NEEDLE_progressive", Oe = Symbol("needle-progressive-texture"), O = 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
|
-
|
|
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 console.warn("Progressive: Got an array of textures for a texture slot, this should not happen"
|
|
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
|
|
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;
|
|
545
|
+
}
|
|
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}.`);
|
|
387
549
|
}
|
|
388
|
-
s[
|
|
550
|
+
s[i] = r;
|
|
389
551
|
}
|
|
390
552
|
return r;
|
|
391
553
|
} else
|
|
392
|
-
|
|
554
|
+
x == "verbose" && console.warn("No LOD found for", e, t);
|
|
393
555
|
return null;
|
|
394
|
-
}).catch((r) => (console.error("Error loading LOD",
|
|
556
|
+
}).catch((r) => (console.error("Error loading LOD", e, r), null));
|
|
395
557
|
}
|
|
396
558
|
// private _isLoadingTexture;
|
|
397
559
|
// loadTexture = (textureIndex: number) => {
|
|
@@ -407,243 +569,259 @@ const X = "NEEDLE_progressive", Oe = Symbol("needle-progressive-texture"), O = c
|
|
|
407
569
|
// return tex;
|
|
408
570
|
// });
|
|
409
571
|
// }
|
|
410
|
-
afterRoot(
|
|
411
|
-
var
|
|
412
|
-
return
|
|
413
|
-
var
|
|
414
|
-
if (
|
|
415
|
-
const a =
|
|
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];
|
|
416
578
|
if (a) {
|
|
417
579
|
if (!a.lods) {
|
|
418
|
-
|
|
580
|
+
x && console.warn("Texture has no LODs", a);
|
|
419
581
|
return;
|
|
420
582
|
}
|
|
421
583
|
let l = !1;
|
|
422
|
-
for (const
|
|
423
|
-
if (
|
|
424
|
-
const
|
|
425
|
-
(
|
|
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));
|
|
426
588
|
}
|
|
427
|
-
l || this.parser.getDependency("texture", r).then((
|
|
428
|
-
var
|
|
429
|
-
|
|
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);
|
|
430
592
|
});
|
|
431
593
|
}
|
|
432
594
|
}
|
|
433
|
-
}), (s = this.parser.json.meshes) == null || s.forEach((
|
|
434
|
-
if (
|
|
435
|
-
const
|
|
436
|
-
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) {
|
|
437
599
|
for (const a of this.parser.associations.keys())
|
|
438
600
|
if (a.isMesh) {
|
|
439
601
|
const l = this.parser.associations.get(a);
|
|
440
|
-
(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);
|
|
441
603
|
}
|
|
442
604
|
}
|
|
443
605
|
}
|
|
444
606
|
}), null;
|
|
445
607
|
}
|
|
446
|
-
static async getOrLoadLOD(
|
|
447
|
-
var
|
|
448
|
-
const s =
|
|
449
|
-
if (!
|
|
450
|
-
return
|
|
451
|
-
const r =
|
|
452
|
-
let
|
|
453
|
-
if (
|
|
454
|
-
const
|
|
455
|
-
|
|
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]);
|
|
456
618
|
}
|
|
457
|
-
if (
|
|
458
|
-
if (
|
|
459
|
-
let
|
|
460
|
-
const
|
|
461
|
-
if (
|
|
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)
|
|
462
624
|
return this.lowresCache.get(r);
|
|
463
625
|
}
|
|
464
|
-
const
|
|
465
|
-
if (!
|
|
466
|
-
return
|
|
467
|
-
const
|
|
468
|
-
if (
|
|
469
|
-
if (!
|
|
470
|
-
return console.warn("missing pointer for glb/gltf texture",
|
|
471
|
-
const
|
|
472
|
-
if (
|
|
473
|
-
s && console.log(`LOD ${
|
|
474
|
-
let
|
|
475
|
-
`,
|
|
476
|
-
if (
|
|
477
|
-
return
|
|
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)
|
|
639
|
+
return h;
|
|
478
640
|
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
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;
|
|
664
|
+
if (b && Array.isArray(b.lods)) {
|
|
665
|
+
const S = b.lods[t];
|
|
666
|
+
S.hash && (U += "?v=" + S.hash);
|
|
489
667
|
}
|
|
490
|
-
const
|
|
491
|
-
`,
|
|
492
|
-
if (!
|
|
493
|
-
return
|
|
494
|
-
const
|
|
495
|
-
s && console.log("Loading finished " +
|
|
496
|
-
let
|
|
497
|
-
if (
|
|
498
|
-
let
|
|
499
|
-
for (const
|
|
500
|
-
if (
|
|
501
|
-
const
|
|
502
|
-
if (
|
|
503
|
-
|
|
668
|
+
const k = await T.loadAsync(U).catch((S) => (console.error(`Error loading LOD ${t} from ${w}
|
|
669
|
+
`, S), h(null)));
|
|
670
|
+
if (!k)
|
|
671
|
+
return h(null);
|
|
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];
|
|
680
|
+
if (g != null && g.guid && g.guid === b.guid) {
|
|
681
|
+
S = !0;
|
|
504
682
|
break;
|
|
505
683
|
}
|
|
506
684
|
}
|
|
507
|
-
|
|
685
|
+
G++;
|
|
508
686
|
}
|
|
509
|
-
if (
|
|
510
|
-
let
|
|
511
|
-
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);
|
|
512
690
|
} else
|
|
513
|
-
|
|
691
|
+
x && console.warn("Could not find texture with guid", b.guid, k.parser.json);
|
|
514
692
|
}
|
|
515
|
-
if (
|
|
516
|
-
let
|
|
517
|
-
for (const
|
|
518
|
-
if (
|
|
519
|
-
const
|
|
520
|
-
if (
|
|
521
|
-
|
|
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];
|
|
698
|
+
if (g != null && g.guid && g.guid === b.guid) {
|
|
699
|
+
S = !0;
|
|
522
700
|
break;
|
|
523
701
|
}
|
|
524
702
|
}
|
|
525
|
-
|
|
703
|
+
G++;
|
|
526
704
|
}
|
|
527
|
-
if (
|
|
528
|
-
const
|
|
529
|
-
if (s && console.log(`Loaded Mesh "${
|
|
530
|
-
const
|
|
531
|
-
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);
|
|
532
710
|
} else {
|
|
533
|
-
const
|
|
534
|
-
for (let
|
|
535
|
-
const
|
|
536
|
-
if (
|
|
537
|
-
const
|
|
538
|
-
|
|
711
|
+
const g = new Array();
|
|
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);
|
|
539
717
|
}
|
|
540
718
|
}
|
|
541
|
-
return g
|
|
719
|
+
return h(g);
|
|
542
720
|
}
|
|
543
721
|
} else
|
|
544
|
-
|
|
722
|
+
x && console.warn("Could not find mesh with guid", b.guid, k.parser.json);
|
|
545
723
|
}
|
|
546
|
-
return
|
|
724
|
+
return h(null);
|
|
547
725
|
});
|
|
548
|
-
return this.previouslyLoaded.set(
|
|
549
|
-
} else if (
|
|
550
|
-
s && console.log("Load texture from uri: " +
|
|
551
|
-
const
|
|
552
|
-
return
|
|
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;
|
|
553
731
|
}
|
|
554
732
|
} else
|
|
555
|
-
|
|
733
|
+
x && console.warn(`Can not load LOD ${t}: no LOD info found for "${r}" ${e.name}`, e.type);
|
|
556
734
|
return null;
|
|
557
735
|
}
|
|
558
|
-
static assignLODInformation(
|
|
559
|
-
if (!
|
|
736
|
+
static assignLODInformation(e, t, s, i, r) {
|
|
737
|
+
if (!t)
|
|
560
738
|
return;
|
|
561
|
-
|
|
562
|
-
const
|
|
563
|
-
|
|
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);
|
|
564
742
|
}
|
|
565
|
-
static getAssignedLODInformation(
|
|
566
|
-
var
|
|
567
|
-
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;
|
|
568
746
|
}
|
|
569
747
|
// private static readonly _copiedTextures: WeakMap<Texture, Texture> = new Map();
|
|
570
|
-
static copySettings(
|
|
571
|
-
return
|
|
572
|
-
`,
|
|
573
|
-
`,
|
|
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;
|
|
574
752
|
}
|
|
575
753
|
};
|
|
576
|
-
let
|
|
754
|
+
let C = P;
|
|
577
755
|
/**
|
|
578
756
|
* Register a texture with LOD information
|
|
579
757
|
*/
|
|
580
|
-
|
|
581
|
-
var a, l,
|
|
582
|
-
if (!
|
|
583
|
-
|
|
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");
|
|
584
762
|
return;
|
|
585
763
|
}
|
|
586
|
-
if (
|
|
587
|
-
const
|
|
588
|
-
console.log(`> Progressive: register texture[${
|
|
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);
|
|
589
767
|
}
|
|
590
|
-
|
|
591
|
-
const
|
|
592
|
-
|
|
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);
|
|
593
771
|
}), /**
|
|
594
772
|
* Register a mesh with LOD information
|
|
595
773
|
*/
|
|
596
|
-
|
|
597
|
-
var
|
|
774
|
+
d(C, "registerMesh", (e, t, s, i, r, n) => {
|
|
775
|
+
var u;
|
|
598
776
|
const a = s.geometry;
|
|
599
777
|
if (!a) {
|
|
600
|
-
|
|
778
|
+
x && console.warn("gltf-progressive: Register mesh without geometry");
|
|
601
779
|
return;
|
|
602
780
|
}
|
|
603
|
-
a.userData || (a.userData = {}),
|
|
604
|
-
let l =
|
|
605
|
-
l ? l.push(s.geometry) : l = [s.geometry],
|
|
606
|
-
for (const
|
|
607
|
-
(
|
|
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);
|
|
608
786
|
}), /** A map of key = asset uuid and value = LOD information */
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
class
|
|
613
|
-
constructor(
|
|
614
|
-
|
|
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");
|
|
615
793
|
/** the key to lookup the LOD information */
|
|
616
|
-
|
|
617
|
-
|
|
794
|
+
d(this, "key");
|
|
795
|
+
d(this, "level");
|
|
618
796
|
/** For multi objects (e.g. a group of meshes) this is the index of the object */
|
|
619
|
-
|
|
620
|
-
this.url =
|
|
797
|
+
d(this, "index");
|
|
798
|
+
this.url = e, this.key = t, this.level = s, i != null && (this.index = i);
|
|
621
799
|
}
|
|
622
800
|
}
|
|
623
|
-
class
|
|
624
|
-
constructor(
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
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);
|
|
633
811
|
/** These promises are currently being awaited */
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
812
|
+
d(this, "_awaiting", []);
|
|
813
|
+
d(this, "_maxPromisesPerObject", 1);
|
|
814
|
+
d(this, "_currentFrame", 0);
|
|
815
|
+
d(this, "_seen", /* @__PURE__ */ new WeakMap());
|
|
638
816
|
var r;
|
|
639
|
-
const
|
|
640
|
-
this.frame_start =
|
|
641
|
-
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;
|
|
642
820
|
}), this.ready.finally(() => {
|
|
643
821
|
this._resolved = !0, this._awaiting.length = 0;
|
|
644
|
-
}), this._signal =
|
|
822
|
+
}), this._signal = t.signal, (r = this._signal) == null || r.addEventListener("abort", () => {
|
|
645
823
|
this.resolveNow();
|
|
646
|
-
}), this._maxPromisesPerObject = Math.max(1,
|
|
824
|
+
}), this._maxPromisesPerObject = Math.max(1, t.maxPromisesPerObject ?? 1);
|
|
647
825
|
}
|
|
648
826
|
/**
|
|
649
827
|
* The number of promises that have been added to this group so far.
|
|
@@ -657,156 +835,156 @@ class ye {
|
|
|
657
835
|
get currentlyAwaiting() {
|
|
658
836
|
return this._awaiting.length;
|
|
659
837
|
}
|
|
660
|
-
update(
|
|
661
|
-
var
|
|
662
|
-
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();
|
|
663
841
|
}
|
|
664
|
-
add(
|
|
842
|
+
add(e, t, s) {
|
|
665
843
|
if (this._resolved) {
|
|
666
|
-
|
|
844
|
+
x && console.warn("PromiseGroup: Trying to add a promise to a resolved group, ignoring.");
|
|
667
845
|
return;
|
|
668
846
|
}
|
|
669
847
|
if (!(this._currentFrame > this.frame_capture_end)) {
|
|
670
848
|
if (this._maxPromisesPerObject >= 1)
|
|
671
|
-
if (this._seen.has(
|
|
672
|
-
let
|
|
673
|
-
if (
|
|
674
|
-
|
|
849
|
+
if (this._seen.has(t)) {
|
|
850
|
+
let i = this._seen.get(t);
|
|
851
|
+
if (i >= this._maxPromisesPerObject) {
|
|
852
|
+
x && console.warn("PromiseGroup: Already awaiting object ignoring new promise for it.");
|
|
675
853
|
return;
|
|
676
854
|
}
|
|
677
|
-
this._seen.set(
|
|
855
|
+
this._seen.set(t, i + 1);
|
|
678
856
|
} else
|
|
679
|
-
this._seen.set(
|
|
857
|
+
this._seen.set(t, 1);
|
|
680
858
|
this._awaiting.push(s), this._addedCount++, s.finally(() => {
|
|
681
859
|
this._resolvedCount++, this._awaiting.splice(this._awaiting.indexOf(s), 1);
|
|
682
860
|
});
|
|
683
861
|
}
|
|
684
862
|
}
|
|
685
863
|
resolveNow() {
|
|
686
|
-
var
|
|
687
|
-
this._resolved || (
|
|
864
|
+
var e, t;
|
|
865
|
+
this._resolved || (t = this._resolve) == null || t.call(this, {
|
|
688
866
|
awaited_count: this._addedCount,
|
|
689
867
|
resolved_count: this._resolvedCount,
|
|
690
|
-
cancelled: ((
|
|
868
|
+
cancelled: ((e = this._signal) == null ? void 0 : e.aborted) ?? !1
|
|
691
869
|
});
|
|
692
870
|
}
|
|
693
871
|
}
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
r.add(
|
|
872
|
+
d(Le, "addPromise", (e, t, s, i) => {
|
|
873
|
+
i.forEach((r) => {
|
|
874
|
+
r.add(e, t, s);
|
|
697
875
|
});
|
|
698
876
|
});
|
|
699
|
-
const
|
|
700
|
-
var
|
|
701
|
-
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 {
|
|
702
880
|
// readonly plugins: NEEDLE_progressive_plugin[] = [];
|
|
703
|
-
constructor(
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
881
|
+
constructor(e, t) {
|
|
882
|
+
d(this, "renderer");
|
|
883
|
+
d(this, "context");
|
|
884
|
+
d(this, "projectionScreenMatrix", new Fe());
|
|
707
885
|
/**
|
|
708
886
|
* The target triangle density is the desired max amount of triangles on screen when the mesh is filling the screen.
|
|
709
887
|
* @default 200_000
|
|
710
888
|
*/
|
|
711
|
-
|
|
889
|
+
d(this, "targetTriangleDensity", 2e5);
|
|
712
890
|
/**
|
|
713
891
|
* The interval in frames to automatically update the bounds of skinned meshes.
|
|
714
892
|
* Set to 0 or a negative value to disable automatic bounds updates.
|
|
715
893
|
* @default 30
|
|
716
894
|
*/
|
|
717
|
-
|
|
895
|
+
d(this, "skinnedMeshAutoUpdateBoundsInterval", 30);
|
|
718
896
|
/**
|
|
719
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.
|
|
720
898
|
* @default "auto"
|
|
721
899
|
*/
|
|
722
|
-
|
|
723
|
-
|
|
900
|
+
d(this, "updateInterval", "auto");
|
|
901
|
+
Q(this, F, 1);
|
|
724
902
|
/**
|
|
725
903
|
* If set to true, the LODsManager will not update the LODs.
|
|
726
904
|
* @default false
|
|
727
905
|
*/
|
|
728
|
-
|
|
906
|
+
d(this, "pause", !1);
|
|
729
907
|
/**
|
|
730
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.
|
|
731
909
|
* Otherwise the LODs will be updated automatically when the renderer renders the scene.
|
|
732
910
|
* @default false
|
|
733
911
|
*/
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
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]);
|
|
745
923
|
// private testIfLODLevelsAreAvailable() {
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
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 };
|
|
754
932
|
}
|
|
755
933
|
/** @internal */
|
|
756
|
-
static getObjectLODState(
|
|
757
|
-
return
|
|
934
|
+
static getObjectLODState(e) {
|
|
935
|
+
return e[Ae];
|
|
758
936
|
}
|
|
759
|
-
static addPlugin(
|
|
760
|
-
|
|
937
|
+
static addPlugin(e) {
|
|
938
|
+
Z.push(e);
|
|
761
939
|
}
|
|
762
|
-
static removePlugin(
|
|
763
|
-
const
|
|
764
|
-
|
|
940
|
+
static removePlugin(e) {
|
|
941
|
+
const t = Z.indexOf(e);
|
|
942
|
+
t >= 0 && Z.splice(t, 1);
|
|
765
943
|
}
|
|
766
944
|
/**
|
|
767
945
|
* Gets the LODsManager for the given renderer. If the LODsManager does not exist yet, it will be created.
|
|
768
946
|
* @param renderer The renderer to get the LODsManager for.
|
|
769
947
|
* @returns The LODsManager instance.
|
|
770
948
|
*/
|
|
771
|
-
static get(
|
|
772
|
-
if (
|
|
773
|
-
return console.debug("[gltf-progressive] LODsManager already exists for this renderer"),
|
|
774
|
-
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, {
|
|
775
953
|
engine: "unknown",
|
|
776
|
-
...
|
|
954
|
+
...t
|
|
777
955
|
});
|
|
778
|
-
return
|
|
956
|
+
return e[Te] = s, s;
|
|
779
957
|
}
|
|
780
958
|
/** @deprecated use static `LODsManager.addPlugin()` method. This getter will be removed in later versions */
|
|
781
959
|
get plugins() {
|
|
782
|
-
return
|
|
960
|
+
return Z;
|
|
783
961
|
}
|
|
784
962
|
/**
|
|
785
963
|
* Call to await LODs loading during the next render cycle.
|
|
786
964
|
*/
|
|
787
|
-
awaitLoading(
|
|
788
|
-
const
|
|
965
|
+
awaitLoading(e) {
|
|
966
|
+
const t = this._promiseGroupIds++, s = new Le(D(this, ee), { ...e });
|
|
789
967
|
this._newPromiseGroups.push(s);
|
|
790
|
-
const
|
|
968
|
+
const i = performance.now();
|
|
791
969
|
return s.ready.finally(() => {
|
|
792
970
|
const r = this._newPromiseGroups.indexOf(s);
|
|
793
|
-
r >= 0 && (this._newPromiseGroups.splice(r, 1),
|
|
794
|
-
start:
|
|
795
|
-
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 }
|
|
796
974
|
}));
|
|
797
975
|
}), s.ready;
|
|
798
976
|
}
|
|
799
977
|
_postprocessPromiseGroups() {
|
|
800
978
|
if (this._newPromiseGroups.length !== 0)
|
|
801
|
-
for (let
|
|
802
|
-
this._newPromiseGroups[
|
|
979
|
+
for (let e = this._newPromiseGroups.length - 1; e >= 0; e--)
|
|
980
|
+
this._newPromiseGroups[e].update(D(this, ee));
|
|
803
981
|
}
|
|
804
|
-
addEventListener(
|
|
805
|
-
|
|
982
|
+
addEventListener(e, t) {
|
|
983
|
+
e === "changed" && this._lodchangedlisteners.push(t);
|
|
806
984
|
}
|
|
807
|
-
removeEventListener(
|
|
808
|
-
if (
|
|
809
|
-
const s = this._lodchangedlisteners.indexOf(
|
|
985
|
+
removeEventListener(e, t) {
|
|
986
|
+
if (e === "changed") {
|
|
987
|
+
const s = this._lodchangedlisteners.indexOf(t);
|
|
810
988
|
s >= 0 && this._lodchangedlisteners.splice(s, 1);
|
|
811
989
|
}
|
|
812
990
|
}
|
|
@@ -814,54 +992,54 @@ const b = class {
|
|
|
814
992
|
* Enable the LODsManager. This will replace the render method of the renderer with a method that updates the LODs.
|
|
815
993
|
*/
|
|
816
994
|
enable() {
|
|
817
|
-
if (
|
|
995
|
+
if (D(this, j))
|
|
818
996
|
return;
|
|
819
997
|
console.debug("[gltf-progressive] Enabling LODsManager for renderer");
|
|
820
|
-
let
|
|
821
|
-
|
|
822
|
-
const
|
|
823
|
-
|
|
824
|
-
const r =
|
|
825
|
-
(r == null || "isXRRenderTarget" in r && r.isXRRenderTarget) && (
|
|
826
|
-
const
|
|
827
|
-
|
|
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);
|
|
828
1006
|
};
|
|
829
1007
|
}
|
|
830
1008
|
disable() {
|
|
831
|
-
|
|
1009
|
+
D(this, j) && (console.debug("[gltf-progressive] Disabling LODsManager for renderer"), this.renderer.render = D(this, j), K(this, j, void 0));
|
|
832
1010
|
}
|
|
833
|
-
update(
|
|
834
|
-
this.internalUpdate(
|
|
1011
|
+
update(e, t) {
|
|
1012
|
+
this.internalUpdate(e, t);
|
|
835
1013
|
}
|
|
836
|
-
onAfterRender(
|
|
1014
|
+
onAfterRender(e, t, s) {
|
|
837
1015
|
if (this.pause)
|
|
838
1016
|
return;
|
|
839
|
-
const r = this.renderer.renderLists.get(
|
|
840
|
-
let
|
|
1017
|
+
const r = this.renderer.renderLists.get(e, 0).opaque;
|
|
1018
|
+
let n = !0;
|
|
841
1019
|
if (r.length === 1) {
|
|
842
1020
|
const a = r[0].material;
|
|
843
|
-
(a.name === "EffectMaterial" || a.name === "CopyShader") && (
|
|
1021
|
+
(a.name === "EffectMaterial" || a.name === "CopyShader") && (n = !1);
|
|
844
1022
|
}
|
|
845
|
-
if ((
|
|
846
|
-
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))
|
|
847
1025
|
return;
|
|
848
|
-
this.internalUpdate(
|
|
1026
|
+
this.internalUpdate(e, t), this._postprocessPromiseGroups();
|
|
849
1027
|
}
|
|
850
1028
|
}
|
|
851
1029
|
/**
|
|
852
1030
|
* Update LODs in a scene
|
|
853
1031
|
*/
|
|
854
|
-
internalUpdate(
|
|
855
|
-
var l,
|
|
856
|
-
const s = this.renderer.renderLists.get(
|
|
857
|
-
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);
|
|
858
1036
|
const r = this.targetTriangleDensity;
|
|
859
|
-
for (const
|
|
860
|
-
if (
|
|
861
|
-
|
|
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)));
|
|
862
1040
|
continue;
|
|
863
1041
|
}
|
|
864
|
-
switch (
|
|
1042
|
+
switch (f.material.type) {
|
|
865
1043
|
case "LineBasicMaterial":
|
|
866
1044
|
case "LineDashedMaterial":
|
|
867
1045
|
case "PointsMaterial":
|
|
@@ -870,62 +1048,60 @@ const b = class {
|
|
|
870
1048
|
case "MeshDepthMaterial":
|
|
871
1049
|
continue;
|
|
872
1050
|
}
|
|
873
|
-
if (
|
|
874
|
-
|
|
875
|
-
const
|
|
876
|
-
|
|
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;
|
|
877
1055
|
}
|
|
878
|
-
const
|
|
879
|
-
(
|
|
1056
|
+
const m = f.object;
|
|
1057
|
+
(m instanceof ne || m.isMesh) && this.updateLODs(e, t, m, r);
|
|
880
1058
|
}
|
|
881
|
-
const
|
|
882
|
-
for (const
|
|
883
|
-
const
|
|
884
|
-
(
|
|
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);
|
|
885
1063
|
}
|
|
886
1064
|
const a = s.transmissive;
|
|
887
|
-
for (const
|
|
888
|
-
const
|
|
889
|
-
(
|
|
1065
|
+
for (const f of a) {
|
|
1066
|
+
const m = f.object;
|
|
1067
|
+
(m instanceof ne || m.isMesh) && this.updateLODs(e, t, m, r);
|
|
890
1068
|
}
|
|
891
1069
|
}
|
|
892
1070
|
/** Update the LOD levels for the renderer. */
|
|
893
|
-
updateLODs(
|
|
1071
|
+
updateLODs(e, t, s, i) {
|
|
894
1072
|
var a, l;
|
|
895
1073
|
s.userData || (s.userData = {});
|
|
896
|
-
let r = s[
|
|
897
|
-
if (r || (r = new
|
|
1074
|
+
let r = s[Ae];
|
|
1075
|
+
if (r || (r = new Rt(), s[Ae] = r), r.frames++ < 2)
|
|
898
1076
|
return;
|
|
899
|
-
for (const
|
|
900
|
-
(a =
|
|
901
|
-
const
|
|
902
|
-
|
|
903
|
-
for (const
|
|
904
|
-
(l =
|
|
905
|
-
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;
|
|
906
1084
|
}
|
|
907
1085
|
/** Load progressive textures for the given material
|
|
908
1086
|
* @param material the material to load the textures for
|
|
909
1087
|
* @param level the LOD level to load. Level 0 is the best quality, higher levels are lower quality
|
|
910
1088
|
* @returns Promise with true if the LOD was loaded, false if not
|
|
911
1089
|
*/
|
|
912
|
-
loadProgressiveTextures(t,
|
|
913
|
-
if (!
|
|
1090
|
+
loadProgressiveTextures(e, t, s) {
|
|
1091
|
+
if (!e)
|
|
914
1092
|
return;
|
|
915
|
-
if (Array.isArray(
|
|
916
|
-
for (const r of
|
|
917
|
-
this.loadProgressiveTextures(r,
|
|
1093
|
+
if (Array.isArray(e)) {
|
|
1094
|
+
for (const r of e)
|
|
1095
|
+
this.loadProgressiveTextures(r, t);
|
|
918
1096
|
return;
|
|
919
1097
|
}
|
|
920
|
-
let
|
|
921
|
-
(
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
const r = T.assignTextureLOD(t, e).then((i) => {
|
|
926
|
-
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 }));
|
|
927
1103
|
});
|
|
928
|
-
|
|
1104
|
+
Le.addPromise("texture", e, r, this._newPromiseGroups);
|
|
929
1105
|
}
|
|
930
1106
|
}
|
|
931
1107
|
/** Load progressive meshes for the given mesh
|
|
@@ -934,132 +1110,133 @@ const b = class {
|
|
|
934
1110
|
* @param level the LOD level to load. Level 0 is the best quality, higher levels are lower quality
|
|
935
1111
|
* @returns Promise with true if the LOD was loaded, false if not
|
|
936
1112
|
*/
|
|
937
|
-
loadProgressiveMeshes(
|
|
938
|
-
if (!
|
|
1113
|
+
loadProgressiveMeshes(e, t) {
|
|
1114
|
+
if (!e)
|
|
939
1115
|
return Promise.resolve(null);
|
|
940
|
-
let s =
|
|
941
|
-
const
|
|
942
|
-
if (
|
|
943
|
-
|
|
944
|
-
const r =
|
|
945
|
-
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;
|
|
946
1122
|
}
|
|
947
1123
|
return Promise.resolve(null);
|
|
948
1124
|
}
|
|
949
|
-
static isInside(
|
|
950
|
-
const s =
|
|
951
|
-
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;
|
|
952
1128
|
}
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
1129
|
+
// #region calculateLodLevel
|
|
1130
|
+
calculateLodLevel(e, t, s, i, r) {
|
|
1131
|
+
var B, b, c, v;
|
|
1132
|
+
if (!t) {
|
|
956
1133
|
r.mesh_lod = -1, r.texture_lod = -1;
|
|
957
1134
|
return;
|
|
958
1135
|
}
|
|
959
|
-
if (!
|
|
1136
|
+
if (!e) {
|
|
960
1137
|
r.mesh_lod = -1, r.texture_lod = -1;
|
|
961
1138
|
return;
|
|
962
1139
|
}
|
|
963
1140
|
let a = 10 + 1, l = !1;
|
|
964
|
-
if (
|
|
965
|
-
return
|
|
966
|
-
const
|
|
967
|
-
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) {
|
|
968
1145
|
r.mesh_lod = 0, r.texture_lod = 0;
|
|
969
1146
|
return;
|
|
970
1147
|
}
|
|
971
|
-
|
|
972
|
-
const
|
|
973
|
-
let
|
|
974
|
-
if (
|
|
975
|
-
const
|
|
976
|
-
if (!
|
|
977
|
-
|
|
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;
|
|
1153
|
+
if (!h.boundingBox)
|
|
1154
|
+
h.computeBoundingBox();
|
|
978
1155
|
else if (this.skinnedMeshAutoUpdateBoundsInterval > 0) {
|
|
979
|
-
if (!
|
|
980
|
-
const
|
|
981
|
-
|
|
1156
|
+
if (!h[A.$skinnedMeshBoundsOffset]) {
|
|
1157
|
+
const T = A.skinnedMeshBoundsFrameOffsetCounter++;
|
|
1158
|
+
h[A.$skinnedMeshBoundsOffset] = T;
|
|
982
1159
|
}
|
|
983
|
-
const
|
|
984
|
-
if ((s.frames +
|
|
985
|
-
const
|
|
986
|
-
|
|
1160
|
+
const L = h[A.$skinnedMeshBoundsOffset];
|
|
1161
|
+
if ((s.frames + L) % this.skinnedMeshAutoUpdateBoundsInterval === 0) {
|
|
1162
|
+
const T = ge(h), U = h.geometry;
|
|
1163
|
+
T && (h.geometry = T), h.computeBoundingBox(), h.geometry = U;
|
|
987
1164
|
}
|
|
988
1165
|
}
|
|
989
|
-
|
|
1166
|
+
M = h.boundingBox;
|
|
990
1167
|
}
|
|
991
|
-
if (
|
|
992
|
-
const
|
|
993
|
-
if (
|
|
994
|
-
this._sphere.copy(
|
|
995
|
-
const
|
|
996
|
-
if (this._sphere.containsPoint(
|
|
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);
|
|
1173
|
+
if (this._sphere.containsPoint(g)) {
|
|
997
1174
|
r.mesh_lod = 0, r.texture_lod = 0;
|
|
998
1175
|
return;
|
|
999
1176
|
}
|
|
1000
1177
|
}
|
|
1001
|
-
if (this._tempBox.copy(
|
|
1178
|
+
if (this._tempBox.copy(M), this._tempBox.applyMatrix4(t.matrixWorld), h.isPerspectiveCamera && A.isInside(this._tempBox, this.projectionScreenMatrix)) {
|
|
1002
1179
|
r.mesh_lod = 0, r.texture_lod = 0;
|
|
1003
1180
|
return;
|
|
1004
1181
|
}
|
|
1005
|
-
if (this._tempBox.applyMatrix4(this.projectionScreenMatrix), this.renderer.xr.enabled &&
|
|
1006
|
-
const
|
|
1007
|
-
let
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1010
|
-
const
|
|
1011
|
-
s.lastCentrality = (
|
|
1182
|
+
if (this._tempBox.applyMatrix4(this.projectionScreenMatrix), this.renderer.xr.enabled && h.isPerspectiveCamera && h.fov > 70) {
|
|
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);
|
|
1012
1189
|
} else
|
|
1013
1190
|
s.lastCentrality = 1;
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1016
|
-
const
|
|
1017
|
-
U.copy(
|
|
1018
|
-
const
|
|
1019
|
-
if (Math.max(
|
|
1020
|
-
const
|
|
1021
|
-
|
|
1022
|
-
const
|
|
1023
|
-
|
|
1024
|
-
const
|
|
1025
|
-
|
|
1191
|
+
const L = this._tempBox.getSize(this._tempBoxSize);
|
|
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) {
|
|
1197
|
+
const g = this.tempMatrix.copy(this.projectionScreenMatrix);
|
|
1198
|
+
g.invert();
|
|
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);
|
|
1026
1203
|
}
|
|
1027
|
-
let
|
|
1028
|
-
if (
|
|
1029
|
-
for (let
|
|
1030
|
-
const
|
|
1031
|
-
if (
|
|
1032
|
-
|
|
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;
|
|
1033
1210
|
break;
|
|
1034
1211
|
}
|
|
1035
1212
|
}
|
|
1036
|
-
|
|
1213
|
+
S < a && (a = S, l = !0);
|
|
1037
1214
|
}
|
|
1038
|
-
if (l ? r.mesh_lod = a : r.mesh_lod = s.lastLodLevel_Mesh,
|
|
1039
|
-
const
|
|
1040
|
-
|
|
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}`);
|
|
1041
1218
|
}
|
|
1042
1219
|
if (w) {
|
|
1043
|
-
const
|
|
1220
|
+
const h = "saveData" in globalThis.navigator && globalThis.navigator.saveData === !0;
|
|
1044
1221
|
if (s.lastLodLevel_Texture < 0) {
|
|
1045
|
-
if (r.texture_lod =
|
|
1046
|
-
const
|
|
1047
|
-
|
|
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}`);
|
|
1048
1225
|
}
|
|
1049
1226
|
} else {
|
|
1050
|
-
const
|
|
1051
|
-
let
|
|
1052
|
-
((
|
|
1053
|
-
const
|
|
1054
|
-
let
|
|
1055
|
-
for (let
|
|
1056
|
-
const
|
|
1057
|
-
if (!(
|
|
1058
|
-
if (
|
|
1059
|
-
const
|
|
1060
|
-
|
|
1061
|
-
Screensize: ${
|
|
1062
|
-
${
|
|
1227
|
+
const L = s.lastScreenspaceVolume.x + s.lastScreenspaceVolume.y + s.lastScreenspaceVolume.z;
|
|
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}`);
|
|
1063
1240
|
}
|
|
1064
1241
|
break;
|
|
1065
1242
|
}
|
|
@@ -1069,70 +1246,70 @@ ${e.name}`);
|
|
|
1069
1246
|
r.texture_lod = 0;
|
|
1070
1247
|
}
|
|
1071
1248
|
};
|
|
1072
|
-
let
|
|
1073
|
-
|
|
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(), /**
|
|
1074
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.
|
|
1075
1252
|
*/
|
|
1076
|
-
|
|
1253
|
+
d($, "debugDrawLine"), /**
|
|
1077
1254
|
* Force override the LOD level for all objects in the scene
|
|
1078
1255
|
*/
|
|
1079
|
-
|
|
1080
|
-
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 {
|
|
1081
1258
|
constructor() {
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
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);
|
|
1088
1265
|
}
|
|
1089
1266
|
}
|
|
1090
|
-
const
|
|
1091
|
-
let
|
|
1092
|
-
function
|
|
1093
|
-
const o =
|
|
1094
|
-
o && (o.mapURLs(function(
|
|
1095
|
-
return
|
|
1096
|
-
}),
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
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);
|
|
1100
1277
|
});
|
|
1101
1278
|
});
|
|
1102
|
-
}),
|
|
1279
|
+
}), fe.observe(document, { childList: !0, subtree: !0 }));
|
|
1103
1280
|
}
|
|
1104
|
-
function
|
|
1281
|
+
function $t() {
|
|
1105
1282
|
if (typeof customElements > "u")
|
|
1106
1283
|
return null;
|
|
1107
1284
|
const o = customElements.get("model-viewer");
|
|
1108
1285
|
return o || (customElements.whenDefined("model-viewer").then(() => {
|
|
1109
|
-
console.debug("[gltf-progressive] model-viewer defined"),
|
|
1286
|
+
console.debug("[gltf-progressive] model-viewer defined"), Qe();
|
|
1110
1287
|
}), null);
|
|
1111
1288
|
}
|
|
1112
|
-
function
|
|
1289
|
+
function We() {
|
|
1113
1290
|
if (typeof document > "u")
|
|
1114
1291
|
return;
|
|
1115
|
-
document.querySelectorAll("model-viewer").forEach((
|
|
1116
|
-
|
|
1292
|
+
document.querySelectorAll("model-viewer").forEach((e) => {
|
|
1293
|
+
Je(e);
|
|
1117
1294
|
});
|
|
1118
1295
|
}
|
|
1119
|
-
const
|
|
1120
|
-
let
|
|
1121
|
-
function
|
|
1122
|
-
if (!o ||
|
|
1296
|
+
const ze = /* @__PURE__ */ new WeakSet();
|
|
1297
|
+
let Gt = 0;
|
|
1298
|
+
function Je(o) {
|
|
1299
|
+
if (!o || ze.has(o))
|
|
1123
1300
|
return null;
|
|
1124
|
-
|
|
1301
|
+
ze.add(o), console.debug("[gltf-progressive] found new model-viewer..." + ++Gt + `
|
|
1125
1302
|
`, o.getAttribute("src"));
|
|
1126
|
-
let
|
|
1127
|
-
for (let
|
|
1128
|
-
const r = Object.getOwnPropertySymbols(
|
|
1129
|
-
!
|
|
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]);
|
|
1130
1307
|
}
|
|
1131
|
-
if (
|
|
1132
|
-
let
|
|
1308
|
+
if (e && t) {
|
|
1309
|
+
let i = function() {
|
|
1133
1310
|
if (s) {
|
|
1134
|
-
let
|
|
1135
|
-
if (
|
|
1311
|
+
let n = 0, a = setInterval(() => {
|
|
1312
|
+
if (n++ > 5) {
|
|
1136
1313
|
clearInterval(a);
|
|
1137
1314
|
return;
|
|
1138
1315
|
}
|
|
@@ -1141,129 +1318,129 @@ function Xe(o) {
|
|
|
1141
1318
|
}
|
|
1142
1319
|
};
|
|
1143
1320
|
console.debug("[gltf-progressive] setup model-viewer");
|
|
1144
|
-
const r =
|
|
1145
|
-
return
|
|
1321
|
+
const r = $.get(e, { engine: "model-viewer" });
|
|
1322
|
+
return $.addPlugin(new Et()), r.enable(), r.addEventListener("changed", () => {
|
|
1146
1323
|
s == null || s.call(o);
|
|
1147
|
-
}), o.addEventListener("model-visibility", (
|
|
1148
|
-
|
|
1324
|
+
}), o.addEventListener("model-visibility", (n) => {
|
|
1325
|
+
n.detail.visible && (s == null || s.call(o));
|
|
1149
1326
|
}), o.addEventListener("load", () => {
|
|
1150
|
-
|
|
1327
|
+
i();
|
|
1151
1328
|
}), () => {
|
|
1152
1329
|
r.disable();
|
|
1153
1330
|
};
|
|
1154
1331
|
}
|
|
1155
1332
|
return null;
|
|
1156
1333
|
}
|
|
1157
|
-
class
|
|
1334
|
+
class Et {
|
|
1158
1335
|
constructor() {
|
|
1159
|
-
|
|
1336
|
+
d(this, "_didWarnAboutMissingUrl", !1);
|
|
1160
1337
|
}
|
|
1161
|
-
onBeforeUpdateLOD(
|
|
1162
|
-
this.tryParseMeshLOD(
|
|
1338
|
+
onBeforeUpdateLOD(e, t, s, i) {
|
|
1339
|
+
this.tryParseMeshLOD(t, i), this.tryParseTextureLOD(t, i);
|
|
1163
1340
|
}
|
|
1164
|
-
getUrl(
|
|
1165
|
-
if (!
|
|
1341
|
+
getUrl(e) {
|
|
1342
|
+
if (!e)
|
|
1166
1343
|
return null;
|
|
1167
|
-
let
|
|
1168
|
-
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;
|
|
1169
1346
|
}
|
|
1170
|
-
tryGetCurrentGLTF(
|
|
1171
|
-
return
|
|
1347
|
+
tryGetCurrentGLTF(e) {
|
|
1348
|
+
return e._currentGLTF;
|
|
1172
1349
|
}
|
|
1173
|
-
tryGetCurrentModelViewer(
|
|
1174
|
-
return
|
|
1350
|
+
tryGetCurrentModelViewer(e) {
|
|
1351
|
+
return e.element;
|
|
1175
1352
|
}
|
|
1176
|
-
tryParseTextureLOD(
|
|
1177
|
-
if (
|
|
1353
|
+
tryParseTextureLOD(e, t) {
|
|
1354
|
+
if (t[xe] == !0)
|
|
1178
1355
|
return;
|
|
1179
|
-
|
|
1180
|
-
const s = this.tryGetCurrentGLTF(
|
|
1181
|
-
if (r && s &&
|
|
1182
|
-
let
|
|
1183
|
-
var
|
|
1184
|
-
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)
|
|
1185
1362
|
return;
|
|
1186
|
-
l[
|
|
1187
|
-
const
|
|
1188
|
-
for (let w = 0; w <
|
|
1189
|
-
const
|
|
1190
|
-
if ((
|
|
1191
|
-
const
|
|
1192
|
-
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)
|
|
1193
1370
|
continue;
|
|
1194
|
-
const
|
|
1195
|
-
if (!
|
|
1196
|
-
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);
|
|
1197
1374
|
continue;
|
|
1198
1375
|
}
|
|
1199
|
-
if ((
|
|
1200
|
-
const
|
|
1201
|
-
|
|
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);
|
|
1202
1379
|
}
|
|
1203
1380
|
}
|
|
1204
1381
|
}
|
|
1205
1382
|
};
|
|
1206
|
-
const a =
|
|
1383
|
+
const a = t.material;
|
|
1207
1384
|
if (Array.isArray(a))
|
|
1208
1385
|
for (const l of a)
|
|
1209
|
-
|
|
1386
|
+
n(l);
|
|
1210
1387
|
else
|
|
1211
|
-
|
|
1388
|
+
n(a);
|
|
1212
1389
|
}
|
|
1213
1390
|
}
|
|
1214
|
-
tryParseMeshLOD(
|
|
1215
|
-
var
|
|
1216
|
-
if (
|
|
1391
|
+
tryParseMeshLOD(e, t) {
|
|
1392
|
+
var n, a;
|
|
1393
|
+
if (t[Ue] == !0)
|
|
1217
1394
|
return;
|
|
1218
|
-
|
|
1219
|
-
const s = this.tryGetCurrentModelViewer(
|
|
1220
|
-
if (!
|
|
1395
|
+
t[Ue] = !0;
|
|
1396
|
+
const s = this.tryGetCurrentModelViewer(e), i = this.getUrl(s);
|
|
1397
|
+
if (!i)
|
|
1221
1398
|
return;
|
|
1222
|
-
const r = (a = (
|
|
1223
|
-
if (r &&
|
|
1224
|
-
const l =
|
|
1225
|
-
|
|
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);
|
|
1226
1403
|
}
|
|
1227
1404
|
}
|
|
1228
1405
|
}
|
|
1229
|
-
function
|
|
1230
|
-
|
|
1406
|
+
function Ft(o, e, t, s) {
|
|
1407
|
+
$e(e), Xe(t), Ye(t, {
|
|
1231
1408
|
progressive: !0,
|
|
1232
1409
|
...s == null ? void 0 : s.hints
|
|
1233
|
-
}),
|
|
1234
|
-
const
|
|
1235
|
-
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;
|
|
1236
1413
|
}
|
|
1237
|
-
|
|
1238
|
-
if (!
|
|
1414
|
+
Qe();
|
|
1415
|
+
if (!vt) {
|
|
1239
1416
|
const o = {
|
|
1240
1417
|
gltfProgressive: {
|
|
1241
|
-
useNeedleProgressive:
|
|
1242
|
-
LODsManager:
|
|
1243
|
-
configureLoader:
|
|
1244
|
-
getRaycastMesh:
|
|
1245
|
-
useRaycastMeshes:
|
|
1418
|
+
useNeedleProgressive: Ft,
|
|
1419
|
+
LODsManager: $,
|
|
1420
|
+
configureLoader: Ye,
|
|
1421
|
+
getRaycastMesh: ge,
|
|
1422
|
+
useRaycastMeshes: bt
|
|
1246
1423
|
}
|
|
1247
1424
|
};
|
|
1248
1425
|
if (!globalThis.Needle)
|
|
1249
1426
|
globalThis.Needle = o;
|
|
1250
1427
|
else
|
|
1251
|
-
for (const
|
|
1252
|
-
globalThis.Needle[
|
|
1428
|
+
for (const e in o)
|
|
1429
|
+
globalThis.Needle[e] = o[e];
|
|
1253
1430
|
}
|
|
1254
1431
|
export {
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
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
|
|
1269
1446
|
};
|