@tresjs/core 3.8.0 → 3.9.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/README.md +1 -0
- package/components.d.ts +1 -1
- package/composables.d.ts +1 -1
- package/dist/src/components/TresCanvas.vue.d.ts +5 -5
- package/dist/src/composables/useCamera/index.d.ts +2412 -2412
- package/dist/src/composables/useLoader/index.d.ts +45 -0
- package/dist/src/composables/usePointerEventHandler/index.d.ts +1 -1
- package/dist/src/composables/useRaycaster/index.d.ts +19 -0
- package/dist/src/composables/useRenderer/index.d.ts +1 -7
- package/dist/src/composables/useSeek/index.d.ts +21 -0
- package/dist/src/composables/useSizes/index.d.ts +1 -1
- package/dist/src/core/renderer.d.ts +1 -1
- package/dist/src/directives/index.d.ts +2 -1
- package/dist/src/directives/vRotate.d.ts +13 -0
- package/dist/src/types/index.d.ts +4 -4
- package/dist/src/utils/index.d.ts +1 -1
- package/dist/src/utils/normalize.d.ts +1 -1
- package/dist/tres.js +278 -262
- package/dist/tres.umd.cjs +2 -2
- package/package.json +28 -24
- package/types.d.ts +1 -1
- package/utils.d.ts +1 -1
package/dist/tres.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version: v3.
|
|
3
|
+
* version: v3.9.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
|
|
11
|
-
import { ref as
|
|
8
|
+
var Oe = Object.defineProperty;
|
|
9
|
+
var De = (e, r, t) => r in e ? Oe(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
10
|
+
var Q = (e, r, t) => (De(e, typeof r != "symbol" ? r + "" : r, t), t);
|
|
11
|
+
import { ref as A, computed as L, watchEffect as B, onUnmounted as U, shallowRef as H, watch as ge, reactive as ve, readonly as Y, provide as K, inject as Be, createRenderer as je, defineComponent as ne, useSlots as He, getCurrentInstance as se, onMounted as Re, openBlock as Ie, createElementBlock as $e, normalizeClass as ze, unref as Ne, normalizeStyle as We, h as ie, Fragment as Ve } from "vue";
|
|
12
12
|
import * as he from "three";
|
|
13
|
-
import { PerspectiveCamera as X, OrthographicCamera as Fe, Camera as
|
|
14
|
-
import { createEventHook as
|
|
15
|
-
const
|
|
13
|
+
import { PerspectiveCamera as X, OrthographicCamera as Fe, Camera as Ue, Clock as Ge, Vector3 as te, Color as W, MeshBasicMaterial as ye, DoubleSide as Qe, REVISION as qe, SRGBColorSpace as Je, ACESFilmicToneMapping as Ye, PCFSoftShadowMap as Ke, WebGLRenderer as q, TextureLoader as Xe, Vector2 as Ze, Raycaster as et, BufferAttribute as tt, Scene as rt, Line as ot, BufferGeometry as ae, Float32BufferAttribute as le, LineBasicMaterial as nt, Mesh as st, BackSide as it, DirectionalLightHelper as at, PointLightHelper as lt, SpotLightHelper as ut, HemisphereLightHelper as ct, ArrowHelper as dt, Quaternion as ft } from "three";
|
|
14
|
+
import { createEventHook as R, useRafFn as we, toValue as E, unrefElement as pt, useDevicePixelRatio as mt, usePointer as gt, useElementBounding as vt, useWindowSize as ht, useElementSize as yt, refDebounced as ue, useFps as wt, useMemory as _t } from "@vueuse/core";
|
|
15
|
+
const bt = "@tresjs/core", Et = "module", Ct = "3.9.0", xt = "pnpm@8.15.6", Mt = "Declarative ThreeJS using Vue Components", St = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", kt = "MIT", Pt = [
|
|
16
16
|
"vue",
|
|
17
17
|
"3d",
|
|
18
18
|
"threejs",
|
|
@@ -21,25 +21,25 @@ const _t = "@tresjs/core", Et = "module", Ct = "3.8.0", Mt = "pnpm@8.15.6", xt =
|
|
|
21
21
|
], Tt = !1, At = {
|
|
22
22
|
".": {
|
|
23
23
|
types: "./dist/index.d.ts",
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
import: "./dist/tres.js",
|
|
25
|
+
require: "./dist/tres.umd.cjs"
|
|
26
26
|
},
|
|
27
27
|
"./components": {
|
|
28
|
-
types: "./dist/components/index.d.ts"
|
|
28
|
+
types: "./dist/src/components/index.d.ts"
|
|
29
29
|
},
|
|
30
30
|
"./composables": {
|
|
31
|
-
types: "./dist/composables/index.d.ts"
|
|
31
|
+
types: "./dist/src/composables/index.d.ts"
|
|
32
32
|
},
|
|
33
33
|
"./types": {
|
|
34
|
-
types: "./dist/types/index.d.ts"
|
|
34
|
+
types: "./dist/src/types/index.d.ts"
|
|
35
35
|
},
|
|
36
36
|
"./utils": {
|
|
37
|
-
types: "./dist/utils/index.d.ts"
|
|
37
|
+
types: "./dist/src/utils/index.d.ts"
|
|
38
38
|
},
|
|
39
39
|
"./*": "./*"
|
|
40
40
|
}, Lt = "./dist/tres.js", Ot = "./dist/tres.js", Dt = "./dist/index.d.ts", Bt = [
|
|
41
|
-
"
|
|
42
|
-
"
|
|
41
|
+
"*.d.ts",
|
|
42
|
+
"dist"
|
|
43
43
|
], jt = {
|
|
44
44
|
access: "public"
|
|
45
45
|
}, Ht = {
|
|
@@ -51,12 +51,14 @@ const _t = "@tresjs/core", Et = "module", Ct = "3.8.0", Mt = "pnpm@8.15.6", xt =
|
|
|
51
51
|
"test:ui": "vitest --ui",
|
|
52
52
|
release: "release-it",
|
|
53
53
|
coverage: "vitest run --coverage",
|
|
54
|
-
lint: "eslint .
|
|
54
|
+
lint: "eslint .",
|
|
55
|
+
"lint:fix": "eslint . --fix",
|
|
55
56
|
"docs:dev": "vitepress dev docs",
|
|
56
57
|
"docs:build": "vitepress build docs",
|
|
57
58
|
"docs:serve": "vitepress serve docs",
|
|
58
59
|
"docs:preview": "vitepress preview docs",
|
|
59
|
-
"docs:contributors": "esno scripts/update-contributors.ts"
|
|
60
|
+
"docs:contributors": "esno scripts/update-contributors.ts",
|
|
61
|
+
prepare: "node .husky/install.mjs"
|
|
60
62
|
}, Rt = {
|
|
61
63
|
three: ">=0.133",
|
|
62
64
|
vue: ">=3.3"
|
|
@@ -68,49 +70,51 @@ const _t = "@tresjs/core", Et = "module", Ct = "3.8.0", Mt = "pnpm@8.15.6", xt =
|
|
|
68
70
|
"@release-it/conventional-changelog": "^8.0.1",
|
|
69
71
|
"@stackblitz/sdk": "^1.9.0",
|
|
70
72
|
"@tresjs/cientos": "3.8.0",
|
|
73
|
+
"@tresjs/eslint-config": "^1.0.0",
|
|
71
74
|
"@tresjs/eslint-config-vue": "^0.2.1",
|
|
72
75
|
"@types/three": "^0.163.0",
|
|
73
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
74
|
-
"@typescript-eslint/parser": "^7.
|
|
76
|
+
"@typescript-eslint/eslint-plugin": "^7.7.1",
|
|
77
|
+
"@typescript-eslint/parser": "^7.7.1",
|
|
75
78
|
"@vitejs/plugin-vue": "^5.0.4",
|
|
76
79
|
"@vitest/coverage-c8": "^0.33.0",
|
|
77
|
-
"@vitest/ui": "^1.0
|
|
80
|
+
"@vitest/ui": "^1.5.0",
|
|
78
81
|
"@vue/test-utils": "^2.4.3",
|
|
79
|
-
eslint: "^
|
|
80
|
-
"eslint-plugin-vue": "^9.
|
|
82
|
+
eslint: "^9.1.1",
|
|
83
|
+
"eslint-plugin-vue": "^9.25.0",
|
|
81
84
|
esno: "^4.0.0",
|
|
82
85
|
gsap: "^3.12.3",
|
|
86
|
+
husky: "^9.0.11",
|
|
83
87
|
jsdom: "^24.0.0",
|
|
84
88
|
kolorist: "^1.8.0",
|
|
85
89
|
ohmyfetch: "^0.4.21",
|
|
86
90
|
pathe: "^1.1.1",
|
|
87
|
-
"release-it": "^17.0
|
|
91
|
+
"release-it": "^17.2.0",
|
|
88
92
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
89
93
|
"rollup-plugin-copy": "^3.5.0",
|
|
90
94
|
"rollup-plugin-visualizer": "^5.11.0",
|
|
91
95
|
three: "^0.163.0",
|
|
92
|
-
unocss: "^0.
|
|
96
|
+
unocss: "^0.59.4",
|
|
93
97
|
unplugin: "^1.10.1",
|
|
94
98
|
"unplugin-vue-components": "^0.26.0",
|
|
95
|
-
vite: "^5.2.
|
|
99
|
+
vite: "^5.2.10",
|
|
96
100
|
"vite-plugin-banner": "^0.7.1",
|
|
97
|
-
"vite-plugin-dts": "3.
|
|
98
|
-
"vite-plugin-inspect": "^0.8.
|
|
101
|
+
"vite-plugin-dts": "3.9.0",
|
|
102
|
+
"vite-plugin-inspect": "^0.8.4",
|
|
99
103
|
"vite-plugin-require-transform": "^1.0.21",
|
|
100
104
|
"vite-svg-loader": "^5.1.0",
|
|
101
|
-
vitepress: "1.
|
|
102
|
-
vitest: "^1.0
|
|
103
|
-
vue: "^3.
|
|
105
|
+
vitepress: "1.1.3",
|
|
106
|
+
vitest: "^1.5.0",
|
|
107
|
+
vue: "^3.4.24",
|
|
104
108
|
"vue-demi": "^0.14.6"
|
|
105
|
-
},
|
|
106
|
-
name:
|
|
109
|
+
}, zt = {
|
|
110
|
+
name: bt,
|
|
107
111
|
type: Et,
|
|
108
112
|
version: Ct,
|
|
109
|
-
packageManager:
|
|
110
|
-
description:
|
|
113
|
+
packageManager: xt,
|
|
114
|
+
description: Mt,
|
|
111
115
|
author: St,
|
|
112
|
-
license:
|
|
113
|
-
keywords:
|
|
116
|
+
license: kt,
|
|
117
|
+
keywords: Pt,
|
|
114
118
|
sideEffects: Tt,
|
|
115
119
|
exports: At,
|
|
116
120
|
main: Lt,
|
|
@@ -122,58 +126,58 @@ const _t = "@tresjs/core", Et = "module", Ct = "3.8.0", Mt = "pnpm@8.15.6", xt =
|
|
|
122
126
|
peerDependencies: Rt,
|
|
123
127
|
dependencies: It,
|
|
124
128
|
devDependencies: $t
|
|
125
|
-
},
|
|
126
|
-
const t =
|
|
129
|
+
}, Nt = ({ sizes: e, scene: r }) => {
|
|
130
|
+
const t = A([]), o = L(
|
|
127
131
|
() => t.value[0]
|
|
128
|
-
), s = (a
|
|
129
|
-
|
|
130
|
-
}, i = (a) => {
|
|
131
|
-
t.value = t.value.filter(({ uuid: l }) => l !== a.uuid);
|
|
132
|
-
}, n = (a) => {
|
|
133
|
-
const l = a instanceof Ge ? a : t.value.find((m) => m.uuid === a);
|
|
132
|
+
), s = (a) => {
|
|
133
|
+
const l = a instanceof Ue ? a : t.value.find((m) => m.uuid === a);
|
|
134
134
|
if (!l)
|
|
135
135
|
return;
|
|
136
136
|
const c = t.value.filter(({ uuid: m }) => m !== l.uuid);
|
|
137
137
|
t.value = [l, ...c];
|
|
138
|
+
}, i = (a, l = !1) => {
|
|
139
|
+
t.value.some(({ uuid: c }) => c === a.uuid) || (l ? s(a) : t.value.push(a));
|
|
140
|
+
}, n = (a) => {
|
|
141
|
+
t.value = t.value.filter(({ uuid: l }) => l !== a.uuid);
|
|
138
142
|
};
|
|
139
|
-
return
|
|
143
|
+
return B(() => {
|
|
140
144
|
e.aspectRatio.value && t.value.forEach((a) => {
|
|
141
145
|
a instanceof X && (a.aspect = e.aspectRatio.value), (a instanceof X || a instanceof Fe) && a.updateProjectionMatrix();
|
|
142
146
|
});
|
|
143
|
-
}), r.userData.tres__registerCamera =
|
|
147
|
+
}), r.userData.tres__registerCamera = i, r.userData.tres__deregisterCamera = n, U(() => {
|
|
144
148
|
t.value = [];
|
|
145
149
|
}), {
|
|
146
150
|
camera: o,
|
|
147
151
|
cameras: t,
|
|
148
|
-
registerCamera:
|
|
149
|
-
deregisterCamera:
|
|
150
|
-
setCameraActive:
|
|
152
|
+
registerCamera: i,
|
|
153
|
+
deregisterCamera: n,
|
|
154
|
+
setCameraActive: s
|
|
151
155
|
};
|
|
152
|
-
}, _e =
|
|
153
|
-
let
|
|
154
|
-
const { pause:
|
|
156
|
+
}, _e = R(), be = R(), re = R(), j = new Ge();
|
|
157
|
+
let V = 0, F = 0;
|
|
158
|
+
const { pause: Wt, resume: Vt, isActive: Ft } = we(
|
|
155
159
|
() => {
|
|
156
|
-
_e.trigger({ delta:
|
|
160
|
+
_e.trigger({ delta: V, elapsed: F, clock: j }), be.trigger({ delta: V, elapsed: F, clock: j }), re.trigger({ delta: V, elapsed: F, clock: j });
|
|
157
161
|
},
|
|
158
162
|
{ immediate: !1 }
|
|
159
163
|
);
|
|
160
|
-
|
|
161
|
-
|
|
164
|
+
re.on(() => {
|
|
165
|
+
V = j.getDelta(), F = j.getElapsedTime();
|
|
162
166
|
});
|
|
163
|
-
const
|
|
167
|
+
const G = () => ({
|
|
164
168
|
onBeforeLoop: _e.on,
|
|
165
|
-
onLoop:
|
|
166
|
-
onAfterLoop:
|
|
167
|
-
pause:
|
|
168
|
-
resume:
|
|
169
|
-
isActive:
|
|
170
|
-
}),
|
|
171
|
-
function
|
|
169
|
+
onLoop: be.on,
|
|
170
|
+
onAfterLoop: re.on,
|
|
171
|
+
pause: Wt,
|
|
172
|
+
resume: Vt,
|
|
173
|
+
isActive: Ft
|
|
174
|
+
}), Ir = !0, I = "[TresJS ▲ ■ ●] ";
|
|
175
|
+
function P() {
|
|
172
176
|
function e(...o) {
|
|
173
|
-
typeof o[0] == "string" ? o[0] =
|
|
177
|
+
typeof o[0] == "string" ? o[0] = I + o[0] : o.unshift(I), console.error(...o);
|
|
174
178
|
}
|
|
175
179
|
function r(...o) {
|
|
176
|
-
typeof o[0] == "string" ? o[0] =
|
|
180
|
+
typeof o[0] == "string" ? o[0] = I + o[0] : o.unshift(I), console.warn(...o);
|
|
177
181
|
}
|
|
178
182
|
function t(o, s) {
|
|
179
183
|
}
|
|
@@ -183,17 +187,17 @@ function A() {
|
|
|
183
187
|
logMessage: t
|
|
184
188
|
};
|
|
185
189
|
}
|
|
186
|
-
function
|
|
187
|
-
return typeof e == "number" ? [e, e, e] : e instanceof
|
|
190
|
+
function $r(e) {
|
|
191
|
+
return typeof e == "number" ? [e, e, e] : e instanceof te ? [e.x, e.y, e.z] : e;
|
|
188
192
|
}
|
|
189
|
-
function
|
|
193
|
+
function Ut(e) {
|
|
190
194
|
return e instanceof W ? e : Array.isArray(e) ? new W(...e) : new W(e);
|
|
191
195
|
}
|
|
192
196
|
class Gt extends he.Mesh {
|
|
193
197
|
constructor(...t) {
|
|
194
198
|
super(...t);
|
|
195
|
-
|
|
196
|
-
|
|
199
|
+
Q(this, "type", "HightlightMesh");
|
|
200
|
+
Q(this, "createTime");
|
|
197
201
|
this.createTime = Date.now();
|
|
198
202
|
}
|
|
199
203
|
onBeforeRender() {
|
|
@@ -201,24 +205,24 @@ class Gt extends he.Mesh {
|
|
|
201
205
|
this.scale.set(n, n, n);
|
|
202
206
|
}
|
|
203
207
|
}
|
|
204
|
-
const
|
|
208
|
+
const Ee = (e, r) => {
|
|
205
209
|
for (const t of Object.keys(r))
|
|
206
|
-
r[t] instanceof Object && Object.assign(r[t],
|
|
210
|
+
r[t] instanceof Object && Object.assign(r[t], Ee(e[t], r[t]));
|
|
207
211
|
return Object.assign(e || {}, r), e;
|
|
208
|
-
},
|
|
212
|
+
}, Qt = "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", qt = /* @__PURE__ */ Jt(Qt);
|
|
209
213
|
function ce(e) {
|
|
210
214
|
return e && e.nodeType === 1;
|
|
211
215
|
}
|
|
212
|
-
function
|
|
216
|
+
function $(e) {
|
|
213
217
|
return e.replace(/-([a-z])/g, (r, t) => t.toUpperCase());
|
|
214
218
|
}
|
|
215
|
-
function
|
|
219
|
+
function Jt(e, r) {
|
|
216
220
|
const t = /* @__PURE__ */ Object.create(null), o = e.split(",");
|
|
217
221
|
for (let s = 0; s < o.length; s++)
|
|
218
222
|
t[o[s]] = !0;
|
|
219
223
|
return r ? (s) => !!t[s.toLowerCase()] : (s) => !!t[s];
|
|
220
224
|
}
|
|
221
|
-
const
|
|
225
|
+
const Yt = (e, r) => {
|
|
222
226
|
const t = /* @__PURE__ */ new Set(), o = [];
|
|
223
227
|
for (const s of e) {
|
|
224
228
|
const i = r(s);
|
|
@@ -234,7 +238,7 @@ const qt = (e, r) => {
|
|
|
234
238
|
const o = Array.isArray(r) ? r : r.match(/([^[.\]])+/g);
|
|
235
239
|
o && o.reduce((s, i, n) => (s[i] === void 0 && (s[i] = {}), n === o.length - 1 && (s[i] = t), s[i]), e);
|
|
236
240
|
};
|
|
237
|
-
function
|
|
241
|
+
function Ce(e, r) {
|
|
238
242
|
if (ce(e) && ce(r)) {
|
|
239
243
|
const s = e.attributes, i = r.attributes;
|
|
240
244
|
return s.length !== i.length ? !1 : Array.from(s).every(({ name: n, value: a }) => r.getAttribute(n) === a);
|
|
@@ -247,7 +251,7 @@ function Me(e, r) {
|
|
|
247
251
|
if (t.length !== o.length)
|
|
248
252
|
return !1;
|
|
249
253
|
for (const s of t)
|
|
250
|
-
if (!o.includes(s) || !
|
|
254
|
+
if (!o.includes(s) || !Ce(e[s], r[s]))
|
|
251
255
|
return !1;
|
|
252
256
|
return !0;
|
|
253
257
|
}
|
|
@@ -255,7 +259,7 @@ function Xt(e, r) {
|
|
|
255
259
|
if (!Array.isArray(e) || !Array.isArray(r) || e.length !== r.length)
|
|
256
260
|
return !1;
|
|
257
261
|
for (let t = 0; t < e.length; t++)
|
|
258
|
-
if (!
|
|
262
|
+
if (!Ce(e[t], r[t]))
|
|
259
263
|
return !1;
|
|
260
264
|
return !0;
|
|
261
265
|
}
|
|
@@ -286,7 +290,7 @@ function er(e, r, t, o) {
|
|
|
286
290
|
n[a] !== void 0 ? n[a] = o : console.warn(`Property path is not valid: ${t.join(".")}`);
|
|
287
291
|
}
|
|
288
292
|
function tr(e) {
|
|
289
|
-
const r = new
|
|
293
|
+
const r = new ye({
|
|
290
294
|
color: 11003607,
|
|
291
295
|
// Highlight color, e.g., yellow
|
|
292
296
|
transparent: !0,
|
|
@@ -301,18 +305,18 @@ function tr(e) {
|
|
|
301
305
|
function xe(e) {
|
|
302
306
|
var t;
|
|
303
307
|
let r = e.value;
|
|
304
|
-
return e.value && ((t = e.value) != null && t.isMesh) && (r = e.value.position), Array.isArray(e.value) && (r = new
|
|
308
|
+
return e.value && ((t = e.value) != null && t.isMesh) && (r = e.value.position), Array.isArray(e.value) && (r = new te(...r)), r;
|
|
305
309
|
}
|
|
306
|
-
const rr = Number.parseInt(
|
|
310
|
+
const rr = Number.parseInt(qe.replace("dev", "")), z = {
|
|
307
311
|
realistic: {
|
|
308
312
|
shadows: !0,
|
|
309
313
|
physicallyCorrectLights: !0,
|
|
310
|
-
outputColorSpace:
|
|
311
|
-
toneMapping:
|
|
314
|
+
outputColorSpace: Je,
|
|
315
|
+
toneMapping: Ye,
|
|
312
316
|
toneMappingExposure: 3,
|
|
313
317
|
shadowMap: {
|
|
314
318
|
enabled: !0,
|
|
315
|
-
type:
|
|
319
|
+
type: Ke
|
|
316
320
|
}
|
|
317
321
|
}
|
|
318
322
|
};
|
|
@@ -323,31 +327,31 @@ function or({
|
|
|
323
327
|
disableRender: o,
|
|
324
328
|
contextParts: { sizes: s, camera: i }
|
|
325
329
|
}) {
|
|
326
|
-
const n =
|
|
327
|
-
alpha:
|
|
328
|
-
depth:
|
|
330
|
+
const n = L(() => ({
|
|
331
|
+
alpha: E(t.alpha),
|
|
332
|
+
depth: E(t.depth),
|
|
329
333
|
canvas: pt(r),
|
|
330
|
-
context:
|
|
331
|
-
stencil:
|
|
332
|
-
antialias:
|
|
333
|
-
precision:
|
|
334
|
-
powerPreference:
|
|
335
|
-
premultipliedAlpha:
|
|
336
|
-
preserveDrawingBuffer:
|
|
337
|
-
logarithmicDepthBuffer:
|
|
338
|
-
failIfMajorPerformanceCaveat:
|
|
339
|
-
})), a =
|
|
334
|
+
context: E(t.context),
|
|
335
|
+
stencil: E(t.stencil),
|
|
336
|
+
antialias: E(t.antialias) === void 0 ? !0 : E(t.antialias),
|
|
337
|
+
precision: E(t.precision),
|
|
338
|
+
powerPreference: E(t.powerPreference),
|
|
339
|
+
premultipliedAlpha: E(t.premultipliedAlpha),
|
|
340
|
+
preserveDrawingBuffer: E(t.preserveDrawingBuffer),
|
|
341
|
+
logarithmicDepthBuffer: E(t.logarithmicDepthBuffer),
|
|
342
|
+
failIfMajorPerformanceCaveat: E(t.failIfMajorPerformanceCaveat)
|
|
343
|
+
})), a = H(new q(n.value));
|
|
340
344
|
ge(n, () => {
|
|
341
|
-
a.value.dispose(), a.value = new
|
|
342
|
-
}),
|
|
345
|
+
a.value.dispose(), a.value = new q(n.value);
|
|
346
|
+
}), B(() => {
|
|
343
347
|
a.value.setSize(s.width.value, s.height.value);
|
|
344
348
|
});
|
|
345
349
|
const { pixelRatio: l } = mt();
|
|
346
|
-
|
|
350
|
+
B(() => {
|
|
347
351
|
a.value.setPixelRatio(l.value);
|
|
348
352
|
});
|
|
349
|
-
const { logError: c } =
|
|
350
|
-
const p = new
|
|
353
|
+
const { logError: c } = P(), d = (() => {
|
|
354
|
+
const p = new q(), y = {
|
|
351
355
|
shadowMap: {
|
|
352
356
|
enabled: p.shadowMap.enabled,
|
|
353
357
|
type: p.shadowMap.type
|
|
@@ -358,30 +362,30 @@ function or({
|
|
|
358
362
|
};
|
|
359
363
|
return p.dispose(), y;
|
|
360
364
|
})();
|
|
361
|
-
|
|
362
|
-
const p =
|
|
363
|
-
p && (p in
|
|
364
|
-
const y = (C,
|
|
365
|
-
const w =
|
|
365
|
+
B(() => {
|
|
366
|
+
const p = E(t.preset);
|
|
367
|
+
p && (p in z || c(`Renderer Preset must be one of these: ${Object.keys(z).join(", ")}`), Ee(a.value, z[p]));
|
|
368
|
+
const y = (C, x) => {
|
|
369
|
+
const w = E(C), S = () => {
|
|
366
370
|
if (p)
|
|
367
|
-
return de(
|
|
371
|
+
return de(z[p], x);
|
|
368
372
|
};
|
|
369
373
|
if (w !== void 0)
|
|
370
374
|
return w;
|
|
371
375
|
const v = S();
|
|
372
|
-
return v !== void 0 ? v : de(d,
|
|
373
|
-
}, b = (C,
|
|
376
|
+
return v !== void 0 ? v : de(d, x);
|
|
377
|
+
}, b = (C, x) => Kt(a.value, x, y(C, x));
|
|
374
378
|
b(t.shadows, "shadowMap.enabled"), b(t.toneMapping, "toneMapping"), b(t.shadowMapType, "shadowMap.type"), rr < 150 && b(!t.useLegacyLights, "physicallyCorrectLights"), b(t.outputColorSpace, "outputColorSpace"), b(t.toneMappingExposure, "toneMappingExposure");
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
|
|
379
|
+
const M = y(t.clearColor, "clearColor");
|
|
380
|
+
M && a.value.setClearColor(
|
|
381
|
+
M ? Ut(M) : new W(0)
|
|
378
382
|
// default clear color is not easily/efficiently retrievable from three
|
|
379
383
|
);
|
|
380
384
|
});
|
|
381
|
-
const { pause: u, resume: f, onLoop: h } =
|
|
385
|
+
const { pause: u, resume: f, onLoop: h } = G();
|
|
382
386
|
return h(() => {
|
|
383
|
-
i.value && !
|
|
384
|
-
}), f(),
|
|
387
|
+
i.value && !E(o) && a.value.render(e, i.value);
|
|
388
|
+
}), f(), U(() => {
|
|
385
389
|
u(), a.value.dispose(), a.value.forceContextLoss();
|
|
386
390
|
}), {
|
|
387
391
|
renderer: a
|
|
@@ -394,8 +398,8 @@ function sr(e) {
|
|
|
394
398
|
t.name && (r.nodes[t.name] = t), t.material && !r.materials[t.material.name] && (r.materials[t.material.name] = t.material);
|
|
395
399
|
}), r;
|
|
396
400
|
}
|
|
397
|
-
async function
|
|
398
|
-
const { logError: i } =
|
|
401
|
+
async function zr(e, r, t, o, s) {
|
|
402
|
+
const { logError: i } = P(), n = new e();
|
|
399
403
|
s && s(n), t && t(n);
|
|
400
404
|
const l = (Array.isArray(r) ? r : [r]).map(
|
|
401
405
|
(c) => new Promise((m, d) => {
|
|
@@ -412,7 +416,7 @@ async function $r(e, r, t, o, s) {
|
|
|
412
416
|
return nr(r) ? await Promise.all(l) : await l[0];
|
|
413
417
|
}
|
|
414
418
|
async function Nr(e, r) {
|
|
415
|
-
const t = new
|
|
419
|
+
const t = new Xe(r), o = (s) => new Promise((i, n) => {
|
|
416
420
|
t.load(
|
|
417
421
|
s,
|
|
418
422
|
(a) => i(a),
|
|
@@ -449,44 +453,44 @@ async function Nr(e, r) {
|
|
|
449
453
|
}
|
|
450
454
|
}
|
|
451
455
|
const ir = (e, { renderer: r, camera: t, raycaster: o }) => {
|
|
452
|
-
const s =
|
|
456
|
+
const s = L(() => r.value.domElement), { x: i, y: n } = gt({ target: s }), { width: a, height: l, top: c, left: m } = vt(s), d = ({ x: v, y: _ }) => {
|
|
453
457
|
if (s.value)
|
|
454
458
|
return {
|
|
455
459
|
x: (v - m.value) / a.value * 2 - 1,
|
|
456
|
-
y: -((
|
|
460
|
+
y: -((_ - c.value) / l.value) * 2 + 1
|
|
457
461
|
};
|
|
458
|
-
}, u = ({ x: v, y:
|
|
462
|
+
}, u = ({ x: v, y: _ }) => {
|
|
459
463
|
if (t.value)
|
|
460
|
-
return o.value.setFromCamera(new
|
|
464
|
+
return o.value.setFromCamera(new Ze(v, _), t.value), o.value.intersectObjects(e.value, !1);
|
|
461
465
|
}, f = (v) => {
|
|
462
|
-
const
|
|
466
|
+
const _ = d({
|
|
463
467
|
x: (v == null ? void 0 : v.clientX) ?? i.value,
|
|
464
468
|
y: (v == null ? void 0 : v.clientY) ?? n.value
|
|
465
469
|
});
|
|
466
|
-
return
|
|
467
|
-
}, h =
|
|
468
|
-
v.trigger({ event:
|
|
469
|
-
},
|
|
470
|
+
return _ ? u(_) || [] : [];
|
|
471
|
+
}, h = L(() => f()), p = R(), y = R(), b = (v, _) => {
|
|
472
|
+
v.trigger({ event: _, intersects: f(_) });
|
|
473
|
+
}, M = (v) => {
|
|
470
474
|
b(y, v);
|
|
471
475
|
};
|
|
472
476
|
let C;
|
|
473
|
-
const
|
|
474
|
-
var
|
|
475
|
-
C = (
|
|
477
|
+
const x = (v) => {
|
|
478
|
+
var _;
|
|
479
|
+
C = (_ = f(v)[0]) == null ? void 0 : _.object;
|
|
476
480
|
}, w = (v) => {
|
|
477
|
-
var
|
|
478
|
-
v instanceof PointerEvent && C === ((
|
|
481
|
+
var _;
|
|
482
|
+
v instanceof PointerEvent && C === ((_ = f(v)[0]) == null ? void 0 : _.object) && b(p, v);
|
|
479
483
|
}, S = (v) => y.trigger({ event: v, intersects: [] });
|
|
480
|
-
return s.value.addEventListener("pointerup", w), s.value.addEventListener("pointerdown",
|
|
481
|
-
s != null && s.value && (s.value.removeEventListener("pointerup", w), s.value.removeEventListener("pointerdown",
|
|
484
|
+
return s.value.addEventListener("pointerup", w), s.value.addEventListener("pointerdown", x), s.value.addEventListener("pointermove", M), s.value.addEventListener("pointerleave", S), U(() => {
|
|
485
|
+
s != null && s.value && (s.value.removeEventListener("pointerup", w), s.value.removeEventListener("pointerdown", x), s.value.removeEventListener("pointermove", M), s.value.removeEventListener("pointerleave", S));
|
|
482
486
|
}), {
|
|
483
487
|
intersects: h,
|
|
484
488
|
onClick: (v) => p.on(v).off,
|
|
485
489
|
onPointerMove: (v) => y.on(v).off
|
|
486
490
|
};
|
|
487
491
|
};
|
|
488
|
-
function
|
|
489
|
-
const { logWarning: e } =
|
|
492
|
+
function Wr() {
|
|
493
|
+
const { logWarning: e } = P();
|
|
490
494
|
function r(i, n, a) {
|
|
491
495
|
let l = null;
|
|
492
496
|
return i.traverse((c) => {
|
|
@@ -518,7 +522,7 @@ const ar = ({ scene: e, contextParts: r }) => {
|
|
|
518
522
|
pointerMove: /* @__PURE__ */ new Map(),
|
|
519
523
|
pointerEnter: /* @__PURE__ */ new Map(),
|
|
520
524
|
pointerLeave: /* @__PURE__ */ new Map()
|
|
521
|
-
}), o =
|
|
525
|
+
}), o = A(/* @__PURE__ */ new Set()), s = (u) => {
|
|
522
526
|
o.value.add(u);
|
|
523
527
|
}, i = (u) => {
|
|
524
528
|
o.value.delete(u);
|
|
@@ -529,8 +533,8 @@ const ar = ({ scene: e, contextParts: r }) => {
|
|
|
529
533
|
f && t.click.set(u, f), h && t.pointerMove.set(u, h), p && t.pointerEnter.set(u, p), y && t.pointerLeave.set(u, y);
|
|
530
534
|
};
|
|
531
535
|
e.userData.tres__registerAtPointerEventHandler = a, e.userData.tres__deregisterAtPointerEventHandler = n, e.userData.tres__registerBlockingObjectAtPointerEventHandler = s, e.userData.tres__deregisterBlockingObjectAtPointerEventHandler = i;
|
|
532
|
-
const l =
|
|
533
|
-
() =>
|
|
536
|
+
const l = L(
|
|
537
|
+
() => Yt(
|
|
534
538
|
[
|
|
535
539
|
...Array.from(o.value),
|
|
536
540
|
...Object.values(t).map((u) => Array.from(u.keys())).flat()
|
|
@@ -544,15 +548,15 @@ const ar = ({ scene: e, contextParts: r }) => {
|
|
|
544
548
|
});
|
|
545
549
|
let d;
|
|
546
550
|
return m(({ intersects: u, event: f }) => {
|
|
547
|
-
var
|
|
548
|
-
const h = (
|
|
549
|
-
d && d !== h && ((C = p.get(d)) == null || C(d, f)), h && (d !== h && ((
|
|
551
|
+
var M, C, x, w;
|
|
552
|
+
const h = (M = u == null ? void 0 : u[0]) == null ? void 0 : M.object, { pointerLeave: p, pointerEnter: y, pointerMove: b } = t;
|
|
553
|
+
d && d !== h && ((C = p.get(d)) == null || C(d, f)), h && (d !== h && ((x = y.get(h)) == null || x(u[0], f)), (w = b.get(h)) == null || w(u[0], f)), d = h || null;
|
|
550
554
|
}), {
|
|
551
555
|
registerObject: a,
|
|
552
556
|
deregisterObject: n
|
|
553
557
|
};
|
|
554
558
|
};
|
|
555
|
-
function
|
|
559
|
+
function Me(e) {
|
|
556
560
|
let r = 0;
|
|
557
561
|
return e.traverse((t) => {
|
|
558
562
|
if (t.isMesh && t.geometry) {
|
|
@@ -564,9 +568,9 @@ function Se(e) {
|
|
|
564
568
|
function lr(e) {
|
|
565
569
|
return (e / 1024).toFixed(2);
|
|
566
570
|
}
|
|
567
|
-
const Z =
|
|
571
|
+
const Z = A({}), oe = (e) => Object.assign(Z.value, e);
|
|
568
572
|
function ur(e, r, t = 10) {
|
|
569
|
-
const o =
|
|
573
|
+
const o = E(e) ? ht() : yt(L(() => E(r).parentElement)), s = Y(ue(o.width, t)), i = Y(ue(o.height, t)), n = L(() => s.value / i.value);
|
|
570
574
|
return {
|
|
571
575
|
height: i,
|
|
572
576
|
width: s,
|
|
@@ -580,13 +584,13 @@ function cr({
|
|
|
580
584
|
disableRender: o,
|
|
581
585
|
rendererOptions: s
|
|
582
586
|
}) {
|
|
583
|
-
const i = ur(t, r), n =
|
|
587
|
+
const i = ur(t, r), n = H(e), {
|
|
584
588
|
camera: a,
|
|
585
589
|
cameras: l,
|
|
586
590
|
registerCamera: c,
|
|
587
591
|
deregisterCamera: m,
|
|
588
592
|
setCameraActive: d
|
|
589
|
-
} =
|
|
593
|
+
} = Nt({ sizes: i, scene: e }), { renderer: u } = or(
|
|
590
594
|
{
|
|
591
595
|
scene: e,
|
|
592
596
|
canvas: r,
|
|
@@ -598,10 +602,10 @@ function cr({
|
|
|
598
602
|
sizes: i,
|
|
599
603
|
scene: n,
|
|
600
604
|
camera: a,
|
|
601
|
-
cameras:
|
|
605
|
+
cameras: Y(l),
|
|
602
606
|
renderer: u,
|
|
603
|
-
raycaster:
|
|
604
|
-
controls:
|
|
607
|
+
raycaster: H(new et()),
|
|
608
|
+
controls: A(null),
|
|
605
609
|
perf: {
|
|
606
610
|
maxFrames: 160,
|
|
607
611
|
fps: {
|
|
@@ -620,28 +624,28 @@ function cr({
|
|
|
620
624
|
deregisterCamera: m
|
|
621
625
|
};
|
|
622
626
|
K("useTres", f);
|
|
623
|
-
const h = 100, p = wt({ every: h }), { isSupported: y, memory: b } =
|
|
627
|
+
const h = 100, p = wt({ every: h }), { isSupported: y, memory: b } = _t({ interval: h }), M = 160;
|
|
624
628
|
let C = performance.now();
|
|
625
|
-
const
|
|
626
|
-
f.scene.value && (f.perf.memory.allocatedMem =
|
|
629
|
+
const x = ({ timestamp: _ }) => {
|
|
630
|
+
f.scene.value && (f.perf.memory.allocatedMem = Me(f.scene.value)), _ - C >= h && (C = _, f.perf.fps.accumulator.push(p.value), f.perf.fps.accumulator.length > M && f.perf.fps.accumulator.shift(), f.perf.fps.value = p.value, y.value && b.value && (f.perf.memory.accumulator.push(b.value.usedJSHeapSize / 1024 / 1024), f.perf.memory.accumulator.length > M && f.perf.memory.accumulator.shift(), f.perf.memory.currentMem = f.perf.memory.accumulator.reduce((Ae, Le) => Ae + Le, 0) / f.perf.memory.accumulator.length));
|
|
627
631
|
};
|
|
628
632
|
let w = 0;
|
|
629
|
-
const S = 1, { pause: v
|
|
630
|
-
window.__TRES__DEVTOOLS__ && (
|
|
633
|
+
const S = 1, { pause: v } = we(({ delta: _ }) => {
|
|
634
|
+
window.__TRES__DEVTOOLS__ && (x({ timestamp: performance.now() }), w += _, w >= S && (window.__TRES__DEVTOOLS__.cb(f), w = 0));
|
|
631
635
|
}, { immediate: !0 });
|
|
632
|
-
return
|
|
636
|
+
return U(() => {
|
|
633
637
|
v();
|
|
634
638
|
}), f;
|
|
635
639
|
}
|
|
636
640
|
function dr() {
|
|
637
|
-
const e =
|
|
641
|
+
const e = Be("useTres");
|
|
638
642
|
if (!e)
|
|
639
643
|
throw new Error("useTresContext must be used together with useTresContextProvider");
|
|
640
644
|
return e;
|
|
641
645
|
}
|
|
642
|
-
const
|
|
646
|
+
const Vr = dr;
|
|
643
647
|
let g = null;
|
|
644
|
-
const { logError: pe } =
|
|
648
|
+
const { logError: pe } = P(), J = [
|
|
645
649
|
"onClick",
|
|
646
650
|
"onPointerMove",
|
|
647
651
|
"onPointerEnter",
|
|
@@ -649,7 +653,7 @@ const { logError: pe } = A(), Y = [
|
|
|
649
653
|
], fr = {
|
|
650
654
|
createElement(e, r, t, o) {
|
|
651
655
|
var n, a;
|
|
652
|
-
if (o || (o = {}), o.args || (o.args = []), e === "template" ||
|
|
656
|
+
if (o || (o = {}), o.args || (o.args = []), e === "template" || qt(e))
|
|
653
657
|
return null;
|
|
654
658
|
let s = e.replace("Tres", ""), i;
|
|
655
659
|
if (e === "primitive") {
|
|
@@ -672,12 +676,12 @@ const { logError: pe } = A(), Y = [
|
|
|
672
676
|
if (e != null && e.isObject3D) {
|
|
673
677
|
if (e != null && e.isCamera) {
|
|
674
678
|
if (!(g != null && g.userData.tres__registerCamera))
|
|
675
|
-
throw "could not find tres__registerCamera on scene's userData";
|
|
679
|
+
throw new Error("could not find tres__registerCamera on scene's userData");
|
|
676
680
|
(s = g == null ? void 0 : (o = g.userData).tres__registerCamera) == null || s.call(o, e);
|
|
677
681
|
}
|
|
678
|
-
if (e &&
|
|
682
|
+
if (e && J.some((a) => e[a])) {
|
|
679
683
|
if (!(g != null && g.userData.tres__registerAtPointerEventHandler))
|
|
680
|
-
throw "could not find tres__registerAtPointerEventHandler on scene's userData";
|
|
684
|
+
throw new Error("could not find tres__registerAtPointerEventHandler on scene's userData");
|
|
681
685
|
(n = g == null ? void 0 : (i = g.userData).tres__registerAtPointerEventHandler) == null || n.call(i, e);
|
|
682
686
|
}
|
|
683
687
|
}
|
|
@@ -694,14 +698,14 @@ const { logError: pe } = A(), Y = [
|
|
|
694
698
|
}, i = g == null ? void 0 : g.userData.tres__deregisterAtPointerEventHandler, n = g == null ? void 0 : g.userData.tres__deregisterBlockingObjectAtPointerEventHandler, a = (c) => {
|
|
695
699
|
var m, d;
|
|
696
700
|
if (!n)
|
|
697
|
-
throw "could not find tres__deregisterBlockingObjectAtPointerEventHandler on scene's userData";
|
|
701
|
+
throw new Error("could not find tres__deregisterBlockingObjectAtPointerEventHandler on scene's userData");
|
|
698
702
|
if ((d = g == null ? void 0 : (m = g.userData).tres__deregisterBlockingObjectAtPointerEventHandler) == null || d.call(m, c), !i)
|
|
699
|
-
throw "could not find tres__deregisterAtPointerEventHandler on scene's userData";
|
|
700
|
-
c &&
|
|
703
|
+
throw new Error("could not find tres__deregisterAtPointerEventHandler on scene's userData");
|
|
704
|
+
c && J.some((u) => c[u]) && (i == null || i(c));
|
|
701
705
|
}, l = (c) => {
|
|
702
706
|
const m = g == null ? void 0 : g.userData.tres__deregisterCamera;
|
|
703
707
|
if (!m)
|
|
704
|
-
throw "could not find tres__deregisterCamera on scene's userData";
|
|
708
|
+
throw new Error("could not find tres__deregisterCamera on scene's userData");
|
|
705
709
|
c.isCamera && (m == null || m(c));
|
|
706
710
|
};
|
|
707
711
|
(r = e.removeFromParent) == null || r.call(e), o.traverse((c) => {
|
|
@@ -719,7 +723,7 @@ const { logError: pe } = A(), Y = [
|
|
|
719
723
|
o || o === "" ? (i = g == null ? void 0 : (s = g.userData).tres__registerBlockingObjectAtPointerEventHandler) == null || i.call(s, e) : (a = g == null ? void 0 : (n = g.userData).tres__deregisterBlockingObjectAtPointerEventHandler) == null || a.call(n, e);
|
|
720
724
|
return;
|
|
721
725
|
}
|
|
722
|
-
let m =
|
|
726
|
+
let m = $(c), d = l == null ? void 0 : l[m];
|
|
723
727
|
if (c === "args") {
|
|
724
728
|
const f = e, h = t ?? [], p = o ?? [], y = e.userData.tres__name || e.type;
|
|
725
729
|
y && h.length && !Xt(h, p) && (l = Object.assign(f, new Z.value[y](...o)));
|
|
@@ -729,18 +733,18 @@ const { logError: pe } = A(), Y = [
|
|
|
729
733
|
if (c === "args")
|
|
730
734
|
return;
|
|
731
735
|
l.setAttribute(
|
|
732
|
-
|
|
733
|
-
new
|
|
736
|
+
$(c),
|
|
737
|
+
new tt(...o)
|
|
734
738
|
);
|
|
735
739
|
return;
|
|
736
740
|
}
|
|
737
741
|
if (c.includes("-") && d === void 0) {
|
|
738
742
|
const f = c.split("-");
|
|
739
|
-
d = f.reduce((h, p) => h[
|
|
743
|
+
d = f.reduce((h, p) => h[$(p)], l), c = f.pop(), m = c.toLowerCase(), d != null && d.set || (l = f.reduce((h, p) => h[$(p)], l));
|
|
740
744
|
}
|
|
741
745
|
let u = o;
|
|
742
746
|
if (u === "" && (u = !0), fe(d)) {
|
|
743
|
-
|
|
747
|
+
J.includes(r) || (Array.isArray(u) ? e[m](...u) : e[m](u));
|
|
744
748
|
return;
|
|
745
749
|
}
|
|
746
750
|
!(d != null && d.set) && !fe(d) ? l[m] = u : d.constructor === u.constructor && (d != null && d.copy) ? d == null || d.copy(u) : Array.isArray(u) ? d.set(...u) : !d.isColor && d.setScalar ? d.setScalar(u) : d.set(u);
|
|
@@ -758,24 +762,24 @@ const { logError: pe } = A(), Y = [
|
|
|
758
762
|
setScopeId: () => void 0,
|
|
759
763
|
cloneNode: () => void 0,
|
|
760
764
|
insertStaticContent: () => void 0
|
|
761
|
-
}, { render: pr } =
|
|
765
|
+
}, { render: pr } = je(fr);
|
|
762
766
|
oe(he);
|
|
763
767
|
function mr() {
|
|
764
|
-
return
|
|
768
|
+
return Se().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
|
765
769
|
}
|
|
766
|
-
function
|
|
770
|
+
function Se() {
|
|
767
771
|
return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
|
|
768
772
|
}
|
|
769
773
|
const gr = typeof Proxy == "function", vr = "devtools-plugin:setup", hr = "plugin:settings:set";
|
|
770
|
-
let
|
|
774
|
+
let O, ee;
|
|
771
775
|
function yr() {
|
|
772
776
|
var e;
|
|
773
|
-
return
|
|
777
|
+
return O !== void 0 || (typeof window < "u" && window.performance ? (O = !0, ee = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (O = !0, ee = globalThis.perf_hooks.performance) : O = !1), O;
|
|
774
778
|
}
|
|
775
779
|
function wr() {
|
|
776
780
|
return yr() ? ee.now() : Date.now();
|
|
777
781
|
}
|
|
778
|
-
class
|
|
782
|
+
class _r {
|
|
779
783
|
constructor(r, t) {
|
|
780
784
|
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = r, this.hook = t;
|
|
781
785
|
const o = {};
|
|
@@ -837,12 +841,12 @@ class br {
|
|
|
837
841
|
t.resolve(await this.target[t.method](...t.args));
|
|
838
842
|
}
|
|
839
843
|
}
|
|
840
|
-
function
|
|
841
|
-
const t = e, o =
|
|
844
|
+
function br(e, r) {
|
|
845
|
+
const t = e, o = Se(), s = mr(), i = gr && t.enableEarlyProxy;
|
|
842
846
|
if (s && (o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !i))
|
|
843
847
|
s.emit(vr, e, r);
|
|
844
848
|
else {
|
|
845
|
-
const n = i ? new
|
|
849
|
+
const n = i ? new _r(t, s) : null;
|
|
846
850
|
(o.__VUE_DEVTOOLS_PLUGINS__ = o.__VUE_DEVTOOLS_PLUGINS__ || []).push({
|
|
847
851
|
pluginDescriptor: t,
|
|
848
852
|
setupFn: r,
|
|
@@ -866,7 +870,7 @@ const ke = (e) => {
|
|
|
866
870
|
textColor: 5750629,
|
|
867
871
|
backgroundColor: 15793395
|
|
868
872
|
});
|
|
869
|
-
const t =
|
|
873
|
+
const t = Me(e);
|
|
870
874
|
return t > 0 && r.tags.push({
|
|
871
875
|
label: `${lr(t)} KB`,
|
|
872
876
|
textColor: 15707189,
|
|
@@ -888,26 +892,25 @@ const ke = (e) => {
|
|
|
888
892
|
backgroundColor: 16316922,
|
|
889
893
|
tooltip: "Field of view"
|
|
890
894
|
}), r.tags.push({
|
|
891
|
-
// eslint-disable-next-line max-len
|
|
892
895
|
label: `x: ${Math.round(e.position.x)} y: ${Math.round(e.position.y)} z: ${Math.round(e.position.z)}`,
|
|
893
896
|
textColor: 9738662,
|
|
894
897
|
backgroundColor: 16316922,
|
|
895
898
|
tooltip: "Position"
|
|
896
899
|
})), r;
|
|
897
900
|
};
|
|
898
|
-
function
|
|
901
|
+
function Pe(e, r) {
|
|
899
902
|
e.children.forEach((t) => {
|
|
900
903
|
if (t.type === "HightlightMesh")
|
|
901
904
|
return;
|
|
902
905
|
const o = ke(t);
|
|
903
|
-
r.children.push(o),
|
|
906
|
+
r.children.push(o), Pe(t, o);
|
|
904
907
|
});
|
|
905
908
|
}
|
|
906
|
-
const Cr = [],
|
|
909
|
+
const Cr = [], D = "tres:inspector", xr = ve({
|
|
907
910
|
sceneGraph: null
|
|
908
911
|
});
|
|
909
|
-
function
|
|
910
|
-
|
|
912
|
+
function Mr(e, r) {
|
|
913
|
+
br(
|
|
911
914
|
{
|
|
912
915
|
id: "dev.esm.tres",
|
|
913
916
|
label: "TresJS 🪐",
|
|
@@ -919,26 +922,25 @@ function xr(e, r) {
|
|
|
919
922
|
},
|
|
920
923
|
(t) => {
|
|
921
924
|
typeof t.now != "function" && Er(
|
|
922
|
-
// eslint-disable-next-line max-len
|
|
923
925
|
"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."
|
|
924
926
|
), t.addInspector({
|
|
925
|
-
id:
|
|
927
|
+
id: D,
|
|
926
928
|
label: "TresJS 🪐",
|
|
927
929
|
icon: "account_tree",
|
|
928
930
|
treeFilterPlaceholder: "Search instances"
|
|
929
931
|
}), setInterval(() => {
|
|
930
|
-
t.sendInspectorTree(
|
|
932
|
+
t.sendInspectorTree(D);
|
|
931
933
|
}, 1e3), setInterval(() => {
|
|
932
934
|
t.notifyComponentUpdate();
|
|
933
935
|
}, 5e3), t.on.getInspectorTree((i) => {
|
|
934
|
-
if (i.inspectorId ===
|
|
936
|
+
if (i.inspectorId === D) {
|
|
935
937
|
const n = ke(r.scene.value);
|
|
936
|
-
|
|
938
|
+
Pe(r.scene.value, n), xr.sceneGraph = n, i.rootNodes = [n];
|
|
937
939
|
}
|
|
938
940
|
});
|
|
939
941
|
let o = null, s = null;
|
|
940
942
|
t.on.getInspectorState((i) => {
|
|
941
|
-
if (i.inspectorId ===
|
|
943
|
+
if (i.inspectorId === D) {
|
|
942
944
|
const [n] = r.scene.value.getObjectsByProperty("uuid", i.nodeId);
|
|
943
945
|
if (!n)
|
|
944
946
|
return;
|
|
@@ -1034,12 +1036,12 @@ function xr(e, r) {
|
|
|
1034
1036
|
};
|
|
1035
1037
|
}
|
|
1036
1038
|
}), t.on.editInspectorState((i) => {
|
|
1037
|
-
i.inspectorId ===
|
|
1039
|
+
i.inspectorId === D && er(r.scene.value, i.nodeId, i.path, i.state.value);
|
|
1038
1040
|
});
|
|
1039
1041
|
}
|
|
1040
1042
|
);
|
|
1041
1043
|
}
|
|
1042
|
-
const Sr = ["data-scene", "data-tres"],
|
|
1044
|
+
const Sr = ["data-scene", "data-tres"], kr = /* @__PURE__ */ ne({
|
|
1043
1045
|
__name: "TresCanvas",
|
|
1044
1046
|
props: {
|
|
1045
1047
|
shadows: { type: Boolean, default: void 0 },
|
|
@@ -1067,30 +1069,30 @@ const Sr = ["data-scene", "data-tres"], Pr = /* @__PURE__ */ ne({
|
|
|
1067
1069
|
},
|
|
1068
1070
|
setup(e, { expose: r }) {
|
|
1069
1071
|
var h;
|
|
1070
|
-
const t = e, { logWarning:
|
|
1072
|
+
const t = e, o = He(), { logWarning: s } = P(), i = A(), n = H(new rt()), { resume: a } = G(), l = (h = se()) == null ? void 0 : h.appContext.app, c = (p) => ne({
|
|
1071
1073
|
setup() {
|
|
1072
1074
|
var b;
|
|
1073
1075
|
const y = (b = se()) == null ? void 0 : b.appContext;
|
|
1074
|
-
return y && (y.app = l), K("useTres", p), K("extend", oe), typeof window < "u" &&
|
|
1076
|
+
return y && (y.app = l), K("useTres", p), K("extend", oe), typeof window < "u" && Mr(y.app, p), () => ie(Ve, null, o != null && o.default ? o.default() : []);
|
|
1075
1077
|
}
|
|
1076
1078
|
}), m = (p) => {
|
|
1077
1079
|
const y = c(p);
|
|
1078
|
-
pr(ie(y),
|
|
1080
|
+
pr(ie(y), n.value);
|
|
1079
1081
|
}, d = (p, y = !1) => {
|
|
1080
|
-
|
|
1081
|
-
}, u =
|
|
1082
|
-
return r({ context: f, dispose: () => d(f.value, !0) }),
|
|
1083
|
-
const p =
|
|
1082
|
+
n.value.children = [], y && (p.renderer.value.dispose(), p.renderer.value.renderLists.dispose(), p.renderer.value.forceContextLoss()), m(p), a();
|
|
1083
|
+
}, u = L(() => t.disableRender), f = H(null);
|
|
1084
|
+
return r({ context: f, dispose: () => d(f.value, !0) }), Re(() => {
|
|
1085
|
+
const p = i;
|
|
1084
1086
|
f.value = cr({
|
|
1085
|
-
scene:
|
|
1087
|
+
scene: n.value,
|
|
1086
1088
|
canvas: p,
|
|
1087
1089
|
windowSize: t.windowSize,
|
|
1088
1090
|
disableRender: u,
|
|
1089
1091
|
rendererOptions: t
|
|
1090
|
-
}), ar({ scene:
|
|
1091
|
-
const { registerCamera: y, camera: b, cameras:
|
|
1092
|
+
}), ar({ scene: n.value, contextParts: f.value });
|
|
1093
|
+
const { registerCamera: y, camera: b, cameras: M, deregisterCamera: C } = f.value;
|
|
1092
1094
|
m(f.value);
|
|
1093
|
-
const
|
|
1095
|
+
const x = () => {
|
|
1094
1096
|
const w = new X(
|
|
1095
1097
|
45,
|
|
1096
1098
|
window.innerWidth / window.innerHeight,
|
|
@@ -1098,8 +1100,8 @@ const Sr = ["data-scene", "data-tres"], Pr = /* @__PURE__ */ ne({
|
|
|
1098
1100
|
1e3
|
|
1099
1101
|
);
|
|
1100
1102
|
w.position.set(3, 3, 3), w.lookAt(0, 0, 0), y(w);
|
|
1101
|
-
const S =
|
|
1102
|
-
|
|
1103
|
+
const S = B(() => {
|
|
1104
|
+
M.value.length >= 2 && (w.removeFromParent(), C(w), S == null || S());
|
|
1103
1105
|
});
|
|
1104
1106
|
};
|
|
1105
1107
|
ge(
|
|
@@ -1110,15 +1112,15 @@ const Sr = ["data-scene", "data-tres"], Pr = /* @__PURE__ */ ne({
|
|
|
1110
1112
|
{
|
|
1111
1113
|
immediate: !0
|
|
1112
1114
|
}
|
|
1113
|
-
), b.value || (
|
|
1115
|
+
), b.value || (s(
|
|
1114
1116
|
"No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
|
|
1115
|
-
),
|
|
1116
|
-
}), (p, y) => (
|
|
1117
|
+
), x());
|
|
1118
|
+
}), (p, y) => (Ie(), $e("canvas", {
|
|
1117
1119
|
ref_key: "canvas",
|
|
1118
|
-
ref:
|
|
1119
|
-
"data-scene":
|
|
1120
|
-
class:
|
|
1121
|
-
"data-tres": `tresjs ${
|
|
1120
|
+
ref: i,
|
|
1121
|
+
"data-scene": n.value.uuid,
|
|
1122
|
+
class: ze(p.$attrs.class),
|
|
1123
|
+
"data-tres": `tresjs ${Ne(zt).version}`,
|
|
1122
1124
|
style: We({
|
|
1123
1125
|
display: "block",
|
|
1124
1126
|
width: "100%",
|
|
@@ -1132,17 +1134,17 @@ const Sr = ["data-scene", "data-tres"], Pr = /* @__PURE__ */ ne({
|
|
|
1132
1134
|
})
|
|
1133
1135
|
}, null, 14, Sr));
|
|
1134
1136
|
}
|
|
1135
|
-
}),
|
|
1137
|
+
}), Pr = [
|
|
1136
1138
|
"TresCanvas",
|
|
1137
1139
|
"TresLeches",
|
|
1138
1140
|
"TresScene"
|
|
1139
1141
|
], Tr = {
|
|
1140
1142
|
template: {
|
|
1141
1143
|
compilerOptions: {
|
|
1142
|
-
isCustomElement: (e) => e.startsWith("Tres") && !
|
|
1144
|
+
isCustomElement: (e) => e.startsWith("Tres") && !Pr.includes(e) || e === "primitive"
|
|
1143
1145
|
}
|
|
1144
1146
|
}
|
|
1145
|
-
},
|
|
1147
|
+
}, Fr = Tr, Ur = {
|
|
1146
1148
|
mounted: (e, r) => {
|
|
1147
1149
|
if (r.arg) {
|
|
1148
1150
|
console.log(`v-log:${r.arg}`, e[r.arg]);
|
|
@@ -1151,14 +1153,14 @@ const Sr = ["data-scene", "data-tres"], Pr = /* @__PURE__ */ ne({
|
|
|
1151
1153
|
console.log("v-log", e);
|
|
1152
1154
|
}
|
|
1153
1155
|
};
|
|
1154
|
-
class
|
|
1156
|
+
class Te extends ot {
|
|
1155
1157
|
constructor(r, t) {
|
|
1156
1158
|
const o = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], s = new ae();
|
|
1157
1159
|
s.setAttribute("position", new le(o, 3)), s.computeBoundingSphere();
|
|
1158
|
-
const i = new
|
|
1160
|
+
const i = new nt({ fog: !1 });
|
|
1159
1161
|
super(s, i), this.light = r, this.color = t, this.type = "RectAreaLightHelper";
|
|
1160
1162
|
const n = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], a = new ae();
|
|
1161
|
-
a.setAttribute("position", new le(n, 3)), a.computeBoundingSphere(), this.add(new
|
|
1163
|
+
a.setAttribute("position", new le(n, 3)), a.computeBoundingSphere(), this.add(new st(a, new ye({ side: it, fog: !1 })));
|
|
1162
1164
|
}
|
|
1163
1165
|
updateMatrixWorld() {
|
|
1164
1166
|
if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
|
|
@@ -1174,45 +1176,47 @@ class Ae extends nt {
|
|
|
1174
1176
|
this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
|
|
1175
1177
|
}
|
|
1176
1178
|
}
|
|
1177
|
-
const { logWarning: me } =
|
|
1178
|
-
let
|
|
1179
|
+
const { logWarning: me } = P();
|
|
1180
|
+
let N, T;
|
|
1179
1181
|
const Ar = {
|
|
1180
|
-
DirectionalLight:
|
|
1181
|
-
PointLight:
|
|
1182
|
-
SpotLight:
|
|
1183
|
-
HemisphereLight:
|
|
1184
|
-
RectAreaLight:
|
|
1185
|
-
},
|
|
1182
|
+
DirectionalLight: at,
|
|
1183
|
+
PointLight: lt,
|
|
1184
|
+
SpotLight: ut,
|
|
1185
|
+
HemisphereLight: ct,
|
|
1186
|
+
RectAreaLight: Te
|
|
1187
|
+
}, Gr = {
|
|
1186
1188
|
mounted: (e) => {
|
|
1187
1189
|
if (!e.isLight) {
|
|
1188
1190
|
me(`${e.type} is not a light`);
|
|
1189
1191
|
return;
|
|
1190
1192
|
}
|
|
1191
|
-
|
|
1193
|
+
N = Ar[e.type], e.parent.add(new N(e, 1, e.color.getHex()));
|
|
1192
1194
|
},
|
|
1193
1195
|
updated: (e) => {
|
|
1194
|
-
|
|
1196
|
+
T = e.parent.children.find((r) => r instanceof N), !(T instanceof Te) && T.update();
|
|
1195
1197
|
},
|
|
1196
1198
|
unmounted: (e) => {
|
|
1197
1199
|
if (!e.isLight) {
|
|
1198
1200
|
me(`${e.type} is not a light`);
|
|
1199
1201
|
return;
|
|
1200
1202
|
}
|
|
1201
|
-
|
|
1203
|
+
T = e.parent.children.find((r) => r instanceof N), T && T.dispose && T.dispose(), e.parent.remove(T);
|
|
1202
1204
|
}
|
|
1203
|
-
}, { logWarning: Lr } =
|
|
1205
|
+
}, { logWarning: Lr } = P(), Qr = {
|
|
1204
1206
|
updated: (e, r) => {
|
|
1205
1207
|
const t = xe(r);
|
|
1206
1208
|
if (!t) {
|
|
1207
1209
|
Lr(`v-always-look-at: problem with binding value: ${r.value}`);
|
|
1208
1210
|
return;
|
|
1209
1211
|
}
|
|
1210
|
-
const { onLoop: o } =
|
|
1212
|
+
const { onLoop: o } = G();
|
|
1211
1213
|
o(() => {
|
|
1212
1214
|
e.lookAt(t);
|
|
1213
1215
|
});
|
|
1214
1216
|
}
|
|
1215
|
-
}, { logWarning: Or } =
|
|
1217
|
+
}, { logWarning: Or } = P();
|
|
1218
|
+
let k = null;
|
|
1219
|
+
const qr = {
|
|
1216
1220
|
updated: (e, r) => {
|
|
1217
1221
|
var s;
|
|
1218
1222
|
const t = xe(r);
|
|
@@ -1220,9 +1224,9 @@ const Ar = {
|
|
|
1220
1224
|
Or(`v-distance-to: problem with binding value: ${r.value}`);
|
|
1221
1225
|
return;
|
|
1222
1226
|
}
|
|
1223
|
-
|
|
1227
|
+
k && (k.dispose(), e.parent.remove(k));
|
|
1224
1228
|
const o = t.clone().sub(e.position);
|
|
1225
|
-
o.normalize(),
|
|
1229
|
+
o.normalize(), k = new dt(o, e.position, e.position.distanceTo(t), 16776960), e.parent.add(k), console.table(
|
|
1226
1230
|
[
|
|
1227
1231
|
["Distance:", e.position.distanceTo(t)],
|
|
1228
1232
|
[`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(s = e.position) == null ? void 0 : s.z}`],
|
|
@@ -1231,39 +1235,51 @@ const Ar = {
|
|
|
1231
1235
|
);
|
|
1232
1236
|
},
|
|
1233
1237
|
unmounted: (e) => {
|
|
1234
|
-
|
|
1238
|
+
k == null || k.dispose(), e.parent.remove(k);
|
|
1235
1239
|
}
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
|
|
1240
|
+
}, { logWarning: Dr } = P(), Jr = {
|
|
1241
|
+
mounted: (e, r) => {
|
|
1242
|
+
if (e.isCamera) {
|
|
1243
|
+
Dr(`Rotate the ${e.type} is not a good idea`);
|
|
1244
|
+
return;
|
|
1245
|
+
}
|
|
1246
|
+
const t = r.value ?? 0.01, o = A(r.modifiers.x || r.arg === "x" ? 1 : 0), s = A(r.modifiers.y || r.arg === "y" ? 1 : 0), i = A(r.modifiers.z || r.arg === "z" ? 1 : 0);
|
|
1247
|
+
o.value + s.value + i.value === 0 && (o.value = 1, s.value = 1);
|
|
1248
|
+
const n = new ft().setFromAxisAngle(new te(o.value, s.value, i.value).normalize(), t), { onLoop: a } = G();
|
|
1249
|
+
a(() => {
|
|
1250
|
+
e.applyQuaternion(n);
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
}, Yr = {
|
|
1239
1254
|
install(e) {
|
|
1240
|
-
e.component("TresCanvas",
|
|
1255
|
+
e.component("TresCanvas", kr);
|
|
1241
1256
|
}
|
|
1242
1257
|
};
|
|
1243
1258
|
export {
|
|
1244
|
-
|
|
1259
|
+
kr as TresCanvas,
|
|
1245
1260
|
Z as catalogue,
|
|
1246
|
-
|
|
1261
|
+
Yr as default,
|
|
1247
1262
|
oe as extend,
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1263
|
+
Ir as isProd,
|
|
1264
|
+
Ut as normalizeColor,
|
|
1265
|
+
$r as normalizeVectorFlexibleParam,
|
|
1266
|
+
Fr as templateCompilerOptions,
|
|
1252
1267
|
sr as trasverseObjects,
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1268
|
+
Nt as useCamera,
|
|
1269
|
+
zr as useLoader,
|
|
1270
|
+
P as useLogger,
|
|
1256
1271
|
ar as usePointerEventHandler,
|
|
1257
1272
|
ir as useRaycaster,
|
|
1258
|
-
|
|
1273
|
+
G as useRenderLoop,
|
|
1259
1274
|
or as useRenderer,
|
|
1260
|
-
|
|
1275
|
+
Wr as useSeek,
|
|
1261
1276
|
Nr as useTexture,
|
|
1262
|
-
|
|
1277
|
+
Vr as useTres,
|
|
1263
1278
|
dr as useTresContext,
|
|
1264
1279
|
cr as useTresContextProvider,
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
Ur as vLog
|
|
1280
|
+
Qr as vAlwaysLookAt,
|
|
1281
|
+
qr as vDistanceTo,
|
|
1282
|
+
Gr as vLightHelper,
|
|
1283
|
+
Ur as vLog,
|
|
1284
|
+
Jr as vRotate
|
|
1269
1285
|
};
|