@tresjs/core 4.3.0 → 4.3.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/src/components/TresCanvas.vue.d.ts +5 -4
- package/dist/src/composables/useCamera/index.d.ts +1154 -930
- package/dist/src/composables/useLoader/component.vue.d.ts +7 -8
- package/dist/src/composables/useLoader/index.d.ts +1 -1
- package/dist/src/composables/useRenderer/index.d.ts +1 -1
- package/dist/src/composables/useTexture/component.vue.d.ts +2 -1
- package/dist/src/types/index.d.ts +1 -8
- package/dist/tres.js +272 -368
- package/dist/tres.umd.cjs +3 -3
- package/package.json +30 -31
package/dist/tres.js
CHANGED
|
@@ -1,117 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version: v4.3.
|
|
4
|
-
* (c)
|
|
3
|
+
* version: v4.3.2
|
|
4
|
+
* (c) 2025
|
|
5
5
|
* description: Declarative ThreeJS using Vue Components
|
|
6
6
|
* author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
|
|
7
7
|
*/
|
|
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 K, watchEffect as Ae, onUnmounted as J, 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 Lt, openBlock as kt, createElementBlock as Rt, normalizeClass as Ot, normalizeStyle 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, Vector3 as
|
|
14
|
-
import { tryOnScopeDispose as nn, toValue as
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}, wn = [
|
|
19
|
-
"vue",
|
|
20
|
-
"3d",
|
|
21
|
-
"threejs",
|
|
22
|
-
"three",
|
|
23
|
-
"threejs-vue"
|
|
24
|
-
], bn = !1, Mn = {
|
|
25
|
-
".": {
|
|
26
|
-
types: "./dist/index.d.ts",
|
|
27
|
-
import: "./dist/tres.js",
|
|
28
|
-
require: "./dist/tres.umd.cjs"
|
|
29
|
-
},
|
|
30
|
-
"./components": {
|
|
31
|
-
types: "./dist/src/components/index.d.ts"
|
|
32
|
-
},
|
|
33
|
-
"./composables": {
|
|
34
|
-
types: "./dist/src/composables/index.d.ts"
|
|
35
|
-
},
|
|
36
|
-
"./types": {
|
|
37
|
-
types: "./dist/src/types/index.d.ts"
|
|
38
|
-
},
|
|
39
|
-
"./utils": {
|
|
40
|
-
types: "./dist/src/utils/index.d.ts"
|
|
41
|
-
},
|
|
42
|
-
"./*": "./*"
|
|
43
|
-
}, Pn = "./dist/tres.js", Cn = "./dist/tres.js", En = "./dist/index.d.ts", Tn = [
|
|
44
|
-
"*.d.ts",
|
|
45
|
-
"dist"
|
|
46
|
-
], Sn = {
|
|
47
|
-
access: "public"
|
|
48
|
-
}, xn = {
|
|
49
|
-
dev: "cd playground/vue && npm run dev",
|
|
50
|
-
"dev:nuxt": "cd playground/nuxt && npm run dev",
|
|
51
|
-
build: "vite build",
|
|
52
|
-
test: "vitest",
|
|
53
|
-
"test:ci": "vitest run",
|
|
54
|
-
"test:ui": "vitest --ui --coverage.enabled=true",
|
|
55
|
-
release: "release-it",
|
|
56
|
-
coverage: "vitest run --coverage",
|
|
57
|
-
lint: "eslint .",
|
|
58
|
-
"lint:fix": "eslint . --fix",
|
|
59
|
-
"docs:dev": "vitepress dev docs",
|
|
60
|
-
"docs:build": "vitepress build docs",
|
|
61
|
-
"docs:serve": "vitepress serve docs",
|
|
62
|
-
"docs:preview": "vitepress preview docs",
|
|
63
|
-
"docs:contributors": "esno scripts/update-contributors.ts"
|
|
64
|
-
}, An = {
|
|
65
|
-
three: ">=0.133",
|
|
66
|
-
vue: ">=3.4"
|
|
67
|
-
}, kn = {
|
|
68
|
-
"@alvarosabu/utils": "^3.2.0",
|
|
69
|
-
"@vue/devtools-api": "^6.6.3",
|
|
70
|
-
"@vueuse/core": "^11.1.0"
|
|
71
|
-
}, Ln = {
|
|
72
|
-
"@release-it/conventional-changelog": "^8.0.2",
|
|
73
|
-
"@stackblitz/sdk": "^1.11.0",
|
|
74
|
-
"@tresjs/cientos": "4.0.2",
|
|
75
|
-
"@tresjs/eslint-config": "^1.3.1",
|
|
76
|
-
"@types/three": "^0.168.0",
|
|
77
|
-
"@typescript-eslint/eslint-plugin": "^8.6.0",
|
|
78
|
-
"@typescript-eslint/parser": "^8.6.0",
|
|
79
|
-
"@vitejs/plugin-vue": "^5.1.3",
|
|
80
|
-
"@vitest/coverage-c8": "^0.33.0",
|
|
81
|
-
"@vitest/coverage-v8": "^2.1.1",
|
|
82
|
-
"@vitest/ui": "^2.1.1",
|
|
83
|
-
"@vue/test-utils": "^2.4.6",
|
|
84
|
-
eslint: "^9.10.0",
|
|
85
|
-
"eslint-plugin-vue": "^9.28.0",
|
|
86
|
-
esno: "^4.7.0",
|
|
87
|
-
gsap: "^3.12.5",
|
|
88
|
-
husky: "^9.1.6",
|
|
89
|
-
jsdom: "^25.0.0",
|
|
90
|
-
kolorist: "^1.8.0",
|
|
91
|
-
ohmyfetch: "^0.4.21",
|
|
92
|
-
pathe: "^1.1.2",
|
|
93
|
-
"release-it": "^17.5.0",
|
|
94
|
-
"rollup-plugin-analyzer": "^4.0.0",
|
|
95
|
-
"rollup-plugin-copy": "^3.5.0",
|
|
96
|
-
"rollup-plugin-visualizer": "^5.12.0",
|
|
97
|
-
sponsorkit: "^0.15.5",
|
|
98
|
-
three: "^0.168.0",
|
|
99
|
-
unocss: "^0.62.4",
|
|
100
|
-
unplugin: "^1.14.1",
|
|
101
|
-
"unplugin-vue-components": "^0.27.4",
|
|
102
|
-
vite: "^5.4.6",
|
|
103
|
-
"vite-plugin-banner": "^0.8.0",
|
|
104
|
-
"vite-plugin-dts": "4.2.1",
|
|
105
|
-
"vite-plugin-inspect": "^0.8.7",
|
|
106
|
-
"vite-plugin-require-transform": "^1.0.21",
|
|
107
|
-
"vite-svg-loader": "^5.1.0",
|
|
108
|
-
vitepress: "1.3.4",
|
|
109
|
-
vitest: "^2.1.1",
|
|
110
|
-
vue: "3.5.6",
|
|
111
|
-
"vue-demi": "^0.14.10"
|
|
112
|
-
}, On = {
|
|
113
|
-
name: pn,
|
|
114
|
-
type: dn,
|
|
13
|
+
import { Scene as st, Vector3 as xe, MathUtils as it, MeshBasicMaterial as at, DoubleSide as It, TextureLoader as $t, PerspectiveCamera as be, Camera as Ht, Clock as lt, REVISION as Ut, Color as Z, SRGBColorSpace as Ft, ACESFilmicToneMapping as ct, PCFSoftShadowMap as Wt, NoToneMapping as Nt, WebGLRenderer as ge, Vector2 as ve, Raycaster as zt, BufferAttribute as Gt, Object3D as Vt, ArrowHelper as Yt, Line as qt, BufferGeometry as Fe, Float32BufferAttribute as We, LineBasicMaterial as Kt, Mesh as Jt, BackSide as Qt, DirectionalLightHelper as Xt, PointLightHelper as Zt, SpotLightHelper as en, HemisphereLightHelper as tn } from "three";
|
|
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.2", hn = "pnpm@9.15.1", 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" }, Ln = { "@alvarosabu/utils": "^3.2.0", "@vue/devtools-api": "^6.6.3", "@vueuse/core": "^12.0.0" }, kn = { "@release-it/conventional-changelog": "^9.0.3", "@stackblitz/sdk": "^1.11.0", "@tresjs/cientos": "4.0.3", "@tresjs/eslint-config": "^1.4.0", "@types/three": "^0.171.0", "@typescript-eslint/eslint-plugin": "^8.18.1", "@typescript-eslint/parser": "^8.18.1", "@vitejs/plugin-vue": "^5.2.1", "@vitest/coverage-c8": "^0.33.0", "@vitest/coverage-v8": "^2.1.8", "@vitest/ui": "^2.1.8", "@vue/test-utils": "^2.4.6", eslint: "^9.17.0", "eslint-plugin-vue": "^9.32.0", esno: "^4.8.0", gsap: "^3.12.5", jsdom: "^25.0.1", kolorist: "^1.8.0", ohmyfetch: "^0.4.21", pathe: "^1.1.2", "release-it": "^17.10.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-copy": "^3.5.0", "rollup-plugin-visualizer": "^5.12.0", sponsorkit: "^0.16.2", three: "^0.171.0", unocss: "^0.65.2", unplugin: "^2.1.0", "unplugin-vue-components": "^0.28.0", vite: "^6.0.5", "vite-plugin-banner": "^0.8.0", "vite-plugin-dts": "4.4.0", "vite-plugin-inspect": "^0.10.4", "vite-plugin-require-transform": "^1.0.21", "vite-svg-loader": "^5.1.0", vitepress: "1.5.0", vitest: "2.1.8", vue: "3.5.13", "vue-demi": "^0.14.10" }, Rn = {
|
|
16
|
+
name: dn,
|
|
17
|
+
type: pn,
|
|
115
18
|
version: mn,
|
|
116
19
|
packageManager: hn,
|
|
117
20
|
description: gn,
|
|
@@ -126,12 +29,12 @@ const pn = "@tresjs/core", dn = "module", mn = "4.3.0", hn = "pnpm@9.1.4", gn =
|
|
|
126
29
|
types: En,
|
|
127
30
|
files: Tn,
|
|
128
31
|
publishConfig: Sn,
|
|
129
|
-
scripts:
|
|
130
|
-
peerDependencies:
|
|
131
|
-
dependencies:
|
|
132
|
-
devDependencies:
|
|
32
|
+
scripts: An,
|
|
33
|
+
peerDependencies: xn,
|
|
34
|
+
dependencies: Ln,
|
|
35
|
+
devDependencies: kn
|
|
133
36
|
};
|
|
134
|
-
function
|
|
37
|
+
function On(e) {
|
|
135
38
|
const t = { nodes: {}, materials: {} };
|
|
136
39
|
return e && e.traverse((n) => {
|
|
137
40
|
n.name && (t.nodes[n.name] = n), n.material && !t.materials[n.material.name] && (t.materials[n.material.name] = n.material);
|
|
@@ -144,7 +47,7 @@ async function Dn(e, t, n, r, s) {
|
|
|
144
47
|
t,
|
|
145
48
|
(o) => {
|
|
146
49
|
const f = o;
|
|
147
|
-
f.scene && Object.assign(f,
|
|
50
|
+
f.scene && Object.assign(f, On(f.scene)), a(f);
|
|
148
51
|
},
|
|
149
52
|
r,
|
|
150
53
|
(o) => {
|
|
@@ -153,7 +56,7 @@ async function Dn(e, t, n, r, s) {
|
|
|
153
56
|
);
|
|
154
57
|
});
|
|
155
58
|
}
|
|
156
|
-
const
|
|
59
|
+
const Yr = /* @__PURE__ */ fe({
|
|
157
60
|
__name: "component",
|
|
158
61
|
props: {
|
|
159
62
|
loader: {},
|
|
@@ -180,7 +83,7 @@ class jn extends ot.Mesh {
|
|
|
180
83
|
function Me(e) {
|
|
181
84
|
return typeof e > "u";
|
|
182
85
|
}
|
|
183
|
-
function
|
|
86
|
+
function de(e) {
|
|
184
87
|
return Array.isArray(e);
|
|
185
88
|
}
|
|
186
89
|
function Bn(e) {
|
|
@@ -193,7 +96,7 @@ function G(e) {
|
|
|
193
96
|
return typeof e == "function";
|
|
194
97
|
}
|
|
195
98
|
function H(e) {
|
|
196
|
-
return e === Object(e) && !
|
|
99
|
+
return e === Object(e) && !de(e) && !G(e);
|
|
197
100
|
}
|
|
198
101
|
function N(e) {
|
|
199
102
|
return H(e) && "isObject3D" in e && !!e.isObject3D;
|
|
@@ -222,9 +125,9 @@ function re(e) {
|
|
|
222
125
|
function Wn(e) {
|
|
223
126
|
return H(e) && !!e.isPrimitive;
|
|
224
127
|
}
|
|
225
|
-
const
|
|
128
|
+
const dt = (e, t) => {
|
|
226
129
|
for (const n of Object.keys(t))
|
|
227
|
-
t[n] instanceof Object && Object.assign(t[n],
|
|
130
|
+
t[n] instanceof Object && Object.assign(t[n], dt(e[n], t[n]));
|
|
228
131
|
return Object.assign(e || {}, t), e;
|
|
229
132
|
}, Nn = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot", zn = /* @__PURE__ */ Yn(Nn);
|
|
230
133
|
function Ge(e) {
|
|
@@ -252,7 +155,7 @@ const Ve = (e, t) => {
|
|
|
252
155
|
const r = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
|
|
253
156
|
r && r.reduce((s, l, i) => (s[l] === void 0 && (s[l] = {}), i === r.length - 1 && (s[l] = n), s[l]), e);
|
|
254
157
|
};
|
|
255
|
-
function
|
|
158
|
+
function pt(e, t) {
|
|
256
159
|
if (Ge(e) && Ge(t)) {
|
|
257
160
|
const s = e.attributes, l = t.attributes;
|
|
258
161
|
return s.length !== l.length ? !1 : Array.from(s).every(({ name: i, value: a }) => t.getAttribute(i) === a);
|
|
@@ -265,19 +168,19 @@ function dt(e, t) {
|
|
|
265
168
|
if (n.length !== r.length)
|
|
266
169
|
return !1;
|
|
267
170
|
for (const s of n)
|
|
268
|
-
if (!r.includes(s) || !
|
|
171
|
+
if (!r.includes(s) || !pt(e[s], t[s]))
|
|
269
172
|
return !1;
|
|
270
173
|
return !0;
|
|
271
174
|
}
|
|
272
|
-
function
|
|
175
|
+
function Kn(e, t) {
|
|
273
176
|
if (!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length)
|
|
274
177
|
return !1;
|
|
275
178
|
for (let n = 0; n < e.length; n++)
|
|
276
|
-
if (!
|
|
179
|
+
if (!pt(e[n], t[n]))
|
|
277
180
|
return !1;
|
|
278
181
|
return !0;
|
|
279
182
|
}
|
|
280
|
-
const
|
|
183
|
+
const Jn = Array.isArray;
|
|
281
184
|
function Qn(e, t, n, r) {
|
|
282
185
|
const s = (c) => {
|
|
283
186
|
if (c.uuid === t)
|
|
@@ -319,7 +222,7 @@ function Xn(e) {
|
|
|
319
222
|
function Zn(e) {
|
|
320
223
|
var n;
|
|
321
224
|
let t = e.value;
|
|
322
|
-
return e.value && ((n = e.value) != null && n.isMesh) && (t = e.value.position), Array.isArray(e.value) && (t = new
|
|
225
|
+
return e.value && ((n = e.value) != null && n.isMesh) && (t = e.value.position), Array.isArray(e.value) && (t = new xe(...t)), t;
|
|
323
226
|
}
|
|
324
227
|
function er(e) {
|
|
325
228
|
return "map" in e;
|
|
@@ -354,11 +257,11 @@ function Pe(e, t) {
|
|
|
354
257
|
function qe(...e) {
|
|
355
258
|
return e.map((t, n) => n === 0 ? t : t.charAt(0).toUpperCase() + t.slice(1)).join("");
|
|
356
259
|
}
|
|
357
|
-
const
|
|
260
|
+
const Ke = /-\d+$/;
|
|
358
261
|
function nr(e, t, n) {
|
|
359
262
|
if (ft(n)) {
|
|
360
|
-
if (
|
|
361
|
-
const l = n.replace(
|
|
263
|
+
if (Ke.test(n)) {
|
|
264
|
+
const l = n.replace(Ke, ""), { target: i, key: a } = Pe(e, l);
|
|
362
265
|
if (!Array.isArray(i[a])) {
|
|
363
266
|
const c = i[a], o = [];
|
|
364
267
|
o.__tresDetach = () => {
|
|
@@ -404,7 +307,7 @@ function or(e, t, n) {
|
|
|
404
307
|
if (!G(e.setPixelRatio))
|
|
405
308
|
return;
|
|
406
309
|
let r = 0;
|
|
407
|
-
if (
|
|
310
|
+
if (n && de(n) && n.length >= 2) {
|
|
408
311
|
const [l, i] = n;
|
|
409
312
|
r = it.clamp(t, l, i);
|
|
410
313
|
} else Bn(n) ? r = n : r = t;
|
|
@@ -452,7 +355,7 @@ async function ir(e, t) {
|
|
|
452
355
|
}
|
|
453
356
|
);
|
|
454
357
|
});
|
|
455
|
-
if (
|
|
358
|
+
if (Jn(e)) {
|
|
456
359
|
const s = await Promise.all(e.map((l) => r(l)));
|
|
457
360
|
return e.length > 1 ? s : s[0];
|
|
458
361
|
} else {
|
|
@@ -478,7 +381,7 @@ async function ir(e, t) {
|
|
|
478
381
|
};
|
|
479
382
|
}
|
|
480
383
|
}
|
|
481
|
-
const
|
|
384
|
+
const qr = /* @__PURE__ */ fe({
|
|
482
385
|
__name: "component",
|
|
483
386
|
props: {
|
|
484
387
|
map: {},
|
|
@@ -496,7 +399,7 @@ const Jr = /* @__PURE__ */ fe({
|
|
|
496
399
|
return (l, i) => rt(l.$slots, "default", { textures: W(s) });
|
|
497
400
|
}
|
|
498
401
|
}), ar = ({ sizes: e }) => {
|
|
499
|
-
const t = I([]), n =
|
|
402
|
+
const t = I([]), n = K(
|
|
500
403
|
() => t.value[0]
|
|
501
404
|
), r = (i) => {
|
|
502
405
|
const a = i instanceof Ht ? i : t.value.find((o) => o.uuid === i);
|
|
@@ -517,11 +420,11 @@ const Jr = /* @__PURE__ */ fe({
|
|
|
517
420
|
t.value = t.value.filter(({ uuid: c }) => c !== a.uuid);
|
|
518
421
|
}
|
|
519
422
|
};
|
|
520
|
-
return
|
|
423
|
+
return Ae(() => {
|
|
521
424
|
e.aspectRatio.value && t.value.forEach((i) => {
|
|
522
425
|
!i.manual && (i instanceof be || lr(i)) && (i instanceof be ? 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());
|
|
523
426
|
});
|
|
524
|
-
}),
|
|
427
|
+
}), J(() => {
|
|
525
428
|
t.value = [];
|
|
526
429
|
}), {
|
|
527
430
|
camera: n,
|
|
@@ -534,12 +437,12 @@ const Jr = /* @__PURE__ */ fe({
|
|
|
534
437
|
function lr(e) {
|
|
535
438
|
return e.hasOwnProperty("isOrthographicCamera") && e.isOrthographicCamera;
|
|
536
439
|
}
|
|
537
|
-
const Kr = !0,
|
|
440
|
+
const Kr = !0, pe = "[TresJS ▲ ■ ●] ";
|
|
538
441
|
function cr(...e) {
|
|
539
|
-
typeof e[0] == "string" ? e[0] =
|
|
442
|
+
typeof e[0] == "string" ? e[0] = pe + e[0] : e.unshift(pe), console.error(...e);
|
|
540
443
|
}
|
|
541
444
|
function ur(...e) {
|
|
542
|
-
typeof e[0] == "string" ? e[0] =
|
|
445
|
+
typeof e[0] == "string" ? e[0] = pe + e[0] : e.unshift(pe), console.warn(...e);
|
|
543
446
|
}
|
|
544
447
|
function fr(e, t) {
|
|
545
448
|
}
|
|
@@ -577,41 +480,41 @@ function ye() {
|
|
|
577
480
|
return e.size;
|
|
578
481
|
} };
|
|
579
482
|
}
|
|
580
|
-
function
|
|
483
|
+
function dr() {
|
|
581
484
|
let e = !0, t = !0, n = !1;
|
|
582
485
|
const r = new lt(!1), s = I(r.running), l = I(!1);
|
|
583
486
|
let i;
|
|
584
487
|
const a = it.generateUUID();
|
|
585
488
|
let c = null;
|
|
586
489
|
const o = ye(), f = ye(), y = ye();
|
|
587
|
-
|
|
490
|
+
E();
|
|
588
491
|
let u = {};
|
|
589
492
|
function v(M) {
|
|
590
493
|
u = M;
|
|
591
494
|
}
|
|
592
|
-
function h(M,
|
|
593
|
-
switch (
|
|
495
|
+
function h(M, x, p = 0) {
|
|
496
|
+
switch (x) {
|
|
594
497
|
case "before":
|
|
595
|
-
return o.on(M,
|
|
498
|
+
return o.on(M, p);
|
|
596
499
|
case "render":
|
|
597
500
|
return c || (c = M), f.dispose(), f.on(M);
|
|
598
501
|
case "after":
|
|
599
|
-
return y.on(M,
|
|
502
|
+
return y.on(M, p);
|
|
600
503
|
}
|
|
601
504
|
}
|
|
602
505
|
function g() {
|
|
603
|
-
t && (t = !1,
|
|
506
|
+
t && (t = !1, E(), b());
|
|
604
507
|
}
|
|
605
|
-
function
|
|
606
|
-
t = !0,
|
|
508
|
+
function d() {
|
|
509
|
+
t = !0, E(), cancelAnimationFrame(i);
|
|
607
510
|
}
|
|
608
511
|
function _() {
|
|
609
|
-
n = !1,
|
|
512
|
+
n = !1, E();
|
|
610
513
|
}
|
|
611
|
-
function
|
|
612
|
-
n = !0,
|
|
514
|
+
function P() {
|
|
515
|
+
n = !0, E();
|
|
613
516
|
}
|
|
614
|
-
function
|
|
517
|
+
function C() {
|
|
615
518
|
l.value = !0;
|
|
616
519
|
}
|
|
617
520
|
function T() {
|
|
@@ -622,7 +525,7 @@ function pr() {
|
|
|
622
525
|
i = requestAnimationFrame(b);
|
|
623
526
|
return;
|
|
624
527
|
}
|
|
625
|
-
const M = r.getDelta(),
|
|
528
|
+
const M = r.getDelta(), x = r.getElapsedTime(), p = {
|
|
626
529
|
camera: W(u.camera),
|
|
627
530
|
scene: W(u.scene),
|
|
628
531
|
renderer: W(u.renderer),
|
|
@@ -630,21 +533,21 @@ function pr() {
|
|
|
630
533
|
controls: W(u.controls),
|
|
631
534
|
invalidate: u.invalidate,
|
|
632
535
|
advance: u.advance
|
|
633
|
-
}, w = { delta: M, elapsed:
|
|
536
|
+
}, w = { delta: M, elapsed: x, clock: r, ...p };
|
|
634
537
|
s.value && o.trigger(w), l.value || (f.count ? f.trigger(w) : c && c(w)), s.value && y.trigger(w), i = requestAnimationFrame(b);
|
|
635
538
|
}
|
|
636
|
-
function
|
|
539
|
+
function E() {
|
|
637
540
|
const M = !t && !n;
|
|
638
541
|
r.running !== M && (r.running ? r.stop() : r.start()), s.value = r.running;
|
|
639
542
|
}
|
|
640
543
|
return {
|
|
641
544
|
loopId: a,
|
|
642
|
-
register: (M,
|
|
545
|
+
register: (M, x, p) => h(M, x, p),
|
|
643
546
|
start: g,
|
|
644
|
-
stop:
|
|
645
|
-
pause:
|
|
547
|
+
stop: d,
|
|
548
|
+
pause: P,
|
|
646
549
|
resume: _,
|
|
647
|
-
pauseRender:
|
|
550
|
+
pauseRender: C,
|
|
648
551
|
resumeRender: T,
|
|
649
552
|
isRenderPaused: l,
|
|
650
553
|
isActive: s,
|
|
@@ -652,7 +555,7 @@ function pr() {
|
|
|
652
555
|
setReady: (M) => e = M
|
|
653
556
|
};
|
|
654
557
|
}
|
|
655
|
-
function
|
|
558
|
+
function Le(e) {
|
|
656
559
|
let t = 0;
|
|
657
560
|
return e.traverse((n) => {
|
|
658
561
|
if (n.isMesh && n.geometry && n.type !== "HightlightMesh") {
|
|
@@ -661,12 +564,12 @@ function ke(e) {
|
|
|
661
564
|
}
|
|
662
565
|
}), t;
|
|
663
566
|
}
|
|
664
|
-
function
|
|
567
|
+
function pr(e) {
|
|
665
568
|
return (e / 1024).toFixed(2);
|
|
666
569
|
}
|
|
667
570
|
const mr = Number.parseInt(Ut.replace("dev", ""));
|
|
668
|
-
function
|
|
669
|
-
return typeof e == "number" ? [e, e, e] : e instanceof
|
|
571
|
+
function Jr(e) {
|
|
572
|
+
return typeof e == "number" ? [e, e, e] : e instanceof xe ? [e.x, e.y, e.z] : e;
|
|
670
573
|
}
|
|
671
574
|
function hr(e) {
|
|
672
575
|
return e instanceof Z ? e : Array.isArray(e) ? new Z(...e) : new Z(e);
|
|
@@ -693,19 +596,19 @@ function gr({
|
|
|
693
596
|
options: t,
|
|
694
597
|
contextParts: { sizes: n, render: r, invalidate: s, advance: l }
|
|
695
598
|
}) {
|
|
696
|
-
const i =
|
|
697
|
-
alpha:
|
|
698
|
-
depth:
|
|
599
|
+
const i = K(() => ({
|
|
600
|
+
alpha: A(t.alpha) ?? !0,
|
|
601
|
+
depth: A(t.depth),
|
|
699
602
|
canvas: rn(e),
|
|
700
|
-
context:
|
|
701
|
-
stencil:
|
|
702
|
-
antialias:
|
|
703
|
-
precision:
|
|
704
|
-
powerPreference:
|
|
705
|
-
premultipliedAlpha:
|
|
706
|
-
preserveDrawingBuffer:
|
|
707
|
-
logarithmicDepthBuffer:
|
|
708
|
-
failIfMajorPerformanceCaveat:
|
|
603
|
+
context: A(t.context),
|
|
604
|
+
stencil: A(t.stencil),
|
|
605
|
+
antialias: A(t.antialias) ?? !0,
|
|
606
|
+
precision: A(t.precision),
|
|
607
|
+
powerPreference: A(t.powerPreference),
|
|
608
|
+
premultipliedAlpha: A(t.premultipliedAlpha),
|
|
609
|
+
preserveDrawingBuffer: A(t.preserveDrawingBuffer),
|
|
610
|
+
logarithmicDepthBuffer: A(t.logarithmicDepthBuffer),
|
|
611
|
+
failIfMajorPerformanceCaveat: A(t.failIfMajorPerformanceCaveat)
|
|
709
612
|
})), a = $(new ge(i.value));
|
|
710
613
|
function c() {
|
|
711
614
|
t.renderMode === "on-demand" && s();
|
|
@@ -728,36 +631,36 @@ function gr({
|
|
|
728
631
|
outputColorSpace: h.outputColorSpace
|
|
729
632
|
};
|
|
730
633
|
return h.dispose(), g;
|
|
731
|
-
})(), v =
|
|
634
|
+
})(), v = A(t.renderMode);
|
|
732
635
|
return v === "on-demand" && s(), v === "manual" && setTimeout(() => {
|
|
733
636
|
l();
|
|
734
|
-
}, 100),
|
|
735
|
-
const h =
|
|
736
|
-
h && (h in se || f(`Renderer Preset must be one of these: ${Object.keys(se).join(", ")}`),
|
|
737
|
-
const g = (
|
|
738
|
-
const T =
|
|
637
|
+
}, 100), Ae(() => {
|
|
638
|
+
const h = A(t.preset);
|
|
639
|
+
h && (h in se || f(`Renderer Preset must be one of these: ${Object.keys(se).join(", ")}`), dt(a.value, se[h])), or(a.value, o.value, A(t.dpr)), v === "always" && (r.frames.value = Math.max(1, r.frames.value));
|
|
640
|
+
const g = (P, C) => {
|
|
641
|
+
const T = A(P), b = () => {
|
|
739
642
|
if (h)
|
|
740
|
-
return Ve(se[h],
|
|
643
|
+
return Ve(se[h], C);
|
|
741
644
|
};
|
|
742
645
|
if (T !== void 0)
|
|
743
646
|
return T;
|
|
744
|
-
const
|
|
745
|
-
return
|
|
746
|
-
},
|
|
747
|
-
|
|
647
|
+
const E = b();
|
|
648
|
+
return E !== void 0 ? E : Ve(u, C);
|
|
649
|
+
}, d = (P, C) => qn(a.value, C, g(P, C));
|
|
650
|
+
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");
|
|
748
651
|
const _ = g(t.clearColor, "clearColor");
|
|
749
652
|
_ && a.value.setClearColor(
|
|
750
653
|
_ ? hr(_) : new Z(0)
|
|
751
654
|
// default clear color is not easily/efficiently retrievable from three
|
|
752
655
|
);
|
|
753
|
-
}),
|
|
656
|
+
}), J(() => {
|
|
754
657
|
a.value.dispose(), a.value.forceContextLoss();
|
|
755
658
|
}), {
|
|
756
659
|
renderer: a
|
|
757
660
|
};
|
|
758
661
|
}
|
|
759
662
|
function vr(e, t, n = 10) {
|
|
760
|
-
const r =
|
|
663
|
+
const r = A(e) ? sn() : an(K(() => A(t).parentElement)), s = we(Ne(r.width, n)), l = we(Ne(r.height, n)), i = K(() => s.value / l.value);
|
|
761
664
|
return {
|
|
762
665
|
height: l,
|
|
763
666
|
width: s,
|
|
@@ -765,7 +668,7 @@ function vr(e, t, n = 10) {
|
|
|
765
668
|
};
|
|
766
669
|
}
|
|
767
670
|
const yr = (e, t) => {
|
|
768
|
-
const n =
|
|
671
|
+
const n = K(() => t.renderer.value.domElement), r = $([]), { x: s, y: l } = ln({ target: n });
|
|
769
672
|
let i = 0;
|
|
770
673
|
const { width: a, height: c, top: o, left: f } = cn(n), y = ({ x: m, y: S }) => {
|
|
771
674
|
if (n.value)
|
|
@@ -782,8 +685,8 @@ const yr = (e, t) => {
|
|
|
782
685
|
y: (m == null ? void 0 : m.clientY) ?? l.value
|
|
783
686
|
});
|
|
784
687
|
return S ? u(S) || [] : [];
|
|
785
|
-
}, h = D(), g = D(),
|
|
786
|
-
function
|
|
688
|
+
}, h = D(), g = D(), d = D(), _ = D(), P = D(), C = D(), T = D(), b = D();
|
|
689
|
+
function E(m) {
|
|
787
690
|
const S = {};
|
|
788
691
|
for (const U in m)
|
|
789
692
|
typeof U != "function" && (S[U] = m[U]);
|
|
@@ -791,7 +694,7 @@ const yr = (e, t) => {
|
|
|
791
694
|
}
|
|
792
695
|
const M = (m, S) => {
|
|
793
696
|
var Be, Ie, $e;
|
|
794
|
-
const U =
|
|
697
|
+
const U = E(S), ne = new xe(S == null ? void 0 : S.clientX, S == null ? void 0 : S.clientY, 0).unproject((Be = t.camera) == null ? void 0 : Be.value);
|
|
795
698
|
m.trigger({
|
|
796
699
|
...U,
|
|
797
700
|
intersections: r.value,
|
|
@@ -804,41 +707,41 @@ const yr = (e, t) => {
|
|
|
804
707
|
stopPropagating: !1
|
|
805
708
|
});
|
|
806
709
|
};
|
|
807
|
-
let
|
|
808
|
-
const
|
|
809
|
-
v(m), M(
|
|
710
|
+
let x;
|
|
711
|
+
const p = (m) => {
|
|
712
|
+
v(m), M(d, m), x = m;
|
|
810
713
|
}, w = () => {
|
|
811
|
-
|
|
714
|
+
x && p(x);
|
|
812
715
|
};
|
|
813
|
-
let
|
|
716
|
+
let L, k, R;
|
|
814
717
|
const j = (m) => {
|
|
815
718
|
var S;
|
|
816
|
-
|
|
719
|
+
L = (S = r.value[0]) == null ? void 0 : S.object, i = 0, k = new ve(
|
|
817
720
|
(m == null ? void 0 : m.clientX) ?? s.value,
|
|
818
721
|
(m == null ? void 0 : m.clientY) ?? l.value
|
|
819
|
-
), M(
|
|
722
|
+
), M(P, m);
|
|
820
723
|
};
|
|
821
|
-
let
|
|
822
|
-
const
|
|
724
|
+
let O, Y = !1;
|
|
725
|
+
const Re = (m) => {
|
|
823
726
|
var S, U, ne;
|
|
824
|
-
m instanceof PointerEvent && (r.value.length === 0 && M(
|
|
727
|
+
m instanceof PointerEvent && (r.value.length === 0 && M(C, m), L === ((S = r.value[0]) == null ? void 0 : S.object) && (R = new ve(
|
|
825
728
|
(m == null ? void 0 : m.clientX) ?? s.value,
|
|
826
729
|
(m == null ? void 0 : m.clientY) ?? l.value
|
|
827
|
-
), i =
|
|
828
|
-
},
|
|
829
|
-
Y && (M(g, m),
|
|
830
|
-
}, De = (m) => M(
|
|
831
|
-
return n.value.addEventListener("pointerup",
|
|
832
|
-
n != null && n.value && (n.value.removeEventListener("pointerup",
|
|
730
|
+
), i = k == null ? void 0 : k.distanceTo(R), m.button === 0 ? (M(h, m), O === ((U = r.value[0]) == null ? void 0 : U.object) ? Y = !0 : (O = (ne = r.value[0]) == null ? void 0 : ne.object, Y = !1)) : m.button === 2 && M(T, m)), M(_, m));
|
|
731
|
+
}, Oe = (m) => {
|
|
732
|
+
Y && (M(g, m), O = void 0, Y = !1);
|
|
733
|
+
}, De = (m) => M(d, m), je = (m) => M(b, m);
|
|
734
|
+
return n.value.addEventListener("pointerup", Re), n.value.addEventListener("pointerdown", j), n.value.addEventListener("pointermove", p), n.value.addEventListener("pointerleave", De), n.value.addEventListener("dblclick", Oe), n.value.addEventListener("wheel", je), J(() => {
|
|
735
|
+
n != null && n.value && (n.value.removeEventListener("pointerup", Re), n.value.removeEventListener("pointerdown", j), n.value.removeEventListener("pointermove", p), n.value.removeEventListener("pointerleave", De), n.value.removeEventListener("dblclick", Oe), n.value.removeEventListener("wheel", je));
|
|
833
736
|
}), {
|
|
834
737
|
intersects: r,
|
|
835
738
|
onClick: (m) => h.on(m).off,
|
|
836
739
|
onDblClick: (m) => g.on(m).off,
|
|
837
740
|
onContextMenu: (m) => T.on(m).off,
|
|
838
|
-
onPointerMove: (m) =>
|
|
741
|
+
onPointerMove: (m) => d.on(m).off,
|
|
839
742
|
onPointerUp: (m) => _.on(m).off,
|
|
840
|
-
onPointerDown: (m) =>
|
|
841
|
-
onPointerMissed: (m) =>
|
|
743
|
+
onPointerDown: (m) => P.on(m).off,
|
|
744
|
+
onPointerMissed: (m) => C.on(m).off,
|
|
842
745
|
onWheel: (m) => b.on(m).off,
|
|
843
746
|
forceUpdate: w
|
|
844
747
|
};
|
|
@@ -850,30 +753,30 @@ function _e(e, t) {
|
|
|
850
753
|
typeof e == "function" && e(t);
|
|
851
754
|
}
|
|
852
755
|
function _r(e, t, n) {
|
|
853
|
-
var
|
|
756
|
+
var x;
|
|
854
757
|
const r = $(), s = $();
|
|
855
758
|
e && (r.value = e), t && (s.value = t);
|
|
856
|
-
const l = (
|
|
759
|
+
const l = (p) => {
|
|
857
760
|
var w;
|
|
858
|
-
return ((w =
|
|
859
|
-
}, i = (
|
|
761
|
+
return ((w = p.__tres) == null ? void 0 : w.eventCount) > 0;
|
|
762
|
+
}, i = (p) => {
|
|
860
763
|
var w;
|
|
861
|
-
return ((w =
|
|
862
|
-
}, a = $(((
|
|
863
|
-
function c(
|
|
864
|
-
const
|
|
865
|
-
w.stopPropagation =
|
|
866
|
-
for (const
|
|
764
|
+
return ((w = p.children) == null ? void 0 : w.some((L) => i(L))) || l(p);
|
|
765
|
+
}, a = $(((x = r.value) == null ? void 0 : x.children).filter(i) || []);
|
|
766
|
+
function c(p, w) {
|
|
767
|
+
const L = [], k = () => w.stopPropagating = !0;
|
|
768
|
+
w.stopPropagation = k;
|
|
769
|
+
for (const R of w == null ? void 0 : w.intersections) {
|
|
867
770
|
if (w.stopPropagating)
|
|
868
771
|
return;
|
|
869
|
-
w = { ...w, ...
|
|
870
|
-
const { object: j } =
|
|
871
|
-
w.eventObject = j, _e(j[
|
|
872
|
-
let
|
|
873
|
-
for (;
|
|
874
|
-
w.eventObject =
|
|
875
|
-
const Y = Vn(
|
|
876
|
-
n(Y, { intersection:
|
|
772
|
+
w = { ...w, ...R };
|
|
773
|
+
const { object: j } = R;
|
|
774
|
+
w.eventObject = j, _e(j[p], w), L.push(j);
|
|
775
|
+
let O = j.parent;
|
|
776
|
+
for (; O !== null && !w.stopPropagating && !L.includes(O); )
|
|
777
|
+
w.eventObject = O, _e(O[p], w), L.push(O), O = O.parent;
|
|
778
|
+
const Y = Vn(p.slice(2));
|
|
779
|
+
n(Y, { intersection: R, event: w });
|
|
877
780
|
}
|
|
878
781
|
}
|
|
879
782
|
const {
|
|
@@ -884,55 +787,55 @@ function _r(e, t, n) {
|
|
|
884
787
|
onPointerDown: v,
|
|
885
788
|
onPointerUp: h,
|
|
886
789
|
onPointerMissed: g,
|
|
887
|
-
onWheel:
|
|
790
|
+
onWheel: d,
|
|
888
791
|
forceUpdate: _
|
|
889
792
|
} = yr(a, t);
|
|
890
|
-
h((
|
|
891
|
-
let
|
|
892
|
-
u((
|
|
893
|
-
const w =
|
|
894
|
-
|
|
895
|
-
w.includes(
|
|
896
|
-
}),
|
|
897
|
-
|
|
898
|
-
}), c("onPointerMove",
|
|
793
|
+
h((p) => c("onPointerUp", p)), v((p) => c("onPointerDown", p)), o((p) => c("onClick", p)), f((p) => c("onDoubleClick", p)), y((p) => c("onContextMenu", p)), d((p) => c("onWheel", p));
|
|
794
|
+
let P = [];
|
|
795
|
+
u((p) => {
|
|
796
|
+
const w = p.intersections.map(({ object: k }) => k), L = p.intersections;
|
|
797
|
+
P.forEach(({ object: k }) => {
|
|
798
|
+
w.includes(k) || (p.intersections = P, c("onPointerLeave", p), c("onPointerOut", p));
|
|
799
|
+
}), p.intersections = L, p.intersections.forEach(({ object: k }) => {
|
|
800
|
+
P.includes(k) || (c("onPointerEnter", p), c("onPointerOver", p));
|
|
801
|
+
}), c("onPointerMove", p), P = p.intersections;
|
|
899
802
|
});
|
|
900
|
-
const
|
|
901
|
-
g((
|
|
902
|
-
const w = () =>
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
}), n("pointer-missed", { event:
|
|
803
|
+
const C = [];
|
|
804
|
+
g((p) => {
|
|
805
|
+
const w = () => p.stopPropagating = !0;
|
|
806
|
+
p.stopPropagation = w, C.forEach((L) => {
|
|
807
|
+
p.stopPropagating || (p.eventObject = L, _e(L.onPointerMissed, p));
|
|
808
|
+
}), n("pointer-missed", { event: p });
|
|
906
809
|
});
|
|
907
|
-
function T(
|
|
908
|
-
re(
|
|
810
|
+
function T(p) {
|
|
811
|
+
re(p) && N(p) && a.value.push(p);
|
|
909
812
|
}
|
|
910
|
-
function b(
|
|
911
|
-
if (re(
|
|
912
|
-
const w = a.value.indexOf(
|
|
813
|
+
function b(p) {
|
|
814
|
+
if (re(p) && N(p)) {
|
|
815
|
+
const w = a.value.indexOf(p);
|
|
913
816
|
w > -1 && a.value.splice(w, 1);
|
|
914
817
|
}
|
|
915
818
|
}
|
|
916
|
-
function
|
|
917
|
-
re(
|
|
819
|
+
function E(p) {
|
|
820
|
+
re(p) && N(p) && p.onPointerMissed && C.push(p);
|
|
918
821
|
}
|
|
919
|
-
function M(
|
|
920
|
-
if (re(
|
|
921
|
-
const w =
|
|
922
|
-
w > -1 &&
|
|
822
|
+
function M(p) {
|
|
823
|
+
if (re(p) && N(p)) {
|
|
824
|
+
const w = C.indexOf(p);
|
|
825
|
+
w > -1 && C.splice(w, 1);
|
|
923
826
|
}
|
|
924
827
|
}
|
|
925
828
|
return t.eventManager = {
|
|
926
829
|
forceUpdate: _,
|
|
927
830
|
registerObject: T,
|
|
928
831
|
deregisterObject: b,
|
|
929
|
-
registerPointerMissedObject:
|
|
832
|
+
registerPointerMissedObject: E,
|
|
930
833
|
deregisterPointerMissedObject: M
|
|
931
834
|
}, {
|
|
932
835
|
forceUpdate: _,
|
|
933
836
|
registerObject: T,
|
|
934
837
|
deregisterObject: b,
|
|
935
|
-
registerPointerMissedObject:
|
|
838
|
+
registerPointerMissedObject: E,
|
|
936
839
|
deregisterPointerMissedObject: M
|
|
937
840
|
};
|
|
938
841
|
}
|
|
@@ -979,7 +882,7 @@ function yt(e) {
|
|
|
979
882
|
}, e);
|
|
980
883
|
return ee.set(e, l), l;
|
|
981
884
|
}
|
|
982
|
-
function
|
|
885
|
+
function Qr(e) {
|
|
983
886
|
const t = me();
|
|
984
887
|
if (t)
|
|
985
888
|
return ee.has(t) ? ee.get(t).on(e) : yt(t).on(e);
|
|
@@ -1002,10 +905,10 @@ function br({
|
|
|
1002
905
|
priority: I(0),
|
|
1003
906
|
frames: I(0),
|
|
1004
907
|
maxFrames: 60,
|
|
1005
|
-
canBeInvalidated:
|
|
908
|
+
canBeInvalidated: K(() => u.mode.value === "on-demand" && u.frames.value === 0)
|
|
1006
909
|
};
|
|
1007
|
-
function v(
|
|
1008
|
-
r.renderMode === "on-demand" && (u.frames.value = Math.min(u.maxFrames, u.frames.value +
|
|
910
|
+
function v(R = 1) {
|
|
911
|
+
r.renderMode === "on-demand" && (u.frames.value = Math.min(u.maxFrames, u.frames.value + R));
|
|
1009
912
|
}
|
|
1010
913
|
function h() {
|
|
1011
914
|
r.renderMode === "manual" && (u.frames.value = 1);
|
|
@@ -1019,7 +922,7 @@ function br({
|
|
|
1019
922
|
// TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
|
|
1020
923
|
contextParts: { sizes: i, camera: a, render: u, invalidate: v, advance: h }
|
|
1021
924
|
}
|
|
1022
|
-
),
|
|
925
|
+
), d = {
|
|
1023
926
|
sizes: i,
|
|
1024
927
|
scene: l,
|
|
1025
928
|
camera: a,
|
|
@@ -1046,31 +949,31 @@ function br({
|
|
|
1046
949
|
registerCamera: o,
|
|
1047
950
|
setCameraActive: y,
|
|
1048
951
|
deregisterCamera: f,
|
|
1049
|
-
loop:
|
|
952
|
+
loop: dr()
|
|
1050
953
|
};
|
|
1051
|
-
le("useTres",
|
|
1052
|
-
root:
|
|
1053
|
-
},
|
|
1054
|
-
a.value && u.frames.value > 0 && (g.value.render(e, a.value), s("render",
|
|
954
|
+
le("useTres", d), d.scene.value.__tres = {
|
|
955
|
+
root: d
|
|
956
|
+
}, d.loop.register(() => {
|
|
957
|
+
a.value && u.frames.value > 0 && (g.value.render(e, a.value), s("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);
|
|
1055
958
|
}, "render");
|
|
1056
|
-
const { on: _, cancel:
|
|
1057
|
-
|
|
1058
|
-
s("ready",
|
|
1059
|
-
}),
|
|
1060
|
-
|
|
959
|
+
const { on: _, cancel: P } = yt(d);
|
|
960
|
+
d.loop.setReady(!1), d.loop.start(), _(() => {
|
|
961
|
+
s("ready", d), d.loop.setReady(!0), _r(e, d, s);
|
|
962
|
+
}), J(() => {
|
|
963
|
+
P(), d.loop.stop();
|
|
1061
964
|
});
|
|
1062
|
-
const
|
|
1063
|
-
let
|
|
1064
|
-
const
|
|
1065
|
-
|
|
965
|
+
const C = 100, T = un({ every: C }), { isSupported: b, memory: E } = fn({ interval: C }), M = 160;
|
|
966
|
+
let x = performance.now();
|
|
967
|
+
const p = ({ timestamp: R }) => {
|
|
968
|
+
d.scene.value && (d.perf.memory.allocatedMem = Le(d.scene.value)), R - x >= C && (x = R, d.perf.fps.accumulator.push(T.value), d.perf.fps.accumulator.length > M && d.perf.fps.accumulator.shift(), d.perf.fps.value = T.value, b.value && E.value && (d.perf.memory.accumulator.push(E.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));
|
|
1066
969
|
};
|
|
1067
970
|
let w = 0;
|
|
1068
|
-
const
|
|
1069
|
-
window.__TRES__DEVTOOLS__ && (
|
|
971
|
+
const L = 1, { pause: k } = ut(({ delta: R }) => {
|
|
972
|
+
window.__TRES__DEVTOOLS__ && (p({ timestamp: performance.now() }), w += R, w >= L && (window.__TRES__DEVTOOLS__.cb(d), w = 0));
|
|
1070
973
|
}, { immediate: !0 });
|
|
1071
|
-
return
|
|
1072
|
-
|
|
1073
|
-
}),
|
|
974
|
+
return J(() => {
|
|
975
|
+
k();
|
|
976
|
+
}), d;
|
|
1074
977
|
}
|
|
1075
978
|
function me() {
|
|
1076
979
|
const e = St("useTres");
|
|
@@ -1078,8 +981,8 @@ function me() {
|
|
|
1078
981
|
throw new Error("useTresContext must be used together with useTresContextProvider");
|
|
1079
982
|
return e;
|
|
1080
983
|
}
|
|
1081
|
-
const
|
|
1082
|
-
function
|
|
984
|
+
const Xr = me;
|
|
985
|
+
function Zr() {
|
|
1083
986
|
const {
|
|
1084
987
|
camera: e,
|
|
1085
988
|
scene: t,
|
|
@@ -1119,27 +1022,27 @@ function eo() {
|
|
|
1119
1022
|
onAfterRender: f
|
|
1120
1023
|
};
|
|
1121
1024
|
}
|
|
1122
|
-
const _t = D(), wt = D(),
|
|
1025
|
+
const _t = D(), wt = D(), ke = D(), te = new lt();
|
|
1123
1026
|
let ce = 0, ue = 0;
|
|
1124
|
-
const { pause: Mr, resume:
|
|
1027
|
+
const { pause: Mr, resume: Je, isActive: Pr } = ut(
|
|
1125
1028
|
() => {
|
|
1126
|
-
_t.trigger({ delta: ce, elapsed: ue, clock: te }), wt.trigger({ delta: ce, elapsed: ue, clock: te }),
|
|
1029
|
+
_t.trigger({ delta: ce, elapsed: ue, clock: te }), wt.trigger({ delta: ce, elapsed: ue, clock: te }), ke.trigger({ delta: ce, elapsed: ue, clock: te });
|
|
1127
1030
|
},
|
|
1128
1031
|
{ immediate: !1 }
|
|
1129
1032
|
);
|
|
1130
|
-
|
|
1033
|
+
ke.on(() => {
|
|
1131
1034
|
ce = te.getDelta(), ue = te.getElapsedTime();
|
|
1132
1035
|
});
|
|
1133
1036
|
let Qe = !1;
|
|
1134
|
-
const
|
|
1037
|
+
const eo = () => (Qe || (Qe = !0, Je()), {
|
|
1135
1038
|
onBeforeLoop: _t.on,
|
|
1136
1039
|
onLoop: wt.on,
|
|
1137
|
-
onAfterLoop:
|
|
1040
|
+
onAfterLoop: ke.on,
|
|
1138
1041
|
pause: Mr,
|
|
1139
|
-
resume:
|
|
1042
|
+
resume: Je,
|
|
1140
1043
|
isActive: Pr
|
|
1141
1044
|
});
|
|
1142
|
-
function
|
|
1045
|
+
function to() {
|
|
1143
1046
|
const { logWarning: e } = V();
|
|
1144
1047
|
function t(l, i, a) {
|
|
1145
1048
|
let c = null;
|
|
@@ -1207,7 +1110,7 @@ const { logError: Xe } = V(), Ze = [
|
|
|
1207
1110
|
return null;
|
|
1208
1111
|
let v = o.replace("Tres", ""), h;
|
|
1209
1112
|
if (o === "primitive") {
|
|
1210
|
-
(!H(u.object) ||
|
|
1113
|
+
(!H(u.object) || At(u.object)) && Xe(
|
|
1211
1114
|
"Tres primitives need an 'object' prop, whose value is an object or shallowRef<object>"
|
|
1212
1115
|
), v = u.object.type;
|
|
1213
1116
|
const g = {};
|
|
@@ -1219,8 +1122,8 @@ const { logError: Xe } = V(), Ze = [
|
|
|
1219
1122
|
__tres: () => g
|
|
1220
1123
|
},
|
|
1221
1124
|
{
|
|
1222
|
-
object: (_,
|
|
1223
|
-
sr(_,
|
|
1125
|
+
object: (_, P, C, T) => {
|
|
1126
|
+
sr(_, C, T, { patchProp: l, remove: s, insert: r }, e);
|
|
1224
1127
|
},
|
|
1225
1128
|
__tres: (_) => {
|
|
1226
1129
|
Object.assign(g, _);
|
|
@@ -1251,14 +1154,14 @@ const { logError: Xe } = V(), Ze = [
|
|
|
1251
1154
|
o = Q(y), f = Q(u), o.__tres && ((v = o.__tres) == null ? void 0 : v.eventCount) > 0 && ((h = e.eventManager) == null || h.registerObject(o)), e.registerCamera(o), (g = e.eventManager) == null || g.registerPointerMissedObject(o), y.__tres.attach ? nr(u, y, y.__tres.attach) : N(o) && N(u) && (u.add(o), o.dispatchEvent({ type: "added" })), y.__tres.parent = u, u.__tres.objects && !u.__tres.objects.includes(y) && u.__tres.objects.push(y);
|
|
1252
1155
|
}
|
|
1253
1156
|
function s(o, f) {
|
|
1254
|
-
var h, g,
|
|
1157
|
+
var h, g, d, _;
|
|
1255
1158
|
if (!o)
|
|
1256
1159
|
return;
|
|
1257
1160
|
o != null && o.__tres && ((h = o.__tres) == null ? void 0 : h.eventCount) > 0 && ((g = e.eventManager) == null || g.deregisterObject(o)), f = Me(f) ? "default" : f;
|
|
1258
|
-
const y = (
|
|
1161
|
+
const y = (d = o.__tres) == null ? void 0 : d.dispose;
|
|
1259
1162
|
Me(y) || (y === null ? f = !1 : f = y);
|
|
1260
1163
|
const u = (_ = o.__tres) == null ? void 0 : _.primitive, v = f === "default" ? !u : !!f;
|
|
1261
|
-
if (o.__tres && "objects" in o.__tres && [...o.__tres.objects].forEach((
|
|
1164
|
+
if (o.__tres && "objects" in o.__tres && [...o.__tres.objects].forEach((P) => s(P, f)), v && o.children && [...o.children].forEach((P) => s(P, f)), gt(o, e), vt(o, e), v && !Fn(o)) {
|
|
1262
1165
|
if (G(f))
|
|
1263
1166
|
f(o);
|
|
1264
1167
|
else if (G(o.dispose))
|
|
@@ -1270,12 +1173,12 @@ const { logError: Xe } = V(), Ze = [
|
|
|
1270
1173
|
"__tres" in o && delete o.__tres;
|
|
1271
1174
|
}
|
|
1272
1175
|
function l(o, f, y, u) {
|
|
1273
|
-
var
|
|
1176
|
+
var P, C;
|
|
1274
1177
|
if (!o)
|
|
1275
1178
|
return;
|
|
1276
1179
|
let v = o, h = f;
|
|
1277
1180
|
if (o.__tres && (o.__tres.memoizedProps[f] = u), f === "attach") {
|
|
1278
|
-
const T = ((
|
|
1181
|
+
const T = ((P = o.__tres) == null ? void 0 : P.parent) || o.parent;
|
|
1279
1182
|
s(o), z(o, { attach: u }, e), T && r(o, T);
|
|
1280
1183
|
return;
|
|
1281
1184
|
}
|
|
@@ -1288,10 +1191,10 @@ const { logError: Xe } = V(), Ze = [
|
|
|
1288
1191
|
return;
|
|
1289
1192
|
}
|
|
1290
1193
|
Ze.includes(f) && o.__tres && (o.__tres.eventCount += 1);
|
|
1291
|
-
let g = oe(h),
|
|
1194
|
+
let g = oe(h), d = v == null ? void 0 : v[g];
|
|
1292
1195
|
if (h === "args") {
|
|
1293
|
-
const T = o, b = y ?? [],
|
|
1294
|
-
M && b.length && !
|
|
1196
|
+
const T = o, b = y ?? [], E = u ?? [], M = ((C = o.__tres) == null ? void 0 : C.type) || o.type;
|
|
1197
|
+
M && b.length && !Kn(b, E) && (v = Object.assign(
|
|
1295
1198
|
T,
|
|
1296
1199
|
new Ce.value[M](...u)
|
|
1297
1200
|
));
|
|
@@ -1306,16 +1209,16 @@ const { logError: Xe } = V(), Ze = [
|
|
|
1306
1209
|
);
|
|
1307
1210
|
return;
|
|
1308
1211
|
}
|
|
1309
|
-
if (h.includes("-") &&
|
|
1212
|
+
if (h.includes("-") && d === void 0) {
|
|
1310
1213
|
const T = h.split("-");
|
|
1311
|
-
|
|
1214
|
+
d = T.reduce((b, E) => b[oe(E)], v), h = T.pop(), g = h, d != null && d.set || (v = T.reduce((b, E) => b[oe(E)], v));
|
|
1312
1215
|
}
|
|
1313
1216
|
let _ = u;
|
|
1314
|
-
if (_ === "" && (_ = !0), G(
|
|
1315
|
-
Ze.includes(f) || (
|
|
1217
|
+
if (_ === "" && (_ = !0), G(d)) {
|
|
1218
|
+
Ze.includes(f) || (de(_) ? o[g](..._) : o[g](_)), g.startsWith("on") && G(_) && (v[g] = _);
|
|
1316
1219
|
return;
|
|
1317
1220
|
}
|
|
1318
|
-
!(
|
|
1221
|
+
!(d != null && d.set) && !G(d) ? v[g] = _ : d.constructor === _.constructor && (d != null && d.copy) ? d == null || d.copy(_) : de(_) ? d.set(..._) : !d.isColor && d.setScalar ? d.setScalar(_) : d.set(_), ht(o);
|
|
1319
1222
|
}
|
|
1320
1223
|
function i(o) {
|
|
1321
1224
|
var f;
|
|
@@ -1353,16 +1256,16 @@ function Tr() {
|
|
|
1353
1256
|
function bt() {
|
|
1354
1257
|
return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
|
|
1355
1258
|
}
|
|
1356
|
-
const Sr = typeof Proxy == "function",
|
|
1259
|
+
const Sr = typeof Proxy == "function", Ar = "devtools-plugin:setup", xr = "plugin:settings:set";
|
|
1357
1260
|
let q, Te;
|
|
1358
|
-
function
|
|
1261
|
+
function Lr() {
|
|
1359
1262
|
var e;
|
|
1360
1263
|
return q !== void 0 || (typeof window < "u" && window.performance ? (q = !0, Te = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (q = !0, Te = globalThis.perf_hooks.performance) : q = !1), q;
|
|
1361
1264
|
}
|
|
1362
|
-
function
|
|
1363
|
-
return
|
|
1265
|
+
function kr() {
|
|
1266
|
+
return Lr() ? Te.now() : Date.now();
|
|
1364
1267
|
}
|
|
1365
|
-
class
|
|
1268
|
+
class Rr {
|
|
1366
1269
|
constructor(t, n) {
|
|
1367
1270
|
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
|
|
1368
1271
|
const r = {};
|
|
@@ -1390,9 +1293,9 @@ class Or {
|
|
|
1390
1293
|
l = i;
|
|
1391
1294
|
},
|
|
1392
1295
|
now() {
|
|
1393
|
-
return
|
|
1296
|
+
return kr();
|
|
1394
1297
|
}
|
|
1395
|
-
}, n && n.on(
|
|
1298
|
+
}, n && n.on(xr, (i, a) => {
|
|
1396
1299
|
i === this.plugin.id && this.fallbacks.setSettings(a);
|
|
1397
1300
|
}), this.proxiedOn = new Proxy({}, {
|
|
1398
1301
|
get: (i, a) => this.target ? this.target.on[a] : (...c) => {
|
|
@@ -1424,12 +1327,12 @@ class Or {
|
|
|
1424
1327
|
n.resolve(await this.target[n.method](...n.args));
|
|
1425
1328
|
}
|
|
1426
1329
|
}
|
|
1427
|
-
function
|
|
1330
|
+
function Or(e, t) {
|
|
1428
1331
|
const n = e, r = bt(), s = Tr(), l = Sr && n.enableEarlyProxy;
|
|
1429
1332
|
if (s && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !l))
|
|
1430
|
-
s.emit(
|
|
1333
|
+
s.emit(Ar, e, t);
|
|
1431
1334
|
else {
|
|
1432
|
-
const i = l ? new
|
|
1335
|
+
const i = l ? new Rr(n, s) : null;
|
|
1433
1336
|
(r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({
|
|
1434
1337
|
pluginDescriptor: n,
|
|
1435
1338
|
setupFn: t,
|
|
@@ -1456,9 +1359,9 @@ const Mt = (e) => {
|
|
|
1456
1359
|
textColor: 5750629,
|
|
1457
1360
|
backgroundColor: 15793395
|
|
1458
1361
|
});
|
|
1459
|
-
const n =
|
|
1362
|
+
const n = Le(e);
|
|
1460
1363
|
return n > 0 && t.tags.push({
|
|
1461
|
-
label: `${
|
|
1364
|
+
label: `${pr(n)} KB`,
|
|
1462
1365
|
textColor: 15707189,
|
|
1463
1366
|
backgroundColor: 16775644,
|
|
1464
1367
|
tooltip: "Memory usage"
|
|
@@ -1496,7 +1399,7 @@ const jr = [], X = "tres:inspector", Br = Se({
|
|
|
1496
1399
|
sceneGraph: null
|
|
1497
1400
|
});
|
|
1498
1401
|
function Ir(e, t) {
|
|
1499
|
-
|
|
1402
|
+
Or(
|
|
1500
1403
|
{
|
|
1501
1404
|
id: "dev.esm.tres",
|
|
1502
1405
|
label: "TresJS 🪐",
|
|
@@ -1539,7 +1442,7 @@ function Ir(e, t) {
|
|
|
1539
1442
|
object: Object.entries(a).map(([c, o]) => c === "children" ? { key: c, value: o.filter((f) => f.type !== "HightlightMesh") } : { key: c, value: o, editable: !0 }).filter(({ key: c }) => c !== "parent")
|
|
1540
1443
|
}, a.isScene && (l.state.info = {
|
|
1541
1444
|
objects: a.children.length,
|
|
1542
|
-
memory:
|
|
1445
|
+
memory: Le(a),
|
|
1543
1446
|
calls: t.renderer.value.info.render.calls,
|
|
1544
1447
|
triangles: t.renderer.value.info.render.triangles,
|
|
1545
1448
|
points: t.renderer.value.info.render.points,
|
|
@@ -1577,7 +1480,6 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
|
|
|
1577
1480
|
windowSize: { type: Boolean, default: void 0 },
|
|
1578
1481
|
enableProvideBridge: { type: Boolean, default: !0 },
|
|
1579
1482
|
context: {},
|
|
1580
|
-
precision: {},
|
|
1581
1483
|
alpha: { type: Boolean, default: void 0 },
|
|
1582
1484
|
premultipliedAlpha: { type: Boolean },
|
|
1583
1485
|
antialias: { type: Boolean, default: void 0 },
|
|
@@ -1585,8 +1487,10 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
|
|
|
1585
1487
|
preserveDrawingBuffer: { type: Boolean, default: void 0 },
|
|
1586
1488
|
powerPreference: {},
|
|
1587
1489
|
depth: { type: Boolean, default: void 0 },
|
|
1490
|
+
failIfMajorPerformanceCaveat: { type: Boolean, default: void 0 },
|
|
1491
|
+
precision: {},
|
|
1588
1492
|
logarithmicDepthBuffer: { type: Boolean, default: void 0 },
|
|
1589
|
-
|
|
1493
|
+
reverseDepthBuffer: { type: Boolean }
|
|
1590
1494
|
},
|
|
1591
1495
|
emits: [
|
|
1592
1496
|
"render",
|
|
@@ -1605,26 +1509,26 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
|
|
|
1605
1509
|
"ready"
|
|
1606
1510
|
],
|
|
1607
1511
|
setup(e, { expose: t, emit: n }) {
|
|
1608
|
-
const r = e, s = n, l =
|
|
1512
|
+
const r = e, s = n, l = xt(), { logWarning: i } = V(), a = I(), c = $(new st()), o = He();
|
|
1609
1513
|
Ee(ot);
|
|
1610
|
-
const f = (g,
|
|
1514
|
+
const f = (g, d = !1) => fe({
|
|
1611
1515
|
setup() {
|
|
1612
1516
|
var T;
|
|
1613
1517
|
const _ = (T = He()) == null ? void 0 : T.appContext;
|
|
1614
1518
|
_ && (_.app = o == null ? void 0 : o.appContext.app);
|
|
1615
|
-
const
|
|
1616
|
-
function
|
|
1617
|
-
b && (b.parent &&
|
|
1519
|
+
const P = {};
|
|
1520
|
+
function C(b) {
|
|
1521
|
+
b && (b.parent && C(b.parent), b.provides && Object.assign(P, b.provides));
|
|
1618
1522
|
}
|
|
1619
|
-
return o != null && o.parent && r.enableProvideBridge && (
|
|
1620
|
-
le(b, P);
|
|
1621
|
-
})), le("useTres", g), le("extend", Ee), typeof window < "u" && Ir(_ == null ? void 0 : _.app, g), () => Ue(Bt, null,
|
|
1523
|
+
return o != null && o.parent && r.enableProvideBridge && (C(o.parent), Reflect.ownKeys(P).forEach((b) => {
|
|
1524
|
+
le(b, P[b]);
|
|
1525
|
+
})), le("useTres", g), le("extend", Ee), typeof window < "u" && Ir(_ == null ? void 0 : _.app, g), () => Ue(Bt, null, d ? [] : l.default());
|
|
1622
1526
|
}
|
|
1623
|
-
}), y = (g,
|
|
1624
|
-
const _ = f(g,
|
|
1625
|
-
|
|
1626
|
-
}, u = (g,
|
|
1627
|
-
mt(g.scene.value),
|
|
1527
|
+
}), y = (g, d = !1) => {
|
|
1528
|
+
const _ = f(g, d), { render: P } = jt(Er(g));
|
|
1529
|
+
P(Ue(_), c.value);
|
|
1530
|
+
}, u = (g, d = !1) => {
|
|
1531
|
+
mt(g.scene.value), d && (g.renderer.value.dispose(), g.renderer.value.renderLists.dispose(), g.renderer.value.forceContextLoss()), c.value.__tres = {
|
|
1628
1532
|
root: g
|
|
1629
1533
|
};
|
|
1630
1534
|
}, v = $(null);
|
|
@@ -1632,7 +1536,7 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
|
|
|
1632
1536
|
const h = () => {
|
|
1633
1537
|
u(v.value), y(v.value, !0);
|
|
1634
1538
|
};
|
|
1635
|
-
return
|
|
1539
|
+
return Lt(() => {
|
|
1636
1540
|
const g = a;
|
|
1637
1541
|
v.value = br({
|
|
1638
1542
|
scene: c.value,
|
|
@@ -1641,7 +1545,7 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
|
|
|
1641
1545
|
rendererOptions: r,
|
|
1642
1546
|
emit: s
|
|
1643
1547
|
});
|
|
1644
|
-
const { registerCamera:
|
|
1548
|
+
const { registerCamera: d, camera: _, cameras: P, deregisterCamera: C } = v.value;
|
|
1645
1549
|
y(v.value);
|
|
1646
1550
|
const T = () => {
|
|
1647
1551
|
const b = new be(
|
|
@@ -1650,15 +1554,15 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
|
|
|
1650
1554
|
0.1,
|
|
1651
1555
|
1e3
|
|
1652
1556
|
);
|
|
1653
|
-
b.position.set(3, 3, 3), b.lookAt(0, 0, 0),
|
|
1654
|
-
const
|
|
1655
|
-
|
|
1557
|
+
b.position.set(3, 3, 3), b.lookAt(0, 0, 0), d(b);
|
|
1558
|
+
const E = Ae(() => {
|
|
1559
|
+
P.value.length >= 2 && (b.removeFromParent(), C(b), E == null || E());
|
|
1656
1560
|
});
|
|
1657
1561
|
};
|
|
1658
1562
|
ae(
|
|
1659
1563
|
() => r.camera,
|
|
1660
|
-
(b,
|
|
1661
|
-
b &&
|
|
1564
|
+
(b, E) => {
|
|
1565
|
+
b && d(b), E && (E.removeFromParent(), C(E));
|
|
1662
1566
|
},
|
|
1663
1567
|
{
|
|
1664
1568
|
immediate: !0
|
|
@@ -1666,12 +1570,12 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
|
|
|
1666
1570
|
), _.value || (i(
|
|
1667
1571
|
"No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
|
|
1668
1572
|
), T());
|
|
1669
|
-
}),
|
|
1573
|
+
}), J(h), (g, d) => (kt(), Rt("canvas", {
|
|
1670
1574
|
ref_key: "canvas",
|
|
1671
1575
|
ref: a,
|
|
1672
1576
|
"data-scene": c.value.uuid,
|
|
1673
|
-
class:
|
|
1674
|
-
"data-tres": `tresjs ${W(
|
|
1577
|
+
class: Ot(g.$attrs.class),
|
|
1578
|
+
"data-tres": `tresjs ${W(Rn).version}`,
|
|
1675
1579
|
style: Dt({
|
|
1676
1580
|
display: "block",
|
|
1677
1581
|
width: "100%",
|
|
@@ -1689,20 +1593,20 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
|
|
|
1689
1593
|
"TresCanvas",
|
|
1690
1594
|
"TresLeches",
|
|
1691
1595
|
"TresScene"
|
|
1692
|
-
],
|
|
1596
|
+
], no = {
|
|
1693
1597
|
template: {
|
|
1694
1598
|
compilerOptions: {
|
|
1695
1599
|
isCustomElement: (e) => e.startsWith("Tres") && !Ur.includes(e) || e === "primitive"
|
|
1696
1600
|
}
|
|
1697
1601
|
}
|
|
1698
|
-
},
|
|
1602
|
+
}, { logWarning: Fr } = V();
|
|
1699
1603
|
let B = null;
|
|
1700
|
-
const
|
|
1604
|
+
const ro = {
|
|
1701
1605
|
updated: (e, t) => {
|
|
1702
1606
|
var s;
|
|
1703
1607
|
const n = Zn(t);
|
|
1704
1608
|
if (!n) {
|
|
1705
|
-
|
|
1609
|
+
Fr(`v-distance-to: problem with binding value: ${t.value}`);
|
|
1706
1610
|
return;
|
|
1707
1611
|
}
|
|
1708
1612
|
B && (B.dispose(), e.parent.remove(B));
|
|
@@ -1723,10 +1627,10 @@ class Ct extends qt {
|
|
|
1723
1627
|
constructor(t, n) {
|
|
1724
1628
|
const r = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], s = new Fe();
|
|
1725
1629
|
s.setAttribute("position", new We(r, 3)), s.computeBoundingSphere();
|
|
1726
|
-
const l = new
|
|
1630
|
+
const l = new Kt({ fog: !1 });
|
|
1727
1631
|
super(s, l), this.light = t, this.color = n, this.type = "RectAreaLightHelper";
|
|
1728
1632
|
const i = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], a = new Fe();
|
|
1729
|
-
a.setAttribute("position", new We(i, 3)), a.computeBoundingSphere(), this.add(new
|
|
1633
|
+
a.setAttribute("position", new We(i, 3)), a.computeBoundingSphere(), this.add(new Jt(a, new at({ side: Qt, fog: !1 })));
|
|
1730
1634
|
}
|
|
1731
1635
|
updateMatrixWorld() {
|
|
1732
1636
|
if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
|
|
@@ -1744,19 +1648,19 @@ class Ct extends qt {
|
|
|
1744
1648
|
}
|
|
1745
1649
|
const { logWarning: tt } = V();
|
|
1746
1650
|
let ie, F;
|
|
1747
|
-
const
|
|
1651
|
+
const Wr = {
|
|
1748
1652
|
DirectionalLight: Xt,
|
|
1749
1653
|
PointLight: Zt,
|
|
1750
1654
|
SpotLight: en,
|
|
1751
1655
|
HemisphereLight: tn,
|
|
1752
1656
|
RectAreaLight: Ct
|
|
1753
|
-
},
|
|
1657
|
+
}, oo = {
|
|
1754
1658
|
mounted: (e) => {
|
|
1755
1659
|
if (!e.isLight) {
|
|
1756
1660
|
tt(`${e.type} is not a light`);
|
|
1757
1661
|
return;
|
|
1758
1662
|
}
|
|
1759
|
-
ie =
|
|
1663
|
+
ie = Wr[e.type], e.parent.add(new ie(e, 1, e.color.getHex()));
|
|
1760
1664
|
},
|
|
1761
1665
|
updated: (e) => {
|
|
1762
1666
|
F = e.parent.children.find((t) => t instanceof ie), !(F instanceof Ct) && F.update();
|
|
@@ -1768,7 +1672,7 @@ const Nr = {
|
|
|
1768
1672
|
}
|
|
1769
1673
|
F = e.parent.children.find((t) => t instanceof ie), F && F.dispose && F.dispose(), e.parent.remove(F);
|
|
1770
1674
|
}
|
|
1771
|
-
},
|
|
1675
|
+
}, so = {
|
|
1772
1676
|
mounted: (e, t) => {
|
|
1773
1677
|
if (t.arg) {
|
|
1774
1678
|
console.log(`v-log:${t.arg}`, e[t.arg]);
|
|
@@ -1776,40 +1680,40 @@ const Nr = {
|
|
|
1776
1680
|
}
|
|
1777
1681
|
console.log("v-log", e);
|
|
1778
1682
|
}
|
|
1779
|
-
},
|
|
1683
|
+
}, io = {
|
|
1780
1684
|
install(e) {
|
|
1781
1685
|
e.component("TresCanvas", Hr);
|
|
1782
1686
|
}
|
|
1783
1687
|
};
|
|
1784
1688
|
export {
|
|
1785
1689
|
Hr as TresCanvas,
|
|
1786
|
-
|
|
1787
|
-
|
|
1690
|
+
Yr as UseLoader,
|
|
1691
|
+
qr as UseTexture,
|
|
1788
1692
|
Ce as catalogue,
|
|
1789
|
-
|
|
1790
|
-
|
|
1693
|
+
dr as createRenderLoop,
|
|
1694
|
+
io as default,
|
|
1791
1695
|
mt as dispose,
|
|
1792
1696
|
Ee as extend,
|
|
1793
1697
|
Kr as isProd,
|
|
1794
1698
|
hr as normalizeColor,
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1699
|
+
Jr as normalizeVectorFlexibleParam,
|
|
1700
|
+
Qr as onTresReady,
|
|
1701
|
+
no as templateCompilerOptions,
|
|
1702
|
+
On as traverseObjects,
|
|
1799
1703
|
ar as useCamera,
|
|
1800
1704
|
Dn as useLoader,
|
|
1801
1705
|
V as useLogger,
|
|
1802
|
-
|
|
1706
|
+
Zr as useLoop,
|
|
1803
1707
|
yr as useRaycaster,
|
|
1804
|
-
|
|
1708
|
+
eo as useRenderLoop,
|
|
1805
1709
|
gr as useRenderer,
|
|
1806
|
-
|
|
1710
|
+
to as useSeek,
|
|
1807
1711
|
ir as useTexture,
|
|
1808
|
-
|
|
1712
|
+
Xr as useTres,
|
|
1809
1713
|
me as useTresContext,
|
|
1810
1714
|
br as useTresContextProvider,
|
|
1811
1715
|
_r as useTresEventManager,
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1716
|
+
ro as vDistanceTo,
|
|
1717
|
+
oo as vLightHelper,
|
|
1718
|
+
so as vLog
|
|
1815
1719
|
};
|