@needle-tools/engine 4.1.0-experimental.13 → 4.1.1
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 +75 -10
- package/README.md +28 -17
- package/components.needle.json +1 -1
- package/dist/gltf-progressive.js +220 -221
- package/dist/gltf-progressive.light.js +220 -221
- package/dist/gltf-progressive.light.min.js +6 -6
- package/dist/gltf-progressive.light.umd.cjs +7 -7
- package/dist/gltf-progressive.min.js +6 -6
- package/dist/gltf-progressive.umd.cjs +7 -7
- package/dist/needle-engine.bundle.js +8241 -7948
- package/dist/needle-engine.bundle.light.js +8194 -7901
- package/dist/needle-engine.bundle.light.min.js +140 -141
- package/dist/needle-engine.bundle.light.umd.cjs +138 -139
- package/dist/needle-engine.bundle.min.js +140 -141
- package/dist/needle-engine.bundle.umd.cjs +134 -135
- package/dist/needle-engine.d.ts +140 -0
- package/dist/needle-engine.js +597 -590
- package/dist/needle-engine.light.d.ts +140 -0
- package/dist/needle-engine.light.js +597 -590
- package/dist/needle-engine.light.min.js +1 -1
- package/dist/needle-engine.light.umd.cjs +1 -1
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/postprocessing.js +1 -1
- package/dist/postprocessing.light.js +1 -1
- package/dist/postprocessing.light.min.js +1 -1
- package/dist/postprocessing.min.js +1 -1
- package/dist/three-examples.js +2809 -2450
- package/dist/three-examples.light.js +2809 -2450
- package/dist/three-examples.light.min.js +47 -15
- package/dist/three-examples.light.umd.cjs +47 -15
- package/dist/three-examples.min.js +47 -15
- package/dist/three-examples.umd.cjs +47 -15
- package/dist/three-mesh-ui.js +1 -1
- package/dist/three-mesh-ui.light.js +1 -1
- package/dist/three-mesh-ui.light.min.js +1 -1
- package/dist/three-mesh-ui.min.js +1 -1
- package/dist/three.js +577 -572
- package/dist/three.light.js +577 -572
- package/dist/three.light.min.js +170 -170
- package/dist/three.light.umd.cjs +170 -170
- package/dist/three.min.js +170 -170
- package/dist/three.umd.cjs +170 -170
- package/dist/vendor.js +1327 -1331
- package/dist/vendor.light.js +1327 -1331
- package/dist/vendor.light.min.js +33 -33
- package/dist/vendor.light.umd.cjs +33 -33
- package/dist/vendor.min.js +33 -33
- package/dist/vendor.umd.cjs +33 -33
- package/lib/engine/assets/index.js.map +1 -1
- package/lib/engine/engine.d.ts +4 -0
- package/lib/engine/engine.js +12 -0
- package/lib/engine/engine.js.map +1 -0
- package/lib/engine/engine_addressables.d.ts +6 -4
- package/lib/engine/engine_addressables.js +8 -1
- package/lib/engine/engine_addressables.js.map +1 -1
- package/lib/engine/engine_context.d.ts +3 -2
- package/lib/engine/engine_context.js +28 -4
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_gameobject.d.ts +2 -12
- package/lib/engine/engine_gameobject.js +5 -15
- package/lib/engine/engine_gameobject.js.map +1 -1
- package/lib/engine/engine_gltf_builtin_components.js +5 -0
- package/lib/engine/engine_gltf_builtin_components.js.map +1 -1
- package/lib/engine/engine_input.d.ts +23 -6
- package/lib/engine/engine_input.js +4 -10
- package/lib/engine/engine_input.js.map +1 -1
- package/lib/engine/engine_license.js +1 -1
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine/engine_modules.d.ts +7 -0
- package/lib/engine/engine_modules.js +7 -0
- package/lib/engine/engine_modules.js.map +1 -1
- package/lib/engine/engine_networking_auto.js +6 -11
- package/lib/engine/engine_networking_auto.js.map +1 -1
- package/lib/engine/engine_networking_instantiate.d.ts +1 -1
- package/lib/engine/engine_physics_rapier.d.ts +6 -4
- package/lib/engine/engine_physics_rapier.js +38 -24
- package/lib/engine/engine_physics_rapier.js.map +1 -1
- package/lib/engine/engine_scenetools.js +6 -2
- package/lib/engine/engine_scenetools.js.map +1 -1
- package/lib/engine/engine_types.d.ts +9 -2
- package/lib/engine/engine_types.js +6 -0
- package/lib/engine/engine_types.js.map +1 -1
- package/lib/engine/engine_web_api.d.ts +12 -0
- package/lib/engine/engine_web_api.js +113 -0
- package/lib/engine/engine_web_api.js.map +1 -0
- package/lib/engine/export/gltf/Writers.js.map +1 -1
- package/lib/engine/export/gltf/index.js +11 -1
- package/lib/engine/export/gltf/index.js.map +1 -1
- package/lib/engine/export/utils.d.ts +2 -0
- package/lib/engine/export/utils.js +8 -0
- package/lib/engine/export/utils.js.map +1 -0
- package/lib/engine/extensions/NEEDLE_gameobject_data.js +1 -1
- package/lib/engine/extensions/NEEDLE_gameobject_data.js.map +1 -1
- package/lib/engine/js-extensions/Object3D.d.ts +5 -1
- package/lib/engine/js-extensions/Object3D.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.js +8 -2
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/xr/NeedleXRSession.js +3 -0
- package/lib/engine/xr/NeedleXRSession.js.map +1 -1
- package/lib/engine-components/AvatarLoader.js.map +1 -1
- package/lib/engine-components/Camera.d.ts +7 -4
- package/lib/engine-components/Camera.js +13 -10
- package/lib/engine-components/Camera.js.map +1 -1
- package/lib/engine-components/Collider.js +4 -5
- package/lib/engine-components/Collider.js.map +1 -1
- package/lib/engine-components/Component.d.ts +4 -3
- package/lib/engine-components/Component.js +6 -7
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/ContactShadows.d.ts +1 -1
- package/lib/engine-components/ContactShadows.js +7 -0
- package/lib/engine-components/ContactShadows.js.map +1 -1
- package/lib/engine-components/FlyControls.d.ts +10 -0
- package/lib/engine-components/FlyControls.js +29 -0
- package/lib/engine-components/FlyControls.js.map +1 -0
- package/lib/engine-components/GroundProjection.d.ts +1 -1
- package/lib/engine-components/GroundProjection.js +39 -32
- package/lib/engine-components/GroundProjection.js.map +1 -1
- package/lib/engine-components/OrbitControls.js +9 -1
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/RigidBody.d.ts +1 -0
- package/lib/engine-components/RigidBody.js +11 -4
- package/lib/engine-components/RigidBody.js.map +1 -1
- package/lib/engine-components/SceneSwitcher.d.ts +1 -1
- package/lib/engine-components/SceneSwitcher.js +1 -1
- package/lib/engine-components/SceneSwitcher.js.map +1 -1
- package/lib/engine-components/SpatialTrigger.d.ts +2 -2
- package/lib/engine-components/SpatialTrigger.js +4 -4
- package/lib/engine-components/SpatialTrigger.js.map +1 -1
- package/lib/engine-components/TransformGizmo.d.ts +7 -1
- package/lib/engine-components/TransformGizmo.js +39 -32
- package/lib/engine-components/TransformGizmo.js.map +1 -1
- package/lib/engine-components/VideoPlayer.js +0 -1
- package/lib/engine-components/VideoPlayer.js.map +1 -1
- package/lib/engine-components/export/gltf/GltfExport.js +23 -4
- package/lib/engine-components/export/gltf/GltfExport.js.map +1 -1
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.d.ts +1 -1
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.js +2 -2
- package/lib/engine-components/export/usdz/index.d.ts +1 -1
- package/lib/engine-components/export/usdz/index.js +1 -1
- package/lib/engine-components/export/usdz/index.js.map +1 -1
- package/lib/engine-components/particlesystem/ParticleSystem.d.ts +5 -6
- package/lib/engine-components/particlesystem/ParticleSystem.js +24 -9
- package/lib/engine-components/particlesystem/ParticleSystem.js.map +1 -1
- package/lib/engine-components/particlesystem/ParticleSystemModules.js +8 -2
- package/lib/engine-components/particlesystem/ParticleSystemModules.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Antialiasing.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/BloomEffect.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Pixelation.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Sharpening.d.ts +2 -0
- package/lib/engine-components/postprocessing/Effects/Sharpening.js +15 -6
- package/lib/engine-components/postprocessing/Effects/Sharpening.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Tonemapping.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Vignette.js.map +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.js +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
- package/lib/engine-components/webxr/Avatar.js +3 -3
- package/lib/engine-components/webxr/Avatar.js.map +1 -1
- package/lib/engine-components/webxr/WebXR.js +22 -13
- package/lib/engine-components/webxr/WebXR.js.map +1 -1
- package/lib/engine-components/webxr/WebXRImageTracking.d.ts +4 -0
- package/lib/engine-components/webxr/WebXRImageTracking.js +14 -4
- package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
- package/lib/engine-components/webxr/WebXRRig.d.ts +11 -1
- package/lib/engine-components/webxr/WebXRRig.js +13 -1
- package/lib/engine-components/webxr/WebXRRig.js.map +1 -1
- package/lib/engine-components-experimental/networking/PlayerSync.d.ts +4 -1
- package/lib/engine-components-experimental/networking/PlayerSync.js +18 -30
- package/lib/engine-components-experimental/networking/PlayerSync.js.map +1 -1
- package/lib/needle-engine.js +5 -5
- package/lib/needle-engine.js.map +1 -1
- package/package.json +14 -8
- package/plugins/common/config.cjs +22 -6
- package/plugins/common/config.js +27 -11
- package/plugins/next/next.js +47 -4
- package/plugins/vite/transform.js +3 -3
- package/src/engine/assets/index.ts +1 -0
- package/src/engine/codegen/register_types.ts +2 -2
- package/src/engine/engine_addressables.ts +19 -12
- package/src/engine/engine_context.ts +33 -8
- package/src/engine/engine_gameobject.ts +12 -16
- package/src/engine/engine_gltf_builtin_components.ts +7 -1
- package/src/engine/engine_input.ts +16 -5
- package/src/engine/engine_license.ts +2 -1
- package/src/engine/engine_modules.ts +7 -0
- package/src/engine/engine_networking_auto.ts +7 -22
- package/src/engine/engine_networking_instantiate.ts +1 -1
- package/src/engine/engine_physics_rapier.ts +48 -26
- package/src/engine/engine_scenetools.ts +6 -2
- package/src/engine/engine_types.ts +10 -2
- package/src/engine/export/gltf/Writers.ts +0 -1
- package/src/engine/export/gltf/index.ts +13 -3
- package/src/engine/export/index.ts +1 -1
- package/src/engine/export/utils.ts +10 -0
- package/src/engine/extensions/NEEDLE_gameobject_data.ts +1 -2
- package/src/engine/js-extensions/Object3D.ts +6 -1
- package/src/engine/webcomponents/needle menu/needle-menu.ts +16 -10
- package/src/engine/xr/NeedleXRSession.ts +4 -1
- package/src/engine-components/AvatarLoader.ts +1 -1
- package/src/engine-components/Camera.ts +14 -11
- package/src/engine-components/Collider.ts +4 -4
- package/src/engine-components/Component.ts +13 -7
- package/src/engine-components/ContactShadows.ts +11 -2
- package/src/engine-components/GroundProjection.ts +46 -38
- package/src/engine-components/OrbitControls.ts +9 -1
- package/src/engine-components/RigidBody.ts +13 -5
- package/src/engine-components/SceneSwitcher.ts +1 -1
- package/src/engine-components/SpatialTrigger.ts +6 -6
- package/src/engine-components/TransformGizmo.ts +41 -33
- package/src/engine-components/VideoPlayer.ts +0 -1
- package/src/engine-components/export/gltf/GltfExport.ts +26 -6
- package/src/engine-components/export/usdz/ThreeUSDZExporter.ts +2 -2
- package/src/engine-components/export/usdz/index.ts +1 -1
- package/src/engine-components/particlesystem/ParticleSystem.ts +27 -10
- package/src/engine-components/particlesystem/ParticleSystemModules.ts +10 -3
- package/src/engine-components/postprocessing/Effects/Antialiasing.ts +0 -1
- package/src/engine-components/postprocessing/Effects/BloomEffect.ts +1 -1
- package/src/engine-components/postprocessing/Effects/ChromaticAberration.ts +1 -1
- package/src/engine-components/postprocessing/Effects/ColorAdjustments.ts +1 -1
- package/src/engine-components/postprocessing/Effects/Pixelation.ts +1 -1
- package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.ts +1 -1
- package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.ts +1 -1
- package/src/engine-components/postprocessing/Effects/Sharpening.ts +17 -7
- package/src/engine-components/postprocessing/Effects/TiltShiftEffect.ts +0 -1
- package/src/engine-components/postprocessing/Effects/Tonemapping.ts +1 -1
- package/src/engine-components/postprocessing/Effects/Vignette.ts +1 -1
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +2 -3
- package/src/engine-components/webxr/Avatar.ts +3 -3
- package/src/engine-components/webxr/WebXR.ts +23 -14
- package/src/engine-components/webxr/WebXRImageTracking.ts +23 -8
- package/src/engine-components/webxr/WebXRRig.ts +15 -2
- package/src/engine-components-experimental/networking/PlayerSync.ts +18 -37
- package/src/needle-engine.ts +5 -5
package/dist/gltf-progressive.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { B as he, M as
|
|
2
|
-
import { D as
|
|
1
|
+
import { B as he, M as J, T as j, a as We, V as F, b as Se, S as ze, c as be, d as Ve, C as qe } from "./three.js";
|
|
2
|
+
import { D as Ke, K as Xe, G as Oe, M as Ye } from "./three-examples.js";
|
|
3
3
|
const Pe = "";
|
|
4
4
|
globalThis.GLTF_PROGRESSIVE_VERSION = Pe;
|
|
5
5
|
console.debug(`[gltf-progressive] version ${Pe}`);
|
|
6
6
|
let Z = "https://www.gstatic.com/draco/versioned/decoders/1.5.7/", ne = "https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";
|
|
7
|
-
const
|
|
8
|
-
fetch(
|
|
7
|
+
const He = Z, Je = ne, Qe = new URL(Z + "draco_decoder.js");
|
|
8
|
+
fetch(Qe, {
|
|
9
9
|
method: "GET",
|
|
10
10
|
headers: {
|
|
11
11
|
Range: "bytes=0-1"
|
|
12
12
|
}
|
|
13
13
|
}).catch((t) => {
|
|
14
|
-
Z ===
|
|
14
|
+
Z === He && (Z = "./include/draco/"), ne === Je && (ne = "./include/ktx2/");
|
|
15
15
|
}).finally(() => {
|
|
16
16
|
ke();
|
|
17
17
|
});
|
|
18
|
-
function
|
|
18
|
+
function gt(t) {
|
|
19
19
|
Z = t;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function pt(t) {
|
|
22
22
|
ne = t;
|
|
23
23
|
}
|
|
24
|
-
let
|
|
24
|
+
let Y, ge, H;
|
|
25
25
|
function ke() {
|
|
26
|
-
|
|
26
|
+
Y || (Y = new Ke(), Y.setDecoderPath(Z), Y.setDecoderConfig({ type: "js" }), Y.preload()), H || (H = new Xe(), H.setTranscoderPath(ne), H.init()), ge || (ge = Ye);
|
|
27
27
|
}
|
|
28
28
|
function Be(t) {
|
|
29
|
-
return ke(), t ?
|
|
29
|
+
return ke(), t ? H.detectSupport(t) : t !== null && console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures might fail"), { dracoLoader: Y, ktx2Loader: H, meshoptDecoder: ge };
|
|
30
30
|
}
|
|
31
31
|
function Re(t) {
|
|
32
|
-
t.dracoLoader || t.setDRACOLoader(
|
|
32
|
+
t.dracoLoader || t.setDRACOLoader(Y), t.ktx2Loader || t.setKTX2Loader(H), t.meshoptDecoder || t.setMeshoptDecoder(ge);
|
|
33
33
|
}
|
|
34
34
|
const Me = /* @__PURE__ */ new WeakMap();
|
|
35
35
|
function Ie(t, e) {
|
|
@@ -37,7 +37,7 @@ function Ie(t, e) {
|
|
|
37
37
|
s ? s = Object.assign(s, e) : s = e, Me.set(t, s);
|
|
38
38
|
}
|
|
39
39
|
const Le = Oe.prototype.load;
|
|
40
|
-
function
|
|
40
|
+
function Ze(...t) {
|
|
41
41
|
const e = Me.get(this);
|
|
42
42
|
let s = t[0];
|
|
43
43
|
const n = new URL(s, window.location.href);
|
|
@@ -47,7 +47,7 @@ function je(...t) {
|
|
|
47
47
|
}
|
|
48
48
|
return t[0] = s, Le == null ? void 0 : Le.call(this, ...t);
|
|
49
49
|
}
|
|
50
|
-
Oe.prototype.load =
|
|
50
|
+
Oe.prototype.load = Ze;
|
|
51
51
|
oe("debugprogressive");
|
|
52
52
|
function oe(t) {
|
|
53
53
|
if (typeof window > "u")
|
|
@@ -55,7 +55,7 @@ function oe(t) {
|
|
|
55
55
|
const s = new URL(window.location.href).searchParams.get(t);
|
|
56
56
|
return s == null || s === "0" || s === "false" ? !1 : s === "" ? !0 : s;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function je(t, e) {
|
|
59
59
|
if (e === void 0 || e.startsWith("./") || e.startsWith("http") || t === void 0)
|
|
60
60
|
return e;
|
|
61
61
|
const s = t.lastIndexOf("/");
|
|
@@ -68,25 +68,25 @@ function et(t, e) {
|
|
|
68
68
|
return e;
|
|
69
69
|
}
|
|
70
70
|
let ee;
|
|
71
|
-
function
|
|
71
|
+
function et() {
|
|
72
72
|
return ee !== void 0 || (ee = /iPhone|iPad|iPod|Android|IEMobile/i.test(navigator.userAgent), oe("debugprogressive") && console.log("[glTF Progressive]: isMobileDevice", ee)), ee;
|
|
73
73
|
}
|
|
74
|
-
const
|
|
74
|
+
const tt = typeof window > "u" && typeof document > "u", De = Symbol("needle:raycast-mesh");
|
|
75
75
|
function ae(t) {
|
|
76
76
|
return (t == null ? void 0 : t[De]) instanceof he ? t[De] : null;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function st(t, e) {
|
|
79
79
|
if ((t.type === "Mesh" || t.type === "SkinnedMesh") && !ae(t)) {
|
|
80
|
-
const n =
|
|
80
|
+
const n = it(e);
|
|
81
81
|
n.userData = { isRaycastMesh: !0 }, t[De] = n;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function rt(t = !0) {
|
|
85
85
|
if (t) {
|
|
86
86
|
if (te)
|
|
87
87
|
return;
|
|
88
|
-
const e = te =
|
|
89
|
-
|
|
88
|
+
const e = te = J.prototype.raycast;
|
|
89
|
+
J.prototype.raycast = function(s, n) {
|
|
90
90
|
const i = this, r = ae(i);
|
|
91
91
|
let o;
|
|
92
92
|
r && i.isMesh && (o = i.geometry, i.geometry = r), e.call(this, s, n), o && (i.geometry = o);
|
|
@@ -94,43 +94,40 @@ function it(t = !0) {
|
|
|
94
94
|
} else {
|
|
95
95
|
if (!te)
|
|
96
96
|
return;
|
|
97
|
-
|
|
97
|
+
J.prototype.raycast = te, te = null;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
let te = null;
|
|
101
|
-
function
|
|
101
|
+
function it(t) {
|
|
102
102
|
const e = new he();
|
|
103
103
|
for (const s in t.attributes)
|
|
104
104
|
e.setAttribute(s, t.getAttribute(s));
|
|
105
105
|
return e.setIndex(t.getIndex()), e;
|
|
106
106
|
}
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
107
|
+
const K = new Array(), $ = "NEEDLE_progressive", p = oe("debugprogressive"), _e = Symbol("needle-progressive-texture"), ie = /* @__PURE__ */ new Map(), ve = /* @__PURE__ */ new Set();
|
|
108
|
+
if (p) {
|
|
109
109
|
let t = function() {
|
|
110
110
|
e += 1, console.log("Toggle LOD level", e, ie), ie.forEach((i, r) => {
|
|
111
111
|
for (const o of i.keys) {
|
|
112
112
|
const a = r[o];
|
|
113
|
-
if (a != null)
|
|
113
|
+
if (a != null)
|
|
114
114
|
if (a.isBufferGeometry === !0) {
|
|
115
|
-
const c =
|
|
116
|
-
r["DEBUG:LOD"] =
|
|
117
|
-
} else
|
|
118
|
-
r["DEBUG:LOD"] = e
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
115
|
+
const c = A.getMeshLODInformation(a), l = c ? Math.min(e, c.lods.length) : 0;
|
|
116
|
+
r["DEBUG:LOD"] = l, c && (s = Math.max(s, c.lods.length - 1));
|
|
117
|
+
} else
|
|
118
|
+
r.isMaterial === !0 && (r["DEBUG:LOD"] = e);
|
|
122
119
|
}
|
|
123
120
|
}), e >= s && (e = -1);
|
|
124
121
|
}, e = -1, s = 2, n = !1;
|
|
125
122
|
window.addEventListener("keyup", (i) => {
|
|
126
|
-
i.key === "p" && t(), i.key === "w" && (n = !n,
|
|
123
|
+
i.key === "p" && t(), i.key === "w" && (n = !n, ve && ve.forEach((r) => {
|
|
127
124
|
r.name != "BackgroundCubeMaterial" && r.glyphMap == null && "wireframe" in r && (r.wireframe = n);
|
|
128
125
|
}));
|
|
129
126
|
});
|
|
130
127
|
}
|
|
131
128
|
function Ee(t, e, s) {
|
|
132
129
|
var i;
|
|
133
|
-
if (!
|
|
130
|
+
if (!p)
|
|
134
131
|
return;
|
|
135
132
|
ie.has(t) || ie.set(t, { keys: [], sourceId: s });
|
|
136
133
|
const n = ie.get(t);
|
|
@@ -142,16 +139,16 @@ const D = class {
|
|
|
142
139
|
var i, r;
|
|
143
140
|
if (this._isLoadingMesh)
|
|
144
141
|
return null;
|
|
145
|
-
const n = (r = (i = this.parser.json.meshes[s]) == null ? void 0 : i.extensions) == null ? void 0 : r[
|
|
142
|
+
const n = (r = (i = this.parser.json.meshes[s]) == null ? void 0 : i.extensions) == null ? void 0 : r[$];
|
|
146
143
|
return n ? (this._isLoadingMesh = !0, this.parser.getDependency("mesh", s).then((o) => {
|
|
147
144
|
var a;
|
|
148
145
|
return this._isLoadingMesh = !1, o && D.registerMesh(this.url, n.guid, o, (a = n.lods) == null ? void 0 : a.length, void 0, n), o;
|
|
149
146
|
})) : null;
|
|
150
|
-
},
|
|
147
|
+
}, p && console.log("Progressive extension registered for", e), this.parser = t, this.url = e;
|
|
151
148
|
}
|
|
152
149
|
/** The name of the extension */
|
|
153
150
|
get name() {
|
|
154
|
-
return
|
|
151
|
+
return $;
|
|
155
152
|
}
|
|
156
153
|
static getMeshLODInformation(t) {
|
|
157
154
|
const e = this.getAssignedLODInformation(t);
|
|
@@ -170,7 +167,7 @@ const D = class {
|
|
|
170
167
|
this.getMaterialMinMaxLODsCount(o, e);
|
|
171
168
|
return t[n] = e, e;
|
|
172
169
|
}
|
|
173
|
-
if (
|
|
170
|
+
if (p === "verbose" && console.log("getMaterialMinMaxLODsCount", t), t.type === "ShaderMaterial" || t.type === "RawShaderMaterial") {
|
|
174
171
|
const o = t;
|
|
175
172
|
for (const a of Object.keys(o.uniforms)) {
|
|
176
173
|
const c = o.uniforms[a].value;
|
|
@@ -249,21 +246,21 @@ const D = class {
|
|
|
249
246
|
var s;
|
|
250
247
|
if (!t)
|
|
251
248
|
return Promise.resolve(null);
|
|
252
|
-
if (t instanceof
|
|
249
|
+
if (t instanceof J || t.isMesh === !0) {
|
|
253
250
|
const n = t.geometry, i = this.getAssignedLODInformation(n);
|
|
254
251
|
if (!i)
|
|
255
252
|
return Promise.resolve(null);
|
|
256
|
-
for (const r of
|
|
253
|
+
for (const r of K)
|
|
257
254
|
(s = r.onBeforeGetLODMesh) == null || s.call(r, t, e);
|
|
258
255
|
return t["LOD:requested level"] = e, D.getOrLoadLOD(n, e).then((r) => {
|
|
259
256
|
if (Array.isArray(r)) {
|
|
260
257
|
const o = i.index || 0;
|
|
261
258
|
r = r[o];
|
|
262
259
|
}
|
|
263
|
-
return t["LOD:requested level"] === e && (delete t["LOD:requested level"], r && n != r && ((r == null ? void 0 : r.isBufferGeometry) ? (t.geometry = r,
|
|
260
|
+
return t["LOD:requested level"] === e && (delete t["LOD:requested level"], r && n != r && ((r == null ? void 0 : r.isBufferGeometry) ? (t.geometry = r, p && Ee(t, "geometry", i.url)) : p && console.error("Invalid LOD geometry", r))), r;
|
|
264
261
|
}).catch((r) => (console.error("Error loading mesh LOD", t, r), null));
|
|
265
262
|
} else
|
|
266
|
-
|
|
263
|
+
p && console.error("Invalid call to assignMeshLOD: Request mesh LOD but the object is not a mesh", t);
|
|
267
264
|
return Promise.resolve(null);
|
|
268
265
|
}
|
|
269
266
|
static assignTextureLOD(t, e = 0) {
|
|
@@ -286,9 +283,9 @@ const D = class {
|
|
|
286
283
|
} else
|
|
287
284
|
return this.assignTextureLOD(s.material, e);
|
|
288
285
|
}
|
|
289
|
-
if (t
|
|
286
|
+
if (t.isMaterial === !0) {
|
|
290
287
|
const s = t, n = [], i = new Array();
|
|
291
|
-
if (
|
|
288
|
+
if (p && ve.add(s), s.uniforms && (s.isRawShaderMaterial || s.isShaderMaterial === !0)) {
|
|
292
289
|
const r = s;
|
|
293
290
|
for (const o of Object.keys(r.uniforms)) {
|
|
294
291
|
const a = r.uniforms[o].value;
|
|
@@ -328,33 +325,33 @@ const D = class {
|
|
|
328
325
|
if (i != t) {
|
|
329
326
|
if (s && n) {
|
|
330
327
|
const r = s[n];
|
|
331
|
-
if (r) {
|
|
328
|
+
if (r && !p) {
|
|
332
329
|
const o = this.getAssignedLODInformation(r);
|
|
333
330
|
if (o && (o == null ? void 0 : o.level) < e)
|
|
334
|
-
return
|
|
331
|
+
return p === "verbose" && console.warn("Assigned texture level is already higher: ", o.level, e, s, r, i), null;
|
|
335
332
|
}
|
|
336
333
|
s[n] = i;
|
|
337
334
|
}
|
|
338
|
-
if (
|
|
335
|
+
if (p && n && s) {
|
|
339
336
|
const r = this.getAssignedLODInformation(t);
|
|
340
|
-
r
|
|
337
|
+
r ? Ee(s, n, r.url) : console.warn("No LOD info for texture", t);
|
|
341
338
|
}
|
|
342
339
|
}
|
|
343
340
|
return i;
|
|
344
341
|
} else
|
|
345
|
-
|
|
342
|
+
p == "verbose" && console.warn("No LOD found for", t, e);
|
|
346
343
|
return null;
|
|
347
344
|
}).catch((i) => (console.error("Error loading LOD", t, i), null));
|
|
348
345
|
}
|
|
349
346
|
afterRoot(t) {
|
|
350
347
|
var e, s;
|
|
351
|
-
return
|
|
348
|
+
return p && console.log("AFTER", this.url, t), (e = this.parser.json.textures) == null || e.forEach((n, i) => {
|
|
352
349
|
var r;
|
|
353
350
|
if (n != null && n.extensions) {
|
|
354
|
-
const o = n == null ? void 0 : n.extensions[
|
|
351
|
+
const o = n == null ? void 0 : n.extensions[$];
|
|
355
352
|
if (o) {
|
|
356
353
|
if (!o.lods) {
|
|
357
|
-
|
|
354
|
+
p && console.warn("Texture has no LODs", o);
|
|
358
355
|
return;
|
|
359
356
|
}
|
|
360
357
|
let a = !1;
|
|
@@ -371,7 +368,7 @@ const D = class {
|
|
|
371
368
|
}
|
|
372
369
|
}), (s = this.parser.json.meshes) == null || s.forEach((n, i) => {
|
|
373
370
|
if (n != null && n.extensions) {
|
|
374
|
-
const r = n == null ? void 0 : n.extensions[
|
|
371
|
+
const r = n == null ? void 0 : n.extensions[$];
|
|
375
372
|
if (r && r.lods) {
|
|
376
373
|
for (const o of this.parser.associations.keys())
|
|
377
374
|
if (o.isMesh) {
|
|
@@ -384,7 +381,7 @@ const D = class {
|
|
|
384
381
|
}
|
|
385
382
|
static async getOrLoadLOD(t, e) {
|
|
386
383
|
var o, a, c, l;
|
|
387
|
-
const s =
|
|
384
|
+
const s = p == "verbose", n = t.userData.LODS;
|
|
388
385
|
if (!n)
|
|
389
386
|
return null;
|
|
390
387
|
const i = n == null ? void 0 : n.key;
|
|
@@ -395,107 +392,107 @@ const D = class {
|
|
|
395
392
|
}
|
|
396
393
|
if (r || (r = D.lodInfos.get(i)), r) {
|
|
397
394
|
if (e > 0) {
|
|
398
|
-
let
|
|
395
|
+
let x = !1;
|
|
399
396
|
const L = Array.isArray(r.lods);
|
|
400
|
-
if (L && e >= r.lods.length ?
|
|
397
|
+
if (L && e >= r.lods.length ? x = !0 : L || (x = !0), x)
|
|
401
398
|
return this.lowresCache.get(i);
|
|
402
399
|
}
|
|
403
400
|
const d = Array.isArray(r.lods) ? (o = r.lods[e]) == null ? void 0 : o.path : r.lods;
|
|
404
401
|
if (!d)
|
|
405
|
-
return
|
|
406
|
-
const h =
|
|
402
|
+
return p && !r["missing:uri"] && (r["missing:uri"] = !0, console.warn("Missing uri for progressive asset for LOD " + e, r)), null;
|
|
403
|
+
const h = je(n.url, d);
|
|
407
404
|
if (h.endsWith(".glb") || h.endsWith(".gltf")) {
|
|
408
405
|
if (!r.guid)
|
|
409
406
|
return console.warn("missing pointer for glb/gltf texture", r), null;
|
|
410
|
-
const
|
|
407
|
+
const x = h + "_" + r.guid, L = this.previouslyLoaded.get(x);
|
|
411
408
|
if (L !== void 0) {
|
|
412
|
-
s && console.log(`LOD ${e} was already loading/loaded: ${
|
|
409
|
+
s && console.log(`LOD ${e} was already loading/loaded: ${x}`);
|
|
413
410
|
let f = await L.catch((I) => (console.error(`Error loading LOD ${e} from ${h}
|
|
414
411
|
`, I), null)), w = !1;
|
|
415
|
-
if (f == null || (f instanceof j && t instanceof j ? (a = f.image) != null && a.data || (c = f.source) != null && c.data ? f = this.copySettings(t, f) : (w = !0, this.previouslyLoaded.delete(
|
|
412
|
+
if (f == null || (f instanceof j && t instanceof j ? (a = f.image) != null && a.data || (c = f.source) != null && c.data ? f = this.copySettings(t, f) : (w = !0, this.previouslyLoaded.delete(x)) : f instanceof he && t instanceof he && ((l = f.attributes.position) != null && l.array || (w = !0, this.previouslyLoaded.delete(x)))), !w)
|
|
416
413
|
return f;
|
|
417
414
|
}
|
|
418
415
|
const M = r, P = new Promise(async (f, w) => {
|
|
419
416
|
const I = new Oe();
|
|
420
|
-
Re(I),
|
|
417
|
+
Re(I), p && (await new Promise((O) => setTimeout(O, 1e3)), s && console.warn("Start loading (delayed) " + h, M.guid));
|
|
421
418
|
let k = h;
|
|
422
419
|
if (M && Array.isArray(M.lods)) {
|
|
423
|
-
const
|
|
424
|
-
|
|
420
|
+
const O = M.lods[e];
|
|
421
|
+
O.hash && (k += "?v=" + O.hash);
|
|
425
422
|
}
|
|
426
|
-
const
|
|
427
|
-
`,
|
|
428
|
-
if (!
|
|
423
|
+
const E = await I.loadAsync(k).catch((O) => (console.error(`Error loading LOD ${e} from ${h}
|
|
424
|
+
`, O), null));
|
|
425
|
+
if (!E)
|
|
429
426
|
return null;
|
|
430
|
-
const
|
|
427
|
+
const G = E.parser;
|
|
431
428
|
s && console.log("Loading finished " + h, M.guid);
|
|
432
|
-
let
|
|
433
|
-
if (
|
|
434
|
-
let
|
|
435
|
-
for (const u of
|
|
429
|
+
let v = 0;
|
|
430
|
+
if (E.parser.json.textures) {
|
|
431
|
+
let O = !1;
|
|
432
|
+
for (const u of E.parser.json.textures) {
|
|
436
433
|
if (u != null && u.extensions) {
|
|
437
|
-
const g = u == null ? void 0 : u.extensions[
|
|
434
|
+
const g = u == null ? void 0 : u.extensions[$];
|
|
438
435
|
if (g != null && g.guid && g.guid === M.guid) {
|
|
439
|
-
|
|
436
|
+
O = !0;
|
|
440
437
|
break;
|
|
441
438
|
}
|
|
442
439
|
}
|
|
443
|
-
|
|
440
|
+
v++;
|
|
444
441
|
}
|
|
445
|
-
if (
|
|
446
|
-
let u = await
|
|
447
|
-
return u && D.assignLODInformation(n.url, u, i, e, void 0, void 0), s && console.log('change "' + t.name + '" → "' + u.name + '"', h,
|
|
442
|
+
if (O) {
|
|
443
|
+
let u = await G.getDependency("texture", v);
|
|
444
|
+
return u && D.assignLODInformation(n.url, u, i, e, void 0, void 0), s && console.log('change "' + t.name + '" → "' + u.name + '"', h, v, u, x), t instanceof j && (u = this.copySettings(t, u)), u && (u.guid = M.guid), f(u);
|
|
448
445
|
} else
|
|
449
|
-
|
|
446
|
+
p && console.warn("Could not find texture with guid", M.guid, E.parser.json);
|
|
450
447
|
}
|
|
451
|
-
if (
|
|
452
|
-
let
|
|
453
|
-
for (const u of
|
|
448
|
+
if (v = 0, E.parser.json.meshes) {
|
|
449
|
+
let O = !1;
|
|
450
|
+
for (const u of E.parser.json.meshes) {
|
|
454
451
|
if (u != null && u.extensions) {
|
|
455
|
-
const g = u == null ? void 0 : u.extensions[
|
|
452
|
+
const g = u == null ? void 0 : u.extensions[$];
|
|
456
453
|
if (g != null && g.guid && g.guid === M.guid) {
|
|
457
|
-
|
|
454
|
+
O = !0;
|
|
458
455
|
break;
|
|
459
456
|
}
|
|
460
457
|
}
|
|
461
|
-
|
|
458
|
+
v++;
|
|
462
459
|
}
|
|
463
|
-
if (
|
|
464
|
-
const u = await
|
|
465
|
-
if (s && console.log(`Loaded Mesh "${u.name}"`, h,
|
|
460
|
+
if (O) {
|
|
461
|
+
const u = await G.getDependency("mesh", v), g = M;
|
|
462
|
+
if (s && console.log(`Loaded Mesh "${u.name}"`, h, v, u, x), u.isMesh === !0) {
|
|
466
463
|
const _ = u.geometry;
|
|
467
464
|
return D.assignLODInformation(n.url, _, i, e, void 0, g.density), f(_);
|
|
468
465
|
} else {
|
|
469
466
|
const _ = new Array();
|
|
470
|
-
for (let
|
|
471
|
-
const
|
|
472
|
-
if (
|
|
473
|
-
const W =
|
|
474
|
-
D.assignLODInformation(n.url, W, i, e,
|
|
467
|
+
for (let S = 0; S < u.children.length; S++) {
|
|
468
|
+
const T = u.children[S];
|
|
469
|
+
if (T.isMesh === !0) {
|
|
470
|
+
const W = T.geometry;
|
|
471
|
+
D.assignLODInformation(n.url, W, i, e, S, g.density), _.push(W);
|
|
475
472
|
}
|
|
476
473
|
}
|
|
477
474
|
return f(_);
|
|
478
475
|
}
|
|
479
476
|
} else
|
|
480
|
-
|
|
477
|
+
p && console.warn("Could not find mesh with guid", M.guid, E.parser.json);
|
|
481
478
|
}
|
|
482
479
|
return f(null);
|
|
483
480
|
});
|
|
484
|
-
return this.previouslyLoaded.set(
|
|
481
|
+
return this.previouslyLoaded.set(x, P), await P;
|
|
485
482
|
} else if (t instanceof j) {
|
|
486
483
|
s && console.log("Load texture from uri: " + h);
|
|
487
|
-
const L = await new
|
|
488
|
-
return L ? (L.guid = r.guid, L.flipY = !1, L.needsUpdate = !0, L.colorSpace = t.colorSpace, s && console.log(r, L)) :
|
|
484
|
+
const L = await new We().loadAsync(h);
|
|
485
|
+
return L ? (L.guid = r.guid, L.flipY = !1, L.needsUpdate = !0, L.colorSpace = t.colorSpace, s && console.log(r, L)) : p && console.warn("failed loading", h), L;
|
|
489
486
|
}
|
|
490
487
|
} else
|
|
491
|
-
|
|
488
|
+
p && console.warn(`Can not load LOD ${e}: no LOD info found for "${i}" ${t.name}`, t.type);
|
|
492
489
|
return null;
|
|
493
490
|
}
|
|
494
491
|
static assignLODInformation(t, e, s, n, i, r) {
|
|
495
492
|
if (!e)
|
|
496
493
|
return;
|
|
497
494
|
e.userData || (e.userData = {});
|
|
498
|
-
const o = new
|
|
495
|
+
const o = new nt(t, s, n, i, r);
|
|
499
496
|
e.userData.LODS = o;
|
|
500
497
|
}
|
|
501
498
|
static getAssignedLODInformation(t) {
|
|
@@ -504,39 +501,39 @@ const D = class {
|
|
|
504
501
|
}
|
|
505
502
|
// private static readonly _copiedTextures: WeakMap<Texture, Texture> = new Map();
|
|
506
503
|
static copySettings(t, e) {
|
|
507
|
-
return
|
|
504
|
+
return p && console.warn(`Copy texture settings
|
|
508
505
|
`, t.uuid, `
|
|
509
|
-
`, e.uuid), e.offset = t.offset, e.repeat = t.repeat, e.colorSpace = t.colorSpace, e.magFilter = t.magFilter, e.minFilter = t.minFilter, e.wrapS = t.wrapS, e.wrapT = t.wrapT, e.flipY = t.flipY, e.anisotropy = t.anisotropy, e.mipmaps || (e.generateMipmaps = t.generateMipmaps), e;
|
|
506
|
+
`, e.uuid), e = e.clone(), e.offset = t.offset, e.repeat = t.repeat, e.colorSpace = t.colorSpace, e.magFilter = t.magFilter, e.minFilter = t.minFilter, e.wrapS = t.wrapS, e.wrapT = t.wrapT, e.flipY = t.flipY, e.anisotropy = t.anisotropy, e.mipmaps || (e.generateMipmaps = t.generateMipmaps), e;
|
|
510
507
|
}
|
|
511
508
|
};
|
|
512
|
-
let
|
|
513
|
-
|
|
514
|
-
if (
|
|
515
|
-
|
|
509
|
+
let A = D;
|
|
510
|
+
A.registerTexture = (t, e, s, n, i) => {
|
|
511
|
+
if (p && console.log("> Progressive: register texture", n, e.name, e.uuid, e, i), !e) {
|
|
512
|
+
p && console.error("gltf-progressive: Register texture without texture");
|
|
516
513
|
return;
|
|
517
514
|
}
|
|
518
515
|
e.source && (e.source[_e] = i);
|
|
519
516
|
const r = i.guid;
|
|
520
517
|
D.assignLODInformation(t, e, r, s, n, void 0), D.lodInfos.set(r, i), D.lowresCache.set(r, e);
|
|
521
518
|
};
|
|
522
|
-
|
|
519
|
+
A.registerMesh = (t, e, s, n, i, r) => {
|
|
523
520
|
var c;
|
|
524
|
-
|
|
521
|
+
p && console.log("> Progressive: register mesh", i, s.name, r, s.uuid, s);
|
|
525
522
|
const o = s.geometry;
|
|
526
523
|
if (!o) {
|
|
527
|
-
|
|
524
|
+
p && console.warn("gltf-progressive: Register mesh without geometry");
|
|
528
525
|
return;
|
|
529
526
|
}
|
|
530
527
|
o.userData || (o.userData = {}), D.assignLODInformation(t, o, e, n, i, r.density), D.lodInfos.set(e, r);
|
|
531
528
|
let a = D.lowresCache.get(e);
|
|
532
|
-
a ? a.push(s.geometry) : a = [s.geometry], D.lowresCache.set(e, a), n > 0 && !ae(s) &&
|
|
533
|
-
for (const l of
|
|
529
|
+
a ? a.push(s.geometry) : a = [s.geometry], D.lowresCache.set(e, a), n > 0 && !ae(s) && st(s, o);
|
|
530
|
+
for (const l of K)
|
|
534
531
|
(c = l.onRegisteredNewMesh) == null || c.call(l, s, r);
|
|
535
532
|
};
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
class
|
|
533
|
+
A.lodInfos = /* @__PURE__ */ new Map();
|
|
534
|
+
A.previouslyLoaded = /* @__PURE__ */ new Map();
|
|
535
|
+
A.lowresCache = /* @__PURE__ */ new Map();
|
|
536
|
+
class nt {
|
|
540
537
|
constructor(e, s, n, i, r) {
|
|
541
538
|
this.url = e, this.key = s, this.level = n, i != null && (this.index = i), r != null && (this.density = r);
|
|
542
539
|
}
|
|
@@ -544,26 +541,26 @@ class ot {
|
|
|
544
541
|
var Ge = (t, e, s) => {
|
|
545
542
|
if (!e.has(t))
|
|
546
543
|
throw TypeError("Cannot " + s);
|
|
547
|
-
},
|
|
544
|
+
}, y = (t, e, s) => (Ge(t, e, "read from private field"), s ? s.call(t) : e.get(t)), X = (t, e, s) => {
|
|
548
545
|
if (e.has(t))
|
|
549
546
|
throw TypeError("Cannot add the same private member more than once");
|
|
550
547
|
e instanceof WeakSet ? e.add(t) : e.set(t, s);
|
|
551
|
-
},
|
|
552
|
-
const B = oe("debugprogressive"),
|
|
548
|
+
}, N = (t, e, s, n) => (Ge(t, e, "write to private field"), n ? n.call(t, s) : e.set(t, s), s), b, V, we, Q, re, de, q;
|
|
549
|
+
const B = oe("debugprogressive"), ot = oe("noprogressive"), me = Symbol("Needle:LODSManager"), xe = Symbol("Needle:LODState"), z = Symbol("Needle:CurrentLOD"), R = { mesh_lod: -1, texture_lod: -1 }, C = class {
|
|
553
550
|
// readonly plugins: NEEDLE_progressive_plugin[] = [];
|
|
554
551
|
constructor(t, e) {
|
|
555
|
-
this.projectionScreenMatrix = new Se(), this.targetTriangleDensity = 2e5, this.updateInterval = "auto",
|
|
552
|
+
this.projectionScreenMatrix = new Se(), this.targetTriangleDensity = 2e5, this.updateInterval = "auto", X(this, b, 1), this.pause = !1, this.manual = !1, this._lodchangedlisteners = [], X(this, V, void 0), X(this, we, new qe()), X(this, Q, 0), X(this, re, 0), X(this, de, 0), X(this, q, 0), this._fpsBuffer = [60, 60, 60, 60, 60], this._sphere = new ze(), this._tempBox = new be(), this._tempBox2 = new be(), this.tempMatrix = new Se(), this._tempWorldPosition = new F(), this._tempBoxSize = new F(), this._tempBox2Size = new F(), this.renderer = t, this.context = { ...e };
|
|
556
553
|
}
|
|
557
554
|
/** @internal */
|
|
558
555
|
static getObjectLODState(t) {
|
|
559
556
|
return t[xe];
|
|
560
557
|
}
|
|
561
558
|
static addPlugin(t) {
|
|
562
|
-
|
|
559
|
+
K.push(t);
|
|
563
560
|
}
|
|
564
561
|
static removePlugin(t) {
|
|
565
|
-
const e =
|
|
566
|
-
e >= 0 &&
|
|
562
|
+
const e = K.indexOf(t);
|
|
563
|
+
e >= 0 && K.splice(e, 1);
|
|
567
564
|
}
|
|
568
565
|
/**
|
|
569
566
|
* Gets the LODsManager for the given renderer. If the LODsManager does not exist yet, it will be created.
|
|
@@ -581,7 +578,7 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
|
|
|
581
578
|
}
|
|
582
579
|
/** @deprecated use static `LODsManager.addPlugin()` method. This getter will be removed in later versions */
|
|
583
580
|
get plugins() {
|
|
584
|
-
return
|
|
581
|
+
return K;
|
|
585
582
|
}
|
|
586
583
|
addEventListener(t, e) {
|
|
587
584
|
t === "changed" && this._lodchangedlisteners.push(e);
|
|
@@ -596,21 +593,21 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
|
|
|
596
593
|
* Enable the LODsManager. This will replace the render method of the renderer with a method that updates the LODs.
|
|
597
594
|
*/
|
|
598
595
|
enable() {
|
|
599
|
-
if (
|
|
596
|
+
if (y(this, V))
|
|
600
597
|
return;
|
|
601
598
|
console.debug("[gltf-progressive] Enabling LODsManager for renderer");
|
|
602
599
|
let t = 0;
|
|
603
|
-
|
|
600
|
+
N(this, V, this.renderer.render);
|
|
604
601
|
const e = this;
|
|
605
602
|
Be(this.renderer), this.renderer.render = function(s, n) {
|
|
606
603
|
const i = e.renderer.getRenderTarget();
|
|
607
|
-
(i == null || "isXRRenderTarget" in i && i.isXRRenderTarget) && (t = 0,
|
|
604
|
+
(i == null || "isXRRenderTarget" in i && i.isXRRenderTarget) && (t = 0, N(e, Q, y(e, Q) + 1), N(e, re, y(e, we).getDelta()), N(e, de, y(e, de) + y(e, re)), e._fpsBuffer.shift(), e._fpsBuffer.push(1 / y(e, re)), N(e, q, e._fpsBuffer.reduce((o, a) => o + a) / e._fpsBuffer.length), B && y(e, Q) % 200 === 0 && console.log("FPS", Math.round(y(e, q)), "Interval:", y(e, b)));
|
|
608
605
|
const r = t++;
|
|
609
|
-
|
|
606
|
+
y(e, V).call(this, s, n), e.onAfterRender(s, n, r);
|
|
610
607
|
};
|
|
611
608
|
}
|
|
612
609
|
disable() {
|
|
613
|
-
|
|
610
|
+
y(this, V) && (console.debug("[gltf-progressive] Disabling LODsManager for renderer"), this.renderer.render = y(this, V), N(this, V, void 0));
|
|
614
611
|
}
|
|
615
612
|
update(t, e) {
|
|
616
613
|
this.internalUpdate(t, e);
|
|
@@ -625,7 +622,7 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
|
|
|
625
622
|
(o.name === "EffectMaterial" || o.name === "CopyShader") && (r = !1);
|
|
626
623
|
}
|
|
627
624
|
if ((e.parent && e.parent.type === "CubeCamera" || s >= 1 && e.type === "OrthographicCamera") && (r = !1), r) {
|
|
628
|
-
if (
|
|
625
|
+
if (ot || (this.updateInterval === "auto" ? y(this, q) < 40 && y(this, b) < 10 ? (N(this, b, y(this, b) + 1), B && console.warn("↓ Reducing LOD updates", y(this, b), y(this, q).toFixed(0))) : y(this, q) >= 60 && y(this, b) > 1 && (N(this, b, y(this, b) - 1), B && console.warn("↑ Increasing LOD updates", y(this, b), y(this, q).toFixed(0))) : N(this, b, this.updateInterval), y(this, b) > 0 && y(this, Q) % y(this, b) != 0))
|
|
629
626
|
return;
|
|
630
627
|
this.internalUpdate(t, e);
|
|
631
628
|
}
|
|
@@ -654,21 +651,21 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
|
|
|
654
651
|
}
|
|
655
652
|
if (B === "color" && l.material && !l.object.progressive_debug_color) {
|
|
656
653
|
l.object.progressive_debug_color = !0;
|
|
657
|
-
const h = Math.random() * 16777215,
|
|
658
|
-
l.object.material =
|
|
654
|
+
const h = Math.random() * 16777215, x = new Ve({ color: h });
|
|
655
|
+
l.object.material = x;
|
|
659
656
|
}
|
|
660
657
|
const d = l.object;
|
|
661
|
-
(d instanceof
|
|
658
|
+
(d instanceof J || d.isMesh) && this.updateLODs(t, e, d, i);
|
|
662
659
|
}
|
|
663
660
|
const r = s.transparent;
|
|
664
661
|
for (const l of r) {
|
|
665
662
|
const d = l.object;
|
|
666
|
-
(d instanceof
|
|
663
|
+
(d instanceof J || d.isMesh) && this.updateLODs(t, e, d, i);
|
|
667
664
|
}
|
|
668
665
|
const o = s.transmissive;
|
|
669
666
|
for (const l of o) {
|
|
670
667
|
const d = l.object;
|
|
671
|
-
(d instanceof
|
|
668
|
+
(d instanceof J || d.isMesh) && this.updateLODs(t, e, d, i);
|
|
672
669
|
}
|
|
673
670
|
}
|
|
674
671
|
/** Update the LOD levels for the renderer. */
|
|
@@ -676,17 +673,14 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
|
|
|
676
673
|
var o, a;
|
|
677
674
|
s.userData || (s.userData = {});
|
|
678
675
|
let i = s[xe];
|
|
679
|
-
if (i || (i = new
|
|
676
|
+
if (i || (i = new at(), s[xe] = i), i.frames++ < 2)
|
|
680
677
|
return;
|
|
681
|
-
for (const c of
|
|
678
|
+
for (const c of K)
|
|
682
679
|
(o = c.onBeforeUpdateLOD) == null || o.call(c, this.renderer, t, e, s);
|
|
683
680
|
this.calculateLodLevel(e, s, i, n, R), R.mesh_lod = Math.round(R.mesh_lod), R.texture_lod = Math.round(R.texture_lod), R.mesh_lod >= 0 && this.loadProgressiveMeshes(s, R.mesh_lod);
|
|
684
681
|
let r = R.texture_lod;
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
c != null && (r = c), this.loadProgressiveTextures(s.material, r);
|
|
688
|
-
}
|
|
689
|
-
for (const c of q)
|
|
682
|
+
s.material && r >= 0 && this.loadProgressiveTextures(s.material, r);
|
|
683
|
+
for (const c of K)
|
|
690
684
|
(a = c.onAfterUpdatedLOD) == null || a.call(c, this.renderer, t, e, s, R);
|
|
691
685
|
i.lastLodLevel_Mesh = R.mesh_lod, i.lastLodLevel_Texture = R.texture_lod;
|
|
692
686
|
}
|
|
@@ -699,13 +693,15 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
|
|
|
699
693
|
if (!t)
|
|
700
694
|
return;
|
|
701
695
|
if (Array.isArray(t)) {
|
|
702
|
-
for (const
|
|
703
|
-
this.loadProgressiveTextures(
|
|
696
|
+
for (const i of t)
|
|
697
|
+
this.loadProgressiveTextures(i, e);
|
|
704
698
|
return;
|
|
705
699
|
}
|
|
706
700
|
let s = !1;
|
|
707
|
-
(t[
|
|
708
|
-
|
|
701
|
+
(t[z] === void 0 || e < t[z]) && (s = !0);
|
|
702
|
+
const n = t["DEBUG:LOD"];
|
|
703
|
+
n != null && (s = t[z] != n, e = n), s && (t[z] = e, A.assignTextureLOD(t, e).then((i) => {
|
|
704
|
+
this._lodchangedlisteners.forEach((r) => r({ type: "texture", level: e, object: t }));
|
|
709
705
|
}));
|
|
710
706
|
}
|
|
711
707
|
/** Load progressive meshes for the given mesh
|
|
@@ -717,10 +713,12 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
|
|
|
717
713
|
loadProgressiveMeshes(t, e) {
|
|
718
714
|
if (!t)
|
|
719
715
|
return Promise.resolve(null);
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
716
|
+
let s = t[z] !== e;
|
|
717
|
+
const n = t["DEBUG:LOD"];
|
|
718
|
+
if (n != null && (s = t[z] != n, e = n), s) {
|
|
719
|
+
t[z] = e;
|
|
720
|
+
const i = t.geometry;
|
|
721
|
+
return A.assignMeshLOD(t, e).then((r) => (r && t[z] == e && i != t.geometry && this._lodchangedlisteners.forEach((o) => o({ type: "mesh", level: e, object: t })), r));
|
|
724
722
|
}
|
|
725
723
|
return Promise.resolve(null);
|
|
726
724
|
}
|
|
@@ -741,8 +739,8 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
|
|
|
741
739
|
let o = 10 + 1, a = !1;
|
|
742
740
|
if (B && e["DEBUG:LOD"] != null)
|
|
743
741
|
return e["DEBUG:LOD"];
|
|
744
|
-
const c =
|
|
745
|
-
if (!d && !
|
|
742
|
+
const c = A.getMeshLODInformation(e.geometry), l = c == null ? void 0 : c.lods, d = l && l.length > 0, h = A.getMaterialMinMaxLODsCount(e.material), x = (h == null ? void 0 : h.min_count) != 1 / 0 && h.min_count > 0 && h.max_count > 0;
|
|
743
|
+
if (!d && !x) {
|
|
746
744
|
i.mesh_lod = 0, i.texture_lod = 0;
|
|
747
745
|
return;
|
|
748
746
|
}
|
|
@@ -750,17 +748,17 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
|
|
|
750
748
|
const L = this.renderer.domElement.clientHeight || this.renderer.domElement.height;
|
|
751
749
|
let M = e.geometry.boundingBox;
|
|
752
750
|
if (e.type === "SkinnedMesh") {
|
|
753
|
-
const
|
|
754
|
-
if (!
|
|
755
|
-
|
|
751
|
+
const m = e;
|
|
752
|
+
if (!m.boundingBox)
|
|
753
|
+
m.computeBoundingBox();
|
|
756
754
|
else if (s.frames % 30 === 0) {
|
|
757
|
-
const f = ae(
|
|
758
|
-
f && (
|
|
755
|
+
const f = ae(m), w = m.geometry;
|
|
756
|
+
f && (m.geometry = f), m.computeBoundingBox(), m.geometry = w;
|
|
759
757
|
}
|
|
760
|
-
M =
|
|
758
|
+
M = m.boundingBox;
|
|
761
759
|
}
|
|
762
|
-
if (M
|
|
763
|
-
const
|
|
760
|
+
if (M) {
|
|
761
|
+
const m = t;
|
|
764
762
|
if (e.geometry.attributes.color && e.geometry.attributes.color.count < 100 && e.geometry.boundingSphere) {
|
|
765
763
|
this._sphere.copy(e.geometry.boundingSphere), this._sphere.applyMatrix4(e.matrixWorld);
|
|
766
764
|
const u = t.getWorldPosition(this._tempWorldPosition);
|
|
@@ -769,48 +767,48 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
|
|
|
769
767
|
return;
|
|
770
768
|
}
|
|
771
769
|
}
|
|
772
|
-
if (this._tempBox.copy(M), this._tempBox.applyMatrix4(e.matrixWorld), C.isInside(this._tempBox, this.projectionScreenMatrix)) {
|
|
770
|
+
if (this._tempBox.copy(M), this._tempBox.applyMatrix4(e.matrixWorld), m.isPerspectiveCamera && C.isInside(this._tempBox, this.projectionScreenMatrix)) {
|
|
773
771
|
i.mesh_lod = 0, i.texture_lod = 0;
|
|
774
772
|
return;
|
|
775
773
|
}
|
|
776
|
-
if (this._tempBox.applyMatrix4(this.projectionScreenMatrix), this.renderer.xr.enabled &&
|
|
774
|
+
if (this._tempBox.applyMatrix4(this.projectionScreenMatrix), this.renderer.xr.enabled && m.isPerspectiveCamera && m.fov > 70) {
|
|
777
775
|
const u = this._tempBox.min, g = this._tempBox.max;
|
|
778
|
-
let _ = u.x,
|
|
776
|
+
let _ = u.x, S = u.y, T = g.x, W = g.y;
|
|
779
777
|
const le = 2, pe = 1.5, ce = (u.x + g.x) * 0.5, ue = (u.y + g.y) * 0.5;
|
|
780
|
-
_ = (_ - ce) * le + ce,
|
|
781
|
-
const Fe = _ < 0 &&
|
|
778
|
+
_ = (_ - ce) * le + ce, S = (S - ue) * le + ue, T = (T - ce) * le + ce, W = (W - ue) * le + ue;
|
|
779
|
+
const Fe = _ < 0 && T > 0 ? 0 : Math.min(Math.abs(u.x), Math.abs(g.x)), Ue = S < 0 && W > 0 ? 0 : Math.min(Math.abs(u.y), Math.abs(g.y)), ye = Math.max(Fe, Ue);
|
|
782
780
|
s.lastCentrality = (pe - ye) * (pe - ye) * (pe - ye);
|
|
783
781
|
} else
|
|
784
782
|
s.lastCentrality = 1;
|
|
785
783
|
const f = this._tempBox.getSize(this._tempBoxSize);
|
|
786
|
-
f.multiplyScalar(0.5), screen.availHeight > 0 && L > 0 && f.multiplyScalar(L / screen.availHeight), f.x *=
|
|
784
|
+
f.multiplyScalar(0.5), screen.availHeight > 0 && L > 0 && f.multiplyScalar(L / screen.availHeight), t.isPerspectiveCamera ? f.x *= t.aspect : t.isOrthographicCamera;
|
|
787
785
|
const w = t.matrixWorldInverse, I = this._tempBox2;
|
|
788
786
|
I.copy(M), I.applyMatrix4(e.matrixWorld), I.applyMatrix4(w);
|
|
789
|
-
const k = I.getSize(this._tempBox2Size),
|
|
790
|
-
if (Math.max(f.x, f.y) != 0 &&
|
|
787
|
+
const k = I.getSize(this._tempBox2Size), E = Math.max(k.x, k.y);
|
|
788
|
+
if (Math.max(f.x, f.y) != 0 && E != 0 && (f.z = k.z / Math.max(k.x, k.y) * Math.max(f.x, f.y)), s.lastScreenCoverage = Math.max(f.x, f.y, f.z), s.lastScreenspaceVolume.copy(f), s.lastScreenCoverage *= s.lastCentrality, B && C.debugDrawLine) {
|
|
791
789
|
const u = this.tempMatrix.copy(this.projectionScreenMatrix);
|
|
792
790
|
u.invert();
|
|
793
|
-
const g = C.corner0, _ = C.corner1,
|
|
794
|
-
g.copy(this._tempBox.min), _.copy(this._tempBox.max), _.x = g.x,
|
|
795
|
-
const W = (g.z +
|
|
796
|
-
g.z = _.z =
|
|
791
|
+
const g = C.corner0, _ = C.corner1, S = C.corner2, T = C.corner3;
|
|
792
|
+
g.copy(this._tempBox.min), _.copy(this._tempBox.max), _.x = g.x, S.copy(this._tempBox.max), S.y = g.y, T.copy(this._tempBox.max);
|
|
793
|
+
const W = (g.z + T.z) * 0.5;
|
|
794
|
+
g.z = _.z = S.z = T.z = W, g.applyMatrix4(u), _.applyMatrix4(u), S.applyMatrix4(u), T.applyMatrix4(u), C.debugDrawLine(g, _, 255), C.debugDrawLine(g, S, 255), C.debugDrawLine(_, T, 255), C.debugDrawLine(S, T, 255);
|
|
797
795
|
}
|
|
798
|
-
let
|
|
796
|
+
let v = 999;
|
|
799
797
|
if (l && s.lastScreenCoverage > 0) {
|
|
800
798
|
for (let u = 0; u < l.length; u++)
|
|
801
799
|
if (l[u].density / s.lastScreenCoverage < n) {
|
|
802
|
-
|
|
800
|
+
v = u;
|
|
803
801
|
break;
|
|
804
802
|
}
|
|
805
803
|
}
|
|
806
|
-
|
|
804
|
+
v < o && (o = v, a = !0);
|
|
807
805
|
}
|
|
808
806
|
if (a ? i.mesh_lod = o : i.mesh_lod = s.lastLodLevel_Mesh, B && i.mesh_lod != s.lastLodLevel_Mesh) {
|
|
809
807
|
const f = l == null ? void 0 : l[i.mesh_lod];
|
|
810
808
|
f && console.log(`Mesh LOD changed: ${s.lastLodLevel_Mesh} → ${i.mesh_lod} (${f.density.toFixed(0)}) - ${e.name}`);
|
|
811
809
|
}
|
|
812
|
-
if (
|
|
813
|
-
const
|
|
810
|
+
if (x) {
|
|
811
|
+
const m = "saveData" in globalThis.navigator && globalThis.navigator.saveData === !0;
|
|
814
812
|
if (s.lastLodLevel_Texture < 0) {
|
|
815
813
|
if (i.texture_lod = h.max_count - 1, B) {
|
|
816
814
|
const f = h.lods[h.max_count - 1];
|
|
@@ -821,12 +819,13 @@ const B = oe("debugprogressive"), at = oe("noprogressive"), me = Symbol("Needle:
|
|
|
821
819
|
let w = s.lastScreenCoverage * 4;
|
|
822
820
|
((P = this.context) == null ? void 0 : P.engine) === "model-viewer" && (w *= 1.5);
|
|
823
821
|
const k = L / window.devicePixelRatio * w;
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
822
|
+
let E = !1;
|
|
823
|
+
for (let G = h.lods.length - 1; G >= 0; G--) {
|
|
824
|
+
let v = h.lods[G];
|
|
825
|
+
if (!(m && v.max_height >= 2048) && !(et() && v.max_height > 4096) && (v.max_height > k || !E && G === 0)) {
|
|
826
|
+
if (E = !0, i.texture_lod = G, i.texture_lod < s.lastLodLevel_Texture) {
|
|
827
|
+
const O = v.max_height;
|
|
828
|
+
B && console.log(`Texture LOD changed: ${s.lastLodLevel_Texture} → ${i.texture_lod} = ${O}px
|
|
830
829
|
Screensize: ${k.toFixed(0)}px, Coverage: ${(100 * s.lastScreenCoverage).toFixed(2)}%, Volume ${f.toFixed(1)}
|
|
831
830
|
${e.name}`);
|
|
832
831
|
}
|
|
@@ -838,28 +837,28 @@ ${e.name}`);
|
|
|
838
837
|
i.texture_lod = 0;
|
|
839
838
|
}
|
|
840
839
|
};
|
|
841
|
-
let
|
|
840
|
+
let U = C;
|
|
842
841
|
b = /* @__PURE__ */ new WeakMap();
|
|
843
|
-
|
|
844
|
-
|
|
842
|
+
V = /* @__PURE__ */ new WeakMap();
|
|
843
|
+
we = /* @__PURE__ */ new WeakMap();
|
|
845
844
|
Q = /* @__PURE__ */ new WeakMap();
|
|
846
845
|
re = /* @__PURE__ */ new WeakMap();
|
|
847
846
|
de = /* @__PURE__ */ new WeakMap();
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
class
|
|
847
|
+
q = /* @__PURE__ */ new WeakMap();
|
|
848
|
+
U.corner0 = new F();
|
|
849
|
+
U.corner1 = new F();
|
|
850
|
+
U.corner2 = new F();
|
|
851
|
+
U.corner3 = new F();
|
|
852
|
+
U._tempPtInside = new F();
|
|
853
|
+
class at {
|
|
855
854
|
constructor() {
|
|
856
|
-
this.frames = 0, this.lastLodLevel_Mesh = -1, this.lastLodLevel_Texture = -1, this.lastScreenCoverage = 0, this.lastScreenspaceVolume = new
|
|
855
|
+
this.frames = 0, this.lastLodLevel_Mesh = -1, this.lastLodLevel_Texture = -1, this.lastScreenCoverage = 0, this.lastScreenspaceVolume = new F(), this.lastCentrality = 0;
|
|
857
856
|
}
|
|
858
857
|
}
|
|
859
858
|
const Te = Symbol("NEEDLE_mesh_lod"), fe = Symbol("NEEDLE_texture_lod");
|
|
860
859
|
let se = null;
|
|
861
860
|
function Ne() {
|
|
862
|
-
const t =
|
|
861
|
+
const t = lt();
|
|
863
862
|
t && (t.mapURLs(function(e) {
|
|
864
863
|
return Ae(), e;
|
|
865
864
|
}), Ae(), se == null || se.disconnect(), se = new MutationObserver((e) => {
|
|
@@ -870,7 +869,7 @@ function Ne() {
|
|
|
870
869
|
});
|
|
871
870
|
}), se.observe(document, { childList: !0, subtree: !0 }));
|
|
872
871
|
}
|
|
873
|
-
function
|
|
872
|
+
function lt() {
|
|
874
873
|
if (typeof customElements > "u")
|
|
875
874
|
return null;
|
|
876
875
|
const t = customElements.get("model-viewer");
|
|
@@ -886,11 +885,11 @@ function Ae() {
|
|
|
886
885
|
});
|
|
887
886
|
}
|
|
888
887
|
const Ce = /* @__PURE__ */ new WeakSet();
|
|
889
|
-
let
|
|
888
|
+
let ct = 0;
|
|
890
889
|
function $e(t) {
|
|
891
890
|
if (!t || Ce.has(t))
|
|
892
891
|
return null;
|
|
893
|
-
Ce.add(t), console.debug("[gltf-progressive] found new model-viewer..." + ++
|
|
892
|
+
Ce.add(t), console.debug("[gltf-progressive] found new model-viewer..." + ++ct + `
|
|
894
893
|
`, t.getAttribute("src"));
|
|
895
894
|
let e = null, s = null, n = null;
|
|
896
895
|
for (let i = t; i != null; i = Object.getPrototypeOf(i)) {
|
|
@@ -910,8 +909,8 @@ function $e(t) {
|
|
|
910
909
|
}
|
|
911
910
|
};
|
|
912
911
|
console.debug("[gltf-progressive] setup model-viewer");
|
|
913
|
-
const r =
|
|
914
|
-
return
|
|
912
|
+
const r = U.get(e, { engine: "model-viewer" });
|
|
913
|
+
return U.addPlugin(new ut()), r.enable(), r.addEventListener("changed", () => {
|
|
915
914
|
n == null || n.call(t);
|
|
916
915
|
}), t.addEventListener("model-visibility", (o) => {
|
|
917
916
|
o.detail.visible && (n == null || n.call(t));
|
|
@@ -923,7 +922,7 @@ function $e(t) {
|
|
|
923
922
|
}
|
|
924
923
|
return null;
|
|
925
924
|
}
|
|
926
|
-
class
|
|
925
|
+
class ut {
|
|
927
926
|
constructor() {
|
|
928
927
|
this._didWarnAboutMissingUrl = !1;
|
|
929
928
|
}
|
|
@@ -949,7 +948,7 @@ class ft {
|
|
|
949
948
|
const n = this.tryGetCurrentGLTF(e), i = this.tryGetCurrentModelViewer(e), r = this.getUrl(i);
|
|
950
949
|
if (r && n && s.material) {
|
|
951
950
|
let o = function(c) {
|
|
952
|
-
var d, h,
|
|
951
|
+
var d, h, x;
|
|
953
952
|
if (c[fe] == !0)
|
|
954
953
|
return;
|
|
955
954
|
c[fe] = !0, c.userData && (c.userData.LOD = -1);
|
|
@@ -957,17 +956,17 @@ class ft {
|
|
|
957
956
|
for (let L = 0; L < l.length; L++) {
|
|
958
957
|
const M = l[L], P = c[M];
|
|
959
958
|
if ((P == null ? void 0 : P.isTexture) === !0) {
|
|
960
|
-
const
|
|
961
|
-
if (
|
|
959
|
+
const m = (h = (d = P.userData) == null ? void 0 : d.associations) == null ? void 0 : h.textures;
|
|
960
|
+
if (m == null)
|
|
962
961
|
continue;
|
|
963
|
-
const f = n.parser.json.textures[
|
|
962
|
+
const f = n.parser.json.textures[m];
|
|
964
963
|
if (!f) {
|
|
965
|
-
console.warn("Texture data not found for texture index " +
|
|
964
|
+
console.warn("Texture data not found for texture index " + m);
|
|
966
965
|
continue;
|
|
967
966
|
}
|
|
968
|
-
if ((
|
|
969
|
-
const w = f.extensions[
|
|
970
|
-
w && r &&
|
|
967
|
+
if ((x = f == null ? void 0 : f.extensions) != null && x[$]) {
|
|
968
|
+
const w = f.extensions[$];
|
|
969
|
+
w && r && A.registerTexture(r, P, w.lods.length, m, w);
|
|
971
970
|
}
|
|
972
971
|
}
|
|
973
972
|
}
|
|
@@ -988,30 +987,30 @@ class ft {
|
|
|
988
987
|
const n = this.tryGetCurrentModelViewer(e), i = this.getUrl(n);
|
|
989
988
|
if (!i)
|
|
990
989
|
return;
|
|
991
|
-
const r = (a = (o = s.userData) == null ? void 0 : o.gltfExtensions) == null ? void 0 : a[
|
|
990
|
+
const r = (a = (o = s.userData) == null ? void 0 : o.gltfExtensions) == null ? void 0 : a[$];
|
|
992
991
|
if (r && i) {
|
|
993
992
|
const c = s.uuid;
|
|
994
|
-
|
|
993
|
+
A.registerMesh(i, c, s, 0, r.lods.length, r);
|
|
995
994
|
}
|
|
996
995
|
}
|
|
997
996
|
}
|
|
998
|
-
function
|
|
997
|
+
function ft(t, e, s, n) {
|
|
999
998
|
Be(e), Re(s), Ie(s, {
|
|
1000
999
|
progressive: !0,
|
|
1001
1000
|
...n == null ? void 0 : n.hints
|
|
1002
|
-
}), s.register((r) => new
|
|
1003
|
-
const i =
|
|
1001
|
+
}), s.register((r) => new A(r, t));
|
|
1002
|
+
const i = U.get(e);
|
|
1004
1003
|
return (n == null ? void 0 : n.enableLODsManager) !== !1 && i.enable(), i;
|
|
1005
1004
|
}
|
|
1006
1005
|
Ne();
|
|
1007
|
-
if (!
|
|
1006
|
+
if (!tt) {
|
|
1008
1007
|
const t = {
|
|
1009
1008
|
gltfProgressive: {
|
|
1010
|
-
useNeedleProgressive:
|
|
1011
|
-
LODsManager:
|
|
1009
|
+
useNeedleProgressive: ft,
|
|
1010
|
+
LODsManager: U,
|
|
1012
1011
|
configureLoader: Ie,
|
|
1013
1012
|
getRaycastMesh: ae,
|
|
1014
|
-
useRaycastMeshes:
|
|
1013
|
+
useRaycastMeshes: rt
|
|
1015
1014
|
}
|
|
1016
1015
|
};
|
|
1017
1016
|
if (!globalThis.Needle)
|
|
@@ -1021,12 +1020,12 @@ if (!st) {
|
|
|
1021
1020
|
globalThis.Needle[e] = t[e];
|
|
1022
1021
|
}
|
|
1023
1022
|
export {
|
|
1024
|
-
|
|
1025
|
-
|
|
1023
|
+
U as L,
|
|
1024
|
+
A as N,
|
|
1026
1025
|
Re as a,
|
|
1027
1026
|
Ie as b,
|
|
1028
1027
|
Be as c,
|
|
1029
|
-
|
|
1028
|
+
pt as d,
|
|
1030
1029
|
ae as g,
|
|
1031
|
-
|
|
1030
|
+
gt as s
|
|
1032
1031
|
};
|