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