@tresjs/core 4.3.2 → 4.3.3
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version: v4.3.
|
|
3
|
+
* version: v4.3.3
|
|
4
4
|
* (c) 2025
|
|
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 Et = Object.defineProperty;
|
|
9
9
|
var Tt = (e, t, n) => t in e ? Et(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
10
10
|
var he = (e, t, n) => Tt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
11
|
-
import { defineComponent as fe, withAsyncContext as nt, reactive as Se, renderSlot as rt, unref as W, ref as I, computed as
|
|
11
|
+
import { defineComponent as fe, withAsyncContext as nt, reactive as Se, renderSlot as rt, unref as W, ref as I, computed as q, watchEffect as Ae, onUnmounted as K, shallowRef as $, watch as ae, readonly as we, provide as le, inject as St, isRef as At, useSlots as xt, getCurrentInstance as He, onMounted as kt, createElementBlock as Lt, openBlock as Rt, normalizeStyle as Ot, normalizeClass as Dt, createRenderer as jt, h as Ue, Fragment as Bt } from "vue";
|
|
12
12
|
import * as ot from "three";
|
|
13
|
-
import { Scene as st,
|
|
13
|
+
import { Scene as st, MathUtils as it, Vector3 as xe, MeshBasicMaterial as at, DoubleSide as It, TextureLoader as $t, PerspectiveCamera as be, Camera as Ht, Clock as lt, REVISION as Ut, Color as Z, NoToneMapping as Ft, PCFSoftShadowMap as Wt, ACESFilmicToneMapping as ct, SRGBColorSpace as Nt, WebGLRenderer as ge, Vector2 as ve, Raycaster as zt, Object3D as Gt, BufferAttribute as Vt, ArrowHelper as Yt, Line as qt, BufferGeometry as Fe, Float32BufferAttribute as We, LineBasicMaterial as Kt, Mesh as Jt, BackSide as Qt, HemisphereLightHelper as Xt, SpotLightHelper as Zt, PointLightHelper as en, DirectionalLightHelper as tn } from "three";
|
|
14
14
|
import { tryOnScopeDispose as nn, toValue as A, unrefElement as rn, useDevicePixelRatio as on, useWindowSize as sn, useElementSize as an, refDebounced as Ne, usePointer as ln, useElementBounding as cn, createEventHook as D, useFps as un, useMemory as fn, useRafFn as ut } from "@vueuse/core";
|
|
15
|
-
const dn = "@tresjs/core", pn = "module", mn = "4.3.
|
|
15
|
+
const dn = "@tresjs/core", pn = "module", mn = "4.3.3", hn = "pnpm@9.15.5", gn = "Declarative ThreeJS using Vue Components", vn = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", yn = "MIT", _n = { type: "git", url: "git+https://github.com/Tresjs/tres.git" }, wn = ["vue", "3d", "threejs", "three", "threejs-vue"], bn = !1, Mn = { ".": { types: "./dist/index.d.ts", import: "./dist/tres.js", require: "./dist/tres.umd.cjs" }, "./components": { types: "./dist/src/components/index.d.ts" }, "./composables": { types: "./dist/src/composables/index.d.ts" }, "./types": { types: "./dist/src/types/index.d.ts" }, "./utils": { types: "./dist/src/utils/index.d.ts" }, "./*": "./*" }, Pn = "./dist/tres.js", Cn = "./dist/tres.js", En = "./dist/index.d.ts", Tn = ["*.d.ts", "dist"], Sn = { access: "public" }, An = { dev: "pnpm --filter='./playground/vue' dev", "dev:nuxt": "pnpm --filter='./playground/nuxt' dev", build: "vite build", test: "vitest", "test:ci": "vitest run", "test:ui": "vitest --ui --coverage.enabled=true", release: "release-it", coverage: "vitest run --coverage", lint: "eslint .", "lint:fix": "eslint . --fix", "docs:dev": "vitepress dev docs", "docs:build": "vitepress build docs", "docs:serve": "vitepress serve docs", "docs:preview": "vitepress preview docs", "docs:contributors": "esno scripts/update-contributors.ts" }, xn = { three: ">=0.133", vue: ">=3.4" }, kn = { "@alvarosabu/utils": "^3.2.0", "@vue/devtools-api": "^6.6.3", "@vueuse/core": "^12.5.0" }, Ln = { "@release-it/conventional-changelog": "^10.0.0", "@stackblitz/sdk": "^1.11.0", "@tresjs/cientos": "4.1.0", "@tresjs/eslint-config": "^1.4.0", "@types/three": "^0.173.0", "@typescript-eslint/eslint-plugin": "^8.23.0", "@typescript-eslint/parser": "^8.23.0", "@vitejs/plugin-vue": "^5.2.1", "@vitest/coverage-c8": "^0.33.0", "@vitest/coverage-v8": "^3.0.5", "@vitest/ui": "^3.0.5", "@vue/test-utils": "^2.4.6", eslint: "^9.19.0", "eslint-plugin-vue": "^9.32.0", esno: "^4.8.0", gsap: "^3.12.7", jsdom: "^26.0.0", kolorist: "^1.8.0", ohmyfetch: "^0.4.21", pathe: "^2.0.2", "release-it": "^18.1.2", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-copy": "^3.5.0", "rollup-plugin-visualizer": "^5.14.0", sponsorkit: "^16.3.0", three: "^0.173.0", unocss: "^65.4.3", unplugin: "^2.1.2", "unplugin-vue-components": "^28.0.0", vite: "^6.1.0", "vite-plugin-banner": "^0.8.0", "vite-plugin-dts": "4.5.0", "vite-plugin-inspect": "^10.1.0", "vite-plugin-require-transform": "^1.0.21", "vite-svg-loader": "^5.1.0", vitepress: "1.6.3", vitest: "3.0.5", vue: "3.5.13", "vue-demi": "^0.14.10" }, Rn = {
|
|
16
16
|
name: dn,
|
|
17
17
|
type: pn,
|
|
18
18
|
version: mn,
|
|
@@ -31,8 +31,8 @@ const dn = "@tresjs/core", pn = "module", mn = "4.3.2", hn = "pnpm@9.15.1", gn =
|
|
|
31
31
|
publishConfig: Sn,
|
|
32
32
|
scripts: An,
|
|
33
33
|
peerDependencies: xn,
|
|
34
|
-
dependencies:
|
|
35
|
-
devDependencies:
|
|
34
|
+
dependencies: kn,
|
|
35
|
+
devDependencies: Ln
|
|
36
36
|
};
|
|
37
37
|
function On(e) {
|
|
38
38
|
const t = { nodes: {}, materials: {} };
|
|
@@ -40,18 +40,18 @@ function On(e) {
|
|
|
40
40
|
n.name && (t.nodes[n.name] = n), n.material && !t.materials[n.material.name] && (t.materials[n.material.name] = n.material);
|
|
41
41
|
}), t;
|
|
42
42
|
}
|
|
43
|
-
async function Dn(e, t, n, r,
|
|
44
|
-
const { logError: l } =
|
|
45
|
-
return
|
|
46
|
-
|
|
43
|
+
async function Dn(e, t, n, r, o) {
|
|
44
|
+
const { logError: l } = Q(), s = new e();
|
|
45
|
+
return o && o(s), n && n(s), await new Promise((a, c) => {
|
|
46
|
+
s.load(
|
|
47
47
|
t,
|
|
48
|
-
(
|
|
49
|
-
const f =
|
|
48
|
+
(i) => {
|
|
49
|
+
const f = i;
|
|
50
50
|
f.scene && Object.assign(f, On(f.scene)), a(f);
|
|
51
51
|
},
|
|
52
52
|
r,
|
|
53
|
-
(
|
|
54
|
-
l("[useLoader] - Failed to load resource",
|
|
53
|
+
(i) => {
|
|
54
|
+
l("[useLoader] - Failed to load resource", i), c(i);
|
|
55
55
|
}
|
|
56
56
|
);
|
|
57
57
|
});
|
|
@@ -64,8 +64,8 @@ const Yr = /* @__PURE__ */ fe({
|
|
|
64
64
|
},
|
|
65
65
|
async setup(e) {
|
|
66
66
|
let t, n;
|
|
67
|
-
const r = e,
|
|
68
|
-
return (l,
|
|
67
|
+
const r = e, o = ([t, n] = nt(() => Se(Dn(r.loader, r.url))), t = await t, n(), t);
|
|
68
|
+
return (l, s) => rt(l.$slots, "default", { data: W(o) });
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
class jn extends ot.Mesh {
|
|
@@ -76,8 +76,8 @@ class jn extends ot.Mesh {
|
|
|
76
76
|
this.createTime = Date.now();
|
|
77
77
|
}
|
|
78
78
|
onBeforeRender() {
|
|
79
|
-
const r = (Date.now() - this.createTime) / 1e3,
|
|
80
|
-
this.scale.set(
|
|
79
|
+
const r = (Date.now() - this.createTime) / 1e3, s = 1 + 0.07 * Math.sin(2.5 * r);
|
|
80
|
+
this.scale.set(s, s, s);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
function Me(e) {
|
|
@@ -142,23 +142,23 @@ function Vn(e) {
|
|
|
142
142
|
}
|
|
143
143
|
function Yn(e, t) {
|
|
144
144
|
const n = /* @__PURE__ */ Object.create(null), r = e.split(",");
|
|
145
|
-
for (let
|
|
146
|
-
n[r[
|
|
147
|
-
return (
|
|
145
|
+
for (let o = 0; o < r.length; o++)
|
|
146
|
+
n[r[o]] = !0;
|
|
147
|
+
return t ? (o) => !!n[o.toLowerCase()] : (o) => !!n[o];
|
|
148
148
|
}
|
|
149
149
|
const Ve = (e, t) => {
|
|
150
150
|
if (!t)
|
|
151
151
|
return;
|
|
152
152
|
const n = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
|
|
153
|
-
return n == null ? void 0 : n.reduce((r,
|
|
153
|
+
return n == null ? void 0 : n.reduce((r, o) => r && r[o], e);
|
|
154
154
|
}, qn = (e, t, n) => {
|
|
155
155
|
const r = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
|
|
156
|
-
r && r.reduce((
|
|
156
|
+
r && r.reduce((o, l, s) => (o[l] === void 0 && (o[l] = {}), s === r.length - 1 && (o[l] = n), o[l]), e);
|
|
157
157
|
};
|
|
158
158
|
function pt(e, t) {
|
|
159
159
|
if (Ge(e) && Ge(t)) {
|
|
160
|
-
const
|
|
161
|
-
return
|
|
160
|
+
const o = e.attributes, l = t.attributes;
|
|
161
|
+
return o.length !== l.length ? !1 : Array.from(o).every(({ name: s, value: a }) => t.getAttribute(s) === a);
|
|
162
162
|
}
|
|
163
163
|
if (e === t)
|
|
164
164
|
return !0;
|
|
@@ -167,8 +167,8 @@ function pt(e, t) {
|
|
|
167
167
|
const n = Object.keys(e), r = Object.keys(t);
|
|
168
168
|
if (n.length !== r.length)
|
|
169
169
|
return !1;
|
|
170
|
-
for (const
|
|
171
|
-
if (!r.includes(
|
|
170
|
+
for (const o of n)
|
|
171
|
+
if (!r.includes(o) || !pt(e[o], t[o]))
|
|
172
172
|
return !1;
|
|
173
173
|
return !0;
|
|
174
174
|
}
|
|
@@ -182,29 +182,29 @@ function Kn(e, t) {
|
|
|
182
182
|
}
|
|
183
183
|
const Jn = Array.isArray;
|
|
184
184
|
function Qn(e, t, n, r) {
|
|
185
|
-
const
|
|
185
|
+
const o = (c) => {
|
|
186
186
|
if (c.uuid === t)
|
|
187
187
|
return c;
|
|
188
|
-
for (const
|
|
189
|
-
const f =
|
|
188
|
+
for (const i of c.children) {
|
|
189
|
+
const f = o(i);
|
|
190
190
|
if (f)
|
|
191
191
|
return f;
|
|
192
192
|
}
|
|
193
|
-
}, l =
|
|
193
|
+
}, l = o(e);
|
|
194
194
|
if (!l) {
|
|
195
195
|
console.warn("Object with UUID not found in the scene.");
|
|
196
196
|
return;
|
|
197
197
|
}
|
|
198
|
-
let
|
|
198
|
+
let s = l;
|
|
199
199
|
for (let c = 0; c < n.length - 1; c++)
|
|
200
|
-
if (
|
|
201
|
-
|
|
200
|
+
if (s[n[c]] !== void 0)
|
|
201
|
+
s = s[n[c]];
|
|
202
202
|
else {
|
|
203
203
|
console.warn(`Property path is not valid: ${n.join(".")}`);
|
|
204
204
|
return;
|
|
205
205
|
}
|
|
206
206
|
const a = n[n.length - 1];
|
|
207
|
-
|
|
207
|
+
s[a] !== void 0 ? s[a] = r : console.warn(`Property path is not valid: ${n.join(".")}`);
|
|
208
208
|
}
|
|
209
209
|
function Xn(e) {
|
|
210
210
|
const t = new at({
|
|
@@ -232,9 +232,9 @@ function Ye(e) {
|
|
|
232
232
|
}
|
|
233
233
|
function mt(e) {
|
|
234
234
|
var n, r;
|
|
235
|
-
if (e.parent && ((n = e.removeFromParent) == null || n.call(e)), delete e.__tres, [...e.children].forEach((
|
|
236
|
-
const
|
|
237
|
-
e && ((r = e.dispose) == null || r.call(e)),
|
|
235
|
+
if (e.parent && ((n = e.removeFromParent) == null || n.call(e)), delete e.__tres, [...e.children].forEach((o) => mt(o)), !(e instanceof st)) {
|
|
236
|
+
const o = e;
|
|
237
|
+
e && ((r = e.dispose) == null || r.call(e)), o.geometry && o.geometry.dispose(), Array.isArray(o.material) ? o.material.forEach((l) => Ye(l)) : o.material && Ye(o.material);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
function tr(e, t) {
|
|
@@ -247,10 +247,10 @@ function Pe(e, t) {
|
|
|
247
247
|
let n = e;
|
|
248
248
|
if (t.includes("-")) {
|
|
249
249
|
const r = t.split("-");
|
|
250
|
-
let
|
|
250
|
+
let o = r.shift();
|
|
251
251
|
for (; n && r.length; )
|
|
252
|
-
|
|
253
|
-
return { target: n, key: qe(
|
|
252
|
+
o in n ? (n = n[o], o = r.shift()) : o = qe(o, r.shift());
|
|
253
|
+
return { target: n, key: qe(o, ...r) };
|
|
254
254
|
} else
|
|
255
255
|
return { target: n, key: t };
|
|
256
256
|
}
|
|
@@ -261,26 +261,26 @@ const Ke = /-\d+$/;
|
|
|
261
261
|
function nr(e, t, n) {
|
|
262
262
|
if (ft(n)) {
|
|
263
263
|
if (Ke.test(n)) {
|
|
264
|
-
const l = n.replace(Ke, ""), { target:
|
|
265
|
-
if (!Array.isArray(
|
|
266
|
-
const c =
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
},
|
|
264
|
+
const l = n.replace(Ke, ""), { target: s, key: a } = Pe(e, l);
|
|
265
|
+
if (!Array.isArray(s[a])) {
|
|
266
|
+
const c = s[a], i = [];
|
|
267
|
+
i.__tresDetach = () => {
|
|
268
|
+
i.every((f) => Me(f)) && (s[a] = c);
|
|
269
|
+
}, s[a] = i;
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
const { target: r, key:
|
|
273
|
-
t.__tres.previousAttach = r[
|
|
272
|
+
const { target: r, key: o } = Pe(e, n);
|
|
273
|
+
t.__tres.previousAttach = r[o], r[o] = J(t);
|
|
274
274
|
} else
|
|
275
275
|
t.__tres.previousAttach = n(e, t);
|
|
276
276
|
}
|
|
277
277
|
function rr(e, t, n) {
|
|
278
|
-
var r,
|
|
278
|
+
var r, o, l;
|
|
279
279
|
if (ft(n)) {
|
|
280
|
-
const { target:
|
|
281
|
-
c === void 0 ? delete
|
|
280
|
+
const { target: s, key: a } = Pe(e, n), c = t.__tres.previousAttach;
|
|
281
|
+
c === void 0 ? delete s[a] : s[a] = c, "__tresDetach" in s && s.__tresDetach();
|
|
282
282
|
} else
|
|
283
|
-
(
|
|
283
|
+
(o = (r = t.__tres) == null ? void 0 : r.previousAttach) == null || o.call(r, e, t);
|
|
284
284
|
(l = t.__tres) == null || delete l.previousAttach;
|
|
285
285
|
}
|
|
286
286
|
function z(e, t, n) {
|
|
@@ -303,81 +303,84 @@ function ht(e) {
|
|
|
303
303
|
t && t.render && t.render.canBeInvalidated.value && t.invalidate();
|
|
304
304
|
}
|
|
305
305
|
function or(e, t, n) {
|
|
306
|
-
var
|
|
306
|
+
var o;
|
|
307
307
|
if (!G(e.setPixelRatio))
|
|
308
308
|
return;
|
|
309
309
|
let r = 0;
|
|
310
|
-
if (n && de(n)
|
|
311
|
-
const
|
|
312
|
-
|
|
310
|
+
if (n && de(n)) {
|
|
311
|
+
const l = n;
|
|
312
|
+
if (l.length >= 2) {
|
|
313
|
+
const [s, a] = l;
|
|
314
|
+
r = it.clamp(t, s, a);
|
|
315
|
+
}
|
|
313
316
|
} else Bn(n) ? r = n : r = t;
|
|
314
|
-
r !== ((
|
|
317
|
+
r !== ((o = e.getPixelRatio) == null ? void 0 : o.call(e)) && e.setPixelRatio(r);
|
|
315
318
|
}
|
|
316
|
-
function sr(e, t, n, r,
|
|
317
|
-
const l = [...t.__tres.objects],
|
|
318
|
-
if (e =
|
|
319
|
+
function sr(e, t, n, r, o) {
|
|
320
|
+
const l = [...t.__tres.objects], s = J(t);
|
|
321
|
+
if (e = J(e), s === e)
|
|
319
322
|
return !0;
|
|
320
|
-
const a = z(e, t.__tres ?? {},
|
|
321
|
-
delete
|
|
323
|
+
const a = z(e, t.__tres ?? {}, o), c = t.parent ?? t.__tres.parent ?? null, i = { ...t.__tres.memoizedProps };
|
|
324
|
+
delete i.object;
|
|
322
325
|
for (const f of l)
|
|
323
|
-
gt(f,
|
|
324
|
-
|
|
325
|
-
for (const [f,
|
|
326
|
-
r.patchProp(a, f, a[f],
|
|
326
|
+
gt(f, o), vt(f, o);
|
|
327
|
+
s.__tres.objects = [], r.remove(t);
|
|
328
|
+
for (const [f, g] of Object.entries(i))
|
|
329
|
+
r.patchProp(a, f, a[f], g);
|
|
327
330
|
n(e), r.insert(t, c);
|
|
328
331
|
for (const f of l)
|
|
329
332
|
r.insert(f, t);
|
|
330
333
|
return !0;
|
|
331
334
|
}
|
|
332
|
-
function
|
|
335
|
+
function J(e) {
|
|
333
336
|
return Wn(e) ? (e.object.__tres = e.__tres, e.object) : e;
|
|
334
337
|
}
|
|
335
338
|
function gt(e, t) {
|
|
336
|
-
var r,
|
|
339
|
+
var r, o, l, s;
|
|
337
340
|
const n = ((r = e.__tres) == null ? void 0 : r.parent) || t.scene.value;
|
|
338
|
-
e.__tres && (e.__tres.parent = null), n && n.__tres && "objects" in n.__tres && tr(n.__tres.objects, (a) => a !== e), (
|
|
341
|
+
e.__tres && (e.__tres.parent = null), n && n.__tres && "objects" in n.__tres && tr(n.__tres.objects, (a) => a !== e), (o = e.__tres) != null && o.attach ? rr(n, e, e.__tres.attach) : ((s = (l = e.parent) == null ? void 0 : l.remove) == null || s.call(l, J(e)), e.parent = null);
|
|
339
342
|
}
|
|
340
343
|
function vt(e, t) {
|
|
341
344
|
var n;
|
|
342
345
|
(n = e.traverse) == null || n.call(e, (r) => {
|
|
343
|
-
var
|
|
344
|
-
t.deregisterCamera(r), (
|
|
346
|
+
var o;
|
|
347
|
+
t.deregisterCamera(r), (o = t.eventManager) == null || o.deregisterPointerMissedObject(r);
|
|
345
348
|
}), t.deregisterCamera(e), ht(e);
|
|
346
349
|
}
|
|
347
350
|
async function ir(e, t) {
|
|
348
|
-
const n = new $t(t), r = (
|
|
351
|
+
const n = new $t(t), r = (o) => new Promise((l, s) => {
|
|
349
352
|
n.load(
|
|
350
|
-
|
|
353
|
+
o,
|
|
351
354
|
(a) => l(a),
|
|
352
355
|
() => null,
|
|
353
356
|
() => {
|
|
354
|
-
|
|
357
|
+
s(new Error("[useTextures] - Failed to load texture"));
|
|
355
358
|
}
|
|
356
359
|
);
|
|
357
360
|
});
|
|
358
361
|
if (Jn(e)) {
|
|
359
|
-
const
|
|
360
|
-
return e.length > 1 ?
|
|
362
|
+
const o = await Promise.all(e.map((l) => r(l)));
|
|
363
|
+
return e.length > 1 ? o : o[0];
|
|
361
364
|
} else {
|
|
362
365
|
const {
|
|
363
|
-
map:
|
|
366
|
+
map: o,
|
|
364
367
|
displacementMap: l,
|
|
365
|
-
normalMap:
|
|
368
|
+
normalMap: s,
|
|
366
369
|
roughnessMap: a,
|
|
367
370
|
metalnessMap: c,
|
|
368
|
-
aoMap:
|
|
371
|
+
aoMap: i,
|
|
369
372
|
alphaMap: f,
|
|
370
|
-
matcap:
|
|
373
|
+
matcap: g
|
|
371
374
|
} = e;
|
|
372
375
|
return {
|
|
373
|
-
map:
|
|
376
|
+
map: o ? await r(o) : null,
|
|
374
377
|
displacementMap: l ? await r(l) : null,
|
|
375
|
-
normalMap:
|
|
378
|
+
normalMap: s ? await r(s) : null,
|
|
376
379
|
roughnessMap: a ? await r(a) : null,
|
|
377
380
|
metalnessMap: c ? await r(c) : null,
|
|
378
|
-
aoMap:
|
|
381
|
+
aoMap: i ? await r(i) : null,
|
|
379
382
|
alphaMap: f ? await r(f) : null,
|
|
380
|
-
matcap:
|
|
383
|
+
matcap: g ? await r(g) : null
|
|
381
384
|
};
|
|
382
385
|
}
|
|
383
386
|
}
|
|
@@ -395,41 +398,41 @@ const qr = /* @__PURE__ */ fe({
|
|
|
395
398
|
},
|
|
396
399
|
async setup(e) {
|
|
397
400
|
let t, n;
|
|
398
|
-
const r = e,
|
|
399
|
-
return (l,
|
|
401
|
+
const r = e, o = ([t, n] = nt(() => Se(ir(r))), t = await t, n(), t);
|
|
402
|
+
return (l, s) => rt(l.$slots, "default", { textures: W(o) });
|
|
400
403
|
}
|
|
401
404
|
}), ar = ({ sizes: e }) => {
|
|
402
|
-
const t = I([]), n =
|
|
405
|
+
const t = I([]), n = q(
|
|
403
406
|
() => t.value[0]
|
|
404
|
-
), r = (
|
|
405
|
-
const a =
|
|
407
|
+
), r = (s) => {
|
|
408
|
+
const a = s instanceof Ht ? s : t.value.find((i) => i.uuid === s);
|
|
406
409
|
if (!a)
|
|
407
410
|
return;
|
|
408
|
-
const c = t.value.filter(({ uuid:
|
|
411
|
+
const c = t.value.filter(({ uuid: i }) => i !== a.uuid);
|
|
409
412
|
t.value = [a, ...c];
|
|
410
|
-
},
|
|
411
|
-
if (ze(
|
|
412
|
-
const c =
|
|
413
|
-
if (t.value.some(({ uuid:
|
|
413
|
+
}, o = (s, a = !1) => {
|
|
414
|
+
if (ze(s)) {
|
|
415
|
+
const c = s;
|
|
416
|
+
if (t.value.some(({ uuid: i }) => i === c.uuid))
|
|
414
417
|
return;
|
|
415
418
|
a ? r(c) : t.value.push(c);
|
|
416
419
|
}
|
|
417
|
-
}, l = (
|
|
418
|
-
if (ze(
|
|
419
|
-
const a =
|
|
420
|
+
}, l = (s) => {
|
|
421
|
+
if (ze(s)) {
|
|
422
|
+
const a = s;
|
|
420
423
|
t.value = t.value.filter(({ uuid: c }) => c !== a.uuid);
|
|
421
424
|
}
|
|
422
425
|
};
|
|
423
426
|
return Ae(() => {
|
|
424
|
-
e.aspectRatio.value && t.value.forEach((
|
|
425
|
-
!
|
|
427
|
+
e.aspectRatio.value && t.value.forEach((s) => {
|
|
428
|
+
!s.manual && (s instanceof be || lr(s)) && (s instanceof be ? s.aspect = e.aspectRatio.value : (s.left = e.width.value * -0.5, s.right = e.width.value * 0.5, s.top = e.height.value * 0.5, s.bottom = e.height.value * -0.5), s.updateProjectionMatrix());
|
|
426
429
|
});
|
|
427
|
-
}),
|
|
430
|
+
}), K(() => {
|
|
428
431
|
t.value = [];
|
|
429
432
|
}), {
|
|
430
433
|
camera: n,
|
|
431
434
|
cameras: t,
|
|
432
|
-
registerCamera:
|
|
435
|
+
registerCamera: o,
|
|
433
436
|
deregisterCamera: l,
|
|
434
437
|
setCameraActive: r
|
|
435
438
|
};
|
|
@@ -446,7 +449,7 @@ function ur(...e) {
|
|
|
446
449
|
}
|
|
447
450
|
function fr(e, t) {
|
|
448
451
|
}
|
|
449
|
-
function
|
|
452
|
+
function Q() {
|
|
450
453
|
return {
|
|
451
454
|
logError: cr,
|
|
452
455
|
logWarning: ur,
|
|
@@ -457,23 +460,23 @@ const Ce = I({}), Ee = (e) => Object.assign(Ce.value, e);
|
|
|
457
460
|
function ye() {
|
|
458
461
|
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
|
|
459
462
|
let n = 0, r = !1;
|
|
460
|
-
const
|
|
461
|
-
const
|
|
462
|
-
const u = f[1].priority -
|
|
463
|
-
return u === 0 ? f[1].addI -
|
|
463
|
+
const o = () => {
|
|
464
|
+
const i = Array.from(e.entries()).sort((f, g) => {
|
|
465
|
+
const u = f[1].priority - g[1].priority;
|
|
466
|
+
return u === 0 ? f[1].addI - g[1].addI : u;
|
|
464
467
|
});
|
|
465
|
-
t.clear(),
|
|
466
|
-
}, l = (
|
|
467
|
-
e.delete(
|
|
468
|
+
t.clear(), i.forEach((f) => t.add(f[0]));
|
|
469
|
+
}, l = (i) => {
|
|
470
|
+
e.delete(i), t.delete(i);
|
|
468
471
|
};
|
|
469
|
-
return { on: (
|
|
470
|
-
e.set(
|
|
471
|
-
const
|
|
472
|
-
return nn(
|
|
473
|
-
off:
|
|
472
|
+
return { on: (i, f = 0) => {
|
|
473
|
+
e.set(i, { priority: f, addI: n++ });
|
|
474
|
+
const g = () => l(i);
|
|
475
|
+
return nn(g), r = !0, {
|
|
476
|
+
off: g
|
|
474
477
|
};
|
|
475
|
-
}, off: l, trigger: (...
|
|
476
|
-
r && (
|
|
478
|
+
}, off: l, trigger: (...i) => {
|
|
479
|
+
r && (o(), r = !1), t.forEach((f) => f(...i));
|
|
477
480
|
}, dispose: () => {
|
|
478
481
|
e.clear(), t.clear();
|
|
479
482
|
}, get count() {
|
|
@@ -482,50 +485,50 @@ function ye() {
|
|
|
482
485
|
}
|
|
483
486
|
function dr() {
|
|
484
487
|
let e = !0, t = !0, n = !1;
|
|
485
|
-
const r = new lt(!1),
|
|
486
|
-
let
|
|
488
|
+
const r = new lt(!1), o = I(r.running), l = I(!1);
|
|
489
|
+
let s;
|
|
487
490
|
const a = it.generateUUID();
|
|
488
491
|
let c = null;
|
|
489
|
-
const
|
|
490
|
-
|
|
492
|
+
const i = ye(), f = ye(), g = ye();
|
|
493
|
+
S();
|
|
491
494
|
let u = {};
|
|
492
|
-
function
|
|
495
|
+
function y(M) {
|
|
493
496
|
u = M;
|
|
494
497
|
}
|
|
495
|
-
function
|
|
498
|
+
function p(M, x, m = 0) {
|
|
496
499
|
switch (x) {
|
|
497
500
|
case "before":
|
|
498
|
-
return
|
|
501
|
+
return i.on(M, m);
|
|
499
502
|
case "render":
|
|
500
503
|
return c || (c = M), f.dispose(), f.on(M);
|
|
501
504
|
case "after":
|
|
502
|
-
return
|
|
505
|
+
return g.on(M, m);
|
|
503
506
|
}
|
|
504
507
|
}
|
|
505
|
-
function
|
|
506
|
-
t && (t = !1,
|
|
508
|
+
function _() {
|
|
509
|
+
t && (t = !1, S(), E());
|
|
507
510
|
}
|
|
508
511
|
function d() {
|
|
509
|
-
t = !0,
|
|
512
|
+
t = !0, S(), cancelAnimationFrame(s);
|
|
510
513
|
}
|
|
511
|
-
function
|
|
512
|
-
n = !1,
|
|
514
|
+
function v() {
|
|
515
|
+
n = !1, S();
|
|
513
516
|
}
|
|
514
517
|
function P() {
|
|
515
|
-
n = !0,
|
|
518
|
+
n = !0, S();
|
|
516
519
|
}
|
|
517
520
|
function C() {
|
|
518
521
|
l.value = !0;
|
|
519
522
|
}
|
|
520
|
-
function
|
|
523
|
+
function w() {
|
|
521
524
|
l.value = !1;
|
|
522
525
|
}
|
|
523
|
-
function
|
|
526
|
+
function E() {
|
|
524
527
|
if (!e) {
|
|
525
|
-
|
|
528
|
+
s = requestAnimationFrame(E);
|
|
526
529
|
return;
|
|
527
530
|
}
|
|
528
|
-
const M = r.getDelta(), x = r.getElapsedTime(),
|
|
531
|
+
const M = r.getDelta(), x = r.getElapsedTime(), m = {
|
|
529
532
|
camera: W(u.camera),
|
|
530
533
|
scene: W(u.scene),
|
|
531
534
|
renderer: W(u.renderer),
|
|
@@ -533,33 +536,33 @@ function dr() {
|
|
|
533
536
|
controls: W(u.controls),
|
|
534
537
|
invalidate: u.invalidate,
|
|
535
538
|
advance: u.advance
|
|
536
|
-
},
|
|
537
|
-
|
|
539
|
+
}, b = { delta: M, elapsed: x, clock: r, ...m };
|
|
540
|
+
o.value && i.trigger(b), l.value || (f.count ? f.trigger(b) : c && c(b)), o.value && g.trigger(b), s = requestAnimationFrame(E);
|
|
538
541
|
}
|
|
539
|
-
function
|
|
542
|
+
function S() {
|
|
540
543
|
const M = !t && !n;
|
|
541
|
-
r.running !== M && (r.running ? r.stop() : r.start()),
|
|
544
|
+
r.running !== M && (r.running ? r.stop() : r.start()), o.value = r.running;
|
|
542
545
|
}
|
|
543
546
|
return {
|
|
544
547
|
loopId: a,
|
|
545
|
-
register: (M, x,
|
|
546
|
-
start:
|
|
548
|
+
register: (M, x, m) => p(M, x, m),
|
|
549
|
+
start: _,
|
|
547
550
|
stop: d,
|
|
548
551
|
pause: P,
|
|
549
|
-
resume:
|
|
552
|
+
resume: v,
|
|
550
553
|
pauseRender: C,
|
|
551
|
-
resumeRender:
|
|
554
|
+
resumeRender: w,
|
|
552
555
|
isRenderPaused: l,
|
|
553
|
-
isActive:
|
|
554
|
-
setContext:
|
|
556
|
+
isActive: o,
|
|
557
|
+
setContext: y,
|
|
555
558
|
setReady: (M) => e = M
|
|
556
559
|
};
|
|
557
560
|
}
|
|
558
|
-
function
|
|
561
|
+
function ke(e) {
|
|
559
562
|
let t = 0;
|
|
560
563
|
return e.traverse((n) => {
|
|
561
564
|
if (n.isMesh && n.geometry && n.type !== "HightlightMesh") {
|
|
562
|
-
const r = n.geometry,
|
|
565
|
+
const r = n.geometry, o = r.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, l = r.index ? r.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, s = 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 = o + l + s + a;
|
|
563
566
|
t += c;
|
|
564
567
|
}
|
|
565
568
|
}), t;
|
|
@@ -578,7 +581,7 @@ const se = {
|
|
|
578
581
|
realistic: {
|
|
579
582
|
shadows: !0,
|
|
580
583
|
physicallyCorrectLights: !0,
|
|
581
|
-
outputColorSpace:
|
|
584
|
+
outputColorSpace: Nt,
|
|
582
585
|
toneMapping: ct,
|
|
583
586
|
toneMappingExposure: 3,
|
|
584
587
|
shadowMap: {
|
|
@@ -587,16 +590,16 @@ const se = {
|
|
|
587
590
|
}
|
|
588
591
|
},
|
|
589
592
|
flat: {
|
|
590
|
-
toneMapping:
|
|
593
|
+
toneMapping: Ft,
|
|
591
594
|
toneMappingExposure: 1
|
|
592
595
|
}
|
|
593
596
|
};
|
|
594
597
|
function gr({
|
|
595
598
|
canvas: e,
|
|
596
599
|
options: t,
|
|
597
|
-
contextParts: { sizes: n, render: r, invalidate:
|
|
600
|
+
contextParts: { sizes: n, render: r, invalidate: o, advance: l }
|
|
598
601
|
}) {
|
|
599
|
-
const
|
|
602
|
+
const s = q(() => ({
|
|
600
603
|
alpha: A(t.alpha) ?? !0,
|
|
601
604
|
depth: A(t.depth),
|
|
602
605
|
canvas: rn(e),
|
|
@@ -609,141 +612,141 @@ function gr({
|
|
|
609
612
|
preserveDrawingBuffer: A(t.preserveDrawingBuffer),
|
|
610
613
|
logarithmicDepthBuffer: A(t.logarithmicDepthBuffer),
|
|
611
614
|
failIfMajorPerformanceCaveat: A(t.failIfMajorPerformanceCaveat)
|
|
612
|
-
})), a = $(new ge(
|
|
615
|
+
})), a = $(new ge(s.value));
|
|
613
616
|
function c() {
|
|
614
|
-
t.renderMode === "on-demand" &&
|
|
617
|
+
t.renderMode === "on-demand" && o();
|
|
615
618
|
}
|
|
616
|
-
ae(
|
|
617
|
-
a.value.dispose(), a.value = new ge(
|
|
619
|
+
ae(s, () => {
|
|
620
|
+
a.value.dispose(), a.value = new ge(s.value), c();
|
|
618
621
|
}), ae([n.width, n.height], () => {
|
|
619
622
|
a.value.setSize(n.width.value, n.height.value), c();
|
|
620
623
|
}, {
|
|
621
624
|
immediate: !0
|
|
622
625
|
}), ae(() => t.clearColor, c);
|
|
623
|
-
const { pixelRatio:
|
|
624
|
-
const
|
|
626
|
+
const { pixelRatio: i } = on(), { logError: f } = Q(), u = (() => {
|
|
627
|
+
const p = new ge(), _ = {
|
|
625
628
|
shadowMap: {
|
|
626
|
-
enabled:
|
|
627
|
-
type:
|
|
629
|
+
enabled: p.shadowMap.enabled,
|
|
630
|
+
type: p.shadowMap.type
|
|
628
631
|
},
|
|
629
|
-
toneMapping:
|
|
630
|
-
toneMappingExposure:
|
|
631
|
-
outputColorSpace:
|
|
632
|
+
toneMapping: p.toneMapping,
|
|
633
|
+
toneMappingExposure: p.toneMappingExposure,
|
|
634
|
+
outputColorSpace: p.outputColorSpace
|
|
632
635
|
};
|
|
633
|
-
return
|
|
634
|
-
})(),
|
|
635
|
-
return
|
|
636
|
+
return p.dispose(), _;
|
|
637
|
+
})(), y = A(t.renderMode);
|
|
638
|
+
return y === "on-demand" && o(), y === "manual" && setTimeout(() => {
|
|
636
639
|
l();
|
|
637
640
|
}, 100), Ae(() => {
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
const
|
|
641
|
-
const
|
|
642
|
-
if (
|
|
643
|
-
return Ve(se[
|
|
641
|
+
const p = A(t.preset);
|
|
642
|
+
p && (p in se || f(`Renderer Preset must be one of these: ${Object.keys(se).join(", ")}`), dt(a.value, se[p])), or(a.value, i.value, A(t.dpr)), y === "always" && (r.frames.value = Math.max(1, r.frames.value));
|
|
643
|
+
const _ = (P, C) => {
|
|
644
|
+
const w = A(P), E = () => {
|
|
645
|
+
if (p)
|
|
646
|
+
return Ve(se[p], C);
|
|
644
647
|
};
|
|
645
|
-
if (
|
|
646
|
-
return
|
|
647
|
-
const
|
|
648
|
-
return
|
|
649
|
-
}, d = (P, C) => qn(a.value, C,
|
|
648
|
+
if (w !== void 0)
|
|
649
|
+
return w;
|
|
650
|
+
const S = E();
|
|
651
|
+
return S !== void 0 ? S : Ve(u, C);
|
|
652
|
+
}, d = (P, C) => qn(a.value, C, _(P, C));
|
|
650
653
|
d(t.shadows, "shadowMap.enabled"), d(t.toneMapping ?? ct, "toneMapping"), d(t.shadowMapType, "shadowMap.type"), mr < 150 && d(!t.useLegacyLights, "physicallyCorrectLights"), d(t.outputColorSpace, "outputColorSpace"), d(t.toneMappingExposure, "toneMappingExposure");
|
|
651
|
-
const
|
|
652
|
-
|
|
653
|
-
|
|
654
|
+
const v = _(t.clearColor, "clearColor");
|
|
655
|
+
v && a.value.setClearColor(
|
|
656
|
+
v ? hr(v) : new Z(0)
|
|
654
657
|
// default clear color is not easily/efficiently retrievable from three
|
|
655
658
|
);
|
|
656
|
-
}),
|
|
659
|
+
}), K(() => {
|
|
657
660
|
a.value.dispose(), a.value.forceContextLoss();
|
|
658
661
|
}), {
|
|
659
662
|
renderer: a
|
|
660
663
|
};
|
|
661
664
|
}
|
|
662
665
|
function vr(e, t, n = 10) {
|
|
663
|
-
const r = A(e) ? sn() : an(
|
|
666
|
+
const r = A(e) ? sn() : an(q(() => A(t).parentElement)), o = we(Ne(r.width, n)), l = we(Ne(r.height, n)), s = q(() => o.value / l.value);
|
|
664
667
|
return {
|
|
665
668
|
height: l,
|
|
666
|
-
width:
|
|
667
|
-
aspectRatio:
|
|
669
|
+
width: o,
|
|
670
|
+
aspectRatio: s
|
|
668
671
|
};
|
|
669
672
|
}
|
|
670
673
|
const yr = (e, t) => {
|
|
671
|
-
const n =
|
|
672
|
-
let
|
|
673
|
-
const { width: a, height: c, top:
|
|
674
|
+
const n = q(() => t.renderer.value.domElement), r = $([]), { x: o, y: l } = ln({ target: n });
|
|
675
|
+
let s = 0;
|
|
676
|
+
const { width: a, height: c, top: i, left: f } = cn(n), g = ({ x: h, y: T }) => {
|
|
674
677
|
if (n.value)
|
|
675
678
|
return {
|
|
676
|
-
x: (
|
|
677
|
-
y: -((
|
|
679
|
+
x: (h - f.value) / a.value * 2 - 1,
|
|
680
|
+
y: -((T - i.value) / c.value) * 2 + 1
|
|
678
681
|
};
|
|
679
|
-
}, u = ({ x:
|
|
682
|
+
}, u = ({ x: h, y: T }) => {
|
|
680
683
|
if (t.camera.value)
|
|
681
|
-
return t.raycaster.value.setFromCamera(new ve(
|
|
682
|
-
},
|
|
683
|
-
const
|
|
684
|
-
x: (
|
|
685
|
-
y: (
|
|
684
|
+
return t.raycaster.value.setFromCamera(new ve(h, T), t.camera.value), r.value = t.raycaster.value.intersectObjects(e.value, !0), r.value;
|
|
685
|
+
}, y = (h) => {
|
|
686
|
+
const T = g({
|
|
687
|
+
x: (h == null ? void 0 : h.clientX) ?? o.value,
|
|
688
|
+
y: (h == null ? void 0 : h.clientY) ?? l.value
|
|
686
689
|
});
|
|
687
|
-
return
|
|
688
|
-
},
|
|
689
|
-
function
|
|
690
|
-
const
|
|
691
|
-
for (const U in
|
|
692
|
-
typeof U != "function" && (
|
|
693
|
-
return
|
|
690
|
+
return T ? u(T) || [] : [];
|
|
691
|
+
}, p = D(), _ = D(), d = D(), v = D(), P = D(), C = D(), w = D(), E = D();
|
|
692
|
+
function S(h) {
|
|
693
|
+
const T = {};
|
|
694
|
+
for (const U in h)
|
|
695
|
+
typeof U != "function" && (T[U] = h[U]);
|
|
696
|
+
return T;
|
|
694
697
|
}
|
|
695
|
-
const M = (
|
|
698
|
+
const M = (h, T) => {
|
|
696
699
|
var Be, Ie, $e;
|
|
697
|
-
const U =
|
|
698
|
-
|
|
700
|
+
const U = S(T), ne = new xe(T == null ? void 0 : T.clientX, T == null ? void 0 : T.clientY, 0).unproject((Be = t.camera) == null ? void 0 : Be.value);
|
|
701
|
+
h.trigger({
|
|
699
702
|
...U,
|
|
700
703
|
intersections: r.value,
|
|
701
704
|
// The unprojectedPoint is wrong, math needs to be fixed
|
|
702
705
|
unprojectedPoint: ne,
|
|
703
706
|
ray: (Ie = t.raycaster) == null ? void 0 : Ie.value.ray,
|
|
704
707
|
camera: ($e = t.camera) == null ? void 0 : $e.value,
|
|
705
|
-
sourceEvent:
|
|
706
|
-
delta:
|
|
708
|
+
sourceEvent: T,
|
|
709
|
+
delta: s,
|
|
707
710
|
stopPropagating: !1
|
|
708
711
|
});
|
|
709
712
|
};
|
|
710
713
|
let x;
|
|
711
|
-
const
|
|
712
|
-
|
|
713
|
-
},
|
|
714
|
-
x &&
|
|
714
|
+
const m = (h) => {
|
|
715
|
+
y(h), M(d, h), x = h;
|
|
716
|
+
}, b = () => {
|
|
717
|
+
x && m(x);
|
|
715
718
|
};
|
|
716
|
-
let
|
|
717
|
-
const j = (
|
|
718
|
-
var
|
|
719
|
-
|
|
720
|
-
(
|
|
721
|
-
(
|
|
722
|
-
), M(P,
|
|
719
|
+
let k, L, R;
|
|
720
|
+
const j = (h) => {
|
|
721
|
+
var T;
|
|
722
|
+
k = (T = r.value[0]) == null ? void 0 : T.object, s = 0, L = new ve(
|
|
723
|
+
(h == null ? void 0 : h.clientX) ?? o.value,
|
|
724
|
+
(h == null ? void 0 : h.clientY) ?? l.value
|
|
725
|
+
), M(P, h);
|
|
723
726
|
};
|
|
724
|
-
let O,
|
|
725
|
-
const Re = (
|
|
726
|
-
var
|
|
727
|
-
|
|
728
|
-
(
|
|
729
|
-
(
|
|
730
|
-
),
|
|
731
|
-
}, Oe = (
|
|
732
|
-
|
|
733
|
-
}, De = (
|
|
734
|
-
return n.value.addEventListener("pointerup", Re), n.value.addEventListener("pointerdown", j), n.value.addEventListener("pointermove",
|
|
735
|
-
n != null && n.value && (n.value.removeEventListener("pointerup", Re), n.value.removeEventListener("pointerdown", j), n.value.removeEventListener("pointermove",
|
|
727
|
+
let O, V = !1;
|
|
728
|
+
const Re = (h) => {
|
|
729
|
+
var T, U, ne;
|
|
730
|
+
h instanceof PointerEvent && (r.value.length === 0 && M(C, h), k === ((T = r.value[0]) == null ? void 0 : T.object) && (R = new ve(
|
|
731
|
+
(h == null ? void 0 : h.clientX) ?? o.value,
|
|
732
|
+
(h == null ? void 0 : h.clientY) ?? l.value
|
|
733
|
+
), s = L == null ? void 0 : L.distanceTo(R), h.button === 0 ? (M(p, h), O === ((U = r.value[0]) == null ? void 0 : U.object) ? V = !0 : (O = (ne = r.value[0]) == null ? void 0 : ne.object, V = !1)) : h.button === 2 && M(w, h)), M(v, h));
|
|
734
|
+
}, Oe = (h) => {
|
|
735
|
+
V && (M(_, h), O = void 0, V = !1);
|
|
736
|
+
}, De = (h) => M(d, h), je = (h) => M(E, h);
|
|
737
|
+
return n.value.addEventListener("pointerup", Re), n.value.addEventListener("pointerdown", j), n.value.addEventListener("pointermove", m), n.value.addEventListener("pointerleave", De), n.value.addEventListener("dblclick", Oe), n.value.addEventListener("wheel", je), K(() => {
|
|
738
|
+
n != null && n.value && (n.value.removeEventListener("pointerup", Re), n.value.removeEventListener("pointerdown", j), n.value.removeEventListener("pointermove", m), n.value.removeEventListener("pointerleave", De), n.value.removeEventListener("dblclick", Oe), n.value.removeEventListener("wheel", je));
|
|
736
739
|
}), {
|
|
737
740
|
intersects: r,
|
|
738
|
-
onClick: (
|
|
739
|
-
onDblClick: (
|
|
740
|
-
onContextMenu: (
|
|
741
|
-
onPointerMove: (
|
|
742
|
-
onPointerUp: (
|
|
743
|
-
onPointerDown: (
|
|
744
|
-
onPointerMissed: (
|
|
745
|
-
onWheel: (
|
|
746
|
-
forceUpdate:
|
|
741
|
+
onClick: (h) => p.on(h).off,
|
|
742
|
+
onDblClick: (h) => _.on(h).off,
|
|
743
|
+
onContextMenu: (h) => w.on(h).off,
|
|
744
|
+
onPointerMove: (h) => d.on(h).off,
|
|
745
|
+
onPointerUp: (h) => v.on(h).off,
|
|
746
|
+
onPointerDown: (h) => P.on(h).off,
|
|
747
|
+
onPointerMissed: (h) => C.on(h).off,
|
|
748
|
+
onWheel: (h) => E.on(h).off,
|
|
749
|
+
forceUpdate: b
|
|
747
750
|
};
|
|
748
751
|
};
|
|
749
752
|
function _e(e, t) {
|
|
@@ -754,104 +757,104 @@ function _e(e, t) {
|
|
|
754
757
|
}
|
|
755
758
|
function _r(e, t, n) {
|
|
756
759
|
var x;
|
|
757
|
-
const r = $(),
|
|
758
|
-
e && (r.value = e), t && (
|
|
759
|
-
const l = (
|
|
760
|
-
var
|
|
761
|
-
return ((
|
|
762
|
-
},
|
|
763
|
-
var
|
|
764
|
-
return ((
|
|
765
|
-
}, a = $(((x = r.value) == null ? void 0 : x.children).filter(
|
|
766
|
-
function c(
|
|
767
|
-
const
|
|
768
|
-
|
|
769
|
-
for (const R of
|
|
770
|
-
if (
|
|
760
|
+
const r = $(), o = $();
|
|
761
|
+
e && (r.value = e), t && (o.value = t);
|
|
762
|
+
const l = (m) => {
|
|
763
|
+
var b;
|
|
764
|
+
return ((b = m.__tres) == null ? void 0 : b.eventCount) > 0;
|
|
765
|
+
}, s = (m) => {
|
|
766
|
+
var b;
|
|
767
|
+
return ((b = m.children) == null ? void 0 : b.some((k) => s(k))) || l(m);
|
|
768
|
+
}, a = $(((x = r.value) == null ? void 0 : x.children).filter(s) || []);
|
|
769
|
+
function c(m, b) {
|
|
770
|
+
const k = [], L = () => b.stopPropagating = !0;
|
|
771
|
+
b.stopPropagation = L;
|
|
772
|
+
for (const R of b == null ? void 0 : b.intersections) {
|
|
773
|
+
if (b.stopPropagating)
|
|
771
774
|
return;
|
|
772
|
-
|
|
775
|
+
b = { ...b, ...R };
|
|
773
776
|
const { object: j } = R;
|
|
774
|
-
|
|
777
|
+
b.eventObject = j, _e(j[m], b), k.push(j);
|
|
775
778
|
let O = j.parent;
|
|
776
|
-
for (; O !== null && !
|
|
777
|
-
|
|
778
|
-
const
|
|
779
|
-
n(
|
|
779
|
+
for (; O !== null && !b.stopPropagating && !k.includes(O); )
|
|
780
|
+
b.eventObject = O, _e(O[m], b), k.push(O), O = O.parent;
|
|
781
|
+
const V = Vn(m.slice(2));
|
|
782
|
+
n(V, { intersection: R, event: b });
|
|
780
783
|
}
|
|
781
784
|
}
|
|
782
785
|
const {
|
|
783
|
-
onClick:
|
|
786
|
+
onClick: i,
|
|
784
787
|
onDblClick: f,
|
|
785
|
-
onContextMenu:
|
|
788
|
+
onContextMenu: g,
|
|
786
789
|
onPointerMove: u,
|
|
787
|
-
onPointerDown:
|
|
788
|
-
onPointerUp:
|
|
789
|
-
onPointerMissed:
|
|
790
|
+
onPointerDown: y,
|
|
791
|
+
onPointerUp: p,
|
|
792
|
+
onPointerMissed: _,
|
|
790
793
|
onWheel: d,
|
|
791
|
-
forceUpdate:
|
|
794
|
+
forceUpdate: v
|
|
792
795
|
} = yr(a, t);
|
|
793
|
-
|
|
796
|
+
p((m) => c("onPointerUp", m)), y((m) => c("onPointerDown", m)), i((m) => c("onClick", m)), f((m) => c("onDoubleClick", m)), g((m) => c("onContextMenu", m)), d((m) => c("onWheel", m));
|
|
794
797
|
let P = [];
|
|
795
|
-
u((
|
|
796
|
-
const
|
|
797
|
-
P.forEach(({ object:
|
|
798
|
-
|
|
799
|
-
}),
|
|
800
|
-
P.includes(
|
|
801
|
-
}), c("onPointerMove",
|
|
798
|
+
u((m) => {
|
|
799
|
+
const b = m.intersections.map(({ object: L }) => L), k = m.intersections;
|
|
800
|
+
P.forEach(({ object: L }) => {
|
|
801
|
+
b.includes(L) || (m.intersections = P, c("onPointerLeave", m), c("onPointerOut", m));
|
|
802
|
+
}), m.intersections = k, m.intersections.forEach(({ object: L }) => {
|
|
803
|
+
P.includes(L) || (c("onPointerEnter", m), c("onPointerOver", m));
|
|
804
|
+
}), c("onPointerMove", m), P = m.intersections;
|
|
802
805
|
});
|
|
803
806
|
const C = [];
|
|
804
|
-
|
|
805
|
-
const
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
}), n("pointer-missed", { event:
|
|
807
|
+
_((m) => {
|
|
808
|
+
const b = () => m.stopPropagating = !0;
|
|
809
|
+
m.stopPropagation = b, C.forEach((k) => {
|
|
810
|
+
m.stopPropagating || (m.eventObject = k, _e(k.onPointerMissed, m));
|
|
811
|
+
}), n("pointer-missed", { event: m });
|
|
809
812
|
});
|
|
810
|
-
function
|
|
811
|
-
re(
|
|
813
|
+
function w(m) {
|
|
814
|
+
re(m) && N(m) && a.value.push(m);
|
|
812
815
|
}
|
|
813
|
-
function
|
|
814
|
-
if (re(
|
|
815
|
-
const
|
|
816
|
-
|
|
816
|
+
function E(m) {
|
|
817
|
+
if (re(m) && N(m)) {
|
|
818
|
+
const b = a.value.indexOf(m);
|
|
819
|
+
b > -1 && a.value.splice(b, 1);
|
|
817
820
|
}
|
|
818
821
|
}
|
|
819
|
-
function
|
|
820
|
-
re(
|
|
822
|
+
function S(m) {
|
|
823
|
+
re(m) && N(m) && m.onPointerMissed && C.push(m);
|
|
821
824
|
}
|
|
822
|
-
function M(
|
|
823
|
-
if (re(
|
|
824
|
-
const
|
|
825
|
-
|
|
825
|
+
function M(m) {
|
|
826
|
+
if (re(m) && N(m)) {
|
|
827
|
+
const b = C.indexOf(m);
|
|
828
|
+
b > -1 && C.splice(b, 1);
|
|
826
829
|
}
|
|
827
830
|
}
|
|
828
831
|
return t.eventManager = {
|
|
829
|
-
forceUpdate:
|
|
830
|
-
registerObject:
|
|
831
|
-
deregisterObject:
|
|
832
|
-
registerPointerMissedObject:
|
|
832
|
+
forceUpdate: v,
|
|
833
|
+
registerObject: w,
|
|
834
|
+
deregisterObject: E,
|
|
835
|
+
registerPointerMissedObject: S,
|
|
833
836
|
deregisterPointerMissedObject: M
|
|
834
837
|
}, {
|
|
835
|
-
forceUpdate:
|
|
836
|
-
registerObject:
|
|
837
|
-
deregisterObject:
|
|
838
|
-
registerPointerMissedObject:
|
|
838
|
+
forceUpdate: v,
|
|
839
|
+
registerObject: w,
|
|
840
|
+
deregisterObject: E,
|
|
841
|
+
registerPointerMissedObject: S,
|
|
839
842
|
deregisterPointerMissedObject: M
|
|
840
843
|
};
|
|
841
844
|
}
|
|
842
845
|
function wr(e, t, n = 100) {
|
|
843
846
|
n = n <= 0 ? 100 : n;
|
|
844
|
-
const r = D(),
|
|
845
|
-
let l = !1,
|
|
847
|
+
const r = D(), o = /* @__PURE__ */ new Set();
|
|
848
|
+
let l = !1, s = !1, a = null;
|
|
846
849
|
function c() {
|
|
847
|
-
a && clearTimeout(a), !
|
|
850
|
+
a && clearTimeout(a), !s && !l && e() ? (r.trigger(t), o.forEach((u) => u()), o.clear(), l = !0) : !s && !l && (a = setTimeout(c, n));
|
|
848
851
|
}
|
|
849
|
-
function
|
|
850
|
-
|
|
852
|
+
function i() {
|
|
853
|
+
s = !0, a && clearTimeout(a);
|
|
851
854
|
}
|
|
852
855
|
c();
|
|
853
|
-
const f = (u, ...
|
|
854
|
-
u(...
|
|
856
|
+
const f = (u, ...y) => {
|
|
857
|
+
u(...y);
|
|
855
858
|
};
|
|
856
859
|
return {
|
|
857
860
|
on: (u) => {
|
|
@@ -859,13 +862,14 @@ function wr(e, t, n = 100) {
|
|
|
859
862
|
return f(u, t), { off: () => {
|
|
860
863
|
} };
|
|
861
864
|
{
|
|
862
|
-
const
|
|
863
|
-
return
|
|
865
|
+
const y = r.on(u);
|
|
866
|
+
return o.add(y.off), r.on(u);
|
|
864
867
|
}
|
|
865
868
|
},
|
|
866
869
|
off: r.off,
|
|
867
870
|
trigger: r.trigger,
|
|
868
|
-
|
|
871
|
+
clear: r.clear,
|
|
872
|
+
cancel: i
|
|
869
873
|
};
|
|
870
874
|
}
|
|
871
875
|
const ee = /* @__PURE__ */ new WeakMap();
|
|
@@ -876,8 +880,8 @@ function yt(e) {
|
|
|
876
880
|
if (Date.now() - n >= t)
|
|
877
881
|
return !0;
|
|
878
882
|
{
|
|
879
|
-
const
|
|
880
|
-
return !!(
|
|
883
|
+
const s = e.renderer.value, a = (s == null ? void 0 : s.domElement) || { width: 0, height: 0 };
|
|
884
|
+
return !!(s && a.width > 0 && a.height > 0);
|
|
881
885
|
}
|
|
882
886
|
}, e);
|
|
883
887
|
return ee.set(e, l), l;
|
|
@@ -892,42 +896,40 @@ function br({
|
|
|
892
896
|
canvas: t,
|
|
893
897
|
windowSize: n,
|
|
894
898
|
rendererOptions: r,
|
|
895
|
-
emit:
|
|
899
|
+
emit: o
|
|
896
900
|
}) {
|
|
897
|
-
const l = $(e),
|
|
901
|
+
const l = $(e), s = vr(n, t), {
|
|
898
902
|
camera: a,
|
|
899
903
|
cameras: c,
|
|
900
|
-
registerCamera:
|
|
904
|
+
registerCamera: i,
|
|
901
905
|
deregisterCamera: f,
|
|
902
|
-
setCameraActive:
|
|
903
|
-
} = ar({ sizes:
|
|
906
|
+
setCameraActive: g
|
|
907
|
+
} = ar({ sizes: s }), u = {
|
|
904
908
|
mode: I(r.renderMode || "always"),
|
|
905
909
|
priority: I(0),
|
|
906
910
|
frames: I(0),
|
|
907
911
|
maxFrames: 60,
|
|
908
|
-
canBeInvalidated:
|
|
912
|
+
canBeInvalidated: q(() => u.mode.value === "on-demand" && u.frames.value === 0)
|
|
909
913
|
};
|
|
910
|
-
function
|
|
914
|
+
function y(R = 1) {
|
|
911
915
|
r.renderMode === "on-demand" && (u.frames.value = Math.min(u.maxFrames, u.frames.value + R));
|
|
912
916
|
}
|
|
913
|
-
function
|
|
917
|
+
function p() {
|
|
914
918
|
r.renderMode === "manual" && (u.frames.value = 1);
|
|
915
919
|
}
|
|
916
|
-
const { renderer:
|
|
920
|
+
const { renderer: _ } = gr(
|
|
917
921
|
{
|
|
918
|
-
scene: e,
|
|
919
922
|
canvas: t,
|
|
920
923
|
options: r,
|
|
921
|
-
emit: s,
|
|
922
924
|
// TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
|
|
923
|
-
contextParts: { sizes:
|
|
925
|
+
contextParts: { sizes: s, render: u, invalidate: y, advance: p }
|
|
924
926
|
}
|
|
925
927
|
), d = {
|
|
926
|
-
sizes:
|
|
928
|
+
sizes: s,
|
|
927
929
|
scene: l,
|
|
928
930
|
camera: a,
|
|
929
931
|
cameras: we(c),
|
|
930
|
-
renderer:
|
|
932
|
+
renderer: _,
|
|
931
933
|
raycaster: $(new zt()),
|
|
932
934
|
controls: I(null),
|
|
933
935
|
perf: {
|
|
@@ -943,36 +945,36 @@ function br({
|
|
|
943
945
|
}
|
|
944
946
|
},
|
|
945
947
|
render: u,
|
|
946
|
-
advance:
|
|
948
|
+
advance: p,
|
|
947
949
|
extend: Ee,
|
|
948
|
-
invalidate:
|
|
949
|
-
registerCamera:
|
|
950
|
-
setCameraActive:
|
|
950
|
+
invalidate: y,
|
|
951
|
+
registerCamera: i,
|
|
952
|
+
setCameraActive: g,
|
|
951
953
|
deregisterCamera: f,
|
|
952
954
|
loop: dr()
|
|
953
955
|
};
|
|
954
956
|
le("useTres", d), d.scene.value.__tres = {
|
|
955
957
|
root: d
|
|
956
958
|
}, d.loop.register(() => {
|
|
957
|
-
a.value && u.frames.value > 0 && (
|
|
959
|
+
a.value && u.frames.value > 0 && (_.value.render(e, a.value), o("render", d.renderer.value)), u.priority.value = 0, u.mode.value === "always" ? u.frames.value = 1 : u.frames.value = Math.max(0, u.frames.value - 1);
|
|
958
960
|
}, "render");
|
|
959
|
-
const { on:
|
|
960
|
-
d.loop.setReady(!1), d.loop.start(),
|
|
961
|
-
|
|
962
|
-
}),
|
|
961
|
+
const { on: v, cancel: P } = yt(d);
|
|
962
|
+
d.loop.setReady(!1), d.loop.start(), v(() => {
|
|
963
|
+
o("ready", d), d.loop.setReady(!0), _r(e, d, o);
|
|
964
|
+
}), K(() => {
|
|
963
965
|
P(), d.loop.stop();
|
|
964
966
|
});
|
|
965
|
-
const C = 100,
|
|
967
|
+
const C = 100, w = un({ every: C }), { isSupported: E, memory: S } = fn({ interval: C }), M = 160;
|
|
966
968
|
let x = performance.now();
|
|
967
|
-
const
|
|
968
|
-
d.scene.value && (d.perf.memory.allocatedMem =
|
|
969
|
+
const m = ({ timestamp: R }) => {
|
|
970
|
+
d.scene.value && (d.perf.memory.allocatedMem = ke(d.scene.value)), R - x >= C && (x = R, d.perf.fps.accumulator.push(w.value), d.perf.fps.accumulator.length > M && d.perf.fps.accumulator.shift(), d.perf.fps.value = w.value, E.value && S.value && (d.perf.memory.accumulator.push(S.value.usedJSHeapSize / 1024 / 1024), d.perf.memory.accumulator.length > M && d.perf.memory.accumulator.shift(), d.perf.memory.currentMem = d.perf.memory.accumulator.reduce((j, O) => j + O, 0) / d.perf.memory.accumulator.length));
|
|
969
971
|
};
|
|
970
|
-
let
|
|
971
|
-
const
|
|
972
|
-
window.__TRES__DEVTOOLS__ && (
|
|
972
|
+
let b = 0;
|
|
973
|
+
const k = 1, { pause: L } = ut(({ delta: R }) => {
|
|
974
|
+
window.__TRES__DEVTOOLS__ && (m({ timestamp: performance.now() }), b += R, b >= k && (window.__TRES__DEVTOOLS__.cb(d), b = 0));
|
|
973
975
|
}, { immediate: !0 });
|
|
974
|
-
return
|
|
975
|
-
|
|
976
|
+
return K(() => {
|
|
977
|
+
L();
|
|
976
978
|
}), d;
|
|
977
979
|
}
|
|
978
980
|
function me() {
|
|
@@ -988,28 +990,28 @@ function Zr() {
|
|
|
988
990
|
scene: t,
|
|
989
991
|
renderer: n,
|
|
990
992
|
loop: r,
|
|
991
|
-
raycaster:
|
|
993
|
+
raycaster: o,
|
|
992
994
|
controls: l,
|
|
993
|
-
invalidate:
|
|
995
|
+
invalidate: s,
|
|
994
996
|
advance: a
|
|
995
997
|
} = me();
|
|
996
998
|
r.setContext({
|
|
997
999
|
camera: e,
|
|
998
1000
|
scene: t,
|
|
999
1001
|
renderer: n,
|
|
1000
|
-
raycaster:
|
|
1002
|
+
raycaster: o,
|
|
1001
1003
|
controls: l,
|
|
1002
|
-
invalidate:
|
|
1004
|
+
invalidate: s,
|
|
1003
1005
|
advance: a
|
|
1004
1006
|
});
|
|
1005
|
-
function c(
|
|
1006
|
-
return r.register(
|
|
1007
|
+
function c(g, u = 0) {
|
|
1008
|
+
return r.register(g, "before", u);
|
|
1007
1009
|
}
|
|
1008
|
-
function
|
|
1009
|
-
return r.register(
|
|
1010
|
+
function i(g) {
|
|
1011
|
+
return r.register(g, "render");
|
|
1010
1012
|
}
|
|
1011
|
-
function f(
|
|
1012
|
-
return r.register(
|
|
1013
|
+
function f(g, u = 0) {
|
|
1014
|
+
return r.register(g, "after", u);
|
|
1013
1015
|
}
|
|
1014
1016
|
return {
|
|
1015
1017
|
pause: r.pause,
|
|
@@ -1018,77 +1020,78 @@ function Zr() {
|
|
|
1018
1020
|
resumeRender: r.resumeRender,
|
|
1019
1021
|
isActive: r.isActive,
|
|
1020
1022
|
onBeforeRender: c,
|
|
1021
|
-
render:
|
|
1023
|
+
render: i,
|
|
1022
1024
|
onAfterRender: f
|
|
1023
1025
|
};
|
|
1024
1026
|
}
|
|
1025
|
-
const _t = D(), wt = D(),
|
|
1027
|
+
const _t = D(), wt = D(), Le = D(), te = new lt();
|
|
1026
1028
|
let ce = 0, ue = 0;
|
|
1027
1029
|
const { pause: Mr, resume: Je, isActive: Pr } = ut(
|
|
1028
1030
|
() => {
|
|
1029
|
-
_t.trigger({ delta: ce, elapsed: ue, clock: te }), wt.trigger({ delta: ce, elapsed: ue, clock: te }),
|
|
1031
|
+
_t.trigger({ delta: ce, elapsed: ue, clock: te }), wt.trigger({ delta: ce, elapsed: ue, clock: te }), Le.trigger({ delta: ce, elapsed: ue, clock: te });
|
|
1030
1032
|
},
|
|
1031
1033
|
{ immediate: !1 }
|
|
1032
1034
|
);
|
|
1033
|
-
|
|
1035
|
+
Le.on(() => {
|
|
1034
1036
|
ce = te.getDelta(), ue = te.getElapsedTime();
|
|
1035
1037
|
});
|
|
1036
1038
|
let Qe = !1;
|
|
1037
1039
|
const eo = () => (Qe || (Qe = !0, Je()), {
|
|
1038
1040
|
onBeforeLoop: _t.on,
|
|
1039
1041
|
onLoop: wt.on,
|
|
1040
|
-
onAfterLoop:
|
|
1042
|
+
onAfterLoop: Le.on,
|
|
1041
1043
|
pause: Mr,
|
|
1042
1044
|
resume: Je,
|
|
1043
1045
|
isActive: Pr
|
|
1044
1046
|
});
|
|
1045
1047
|
function to() {
|
|
1046
|
-
const { logWarning: e } =
|
|
1047
|
-
function t(l,
|
|
1048
|
+
const { logWarning: e } = Q();
|
|
1049
|
+
function t(l, s, a) {
|
|
1048
1050
|
let c = null;
|
|
1049
|
-
return l.traverse((
|
|
1050
|
-
|
|
1051
|
-
}), c || e(`Child with ${
|
|
1051
|
+
return l.traverse((i) => {
|
|
1052
|
+
i[s] === a && (c = i);
|
|
1053
|
+
}), c || e(`Child with ${s} '${a}' not found.`), c;
|
|
1052
1054
|
}
|
|
1053
|
-
function n(l,
|
|
1055
|
+
function n(l, s, a) {
|
|
1054
1056
|
const c = [];
|
|
1055
|
-
return l.traverse((
|
|
1056
|
-
|
|
1057
|
-
}), c.length || e(`Children with ${
|
|
1057
|
+
return l.traverse((i) => {
|
|
1058
|
+
i[s].includes(a) && c.push(i);
|
|
1059
|
+
}), c.length || e(`Children with ${s} '${a}' not found.`), c;
|
|
1058
1060
|
}
|
|
1059
|
-
function r(l,
|
|
1060
|
-
return t(l, "name",
|
|
1061
|
+
function r(l, s) {
|
|
1062
|
+
return t(l, "name", s);
|
|
1061
1063
|
}
|
|
1062
|
-
function
|
|
1063
|
-
return n(l, "name",
|
|
1064
|
+
function o(l, s) {
|
|
1065
|
+
return n(l, "name", s);
|
|
1064
1066
|
}
|
|
1065
1067
|
return {
|
|
1066
1068
|
seek: t,
|
|
1067
1069
|
seekByName: r,
|
|
1068
1070
|
seekAll: n,
|
|
1069
|
-
seekAllByName:
|
|
1071
|
+
seekAllByName: o
|
|
1070
1072
|
};
|
|
1071
1073
|
}
|
|
1072
1074
|
function Cr(e, t = {}, n = {}) {
|
|
1073
1075
|
let r = e;
|
|
1074
|
-
const
|
|
1076
|
+
const o = (a) => {
|
|
1075
1077
|
r = a;
|
|
1076
1078
|
};
|
|
1077
1079
|
let l = new Proxy({}, {});
|
|
1078
|
-
const
|
|
1080
|
+
const s = {
|
|
1079
1081
|
has(a, c) {
|
|
1080
1082
|
return c in t || c in r;
|
|
1081
1083
|
},
|
|
1082
|
-
get(a, c,
|
|
1084
|
+
get(a, c, i) {
|
|
1083
1085
|
return c in t ? t[c](r) : r[c];
|
|
1084
1086
|
},
|
|
1085
|
-
set(a, c,
|
|
1086
|
-
|
|
1087
|
+
set(a, c, i) {
|
|
1088
|
+
const f = n[c];
|
|
1089
|
+
return f && typeof f == "function" ? f(i, r, l, o) : r[c] = i, !0;
|
|
1087
1090
|
}
|
|
1088
1091
|
};
|
|
1089
|
-
return l = new Proxy({},
|
|
1092
|
+
return l = new Proxy({}, s), l;
|
|
1090
1093
|
}
|
|
1091
|
-
const { logError: Xe } =
|
|
1094
|
+
const { logError: Xe } = Q(), Ze = [
|
|
1092
1095
|
"onClick",
|
|
1093
1096
|
"onContextMenu",
|
|
1094
1097
|
"onPointerMove",
|
|
@@ -1105,140 +1108,140 @@ const { logError: Xe } = V(), Ze = [
|
|
|
1105
1108
|
"onWheel"
|
|
1106
1109
|
], Er = (e) => {
|
|
1107
1110
|
const t = e.scene.value;
|
|
1108
|
-
function n(
|
|
1109
|
-
if (u || (u = {}), u.args || (u.args = []),
|
|
1111
|
+
function n(i, f, g, u) {
|
|
1112
|
+
if (u || (u = {}), u.args || (u.args = []), i === "template" || zn(i))
|
|
1110
1113
|
return null;
|
|
1111
|
-
let
|
|
1112
|
-
if (
|
|
1114
|
+
let y = i.replace("Tres", ""), p;
|
|
1115
|
+
if (i === "primitive") {
|
|
1113
1116
|
(!H(u.object) || At(u.object)) && Xe(
|
|
1114
1117
|
"Tres primitives need an 'object' prop, whose value is an object or shallowRef<object>"
|
|
1115
|
-
),
|
|
1116
|
-
const
|
|
1117
|
-
|
|
1118
|
+
), y = u.object.type;
|
|
1119
|
+
const _ = {};
|
|
1120
|
+
p = Cr(
|
|
1118
1121
|
u.object,
|
|
1119
1122
|
{
|
|
1120
|
-
object: (
|
|
1123
|
+
object: (v) => v,
|
|
1121
1124
|
isPrimitive: () => !0,
|
|
1122
|
-
__tres: () =>
|
|
1125
|
+
__tres: () => _
|
|
1123
1126
|
},
|
|
1124
1127
|
{
|
|
1125
|
-
object: (
|
|
1126
|
-
sr(
|
|
1128
|
+
object: (v, P, C, w) => {
|
|
1129
|
+
sr(v, C, w, { patchProp: l, remove: o, insert: r }, e);
|
|
1127
1130
|
},
|
|
1128
|
-
__tres: (
|
|
1129
|
-
Object.assign(
|
|
1131
|
+
__tres: (v) => {
|
|
1132
|
+
Object.assign(_, v);
|
|
1130
1133
|
}
|
|
1131
1134
|
}
|
|
1132
1135
|
);
|
|
1133
1136
|
} else {
|
|
1134
|
-
const
|
|
1135
|
-
|
|
1136
|
-
`${
|
|
1137
|
-
),
|
|
1137
|
+
const _ = Ce.value[y];
|
|
1138
|
+
_ || Xe(
|
|
1139
|
+
`${y} is not defined on the THREE namespace. Use extend to add it to the catalog.`
|
|
1140
|
+
), p = new _(...u.args);
|
|
1138
1141
|
}
|
|
1139
|
-
return
|
|
1140
|
-
...
|
|
1141
|
-
type:
|
|
1142
|
+
return p ? (p.isCamera && (u != null && u.position || p.position.set(3, 3, 3), u != null && u.lookAt || p.lookAt(0, 0, 0)), p = z(p, {
|
|
1143
|
+
...p.__tres,
|
|
1144
|
+
type: y,
|
|
1142
1145
|
memoizedProps: u,
|
|
1143
1146
|
eventCount: 0,
|
|
1144
|
-
primitive:
|
|
1147
|
+
primitive: i === "primitive",
|
|
1145
1148
|
attach: u.attach
|
|
1146
|
-
}, e),
|
|
1149
|
+
}, e), p) : null;
|
|
1147
1150
|
}
|
|
1148
|
-
function r(
|
|
1149
|
-
var
|
|
1150
|
-
if (!
|
|
1151
|
+
function r(i, f) {
|
|
1152
|
+
var y, p, _;
|
|
1153
|
+
if (!i)
|
|
1151
1154
|
return;
|
|
1152
1155
|
f = f || t;
|
|
1153
|
-
const
|
|
1154
|
-
|
|
1156
|
+
const g = i.__tres ? i : z(i, {}, e), u = f.__tres ? f : z(f, {}, e);
|
|
1157
|
+
i = J(g), f = J(u), i.__tres && ((y = i.__tres) == null ? void 0 : y.eventCount) > 0 && ((p = e.eventManager) == null || p.registerObject(i)), e.registerCamera(i), (_ = e.eventManager) == null || _.registerPointerMissedObject(i), g.__tres.attach ? nr(u, g, g.__tres.attach) : N(i) && N(u) && (u.add(i), i.dispatchEvent({ type: "added" })), g.__tres.parent = u, u.__tres.objects && !u.__tres.objects.includes(g) && u.__tres.objects.push(g);
|
|
1155
1158
|
}
|
|
1156
|
-
function
|
|
1157
|
-
var
|
|
1158
|
-
if (!
|
|
1159
|
+
function o(i, f) {
|
|
1160
|
+
var p, _, d, v;
|
|
1161
|
+
if (!i)
|
|
1159
1162
|
return;
|
|
1160
|
-
|
|
1161
|
-
const
|
|
1162
|
-
Me(
|
|
1163
|
-
const u = (
|
|
1164
|
-
if (
|
|
1163
|
+
i != null && i.__tres && ((p = i.__tres) == null ? void 0 : p.eventCount) > 0 && ((_ = e.eventManager) == null || _.deregisterObject(i)), f = Me(f) ? "default" : f;
|
|
1164
|
+
const g = (d = i.__tres) == null ? void 0 : d.dispose;
|
|
1165
|
+
Me(g) || (g === null ? f = !1 : f = g);
|
|
1166
|
+
const u = (v = i.__tres) == null ? void 0 : v.primitive, y = f === "default" ? !u : !!f;
|
|
1167
|
+
if (i.__tres && "objects" in i.__tres && [...i.__tres.objects].forEach((P) => o(P, f)), y && i.children && [...i.children].forEach((P) => o(P, f)), gt(i, e), vt(i, e), y && !Fn(i)) {
|
|
1165
1168
|
if (G(f))
|
|
1166
|
-
f(
|
|
1167
|
-
else if (G(
|
|
1169
|
+
f(i);
|
|
1170
|
+
else if (G(i.dispose))
|
|
1168
1171
|
try {
|
|
1169
|
-
|
|
1172
|
+
i.dispose();
|
|
1170
1173
|
} catch {
|
|
1171
1174
|
}
|
|
1172
1175
|
}
|
|
1173
|
-
"__tres" in
|
|
1176
|
+
"__tres" in i && delete i.__tres;
|
|
1174
1177
|
}
|
|
1175
|
-
function l(
|
|
1178
|
+
function l(i, f, g, u) {
|
|
1176
1179
|
var P, C;
|
|
1177
|
-
if (!
|
|
1180
|
+
if (!i)
|
|
1178
1181
|
return;
|
|
1179
|
-
let
|
|
1180
|
-
if (
|
|
1181
|
-
const
|
|
1182
|
-
|
|
1182
|
+
let y = i, p = f;
|
|
1183
|
+
if (i.__tres && (i.__tres.memoizedProps[f] = u), f === "attach") {
|
|
1184
|
+
const w = ((P = i.__tres) == null ? void 0 : P.parent) || i.parent;
|
|
1185
|
+
o(i), z(i, { attach: u }, e), w && r(i, w);
|
|
1183
1186
|
return;
|
|
1184
1187
|
}
|
|
1185
1188
|
if (f === "dispose") {
|
|
1186
|
-
|
|
1189
|
+
i.__tres || (i = z(i, {}, e)), i.__tres.dispose = u;
|
|
1187
1190
|
return;
|
|
1188
1191
|
}
|
|
1189
|
-
if (N(
|
|
1190
|
-
u || u === "" ?
|
|
1192
|
+
if (N(i) && p === "blocks-pointer-events") {
|
|
1193
|
+
u || u === "" ? i[p] = u : delete i[p];
|
|
1191
1194
|
return;
|
|
1192
1195
|
}
|
|
1193
|
-
Ze.includes(f) &&
|
|
1194
|
-
let
|
|
1195
|
-
if (
|
|
1196
|
-
const
|
|
1197
|
-
M &&
|
|
1198
|
-
|
|
1196
|
+
Ze.includes(f) && i.__tres && (i.__tres.eventCount += 1);
|
|
1197
|
+
let _ = oe(p), d = y == null ? void 0 : y[_];
|
|
1198
|
+
if (p === "args") {
|
|
1199
|
+
const w = i, E = g ?? [], S = u ?? [], M = ((C = i.__tres) == null ? void 0 : C.type) || i.type;
|
|
1200
|
+
M && E.length && !Kn(E, S) && (y = Object.assign(
|
|
1201
|
+
w,
|
|
1199
1202
|
new Ce.value[M](...u)
|
|
1200
1203
|
));
|
|
1201
1204
|
return;
|
|
1202
1205
|
}
|
|
1203
|
-
if (
|
|
1204
|
-
if (
|
|
1206
|
+
if (y.type === "BufferGeometry") {
|
|
1207
|
+
if (p === "args")
|
|
1205
1208
|
return;
|
|
1206
|
-
|
|
1207
|
-
oe(
|
|
1208
|
-
new
|
|
1209
|
+
y.setAttribute(
|
|
1210
|
+
oe(p),
|
|
1211
|
+
new Vt(...u)
|
|
1209
1212
|
);
|
|
1210
1213
|
return;
|
|
1211
1214
|
}
|
|
1212
|
-
if (
|
|
1213
|
-
const
|
|
1214
|
-
d =
|
|
1215
|
+
if (p.includes("-") && d === void 0) {
|
|
1216
|
+
const w = p.split("-");
|
|
1217
|
+
d = w.reduce((E, S) => E[oe(S)], y), p = w.pop(), _ = p, d != null && d.set || (y = w.reduce((E, S) => E[oe(S)], y));
|
|
1215
1218
|
}
|
|
1216
|
-
let
|
|
1217
|
-
if (
|
|
1218
|
-
Ze.includes(f) || (de(
|
|
1219
|
+
let v = u;
|
|
1220
|
+
if (v === "" && (v = !0), G(d)) {
|
|
1221
|
+
Ze.includes(f) || (de(v) ? i[_](...v) : i[_](v)), _.startsWith("on") && G(v) && (y[_] = v);
|
|
1219
1222
|
return;
|
|
1220
1223
|
}
|
|
1221
|
-
!(d != null && d.set) && !G(d) ?
|
|
1224
|
+
!(d != null && d.set) && !G(d) ? y[_] = v : d.constructor === v.constructor && (d != null && d.copy) ? d == null || d.copy(v) : de(v) ? d.set(...v) : !d.isColor && d.setScalar ? d.setScalar(v) : d.set(v), ht(i);
|
|
1222
1225
|
}
|
|
1223
|
-
function i
|
|
1226
|
+
function s(i) {
|
|
1224
1227
|
var f;
|
|
1225
|
-
return ((f =
|
|
1228
|
+
return ((f = i == null ? void 0 : i.__tres) == null ? void 0 : f.parent) || null;
|
|
1226
1229
|
}
|
|
1227
|
-
function a(
|
|
1228
|
-
const f = z(new
|
|
1229
|
-
return f.name =
|
|
1230
|
+
function a(i) {
|
|
1231
|
+
const f = z(new Gt(), { type: "Comment" }, e);
|
|
1232
|
+
return f.name = i, f;
|
|
1230
1233
|
}
|
|
1231
|
-
function c(
|
|
1232
|
-
var
|
|
1233
|
-
const f = i
|
|
1234
|
-
return u < 0 || u >=
|
|
1234
|
+
function c(i) {
|
|
1235
|
+
var y;
|
|
1236
|
+
const f = s(i), g = ((y = f == null ? void 0 : f.__tres) == null ? void 0 : y.objects) || [], u = g.indexOf(i);
|
|
1237
|
+
return u < 0 || u >= g.length - 1 ? null : g[u + 1];
|
|
1235
1238
|
}
|
|
1236
1239
|
return {
|
|
1237
1240
|
insert: r,
|
|
1238
|
-
remove:
|
|
1241
|
+
remove: o,
|
|
1239
1242
|
createElement: n,
|
|
1240
1243
|
patchProp: l,
|
|
1241
|
-
parentNode:
|
|
1244
|
+
parentNode: s,
|
|
1242
1245
|
createText: () => void 0,
|
|
1243
1246
|
createComment: a,
|
|
1244
1247
|
setText: () => void 0,
|
|
@@ -1257,27 +1260,27 @@ function bt() {
|
|
|
1257
1260
|
return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
|
|
1258
1261
|
}
|
|
1259
1262
|
const Sr = typeof Proxy == "function", Ar = "devtools-plugin:setup", xr = "plugin:settings:set";
|
|
1260
|
-
let
|
|
1261
|
-
function
|
|
1263
|
+
let Y, Te;
|
|
1264
|
+
function kr() {
|
|
1262
1265
|
var e;
|
|
1263
|
-
return
|
|
1266
|
+
return Y !== void 0 || (typeof window < "u" && window.performance ? (Y = !0, Te = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (Y = !0, Te = globalThis.perf_hooks.performance) : Y = !1), Y;
|
|
1264
1267
|
}
|
|
1265
|
-
function
|
|
1266
|
-
return
|
|
1268
|
+
function Lr() {
|
|
1269
|
+
return kr() ? Te.now() : Date.now();
|
|
1267
1270
|
}
|
|
1268
1271
|
class Rr {
|
|
1269
1272
|
constructor(t, n) {
|
|
1270
1273
|
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
|
|
1271
1274
|
const r = {};
|
|
1272
1275
|
if (t.settings)
|
|
1273
|
-
for (const
|
|
1274
|
-
const a = t.settings[
|
|
1275
|
-
r[
|
|
1276
|
+
for (const s in t.settings) {
|
|
1277
|
+
const a = t.settings[s];
|
|
1278
|
+
r[s] = a.defaultValue;
|
|
1276
1279
|
}
|
|
1277
|
-
const
|
|
1280
|
+
const o = `__vue-devtools-plugin-settings__${t.id}`;
|
|
1278
1281
|
let l = Object.assign({}, r);
|
|
1279
1282
|
try {
|
|
1280
|
-
const
|
|
1283
|
+
const s = localStorage.getItem(o), a = JSON.parse(s);
|
|
1281
1284
|
Object.assign(l, a);
|
|
1282
1285
|
} catch {
|
|
1283
1286
|
}
|
|
@@ -1285,36 +1288,36 @@ class Rr {
|
|
|
1285
1288
|
getSettings() {
|
|
1286
1289
|
return l;
|
|
1287
1290
|
},
|
|
1288
|
-
setSettings(
|
|
1291
|
+
setSettings(s) {
|
|
1289
1292
|
try {
|
|
1290
|
-
localStorage.setItem(
|
|
1293
|
+
localStorage.setItem(o, JSON.stringify(s));
|
|
1291
1294
|
} catch {
|
|
1292
1295
|
}
|
|
1293
|
-
l =
|
|
1296
|
+
l = s;
|
|
1294
1297
|
},
|
|
1295
1298
|
now() {
|
|
1296
|
-
return
|
|
1299
|
+
return Lr();
|
|
1297
1300
|
}
|
|
1298
|
-
}, n && n.on(xr, (
|
|
1299
|
-
|
|
1301
|
+
}, n && n.on(xr, (s, a) => {
|
|
1302
|
+
s === this.plugin.id && this.fallbacks.setSettings(a);
|
|
1300
1303
|
}), this.proxiedOn = new Proxy({}, {
|
|
1301
|
-
get: (
|
|
1304
|
+
get: (s, a) => this.target ? this.target.on[a] : (...c) => {
|
|
1302
1305
|
this.onQueue.push({
|
|
1303
1306
|
method: a,
|
|
1304
1307
|
args: c
|
|
1305
1308
|
});
|
|
1306
1309
|
}
|
|
1307
1310
|
}), this.proxiedTarget = new Proxy({}, {
|
|
1308
|
-
get: (
|
|
1311
|
+
get: (s, a) => this.target ? this.target[a] : a === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(a) ? (...c) => (this.targetQueue.push({
|
|
1309
1312
|
method: a,
|
|
1310
1313
|
args: c,
|
|
1311
1314
|
resolve: () => {
|
|
1312
1315
|
}
|
|
1313
|
-
}), this.fallbacks[a](...c)) : (...c) => new Promise((
|
|
1316
|
+
}), this.fallbacks[a](...c)) : (...c) => new Promise((i) => {
|
|
1314
1317
|
this.targetQueue.push({
|
|
1315
1318
|
method: a,
|
|
1316
1319
|
args: c,
|
|
1317
|
-
resolve:
|
|
1320
|
+
resolve: i
|
|
1318
1321
|
});
|
|
1319
1322
|
})
|
|
1320
1323
|
});
|
|
@@ -1328,16 +1331,16 @@ class Rr {
|
|
|
1328
1331
|
}
|
|
1329
1332
|
}
|
|
1330
1333
|
function Or(e, t) {
|
|
1331
|
-
const n = e, r = bt(),
|
|
1332
|
-
if (
|
|
1333
|
-
|
|
1334
|
+
const n = e, r = bt(), o = Tr(), l = Sr && n.enableEarlyProxy;
|
|
1335
|
+
if (o && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !l))
|
|
1336
|
+
o.emit(Ar, e, t);
|
|
1334
1337
|
else {
|
|
1335
|
-
const
|
|
1338
|
+
const s = l ? new Rr(n, o) : null;
|
|
1336
1339
|
(r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({
|
|
1337
1340
|
pluginDescriptor: n,
|
|
1338
1341
|
setupFn: t,
|
|
1339
|
-
proxy:
|
|
1340
|
-
}),
|
|
1342
|
+
proxy: s
|
|
1343
|
+
}), s && t(s.proxiedTarget);
|
|
1341
1344
|
}
|
|
1342
1345
|
}
|
|
1343
1346
|
function Dr(e, t) {
|
|
@@ -1359,7 +1362,7 @@ const Mt = (e) => {
|
|
|
1359
1362
|
textColor: 5750629,
|
|
1360
1363
|
backgroundColor: 15793395
|
|
1361
1364
|
});
|
|
1362
|
-
const n =
|
|
1365
|
+
const n = ke(e);
|
|
1363
1366
|
return n > 0 && t.tags.push({
|
|
1364
1367
|
label: `${pr(n)} KB`,
|
|
1365
1368
|
textColor: 15707189,
|
|
@@ -1391,8 +1394,8 @@ function Pt(e, t, n = "") {
|
|
|
1391
1394
|
e.children.forEach((r) => {
|
|
1392
1395
|
if (r.type === "HightlightMesh" || n && !r.type.includes(n) && !r.name.includes(n))
|
|
1393
1396
|
return;
|
|
1394
|
-
const
|
|
1395
|
-
t.children.push(
|
|
1397
|
+
const o = Mt(r);
|
|
1398
|
+
t.children.push(o), Pt(r, o, n);
|
|
1396
1399
|
});
|
|
1397
1400
|
}
|
|
1398
1401
|
const jr = [], X = "tres:inspector", Br = Se({
|
|
@@ -1423,39 +1426,46 @@ function Ir(e, t) {
|
|
|
1423
1426
|
n.notifyComponentUpdate();
|
|
1424
1427
|
}, 5e3), n.on.getInspectorTree((l) => {
|
|
1425
1428
|
if (l.inspectorId === X) {
|
|
1426
|
-
const
|
|
1427
|
-
Pt(t.scene.value,
|
|
1429
|
+
const s = Mt(t.scene.value);
|
|
1430
|
+
Pt(t.scene.value, s, l.filter), Br.sceneGraph = s, l.rootNodes = [s];
|
|
1428
1431
|
}
|
|
1429
1432
|
});
|
|
1430
|
-
let r = null,
|
|
1433
|
+
let r = null, o = null;
|
|
1431
1434
|
n.on.getInspectorState((l) => {
|
|
1432
|
-
var
|
|
1435
|
+
var s;
|
|
1433
1436
|
if (l.inspectorId === X) {
|
|
1434
1437
|
const [a] = t.scene.value.getObjectsByProperty("uuid", l.nodeId);
|
|
1435
1438
|
if (!a)
|
|
1436
1439
|
return;
|
|
1437
|
-
if (
|
|
1440
|
+
if (o && r && r.parent && o.remove(r), a.isMesh) {
|
|
1438
1441
|
const c = Xn(a);
|
|
1439
|
-
a.add(c), r = c,
|
|
1442
|
+
a.add(c), r = c, o = a;
|
|
1440
1443
|
}
|
|
1441
1444
|
l.state = {
|
|
1442
|
-
object: Object.entries(a).map(([c,
|
|
1443
|
-
}, a.isScene && (l.state
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1445
|
+
object: Object.entries(a).map(([c, i]) => c === "children" ? { key: c, value: i.filter((f) => f.type !== "HightlightMesh") } : { key: c, value: i, editable: !0 }).filter(({ key: c }) => c !== "parent")
|
|
1446
|
+
}, a.isScene && (l.state = {
|
|
1447
|
+
...l.state,
|
|
1448
|
+
state: [
|
|
1449
|
+
{
|
|
1450
|
+
key: "Scene Info",
|
|
1451
|
+
value: {
|
|
1452
|
+
objects: a.children.length,
|
|
1453
|
+
memory: ke(a),
|
|
1454
|
+
calls: t.renderer.value.info.render.calls,
|
|
1455
|
+
triangles: t.renderer.value.info.render.triangles,
|
|
1456
|
+
points: t.renderer.value.info.render.points,
|
|
1457
|
+
lines: t.renderer.value.info.render.lines
|
|
1458
|
+
}
|
|
1459
|
+
},
|
|
1460
|
+
{
|
|
1461
|
+
key: "Programs",
|
|
1462
|
+
value: ((s = t.renderer.value.info.programs) == null ? void 0 : s.map((c) => ({
|
|
1463
|
+
...c,
|
|
1464
|
+
programName: c.name
|
|
1465
|
+
}))) || []
|
|
1466
|
+
}
|
|
1467
|
+
]
|
|
1468
|
+
});
|
|
1459
1469
|
}
|
|
1460
1470
|
}), n.on.editInspectorState((l) => {
|
|
1461
1471
|
l.inspectorId === X && Qn(t.scene.value, l.nodeId, l.path, l.state.value);
|
|
@@ -1509,83 +1519,81 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
|
|
|
1509
1519
|
"ready"
|
|
1510
1520
|
],
|
|
1511
1521
|
setup(e, { expose: t, emit: n }) {
|
|
1512
|
-
const r = e,
|
|
1522
|
+
const r = e, o = n, l = xt(), s = I(), a = $(new st()), c = He();
|
|
1513
1523
|
Ee(ot);
|
|
1514
|
-
const
|
|
1524
|
+
const i = (p, _ = !1) => fe({
|
|
1515
1525
|
setup() {
|
|
1516
|
-
var
|
|
1517
|
-
const
|
|
1518
|
-
|
|
1519
|
-
const
|
|
1520
|
-
function
|
|
1521
|
-
|
|
1526
|
+
var C;
|
|
1527
|
+
const d = (C = He()) == null ? void 0 : C.appContext;
|
|
1528
|
+
d && (d.app = c == null ? void 0 : c.appContext.app);
|
|
1529
|
+
const v = {};
|
|
1530
|
+
function P(w) {
|
|
1531
|
+
w && (w.parent && P(w.parent), w.provides && Object.assign(v, w.provides));
|
|
1522
1532
|
}
|
|
1523
|
-
return
|
|
1524
|
-
le(
|
|
1525
|
-
})), le("useTres",
|
|
1533
|
+
return c != null && c.parent && r.enableProvideBridge && (P(c.parent), Reflect.ownKeys(v).forEach((w) => {
|
|
1534
|
+
le(w, v[w]);
|
|
1535
|
+
})), le("useTres", p), le("extend", Ee), typeof window < "u" && Ir(d == null ? void 0 : d.app, p), () => Ue(Bt, null, _ ? [] : l.default());
|
|
1526
1536
|
}
|
|
1527
|
-
}),
|
|
1528
|
-
const
|
|
1529
|
-
|
|
1530
|
-
},
|
|
1531
|
-
mt(
|
|
1532
|
-
root:
|
|
1537
|
+
}), f = (p, _ = !1) => {
|
|
1538
|
+
const d = i(p, _), { render: v } = jt(Er(p));
|
|
1539
|
+
v(Ue(d), a.value);
|
|
1540
|
+
}, g = (p, _ = !1) => {
|
|
1541
|
+
mt(p.scene.value), _ && (p.renderer.value.dispose(), p.renderer.value.renderLists.dispose(), p.renderer.value.forceContextLoss()), a.value.__tres = {
|
|
1542
|
+
root: p
|
|
1533
1543
|
};
|
|
1534
|
-
},
|
|
1535
|
-
t({ context:
|
|
1536
|
-
const
|
|
1537
|
-
u
|
|
1544
|
+
}, u = $(null);
|
|
1545
|
+
t({ context: u, dispose: () => g(u.value, !0) });
|
|
1546
|
+
const y = () => {
|
|
1547
|
+
g(u.value), f(u.value, !0);
|
|
1538
1548
|
};
|
|
1539
|
-
return
|
|
1540
|
-
const
|
|
1541
|
-
|
|
1542
|
-
scene:
|
|
1543
|
-
canvas:
|
|
1549
|
+
return kt(() => {
|
|
1550
|
+
const p = s;
|
|
1551
|
+
u.value = br({
|
|
1552
|
+
scene: a.value,
|
|
1553
|
+
canvas: p,
|
|
1544
1554
|
windowSize: r.windowSize ?? !1,
|
|
1545
1555
|
rendererOptions: r,
|
|
1546
|
-
emit:
|
|
1556
|
+
emit: o
|
|
1547
1557
|
});
|
|
1548
|
-
const { registerCamera:
|
|
1549
|
-
|
|
1550
|
-
const
|
|
1551
|
-
const
|
|
1558
|
+
const { registerCamera: _, camera: d, cameras: v, deregisterCamera: P } = u.value;
|
|
1559
|
+
f(u.value);
|
|
1560
|
+
const C = () => {
|
|
1561
|
+
const w = new be(
|
|
1552
1562
|
45,
|
|
1553
1563
|
window.innerWidth / window.innerHeight,
|
|
1554
1564
|
0.1,
|
|
1555
1565
|
1e3
|
|
1556
1566
|
);
|
|
1557
|
-
|
|
1567
|
+
w.position.set(3, 3, 3), w.lookAt(0, 0, 0), _(w);
|
|
1558
1568
|
const E = Ae(() => {
|
|
1559
|
-
|
|
1569
|
+
v.value.length >= 2 && (w.removeFromParent(), P(w), E == null || E());
|
|
1560
1570
|
});
|
|
1561
1571
|
};
|
|
1562
1572
|
ae(
|
|
1563
1573
|
() => r.camera,
|
|
1564
|
-
(
|
|
1565
|
-
|
|
1574
|
+
(w, E) => {
|
|
1575
|
+
w && _(w), E && (E.removeFromParent(), P(E));
|
|
1566
1576
|
},
|
|
1567
1577
|
{
|
|
1568
1578
|
immediate: !0
|
|
1569
1579
|
}
|
|
1570
|
-
),
|
|
1571
|
-
|
|
1572
|
-
), T());
|
|
1573
|
-
}), J(h), (g, d) => (kt(), Rt("canvas", {
|
|
1580
|
+
), d.value || C();
|
|
1581
|
+
}), K(y), (p, _) => (Rt(), Lt("canvas", {
|
|
1574
1582
|
ref_key: "canvas",
|
|
1575
|
-
ref:
|
|
1576
|
-
"data-scene":
|
|
1577
|
-
class:
|
|
1583
|
+
ref: s,
|
|
1584
|
+
"data-scene": a.value.uuid,
|
|
1585
|
+
class: Dt(p.$attrs.class),
|
|
1578
1586
|
"data-tres": `tresjs ${W(Rn).version}`,
|
|
1579
|
-
style:
|
|
1587
|
+
style: Ot({
|
|
1580
1588
|
display: "block",
|
|
1581
1589
|
width: "100%",
|
|
1582
1590
|
height: "100%",
|
|
1583
|
-
position:
|
|
1591
|
+
position: p.windowSize ? "fixed" : "relative",
|
|
1584
1592
|
top: 0,
|
|
1585
1593
|
left: 0,
|
|
1586
1594
|
pointerEvents: "auto",
|
|
1587
1595
|
touchAction: "none",
|
|
1588
|
-
...
|
|
1596
|
+
...p.$attrs.style
|
|
1589
1597
|
})
|
|
1590
1598
|
}, null, 14, $r));
|
|
1591
1599
|
}
|
|
@@ -1599,11 +1607,11 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
|
|
|
1599
1607
|
isCustomElement: (e) => e.startsWith("Tres") && !Ur.includes(e) || e === "primitive"
|
|
1600
1608
|
}
|
|
1601
1609
|
}
|
|
1602
|
-
}, { logWarning: Fr } =
|
|
1610
|
+
}, { logWarning: Fr } = Q();
|
|
1603
1611
|
let B = null;
|
|
1604
1612
|
const ro = {
|
|
1605
1613
|
updated: (e, t) => {
|
|
1606
|
-
var
|
|
1614
|
+
var o;
|
|
1607
1615
|
const n = Zn(t);
|
|
1608
1616
|
if (!n) {
|
|
1609
1617
|
Fr(`v-distance-to: problem with binding value: ${t.value}`);
|
|
@@ -1614,23 +1622,23 @@ const ro = {
|
|
|
1614
1622
|
r.normalize(), B = new Yt(r, e.position, e.position.distanceTo(n), 16776960), e.parent.add(B), console.table(
|
|
1615
1623
|
[
|
|
1616
1624
|
["Distance:", e.position.distanceTo(n)],
|
|
1617
|
-
[`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(
|
|
1625
|
+
[`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(o = e.position) == null ? void 0 : o.z}`],
|
|
1618
1626
|
[`Destiny: ${e.name || e.type}`, `x:${n.x}, y:${n.y}, z:${n == null ? void 0 : n.z}`]
|
|
1619
1627
|
]
|
|
1620
1628
|
);
|
|
1621
1629
|
},
|
|
1622
1630
|
unmounted: (e) => {
|
|
1623
|
-
B == null || B.dispose(), e.parent.remove(B);
|
|
1631
|
+
B == null || B.dispose(), e.parent && e.parent.remove(B);
|
|
1624
1632
|
}
|
|
1625
1633
|
};
|
|
1626
1634
|
class Ct extends qt {
|
|
1627
1635
|
constructor(t, n) {
|
|
1628
|
-
const r = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0],
|
|
1629
|
-
|
|
1636
|
+
const r = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], o = new Fe();
|
|
1637
|
+
o.setAttribute("position", new We(r, 3)), o.computeBoundingSphere();
|
|
1630
1638
|
const l = new Kt({ fog: !1 });
|
|
1631
|
-
super(
|
|
1632
|
-
const
|
|
1633
|
-
a.setAttribute("position", new We(
|
|
1639
|
+
super(o, l), this.light = t, this.color = n, this.type = "RectAreaLightHelper";
|
|
1640
|
+
const s = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], a = new Fe();
|
|
1641
|
+
a.setAttribute("position", new We(s, 3)), a.computeBoundingSphere(), this.add(new Jt(a, new at({ side: Qt, fog: !1 })));
|
|
1634
1642
|
}
|
|
1635
1643
|
updateMatrixWorld() {
|
|
1636
1644
|
if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
|
|
@@ -1646,13 +1654,13 @@ class Ct extends qt {
|
|
|
1646
1654
|
this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
|
|
1647
1655
|
}
|
|
1648
1656
|
}
|
|
1649
|
-
const { logWarning: tt } =
|
|
1657
|
+
const { logWarning: tt } = Q();
|
|
1650
1658
|
let ie, F;
|
|
1651
1659
|
const Wr = {
|
|
1652
|
-
DirectionalLight:
|
|
1653
|
-
PointLight:
|
|
1654
|
-
SpotLight:
|
|
1655
|
-
HemisphereLight:
|
|
1660
|
+
DirectionalLight: tn,
|
|
1661
|
+
PointLight: en,
|
|
1662
|
+
SpotLight: Zt,
|
|
1663
|
+
HemisphereLight: Xt,
|
|
1656
1664
|
RectAreaLight: Ct
|
|
1657
1665
|
}, oo = {
|
|
1658
1666
|
mounted: (e) => {
|
|
@@ -1670,7 +1678,7 @@ const Wr = {
|
|
|
1670
1678
|
tt(`${e.type} is not a light`);
|
|
1671
1679
|
return;
|
|
1672
1680
|
}
|
|
1673
|
-
F = e.parent.children.find((t) => t instanceof ie), F && F.dispose && F.dispose(), e.parent.remove(F);
|
|
1681
|
+
F = e.parent.children.find((t) => t instanceof ie), F && F.dispose && F.dispose(), e.parent && e.parent.remove(F);
|
|
1674
1682
|
}
|
|
1675
1683
|
}, so = {
|
|
1676
1684
|
mounted: (e, t) => {
|
|
@@ -1702,7 +1710,7 @@ export {
|
|
|
1702
1710
|
On as traverseObjects,
|
|
1703
1711
|
ar as useCamera,
|
|
1704
1712
|
Dn as useLoader,
|
|
1705
|
-
|
|
1713
|
+
Q as useLogger,
|
|
1706
1714
|
Zr as useLoop,
|
|
1707
1715
|
yr as useRaycaster,
|
|
1708
1716
|
eo as useRenderLoop,
|