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