@tresjs/core 4.2.1 → 4.2.2
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 +389 -389
- package/dist/tres.umd.cjs +2 -2
- package/package.json +1 -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.2
|
|
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,11 +8,11 @@
|
|
|
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
|
|
11
|
+
import { ref as H, computed as V, watchEffect as Te, onUnmounted as K, shallowRef as $, watch as le, 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 kt, normalizeClass as xt, 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 ce, 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.2", 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
16
|
"vue",
|
|
17
17
|
"3d",
|
|
18
18
|
"threejs",
|
|
@@ -40,9 +40,9 @@ const cn = "@tresjs/core", un = "module", fn = "4.2.1", dn = "pnpm@9.1.4", pn =
|
|
|
40
40
|
}, _n = "./dist/tres.js", wn = "./dist/tres.js", bn = "./dist/index.d.ts", Pn = [
|
|
41
41
|
"*.d.ts",
|
|
42
42
|
"dist"
|
|
43
|
-
],
|
|
43
|
+
], Cn = {
|
|
44
44
|
access: "public"
|
|
45
|
-
},
|
|
45
|
+
}, Mn = {
|
|
46
46
|
dev: "cd playground && npm run dev",
|
|
47
47
|
build: "vite build",
|
|
48
48
|
playground: "cd playground && npm run dev",
|
|
@@ -122,8 +122,8 @@ const cn = "@tresjs/core", un = "module", fn = "4.2.1", dn = "pnpm@9.1.4", pn =
|
|
|
122
122
|
module: wn,
|
|
123
123
|
types: bn,
|
|
124
124
|
files: Pn,
|
|
125
|
-
publishConfig:
|
|
126
|
-
scripts:
|
|
125
|
+
publishConfig: Cn,
|
|
126
|
+
scripts: Mn,
|
|
127
127
|
peerDependencies: En,
|
|
128
128
|
dependencies: Tn,
|
|
129
129
|
devDependencies: Sn
|
|
@@ -140,11 +140,11 @@ function kn(e) {
|
|
|
140
140
|
function at(e) {
|
|
141
141
|
return typeof e == "string";
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function G(e) {
|
|
144
144
|
return typeof e == "function";
|
|
145
145
|
}
|
|
146
146
|
function N(e) {
|
|
147
|
-
return e === Object(e) && !de(e) && !
|
|
147
|
+
return e === Object(e) && !de(e) && !G(e);
|
|
148
148
|
}
|
|
149
149
|
function W(e) {
|
|
150
150
|
return N(e) && "isObject3D" in e && !!e.isObject3D;
|
|
@@ -171,7 +171,7 @@ function Dn(e) {
|
|
|
171
171
|
return N(e) && !!e.isPrimitive;
|
|
172
172
|
}
|
|
173
173
|
const jn = ({ sizes: e }) => {
|
|
174
|
-
const t =
|
|
174
|
+
const t = H([]), n = V(
|
|
175
175
|
() => t.value[0]
|
|
176
176
|
), r = (i) => {
|
|
177
177
|
const l = i instanceof Dt ? i : t.value.find((o) => o.uuid === i);
|
|
@@ -196,7 +196,7 @@ const jn = ({ sizes: e }) => {
|
|
|
196
196
|
e.aspectRatio.value && t.value.forEach((i) => {
|
|
197
197
|
!i.manual && (i instanceof we || Bn(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());
|
|
198
198
|
});
|
|
199
|
-
}),
|
|
199
|
+
}), K(() => {
|
|
200
200
|
t.value = [];
|
|
201
201
|
}), {
|
|
202
202
|
camera: n,
|
|
@@ -209,16 +209,16 @@ const jn = ({ sizes: e }) => {
|
|
|
209
209
|
function Bn(e) {
|
|
210
210
|
return e.hasOwnProperty("isOrthographicCamera") && e.isOrthographicCamera;
|
|
211
211
|
}
|
|
212
|
-
const lt = j(), ct = j(), Ae = j(),
|
|
212
|
+
const lt = j(), ct = j(), Ae = j(), Z = new tt();
|
|
213
213
|
let ue = 0, fe = 0;
|
|
214
214
|
const { pause: In, resume: Ne, isActive: Hn } = it(
|
|
215
215
|
() => {
|
|
216
|
-
lt.trigger({ delta: ue, elapsed: fe, clock:
|
|
216
|
+
lt.trigger({ delta: ue, elapsed: fe, clock: Z }), ct.trigger({ delta: ue, elapsed: fe, clock: Z }), Ae.trigger({ delta: ue, elapsed: fe, clock: Z });
|
|
217
217
|
},
|
|
218
218
|
{ immediate: !1 }
|
|
219
219
|
);
|
|
220
220
|
Ae.on(() => {
|
|
221
|
-
ue =
|
|
221
|
+
ue = Z.getDelta(), fe = Z.getElapsedTime();
|
|
222
222
|
});
|
|
223
223
|
let ze = !1;
|
|
224
224
|
const $r = () => (ze || (ze = !0, Ne()), {
|
|
@@ -229,7 +229,7 @@ const $r = () => (ze || (ze = !0, Ne()), {
|
|
|
229
229
|
resume: Ne,
|
|
230
230
|
isActive: Hn
|
|
231
231
|
}), Ur = !0, oe = "[TresJS ▲ ■ ●] ";
|
|
232
|
-
function
|
|
232
|
+
function Y() {
|
|
233
233
|
function e(...r) {
|
|
234
234
|
typeof r[0] == "string" ? r[0] = oe + r[0] : r.unshift(oe), console.error(...r);
|
|
235
235
|
}
|
|
@@ -407,7 +407,7 @@ function er(e, t, n) {
|
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
const { target: r, key: s } = Pe(e, n);
|
|
410
|
-
t.__tres.previousAttach = r[s], r[s] =
|
|
410
|
+
t.__tres.previousAttach = r[s], r[s] = Q(t);
|
|
411
411
|
} else
|
|
412
412
|
t.__tres.previousAttach = n(e, t);
|
|
413
413
|
}
|
|
@@ -420,7 +420,7 @@ function tr(e, t, n) {
|
|
|
420
420
|
(s = (r = t.__tres) == null ? void 0 : r.previousAttach) == null || s.call(r, e, t);
|
|
421
421
|
(a = t.__tres) == null || delete a.previousAttach;
|
|
422
422
|
}
|
|
423
|
-
function
|
|
423
|
+
function z(e, t, n) {
|
|
424
424
|
const r = e;
|
|
425
425
|
return r.__tres = {
|
|
426
426
|
type: "unknown",
|
|
@@ -441,7 +441,7 @@ function pt(e) {
|
|
|
441
441
|
}
|
|
442
442
|
function nr(e, t, n) {
|
|
443
443
|
var s;
|
|
444
|
-
if (!
|
|
444
|
+
if (!G(e.setPixelRatio))
|
|
445
445
|
return;
|
|
446
446
|
let r = 0;
|
|
447
447
|
if (de(n) && n.length >= 2) {
|
|
@@ -451,28 +451,28 @@ function nr(e, t, n) {
|
|
|
451
451
|
r !== ((s = e.getPixelRatio) == null ? void 0 : s.call(e)) && e.setPixelRatio(r);
|
|
452
452
|
}
|
|
453
453
|
function rr(e, t, n, r, s) {
|
|
454
|
-
const a = [...t.__tres.objects], i =
|
|
455
|
-
if (e =
|
|
454
|
+
const a = [...t.__tres.objects], i = Q(t);
|
|
455
|
+
if (e = Q(e), i === e)
|
|
456
456
|
return !0;
|
|
457
|
-
const l =
|
|
457
|
+
const l = z(e, t.__tres ?? {}, s), c = t.parent ?? t.__tres.parent ?? null, o = { ...t.__tres.memoizedProps };
|
|
458
458
|
delete o.object;
|
|
459
459
|
for (const u of a)
|
|
460
460
|
mt(u, s), ht(u, s);
|
|
461
461
|
i.__tres.objects = [], r.remove(t);
|
|
462
|
-
for (const [u,
|
|
463
|
-
r.patchProp(l, u, l[u],
|
|
462
|
+
for (const [u, y] of Object.entries(o))
|
|
463
|
+
r.patchProp(l, u, l[u], y);
|
|
464
464
|
n(e), r.insert(t, c);
|
|
465
465
|
for (const u of a)
|
|
466
466
|
r.insert(u, t);
|
|
467
467
|
return !0;
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function Q(e) {
|
|
470
470
|
return Dn(e) ? (e.object.__tres = e.__tres, e.object) : e;
|
|
471
471
|
}
|
|
472
472
|
function mt(e, t) {
|
|
473
473
|
var r, s, a, i;
|
|
474
474
|
const n = ((r = e.__tres) == null ? void 0 : r.parent) || t.scene.value;
|
|
475
|
-
e.__tres && (e.__tres.parent = null), n && n.__tres && "objects" in n.__tres && Zn(n.__tres.objects, (l) => l !== e), (s = e.__tres) != null && s.attach ? tr(n, e, e.__tres.attach) : ((i = (a = e.parent) == null ? void 0 : a.remove) == null || i.call(a,
|
|
475
|
+
e.__tres && (e.__tres.parent = null), n && n.__tres && "objects" in n.__tres && Zn(n.__tres.objects, (l) => l !== e), (s = e.__tres) != null && s.attach ? tr(n, e, e.__tres.attach) : ((i = (a = e.parent) == null ? void 0 : a.remove) == null || i.call(a, Q(e)), e.parent = null);
|
|
476
476
|
}
|
|
477
477
|
function ht(e, t) {
|
|
478
478
|
var n;
|
|
@@ -503,7 +503,7 @@ function sr({
|
|
|
503
503
|
options: t,
|
|
504
504
|
contextParts: { sizes: n, render: r, invalidate: s, advance: a }
|
|
505
505
|
}) {
|
|
506
|
-
const i =
|
|
506
|
+
const i = V(() => ({
|
|
507
507
|
alpha: k(t.alpha) ?? !0,
|
|
508
508
|
depth: k(t.depth),
|
|
509
509
|
canvas: Zt(e),
|
|
@@ -516,7 +516,7 @@ function sr({
|
|
|
516
516
|
preserveDrawingBuffer: k(t.preserveDrawingBuffer),
|
|
517
517
|
logarithmicDepthBuffer: k(t.logarithmicDepthBuffer),
|
|
518
518
|
failIfMajorPerformanceCaveat: k(t.failIfMajorPerformanceCaveat)
|
|
519
|
-
})), l =
|
|
519
|
+
})), l = $(new he(i.value));
|
|
520
520
|
function c() {
|
|
521
521
|
t.renderMode === "on-demand" && s();
|
|
522
522
|
}
|
|
@@ -527,40 +527,40 @@ function sr({
|
|
|
527
527
|
}, {
|
|
528
528
|
immediate: !0
|
|
529
529
|
}), le(() => t.clearColor, c);
|
|
530
|
-
const { pixelRatio: o } = en(), { logError: u } =
|
|
531
|
-
const
|
|
530
|
+
const { pixelRatio: o } = en(), { logError: u } = Y(), f = (() => {
|
|
531
|
+
const v = new he(), b = {
|
|
532
532
|
shadowMap: {
|
|
533
|
-
enabled:
|
|
534
|
-
type:
|
|
533
|
+
enabled: v.shadowMap.enabled,
|
|
534
|
+
type: v.shadowMap.type
|
|
535
535
|
},
|
|
536
|
-
toneMapping:
|
|
537
|
-
toneMappingExposure:
|
|
538
|
-
outputColorSpace:
|
|
536
|
+
toneMapping: v.toneMapping,
|
|
537
|
+
toneMappingExposure: v.toneMappingExposure,
|
|
538
|
+
outputColorSpace: v.outputColorSpace
|
|
539
539
|
};
|
|
540
|
-
return
|
|
541
|
-
})(),
|
|
542
|
-
return
|
|
540
|
+
return v.dispose(), b;
|
|
541
|
+
})(), g = k(t.renderMode);
|
|
542
|
+
return g === "on-demand" && s(), g === "manual" && setTimeout(() => {
|
|
543
543
|
a();
|
|
544
544
|
}, 100), Te(() => {
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
const
|
|
548
|
-
const
|
|
549
|
-
if (
|
|
550
|
-
return Ve(ie[
|
|
545
|
+
const v = k(t.preset);
|
|
546
|
+
v && (v in ie || u(`Renderer Preset must be one of these: ${Object.keys(ie).join(", ")}`), ut(l.value, ie[v])), nr(l.value, o.value, k(t.dpr)), g === "always" && (r.frames.value = Math.max(1, r.frames.value));
|
|
547
|
+
const b = (M, E) => {
|
|
548
|
+
const P = k(M), S = () => {
|
|
549
|
+
if (v)
|
|
550
|
+
return Ve(ie[v], E);
|
|
551
551
|
};
|
|
552
|
-
if (
|
|
553
|
-
return
|
|
554
|
-
const
|
|
555
|
-
return
|
|
556
|
-
}, m = (
|
|
552
|
+
if (P !== void 0)
|
|
553
|
+
return P;
|
|
554
|
+
const C = S();
|
|
555
|
+
return C !== void 0 ? C : Ve(f, E);
|
|
556
|
+
}, m = (M, E) => Vn(l.value, E, b(M, E));
|
|
557
557
|
m(t.shadows, "shadowMap.enabled"), m(t.toneMapping ?? st, "toneMapping"), m(t.shadowMapType, "shadowMap.type"), or < 150 && m(!t.useLegacyLights, "physicallyCorrectLights"), m(t.outputColorSpace, "outputColorSpace"), m(t.toneMappingExposure, "toneMappingExposure");
|
|
558
|
-
const
|
|
559
|
-
|
|
560
|
-
|
|
558
|
+
const d = b(t.clearColor, "clearColor");
|
|
559
|
+
d && l.value.setClearColor(
|
|
560
|
+
d ? $n(d) : new ce(0)
|
|
561
561
|
// default clear color is not easily/efficiently retrievable from three
|
|
562
562
|
);
|
|
563
|
-
}),
|
|
563
|
+
}), K(() => {
|
|
564
564
|
l.value.dispose(), l.value.forceContextLoss();
|
|
565
565
|
}), {
|
|
566
566
|
renderer: l
|
|
@@ -574,18 +574,18 @@ function ar(e) {
|
|
|
574
574
|
}), t;
|
|
575
575
|
}
|
|
576
576
|
async function Wr(e, t, n, r, s) {
|
|
577
|
-
const { logError: a } =
|
|
577
|
+
const { logError: a } = Y(), i = new e();
|
|
578
578
|
s && s(i), n && n(i);
|
|
579
579
|
const c = (Array.isArray(t) ? t : [t]).map(
|
|
580
|
-
(o) => new Promise((u,
|
|
580
|
+
(o) => new Promise((u, y) => {
|
|
581
581
|
i.load(
|
|
582
582
|
o,
|
|
583
583
|
(f) => {
|
|
584
|
-
const
|
|
585
|
-
|
|
584
|
+
const g = f;
|
|
585
|
+
g.scene && Object.assign(g, ar(g.scene)), u(g);
|
|
586
586
|
},
|
|
587
587
|
r,
|
|
588
|
-
(f) =>
|
|
588
|
+
(f) => y(a("[useLoader] - Failed to load resource", f))
|
|
589
589
|
);
|
|
590
590
|
})
|
|
591
591
|
);
|
|
@@ -614,7 +614,7 @@ async function Nr(e, t) {
|
|
|
614
614
|
metalnessMap: c,
|
|
615
615
|
aoMap: o,
|
|
616
616
|
alphaMap: u,
|
|
617
|
-
matcap:
|
|
617
|
+
matcap: y
|
|
618
618
|
} = e;
|
|
619
619
|
return {
|
|
620
620
|
map: s ? await r(s) : null,
|
|
@@ -624,38 +624,38 @@ async function Nr(e, t) {
|
|
|
624
624
|
metalnessMap: c ? await r(c) : null,
|
|
625
625
|
aoMap: o ? await r(o) : null,
|
|
626
626
|
alphaMap: u ? await r(u) : null,
|
|
627
|
-
matcap:
|
|
627
|
+
matcap: y ? await r(y) : null
|
|
628
628
|
};
|
|
629
629
|
}
|
|
630
630
|
}
|
|
631
631
|
const lr = (e, t) => {
|
|
632
|
-
const n =
|
|
632
|
+
const n = V(() => t.renderer.value.domElement), r = $([]), { x: s, y: a } = tn({ target: n });
|
|
633
633
|
let i = 0;
|
|
634
|
-
const { width: l, height: c, top: o, left: u } = nn(n),
|
|
634
|
+
const { width: l, height: c, top: o, left: u } = nn(n), y = ({ x: h, y: T }) => {
|
|
635
635
|
if (n.value)
|
|
636
636
|
return {
|
|
637
637
|
x: (h - u.value) / l.value * 2 - 1,
|
|
638
|
-
y: -((
|
|
638
|
+
y: -((T - o.value) / c.value) * 2 + 1
|
|
639
639
|
};
|
|
640
|
-
}, f = ({ x: h, y:
|
|
640
|
+
}, f = ({ x: h, y: T }) => {
|
|
641
641
|
if (t.camera.value)
|
|
642
|
-
return t.raycaster.value.setFromCamera(new ge(h,
|
|
643
|
-
},
|
|
644
|
-
const
|
|
642
|
+
return t.raycaster.value.setFromCamera(new ge(h, T), t.camera.value), r.value = t.raycaster.value.intersectObjects(e.value, !0), r.value;
|
|
643
|
+
}, g = (h) => {
|
|
644
|
+
const T = y({
|
|
645
645
|
x: (h == null ? void 0 : h.clientX) ?? s.value,
|
|
646
646
|
y: (h == null ? void 0 : h.clientY) ?? a.value
|
|
647
647
|
});
|
|
648
|
-
return
|
|
649
|
-
},
|
|
650
|
-
function
|
|
651
|
-
const
|
|
648
|
+
return T ? f(T) || [] : [];
|
|
649
|
+
}, v = j(), b = j(), m = j(), d = j(), M = j(), E = j(), P = j(), S = j();
|
|
650
|
+
function C(h) {
|
|
651
|
+
const T = {};
|
|
652
652
|
for (const U in h)
|
|
653
|
-
typeof U != "function" && (
|
|
654
|
-
return
|
|
653
|
+
typeof U != "function" && (T[U] = h[U]);
|
|
654
|
+
return T;
|
|
655
655
|
}
|
|
656
|
-
const
|
|
656
|
+
const _ = (h, T) => {
|
|
657
657
|
var Oe, De, je;
|
|
658
|
-
const U =
|
|
658
|
+
const U = C(T), ne = new Se(T == null ? void 0 : T.clientX, T == null ? void 0 : T.clientY, 0).unproject((Oe = t.camera) == null ? void 0 : Oe.value);
|
|
659
659
|
h.trigger({
|
|
660
660
|
...U,
|
|
661
661
|
intersections: r.value,
|
|
@@ -663,52 +663,52 @@ const lr = (e, t) => {
|
|
|
663
663
|
unprojectedPoint: ne,
|
|
664
664
|
ray: (De = t.raycaster) == null ? void 0 : De.value.ray,
|
|
665
665
|
camera: (je = t.camera) == null ? void 0 : je.value,
|
|
666
|
-
sourceEvent:
|
|
666
|
+
sourceEvent: T,
|
|
667
667
|
delta: i,
|
|
668
668
|
stopPropagating: !1
|
|
669
669
|
});
|
|
670
670
|
};
|
|
671
671
|
let L;
|
|
672
672
|
const x = (h) => {
|
|
673
|
-
|
|
674
|
-
},
|
|
673
|
+
g(h), _(m, h), L = h;
|
|
674
|
+
}, p = () => {
|
|
675
675
|
L && x(L);
|
|
676
676
|
};
|
|
677
|
-
let
|
|
678
|
-
const
|
|
679
|
-
var
|
|
680
|
-
|
|
677
|
+
let w, A, D;
|
|
678
|
+
const O = (h) => {
|
|
679
|
+
var T;
|
|
680
|
+
w = (T = r.value[0]) == null ? void 0 : T.object, i = 0, A = new ge(
|
|
681
681
|
(h == null ? void 0 : h.clientX) ?? s.value,
|
|
682
682
|
(h == null ? void 0 : h.clientY) ?? a.value
|
|
683
|
-
),
|
|
683
|
+
), _(M, h);
|
|
684
684
|
};
|
|
685
|
-
let
|
|
686
|
-
const
|
|
687
|
-
var
|
|
688
|
-
h instanceof PointerEvent && (r.value.length === 0 &&
|
|
685
|
+
let B, R = !1;
|
|
686
|
+
const te = (h) => {
|
|
687
|
+
var T, U, ne;
|
|
688
|
+
h instanceof PointerEvent && (r.value.length === 0 && _(E, h), w === ((T = r.value[0]) == null ? void 0 : T.object) && (D = new ge(
|
|
689
689
|
(h == null ? void 0 : h.clientX) ?? s.value,
|
|
690
690
|
(h == null ? void 0 : h.clientY) ?? a.value
|
|
691
|
-
), i = A == null ? void 0 : A.distanceTo(D), h.button === 0 ? (
|
|
691
|
+
), i = A == null ? void 0 : A.distanceTo(D), h.button === 0 ? (_(v, h), B === ((U = r.value[0]) == null ? void 0 : U.object) ? R = !0 : (B = (ne = r.value[0]) == null ? void 0 : ne.object, R = !1)) : h.button === 2 && _(P, h)), _(d, h));
|
|
692
692
|
}, xe = (h) => {
|
|
693
|
-
|
|
694
|
-
}, Le = (h) =>
|
|
695
|
-
return n.value.addEventListener("pointerup",
|
|
696
|
-
n != null && n.value && (n.value.removeEventListener("pointerup",
|
|
693
|
+
R && (_(b, h), B = void 0, R = !1);
|
|
694
|
+
}, Le = (h) => _(m, h), Re = (h) => _(S, h);
|
|
695
|
+
return n.value.addEventListener("pointerup", te), n.value.addEventListener("pointerdown", O), n.value.addEventListener("pointermove", x), n.value.addEventListener("pointerleave", Le), n.value.addEventListener("dblclick", xe), n.value.addEventListener("wheel", Re), K(() => {
|
|
696
|
+
n != null && n.value && (n.value.removeEventListener("pointerup", te), n.value.removeEventListener("pointerdown", O), n.value.removeEventListener("pointermove", x), n.value.removeEventListener("pointerleave", Le), n.value.removeEventListener("dblclick", xe), n.value.removeEventListener("wheel", Re));
|
|
697
697
|
}), {
|
|
698
698
|
intersects: r,
|
|
699
|
-
onClick: (h) =>
|
|
700
|
-
onDblClick: (h) =>
|
|
701
|
-
onContextMenu: (h) =>
|
|
699
|
+
onClick: (h) => v.on(h).off,
|
|
700
|
+
onDblClick: (h) => b.on(h).off,
|
|
701
|
+
onContextMenu: (h) => P.on(h).off,
|
|
702
702
|
onPointerMove: (h) => m.on(h).off,
|
|
703
|
-
onPointerUp: (h) =>
|
|
704
|
-
onPointerDown: (h) =>
|
|
703
|
+
onPointerUp: (h) => d.on(h).off,
|
|
704
|
+
onPointerDown: (h) => M.on(h).off,
|
|
705
705
|
onPointerMissed: (h) => E.on(h).off,
|
|
706
|
-
onWheel: (h) =>
|
|
707
|
-
forceUpdate:
|
|
706
|
+
onWheel: (h) => S.on(h).off,
|
|
707
|
+
forceUpdate: p
|
|
708
708
|
};
|
|
709
709
|
};
|
|
710
710
|
function zr() {
|
|
711
|
-
const { logWarning: e } =
|
|
711
|
+
const { logWarning: e } = Y();
|
|
712
712
|
function t(a, i, l) {
|
|
713
713
|
let c = null;
|
|
714
714
|
return a.traverse((o) => {
|
|
@@ -746,102 +746,102 @@ function ke(e) {
|
|
|
746
746
|
function cr(e) {
|
|
747
747
|
return (e / 1024).toFixed(2);
|
|
748
748
|
}
|
|
749
|
-
const
|
|
749
|
+
const Ce = H({}), Me = (e) => Object.assign(Ce.value, e);
|
|
750
750
|
function ur(e, t, n) {
|
|
751
751
|
var x;
|
|
752
|
-
const r =
|
|
752
|
+
const r = $(), s = $();
|
|
753
753
|
e && (r.value = e), t && (s.value = t);
|
|
754
|
-
const a = (
|
|
755
|
-
var
|
|
756
|
-
return ((
|
|
757
|
-
}, i = (
|
|
758
|
-
var
|
|
759
|
-
return ((
|
|
760
|
-
}, l =
|
|
761
|
-
function c(
|
|
762
|
-
if (Array.isArray(
|
|
763
|
-
for (const A of
|
|
764
|
-
A(
|
|
765
|
-
typeof
|
|
754
|
+
const a = (p) => {
|
|
755
|
+
var w;
|
|
756
|
+
return ((w = p.__tres) == null ? void 0 : w.eventCount) > 0;
|
|
757
|
+
}, i = (p) => {
|
|
758
|
+
var w;
|
|
759
|
+
return ((w = p.children) == null ? void 0 : w.some((A) => i(A))) || a(p);
|
|
760
|
+
}, l = $(((x = r.value) == null ? void 0 : x.children).filter(i) || []);
|
|
761
|
+
function c(p, w) {
|
|
762
|
+
if (Array.isArray(p))
|
|
763
|
+
for (const A of p)
|
|
764
|
+
A(w);
|
|
765
|
+
typeof p == "function" && p(w);
|
|
766
766
|
}
|
|
767
|
-
function o(
|
|
768
|
-
const A = [], D = () =>
|
|
769
|
-
|
|
770
|
-
for (const
|
|
771
|
-
if (
|
|
767
|
+
function o(p, w) {
|
|
768
|
+
const A = [], D = () => w.stopPropagating = !0;
|
|
769
|
+
w.stopPropagation = D;
|
|
770
|
+
for (const O of w == null ? void 0 : w.intersections) {
|
|
771
|
+
if (w.stopPropagating)
|
|
772
772
|
return;
|
|
773
|
-
|
|
774
|
-
const { object:
|
|
775
|
-
|
|
776
|
-
let
|
|
777
|
-
for (;
|
|
778
|
-
|
|
779
|
-
const
|
|
780
|
-
n(
|
|
773
|
+
w = { ...w, ...O };
|
|
774
|
+
const { object: B } = O;
|
|
775
|
+
w.eventObject = B, c(B[p], w), A.push(B);
|
|
776
|
+
let R = B.parent;
|
|
777
|
+
for (; R !== null && !w.stopPropagating && !A.includes(R); )
|
|
778
|
+
w.eventObject = R, c(R[p], w), A.push(R), R = R.parent;
|
|
779
|
+
const te = zn(p.slice(2));
|
|
780
|
+
n(te, { intersection: O, event: w });
|
|
781
781
|
}
|
|
782
782
|
}
|
|
783
783
|
const {
|
|
784
784
|
onClick: u,
|
|
785
|
-
onDblClick:
|
|
785
|
+
onDblClick: y,
|
|
786
786
|
onContextMenu: f,
|
|
787
|
-
onPointerMove:
|
|
788
|
-
onPointerDown:
|
|
789
|
-
onPointerUp:
|
|
787
|
+
onPointerMove: g,
|
|
788
|
+
onPointerDown: v,
|
|
789
|
+
onPointerUp: b,
|
|
790
790
|
onPointerMissed: m,
|
|
791
|
-
onWheel:
|
|
792
|
-
forceUpdate:
|
|
791
|
+
onWheel: d,
|
|
792
|
+
forceUpdate: M
|
|
793
793
|
} = lr(l, t);
|
|
794
|
-
|
|
794
|
+
b((p) => o("onPointerUp", p)), v((p) => o("onPointerDown", p)), u((p) => o("onClick", p)), y((p) => o("onDoubleClick", p)), f((p) => o("onContextMenu", p)), d((p) => o("onWheel", p));
|
|
795
795
|
let E = [];
|
|
796
|
-
|
|
797
|
-
const
|
|
796
|
+
g((p) => {
|
|
797
|
+
const w = p.intersections.map(({ object: D }) => D), A = p.intersections;
|
|
798
798
|
E.forEach(({ object: D }) => {
|
|
799
|
-
|
|
800
|
-
}),
|
|
801
|
-
E.includes(D) || (o("onPointerEnter",
|
|
802
|
-
}), o("onPointerMove",
|
|
799
|
+
w.includes(D) || (p.intersections = E, o("onPointerLeave", p), o("onPointerOut", p));
|
|
800
|
+
}), p.intersections = A, p.intersections.forEach(({ object: D }) => {
|
|
801
|
+
E.includes(D) || (o("onPointerEnter", p), o("onPointerOver", p));
|
|
802
|
+
}), o("onPointerMove", p), E = p.intersections;
|
|
803
803
|
});
|
|
804
|
-
const
|
|
805
|
-
m((
|
|
806
|
-
const
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
}), n("pointer-missed", { event:
|
|
804
|
+
const P = [];
|
|
805
|
+
m((p) => {
|
|
806
|
+
const w = () => p.stopPropagating = !0;
|
|
807
|
+
p.stopPropagation = w, P.forEach((A) => {
|
|
808
|
+
p.stopPropagating || (p.eventObject = A, c(A.onPointerMissed, p));
|
|
809
|
+
}), n("pointer-missed", { event: p });
|
|
810
810
|
});
|
|
811
|
-
function
|
|
812
|
-
re(
|
|
811
|
+
function S(p) {
|
|
812
|
+
re(p) && W(p) && l.value.push(p);
|
|
813
813
|
}
|
|
814
|
-
function
|
|
815
|
-
if (re(
|
|
816
|
-
const
|
|
817
|
-
|
|
814
|
+
function C(p) {
|
|
815
|
+
if (re(p) && W(p)) {
|
|
816
|
+
const w = l.value.indexOf(p);
|
|
817
|
+
w > -1 && l.value.splice(w, 1);
|
|
818
818
|
}
|
|
819
819
|
}
|
|
820
|
-
function
|
|
821
|
-
re(
|
|
820
|
+
function _(p) {
|
|
821
|
+
re(p) && W(p) && p.onPointerMissed && P.push(p);
|
|
822
822
|
}
|
|
823
|
-
function L(
|
|
824
|
-
if (re(
|
|
825
|
-
const
|
|
826
|
-
|
|
823
|
+
function L(p) {
|
|
824
|
+
if (re(p) && W(p)) {
|
|
825
|
+
const w = P.indexOf(p);
|
|
826
|
+
w > -1 && P.splice(w, 1);
|
|
827
827
|
}
|
|
828
828
|
}
|
|
829
829
|
return t.eventManager = {
|
|
830
|
-
forceUpdate:
|
|
831
|
-
registerObject:
|
|
832
|
-
deregisterObject:
|
|
833
|
-
registerPointerMissedObject:
|
|
830
|
+
forceUpdate: M,
|
|
831
|
+
registerObject: S,
|
|
832
|
+
deregisterObject: C,
|
|
833
|
+
registerPointerMissedObject: _,
|
|
834
834
|
deregisterPointerMissedObject: L
|
|
835
835
|
}, {
|
|
836
|
-
forceUpdate:
|
|
837
|
-
registerObject:
|
|
838
|
-
deregisterObject:
|
|
839
|
-
registerPointerMissedObject:
|
|
836
|
+
forceUpdate: M,
|
|
837
|
+
registerObject: S,
|
|
838
|
+
deregisterObject: C,
|
|
839
|
+
registerPointerMissedObject: _,
|
|
840
840
|
deregisterPointerMissedObject: L
|
|
841
841
|
};
|
|
842
842
|
}
|
|
843
843
|
function fr(e, t, n = 10) {
|
|
844
|
-
const r = k(e) ? rn() : on(
|
|
844
|
+
const r = k(e) ? rn() : on(V(() => k(t).parentElement)), s = ye(Fe(r.width, n)), a = ye(Fe(r.height, n)), i = V(() => s.value / a.value);
|
|
845
845
|
return {
|
|
846
846
|
height: a,
|
|
847
847
|
width: s,
|
|
@@ -852,9 +852,9 @@ function ve() {
|
|
|
852
852
|
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
|
|
853
853
|
let n = 0, r = !1;
|
|
854
854
|
const s = () => {
|
|
855
|
-
const o = Array.from(e.entries()).sort((u,
|
|
856
|
-
const f = u[1].priority -
|
|
857
|
-
return f === 0 ? u[1].addI -
|
|
855
|
+
const o = Array.from(e.entries()).sort((u, y) => {
|
|
856
|
+
const f = u[1].priority - y[1].priority;
|
|
857
|
+
return f === 0 ? u[1].addI - y[1].addI : f;
|
|
858
858
|
});
|
|
859
859
|
t.clear(), o.forEach((u) => t.add(u[0]));
|
|
860
860
|
}, a = (o) => {
|
|
@@ -862,9 +862,9 @@ function ve() {
|
|
|
862
862
|
};
|
|
863
863
|
return { on: (o, u = 0) => {
|
|
864
864
|
e.set(o, { priority: u, addI: n++ });
|
|
865
|
-
const
|
|
866
|
-
return sn(
|
|
867
|
-
off:
|
|
865
|
+
const y = () => a(o);
|
|
866
|
+
return sn(y), r = !0, {
|
|
867
|
+
off: y
|
|
868
868
|
};
|
|
869
869
|
}, off: a, trigger: (...o) => {
|
|
870
870
|
r && (s(), r = !1), t.forEach((u) => u(...o));
|
|
@@ -876,77 +876,77 @@ function ve() {
|
|
|
876
876
|
}
|
|
877
877
|
function dr() {
|
|
878
878
|
let e = !0, t = !0, n = !1;
|
|
879
|
-
const r = new tt(!1), s =
|
|
879
|
+
const r = new tt(!1), s = H(r.running), a = H(!1);
|
|
880
880
|
let i;
|
|
881
881
|
const l = rt.generateUUID();
|
|
882
882
|
let c = null;
|
|
883
|
-
const o = ve(), u = ve(),
|
|
884
|
-
|
|
883
|
+
const o = ve(), u = ve(), y = ve();
|
|
884
|
+
C();
|
|
885
885
|
let f = {};
|
|
886
|
-
function _
|
|
887
|
-
f =
|
|
886
|
+
function g(_) {
|
|
887
|
+
f = _;
|
|
888
888
|
}
|
|
889
|
-
function
|
|
889
|
+
function v(_, L, x = 0) {
|
|
890
890
|
switch (L) {
|
|
891
891
|
case "before":
|
|
892
|
-
return o.on(
|
|
892
|
+
return o.on(_, x);
|
|
893
893
|
case "render":
|
|
894
|
-
return c || (c =
|
|
894
|
+
return c || (c = _), u.dispose(), u.on(_);
|
|
895
895
|
case "after":
|
|
896
|
-
return
|
|
896
|
+
return y.on(_, x);
|
|
897
897
|
}
|
|
898
898
|
}
|
|
899
|
-
function
|
|
900
|
-
t && (t = !1,
|
|
899
|
+
function b() {
|
|
900
|
+
t && (t = !1, C(), S());
|
|
901
901
|
}
|
|
902
902
|
function m() {
|
|
903
|
-
t = !0,
|
|
903
|
+
t = !0, C(), cancelAnimationFrame(i);
|
|
904
904
|
}
|
|
905
|
-
function
|
|
906
|
-
n = !1,
|
|
905
|
+
function d() {
|
|
906
|
+
n = !1, C();
|
|
907
907
|
}
|
|
908
|
-
function
|
|
909
|
-
n = !0,
|
|
908
|
+
function M() {
|
|
909
|
+
n = !0, C();
|
|
910
910
|
}
|
|
911
911
|
function E() {
|
|
912
912
|
a.value = !0;
|
|
913
913
|
}
|
|
914
|
-
function
|
|
914
|
+
function P() {
|
|
915
915
|
a.value = !1;
|
|
916
916
|
}
|
|
917
|
-
function
|
|
917
|
+
function S() {
|
|
918
918
|
if (!e) {
|
|
919
|
-
i = requestAnimationFrame(
|
|
919
|
+
i = requestAnimationFrame(S);
|
|
920
920
|
return;
|
|
921
921
|
}
|
|
922
|
-
const
|
|
923
|
-
camera:
|
|
924
|
-
scene:
|
|
925
|
-
renderer:
|
|
926
|
-
raycaster:
|
|
927
|
-
controls:
|
|
922
|
+
const _ = r.getDelta(), L = r.getElapsedTime(), x = {
|
|
923
|
+
camera: J(f.camera),
|
|
924
|
+
scene: J(f.scene),
|
|
925
|
+
renderer: J(f.renderer),
|
|
926
|
+
raycaster: J(f.raycaster),
|
|
927
|
+
controls: J(f.controls),
|
|
928
928
|
invalidate: f.invalidate,
|
|
929
929
|
advance: f.advance
|
|
930
|
-
},
|
|
931
|
-
s.value && o.trigger(
|
|
930
|
+
}, p = { delta: _, elapsed: L, clock: r, ...x };
|
|
931
|
+
s.value && o.trigger(p), a.value || (u.count ? u.trigger(p) : c && c(p)), s.value && y.trigger(p), i = requestAnimationFrame(S);
|
|
932
932
|
}
|
|
933
|
-
function
|
|
934
|
-
const
|
|
935
|
-
r.running !==
|
|
933
|
+
function C() {
|
|
934
|
+
const _ = !t && !n;
|
|
935
|
+
r.running !== _ && (r.running ? r.stop() : r.start()), s.value = r.running;
|
|
936
936
|
}
|
|
937
937
|
return {
|
|
938
938
|
loopId: l,
|
|
939
|
-
register: (
|
|
940
|
-
start:
|
|
939
|
+
register: (_, L, x) => v(_, L, x),
|
|
940
|
+
start: b,
|
|
941
941
|
stop: m,
|
|
942
|
-
pause:
|
|
943
|
-
resume:
|
|
942
|
+
pause: M,
|
|
943
|
+
resume: d,
|
|
944
944
|
pauseRender: E,
|
|
945
|
-
resumeRender:
|
|
945
|
+
resumeRender: P,
|
|
946
946
|
isRenderPaused: a,
|
|
947
947
|
isActive: s,
|
|
948
|
-
setContext:
|
|
949
|
-
setReady: (
|
|
948
|
+
setContext: g,
|
|
949
|
+
setReady: (_) => e = _
|
|
950
950
|
};
|
|
951
951
|
}
|
|
952
952
|
function pr(e, t, n = 100) {
|
|
@@ -960,8 +960,8 @@ function pr(e, t, n = 100) {
|
|
|
960
960
|
i = !0, l && clearTimeout(l);
|
|
961
961
|
}
|
|
962
962
|
c();
|
|
963
|
-
const u = (f, ...
|
|
964
|
-
f(...
|
|
963
|
+
const u = (f, ...g) => {
|
|
964
|
+
f(...g);
|
|
965
965
|
};
|
|
966
966
|
return {
|
|
967
967
|
on: (f) => {
|
|
@@ -969,8 +969,8 @@ function pr(e, t, n = 100) {
|
|
|
969
969
|
return u(f, t), { off: () => {
|
|
970
970
|
} };
|
|
971
971
|
{
|
|
972
|
-
const
|
|
973
|
-
return s.add(
|
|
972
|
+
const g = r.on(f);
|
|
973
|
+
return s.add(g.off), r.on(f);
|
|
974
974
|
}
|
|
975
975
|
},
|
|
976
976
|
off: r.off,
|
|
@@ -978,10 +978,10 @@ function pr(e, t, n = 100) {
|
|
|
978
978
|
cancel: o
|
|
979
979
|
};
|
|
980
980
|
}
|
|
981
|
-
const
|
|
981
|
+
const ee = /* @__PURE__ */ new WeakMap();
|
|
982
982
|
function gt(e) {
|
|
983
|
-
if (e = e || pe(),
|
|
984
|
-
return
|
|
983
|
+
if (e = e || pe(), ee.has(e))
|
|
984
|
+
return ee.get(e);
|
|
985
985
|
const t = 100, n = Date.now(), a = pr(() => {
|
|
986
986
|
if (Date.now() - n >= t)
|
|
987
987
|
return !0;
|
|
@@ -990,12 +990,12 @@ function gt(e) {
|
|
|
990
990
|
return !!(i && l.width > 0 && l.height > 0);
|
|
991
991
|
}
|
|
992
992
|
}, e);
|
|
993
|
-
return
|
|
993
|
+
return ee.set(e, a), a;
|
|
994
994
|
}
|
|
995
995
|
function Gr(e) {
|
|
996
996
|
const t = pe();
|
|
997
997
|
if (t)
|
|
998
|
-
return
|
|
998
|
+
return ee.has(t) ? ee.get(t).on(e) : gt(t).on(e);
|
|
999
999
|
}
|
|
1000
1000
|
function mr({
|
|
1001
1001
|
scene: e,
|
|
@@ -1005,43 +1005,43 @@ function mr({
|
|
|
1005
1005
|
rendererOptions: s,
|
|
1006
1006
|
emit: a
|
|
1007
1007
|
}) {
|
|
1008
|
-
const
|
|
1009
|
-
camera:
|
|
1010
|
-
cameras:
|
|
1011
|
-
registerCamera:
|
|
1012
|
-
deregisterCamera:
|
|
1013
|
-
setCameraActive:
|
|
1014
|
-
} = jn({ sizes:
|
|
1015
|
-
mode:
|
|
1016
|
-
priority:
|
|
1017
|
-
frames:
|
|
1008
|
+
const i = $(e), l = fr(n, t), {
|
|
1009
|
+
camera: c,
|
|
1010
|
+
cameras: o,
|
|
1011
|
+
registerCamera: u,
|
|
1012
|
+
deregisterCamera: y,
|
|
1013
|
+
setCameraActive: f
|
|
1014
|
+
} = jn({ sizes: l, scene: e }), g = {
|
|
1015
|
+
mode: H(s.renderMode || "always"),
|
|
1016
|
+
priority: H(0),
|
|
1017
|
+
frames: H(0),
|
|
1018
1018
|
maxFrames: 60,
|
|
1019
|
-
canBeInvalidated:
|
|
1019
|
+
canBeInvalidated: V(() => g.mode.value === "on-demand" && g.frames.value === 0)
|
|
1020
1020
|
};
|
|
1021
|
-
function
|
|
1022
|
-
s.renderMode === "on-demand"
|
|
1021
|
+
function v(O = 1) {
|
|
1022
|
+
s.renderMode === "on-demand" && (g.frames.value = Math.min(g.maxFrames, g.frames.value + O));
|
|
1023
1023
|
}
|
|
1024
|
-
function
|
|
1025
|
-
s.renderMode === "manual"
|
|
1024
|
+
function b() {
|
|
1025
|
+
s.renderMode === "manual" && (g.frames.value = 1);
|
|
1026
1026
|
}
|
|
1027
|
-
const { renderer:
|
|
1027
|
+
const { renderer: m } = sr(
|
|
1028
1028
|
{
|
|
1029
1029
|
scene: e,
|
|
1030
1030
|
canvas: t,
|
|
1031
1031
|
options: s,
|
|
1032
1032
|
emit: a,
|
|
1033
1033
|
// TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
|
|
1034
|
-
contextParts: { sizes:
|
|
1034
|
+
contextParts: { sizes: l, camera: c, render: g, invalidate: v, advance: b },
|
|
1035
1035
|
disableRender: r
|
|
1036
1036
|
}
|
|
1037
|
-
),
|
|
1038
|
-
sizes:
|
|
1039
|
-
scene:
|
|
1040
|
-
camera:
|
|
1041
|
-
cameras: ye(
|
|
1042
|
-
renderer:
|
|
1043
|
-
raycaster:
|
|
1044
|
-
controls:
|
|
1037
|
+
), d = {
|
|
1038
|
+
sizes: l,
|
|
1039
|
+
scene: i,
|
|
1040
|
+
camera: c,
|
|
1041
|
+
cameras: ye(o),
|
|
1042
|
+
renderer: m,
|
|
1043
|
+
raycaster: $(new Ft()),
|
|
1044
|
+
controls: H(null),
|
|
1045
1045
|
perf: {
|
|
1046
1046
|
maxFrames: 160,
|
|
1047
1047
|
fps: {
|
|
@@ -1054,41 +1054,41 @@ function mr({
|
|
|
1054
1054
|
accumulator: []
|
|
1055
1055
|
}
|
|
1056
1056
|
},
|
|
1057
|
-
render:
|
|
1058
|
-
advance:
|
|
1059
|
-
extend:
|
|
1060
|
-
invalidate:
|
|
1061
|
-
registerCamera:
|
|
1062
|
-
setCameraActive:
|
|
1063
|
-
deregisterCamera:
|
|
1057
|
+
render: g,
|
|
1058
|
+
advance: b,
|
|
1059
|
+
extend: Me,
|
|
1060
|
+
invalidate: v,
|
|
1061
|
+
registerCamera: u,
|
|
1062
|
+
setCameraActive: f,
|
|
1063
|
+
deregisterCamera: y,
|
|
1064
1064
|
loop: dr()
|
|
1065
1065
|
};
|
|
1066
|
-
_e("useTres",
|
|
1067
|
-
root:
|
|
1068
|
-
},
|
|
1069
|
-
|
|
1066
|
+
_e("useTres", d), d.scene.value.__tres = {
|
|
1067
|
+
root: d
|
|
1068
|
+
}, d.loop.register(() => {
|
|
1069
|
+
c.value && g.frames.value > 0 && (m.value.render(e, c.value), a("render", d.renderer.value)), g.priority.value = 0, g.mode.value === "always" ? g.frames.value = 1 : g.frames.value = Math.max(0, g.frames.value - 1);
|
|
1070
1070
|
}, "render");
|
|
1071
|
-
const { on:
|
|
1072
|
-
|
|
1073
|
-
a("ready",
|
|
1074
|
-
}),
|
|
1075
|
-
|
|
1071
|
+
const { on: M, cancel: E } = gt(d);
|
|
1072
|
+
d.loop.setReady(!1), d.loop.start(), M(() => {
|
|
1073
|
+
a("ready", d), d.loop.setReady(!0), ur(e, d, a);
|
|
1074
|
+
}), K(() => {
|
|
1075
|
+
E(), d.loop.stop();
|
|
1076
1076
|
});
|
|
1077
|
-
const
|
|
1078
|
-
let
|
|
1079
|
-
const
|
|
1080
|
-
|
|
1077
|
+
const P = 100, S = an({ every: P }), { isSupported: C, memory: _ } = ln({ interval: P }), L = 160;
|
|
1078
|
+
let x = performance.now();
|
|
1079
|
+
const p = ({ timestamp: O }) => {
|
|
1080
|
+
d.scene.value && (d.perf.memory.allocatedMem = ke(d.scene.value)), O - x >= P && (x = O, d.perf.fps.accumulator.push(S.value), d.perf.fps.accumulator.length > L && d.perf.fps.accumulator.shift(), d.perf.fps.value = S.value, C.value && _.value && (d.perf.memory.accumulator.push(_.value.usedJSHeapSize / 1024 / 1024), d.perf.memory.accumulator.length > L && d.perf.memory.accumulator.shift(), d.perf.memory.currentMem = d.perf.memory.accumulator.reduce((B, R) => B + R, 0) / d.perf.memory.accumulator.length));
|
|
1081
1081
|
};
|
|
1082
|
-
let
|
|
1083
|
-
const
|
|
1084
|
-
window.__TRES__DEVTOOLS__ && (
|
|
1082
|
+
let w = 0;
|
|
1083
|
+
const A = 1, { pause: D } = it(({ delta: O }) => {
|
|
1084
|
+
window.__TRES__DEVTOOLS__ && (p({ timestamp: performance.now() }), w += O, w >= A && (window.__TRES__DEVTOOLS__.cb(d), w = 0));
|
|
1085
1085
|
}, { immediate: !0 });
|
|
1086
|
-
return
|
|
1087
|
-
|
|
1088
|
-
}),
|
|
1086
|
+
return K(() => {
|
|
1087
|
+
D();
|
|
1088
|
+
}), d;
|
|
1089
1089
|
}
|
|
1090
1090
|
function pe() {
|
|
1091
|
-
const e =
|
|
1091
|
+
const e = Ct("useTres");
|
|
1092
1092
|
if (!e)
|
|
1093
1093
|
throw new Error("useTresContext must be used together with useTresContextProvider");
|
|
1094
1094
|
return e;
|
|
@@ -1114,14 +1114,14 @@ function Yr() {
|
|
|
1114
1114
|
invalidate: i,
|
|
1115
1115
|
advance: l
|
|
1116
1116
|
});
|
|
1117
|
-
function c(
|
|
1118
|
-
return r.register(
|
|
1117
|
+
function c(y, f = 0) {
|
|
1118
|
+
return r.register(y, "before", f);
|
|
1119
1119
|
}
|
|
1120
|
-
function o(
|
|
1121
|
-
return r.register(
|
|
1120
|
+
function o(y) {
|
|
1121
|
+
return r.register(y, "render");
|
|
1122
1122
|
}
|
|
1123
|
-
function u(
|
|
1124
|
-
return r.register(
|
|
1123
|
+
function u(y, f = 0) {
|
|
1124
|
+
return r.register(y, "after", f);
|
|
1125
1125
|
}
|
|
1126
1126
|
return {
|
|
1127
1127
|
pause: r.pause,
|
|
@@ -1153,7 +1153,7 @@ function hr(e, t = {}, n = {}) {
|
|
|
1153
1153
|
};
|
|
1154
1154
|
return a = new Proxy({}, i), a;
|
|
1155
1155
|
}
|
|
1156
|
-
const { logError: Ke } =
|
|
1156
|
+
const { logError: Ke } = Y(), Qe = [
|
|
1157
1157
|
"onClick",
|
|
1158
1158
|
"onContextMenu",
|
|
1159
1159
|
"onPointerMove",
|
|
@@ -1170,66 +1170,66 @@ const { logError: Ke } = z(), Qe = [
|
|
|
1170
1170
|
"onWheel"
|
|
1171
1171
|
], gr = (e) => {
|
|
1172
1172
|
const t = e.scene.value;
|
|
1173
|
-
function n(o, u,
|
|
1173
|
+
function n(o, u, y, f) {
|
|
1174
1174
|
if (f || (f = {}), f.args || (f.args = []), o === "template" || Wn(o))
|
|
1175
1175
|
return null;
|
|
1176
|
-
let
|
|
1176
|
+
let g = o.replace("Tres", ""), v;
|
|
1177
1177
|
if (o === "primitive") {
|
|
1178
|
-
(!N(f.object) ||
|
|
1178
|
+
(!N(f.object) || Mt(f.object)) && Ke(
|
|
1179
1179
|
"Tres primitives need an 'object' prop, whose value is an object or shallowRef<object>"
|
|
1180
|
-
),
|
|
1181
|
-
const
|
|
1182
|
-
|
|
1180
|
+
), g = f.object.type;
|
|
1181
|
+
const b = {};
|
|
1182
|
+
v = hr(
|
|
1183
1183
|
f.object,
|
|
1184
1184
|
{
|
|
1185
|
-
object: (
|
|
1185
|
+
object: (d) => d,
|
|
1186
1186
|
isPrimitive: () => !0,
|
|
1187
|
-
__tres: () =>
|
|
1187
|
+
__tres: () => b
|
|
1188
1188
|
},
|
|
1189
1189
|
{
|
|
1190
|
-
object: (
|
|
1191
|
-
rr(
|
|
1190
|
+
object: (d, M, E, P) => {
|
|
1191
|
+
rr(d, E, P, { patchProp: a, remove: s, insert: r }, e);
|
|
1192
1192
|
},
|
|
1193
|
-
__tres: (
|
|
1194
|
-
Object.assign(
|
|
1193
|
+
__tres: (d) => {
|
|
1194
|
+
Object.assign(b, d);
|
|
1195
1195
|
}
|
|
1196
1196
|
}
|
|
1197
1197
|
);
|
|
1198
1198
|
} else {
|
|
1199
|
-
const
|
|
1200
|
-
|
|
1201
|
-
`${
|
|
1202
|
-
),
|
|
1199
|
+
const b = Ce.value[g];
|
|
1200
|
+
b || Ke(
|
|
1201
|
+
`${g} is not defined on the THREE namespace. Use extend to add it to the catalog.`
|
|
1202
|
+
), v = new b(...f.args);
|
|
1203
1203
|
}
|
|
1204
|
-
return
|
|
1205
|
-
...
|
|
1206
|
-
type:
|
|
1204
|
+
return v ? (v.isCamera && (f != null && f.position || v.position.set(3, 3, 3), f != null && f.lookAt || v.lookAt(0, 0, 0)), v = z(v, {
|
|
1205
|
+
...v.__tres,
|
|
1206
|
+
type: g,
|
|
1207
1207
|
memoizedProps: f,
|
|
1208
1208
|
eventCount: 0,
|
|
1209
1209
|
primitive: o === "primitive",
|
|
1210
1210
|
attach: f.attach
|
|
1211
|
-
}, e),
|
|
1211
|
+
}, e), v) : null;
|
|
1212
1212
|
}
|
|
1213
1213
|
function r(o, u) {
|
|
1214
|
-
var
|
|
1214
|
+
var g, v, b;
|
|
1215
1215
|
if (!o)
|
|
1216
1216
|
return;
|
|
1217
1217
|
u = u || t;
|
|
1218
|
-
const
|
|
1219
|
-
o =
|
|
1218
|
+
const y = o.__tres ? o : z(o, {}, e), f = u.__tres ? u : z(u, {}, e);
|
|
1219
|
+
o = Q(y), u = Q(f), o.__tres && ((g = o.__tres) == null ? void 0 : g.eventCount) > 0 && ((v = e.eventManager) == null || v.registerObject(o)), e.registerCamera(o), (b = e.eventManager) == null || b.registerPointerMissedObject(o), y.__tres.attach ? er(f, y, y.__tres.attach) : W(o) && W(f) && (f.add(o), o.dispatchEvent({ type: "added" })), y.__tres.parent = f, f.__tres.objects && !f.__tres.objects.includes(y) && f.__tres.objects.push(y);
|
|
1220
1220
|
}
|
|
1221
1221
|
function s(o, u) {
|
|
1222
|
-
var
|
|
1222
|
+
var v, b, m, d;
|
|
1223
1223
|
if (!o)
|
|
1224
1224
|
return;
|
|
1225
|
-
o != null && o.__tres && ((
|
|
1226
|
-
const
|
|
1227
|
-
be(
|
|
1228
|
-
const f = (
|
|
1229
|
-
if (o.__tres && "objects" in o.__tres && [...o.__tres.objects].forEach((
|
|
1230
|
-
if (
|
|
1225
|
+
o != null && o.__tres && ((v = o.__tres) == null ? void 0 : v.eventCount) > 0 && ((b = e.eventManager) == null || b.deregisterObject(o)), u = be(u) ? "default" : u;
|
|
1226
|
+
const y = (m = o.__tres) == null ? void 0 : m.dispose;
|
|
1227
|
+
be(y) || (y === null ? u = !1 : u = y);
|
|
1228
|
+
const f = (d = o.__tres) == null ? void 0 : d.primitive, g = u === "default" ? !f : !!u;
|
|
1229
|
+
if (o.__tres && "objects" in o.__tres && [...o.__tres.objects].forEach((M) => s(M, u)), g && o.children && [...o.children].forEach((M) => s(M, u)), mt(o, e), ht(o, e), g && !On(o)) {
|
|
1230
|
+
if (G(u))
|
|
1231
1231
|
u(o);
|
|
1232
|
-
else if (
|
|
1232
|
+
else if (G(o.dispose))
|
|
1233
1233
|
try {
|
|
1234
1234
|
o.dispose();
|
|
1235
1235
|
} catch {
|
|
@@ -1237,66 +1237,66 @@ const { logError: Ke } = z(), Qe = [
|
|
|
1237
1237
|
}
|
|
1238
1238
|
"__tres" in o && delete o.__tres;
|
|
1239
1239
|
}
|
|
1240
|
-
function a(o, u,
|
|
1241
|
-
var
|
|
1240
|
+
function a(o, u, y, f) {
|
|
1241
|
+
var M, E;
|
|
1242
1242
|
if (!o)
|
|
1243
1243
|
return;
|
|
1244
|
-
let
|
|
1244
|
+
let g = o, v = u;
|
|
1245
1245
|
if (o.__tres && (o.__tres.memoizedProps[u] = f), u === "attach") {
|
|
1246
|
-
const
|
|
1247
|
-
s(o),
|
|
1246
|
+
const P = ((M = o.__tres) == null ? void 0 : M.parent) || o.parent;
|
|
1247
|
+
s(o), z(o, { attach: f }, e), P && r(o, P);
|
|
1248
1248
|
return;
|
|
1249
1249
|
}
|
|
1250
1250
|
if (u === "dispose") {
|
|
1251
|
-
o.__tres || (o =
|
|
1251
|
+
o.__tres || (o = z(o, {}, e)), o.__tres.dispose = f;
|
|
1252
1252
|
return;
|
|
1253
1253
|
}
|
|
1254
|
-
if (W(o) &&
|
|
1255
|
-
f || f === "" ? o[
|
|
1254
|
+
if (W(o) && v === "blocks-pointer-events") {
|
|
1255
|
+
f || f === "" ? o[v] = f : delete o[v];
|
|
1256
1256
|
return;
|
|
1257
1257
|
}
|
|
1258
1258
|
Qe.includes(u) && o.__tres && (o.__tres.eventCount += 1);
|
|
1259
|
-
let
|
|
1260
|
-
if (
|
|
1261
|
-
const
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
new
|
|
1259
|
+
let b = se(v), m = g == null ? void 0 : g[b];
|
|
1260
|
+
if (v === "args") {
|
|
1261
|
+
const P = o, S = y ?? [], C = f ?? [], _ = ((E = o.__tres) == null ? void 0 : E.type) || o.type;
|
|
1262
|
+
_ && S.length && !Yn(S, C) && (g = Object.assign(
|
|
1263
|
+
P,
|
|
1264
|
+
new Ce.value[_](...f)
|
|
1265
1265
|
));
|
|
1266
1266
|
return;
|
|
1267
1267
|
}
|
|
1268
|
-
if (
|
|
1269
|
-
if (
|
|
1268
|
+
if (g.type === "BufferGeometry") {
|
|
1269
|
+
if (v === "args")
|
|
1270
1270
|
return;
|
|
1271
|
-
|
|
1272
|
-
se(
|
|
1271
|
+
g.setAttribute(
|
|
1272
|
+
se(v),
|
|
1273
1273
|
new Wt(...f)
|
|
1274
1274
|
);
|
|
1275
1275
|
return;
|
|
1276
1276
|
}
|
|
1277
|
-
if (
|
|
1278
|
-
const
|
|
1279
|
-
m =
|
|
1277
|
+
if (v.includes("-") && m === void 0) {
|
|
1278
|
+
const P = v.split("-");
|
|
1279
|
+
m = P.reduce((S, C) => S[se(C)], g), v = P.pop(), b = v, m != null && m.set || (g = P.reduce((S, C) => S[se(C)], g));
|
|
1280
1280
|
}
|
|
1281
|
-
let
|
|
1282
|
-
if (
|
|
1283
|
-
Qe.includes(u) || (de(
|
|
1281
|
+
let d = f;
|
|
1282
|
+
if (d === "" && (d = !0), G(m)) {
|
|
1283
|
+
Qe.includes(u) || (de(d) ? o[b](...d) : o[b](d)), b.startsWith("on") && G(d) && (g[b] = d);
|
|
1284
1284
|
return;
|
|
1285
1285
|
}
|
|
1286
|
-
!(m != null && m.set) && !
|
|
1286
|
+
!(m != null && m.set) && !G(m) ? g[b] = d : m.constructor === d.constructor && (m != null && m.copy) ? m == null || m.copy(d) : de(d) ? m.set(...d) : !m.isColor && m.setScalar ? m.setScalar(d) : m.set(d), pt(o);
|
|
1287
1287
|
}
|
|
1288
1288
|
function i(o) {
|
|
1289
1289
|
var u;
|
|
1290
1290
|
return ((u = o == null ? void 0 : o.__tres) == null ? void 0 : u.parent) || null;
|
|
1291
1291
|
}
|
|
1292
1292
|
function l(o) {
|
|
1293
|
-
const u =
|
|
1293
|
+
const u = z(new Nt(), { type: "Comment" }, e);
|
|
1294
1294
|
return u.name = o, u;
|
|
1295
1295
|
}
|
|
1296
1296
|
function c(o) {
|
|
1297
|
-
var
|
|
1298
|
-
const u = i(o),
|
|
1299
|
-
return f < 0 || f >=
|
|
1297
|
+
var g;
|
|
1298
|
+
const u = i(o), y = ((g = u == null ? void 0 : u.__tres) == null ? void 0 : g.objects) || [], f = y.indexOf(o);
|
|
1299
|
+
return f < 0 || f >= y.length - 1 ? null : y[f + 1];
|
|
1300
1300
|
}
|
|
1301
1301
|
return {
|
|
1302
1302
|
insert: r,
|
|
@@ -1322,15 +1322,15 @@ function vt() {
|
|
|
1322
1322
|
return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
|
|
1323
1323
|
}
|
|
1324
1324
|
const yr = typeof Proxy == "function", _r = "devtools-plugin:setup", wr = "plugin:settings:set";
|
|
1325
|
-
let
|
|
1325
|
+
let q, Ee;
|
|
1326
1326
|
function br() {
|
|
1327
1327
|
var e;
|
|
1328
|
-
return
|
|
1328
|
+
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;
|
|
1329
1329
|
}
|
|
1330
1330
|
function Pr() {
|
|
1331
1331
|
return br() ? Ee.now() : Date.now();
|
|
1332
1332
|
}
|
|
1333
|
-
class
|
|
1333
|
+
class Cr {
|
|
1334
1334
|
constructor(t, n) {
|
|
1335
1335
|
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
|
|
1336
1336
|
const r = {};
|
|
@@ -1392,12 +1392,12 @@ class Mr {
|
|
|
1392
1392
|
n.resolve(await this.target[n.method](...n.args));
|
|
1393
1393
|
}
|
|
1394
1394
|
}
|
|
1395
|
-
function
|
|
1395
|
+
function Mr(e, t) {
|
|
1396
1396
|
const n = e, r = vt(), s = vr(), a = yr && n.enableEarlyProxy;
|
|
1397
1397
|
if (s && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !a))
|
|
1398
1398
|
s.emit(_r, e, t);
|
|
1399
1399
|
else {
|
|
1400
|
-
const i = a ? new
|
|
1400
|
+
const i = a ? new Cr(n, s) : null;
|
|
1401
1401
|
(r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({
|
|
1402
1402
|
pluginDescriptor: n,
|
|
1403
1403
|
setupFn: t,
|
|
@@ -1460,11 +1460,11 @@ function _t(e, t, n = "") {
|
|
|
1460
1460
|
t.children.push(s), _t(r, s, n);
|
|
1461
1461
|
});
|
|
1462
1462
|
}
|
|
1463
|
-
const Tr = [],
|
|
1463
|
+
const Tr = [], X = "tres:inspector", Sr = Et({
|
|
1464
1464
|
sceneGraph: null
|
|
1465
1465
|
});
|
|
1466
1466
|
function Ar(e, t) {
|
|
1467
|
-
|
|
1467
|
+
Mr(
|
|
1468
1468
|
{
|
|
1469
1469
|
id: "dev.esm.tres",
|
|
1470
1470
|
label: "TresJS 🪐",
|
|
@@ -1478,16 +1478,16 @@ function Ar(e, t) {
|
|
|
1478
1478
|
typeof n.now != "function" && Er(
|
|
1479
1479
|
"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."
|
|
1480
1480
|
), n.addInspector({
|
|
1481
|
-
id:
|
|
1481
|
+
id: X,
|
|
1482
1482
|
label: "TresJS 🪐",
|
|
1483
1483
|
icon: "account_tree",
|
|
1484
1484
|
treeFilterPlaceholder: "Search instances"
|
|
1485
1485
|
}), setInterval(() => {
|
|
1486
|
-
n.sendInspectorTree(
|
|
1486
|
+
n.sendInspectorTree(X);
|
|
1487
1487
|
}, 1e3), setInterval(() => {
|
|
1488
1488
|
n.notifyComponentUpdate();
|
|
1489
1489
|
}, 5e3), n.on.getInspectorTree((a) => {
|
|
1490
|
-
if (a.inspectorId ===
|
|
1490
|
+
if (a.inspectorId === X) {
|
|
1491
1491
|
const i = yt(t.scene.value);
|
|
1492
1492
|
_t(t.scene.value, i, a.filter), Sr.sceneGraph = i, a.rootNodes = [i];
|
|
1493
1493
|
}
|
|
@@ -1495,7 +1495,7 @@ function Ar(e, t) {
|
|
|
1495
1495
|
let r = null, s = null;
|
|
1496
1496
|
n.on.getInspectorState((a) => {
|
|
1497
1497
|
var i;
|
|
1498
|
-
if (a.inspectorId ===
|
|
1498
|
+
if (a.inspectorId === X) {
|
|
1499
1499
|
const [l] = t.scene.value.getObjectsByProperty("uuid", a.nodeId);
|
|
1500
1500
|
if (!l)
|
|
1501
1501
|
return;
|
|
@@ -1523,7 +1523,7 @@ function Ar(e, t) {
|
|
|
1523
1523
|
}))) || []);
|
|
1524
1524
|
}
|
|
1525
1525
|
}), n.on.editInspectorState((a) => {
|
|
1526
|
-
a.inspectorId ===
|
|
1526
|
+
a.inspectorId === X && Jn(t.scene.value, a.nodeId, a.path, a.state.value);
|
|
1527
1527
|
});
|
|
1528
1528
|
}
|
|
1529
1529
|
);
|
|
@@ -1573,66 +1573,66 @@ const kr = ["data-scene", "data-tres"], xr = /* @__PURE__ */ Be({
|
|
|
1573
1573
|
"ready"
|
|
1574
1574
|
],
|
|
1575
1575
|
setup(e, { expose: t, emit: n }) {
|
|
1576
|
-
var
|
|
1577
|
-
const r = e, s = n, a = Tt(), { logWarning: i } =
|
|
1578
|
-
|
|
1576
|
+
var b;
|
|
1577
|
+
const r = e, s = n, a = Tt(), { logWarning: i } = Y(), l = H(), c = $(new nt()), o = (b = Ie()) == null ? void 0 : b.appContext.app;
|
|
1578
|
+
Me(et);
|
|
1579
1579
|
const u = (m) => Be({
|
|
1580
1580
|
setup() {
|
|
1581
|
-
var
|
|
1582
|
-
const
|
|
1583
|
-
return
|
|
1581
|
+
var M;
|
|
1582
|
+
const d = (M = Ie()) == null ? void 0 : M.appContext;
|
|
1583
|
+
return d && (d.app = o), _e("useTres", m), _e("extend", Me), typeof window < "u" && Ar(d == null ? void 0 : d.app, m), () => He(Ot, null, a != null && a.default ? a.default() : []);
|
|
1584
1584
|
}
|
|
1585
|
-
}),
|
|
1586
|
-
const
|
|
1587
|
-
|
|
1588
|
-
}, f = (m,
|
|
1589
|
-
dt(m.scene.value),
|
|
1585
|
+
}), y = (m) => {
|
|
1586
|
+
const d = u(m), { render: M } = Rt(gr(m));
|
|
1587
|
+
M(He(d), c.value);
|
|
1588
|
+
}, f = (m, d = !1) => {
|
|
1589
|
+
dt(m.scene.value), d && (m.renderer.value.dispose(), m.renderer.value.renderLists.dispose(), m.renderer.value.forceContextLoss()), c.value.__tres = {
|
|
1590
1590
|
root: m
|
|
1591
|
-
},
|
|
1592
|
-
},
|
|
1593
|
-
return t({ context:
|
|
1591
|
+
}, y(m);
|
|
1592
|
+
}, g = V(() => r.disableRender), v = $(null);
|
|
1593
|
+
return t({ context: v, dispose: () => f(v.value, !0) }), St(() => {
|
|
1594
1594
|
const m = l;
|
|
1595
|
-
|
|
1595
|
+
v.value = mr({
|
|
1596
1596
|
scene: c.value,
|
|
1597
1597
|
canvas: m,
|
|
1598
1598
|
windowSize: r.windowSize ?? !1,
|
|
1599
|
-
disableRender:
|
|
1599
|
+
disableRender: g.value ?? !1,
|
|
1600
1600
|
rendererOptions: r,
|
|
1601
1601
|
emit: s
|
|
1602
1602
|
});
|
|
1603
|
-
const { registerCamera:
|
|
1604
|
-
v
|
|
1605
|
-
const
|
|
1606
|
-
const
|
|
1603
|
+
const { registerCamera: d, camera: M, cameras: E, deregisterCamera: P } = v.value;
|
|
1604
|
+
y(v.value);
|
|
1605
|
+
const S = () => {
|
|
1606
|
+
const C = new we(
|
|
1607
1607
|
45,
|
|
1608
1608
|
window.innerWidth / window.innerHeight,
|
|
1609
1609
|
0.1,
|
|
1610
1610
|
1e3
|
|
1611
1611
|
);
|
|
1612
|
-
|
|
1613
|
-
const
|
|
1614
|
-
E.value.length >= 2 && (
|
|
1612
|
+
C.position.set(3, 3, 3), C.lookAt(0, 0, 0), d(C);
|
|
1613
|
+
const _ = Te(() => {
|
|
1614
|
+
E.value.length >= 2 && (C.removeFromParent(), P(C), _ == null || _());
|
|
1615
1615
|
});
|
|
1616
1616
|
};
|
|
1617
1617
|
le(
|
|
1618
1618
|
() => r.camera,
|
|
1619
|
-
(
|
|
1620
|
-
|
|
1619
|
+
(C, _) => {
|
|
1620
|
+
C && d(C), _ && (_.removeFromParent(), P(_));
|
|
1621
1621
|
},
|
|
1622
1622
|
{
|
|
1623
1623
|
immediate: !0
|
|
1624
1624
|
}
|
|
1625
|
-
),
|
|
1625
|
+
), M.value || (i(
|
|
1626
1626
|
"No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
|
|
1627
|
-
),
|
|
1628
|
-
}),
|
|
1629
|
-
f(
|
|
1630
|
-
}), (m,
|
|
1627
|
+
), S());
|
|
1628
|
+
}), K(() => {
|
|
1629
|
+
f(v.value);
|
|
1630
|
+
}), (m, d) => (At(), kt("canvas", {
|
|
1631
1631
|
ref_key: "canvas",
|
|
1632
1632
|
ref: l,
|
|
1633
1633
|
"data-scene": c.value.uuid,
|
|
1634
1634
|
class: xt(m.$attrs.class),
|
|
1635
|
-
"data-tres": `tresjs ${
|
|
1635
|
+
"data-tres": `tresjs ${J(An).version}`,
|
|
1636
1636
|
style: Lt({
|
|
1637
1637
|
display: "block",
|
|
1638
1638
|
width: "100%",
|
|
@@ -1688,7 +1688,7 @@ class wt extends zt {
|
|
|
1688
1688
|
this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
|
|
1689
1689
|
}
|
|
1690
1690
|
}
|
|
1691
|
-
const { logWarning: Ze } =
|
|
1691
|
+
const { logWarning: Ze } = Y();
|
|
1692
1692
|
let ae, F;
|
|
1693
1693
|
const Or = {
|
|
1694
1694
|
DirectionalLight: qt,
|
|
@@ -1714,8 +1714,8 @@ const Or = {
|
|
|
1714
1714
|
}
|
|
1715
1715
|
F = e.parent.children.find((t) => t instanceof ae), F && F.dispose && F.dispose(), e.parent.remove(F);
|
|
1716
1716
|
}
|
|
1717
|
-
}, { logWarning: Dr } =
|
|
1718
|
-
let
|
|
1717
|
+
}, { logWarning: Dr } = Y();
|
|
1718
|
+
let I = null;
|
|
1719
1719
|
const Qr = {
|
|
1720
1720
|
updated: (e, t) => {
|
|
1721
1721
|
var s;
|
|
@@ -1724,9 +1724,9 @@ const Qr = {
|
|
|
1724
1724
|
Dr(`v-distance-to: problem with binding value: ${t.value}`);
|
|
1725
1725
|
return;
|
|
1726
1726
|
}
|
|
1727
|
-
|
|
1727
|
+
I && (I.dispose(), e.parent.remove(I));
|
|
1728
1728
|
const r = n.clone().sub(e.position);
|
|
1729
|
-
r.normalize(),
|
|
1729
|
+
r.normalize(), I = new Xt(r, e.position, e.position.distanceTo(n), 16776960), e.parent.add(I), console.table(
|
|
1730
1730
|
[
|
|
1731
1731
|
["Distance:", e.position.distanceTo(n)],
|
|
1732
1732
|
[`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(s = e.position) == null ? void 0 : s.z}`],
|
|
@@ -1735,7 +1735,7 @@ const Qr = {
|
|
|
1735
1735
|
);
|
|
1736
1736
|
},
|
|
1737
1737
|
unmounted: (e) => {
|
|
1738
|
-
|
|
1738
|
+
I == null || I.dispose(), e.parent.remove(I);
|
|
1739
1739
|
}
|
|
1740
1740
|
}, Xr = {
|
|
1741
1741
|
install(e) {
|
|
@@ -1744,11 +1744,11 @@ const Qr = {
|
|
|
1744
1744
|
};
|
|
1745
1745
|
export {
|
|
1746
1746
|
xr as TresCanvas,
|
|
1747
|
-
|
|
1747
|
+
Ce as catalogue,
|
|
1748
1748
|
dr as createRenderLoop,
|
|
1749
1749
|
Xr as default,
|
|
1750
1750
|
dt as dispose,
|
|
1751
|
-
|
|
1751
|
+
Me as extend,
|
|
1752
1752
|
Ur as isProd,
|
|
1753
1753
|
$n as normalizeColor,
|
|
1754
1754
|
Fr as normalizeVectorFlexibleParam,
|
|
@@ -1757,7 +1757,7 @@ export {
|
|
|
1757
1757
|
ar as trasverseObjects,
|
|
1758
1758
|
jn as useCamera,
|
|
1759
1759
|
Wr as useLoader,
|
|
1760
|
-
|
|
1760
|
+
Y as useLogger,
|
|
1761
1761
|
Yr as useLoop,
|
|
1762
1762
|
lr as useRaycaster,
|
|
1763
1763
|
$r as useRenderLoop,
|