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