@tresjs/core 4.0.2 → 4.1.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 +5 -1
- package/dist/src/components/TresCanvas.vue.d.ts +2 -0
- package/dist/src/composables/index.d.ts +1 -0
- package/dist/src/composables/useCamera/index.d.ts +2 -2
- package/dist/src/composables/useRaycaster/index.d.ts +1 -1
- package/dist/src/composables/useTresContextProvider/index.d.ts +2 -2
- package/dist/src/composables/useTresEventManager/index.d.ts +5 -5
- package/dist/src/composables/useTresReady/createReadyEventHook/index.d.ts +5 -0
- package/dist/src/composables/useTresReady/index.d.ts +8 -0
- package/dist/src/core/loop.d.ts +1 -0
- package/dist/src/core/nodeOps.d.ts +2 -2
- package/dist/src/types/index.d.ts +11 -8
- package/dist/src/utils/index.d.ts +6 -0
- package/dist/src/utils/is.d.ts +12 -0
- package/dist/src/utils/nodeOpsUtils.d.ts +6 -0
- package/dist/tres.js +1056 -939
- package/dist/tres.umd.cjs +2 -2
- package/package.json +2 -1
package/dist/tres.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version: v4.0
|
|
3
|
+
* version: v4.1.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
|
|
12
|
-
import * as
|
|
13
|
-
import { PerspectiveCamera as
|
|
14
|
-
import { createEventHook as
|
|
15
|
-
const
|
|
8
|
+
var gt = Object.defineProperty;
|
|
9
|
+
var ht = (e, t, n) => t in e ? gt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
10
|
+
var ue = (e, t, n) => (ht(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
11
|
+
import { ref as D, computed as j, watchEffect as Me, onUnmounted as Y, shallowRef as $, watch as J, reactive as Ke, readonly as me, unref as V, provide as ge, inject as vt, defineComponent as Le, useSlots as yt, getCurrentInstance as Re, onMounted as wt, openBlock as bt, createElementBlock as Mt, normalizeClass as _t, normalizeStyle as Pt, createRenderer as Ct, h as De, Fragment as Et } from "vue";
|
|
12
|
+
import * as Xe from "three";
|
|
13
|
+
import { PerspectiveCamera as he, Camera as kt, Clock as Ze, Vector3 as _e, Color as se, Scene as et, MeshBasicMaterial as tt, DoubleSide as St, REVISION as Tt, SRGBColorSpace as At, ACESFilmicToneMapping as nt, PCFSoftShadowMap as Ot, NoToneMapping as xt, WebGLRenderer as fe, TextureLoader as Lt, Vector2 as de, MathUtils as Rt, Raycaster as Dt, BufferAttribute as Bt, Object3D as jt, Line as It, BufferGeometry as Be, Float32BufferAttribute as je, LineBasicMaterial as Ht, Mesh as Ut, BackSide as $t, DirectionalLightHelper as Ft, PointLightHelper as Wt, SpotLightHelper as Nt, HemisphereLightHelper as Gt, ArrowHelper as zt } from "three";
|
|
14
|
+
import { createEventHook as L, useRafFn as rt, toValue as A, unrefElement as Vt, useDevicePixelRatio as Yt, usePointer as qt, useElementBounding as Jt, useWindowSize as Qt, useElementSize as Kt, refDebounced as Ie, tryOnScopeDispose as Xt, useFps as Zt, useMemory as en } from "@vueuse/core";
|
|
15
|
+
const tn = "@tresjs/core", nn = "module", rn = "4.1.0", on = "pnpm@9.1.4", sn = "Declarative ThreeJS using Vue Components", an = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", ln = "MIT", cn = [
|
|
16
16
|
"vue",
|
|
17
17
|
"3d",
|
|
18
18
|
"threejs",
|
|
19
19
|
"three",
|
|
20
20
|
"threejs-vue"
|
|
21
|
-
],
|
|
21
|
+
], un = !1, fn = {
|
|
22
22
|
".": {
|
|
23
23
|
types: "./dist/index.d.ts",
|
|
24
24
|
import: "./dist/tres.js",
|
|
@@ -37,12 +37,12 @@ const qt = "@tresjs/core", Yt = "module", Jt = "4.0.2", Qt = "pnpm@9.1.4", Kt =
|
|
|
37
37
|
types: "./dist/src/utils/index.d.ts"
|
|
38
38
|
},
|
|
39
39
|
"./*": "./*"
|
|
40
|
-
},
|
|
40
|
+
}, dn = "./dist/tres.js", pn = "./dist/tres.js", mn = "./dist/index.d.ts", gn = [
|
|
41
41
|
"*.d.ts",
|
|
42
42
|
"dist"
|
|
43
|
-
],
|
|
43
|
+
], hn = {
|
|
44
44
|
access: "public"
|
|
45
|
-
},
|
|
45
|
+
}, vn = {
|
|
46
46
|
dev: "cd playground && npm run dev",
|
|
47
47
|
build: "vite build",
|
|
48
48
|
playground: "cd playground && npm run dev",
|
|
@@ -59,14 +59,14 @@ const qt = "@tresjs/core", Yt = "module", Jt = "4.0.2", Qt = "pnpm@9.1.4", Kt =
|
|
|
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
|
+
}, yn = {
|
|
63
63
|
three: ">=0.133",
|
|
64
64
|
vue: ">=3.4"
|
|
65
|
-
},
|
|
65
|
+
}, wn = {
|
|
66
66
|
"@alvarosabu/utils": "^3.2.0",
|
|
67
67
|
"@vue/devtools-api": "^6.6.2",
|
|
68
68
|
"@vueuse/core": "^10.10.0"
|
|
69
|
-
},
|
|
69
|
+
}, bn = {
|
|
70
70
|
"@release-it/conventional-changelog": "^8.0.1",
|
|
71
71
|
"@stackblitz/sdk": "^1.10.0",
|
|
72
72
|
"@tresjs/cientos": "3.9.0",
|
|
@@ -92,6 +92,7 @@ const qt = "@tresjs/core", Yt = "module", Jt = "4.0.2", Qt = "pnpm@9.1.4", Kt =
|
|
|
92
92
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
93
93
|
"rollup-plugin-copy": "^3.5.0",
|
|
94
94
|
"rollup-plugin-visualizer": "^5.12.0",
|
|
95
|
+
sponsorkit: "^0.14.6",
|
|
95
96
|
three: "^0.165.0",
|
|
96
97
|
unocss: "^0.60.4",
|
|
97
98
|
unplugin: "^1.10.1",
|
|
@@ -106,686 +107,784 @@ const qt = "@tresjs/core", Yt = "module", Jt = "4.0.2", Qt = "pnpm@9.1.4", Kt =
|
|
|
106
107
|
vitest: "^1.6.0",
|
|
107
108
|
vue: "^3.4.27",
|
|
108
109
|
"vue-demi": "^0.14.8"
|
|
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
|
-
}
|
|
130
|
-
|
|
110
|
+
}, Mn = {
|
|
111
|
+
name: tn,
|
|
112
|
+
type: nn,
|
|
113
|
+
version: rn,
|
|
114
|
+
packageManager: on,
|
|
115
|
+
description: sn,
|
|
116
|
+
author: an,
|
|
117
|
+
license: ln,
|
|
118
|
+
keywords: cn,
|
|
119
|
+
sideEffects: un,
|
|
120
|
+
exports: fn,
|
|
121
|
+
main: dn,
|
|
122
|
+
module: pn,
|
|
123
|
+
types: mn,
|
|
124
|
+
files: gn,
|
|
125
|
+
publishConfig: hn,
|
|
126
|
+
scripts: vn,
|
|
127
|
+
peerDependencies: yn,
|
|
128
|
+
dependencies: wn,
|
|
129
|
+
devDependencies: bn
|
|
130
|
+
};
|
|
131
|
+
function ve(e) {
|
|
132
|
+
return Array.isArray(e);
|
|
133
|
+
}
|
|
134
|
+
function Q(e) {
|
|
135
|
+
return typeof e == "function";
|
|
136
|
+
}
|
|
137
|
+
function Z(e) {
|
|
138
|
+
return e === Object(e) && !ve(e) && !Q(e);
|
|
139
|
+
}
|
|
140
|
+
function W(e) {
|
|
141
|
+
return Z(e) && "isObject3D" in e && !!e.isObject3D;
|
|
142
|
+
}
|
|
143
|
+
function He(e) {
|
|
144
|
+
return Z(e) && "isCamera" in e && !!e.isCamera;
|
|
145
|
+
}
|
|
146
|
+
function _n(e) {
|
|
147
|
+
return Z(e) && "isBufferGeometry" in e && !!e.isBufferGeometry;
|
|
148
|
+
}
|
|
149
|
+
function Pn(e) {
|
|
150
|
+
return Z(e) && "isMaterial" in e && !!e.isMaterial;
|
|
151
|
+
}
|
|
152
|
+
function ot(e) {
|
|
153
|
+
return Z(e) && "isFog" in e && !!e.isFog;
|
|
154
|
+
}
|
|
155
|
+
function Ue(e) {
|
|
156
|
+
return W(e) || _n(e) || Pn(e) || ot(e);
|
|
157
|
+
}
|
|
158
|
+
const Cn = ({ sizes: e }) => {
|
|
159
|
+
const t = D([]), n = j(
|
|
131
160
|
() => t.value[0]
|
|
132
|
-
),
|
|
133
|
-
const
|
|
134
|
-
if (!
|
|
161
|
+
), r = (i) => {
|
|
162
|
+
const a = i instanceof kt ? i : t.value.find((o) => o.uuid === i);
|
|
163
|
+
if (!a)
|
|
135
164
|
return;
|
|
136
|
-
const
|
|
137
|
-
t.value = [
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
165
|
+
const d = t.value.filter(({ uuid: o }) => o !== a.uuid);
|
|
166
|
+
t.value = [a, ...d];
|
|
167
|
+
}, s = (i, a = !1) => {
|
|
168
|
+
if (He(i)) {
|
|
169
|
+
const d = i;
|
|
170
|
+
if (t.value.some(({ uuid: o }) => o === d.uuid))
|
|
171
|
+
return;
|
|
172
|
+
a ? r(d) : t.value.push(d);
|
|
173
|
+
}
|
|
174
|
+
}, l = (i) => {
|
|
175
|
+
if (He(i)) {
|
|
176
|
+
const a = i;
|
|
177
|
+
t.value = t.value.filter(({ uuid: d }) => d !== a.uuid);
|
|
178
|
+
}
|
|
142
179
|
};
|
|
143
|
-
return
|
|
144
|
-
e.aspectRatio.value && t.value.forEach((
|
|
145
|
-
!
|
|
180
|
+
return Me(() => {
|
|
181
|
+
e.aspectRatio.value && t.value.forEach((i) => {
|
|
182
|
+
!i.manual && (i instanceof he || En(i)) && (i instanceof he ? i.aspect = e.aspectRatio.value : (i.left = e.width.value * -0.5, i.right = e.width.value * 0.5, i.top = e.height.value * 0.5, i.bottom = e.height.value * -0.5), i.updateProjectionMatrix());
|
|
146
183
|
});
|
|
147
|
-
}),
|
|
184
|
+
}), Y(() => {
|
|
148
185
|
t.value = [];
|
|
149
186
|
}), {
|
|
150
|
-
camera:
|
|
187
|
+
camera: n,
|
|
151
188
|
cameras: t,
|
|
152
|
-
registerCamera:
|
|
153
|
-
deregisterCamera:
|
|
154
|
-
setCameraActive:
|
|
189
|
+
registerCamera: s,
|
|
190
|
+
deregisterCamera: l,
|
|
191
|
+
setCameraActive: r
|
|
155
192
|
};
|
|
156
193
|
};
|
|
157
|
-
function
|
|
194
|
+
function En(e) {
|
|
158
195
|
return e.hasOwnProperty("isOrthographicCamera") && e.isOrthographicCamera;
|
|
159
196
|
}
|
|
160
|
-
const
|
|
161
|
-
let
|
|
162
|
-
const { pause:
|
|
197
|
+
const it = L(), st = L(), Pe = L(), K = new Ze();
|
|
198
|
+
let ae = 0, le = 0;
|
|
199
|
+
const { pause: kn, resume: $e, isActive: Sn } = rt(
|
|
163
200
|
() => {
|
|
164
|
-
|
|
201
|
+
it.trigger({ delta: ae, elapsed: le, clock: K }), st.trigger({ delta: ae, elapsed: le, clock: K }), Pe.trigger({ delta: ae, elapsed: le, clock: K });
|
|
165
202
|
},
|
|
166
203
|
{ immediate: !1 }
|
|
167
204
|
);
|
|
168
|
-
|
|
169
|
-
|
|
205
|
+
Pe.on(() => {
|
|
206
|
+
ae = K.getDelta(), le = K.getElapsedTime();
|
|
170
207
|
});
|
|
171
|
-
let
|
|
172
|
-
const
|
|
173
|
-
onBeforeLoop:
|
|
174
|
-
onLoop:
|
|
175
|
-
onAfterLoop:
|
|
176
|
-
pause:
|
|
177
|
-
resume:
|
|
178
|
-
isActive:
|
|
179
|
-
}),
|
|
180
|
-
function
|
|
181
|
-
function e(...
|
|
182
|
-
typeof
|
|
208
|
+
let Fe = !1;
|
|
209
|
+
const Pr = () => (Fe || (Fe = !0, $e()), {
|
|
210
|
+
onBeforeLoop: it.on,
|
|
211
|
+
onLoop: st.on,
|
|
212
|
+
onAfterLoop: Pe.on,
|
|
213
|
+
pause: kn,
|
|
214
|
+
resume: $e,
|
|
215
|
+
isActive: Sn
|
|
216
|
+
}), Cr = !0, ne = "[TresJS ▲ ■ ●] ";
|
|
217
|
+
function F() {
|
|
218
|
+
function e(...r) {
|
|
219
|
+
typeof r[0] == "string" ? r[0] = ne + r[0] : r.unshift(ne), console.error(...r);
|
|
183
220
|
}
|
|
184
|
-
function t(...
|
|
185
|
-
typeof
|
|
221
|
+
function t(...r) {
|
|
222
|
+
typeof r[0] == "string" ? r[0] = ne + r[0] : r.unshift(ne), console.warn(...r);
|
|
186
223
|
}
|
|
187
|
-
function r
|
|
224
|
+
function n(r, s) {
|
|
188
225
|
}
|
|
189
226
|
return {
|
|
190
227
|
logError: e,
|
|
191
228
|
logWarning: t,
|
|
192
|
-
logMessage:
|
|
229
|
+
logMessage: n
|
|
193
230
|
};
|
|
194
231
|
}
|
|
195
|
-
function
|
|
196
|
-
return typeof e == "number" ? [e, e, e] : e instanceof
|
|
232
|
+
function Er(e) {
|
|
233
|
+
return typeof e == "number" ? [e, e, e] : e instanceof _e ? [e.x, e.y, e.z] : e;
|
|
197
234
|
}
|
|
198
|
-
function
|
|
199
|
-
return e instanceof
|
|
235
|
+
function Tn(e) {
|
|
236
|
+
return e instanceof se ? e : Array.isArray(e) ? new se(...e) : new se(e);
|
|
200
237
|
}
|
|
201
|
-
class
|
|
202
|
-
constructor(...
|
|
203
|
-
super(...
|
|
204
|
-
|
|
205
|
-
|
|
238
|
+
class An extends Xe.Mesh {
|
|
239
|
+
constructor(...n) {
|
|
240
|
+
super(...n);
|
|
241
|
+
ue(this, "type", "HightlightMesh");
|
|
242
|
+
ue(this, "createTime");
|
|
206
243
|
this.createTime = Date.now();
|
|
207
244
|
}
|
|
208
245
|
onBeforeRender() {
|
|
209
|
-
const
|
|
210
|
-
this.scale.set(
|
|
246
|
+
const r = (Date.now() - this.createTime) / 1e3, i = 1 + 0.07 * Math.sin(2.5 * r);
|
|
247
|
+
this.scale.set(i, i, i);
|
|
211
248
|
}
|
|
212
249
|
}
|
|
213
|
-
const
|
|
214
|
-
for (const
|
|
215
|
-
t[
|
|
250
|
+
const at = (e, t) => {
|
|
251
|
+
for (const n of Object.keys(t))
|
|
252
|
+
t[n] instanceof Object && Object.assign(t[n], at(e[n], t[n]));
|
|
216
253
|
return Object.assign(e || {}, t), e;
|
|
217
|
-
},
|
|
218
|
-
function
|
|
254
|
+
}, On = "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", xn = /* @__PURE__ */ Dn(On);
|
|
255
|
+
function We(e) {
|
|
219
256
|
return e && e.nodeType === 1;
|
|
220
257
|
}
|
|
221
|
-
function
|
|
222
|
-
return e.replace(/-([a-z])/g, (t,
|
|
258
|
+
function re(e) {
|
|
259
|
+
return e.replace(/-([a-z])/g, (t, n) => n.toUpperCase());
|
|
223
260
|
}
|
|
224
|
-
const
|
|
225
|
-
function
|
|
226
|
-
return e.replace(
|
|
261
|
+
const Ln = /\B([A-Z])/g;
|
|
262
|
+
function Rn(e) {
|
|
263
|
+
return e.replace(Ln, "-$1").toLowerCase();
|
|
227
264
|
}
|
|
228
|
-
function
|
|
229
|
-
const
|
|
230
|
-
for (let
|
|
231
|
-
r[
|
|
232
|
-
return (
|
|
265
|
+
function Dn(e, t) {
|
|
266
|
+
const n = /* @__PURE__ */ Object.create(null), r = e.split(",");
|
|
267
|
+
for (let s = 0; s < r.length; s++)
|
|
268
|
+
n[r[s]] = !0;
|
|
269
|
+
return (s) => !!n[s];
|
|
233
270
|
}
|
|
234
|
-
const
|
|
235
|
-
const
|
|
236
|
-
for (const
|
|
237
|
-
const
|
|
238
|
-
|
|
271
|
+
const Bn = (e, t) => {
|
|
272
|
+
const n = /* @__PURE__ */ new Set(), r = [];
|
|
273
|
+
for (const s of e) {
|
|
274
|
+
const l = t(s);
|
|
275
|
+
n.has(l) || (n.add(l), r.push(s));
|
|
239
276
|
}
|
|
240
|
-
return
|
|
241
|
-
},
|
|
277
|
+
return r;
|
|
278
|
+
}, Ne = (e, t) => {
|
|
242
279
|
if (!t)
|
|
243
280
|
return;
|
|
281
|
+
const n = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
|
|
282
|
+
return n == null ? void 0 : n.reduce((r, s) => r && r[s], e);
|
|
283
|
+
}, jn = (e, t, n) => {
|
|
244
284
|
const r = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
|
|
245
|
-
|
|
246
|
-
}, Er = (e, t, r) => {
|
|
247
|
-
const o = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
|
|
248
|
-
o && o.reduce((i, u, a) => (i[u] === void 0 && (i[u] = {}), a === o.length - 1 && (i[u] = r), i[u]), e);
|
|
285
|
+
r && r.reduce((s, l, i) => (s[l] === void 0 && (s[l] = {}), i === r.length - 1 && (s[l] = n), s[l]), e);
|
|
249
286
|
};
|
|
250
|
-
function
|
|
251
|
-
if (
|
|
252
|
-
const
|
|
253
|
-
return
|
|
287
|
+
function lt(e, t) {
|
|
288
|
+
if (We(e) && We(t)) {
|
|
289
|
+
const s = e.attributes, l = t.attributes;
|
|
290
|
+
return s.length !== l.length ? !1 : Array.from(s).every(({ name: i, value: a }) => t.getAttribute(i) === a);
|
|
254
291
|
}
|
|
255
292
|
if (e === t)
|
|
256
293
|
return !0;
|
|
257
294
|
if (e === null || typeof e != "object" || t === null || typeof t != "object")
|
|
258
295
|
return !1;
|
|
259
|
-
const
|
|
260
|
-
if (
|
|
296
|
+
const n = Object.keys(e), r = Object.keys(t);
|
|
297
|
+
if (n.length !== r.length)
|
|
261
298
|
return !1;
|
|
262
|
-
for (const
|
|
263
|
-
if (!
|
|
299
|
+
for (const s of n)
|
|
300
|
+
if (!r.includes(s) || !lt(e[s], t[s]))
|
|
264
301
|
return !1;
|
|
265
302
|
return !0;
|
|
266
303
|
}
|
|
267
|
-
function
|
|
304
|
+
function In(e, t) {
|
|
268
305
|
if (!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length)
|
|
269
306
|
return !1;
|
|
270
|
-
for (let
|
|
271
|
-
if (!
|
|
307
|
+
for (let n = 0; n < e.length; n++)
|
|
308
|
+
if (!lt(e[n], t[n]))
|
|
272
309
|
return !1;
|
|
273
310
|
return !0;
|
|
274
311
|
}
|
|
275
|
-
const
|
|
276
|
-
function
|
|
277
|
-
const
|
|
278
|
-
if (
|
|
279
|
-
return
|
|
280
|
-
for (const
|
|
281
|
-
const h =
|
|
312
|
+
const Hn = Array.isArray;
|
|
313
|
+
function Un(e, t, n, r) {
|
|
314
|
+
const s = (d) => {
|
|
315
|
+
if (d.uuid === t)
|
|
316
|
+
return d;
|
|
317
|
+
for (const o of d.children) {
|
|
318
|
+
const h = s(o);
|
|
282
319
|
if (h)
|
|
283
320
|
return h;
|
|
284
321
|
}
|
|
285
|
-
},
|
|
286
|
-
if (!
|
|
322
|
+
}, l = s(e);
|
|
323
|
+
if (!l) {
|
|
287
324
|
console.warn("Object with UUID not found in the scene.");
|
|
288
325
|
return;
|
|
289
326
|
}
|
|
290
|
-
let
|
|
291
|
-
for (let
|
|
292
|
-
if (
|
|
293
|
-
|
|
327
|
+
let i = l;
|
|
328
|
+
for (let d = 0; d < n.length - 1; d++)
|
|
329
|
+
if (i[n[d]] !== void 0)
|
|
330
|
+
i = i[n[d]];
|
|
294
331
|
else {
|
|
295
|
-
console.warn(`Property path is not valid: ${
|
|
332
|
+
console.warn(`Property path is not valid: ${n.join(".")}`);
|
|
296
333
|
return;
|
|
297
334
|
}
|
|
298
|
-
const
|
|
299
|
-
a
|
|
335
|
+
const a = n[n.length - 1];
|
|
336
|
+
i[a] !== void 0 ? i[a] = r : console.warn(`Property path is not valid: ${n.join(".")}`);
|
|
300
337
|
}
|
|
301
|
-
function
|
|
302
|
-
const t = new
|
|
338
|
+
function $n(e) {
|
|
339
|
+
const t = new tt({
|
|
303
340
|
color: 11003607,
|
|
304
341
|
// Highlight color, e.g., yellow
|
|
305
342
|
transparent: !0,
|
|
306
343
|
opacity: 0.2,
|
|
307
344
|
depthTest: !1,
|
|
308
345
|
// So the highlight is always visible
|
|
309
|
-
side:
|
|
346
|
+
side: St
|
|
310
347
|
// To e
|
|
311
348
|
});
|
|
312
|
-
return new
|
|
349
|
+
return new An(e.geometry.clone(), t);
|
|
313
350
|
}
|
|
314
|
-
function
|
|
315
|
-
var
|
|
351
|
+
function Fn(e) {
|
|
352
|
+
var n;
|
|
316
353
|
let t = e.value;
|
|
317
|
-
return e.value && ((
|
|
354
|
+
return e.value && ((n = e.value) != null && n.isMesh) && (t = e.value.position), Array.isArray(e.value) && (t = new _e(...t)), t;
|
|
318
355
|
}
|
|
319
|
-
function
|
|
356
|
+
function Wn(e) {
|
|
320
357
|
return "map" in e;
|
|
321
358
|
}
|
|
322
|
-
function
|
|
323
|
-
|
|
359
|
+
function Ge(e) {
|
|
360
|
+
Wn(e) && e.map && e.map.dispose(), e.dispose();
|
|
324
361
|
}
|
|
325
|
-
function
|
|
326
|
-
var
|
|
327
|
-
if (e.parent && ((
|
|
328
|
-
const
|
|
329
|
-
e && ((
|
|
362
|
+
function Ce(e) {
|
|
363
|
+
var n, r;
|
|
364
|
+
if (e.parent && ((n = e.removeFromParent) == null || n.call(e)), delete e.__tres, [...e.children].forEach((s) => Ce(s)), !(e instanceof et)) {
|
|
365
|
+
const s = e;
|
|
366
|
+
e && ((r = e.dispose) == null || r.call(e)), s.geometry && (s.geometry.dispose(), delete s.geometry), Array.isArray(s.material) ? (s.material.forEach((l) => Ge(l)), delete s.material) : s.material && (Ge(s.material), delete s.material);
|
|
330
367
|
}
|
|
331
368
|
}
|
|
332
|
-
|
|
369
|
+
function Nn(e, t) {
|
|
370
|
+
let n = 0;
|
|
371
|
+
for (let r = 0; r < e.length; r++)
|
|
372
|
+
t(e[r], r) && (e[n] = e[r], n++);
|
|
373
|
+
return e.length = n, e;
|
|
374
|
+
}
|
|
375
|
+
const Gn = Number.parseInt(Tt.replace("dev", "")), oe = {
|
|
333
376
|
realistic: {
|
|
334
377
|
shadows: !0,
|
|
335
378
|
physicallyCorrectLights: !0,
|
|
336
|
-
outputColorSpace:
|
|
337
|
-
toneMapping:
|
|
379
|
+
outputColorSpace: At,
|
|
380
|
+
toneMapping: nt,
|
|
338
381
|
toneMappingExposure: 3,
|
|
339
382
|
shadowMap: {
|
|
340
383
|
enabled: !0,
|
|
341
|
-
type:
|
|
384
|
+
type: Ot
|
|
342
385
|
}
|
|
343
386
|
},
|
|
344
387
|
flat: {
|
|
345
|
-
toneMapping:
|
|
388
|
+
toneMapping: xt,
|
|
346
389
|
toneMappingExposure: 1
|
|
347
390
|
}
|
|
348
391
|
};
|
|
349
|
-
function
|
|
392
|
+
function zn({
|
|
350
393
|
canvas: e,
|
|
351
394
|
options: t,
|
|
352
|
-
contextParts: { sizes:
|
|
395
|
+
contextParts: { sizes: n, render: r, invalidate: s, advance: l }
|
|
353
396
|
}) {
|
|
354
|
-
const
|
|
355
|
-
alpha:
|
|
356
|
-
depth:
|
|
357
|
-
canvas:
|
|
358
|
-
context:
|
|
359
|
-
stencil:
|
|
360
|
-
antialias:
|
|
361
|
-
precision:
|
|
362
|
-
powerPreference:
|
|
363
|
-
premultipliedAlpha:
|
|
364
|
-
preserveDrawingBuffer:
|
|
365
|
-
logarithmicDepthBuffer:
|
|
366
|
-
failIfMajorPerformanceCaveat:
|
|
367
|
-
})),
|
|
368
|
-
function
|
|
369
|
-
t.renderMode === "on-demand" &&
|
|
397
|
+
const i = j(() => ({
|
|
398
|
+
alpha: A(t.alpha) ?? !0,
|
|
399
|
+
depth: A(t.depth),
|
|
400
|
+
canvas: Vt(e),
|
|
401
|
+
context: A(t.context),
|
|
402
|
+
stencil: A(t.stencil),
|
|
403
|
+
antialias: A(t.antialias) ?? !0,
|
|
404
|
+
precision: A(t.precision),
|
|
405
|
+
powerPreference: A(t.powerPreference),
|
|
406
|
+
premultipliedAlpha: A(t.premultipliedAlpha),
|
|
407
|
+
preserveDrawingBuffer: A(t.preserveDrawingBuffer),
|
|
408
|
+
logarithmicDepthBuffer: A(t.logarithmicDepthBuffer),
|
|
409
|
+
failIfMajorPerformanceCaveat: A(t.failIfMajorPerformanceCaveat)
|
|
410
|
+
})), a = $(new fe(i.value));
|
|
411
|
+
function d() {
|
|
412
|
+
t.renderMode === "on-demand" && s();
|
|
370
413
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
}),
|
|
374
|
-
|
|
414
|
+
J(i, () => {
|
|
415
|
+
a.value.dispose(), a.value = new fe(i.value), d();
|
|
416
|
+
}), J([n.width, n.height], () => {
|
|
417
|
+
a.value.setSize(n.width.value, n.height.value), d();
|
|
375
418
|
}, {
|
|
376
419
|
immediate: !0
|
|
377
|
-
}),
|
|
378
|
-
const { pixelRatio:
|
|
379
|
-
|
|
380
|
-
|
|
420
|
+
}), J(() => t.clearColor, d);
|
|
421
|
+
const { pixelRatio: o } = Yt();
|
|
422
|
+
J(o, () => {
|
|
423
|
+
a.value.setPixelRatio(o.value);
|
|
381
424
|
});
|
|
382
|
-
const { logError: h } =
|
|
383
|
-
const
|
|
425
|
+
const { logError: h } = F(), c = (() => {
|
|
426
|
+
const f = new fe(), _ = {
|
|
384
427
|
shadowMap: {
|
|
385
|
-
enabled:
|
|
386
|
-
type:
|
|
428
|
+
enabled: f.shadowMap.enabled,
|
|
429
|
+
type: f.shadowMap.type
|
|
387
430
|
},
|
|
388
|
-
toneMapping:
|
|
389
|
-
toneMappingExposure:
|
|
390
|
-
outputColorSpace:
|
|
431
|
+
toneMapping: f.toneMapping,
|
|
432
|
+
toneMappingExposure: f.toneMappingExposure,
|
|
433
|
+
outputColorSpace: f.outputColorSpace
|
|
391
434
|
};
|
|
392
|
-
return
|
|
393
|
-
})(),
|
|
394
|
-
return
|
|
395
|
-
|
|
396
|
-
}, 100),
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
const
|
|
400
|
-
const
|
|
401
|
-
if (
|
|
402
|
-
return
|
|
435
|
+
return f.dispose(), _;
|
|
436
|
+
})(), v = A(t.renderMode);
|
|
437
|
+
return v === "on-demand" && s(), v === "manual" && setTimeout(() => {
|
|
438
|
+
l();
|
|
439
|
+
}, 100), Me(() => {
|
|
440
|
+
const f = A(t.preset);
|
|
441
|
+
f && (f in oe || h(`Renderer Preset must be one of these: ${Object.keys(oe).join(", ")}`), at(a.value, oe[f])), v === "always" && (r.frames.value = Math.max(1, r.frames.value));
|
|
442
|
+
const _ = (y, k) => {
|
|
443
|
+
const P = A(y), C = () => {
|
|
444
|
+
if (f)
|
|
445
|
+
return Ne(oe[f], k);
|
|
403
446
|
};
|
|
404
|
-
if (
|
|
405
|
-
return
|
|
406
|
-
const
|
|
407
|
-
return
|
|
408
|
-
},
|
|
409
|
-
|
|
410
|
-
const
|
|
411
|
-
|
|
412
|
-
|
|
447
|
+
if (P !== void 0)
|
|
448
|
+
return P;
|
|
449
|
+
const b = C();
|
|
450
|
+
return b !== void 0 ? b : Ne(c, k);
|
|
451
|
+
}, m = (y, k) => jn(a.value, k, _(y, k));
|
|
452
|
+
m(t.shadows, "shadowMap.enabled"), m(t.toneMapping ?? nt, "toneMapping"), m(t.shadowMapType, "shadowMap.type"), Gn < 150 && m(!t.useLegacyLights, "physicallyCorrectLights"), m(t.outputColorSpace, "outputColorSpace"), m(t.toneMappingExposure, "toneMappingExposure");
|
|
453
|
+
const w = _(t.clearColor, "clearColor");
|
|
454
|
+
w && a.value.setClearColor(
|
|
455
|
+
w ? Tn(w) : new se(0)
|
|
413
456
|
// default clear color is not easily/efficiently retrievable from three
|
|
414
457
|
);
|
|
415
|
-
}),
|
|
416
|
-
|
|
458
|
+
}), Y(() => {
|
|
459
|
+
a.value.dispose(), a.value.forceContextLoss();
|
|
417
460
|
}), {
|
|
418
|
-
renderer:
|
|
461
|
+
renderer: a
|
|
419
462
|
};
|
|
420
463
|
}
|
|
421
|
-
const
|
|
422
|
-
function
|
|
464
|
+
const Vn = (e) => !!e && e.constructor === Array;
|
|
465
|
+
function Yn(e) {
|
|
423
466
|
const t = { nodes: {}, materials: {} };
|
|
424
|
-
return e && e.traverse((
|
|
425
|
-
|
|
467
|
+
return e && e.traverse((n) => {
|
|
468
|
+
n.name && (t.nodes[n.name] = n), n.material && !t.materials[n.material.name] && (t.materials[n.material.name] = n.material);
|
|
426
469
|
}), t;
|
|
427
470
|
}
|
|
428
|
-
async function
|
|
429
|
-
const { logError:
|
|
430
|
-
|
|
431
|
-
const
|
|
432
|
-
(
|
|
433
|
-
|
|
434
|
-
f,
|
|
435
|
-
(b) => {
|
|
436
|
-
b.scene && Object.assign(b, jr(b.scene)), h(b);
|
|
437
|
-
},
|
|
471
|
+
async function kr(e, t, n, r, s) {
|
|
472
|
+
const { logError: l } = F(), i = new e();
|
|
473
|
+
s && s(i), n && n(i);
|
|
474
|
+
const d = (Array.isArray(t) ? t : [t]).map(
|
|
475
|
+
(o) => new Promise((h, p) => {
|
|
476
|
+
i.load(
|
|
438
477
|
o,
|
|
439
|
-
(
|
|
478
|
+
(c) => {
|
|
479
|
+
c.scene && Object.assign(c, Yn(c.scene)), h(c);
|
|
480
|
+
},
|
|
481
|
+
r,
|
|
482
|
+
(c) => p(l("[useLoader] - Failed to load resource", c))
|
|
440
483
|
);
|
|
441
484
|
})
|
|
442
485
|
);
|
|
443
|
-
return
|
|
486
|
+
return Vn(t) ? await Promise.all(d) : await d[0];
|
|
444
487
|
}
|
|
445
|
-
async function
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
(
|
|
488
|
+
async function Sr(e, t) {
|
|
489
|
+
const n = new Lt(t), r = (s) => new Promise((l, i) => {
|
|
490
|
+
n.load(
|
|
491
|
+
s,
|
|
492
|
+
(a) => l(a),
|
|
450
493
|
() => null,
|
|
451
494
|
() => {
|
|
452
|
-
|
|
495
|
+
i(new Error("[useTextures] - Failed to load texture"));
|
|
453
496
|
}
|
|
454
497
|
);
|
|
455
498
|
});
|
|
456
|
-
if (
|
|
457
|
-
const
|
|
458
|
-
return e.length > 1 ?
|
|
499
|
+
if (Hn(e)) {
|
|
500
|
+
const s = await Promise.all(e.map((l) => r(l)));
|
|
501
|
+
return e.length > 1 ? s : s[0];
|
|
459
502
|
} else {
|
|
460
503
|
const {
|
|
461
|
-
map:
|
|
462
|
-
displacementMap:
|
|
463
|
-
normalMap:
|
|
464
|
-
roughnessMap:
|
|
465
|
-
metalnessMap:
|
|
466
|
-
aoMap:
|
|
504
|
+
map: s,
|
|
505
|
+
displacementMap: l,
|
|
506
|
+
normalMap: i,
|
|
507
|
+
roughnessMap: a,
|
|
508
|
+
metalnessMap: d,
|
|
509
|
+
aoMap: o,
|
|
467
510
|
alphaMap: h,
|
|
468
|
-
matcap:
|
|
511
|
+
matcap: p
|
|
469
512
|
} = e;
|
|
470
513
|
return {
|
|
471
|
-
map:
|
|
472
|
-
displacementMap:
|
|
473
|
-
normalMap:
|
|
474
|
-
roughnessMap:
|
|
475
|
-
metalnessMap:
|
|
476
|
-
aoMap:
|
|
477
|
-
alphaMap: h ? await
|
|
478
|
-
matcap:
|
|
514
|
+
map: s ? await r(s) : null,
|
|
515
|
+
displacementMap: l ? await r(l) : null,
|
|
516
|
+
normalMap: i ? await r(i) : null,
|
|
517
|
+
roughnessMap: a ? await r(a) : null,
|
|
518
|
+
metalnessMap: d ? await r(d) : null,
|
|
519
|
+
aoMap: o ? await r(o) : null,
|
|
520
|
+
alphaMap: h ? await r(h) : null,
|
|
521
|
+
matcap: p ? await r(p) : null
|
|
479
522
|
};
|
|
480
523
|
}
|
|
481
524
|
}
|
|
482
|
-
const
|
|
483
|
-
const
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
let s = 0;
|
|
488
|
-
const { width: n, height: f, top: h, left: l } = Ft(r), b = ({ x: m, y: C }) => {
|
|
489
|
-
if (r.value)
|
|
525
|
+
const ct = (e, t) => {
|
|
526
|
+
const n = j(() => t.renderer.value.domElement), r = $([]), { x: s, y: l } = qt({ target: n });
|
|
527
|
+
let i = 0;
|
|
528
|
+
const { width: a, height: d, top: o, left: h } = Jt(n), p = ({ x: g, y: S }) => {
|
|
529
|
+
if (n.value)
|
|
490
530
|
return {
|
|
491
|
-
x: (
|
|
492
|
-
y: -((
|
|
531
|
+
x: (g - h.value) / a.value * 2 - 1,
|
|
532
|
+
y: -((S - o.value) / d.value) * 2 + 1
|
|
493
533
|
};
|
|
494
|
-
},
|
|
534
|
+
}, c = ({ x: g, y: S }) => {
|
|
495
535
|
if (t.camera.value)
|
|
496
|
-
return t.raycaster.value.setFromCamera(new
|
|
497
|
-
},
|
|
498
|
-
const
|
|
499
|
-
x: (
|
|
500
|
-
y: (
|
|
536
|
+
return t.raycaster.value.setFromCamera(new de(g, S), t.camera.value), r.value = t.raycaster.value.intersectObjects(e.value, !0), r.value;
|
|
537
|
+
}, v = (g) => {
|
|
538
|
+
const S = p({
|
|
539
|
+
x: (g == null ? void 0 : g.clientX) ?? s.value,
|
|
540
|
+
y: (g == null ? void 0 : g.clientY) ?? l.value
|
|
501
541
|
});
|
|
502
|
-
return
|
|
503
|
-
},
|
|
504
|
-
function
|
|
505
|
-
const
|
|
506
|
-
for (const
|
|
507
|
-
typeof
|
|
508
|
-
return
|
|
542
|
+
return S ? c(S) || [] : [];
|
|
543
|
+
}, f = L(), _ = L(), m = L(), w = L(), y = L(), k = L(), P = L(), C = L();
|
|
544
|
+
function b(g) {
|
|
545
|
+
const S = {};
|
|
546
|
+
for (const H in g)
|
|
547
|
+
typeof H != "function" && (S[H] = g[H]);
|
|
548
|
+
return S;
|
|
509
549
|
}
|
|
510
|
-
const
|
|
511
|
-
var
|
|
512
|
-
const
|
|
513
|
-
|
|
514
|
-
...
|
|
515
|
-
intersections:
|
|
550
|
+
const u = (g, S) => {
|
|
551
|
+
var Ae, Oe, xe;
|
|
552
|
+
const H = b(S), te = new _e(S == null ? void 0 : S.clientX, S == null ? void 0 : S.clientY, 0).unproject((Ae = t.camera) == null ? void 0 : Ae.value);
|
|
553
|
+
g.trigger({
|
|
554
|
+
...H,
|
|
555
|
+
intersections: r.value,
|
|
516
556
|
// The unprojectedPoint is wrong, math needs to be fixed
|
|
517
|
-
unprojectedPoint:
|
|
518
|
-
ray: (
|
|
519
|
-
camera: (
|
|
520
|
-
sourceEvent:
|
|
521
|
-
delta:
|
|
557
|
+
unprojectedPoint: te,
|
|
558
|
+
ray: (Oe = t.raycaster) == null ? void 0 : Oe.value.ray,
|
|
559
|
+
camera: (xe = t.camera) == null ? void 0 : xe.value,
|
|
560
|
+
sourceEvent: S,
|
|
561
|
+
delta: i,
|
|
522
562
|
stopPropagating: !1
|
|
523
563
|
});
|
|
524
564
|
};
|
|
525
|
-
let
|
|
526
|
-
const
|
|
527
|
-
|
|
565
|
+
let M;
|
|
566
|
+
const E = (g) => {
|
|
567
|
+
v(g), u(m, g), M = g;
|
|
528
568
|
}, T = () => {
|
|
529
|
-
|
|
569
|
+
M && E(M);
|
|
530
570
|
};
|
|
531
|
-
let
|
|
532
|
-
const
|
|
533
|
-
var
|
|
534
|
-
|
|
535
|
-
(
|
|
536
|
-
(
|
|
537
|
-
),
|
|
571
|
+
let I, O, x;
|
|
572
|
+
const N = (g) => {
|
|
573
|
+
var S;
|
|
574
|
+
I = (S = r.value[0]) == null ? void 0 : S.object, i = 0, O = new de(
|
|
575
|
+
(g == null ? void 0 : g.clientX) ?? s.value,
|
|
576
|
+
(g == null ? void 0 : g.clientY) ?? l.value
|
|
577
|
+
), u(y, g);
|
|
538
578
|
};
|
|
539
|
-
let
|
|
540
|
-
const
|
|
541
|
-
var
|
|
542
|
-
|
|
543
|
-
(
|
|
544
|
-
(
|
|
545
|
-
),
|
|
546
|
-
},
|
|
547
|
-
|
|
548
|
-
},
|
|
549
|
-
return
|
|
550
|
-
|
|
579
|
+
let R, G = !1;
|
|
580
|
+
const ee = (g) => {
|
|
581
|
+
var S, H, te;
|
|
582
|
+
g instanceof PointerEvent && (r.value.length === 0 && u(k, g), I === ((S = r.value[0]) == null ? void 0 : S.object) && (x = new de(
|
|
583
|
+
(g == null ? void 0 : g.clientX) ?? s.value,
|
|
584
|
+
(g == null ? void 0 : g.clientY) ?? l.value
|
|
585
|
+
), i = O == null ? void 0 : O.distanceTo(x), g.button === 0 ? (u(f, g), R === ((H = r.value[0]) == null ? void 0 : H.object) ? G = !0 : (R = (te = r.value[0]) == null ? void 0 : te.object, G = !1)) : g.button === 2 && u(P, g)), u(w, g));
|
|
586
|
+
}, ke = (g) => {
|
|
587
|
+
G && (u(_, g), R = void 0, G = !1);
|
|
588
|
+
}, Se = (g) => u(m, g), Te = (g) => u(C, g);
|
|
589
|
+
return n.value.addEventListener("pointerup", ee), n.value.addEventListener("pointerdown", N), n.value.addEventListener("pointermove", E), n.value.addEventListener("pointerleave", Se), n.value.addEventListener("dblclick", ke), n.value.addEventListener("wheel", Te), Y(() => {
|
|
590
|
+
n != null && n.value && (n.value.removeEventListener("pointerup", ee), n.value.removeEventListener("pointerdown", N), n.value.removeEventListener("pointermove", E), n.value.removeEventListener("pointerleave", Se), n.value.removeEventListener("dblclick", ke), n.value.removeEventListener("wheel", Te));
|
|
551
591
|
}), {
|
|
552
|
-
intersects:
|
|
553
|
-
onClick: (
|
|
554
|
-
onDblClick: (
|
|
555
|
-
onContextMenu: (
|
|
556
|
-
onPointerMove: (
|
|
557
|
-
onPointerUp: (
|
|
558
|
-
onPointerDown: (
|
|
559
|
-
onPointerMissed: (
|
|
560
|
-
onWheel: (
|
|
592
|
+
intersects: r,
|
|
593
|
+
onClick: (g) => f.on(g).off,
|
|
594
|
+
onDblClick: (g) => _.on(g).off,
|
|
595
|
+
onContextMenu: (g) => P.on(g).off,
|
|
596
|
+
onPointerMove: (g) => m.on(g).off,
|
|
597
|
+
onPointerUp: (g) => w.on(g).off,
|
|
598
|
+
onPointerDown: (g) => y.on(g).off,
|
|
599
|
+
onPointerMissed: (g) => k.on(g).off,
|
|
600
|
+
onWheel: (g) => C.on(g).off,
|
|
561
601
|
forceUpdate: T
|
|
562
602
|
};
|
|
563
603
|
};
|
|
564
|
-
function
|
|
565
|
-
const { logWarning: e } =
|
|
566
|
-
function t(
|
|
567
|
-
let
|
|
568
|
-
return
|
|
569
|
-
|
|
570
|
-
}),
|
|
604
|
+
function Tr() {
|
|
605
|
+
const { logWarning: e } = F();
|
|
606
|
+
function t(l, i, a) {
|
|
607
|
+
let d = null;
|
|
608
|
+
return l.traverse((o) => {
|
|
609
|
+
o[i] === a && (d = o);
|
|
610
|
+
}), d || e(`Child with ${i} '${a}' not found.`), d;
|
|
571
611
|
}
|
|
572
|
-
function
|
|
573
|
-
const
|
|
574
|
-
return
|
|
575
|
-
|
|
576
|
-
}),
|
|
612
|
+
function n(l, i, a) {
|
|
613
|
+
const d = [];
|
|
614
|
+
return l.traverse((o) => {
|
|
615
|
+
o[i].includes(a) && d.push(o);
|
|
616
|
+
}), d.length || e(`Children with ${i} '${a}' not found.`), d;
|
|
577
617
|
}
|
|
578
|
-
function
|
|
579
|
-
return t(
|
|
618
|
+
function r(l, i) {
|
|
619
|
+
return t(l, "name", i);
|
|
580
620
|
}
|
|
581
|
-
function
|
|
582
|
-
return
|
|
621
|
+
function s(l, i) {
|
|
622
|
+
return n(l, "name", i);
|
|
583
623
|
}
|
|
584
624
|
return {
|
|
585
625
|
seek: t,
|
|
586
|
-
seekByName:
|
|
587
|
-
seekAll:
|
|
588
|
-
seekAllByName:
|
|
626
|
+
seekByName: r,
|
|
627
|
+
seekAll: n,
|
|
628
|
+
seekAllByName: s
|
|
589
629
|
};
|
|
590
630
|
}
|
|
591
|
-
const
|
|
592
|
-
const t =
|
|
631
|
+
const Ar = (e) => {
|
|
632
|
+
const t = Ke({
|
|
593
633
|
click: /* @__PURE__ */ new Map(),
|
|
594
634
|
pointerMove: /* @__PURE__ */ new Map(),
|
|
595
635
|
pointerEnter: /* @__PURE__ */ new Map(),
|
|
596
636
|
pointerLeave: /* @__PURE__ */ new Map()
|
|
597
|
-
}),
|
|
598
|
-
|
|
599
|
-
},
|
|
600
|
-
|
|
601
|
-
},
|
|
602
|
-
Object.values(t).forEach((
|
|
603
|
-
},
|
|
604
|
-
const { onClick:
|
|
605
|
-
|
|
606
|
-
},
|
|
607
|
-
() =>
|
|
637
|
+
}), n = D(/* @__PURE__ */ new Set()), r = (p) => {
|
|
638
|
+
n.value.add(p);
|
|
639
|
+
}, s = (p) => {
|
|
640
|
+
n.value.delete(p);
|
|
641
|
+
}, l = (p) => {
|
|
642
|
+
Object.values(t).forEach((c) => c.delete(p)), s(p);
|
|
643
|
+
}, i = (p) => {
|
|
644
|
+
const { onClick: c, onPointerMove: v, onPointerEnter: f, onPointerLeave: _ } = p;
|
|
645
|
+
c && t.click.set(p, c), v && t.pointerMove.set(p, v), f && t.pointerEnter.set(p, f), _ && t.pointerLeave.set(p, _);
|
|
646
|
+
}, a = j(
|
|
647
|
+
() => Bn(
|
|
608
648
|
[
|
|
609
|
-
...Array.from(
|
|
610
|
-
...Object.values(t).map((
|
|
649
|
+
...Array.from(n.value),
|
|
650
|
+
...Object.values(t).map((p) => Array.from(p.keys())).flat()
|
|
611
651
|
],
|
|
612
|
-
({ uuid:
|
|
652
|
+
({ uuid: p }) => p
|
|
613
653
|
)
|
|
614
654
|
);
|
|
615
|
-
e.registerObjectAtPointerEventHandler =
|
|
616
|
-
const { onClick:
|
|
617
|
-
|
|
618
|
-
var
|
|
619
|
-
|
|
655
|
+
e.registerObjectAtPointerEventHandler = i, e.deregisterObjectAtPointerEventHandler = l, e.registerBlockingObjectAtPointerEventHandler = r, e.deregisterBlockingObjectAtPointerEventHandler = s;
|
|
656
|
+
const { onClick: d, onPointerMove: o } = ct(a, e);
|
|
657
|
+
d(({ intersects: p, event: c }) => {
|
|
658
|
+
var v;
|
|
659
|
+
p.length && ((v = t.click.get(p[0].object)) == null || v(p[0], c));
|
|
620
660
|
});
|
|
621
661
|
let h;
|
|
622
|
-
return
|
|
623
|
-
var
|
|
624
|
-
const
|
|
625
|
-
h && h !==
|
|
662
|
+
return o(({ intersects: p, event: c }) => {
|
|
663
|
+
var w, y, k, P;
|
|
664
|
+
const v = (w = p == null ? void 0 : p[0]) == null ? void 0 : w.object, { pointerLeave: f, pointerEnter: _, pointerMove: m } = t;
|
|
665
|
+
h && h !== v && ((y = f.get(h)) == null || y(h, c)), v && (h !== v && ((k = _.get(v)) == null || k(p[0], c)), (P = m.get(v)) == null || P(p[0], c)), h = v || null;
|
|
626
666
|
}), {
|
|
627
|
-
registerObject:
|
|
628
|
-
deregisterObject:
|
|
629
|
-
registerBlockingObject:
|
|
630
|
-
deregisterBlockingObject:
|
|
667
|
+
registerObject: i,
|
|
668
|
+
deregisterObject: l,
|
|
669
|
+
registerBlockingObject: r,
|
|
670
|
+
deregisterBlockingObject: s
|
|
631
671
|
};
|
|
632
672
|
};
|
|
633
|
-
function
|
|
673
|
+
function Ee(e) {
|
|
634
674
|
let t = 0;
|
|
635
|
-
return e.traverse((
|
|
636
|
-
if (
|
|
637
|
-
const
|
|
638
|
-
t +=
|
|
675
|
+
return e.traverse((n) => {
|
|
676
|
+
if (n.isMesh && n.geometry) {
|
|
677
|
+
const r = n.geometry, s = r.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, l = r.index ? r.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, i = r.attributes.normal ? r.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, a = r.attributes.uv ? r.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, d = s + l + i + a;
|
|
678
|
+
t += d;
|
|
639
679
|
}
|
|
640
680
|
}), t;
|
|
641
681
|
}
|
|
642
|
-
function
|
|
682
|
+
function qn(e) {
|
|
643
683
|
return (e / 1024).toFixed(2);
|
|
644
684
|
}
|
|
645
|
-
const
|
|
646
|
-
function
|
|
647
|
-
const
|
|
685
|
+
const ye = D({}), we = (e) => Object.assign(ye.value, e);
|
|
686
|
+
function Jn(e, t, n = 10) {
|
|
687
|
+
const r = A(e) ? Qt() : Kt(j(() => A(t).parentElement)), s = me(Ie(r.width, n)), l = me(Ie(r.height, n)), i = j(() => s.value / l.value);
|
|
648
688
|
return {
|
|
649
|
-
height:
|
|
650
|
-
width:
|
|
651
|
-
aspectRatio:
|
|
689
|
+
height: l,
|
|
690
|
+
width: s,
|
|
691
|
+
aspectRatio: i
|
|
652
692
|
};
|
|
653
693
|
}
|
|
654
|
-
function
|
|
694
|
+
function pe() {
|
|
655
695
|
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
|
|
656
|
-
let
|
|
657
|
-
const
|
|
658
|
-
const
|
|
659
|
-
const
|
|
660
|
-
return
|
|
696
|
+
let n = 0, r = !1;
|
|
697
|
+
const s = () => {
|
|
698
|
+
const o = Array.from(e.entries()).sort((h, p) => {
|
|
699
|
+
const c = h[1].priority - p[1].priority;
|
|
700
|
+
return c === 0 ? h[1].addI - p[1].addI : c;
|
|
661
701
|
});
|
|
662
|
-
t.clear(),
|
|
663
|
-
},
|
|
664
|
-
e.delete(
|
|
702
|
+
t.clear(), o.forEach((h) => t.add(h[0]));
|
|
703
|
+
}, l = (o) => {
|
|
704
|
+
e.delete(o), t.delete(o);
|
|
665
705
|
};
|
|
666
|
-
return { on: (
|
|
667
|
-
e.set(
|
|
668
|
-
const
|
|
669
|
-
return
|
|
670
|
-
off:
|
|
706
|
+
return { on: (o, h = 0) => {
|
|
707
|
+
e.set(o, { priority: h, addI: n++ });
|
|
708
|
+
const p = () => l(o);
|
|
709
|
+
return Xt(p), r = !0, {
|
|
710
|
+
off: p
|
|
671
711
|
};
|
|
672
|
-
}, off:
|
|
673
|
-
|
|
712
|
+
}, off: l, trigger: (...o) => {
|
|
713
|
+
r && (s(), r = !1), t.forEach((h) => h(...o));
|
|
674
714
|
}, dispose: () => {
|
|
675
715
|
e.clear(), t.clear();
|
|
676
716
|
}, get count() {
|
|
677
717
|
return e.size;
|
|
678
718
|
} };
|
|
679
719
|
}
|
|
680
|
-
function
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
720
|
+
function Qn() {
|
|
721
|
+
let e = !0, t = !0, n = !1;
|
|
722
|
+
const r = new Ze(!1), s = D(r.running), l = D(!1);
|
|
723
|
+
let i;
|
|
724
|
+
const a = Rt.generateUUID();
|
|
725
|
+
let d = null;
|
|
726
|
+
const o = pe(), h = pe(), p = pe();
|
|
727
|
+
b();
|
|
728
|
+
let c = {};
|
|
729
|
+
function v(u) {
|
|
730
|
+
c = u;
|
|
689
731
|
}
|
|
690
|
-
function
|
|
691
|
-
switch (
|
|
732
|
+
function f(u, M, E = 0) {
|
|
733
|
+
switch (M) {
|
|
692
734
|
case "before":
|
|
693
|
-
return
|
|
735
|
+
return o.on(u, E);
|
|
694
736
|
case "render":
|
|
695
|
-
return
|
|
737
|
+
return d || (d = u), h.dispose(), h.on(u);
|
|
696
738
|
case "after":
|
|
697
|
-
return
|
|
739
|
+
return p.on(u, E);
|
|
698
740
|
}
|
|
699
741
|
}
|
|
700
|
-
function
|
|
701
|
-
t
|
|
742
|
+
function _() {
|
|
743
|
+
t && (t = !1, b(), C());
|
|
744
|
+
}
|
|
745
|
+
function m() {
|
|
746
|
+
t = !0, b(), cancelAnimationFrame(i);
|
|
702
747
|
}
|
|
703
748
|
function w() {
|
|
704
|
-
|
|
749
|
+
n = !1, b();
|
|
705
750
|
}
|
|
706
|
-
function
|
|
707
|
-
|
|
751
|
+
function y() {
|
|
752
|
+
n = !0, b();
|
|
753
|
+
}
|
|
754
|
+
function k() {
|
|
755
|
+
l.value = !0;
|
|
708
756
|
}
|
|
709
757
|
function P() {
|
|
710
|
-
|
|
758
|
+
l.value = !1;
|
|
711
759
|
}
|
|
712
|
-
function
|
|
713
|
-
|
|
760
|
+
function C() {
|
|
761
|
+
if (!e) {
|
|
762
|
+
i = requestAnimationFrame(C);
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
const u = r.getDelta(), M = r.getElapsedTime(), E = {
|
|
766
|
+
camera: V(c.camera),
|
|
767
|
+
scene: V(c.scene),
|
|
768
|
+
renderer: V(c.renderer),
|
|
769
|
+
raycaster: V(c.raycaster),
|
|
770
|
+
controls: V(c.controls),
|
|
771
|
+
invalidate: c.invalidate,
|
|
772
|
+
advance: c.advance
|
|
773
|
+
}, T = { delta: u, elapsed: M, clock: r, ...E };
|
|
774
|
+
s.value && o.trigger(T), l.value || (h.count ? h.trigger(T) : d && d(T)), s.value && p.trigger(T), i = requestAnimationFrame(C);
|
|
775
|
+
}
|
|
776
|
+
function b() {
|
|
777
|
+
const u = !t && !n;
|
|
778
|
+
r.running !== u && (r.running ? r.stop() : r.start()), s.value = r.running;
|
|
714
779
|
}
|
|
715
|
-
|
|
716
|
-
|
|
780
|
+
return {
|
|
781
|
+
loopId: a,
|
|
782
|
+
register: (u, M, E) => f(u, M, E),
|
|
783
|
+
start: _,
|
|
784
|
+
stop: m,
|
|
785
|
+
pause: y,
|
|
786
|
+
resume: w,
|
|
787
|
+
pauseRender: k,
|
|
788
|
+
resumeRender: P,
|
|
789
|
+
isRenderPaused: l,
|
|
790
|
+
isActive: s,
|
|
791
|
+
setContext: v,
|
|
792
|
+
setReady: (u) => e = u
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
function Kn(e, t, n = 100) {
|
|
796
|
+
n = n <= 0 ? 100 : n;
|
|
797
|
+
const r = L(), s = /* @__PURE__ */ new Set();
|
|
798
|
+
let l = !1, i = !1, a = null;
|
|
799
|
+
function d() {
|
|
800
|
+
a && clearTimeout(a), !i && !l && e() ? (r.trigger(t), s.forEach((c) => c()), s.clear(), l = !0) : !i && !l && (a = setTimeout(d, n));
|
|
717
801
|
}
|
|
718
|
-
function
|
|
719
|
-
|
|
720
|
-
camera: W(f.camera),
|
|
721
|
-
scene: W(f.scene),
|
|
722
|
-
renderer: W(f.renderer),
|
|
723
|
-
raycaster: W(f.raycaster),
|
|
724
|
-
controls: W(f.controls),
|
|
725
|
-
invalidate: f.invalidate,
|
|
726
|
-
advance: f.advance
|
|
727
|
-
}, g = { delta: M, elapsed: _, clock: e, ...c };
|
|
728
|
-
t.value && a.trigger(g), r.value || (s.count ? s.trigger(g) : u && u(g)), t.value && n.trigger(g), o = requestAnimationFrame(p);
|
|
802
|
+
function o() {
|
|
803
|
+
i = !0, a && clearTimeout(a);
|
|
729
804
|
}
|
|
805
|
+
d();
|
|
806
|
+
const h = (c, ...v) => {
|
|
807
|
+
c(...v);
|
|
808
|
+
};
|
|
730
809
|
return {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
810
|
+
on: (c) => {
|
|
811
|
+
if (l)
|
|
812
|
+
return h(c, t), { off: () => {
|
|
813
|
+
} };
|
|
814
|
+
{
|
|
815
|
+
const v = r.on(c);
|
|
816
|
+
return s.add(v.off), r.on(c);
|
|
817
|
+
}
|
|
818
|
+
},
|
|
819
|
+
off: r.off,
|
|
820
|
+
trigger: r.trigger,
|
|
821
|
+
cancel: o
|
|
742
822
|
};
|
|
743
823
|
}
|
|
744
|
-
|
|
824
|
+
const X = /* @__PURE__ */ new WeakMap();
|
|
825
|
+
function ut(e) {
|
|
826
|
+
if (e = e || ce(), X.has(e))
|
|
827
|
+
return X.get(e);
|
|
828
|
+
const t = 100, n = Date.now(), l = Kn(() => {
|
|
829
|
+
if (Date.now() - n >= t)
|
|
830
|
+
return !0;
|
|
831
|
+
{
|
|
832
|
+
const i = e.renderer.value, a = (i == null ? void 0 : i.domElement) || { width: 0, height: 0 };
|
|
833
|
+
return !!(i && a.width > 0 && a.height > 0);
|
|
834
|
+
}
|
|
835
|
+
}, e);
|
|
836
|
+
return X.set(e, l), l;
|
|
837
|
+
}
|
|
838
|
+
function Or(e) {
|
|
839
|
+
const t = ce();
|
|
840
|
+
if (t)
|
|
841
|
+
return X.has(t) ? X.get(t).on(e) : ut(t).on(e);
|
|
842
|
+
}
|
|
843
|
+
function Xn({
|
|
745
844
|
scene: e,
|
|
746
845
|
canvas: t,
|
|
747
|
-
windowSize:
|
|
748
|
-
disableRender:
|
|
749
|
-
rendererOptions:
|
|
750
|
-
emit:
|
|
846
|
+
windowSize: n,
|
|
847
|
+
disableRender: r,
|
|
848
|
+
rendererOptions: s,
|
|
849
|
+
emit: l
|
|
751
850
|
}) {
|
|
752
|
-
const { logWarning:
|
|
753
|
-
camera:
|
|
851
|
+
const { logWarning: i } = F(), a = $(e), d = Jn(n, t), {
|
|
852
|
+
camera: o,
|
|
754
853
|
cameras: h,
|
|
755
|
-
registerCamera:
|
|
756
|
-
deregisterCamera:
|
|
757
|
-
setCameraActive:
|
|
758
|
-
} =
|
|
759
|
-
mode:
|
|
760
|
-
priority:
|
|
761
|
-
frames:
|
|
854
|
+
registerCamera: p,
|
|
855
|
+
deregisterCamera: c,
|
|
856
|
+
setCameraActive: v
|
|
857
|
+
} = Cn({ sizes: d, scene: e }), f = {
|
|
858
|
+
mode: D(s.renderMode || "always"),
|
|
859
|
+
priority: D(0),
|
|
860
|
+
frames: D(0),
|
|
762
861
|
maxFrames: 60,
|
|
763
|
-
canBeInvalidated:
|
|
862
|
+
canBeInvalidated: j(() => f.mode.value === "on-demand" && f.frames.value === 0)
|
|
764
863
|
};
|
|
765
|
-
function
|
|
766
|
-
|
|
864
|
+
function _(R = 1) {
|
|
865
|
+
s.renderMode === "on-demand" ? f.frames.value = Math.min(f.maxFrames, f.frames.value + R) : i("`invalidate` can only be used when `renderMode` is set to `on-demand`");
|
|
767
866
|
}
|
|
768
|
-
function
|
|
769
|
-
|
|
867
|
+
function m() {
|
|
868
|
+
s.renderMode === "manual" ? f.frames.value = 1 : i("`advance` can only be used when `renderMode` is set to `manual`");
|
|
770
869
|
}
|
|
771
|
-
const { renderer:
|
|
870
|
+
const { renderer: w } = zn(
|
|
772
871
|
{
|
|
773
872
|
scene: e,
|
|
774
873
|
canvas: t,
|
|
775
|
-
options:
|
|
776
|
-
emit:
|
|
874
|
+
options: s,
|
|
875
|
+
emit: l,
|
|
777
876
|
// TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
|
|
778
|
-
contextParts: { sizes:
|
|
779
|
-
disableRender:
|
|
877
|
+
contextParts: { sizes: d, camera: o, render: f, invalidate: _, advance: m },
|
|
878
|
+
disableRender: r
|
|
780
879
|
}
|
|
781
|
-
),
|
|
782
|
-
sizes:
|
|
783
|
-
scene:
|
|
784
|
-
camera:
|
|
785
|
-
cameras:
|
|
786
|
-
renderer:
|
|
787
|
-
raycaster:
|
|
788
|
-
controls:
|
|
880
|
+
), y = {
|
|
881
|
+
sizes: d,
|
|
882
|
+
scene: a,
|
|
883
|
+
camera: o,
|
|
884
|
+
cameras: me(h),
|
|
885
|
+
renderer: w,
|
|
886
|
+
raycaster: $(new Dt()),
|
|
887
|
+
controls: D(null),
|
|
789
888
|
perf: {
|
|
790
889
|
maxFrames: 160,
|
|
791
890
|
fps: {
|
|
@@ -798,152 +897,183 @@ function Ur({
|
|
|
798
897
|
accumulator: []
|
|
799
898
|
}
|
|
800
899
|
},
|
|
801
|
-
render:
|
|
802
|
-
advance:
|
|
803
|
-
extend:
|
|
804
|
-
invalidate:
|
|
805
|
-
registerCamera:
|
|
806
|
-
setCameraActive:
|
|
807
|
-
deregisterCamera:
|
|
808
|
-
loop:
|
|
900
|
+
render: f,
|
|
901
|
+
advance: m,
|
|
902
|
+
extend: we,
|
|
903
|
+
invalidate: _,
|
|
904
|
+
registerCamera: p,
|
|
905
|
+
setCameraActive: v,
|
|
906
|
+
deregisterCamera: c,
|
|
907
|
+
loop: Qn()
|
|
809
908
|
};
|
|
810
|
-
|
|
811
|
-
root:
|
|
812
|
-
},
|
|
813
|
-
|
|
814
|
-
}, "render")
|
|
815
|
-
|
|
909
|
+
ge("useTres", y), y.scene.value.__tres = {
|
|
910
|
+
root: y
|
|
911
|
+
}, y.loop.register(() => {
|
|
912
|
+
o.value && f.frames.value > 0 && (w.value.render(e, o.value), l("render", y.renderer.value)), f.priority.value = 0, f.mode.value === "always" ? f.frames.value = 1 : f.frames.value = Math.max(0, f.frames.value - 1);
|
|
913
|
+
}, "render");
|
|
914
|
+
const { on: k, cancel: P } = ut(y);
|
|
915
|
+
y.loop.setReady(!1), y.loop.start(), k(() => {
|
|
916
|
+
l("ready", y), y.loop.setReady(!0);
|
|
917
|
+
}), Y(() => {
|
|
918
|
+
P(), y.loop.stop();
|
|
816
919
|
});
|
|
817
|
-
const
|
|
818
|
-
let
|
|
819
|
-
const
|
|
820
|
-
|
|
920
|
+
const C = 100, b = Zt({ every: C }), { isSupported: u, memory: M } = en({ interval: C }), E = 160;
|
|
921
|
+
let T = performance.now();
|
|
922
|
+
const I = ({ timestamp: R }) => {
|
|
923
|
+
y.scene.value && (y.perf.memory.allocatedMem = Ee(y.scene.value)), R - T >= C && (T = R, y.perf.fps.accumulator.push(b.value), y.perf.fps.accumulator.length > E && y.perf.fps.accumulator.shift(), y.perf.fps.value = b.value, u.value && M.value && (y.perf.memory.accumulator.push(M.value.usedJSHeapSize / 1024 / 1024), y.perf.memory.accumulator.length > E && y.perf.memory.accumulator.shift(), y.perf.memory.currentMem = y.perf.memory.accumulator.reduce((G, ee) => G + ee, 0) / y.perf.memory.accumulator.length));
|
|
821
924
|
};
|
|
822
|
-
let
|
|
823
|
-
const
|
|
824
|
-
window.__TRES__DEVTOOLS__ && (
|
|
925
|
+
let O = 0;
|
|
926
|
+
const x = 1, { pause: N } = rt(({ delta: R }) => {
|
|
927
|
+
window.__TRES__DEVTOOLS__ && (I({ timestamp: performance.now() }), O += R, O >= x && (window.__TRES__DEVTOOLS__.cb(y), O = 0));
|
|
825
928
|
}, { immediate: !0 });
|
|
826
|
-
return
|
|
827
|
-
|
|
828
|
-
}),
|
|
929
|
+
return Y(() => {
|
|
930
|
+
N();
|
|
931
|
+
}), y;
|
|
829
932
|
}
|
|
830
|
-
function
|
|
831
|
-
const e =
|
|
933
|
+
function ce() {
|
|
934
|
+
const e = vt("useTres");
|
|
832
935
|
if (!e)
|
|
833
936
|
throw new Error("useTresContext must be used together with useTresContextProvider");
|
|
834
937
|
return e;
|
|
835
938
|
}
|
|
836
|
-
const
|
|
837
|
-
function
|
|
939
|
+
const xr = ce;
|
|
940
|
+
function Lr() {
|
|
838
941
|
const {
|
|
839
942
|
camera: e,
|
|
840
943
|
scene: t,
|
|
841
|
-
renderer:
|
|
842
|
-
loop:
|
|
843
|
-
raycaster:
|
|
844
|
-
controls:
|
|
845
|
-
invalidate:
|
|
846
|
-
advance:
|
|
847
|
-
} =
|
|
848
|
-
|
|
944
|
+
renderer: n,
|
|
945
|
+
loop: r,
|
|
946
|
+
raycaster: s,
|
|
947
|
+
controls: l,
|
|
948
|
+
invalidate: i,
|
|
949
|
+
advance: a
|
|
950
|
+
} = ce();
|
|
951
|
+
r.setContext({
|
|
849
952
|
camera: e,
|
|
850
953
|
scene: t,
|
|
851
|
-
renderer:
|
|
852
|
-
raycaster:
|
|
853
|
-
controls:
|
|
854
|
-
invalidate:
|
|
855
|
-
advance:
|
|
954
|
+
renderer: n,
|
|
955
|
+
raycaster: s,
|
|
956
|
+
controls: l,
|
|
957
|
+
invalidate: i,
|
|
958
|
+
advance: a
|
|
856
959
|
});
|
|
857
|
-
function
|
|
858
|
-
return
|
|
960
|
+
function d(p, c = 0) {
|
|
961
|
+
return r.register(p, "before", c);
|
|
859
962
|
}
|
|
860
|
-
function
|
|
861
|
-
return
|
|
963
|
+
function o(p) {
|
|
964
|
+
return r.register(p, "render");
|
|
862
965
|
}
|
|
863
|
-
function h(
|
|
864
|
-
return
|
|
966
|
+
function h(p, c = 0) {
|
|
967
|
+
return r.register(p, "after", c);
|
|
865
968
|
}
|
|
866
969
|
return {
|
|
867
|
-
pause:
|
|
868
|
-
resume:
|
|
869
|
-
pauseRender:
|
|
870
|
-
resumeRender:
|
|
871
|
-
isActive:
|
|
872
|
-
onBeforeRender:
|
|
873
|
-
render:
|
|
970
|
+
pause: r.pause,
|
|
971
|
+
resume: r.resume,
|
|
972
|
+
pauseRender: r.pauseRender,
|
|
973
|
+
resumeRender: r.resumeRender,
|
|
974
|
+
isActive: r.isActive,
|
|
975
|
+
onBeforeRender: d,
|
|
976
|
+
render: o,
|
|
874
977
|
onAfterRender: h
|
|
875
978
|
};
|
|
876
979
|
}
|
|
877
|
-
function
|
|
878
|
-
const
|
|
879
|
-
e && (
|
|
880
|
-
const
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
980
|
+
function Zn(e, t, n) {
|
|
981
|
+
const r = $(), s = $();
|
|
982
|
+
e && (r.value = e), t && (s.value = t);
|
|
983
|
+
const l = (u) => {
|
|
984
|
+
var M;
|
|
985
|
+
return ((M = u.__tres) == null ? void 0 : M.eventCount) > 0;
|
|
986
|
+
}, i = (u) => {
|
|
987
|
+
var M;
|
|
988
|
+
return ((M = u.children) == null ? void 0 : M.some((E) => i(E))) || l(u);
|
|
989
|
+
}, a = j(() => {
|
|
990
|
+
var u, M;
|
|
991
|
+
return ((M = (u = r.value) == null ? void 0 : u.children) == null ? void 0 : M.filter(i)) || [];
|
|
992
|
+
});
|
|
993
|
+
function d(u, M) {
|
|
994
|
+
if (Array.isArray(u))
|
|
995
|
+
for (const E of u)
|
|
996
|
+
E(M);
|
|
997
|
+
typeof u == "function" && u(M);
|
|
888
998
|
}
|
|
889
|
-
function
|
|
890
|
-
const E = [],
|
|
891
|
-
|
|
892
|
-
for (const
|
|
893
|
-
if (
|
|
999
|
+
function o(u, M) {
|
|
1000
|
+
const E = [], T = () => M.stopPropagating = !0;
|
|
1001
|
+
M.stopPropagation = T;
|
|
1002
|
+
for (const I of M == null ? void 0 : M.intersections) {
|
|
1003
|
+
if (M.stopPropagating)
|
|
894
1004
|
return;
|
|
895
|
-
|
|
896
|
-
const { object:
|
|
897
|
-
|
|
898
|
-
let
|
|
899
|
-
for (;
|
|
900
|
-
|
|
901
|
-
const
|
|
902
|
-
|
|
1005
|
+
M = { ...M, ...I };
|
|
1006
|
+
const { object: O } = I;
|
|
1007
|
+
M.eventObject = O, d(O[u], M), E.push(O);
|
|
1008
|
+
let x = O.parent;
|
|
1009
|
+
for (; x !== null && !M.stopPropagating && !E.includes(x); )
|
|
1010
|
+
M.eventObject = x, d(x[u], M), E.push(x), x = x.parent;
|
|
1011
|
+
const N = Rn(u.slice(2));
|
|
1012
|
+
n(N, { intersection: I, event: M });
|
|
903
1013
|
}
|
|
904
1014
|
}
|
|
905
1015
|
const {
|
|
906
|
-
onClick:
|
|
907
|
-
onDblClick:
|
|
908
|
-
onContextMenu:
|
|
909
|
-
onPointerMove:
|
|
910
|
-
onPointerDown:
|
|
911
|
-
onPointerUp:
|
|
912
|
-
onPointerMissed:
|
|
913
|
-
onWheel:
|
|
1016
|
+
onClick: h,
|
|
1017
|
+
onDblClick: p,
|
|
1018
|
+
onContextMenu: c,
|
|
1019
|
+
onPointerMove: v,
|
|
1020
|
+
onPointerDown: f,
|
|
1021
|
+
onPointerUp: _,
|
|
1022
|
+
onPointerMissed: m,
|
|
1023
|
+
onWheel: w,
|
|
914
1024
|
forceUpdate: y
|
|
915
|
-
} =
|
|
916
|
-
|
|
917
|
-
let
|
|
918
|
-
|
|
919
|
-
const
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
}),
|
|
923
|
-
|
|
924
|
-
}),
|
|
1025
|
+
} = ct(a, t);
|
|
1026
|
+
_((u) => o("onPointerUp", u)), f((u) => o("onPointerDown", u)), h((u) => o("onClick", u)), p((u) => o("onDoubleClick", u)), c((u) => o("onContextMenu", u)), w((u) => o("onWheel", u));
|
|
1027
|
+
let k = [];
|
|
1028
|
+
v((u) => {
|
|
1029
|
+
const M = u.intersections.map(({ object: T }) => T), E = u.intersections;
|
|
1030
|
+
k.forEach(({ object: T }) => {
|
|
1031
|
+
M.includes(T) || (u.intersections = k, o("onPointerLeave", u), o("onPointerOut", u));
|
|
1032
|
+
}), u.intersections = E, u.intersections.forEach(({ object: T }) => {
|
|
1033
|
+
k.includes(T) || (o("onPointerEnter", u), o("onPointerOver", u));
|
|
1034
|
+
}), o("onPointerMove", u), k = u.intersections;
|
|
925
1035
|
});
|
|
926
|
-
const
|
|
927
|
-
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
}),
|
|
1036
|
+
const P = [];
|
|
1037
|
+
m((u) => {
|
|
1038
|
+
const M = () => u.stopPropagating = !0;
|
|
1039
|
+
u.stopPropagation = M, P.forEach((E) => {
|
|
1040
|
+
u.stopPropagating || (u.eventObject = E, d(E.onPointerMissed, u));
|
|
1041
|
+
}), n("pointer-missed", { event: u });
|
|
932
1042
|
});
|
|
933
|
-
function
|
|
934
|
-
|
|
1043
|
+
function C(u) {
|
|
1044
|
+
Ue(u) && W(u) && u.onPointerMissed && P.push(u);
|
|
935
1045
|
}
|
|
936
|
-
function
|
|
937
|
-
|
|
938
|
-
|
|
1046
|
+
function b(u) {
|
|
1047
|
+
if (Ue(u) && W(u)) {
|
|
1048
|
+
const M = P.indexOf(u);
|
|
1049
|
+
M > -1 && P.splice(M, 1);
|
|
1050
|
+
}
|
|
939
1051
|
}
|
|
940
1052
|
return t.eventManager = {
|
|
941
1053
|
forceUpdate: y,
|
|
942
|
-
registerPointerMissedObject:
|
|
943
|
-
deregisterPointerMissedObject:
|
|
944
|
-
}, { forceUpdate: y, registerPointerMissedObject:
|
|
1054
|
+
registerPointerMissedObject: C,
|
|
1055
|
+
deregisterPointerMissedObject: b
|
|
1056
|
+
}, { forceUpdate: y, registerPointerMissedObject: C, deregisterPointerMissedObject: b };
|
|
1057
|
+
}
|
|
1058
|
+
function ze(e, t, n) {
|
|
1059
|
+
const r = e;
|
|
1060
|
+
return r.__tres = {
|
|
1061
|
+
type: "unknown",
|
|
1062
|
+
eventCount: 0,
|
|
1063
|
+
root: n,
|
|
1064
|
+
handlers: {},
|
|
1065
|
+
memoizedProps: {},
|
|
1066
|
+
objects: [],
|
|
1067
|
+
parent: null,
|
|
1068
|
+
...t
|
|
1069
|
+
}, r;
|
|
945
1070
|
}
|
|
946
|
-
|
|
1071
|
+
function Ve(e) {
|
|
1072
|
+
var n;
|
|
1073
|
+
const t = (n = e == null ? void 0 : e.__tres) == null ? void 0 : n.root;
|
|
1074
|
+
t && t.render && t.render.canBeInvalidated.value && t.invalidate();
|
|
1075
|
+
}
|
|
1076
|
+
const { logError: Ye } = F(), qe = [
|
|
947
1077
|
"onClick",
|
|
948
1078
|
"onContextMenu",
|
|
949
1079
|
"onPointerMove",
|
|
@@ -958,245 +1088,230 @@ const { logError: Ue } = U(), $e = [
|
|
|
958
1088
|
"onPointerMissed",
|
|
959
1089
|
"onLostPointerCapture",
|
|
960
1090
|
"onWheel"
|
|
961
|
-
]
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
t && t.render && t.render.canBeInvalidated.value && t.invalidate();
|
|
966
|
-
}
|
|
967
|
-
const Fr = () => {
|
|
968
|
-
let e = null;
|
|
969
|
-
function t(n, f, h, l) {
|
|
970
|
-
if (l || (l = {}), l.args || (l.args = []), n === "template" || wr(n))
|
|
1091
|
+
], er = (e) => {
|
|
1092
|
+
const t = e.scene.value;
|
|
1093
|
+
function n(o, h, p, c) {
|
|
1094
|
+
if (c || (c = {}), c.args || (c.args = []), o === "template" || xn(o))
|
|
971
1095
|
return null;
|
|
972
|
-
let
|
|
973
|
-
if (
|
|
974
|
-
(
|
|
975
|
-
const
|
|
976
|
-
|
|
1096
|
+
let v = o.replace("Tres", ""), f;
|
|
1097
|
+
if (o === "primitive") {
|
|
1098
|
+
(c == null ? void 0 : c.object) === void 0 && Ye("Tres primitives need a prop 'object'");
|
|
1099
|
+
const _ = c.object;
|
|
1100
|
+
v = _.type, f = Object.assign(_.clone(), { type: v });
|
|
977
1101
|
} else {
|
|
978
|
-
const
|
|
979
|
-
|
|
980
|
-
`${
|
|
981
|
-
),
|
|
1102
|
+
const _ = ye.value[v];
|
|
1103
|
+
_ || Ye(
|
|
1104
|
+
`${v} is not defined on the THREE namespace. Use extend to add it to the catalog.`
|
|
1105
|
+
), f = new _(...c.args);
|
|
982
1106
|
}
|
|
983
|
-
return
|
|
984
|
-
...
|
|
985
|
-
type:
|
|
986
|
-
memoizedProps:
|
|
1107
|
+
return f ? (f.isCamera && (c != null && c.position || f.position.set(3, 3, 3), c != null && c.lookAt || f.lookAt(0, 0, 0)), (c == null ? void 0 : c.attach) === void 0 && (f.isMaterial ? f.attach = "material" : f.isBufferGeometry && (f.attach = "geometry")), f = ze(f, {
|
|
1108
|
+
...f.__tres,
|
|
1109
|
+
type: v,
|
|
1110
|
+
memoizedProps: c,
|
|
987
1111
|
eventCount: 0,
|
|
988
1112
|
disposable: !0,
|
|
989
|
-
primitive:
|
|
990
|
-
},
|
|
1113
|
+
primitive: o === "primitive"
|
|
1114
|
+
}, e), f.isObject3D && f.__tres && (c != null && c.material || c != null && c.geometry) && (f.__tres.disposable = !1), f) : null;
|
|
991
1115
|
}
|
|
992
|
-
function r(
|
|
993
|
-
var
|
|
994
|
-
if (!
|
|
1116
|
+
function r(o, h) {
|
|
1117
|
+
var f, _;
|
|
1118
|
+
if (!o)
|
|
995
1119
|
return;
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
n != null && n.isCamera && y(n), n.onPointerMissed && ((b = n == null ? void 0 : n.__tres) != null && b.root) && ((P = (d = (w = n == null ? void 0 : n.__tres) == null ? void 0 : w.root) == null ? void 0 : d.eventManager) == null || P.registerPointerMissedObject(n));
|
|
1001
|
-
}
|
|
1002
|
-
n != null && n.isObject3D && (h != null && h.isObject3D) ? (h.add(n), n.dispatchEvent({ type: "added" })) : n != null && n.isFog ? h.fog = n : typeof (n == null ? void 0 : n.attach) == "string" && (n.__previousAttach = n[h == null ? void 0 : h.attach], h && (h[n.attach] = n));
|
|
1120
|
+
const p = o.__tres ? o : ze(o, {}), c = h || t;
|
|
1121
|
+
e.registerCamera(o), (f = e.eventManager) == null || f.registerPointerMissedObject(o);
|
|
1122
|
+
let v = !1;
|
|
1123
|
+
W(o) && W(c) ? (c.add(o), v = !0, o.dispatchEvent({ type: "added" })) : ot(o) ? c.fog = o : typeof o.attach == "string" && (o.__previousAttach = o[c == null ? void 0 : c.attach], c && (c[o.attach] = o)), p.__tres.parent = c, (_ = c.__tres) != null && _.objects && !v && (c.__tres.objects.includes(o) || c.__tres.objects.push(o));
|
|
1003
1124
|
}
|
|
1004
|
-
function o
|
|
1005
|
-
var
|
|
1006
|
-
if (!
|
|
1125
|
+
function s(o) {
|
|
1126
|
+
var p, c, v, f, _;
|
|
1127
|
+
if (!o)
|
|
1007
1128
|
return;
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
};
|
|
1015
|
-
(h = n.removeFromParent) == null || h.call(n), n.traverse((y) => {
|
|
1016
|
-
var v, p;
|
|
1017
|
-
d(y), y.onPointerMissed && ((p = (v = f == null ? void 0 : f.root) == null ? void 0 : v.eventManager) == null || p.deregisterPointerMissedObject(y));
|
|
1018
|
-
}), d(n), Fe(n), !((l = n.__tres) == null ? void 0 : l.primitive) && ((b = n.__tres) != null && b.disposable) && be(n), (w = n.dispose) == null || w.call(n);
|
|
1019
|
-
}
|
|
1129
|
+
o.parent = o.parent || t;
|
|
1130
|
+
const h = ((p = o.__tres) == null ? void 0 : p.parent) || t;
|
|
1131
|
+
o.__tres && (o.__tres.parent = null), h.__tres && "objects" in h.__tres && Nn(h.__tres.objects, (m) => m !== o), W(o) && ((c = o.removeFromParent) == null || c.call(o), o.traverse((w) => {
|
|
1132
|
+
var y;
|
|
1133
|
+
e.deregisterCamera(w), (y = e.eventManager) == null || y.deregisterPointerMissedObject(w);
|
|
1134
|
+
}), e.deregisterCamera(o), Ve(o), !((v = o.__tres) != null && v.primitive) && ((f = o.__tres) != null && f.disposable) && Ce(o), (_ = o.dispose) == null || _.call(o));
|
|
1020
1135
|
}
|
|
1021
|
-
function
|
|
1022
|
-
var
|
|
1023
|
-
if (
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
M != null && M.__tres && (M.__tres.root = e == null ? void 0 : e.__tres.root), M != null && M.isGroup ? (n.geometry = void 0, n.material = void 0) : delete n.isGroup;
|
|
1036
|
-
}
|
|
1037
|
-
if (n != null && n.isObject3D && P === "blocks-pointer-events") {
|
|
1038
|
-
l || l === "" ? n[P] = l : delete n[P];
|
|
1039
|
-
return;
|
|
1040
|
-
}
|
|
1041
|
-
$e.includes(f) && (n.__tres.eventCount += 1);
|
|
1042
|
-
let y = X(P), v = d == null ? void 0 : d[y];
|
|
1043
|
-
if (P === "args") {
|
|
1044
|
-
const M = n, _ = h ?? [], c = l ?? [], g = ((w = n == null ? void 0 : n.__tres) == null ? void 0 : w.type) || n.type;
|
|
1045
|
-
g && _.length && !kr(_, c) && (d = Object.assign(
|
|
1046
|
-
M,
|
|
1047
|
-
new pe.value[g](...l)
|
|
1048
|
-
));
|
|
1049
|
-
return;
|
|
1050
|
-
}
|
|
1051
|
-
if (d.type === "BufferGeometry") {
|
|
1052
|
-
if (P === "args")
|
|
1053
|
-
return;
|
|
1054
|
-
d.setAttribute(
|
|
1055
|
-
X(P),
|
|
1056
|
-
new St(...l)
|
|
1057
|
-
);
|
|
1058
|
-
return;
|
|
1059
|
-
}
|
|
1060
|
-
if (P.includes("-") && v === void 0) {
|
|
1061
|
-
const M = P.split("-");
|
|
1062
|
-
v = M.reduce((_, c) => _[X(c)], d), P = M.pop(), y = P, v != null && v.set || (d = M.reduce((_, c) => _[X(c)], d));
|
|
1136
|
+
function l(o, h, p, c) {
|
|
1137
|
+
var y, k;
|
|
1138
|
+
if (!o)
|
|
1139
|
+
return;
|
|
1140
|
+
let v = o, f = h;
|
|
1141
|
+
if ((y = o.__tres) != null && y.primitive && f === "object" && p !== null) {
|
|
1142
|
+
const P = n("primitive", void 0, void 0, {
|
|
1143
|
+
object: c
|
|
1144
|
+
});
|
|
1145
|
+
for (const C in P) {
|
|
1146
|
+
if (C === "uuid")
|
|
1147
|
+
continue;
|
|
1148
|
+
const b = o[C], u = P[C];
|
|
1149
|
+
!(b != null && b.set) && !Q(b) ? o[C] = u : b.constructor === u.constructor && (b != null && b.copy) ? b == null || b.copy(u) : Array.isArray(u) ? b.set(...u) : !b.isColor && b.setScalar ? b.setScalar(u) : b.set(u);
|
|
1063
1150
|
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1151
|
+
P != null && P.__tres && (P.__tres.root = e), P != null && P.isGroup ? (o.geometry = void 0, o.material = void 0) : delete o.isGroup;
|
|
1152
|
+
}
|
|
1153
|
+
if (W(o) && f === "blocks-pointer-events") {
|
|
1154
|
+
c || c === "" ? o[f] = c : delete o[f];
|
|
1155
|
+
return;
|
|
1156
|
+
}
|
|
1157
|
+
qe.includes(h) && (o.__tres.eventCount += 1);
|
|
1158
|
+
let _ = re(f), m = v == null ? void 0 : v[_];
|
|
1159
|
+
if (f === "args") {
|
|
1160
|
+
const P = o, C = p ?? [], b = c ?? [], u = ((k = o.__tres) == null ? void 0 : k.type) || o.type;
|
|
1161
|
+
u && C.length && !In(C, b) && (v = Object.assign(
|
|
1162
|
+
P,
|
|
1163
|
+
new ye.value[u](...c)
|
|
1164
|
+
));
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
if (v.type === "BufferGeometry") {
|
|
1168
|
+
if (f === "args")
|
|
1067
1169
|
return;
|
|
1068
|
-
|
|
1069
|
-
|
|
1170
|
+
v.setAttribute(
|
|
1171
|
+
re(f),
|
|
1172
|
+
new Bt(...c)
|
|
1173
|
+
);
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
if (f.includes("-") && m === void 0) {
|
|
1177
|
+
const P = f.split("-");
|
|
1178
|
+
m = P.reduce((C, b) => C[re(b)], v), f = P.pop(), _ = f, m != null && m.set || (v = P.reduce((C, b) => C[re(b)], v));
|
|
1179
|
+
}
|
|
1180
|
+
let w = c;
|
|
1181
|
+
if (w === "" && (w = !0), Q(m)) {
|
|
1182
|
+
qe.includes(h) || (ve(w) ? o[_](...w) : o[_](w)), _.startsWith("on") && Q(w) && (v[_] = w);
|
|
1183
|
+
return;
|
|
1070
1184
|
}
|
|
1185
|
+
!(m != null && m.set) && !Q(m) ? v[_] = w : m.constructor === w.constructor && (m != null && m.copy) ? m == null || m.copy(w) : ve(w) ? m.set(...w) : !m.isColor && m.setScalar ? m.setScalar(w) : m.set(w), Ve(o);
|
|
1071
1186
|
}
|
|
1072
|
-
function
|
|
1073
|
-
return (
|
|
1187
|
+
function i(o) {
|
|
1188
|
+
return (o == null ? void 0 : o.parent) || null;
|
|
1074
1189
|
}
|
|
1075
|
-
function a(
|
|
1076
|
-
const
|
|
1077
|
-
return
|
|
1190
|
+
function a(o) {
|
|
1191
|
+
const h = new jt();
|
|
1192
|
+
return h.name = o, h.__tres = { type: "Comment" }, h.__tres.root = t == null ? void 0 : t.__tres.root, h;
|
|
1078
1193
|
}
|
|
1079
|
-
function
|
|
1080
|
-
if (!
|
|
1194
|
+
function d(o) {
|
|
1195
|
+
if (!o)
|
|
1081
1196
|
return null;
|
|
1082
|
-
const
|
|
1083
|
-
return
|
|
1197
|
+
const h = o.parent || t, p = h.children.indexOf(o);
|
|
1198
|
+
return h.children[p + 1] || null;
|
|
1084
1199
|
}
|
|
1085
1200
|
return {
|
|
1086
1201
|
insert: r,
|
|
1087
|
-
remove:
|
|
1088
|
-
createElement:
|
|
1089
|
-
patchProp:
|
|
1090
|
-
parentNode:
|
|
1202
|
+
remove: s,
|
|
1203
|
+
createElement: n,
|
|
1204
|
+
patchProp: l,
|
|
1205
|
+
parentNode: i,
|
|
1091
1206
|
createText: () => void 0,
|
|
1092
1207
|
createComment: a,
|
|
1093
1208
|
setText: () => void 0,
|
|
1094
1209
|
setElementText: () => void 0,
|
|
1095
|
-
nextSibling:
|
|
1210
|
+
nextSibling: d,
|
|
1096
1211
|
querySelector: () => void 0,
|
|
1097
1212
|
setScopeId: () => void 0,
|
|
1098
1213
|
cloneNode: () => void 0,
|
|
1099
1214
|
insertStaticContent: () => void 0
|
|
1100
1215
|
};
|
|
1101
1216
|
};
|
|
1102
|
-
function
|
|
1103
|
-
return
|
|
1217
|
+
function tr() {
|
|
1218
|
+
return ft().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
|
1104
1219
|
}
|
|
1105
|
-
function
|
|
1220
|
+
function ft() {
|
|
1106
1221
|
return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
|
|
1107
1222
|
}
|
|
1108
|
-
const
|
|
1109
|
-
let
|
|
1110
|
-
function
|
|
1223
|
+
const nr = typeof Proxy == "function", rr = "devtools-plugin:setup", or = "plugin:settings:set";
|
|
1224
|
+
let z, be;
|
|
1225
|
+
function ir() {
|
|
1111
1226
|
var e;
|
|
1112
|
-
return
|
|
1227
|
+
return z !== void 0 || (typeof window < "u" && window.performance ? (z = !0, be = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (z = !0, be = globalThis.perf_hooks.performance) : z = !1), z;
|
|
1113
1228
|
}
|
|
1114
|
-
function
|
|
1115
|
-
return
|
|
1229
|
+
function sr() {
|
|
1230
|
+
return ir() ? be.now() : Date.now();
|
|
1116
1231
|
}
|
|
1117
|
-
class
|
|
1118
|
-
constructor(t,
|
|
1119
|
-
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook =
|
|
1120
|
-
const
|
|
1232
|
+
class ar {
|
|
1233
|
+
constructor(t, n) {
|
|
1234
|
+
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
|
|
1235
|
+
const r = {};
|
|
1121
1236
|
if (t.settings)
|
|
1122
|
-
for (const
|
|
1123
|
-
const
|
|
1124
|
-
|
|
1237
|
+
for (const i in t.settings) {
|
|
1238
|
+
const a = t.settings[i];
|
|
1239
|
+
r[i] = a.defaultValue;
|
|
1125
1240
|
}
|
|
1126
|
-
const
|
|
1127
|
-
let
|
|
1241
|
+
const s = `__vue-devtools-plugin-settings__${t.id}`;
|
|
1242
|
+
let l = Object.assign({}, r);
|
|
1128
1243
|
try {
|
|
1129
|
-
const
|
|
1130
|
-
Object.assign(
|
|
1244
|
+
const i = localStorage.getItem(s), a = JSON.parse(i);
|
|
1245
|
+
Object.assign(l, a);
|
|
1131
1246
|
} catch {
|
|
1132
1247
|
}
|
|
1133
1248
|
this.fallbacks = {
|
|
1134
1249
|
getSettings() {
|
|
1135
|
-
return
|
|
1250
|
+
return l;
|
|
1136
1251
|
},
|
|
1137
|
-
setSettings(
|
|
1252
|
+
setSettings(i) {
|
|
1138
1253
|
try {
|
|
1139
|
-
localStorage.setItem(
|
|
1254
|
+
localStorage.setItem(s, JSON.stringify(i));
|
|
1140
1255
|
} catch {
|
|
1141
1256
|
}
|
|
1142
|
-
|
|
1257
|
+
l = i;
|
|
1143
1258
|
},
|
|
1144
1259
|
now() {
|
|
1145
|
-
return
|
|
1260
|
+
return sr();
|
|
1146
1261
|
}
|
|
1147
|
-
},
|
|
1148
|
-
|
|
1262
|
+
}, n && n.on(or, (i, a) => {
|
|
1263
|
+
i === this.plugin.id && this.fallbacks.setSettings(a);
|
|
1149
1264
|
}), this.proxiedOn = new Proxy({}, {
|
|
1150
|
-
get: (
|
|
1265
|
+
get: (i, a) => this.target ? this.target.on[a] : (...d) => {
|
|
1151
1266
|
this.onQueue.push({
|
|
1152
|
-
method:
|
|
1153
|
-
args:
|
|
1267
|
+
method: a,
|
|
1268
|
+
args: d
|
|
1154
1269
|
});
|
|
1155
1270
|
}
|
|
1156
1271
|
}), this.proxiedTarget = new Proxy({}, {
|
|
1157
|
-
get: (
|
|
1158
|
-
method:
|
|
1159
|
-
args:
|
|
1272
|
+
get: (i, a) => this.target ? this.target[a] : a === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(a) ? (...d) => (this.targetQueue.push({
|
|
1273
|
+
method: a,
|
|
1274
|
+
args: d,
|
|
1160
1275
|
resolve: () => {
|
|
1161
1276
|
}
|
|
1162
|
-
}), this.fallbacks[
|
|
1277
|
+
}), this.fallbacks[a](...d)) : (...d) => new Promise((o) => {
|
|
1163
1278
|
this.targetQueue.push({
|
|
1164
|
-
method:
|
|
1165
|
-
args:
|
|
1166
|
-
resolve:
|
|
1279
|
+
method: a,
|
|
1280
|
+
args: d,
|
|
1281
|
+
resolve: o
|
|
1167
1282
|
});
|
|
1168
1283
|
})
|
|
1169
1284
|
});
|
|
1170
1285
|
}
|
|
1171
1286
|
async setRealTarget(t) {
|
|
1172
1287
|
this.target = t;
|
|
1173
|
-
for (const
|
|
1174
|
-
this.target.on[
|
|
1175
|
-
for (const
|
|
1176
|
-
|
|
1288
|
+
for (const n of this.onQueue)
|
|
1289
|
+
this.target.on[n.method](...n.args);
|
|
1290
|
+
for (const n of this.targetQueue)
|
|
1291
|
+
n.resolve(await this.target[n.method](...n.args));
|
|
1177
1292
|
}
|
|
1178
1293
|
}
|
|
1179
|
-
function
|
|
1180
|
-
const
|
|
1181
|
-
if (
|
|
1182
|
-
|
|
1294
|
+
function lr(e, t) {
|
|
1295
|
+
const n = e, r = ft(), s = tr(), l = nr && n.enableEarlyProxy;
|
|
1296
|
+
if (s && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !l))
|
|
1297
|
+
s.emit(rr, e, t);
|
|
1183
1298
|
else {
|
|
1184
|
-
const
|
|
1185
|
-
(
|
|
1186
|
-
pluginDescriptor:
|
|
1299
|
+
const i = l ? new ar(n, s) : null;
|
|
1300
|
+
(r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({
|
|
1301
|
+
pluginDescriptor: n,
|
|
1187
1302
|
setupFn: t,
|
|
1188
|
-
proxy:
|
|
1189
|
-
}),
|
|
1303
|
+
proxy: i
|
|
1304
|
+
}), i && t(i.proxiedTarget);
|
|
1190
1305
|
}
|
|
1191
1306
|
}
|
|
1192
|
-
function
|
|
1193
|
-
const
|
|
1194
|
-
typeof
|
|
1307
|
+
function cr(e, t) {
|
|
1308
|
+
const n = `▲ ■ ●${e}`;
|
|
1309
|
+
typeof Je == "function" ? Je(n, t) : console.log(n);
|
|
1195
1310
|
}
|
|
1196
|
-
function
|
|
1311
|
+
function Je(e, t) {
|
|
1197
1312
|
throw new Error(e + t);
|
|
1198
1313
|
}
|
|
1199
|
-
const
|
|
1314
|
+
const dt = (e) => {
|
|
1200
1315
|
const t = {
|
|
1201
1316
|
id: e.uuid,
|
|
1202
1317
|
label: e.type,
|
|
@@ -1208,9 +1323,9 @@ const ot = (e) => {
|
|
|
1208
1323
|
textColor: 5750629,
|
|
1209
1324
|
backgroundColor: 15793395
|
|
1210
1325
|
});
|
|
1211
|
-
const
|
|
1212
|
-
return
|
|
1213
|
-
label: `${
|
|
1326
|
+
const n = Ee(e);
|
|
1327
|
+
return n > 0 && t.tags.push({
|
|
1328
|
+
label: `${qn(n)} KB`,
|
|
1214
1329
|
textColor: 15707189,
|
|
1215
1330
|
backgroundColor: 16775644,
|
|
1216
1331
|
tooltip: "Memory usage"
|
|
@@ -1236,166 +1351,166 @@ const ot = (e) => {
|
|
|
1236
1351
|
tooltip: "Position"
|
|
1237
1352
|
})), t;
|
|
1238
1353
|
};
|
|
1239
|
-
function
|
|
1240
|
-
e.children.forEach((
|
|
1241
|
-
if (
|
|
1354
|
+
function pt(e, t, n = "") {
|
|
1355
|
+
e.children.forEach((r) => {
|
|
1356
|
+
if (r.type === "HightlightMesh" || n && !r.type.includes(n) && !r.name.includes(n))
|
|
1242
1357
|
return;
|
|
1243
|
-
const
|
|
1244
|
-
t.children.push(
|
|
1358
|
+
const s = dt(r);
|
|
1359
|
+
t.children.push(s), pt(r, s, n);
|
|
1245
1360
|
});
|
|
1246
1361
|
}
|
|
1247
|
-
const
|
|
1362
|
+
const ur = [], q = "tres:inspector", fr = Ke({
|
|
1248
1363
|
sceneGraph: null
|
|
1249
1364
|
});
|
|
1250
|
-
function
|
|
1251
|
-
|
|
1365
|
+
function dr(e, t) {
|
|
1366
|
+
lr(
|
|
1252
1367
|
{
|
|
1253
1368
|
id: "dev.esm.tres",
|
|
1254
1369
|
label: "TresJS 🪐",
|
|
1255
1370
|
logo: "https://raw.githubusercontent.com/Tresjs/tres/main/public/favicon.svg",
|
|
1256
1371
|
packageName: "tresjs",
|
|
1257
1372
|
homepage: "https://tresjs.org",
|
|
1258
|
-
componentStateTypes:
|
|
1373
|
+
componentStateTypes: ur,
|
|
1259
1374
|
app: e
|
|
1260
1375
|
},
|
|
1261
|
-
(
|
|
1262
|
-
typeof
|
|
1376
|
+
(n) => {
|
|
1377
|
+
typeof n.now != "function" && cr(
|
|
1263
1378
|
"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."
|
|
1264
|
-
),
|
|
1265
|
-
id:
|
|
1379
|
+
), n.addInspector({
|
|
1380
|
+
id: q,
|
|
1266
1381
|
label: "TresJS 🪐",
|
|
1267
1382
|
icon: "account_tree",
|
|
1268
1383
|
treeFilterPlaceholder: "Search instances"
|
|
1269
1384
|
}), setInterval(() => {
|
|
1270
|
-
|
|
1385
|
+
n.sendInspectorTree(q);
|
|
1271
1386
|
}, 1e3), setInterval(() => {
|
|
1272
|
-
|
|
1273
|
-
}, 5e3),
|
|
1274
|
-
if (
|
|
1275
|
-
const
|
|
1276
|
-
|
|
1387
|
+
n.notifyComponentUpdate();
|
|
1388
|
+
}, 5e3), n.on.getInspectorTree((l) => {
|
|
1389
|
+
if (l.inspectorId === q) {
|
|
1390
|
+
const i = dt(t.scene.value);
|
|
1391
|
+
pt(t.scene.value, i, l.filter), fr.sceneGraph = i, l.rootNodes = [i];
|
|
1277
1392
|
}
|
|
1278
1393
|
});
|
|
1279
|
-
let
|
|
1280
|
-
|
|
1281
|
-
var
|
|
1282
|
-
if (
|
|
1283
|
-
const [
|
|
1284
|
-
if (!
|
|
1394
|
+
let r = null, s = null;
|
|
1395
|
+
n.on.getInspectorState((l) => {
|
|
1396
|
+
var i;
|
|
1397
|
+
if (l.inspectorId === q) {
|
|
1398
|
+
const [a] = t.scene.value.getObjectsByProperty("uuid", l.nodeId);
|
|
1399
|
+
if (!a)
|
|
1285
1400
|
return;
|
|
1286
|
-
if (
|
|
1287
|
-
const
|
|
1288
|
-
|
|
1401
|
+
if (s && r && r.parent && s.remove(r), a.isMesh) {
|
|
1402
|
+
const d = $n(a);
|
|
1403
|
+
a.add(d), r = d, s = a;
|
|
1289
1404
|
}
|
|
1290
|
-
|
|
1405
|
+
l.state = {
|
|
1291
1406
|
object: [
|
|
1292
1407
|
{
|
|
1293
1408
|
key: "uuid",
|
|
1294
1409
|
editable: !0,
|
|
1295
|
-
value:
|
|
1410
|
+
value: a.uuid
|
|
1296
1411
|
},
|
|
1297
1412
|
{
|
|
1298
1413
|
key: "name",
|
|
1299
1414
|
editable: !0,
|
|
1300
|
-
value:
|
|
1415
|
+
value: a.name
|
|
1301
1416
|
},
|
|
1302
1417
|
{
|
|
1303
1418
|
key: "type",
|
|
1304
1419
|
editable: !0,
|
|
1305
|
-
value:
|
|
1420
|
+
value: a.type
|
|
1306
1421
|
},
|
|
1307
1422
|
{
|
|
1308
1423
|
key: "position",
|
|
1309
1424
|
editable: !0,
|
|
1310
|
-
value:
|
|
1425
|
+
value: a.position
|
|
1311
1426
|
},
|
|
1312
1427
|
{
|
|
1313
1428
|
key: "rotation",
|
|
1314
1429
|
editable: !0,
|
|
1315
|
-
value:
|
|
1430
|
+
value: a.rotation
|
|
1316
1431
|
},
|
|
1317
1432
|
{
|
|
1318
1433
|
key: "scale",
|
|
1319
1434
|
editable: !0,
|
|
1320
|
-
value:
|
|
1435
|
+
value: a.scale
|
|
1321
1436
|
},
|
|
1322
1437
|
{
|
|
1323
1438
|
key: "geometry",
|
|
1324
|
-
value:
|
|
1439
|
+
value: a.geometry
|
|
1325
1440
|
},
|
|
1326
1441
|
{
|
|
1327
1442
|
key: "material",
|
|
1328
|
-
value:
|
|
1443
|
+
value: a.material
|
|
1329
1444
|
},
|
|
1330
1445
|
{
|
|
1331
1446
|
key: "color",
|
|
1332
1447
|
editable: !0,
|
|
1333
|
-
value:
|
|
1448
|
+
value: a.color
|
|
1334
1449
|
},
|
|
1335
1450
|
{
|
|
1336
1451
|
key: "intensity",
|
|
1337
1452
|
editable: !0,
|
|
1338
|
-
value:
|
|
1453
|
+
value: a.intensity
|
|
1339
1454
|
},
|
|
1340
1455
|
{
|
|
1341
1456
|
key: "castShadow",
|
|
1342
1457
|
editable: !0,
|
|
1343
|
-
value:
|
|
1458
|
+
value: a.castShadow
|
|
1344
1459
|
},
|
|
1345
1460
|
{
|
|
1346
1461
|
key: "receiveShadow",
|
|
1347
1462
|
editable: !0,
|
|
1348
|
-
value:
|
|
1463
|
+
value: a.receiveShadow
|
|
1349
1464
|
},
|
|
1350
1465
|
{
|
|
1351
1466
|
key: "frustumCulled",
|
|
1352
1467
|
editable: !0,
|
|
1353
|
-
value:
|
|
1468
|
+
value: a.frustumCulled
|
|
1354
1469
|
},
|
|
1355
1470
|
{
|
|
1356
1471
|
key: "matrixAutoUpdate",
|
|
1357
1472
|
editable: !0,
|
|
1358
|
-
value:
|
|
1473
|
+
value: a.matrixAutoUpdate
|
|
1359
1474
|
},
|
|
1360
1475
|
{
|
|
1361
1476
|
key: "matrixWorldNeedsUpdate",
|
|
1362
1477
|
editable: !0,
|
|
1363
|
-
value:
|
|
1478
|
+
value: a.matrixWorldNeedsUpdate
|
|
1364
1479
|
},
|
|
1365
1480
|
{
|
|
1366
1481
|
key: "matrixWorld",
|
|
1367
|
-
value:
|
|
1482
|
+
value: a.matrixWorld
|
|
1368
1483
|
},
|
|
1369
1484
|
{
|
|
1370
1485
|
key: "visible",
|
|
1371
1486
|
editable: !0,
|
|
1372
|
-
value:
|
|
1487
|
+
value: a.visible
|
|
1373
1488
|
}
|
|
1374
1489
|
]
|
|
1375
|
-
},
|
|
1376
|
-
memory:
|
|
1377
|
-
objects:
|
|
1490
|
+
}, a.isScene && (l.state.info = {
|
|
1491
|
+
memory: Ee(a),
|
|
1492
|
+
objects: a.children.length,
|
|
1378
1493
|
calls: t.renderer.value.info.render.calls,
|
|
1379
1494
|
triangles: t.renderer.value.info.render.triangles,
|
|
1380
1495
|
points: t.renderer.value.info.render.points,
|
|
1381
1496
|
lines: t.renderer.value.info.render.lines
|
|
1382
|
-
},
|
|
1383
|
-
key:
|
|
1497
|
+
}, l.state.programs = ((i = t.renderer.value.info.programs) == null ? void 0 : i.map((d) => ({
|
|
1498
|
+
key: d.name,
|
|
1384
1499
|
value: {
|
|
1385
|
-
...
|
|
1386
|
-
vertexShader:
|
|
1387
|
-
attributes:
|
|
1388
|
-
uniforms:
|
|
1500
|
+
...d,
|
|
1501
|
+
vertexShader: d.vertexShader,
|
|
1502
|
+
attributes: d.getAttributes(),
|
|
1503
|
+
uniforms: d.getUniforms()
|
|
1389
1504
|
}
|
|
1390
1505
|
}))) || []);
|
|
1391
1506
|
}
|
|
1392
|
-
}),
|
|
1393
|
-
|
|
1507
|
+
}), n.on.editInspectorState((l) => {
|
|
1508
|
+
l.inspectorId === q && Un(t.scene.value, l.nodeId, l.path, l.state.value);
|
|
1394
1509
|
});
|
|
1395
1510
|
}
|
|
1396
1511
|
);
|
|
1397
1512
|
}
|
|
1398
|
-
const
|
|
1513
|
+
const pr = ["data-scene", "data-tres"], mr = /* @__PURE__ */ Le({
|
|
1399
1514
|
__name: "TresCanvas",
|
|
1400
1515
|
props: {
|
|
1401
1516
|
shadows: { type: Boolean, default: void 0 },
|
|
@@ -1435,93 +1550,94 @@ const en = ["data-scene", "data-tres"], tn = /* @__PURE__ */ xe({
|
|
|
1435
1550
|
"pointer-over",
|
|
1436
1551
|
"pointer-out",
|
|
1437
1552
|
"pointer-missed",
|
|
1438
|
-
"wheel"
|
|
1553
|
+
"wheel",
|
|
1554
|
+
"ready"
|
|
1439
1555
|
],
|
|
1440
|
-
setup(e, { expose: t, emit:
|
|
1441
|
-
var
|
|
1442
|
-
const
|
|
1443
|
-
|
|
1444
|
-
const h = (
|
|
1556
|
+
setup(e, { expose: t, emit: n }) {
|
|
1557
|
+
var _;
|
|
1558
|
+
const r = e, s = n, l = yt(), { logWarning: i } = F(), a = D(), d = $(new et()), o = (_ = Re()) == null ? void 0 : _.appContext.app;
|
|
1559
|
+
we(Xe);
|
|
1560
|
+
const h = (m) => Le({
|
|
1445
1561
|
setup() {
|
|
1446
|
-
var
|
|
1447
|
-
const
|
|
1448
|
-
return
|
|
1562
|
+
var y;
|
|
1563
|
+
const w = (y = Re()) == null ? void 0 : y.appContext;
|
|
1564
|
+
return w && (w.app = o), ge("useTres", m), ge("extend", we), typeof window < "u" && dr(w == null ? void 0 : w.app, m), () => De(Et, null, l != null && l.default ? l.default() : []);
|
|
1449
1565
|
}
|
|
1450
|
-
}),
|
|
1451
|
-
const
|
|
1452
|
-
|
|
1453
|
-
},
|
|
1454
|
-
|
|
1455
|
-
root:
|
|
1456
|
-
},
|
|
1457
|
-
},
|
|
1458
|
-
return t({ context:
|
|
1459
|
-
const
|
|
1460
|
-
|
|
1461
|
-
scene:
|
|
1462
|
-
canvas:
|
|
1463
|
-
windowSize:
|
|
1464
|
-
disableRender:
|
|
1465
|
-
rendererOptions:
|
|
1466
|
-
emit:
|
|
1467
|
-
}),
|
|
1468
|
-
const { registerCamera:
|
|
1469
|
-
|
|
1470
|
-
const
|
|
1471
|
-
const
|
|
1566
|
+
}), p = (m) => {
|
|
1567
|
+
const w = h(m), { render: y } = Ct(er(m));
|
|
1568
|
+
y(De(w), d.value);
|
|
1569
|
+
}, c = (m, w = !1) => {
|
|
1570
|
+
Ce(m.scene.value), w && (m.renderer.value.dispose(), m.renderer.value.renderLists.dispose(), m.renderer.value.forceContextLoss()), d.value.__tres = {
|
|
1571
|
+
root: m
|
|
1572
|
+
}, p(m);
|
|
1573
|
+
}, v = j(() => r.disableRender), f = $(null);
|
|
1574
|
+
return t({ context: f, dispose: () => c(f.value, !0) }), wt(() => {
|
|
1575
|
+
const m = a;
|
|
1576
|
+
f.value = Xn({
|
|
1577
|
+
scene: d.value,
|
|
1578
|
+
canvas: m,
|
|
1579
|
+
windowSize: r.windowSize ?? !1,
|
|
1580
|
+
disableRender: v.value ?? !1,
|
|
1581
|
+
rendererOptions: r,
|
|
1582
|
+
emit: s
|
|
1583
|
+
}), Zn(d.value, f.value, s);
|
|
1584
|
+
const { registerCamera: w, camera: y, cameras: k, deregisterCamera: P } = f.value;
|
|
1585
|
+
p(f.value);
|
|
1586
|
+
const C = () => {
|
|
1587
|
+
const b = new he(
|
|
1472
1588
|
45,
|
|
1473
1589
|
window.innerWidth / window.innerHeight,
|
|
1474
1590
|
0.1,
|
|
1475
1591
|
1e3
|
|
1476
1592
|
);
|
|
1477
|
-
|
|
1478
|
-
const
|
|
1479
|
-
|
|
1593
|
+
b.position.set(3, 3, 3), b.lookAt(0, 0, 0), w(b);
|
|
1594
|
+
const u = Me(() => {
|
|
1595
|
+
k.value.length >= 2 && (b.removeFromParent(), P(b), u == null || u());
|
|
1480
1596
|
});
|
|
1481
1597
|
};
|
|
1482
|
-
|
|
1483
|
-
() =>
|
|
1484
|
-
(
|
|
1485
|
-
|
|
1598
|
+
J(
|
|
1599
|
+
() => r.camera,
|
|
1600
|
+
(b, u) => {
|
|
1601
|
+
b && w(b), u && (u.removeFromParent(), P(u));
|
|
1486
1602
|
},
|
|
1487
1603
|
{
|
|
1488
1604
|
immediate: !0
|
|
1489
1605
|
}
|
|
1490
|
-
),
|
|
1606
|
+
), y.value || (i(
|
|
1491
1607
|
"No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
|
|
1492
|
-
),
|
|
1493
|
-
}),
|
|
1494
|
-
|
|
1495
|
-
}), (
|
|
1608
|
+
), C());
|
|
1609
|
+
}), Y(() => {
|
|
1610
|
+
c(f.value);
|
|
1611
|
+
}), (m, w) => (bt(), Mt("canvas", {
|
|
1496
1612
|
ref_key: "canvas",
|
|
1497
|
-
ref:
|
|
1498
|
-
"data-scene":
|
|
1499
|
-
class:
|
|
1500
|
-
"data-tres": `tresjs ${
|
|
1501
|
-
style:
|
|
1613
|
+
ref: a,
|
|
1614
|
+
"data-scene": d.value.uuid,
|
|
1615
|
+
class: _t(m.$attrs.class),
|
|
1616
|
+
"data-tres": `tresjs ${V(Mn).version}`,
|
|
1617
|
+
style: Pt({
|
|
1502
1618
|
display: "block",
|
|
1503
1619
|
width: "100%",
|
|
1504
1620
|
height: "100%",
|
|
1505
|
-
position:
|
|
1621
|
+
position: m.windowSize ? "fixed" : "relative",
|
|
1506
1622
|
top: 0,
|
|
1507
1623
|
left: 0,
|
|
1508
1624
|
pointerEvents: "auto",
|
|
1509
1625
|
touchAction: "none",
|
|
1510
|
-
...
|
|
1626
|
+
...m.$attrs.style
|
|
1511
1627
|
})
|
|
1512
|
-
}, null, 14,
|
|
1628
|
+
}, null, 14, pr));
|
|
1513
1629
|
}
|
|
1514
|
-
}),
|
|
1630
|
+
}), gr = [
|
|
1515
1631
|
"TresCanvas",
|
|
1516
1632
|
"TresLeches",
|
|
1517
1633
|
"TresScene"
|
|
1518
|
-
],
|
|
1634
|
+
], hr = {
|
|
1519
1635
|
template: {
|
|
1520
1636
|
compilerOptions: {
|
|
1521
|
-
isCustomElement: (e) => e.startsWith("Tres") && !
|
|
1637
|
+
isCustomElement: (e) => e.startsWith("Tres") && !gr.includes(e) || e === "primitive"
|
|
1522
1638
|
}
|
|
1523
1639
|
}
|
|
1524
|
-
},
|
|
1640
|
+
}, Rr = hr, Dr = {
|
|
1525
1641
|
mounted: (e, t) => {
|
|
1526
1642
|
if (t.arg) {
|
|
1527
1643
|
console.log(`v-log:${t.arg}`, e[t.arg]);
|
|
@@ -1530,22 +1646,22 @@ const en = ["data-scene", "data-tres"], tn = /* @__PURE__ */ xe({
|
|
|
1530
1646
|
console.log("v-log", e);
|
|
1531
1647
|
}
|
|
1532
1648
|
};
|
|
1533
|
-
class
|
|
1534
|
-
constructor(t,
|
|
1535
|
-
const
|
|
1536
|
-
|
|
1537
|
-
const
|
|
1538
|
-
super(
|
|
1539
|
-
const
|
|
1540
|
-
|
|
1649
|
+
class mt extends It {
|
|
1650
|
+
constructor(t, n) {
|
|
1651
|
+
const r = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], s = new Be();
|
|
1652
|
+
s.setAttribute("position", new je(r, 3)), s.computeBoundingSphere();
|
|
1653
|
+
const l = new Ht({ fog: !1 });
|
|
1654
|
+
super(s, l), this.light = t, this.color = n, this.type = "RectAreaLightHelper";
|
|
1655
|
+
const i = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], a = new Be();
|
|
1656
|
+
a.setAttribute("position", new je(i, 3)), a.computeBoundingSphere(), this.add(new Ut(a, new tt({ side: $t, fog: !1 })));
|
|
1541
1657
|
}
|
|
1542
1658
|
updateMatrixWorld() {
|
|
1543
1659
|
if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
|
|
1544
1660
|
this.material.color.set(this.color), this.children[0].material.color.set(this.color);
|
|
1545
1661
|
else {
|
|
1546
1662
|
this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);
|
|
1547
|
-
const t = this.material.color,
|
|
1548
|
-
|
|
1663
|
+
const t = this.material.color, n = Math.max(t.r, t.g, t.b);
|
|
1664
|
+
n > 1 && t.multiplyScalar(1 / n), this.children[0].material.color.copy(this.material.color);
|
|
1549
1665
|
}
|
|
1550
1666
|
this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld), this.children[0].matrixWorld.copy(this.matrixWorld);
|
|
1551
1667
|
}
|
|
@@ -1553,87 +1669,88 @@ class it extends Tt {
|
|
|
1553
1669
|
this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
|
|
1554
1670
|
}
|
|
1555
1671
|
}
|
|
1556
|
-
const { logWarning:
|
|
1557
|
-
let
|
|
1558
|
-
const
|
|
1559
|
-
DirectionalLight:
|
|
1560
|
-
PointLight:
|
|
1561
|
-
SpotLight:
|
|
1562
|
-
HemisphereLight:
|
|
1563
|
-
RectAreaLight:
|
|
1564
|
-
},
|
|
1672
|
+
const { logWarning: Qe } = F();
|
|
1673
|
+
let ie, U;
|
|
1674
|
+
const vr = {
|
|
1675
|
+
DirectionalLight: Ft,
|
|
1676
|
+
PointLight: Wt,
|
|
1677
|
+
SpotLight: Nt,
|
|
1678
|
+
HemisphereLight: Gt,
|
|
1679
|
+
RectAreaLight: mt
|
|
1680
|
+
}, Br = {
|
|
1565
1681
|
mounted: (e) => {
|
|
1566
1682
|
if (!e.isLight) {
|
|
1567
|
-
|
|
1683
|
+
Qe(`${e.type} is not a light`);
|
|
1568
1684
|
return;
|
|
1569
1685
|
}
|
|
1570
|
-
|
|
1686
|
+
ie = vr[e.type], e.parent.add(new ie(e, 1, e.color.getHex()));
|
|
1571
1687
|
},
|
|
1572
1688
|
updated: (e) => {
|
|
1573
|
-
|
|
1689
|
+
U = e.parent.children.find((t) => t instanceof ie), !(U instanceof mt) && U.update();
|
|
1574
1690
|
},
|
|
1575
1691
|
unmounted: (e) => {
|
|
1576
1692
|
if (!e.isLight) {
|
|
1577
|
-
|
|
1693
|
+
Qe(`${e.type} is not a light`);
|
|
1578
1694
|
return;
|
|
1579
1695
|
}
|
|
1580
|
-
|
|
1696
|
+
U = e.parent.children.find((t) => t instanceof ie), U && U.dispose && U.dispose(), e.parent.remove(U);
|
|
1581
1697
|
}
|
|
1582
|
-
}, { logWarning:
|
|
1583
|
-
let
|
|
1584
|
-
const
|
|
1698
|
+
}, { logWarning: yr } = F();
|
|
1699
|
+
let B = null;
|
|
1700
|
+
const jr = {
|
|
1585
1701
|
updated: (e, t) => {
|
|
1586
|
-
var
|
|
1587
|
-
const
|
|
1588
|
-
if (!
|
|
1589
|
-
|
|
1702
|
+
var s;
|
|
1703
|
+
const n = Fn(t);
|
|
1704
|
+
if (!n) {
|
|
1705
|
+
yr(`v-distance-to: problem with binding value: ${t.value}`);
|
|
1590
1706
|
return;
|
|
1591
1707
|
}
|
|
1592
|
-
|
|
1593
|
-
const
|
|
1594
|
-
|
|
1708
|
+
B && (B.dispose(), e.parent.remove(B));
|
|
1709
|
+
const r = n.clone().sub(e.position);
|
|
1710
|
+
r.normalize(), B = new zt(r, e.position, e.position.distanceTo(n), 16776960), e.parent.add(B), console.table(
|
|
1595
1711
|
[
|
|
1596
|
-
["Distance:", e.position.distanceTo(
|
|
1597
|
-
[`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(
|
|
1598
|
-
[`Destiny: ${e.name || e.type}`, `x:${
|
|
1712
|
+
["Distance:", e.position.distanceTo(n)],
|
|
1713
|
+
[`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(s = e.position) == null ? void 0 : s.z}`],
|
|
1714
|
+
[`Destiny: ${e.name || e.type}`, `x:${n.x}, y:${n.y}, z:${n == null ? void 0 : n.z}`]
|
|
1599
1715
|
]
|
|
1600
1716
|
);
|
|
1601
1717
|
},
|
|
1602
1718
|
unmounted: (e) => {
|
|
1603
|
-
|
|
1719
|
+
B == null || B.dispose(), e.parent.remove(B);
|
|
1604
1720
|
}
|
|
1605
|
-
},
|
|
1721
|
+
}, Ir = {
|
|
1606
1722
|
install(e) {
|
|
1607
|
-
e.component("TresCanvas",
|
|
1723
|
+
e.component("TresCanvas", mr);
|
|
1608
1724
|
}
|
|
1609
1725
|
};
|
|
1610
1726
|
export {
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1727
|
+
mr as TresCanvas,
|
|
1728
|
+
ye as catalogue,
|
|
1729
|
+
Qn as createRenderLoop,
|
|
1730
|
+
Ir as default,
|
|
1731
|
+
Ce as dispose,
|
|
1732
|
+
we as extend,
|
|
1733
|
+
Cr as isProd,
|
|
1734
|
+
Tn as normalizeColor,
|
|
1735
|
+
Er as normalizeVectorFlexibleParam,
|
|
1736
|
+
Or as onTresReady,
|
|
1737
|
+
Rr as templateCompilerOptions,
|
|
1738
|
+
Yn as trasverseObjects,
|
|
1739
|
+
Cn as useCamera,
|
|
1740
|
+
kr as useLoader,
|
|
1741
|
+
F as useLogger,
|
|
1742
|
+
Lr as useLoop,
|
|
1743
|
+
Ar as usePointerEventHandler,
|
|
1744
|
+
ct as useRaycaster,
|
|
1745
|
+
Pr as useRenderLoop,
|
|
1746
|
+
zn as useRenderer,
|
|
1747
|
+
Tr as useSeek,
|
|
1748
|
+
Sr as useTexture,
|
|
1749
|
+
xr as useTres,
|
|
1750
|
+
ce as useTresContext,
|
|
1751
|
+
Xn as useTresContextProvider,
|
|
1752
|
+
Zn as useTresEventManager,
|
|
1753
|
+
jr as vDistanceTo,
|
|
1754
|
+
Br as vLightHelper,
|
|
1755
|
+
Dr as vLog
|
|
1639
1756
|
};
|