@tresjs/core 4.0.0-rc.2 → 4.0.0
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 +245 -244
- package/dist/tres.umd.cjs +2 -2
- package/package.json +6 -6
package/dist/tres.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version: v4.0.0
|
|
3
|
+
* version: v4.0.0
|
|
4
4
|
* (c) 2024
|
|
5
5
|
* description: Declarative ThreeJS using Vue Components
|
|
6
6
|
* author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
|
|
7
7
|
*/
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var se = (e, t, n) => (
|
|
11
|
-
import { ref as A, computed as B, watchEffect as ve, onUnmounted as N, shallowRef as U, watch as V, reactive as
|
|
12
|
-
import * as
|
|
13
|
-
import { PerspectiveCamera as fe, Camera as
|
|
14
|
-
import { createEventHook as x, useRafFn as
|
|
15
|
-
const
|
|
8
|
+
var st = Object.defineProperty;
|
|
9
|
+
var it = (e, t, n) => t in e ? st(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
10
|
+
var se = (e, t, n) => (it(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
11
|
+
import { ref as A, computed as B, watchEffect as ve, onUnmounted as N, shallowRef as U, watch as V, reactive as We, readonly as ue, unref as W, provide as ce, inject as at, defineComponent as Se, useSlots as lt, getCurrentInstance as xe, onMounted as ut, openBlock as ct, createElementBlock as ft, normalizeClass as dt, normalizeStyle as pt, createRenderer as mt, h as Te, Fragment as vt } from "vue";
|
|
12
|
+
import * as Ne from "three";
|
|
13
|
+
import { PerspectiveCamera as fe, Camera as gt, Clock as ze, Vector3 as ge, Color as re, Scene as Ge, MeshBasicMaterial as Ve, DoubleSide as ht, REVISION as yt, SRGBColorSpace as bt, ACESFilmicToneMapping as qe, PCFSoftShadowMap as wt, NoToneMapping as Mt, WebGLRenderer as ie, TextureLoader as Pt, Vector2 as ae, MathUtils as Ct, Raycaster as _t, BufferAttribute as Et, Line as kt, BufferGeometry as Ae, Float32BufferAttribute as Oe, LineBasicMaterial as St, Mesh as xt, BackSide as Tt, DirectionalLightHelper as At, PointLightHelper as Ot, SpotLightHelper as Lt, HemisphereLightHelper as Dt, ArrowHelper as Bt } from "three";
|
|
14
|
+
import { createEventHook as x, useRafFn as Ye, toValue as k, unrefElement as Rt, useDevicePixelRatio as jt, usePointer as It, useElementBounding as Ht, useWindowSize as Ut, useElementSize as $t, refDebounced as Le, tryOnScopeDispose as Ft, useFps as Wt, useMemory as Nt } from "@vueuse/core";
|
|
15
|
+
const zt = "@tresjs/core", Gt = "module", Vt = "4.0.0", qt = "pnpm@8.15.6", Yt = "Declarative ThreeJS using Vue Components", Jt = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", Qt = "MIT", Kt = [
|
|
16
16
|
"vue",
|
|
17
17
|
"3d",
|
|
18
18
|
"threejs",
|
|
19
19
|
"three",
|
|
20
20
|
"threejs-vue"
|
|
21
|
-
],
|
|
21
|
+
], Xt = !1, Zt = {
|
|
22
22
|
".": {
|
|
23
23
|
types: "./dist/index.d.ts",
|
|
24
24
|
import: "./dist/tres.js",
|
|
@@ -37,12 +37,12 @@ const Wt = "@tresjs/core", Nt = "module", zt = "4.0.0-rc.2", Gt = "pnpm@8.15.6",
|
|
|
37
37
|
types: "./dist/src/utils/index.d.ts"
|
|
38
38
|
},
|
|
39
39
|
"./*": "./*"
|
|
40
|
-
},
|
|
40
|
+
}, er = "./dist/tres.js", tr = "./dist/tres.js", rr = "./dist/index.d.ts", nr = [
|
|
41
41
|
"*.d.ts",
|
|
42
42
|
"dist"
|
|
43
|
-
],
|
|
43
|
+
], or = {
|
|
44
44
|
access: "public"
|
|
45
|
-
},
|
|
45
|
+
}, sr = {
|
|
46
46
|
dev: "cd playground && npm run dev",
|
|
47
47
|
build: "vite build",
|
|
48
48
|
playground: "cd playground && npm run dev",
|
|
@@ -59,21 +59,21 @@ const Wt = "@tresjs/core", Nt = "module", zt = "4.0.0-rc.2", Gt = "pnpm@8.15.6",
|
|
|
59
59
|
"docs:preview": "vitepress preview docs",
|
|
60
60
|
"docs:contributors": "esno scripts/update-contributors.ts",
|
|
61
61
|
prepare: "node .husky/install.mjs"
|
|
62
|
-
},
|
|
62
|
+
}, ir = {
|
|
63
63
|
three: ">=0.133",
|
|
64
64
|
vue: ">=3.4"
|
|
65
|
-
},
|
|
65
|
+
}, ar = {
|
|
66
66
|
"@alvarosabu/utils": "^3.2.0",
|
|
67
67
|
"@vue/devtools-api": "^6.6.1",
|
|
68
|
-
"@vueuse/core": "^10.
|
|
69
|
-
},
|
|
68
|
+
"@vueuse/core": "^10.10.0"
|
|
69
|
+
}, lr = {
|
|
70
70
|
"@release-it/conventional-changelog": "^8.0.1",
|
|
71
71
|
"@stackblitz/sdk": "^1.10.0",
|
|
72
72
|
"@tresjs/cientos": "3.9.0",
|
|
73
73
|
"@tresjs/eslint-config": "^1.1.0",
|
|
74
74
|
"@types/three": "^0.164.1",
|
|
75
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
76
|
-
"@typescript-eslint/parser": "^7.
|
|
75
|
+
"@typescript-eslint/eslint-plugin": "^7.11.0",
|
|
76
|
+
"@typescript-eslint/parser": "^7.11.0",
|
|
77
77
|
"@vitejs/plugin-vue": "^5.0.4",
|
|
78
78
|
"@vitest/coverage-c8": "^0.33.0",
|
|
79
79
|
"@vitest/coverage-v8": "^1.6.0",
|
|
@@ -84,7 +84,7 @@ const Wt = "@tresjs/core", Nt = "module", zt = "4.0.0-rc.2", Gt = "pnpm@8.15.6",
|
|
|
84
84
|
esno: "^4.7.0",
|
|
85
85
|
gsap: "^3.12.5",
|
|
86
86
|
husky: "^9.0.11",
|
|
87
|
-
jsdom: "^24.
|
|
87
|
+
jsdom: "^24.1.0",
|
|
88
88
|
kolorist: "^1.8.0",
|
|
89
89
|
ohmyfetch: "^0.4.21",
|
|
90
90
|
pathe: "^1.1.2",
|
|
@@ -96,7 +96,7 @@ const Wt = "@tresjs/core", Nt = "module", zt = "4.0.0-rc.2", Gt = "pnpm@8.15.6",
|
|
|
96
96
|
unocss: "^0.60.3",
|
|
97
97
|
unplugin: "^1.10.1",
|
|
98
98
|
"unplugin-vue-components": "^0.27.0",
|
|
99
|
-
vite: "^5.2.
|
|
99
|
+
vite: "^5.2.12",
|
|
100
100
|
"vite-plugin-banner": "^0.7.1",
|
|
101
101
|
"vite-plugin-dts": "3.9.1",
|
|
102
102
|
"vite-plugin-inspect": "^0.8.4",
|
|
@@ -106,31 +106,31 @@ const Wt = "@tresjs/core", Nt = "module", zt = "4.0.0-rc.2", Gt = "pnpm@8.15.6",
|
|
|
106
106
|
vitest: "^1.6.0",
|
|
107
107
|
vue: "^3.4.27",
|
|
108
108
|
"vue-demi": "^0.14.7"
|
|
109
|
-
},
|
|
110
|
-
name:
|
|
111
|
-
type:
|
|
112
|
-
version:
|
|
113
|
-
packageManager:
|
|
114
|
-
description:
|
|
115
|
-
author:
|
|
116
|
-
license:
|
|
117
|
-
keywords:
|
|
118
|
-
sideEffects:
|
|
119
|
-
exports:
|
|
120
|
-
main:
|
|
121
|
-
module:
|
|
122
|
-
types:
|
|
123
|
-
files:
|
|
124
|
-
publishConfig:
|
|
125
|
-
scripts:
|
|
126
|
-
peerDependencies:
|
|
127
|
-
dependencies:
|
|
128
|
-
devDependencies:
|
|
129
|
-
},
|
|
109
|
+
}, ur = {
|
|
110
|
+
name: zt,
|
|
111
|
+
type: Gt,
|
|
112
|
+
version: Vt,
|
|
113
|
+
packageManager: qt,
|
|
114
|
+
description: Yt,
|
|
115
|
+
author: Jt,
|
|
116
|
+
license: Qt,
|
|
117
|
+
keywords: Kt,
|
|
118
|
+
sideEffects: Xt,
|
|
119
|
+
exports: Zt,
|
|
120
|
+
main: er,
|
|
121
|
+
module: tr,
|
|
122
|
+
types: rr,
|
|
123
|
+
files: nr,
|
|
124
|
+
publishConfig: or,
|
|
125
|
+
scripts: sr,
|
|
126
|
+
peerDependencies: ir,
|
|
127
|
+
dependencies: ar,
|
|
128
|
+
devDependencies: lr
|
|
129
|
+
}, cr = ({ sizes: e }) => {
|
|
130
130
|
const t = A([]), n = B(
|
|
131
131
|
() => t.value[0]
|
|
132
132
|
), o = (r) => {
|
|
133
|
-
const s = r instanceof
|
|
133
|
+
const s = r instanceof gt ? r : t.value.find((a) => a.uuid === r);
|
|
134
134
|
if (!s)
|
|
135
135
|
return;
|
|
136
136
|
const u = t.value.filter(({ uuid: a }) => a !== s.uuid);
|
|
@@ -142,7 +142,7 @@ const Wt = "@tresjs/core", Nt = "module", zt = "4.0.0-rc.2", Gt = "pnpm@8.15.6",
|
|
|
142
142
|
};
|
|
143
143
|
return ve(() => {
|
|
144
144
|
e.aspectRatio.value && t.value.forEach((r) => {
|
|
145
|
-
!r.manual && (r instanceof fe ||
|
|
145
|
+
!r.manual && (r instanceof fe || fr(r)) && (r instanceof fe ? r.aspect = e.aspectRatio.value : (r.left = e.width.value * -0.5, r.right = e.width.value * 0.5, r.top = e.height.value * 0.5, r.bottom = e.height.value * -0.5), r.updateProjectionMatrix());
|
|
146
146
|
});
|
|
147
147
|
}), N(() => {
|
|
148
148
|
t.value = [];
|
|
@@ -154,28 +154,29 @@ const Wt = "@tresjs/core", Nt = "module", zt = "4.0.0-rc.2", Gt = "pnpm@8.15.6",
|
|
|
154
154
|
setCameraActive: o
|
|
155
155
|
};
|
|
156
156
|
};
|
|
157
|
-
function
|
|
157
|
+
function fr(e) {
|
|
158
158
|
return e.hasOwnProperty("isOrthographicCamera") && e.isOrthographicCamera;
|
|
159
159
|
}
|
|
160
|
-
const
|
|
160
|
+
const Je = x(), Qe = x(), he = x(), q = new ze();
|
|
161
161
|
let ne = 0, oe = 0;
|
|
162
|
-
const { pause:
|
|
162
|
+
const { pause: dr, resume: De, isActive: pr } = Ye(
|
|
163
163
|
() => {
|
|
164
|
-
|
|
164
|
+
Je.trigger({ delta: ne, elapsed: oe, clock: q }), Qe.trigger({ delta: ne, elapsed: oe, clock: q }), he.trigger({ delta: ne, elapsed: oe, clock: q });
|
|
165
165
|
},
|
|
166
166
|
{ immediate: !1 }
|
|
167
167
|
);
|
|
168
168
|
he.on(() => {
|
|
169
169
|
ne = q.getDelta(), oe = q.getElapsedTime();
|
|
170
170
|
});
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
let Be = !1;
|
|
172
|
+
const un = () => (Be || (Be = !0, De()), {
|
|
173
|
+
onBeforeLoop: Je.on,
|
|
174
|
+
onLoop: Qe.on,
|
|
174
175
|
onAfterLoop: he.on,
|
|
175
|
-
pause:
|
|
176
|
-
resume:
|
|
177
|
-
isActive:
|
|
178
|
-
}),
|
|
176
|
+
pause: dr,
|
|
177
|
+
resume: De,
|
|
178
|
+
isActive: pr
|
|
179
|
+
}), cn = !0, K = "[TresJS ▲ ■ ●] ";
|
|
179
180
|
function $() {
|
|
180
181
|
function e(...o) {
|
|
181
182
|
typeof o[0] == "string" ? o[0] = K + o[0] : o.unshift(K), console.error(...o);
|
|
@@ -191,13 +192,13 @@ function $() {
|
|
|
191
192
|
logMessage: n
|
|
192
193
|
};
|
|
193
194
|
}
|
|
194
|
-
function
|
|
195
|
+
function fn(e) {
|
|
195
196
|
return typeof e == "number" ? [e, e, e] : e instanceof ge ? [e.x, e.y, e.z] : e;
|
|
196
197
|
}
|
|
197
|
-
function
|
|
198
|
+
function mr(e) {
|
|
198
199
|
return e instanceof re ? e : Array.isArray(e) ? new re(...e) : new re(e);
|
|
199
200
|
}
|
|
200
|
-
class
|
|
201
|
+
class vr extends Ne.Mesh {
|
|
201
202
|
constructor(...n) {
|
|
202
203
|
super(...n);
|
|
203
204
|
se(this, "type", "HightlightMesh");
|
|
@@ -209,45 +210,45 @@ class mr extends Fe.Mesh {
|
|
|
209
210
|
this.scale.set(r, r, r);
|
|
210
211
|
}
|
|
211
212
|
}
|
|
212
|
-
const
|
|
213
|
+
const Ke = (e, t) => {
|
|
213
214
|
for (const n of Object.keys(t))
|
|
214
|
-
t[n] instanceof Object && Object.assign(t[n],
|
|
215
|
+
t[n] instanceof Object && Object.assign(t[n], Ke(e[n], t[n]));
|
|
215
216
|
return Object.assign(e || {}, t), e;
|
|
216
|
-
},
|
|
217
|
-
function
|
|
217
|
+
}, gr = "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", hr = /* @__PURE__ */ wr(gr);
|
|
218
|
+
function Re(e) {
|
|
218
219
|
return e && e.nodeType === 1;
|
|
219
220
|
}
|
|
220
221
|
function X(e) {
|
|
221
222
|
return e.replace(/-([a-z])/g, (t, n) => n.toUpperCase());
|
|
222
223
|
}
|
|
223
|
-
const
|
|
224
|
-
function
|
|
225
|
-
return e.replace(
|
|
224
|
+
const yr = /\B([A-Z])/g;
|
|
225
|
+
function br(e) {
|
|
226
|
+
return e.replace(yr, "-$1").toLowerCase();
|
|
226
227
|
}
|
|
227
|
-
function
|
|
228
|
+
function wr(e, t) {
|
|
228
229
|
const n = /* @__PURE__ */ Object.create(null), o = e.split(",");
|
|
229
230
|
for (let i = 0; i < o.length; i++)
|
|
230
231
|
n[o[i]] = !0;
|
|
231
232
|
return (i) => !!n[i];
|
|
232
233
|
}
|
|
233
|
-
const
|
|
234
|
+
const Mr = (e, t) => {
|
|
234
235
|
const n = /* @__PURE__ */ new Set(), o = [];
|
|
235
236
|
for (const i of e) {
|
|
236
237
|
const l = t(i);
|
|
237
238
|
n.has(l) || (n.add(l), o.push(i));
|
|
238
239
|
}
|
|
239
240
|
return o;
|
|
240
|
-
},
|
|
241
|
+
}, je = (e, t) => {
|
|
241
242
|
if (!t)
|
|
242
243
|
return;
|
|
243
244
|
const n = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
|
|
244
245
|
return n == null ? void 0 : n.reduce((o, i) => o && o[i], e);
|
|
245
|
-
},
|
|
246
|
+
}, Pr = (e, t, n) => {
|
|
246
247
|
const o = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
|
|
247
248
|
o && o.reduce((i, l, r) => (i[l] === void 0 && (i[l] = {}), r === o.length - 1 && (i[l] = n), i[l]), e);
|
|
248
249
|
};
|
|
249
|
-
function
|
|
250
|
-
if (
|
|
250
|
+
function Xe(e, t) {
|
|
251
|
+
if (Re(e) && Re(t)) {
|
|
251
252
|
const i = e.attributes, l = t.attributes;
|
|
252
253
|
return i.length !== l.length ? !1 : Array.from(i).every(({ name: r, value: s }) => t.getAttribute(r) === s);
|
|
253
254
|
}
|
|
@@ -259,20 +260,20 @@ function Qe(e, t) {
|
|
|
259
260
|
if (n.length !== o.length)
|
|
260
261
|
return !1;
|
|
261
262
|
for (const i of n)
|
|
262
|
-
if (!o.includes(i) || !
|
|
263
|
+
if (!o.includes(i) || !Xe(e[i], t[i]))
|
|
263
264
|
return !1;
|
|
264
265
|
return !0;
|
|
265
266
|
}
|
|
266
|
-
function
|
|
267
|
+
function Cr(e, t) {
|
|
267
268
|
if (!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length)
|
|
268
269
|
return !1;
|
|
269
270
|
for (let n = 0; n < e.length; n++)
|
|
270
|
-
if (!
|
|
271
|
+
if (!Xe(e[n], t[n]))
|
|
271
272
|
return !1;
|
|
272
273
|
return !0;
|
|
273
274
|
}
|
|
274
|
-
const
|
|
275
|
-
function
|
|
275
|
+
const _r = Array.isArray;
|
|
276
|
+
function Er(e, t, n, o) {
|
|
276
277
|
const i = (u) => {
|
|
277
278
|
if (u.uuid === t)
|
|
278
279
|
return u;
|
|
@@ -297,55 +298,55 @@ function _r(e, t, n, o) {
|
|
|
297
298
|
const s = n[n.length - 1];
|
|
298
299
|
r[s] !== void 0 ? r[s] = o : console.warn(`Property path is not valid: ${n.join(".")}`);
|
|
299
300
|
}
|
|
300
|
-
function
|
|
301
|
-
const t = new
|
|
301
|
+
function kr(e) {
|
|
302
|
+
const t = new Ve({
|
|
302
303
|
color: 11003607,
|
|
303
304
|
// Highlight color, e.g., yellow
|
|
304
305
|
transparent: !0,
|
|
305
306
|
opacity: 0.2,
|
|
306
307
|
depthTest: !1,
|
|
307
308
|
// So the highlight is always visible
|
|
308
|
-
side:
|
|
309
|
+
side: ht
|
|
309
310
|
// To e
|
|
310
311
|
});
|
|
311
|
-
return new
|
|
312
|
+
return new vr(e.geometry.clone(), t);
|
|
312
313
|
}
|
|
313
|
-
function
|
|
314
|
+
function Sr(e) {
|
|
314
315
|
var n;
|
|
315
316
|
let t = e.value;
|
|
316
317
|
return e.value && ((n = e.value) != null && n.isMesh) && (t = e.value.position), Array.isArray(e.value) && (t = new ge(...t)), t;
|
|
317
318
|
}
|
|
318
|
-
function
|
|
319
|
+
function xr(e) {
|
|
319
320
|
return "map" in e;
|
|
320
321
|
}
|
|
321
|
-
function
|
|
322
|
-
|
|
322
|
+
function Ie(e) {
|
|
323
|
+
xr(e) && e.map && e.map.dispose(), e.dispose();
|
|
323
324
|
}
|
|
324
325
|
function ye(e) {
|
|
325
326
|
var n, o;
|
|
326
|
-
if (e.parent && ((n = e.removeFromParent) == null || n.call(e)), delete e.__tres, [...e.children].forEach((i) => ye(i)), !(e instanceof
|
|
327
|
+
if (e.parent && ((n = e.removeFromParent) == null || n.call(e)), delete e.__tres, [...e.children].forEach((i) => ye(i)), !(e instanceof Ge)) {
|
|
327
328
|
const i = e;
|
|
328
|
-
e && ((o = e.dispose) == null || o.call(e)), i.geometry && (i.geometry.dispose(), delete i.geometry), Array.isArray(i.material) ? (i.material.forEach((l) =>
|
|
329
|
+
e && ((o = e.dispose) == null || o.call(e)), i.geometry && (i.geometry.dispose(), delete i.geometry), Array.isArray(i.material) ? (i.material.forEach((l) => Ie(l)), delete i.material) : i.material && (Ie(i.material), delete i.material);
|
|
329
330
|
}
|
|
330
331
|
}
|
|
331
|
-
const
|
|
332
|
+
const Tr = Number.parseInt(yt.replace("dev", "")), Z = {
|
|
332
333
|
realistic: {
|
|
333
334
|
shadows: !0,
|
|
334
335
|
physicallyCorrectLights: !0,
|
|
335
|
-
outputColorSpace:
|
|
336
|
-
toneMapping:
|
|
336
|
+
outputColorSpace: bt,
|
|
337
|
+
toneMapping: qe,
|
|
337
338
|
toneMappingExposure: 3,
|
|
338
339
|
shadowMap: {
|
|
339
340
|
enabled: !0,
|
|
340
|
-
type:
|
|
341
|
+
type: wt
|
|
341
342
|
}
|
|
342
343
|
},
|
|
343
344
|
flat: {
|
|
344
|
-
toneMapping:
|
|
345
|
+
toneMapping: Mt,
|
|
345
346
|
toneMappingExposure: 1
|
|
346
347
|
}
|
|
347
348
|
};
|
|
348
|
-
function
|
|
349
|
+
function Ar({
|
|
349
350
|
canvas: e,
|
|
350
351
|
options: t,
|
|
351
352
|
contextParts: { sizes: n, render: o, invalidate: i, advance: l }
|
|
@@ -353,7 +354,7 @@ function Tr({
|
|
|
353
354
|
const r = B(() => ({
|
|
354
355
|
alpha: k(t.alpha) ?? !0,
|
|
355
356
|
depth: k(t.depth),
|
|
356
|
-
canvas:
|
|
357
|
+
canvas: Rt(e),
|
|
357
358
|
context: k(t.context),
|
|
358
359
|
stencil: k(t.stencil),
|
|
359
360
|
antialias: k(t.antialias) ?? !0,
|
|
@@ -374,7 +375,7 @@ function Tr({
|
|
|
374
375
|
}, {
|
|
375
376
|
immediate: !0
|
|
376
377
|
}), V(() => t.clearColor, u);
|
|
377
|
-
const { pixelRatio: a } =
|
|
378
|
+
const { pixelRatio: a } = jt();
|
|
378
379
|
V(a, () => {
|
|
379
380
|
s.value.setPixelRatio(a.value);
|
|
380
381
|
});
|
|
@@ -394,21 +395,21 @@ function Tr({
|
|
|
394
395
|
l();
|
|
395
396
|
}, 100), ve(() => {
|
|
396
397
|
const f = k(t.preset);
|
|
397
|
-
f && (f in Z || y(`Renderer Preset must be one of these: ${Object.keys(Z).join(", ")}`),
|
|
398
|
+
f && (f in Z || y(`Renderer Preset must be one of these: ${Object.keys(Z).join(", ")}`), Ke(s.value, Z[f])), P === "always" && (o.frames.value = Math.max(1, o.frames.value));
|
|
398
399
|
const b = (v, h) => {
|
|
399
400
|
const _ = k(v), g = () => {
|
|
400
401
|
if (f)
|
|
401
|
-
return
|
|
402
|
+
return je(Z[f], h);
|
|
402
403
|
};
|
|
403
404
|
if (_ !== void 0)
|
|
404
405
|
return _;
|
|
405
406
|
const M = g();
|
|
406
|
-
return M !== void 0 ? M :
|
|
407
|
-
}, m = (v, h) =>
|
|
408
|
-
m(t.shadows, "shadowMap.enabled"), m(t.toneMapping ??
|
|
407
|
+
return M !== void 0 ? M : je(p, h);
|
|
408
|
+
}, m = (v, h) => Pr(s.value, h, b(v, h));
|
|
409
|
+
m(t.shadows, "shadowMap.enabled"), m(t.toneMapping ?? qe, "toneMapping"), m(t.shadowMapType, "shadowMap.type"), Tr < 150 && m(!t.useLegacyLights, "physicallyCorrectLights"), m(t.outputColorSpace, "outputColorSpace"), m(t.toneMappingExposure, "toneMappingExposure");
|
|
409
410
|
const w = b(t.clearColor, "clearColor");
|
|
410
411
|
w && s.value.setClearColor(
|
|
411
|
-
w ?
|
|
412
|
+
w ? mr(w) : new re(0)
|
|
412
413
|
// default clear color is not easily/efficiently retrievable from three
|
|
413
414
|
);
|
|
414
415
|
}), N(() => {
|
|
@@ -417,14 +418,14 @@ function Tr({
|
|
|
417
418
|
renderer: s
|
|
418
419
|
};
|
|
419
420
|
}
|
|
420
|
-
const ee = (e) => typeof e == "function",
|
|
421
|
-
function
|
|
421
|
+
const ee = (e) => typeof e == "function", Or = (e) => !!e && e.constructor === Array;
|
|
422
|
+
function Lr(e) {
|
|
422
423
|
const t = { nodes: {}, materials: {} };
|
|
423
424
|
return e && e.traverse((n) => {
|
|
424
425
|
n.name && (t.nodes[n.name] = n), n.material && !t.materials[n.material.name] && (t.materials[n.material.name] = n.material);
|
|
425
426
|
}), t;
|
|
426
427
|
}
|
|
427
|
-
async function
|
|
428
|
+
async function dn(e, t, n, o, i) {
|
|
428
429
|
const { logError: l } = $(), r = new e();
|
|
429
430
|
i && i(r), n && n(r);
|
|
430
431
|
const u = (Array.isArray(t) ? t : [t]).map(
|
|
@@ -432,17 +433,17 @@ async function fn(e, t, n, o, i) {
|
|
|
432
433
|
r.load(
|
|
433
434
|
a,
|
|
434
435
|
(p) => {
|
|
435
|
-
p.scene && Object.assign(p,
|
|
436
|
+
p.scene && Object.assign(p, Lr(p.scene)), y(p);
|
|
436
437
|
},
|
|
437
438
|
o,
|
|
438
439
|
(p) => c(l("[useLoader] - Failed to load resource", p))
|
|
439
440
|
);
|
|
440
441
|
})
|
|
441
442
|
);
|
|
442
|
-
return
|
|
443
|
+
return Or(t) ? await Promise.all(u) : await u[0];
|
|
443
444
|
}
|
|
444
|
-
async function
|
|
445
|
-
const n = new
|
|
445
|
+
async function pn(e, t) {
|
|
446
|
+
const n = new Pt(t), o = (i) => new Promise((l, r) => {
|
|
446
447
|
n.load(
|
|
447
448
|
i,
|
|
448
449
|
(s) => l(s),
|
|
@@ -452,7 +453,7 @@ async function dn(e, t) {
|
|
|
452
453
|
}
|
|
453
454
|
);
|
|
454
455
|
});
|
|
455
|
-
if (
|
|
456
|
+
if (_r(e)) {
|
|
456
457
|
const i = await Promise.all(e.map((l) => o(l)));
|
|
457
458
|
return e.length > 1 ? i : i[0];
|
|
458
459
|
} else {
|
|
@@ -478,10 +479,10 @@ async function dn(e, t) {
|
|
|
478
479
|
};
|
|
479
480
|
}
|
|
480
481
|
}
|
|
481
|
-
const
|
|
482
|
-
const n = B(() => t.renderer.value.domElement), o = U([]), { x: i, y: l } =
|
|
482
|
+
const Ze = (e, t) => {
|
|
483
|
+
const n = B(() => t.renderer.value.domElement), o = U([]), { x: i, y: l } = It({ target: n });
|
|
483
484
|
let r = 0;
|
|
484
|
-
const { width: s, height: u, top: a, left: y } =
|
|
485
|
+
const { width: s, height: u, top: a, left: y } = Ht(n), c = ({ x: d, y: E }) => {
|
|
485
486
|
if (n.value)
|
|
486
487
|
return {
|
|
487
488
|
x: (d - y.value) / s.value * 2 - 1,
|
|
@@ -557,7 +558,7 @@ const Ke = (e, t) => {
|
|
|
557
558
|
forceUpdate: T
|
|
558
559
|
};
|
|
559
560
|
};
|
|
560
|
-
function
|
|
561
|
+
function mn() {
|
|
561
562
|
const { logWarning: e } = $();
|
|
562
563
|
function t(l, r, s) {
|
|
563
564
|
let u = null;
|
|
@@ -584,8 +585,8 @@ function pn() {
|
|
|
584
585
|
seekAllByName: i
|
|
585
586
|
};
|
|
586
587
|
}
|
|
587
|
-
const
|
|
588
|
-
const t =
|
|
588
|
+
const vn = (e) => {
|
|
589
|
+
const t = We({
|
|
589
590
|
click: /* @__PURE__ */ new Map(),
|
|
590
591
|
pointerMove: /* @__PURE__ */ new Map(),
|
|
591
592
|
pointerEnter: /* @__PURE__ */ new Map(),
|
|
@@ -600,7 +601,7 @@ const mn = (e) => {
|
|
|
600
601
|
const { onClick: p, onPointerMove: P, onPointerEnter: f, onPointerLeave: b } = c;
|
|
601
602
|
p && t.click.set(c, p), P && t.pointerMove.set(c, P), f && t.pointerEnter.set(c, f), b && t.pointerLeave.set(c, b);
|
|
602
603
|
}, s = B(
|
|
603
|
-
() =>
|
|
604
|
+
() => Mr(
|
|
604
605
|
[
|
|
605
606
|
...Array.from(n.value),
|
|
606
607
|
...Object.values(t).map((c) => Array.from(c.keys())).flat()
|
|
@@ -609,7 +610,7 @@ const mn = (e) => {
|
|
|
609
610
|
)
|
|
610
611
|
);
|
|
611
612
|
e.registerObjectAtPointerEventHandler = r, e.deregisterObjectAtPointerEventHandler = l, e.registerBlockingObjectAtPointerEventHandler = o, e.deregisterBlockingObjectAtPointerEventHandler = i;
|
|
612
|
-
const { onClick: u, onPointerMove: a } =
|
|
613
|
+
const { onClick: u, onPointerMove: a } = Ze(s, e);
|
|
613
614
|
u(({ intersects: c, event: p }) => {
|
|
614
615
|
var P;
|
|
615
616
|
c.length && ((P = t.click.get(c[0].object)) == null || P(c[0], p));
|
|
@@ -635,12 +636,12 @@ function be(e) {
|
|
|
635
636
|
}
|
|
636
637
|
}), t;
|
|
637
638
|
}
|
|
638
|
-
function
|
|
639
|
+
function Dr(e) {
|
|
639
640
|
return (e / 1024).toFixed(2);
|
|
640
641
|
}
|
|
641
642
|
const de = A({}), pe = (e) => Object.assign(de.value, e);
|
|
642
|
-
function
|
|
643
|
-
const o = k(e) ?
|
|
643
|
+
function Br(e, t, n = 10) {
|
|
644
|
+
const o = k(e) ? Ut() : $t(B(() => k(t).parentElement)), i = ue(Le(o.width, n)), l = ue(Le(o.height, n)), r = B(() => i.value / l.value);
|
|
644
645
|
return {
|
|
645
646
|
height: l,
|
|
646
647
|
width: i,
|
|
@@ -662,7 +663,7 @@ function le() {
|
|
|
662
663
|
return { on: (a, y = 0) => {
|
|
663
664
|
e.set(a, { priority: y, addI: n++ });
|
|
664
665
|
const c = () => l(a);
|
|
665
|
-
return
|
|
666
|
+
return Ft(c), o = !0, {
|
|
666
667
|
off: c
|
|
667
668
|
};
|
|
668
669
|
}, off: l, trigger: (...a) => {
|
|
@@ -673,10 +674,10 @@ function le() {
|
|
|
673
674
|
return e.size;
|
|
674
675
|
} };
|
|
675
676
|
}
|
|
676
|
-
function
|
|
677
|
-
const e = new
|
|
677
|
+
function Rr() {
|
|
678
|
+
const e = new ze(!1), t = A(!1), n = A(!1);
|
|
678
679
|
let o;
|
|
679
|
-
const i =
|
|
680
|
+
const i = Ct.generateUUID();
|
|
680
681
|
let l = null;
|
|
681
682
|
const r = le(), s = le(), u = le();
|
|
682
683
|
let a = {};
|
|
@@ -737,7 +738,7 @@ function Br() {
|
|
|
737
738
|
setContext: y
|
|
738
739
|
};
|
|
739
740
|
}
|
|
740
|
-
function
|
|
741
|
+
function jr({
|
|
741
742
|
scene: e,
|
|
742
743
|
canvas: t,
|
|
743
744
|
windowSize: n,
|
|
@@ -745,13 +746,13 @@ function Rr({
|
|
|
745
746
|
rendererOptions: i,
|
|
746
747
|
emit: l
|
|
747
748
|
}) {
|
|
748
|
-
const { logWarning: r } = $(), s = U(e), u =
|
|
749
|
+
const { logWarning: r } = $(), s = U(e), u = Br(n, t), {
|
|
749
750
|
camera: a,
|
|
750
751
|
cameras: y,
|
|
751
752
|
registerCamera: c,
|
|
752
753
|
deregisterCamera: p,
|
|
753
754
|
setCameraActive: P
|
|
754
|
-
} =
|
|
755
|
+
} = cr({ sizes: u, scene: e }), f = {
|
|
755
756
|
mode: A(i.renderMode || "always"),
|
|
756
757
|
priority: A(0),
|
|
757
758
|
frames: A(0),
|
|
@@ -764,7 +765,7 @@ function Rr({
|
|
|
764
765
|
function m() {
|
|
765
766
|
i.renderMode === "manual" ? f.frames.value = 1 : r("`advance` can only be used when `renderMode` is set to `manual`");
|
|
766
767
|
}
|
|
767
|
-
const { renderer: w } =
|
|
768
|
+
const { renderer: w } = Ar(
|
|
768
769
|
{
|
|
769
770
|
scene: e,
|
|
770
771
|
canvas: t,
|
|
@@ -780,7 +781,7 @@ function Rr({
|
|
|
780
781
|
camera: a,
|
|
781
782
|
cameras: ue(y),
|
|
782
783
|
renderer: w,
|
|
783
|
-
raycaster: U(new
|
|
784
|
+
raycaster: U(new _t()),
|
|
784
785
|
controls: A(null),
|
|
785
786
|
perf: {
|
|
786
787
|
maxFrames: 160,
|
|
@@ -801,7 +802,7 @@ function Rr({
|
|
|
801
802
|
registerCamera: c,
|
|
802
803
|
setCameraActive: P,
|
|
803
804
|
deregisterCamera: p,
|
|
804
|
-
loop:
|
|
805
|
+
loop: Rr()
|
|
805
806
|
};
|
|
806
807
|
ce("useTres", v), v.scene.value.__tres = {
|
|
807
808
|
root: v
|
|
@@ -810,27 +811,27 @@ function Rr({
|
|
|
810
811
|
}, "render"), v.loop.start(), N(() => {
|
|
811
812
|
v.loop.stop();
|
|
812
813
|
});
|
|
813
|
-
const h = 100, _ =
|
|
814
|
+
const h = 100, _ = Wt({ every: h }), { isSupported: g, memory: M } = Nt({ interval: h }), C = 160;
|
|
814
815
|
let R = performance.now();
|
|
815
816
|
const O = ({ timestamp: L }) => {
|
|
816
817
|
v.scene.value && (v.perf.memory.allocatedMem = be(v.scene.value)), L - R >= h && (R = L, v.perf.fps.accumulator.push(_.value), v.perf.fps.accumulator.length > C && v.perf.fps.accumulator.shift(), v.perf.fps.value = _.value, g.value && M.value && (v.perf.memory.accumulator.push(M.value.usedJSHeapSize / 1024 / 1024), v.perf.memory.accumulator.length > C && v.perf.memory.accumulator.shift(), v.perf.memory.currentMem = v.perf.memory.accumulator.reduce((Y, z) => Y + z, 0) / v.perf.memory.accumulator.length));
|
|
817
818
|
};
|
|
818
819
|
let T = 0;
|
|
819
|
-
const S = 1, { pause: j } =
|
|
820
|
+
const S = 1, { pause: j } = Ye(({ delta: L }) => {
|
|
820
821
|
window.__TRES__DEVTOOLS__ && (O({ timestamp: performance.now() }), T += L, T >= S && (window.__TRES__DEVTOOLS__.cb(v), T = 0));
|
|
821
822
|
}, { immediate: !0 });
|
|
822
823
|
return N(() => {
|
|
823
824
|
j();
|
|
824
825
|
}), v;
|
|
825
826
|
}
|
|
826
|
-
function
|
|
827
|
-
const e =
|
|
827
|
+
function et() {
|
|
828
|
+
const e = at("useTres");
|
|
828
829
|
if (!e)
|
|
829
830
|
throw new Error("useTresContext must be used together with useTresContextProvider");
|
|
830
831
|
return e;
|
|
831
832
|
}
|
|
832
|
-
const
|
|
833
|
-
function
|
|
833
|
+
const gn = et;
|
|
834
|
+
function hn() {
|
|
834
835
|
const {
|
|
835
836
|
camera: e,
|
|
836
837
|
scene: t,
|
|
@@ -840,7 +841,7 @@ function gn() {
|
|
|
840
841
|
controls: l,
|
|
841
842
|
invalidate: r,
|
|
842
843
|
advance: s
|
|
843
|
-
} =
|
|
844
|
+
} = et();
|
|
844
845
|
o.setContext({
|
|
845
846
|
camera: e,
|
|
846
847
|
scene: t,
|
|
@@ -870,7 +871,7 @@ function gn() {
|
|
|
870
871
|
onAfterRender: y
|
|
871
872
|
};
|
|
872
873
|
}
|
|
873
|
-
function
|
|
874
|
+
function Ir(e, t, n) {
|
|
874
875
|
const o = U(), i = U();
|
|
875
876
|
e && (o.value = e), t && (i.value = t);
|
|
876
877
|
const l = B(
|
|
@@ -894,7 +895,7 @@ function jr(e, t, n) {
|
|
|
894
895
|
let S = T.parent;
|
|
895
896
|
for (; S !== null && !M.stopPropagating && !C.includes(S); )
|
|
896
897
|
M.eventObject = S, r(S[g], M), C.push(S), S = S.parent;
|
|
897
|
-
const j =
|
|
898
|
+
const j = br(g.slice(2));
|
|
898
899
|
n(j, { intersection: O, event: M });
|
|
899
900
|
}
|
|
900
901
|
}
|
|
@@ -908,7 +909,7 @@ function jr(e, t, n) {
|
|
|
908
909
|
onPointerMissed: f,
|
|
909
910
|
onWheel: b,
|
|
910
911
|
forceUpdate: m
|
|
911
|
-
} =
|
|
912
|
+
} = Ze(l, t);
|
|
912
913
|
P((g) => s("onPointerUp", g)), p((g) => s("onPointerDown", g)), u((g) => s("onClick", g)), a((g) => s("onDoubleClick", g)), y((g) => s("onContextMenu", g)), b((g) => s("onWheel", g));
|
|
913
914
|
let w = [];
|
|
914
915
|
c((g) => {
|
|
@@ -939,7 +940,7 @@ function jr(e, t, n) {
|
|
|
939
940
|
deregisterPointerMissedObject: _
|
|
940
941
|
}, { forceUpdate: m, registerPointerMissedObject: h, deregisterPointerMissedObject: _ };
|
|
941
942
|
}
|
|
942
|
-
const { logError:
|
|
943
|
+
const { logError: He } = $(), Hr = [
|
|
943
944
|
"onClick",
|
|
944
945
|
"onContextMenu",
|
|
945
946
|
"onPointerMove",
|
|
@@ -955,24 +956,24 @@ const { logError: je } = $(), Ir = [
|
|
|
955
956
|
"onLostPointerCapture",
|
|
956
957
|
"onWheel"
|
|
957
958
|
];
|
|
958
|
-
function
|
|
959
|
+
function Ue(e) {
|
|
959
960
|
var n;
|
|
960
961
|
const t = (n = e == null ? void 0 : e.__tres) == null ? void 0 : n.root;
|
|
961
962
|
t && t.render && t.render.canBeInvalidated.value && t.invalidate();
|
|
962
963
|
}
|
|
963
|
-
const
|
|
964
|
+
const Ur = () => {
|
|
964
965
|
let e = null;
|
|
965
966
|
function t(r, s, u, a) {
|
|
966
|
-
if (a || (a = {}), a.args || (a.args = []), r === "template" ||
|
|
967
|
+
if (a || (a = {}), a.args || (a.args = []), r === "template" || hr(r))
|
|
967
968
|
return null;
|
|
968
969
|
let y = r.replace("Tres", ""), c;
|
|
969
970
|
if (r === "primitive") {
|
|
970
|
-
(a == null ? void 0 : a.object) === void 0 &&
|
|
971
|
+
(a == null ? void 0 : a.object) === void 0 && He("Tres primitives need a prop 'object'");
|
|
971
972
|
const p = a.object;
|
|
972
973
|
y = p.type, c = Object.assign(p.clone(), { type: y });
|
|
973
974
|
} else {
|
|
974
975
|
const p = de.value[y];
|
|
975
|
-
p ||
|
|
976
|
+
p || He(
|
|
976
977
|
`${y} is not defined on the THREE namespace. Use extend to add it to the catalog.`
|
|
977
978
|
), c = new p(...a.args);
|
|
978
979
|
}
|
|
@@ -1011,7 +1012,7 @@ const Hr = () => {
|
|
|
1011
1012
|
(u = r.removeFromParent) == null || u.call(r), r.traverse((f) => {
|
|
1012
1013
|
var b, m;
|
|
1013
1014
|
p(f), f.onPointerMissed && ((m = (b = s == null ? void 0 : s.root) == null ? void 0 : b.eventManager) == null || m.deregisterPointerMissedObject(f));
|
|
1014
|
-
}), p(r),
|
|
1015
|
+
}), p(r), Ue(r), !((a = r.__tres) == null ? void 0 : a.primitive) && ((y = r.__tres) != null && y.disposable) && ye(r), (c = r.dispose) == null || c.call(r);
|
|
1015
1016
|
}
|
|
1016
1017
|
}
|
|
1017
1018
|
function i(r, s, u, a) {
|
|
@@ -1037,7 +1038,7 @@ const Hr = () => {
|
|
|
1037
1038
|
let f = X(P), b = p == null ? void 0 : p[f];
|
|
1038
1039
|
if (P === "args") {
|
|
1039
1040
|
const w = r, v = u ?? [], h = a ?? [], _ = ((c = r == null ? void 0 : r.__tres) == null ? void 0 : c.type) || r.type;
|
|
1040
|
-
_ && v.length && !
|
|
1041
|
+
_ && v.length && !Cr(v, h) && (p = Object.assign(
|
|
1041
1042
|
w,
|
|
1042
1043
|
new de.value[_](...a)
|
|
1043
1044
|
));
|
|
@@ -1048,7 +1049,7 @@ const Hr = () => {
|
|
|
1048
1049
|
return;
|
|
1049
1050
|
p.setAttribute(
|
|
1050
1051
|
X(P),
|
|
1051
|
-
new
|
|
1052
|
+
new Et(...a)
|
|
1052
1053
|
);
|
|
1053
1054
|
return;
|
|
1054
1055
|
}
|
|
@@ -1058,10 +1059,10 @@ const Hr = () => {
|
|
|
1058
1059
|
}
|
|
1059
1060
|
let m = a;
|
|
1060
1061
|
if (m === "" && (m = !0), ee(b)) {
|
|
1061
|
-
|
|
1062
|
+
Hr.includes(s) || (Array.isArray(m) ? r[f](...m) : r[f](m)), f.startsWith("on") && ee(m) && (p[f] = m);
|
|
1062
1063
|
return;
|
|
1063
1064
|
}
|
|
1064
|
-
!(b != null && b.set) && !ee(b) ? p[f] = m : b.constructor === m.constructor && (b != null && b.copy) ? b == null || b.copy(m) : Array.isArray(m) ? b.set(...m) : !b.isColor && b.setScalar ? b.setScalar(m) : b.set(m),
|
|
1065
|
+
!(b != null && b.set) && !ee(b) ? p[f] = m : b.constructor === m.constructor && (b != null && b.copy) ? b == null || b.copy(m) : Array.isArray(m) ? b.set(...m) : !b.isColor && b.setScalar ? b.setScalar(m) : b.set(m), Ue(r);
|
|
1065
1066
|
}
|
|
1066
1067
|
}
|
|
1067
1068
|
function l(r) {
|
|
@@ -1084,22 +1085,22 @@ const Hr = () => {
|
|
|
1084
1085
|
insertStaticContent: () => void 0
|
|
1085
1086
|
};
|
|
1086
1087
|
};
|
|
1087
|
-
function
|
|
1088
|
-
return
|
|
1088
|
+
function $r() {
|
|
1089
|
+
return tt().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
|
1089
1090
|
}
|
|
1090
|
-
function
|
|
1091
|
+
function tt() {
|
|
1091
1092
|
return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
|
|
1092
1093
|
}
|
|
1093
|
-
const
|
|
1094
|
+
const Fr = typeof Proxy == "function", Wr = "devtools-plugin:setup", Nr = "plugin:settings:set";
|
|
1094
1095
|
let F, me;
|
|
1095
|
-
function
|
|
1096
|
+
function zr() {
|
|
1096
1097
|
var e;
|
|
1097
1098
|
return F !== void 0 || (typeof window < "u" && window.performance ? (F = !0, me = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (F = !0, me = globalThis.perf_hooks.performance) : F = !1), F;
|
|
1098
1099
|
}
|
|
1099
|
-
function
|
|
1100
|
-
return
|
|
1100
|
+
function Gr() {
|
|
1101
|
+
return zr() ? me.now() : Date.now();
|
|
1101
1102
|
}
|
|
1102
|
-
class
|
|
1103
|
+
class Vr {
|
|
1103
1104
|
constructor(t, n) {
|
|
1104
1105
|
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
|
|
1105
1106
|
const o = {};
|
|
@@ -1127,9 +1128,9 @@ class Gr {
|
|
|
1127
1128
|
l = r;
|
|
1128
1129
|
},
|
|
1129
1130
|
now() {
|
|
1130
|
-
return
|
|
1131
|
+
return Gr();
|
|
1131
1132
|
}
|
|
1132
|
-
}, n && n.on(
|
|
1133
|
+
}, n && n.on(Nr, (r, s) => {
|
|
1133
1134
|
r === this.plugin.id && this.fallbacks.setSettings(s);
|
|
1134
1135
|
}), this.proxiedOn = new Proxy({}, {
|
|
1135
1136
|
get: (r, s) => this.target ? this.target.on[s] : (...u) => {
|
|
@@ -1161,12 +1162,12 @@ class Gr {
|
|
|
1161
1162
|
n.resolve(await this.target[n.method](...n.args));
|
|
1162
1163
|
}
|
|
1163
1164
|
}
|
|
1164
|
-
function
|
|
1165
|
-
const n = e, o =
|
|
1165
|
+
function qr(e, t) {
|
|
1166
|
+
const n = e, o = tt(), i = $r(), l = Fr && n.enableEarlyProxy;
|
|
1166
1167
|
if (i && (o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !l))
|
|
1167
|
-
i.emit(
|
|
1168
|
+
i.emit(Wr, e, t);
|
|
1168
1169
|
else {
|
|
1169
|
-
const r = l ? new
|
|
1170
|
+
const r = l ? new Vr(n, i) : null;
|
|
1170
1171
|
(o.__VUE_DEVTOOLS_PLUGINS__ = o.__VUE_DEVTOOLS_PLUGINS__ || []).push({
|
|
1171
1172
|
pluginDescriptor: n,
|
|
1172
1173
|
setupFn: t,
|
|
@@ -1174,14 +1175,14 @@ function Vr(e, t) {
|
|
|
1174
1175
|
}), r && t(r.proxiedTarget);
|
|
1175
1176
|
}
|
|
1176
1177
|
}
|
|
1177
|
-
function
|
|
1178
|
+
function Yr(e, t) {
|
|
1178
1179
|
const n = `▲ ■ ●${e}`;
|
|
1179
|
-
typeof
|
|
1180
|
+
typeof $e == "function" ? $e(n, t) : console.log(n);
|
|
1180
1181
|
}
|
|
1181
|
-
function
|
|
1182
|
+
function $e(e, t) {
|
|
1182
1183
|
throw new Error(e + t);
|
|
1183
1184
|
}
|
|
1184
|
-
const
|
|
1185
|
+
const rt = (e) => {
|
|
1185
1186
|
const t = {
|
|
1186
1187
|
id: e.uuid,
|
|
1187
1188
|
label: e.type,
|
|
@@ -1195,7 +1196,7 @@ const et = (e) => {
|
|
|
1195
1196
|
});
|
|
1196
1197
|
const n = be(e);
|
|
1197
1198
|
return n > 0 && t.tags.push({
|
|
1198
|
-
label: `${
|
|
1199
|
+
label: `${Dr(n)} KB`,
|
|
1199
1200
|
textColor: 15707189,
|
|
1200
1201
|
backgroundColor: 16775644,
|
|
1201
1202
|
tooltip: "Memory usage"
|
|
@@ -1221,30 +1222,30 @@ const et = (e) => {
|
|
|
1221
1222
|
tooltip: "Position"
|
|
1222
1223
|
})), t;
|
|
1223
1224
|
};
|
|
1224
|
-
function
|
|
1225
|
+
function nt(e, t, n = "") {
|
|
1225
1226
|
e.children.forEach((o) => {
|
|
1226
1227
|
if (o.type === "HightlightMesh" || n && !o.type.includes(n) && !o.name.includes(n))
|
|
1227
1228
|
return;
|
|
1228
|
-
const i =
|
|
1229
|
-
t.children.push(i),
|
|
1229
|
+
const i = rt(o);
|
|
1230
|
+
t.children.push(i), nt(o, i, n);
|
|
1230
1231
|
});
|
|
1231
1232
|
}
|
|
1232
|
-
const
|
|
1233
|
+
const Jr = [], G = "tres:inspector", Qr = We({
|
|
1233
1234
|
sceneGraph: null
|
|
1234
1235
|
});
|
|
1235
|
-
function
|
|
1236
|
-
|
|
1236
|
+
function Kr(e, t) {
|
|
1237
|
+
qr(
|
|
1237
1238
|
{
|
|
1238
1239
|
id: "dev.esm.tres",
|
|
1239
1240
|
label: "TresJS 🪐",
|
|
1240
1241
|
logo: "https://raw.githubusercontent.com/Tresjs/tres/main/public/favicon.svg",
|
|
1241
1242
|
packageName: "tresjs",
|
|
1242
1243
|
homepage: "https://tresjs.org",
|
|
1243
|
-
componentStateTypes:
|
|
1244
|
+
componentStateTypes: Jr,
|
|
1244
1245
|
app: e
|
|
1245
1246
|
},
|
|
1246
1247
|
(n) => {
|
|
1247
|
-
typeof n.now != "function" &&
|
|
1248
|
+
typeof n.now != "function" && Yr(
|
|
1248
1249
|
"You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html."
|
|
1249
1250
|
), n.addInspector({
|
|
1250
1251
|
id: G,
|
|
@@ -1257,8 +1258,8 @@ function Qr(e, t) {
|
|
|
1257
1258
|
n.notifyComponentUpdate();
|
|
1258
1259
|
}, 5e3), n.on.getInspectorTree((l) => {
|
|
1259
1260
|
if (l.inspectorId === G) {
|
|
1260
|
-
const r =
|
|
1261
|
-
|
|
1261
|
+
const r = rt(t.scene.value);
|
|
1262
|
+
nt(t.scene.value, r, l.filter), Qr.sceneGraph = r, l.rootNodes = [r];
|
|
1262
1263
|
}
|
|
1263
1264
|
});
|
|
1264
1265
|
let o = null, i = null;
|
|
@@ -1269,7 +1270,7 @@ function Qr(e, t) {
|
|
|
1269
1270
|
if (!s)
|
|
1270
1271
|
return;
|
|
1271
1272
|
if (i && o && o.parent && i.remove(o), s.isMesh) {
|
|
1272
|
-
const u =
|
|
1273
|
+
const u = kr(s);
|
|
1273
1274
|
s.add(u), o = u, i = s;
|
|
1274
1275
|
}
|
|
1275
1276
|
l.state = {
|
|
@@ -1375,12 +1376,12 @@ function Qr(e, t) {
|
|
|
1375
1376
|
}))) || []);
|
|
1376
1377
|
}
|
|
1377
1378
|
}), n.on.editInspectorState((l) => {
|
|
1378
|
-
l.inspectorId === G &&
|
|
1379
|
+
l.inspectorId === G && Er(t.scene.value, l.nodeId, l.path, l.state.value);
|
|
1379
1380
|
});
|
|
1380
1381
|
}
|
|
1381
1382
|
);
|
|
1382
1383
|
}
|
|
1383
|
-
const
|
|
1384
|
+
const Xr = ["data-scene", "data-tres"], Zr = /* @__PURE__ */ Se({
|
|
1384
1385
|
__name: "TresCanvas",
|
|
1385
1386
|
props: {
|
|
1386
1387
|
shadows: { type: Boolean, default: void 0 },
|
|
@@ -1424,32 +1425,32 @@ const Kr = ["data-scene", "data-tres"], Xr = /* @__PURE__ */ Se({
|
|
|
1424
1425
|
],
|
|
1425
1426
|
setup(e, { expose: t, emit: n }) {
|
|
1426
1427
|
var b;
|
|
1427
|
-
const o = e, i = n, l =
|
|
1428
|
-
pe(
|
|
1428
|
+
const o = e, i = n, l = lt(), { logWarning: r } = $(), s = A(), u = U(new Ge()), a = (b = xe()) == null ? void 0 : b.appContext.app;
|
|
1429
|
+
pe(Ne);
|
|
1429
1430
|
const y = (m) => Se({
|
|
1430
1431
|
setup() {
|
|
1431
1432
|
var v;
|
|
1432
1433
|
const w = (v = xe()) == null ? void 0 : v.appContext;
|
|
1433
|
-
return w && (w.app = a), ce("useTres", m), ce("extend", pe), typeof window < "u" &&
|
|
1434
|
+
return w && (w.app = a), ce("useTres", m), ce("extend", pe), typeof window < "u" && Kr(w == null ? void 0 : w.app, m), () => Te(vt, null, l != null && l.default ? l.default() : []);
|
|
1434
1435
|
}
|
|
1435
1436
|
}), c = (m) => {
|
|
1436
|
-
const w = y(m), { render: v } =
|
|
1437
|
+
const w = y(m), { render: v } = mt(Ur());
|
|
1437
1438
|
v(Te(w), u.value);
|
|
1438
1439
|
}, p = (m, w = !1) => {
|
|
1439
1440
|
ye(m.scene.value), w && (m.renderer.value.dispose(), m.renderer.value.renderLists.dispose(), m.renderer.value.forceContextLoss()), u.value.__tres = {
|
|
1440
1441
|
root: m
|
|
1441
1442
|
}, c(m);
|
|
1442
1443
|
}, P = B(() => o.disableRender), f = U(null);
|
|
1443
|
-
return t({ context: f, dispose: () => p(f.value, !0) }),
|
|
1444
|
+
return t({ context: f, dispose: () => p(f.value, !0) }), ut(() => {
|
|
1444
1445
|
const m = s;
|
|
1445
|
-
f.value =
|
|
1446
|
+
f.value = jr({
|
|
1446
1447
|
scene: u.value,
|
|
1447
1448
|
canvas: m,
|
|
1448
1449
|
windowSize: o.windowSize ?? !1,
|
|
1449
1450
|
disableRender: P.value ?? !1,
|
|
1450
1451
|
rendererOptions: o,
|
|
1451
1452
|
emit: i
|
|
1452
|
-
}),
|
|
1453
|
+
}), Ir(u.value, f.value, i);
|
|
1453
1454
|
const { registerCamera: w, camera: v, cameras: h, deregisterCamera: _ } = f.value;
|
|
1454
1455
|
c(f.value);
|
|
1455
1456
|
const g = () => {
|
|
@@ -1477,13 +1478,13 @@ const Kr = ["data-scene", "data-tres"], Xr = /* @__PURE__ */ Se({
|
|
|
1477
1478
|
), g());
|
|
1478
1479
|
}), N(() => {
|
|
1479
1480
|
p(f.value);
|
|
1480
|
-
}), (m, w) => (
|
|
1481
|
+
}), (m, w) => (ct(), ft("canvas", {
|
|
1481
1482
|
ref_key: "canvas",
|
|
1482
1483
|
ref: s,
|
|
1483
1484
|
"data-scene": u.value.uuid,
|
|
1484
|
-
class:
|
|
1485
|
-
"data-tres": `tresjs ${W(
|
|
1486
|
-
style:
|
|
1485
|
+
class: dt(m.$attrs.class),
|
|
1486
|
+
"data-tres": `tresjs ${W(ur).version}`,
|
|
1487
|
+
style: pt({
|
|
1487
1488
|
display: "block",
|
|
1488
1489
|
width: "100%",
|
|
1489
1490
|
height: "100%",
|
|
@@ -1494,19 +1495,19 @@ const Kr = ["data-scene", "data-tres"], Xr = /* @__PURE__ */ Se({
|
|
|
1494
1495
|
touchAction: "none",
|
|
1495
1496
|
...m.$attrs.style
|
|
1496
1497
|
})
|
|
1497
|
-
}, null, 14,
|
|
1498
|
+
}, null, 14, Xr));
|
|
1498
1499
|
}
|
|
1499
|
-
}),
|
|
1500
|
+
}), en = [
|
|
1500
1501
|
"TresCanvas",
|
|
1501
1502
|
"TresLeches",
|
|
1502
1503
|
"TresScene"
|
|
1503
|
-
],
|
|
1504
|
+
], tn = {
|
|
1504
1505
|
template: {
|
|
1505
1506
|
compilerOptions: {
|
|
1506
|
-
isCustomElement: (e) => e.startsWith("Tres") && !
|
|
1507
|
+
isCustomElement: (e) => e.startsWith("Tres") && !en.includes(e) || e === "primitive"
|
|
1507
1508
|
}
|
|
1508
1509
|
}
|
|
1509
|
-
},
|
|
1510
|
+
}, yn = tn, bn = {
|
|
1510
1511
|
mounted: (e, t) => {
|
|
1511
1512
|
if (t.arg) {
|
|
1512
1513
|
console.log(`v-log:${t.arg}`, e[t.arg]);
|
|
@@ -1515,14 +1516,14 @@ const Kr = ["data-scene", "data-tres"], Xr = /* @__PURE__ */ Se({
|
|
|
1515
1516
|
console.log("v-log", e);
|
|
1516
1517
|
}
|
|
1517
1518
|
};
|
|
1518
|
-
class
|
|
1519
|
+
class ot extends kt {
|
|
1519
1520
|
constructor(t, n) {
|
|
1520
1521
|
const o = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], i = new Ae();
|
|
1521
1522
|
i.setAttribute("position", new Oe(o, 3)), i.computeBoundingSphere();
|
|
1522
|
-
const l = new
|
|
1523
|
+
const l = new St({ fog: !1 });
|
|
1523
1524
|
super(i, l), this.light = t, this.color = n, this.type = "RectAreaLightHelper";
|
|
1524
1525
|
const r = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], s = new Ae();
|
|
1525
|
-
s.setAttribute("position", new Oe(r, 3)), s.computeBoundingSphere(), this.add(new
|
|
1526
|
+
s.setAttribute("position", new Oe(r, 3)), s.computeBoundingSphere(), this.add(new xt(s, new Ve({ side: Tt, fog: !1 })));
|
|
1526
1527
|
}
|
|
1527
1528
|
updateMatrixWorld() {
|
|
1528
1529
|
if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
|
|
@@ -1538,45 +1539,45 @@ class rt extends _t {
|
|
|
1538
1539
|
this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
|
|
1539
1540
|
}
|
|
1540
1541
|
}
|
|
1541
|
-
const { logWarning:
|
|
1542
|
+
const { logWarning: Fe } = $();
|
|
1542
1543
|
let te, H;
|
|
1543
|
-
const
|
|
1544
|
-
DirectionalLight:
|
|
1545
|
-
PointLight:
|
|
1546
|
-
SpotLight:
|
|
1547
|
-
HemisphereLight:
|
|
1548
|
-
RectAreaLight:
|
|
1549
|
-
},
|
|
1544
|
+
const rn = {
|
|
1545
|
+
DirectionalLight: At,
|
|
1546
|
+
PointLight: Ot,
|
|
1547
|
+
SpotLight: Lt,
|
|
1548
|
+
HemisphereLight: Dt,
|
|
1549
|
+
RectAreaLight: ot
|
|
1550
|
+
}, wn = {
|
|
1550
1551
|
mounted: (e) => {
|
|
1551
1552
|
if (!e.isLight) {
|
|
1552
|
-
|
|
1553
|
+
Fe(`${e.type} is not a light`);
|
|
1553
1554
|
return;
|
|
1554
1555
|
}
|
|
1555
|
-
te =
|
|
1556
|
+
te = rn[e.type], e.parent.add(new te(e, 1, e.color.getHex()));
|
|
1556
1557
|
},
|
|
1557
1558
|
updated: (e) => {
|
|
1558
|
-
H = e.parent.children.find((t) => t instanceof te), !(H instanceof
|
|
1559
|
+
H = e.parent.children.find((t) => t instanceof te), !(H instanceof ot) && H.update();
|
|
1559
1560
|
},
|
|
1560
1561
|
unmounted: (e) => {
|
|
1561
1562
|
if (!e.isLight) {
|
|
1562
|
-
|
|
1563
|
+
Fe(`${e.type} is not a light`);
|
|
1563
1564
|
return;
|
|
1564
1565
|
}
|
|
1565
1566
|
H = e.parent.children.find((t) => t instanceof te), H && H.dispose && H.dispose(), e.parent.remove(H);
|
|
1566
1567
|
}
|
|
1567
|
-
}, { logWarning:
|
|
1568
|
+
}, { logWarning: nn } = $();
|
|
1568
1569
|
let D = null;
|
|
1569
|
-
const
|
|
1570
|
+
const Mn = {
|
|
1570
1571
|
updated: (e, t) => {
|
|
1571
1572
|
var i;
|
|
1572
|
-
const n =
|
|
1573
|
+
const n = Sr(t);
|
|
1573
1574
|
if (!n) {
|
|
1574
|
-
|
|
1575
|
+
nn(`v-distance-to: problem with binding value: ${t.value}`);
|
|
1575
1576
|
return;
|
|
1576
1577
|
}
|
|
1577
1578
|
D && (D.dispose(), e.parent.remove(D));
|
|
1578
1579
|
const o = n.clone().sub(e.position);
|
|
1579
|
-
o.normalize(), D = new
|
|
1580
|
+
o.normalize(), D = new Bt(o, e.position, e.position.distanceTo(n), 16776960), e.parent.add(D), console.table(
|
|
1580
1581
|
[
|
|
1581
1582
|
["Distance:", e.position.distanceTo(n)],
|
|
1582
1583
|
[`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(i = e.position) == null ? void 0 : i.z}`],
|
|
@@ -1587,38 +1588,38 @@ const wn = {
|
|
|
1587
1588
|
unmounted: (e) => {
|
|
1588
1589
|
D == null || D.dispose(), e.parent.remove(D);
|
|
1589
1590
|
}
|
|
1590
|
-
},
|
|
1591
|
+
}, Pn = {
|
|
1591
1592
|
install(e) {
|
|
1592
|
-
e.component("TresCanvas",
|
|
1593
|
+
e.component("TresCanvas", Zr);
|
|
1593
1594
|
}
|
|
1594
1595
|
};
|
|
1595
1596
|
export {
|
|
1596
|
-
|
|
1597
|
+
Zr as TresCanvas,
|
|
1597
1598
|
de as catalogue,
|
|
1598
|
-
|
|
1599
|
-
|
|
1599
|
+
Rr as createRenderLoop,
|
|
1600
|
+
Pn as default,
|
|
1600
1601
|
ye as dispose,
|
|
1601
1602
|
pe as extend,
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1603
|
+
cn as isProd,
|
|
1604
|
+
mr as normalizeColor,
|
|
1605
|
+
fn as normalizeVectorFlexibleParam,
|
|
1606
|
+
yn as templateCompilerOptions,
|
|
1607
|
+
Lr as trasverseObjects,
|
|
1608
|
+
cr as useCamera,
|
|
1609
|
+
dn as useLoader,
|
|
1609
1610
|
$ as useLogger,
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1611
|
+
hn as useLoop,
|
|
1612
|
+
vn as usePointerEventHandler,
|
|
1613
|
+
Ze as useRaycaster,
|
|
1614
|
+
un as useRenderLoop,
|
|
1615
|
+
Ar as useRenderer,
|
|
1616
|
+
mn as useSeek,
|
|
1617
|
+
pn as useTexture,
|
|
1618
|
+
gn as useTres,
|
|
1619
|
+
et as useTresContext,
|
|
1620
|
+
jr as useTresContextProvider,
|
|
1621
|
+
Ir as useTresEventManager,
|
|
1622
|
+
Mn as vDistanceTo,
|
|
1623
|
+
wn as vLightHelper,
|
|
1624
|
+
bn as vLog
|
|
1624
1625
|
};
|