mbt-3d 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -1
- package/dist/mbt-3d.cjs +1 -1
- package/dist/mbt-3d.cjs.map +1 -1
- package/dist/mbt-3d.js +564 -479
- package/dist/mbt-3d.js.map +1 -1
- package/package.json +1 -1
package/dist/mbt-3d.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ContactShadows as pe, Environment as
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
5
|
-
import { Canvas as
|
|
1
|
+
import { useState as Y, useRef as v, useCallback as C, useEffect as L, Suspense as V, useMemo as D, createContext as ue, useContext as me, forwardRef as oe, useImperativeHandle as ne } from "react";
|
|
2
|
+
import { ContactShadows as pe, Environment as de, OrbitControls as fe, useProgress as ge, useTexture as he, useGLTF as U, useAnimations as Me } from "@react-three/drei";
|
|
3
|
+
import * as R from "three";
|
|
4
|
+
import * as se from "three/examples/jsm/utils/SkeletonUtils.js";
|
|
5
|
+
import { Canvas as ye, useThree as ae, useFrame as Z, createPortal as be } from "@react-three/fiber";
|
|
6
6
|
import { KTX2Loader as Te } from "three/examples/jsm/loaders/KTX2Loader.js";
|
|
7
|
-
import {
|
|
8
|
-
function
|
|
7
|
+
import { jsxs as _, jsx as b } from "react/jsx-runtime";
|
|
8
|
+
function Se({
|
|
9
9
|
position: t,
|
|
10
10
|
controlsConfig: e
|
|
11
11
|
}) {
|
|
12
|
-
const { camera:
|
|
12
|
+
const { camera: r } = ae(), i = v(null);
|
|
13
13
|
return L(() => {
|
|
14
|
-
t &&
|
|
15
|
-
}, [t,
|
|
16
|
-
|
|
14
|
+
t && r && (r.position.set(t[0], t[1], t[2]), r.updateProjectionMatrix(), i.current && (i.current.target.set(0, 0, 0), i.current.update()));
|
|
15
|
+
}, [t, r]), /* @__PURE__ */ b(
|
|
16
|
+
fe,
|
|
17
17
|
{
|
|
18
|
-
ref:
|
|
18
|
+
ref: i,
|
|
19
19
|
makeDefault: !0,
|
|
20
20
|
enabled: e.enabled,
|
|
21
21
|
enablePan: e.enablePan,
|
|
@@ -30,48 +30,48 @@ function be({
|
|
|
30
30
|
}
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function $e({ background: t }) {
|
|
34
34
|
const e = t == null ? void 0 : t.startsWith("#");
|
|
35
|
-
return t ? e ? /* @__PURE__ */
|
|
35
|
+
return t ? e ? /* @__PURE__ */ b("color", { attach: "background", args: [t] }) : /* @__PURE__ */ b(xe, { url: t }) : null;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
const e =
|
|
39
|
-
return
|
|
40
|
-
e.colorSpace =
|
|
41
|
-
}, [e]), /* @__PURE__ */
|
|
37
|
+
function xe({ url: t }) {
|
|
38
|
+
const e = he(t);
|
|
39
|
+
return D(() => {
|
|
40
|
+
e.colorSpace = R.SRGBColorSpace;
|
|
41
|
+
}, [e]), /* @__PURE__ */ b("primitive", { attach: "background", object: e });
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
return /* @__PURE__ */
|
|
45
|
-
|
|
43
|
+
function we({ config: t }) {
|
|
44
|
+
return /* @__PURE__ */ b(
|
|
45
|
+
de,
|
|
46
46
|
{
|
|
47
47
|
files: t.files,
|
|
48
48
|
background: t.background ?? !1,
|
|
49
49
|
blur: t.blur ?? 0,
|
|
50
|
-
children: /* @__PURE__ */
|
|
50
|
+
children: /* @__PURE__ */ b("group", { scale: t.intensity ?? 1, children: /* @__PURE__ */ b("ambientLight", { intensity: 0 }) })
|
|
51
51
|
}
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function Ae({ config: t }) {
|
|
55
55
|
switch (t.type) {
|
|
56
56
|
case "spot": {
|
|
57
57
|
const {
|
|
58
58
|
position: e = [5, 10, 5],
|
|
59
|
-
intensity:
|
|
60
|
-
castShadow:
|
|
59
|
+
intensity: r = 50,
|
|
60
|
+
castShadow: i = !0,
|
|
61
61
|
angle: l = Math.PI / 6,
|
|
62
|
-
penumbra:
|
|
62
|
+
penumbra: f = 0.5,
|
|
63
63
|
decay: M = 2,
|
|
64
64
|
distance: T = 0,
|
|
65
65
|
color: g = "#ffffff"
|
|
66
66
|
} = t;
|
|
67
|
-
return /* @__PURE__ */
|
|
67
|
+
return /* @__PURE__ */ b(
|
|
68
68
|
"spotLight",
|
|
69
69
|
{
|
|
70
70
|
position: e,
|
|
71
|
-
intensity:
|
|
72
|
-
castShadow:
|
|
71
|
+
intensity: r,
|
|
72
|
+
castShadow: i,
|
|
73
73
|
angle: l,
|
|
74
|
-
penumbra:
|
|
74
|
+
penumbra: f,
|
|
75
75
|
decay: M,
|
|
76
76
|
distance: T,
|
|
77
77
|
color: g
|
|
@@ -81,20 +81,20 @@ function we({ config: t }) {
|
|
|
81
81
|
case "point": {
|
|
82
82
|
const {
|
|
83
83
|
position: e = [0, 5, 0],
|
|
84
|
-
intensity:
|
|
85
|
-
color:
|
|
84
|
+
intensity: r = 20,
|
|
85
|
+
color: i = "#ffffff",
|
|
86
86
|
distance: l = 0,
|
|
87
|
-
decay:
|
|
87
|
+
decay: f = 2,
|
|
88
88
|
castShadow: M = !1
|
|
89
89
|
} = t;
|
|
90
|
-
return /* @__PURE__ */
|
|
90
|
+
return /* @__PURE__ */ b(
|
|
91
91
|
"pointLight",
|
|
92
92
|
{
|
|
93
93
|
position: e,
|
|
94
|
-
intensity:
|
|
95
|
-
color:
|
|
94
|
+
intensity: r,
|
|
95
|
+
color: i,
|
|
96
96
|
distance: l,
|
|
97
|
-
decay:
|
|
97
|
+
decay: f,
|
|
98
98
|
castShadow: M
|
|
99
99
|
}
|
|
100
100
|
);
|
|
@@ -102,16 +102,16 @@ function we({ config: t }) {
|
|
|
102
102
|
case "directional": {
|
|
103
103
|
const {
|
|
104
104
|
position: e = [10, 20, 10],
|
|
105
|
-
intensity:
|
|
106
|
-
color:
|
|
105
|
+
intensity: r = 40,
|
|
106
|
+
color: i = "#ffffff",
|
|
107
107
|
castShadow: l = !0
|
|
108
108
|
} = t;
|
|
109
|
-
return /* @__PURE__ */
|
|
109
|
+
return /* @__PURE__ */ b(
|
|
110
110
|
"directionalLight",
|
|
111
111
|
{
|
|
112
112
|
position: e,
|
|
113
|
-
intensity:
|
|
114
|
-
color:
|
|
113
|
+
intensity: r,
|
|
114
|
+
color: i,
|
|
115
115
|
castShadow: l
|
|
116
116
|
}
|
|
117
117
|
);
|
|
@@ -119,14 +119,14 @@ function we({ config: t }) {
|
|
|
119
119
|
case "hemisphere": {
|
|
120
120
|
const {
|
|
121
121
|
skyColor: e = "#ffffff",
|
|
122
|
-
groundColor:
|
|
123
|
-
intensity:
|
|
122
|
+
groundColor: r = "#444444",
|
|
123
|
+
intensity: i = 0.5,
|
|
124
124
|
position: l = [0, 10, 0]
|
|
125
|
-
} = t,
|
|
126
|
-
return /* @__PURE__ */
|
|
125
|
+
} = t, f = D(() => new R.Color(e), [e]), M = D(() => new R.Color(r), [r]);
|
|
126
|
+
return /* @__PURE__ */ b(
|
|
127
127
|
"hemisphereLight",
|
|
128
128
|
{
|
|
129
|
-
args: [
|
|
129
|
+
args: [f, M, i],
|
|
130
130
|
position: l
|
|
131
131
|
}
|
|
132
132
|
);
|
|
@@ -134,13 +134,13 @@ function we({ config: t }) {
|
|
|
134
134
|
case "ambient": {
|
|
135
135
|
const {
|
|
136
136
|
intensity: e = 0.5,
|
|
137
|
-
color:
|
|
137
|
+
color: r = "#ffffff"
|
|
138
138
|
} = t;
|
|
139
|
-
return /* @__PURE__ */
|
|
139
|
+
return /* @__PURE__ */ b(
|
|
140
140
|
"ambientLight",
|
|
141
141
|
{
|
|
142
142
|
intensity: e,
|
|
143
|
-
color:
|
|
143
|
+
color: r
|
|
144
144
|
}
|
|
145
145
|
);
|
|
146
146
|
}
|
|
@@ -148,678 +148,763 @@ function we({ config: t }) {
|
|
|
148
148
|
return null;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
+
function ve({
|
|
152
|
+
onChange: t
|
|
153
|
+
}) {
|
|
154
|
+
const { active: e, progress: r } = ge();
|
|
155
|
+
return L(() => {
|
|
156
|
+
t(e, r);
|
|
157
|
+
}, [e, r, t]), null;
|
|
158
|
+
}
|
|
151
159
|
function Xe({
|
|
152
160
|
children: t,
|
|
153
161
|
camera: e = {},
|
|
154
|
-
controls:
|
|
155
|
-
background:
|
|
162
|
+
controls: r = {},
|
|
163
|
+
background: i,
|
|
156
164
|
shadows: l = !0,
|
|
157
|
-
lights:
|
|
165
|
+
lights: f = [
|
|
158
166
|
{ type: "ambient", intensity: 0.5 },
|
|
159
167
|
{ type: "spot", position: [5, 10, 5], intensity: 50, castShadow: !0 }
|
|
160
168
|
],
|
|
161
169
|
environment: M,
|
|
162
170
|
contactShadows: T = !0,
|
|
163
|
-
|
|
171
|
+
showLoadingOverlay: g = !0,
|
|
172
|
+
style: n,
|
|
164
173
|
className: s
|
|
165
174
|
}) {
|
|
166
|
-
const
|
|
175
|
+
const [c, d] = Y(!1), [h, o] = Y(0), a = v(null), u = C((E, p) => {
|
|
176
|
+
if (E) {
|
|
177
|
+
a.current !== null && (window.clearTimeout(a.current), a.current = null), d(!0), o(Math.max(0, Math.min(100, Math.round(p))));
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
o(100), a.current = window.setTimeout(() => {
|
|
181
|
+
d(!1), o(0), a.current = null;
|
|
182
|
+
}, 200);
|
|
183
|
+
}, []);
|
|
184
|
+
L(() => () => {
|
|
185
|
+
a.current !== null && window.clearTimeout(a.current);
|
|
186
|
+
}, []);
|
|
187
|
+
const S = {
|
|
167
188
|
position: e.position || [0, 2, 5],
|
|
168
189
|
fov: e.fov || 45
|
|
169
|
-
},
|
|
170
|
-
enabled:
|
|
171
|
-
enablePan:
|
|
172
|
-
enableZoom:
|
|
173
|
-
enableRotate:
|
|
174
|
-
minDistance:
|
|
175
|
-
maxDistance:
|
|
176
|
-
minPolarAngle:
|
|
177
|
-
maxPolarAngle:
|
|
178
|
-
autoRotate:
|
|
179
|
-
autoRotateSpeed:
|
|
180
|
-
},
|
|
190
|
+
}, m = {
|
|
191
|
+
enabled: r.enabled ?? !0,
|
|
192
|
+
enablePan: r.enablePan ?? !0,
|
|
193
|
+
enableZoom: r.enableZoom ?? !0,
|
|
194
|
+
enableRotate: r.enableRotate ?? !0,
|
|
195
|
+
minDistance: r.minDistance,
|
|
196
|
+
maxDistance: r.maxDistance,
|
|
197
|
+
minPolarAngle: r.minPolarAngle,
|
|
198
|
+
maxPolarAngle: r.maxPolarAngle,
|
|
199
|
+
autoRotate: r.autoRotate ?? !1,
|
|
200
|
+
autoRotateSpeed: r.autoRotateSpeed ?? 2
|
|
201
|
+
}, w = typeof T == "object" ? {
|
|
181
202
|
position: T.position || [0, -1, 0],
|
|
182
203
|
opacity: T.opacity ?? 0.5,
|
|
183
204
|
blur: T.blur ?? 2
|
|
184
205
|
} : T ? { position: [0, -1, 0], opacity: 0.5, blur: 2 } : null;
|
|
185
|
-
return /* @__PURE__ */
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
206
|
+
return /* @__PURE__ */ _("div", { style: { ...n || {}, position: (n == null ? void 0 : n.position) ?? "relative" }, className: s, children: [
|
|
207
|
+
/* @__PURE__ */ _(
|
|
208
|
+
ye,
|
|
209
|
+
{
|
|
210
|
+
shadows: l,
|
|
211
|
+
camera: {
|
|
212
|
+
position: S.position,
|
|
213
|
+
fov: S.fov
|
|
214
|
+
},
|
|
215
|
+
style: { width: "100%", height: "100%" },
|
|
216
|
+
children: [
|
|
217
|
+
/* @__PURE__ */ b(V, { fallback: null, children: /* @__PURE__ */ b($e, { background: i }) }),
|
|
218
|
+
M && /* @__PURE__ */ b(V, { fallback: null, children: /* @__PURE__ */ b(we, { config: M }) }),
|
|
219
|
+
f.map((E, p) => /* @__PURE__ */ b(Ae, { config: E }, `${E.type}-${p}`)),
|
|
220
|
+
/* @__PURE__ */ b(V, { fallback: null, children: t }),
|
|
221
|
+
/* @__PURE__ */ b(
|
|
222
|
+
Se,
|
|
223
|
+
{
|
|
224
|
+
position: S.position,
|
|
225
|
+
controlsConfig: m
|
|
226
|
+
}
|
|
227
|
+
),
|
|
228
|
+
w && /* @__PURE__ */ b(
|
|
229
|
+
pe,
|
|
230
|
+
{
|
|
231
|
+
position: w.position,
|
|
232
|
+
opacity: w.opacity,
|
|
233
|
+
blur: w.blur
|
|
234
|
+
}
|
|
235
|
+
),
|
|
236
|
+
/* @__PURE__ */ b(ve, { onChange: u })
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
),
|
|
240
|
+
g && c && /* @__PURE__ */ b(
|
|
241
|
+
"div",
|
|
242
|
+
{
|
|
243
|
+
style: {
|
|
244
|
+
position: "absolute",
|
|
245
|
+
inset: 0,
|
|
246
|
+
background: "rgba(8, 10, 16, 0.46)",
|
|
247
|
+
display: "flex",
|
|
248
|
+
alignItems: "center",
|
|
249
|
+
justifyContent: "center",
|
|
250
|
+
pointerEvents: "none",
|
|
251
|
+
zIndex: 10
|
|
252
|
+
},
|
|
253
|
+
children: /* @__PURE__ */ _(
|
|
254
|
+
"div",
|
|
208
255
|
{
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
256
|
+
style: {
|
|
257
|
+
minWidth: 220,
|
|
258
|
+
padding: "16px 18px",
|
|
259
|
+
borderRadius: 14,
|
|
260
|
+
border: "1px solid rgba(255,255,255,0.2)",
|
|
261
|
+
background: "linear-gradient(180deg, rgba(18,24,36,0.9), rgba(13,17,27,0.9))",
|
|
262
|
+
color: "#eef3ff",
|
|
263
|
+
boxShadow: "0 10px 30px rgba(0,0,0,0.35)",
|
|
264
|
+
fontFamily: "system-ui, -apple-system, Segoe UI, sans-serif",
|
|
265
|
+
textAlign: "center"
|
|
266
|
+
},
|
|
267
|
+
children: [
|
|
268
|
+
/* @__PURE__ */ b("div", { style: { display: "flex", justifyContent: "center", marginBottom: 10 }, children: /* @__PURE__ */ _("svg", { width: "34", height: "34", viewBox: "0 0 34 34", "aria-hidden": "true", children: [
|
|
269
|
+
/* @__PURE__ */ b("circle", { cx: "17", cy: "17", r: "14", fill: "none", stroke: "rgba(255,255,255,0.2)", strokeWidth: "4" }),
|
|
270
|
+
/* @__PURE__ */ b(
|
|
271
|
+
"path",
|
|
272
|
+
{
|
|
273
|
+
d: "M31 17a14 14 0 0 1-14 14",
|
|
274
|
+
fill: "none",
|
|
275
|
+
stroke: "#67b4ff",
|
|
276
|
+
strokeWidth: "4",
|
|
277
|
+
strokeLinecap: "round",
|
|
278
|
+
children: /* @__PURE__ */ b(
|
|
279
|
+
"animateTransform",
|
|
280
|
+
{
|
|
281
|
+
attributeName: "transform",
|
|
282
|
+
type: "rotate",
|
|
283
|
+
from: "0 17 17",
|
|
284
|
+
to: "360 17 17",
|
|
285
|
+
dur: "0.9s",
|
|
286
|
+
repeatCount: "indefinite"
|
|
287
|
+
}
|
|
288
|
+
)
|
|
289
|
+
}
|
|
290
|
+
)
|
|
291
|
+
] }) }),
|
|
292
|
+
/* @__PURE__ */ _("div", { style: { fontSize: 12, opacity: 0.82, marginTop: 4 }, children: [
|
|
293
|
+
h,
|
|
294
|
+
"%"
|
|
295
|
+
] })
|
|
296
|
+
]
|
|
212
297
|
}
|
|
213
298
|
)
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
299
|
+
}
|
|
300
|
+
)
|
|
301
|
+
] });
|
|
217
302
|
}
|
|
218
|
-
function
|
|
219
|
-
const
|
|
303
|
+
function q(t, e) {
|
|
304
|
+
const r = v(/* @__PURE__ */ new Map()), i = v({}), l = v({});
|
|
220
305
|
L(() => {
|
|
221
|
-
e && (
|
|
306
|
+
e && (i.current = { ...e });
|
|
222
307
|
}, [e]), L(() => {
|
|
223
308
|
if (!t) return;
|
|
224
309
|
const g = /* @__PURE__ */ new Map();
|
|
225
|
-
t.traverse((
|
|
226
|
-
if (
|
|
227
|
-
const
|
|
228
|
-
|
|
310
|
+
t.traverse((n) => {
|
|
311
|
+
if (n.isMesh) {
|
|
312
|
+
const s = n;
|
|
313
|
+
s.name && g.set(s.name, s);
|
|
229
314
|
}
|
|
230
|
-
}),
|
|
231
|
-
}, [t]),
|
|
232
|
-
const g =
|
|
315
|
+
}), r.current = g;
|
|
316
|
+
}, [t]), Z(() => {
|
|
317
|
+
const g = r.current;
|
|
233
318
|
if (g.size === 0) return;
|
|
234
|
-
const
|
|
235
|
-
for (const [
|
|
236
|
-
const
|
|
237
|
-
|
|
319
|
+
const n = { ...i.current, ...l.current };
|
|
320
|
+
for (const [s, c] of Object.entries(n)) {
|
|
321
|
+
const d = g.get(s);
|
|
322
|
+
d && d.visible !== c && (d.visible = c);
|
|
238
323
|
}
|
|
239
324
|
});
|
|
240
|
-
const
|
|
241
|
-
l.current[g] =
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
}, []), M =
|
|
325
|
+
const f = C((g, n) => {
|
|
326
|
+
l.current[g] = n;
|
|
327
|
+
const s = r.current.get(g);
|
|
328
|
+
s && (s.visible = n);
|
|
329
|
+
}, []), M = C(() => Array.from(r.current.keys()).sort(), []), T = C(() => {
|
|
245
330
|
const g = {};
|
|
246
|
-
return
|
|
247
|
-
g[
|
|
331
|
+
return r.current.forEach((n, s) => {
|
|
332
|
+
g[s] = n.visible;
|
|
248
333
|
}), g;
|
|
249
334
|
}, []);
|
|
250
335
|
return {
|
|
251
|
-
setMeshVisibility:
|
|
336
|
+
setMeshVisibility: f,
|
|
252
337
|
getMeshNames: M,
|
|
253
338
|
getMeshVisibility: T
|
|
254
339
|
};
|
|
255
340
|
}
|
|
256
|
-
function
|
|
257
|
-
const
|
|
341
|
+
function J(t, e) {
|
|
342
|
+
const r = v(/* @__PURE__ */ new Map()), i = v(/* @__PURE__ */ new Map());
|
|
258
343
|
L(() => {
|
|
259
344
|
if (!t) return;
|
|
260
|
-
const
|
|
261
|
-
t.traverse((
|
|
262
|
-
if (
|
|
263
|
-
const c =
|
|
345
|
+
const n = /* @__PURE__ */ new Map();
|
|
346
|
+
t.traverse((s) => {
|
|
347
|
+
if (s.isMesh) {
|
|
348
|
+
const c = s;
|
|
264
349
|
(Array.isArray(c.material) ? c.material : [c.material]).forEach((h) => {
|
|
265
|
-
h.name && !
|
|
350
|
+
h.name && !n.has(h.name) && n.set(h.name, h);
|
|
266
351
|
});
|
|
267
352
|
}
|
|
268
|
-
}),
|
|
269
|
-
const
|
|
270
|
-
if (
|
|
353
|
+
}), r.current = n, e && Object.entries(e).forEach(([s, c]) => {
|
|
354
|
+
const d = n.get(s);
|
|
355
|
+
if (d && !Array.isArray(d)) {
|
|
271
356
|
const h = l(c);
|
|
272
|
-
|
|
357
|
+
d.color && d.color.copy(h), i.current.set(s, h);
|
|
273
358
|
}
|
|
274
359
|
});
|
|
275
|
-
}, [t, e]),
|
|
276
|
-
|
|
277
|
-
const c =
|
|
360
|
+
}, [t, e]), Z(() => {
|
|
361
|
+
i.current.forEach((n, s) => {
|
|
362
|
+
const c = r.current.get(s);
|
|
278
363
|
if (c && !Array.isArray(c)) {
|
|
279
|
-
const
|
|
280
|
-
|
|
364
|
+
const d = c;
|
|
365
|
+
d.color && !d.color.equals(n) && (d.color.copy(n), d.needsUpdate = !0);
|
|
281
366
|
}
|
|
282
367
|
});
|
|
283
368
|
});
|
|
284
|
-
const l = (
|
|
285
|
-
const c = l(
|
|
286
|
-
|
|
287
|
-
const
|
|
288
|
-
if (
|
|
289
|
-
const h =
|
|
369
|
+
const l = (n) => typeof n == "string" ? new R.Color(n) : new R.Color(n[0], n[1], n[2]), f = C((n, s) => {
|
|
370
|
+
const c = l(s);
|
|
371
|
+
i.current.set(n, c);
|
|
372
|
+
const d = r.current.get(n);
|
|
373
|
+
if (d && !Array.isArray(d)) {
|
|
374
|
+
const h = d;
|
|
290
375
|
h.color && (h.color.copy(c), h.needsUpdate = !0);
|
|
291
376
|
}
|
|
292
|
-
}, []), M =
|
|
293
|
-
const
|
|
294
|
-
if (
|
|
295
|
-
const c =
|
|
377
|
+
}, []), M = C(() => Array.from(r.current.keys()).sort(), []), T = C((n) => {
|
|
378
|
+
const s = r.current.get(n);
|
|
379
|
+
if (s && !Array.isArray(s)) {
|
|
380
|
+
const c = s;
|
|
296
381
|
if (c.color)
|
|
297
382
|
return "#" + c.color.getHexString();
|
|
298
383
|
}
|
|
299
384
|
return null;
|
|
300
|
-
}, []), g =
|
|
301
|
-
const
|
|
302
|
-
return
|
|
303
|
-
if (!Array.isArray(
|
|
304
|
-
const
|
|
305
|
-
|
|
385
|
+
}, []), g = C(() => {
|
|
386
|
+
const n = {};
|
|
387
|
+
return r.current.forEach((s, c) => {
|
|
388
|
+
if (!Array.isArray(s)) {
|
|
389
|
+
const d = s;
|
|
390
|
+
d.color && (n[c] = "#" + d.color.getHexString());
|
|
306
391
|
}
|
|
307
|
-
}),
|
|
392
|
+
}), n;
|
|
308
393
|
}, []);
|
|
309
394
|
return {
|
|
310
|
-
setMaterialColor:
|
|
395
|
+
setMaterialColor: f,
|
|
311
396
|
getMaterialNames: M,
|
|
312
397
|
getMaterialColor: T,
|
|
313
398
|
getAllMaterialColors: g
|
|
314
399
|
};
|
|
315
400
|
}
|
|
316
|
-
function
|
|
401
|
+
function G(t) {
|
|
317
402
|
const e = t.toLowerCase();
|
|
318
403
|
if (e.endsWith(".ktx2")) return !0;
|
|
319
404
|
try {
|
|
320
|
-
const
|
|
321
|
-
return
|
|
405
|
+
const r = new URL(t, window.location.origin), i = decodeURIComponent(r.hash.replace(/^#/, "")).toLowerCase(), l = decodeURIComponent(r.search).toLowerCase(), f = decodeURIComponent(r.pathname).toLowerCase();
|
|
406
|
+
return i.endsWith(".ktx2") || l.includes(".ktx2") || f.endsWith(".ktx2");
|
|
322
407
|
} catch {
|
|
323
408
|
return e.includes(".ktx2");
|
|
324
409
|
}
|
|
325
410
|
}
|
|
326
|
-
function
|
|
327
|
-
const { gl:
|
|
411
|
+
function Q(t, e) {
|
|
412
|
+
const { gl: r } = ae(), i = v(/* @__PURE__ */ new Map()), l = v(new R.TextureLoader()), f = v(null), M = v(/* @__PURE__ */ new Map()), T = v(/* @__PURE__ */ new Set()), g = v("");
|
|
328
413
|
L(() => {
|
|
329
|
-
if (!
|
|
414
|
+
if (!f.current)
|
|
330
415
|
try {
|
|
331
416
|
const o = typeof WebAssembly == "object" && typeof WebAssembly.validate == "function";
|
|
332
|
-
console.log("[useMaterialTexture] Browser features:"), console.log(` WebAssembly supported: ${o}`), console.log(` WebGL2: ${
|
|
333
|
-
const
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
}).catch((
|
|
337
|
-
console.error("[useMaterialTexture] ❌ Failed to check basis_transcoder.wasm:",
|
|
417
|
+
console.log("[useMaterialTexture] Browser features:"), console.log(` WebAssembly supported: ${o}`), console.log(` WebGL2: ${r.capabilities.isWebGL2}`);
|
|
418
|
+
const a = new Te();
|
|
419
|
+
a.setTranscoderPath("/basis/"), a.detectSupport(r), f.current = a, console.log("[useMaterialTexture] ✅ KTX2Loader initialized"), console.log("[useMaterialTexture] Transcoder path: /basis/"), fetch("/basis/basis_transcoder.wasm").then((u) => {
|
|
420
|
+
u.ok ? console.log("[useMaterialTexture] ✅ basis_transcoder.wasm is accessible") : console.error("[useMaterialTexture] ❌ basis_transcoder.wasm returned", u.status);
|
|
421
|
+
}).catch((u) => {
|
|
422
|
+
console.error("[useMaterialTexture] ❌ Failed to check basis_transcoder.wasm:", u);
|
|
338
423
|
}), o || (console.warn("[useMaterialTexture] ⚠️ WebAssembly not supported! KTX2 will fallback to CPU decoding (slow)"), console.warn("[useMaterialTexture] ⚠️ Recommend using WebP instead of KTX2 for this browser"));
|
|
339
424
|
} catch (o) {
|
|
340
425
|
console.error("[useMaterialTexture] ❌ Failed to initialize KTX2Loader:", o);
|
|
341
426
|
}
|
|
342
427
|
return () => {
|
|
343
|
-
|
|
428
|
+
f.current && (f.current.dispose(), f.current = null);
|
|
344
429
|
};
|
|
345
|
-
}, [
|
|
430
|
+
}, [r]), L(() => {
|
|
346
431
|
if (!t) return;
|
|
347
432
|
const o = /* @__PURE__ */ new Map();
|
|
348
|
-
t.traverse((
|
|
349
|
-
if (
|
|
350
|
-
const
|
|
351
|
-
(Array.isArray(
|
|
352
|
-
|
|
433
|
+
t.traverse((a) => {
|
|
434
|
+
if (a.isMesh) {
|
|
435
|
+
const u = a;
|
|
436
|
+
(Array.isArray(u.material) ? u.material : [u.material]).forEach((m) => {
|
|
437
|
+
m.name && !o.has(m.name) && o.set(m.name, m);
|
|
353
438
|
});
|
|
354
439
|
}
|
|
355
|
-
}),
|
|
440
|
+
}), i.current = o;
|
|
356
441
|
}, [t]);
|
|
357
|
-
const
|
|
442
|
+
const n = C((o) => G(o) ? f.current ? f.current : (console.warn("[useMaterialTexture] KTX2Loader not initialized, falling back to TextureLoader"), l.current) : l.current, []);
|
|
358
443
|
L(() => {
|
|
359
444
|
if (!e || !t) return;
|
|
360
|
-
const o =
|
|
445
|
+
const o = i.current;
|
|
361
446
|
if (o.size === 0) return;
|
|
362
|
-
const
|
|
363
|
-
if (g.current ===
|
|
447
|
+
const a = JSON.stringify(e);
|
|
448
|
+
if (g.current === a) {
|
|
364
449
|
console.log("[useMaterialTexture] Textures unchanged, skipping reload");
|
|
365
450
|
return;
|
|
366
451
|
}
|
|
367
|
-
g.current =
|
|
368
|
-
let
|
|
369
|
-
const
|
|
370
|
-
Object.entries(e).forEach(([
|
|
371
|
-
|
|
372
|
-
}), console.log("[useMaterialTexture] Starting texture load for",
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
var
|
|
376
|
-
const
|
|
377
|
-
if (!
|
|
378
|
-
console.warn(`[useMaterialTexture] Material "${
|
|
452
|
+
g.current = a;
|
|
453
|
+
let u = !1;
|
|
454
|
+
const S = /* @__PURE__ */ new Map();
|
|
455
|
+
Object.entries(e).forEach(([p, x]) => {
|
|
456
|
+
S.set(p, typeof x == "string" ? { map: x } : x);
|
|
457
|
+
}), console.log("[useMaterialTexture] Starting texture load for", S.size, "materials");
|
|
458
|
+
const m = [];
|
|
459
|
+
S.forEach((p, x) => {
|
|
460
|
+
var A, O;
|
|
461
|
+
const X = o.get(x);
|
|
462
|
+
if (!X || !X.isMeshStandardMaterial) {
|
|
463
|
+
console.warn(`[useMaterialTexture] Material "${x}" not found or not MeshStandardMaterial`);
|
|
379
464
|
return;
|
|
380
465
|
}
|
|
381
|
-
const y =
|
|
382
|
-
console.log(`[useMaterialTexture] 📋 Material "${
|
|
383
|
-
if (!
|
|
384
|
-
const
|
|
385
|
-
|
|
386
|
-
}),
|
|
387
|
-
if (!
|
|
388
|
-
const
|
|
389
|
-
if (
|
|
390
|
-
console.log(`[useMaterialTexture] Using cached texture: ${
|
|
466
|
+
const y = X;
|
|
467
|
+
console.log(`[useMaterialTexture] 📋 Material "${x}" BEFORE reset:`), console.log(` - map: ${y.map ? "EXISTS" : "null"} ${y.map ? `(uuid: ${y.map.uuid})` : ""}`), console.log(` - normalMap: ${y.normalMap ? "EXISTS" : "null"}`), console.log(` - roughnessMap: ${y.roughnessMap ? "EXISTS" : "null"}`), console.log(` - metalnessMap: ${y.metalnessMap ? "EXISTS" : "null"}`), console.log(` - emissiveMap: ${y.emissiveMap ? "EXISTS" : "null"}`), console.log(` - aoMap: ${y.aoMap ? "EXISTS" : "null"}`), console.log(` - color: ${(A = y.color) == null ? void 0 : A.getHexString()}`), console.log(` - emissive: ${(O = y.emissive) == null ? void 0 : O.getHexString()}`), console.log(` - material uuid: ${y.uuid}`), Object.entries(p).forEach(([$, k]) => {
|
|
468
|
+
if (!k) return;
|
|
469
|
+
const I = $, j = y[I];
|
|
470
|
+
j && (console.log(`[useMaterialTexture] 🗑️ Disposing old ${I} (uuid: ${j.uuid})`), j.dispose(), y[I] = null);
|
|
471
|
+
}), p.emissiveMap && (y.emissive = new R.Color(0), y.emissiveIntensity = 0), y.needsUpdate = !0, y.color = new R.Color(16777215), console.log(`[useMaterialTexture] ✅ Material "${x}" AFTER reset: only specified maps cleared`), Object.entries(p).forEach(([$, k]) => {
|
|
472
|
+
if (!k) return;
|
|
473
|
+
const I = `${x}_${$}_${k}`, j = M.current.get(I);
|
|
474
|
+
if (j) {
|
|
475
|
+
console.log(`[useMaterialTexture] Using cached texture: ${x}.${$}`), u || s(y, $, j);
|
|
391
476
|
return;
|
|
392
477
|
}
|
|
393
|
-
if (T.current.has(
|
|
394
|
-
console.log(`[useMaterialTexture] Skipping already loading: ${
|
|
478
|
+
if (T.current.has(I)) {
|
|
479
|
+
console.log(`[useMaterialTexture] Skipping already loading: ${x}.${$}`);
|
|
395
480
|
return;
|
|
396
481
|
}
|
|
397
|
-
|
|
482
|
+
m.push({ materialName: x, textureType: $, url: k, material: y });
|
|
398
483
|
});
|
|
399
|
-
}), console.log(`[useMaterialTexture] Queued ${
|
|
400
|
-
let
|
|
401
|
-
const
|
|
402
|
-
if (
|
|
403
|
-
console.log("[useMaterialTexture] ✅ All textures loaded"), console.log("[useMaterialTexture] 📊 FINAL material states:"), o.forEach((
|
|
404
|
-
var
|
|
405
|
-
const
|
|
406
|
-
console.log(` Material "${
|
|
484
|
+
}), console.log(`[useMaterialTexture] Queued ${m.length} textures to load`);
|
|
485
|
+
let w = 0;
|
|
486
|
+
const E = () => {
|
|
487
|
+
if (u || w >= m.length) {
|
|
488
|
+
console.log("[useMaterialTexture] ✅ All textures loaded"), console.log("[useMaterialTexture] 📊 FINAL material states:"), o.forEach((A, O) => {
|
|
489
|
+
var k, I;
|
|
490
|
+
const $ = A;
|
|
491
|
+
console.log(` Material "${O}":`), console.log(` - map: ${$.map ? "EXISTS" : "null"} ${$.map ? `(colorSpace: ${$.map.colorSpace})` : ""}`), console.log(` - normalMap: ${$.normalMap ? "EXISTS" : "null"}`), console.log(` - roughnessMap: ${$.roughnessMap ? "EXISTS" : "null"}`), console.log(` - metalnessMap: ${$.metalnessMap ? "EXISTS" : "null"}`), console.log(` - emissiveMap: ${$.emissiveMap ? "EXISTS" : "null"}`), console.log(` - color: ${(k = $.color) == null ? void 0 : k.getHexString()}`), console.log(` - emissive: ${(I = $.emissive) == null ? void 0 : I.getHexString()}`), console.log(` - emissiveIntensity: ${$.emissiveIntensity}`), console.log(` - roughness: ${$.roughness}`), console.log(` - metalness: ${$.metalness}`);
|
|
407
492
|
});
|
|
408
493
|
return;
|
|
409
494
|
}
|
|
410
|
-
const
|
|
411
|
-
console.log(`[useMaterialTexture] Loading (${
|
|
412
|
-
const
|
|
413
|
-
console.log(`[useMaterialTexture] Using ${y} for ${
|
|
414
|
-
|
|
415
|
-
(
|
|
416
|
-
var
|
|
417
|
-
if (T.current.delete(
|
|
418
|
-
console.log(`[useMaterialTexture] Disposed, cleaning up texture: ${
|
|
495
|
+
const p = m[w++], x = `${p.materialName}_${p.textureType}_${p.url}`;
|
|
496
|
+
console.log(`[useMaterialTexture] Loading (${w}/${m.length}): ${p.materialName}.${p.textureType} from ${p.url}`), T.current.add(x);
|
|
497
|
+
const X = n(p.url), y = G(p.url) ? "KTX2Loader" : "TextureLoader";
|
|
498
|
+
console.log(`[useMaterialTexture] Using ${y} for ${p.url}`), X.load(
|
|
499
|
+
p.url,
|
|
500
|
+
(A) => {
|
|
501
|
+
var I, j, W, P, N, H;
|
|
502
|
+
if (T.current.delete(x), u) {
|
|
503
|
+
console.log(`[useMaterialTexture] Disposed, cleaning up texture: ${p.materialName}.${p.textureType}`), A.dispose();
|
|
419
504
|
return;
|
|
420
505
|
}
|
|
421
|
-
const
|
|
422
|
-
console.log(`[useMaterialTexture] ✅ Loaded: ${
|
|
423
|
-
const
|
|
424
|
-
console.log(`[useMaterialTexture] Waiting111111 ${
|
|
506
|
+
const O = ((I = A.image) == null ? void 0 : I.width) || ((W = (j = A.source) == null ? void 0 : j.data) == null ? void 0 : W.width) || "unknown", $ = ((P = A.image) == null ? void 0 : P.height) || ((H = (N = A.source) == null ? void 0 : N.data) == null ? void 0 : H.height) || "unknown";
|
|
507
|
+
console.log(`[useMaterialTexture] ✅ Loaded: ${p.materialName}.${p.textureType} (${O}x${$})`), A.colorSpace = p.textureType === "map" || p.textureType === "emissiveMap" ? R.SRGBColorSpace : R.NoColorSpace, A.wrapS = R.RepeatWrapping, A.wrapT = R.RepeatWrapping, A.flipY = !1, M.current.set(x, A), s(p.material, p.textureType, A);
|
|
508
|
+
const k = G(p.url) ? 500 : 150;
|
|
509
|
+
console.log(`[useMaterialTexture] Waiting111111 ${k}ms before next texture...`), setTimeout(E, 0);
|
|
425
510
|
},
|
|
426
|
-
(
|
|
427
|
-
if (
|
|
428
|
-
const
|
|
429
|
-
|
|
511
|
+
(A) => {
|
|
512
|
+
if (A.lengthComputable) {
|
|
513
|
+
const O = Math.round(A.loaded / A.total * 100);
|
|
514
|
+
O % 25 === 0 && console.log(`[useMaterialTexture] Progress ${p.materialName}.${p.textureType}: ${O}%`);
|
|
430
515
|
}
|
|
431
516
|
},
|
|
432
|
-
(
|
|
433
|
-
T.current.delete(
|
|
517
|
+
(A) => {
|
|
518
|
+
T.current.delete(x), u || (console.error(`[useMaterialTexture] ❌ Failed to load ${p.materialName}.${p.textureType} from ${p.url}`), console.error("[useMaterialTexture] Error details:", A), console.error("[useMaterialTexture] Loader type:", y), G(p.url) && (console.error("[useMaterialTexture] KTX2 error - file may not be in Basis Universal format!"), console.error("[useMaterialTexture] Make sure files are created with: gltf-transform etc1s input.png output.ktx2"))), setTimeout(E, 100);
|
|
434
519
|
}
|
|
435
520
|
);
|
|
436
521
|
};
|
|
437
|
-
return
|
|
438
|
-
console.log("[useMaterialTexture] Cleanup: disposed"),
|
|
522
|
+
return E(), () => {
|
|
523
|
+
console.log("[useMaterialTexture] Cleanup: disposed"), u = !0;
|
|
439
524
|
};
|
|
440
|
-
}, [t, e,
|
|
441
|
-
const
|
|
442
|
-
var
|
|
443
|
-
switch (console.log(`[useMaterialTexture] 🎨 Applying texture: ${o.name}.${
|
|
525
|
+
}, [t, e, n]);
|
|
526
|
+
const s = (o, a, u) => {
|
|
527
|
+
var S, m;
|
|
528
|
+
switch (console.log(`[useMaterialTexture] 🎨 Applying texture: ${o.name}.${a} (texture uuid: ${u.uuid})`), a) {
|
|
444
529
|
case "map":
|
|
445
|
-
o.map =
|
|
530
|
+
o.map = u;
|
|
446
531
|
break;
|
|
447
532
|
case "normalMap":
|
|
448
|
-
o.normalMap =
|
|
533
|
+
o.normalMap = u;
|
|
449
534
|
break;
|
|
450
535
|
case "roughnessMap":
|
|
451
|
-
o.roughnessMap =
|
|
536
|
+
o.roughnessMap = u;
|
|
452
537
|
break;
|
|
453
538
|
case "metalnessMap":
|
|
454
|
-
o.metalnessMap =
|
|
539
|
+
o.metalnessMap = u;
|
|
455
540
|
break;
|
|
456
541
|
case "emissiveMap":
|
|
457
|
-
o.emissiveMap =
|
|
542
|
+
o.emissiveMap = u, o.emissive = new R.Color(16777215), o.emissiveIntensity = 1;
|
|
458
543
|
break;
|
|
459
544
|
case "alphaMap":
|
|
460
545
|
console.log(`[useMaterialTexture] Skipping alphaMap for "${o.name}" to prevent disappearing`);
|
|
461
546
|
break;
|
|
462
547
|
case "aoMap":
|
|
463
|
-
o.aoMap =
|
|
548
|
+
o.aoMap = u;
|
|
464
549
|
break;
|
|
465
550
|
}
|
|
466
|
-
o.needsUpdate = !0, console.log(`[useMaterialTexture] ✅ Applied ${
|
|
467
|
-
}, c =
|
|
468
|
-
const
|
|
469
|
-
if (
|
|
551
|
+
o.needsUpdate = !0, console.log(`[useMaterialTexture] ✅ Applied ${a} to ${o.name}, needsUpdate=true`), console.log(`[useMaterialTexture] 📊 Material "${o.name}" FINAL state:`), console.log(` - map: ${o.map ? "EXISTS" : "null"} ${o.map ? `(uuid: ${o.map.uuid}, colorSpace: ${o.map.colorSpace})` : ""}`), console.log(` - normalMap: ${o.normalMap ? "EXISTS" : "null"}`), console.log(` - roughnessMap: ${o.roughnessMap ? "EXISTS" : "null"}`), console.log(` - metalnessMap: ${o.metalnessMap ? "EXISTS" : "null"}`), console.log(` - emissiveMap: ${o.emissiveMap ? "EXISTS" : "null"}`), console.log(` - aoMap: ${o.aoMap ? "EXISTS" : "null"}`), console.log(` - color: ${(S = o.color) == null ? void 0 : S.getHexString()}`), console.log(` - emissive: ${(m = o.emissive) == null ? void 0 : m.getHexString()}`), console.log(` - emissiveIntensity: ${o.emissiveIntensity}`), console.log(` - roughness: ${o.roughness}`), console.log(` - metalness: ${o.metalness}`);
|
|
552
|
+
}, c = C((o, a) => {
|
|
553
|
+
const u = typeof a == "string" ? { map: a } : a, S = i.current.get(o);
|
|
554
|
+
if (!S || !S.isMeshStandardMaterial) {
|
|
470
555
|
console.warn(`Material "${o}" not found or not MeshStandardMaterial`);
|
|
471
556
|
return;
|
|
472
557
|
}
|
|
473
|
-
const
|
|
474
|
-
Object.entries(
|
|
475
|
-
if (!
|
|
476
|
-
const
|
|
477
|
-
if (
|
|
478
|
-
|
|
558
|
+
const m = S;
|
|
559
|
+
Object.entries(u).forEach(([w, E]) => {
|
|
560
|
+
if (!E) return;
|
|
561
|
+
const p = `${o}_${w}_${E}`, x = M.current.get(p);
|
|
562
|
+
if (x) {
|
|
563
|
+
s(m, w, x);
|
|
479
564
|
return;
|
|
480
565
|
}
|
|
481
|
-
|
|
482
|
-
|
|
566
|
+
n(E).load(
|
|
567
|
+
E,
|
|
483
568
|
(y) => {
|
|
484
|
-
y.colorSpace =
|
|
569
|
+
y.colorSpace = w === "map" || w === "emissiveMap" ? R.SRGBColorSpace : R.NoColorSpace, y.wrapS = R.RepeatWrapping, y.wrapT = R.RepeatWrapping, M.current.set(p, y), s(m, w, y);
|
|
485
570
|
},
|
|
486
571
|
void 0,
|
|
487
572
|
(y) => {
|
|
488
|
-
console.error(`Failed to load texture ${
|
|
573
|
+
console.error(`Failed to load texture ${E}:`, y);
|
|
489
574
|
}
|
|
490
575
|
);
|
|
491
576
|
});
|
|
492
|
-
}, [
|
|
493
|
-
const
|
|
494
|
-
if (!
|
|
495
|
-
const
|
|
496
|
-
|
|
577
|
+
}, [n]), d = C(() => Array.from(i.current.keys()).sort(), []), h = C((o) => {
|
|
578
|
+
const a = i.current.get(o);
|
|
579
|
+
if (!a || !a.isMeshStandardMaterial) return;
|
|
580
|
+
const u = a;
|
|
581
|
+
u.map = null, u.normalMap = null, u.roughnessMap = null, u.metalnessMap = null, u.emissiveMap = null, u.alphaMap = null, u.aoMap = null, u.needsUpdate = !0;
|
|
497
582
|
}, []);
|
|
498
583
|
return {
|
|
499
584
|
setMaterialTextures: c,
|
|
500
|
-
getMaterialNames:
|
|
585
|
+
getMaterialNames: d,
|
|
501
586
|
clearMaterialTextures: h
|
|
502
587
|
};
|
|
503
588
|
}
|
|
504
|
-
function
|
|
589
|
+
function Ee({
|
|
505
590
|
url: t,
|
|
506
591
|
position: e = [0, 0, 0],
|
|
507
|
-
rotation:
|
|
508
|
-
scale:
|
|
592
|
+
rotation: r = [0, 0, 0],
|
|
593
|
+
scale: i = 1,
|
|
509
594
|
meshVisibility: l,
|
|
510
|
-
materialColors:
|
|
595
|
+
materialColors: f,
|
|
511
596
|
materialTextures: M,
|
|
512
597
|
onLoad: T,
|
|
513
598
|
onError: g
|
|
514
599
|
}) {
|
|
515
|
-
const { scene:
|
|
516
|
-
|
|
517
|
-
const c =
|
|
518
|
-
const h =
|
|
600
|
+
const { scene: n } = U(t), s = v(T);
|
|
601
|
+
s.current = T;
|
|
602
|
+
const c = D(() => {
|
|
603
|
+
const h = n.clone();
|
|
519
604
|
console.log("[Model] 🔍 Scene clone created, checking materials...");
|
|
520
|
-
const o = [],
|
|
521
|
-
let
|
|
522
|
-
return h.traverse((
|
|
523
|
-
if (
|
|
524
|
-
const
|
|
525
|
-
o.push(
|
|
526
|
-
|
|
527
|
-
const
|
|
528
|
-
console.log(` - Has map: ${
|
|
605
|
+
const o = [], a = /* @__PURE__ */ new Set(), u = [];
|
|
606
|
+
let S = 0;
|
|
607
|
+
return h.traverse((m) => {
|
|
608
|
+
if (S++, m.type === "Bone" && u.push(m.name), m.isMesh) {
|
|
609
|
+
const w = m;
|
|
610
|
+
o.push(w.name), w.castShadow = !0, w.receiveShadow = !0, (Array.isArray(w.material) ? w.material : [w.material]).forEach((p) => {
|
|
611
|
+
a.add(p.name), console.log(`[Model] 📦 Material found: "${p.name}" (uuid: ${p.uuid})`);
|
|
612
|
+
const x = p;
|
|
613
|
+
console.log(` - Has map: ${x.map ? "YES" : "NO"}`), console.log(` - Has normalMap: ${x.normalMap ? "YES" : "NO"}`), console.log(` - Has roughnessMap: ${x.roughnessMap ? "YES" : "NO"}`), console.log(` - Has metalnessMap: ${x.metalnessMap ? "YES" : "NO"}`);
|
|
529
614
|
});
|
|
530
615
|
}
|
|
531
|
-
}), console.log(`[Model] 📊 Clone summary: ${o.length} meshes, ${
|
|
532
|
-
var
|
|
533
|
-
(
|
|
616
|
+
}), console.log(`[Model] 📊 Clone summary: ${o.length} meshes, ${a.size} materials`), setTimeout(() => {
|
|
617
|
+
var m;
|
|
618
|
+
(m = s.current) == null || m.call(s, {
|
|
534
619
|
meshes: o.sort(),
|
|
535
|
-
materials: Array.from(
|
|
536
|
-
bones:
|
|
537
|
-
nodeCount:
|
|
620
|
+
materials: Array.from(a).sort(),
|
|
621
|
+
bones: u.sort(),
|
|
622
|
+
nodeCount: S
|
|
538
623
|
});
|
|
539
624
|
}, 0), h;
|
|
540
|
-
}, [
|
|
541
|
-
return
|
|
625
|
+
}, [n]);
|
|
626
|
+
return q(c, l), J(c, f), Q(c, M), /* @__PURE__ */ b("group", { position: e, rotation: r, scale: typeof i == "number" ? [i, i, i] : i, children: /* @__PURE__ */ b("primitive", { object: c }) });
|
|
542
627
|
}
|
|
543
|
-
|
|
628
|
+
Ee.preload = (t) => {
|
|
544
629
|
U.preload(t);
|
|
545
630
|
};
|
|
546
|
-
function
|
|
547
|
-
const { actions:
|
|
631
|
+
function Re(t, e, r) {
|
|
632
|
+
const { actions: i, names: l } = Me(t, e), f = v(null), M = v(r == null ? void 0 : r.defaultAnimation);
|
|
548
633
|
L(() => {
|
|
549
634
|
if (l.length === 0) return;
|
|
550
|
-
const
|
|
635
|
+
const s = M.current;
|
|
551
636
|
let c = l[0];
|
|
552
|
-
if (
|
|
553
|
-
const h = l.find((o) => o ===
|
|
637
|
+
if (s) {
|
|
638
|
+
const h = l.find((o) => o === s || o.includes(s));
|
|
554
639
|
h && (c = h);
|
|
555
640
|
}
|
|
556
|
-
const
|
|
557
|
-
|
|
558
|
-
}, [
|
|
559
|
-
const T =
|
|
560
|
-
(
|
|
641
|
+
const d = i[c];
|
|
642
|
+
d && (d.reset().fadeIn(0.5).play(), f.current = d);
|
|
643
|
+
}, [i, l]);
|
|
644
|
+
const T = C(
|
|
645
|
+
(s, c) => {
|
|
561
646
|
const {
|
|
562
|
-
loop:
|
|
647
|
+
loop: d = !1,
|
|
563
648
|
crossFadeDuration: h = 0.2,
|
|
564
649
|
restoreDefault: o = !0
|
|
565
650
|
} = c || {};
|
|
566
|
-
let
|
|
567
|
-
if (!
|
|
568
|
-
const
|
|
569
|
-
(
|
|
651
|
+
let a = i[s];
|
|
652
|
+
if (!a) {
|
|
653
|
+
const S = Object.keys(i).find(
|
|
654
|
+
(m) => m.toLowerCase().includes(s.toLowerCase()) || s.toLowerCase().includes(m.toLowerCase())
|
|
570
655
|
);
|
|
571
|
-
|
|
656
|
+
S && (a = i[S]);
|
|
572
657
|
}
|
|
573
|
-
if (!
|
|
574
|
-
console.warn(`Animation "${
|
|
658
|
+
if (!a) {
|
|
659
|
+
console.warn(`Animation "${s}" not found. Available: ${l.join(", ")}`);
|
|
575
660
|
return;
|
|
576
661
|
}
|
|
577
|
-
const
|
|
578
|
-
if (!(
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
),
|
|
582
|
-
const
|
|
583
|
-
if (
|
|
584
|
-
|
|
585
|
-
const
|
|
586
|
-
|
|
662
|
+
const u = f.current;
|
|
663
|
+
if (!(u === a && a.isRunning()) && (u && u !== a && u.fadeOut(h), a.reset(), a.fadeIn(h), a.setLoop(
|
|
664
|
+
d ? R.LoopRepeat : R.LoopOnce,
|
|
665
|
+
d ? 1 / 0 : 1
|
|
666
|
+
), a.clampWhenFinished = !d, a.play(), d || a.getMixer().update(0), f.current = a, o && !d && M.current)) {
|
|
667
|
+
const S = a.getMixer(), m = (w) => {
|
|
668
|
+
if (w.action === a) {
|
|
669
|
+
S.removeEventListener("finished", m);
|
|
670
|
+
const E = i[M.current];
|
|
671
|
+
E && (a.fadeOut(h), E.reset().fadeIn(h).play(), f.current = E);
|
|
587
672
|
}
|
|
588
673
|
};
|
|
589
|
-
|
|
674
|
+
S.addEventListener("finished", m);
|
|
590
675
|
}
|
|
591
676
|
},
|
|
592
|
-
[
|
|
593
|
-
), g =
|
|
594
|
-
var
|
|
595
|
-
(
|
|
596
|
-
}, []),
|
|
677
|
+
[i, l]
|
|
678
|
+
), g = C(() => {
|
|
679
|
+
var s;
|
|
680
|
+
(s = f.current) == null || s.fadeOut(0.2), f.current = null;
|
|
681
|
+
}, []), n = C(() => l, [l]);
|
|
597
682
|
return {
|
|
598
683
|
playAnimation: T,
|
|
599
684
|
stopAnimation: g,
|
|
600
|
-
getAnimationNames:
|
|
601
|
-
actions:
|
|
685
|
+
getAnimationNames: n,
|
|
686
|
+
actions: i
|
|
602
687
|
};
|
|
603
688
|
}
|
|
604
|
-
function
|
|
605
|
-
const
|
|
689
|
+
function ie(t, e) {
|
|
690
|
+
const r = v(e || {}), i = v([]), l = v([]);
|
|
606
691
|
L(() => {
|
|
607
|
-
const g = /* @__PURE__ */ new Set(),
|
|
608
|
-
t.traverse((
|
|
609
|
-
|
|
692
|
+
const g = /* @__PURE__ */ new Set(), n = [];
|
|
693
|
+
t.traverse((s) => {
|
|
694
|
+
s instanceof R.Mesh && s.morphTargetDictionary && s.morphTargetInfluences && (n.push(s), Object.keys(s.morphTargetDictionary).forEach((c) => {
|
|
610
695
|
g.add(c);
|
|
611
696
|
}));
|
|
612
|
-
}),
|
|
613
|
-
}, [t]),
|
|
614
|
-
const g =
|
|
615
|
-
l.current.forEach((
|
|
616
|
-
!
|
|
617
|
-
const
|
|
618
|
-
|
|
697
|
+
}), i.current = Array.from(g).sort(), l.current = n;
|
|
698
|
+
}, [t]), Z(() => {
|
|
699
|
+
const g = r.current;
|
|
700
|
+
l.current.forEach((n) => {
|
|
701
|
+
!n.morphTargetDictionary || !n.morphTargetInfluences || Object.entries(g).forEach(([s, c]) => {
|
|
702
|
+
const d = n.morphTargetDictionary[s];
|
|
703
|
+
d !== void 0 && (n.morphTargetInfluences[d] = c);
|
|
619
704
|
});
|
|
620
705
|
});
|
|
621
706
|
}), L(() => {
|
|
622
|
-
e && (
|
|
707
|
+
e && (r.current = { ...e });
|
|
623
708
|
}, [e]);
|
|
624
|
-
const
|
|
625
|
-
|
|
626
|
-
}, []), M =
|
|
709
|
+
const f = C((g, n) => {
|
|
710
|
+
r.current[g] = Math.max(0, Math.min(1, n));
|
|
711
|
+
}, []), M = C(() => i.current, []), T = C(() => ({ ...r.current }), []);
|
|
627
712
|
return {
|
|
628
|
-
setMorphTarget:
|
|
713
|
+
setMorphTarget: f,
|
|
629
714
|
getMorphTargetNames: M,
|
|
630
715
|
getMorphTargetValues: T
|
|
631
716
|
};
|
|
632
717
|
}
|
|
633
|
-
const
|
|
634
|
-
function
|
|
635
|
-
const t =
|
|
718
|
+
const le = ue(null);
|
|
719
|
+
function ke() {
|
|
720
|
+
const t = me(le);
|
|
636
721
|
if (!t)
|
|
637
722
|
throw new Error("BoneAttachment must be used within an AnimatedModel");
|
|
638
723
|
return t;
|
|
639
724
|
}
|
|
640
|
-
const
|
|
725
|
+
const ce = oe(
|
|
641
726
|
({
|
|
642
727
|
url: t,
|
|
643
728
|
position: e = [0, 0, 0],
|
|
644
|
-
rotation:
|
|
645
|
-
scale:
|
|
729
|
+
rotation: r = [0, 0, 0],
|
|
730
|
+
scale: i = 1,
|
|
646
731
|
defaultAnimation: l,
|
|
647
|
-
morphTargets:
|
|
732
|
+
morphTargets: f,
|
|
648
733
|
meshVisibility: M,
|
|
649
734
|
materialColors: T,
|
|
650
735
|
materialTextures: g,
|
|
651
|
-
onLoad:
|
|
652
|
-
onError:
|
|
736
|
+
onLoad: n,
|
|
737
|
+
onError: s,
|
|
653
738
|
children: c
|
|
654
|
-
},
|
|
655
|
-
const h =
|
|
656
|
-
|
|
657
|
-
const { scene:
|
|
658
|
-
|
|
659
|
-
|
|
739
|
+
}, d) => {
|
|
740
|
+
const h = v(null), o = v([]), a = v(n);
|
|
741
|
+
a.current = n;
|
|
742
|
+
const { scene: u, animations: S } = U(t), m = D(() => se.clone(u), [u]), { playAnimation: w, stopAnimation: E, getAnimationNames: p } = Re(
|
|
743
|
+
S,
|
|
744
|
+
m,
|
|
660
745
|
{ defaultAnimation: l }
|
|
661
|
-
), { setMorphTarget:
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
), { setMeshVisibility:
|
|
665
|
-
|
|
746
|
+
), { setMorphTarget: x } = ie(
|
|
747
|
+
m,
|
|
748
|
+
f
|
|
749
|
+
), { setMeshVisibility: X, getMeshNames: y } = q(
|
|
750
|
+
m,
|
|
666
751
|
M
|
|
667
|
-
), { setMaterialColor:
|
|
668
|
-
|
|
752
|
+
), { setMaterialColor: A, getMaterialNames: O, getMaterialColor: $ } = J(
|
|
753
|
+
m,
|
|
669
754
|
T
|
|
670
|
-
), { setMaterialTextures:
|
|
671
|
-
|
|
755
|
+
), { setMaterialTextures: k, clearMaterialTextures: I } = Q(
|
|
756
|
+
m,
|
|
672
757
|
g
|
|
673
758
|
);
|
|
674
759
|
L(() => {
|
|
675
|
-
if (!
|
|
676
|
-
const
|
|
677
|
-
var
|
|
678
|
-
const
|
|
679
|
-
let
|
|
680
|
-
|
|
681
|
-
if (
|
|
682
|
-
const
|
|
683
|
-
H.push(
|
|
684
|
-
|
|
685
|
-
}),
|
|
686
|
-
|
|
760
|
+
if (!m) return;
|
|
761
|
+
const P = setTimeout(() => {
|
|
762
|
+
var re;
|
|
763
|
+
const N = [], H = [], F = /* @__PURE__ */ new Set(), ee = /* @__PURE__ */ new Set();
|
|
764
|
+
let te = 0;
|
|
765
|
+
m.traverse((K) => {
|
|
766
|
+
if (te++, K.type === "Bone" && N.push(K.name), K.isMesh) {
|
|
767
|
+
const B = K;
|
|
768
|
+
H.push(B.name), B.castShadow = !0, B.receiveShadow = !0, (Array.isArray(B.material) ? B.material : [B.material]).forEach((z) => {
|
|
769
|
+
F.add(z.name), z.shadowSide = R.DoubleSide;
|
|
770
|
+
}), B.morphTargetDictionary && Object.keys(B.morphTargetDictionary).forEach((z) => {
|
|
771
|
+
ee.add(z);
|
|
687
772
|
});
|
|
688
773
|
}
|
|
689
|
-
}), o.current = Array.from(
|
|
774
|
+
}), o.current = Array.from(ee).sort(), (re = a.current) == null || re.call(a, {
|
|
690
775
|
meshes: H.sort(),
|
|
691
|
-
materials: Array.from(
|
|
692
|
-
bones:
|
|
693
|
-
nodeCount:
|
|
694
|
-
animations:
|
|
776
|
+
materials: Array.from(F).sort(),
|
|
777
|
+
bones: N.sort(),
|
|
778
|
+
nodeCount: te,
|
|
779
|
+
animations: S.map((K) => K.name),
|
|
695
780
|
morphTargetNames: o.current
|
|
696
781
|
});
|
|
697
782
|
}, 0);
|
|
698
|
-
return () => clearTimeout(
|
|
699
|
-
}, [
|
|
700
|
-
playAnimation:
|
|
701
|
-
stopAnimation:
|
|
702
|
-
getAnimationNames:
|
|
783
|
+
return () => clearTimeout(P);
|
|
784
|
+
}, [m, S]), ne(d, () => ({
|
|
785
|
+
playAnimation: w,
|
|
786
|
+
stopAnimation: E,
|
|
787
|
+
getAnimationNames: p,
|
|
703
788
|
getGroup: () => h.current,
|
|
704
|
-
setMorphTarget:
|
|
789
|
+
setMorphTarget: x,
|
|
705
790
|
getMorphTargetNames: () => o.current,
|
|
706
|
-
setMeshVisibility:
|
|
791
|
+
setMeshVisibility: X,
|
|
707
792
|
getMeshNames: y,
|
|
708
|
-
setMaterialColor:
|
|
709
|
-
getMaterialNames:
|
|
710
|
-
getMaterialColor:
|
|
711
|
-
setMaterialTextures:
|
|
712
|
-
clearMaterialTextures:
|
|
793
|
+
setMaterialColor: A,
|
|
794
|
+
getMaterialNames: O,
|
|
795
|
+
getMaterialColor: $,
|
|
796
|
+
setMaterialTextures: k,
|
|
797
|
+
clearMaterialTextures: I
|
|
713
798
|
}));
|
|
714
|
-
const
|
|
799
|
+
const j = D(
|
|
715
800
|
() => ({
|
|
716
|
-
scene:
|
|
717
|
-
getBone: (
|
|
801
|
+
scene: m,
|
|
802
|
+
getBone: (P) => m.getObjectByName(P) || null
|
|
718
803
|
}),
|
|
719
|
-
[
|
|
720
|
-
), W = typeof
|
|
721
|
-
return /* @__PURE__ */
|
|
804
|
+
[m]
|
|
805
|
+
), W = typeof i == "number" ? [i, i, i] : i;
|
|
806
|
+
return /* @__PURE__ */ b(le.Provider, { value: j, children: /* @__PURE__ */ _(
|
|
722
807
|
"group",
|
|
723
808
|
{
|
|
724
809
|
ref: h,
|
|
725
810
|
position: e,
|
|
726
|
-
rotation:
|
|
811
|
+
rotation: r,
|
|
727
812
|
scale: W,
|
|
728
813
|
children: [
|
|
729
|
-
/* @__PURE__ */
|
|
814
|
+
/* @__PURE__ */ b("primitive", { object: m }),
|
|
730
815
|
c
|
|
731
816
|
]
|
|
732
817
|
}
|
|
733
818
|
) });
|
|
734
819
|
}
|
|
735
820
|
);
|
|
736
|
-
|
|
737
|
-
|
|
821
|
+
ce.displayName = "AnimatedModel";
|
|
822
|
+
ce.preload = (t) => {
|
|
738
823
|
U.preload(t);
|
|
739
824
|
};
|
|
740
|
-
const
|
|
825
|
+
const Ce = oe(
|
|
741
826
|
({
|
|
742
827
|
url: t,
|
|
743
828
|
position: e = [0, 0, 0],
|
|
744
|
-
rotation:
|
|
745
|
-
scale:
|
|
829
|
+
rotation: r = [0, 0, 0],
|
|
830
|
+
scale: i = 1,
|
|
746
831
|
morphTargets: l,
|
|
747
|
-
meshVisibility:
|
|
832
|
+
meshVisibility: f,
|
|
748
833
|
materialColors: M,
|
|
749
834
|
materialTextures: T,
|
|
750
835
|
onMorphTargetsFound: g,
|
|
751
|
-
onLoad:
|
|
752
|
-
onError:
|
|
836
|
+
onLoad: n,
|
|
837
|
+
onError: s
|
|
753
838
|
}, c) => {
|
|
754
|
-
const { scene:
|
|
755
|
-
h.current =
|
|
756
|
-
const o =
|
|
839
|
+
const { scene: d } = U(t), h = v(n);
|
|
840
|
+
h.current = n;
|
|
841
|
+
const o = v(g);
|
|
757
842
|
o.current = g;
|
|
758
|
-
const
|
|
759
|
-
|
|
843
|
+
const a = D(() => d.clone(), [d]), { setMorphTarget: u, getMorphTargetNames: S, getMorphTargetValues: m } = ie(
|
|
844
|
+
a,
|
|
760
845
|
l
|
|
761
|
-
), { setMeshVisibility:
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
), { setMaterialColor:
|
|
765
|
-
|
|
846
|
+
), { setMeshVisibility: w, getMeshNames: E } = q(
|
|
847
|
+
a,
|
|
848
|
+
f
|
|
849
|
+
), { setMaterialColor: p, getMaterialNames: x, getMaterialColor: X } = J(
|
|
850
|
+
a,
|
|
766
851
|
M
|
|
767
|
-
), { setMaterialTextures: y, clearMaterialTextures:
|
|
768
|
-
|
|
852
|
+
), { setMaterialTextures: y, clearMaterialTextures: A } = Q(
|
|
853
|
+
a,
|
|
769
854
|
T
|
|
770
855
|
);
|
|
771
856
|
return L(() => {
|
|
772
|
-
var
|
|
773
|
-
const
|
|
774
|
-
|
|
775
|
-
}, [
|
|
857
|
+
var k;
|
|
858
|
+
const $ = S();
|
|
859
|
+
$.length > 0 && ((k = o.current) == null || k.call(o, $));
|
|
860
|
+
}, [a, S]), L(() => {
|
|
776
861
|
var W;
|
|
777
|
-
if (!
|
|
778
|
-
const
|
|
779
|
-
let
|
|
780
|
-
|
|
781
|
-
if (
|
|
782
|
-
const
|
|
783
|
-
|
|
862
|
+
if (!a) return;
|
|
863
|
+
const $ = [], k = /* @__PURE__ */ new Set(), I = [];
|
|
864
|
+
let j = 0;
|
|
865
|
+
a.traverse((P) => {
|
|
866
|
+
if (j++, P.type === "Bone" && I.push(P.name), P.isMesh) {
|
|
867
|
+
const N = P;
|
|
868
|
+
$.push(N.name), N.castShadow = !0, N.receiveShadow = !0, (Array.isArray(N.material) ? N.material : [N.material]).forEach((F) => k.add(F.name));
|
|
784
869
|
}
|
|
785
870
|
}), (W = h.current) == null || W.call(h, {
|
|
786
|
-
meshes:
|
|
787
|
-
materials: Array.from(
|
|
788
|
-
bones:
|
|
789
|
-
nodeCount:
|
|
871
|
+
meshes: $.sort(),
|
|
872
|
+
materials: Array.from(k).sort(),
|
|
873
|
+
bones: I.sort(),
|
|
874
|
+
nodeCount: j
|
|
790
875
|
});
|
|
791
|
-
}, [
|
|
792
|
-
setMorphTarget:
|
|
793
|
-
getMorphTargetNames:
|
|
794
|
-
getMorphTargetValues:
|
|
795
|
-
setMeshVisibility:
|
|
796
|
-
getMeshNames:
|
|
797
|
-
setMaterialColor:
|
|
798
|
-
getMaterialNames:
|
|
799
|
-
getMaterialColor:
|
|
876
|
+
}, [a]), ne(c, () => ({
|
|
877
|
+
setMorphTarget: u,
|
|
878
|
+
getMorphTargetNames: S,
|
|
879
|
+
getMorphTargetValues: m,
|
|
880
|
+
setMeshVisibility: w,
|
|
881
|
+
getMeshNames: E,
|
|
882
|
+
setMaterialColor: p,
|
|
883
|
+
getMaterialNames: x,
|
|
884
|
+
getMaterialColor: X,
|
|
800
885
|
setMaterialTextures: y,
|
|
801
|
-
clearMaterialTextures:
|
|
802
|
-
})), /* @__PURE__ */
|
|
886
|
+
clearMaterialTextures: A
|
|
887
|
+
})), /* @__PURE__ */ b("group", { position: e, rotation: r, scale: typeof i == "number" ? [i, i, i] : i, children: /* @__PURE__ */ b("primitive", { object: a }) });
|
|
803
888
|
}
|
|
804
889
|
);
|
|
805
|
-
|
|
806
|
-
function
|
|
890
|
+
Ce.displayName = "MorphableModel";
|
|
891
|
+
function Be({
|
|
807
892
|
children: t,
|
|
808
893
|
bone: e,
|
|
809
|
-
position:
|
|
810
|
-
rotation:
|
|
894
|
+
position: r = [0, 0, 0],
|
|
895
|
+
rotation: i = [0, 0, 0],
|
|
811
896
|
scale: l = 1
|
|
812
897
|
}) {
|
|
813
|
-
const { getBone:
|
|
898
|
+
const { getBone: f } = ke(), [M, T] = Y(null);
|
|
814
899
|
return L(() => {
|
|
815
|
-
const
|
|
816
|
-
|
|
817
|
-
}, [e,
|
|
818
|
-
/* @__PURE__ */
|
|
900
|
+
const n = f(e);
|
|
901
|
+
n ? T(n) : console.warn(`Bone "${e}" not found in model`);
|
|
902
|
+
}, [e, f]), M ? be(
|
|
903
|
+
/* @__PURE__ */ b(
|
|
819
904
|
"group",
|
|
820
905
|
{
|
|
821
|
-
position:
|
|
822
|
-
rotation:
|
|
906
|
+
position: r,
|
|
907
|
+
rotation: i,
|
|
823
908
|
scale: typeof l == "number" ? [l, l, l] : l,
|
|
824
909
|
children: t
|
|
825
910
|
}
|
|
@@ -828,42 +913,42 @@ function Ne({
|
|
|
828
913
|
) : null;
|
|
829
914
|
}
|
|
830
915
|
function De(t, e) {
|
|
831
|
-
const { scene:
|
|
916
|
+
const { scene: r, animations: i } = U(t), l = D(() => se.clone(r), [r]);
|
|
832
917
|
return L(() => {
|
|
833
|
-
var
|
|
918
|
+
var n;
|
|
834
919
|
if (!l) return;
|
|
835
|
-
const
|
|
920
|
+
const f = [], M = [], T = /* @__PURE__ */ new Set();
|
|
836
921
|
let g = 0;
|
|
837
|
-
l.traverse((
|
|
838
|
-
if (g++,
|
|
839
|
-
const c =
|
|
922
|
+
l.traverse((s) => {
|
|
923
|
+
if (g++, s.type === "Bone" && f.push(s.name), s.isMesh) {
|
|
924
|
+
const c = s;
|
|
840
925
|
M.push(c.name), c.castShadow = !0, c.receiveShadow = !0, (Array.isArray(c.material) ? c.material : [c.material]).forEach((h) => {
|
|
841
|
-
T.add(h.name), h.shadowSide =
|
|
926
|
+
T.add(h.name), h.shadowSide = R.DoubleSide;
|
|
842
927
|
});
|
|
843
928
|
}
|
|
844
|
-
}), (
|
|
929
|
+
}), (n = e == null ? void 0 : e.onLoad) == null || n.call(e, {
|
|
845
930
|
meshes: M.sort(),
|
|
846
931
|
materials: Array.from(T).sort(),
|
|
847
|
-
bones:
|
|
932
|
+
bones: f.sort(),
|
|
848
933
|
nodeCount: g
|
|
849
934
|
});
|
|
850
|
-
}, [l, e]), { scene: l, animations:
|
|
935
|
+
}, [l, e]), { scene: l, animations: i };
|
|
851
936
|
}
|
|
852
|
-
function
|
|
937
|
+
function We(t) {
|
|
853
938
|
U.preload(t);
|
|
854
939
|
}
|
|
855
940
|
export {
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
941
|
+
ce as AnimatedModel,
|
|
942
|
+
Be as BoneAttachment,
|
|
943
|
+
Ee as Model,
|
|
944
|
+
Ce as MorphableModel,
|
|
860
945
|
Xe as Scene3D,
|
|
861
|
-
|
|
862
|
-
|
|
946
|
+
We as preloadModel,
|
|
947
|
+
Re as useAnimationController,
|
|
863
948
|
De as useClonedModel,
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
949
|
+
J as useMaterialColor,
|
|
950
|
+
Q as useMaterialTexture,
|
|
951
|
+
q as useMeshVisibility,
|
|
952
|
+
ie as useMorphTargets
|
|
868
953
|
};
|
|
869
954
|
//# sourceMappingURL=mbt-3d.js.map
|