@tresjs/core 4.2.5 → 4.2.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/tres.js +544 -538
- package/dist/tres.umd.cjs +2 -2
- package/package.json +5 -1
package/dist/tres.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version: v4.2.
|
|
3
|
+
* version: v4.2.7
|
|
4
4
|
* (c) 2024
|
|
5
5
|
* description: Declarative ThreeJS using Vue Components
|
|
6
6
|
* author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
|
|
@@ -8,17 +8,20 @@
|
|
|
8
8
|
var bt = Object.defineProperty;
|
|
9
9
|
var Pt = (e, t, n) => t in e ? bt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
10
10
|
var me = (e, t, n) => Pt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
11
|
-
import { ref as H, computed as V, watchEffect as Te, onUnmounted as K, shallowRef as $, watch as ce, readonly as ye, unref as J, provide as _e, inject as
|
|
11
|
+
import { ref as H, computed as V, watchEffect as Te, onUnmounted as K, shallowRef as $, watch as ce, readonly as ye, unref as J, provide as _e, inject as Ct, isRef as Mt, reactive as Et, defineComponent as Be, useSlots as Tt, getCurrentInstance as Ie, onMounted as St, openBlock as At, createElementBlock as xt, normalizeClass as kt, normalizeStyle as Lt, createRenderer as Rt, h as He, Fragment as Ot } from "vue";
|
|
12
12
|
import * as et from "three";
|
|
13
13
|
import { PerspectiveCamera as we, Camera as Dt, Clock as tt, Vector3 as Se, Color as Z, Scene as nt, MathUtils as rt, MeshBasicMaterial as ot, DoubleSide as jt, REVISION as Bt, SRGBColorSpace as It, ACESFilmicToneMapping as st, PCFSoftShadowMap as Ht, NoToneMapping as $t, WebGLRenderer as he, TextureLoader as Ut, Vector2 as ge, Raycaster as Ft, BufferAttribute as Wt, Object3D as Nt, Line as zt, BufferGeometry as $e, Float32BufferAttribute as Ue, LineBasicMaterial as Gt, Mesh as Vt, BackSide as Yt, DirectionalLightHelper as qt, PointLightHelper as Jt, SpotLightHelper as Kt, HemisphereLightHelper as Qt, ArrowHelper as Xt } from "three";
|
|
14
14
|
import { createEventHook as j, useRafFn as it, toValue as k, unrefElement as Zt, useDevicePixelRatio as en, usePointer as tn, useElementBounding as nn, useWindowSize as rn, useElementSize as on, refDebounced as Fe, tryOnScopeDispose as sn, useFps as an, useMemory as ln } from "@vueuse/core";
|
|
15
|
-
const cn = "@tresjs/core", un = "module", fn = "4.2.
|
|
15
|
+
const cn = "@tresjs/core", un = "module", fn = "4.2.7", dn = "pnpm@9.1.4", pn = "Declarative ThreeJS using Vue Components", mn = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", hn = "MIT", gn = {
|
|
16
|
+
type: "git",
|
|
17
|
+
url: "git+https://github.com/Tresjs/tres.git"
|
|
18
|
+
}, vn = [
|
|
16
19
|
"vue",
|
|
17
20
|
"3d",
|
|
18
21
|
"threejs",
|
|
19
22
|
"three",
|
|
20
23
|
"threejs-vue"
|
|
21
|
-
],
|
|
24
|
+
], yn = !1, _n = {
|
|
22
25
|
".": {
|
|
23
26
|
types: "./dist/index.d.ts",
|
|
24
27
|
import: "./dist/tres.js",
|
|
@@ -37,12 +40,12 @@ const cn = "@tresjs/core", un = "module", fn = "4.2.5", dn = "pnpm@9.1.4", pn =
|
|
|
37
40
|
types: "./dist/src/utils/index.d.ts"
|
|
38
41
|
},
|
|
39
42
|
"./*": "./*"
|
|
40
|
-
},
|
|
43
|
+
}, wn = "./dist/tres.js", bn = "./dist/tres.js", Pn = "./dist/index.d.ts", Cn = [
|
|
41
44
|
"*.d.ts",
|
|
42
45
|
"dist"
|
|
43
46
|
], Mn = {
|
|
44
47
|
access: "public"
|
|
45
|
-
},
|
|
48
|
+
}, En = {
|
|
46
49
|
dev: "cd playground && npm run dev",
|
|
47
50
|
build: "vite build",
|
|
48
51
|
playground: "cd playground && npm run dev",
|
|
@@ -59,14 +62,14 @@ const cn = "@tresjs/core", un = "module", fn = "4.2.5", dn = "pnpm@9.1.4", pn =
|
|
|
59
62
|
"docs:preview": "vitepress preview docs",
|
|
60
63
|
"docs:contributors": "esno scripts/update-contributors.ts",
|
|
61
64
|
prepare: "node .husky/install.mjs"
|
|
62
|
-
},
|
|
65
|
+
}, Tn = {
|
|
63
66
|
three: ">=0.133",
|
|
64
67
|
vue: ">=3.4"
|
|
65
|
-
},
|
|
68
|
+
}, Sn = {
|
|
66
69
|
"@alvarosabu/utils": "^3.2.0",
|
|
67
70
|
"@vue/devtools-api": "^6.6.3",
|
|
68
71
|
"@vueuse/core": "^10.11.0"
|
|
69
|
-
},
|
|
72
|
+
}, An = {
|
|
70
73
|
"@release-it/conventional-changelog": "^8.0.1",
|
|
71
74
|
"@stackblitz/sdk": "^1.11.0",
|
|
72
75
|
"@tresjs/cientos": "3.9.0",
|
|
@@ -107,7 +110,7 @@ const cn = "@tresjs/core", un = "module", fn = "4.2.5", dn = "pnpm@9.1.4", pn =
|
|
|
107
110
|
vitest: "^2.0.2",
|
|
108
111
|
vue: "^3.4.31",
|
|
109
112
|
"vue-demi": "^0.14.8"
|
|
110
|
-
},
|
|
113
|
+
}, xn = {
|
|
111
114
|
name: cn,
|
|
112
115
|
type: un,
|
|
113
116
|
version: fn,
|
|
@@ -115,18 +118,19 @@ const cn = "@tresjs/core", un = "module", fn = "4.2.5", dn = "pnpm@9.1.4", pn =
|
|
|
115
118
|
description: pn,
|
|
116
119
|
author: mn,
|
|
117
120
|
license: hn,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
repository: gn,
|
|
122
|
+
keywords: vn,
|
|
123
|
+
sideEffects: yn,
|
|
124
|
+
exports: _n,
|
|
125
|
+
main: wn,
|
|
126
|
+
module: bn,
|
|
127
|
+
types: Pn,
|
|
128
|
+
files: Cn,
|
|
125
129
|
publishConfig: Mn,
|
|
126
|
-
scripts:
|
|
127
|
-
peerDependencies:
|
|
128
|
-
dependencies:
|
|
129
|
-
devDependencies:
|
|
130
|
+
scripts: En,
|
|
131
|
+
peerDependencies: Tn,
|
|
132
|
+
dependencies: Sn,
|
|
133
|
+
devDependencies: An
|
|
130
134
|
};
|
|
131
135
|
function be(e) {
|
|
132
136
|
return typeof e > "u";
|
|
@@ -152,52 +156,52 @@ function N(e) {
|
|
|
152
156
|
function We(e) {
|
|
153
157
|
return U(e) && "isCamera" in e && !!e.isCamera;
|
|
154
158
|
}
|
|
155
|
-
function
|
|
159
|
+
function Ln(e) {
|
|
156
160
|
return U(e) && "isBufferGeometry" in e && !!e.isBufferGeometry;
|
|
157
161
|
}
|
|
158
|
-
function
|
|
162
|
+
function Rn(e) {
|
|
159
163
|
return U(e) && "isMaterial" in e && !!e.isMaterial;
|
|
160
164
|
}
|
|
161
|
-
function
|
|
165
|
+
function On(e) {
|
|
162
166
|
return U(e) && "isLight" in e && !!e.isLight;
|
|
163
167
|
}
|
|
164
|
-
function
|
|
168
|
+
function Dn(e) {
|
|
165
169
|
return U(e) && "isFog" in e && !!e.isFog;
|
|
166
170
|
}
|
|
167
|
-
function
|
|
171
|
+
function jn(e) {
|
|
168
172
|
return U(e) && "isScene" in e && !!e.isScene;
|
|
169
173
|
}
|
|
170
174
|
function oe(e) {
|
|
171
|
-
return N(e) ||
|
|
175
|
+
return N(e) || Ln(e) || Rn(e) || Dn(e);
|
|
172
176
|
}
|
|
173
|
-
function
|
|
177
|
+
function Bn(e) {
|
|
174
178
|
return U(e) && !!e.isPrimitive;
|
|
175
179
|
}
|
|
176
|
-
const
|
|
180
|
+
const In = ({ sizes: e }) => {
|
|
177
181
|
const t = H([]), n = V(
|
|
178
182
|
() => t.value[0]
|
|
179
183
|
), r = (i) => {
|
|
180
|
-
const
|
|
181
|
-
if (!
|
|
184
|
+
const a = i instanceof Dt ? i : t.value.find((o) => o.uuid === i);
|
|
185
|
+
if (!a)
|
|
182
186
|
return;
|
|
183
|
-
const c = t.value.filter(({ uuid: o }) => o !==
|
|
184
|
-
t.value = [
|
|
185
|
-
}, s = (i,
|
|
187
|
+
const c = t.value.filter(({ uuid: o }) => o !== a.uuid);
|
|
188
|
+
t.value = [a, ...c];
|
|
189
|
+
}, s = (i, a = !1) => {
|
|
186
190
|
if (We(i)) {
|
|
187
191
|
const c = i;
|
|
188
192
|
if (t.value.some(({ uuid: o }) => o === c.uuid))
|
|
189
193
|
return;
|
|
190
|
-
|
|
194
|
+
a ? r(c) : t.value.push(c);
|
|
191
195
|
}
|
|
192
|
-
},
|
|
196
|
+
}, l = (i) => {
|
|
193
197
|
if (We(i)) {
|
|
194
|
-
const
|
|
195
|
-
t.value = t.value.filter(({ uuid: c }) => c !==
|
|
198
|
+
const a = i;
|
|
199
|
+
t.value = t.value.filter(({ uuid: c }) => c !== a.uuid);
|
|
196
200
|
}
|
|
197
201
|
};
|
|
198
202
|
return Te(() => {
|
|
199
203
|
e.aspectRatio.value && t.value.forEach((i) => {
|
|
200
|
-
!i.manual && (i instanceof we ||
|
|
204
|
+
!i.manual && (i instanceof we || Hn(i)) && (i instanceof we ? i.aspect = e.aspectRatio.value : (i.left = e.width.value * -0.5, i.right = e.width.value * 0.5, i.top = e.height.value * 0.5, i.bottom = e.height.value * -0.5), i.updateProjectionMatrix());
|
|
201
205
|
});
|
|
202
206
|
}), K(() => {
|
|
203
207
|
t.value = [];
|
|
@@ -205,16 +209,16 @@ const Bn = ({ sizes: e }) => {
|
|
|
205
209
|
camera: n,
|
|
206
210
|
cameras: t,
|
|
207
211
|
registerCamera: s,
|
|
208
|
-
deregisterCamera:
|
|
212
|
+
deregisterCamera: l,
|
|
209
213
|
setCameraActive: r
|
|
210
214
|
};
|
|
211
215
|
};
|
|
212
|
-
function
|
|
216
|
+
function Hn(e) {
|
|
213
217
|
return e.hasOwnProperty("isOrthographicCamera") && e.isOrthographicCamera;
|
|
214
218
|
}
|
|
215
219
|
const lt = j(), ct = j(), Ae = j(), ee = new tt();
|
|
216
220
|
let ue = 0, fe = 0;
|
|
217
|
-
const { pause:
|
|
221
|
+
const { pause: $n, resume: Ne, isActive: Un } = it(
|
|
218
222
|
() => {
|
|
219
223
|
lt.trigger({ delta: ue, elapsed: fe, clock: ee }), ct.trigger({ delta: ue, elapsed: fe, clock: ee }), Ae.trigger({ delta: ue, elapsed: fe, clock: ee });
|
|
220
224
|
},
|
|
@@ -224,14 +228,14 @@ Ae.on(() => {
|
|
|
224
228
|
ue = ee.getDelta(), fe = ee.getElapsedTime();
|
|
225
229
|
});
|
|
226
230
|
let ze = !1;
|
|
227
|
-
const
|
|
231
|
+
const Fr = () => (ze || (ze = !0, Ne()), {
|
|
228
232
|
onBeforeLoop: lt.on,
|
|
229
233
|
onLoop: ct.on,
|
|
230
234
|
onAfterLoop: Ae.on,
|
|
231
|
-
pause:
|
|
235
|
+
pause: $n,
|
|
232
236
|
resume: Ne,
|
|
233
|
-
isActive:
|
|
234
|
-
}),
|
|
237
|
+
isActive: Un
|
|
238
|
+
}), Wr = !0, se = "[TresJS ▲ ■ ●] ";
|
|
235
239
|
function Y() {
|
|
236
240
|
function e(...r) {
|
|
237
241
|
typeof r[0] == "string" ? r[0] = se + r[0] : r.unshift(se), console.error(...r);
|
|
@@ -247,13 +251,13 @@ function Y() {
|
|
|
247
251
|
logMessage: n
|
|
248
252
|
};
|
|
249
253
|
}
|
|
250
|
-
function
|
|
254
|
+
function Nr(e) {
|
|
251
255
|
return typeof e == "number" ? [e, e, e] : e instanceof Se ? [e.x, e.y, e.z] : e;
|
|
252
256
|
}
|
|
253
|
-
function
|
|
257
|
+
function Fn(e) {
|
|
254
258
|
return e instanceof Z ? e : Array.isArray(e) ? new Z(...e) : new Z(e);
|
|
255
259
|
}
|
|
256
|
-
class
|
|
260
|
+
class Wn extends et.Mesh {
|
|
257
261
|
constructor(...n) {
|
|
258
262
|
super(...n);
|
|
259
263
|
me(this, "type", "HightlightMesh");
|
|
@@ -269,18 +273,18 @@ const ut = (e, t) => {
|
|
|
269
273
|
for (const n of Object.keys(t))
|
|
270
274
|
t[n] instanceof Object && Object.assign(t[n], ut(e[n], t[n]));
|
|
271
275
|
return Object.assign(e || {}, t), e;
|
|
272
|
-
},
|
|
276
|
+
}, Nn = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot", zn = /* @__PURE__ */ Yn(Nn);
|
|
273
277
|
function Ge(e) {
|
|
274
278
|
return e && e.nodeType === 1;
|
|
275
279
|
}
|
|
276
280
|
function ie(e) {
|
|
277
281
|
return e.replace(/-([a-z])/g, (t, n) => n.toUpperCase());
|
|
278
282
|
}
|
|
279
|
-
const
|
|
280
|
-
function
|
|
281
|
-
return e.replace(
|
|
283
|
+
const Gn = /\B([A-Z])/g;
|
|
284
|
+
function Vn(e) {
|
|
285
|
+
return e.replace(Gn, "-$1").toLowerCase();
|
|
282
286
|
}
|
|
283
|
-
function
|
|
287
|
+
function Yn(e, t) {
|
|
284
288
|
const n = /* @__PURE__ */ Object.create(null), r = e.split(",");
|
|
285
289
|
for (let s = 0; s < r.length; s++)
|
|
286
290
|
n[r[s]] = !0;
|
|
@@ -291,14 +295,14 @@ const Ve = (e, t) => {
|
|
|
291
295
|
return;
|
|
292
296
|
const n = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
|
|
293
297
|
return n == null ? void 0 : n.reduce((r, s) => r && r[s], e);
|
|
294
|
-
},
|
|
298
|
+
}, qn = (e, t, n) => {
|
|
295
299
|
const r = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
|
|
296
|
-
r && r.reduce((s,
|
|
300
|
+
r && r.reduce((s, l, i) => (s[l] === void 0 && (s[l] = {}), i === r.length - 1 && (s[l] = n), s[l]), e);
|
|
297
301
|
};
|
|
298
302
|
function ft(e, t) {
|
|
299
303
|
if (Ge(e) && Ge(t)) {
|
|
300
|
-
const s = e.attributes,
|
|
301
|
-
return s.length !==
|
|
304
|
+
const s = e.attributes, l = t.attributes;
|
|
305
|
+
return s.length !== l.length ? !1 : Array.from(s).every(({ name: i, value: a }) => t.getAttribute(i) === a);
|
|
302
306
|
}
|
|
303
307
|
if (e === t)
|
|
304
308
|
return !0;
|
|
@@ -312,7 +316,7 @@ function ft(e, t) {
|
|
|
312
316
|
return !1;
|
|
313
317
|
return !0;
|
|
314
318
|
}
|
|
315
|
-
function
|
|
319
|
+
function Jn(e, t) {
|
|
316
320
|
if (!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length)
|
|
317
321
|
return !1;
|
|
318
322
|
for (let n = 0; n < e.length; n++)
|
|
@@ -320,8 +324,8 @@ function qn(e, t) {
|
|
|
320
324
|
return !1;
|
|
321
325
|
return !0;
|
|
322
326
|
}
|
|
323
|
-
const
|
|
324
|
-
function
|
|
327
|
+
const Kn = Array.isArray;
|
|
328
|
+
function Qn(e, t, n, r) {
|
|
325
329
|
const s = (c) => {
|
|
326
330
|
if (c.uuid === t)
|
|
327
331
|
return c;
|
|
@@ -330,12 +334,12 @@ function Kn(e, t, n, r) {
|
|
|
330
334
|
if (u)
|
|
331
335
|
return u;
|
|
332
336
|
}
|
|
333
|
-
},
|
|
334
|
-
if (!
|
|
337
|
+
}, l = s(e);
|
|
338
|
+
if (!l) {
|
|
335
339
|
console.warn("Object with UUID not found in the scene.");
|
|
336
340
|
return;
|
|
337
341
|
}
|
|
338
|
-
let i =
|
|
342
|
+
let i = l;
|
|
339
343
|
for (let c = 0; c < n.length - 1; c++)
|
|
340
344
|
if (i[n[c]] !== void 0)
|
|
341
345
|
i = i[n[c]];
|
|
@@ -343,10 +347,10 @@ function Kn(e, t, n, r) {
|
|
|
343
347
|
console.warn(`Property path is not valid: ${n.join(".")}`);
|
|
344
348
|
return;
|
|
345
349
|
}
|
|
346
|
-
const
|
|
347
|
-
i[
|
|
350
|
+
const a = n[n.length - 1];
|
|
351
|
+
i[a] !== void 0 ? i[a] = r : console.warn(`Property path is not valid: ${n.join(".")}`);
|
|
348
352
|
}
|
|
349
|
-
function
|
|
353
|
+
function Xn(e) {
|
|
350
354
|
const t = new ot({
|
|
351
355
|
color: 11003607,
|
|
352
356
|
// Highlight color, e.g., yellow
|
|
@@ -357,27 +361,27 @@ function Qn(e) {
|
|
|
357
361
|
side: jt
|
|
358
362
|
// To e
|
|
359
363
|
});
|
|
360
|
-
return new
|
|
364
|
+
return new Wn(e.geometry.clone(), t);
|
|
361
365
|
}
|
|
362
|
-
function
|
|
366
|
+
function Zn(e) {
|
|
363
367
|
var n;
|
|
364
368
|
let t = e.value;
|
|
365
369
|
return e.value && ((n = e.value) != null && n.isMesh) && (t = e.value.position), Array.isArray(e.value) && (t = new Se(...t)), t;
|
|
366
370
|
}
|
|
367
|
-
function
|
|
371
|
+
function er(e) {
|
|
368
372
|
return "map" in e;
|
|
369
373
|
}
|
|
370
374
|
function Ye(e) {
|
|
371
|
-
|
|
375
|
+
er(e) && e.map && e.map.dispose(), e.dispose();
|
|
372
376
|
}
|
|
373
377
|
function dt(e) {
|
|
374
378
|
var n, r;
|
|
375
379
|
if (e.parent && ((n = e.removeFromParent) == null || n.call(e)), delete e.__tres, [...e.children].forEach((s) => dt(s)), !(e instanceof nt)) {
|
|
376
380
|
const s = e;
|
|
377
|
-
e && ((r = e.dispose) == null || r.call(e)), s.geometry && (s.geometry.dispose(), delete s.geometry), Array.isArray(s.material) ? (s.material.forEach((
|
|
381
|
+
e && ((r = e.dispose) == null || r.call(e)), s.geometry && (s.geometry.dispose(), delete s.geometry), Array.isArray(s.material) ? (s.material.forEach((l) => Ye(l)), delete s.material) : s.material && (Ye(s.material), delete s.material);
|
|
378
382
|
}
|
|
379
383
|
}
|
|
380
|
-
function
|
|
384
|
+
function tr(e, t) {
|
|
381
385
|
let n = 0;
|
|
382
386
|
for (let r = 0; r < e.length; r++)
|
|
383
387
|
t(e[r], r) && (e[n] = e[r], n++);
|
|
@@ -398,15 +402,15 @@ function qe(...e) {
|
|
|
398
402
|
return e.map((t, n) => n === 0 ? t : t.charAt(0).toUpperCase() + t.slice(1)).join("");
|
|
399
403
|
}
|
|
400
404
|
const Je = /-\d+$/;
|
|
401
|
-
function
|
|
405
|
+
function nr(e, t, n) {
|
|
402
406
|
if (at(n)) {
|
|
403
407
|
if (Je.test(n)) {
|
|
404
|
-
const
|
|
405
|
-
if (!Array.isArray(i[
|
|
406
|
-
const c = i[
|
|
408
|
+
const l = n.replace(Je, ""), { target: i, key: a } = Pe(e, l);
|
|
409
|
+
if (!Array.isArray(i[a])) {
|
|
410
|
+
const c = i[a], o = [];
|
|
407
411
|
o.__tresDetach = () => {
|
|
408
|
-
o.every((u) => be(u)) && (i[
|
|
409
|
-
}, i[
|
|
412
|
+
o.every((u) => be(u)) && (i[a] = c);
|
|
413
|
+
}, i[a] = o;
|
|
410
414
|
}
|
|
411
415
|
}
|
|
412
416
|
const { target: r, key: s } = Pe(e, n);
|
|
@@ -414,14 +418,14 @@ function tr(e, t, n) {
|
|
|
414
418
|
} else
|
|
415
419
|
t.__tres.previousAttach = n(e, t);
|
|
416
420
|
}
|
|
417
|
-
function
|
|
418
|
-
var r, s,
|
|
421
|
+
function rr(e, t, n) {
|
|
422
|
+
var r, s, l;
|
|
419
423
|
if (at(n)) {
|
|
420
|
-
const { target: i, key:
|
|
421
|
-
c === void 0 ? delete i[
|
|
424
|
+
const { target: i, key: a } = Pe(e, n), c = t.__tres.previousAttach;
|
|
425
|
+
c === void 0 ? delete i[a] : i[a] = c, "__tresDetach" in i && i.__tresDetach();
|
|
422
426
|
} else
|
|
423
427
|
(s = (r = t.__tres) == null ? void 0 : r.previousAttach) == null || s.call(r, e, t);
|
|
424
|
-
(
|
|
428
|
+
(l = t.__tres) == null || delete l.previousAttach;
|
|
425
429
|
}
|
|
426
430
|
function z(e, t, n) {
|
|
427
431
|
const r = e;
|
|
@@ -442,40 +446,40 @@ function pt(e) {
|
|
|
442
446
|
const t = (n = e == null ? void 0 : e.__tres) == null ? void 0 : n.root;
|
|
443
447
|
t && t.render && t.render.canBeInvalidated.value && t.invalidate();
|
|
444
448
|
}
|
|
445
|
-
function
|
|
449
|
+
function or(e, t, n) {
|
|
446
450
|
var s;
|
|
447
451
|
if (!G(e.setPixelRatio))
|
|
448
452
|
return;
|
|
449
453
|
let r = 0;
|
|
450
454
|
if (de(n) && n.length >= 2) {
|
|
451
|
-
const [
|
|
452
|
-
r = rt.clamp(t,
|
|
455
|
+
const [l, i] = n;
|
|
456
|
+
r = rt.clamp(t, l, i);
|
|
453
457
|
} else kn(n) ? r = n : r = t;
|
|
454
458
|
r !== ((s = e.getPixelRatio) == null ? void 0 : s.call(e)) && e.setPixelRatio(r);
|
|
455
459
|
}
|
|
456
|
-
function
|
|
457
|
-
const
|
|
460
|
+
function sr(e, t, n, r, s) {
|
|
461
|
+
const l = [...t.__tres.objects], i = Q(t);
|
|
458
462
|
if (e = Q(e), i === e)
|
|
459
463
|
return !0;
|
|
460
|
-
const
|
|
464
|
+
const a = z(e, t.__tres ?? {}, s), c = t.parent ?? t.__tres.parent ?? null, o = { ...t.__tres.memoizedProps };
|
|
461
465
|
delete o.object;
|
|
462
|
-
for (const u of
|
|
466
|
+
for (const u of l)
|
|
463
467
|
mt(u, s), ht(u, s);
|
|
464
468
|
i.__tres.objects = [], r.remove(t);
|
|
465
|
-
for (const [u,
|
|
466
|
-
r.patchProp(
|
|
469
|
+
for (const [u, v] of Object.entries(o))
|
|
470
|
+
r.patchProp(a, u, a[u], v);
|
|
467
471
|
n(e), r.insert(t, c);
|
|
468
|
-
for (const u of
|
|
472
|
+
for (const u of l)
|
|
469
473
|
r.insert(u, t);
|
|
470
474
|
return !0;
|
|
471
475
|
}
|
|
472
476
|
function Q(e) {
|
|
473
|
-
return
|
|
477
|
+
return Bn(e) ? (e.object.__tres = e.__tres, e.object) : e;
|
|
474
478
|
}
|
|
475
479
|
function mt(e, t) {
|
|
476
|
-
var r, s,
|
|
480
|
+
var r, s, l, i;
|
|
477
481
|
const n = ((r = e.__tres) == null ? void 0 : r.parent) || t.scene.value;
|
|
478
|
-
e.__tres && (e.__tres.parent = null), n && n.__tres && "objects" in n.__tres &&
|
|
482
|
+
e.__tres && (e.__tres.parent = null), n && n.__tres && "objects" in n.__tres && tr(n.__tres.objects, (a) => a !== e), (s = e.__tres) != null && s.attach ? rr(n, e, e.__tres.attach) : ((i = (l = e.parent) == null ? void 0 : l.remove) == null || i.call(l, Q(e)), e.parent = null);
|
|
479
483
|
}
|
|
480
484
|
function ht(e, t) {
|
|
481
485
|
var n;
|
|
@@ -484,7 +488,7 @@ function ht(e, t) {
|
|
|
484
488
|
t.deregisterCamera(r), (s = t.eventManager) == null || s.deregisterPointerMissedObject(r);
|
|
485
489
|
}), t.deregisterCamera(e), pt(e);
|
|
486
490
|
}
|
|
487
|
-
const
|
|
491
|
+
const ir = Number.parseInt(Bt.replace("dev", "")), ae = {
|
|
488
492
|
realistic: {
|
|
489
493
|
shadows: !0,
|
|
490
494
|
physicallyCorrectLights: !0,
|
|
@@ -501,10 +505,10 @@ const sr = Number.parseInt(Bt.replace("dev", "")), ae = {
|
|
|
501
505
|
toneMappingExposure: 1
|
|
502
506
|
}
|
|
503
507
|
};
|
|
504
|
-
function
|
|
508
|
+
function ar({
|
|
505
509
|
canvas: e,
|
|
506
510
|
options: t,
|
|
507
|
-
contextParts: { sizes: n, render: r, invalidate: s, advance:
|
|
511
|
+
contextParts: { sizes: n, render: r, invalidate: s, advance: l }
|
|
508
512
|
}) {
|
|
509
513
|
const i = V(() => ({
|
|
510
514
|
alpha: k(t.alpha) ?? !0,
|
|
@@ -519,147 +523,147 @@ function ir({
|
|
|
519
523
|
preserveDrawingBuffer: k(t.preserveDrawingBuffer),
|
|
520
524
|
logarithmicDepthBuffer: k(t.logarithmicDepthBuffer),
|
|
521
525
|
failIfMajorPerformanceCaveat: k(t.failIfMajorPerformanceCaveat)
|
|
522
|
-
})),
|
|
526
|
+
})), a = $(new he(i.value));
|
|
523
527
|
function c() {
|
|
524
528
|
t.renderMode === "on-demand" && s();
|
|
525
529
|
}
|
|
526
530
|
ce(i, () => {
|
|
527
|
-
|
|
531
|
+
a.value.dispose(), a.value = new he(i.value), c();
|
|
528
532
|
}), ce([n.width, n.height], () => {
|
|
529
|
-
|
|
533
|
+
a.value.setSize(n.width.value, n.height.value), c();
|
|
530
534
|
}, {
|
|
531
535
|
immediate: !0
|
|
532
536
|
}), ce(() => t.clearColor, c);
|
|
533
537
|
const { pixelRatio: o } = en(), { logError: u } = Y(), f = (() => {
|
|
534
|
-
const
|
|
538
|
+
const g = new he(), b = {
|
|
535
539
|
shadowMap: {
|
|
536
|
-
enabled:
|
|
537
|
-
type:
|
|
540
|
+
enabled: g.shadowMap.enabled,
|
|
541
|
+
type: g.shadowMap.type
|
|
538
542
|
},
|
|
539
|
-
toneMapping:
|
|
540
|
-
toneMappingExposure:
|
|
541
|
-
outputColorSpace:
|
|
543
|
+
toneMapping: g.toneMapping,
|
|
544
|
+
toneMappingExposure: g.toneMappingExposure,
|
|
545
|
+
outputColorSpace: g.outputColorSpace
|
|
542
546
|
};
|
|
543
|
-
return
|
|
544
|
-
})(),
|
|
545
|
-
return
|
|
546
|
-
|
|
547
|
+
return g.dispose(), b;
|
|
548
|
+
})(), h = k(t.renderMode);
|
|
549
|
+
return h === "on-demand" && s(), h === "manual" && setTimeout(() => {
|
|
550
|
+
l();
|
|
547
551
|
}, 100), Te(() => {
|
|
548
|
-
const
|
|
549
|
-
|
|
550
|
-
const b = (C,
|
|
551
|
-
const P = k(C),
|
|
552
|
-
if (
|
|
553
|
-
return Ve(ae[
|
|
552
|
+
const g = k(t.preset);
|
|
553
|
+
g && (g in ae || u(`Renderer Preset must be one of these: ${Object.keys(ae).join(", ")}`), ut(a.value, ae[g])), or(a.value, o.value, k(t.dpr)), h === "always" && (r.frames.value = Math.max(1, r.frames.value));
|
|
554
|
+
const b = (C, M) => {
|
|
555
|
+
const P = k(C), E = () => {
|
|
556
|
+
if (g)
|
|
557
|
+
return Ve(ae[g], M);
|
|
554
558
|
};
|
|
555
559
|
if (P !== void 0)
|
|
556
560
|
return P;
|
|
557
|
-
const
|
|
558
|
-
return
|
|
559
|
-
},
|
|
560
|
-
|
|
561
|
+
const S = E();
|
|
562
|
+
return S !== void 0 ? S : Ve(f, M);
|
|
563
|
+
}, y = (C, M) => qn(a.value, M, b(C, M));
|
|
564
|
+
y(t.shadows, "shadowMap.enabled"), y(t.toneMapping ?? st, "toneMapping"), y(t.shadowMapType, "shadowMap.type"), ir < 150 && y(!t.useLegacyLights, "physicallyCorrectLights"), y(t.outputColorSpace, "outputColorSpace"), y(t.toneMappingExposure, "toneMappingExposure");
|
|
561
565
|
const d = b(t.clearColor, "clearColor");
|
|
562
|
-
d &&
|
|
563
|
-
d ?
|
|
566
|
+
d && a.value.setClearColor(
|
|
567
|
+
d ? Fn(d) : new Z(0)
|
|
564
568
|
// default clear color is not easily/efficiently retrievable from three
|
|
565
569
|
);
|
|
566
570
|
}), K(() => {
|
|
567
|
-
|
|
571
|
+
a.value.dispose(), a.value.forceContextLoss();
|
|
568
572
|
}), {
|
|
569
|
-
renderer:
|
|
573
|
+
renderer: a
|
|
570
574
|
};
|
|
571
575
|
}
|
|
572
|
-
const
|
|
573
|
-
function
|
|
576
|
+
const lr = (e) => !!e && e.constructor === Array;
|
|
577
|
+
function cr(e) {
|
|
574
578
|
const t = { nodes: {}, materials: {} };
|
|
575
579
|
return e && e.traverse((n) => {
|
|
576
580
|
n.name && (t.nodes[n.name] = n), n.material && !t.materials[n.material.name] && (t.materials[n.material.name] = n.material);
|
|
577
581
|
}), t;
|
|
578
582
|
}
|
|
579
|
-
async function
|
|
580
|
-
const { logError:
|
|
583
|
+
async function zr(e, t, n, r, s) {
|
|
584
|
+
const { logError: l } = Y(), i = new e();
|
|
581
585
|
s && s(i), n && n(i);
|
|
582
586
|
const c = (Array.isArray(t) ? t : [t]).map(
|
|
583
|
-
(o) => new Promise((u,
|
|
587
|
+
(o) => new Promise((u, v) => {
|
|
584
588
|
i.load(
|
|
585
589
|
o,
|
|
586
590
|
(f) => {
|
|
587
|
-
const
|
|
588
|
-
|
|
591
|
+
const h = f;
|
|
592
|
+
h.scene && Object.assign(h, cr(h.scene)), u(h);
|
|
589
593
|
},
|
|
590
594
|
r,
|
|
591
|
-
(f) =>
|
|
595
|
+
(f) => v(l("[useLoader] - Failed to load resource", f))
|
|
592
596
|
);
|
|
593
597
|
})
|
|
594
598
|
);
|
|
595
|
-
return
|
|
599
|
+
return lr(t) ? await Promise.all(c) : await c[0];
|
|
596
600
|
}
|
|
597
|
-
async function
|
|
598
|
-
const n = new Ut(t), r = (s) => new Promise((
|
|
601
|
+
async function Gr(e, t) {
|
|
602
|
+
const n = new Ut(t), r = (s) => new Promise((l, i) => {
|
|
599
603
|
n.load(
|
|
600
604
|
s,
|
|
601
|
-
(
|
|
605
|
+
(a) => l(a),
|
|
602
606
|
() => null,
|
|
603
607
|
() => {
|
|
604
608
|
i(new Error("[useTextures] - Failed to load texture"));
|
|
605
609
|
}
|
|
606
610
|
);
|
|
607
611
|
});
|
|
608
|
-
if (
|
|
609
|
-
const s = await Promise.all(e.map((
|
|
612
|
+
if (Kn(e)) {
|
|
613
|
+
const s = await Promise.all(e.map((l) => r(l)));
|
|
610
614
|
return e.length > 1 ? s : s[0];
|
|
611
615
|
} else {
|
|
612
616
|
const {
|
|
613
617
|
map: s,
|
|
614
|
-
displacementMap:
|
|
618
|
+
displacementMap: l,
|
|
615
619
|
normalMap: i,
|
|
616
|
-
roughnessMap:
|
|
620
|
+
roughnessMap: a,
|
|
617
621
|
metalnessMap: c,
|
|
618
622
|
aoMap: o,
|
|
619
623
|
alphaMap: u,
|
|
620
|
-
matcap:
|
|
624
|
+
matcap: v
|
|
621
625
|
} = e;
|
|
622
626
|
return {
|
|
623
627
|
map: s ? await r(s) : null,
|
|
624
|
-
displacementMap:
|
|
628
|
+
displacementMap: l ? await r(l) : null,
|
|
625
629
|
normalMap: i ? await r(i) : null,
|
|
626
|
-
roughnessMap:
|
|
630
|
+
roughnessMap: a ? await r(a) : null,
|
|
627
631
|
metalnessMap: c ? await r(c) : null,
|
|
628
632
|
aoMap: o ? await r(o) : null,
|
|
629
633
|
alphaMap: u ? await r(u) : null,
|
|
630
|
-
matcap:
|
|
634
|
+
matcap: v ? await r(v) : null
|
|
631
635
|
};
|
|
632
636
|
}
|
|
633
637
|
}
|
|
634
|
-
const
|
|
635
|
-
const n = V(() => t.renderer.value.domElement), r = $([]), { x: s, y:
|
|
638
|
+
const ur = (e, t) => {
|
|
639
|
+
const n = V(() => t.renderer.value.domElement), r = $([]), { x: s, y: l } = tn({ target: n });
|
|
636
640
|
let i = 0;
|
|
637
|
-
const { width:
|
|
641
|
+
const { width: a, height: c, top: o, left: u } = nn(n), v = ({ x: m, y: T }) => {
|
|
638
642
|
if (n.value)
|
|
639
643
|
return {
|
|
640
|
-
x: (
|
|
644
|
+
x: (m - u.value) / a.value * 2 - 1,
|
|
641
645
|
y: -((T - o.value) / c.value) * 2 + 1
|
|
642
646
|
};
|
|
643
|
-
}, f = ({ x:
|
|
647
|
+
}, f = ({ x: m, y: T }) => {
|
|
644
648
|
if (t.camera.value)
|
|
645
|
-
return t.raycaster.value.setFromCamera(new ge(
|
|
646
|
-
},
|
|
647
|
-
const T =
|
|
648
|
-
x: (
|
|
649
|
-
y: (
|
|
649
|
+
return t.raycaster.value.setFromCamera(new ge(m, T), t.camera.value), r.value = t.raycaster.value.intersectObjects(e.value, !0), r.value;
|
|
650
|
+
}, h = (m) => {
|
|
651
|
+
const T = v({
|
|
652
|
+
x: (m == null ? void 0 : m.clientX) ?? s.value,
|
|
653
|
+
y: (m == null ? void 0 : m.clientY) ?? l.value
|
|
650
654
|
});
|
|
651
655
|
return T ? f(T) || [] : [];
|
|
652
|
-
},
|
|
653
|
-
function
|
|
656
|
+
}, g = j(), b = j(), y = j(), d = j(), C = j(), M = j(), P = j(), E = j();
|
|
657
|
+
function S(m) {
|
|
654
658
|
const T = {};
|
|
655
|
-
for (const F in
|
|
656
|
-
typeof F != "function" && (T[F] =
|
|
659
|
+
for (const F in m)
|
|
660
|
+
typeof F != "function" && (T[F] = m[F]);
|
|
657
661
|
return T;
|
|
658
662
|
}
|
|
659
|
-
const _ = (
|
|
663
|
+
const _ = (m, T) => {
|
|
660
664
|
var Oe, De, je;
|
|
661
|
-
const F =
|
|
662
|
-
|
|
665
|
+
const F = S(T), re = new Se(T == null ? void 0 : T.clientX, T == null ? void 0 : T.clientY, 0).unproject((Oe = t.camera) == null ? void 0 : Oe.value);
|
|
666
|
+
m.trigger({
|
|
663
667
|
...F,
|
|
664
668
|
intersections: r.value,
|
|
665
669
|
// The unprojectedPoint is wrong, math needs to be fixed
|
|
@@ -671,64 +675,64 @@ const cr = (e, t) => {
|
|
|
671
675
|
stopPropagating: !1
|
|
672
676
|
});
|
|
673
677
|
};
|
|
674
|
-
let
|
|
675
|
-
const
|
|
676
|
-
|
|
678
|
+
let A;
|
|
679
|
+
const L = (m) => {
|
|
680
|
+
h(m), _(y, m), A = m;
|
|
677
681
|
}, p = () => {
|
|
678
|
-
|
|
682
|
+
A && L(A);
|
|
679
683
|
};
|
|
680
|
-
let w,
|
|
681
|
-
const O = (
|
|
684
|
+
let w, x, D;
|
|
685
|
+
const O = (m) => {
|
|
682
686
|
var T;
|
|
683
|
-
w = (T = r.value[0]) == null ? void 0 : T.object, i = 0,
|
|
684
|
-
(
|
|
685
|
-
(
|
|
686
|
-
), _(C,
|
|
687
|
+
w = (T = r.value[0]) == null ? void 0 : T.object, i = 0, x = new ge(
|
|
688
|
+
(m == null ? void 0 : m.clientX) ?? s.value,
|
|
689
|
+
(m == null ? void 0 : m.clientY) ?? l.value
|
|
690
|
+
), _(C, m);
|
|
687
691
|
};
|
|
688
692
|
let B, R = !1;
|
|
689
|
-
const ne = (
|
|
693
|
+
const ne = (m) => {
|
|
690
694
|
var T, F, re;
|
|
691
|
-
|
|
692
|
-
(
|
|
693
|
-
(
|
|
694
|
-
), i =
|
|
695
|
-
},
|
|
696
|
-
R && (_(b,
|
|
697
|
-
}, Le = (
|
|
698
|
-
return n.value.addEventListener("pointerup", ne), n.value.addEventListener("pointerdown", O), n.value.addEventListener("pointermove",
|
|
699
|
-
n != null && n.value && (n.value.removeEventListener("pointerup", ne), n.value.removeEventListener("pointerdown", O), n.value.removeEventListener("pointermove",
|
|
695
|
+
m instanceof PointerEvent && (r.value.length === 0 && _(M, m), w === ((T = r.value[0]) == null ? void 0 : T.object) && (D = new ge(
|
|
696
|
+
(m == null ? void 0 : m.clientX) ?? s.value,
|
|
697
|
+
(m == null ? void 0 : m.clientY) ?? l.value
|
|
698
|
+
), i = x == null ? void 0 : x.distanceTo(D), m.button === 0 ? (_(g, m), B === ((F = r.value[0]) == null ? void 0 : F.object) ? R = !0 : (B = (re = r.value[0]) == null ? void 0 : re.object, R = !1)) : m.button === 2 && _(P, m)), _(d, m));
|
|
699
|
+
}, ke = (m) => {
|
|
700
|
+
R && (_(b, m), B = void 0, R = !1);
|
|
701
|
+
}, Le = (m) => _(y, m), Re = (m) => _(E, m);
|
|
702
|
+
return n.value.addEventListener("pointerup", ne), n.value.addEventListener("pointerdown", O), n.value.addEventListener("pointermove", L), n.value.addEventListener("pointerleave", Le), n.value.addEventListener("dblclick", ke), n.value.addEventListener("wheel", Re), K(() => {
|
|
703
|
+
n != null && n.value && (n.value.removeEventListener("pointerup", ne), n.value.removeEventListener("pointerdown", O), n.value.removeEventListener("pointermove", L), n.value.removeEventListener("pointerleave", Le), n.value.removeEventListener("dblclick", ke), n.value.removeEventListener("wheel", Re));
|
|
700
704
|
}), {
|
|
701
705
|
intersects: r,
|
|
702
|
-
onClick: (
|
|
703
|
-
onDblClick: (
|
|
704
|
-
onContextMenu: (
|
|
705
|
-
onPointerMove: (
|
|
706
|
-
onPointerUp: (
|
|
707
|
-
onPointerDown: (
|
|
708
|
-
onPointerMissed: (
|
|
709
|
-
onWheel: (
|
|
706
|
+
onClick: (m) => g.on(m).off,
|
|
707
|
+
onDblClick: (m) => b.on(m).off,
|
|
708
|
+
onContextMenu: (m) => P.on(m).off,
|
|
709
|
+
onPointerMove: (m) => y.on(m).off,
|
|
710
|
+
onPointerUp: (m) => d.on(m).off,
|
|
711
|
+
onPointerDown: (m) => C.on(m).off,
|
|
712
|
+
onPointerMissed: (m) => M.on(m).off,
|
|
713
|
+
onWheel: (m) => E.on(m).off,
|
|
710
714
|
forceUpdate: p
|
|
711
715
|
};
|
|
712
716
|
};
|
|
713
|
-
function
|
|
717
|
+
function Vr() {
|
|
714
718
|
const { logWarning: e } = Y();
|
|
715
|
-
function t(
|
|
719
|
+
function t(l, i, a) {
|
|
716
720
|
let c = null;
|
|
717
|
-
return
|
|
718
|
-
o[i] ===
|
|
719
|
-
}), c || e(`Child with ${i} '${
|
|
721
|
+
return l.traverse((o) => {
|
|
722
|
+
o[i] === a && (c = o);
|
|
723
|
+
}), c || e(`Child with ${i} '${a}' not found.`), c;
|
|
720
724
|
}
|
|
721
|
-
function n(
|
|
725
|
+
function n(l, i, a) {
|
|
722
726
|
const c = [];
|
|
723
|
-
return
|
|
724
|
-
o[i].includes(
|
|
725
|
-
}), c.length || e(`Children with ${i} '${
|
|
727
|
+
return l.traverse((o) => {
|
|
728
|
+
o[i].includes(a) && c.push(o);
|
|
729
|
+
}), c.length || e(`Children with ${i} '${a}' not found.`), c;
|
|
726
730
|
}
|
|
727
|
-
function r(
|
|
728
|
-
return t(
|
|
731
|
+
function r(l, i) {
|
|
732
|
+
return t(l, "name", i);
|
|
729
733
|
}
|
|
730
|
-
function s(
|
|
731
|
-
return n(
|
|
734
|
+
function s(l, i) {
|
|
735
|
+
return n(l, "name", i);
|
|
732
736
|
}
|
|
733
737
|
return {
|
|
734
738
|
seek: t,
|
|
@@ -737,93 +741,93 @@ function Gr() {
|
|
|
737
741
|
seekAllByName: s
|
|
738
742
|
};
|
|
739
743
|
}
|
|
740
|
-
function
|
|
744
|
+
function xe(e) {
|
|
741
745
|
let t = 0;
|
|
742
746
|
return e.traverse((n) => {
|
|
743
747
|
if (n.isMesh && n.geometry && n.type !== "HightlightMesh") {
|
|
744
|
-
const r = n.geometry, s = r.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT,
|
|
748
|
+
const r = n.geometry, s = r.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, l = r.index ? r.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, i = r.attributes.normal ? r.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, a = r.attributes.uv ? r.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, c = s + l + i + a;
|
|
745
749
|
t += c;
|
|
746
750
|
}
|
|
747
751
|
}), t;
|
|
748
752
|
}
|
|
749
|
-
function
|
|
753
|
+
function fr(e) {
|
|
750
754
|
return (e / 1024).toFixed(2);
|
|
751
755
|
}
|
|
752
|
-
const
|
|
753
|
-
function
|
|
754
|
-
var
|
|
756
|
+
const Ce = H({}), Me = (e) => Object.assign(Ce.value, e);
|
|
757
|
+
function dr(e, t, n) {
|
|
758
|
+
var L;
|
|
755
759
|
const r = $(), s = $();
|
|
756
760
|
e && (r.value = e), t && (s.value = t);
|
|
757
|
-
const
|
|
761
|
+
const l = (p) => {
|
|
758
762
|
var w;
|
|
759
763
|
return ((w = p.__tres) == null ? void 0 : w.eventCount) > 0;
|
|
760
764
|
}, i = (p) => {
|
|
761
765
|
var w;
|
|
762
|
-
return ((w = p.children) == null ? void 0 : w.some((
|
|
763
|
-
},
|
|
766
|
+
return ((w = p.children) == null ? void 0 : w.some((x) => i(x))) || l(p);
|
|
767
|
+
}, a = $(((L = r.value) == null ? void 0 : L.children).filter(i) || []);
|
|
764
768
|
function c(p, w) {
|
|
765
769
|
if (Array.isArray(p))
|
|
766
|
-
for (const
|
|
767
|
-
|
|
770
|
+
for (const x of p)
|
|
771
|
+
x(w);
|
|
768
772
|
typeof p == "function" && p(w);
|
|
769
773
|
}
|
|
770
774
|
function o(p, w) {
|
|
771
|
-
const
|
|
775
|
+
const x = [], D = () => w.stopPropagating = !0;
|
|
772
776
|
w.stopPropagation = D;
|
|
773
777
|
for (const O of w == null ? void 0 : w.intersections) {
|
|
774
778
|
if (w.stopPropagating)
|
|
775
779
|
return;
|
|
776
780
|
w = { ...w, ...O };
|
|
777
781
|
const { object: B } = O;
|
|
778
|
-
w.eventObject = B, c(B[p], w),
|
|
782
|
+
w.eventObject = B, c(B[p], w), x.push(B);
|
|
779
783
|
let R = B.parent;
|
|
780
|
-
for (; R !== null && !w.stopPropagating && !
|
|
781
|
-
w.eventObject = R, c(R[p], w),
|
|
782
|
-
const ne =
|
|
784
|
+
for (; R !== null && !w.stopPropagating && !x.includes(R); )
|
|
785
|
+
w.eventObject = R, c(R[p], w), x.push(R), R = R.parent;
|
|
786
|
+
const ne = Vn(p.slice(2));
|
|
783
787
|
n(ne, { intersection: O, event: w });
|
|
784
788
|
}
|
|
785
789
|
}
|
|
786
790
|
const {
|
|
787
791
|
onClick: u,
|
|
788
|
-
onDblClick:
|
|
792
|
+
onDblClick: v,
|
|
789
793
|
onContextMenu: f,
|
|
790
|
-
onPointerMove:
|
|
791
|
-
onPointerDown:
|
|
794
|
+
onPointerMove: h,
|
|
795
|
+
onPointerDown: g,
|
|
792
796
|
onPointerUp: b,
|
|
793
|
-
onPointerMissed:
|
|
797
|
+
onPointerMissed: y,
|
|
794
798
|
onWheel: d,
|
|
795
799
|
forceUpdate: C
|
|
796
|
-
} =
|
|
797
|
-
b((p) => o("onPointerUp", p)),
|
|
798
|
-
let
|
|
799
|
-
|
|
800
|
-
const w = p.intersections.map(({ object: D }) => D),
|
|
801
|
-
|
|
802
|
-
w.includes(D) || (p.intersections =
|
|
803
|
-
}), p.intersections =
|
|
804
|
-
|
|
805
|
-
}), o("onPointerMove", p),
|
|
800
|
+
} = ur(a, t);
|
|
801
|
+
b((p) => o("onPointerUp", p)), g((p) => o("onPointerDown", p)), u((p) => o("onClick", p)), v((p) => o("onDoubleClick", p)), f((p) => o("onContextMenu", p)), d((p) => o("onWheel", p));
|
|
802
|
+
let M = [];
|
|
803
|
+
h((p) => {
|
|
804
|
+
const w = p.intersections.map(({ object: D }) => D), x = p.intersections;
|
|
805
|
+
M.forEach(({ object: D }) => {
|
|
806
|
+
w.includes(D) || (p.intersections = M, o("onPointerLeave", p), o("onPointerOut", p));
|
|
807
|
+
}), p.intersections = x, p.intersections.forEach(({ object: D }) => {
|
|
808
|
+
M.includes(D) || (o("onPointerEnter", p), o("onPointerOver", p));
|
|
809
|
+
}), o("onPointerMove", p), M = p.intersections;
|
|
806
810
|
});
|
|
807
811
|
const P = [];
|
|
808
|
-
|
|
812
|
+
y((p) => {
|
|
809
813
|
const w = () => p.stopPropagating = !0;
|
|
810
|
-
p.stopPropagation = w, P.forEach((
|
|
811
|
-
p.stopPropagating || (p.eventObject =
|
|
814
|
+
p.stopPropagation = w, P.forEach((x) => {
|
|
815
|
+
p.stopPropagating || (p.eventObject = x, c(x.onPointerMissed, p));
|
|
812
816
|
}), n("pointer-missed", { event: p });
|
|
813
817
|
});
|
|
814
|
-
function
|
|
815
|
-
oe(p) && N(p) &&
|
|
818
|
+
function E(p) {
|
|
819
|
+
oe(p) && N(p) && a.value.push(p);
|
|
816
820
|
}
|
|
817
|
-
function
|
|
821
|
+
function S(p) {
|
|
818
822
|
if (oe(p) && N(p)) {
|
|
819
|
-
const w =
|
|
820
|
-
w > -1 &&
|
|
823
|
+
const w = a.value.indexOf(p);
|
|
824
|
+
w > -1 && a.value.splice(w, 1);
|
|
821
825
|
}
|
|
822
826
|
}
|
|
823
827
|
function _(p) {
|
|
824
828
|
oe(p) && N(p) && p.onPointerMissed && P.push(p);
|
|
825
829
|
}
|
|
826
|
-
function
|
|
830
|
+
function A(p) {
|
|
827
831
|
if (oe(p) && N(p)) {
|
|
828
832
|
const w = P.indexOf(p);
|
|
829
833
|
w > -1 && P.splice(w, 1);
|
|
@@ -831,22 +835,22 @@ function fr(e, t, n) {
|
|
|
831
835
|
}
|
|
832
836
|
return t.eventManager = {
|
|
833
837
|
forceUpdate: C,
|
|
834
|
-
registerObject:
|
|
835
|
-
deregisterObject:
|
|
838
|
+
registerObject: E,
|
|
839
|
+
deregisterObject: S,
|
|
836
840
|
registerPointerMissedObject: _,
|
|
837
|
-
deregisterPointerMissedObject:
|
|
841
|
+
deregisterPointerMissedObject: A
|
|
838
842
|
}, {
|
|
839
843
|
forceUpdate: C,
|
|
840
|
-
registerObject:
|
|
841
|
-
deregisterObject:
|
|
844
|
+
registerObject: E,
|
|
845
|
+
deregisterObject: S,
|
|
842
846
|
registerPointerMissedObject: _,
|
|
843
|
-
deregisterPointerMissedObject:
|
|
847
|
+
deregisterPointerMissedObject: A
|
|
844
848
|
};
|
|
845
849
|
}
|
|
846
|
-
function
|
|
847
|
-
const r = k(e) ? rn() : on(V(() => k(t).parentElement)), s = ye(Fe(r.width, n)),
|
|
850
|
+
function pr(e, t, n = 10) {
|
|
851
|
+
const r = k(e) ? rn() : on(V(() => k(t).parentElement)), s = ye(Fe(r.width, n)), l = ye(Fe(r.height, n)), i = V(() => s.value / l.value);
|
|
848
852
|
return {
|
|
849
|
-
height:
|
|
853
|
+
height: l,
|
|
850
854
|
width: s,
|
|
851
855
|
aspectRatio: i
|
|
852
856
|
};
|
|
@@ -855,21 +859,21 @@ function ve() {
|
|
|
855
859
|
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
|
|
856
860
|
let n = 0, r = !1;
|
|
857
861
|
const s = () => {
|
|
858
|
-
const o = Array.from(e.entries()).sort((u,
|
|
859
|
-
const f = u[1].priority -
|
|
860
|
-
return f === 0 ? u[1].addI -
|
|
862
|
+
const o = Array.from(e.entries()).sort((u, v) => {
|
|
863
|
+
const f = u[1].priority - v[1].priority;
|
|
864
|
+
return f === 0 ? u[1].addI - v[1].addI : f;
|
|
861
865
|
});
|
|
862
866
|
t.clear(), o.forEach((u) => t.add(u[0]));
|
|
863
|
-
},
|
|
867
|
+
}, l = (o) => {
|
|
864
868
|
e.delete(o), t.delete(o);
|
|
865
869
|
};
|
|
866
870
|
return { on: (o, u = 0) => {
|
|
867
871
|
e.set(o, { priority: u, addI: n++ });
|
|
868
|
-
const
|
|
869
|
-
return sn(
|
|
870
|
-
off:
|
|
872
|
+
const v = () => l(o);
|
|
873
|
+
return sn(v), r = !0, {
|
|
874
|
+
off: v
|
|
871
875
|
};
|
|
872
|
-
}, off:
|
|
876
|
+
}, off: l, trigger: (...o) => {
|
|
873
877
|
r && (s(), r = !1), t.forEach((u) => u(...o));
|
|
874
878
|
}, dispose: () => {
|
|
875
879
|
e.clear(), t.clear();
|
|
@@ -877,52 +881,52 @@ function ve() {
|
|
|
877
881
|
return e.size;
|
|
878
882
|
} };
|
|
879
883
|
}
|
|
880
|
-
function
|
|
884
|
+
function mr() {
|
|
881
885
|
let e = !0, t = !0, n = !1;
|
|
882
|
-
const r = new tt(!1), s = H(r.running),
|
|
886
|
+
const r = new tt(!1), s = H(r.running), l = H(!1);
|
|
883
887
|
let i;
|
|
884
|
-
const
|
|
888
|
+
const a = rt.generateUUID();
|
|
885
889
|
let c = null;
|
|
886
|
-
const o = ve(), u = ve(),
|
|
887
|
-
|
|
890
|
+
const o = ve(), u = ve(), v = ve();
|
|
891
|
+
S();
|
|
888
892
|
let f = {};
|
|
889
|
-
function
|
|
893
|
+
function h(_) {
|
|
890
894
|
f = _;
|
|
891
895
|
}
|
|
892
|
-
function
|
|
893
|
-
switch (
|
|
896
|
+
function g(_, A, L = 0) {
|
|
897
|
+
switch (A) {
|
|
894
898
|
case "before":
|
|
895
|
-
return o.on(_,
|
|
899
|
+
return o.on(_, L);
|
|
896
900
|
case "render":
|
|
897
901
|
return c || (c = _), u.dispose(), u.on(_);
|
|
898
902
|
case "after":
|
|
899
|
-
return
|
|
903
|
+
return v.on(_, L);
|
|
900
904
|
}
|
|
901
905
|
}
|
|
902
906
|
function b() {
|
|
903
|
-
t && (t = !1,
|
|
907
|
+
t && (t = !1, S(), E());
|
|
904
908
|
}
|
|
905
|
-
function
|
|
906
|
-
t = !0,
|
|
909
|
+
function y() {
|
|
910
|
+
t = !0, S(), cancelAnimationFrame(i);
|
|
907
911
|
}
|
|
908
912
|
function d() {
|
|
909
|
-
n = !1,
|
|
913
|
+
n = !1, S();
|
|
910
914
|
}
|
|
911
915
|
function C() {
|
|
912
|
-
n = !0,
|
|
916
|
+
n = !0, S();
|
|
913
917
|
}
|
|
914
|
-
function
|
|
915
|
-
|
|
918
|
+
function M() {
|
|
919
|
+
l.value = !0;
|
|
916
920
|
}
|
|
917
921
|
function P() {
|
|
918
|
-
|
|
922
|
+
l.value = !1;
|
|
919
923
|
}
|
|
920
|
-
function
|
|
924
|
+
function E() {
|
|
921
925
|
if (!e) {
|
|
922
|
-
i = requestAnimationFrame(
|
|
926
|
+
i = requestAnimationFrame(E);
|
|
923
927
|
return;
|
|
924
928
|
}
|
|
925
|
-
const _ = r.getDelta(),
|
|
929
|
+
const _ = r.getDelta(), A = r.getElapsedTime(), L = {
|
|
926
930
|
camera: J(f.camera),
|
|
927
931
|
scene: J(f.scene),
|
|
928
932
|
renderer: J(f.renderer),
|
|
@@ -930,50 +934,50 @@ function pr() {
|
|
|
930
934
|
controls: J(f.controls),
|
|
931
935
|
invalidate: f.invalidate,
|
|
932
936
|
advance: f.advance
|
|
933
|
-
}, p = { delta: _, elapsed:
|
|
934
|
-
s.value && o.trigger(p),
|
|
937
|
+
}, p = { delta: _, elapsed: A, clock: r, ...L };
|
|
938
|
+
s.value && o.trigger(p), l.value || (u.count ? u.trigger(p) : c && c(p)), s.value && v.trigger(p), i = requestAnimationFrame(E);
|
|
935
939
|
}
|
|
936
|
-
function
|
|
940
|
+
function S() {
|
|
937
941
|
const _ = !t && !n;
|
|
938
942
|
r.running !== _ && (r.running ? r.stop() : r.start()), s.value = r.running;
|
|
939
943
|
}
|
|
940
944
|
return {
|
|
941
|
-
loopId:
|
|
942
|
-
register: (_,
|
|
945
|
+
loopId: a,
|
|
946
|
+
register: (_, A, L) => g(_, A, L),
|
|
943
947
|
start: b,
|
|
944
|
-
stop:
|
|
948
|
+
stop: y,
|
|
945
949
|
pause: C,
|
|
946
950
|
resume: d,
|
|
947
|
-
pauseRender:
|
|
951
|
+
pauseRender: M,
|
|
948
952
|
resumeRender: P,
|
|
949
|
-
isRenderPaused:
|
|
953
|
+
isRenderPaused: l,
|
|
950
954
|
isActive: s,
|
|
951
|
-
setContext:
|
|
955
|
+
setContext: h,
|
|
952
956
|
setReady: (_) => e = _
|
|
953
957
|
};
|
|
954
958
|
}
|
|
955
|
-
function
|
|
959
|
+
function hr(e, t, n = 100) {
|
|
956
960
|
n = n <= 0 ? 100 : n;
|
|
957
961
|
const r = j(), s = /* @__PURE__ */ new Set();
|
|
958
|
-
let
|
|
962
|
+
let l = !1, i = !1, a = null;
|
|
959
963
|
function c() {
|
|
960
|
-
|
|
964
|
+
a && clearTimeout(a), !i && !l && e() ? (r.trigger(t), s.forEach((f) => f()), s.clear(), l = !0) : !i && !l && (a = setTimeout(c, n));
|
|
961
965
|
}
|
|
962
966
|
function o() {
|
|
963
|
-
i = !0,
|
|
967
|
+
i = !0, a && clearTimeout(a);
|
|
964
968
|
}
|
|
965
969
|
c();
|
|
966
|
-
const u = (f, ...
|
|
967
|
-
f(...
|
|
970
|
+
const u = (f, ...h) => {
|
|
971
|
+
f(...h);
|
|
968
972
|
};
|
|
969
973
|
return {
|
|
970
974
|
on: (f) => {
|
|
971
|
-
if (
|
|
975
|
+
if (l)
|
|
972
976
|
return u(f, t), { off: () => {
|
|
973
977
|
} };
|
|
974
978
|
{
|
|
975
|
-
const
|
|
976
|
-
return s.add(
|
|
979
|
+
const h = r.on(f);
|
|
980
|
+
return s.add(h.off), r.on(f);
|
|
977
981
|
}
|
|
978
982
|
},
|
|
979
983
|
off: r.off,
|
|
@@ -985,64 +989,64 @@ const te = /* @__PURE__ */ new WeakMap();
|
|
|
985
989
|
function gt(e) {
|
|
986
990
|
if (e = e || pe(), te.has(e))
|
|
987
991
|
return te.get(e);
|
|
988
|
-
const t = 100, n = Date.now(),
|
|
992
|
+
const t = 100, n = Date.now(), l = hr(() => {
|
|
989
993
|
if (Date.now() - n >= t)
|
|
990
994
|
return !0;
|
|
991
995
|
{
|
|
992
|
-
const i = e.renderer.value,
|
|
993
|
-
return !!(i &&
|
|
996
|
+
const i = e.renderer.value, a = (i == null ? void 0 : i.domElement) || { width: 0, height: 0 };
|
|
997
|
+
return !!(i && a.width > 0 && a.height > 0);
|
|
994
998
|
}
|
|
995
999
|
}, e);
|
|
996
|
-
return te.set(e,
|
|
1000
|
+
return te.set(e, l), l;
|
|
997
1001
|
}
|
|
998
|
-
function
|
|
1002
|
+
function Yr(e) {
|
|
999
1003
|
const t = pe();
|
|
1000
1004
|
if (t)
|
|
1001
1005
|
return te.has(t) ? te.get(t).on(e) : gt(t).on(e);
|
|
1002
1006
|
}
|
|
1003
|
-
function
|
|
1007
|
+
function gr({
|
|
1004
1008
|
scene: e,
|
|
1005
1009
|
canvas: t,
|
|
1006
1010
|
windowSize: n,
|
|
1007
1011
|
disableRender: r,
|
|
1008
1012
|
rendererOptions: s,
|
|
1009
|
-
emit:
|
|
1013
|
+
emit: l
|
|
1010
1014
|
}) {
|
|
1011
|
-
const i = $(e),
|
|
1015
|
+
const i = $(e), a = pr(n, t), {
|
|
1012
1016
|
camera: c,
|
|
1013
1017
|
cameras: o,
|
|
1014
1018
|
registerCamera: u,
|
|
1015
|
-
deregisterCamera:
|
|
1019
|
+
deregisterCamera: v,
|
|
1016
1020
|
setCameraActive: f
|
|
1017
|
-
} =
|
|
1021
|
+
} = In({ sizes: a, scene: e }), h = {
|
|
1018
1022
|
mode: H(s.renderMode || "always"),
|
|
1019
1023
|
priority: H(0),
|
|
1020
1024
|
frames: H(0),
|
|
1021
1025
|
maxFrames: 60,
|
|
1022
|
-
canBeInvalidated: V(() =>
|
|
1026
|
+
canBeInvalidated: V(() => h.mode.value === "on-demand" && h.frames.value === 0)
|
|
1023
1027
|
};
|
|
1024
|
-
function
|
|
1025
|
-
s.renderMode === "on-demand" && (
|
|
1028
|
+
function g(O = 1) {
|
|
1029
|
+
s.renderMode === "on-demand" && (h.frames.value = Math.min(h.maxFrames, h.frames.value + O));
|
|
1026
1030
|
}
|
|
1027
1031
|
function b() {
|
|
1028
|
-
s.renderMode === "manual" && (
|
|
1032
|
+
s.renderMode === "manual" && (h.frames.value = 1);
|
|
1029
1033
|
}
|
|
1030
|
-
const { renderer:
|
|
1034
|
+
const { renderer: y } = ar(
|
|
1031
1035
|
{
|
|
1032
1036
|
scene: e,
|
|
1033
1037
|
canvas: t,
|
|
1034
1038
|
options: s,
|
|
1035
|
-
emit:
|
|
1039
|
+
emit: l,
|
|
1036
1040
|
// TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
|
|
1037
|
-
contextParts: { sizes:
|
|
1041
|
+
contextParts: { sizes: a, camera: c, render: h, invalidate: g, advance: b },
|
|
1038
1042
|
disableRender: r
|
|
1039
1043
|
}
|
|
1040
1044
|
), d = {
|
|
1041
|
-
sizes:
|
|
1045
|
+
sizes: a,
|
|
1042
1046
|
scene: i,
|
|
1043
1047
|
camera: c,
|
|
1044
1048
|
cameras: ye(o),
|
|
1045
|
-
renderer:
|
|
1049
|
+
renderer: y,
|
|
1046
1050
|
raycaster: $(new Ft()),
|
|
1047
1051
|
controls: H(null),
|
|
1048
1052
|
perf: {
|
|
@@ -1057,74 +1061,74 @@ function hr({
|
|
|
1057
1061
|
accumulator: []
|
|
1058
1062
|
}
|
|
1059
1063
|
},
|
|
1060
|
-
render:
|
|
1064
|
+
render: h,
|
|
1061
1065
|
advance: b,
|
|
1062
|
-
extend:
|
|
1063
|
-
invalidate:
|
|
1066
|
+
extend: Me,
|
|
1067
|
+
invalidate: g,
|
|
1064
1068
|
registerCamera: u,
|
|
1065
1069
|
setCameraActive: f,
|
|
1066
|
-
deregisterCamera:
|
|
1067
|
-
loop:
|
|
1070
|
+
deregisterCamera: v,
|
|
1071
|
+
loop: mr()
|
|
1068
1072
|
};
|
|
1069
1073
|
_e("useTres", d), d.scene.value.__tres = {
|
|
1070
1074
|
root: d
|
|
1071
1075
|
}, d.loop.register(() => {
|
|
1072
|
-
c.value &&
|
|
1076
|
+
c.value && h.frames.value > 0 && (y.value.render(e, c.value), l("render", d.renderer.value)), h.priority.value = 0, h.mode.value === "always" ? h.frames.value = 1 : h.frames.value = Math.max(0, h.frames.value - 1);
|
|
1073
1077
|
}, "render");
|
|
1074
|
-
const { on: C, cancel:
|
|
1078
|
+
const { on: C, cancel: M } = gt(d);
|
|
1075
1079
|
d.loop.setReady(!1), d.loop.start(), C(() => {
|
|
1076
|
-
|
|
1080
|
+
l("ready", d), d.loop.setReady(!0), dr(e, d, l);
|
|
1077
1081
|
}), K(() => {
|
|
1078
|
-
|
|
1082
|
+
M(), d.loop.stop();
|
|
1079
1083
|
});
|
|
1080
|
-
const P = 100,
|
|
1081
|
-
let
|
|
1084
|
+
const P = 100, E = an({ every: P }), { isSupported: S, memory: _ } = ln({ interval: P }), A = 160;
|
|
1085
|
+
let L = performance.now();
|
|
1082
1086
|
const p = ({ timestamp: O }) => {
|
|
1083
|
-
d.scene.value && (d.perf.memory.allocatedMem =
|
|
1087
|
+
d.scene.value && (d.perf.memory.allocatedMem = xe(d.scene.value)), O - L >= P && (L = O, d.perf.fps.accumulator.push(E.value), d.perf.fps.accumulator.length > A && d.perf.fps.accumulator.shift(), d.perf.fps.value = E.value, S.value && _.value && (d.perf.memory.accumulator.push(_.value.usedJSHeapSize / 1024 / 1024), d.perf.memory.accumulator.length > A && d.perf.memory.accumulator.shift(), d.perf.memory.currentMem = d.perf.memory.accumulator.reduce((B, R) => B + R, 0) / d.perf.memory.accumulator.length));
|
|
1084
1088
|
};
|
|
1085
1089
|
let w = 0;
|
|
1086
|
-
const
|
|
1087
|
-
window.__TRES__DEVTOOLS__ && (p({ timestamp: performance.now() }), w += O, w >=
|
|
1090
|
+
const x = 1, { pause: D } = it(({ delta: O }) => {
|
|
1091
|
+
window.__TRES__DEVTOOLS__ && (p({ timestamp: performance.now() }), w += O, w >= x && (window.__TRES__DEVTOOLS__.cb(d), w = 0));
|
|
1088
1092
|
}, { immediate: !0 });
|
|
1089
1093
|
return K(() => {
|
|
1090
1094
|
D();
|
|
1091
1095
|
}), d;
|
|
1092
1096
|
}
|
|
1093
1097
|
function pe() {
|
|
1094
|
-
const e =
|
|
1098
|
+
const e = Ct("useTres");
|
|
1095
1099
|
if (!e)
|
|
1096
1100
|
throw new Error("useTresContext must be used together with useTresContextProvider");
|
|
1097
1101
|
return e;
|
|
1098
1102
|
}
|
|
1099
|
-
const
|
|
1100
|
-
function
|
|
1103
|
+
const qr = pe;
|
|
1104
|
+
function Jr() {
|
|
1101
1105
|
const {
|
|
1102
1106
|
camera: e,
|
|
1103
1107
|
scene: t,
|
|
1104
1108
|
renderer: n,
|
|
1105
1109
|
loop: r,
|
|
1106
1110
|
raycaster: s,
|
|
1107
|
-
controls:
|
|
1111
|
+
controls: l,
|
|
1108
1112
|
invalidate: i,
|
|
1109
|
-
advance:
|
|
1113
|
+
advance: a
|
|
1110
1114
|
} = pe();
|
|
1111
1115
|
r.setContext({
|
|
1112
1116
|
camera: e,
|
|
1113
1117
|
scene: t,
|
|
1114
1118
|
renderer: n,
|
|
1115
1119
|
raycaster: s,
|
|
1116
|
-
controls:
|
|
1120
|
+
controls: l,
|
|
1117
1121
|
invalidate: i,
|
|
1118
|
-
advance:
|
|
1122
|
+
advance: a
|
|
1119
1123
|
});
|
|
1120
|
-
function c(
|
|
1121
|
-
return r.register(
|
|
1124
|
+
function c(v, f = 0) {
|
|
1125
|
+
return r.register(v, "before", f);
|
|
1122
1126
|
}
|
|
1123
|
-
function o(
|
|
1124
|
-
return r.register(
|
|
1127
|
+
function o(v) {
|
|
1128
|
+
return r.register(v, "render");
|
|
1125
1129
|
}
|
|
1126
|
-
function u(
|
|
1127
|
-
return r.register(
|
|
1130
|
+
function u(v, f = 0) {
|
|
1131
|
+
return r.register(v, "after", f);
|
|
1128
1132
|
}
|
|
1129
1133
|
return {
|
|
1130
1134
|
pause: r.pause,
|
|
@@ -1137,24 +1141,24 @@ function qr() {
|
|
|
1137
1141
|
onAfterRender: u
|
|
1138
1142
|
};
|
|
1139
1143
|
}
|
|
1140
|
-
function
|
|
1144
|
+
function vr(e, t = {}, n = {}) {
|
|
1141
1145
|
let r = e;
|
|
1142
|
-
const s = (
|
|
1143
|
-
r =
|
|
1146
|
+
const s = (a) => {
|
|
1147
|
+
r = a;
|
|
1144
1148
|
};
|
|
1145
|
-
let
|
|
1149
|
+
let l = new Proxy({}, {});
|
|
1146
1150
|
const i = {
|
|
1147
|
-
has(
|
|
1151
|
+
has(a, c) {
|
|
1148
1152
|
return c in t || c in r;
|
|
1149
1153
|
},
|
|
1150
|
-
get(
|
|
1154
|
+
get(a, c, o) {
|
|
1151
1155
|
return c in t ? t[c](r) : r[c];
|
|
1152
1156
|
},
|
|
1153
|
-
set(
|
|
1154
|
-
return n[c] ? n[c](o, r,
|
|
1157
|
+
set(a, c, o) {
|
|
1158
|
+
return n[c] ? n[c](o, r, l, s) : r[c] = o, !0;
|
|
1155
1159
|
}
|
|
1156
1160
|
};
|
|
1157
|
-
return
|
|
1161
|
+
return l = new Proxy({}, i), l;
|
|
1158
1162
|
}
|
|
1159
1163
|
const { logError: Ke } = Y(), Qe = [
|
|
1160
1164
|
"onClick",
|
|
@@ -1171,18 +1175,18 @@ const { logError: Ke } = Y(), Qe = [
|
|
|
1171
1175
|
"onPointerMissed",
|
|
1172
1176
|
"onLostPointerCapture",
|
|
1173
1177
|
"onWheel"
|
|
1174
|
-
],
|
|
1178
|
+
], yr = (e) => {
|
|
1175
1179
|
const t = e.scene.value;
|
|
1176
|
-
function n(o, u,
|
|
1177
|
-
if (f || (f = {}), f.args || (f.args = []), o === "template" ||
|
|
1180
|
+
function n(o, u, v, f) {
|
|
1181
|
+
if (f || (f = {}), f.args || (f.args = []), o === "template" || zn(o))
|
|
1178
1182
|
return null;
|
|
1179
|
-
let
|
|
1183
|
+
let h = o.replace("Tres", ""), g;
|
|
1180
1184
|
if (o === "primitive") {
|
|
1181
|
-
(!U(f.object) ||
|
|
1185
|
+
(!U(f.object) || Mt(f.object)) && Ke(
|
|
1182
1186
|
"Tres primitives need an 'object' prop, whose value is an object or shallowRef<object>"
|
|
1183
|
-
),
|
|
1187
|
+
), h = f.object.type;
|
|
1184
1188
|
const b = {};
|
|
1185
|
-
|
|
1189
|
+
g = vr(
|
|
1186
1190
|
f.object,
|
|
1187
1191
|
{
|
|
1188
1192
|
object: (d) => d,
|
|
@@ -1190,8 +1194,8 @@ const { logError: Ke } = Y(), Qe = [
|
|
|
1190
1194
|
__tres: () => b
|
|
1191
1195
|
},
|
|
1192
1196
|
{
|
|
1193
|
-
object: (d, C,
|
|
1194
|
-
|
|
1197
|
+
object: (d, C, M, P) => {
|
|
1198
|
+
sr(d, M, P, { patchProp: l, remove: s, insert: r }, e);
|
|
1195
1199
|
},
|
|
1196
1200
|
__tres: (d) => {
|
|
1197
1201
|
Object.assign(b, d);
|
|
@@ -1199,37 +1203,37 @@ const { logError: Ke } = Y(), Qe = [
|
|
|
1199
1203
|
}
|
|
1200
1204
|
);
|
|
1201
1205
|
} else {
|
|
1202
|
-
const b =
|
|
1206
|
+
const b = Ce.value[h];
|
|
1203
1207
|
b || Ke(
|
|
1204
|
-
`${
|
|
1205
|
-
),
|
|
1208
|
+
`${h} is not defined on the THREE namespace. Use extend to add it to the catalog.`
|
|
1209
|
+
), g = new b(...f.args);
|
|
1206
1210
|
}
|
|
1207
|
-
return
|
|
1208
|
-
...
|
|
1209
|
-
type:
|
|
1211
|
+
return g ? (g.isCamera && (f != null && f.position || g.position.set(3, 3, 3), f != null && f.lookAt || g.lookAt(0, 0, 0)), g = z(g, {
|
|
1212
|
+
...g.__tres,
|
|
1213
|
+
type: h,
|
|
1210
1214
|
memoizedProps: f,
|
|
1211
1215
|
eventCount: 0,
|
|
1212
1216
|
primitive: o === "primitive",
|
|
1213
1217
|
attach: f.attach
|
|
1214
|
-
}, e),
|
|
1218
|
+
}, e), g) : null;
|
|
1215
1219
|
}
|
|
1216
1220
|
function r(o, u) {
|
|
1217
|
-
var
|
|
1221
|
+
var h, g, b;
|
|
1218
1222
|
if (!o)
|
|
1219
1223
|
return;
|
|
1220
1224
|
u = u || t;
|
|
1221
|
-
const
|
|
1222
|
-
o = Q(
|
|
1225
|
+
const v = o.__tres ? o : z(o, {}, e), f = u.__tres ? u : z(u, {}, e);
|
|
1226
|
+
o = Q(v), u = Q(f), o.__tres && ((h = o.__tres) == null ? void 0 : h.eventCount) > 0 && ((g = e.eventManager) == null || g.registerObject(o)), e.registerCamera(o), (b = e.eventManager) == null || b.registerPointerMissedObject(o), v.__tres.attach ? nr(f, v, v.__tres.attach) : N(o) && N(f) && (f.add(o), o.dispatchEvent({ type: "added" })), v.__tres.parent = f, f.__tres.objects && !f.__tres.objects.includes(v) && f.__tres.objects.push(v);
|
|
1223
1227
|
}
|
|
1224
1228
|
function s(o, u) {
|
|
1225
|
-
var
|
|
1229
|
+
var g, b, y, d;
|
|
1226
1230
|
if (!o)
|
|
1227
1231
|
return;
|
|
1228
|
-
o != null && o.__tres && ((
|
|
1229
|
-
const
|
|
1230
|
-
be(
|
|
1231
|
-
const f = (d = o.__tres) == null ? void 0 : d.primitive,
|
|
1232
|
-
if (o.__tres && "objects" in o.__tres && [...o.__tres.objects].forEach((C) => s(C, u)),
|
|
1232
|
+
o != null && o.__tres && ((g = o.__tres) == null ? void 0 : g.eventCount) > 0 && ((b = e.eventManager) == null || b.deregisterObject(o)), u = be(u) ? "default" : u;
|
|
1233
|
+
const v = (y = o.__tres) == null ? void 0 : y.dispose;
|
|
1234
|
+
be(v) || (v === null ? u = !1 : u = v);
|
|
1235
|
+
const f = (d = o.__tres) == null ? void 0 : d.primitive, h = u === "default" ? !f : !!u;
|
|
1236
|
+
if (o.__tres && "objects" in o.__tres && [...o.__tres.objects].forEach((C) => s(C, u)), h && o.children && [...o.children].forEach((C) => s(C, u)), mt(o, e), ht(o, e), h && !jn(o)) {
|
|
1233
1237
|
if (G(u))
|
|
1234
1238
|
u(o);
|
|
1235
1239
|
else if (G(o.dispose))
|
|
@@ -1240,11 +1244,11 @@ const { logError: Ke } = Y(), Qe = [
|
|
|
1240
1244
|
}
|
|
1241
1245
|
"__tres" in o && delete o.__tres;
|
|
1242
1246
|
}
|
|
1243
|
-
function
|
|
1244
|
-
var C,
|
|
1247
|
+
function l(o, u, v, f) {
|
|
1248
|
+
var C, M;
|
|
1245
1249
|
if (!o)
|
|
1246
1250
|
return;
|
|
1247
|
-
let
|
|
1251
|
+
let h = o, g = u;
|
|
1248
1252
|
if (o.__tres && (o.__tres.memoizedProps[u] = f), u === "attach") {
|
|
1249
1253
|
const P = ((C = o.__tres) == null ? void 0 : C.parent) || o.parent;
|
|
1250
1254
|
s(o), z(o, { attach: f }, e), P && r(o, P);
|
|
@@ -1254,61 +1258,61 @@ const { logError: Ke } = Y(), Qe = [
|
|
|
1254
1258
|
o.__tres || (o = z(o, {}, e)), o.__tres.dispose = f;
|
|
1255
1259
|
return;
|
|
1256
1260
|
}
|
|
1257
|
-
if (N(o) &&
|
|
1258
|
-
f || f === "" ? o[
|
|
1261
|
+
if (N(o) && g === "blocks-pointer-events") {
|
|
1262
|
+
f || f === "" ? o[g] = f : delete o[g];
|
|
1259
1263
|
return;
|
|
1260
1264
|
}
|
|
1261
1265
|
Qe.includes(u) && o.__tres && (o.__tres.eventCount += 1);
|
|
1262
|
-
let b = ie(
|
|
1263
|
-
if (
|
|
1264
|
-
const P = o,
|
|
1265
|
-
_ &&
|
|
1266
|
+
let b = ie(g), y = h == null ? void 0 : h[b];
|
|
1267
|
+
if (g === "args") {
|
|
1268
|
+
const P = o, E = v ?? [], S = f ?? [], _ = ((M = o.__tres) == null ? void 0 : M.type) || o.type;
|
|
1269
|
+
_ && E.length && !Jn(E, S) && (h = Object.assign(
|
|
1266
1270
|
P,
|
|
1267
|
-
new
|
|
1271
|
+
new Ce.value[_](...f)
|
|
1268
1272
|
));
|
|
1269
1273
|
return;
|
|
1270
1274
|
}
|
|
1271
|
-
if (
|
|
1272
|
-
if (
|
|
1275
|
+
if (h.type === "BufferGeometry") {
|
|
1276
|
+
if (g === "args")
|
|
1273
1277
|
return;
|
|
1274
|
-
|
|
1275
|
-
ie(
|
|
1278
|
+
h.setAttribute(
|
|
1279
|
+
ie(g),
|
|
1276
1280
|
new Wt(...f)
|
|
1277
1281
|
);
|
|
1278
1282
|
return;
|
|
1279
1283
|
}
|
|
1280
|
-
if (
|
|
1281
|
-
const P =
|
|
1282
|
-
|
|
1284
|
+
if (g.includes("-") && y === void 0) {
|
|
1285
|
+
const P = g.split("-");
|
|
1286
|
+
y = P.reduce((E, S) => E[ie(S)], h), g = P.pop(), b = g, y != null && y.set || (h = P.reduce((E, S) => E[ie(S)], h));
|
|
1283
1287
|
}
|
|
1284
1288
|
let d = f;
|
|
1285
|
-
if (d === "" && (d = !0), G(
|
|
1286
|
-
Qe.includes(u) || (de(d) ? o[b](...d) : o[b](d)), b.startsWith("on") && G(d) && (
|
|
1289
|
+
if (d === "" && (d = !0), G(y)) {
|
|
1290
|
+
Qe.includes(u) || (de(d) ? o[b](...d) : o[b](d)), b.startsWith("on") && G(d) && (h[b] = d);
|
|
1287
1291
|
return;
|
|
1288
1292
|
}
|
|
1289
|
-
!(
|
|
1293
|
+
!(y != null && y.set) && !G(y) ? h[b] = d : y.constructor === d.constructor && (y != null && y.copy) ? y == null || y.copy(d) : de(d) ? y.set(...d) : !y.isColor && y.setScalar ? y.setScalar(d) : y.set(d), pt(o);
|
|
1290
1294
|
}
|
|
1291
1295
|
function i(o) {
|
|
1292
1296
|
var u;
|
|
1293
1297
|
return ((u = o == null ? void 0 : o.__tres) == null ? void 0 : u.parent) || null;
|
|
1294
1298
|
}
|
|
1295
|
-
function
|
|
1299
|
+
function a(o) {
|
|
1296
1300
|
const u = z(new Nt(), { type: "Comment" }, e);
|
|
1297
1301
|
return u.name = o, u;
|
|
1298
1302
|
}
|
|
1299
1303
|
function c(o) {
|
|
1300
|
-
var
|
|
1301
|
-
const u = i(o),
|
|
1302
|
-
return f < 0 || f >=
|
|
1304
|
+
var h;
|
|
1305
|
+
const u = i(o), v = ((h = u == null ? void 0 : u.__tres) == null ? void 0 : h.objects) || [], f = v.indexOf(o);
|
|
1306
|
+
return f < 0 || f >= v.length - 1 ? null : v[f + 1];
|
|
1303
1307
|
}
|
|
1304
1308
|
return {
|
|
1305
1309
|
insert: r,
|
|
1306
1310
|
remove: s,
|
|
1307
1311
|
createElement: n,
|
|
1308
|
-
patchProp:
|
|
1312
|
+
patchProp: l,
|
|
1309
1313
|
parentNode: i,
|
|
1310
1314
|
createText: () => void 0,
|
|
1311
|
-
createComment:
|
|
1315
|
+
createComment: a,
|
|
1312
1316
|
setText: () => void 0,
|
|
1313
1317
|
setElementText: () => void 0,
|
|
1314
1318
|
nextSibling: c,
|
|
@@ -1318,69 +1322,69 @@ const { logError: Ke } = Y(), Qe = [
|
|
|
1318
1322
|
insertStaticContent: () => void 0
|
|
1319
1323
|
};
|
|
1320
1324
|
};
|
|
1321
|
-
function
|
|
1325
|
+
function _r() {
|
|
1322
1326
|
return vt().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
|
1323
1327
|
}
|
|
1324
1328
|
function vt() {
|
|
1325
1329
|
return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
|
|
1326
1330
|
}
|
|
1327
|
-
const
|
|
1331
|
+
const wr = typeof Proxy == "function", br = "devtools-plugin:setup", Pr = "plugin:settings:set";
|
|
1328
1332
|
let q, Ee;
|
|
1329
|
-
function
|
|
1333
|
+
function Cr() {
|
|
1330
1334
|
var e;
|
|
1331
1335
|
return q !== void 0 || (typeof window < "u" && window.performance ? (q = !0, Ee = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (q = !0, Ee = globalThis.perf_hooks.performance) : q = !1), q;
|
|
1332
1336
|
}
|
|
1333
1337
|
function Mr() {
|
|
1334
|
-
return
|
|
1338
|
+
return Cr() ? Ee.now() : Date.now();
|
|
1335
1339
|
}
|
|
1336
|
-
class
|
|
1340
|
+
class Er {
|
|
1337
1341
|
constructor(t, n) {
|
|
1338
1342
|
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
|
|
1339
1343
|
const r = {};
|
|
1340
1344
|
if (t.settings)
|
|
1341
1345
|
for (const i in t.settings) {
|
|
1342
|
-
const
|
|
1343
|
-
r[i] =
|
|
1346
|
+
const a = t.settings[i];
|
|
1347
|
+
r[i] = a.defaultValue;
|
|
1344
1348
|
}
|
|
1345
1349
|
const s = `__vue-devtools-plugin-settings__${t.id}`;
|
|
1346
|
-
let
|
|
1350
|
+
let l = Object.assign({}, r);
|
|
1347
1351
|
try {
|
|
1348
|
-
const i = localStorage.getItem(s),
|
|
1349
|
-
Object.assign(
|
|
1352
|
+
const i = localStorage.getItem(s), a = JSON.parse(i);
|
|
1353
|
+
Object.assign(l, a);
|
|
1350
1354
|
} catch {
|
|
1351
1355
|
}
|
|
1352
1356
|
this.fallbacks = {
|
|
1353
1357
|
getSettings() {
|
|
1354
|
-
return
|
|
1358
|
+
return l;
|
|
1355
1359
|
},
|
|
1356
1360
|
setSettings(i) {
|
|
1357
1361
|
try {
|
|
1358
1362
|
localStorage.setItem(s, JSON.stringify(i));
|
|
1359
1363
|
} catch {
|
|
1360
1364
|
}
|
|
1361
|
-
|
|
1365
|
+
l = i;
|
|
1362
1366
|
},
|
|
1363
1367
|
now() {
|
|
1364
1368
|
return Mr();
|
|
1365
1369
|
}
|
|
1366
|
-
}, n && n.on(
|
|
1367
|
-
i === this.plugin.id && this.fallbacks.setSettings(
|
|
1370
|
+
}, n && n.on(Pr, (i, a) => {
|
|
1371
|
+
i === this.plugin.id && this.fallbacks.setSettings(a);
|
|
1368
1372
|
}), this.proxiedOn = new Proxy({}, {
|
|
1369
|
-
get: (i,
|
|
1373
|
+
get: (i, a) => this.target ? this.target.on[a] : (...c) => {
|
|
1370
1374
|
this.onQueue.push({
|
|
1371
|
-
method:
|
|
1375
|
+
method: a,
|
|
1372
1376
|
args: c
|
|
1373
1377
|
});
|
|
1374
1378
|
}
|
|
1375
1379
|
}), this.proxiedTarget = new Proxy({}, {
|
|
1376
|
-
get: (i,
|
|
1377
|
-
method:
|
|
1380
|
+
get: (i, a) => this.target ? this.target[a] : a === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(a) ? (...c) => (this.targetQueue.push({
|
|
1381
|
+
method: a,
|
|
1378
1382
|
args: c,
|
|
1379
1383
|
resolve: () => {
|
|
1380
1384
|
}
|
|
1381
|
-
}), this.fallbacks[
|
|
1385
|
+
}), this.fallbacks[a](...c)) : (...c) => new Promise((o) => {
|
|
1382
1386
|
this.targetQueue.push({
|
|
1383
|
-
method:
|
|
1387
|
+
method: a,
|
|
1384
1388
|
args: c,
|
|
1385
1389
|
resolve: o
|
|
1386
1390
|
});
|
|
@@ -1395,12 +1399,12 @@ class Cr {
|
|
|
1395
1399
|
n.resolve(await this.target[n.method](...n.args));
|
|
1396
1400
|
}
|
|
1397
1401
|
}
|
|
1398
|
-
function
|
|
1399
|
-
const n = e, r = vt(), s =
|
|
1400
|
-
if (s && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !
|
|
1401
|
-
s.emit(
|
|
1402
|
+
function Tr(e, t) {
|
|
1403
|
+
const n = e, r = vt(), s = _r(), l = wr && n.enableEarlyProxy;
|
|
1404
|
+
if (s && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !l))
|
|
1405
|
+
s.emit(br, e, t);
|
|
1402
1406
|
else {
|
|
1403
|
-
const i =
|
|
1407
|
+
const i = l ? new Er(n, s) : null;
|
|
1404
1408
|
(r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({
|
|
1405
1409
|
pluginDescriptor: n,
|
|
1406
1410
|
setupFn: t,
|
|
@@ -1408,7 +1412,7 @@ function Er(e, t) {
|
|
|
1408
1412
|
}), i && t(i.proxiedTarget);
|
|
1409
1413
|
}
|
|
1410
1414
|
}
|
|
1411
|
-
function
|
|
1415
|
+
function Sr(e, t) {
|
|
1412
1416
|
const n = `▲ ■ ●${e}`;
|
|
1413
1417
|
typeof Xe == "function" ? Xe(n, t) : console.log(n);
|
|
1414
1418
|
}
|
|
@@ -1427,13 +1431,13 @@ const yt = (e) => {
|
|
|
1427
1431
|
textColor: 5750629,
|
|
1428
1432
|
backgroundColor: 15793395
|
|
1429
1433
|
});
|
|
1430
|
-
const n =
|
|
1434
|
+
const n = xe(e);
|
|
1431
1435
|
return n > 0 && t.tags.push({
|
|
1432
|
-
label: `${
|
|
1436
|
+
label: `${fr(n)} KB`,
|
|
1433
1437
|
textColor: 15707189,
|
|
1434
1438
|
backgroundColor: 16775644,
|
|
1435
1439
|
tooltip: "Memory usage"
|
|
1436
|
-
}), e.type.includes("Light") && (
|
|
1440
|
+
}), e.type.includes("Light") && (On(e) && t.tags.push({
|
|
1437
1441
|
label: `${e.intensity}`,
|
|
1438
1442
|
textColor: 9738662,
|
|
1439
1443
|
backgroundColor: 16316922,
|
|
@@ -1463,22 +1467,22 @@ function _t(e, t, n = "") {
|
|
|
1463
1467
|
t.children.push(s), _t(r, s, n);
|
|
1464
1468
|
});
|
|
1465
1469
|
}
|
|
1466
|
-
const
|
|
1470
|
+
const Ar = [], X = "tres:inspector", xr = Et({
|
|
1467
1471
|
sceneGraph: null
|
|
1468
1472
|
});
|
|
1469
1473
|
function kr(e, t) {
|
|
1470
|
-
|
|
1474
|
+
Tr(
|
|
1471
1475
|
{
|
|
1472
1476
|
id: "dev.esm.tres",
|
|
1473
1477
|
label: "TresJS 🪐",
|
|
1474
1478
|
logo: "https://raw.githubusercontent.com/Tresjs/tres/main/public/favicon.svg",
|
|
1475
1479
|
packageName: "tresjs",
|
|
1476
1480
|
homepage: "https://tresjs.org",
|
|
1477
|
-
componentStateTypes:
|
|
1481
|
+
componentStateTypes: Ar,
|
|
1478
1482
|
app: e
|
|
1479
1483
|
},
|
|
1480
1484
|
(n) => {
|
|
1481
|
-
typeof n.now != "function" &&
|
|
1485
|
+
typeof n.now != "function" && Sr(
|
|
1482
1486
|
"You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html."
|
|
1483
1487
|
), n.addInspector({
|
|
1484
1488
|
id: X,
|
|
@@ -1489,33 +1493,33 @@ function kr(e, t) {
|
|
|
1489
1493
|
n.sendInspectorTree(X);
|
|
1490
1494
|
}, 1e3), setInterval(() => {
|
|
1491
1495
|
n.notifyComponentUpdate();
|
|
1492
|
-
}, 5e3), n.on.getInspectorTree((
|
|
1493
|
-
if (
|
|
1496
|
+
}, 5e3), n.on.getInspectorTree((l) => {
|
|
1497
|
+
if (l.inspectorId === X) {
|
|
1494
1498
|
const i = yt(t.scene.value);
|
|
1495
|
-
_t(t.scene.value, i,
|
|
1499
|
+
_t(t.scene.value, i, l.filter), xr.sceneGraph = i, l.rootNodes = [i];
|
|
1496
1500
|
}
|
|
1497
1501
|
});
|
|
1498
1502
|
let r = null, s = null;
|
|
1499
|
-
n.on.getInspectorState((
|
|
1503
|
+
n.on.getInspectorState((l) => {
|
|
1500
1504
|
var i;
|
|
1501
|
-
if (
|
|
1502
|
-
const [
|
|
1503
|
-
if (!
|
|
1505
|
+
if (l.inspectorId === X) {
|
|
1506
|
+
const [a] = t.scene.value.getObjectsByProperty("uuid", l.nodeId);
|
|
1507
|
+
if (!a)
|
|
1504
1508
|
return;
|
|
1505
|
-
if (s && r && r.parent && s.remove(r),
|
|
1506
|
-
const c =
|
|
1507
|
-
|
|
1509
|
+
if (s && r && r.parent && s.remove(r), a.isMesh) {
|
|
1510
|
+
const c = Xn(a);
|
|
1511
|
+
a.add(c), r = c, s = a;
|
|
1508
1512
|
}
|
|
1509
|
-
|
|
1510
|
-
object: Object.entries(
|
|
1511
|
-
},
|
|
1512
|
-
memory:
|
|
1513
|
-
objects:
|
|
1513
|
+
l.state = {
|
|
1514
|
+
object: Object.entries(a).map(([c, o]) => c === "children" ? { key: c, value: o.filter((u) => u.type !== "HightlightMesh") } : { key: c, value: o, editable: !0 }).filter(({ key: c }) => c !== "parent")
|
|
1515
|
+
}, a.isScene && (l.state.info = {
|
|
1516
|
+
memory: xe(a),
|
|
1517
|
+
objects: a.children.length,
|
|
1514
1518
|
calls: t.renderer.value.info.render.calls,
|
|
1515
1519
|
triangles: t.renderer.value.info.render.triangles,
|
|
1516
1520
|
points: t.renderer.value.info.render.points,
|
|
1517
1521
|
lines: t.renderer.value.info.render.lines
|
|
1518
|
-
},
|
|
1522
|
+
}, l.state.programs = ((i = t.renderer.value.info.programs) == null ? void 0 : i.map((c) => ({
|
|
1519
1523
|
key: c.name,
|
|
1520
1524
|
value: {
|
|
1521
1525
|
...c,
|
|
@@ -1525,13 +1529,13 @@ function kr(e, t) {
|
|
|
1525
1529
|
}
|
|
1526
1530
|
}))) || []);
|
|
1527
1531
|
}
|
|
1528
|
-
}), n.on.editInspectorState((
|
|
1529
|
-
|
|
1532
|
+
}), n.on.editInspectorState((l) => {
|
|
1533
|
+
l.inspectorId === X && Qn(t.scene.value, l.nodeId, l.path, l.state.value);
|
|
1530
1534
|
});
|
|
1531
1535
|
}
|
|
1532
1536
|
);
|
|
1533
1537
|
}
|
|
1534
|
-
const
|
|
1538
|
+
const Lr = ["data-scene", "data-tres"], Rr = /* @__PURE__ */ Be({
|
|
1535
1539
|
__name: "TresCanvas",
|
|
1536
1540
|
props: {
|
|
1537
1541
|
shadows: { type: Boolean, default: void 0 },
|
|
@@ -1576,90 +1580,92 @@ const xr = ["data-scene", "data-tres"], Lr = /* @__PURE__ */ Be({
|
|
|
1576
1580
|
"ready"
|
|
1577
1581
|
],
|
|
1578
1582
|
setup(e, { expose: t, emit: n }) {
|
|
1579
|
-
var
|
|
1580
|
-
const r = e, s = n,
|
|
1581
|
-
|
|
1582
|
-
const u = (
|
|
1583
|
+
var y;
|
|
1584
|
+
const r = e, s = n, l = Tt(), { logWarning: i } = Y(), a = H(), c = $(new nt()), o = (y = Ie()) == null ? void 0 : y.appContext.app;
|
|
1585
|
+
Me(et);
|
|
1586
|
+
const u = (d, C = !1) => Be({
|
|
1583
1587
|
setup() {
|
|
1584
|
-
var
|
|
1585
|
-
const
|
|
1586
|
-
return
|
|
1588
|
+
var P;
|
|
1589
|
+
const M = (P = Ie()) == null ? void 0 : P.appContext;
|
|
1590
|
+
return M && (M.app = o), _e("useTres", d), _e("extend", Me), typeof window < "u" && kr(M == null ? void 0 : M.app, d), () => He(Ot, null, C ? [] : l.default());
|
|
1587
1591
|
}
|
|
1588
|
-
}),
|
|
1589
|
-
const
|
|
1590
|
-
|
|
1591
|
-
}, f = (
|
|
1592
|
-
dt(
|
|
1593
|
-
root:
|
|
1594
|
-
}
|
|
1595
|
-
},
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
v.value
|
|
1592
|
+
}), v = (d, C = !1) => {
|
|
1593
|
+
const M = u(d, C), { render: P } = Rt(yr(d));
|
|
1594
|
+
P(He(M), c.value);
|
|
1595
|
+
}, f = (d, C = !1) => {
|
|
1596
|
+
dt(d.scene.value), C && (d.renderer.value.dispose(), d.renderer.value.renderLists.dispose(), d.renderer.value.forceContextLoss()), c.value.__tres = {
|
|
1597
|
+
root: d
|
|
1598
|
+
};
|
|
1599
|
+
}, h = V(() => r.disableRender), g = $(null);
|
|
1600
|
+
t({ context: g, dispose: () => f(g.value, !0) });
|
|
1601
|
+
const b = () => {
|
|
1602
|
+
f(g.value), v(g.value, !0);
|
|
1603
|
+
};
|
|
1604
|
+
return St(() => {
|
|
1605
|
+
const d = a;
|
|
1606
|
+
g.value = gr({
|
|
1599
1607
|
scene: c.value,
|
|
1600
|
-
canvas:
|
|
1608
|
+
canvas: d,
|
|
1601
1609
|
windowSize: r.windowSize ?? !1,
|
|
1602
|
-
disableRender:
|
|
1610
|
+
disableRender: h.value ?? !1,
|
|
1603
1611
|
rendererOptions: r,
|
|
1604
1612
|
emit: s
|
|
1605
1613
|
});
|
|
1606
|
-
const { registerCamera:
|
|
1607
|
-
|
|
1614
|
+
const { registerCamera: C, camera: M, cameras: P, deregisterCamera: E } = g.value;
|
|
1615
|
+
v(g.value);
|
|
1608
1616
|
const S = () => {
|
|
1609
|
-
const
|
|
1617
|
+
const _ = new we(
|
|
1610
1618
|
45,
|
|
1611
1619
|
window.innerWidth / window.innerHeight,
|
|
1612
1620
|
0.1,
|
|
1613
1621
|
1e3
|
|
1614
1622
|
);
|
|
1615
|
-
|
|
1616
|
-
const
|
|
1617
|
-
|
|
1623
|
+
_.position.set(3, 3, 3), _.lookAt(0, 0, 0), C(_);
|
|
1624
|
+
const A = Te(() => {
|
|
1625
|
+
P.value.length >= 2 && (_.removeFromParent(), E(_), A == null || A());
|
|
1618
1626
|
});
|
|
1619
1627
|
};
|
|
1620
1628
|
ce(
|
|
1621
1629
|
() => r.camera,
|
|
1622
|
-
(
|
|
1623
|
-
|
|
1630
|
+
(_, A) => {
|
|
1631
|
+
_ && C(_), A && (A.removeFromParent(), E(A));
|
|
1624
1632
|
},
|
|
1625
1633
|
{
|
|
1626
1634
|
immediate: !0
|
|
1627
1635
|
}
|
|
1628
|
-
),
|
|
1636
|
+
), M.value || (i(
|
|
1629
1637
|
"No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
|
|
1630
1638
|
), S());
|
|
1631
|
-
}), K(() => {
|
|
1632
|
-
f(v.value);
|
|
1633
|
-
}), (m, d) => (At(), kt("canvas", {
|
|
1639
|
+
}), K(b), (d, C) => (At(), xt("canvas", {
|
|
1634
1640
|
ref_key: "canvas",
|
|
1635
|
-
ref:
|
|
1641
|
+
ref: a,
|
|
1636
1642
|
"data-scene": c.value.uuid,
|
|
1637
|
-
class:
|
|
1638
|
-
"data-tres": `tresjs ${J(
|
|
1643
|
+
class: kt(d.$attrs.class),
|
|
1644
|
+
"data-tres": `tresjs ${J(xn).version}`,
|
|
1639
1645
|
style: Lt({
|
|
1640
1646
|
display: "block",
|
|
1641
1647
|
width: "100%",
|
|
1642
1648
|
height: "100%",
|
|
1643
|
-
position:
|
|
1649
|
+
position: d.windowSize ? "fixed" : "relative",
|
|
1644
1650
|
top: 0,
|
|
1645
1651
|
left: 0,
|
|
1646
1652
|
pointerEvents: "auto",
|
|
1647
1653
|
touchAction: "none",
|
|
1648
|
-
...
|
|
1654
|
+
...d.$attrs.style
|
|
1649
1655
|
})
|
|
1650
|
-
}, null, 14,
|
|
1656
|
+
}, null, 14, Lr));
|
|
1651
1657
|
}
|
|
1652
|
-
}),
|
|
1658
|
+
}), Or = [
|
|
1653
1659
|
"TresCanvas",
|
|
1654
1660
|
"TresLeches",
|
|
1655
1661
|
"TresScene"
|
|
1656
|
-
],
|
|
1662
|
+
], Dr = {
|
|
1657
1663
|
template: {
|
|
1658
1664
|
compilerOptions: {
|
|
1659
|
-
isCustomElement: (e) => e.startsWith("Tres") && !
|
|
1665
|
+
isCustomElement: (e) => e.startsWith("Tres") && !Or.includes(e) || e === "primitive"
|
|
1660
1666
|
}
|
|
1661
1667
|
}
|
|
1662
|
-
},
|
|
1668
|
+
}, Kr = Dr, Qr = {
|
|
1663
1669
|
mounted: (e, t) => {
|
|
1664
1670
|
if (t.arg) {
|
|
1665
1671
|
console.log(`v-log:${t.arg}`, e[t.arg]);
|
|
@@ -1672,10 +1678,10 @@ class wt extends zt {
|
|
|
1672
1678
|
constructor(t, n) {
|
|
1673
1679
|
const r = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], s = new $e();
|
|
1674
1680
|
s.setAttribute("position", new Ue(r, 3)), s.computeBoundingSphere();
|
|
1675
|
-
const
|
|
1676
|
-
super(s,
|
|
1677
|
-
const i = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0],
|
|
1678
|
-
|
|
1681
|
+
const l = new Gt({ fog: !1 });
|
|
1682
|
+
super(s, l), this.light = t, this.color = n, this.type = "RectAreaLightHelper";
|
|
1683
|
+
const i = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], a = new $e();
|
|
1684
|
+
a.setAttribute("position", new Ue(i, 3)), a.computeBoundingSphere(), this.add(new Vt(a, new ot({ side: Yt, fog: !1 })));
|
|
1679
1685
|
}
|
|
1680
1686
|
updateMatrixWorld() {
|
|
1681
1687
|
if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
|
|
@@ -1693,19 +1699,19 @@ class wt extends zt {
|
|
|
1693
1699
|
}
|
|
1694
1700
|
const { logWarning: Ze } = Y();
|
|
1695
1701
|
let le, W;
|
|
1696
|
-
const
|
|
1702
|
+
const jr = {
|
|
1697
1703
|
DirectionalLight: qt,
|
|
1698
1704
|
PointLight: Jt,
|
|
1699
1705
|
SpotLight: Kt,
|
|
1700
1706
|
HemisphereLight: Qt,
|
|
1701
1707
|
RectAreaLight: wt
|
|
1702
|
-
},
|
|
1708
|
+
}, Xr = {
|
|
1703
1709
|
mounted: (e) => {
|
|
1704
1710
|
if (!e.isLight) {
|
|
1705
1711
|
Ze(`${e.type} is not a light`);
|
|
1706
1712
|
return;
|
|
1707
1713
|
}
|
|
1708
|
-
le =
|
|
1714
|
+
le = jr[e.type], e.parent.add(new le(e, 1, e.color.getHex()));
|
|
1709
1715
|
},
|
|
1710
1716
|
updated: (e) => {
|
|
1711
1717
|
W = e.parent.children.find((t) => t instanceof le), !(W instanceof wt) && W.update();
|
|
@@ -1717,14 +1723,14 @@ const Dr = {
|
|
|
1717
1723
|
}
|
|
1718
1724
|
W = e.parent.children.find((t) => t instanceof le), W && W.dispose && W.dispose(), e.parent.remove(W);
|
|
1719
1725
|
}
|
|
1720
|
-
}, { logWarning:
|
|
1726
|
+
}, { logWarning: Br } = Y();
|
|
1721
1727
|
let I = null;
|
|
1722
|
-
const
|
|
1728
|
+
const Zr = {
|
|
1723
1729
|
updated: (e, t) => {
|
|
1724
1730
|
var s;
|
|
1725
|
-
const n =
|
|
1731
|
+
const n = Zn(t);
|
|
1726
1732
|
if (!n) {
|
|
1727
|
-
|
|
1733
|
+
Br(`v-distance-to: problem with binding value: ${t.value}`);
|
|
1728
1734
|
return;
|
|
1729
1735
|
}
|
|
1730
1736
|
I && (I.dispose(), e.parent.remove(I));
|
|
@@ -1740,38 +1746,38 @@ const Xr = {
|
|
|
1740
1746
|
unmounted: (e) => {
|
|
1741
1747
|
I == null || I.dispose(), e.parent.remove(I);
|
|
1742
1748
|
}
|
|
1743
|
-
},
|
|
1749
|
+
}, eo = {
|
|
1744
1750
|
install(e) {
|
|
1745
|
-
e.component("TresCanvas",
|
|
1751
|
+
e.component("TresCanvas", Rr);
|
|
1746
1752
|
}
|
|
1747
1753
|
};
|
|
1748
1754
|
export {
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1755
|
+
Rr as TresCanvas,
|
|
1756
|
+
Ce as catalogue,
|
|
1757
|
+
mr as createRenderLoop,
|
|
1758
|
+
eo as default,
|
|
1753
1759
|
dt as dispose,
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1760
|
+
Me as extend,
|
|
1761
|
+
Wr as isProd,
|
|
1762
|
+
Fn as normalizeColor,
|
|
1763
|
+
Nr as normalizeVectorFlexibleParam,
|
|
1764
|
+
Yr as onTresReady,
|
|
1765
|
+
Kr as templateCompilerOptions,
|
|
1766
|
+
cr as trasverseObjects,
|
|
1767
|
+
In as useCamera,
|
|
1768
|
+
zr as useLoader,
|
|
1763
1769
|
Y as useLogger,
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1770
|
+
Jr as useLoop,
|
|
1771
|
+
ur as useRaycaster,
|
|
1772
|
+
Fr as useRenderLoop,
|
|
1773
|
+
ar as useRenderer,
|
|
1774
|
+
Vr as useSeek,
|
|
1775
|
+
Gr as useTexture,
|
|
1776
|
+
qr as useTres,
|
|
1771
1777
|
pe as useTresContext,
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1778
|
+
gr as useTresContextProvider,
|
|
1779
|
+
dr as useTresEventManager,
|
|
1780
|
+
Zr as vDistanceTo,
|
|
1781
|
+
Xr as vLightHelper,
|
|
1782
|
+
Qr as vLog
|
|
1777
1783
|
};
|