@tresjs/core 4.0.0-next.1 → 4.0.0-next.2
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/composables/useCamera/index.d.ts +354 -387
- package/dist/tres.js +753 -747
- package/dist/tres.umd.cjs +2 -2
- package/package.json +28 -27
- package/dist/src/composables/useLoader/index.d.ts +0 -44
- package/dist/src/composables/useRaycaster/index.d.ts +0 -18
- package/dist/src/composables/useSeek/index.d.ts +0 -19
package/dist/tres.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version: v4.0.0-next.
|
|
3
|
+
* version: v4.0.0-next.2
|
|
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 Y = (
|
|
11
|
-
import { ref as
|
|
8
|
+
var $e = Object.defineProperty;
|
|
9
|
+
var He = (e, r, t) => r in e ? $e(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
10
|
+
var Y = (e, r, t) => (He(e, typeof r != "symbol" ? r + "" : r, t), t);
|
|
11
|
+
import { ref as k, computed as x, watchEffect as se, onUnmounted as J, shallowRef as $, watch as I, reactive as be, readonly as Z, provide as ee, inject as Ne, defineComponent as le, useSlots as Fe, getCurrentInstance as ue, onMounted as We, openBlock as Ue, createElementBlock as Ge, normalizeClass as ze, unref as Ve, normalizeStyle as Je, createRenderer as Qe, h as ce, Fragment as Ye } from "vue";
|
|
12
12
|
import * as Me from "three";
|
|
13
|
-
import { PerspectiveCamera as te, Camera as
|
|
14
|
-
import { createEventHook as H, useRafFn as Se, toValue as
|
|
15
|
-
const
|
|
13
|
+
import { PerspectiveCamera as te, Camera as qe, Clock as Ke, Vector3 as _e, Color as G, MeshBasicMaterial as Ce, DoubleSide as Xe, REVISION as Ze, SRGBColorSpace as et, ACESFilmicToneMapping as Ee, PCFSoftShadowMap as tt, NoToneMapping as nt, WebGLRenderer as q, LoadingManager as rt, TextureLoader as ot, Vector2 as st, Raycaster as it, BufferAttribute as at, Scene as lt, Line as ut, BufferGeometry as de, Float32BufferAttribute as fe, LineBasicMaterial as ct, Mesh as dt, BackSide as ft, DirectionalLightHelper as pt, PointLightHelper as mt, SpotLightHelper as vt, HemisphereLightHelper as gt, ArrowHelper as ht } from "three";
|
|
14
|
+
import { createEventHook as H, useRafFn as Se, toValue as _, unrefElement as yt, useDevicePixelRatio as wt, usePointer as bt, useElementBounding as Mt, useWindowSize as _t, useElementSize as Ct, refDebounced as pe, useFps as Et, useMemory as St } from "@vueuse/core";
|
|
15
|
+
const xt = "@tresjs/core", Tt = "module", kt = "4.0.0-next.2", Pt = "pnpm@8.10.2", At = "Declarative ThreeJS using Vue Components", Lt = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", Ot = "MIT", Bt = [
|
|
16
16
|
"vue",
|
|
17
17
|
"3d",
|
|
18
18
|
"threejs",
|
|
19
19
|
"three",
|
|
20
20
|
"threejs-vue"
|
|
21
|
-
],
|
|
21
|
+
], jt = !1, Dt = {
|
|
22
22
|
".": {
|
|
23
23
|
types: "./dist/index.d.ts",
|
|
24
24
|
require: "./dist/tres.umd.cjs",
|
|
@@ -37,12 +37,12 @@ const kt = "@tresjs/core", Tt = "module", Pt = "4.0.0-next.1", At = "pnpm@8.10.2
|
|
|
37
37
|
types: "./dist/utils/index.d.ts"
|
|
38
38
|
},
|
|
39
39
|
"./*": "./*"
|
|
40
|
-
},
|
|
40
|
+
}, It = "./dist/tres.js", Rt = "./dist/tres.js", $t = "./dist/index.d.ts", Ht = [
|
|
41
41
|
"dist",
|
|
42
42
|
"*.d.ts"
|
|
43
|
-
],
|
|
43
|
+
], Nt = {
|
|
44
44
|
access: "public"
|
|
45
|
-
},
|
|
45
|
+
}, Ft = {
|
|
46
46
|
dev: "cd playground && npm run dev",
|
|
47
47
|
build: "vite build",
|
|
48
48
|
playground: "cd playground && npm run dev",
|
|
@@ -57,106 +57,107 @@ const kt = "@tresjs/core", Tt = "module", Pt = "4.0.0-next.1", At = "pnpm@8.10.2
|
|
|
57
57
|
"docs:serve": "vitepress serve docs",
|
|
58
58
|
"docs:preview": "vitepress preview docs",
|
|
59
59
|
"docs:contributors": "esno scripts/update-contributors.ts"
|
|
60
|
-
},
|
|
60
|
+
}, Wt = {
|
|
61
61
|
three: ">=0.133",
|
|
62
62
|
vue: ">=3.4"
|
|
63
|
+
}, Ut = {
|
|
64
|
+
"@alvarosabu/utils": "^3.2.0",
|
|
65
|
+
"@vue/devtools-api": "^6.6.1",
|
|
66
|
+
"@vueuse/core": "^10.9.0"
|
|
63
67
|
}, Gt = {
|
|
64
|
-
"@alvarosabu/utils": "^3.1.1",
|
|
65
|
-
"@vueuse/core": "^10.7.1"
|
|
66
|
-
}, zt = {
|
|
67
68
|
"@release-it/conventional-changelog": "^8.0.1",
|
|
68
69
|
"@stackblitz/sdk": "^1.9.0",
|
|
69
|
-
"@tresjs/cientos": "3.
|
|
70
|
+
"@tresjs/cientos": "3.8.0",
|
|
70
71
|
"@tresjs/eslint-config-vue": "^0.2.1",
|
|
71
|
-
"@types/three": "^0.
|
|
72
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
73
|
-
"@typescript-eslint/parser": "^
|
|
74
|
-
"@vitejs/plugin-vue": "^5.0.
|
|
72
|
+
"@types/three": "^0.162.0",
|
|
73
|
+
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
|
74
|
+
"@typescript-eslint/parser": "^7.4.0",
|
|
75
|
+
"@vitejs/plugin-vue": "^5.0.4",
|
|
75
76
|
"@vitest/coverage-c8": "^0.33.0",
|
|
76
|
-
"@vitest/ui": "^1.
|
|
77
|
-
"@vue/test-utils": "^2.4.
|
|
78
|
-
eslint: "^8.
|
|
79
|
-
"eslint-plugin-vue": "^9.
|
|
80
|
-
esno: "^4.
|
|
81
|
-
gsap: "^3.12.
|
|
82
|
-
jsdom: "^
|
|
77
|
+
"@vitest/ui": "^1.4.0",
|
|
78
|
+
"@vue/test-utils": "^2.4.5",
|
|
79
|
+
eslint: "^8.57.0",
|
|
80
|
+
"eslint-plugin-vue": "^9.24.0",
|
|
81
|
+
esno: "^4.7.0",
|
|
82
|
+
gsap: "^3.12.5",
|
|
83
|
+
jsdom: "^24.0.0",
|
|
83
84
|
kolorist: "^1.8.0",
|
|
84
85
|
ohmyfetch: "^0.4.21",
|
|
85
|
-
pathe: "^1.1.
|
|
86
|
-
"release-it": "^17.
|
|
86
|
+
pathe: "^1.1.2",
|
|
87
|
+
"release-it": "^17.1.1",
|
|
87
88
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
88
89
|
"rollup-plugin-copy": "^3.5.0",
|
|
89
90
|
"rollup-plugin-visualizer": "^5.12.0",
|
|
90
|
-
three: "^0.
|
|
91
|
-
unocss: "^0.58.
|
|
92
|
-
unplugin: "^1.
|
|
91
|
+
three: "^0.162.0",
|
|
92
|
+
unocss: "^0.58.7",
|
|
93
|
+
unplugin: "^1.10.0",
|
|
93
94
|
"unplugin-vue-components": "^0.26.0",
|
|
94
|
-
vite: "^5.
|
|
95
|
+
vite: "^5.2.6",
|
|
95
96
|
"vite-plugin-banner": "^0.7.1",
|
|
96
|
-
"vite-plugin-dts": "3.7.
|
|
97
|
-
"vite-plugin-inspect": "^0.8.
|
|
97
|
+
"vite-plugin-dts": "3.7.3",
|
|
98
|
+
"vite-plugin-inspect": "^0.8.3",
|
|
98
99
|
"vite-plugin-require-transform": "^1.0.21",
|
|
99
100
|
"vite-svg-loader": "^5.1.0",
|
|
100
|
-
vitepress: "1.0.
|
|
101
|
-
vitest: "^1.
|
|
102
|
-
vue: "^3.4.
|
|
103
|
-
"vue-demi": "^0.14.
|
|
104
|
-
},
|
|
105
|
-
name:
|
|
101
|
+
vitepress: "1.0.1",
|
|
102
|
+
vitest: "^1.4.0",
|
|
103
|
+
vue: "^3.4.21",
|
|
104
|
+
"vue-demi": "^0.14.7"
|
|
105
|
+
}, zt = {
|
|
106
|
+
name: xt,
|
|
106
107
|
type: Tt,
|
|
107
|
-
version:
|
|
108
|
-
packageManager:
|
|
109
|
-
description:
|
|
110
|
-
author:
|
|
111
|
-
license:
|
|
112
|
-
keywords:
|
|
113
|
-
sideEffects:
|
|
114
|
-
exports:
|
|
115
|
-
main:
|
|
116
|
-
module:
|
|
117
|
-
types:
|
|
118
|
-
files:
|
|
119
|
-
publishConfig:
|
|
120
|
-
scripts:
|
|
121
|
-
peerDependencies:
|
|
122
|
-
dependencies:
|
|
123
|
-
devDependencies:
|
|
124
|
-
},
|
|
125
|
-
const
|
|
126
|
-
() =>
|
|
127
|
-
),
|
|
128
|
-
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
}, n = (
|
|
132
|
-
const
|
|
133
|
-
if (!
|
|
108
|
+
version: kt,
|
|
109
|
+
packageManager: Pt,
|
|
110
|
+
description: At,
|
|
111
|
+
author: Lt,
|
|
112
|
+
license: Ot,
|
|
113
|
+
keywords: Bt,
|
|
114
|
+
sideEffects: jt,
|
|
115
|
+
exports: Dt,
|
|
116
|
+
main: It,
|
|
117
|
+
module: Rt,
|
|
118
|
+
types: $t,
|
|
119
|
+
files: Ht,
|
|
120
|
+
publishConfig: Nt,
|
|
121
|
+
scripts: Ft,
|
|
122
|
+
peerDependencies: Wt,
|
|
123
|
+
dependencies: Ut,
|
|
124
|
+
devDependencies: Gt
|
|
125
|
+
}, Vt = ({ sizes: e, scene: r }) => {
|
|
126
|
+
const t = k([]), s = x(
|
|
127
|
+
() => t.value[0]
|
|
128
|
+
), i = (o, u = !1) => {
|
|
129
|
+
t.value.some(({ uuid: c }) => c === o.uuid) || (u ? n(o) : t.value.push(o));
|
|
130
|
+
}, l = (o) => {
|
|
131
|
+
t.value = t.value.filter(({ uuid: u }) => u !== o.uuid);
|
|
132
|
+
}, n = (o) => {
|
|
133
|
+
const u = o instanceof qe ? o : t.value.find((f) => f.uuid === o);
|
|
134
|
+
if (!u)
|
|
134
135
|
return;
|
|
135
|
-
const
|
|
136
|
-
|
|
136
|
+
const c = t.value.filter(({ uuid: f }) => f !== u.uuid);
|
|
137
|
+
t.value = [u, ...c];
|
|
137
138
|
};
|
|
138
139
|
return se(() => {
|
|
139
|
-
|
|
140
|
-
!
|
|
140
|
+
e.aspectRatio.value && t.value.forEach((o) => {
|
|
141
|
+
!o.manual && (o instanceof te || Jt(o)) && (o instanceof te ? o.aspect = e.aspectRatio.value : (o.left = e.width.value * -0.5, o.right = e.width.value * 0.5, o.top = e.height.value * 0.5, o.bottom = e.height.value * -0.5), o.updateProjectionMatrix());
|
|
141
142
|
});
|
|
142
143
|
}), J(() => {
|
|
143
|
-
|
|
144
|
+
t.value = [];
|
|
144
145
|
}), {
|
|
145
146
|
camera: s,
|
|
146
|
-
cameras:
|
|
147
|
-
registerCamera:
|
|
148
|
-
deregisterCamera:
|
|
147
|
+
cameras: t,
|
|
148
|
+
registerCamera: i,
|
|
149
|
+
deregisterCamera: l,
|
|
149
150
|
setCameraActive: n
|
|
150
151
|
};
|
|
151
152
|
};
|
|
152
|
-
function
|
|
153
|
-
return
|
|
153
|
+
function Jt(e) {
|
|
154
|
+
return e.hasOwnProperty("isOrthographicCamera") && e.isOrthographicCamera;
|
|
154
155
|
}
|
|
155
|
-
const xe = H(),
|
|
156
|
+
const xe = H(), Te = H(), ie = H(), R = new Ke();
|
|
156
157
|
let z = 0, V = 0;
|
|
157
|
-
const { pause:
|
|
158
|
+
const { pause: Qt, resume: Yt, isActive: qt } = Se(
|
|
158
159
|
() => {
|
|
159
|
-
xe.trigger({ delta: z, elapsed: V, clock: R }),
|
|
160
|
+
xe.trigger({ delta: z, elapsed: V, clock: R }), Te.trigger({ delta: z, elapsed: V, clock: R }), ie.trigger({ delta: z, elapsed: V, clock: R });
|
|
160
161
|
},
|
|
161
162
|
{ immediate: !1 }
|
|
162
163
|
);
|
|
@@ -165,36 +166,36 @@ ie.on(() => {
|
|
|
165
166
|
});
|
|
166
167
|
const ae = () => ({
|
|
167
168
|
onBeforeLoop: xe.on,
|
|
168
|
-
onLoop:
|
|
169
|
+
onLoop: Te.on,
|
|
169
170
|
onAfterLoop: ie.on,
|
|
170
|
-
pause:
|
|
171
|
-
resume:
|
|
172
|
-
isActive:
|
|
173
|
-
}),
|
|
171
|
+
pause: Qt,
|
|
172
|
+
resume: Yt,
|
|
173
|
+
isActive: qt
|
|
174
|
+
}), Un = !0, me = "[TresJS ▲ ■ ●] ";
|
|
174
175
|
function P() {
|
|
175
|
-
function
|
|
176
|
-
console.error(`${me} ${s}`,
|
|
176
|
+
function e(s, i) {
|
|
177
|
+
console.error(`${me} ${s}`, i || "");
|
|
177
178
|
}
|
|
178
|
-
function
|
|
179
|
+
function r(s) {
|
|
179
180
|
console.warn(`${me} ${s}`);
|
|
180
181
|
}
|
|
181
|
-
function
|
|
182
|
+
function t(s, i) {
|
|
182
183
|
}
|
|
183
184
|
return {
|
|
184
|
-
logError:
|
|
185
|
-
logWarning:
|
|
186
|
-
logMessage:
|
|
185
|
+
logError: e,
|
|
186
|
+
logWarning: r,
|
|
187
|
+
logMessage: t
|
|
187
188
|
};
|
|
188
189
|
}
|
|
189
|
-
function
|
|
190
|
-
return typeof
|
|
190
|
+
function Gn(e) {
|
|
191
|
+
return typeof e == "number" ? [e, e, e] : e instanceof _e ? [e.x, e.y, e.z] : e;
|
|
191
192
|
}
|
|
192
|
-
function
|
|
193
|
-
return
|
|
193
|
+
function Kt(e) {
|
|
194
|
+
return e instanceof G ? e : Array.isArray(e) ? new G(...e) : new G(e);
|
|
194
195
|
}
|
|
195
|
-
class
|
|
196
|
-
constructor(...
|
|
197
|
-
super(...
|
|
196
|
+
class Xt extends Me.Mesh {
|
|
197
|
+
constructor(...t) {
|
|
198
|
+
super(...t);
|
|
198
199
|
Y(this, "type", "HightlightMesh");
|
|
199
200
|
Y(this, "createTime");
|
|
200
201
|
this.createTime = Date.now();
|
|
@@ -204,118 +205,118 @@ class Zt extends Me.Mesh {
|
|
|
204
205
|
this.scale.set(n, n, n);
|
|
205
206
|
}
|
|
206
207
|
}
|
|
207
|
-
const
|
|
208
|
-
for (const
|
|
209
|
-
|
|
210
|
-
return Object.assign(
|
|
211
|
-
},
|
|
212
|
-
function ve(
|
|
213
|
-
return
|
|
208
|
+
const ke = (e, r) => {
|
|
209
|
+
for (const t of Object.keys(r))
|
|
210
|
+
r[t] instanceof Object && Object.assign(r[t], ke(e[t], r[t]));
|
|
211
|
+
return Object.assign(e || {}, r), e;
|
|
212
|
+
}, Zt = "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", en = /* @__PURE__ */ tn(Zt);
|
|
213
|
+
function ve(e) {
|
|
214
|
+
return e && e.nodeType === 1;
|
|
214
215
|
}
|
|
215
|
-
function F(
|
|
216
|
-
return
|
|
216
|
+
function F(e) {
|
|
217
|
+
return e.replace(/-([a-z])/g, (r, t) => t.toUpperCase());
|
|
217
218
|
}
|
|
218
|
-
function
|
|
219
|
-
const
|
|
220
|
-
for (let
|
|
221
|
-
|
|
222
|
-
return
|
|
219
|
+
function tn(e, r) {
|
|
220
|
+
const t = /* @__PURE__ */ Object.create(null), s = e.split(",");
|
|
221
|
+
for (let i = 0; i < s.length; i++)
|
|
222
|
+
t[s[i]] = !0;
|
|
223
|
+
return r ? (i) => !!t[i.toLowerCase()] : (i) => !!t[i];
|
|
223
224
|
}
|
|
224
|
-
const
|
|
225
|
-
const
|
|
226
|
-
for (const
|
|
227
|
-
const
|
|
228
|
-
|
|
225
|
+
const nn = (e, r) => {
|
|
226
|
+
const t = /* @__PURE__ */ new Set(), s = [];
|
|
227
|
+
for (const i of e) {
|
|
228
|
+
const l = r(i);
|
|
229
|
+
t.has(l) || (t.add(l), s.push(i));
|
|
229
230
|
}
|
|
230
231
|
return s;
|
|
231
|
-
}, ge = (
|
|
232
|
-
if (!
|
|
232
|
+
}, ge = (e, r) => {
|
|
233
|
+
if (!r)
|
|
233
234
|
return;
|
|
234
|
-
const
|
|
235
|
-
return
|
|
236
|
-
},
|
|
237
|
-
const s = Array.isArray(
|
|
238
|
-
s && s.reduce((
|
|
235
|
+
const t = Array.isArray(r) ? r : r.match(/([^[.\]])+/g);
|
|
236
|
+
return t == null ? void 0 : t.reduce((s, i) => s && s[i], e);
|
|
237
|
+
}, rn = (e, r, t) => {
|
|
238
|
+
const s = Array.isArray(r) ? r : r.match(/([^[.\]])+/g);
|
|
239
|
+
s && s.reduce((i, l, n) => (i[l] === void 0 && (i[l] = {}), n === s.length - 1 && (i[l] = t), i[l]), e);
|
|
239
240
|
};
|
|
240
|
-
function Pe(
|
|
241
|
-
if (ve(
|
|
242
|
-
const
|
|
243
|
-
return
|
|
241
|
+
function Pe(e, r) {
|
|
242
|
+
if (ve(e) && ve(r)) {
|
|
243
|
+
const i = e.attributes, l = r.attributes;
|
|
244
|
+
return i.length !== l.length ? !1 : Array.from(i).every(({ name: n, value: o }) => r.getAttribute(n) === o);
|
|
244
245
|
}
|
|
245
|
-
if (
|
|
246
|
+
if (e === r)
|
|
246
247
|
return !0;
|
|
247
|
-
if (
|
|
248
|
+
if (e === null || typeof e != "object" || r === null || typeof r != "object")
|
|
248
249
|
return !1;
|
|
249
|
-
const
|
|
250
|
-
if (
|
|
250
|
+
const t = Object.keys(e), s = Object.keys(r);
|
|
251
|
+
if (t.length !== s.length)
|
|
251
252
|
return !1;
|
|
252
|
-
for (const
|
|
253
|
-
if (!s.includes(
|
|
253
|
+
for (const i of t)
|
|
254
|
+
if (!s.includes(i) || !Pe(e[i], r[i]))
|
|
254
255
|
return !1;
|
|
255
256
|
return !0;
|
|
256
257
|
}
|
|
257
|
-
function
|
|
258
|
-
if (!Array.isArray(
|
|
258
|
+
function on(e, r) {
|
|
259
|
+
if (!Array.isArray(e) || !Array.isArray(r) || e.length !== r.length)
|
|
259
260
|
return !1;
|
|
260
|
-
for (let
|
|
261
|
-
if (!Pe(t
|
|
261
|
+
for (let t = 0; t < e.length; t++)
|
|
262
|
+
if (!Pe(e[t], r[t]))
|
|
262
263
|
return !1;
|
|
263
264
|
return !0;
|
|
264
265
|
}
|
|
265
|
-
const
|
|
266
|
-
function
|
|
267
|
-
const
|
|
268
|
-
if (
|
|
269
|
-
return
|
|
270
|
-
for (const
|
|
271
|
-
const
|
|
272
|
-
if (
|
|
273
|
-
return
|
|
266
|
+
const sn = Array.isArray;
|
|
267
|
+
function an(e, r, t, s) {
|
|
268
|
+
const i = (u) => {
|
|
269
|
+
if (u.uuid === r)
|
|
270
|
+
return u;
|
|
271
|
+
for (const c of u.children) {
|
|
272
|
+
const f = i(c);
|
|
273
|
+
if (f)
|
|
274
|
+
return f;
|
|
274
275
|
}
|
|
275
|
-
},
|
|
276
|
-
if (!
|
|
276
|
+
}, l = i(e);
|
|
277
|
+
if (!l) {
|
|
277
278
|
console.warn("Object with UUID not found in the scene.");
|
|
278
279
|
return;
|
|
279
280
|
}
|
|
280
|
-
let n =
|
|
281
|
-
for (let
|
|
282
|
-
if (n[
|
|
283
|
-
n = n[
|
|
281
|
+
let n = l;
|
|
282
|
+
for (let u = 0; u < t.length - 1; u++)
|
|
283
|
+
if (n[t[u]] !== void 0)
|
|
284
|
+
n = n[t[u]];
|
|
284
285
|
else {
|
|
285
|
-
console.warn(`Property path is not valid: ${
|
|
286
|
+
console.warn(`Property path is not valid: ${t.join(".")}`);
|
|
286
287
|
return;
|
|
287
288
|
}
|
|
288
|
-
const
|
|
289
|
-
n[
|
|
289
|
+
const o = t[t.length - 1];
|
|
290
|
+
n[o] !== void 0 ? n[o] = s : console.warn(`Property path is not valid: ${t.join(".")}`);
|
|
290
291
|
}
|
|
291
|
-
function
|
|
292
|
-
const
|
|
292
|
+
function ln(e) {
|
|
293
|
+
const r = new Ce({
|
|
293
294
|
color: 11003607,
|
|
294
295
|
// Highlight color, e.g., yellow
|
|
295
296
|
transparent: !0,
|
|
296
297
|
opacity: 0.2,
|
|
297
298
|
depthTest: !1,
|
|
298
299
|
// So the highlight is always visible
|
|
299
|
-
side:
|
|
300
|
+
side: Xe
|
|
300
301
|
// To e
|
|
301
302
|
});
|
|
302
|
-
return new
|
|
303
|
+
return new Xt(e.geometry.clone(), r);
|
|
303
304
|
}
|
|
304
|
-
function Ae(
|
|
305
|
-
var
|
|
306
|
-
let
|
|
307
|
-
return
|
|
305
|
+
function Ae(e) {
|
|
306
|
+
var t;
|
|
307
|
+
let r = e.value;
|
|
308
|
+
return e.value && ((t = e.value) != null && t.isMesh) && (r = e.value.position), Array.isArray(e.value) && (r = new _e(...r)), r;
|
|
308
309
|
}
|
|
309
|
-
const
|
|
310
|
+
const un = Number.parseInt(Ze.replace("dev", "")), W = {
|
|
310
311
|
realistic: {
|
|
311
312
|
shadows: !0,
|
|
312
313
|
physicallyCorrectLights: !0,
|
|
313
|
-
outputColorSpace:
|
|
314
|
-
toneMapping:
|
|
314
|
+
outputColorSpace: et,
|
|
315
|
+
toneMapping: Ee,
|
|
315
316
|
toneMappingExposure: 3,
|
|
316
317
|
shadowMap: {
|
|
317
318
|
enabled: !0,
|
|
318
|
-
type:
|
|
319
|
+
type: tt
|
|
319
320
|
}
|
|
320
321
|
},
|
|
321
322
|
flat: {
|
|
@@ -323,318 +324,318 @@ const ur = Number.parseInt(et.replace("dev", "")), W = {
|
|
|
323
324
|
toneMappingExposure: 1
|
|
324
325
|
}
|
|
325
326
|
};
|
|
326
|
-
function
|
|
327
|
-
scene:
|
|
328
|
-
canvas:
|
|
329
|
-
options:
|
|
327
|
+
function cn({
|
|
328
|
+
scene: e,
|
|
329
|
+
canvas: r,
|
|
330
|
+
options: t,
|
|
330
331
|
disableRender: s,
|
|
331
|
-
emit:
|
|
332
|
-
contextParts: { sizes:
|
|
332
|
+
emit: i,
|
|
333
|
+
contextParts: { sizes: l, camera: n, render: o, invalidate: u, advance: c }
|
|
333
334
|
}) {
|
|
334
|
-
const
|
|
335
|
-
alpha:
|
|
336
|
-
depth:
|
|
337
|
-
canvas:
|
|
338
|
-
context:
|
|
339
|
-
stencil:
|
|
340
|
-
antialias:
|
|
341
|
-
precision:
|
|
342
|
-
powerPreference:
|
|
343
|
-
premultipliedAlpha:
|
|
344
|
-
preserveDrawingBuffer:
|
|
345
|
-
logarithmicDepthBuffer:
|
|
346
|
-
failIfMajorPerformanceCaveat:
|
|
347
|
-
})),
|
|
348
|
-
function
|
|
349
|
-
|
|
335
|
+
const f = x(() => ({
|
|
336
|
+
alpha: _(t.alpha) ?? !0,
|
|
337
|
+
depth: _(t.depth),
|
|
338
|
+
canvas: yt(r),
|
|
339
|
+
context: _(t.context),
|
|
340
|
+
stencil: _(t.stencil),
|
|
341
|
+
antialias: _(t.antialias) ?? !0,
|
|
342
|
+
precision: _(t.precision),
|
|
343
|
+
powerPreference: _(t.powerPreference),
|
|
344
|
+
premultipliedAlpha: _(t.premultipliedAlpha),
|
|
345
|
+
preserveDrawingBuffer: _(t.preserveDrawingBuffer),
|
|
346
|
+
logarithmicDepthBuffer: _(t.logarithmicDepthBuffer),
|
|
347
|
+
failIfMajorPerformanceCaveat: _(t.failIfMajorPerformanceCaveat)
|
|
348
|
+
})), a = $(new q(f.value));
|
|
349
|
+
function g() {
|
|
350
|
+
t.renderMode === "on-demand" && u();
|
|
350
351
|
}
|
|
351
|
-
I(
|
|
352
|
-
|
|
353
|
-
}), I([
|
|
354
|
-
|
|
352
|
+
I(f, () => {
|
|
353
|
+
a.value.dispose(), a.value = new q(f.value), g();
|
|
354
|
+
}), I([l.width, l.height], () => {
|
|
355
|
+
a.value.setSize(l.width.value, l.height.value), g();
|
|
355
356
|
}, {
|
|
356
357
|
immediate: !0
|
|
357
|
-
}), I(() =>
|
|
358
|
-
const { pixelRatio:
|
|
359
|
-
I(
|
|
360
|
-
|
|
358
|
+
}), I(() => t.clearColor, g);
|
|
359
|
+
const { pixelRatio: d } = wt();
|
|
360
|
+
I(d, () => {
|
|
361
|
+
a.value.setPixelRatio(d.value);
|
|
361
362
|
});
|
|
362
|
-
const { logError: h } = P(), { resume:
|
|
363
|
-
|
|
364
|
-
n.value && !
|
|
365
|
-
}),
|
|
366
|
-
const
|
|
367
|
-
const
|
|
363
|
+
const { logError: h } = P(), { resume: y, onLoop: p } = ae();
|
|
364
|
+
p(() => {
|
|
365
|
+
n.value && !_(s) && o.frames.value > 0 && (a.value.render(e, n.value), i("render", a.value)), o.priority.value = 0, _(t.renderMode) === "always" ? o.frames.value = 1 : o.frames.value = Math.max(0, o.frames.value - 1);
|
|
366
|
+
}), y();
|
|
367
|
+
const v = (() => {
|
|
368
|
+
const M = new q(), w = {
|
|
368
369
|
shadowMap: {
|
|
369
|
-
enabled:
|
|
370
|
-
type:
|
|
370
|
+
enabled: M.shadowMap.enabled,
|
|
371
|
+
type: M.shadowMap.type
|
|
371
372
|
},
|
|
372
|
-
toneMapping:
|
|
373
|
-
toneMappingExposure:
|
|
374
|
-
outputColorSpace:
|
|
373
|
+
toneMapping: M.toneMapping,
|
|
374
|
+
toneMappingExposure: M.toneMappingExposure,
|
|
375
|
+
outputColorSpace: M.outputColorSpace
|
|
375
376
|
};
|
|
376
|
-
return
|
|
377
|
-
})(),
|
|
378
|
-
return
|
|
379
|
-
|
|
377
|
+
return M.dispose(), w;
|
|
378
|
+
})(), C = _(t.renderMode);
|
|
379
|
+
return C === "on-demand" && u(), C === "manual" && setTimeout(() => {
|
|
380
|
+
c();
|
|
380
381
|
}, 1), se(() => {
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
const
|
|
384
|
-
const O =
|
|
385
|
-
if (
|
|
386
|
-
return ge(W[
|
|
382
|
+
const M = _(t.preset);
|
|
383
|
+
M && (M in W || h(`Renderer Preset must be one of these: ${Object.keys(W).join(", ")}`), ke(a.value, W[M])), C === "always" && (o.frames.value = Math.max(1, o.frames.value));
|
|
384
|
+
const w = (L, A) => {
|
|
385
|
+
const O = _(L), Q = () => {
|
|
386
|
+
if (M)
|
|
387
|
+
return ge(W[M], A);
|
|
387
388
|
};
|
|
388
389
|
if (O !== void 0)
|
|
389
390
|
return O;
|
|
390
391
|
const N = Q();
|
|
391
|
-
return N !== void 0 ? N : ge(
|
|
392
|
-
},
|
|
393
|
-
|
|
394
|
-
const
|
|
395
|
-
|
|
396
|
-
|
|
392
|
+
return N !== void 0 ? N : ge(v, A);
|
|
393
|
+
}, b = (L, A) => rn(a.value, A, w(L, A));
|
|
394
|
+
b(t.shadows, "shadowMap.enabled"), b(t.toneMapping ?? Ee, "toneMapping"), b(t.shadowMapType, "shadowMap.type"), un < 150 && b(!t.useLegacyLights, "physicallyCorrectLights"), b(t.outputColorSpace, "outputColorSpace"), b(t.toneMappingExposure, "toneMappingExposure");
|
|
395
|
+
const E = w(t.clearColor, "clearColor");
|
|
396
|
+
E && a.value.setClearColor(
|
|
397
|
+
E ? Kt(E) : new G(0)
|
|
397
398
|
// default clear color is not easily/efficiently retrievable from three
|
|
398
399
|
);
|
|
399
400
|
}), J(() => {
|
|
400
|
-
|
|
401
|
+
a.value.dispose(), a.value.forceContextLoss();
|
|
401
402
|
}), {
|
|
402
|
-
renderer:
|
|
403
|
+
renderer: a
|
|
403
404
|
};
|
|
404
405
|
}
|
|
405
|
-
const K = (
|
|
406
|
-
function
|
|
407
|
-
const
|
|
408
|
-
return
|
|
409
|
-
|
|
410
|
-
}),
|
|
406
|
+
const K = (e) => typeof e == "function", dn = (e) => !!e && e.constructor === Array;
|
|
407
|
+
function fn(e) {
|
|
408
|
+
const r = { nodes: {}, materials: {} };
|
|
409
|
+
return e && e.traverse((t) => {
|
|
410
|
+
t.name && (r.nodes[t.name] = t), t.material && !r.materials[t.material.name] && (r.materials[t.material.name] = t.material);
|
|
411
|
+
}), r;
|
|
411
412
|
}
|
|
412
|
-
async function
|
|
413
|
-
const { logError:
|
|
414
|
-
|
|
415
|
-
const
|
|
416
|
-
(
|
|
413
|
+
async function zn(e, r, t, s, i) {
|
|
414
|
+
const { logError: l } = P(), n = new e();
|
|
415
|
+
i && i(n), t && t(n);
|
|
416
|
+
const u = (Array.isArray(r) ? r : [r]).map(
|
|
417
|
+
(c) => new Promise((f, a) => {
|
|
417
418
|
n.load(
|
|
418
|
-
|
|
419
|
-
(
|
|
420
|
-
|
|
419
|
+
c,
|
|
420
|
+
(g) => {
|
|
421
|
+
g.scene && Object.assign(g, fn(g.scene)), f(g);
|
|
421
422
|
},
|
|
422
423
|
s,
|
|
423
|
-
(
|
|
424
|
+
(g) => a(l("[useLoader] - Failed to load resource", g))
|
|
424
425
|
);
|
|
425
426
|
})
|
|
426
427
|
);
|
|
427
|
-
return
|
|
428
|
+
return dn(r) ? await Promise.all(u) : await u[0];
|
|
428
429
|
}
|
|
429
|
-
async function
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
(
|
|
430
|
+
async function Vn(e) {
|
|
431
|
+
const r = new rt(), t = new ot(r), s = (i) => new Promise((l, n) => {
|
|
432
|
+
t.load(
|
|
433
|
+
i,
|
|
434
|
+
(o) => l(o),
|
|
434
435
|
() => null,
|
|
435
436
|
() => {
|
|
436
437
|
n(new Error("[useTextures] - Failed to load texture"));
|
|
437
438
|
}
|
|
438
439
|
);
|
|
439
440
|
});
|
|
440
|
-
if (
|
|
441
|
-
const
|
|
442
|
-
return
|
|
441
|
+
if (sn(e)) {
|
|
442
|
+
const i = await Promise.all(e.map((l) => s(l)));
|
|
443
|
+
return e.length > 1 ? i : i[0];
|
|
443
444
|
} else {
|
|
444
445
|
const {
|
|
445
|
-
map:
|
|
446
|
-
displacementMap:
|
|
446
|
+
map: i,
|
|
447
|
+
displacementMap: l,
|
|
447
448
|
normalMap: n,
|
|
448
|
-
roughnessMap:
|
|
449
|
-
metalnessMap:
|
|
450
|
-
aoMap:
|
|
451
|
-
alphaMap:
|
|
452
|
-
matcap:
|
|
453
|
-
} =
|
|
449
|
+
roughnessMap: o,
|
|
450
|
+
metalnessMap: u,
|
|
451
|
+
aoMap: c,
|
|
452
|
+
alphaMap: f,
|
|
453
|
+
matcap: a
|
|
454
|
+
} = e;
|
|
454
455
|
return {
|
|
455
|
-
map:
|
|
456
|
-
displacementMap:
|
|
456
|
+
map: i ? await s(i) : null,
|
|
457
|
+
displacementMap: l ? await s(l) : null,
|
|
457
458
|
normalMap: n ? await s(n) : null,
|
|
458
|
-
roughnessMap:
|
|
459
|
-
metalnessMap:
|
|
460
|
-
aoMap:
|
|
461
|
-
alphaMap:
|
|
462
|
-
matcap:
|
|
459
|
+
roughnessMap: o ? await s(o) : null,
|
|
460
|
+
metalnessMap: u ? await s(u) : null,
|
|
461
|
+
aoMap: c ? await s(c) : null,
|
|
462
|
+
alphaMap: f ? await s(f) : null,
|
|
463
|
+
matcap: a ? await s(a) : null
|
|
463
464
|
};
|
|
464
465
|
}
|
|
465
466
|
}
|
|
466
|
-
const
|
|
467
|
-
const
|
|
468
|
-
if (
|
|
467
|
+
const pn = (e, r) => {
|
|
468
|
+
const t = x(() => r.renderer.value.domElement), { x: s, y: i } = bt({ target: t }), { width: l, height: n, top: o, left: u } = Mt(t), c = ({ x: w, y: b }) => {
|
|
469
|
+
if (t.value)
|
|
469
470
|
return {
|
|
470
|
-
x: (
|
|
471
|
-
y: -((
|
|
471
|
+
x: (w - u.value) / l.value * 2 - 1,
|
|
472
|
+
y: -((b - o.value) / n.value) * 2 + 1
|
|
472
473
|
};
|
|
473
|
-
},
|
|
474
|
-
if (
|
|
475
|
-
return
|
|
476
|
-
},
|
|
477
|
-
const
|
|
478
|
-
x: (
|
|
479
|
-
y: (
|
|
474
|
+
}, f = ({ x: w, y: b }) => {
|
|
475
|
+
if (r.camera.value)
|
|
476
|
+
return r.raycaster.value.setFromCamera(new st(w, b), r.camera.value), r.raycaster.value.intersectObjects(e.value, !1);
|
|
477
|
+
}, a = (w) => {
|
|
478
|
+
const b = c({
|
|
479
|
+
x: (w == null ? void 0 : w.clientX) ?? s.value,
|
|
480
|
+
y: (w == null ? void 0 : w.clientY) ?? i.value
|
|
480
481
|
});
|
|
481
|
-
return
|
|
482
|
-
},
|
|
483
|
-
|
|
484
|
-
},
|
|
485
|
-
|
|
482
|
+
return b ? f(b) || [] : [];
|
|
483
|
+
}, g = x(() => a()), d = H(), h = H(), y = (w, b) => {
|
|
484
|
+
w.trigger({ event: b, intersects: a(b) });
|
|
485
|
+
}, p = (w) => {
|
|
486
|
+
y(h, w);
|
|
486
487
|
};
|
|
487
|
-
let
|
|
488
|
-
const
|
|
489
|
-
var
|
|
490
|
-
|
|
491
|
-
},
|
|
492
|
-
var
|
|
493
|
-
|
|
494
|
-
},
|
|
495
|
-
return
|
|
496
|
-
|
|
488
|
+
let m;
|
|
489
|
+
const v = (w) => {
|
|
490
|
+
var b;
|
|
491
|
+
m = (b = a(w)[0]) == null ? void 0 : b.object;
|
|
492
|
+
}, C = (w) => {
|
|
493
|
+
var b;
|
|
494
|
+
w instanceof PointerEvent && m === ((b = a(w)[0]) == null ? void 0 : b.object) && y(d, w);
|
|
495
|
+
}, M = (w) => h.trigger({ event: w, intersects: [] });
|
|
496
|
+
return t.value.addEventListener("pointerup", C), t.value.addEventListener("pointerdown", v), t.value.addEventListener("pointermove", p), t.value.addEventListener("pointerleave", M), J(() => {
|
|
497
|
+
t != null && t.value && (t.value.removeEventListener("pointerup", C), t.value.removeEventListener("pointerdown", v), t.value.removeEventListener("pointermove", p), t.value.removeEventListener("pointerleave", M));
|
|
497
498
|
}), {
|
|
498
|
-
intersects:
|
|
499
|
-
onClick: (
|
|
500
|
-
onPointerMove: (
|
|
499
|
+
intersects: g,
|
|
500
|
+
onClick: (w) => d.on(w).off,
|
|
501
|
+
onPointerMove: (w) => h.on(w).off
|
|
501
502
|
};
|
|
502
503
|
};
|
|
503
|
-
function
|
|
504
|
-
const { logWarning:
|
|
505
|
-
function
|
|
506
|
-
let
|
|
507
|
-
return
|
|
508
|
-
|
|
509
|
-
}),
|
|
504
|
+
function Jn() {
|
|
505
|
+
const { logWarning: e } = P();
|
|
506
|
+
function r(l, n, o) {
|
|
507
|
+
let u = null;
|
|
508
|
+
return l.traverse((c) => {
|
|
509
|
+
c[n] === o && (u = c);
|
|
510
|
+
}), u || e(`Child with ${n} '${o}' not found.`), u;
|
|
510
511
|
}
|
|
511
|
-
function
|
|
512
|
-
const
|
|
513
|
-
return
|
|
514
|
-
|
|
515
|
-
}),
|
|
512
|
+
function t(l, n, o) {
|
|
513
|
+
const u = [];
|
|
514
|
+
return l.traverse((c) => {
|
|
515
|
+
c[n].includes(o) && u.push(c);
|
|
516
|
+
}), u.length || e(`Children with ${n} '${o}' not found.`), u;
|
|
516
517
|
}
|
|
517
|
-
function s(
|
|
518
|
-
return
|
|
518
|
+
function s(l, n) {
|
|
519
|
+
return r(l, "name", n);
|
|
519
520
|
}
|
|
520
|
-
function
|
|
521
|
-
return
|
|
521
|
+
function i(l, n) {
|
|
522
|
+
return t(l, "name", n);
|
|
522
523
|
}
|
|
523
524
|
return {
|
|
524
|
-
seek:
|
|
525
|
+
seek: r,
|
|
525
526
|
seekByName: s,
|
|
526
|
-
seekAll:
|
|
527
|
-
seekAllByName:
|
|
527
|
+
seekAll: t,
|
|
528
|
+
seekAllByName: i
|
|
528
529
|
};
|
|
529
530
|
}
|
|
530
|
-
const
|
|
531
|
-
const
|
|
531
|
+
const mn = (e) => {
|
|
532
|
+
const r = be({
|
|
532
533
|
click: /* @__PURE__ */ new Map(),
|
|
533
534
|
pointerMove: /* @__PURE__ */ new Map(),
|
|
534
535
|
pointerEnter: /* @__PURE__ */ new Map(),
|
|
535
536
|
pointerLeave: /* @__PURE__ */ new Map()
|
|
536
|
-
}),
|
|
537
|
-
|
|
538
|
-
},
|
|
539
|
-
|
|
540
|
-
},
|
|
541
|
-
Object.values(
|
|
542
|
-
}, n = (
|
|
543
|
-
const { onClick:
|
|
544
|
-
|
|
545
|
-
},
|
|
546
|
-
() =>
|
|
537
|
+
}), t = k(/* @__PURE__ */ new Set()), s = (a) => {
|
|
538
|
+
t.value.add(a);
|
|
539
|
+
}, i = (a) => {
|
|
540
|
+
t.value.delete(a);
|
|
541
|
+
}, l = (a) => {
|
|
542
|
+
Object.values(r).forEach((g) => g.delete(a)), i(a);
|
|
543
|
+
}, n = (a) => {
|
|
544
|
+
const { onClick: g, onPointerMove: d, onPointerEnter: h, onPointerLeave: y } = a;
|
|
545
|
+
g && r.click.set(a, g), d && r.pointerMove.set(a, d), h && r.pointerEnter.set(a, h), y && r.pointerLeave.set(a, y);
|
|
546
|
+
}, o = x(
|
|
547
|
+
() => nn(
|
|
547
548
|
[
|
|
548
|
-
...Array.from(
|
|
549
|
-
...Object.values(
|
|
549
|
+
...Array.from(t.value),
|
|
550
|
+
...Object.values(r).map((a) => Array.from(a.keys())).flat()
|
|
550
551
|
],
|
|
551
|
-
({ uuid:
|
|
552
|
+
({ uuid: a }) => a
|
|
552
553
|
)
|
|
553
554
|
);
|
|
554
|
-
|
|
555
|
-
const { onClick:
|
|
556
|
-
|
|
557
|
-
var
|
|
558
|
-
|
|
555
|
+
e.registerObjectAtPointerEventHandler = n, e.deregisterObjectAtPointerEventHandler = l, e.registerBlockingObjectAtPointerEventHandler = s, e.deregisterBlockingObjectAtPointerEventHandler = i;
|
|
556
|
+
const { onClick: u, onPointerMove: c } = pn(o, e);
|
|
557
|
+
u(({ intersects: a, event: g }) => {
|
|
558
|
+
var d;
|
|
559
|
+
a.length && ((d = r.click.get(a[0].object)) == null || d(a[0], g));
|
|
559
560
|
});
|
|
560
|
-
let
|
|
561
|
-
return
|
|
562
|
-
var
|
|
563
|
-
const
|
|
564
|
-
|
|
561
|
+
let f;
|
|
562
|
+
return c(({ intersects: a, event: g }) => {
|
|
563
|
+
var m, v, C, M;
|
|
564
|
+
const d = (m = a == null ? void 0 : a[0]) == null ? void 0 : m.object, { pointerLeave: h, pointerEnter: y, pointerMove: p } = r;
|
|
565
|
+
f && f !== d && ((v = h.get(f)) == null || v(f, g)), d && (f !== d && ((C = y.get(d)) == null || C(a[0], g)), (M = p.get(d)) == null || M(a[0], g)), f = d || null;
|
|
565
566
|
}), {
|
|
566
567
|
registerObject: n,
|
|
567
|
-
deregisterObject:
|
|
568
|
+
deregisterObject: l,
|
|
568
569
|
registerBlockingObject: s,
|
|
569
|
-
deregisterBlockingObject:
|
|
570
|
+
deregisterBlockingObject: i
|
|
570
571
|
};
|
|
571
572
|
};
|
|
572
|
-
function Le(
|
|
573
|
-
let
|
|
574
|
-
return
|
|
575
|
-
if (
|
|
576
|
-
const s =
|
|
577
|
-
|
|
573
|
+
function Le(e) {
|
|
574
|
+
let r = 0;
|
|
575
|
+
return e.traverse((t) => {
|
|
576
|
+
if (t.isMesh && t.geometry) {
|
|
577
|
+
const s = t.geometry, i = s.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, l = s.index ? s.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, n = s.attributes.normal ? s.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, o = s.attributes.uv ? s.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, u = i + l + n + o;
|
|
578
|
+
r += u;
|
|
578
579
|
}
|
|
579
|
-
}),
|
|
580
|
+
}), r;
|
|
580
581
|
}
|
|
581
|
-
function
|
|
582
|
-
return (
|
|
582
|
+
function vn(e) {
|
|
583
|
+
return (e / 1024).toFixed(2);
|
|
583
584
|
}
|
|
584
|
-
const
|
|
585
|
-
function
|
|
586
|
-
const s =
|
|
585
|
+
const ne = k({}), re = (e) => Object.assign(ne.value, e);
|
|
586
|
+
function gn(e, r, t = 10) {
|
|
587
|
+
const s = _(e) ? _t() : Ct(x(() => _(r).parentElement)), i = Z(pe(s.width, t)), l = Z(pe(s.height, t)), n = x(() => i.value / l.value);
|
|
587
588
|
return {
|
|
588
|
-
height:
|
|
589
|
-
width:
|
|
589
|
+
height: l,
|
|
590
|
+
width: i,
|
|
590
591
|
aspectRatio: n
|
|
591
592
|
};
|
|
592
593
|
}
|
|
593
|
-
function
|
|
594
|
-
scene:
|
|
595
|
-
canvas:
|
|
596
|
-
windowSize:
|
|
594
|
+
function hn({
|
|
595
|
+
scene: e,
|
|
596
|
+
canvas: r,
|
|
597
|
+
windowSize: t,
|
|
597
598
|
disableRender: s,
|
|
598
|
-
rendererOptions:
|
|
599
|
-
emit:
|
|
599
|
+
rendererOptions: i,
|
|
600
|
+
emit: l
|
|
600
601
|
}) {
|
|
601
|
-
const { logWarning: n } = P(),
|
|
602
|
-
camera:
|
|
603
|
-
cameras:
|
|
604
|
-
registerCamera:
|
|
605
|
-
deregisterCamera:
|
|
606
|
-
setCameraActive:
|
|
607
|
-
} =
|
|
608
|
-
mode:
|
|
609
|
-
priority:
|
|
610
|
-
frames:
|
|
602
|
+
const { logWarning: n } = P(), o = $(e), u = gn(t, r), {
|
|
603
|
+
camera: c,
|
|
604
|
+
cameras: f,
|
|
605
|
+
registerCamera: a,
|
|
606
|
+
deregisterCamera: g,
|
|
607
|
+
setCameraActive: d
|
|
608
|
+
} = Vt({ sizes: u, scene: e }), h = {
|
|
609
|
+
mode: k(i.renderMode || "always"),
|
|
610
|
+
priority: k(0),
|
|
611
|
+
frames: k(0),
|
|
611
612
|
maxFrames: 60,
|
|
612
613
|
canBeInvalidated: x(() => h.mode.value === "on-demand" && h.frames.value === 0)
|
|
613
614
|
};
|
|
614
|
-
function
|
|
615
|
-
|
|
615
|
+
function y(B = 1) {
|
|
616
|
+
i.renderMode === "on-demand" ? h.frames.value = Math.min(h.maxFrames, h.frames.value + B) : n("`invalidate` can only be used when `renderMode` is set to `on-demand`");
|
|
616
617
|
}
|
|
617
|
-
function
|
|
618
|
-
|
|
618
|
+
function p() {
|
|
619
|
+
i.renderMode === "manual" ? h.frames.value = 1 : n("`advance` can only be used when `renderMode` is set to `manual`");
|
|
619
620
|
}
|
|
620
|
-
const { renderer:
|
|
621
|
+
const { renderer: m } = cn(
|
|
621
622
|
{
|
|
622
|
-
scene:
|
|
623
|
-
canvas:
|
|
624
|
-
options:
|
|
625
|
-
emit:
|
|
623
|
+
scene: e,
|
|
624
|
+
canvas: r,
|
|
625
|
+
options: i,
|
|
626
|
+
emit: l,
|
|
626
627
|
// TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
|
|
627
|
-
contextParts: { sizes:
|
|
628
|
+
contextParts: { sizes: u, camera: c, render: h, invalidate: y, advance: p },
|
|
628
629
|
disableRender: s
|
|
629
630
|
}
|
|
630
|
-
),
|
|
631
|
-
sizes:
|
|
632
|
-
scene:
|
|
633
|
-
camera:
|
|
634
|
-
cameras: Z(
|
|
635
|
-
renderer:
|
|
636
|
-
raycaster: $(new
|
|
637
|
-
controls:
|
|
631
|
+
), v = {
|
|
632
|
+
sizes: u,
|
|
633
|
+
scene: o,
|
|
634
|
+
camera: c,
|
|
635
|
+
cameras: Z(f),
|
|
636
|
+
renderer: m,
|
|
637
|
+
raycaster: $(new it()),
|
|
638
|
+
controls: k(null),
|
|
638
639
|
perf: {
|
|
639
640
|
maxFrames: 160,
|
|
640
641
|
fps: {
|
|
@@ -648,162 +649,167 @@ function hr({
|
|
|
648
649
|
}
|
|
649
650
|
},
|
|
650
651
|
render: h,
|
|
651
|
-
advance:
|
|
652
|
-
extend:
|
|
653
|
-
invalidate:
|
|
654
|
-
registerCamera:
|
|
655
|
-
setCameraActive:
|
|
656
|
-
deregisterCamera:
|
|
652
|
+
advance: p,
|
|
653
|
+
extend: re,
|
|
654
|
+
invalidate: y,
|
|
655
|
+
registerCamera: a,
|
|
656
|
+
setCameraActive: d,
|
|
657
|
+
deregisterCamera: g
|
|
657
658
|
};
|
|
658
|
-
ee("useTres",
|
|
659
|
-
root:
|
|
659
|
+
ee("useTres", v), v.scene.value.__tres = {
|
|
660
|
+
root: v
|
|
660
661
|
};
|
|
661
|
-
const
|
|
662
|
+
const C = 100, M = Et({ every: C }), { isSupported: w, memory: b } = St({ interval: C }), E = 160;
|
|
662
663
|
let L = performance.now();
|
|
663
664
|
const A = ({ timestamp: B }) => {
|
|
664
|
-
|
|
665
|
+
v.scene.value && (v.perf.memory.allocatedMem = Le(v.scene.value)), B - L >= C && (L = B, v.perf.fps.accumulator.push(M.value), v.perf.fps.accumulator.length > E && v.perf.fps.accumulator.shift(), v.perf.fps.value = M.value, w.value && b.value && (v.perf.memory.accumulator.push(b.value.usedJSHeapSize / 1024 / 1024), v.perf.memory.accumulator.length > E && v.perf.memory.accumulator.shift(), v.perf.memory.currentMem = v.perf.memory.accumulator.reduce((Ie, Re) => Ie + Re, 0) / v.perf.memory.accumulator.length));
|
|
665
666
|
};
|
|
666
667
|
let O = 0;
|
|
667
668
|
const Q = 1, { pause: N } = Se(({ delta: B }) => {
|
|
668
|
-
window.__TRES__DEVTOOLS__ && (A({ timestamp: performance.now() }), O += B, O >= Q && (window.__TRES__DEVTOOLS__.cb(
|
|
669
|
+
window.__TRES__DEVTOOLS__ && (A({ timestamp: performance.now() }), O += B, O >= Q && (window.__TRES__DEVTOOLS__.cb(v), O = 0));
|
|
669
670
|
}, { immediate: !0 });
|
|
670
671
|
return J(() => {
|
|
671
672
|
N();
|
|
672
|
-
}),
|
|
673
|
+
}), v;
|
|
673
674
|
}
|
|
674
|
-
function
|
|
675
|
-
const
|
|
676
|
-
if (!
|
|
675
|
+
function yn() {
|
|
676
|
+
const e = Ne("useTres");
|
|
677
|
+
if (!e)
|
|
677
678
|
throw new Error("useTresContext must be used together with useTresContextProvider");
|
|
678
|
-
return
|
|
679
|
+
return e;
|
|
679
680
|
}
|
|
680
|
-
const
|
|
681
|
+
const Qn = yn;
|
|
681
682
|
const { logError: he } = P(), X = [
|
|
682
683
|
"onClick",
|
|
683
684
|
"onPointerMove",
|
|
684
685
|
"onPointerEnter",
|
|
685
686
|
"onPointerLeave"
|
|
686
687
|
];
|
|
687
|
-
function ye(
|
|
688
|
-
const
|
|
689
|
-
|
|
688
|
+
function ye(e) {
|
|
689
|
+
const r = e.__tres.root;
|
|
690
|
+
r && r.render && r.render.canBeInvalidated.value && r.invalidate();
|
|
690
691
|
}
|
|
691
|
-
const
|
|
692
|
-
let
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
692
|
+
const wn = () => {
|
|
693
|
+
let e = null;
|
|
694
|
+
function r(n, o, u, c) {
|
|
695
|
+
if (c || (c = {}), c.args || (c.args = []), n === "template" || en(n))
|
|
696
|
+
return null;
|
|
697
|
+
let f = n.replace("Tres", ""), a;
|
|
698
|
+
if (n === "primitive") {
|
|
699
|
+
(c == null ? void 0 : c.object) === void 0 && he("Tres primitives need a prop 'object'");
|
|
700
|
+
const g = c.object;
|
|
701
|
+
f = g.type, a = Object.assign(g.clone(), { type: f });
|
|
702
|
+
} else {
|
|
703
|
+
const g = ne.value[f];
|
|
704
|
+
g || he(`${f} is not defined on the THREE namespace. Use extend to add it to the catalog.`), a = new g(...c.args);
|
|
705
|
+
}
|
|
706
|
+
return a ? (a.isCamera && (c != null && c.position || a.position.set(3, 3, 3), c != null && c.lookAt || a.lookAt(0, 0, 0)), (c == null ? void 0 : c.attach) === void 0 && (a.isMaterial ? a.attach = "material" : a.isBufferGeometry && (a.attach = "geometry")), a.__tres = {
|
|
707
|
+
...a.__tres,
|
|
708
|
+
type: f,
|
|
709
|
+
memoizedProps: c,
|
|
710
|
+
eventCount: 0,
|
|
711
|
+
disposable: !0,
|
|
712
|
+
primitive: n === "primitive"
|
|
713
|
+
}, a.isObject3D && (c != null && c.material || c != null && c.geometry) && (a.__tres.disposable = !1), a) : null;
|
|
714
|
+
}
|
|
715
|
+
function t(n, o) {
|
|
716
|
+
if (!n)
|
|
717
|
+
return;
|
|
718
|
+
o && o.isScene && (e = o), e && (n.__tres.root = e.__tres.root);
|
|
719
|
+
const u = o || e;
|
|
720
|
+
if (n != null && n.isObject3D) {
|
|
721
|
+
const { registerCamera: c, registerObjectAtPointerEventHandler: f } = n.__tres.root;
|
|
722
|
+
n != null && n.isCamera && c(n), n && X.some((a) => n[a]) && f(n);
|
|
723
|
+
}
|
|
724
|
+
n != null && n.isObject3D && (u != null && u.isObject3D) ? (u.add(n), n.dispatchEvent({ type: "added" })) : n != null && n.isFog ? u.fog = n : typeof (n == null ? void 0 : n.attach) == "string" && (n.__previousAttach = n[u == null ? void 0 : u.attach], u && (u[n.attach] = n));
|
|
725
|
+
}
|
|
726
|
+
function s(n) {
|
|
727
|
+
var f, a;
|
|
728
|
+
if (!n)
|
|
729
|
+
return;
|
|
730
|
+
const o = n.__tres;
|
|
731
|
+
n.parent = n.parent || e;
|
|
732
|
+
const {
|
|
733
|
+
deregisterObjectAtPointerEventHandler: u,
|
|
734
|
+
deregisterBlockingObjectAtPointerEventHandler: c
|
|
735
|
+
} = o.root;
|
|
736
|
+
if (n.isObject3D) {
|
|
737
|
+
const g = (y) => {
|
|
738
|
+
var m, v;
|
|
739
|
+
const p = y;
|
|
740
|
+
o.disposable && ((m = p.material) == null || m.dispose(), p.material = void 0, (v = p.geometry) == null || v.dispose(), p.geometry = void 0);
|
|
741
|
+
}, d = (y) => {
|
|
742
|
+
c(y), y && X.some((p) => y[p]) && (u == null || u(y));
|
|
743
|
+
}, h = (y) => {
|
|
744
|
+
const p = n.__tres.root.deregisterCamera;
|
|
745
|
+
y.isCamera && (p == null || p(y));
|
|
746
|
+
};
|
|
747
|
+
(f = n.removeFromParent) == null || f.call(n), n.traverse((y) => {
|
|
748
|
+
g(y), h(y), d == null || d(y);
|
|
749
|
+
}), g(n), h(n), d == null || d(n), ye(n), (a = n.dispose) == null || a.call(n);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
function i(n, o, u, c) {
|
|
753
|
+
if (n) {
|
|
754
|
+
let f = n, a = o;
|
|
755
|
+
if (n.__tres.primitive && a === "object" && u !== null) {
|
|
756
|
+
const y = r("primitive", void 0, void 0, {
|
|
757
|
+
object: c
|
|
758
|
+
});
|
|
759
|
+
for (const p in y) {
|
|
760
|
+
if (p === "uuid")
|
|
761
|
+
continue;
|
|
762
|
+
const m = n[p], v = y[p];
|
|
763
|
+
!(m != null && m.set) && !K(m) ? n[p] = v : m.constructor === v.constructor && (m != null && m.copy) ? m == null || m.copy(v) : Array.isArray(v) ? m.set(...v) : !m.isColor && m.setScalar ? m.setScalar(v) : m.set(v);
|
|
764
|
+
}
|
|
765
|
+
y.__tres.root = e == null ? void 0 : e.__tres.root, y.isGroup ? (n.geometry = void 0, n.material = void 0) : delete n.isGroup;
|
|
705
766
|
}
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
insert(e, r) {
|
|
716
|
-
if (!e)
|
|
717
|
-
return;
|
|
718
|
-
r && r.isScene && (t = r), t && (e.__tres.root = t.__tres.root);
|
|
719
|
-
const s = r || t;
|
|
720
|
-
if (e != null && e.isObject3D) {
|
|
721
|
-
const { registerCamera: o, registerObjectAtPointerEventHandler: i } = e.__tres.root;
|
|
722
|
-
e != null && e.isCamera && o(e), e && X.some((n) => e[n]) && i(e);
|
|
767
|
+
if (n.__tres.root) {
|
|
768
|
+
const {
|
|
769
|
+
registerBlockingObjectAtPointerEventHandler: y,
|
|
770
|
+
deregisterBlockingObjectAtPointerEventHandler: p
|
|
771
|
+
} = n.__tres.root;
|
|
772
|
+
if (n.isObject3D && a === "blocks-pointer-events") {
|
|
773
|
+
c || c === "" ? y(n) : p(n);
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
723
776
|
}
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
if (!e)
|
|
777
|
+
let g = F(a), d = f == null ? void 0 : f[g];
|
|
778
|
+
if (a === "args") {
|
|
779
|
+
const y = n, p = u ?? [], m = c ?? [], v = n.__tres.type || n.type;
|
|
780
|
+
v && p.length && !on(p, m) && (f = Object.assign(y, new ne.value[v](...c)));
|
|
729
781
|
return;
|
|
730
|
-
const r = e.__tres;
|
|
731
|
-
e.parent = e.parent || t;
|
|
732
|
-
const {
|
|
733
|
-
deregisterObjectAtPointerEventHandler: s,
|
|
734
|
-
deregisterBlockingObjectAtPointerEventHandler: o
|
|
735
|
-
} = r.root;
|
|
736
|
-
if (e.isObject3D) {
|
|
737
|
-
const a = (c) => {
|
|
738
|
-
var d, p;
|
|
739
|
-
const u = c;
|
|
740
|
-
r.disposable && ((d = u.material) == null || d.dispose(), u.material = void 0, (p = u.geometry) == null || p.dispose(), u.geometry = void 0);
|
|
741
|
-
}, l = (c) => {
|
|
742
|
-
o(c), c && X.some((u) => c[u]) && (s == null || s(c));
|
|
743
|
-
}, f = (c) => {
|
|
744
|
-
const u = e.__tres.root.deregisterCamera;
|
|
745
|
-
c.isCamera && (u == null || u(c));
|
|
746
|
-
};
|
|
747
|
-
(i = e.removeFromParent) == null || i.call(e), e.traverse((c) => {
|
|
748
|
-
a(c), f(c), l == null || l(c);
|
|
749
|
-
}), a(e), f(e), l == null || l(e), ye(e), (n = e.dispose) == null || n.call(e);
|
|
750
782
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
if (e) {
|
|
754
|
-
let i = e, n = r;
|
|
755
|
-
if (e.__tres.primitive && n === "object" && s !== null) {
|
|
756
|
-
const c = Oe.createElement("primitive", void 0, void 0, {
|
|
757
|
-
object: o
|
|
758
|
-
});
|
|
759
|
-
for (const u in c) {
|
|
760
|
-
if (u === "uuid")
|
|
761
|
-
continue;
|
|
762
|
-
const d = e[u], p = c[u];
|
|
763
|
-
!(d != null && d.set) && !K(d) ? e[u] = p : d.constructor === p.constructor && (d != null && d.copy) ? d == null || d.copy(p) : Array.isArray(p) ? d.set(...p) : !d.isColor && d.setScalar ? d.setScalar(p) : d.set(p);
|
|
764
|
-
}
|
|
765
|
-
c.__tres.root = t == null ? void 0 : t.__tres.root, c.isGroup ? (e.geometry = void 0, e.material = void 0) : delete e.isGroup;
|
|
766
|
-
}
|
|
767
|
-
if (e.__tres.root) {
|
|
768
|
-
const {
|
|
769
|
-
registerBlockingObjectAtPointerEventHandler: c,
|
|
770
|
-
deregisterBlockingObjectAtPointerEventHandler: u
|
|
771
|
-
} = e.__tres.root;
|
|
772
|
-
if (e.isObject3D && n === "blocks-pointer-events") {
|
|
773
|
-
o || o === "" ? c(e) : u(e);
|
|
774
|
-
return;
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
let a = F(n), l = i == null ? void 0 : i[a];
|
|
778
|
-
if (n === "args") {
|
|
779
|
-
const c = e, u = s ?? [], d = o ?? [], p = e.__tres.type || e.type;
|
|
780
|
-
p && u.length && !sr(u, d) && (i = Object.assign(c, new re.value[p](...o)));
|
|
781
|
-
return;
|
|
782
|
-
}
|
|
783
|
-
if (i.type === "BufferGeometry") {
|
|
784
|
-
if (n === "args")
|
|
785
|
-
return;
|
|
786
|
-
i.setAttribute(
|
|
787
|
-
F(n),
|
|
788
|
-
new lt(...o)
|
|
789
|
-
);
|
|
790
|
-
return;
|
|
791
|
-
}
|
|
792
|
-
if (n.includes("-") && l === void 0) {
|
|
793
|
-
const c = n.split("-");
|
|
794
|
-
l = c.reduce((u, d) => u[F(d)], i), n = c.pop(), a = n.toLowerCase(), l != null && l.set || (i = c.reduce((u, d) => u[F(d)], i));
|
|
795
|
-
}
|
|
796
|
-
let f = o;
|
|
797
|
-
if (f === "" && (f = !0), K(l)) {
|
|
798
|
-
X.includes(r) || (Array.isArray(f) ? e[a](...f) : e[a](f));
|
|
783
|
+
if (f.type === "BufferGeometry") {
|
|
784
|
+
if (a === "args")
|
|
799
785
|
return;
|
|
800
|
-
|
|
801
|
-
|
|
786
|
+
f.setAttribute(
|
|
787
|
+
F(a),
|
|
788
|
+
new at(...c)
|
|
789
|
+
);
|
|
790
|
+
return;
|
|
802
791
|
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
792
|
+
if (a.includes("-") && d === void 0) {
|
|
793
|
+
const y = a.split("-");
|
|
794
|
+
d = y.reduce((p, m) => p[F(m)], f), a = y.pop(), g = a.toLowerCase(), d != null && d.set || (f = y.reduce((p, m) => p[F(m)], f));
|
|
795
|
+
}
|
|
796
|
+
let h = c;
|
|
797
|
+
if (h === "" && (h = !0), K(d)) {
|
|
798
|
+
X.includes(o) || (Array.isArray(h) ? n[g](...h) : n[g](h));
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
801
|
+
!(d != null && d.set) && !K(d) ? f[g] = h : d.constructor === h.constructor && (d != null && d.copy) ? d == null || d.copy(h) : Array.isArray(h) ? d.set(...h) : !d.isColor && d.setScalar ? d.setScalar(h) : d.set(h), ye(n);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
function l(n) {
|
|
805
|
+
return (n == null ? void 0 : n.parent) || null;
|
|
806
|
+
}
|
|
807
|
+
return {
|
|
808
|
+
insert: t,
|
|
809
|
+
remove: s,
|
|
810
|
+
createElement: r,
|
|
811
|
+
patchProp: i,
|
|
812
|
+
parentNode: l,
|
|
807
813
|
createText: () => void 0,
|
|
808
814
|
createComment: () => void 0,
|
|
809
815
|
setText: () => void 0,
|
|
@@ -815,193 +821,193 @@ const Oe = () => {
|
|
|
815
821
|
insertStaticContent: () => void 0
|
|
816
822
|
};
|
|
817
823
|
};
|
|
818
|
-
function
|
|
819
|
-
return
|
|
824
|
+
function bn() {
|
|
825
|
+
return Oe().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
|
820
826
|
}
|
|
821
|
-
function
|
|
822
|
-
return typeof navigator < "u" && typeof window < "u" ? window : typeof
|
|
827
|
+
function Oe() {
|
|
828
|
+
return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
|
|
823
829
|
}
|
|
824
|
-
const
|
|
830
|
+
const Mn = typeof Proxy == "function", _n = "devtools-plugin:setup", Cn = "plugin:settings:set";
|
|
825
831
|
let j, oe;
|
|
826
|
-
function
|
|
827
|
-
var
|
|
828
|
-
return j !== void 0 || (typeof window < "u" && window.performance ? (j = !0, oe = window.performance) : typeof
|
|
832
|
+
function En() {
|
|
833
|
+
var e;
|
|
834
|
+
return j !== void 0 || (typeof window < "u" && window.performance ? (j = !0, oe = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (j = !0, oe = globalThis.perf_hooks.performance) : j = !1), j;
|
|
829
835
|
}
|
|
830
|
-
function
|
|
831
|
-
return
|
|
836
|
+
function Sn() {
|
|
837
|
+
return En() ? oe.now() : Date.now();
|
|
832
838
|
}
|
|
833
|
-
class
|
|
834
|
-
constructor(
|
|
835
|
-
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin =
|
|
839
|
+
class xn {
|
|
840
|
+
constructor(r, t) {
|
|
841
|
+
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = r, this.hook = t;
|
|
836
842
|
const s = {};
|
|
837
|
-
if (
|
|
838
|
-
for (const n in
|
|
839
|
-
const
|
|
840
|
-
s[n] =
|
|
843
|
+
if (r.settings)
|
|
844
|
+
for (const n in r.settings) {
|
|
845
|
+
const o = r.settings[n];
|
|
846
|
+
s[n] = o.defaultValue;
|
|
841
847
|
}
|
|
842
|
-
const
|
|
843
|
-
let
|
|
848
|
+
const i = `__vue-devtools-plugin-settings__${r.id}`;
|
|
849
|
+
let l = Object.assign({}, s);
|
|
844
850
|
try {
|
|
845
|
-
const n = localStorage.getItem(
|
|
846
|
-
Object.assign(
|
|
851
|
+
const n = localStorage.getItem(i), o = JSON.parse(n);
|
|
852
|
+
Object.assign(l, o);
|
|
847
853
|
} catch {
|
|
848
854
|
}
|
|
849
855
|
this.fallbacks = {
|
|
850
856
|
getSettings() {
|
|
851
|
-
return
|
|
857
|
+
return l;
|
|
852
858
|
},
|
|
853
859
|
setSettings(n) {
|
|
854
860
|
try {
|
|
855
|
-
localStorage.setItem(
|
|
861
|
+
localStorage.setItem(i, JSON.stringify(n));
|
|
856
862
|
} catch {
|
|
857
863
|
}
|
|
858
|
-
|
|
864
|
+
l = n;
|
|
859
865
|
},
|
|
860
866
|
now() {
|
|
861
|
-
return
|
|
867
|
+
return Sn();
|
|
862
868
|
}
|
|
863
|
-
},
|
|
864
|
-
n === this.plugin.id && this.fallbacks.setSettings(
|
|
869
|
+
}, t && t.on(Cn, (n, o) => {
|
|
870
|
+
n === this.plugin.id && this.fallbacks.setSettings(o);
|
|
865
871
|
}), this.proxiedOn = new Proxy({}, {
|
|
866
|
-
get: (n,
|
|
872
|
+
get: (n, o) => this.target ? this.target.on[o] : (...u) => {
|
|
867
873
|
this.onQueue.push({
|
|
868
|
-
method:
|
|
869
|
-
args:
|
|
874
|
+
method: o,
|
|
875
|
+
args: u
|
|
870
876
|
});
|
|
871
877
|
}
|
|
872
878
|
}), this.proxiedTarget = new Proxy({}, {
|
|
873
|
-
get: (n,
|
|
874
|
-
method:
|
|
875
|
-
args:
|
|
879
|
+
get: (n, o) => this.target ? this.target[o] : o === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(o) ? (...u) => (this.targetQueue.push({
|
|
880
|
+
method: o,
|
|
881
|
+
args: u,
|
|
876
882
|
resolve: () => {
|
|
877
883
|
}
|
|
878
|
-
}), this.fallbacks[
|
|
884
|
+
}), this.fallbacks[o](...u)) : (...u) => new Promise((c) => {
|
|
879
885
|
this.targetQueue.push({
|
|
880
|
-
method:
|
|
881
|
-
args:
|
|
882
|
-
resolve:
|
|
886
|
+
method: o,
|
|
887
|
+
args: u,
|
|
888
|
+
resolve: c
|
|
883
889
|
});
|
|
884
890
|
})
|
|
885
891
|
});
|
|
886
892
|
}
|
|
887
|
-
async setRealTarget(
|
|
888
|
-
this.target =
|
|
889
|
-
for (const
|
|
890
|
-
this.target.on[
|
|
891
|
-
for (const
|
|
892
|
-
|
|
893
|
+
async setRealTarget(r) {
|
|
894
|
+
this.target = r;
|
|
895
|
+
for (const t of this.onQueue)
|
|
896
|
+
this.target.on[t.method](...t.args);
|
|
897
|
+
for (const t of this.targetQueue)
|
|
898
|
+
t.resolve(await this.target[t.method](...t.args));
|
|
893
899
|
}
|
|
894
900
|
}
|
|
895
|
-
function
|
|
896
|
-
const
|
|
897
|
-
if (
|
|
898
|
-
|
|
901
|
+
function Tn(e, r) {
|
|
902
|
+
const t = e, s = Oe(), i = bn(), l = Mn && t.enableEarlyProxy;
|
|
903
|
+
if (i && (s.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !l))
|
|
904
|
+
i.emit(_n, e, r);
|
|
899
905
|
else {
|
|
900
|
-
const n =
|
|
906
|
+
const n = l ? new xn(t, i) : null;
|
|
901
907
|
(s.__VUE_DEVTOOLS_PLUGINS__ = s.__VUE_DEVTOOLS_PLUGINS__ || []).push({
|
|
902
|
-
pluginDescriptor:
|
|
903
|
-
setupFn:
|
|
908
|
+
pluginDescriptor: t,
|
|
909
|
+
setupFn: r,
|
|
904
910
|
proxy: n
|
|
905
|
-
}), n &&
|
|
911
|
+
}), n && r(n.proxiedTarget);
|
|
906
912
|
}
|
|
907
913
|
}
|
|
908
|
-
function
|
|
909
|
-
const
|
|
910
|
-
typeof __VUE_DEVTOOLS_TOAST__ == "function" ? __VUE_DEVTOOLS_TOAST__(
|
|
914
|
+
function kn(e, r) {
|
|
915
|
+
const t = `▲ ■ ●${e}`;
|
|
916
|
+
typeof __VUE_DEVTOOLS_TOAST__ == "function" ? __VUE_DEVTOOLS_TOAST__(t, r) : r === "error" ? console.error(t) : r === "warn" ? console.warn(t) : console.log(t);
|
|
911
917
|
}
|
|
912
|
-
const
|
|
913
|
-
const
|
|
914
|
-
id:
|
|
915
|
-
label:
|
|
918
|
+
const Be = (e) => {
|
|
919
|
+
const r = {
|
|
920
|
+
id: e.uuid,
|
|
921
|
+
label: e.type,
|
|
916
922
|
children: [],
|
|
917
923
|
tags: []
|
|
918
924
|
};
|
|
919
|
-
|
|
920
|
-
label:
|
|
925
|
+
e.name !== "" && r.tags.push({
|
|
926
|
+
label: e.name,
|
|
921
927
|
textColor: 5750629,
|
|
922
928
|
backgroundColor: 15793395
|
|
923
929
|
});
|
|
924
|
-
const
|
|
925
|
-
return
|
|
926
|
-
label: `${
|
|
930
|
+
const t = Le(e);
|
|
931
|
+
return t > 0 && r.tags.push({
|
|
932
|
+
label: `${vn(t)} KB`,
|
|
927
933
|
textColor: 15707189,
|
|
928
934
|
backgroundColor: 16775644,
|
|
929
935
|
tooltip: "Memory usage"
|
|
930
|
-
}),
|
|
931
|
-
label: `${
|
|
936
|
+
}), e.type.includes("Light") && (r.tags.push({
|
|
937
|
+
label: `${e.intensity}`,
|
|
932
938
|
textColor: 9738662,
|
|
933
939
|
backgroundColor: 16316922,
|
|
934
940
|
tooltip: "Intensity"
|
|
935
|
-
}),
|
|
936
|
-
label: `#${
|
|
941
|
+
}), r.tags.push({
|
|
942
|
+
label: `#${e.color.getHexString()}`,
|
|
937
943
|
textColor: 9738662,
|
|
938
944
|
backgroundColor: 16316922,
|
|
939
945
|
tooltip: "Color"
|
|
940
|
-
})),
|
|
941
|
-
label: `${
|
|
946
|
+
})), e.type.includes("Camera") && (r.tags.push({
|
|
947
|
+
label: `${e.fov}°`,
|
|
942
948
|
textColor: 9738662,
|
|
943
949
|
backgroundColor: 16316922,
|
|
944
950
|
tooltip: "Field of view"
|
|
945
|
-
}),
|
|
951
|
+
}), r.tags.push({
|
|
946
952
|
// eslint-disable-next-line max-len
|
|
947
|
-
label: `x: ${Math.round(
|
|
953
|
+
label: `x: ${Math.round(e.position.x)} y: ${Math.round(e.position.y)} z: ${Math.round(e.position.z)}`,
|
|
948
954
|
textColor: 9738662,
|
|
949
955
|
backgroundColor: 16316922,
|
|
950
956
|
tooltip: "Position"
|
|
951
|
-
})),
|
|
957
|
+
})), r;
|
|
952
958
|
};
|
|
953
|
-
function
|
|
954
|
-
|
|
955
|
-
if (
|
|
959
|
+
function je(e, r) {
|
|
960
|
+
e.children.forEach((t) => {
|
|
961
|
+
if (t.type === "HightlightMesh")
|
|
956
962
|
return;
|
|
957
|
-
const s =
|
|
958
|
-
|
|
963
|
+
const s = Be(t);
|
|
964
|
+
r.children.push(s), je(t, s);
|
|
959
965
|
});
|
|
960
966
|
}
|
|
961
|
-
const
|
|
967
|
+
const Pn = [], D = "tres:inspector", An = be({
|
|
962
968
|
sceneGraph: null
|
|
963
969
|
});
|
|
964
|
-
function
|
|
965
|
-
|
|
970
|
+
function Ln(e, r) {
|
|
971
|
+
Tn(
|
|
966
972
|
{
|
|
967
973
|
id: "dev.esm.tres",
|
|
968
974
|
label: "TresJS 🪐",
|
|
969
975
|
logo: "https://raw.githubusercontent.com/Tresjs/tres/main/public/favicon.svg",
|
|
970
976
|
packageName: "tresjs",
|
|
971
977
|
homepage: "https://tresjs.org",
|
|
972
|
-
componentStateTypes:
|
|
973
|
-
app:
|
|
978
|
+
componentStateTypes: Pn,
|
|
979
|
+
app: e
|
|
974
980
|
},
|
|
975
|
-
(
|
|
976
|
-
typeof
|
|
981
|
+
(t) => {
|
|
982
|
+
typeof t.now != "function" && kn(
|
|
977
983
|
// eslint-disable-next-line max-len
|
|
978
984
|
"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."
|
|
979
|
-
),
|
|
985
|
+
), t.addInspector({
|
|
980
986
|
id: D,
|
|
981
987
|
label: "TresJS 🪐",
|
|
982
988
|
icon: "account_tree",
|
|
983
989
|
treeFilterPlaceholder: "Search instances"
|
|
984
990
|
}), setInterval(() => {
|
|
985
|
-
|
|
991
|
+
t.sendInspectorTree(D);
|
|
986
992
|
}, 1e3), setInterval(() => {
|
|
987
|
-
|
|
988
|
-
}, 5e3),
|
|
989
|
-
if (
|
|
990
|
-
const n =
|
|
991
|
-
|
|
993
|
+
t.notifyComponentUpdate();
|
|
994
|
+
}, 5e3), t.on.getInspectorTree((l) => {
|
|
995
|
+
if (l.inspectorId === D) {
|
|
996
|
+
const n = Be(r.scene.value);
|
|
997
|
+
je(r.scene.value, n), An.sceneGraph = n, l.rootNodes = [n];
|
|
992
998
|
}
|
|
993
999
|
});
|
|
994
|
-
let s = null,
|
|
995
|
-
|
|
996
|
-
if (
|
|
997
|
-
const [n] =
|
|
1000
|
+
let s = null, i = null;
|
|
1001
|
+
t.on.getInspectorState((l) => {
|
|
1002
|
+
if (l.inspectorId === D) {
|
|
1003
|
+
const [n] = r.scene.value.getObjectsByProperty("uuid", l.nodeId);
|
|
998
1004
|
if (!n)
|
|
999
1005
|
return;
|
|
1000
|
-
if (
|
|
1001
|
-
const
|
|
1002
|
-
n.add(
|
|
1006
|
+
if (i && s && s.parent && i.remove(s), n.isMesh) {
|
|
1007
|
+
const o = ln(n);
|
|
1008
|
+
n.add(o), s = o, i = n;
|
|
1003
1009
|
}
|
|
1004
|
-
|
|
1010
|
+
l.state = {
|
|
1005
1011
|
object: [
|
|
1006
1012
|
{
|
|
1007
1013
|
key: "uuid",
|
|
@@ -1088,13 +1094,13 @@ function Ar(t, e) {
|
|
|
1088
1094
|
]
|
|
1089
1095
|
};
|
|
1090
1096
|
}
|
|
1091
|
-
}),
|
|
1092
|
-
|
|
1097
|
+
}), t.on.editInspectorState((l) => {
|
|
1098
|
+
l.inspectorId === D && an(r.scene.value, l.nodeId, l.path, l.state.value);
|
|
1093
1099
|
});
|
|
1094
1100
|
}
|
|
1095
1101
|
);
|
|
1096
1102
|
}
|
|
1097
|
-
const
|
|
1103
|
+
const On = ["data-scene", "data-tres"], Bn = /* @__PURE__ */ le({
|
|
1098
1104
|
__name: "TresCanvas",
|
|
1099
1105
|
props: {
|
|
1100
1106
|
shadows: { type: Boolean, default: void 0 },
|
|
@@ -1122,109 +1128,109 @@ const Lr = ["data-scene", "data-tres"], Or = /* @__PURE__ */ le({
|
|
|
1122
1128
|
failIfMajorPerformanceCaveat: { type: Boolean, default: void 0 }
|
|
1123
1129
|
},
|
|
1124
1130
|
emits: ["render"],
|
|
1125
|
-
setup(
|
|
1126
|
-
var
|
|
1127
|
-
const s =
|
|
1128
|
-
|
|
1129
|
-
const
|
|
1131
|
+
setup(e, { expose: r, emit: t }) {
|
|
1132
|
+
var y;
|
|
1133
|
+
const s = e, i = t, l = k(), n = $(new lt()), { resume: o } = ae(), u = Fe(), c = (y = ue()) == null ? void 0 : y.appContext.app;
|
|
1134
|
+
re(Me);
|
|
1135
|
+
const f = (p) => le({
|
|
1130
1136
|
setup() {
|
|
1131
|
-
var
|
|
1132
|
-
const
|
|
1133
|
-
return
|
|
1137
|
+
var v;
|
|
1138
|
+
const m = (v = ue()) == null ? void 0 : v.appContext;
|
|
1139
|
+
return m && (m.app = c), ee("useTres", p), ee("extend", re), typeof window < "u" && Ln(m == null ? void 0 : m.app, p), () => ce(Ye, null, u != null && u.default ? u.default() : []);
|
|
1134
1140
|
}
|
|
1135
|
-
}),
|
|
1136
|
-
const
|
|
1137
|
-
|
|
1138
|
-
},
|
|
1139
|
-
n.value.children = [],
|
|
1140
|
-
},
|
|
1141
|
-
return
|
|
1142
|
-
const
|
|
1143
|
-
h.value =
|
|
1141
|
+
}), a = (p) => {
|
|
1142
|
+
const m = f(p), { render: v } = Qe(wn());
|
|
1143
|
+
v(ce(m), n.value);
|
|
1144
|
+
}, g = (p, m = !1) => {
|
|
1145
|
+
n.value.children = [], m && (p.renderer.value.dispose(), p.renderer.value.renderLists.dispose(), p.renderer.value.forceContextLoss()), a(p), o();
|
|
1146
|
+
}, d = x(() => s.disableRender), h = $(null);
|
|
1147
|
+
return r({ context: h, dispose: () => g(h.value, !0) }), We(() => {
|
|
1148
|
+
const p = l;
|
|
1149
|
+
h.value = hn({
|
|
1144
1150
|
scene: n.value,
|
|
1145
|
-
canvas:
|
|
1151
|
+
canvas: p,
|
|
1146
1152
|
windowSize: s.windowSize ?? !1,
|
|
1147
|
-
disableRender:
|
|
1153
|
+
disableRender: d.value ?? !1,
|
|
1148
1154
|
rendererOptions: s,
|
|
1149
|
-
emit:
|
|
1150
|
-
}),
|
|
1151
|
-
const { registerCamera:
|
|
1152
|
-
|
|
1153
|
-
const
|
|
1154
|
-
const
|
|
1155
|
+
emit: i
|
|
1156
|
+
}), mn(h.value);
|
|
1157
|
+
const { registerCamera: m, camera: v, cameras: C, deregisterCamera: M } = h.value;
|
|
1158
|
+
a(h.value);
|
|
1159
|
+
const w = () => {
|
|
1160
|
+
const b = new te(
|
|
1155
1161
|
45,
|
|
1156
1162
|
window.innerWidth / window.innerHeight,
|
|
1157
1163
|
0.1,
|
|
1158
1164
|
1e3
|
|
1159
1165
|
);
|
|
1160
|
-
|
|
1161
|
-
const
|
|
1162
|
-
|
|
1166
|
+
b.position.set(3, 3, 3), b.lookAt(0, 0, 0), m(b);
|
|
1167
|
+
const E = se(() => {
|
|
1168
|
+
C.value.length >= 2 && (b.removeFromParent(), M(b), E == null || E());
|
|
1163
1169
|
});
|
|
1164
1170
|
};
|
|
1165
1171
|
I(
|
|
1166
1172
|
() => s.camera,
|
|
1167
|
-
(
|
|
1168
|
-
|
|
1173
|
+
(b, E) => {
|
|
1174
|
+
b && m(b), E && (E.removeFromParent(), M(E));
|
|
1169
1175
|
},
|
|
1170
1176
|
{
|
|
1171
1177
|
immediate: !0
|
|
1172
1178
|
}
|
|
1173
|
-
),
|
|
1174
|
-
}), (
|
|
1179
|
+
), v.value || w();
|
|
1180
|
+
}), (p, m) => (Ue(), Ge("canvas", {
|
|
1175
1181
|
ref_key: "canvas",
|
|
1176
|
-
ref:
|
|
1182
|
+
ref: l,
|
|
1177
1183
|
"data-scene": n.value.uuid,
|
|
1178
|
-
class:
|
|
1179
|
-
"data-tres": `tresjs ${
|
|
1180
|
-
style:
|
|
1184
|
+
class: ze(p.$attrs.class),
|
|
1185
|
+
"data-tres": `tresjs ${Ve(zt).version}`,
|
|
1186
|
+
style: Je({
|
|
1181
1187
|
display: "block",
|
|
1182
1188
|
width: "100%",
|
|
1183
1189
|
height: "100%",
|
|
1184
|
-
position:
|
|
1190
|
+
position: p.windowSize ? "fixed" : "relative",
|
|
1185
1191
|
top: 0,
|
|
1186
1192
|
left: 0,
|
|
1187
1193
|
pointerEvents: "auto",
|
|
1188
1194
|
touchAction: "none",
|
|
1189
|
-
...
|
|
1195
|
+
...p.$attrs.style
|
|
1190
1196
|
})
|
|
1191
|
-
}, null, 14,
|
|
1197
|
+
}, null, 14, On));
|
|
1192
1198
|
}
|
|
1193
|
-
}),
|
|
1199
|
+
}), jn = [
|
|
1194
1200
|
"TresCanvas",
|
|
1195
1201
|
"TresLeches",
|
|
1196
1202
|
"TresScene"
|
|
1197
|
-
],
|
|
1203
|
+
], Dn = {
|
|
1198
1204
|
template: {
|
|
1199
1205
|
compilerOptions: {
|
|
1200
|
-
isCustomElement: (
|
|
1206
|
+
isCustomElement: (e) => e.startsWith("Tres") && !jn.includes(e) || e === "primitive"
|
|
1201
1207
|
}
|
|
1202
1208
|
}
|
|
1203
|
-
},
|
|
1204
|
-
mounted: (
|
|
1205
|
-
if (
|
|
1206
|
-
console.log(`v-log:${
|
|
1209
|
+
}, Yn = Dn, qn = {
|
|
1210
|
+
mounted: (e, r) => {
|
|
1211
|
+
if (r.arg) {
|
|
1212
|
+
console.log(`v-log:${r.arg}`, e[r.arg]);
|
|
1207
1213
|
return;
|
|
1208
1214
|
}
|
|
1209
|
-
console.log("v-log",
|
|
1215
|
+
console.log("v-log", e);
|
|
1210
1216
|
}
|
|
1211
1217
|
};
|
|
1212
|
-
class
|
|
1213
|
-
constructor(
|
|
1214
|
-
const s = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0],
|
|
1215
|
-
|
|
1216
|
-
const
|
|
1217
|
-
super(
|
|
1218
|
-
const n = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0],
|
|
1219
|
-
|
|
1218
|
+
class De extends ut {
|
|
1219
|
+
constructor(r, t) {
|
|
1220
|
+
const s = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], i = new de();
|
|
1221
|
+
i.setAttribute("position", new fe(s, 3)), i.computeBoundingSphere();
|
|
1222
|
+
const l = new ct({ fog: !1 });
|
|
1223
|
+
super(i, l), this.light = r, this.color = t, this.type = "RectAreaLightHelper";
|
|
1224
|
+
const n = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], o = new de();
|
|
1225
|
+
o.setAttribute("position", new fe(n, 3)), o.computeBoundingSphere(), this.add(new dt(o, new Ce({ side: ft, fog: !1 })));
|
|
1220
1226
|
}
|
|
1221
1227
|
updateMatrixWorld() {
|
|
1222
1228
|
if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
|
|
1223
1229
|
this.material.color.set(this.color), this.children[0].material.color.set(this.color);
|
|
1224
1230
|
else {
|
|
1225
1231
|
this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);
|
|
1226
|
-
const
|
|
1227
|
-
|
|
1232
|
+
const r = this.material.color, t = Math.max(r.r, r.g, r.b);
|
|
1233
|
+
t > 1 && r.multiplyScalar(1 / t), this.children[0].material.color.copy(this.material.color);
|
|
1228
1234
|
}
|
|
1229
1235
|
this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld), this.children[0].matrixWorld.copy(this.matrixWorld);
|
|
1230
1236
|
}
|
|
@@ -1233,95 +1239,95 @@ class Ie extends ct {
|
|
|
1233
1239
|
}
|
|
1234
1240
|
}
|
|
1235
1241
|
const { logWarning: we } = P();
|
|
1236
|
-
let U,
|
|
1237
|
-
const
|
|
1238
|
-
DirectionalLight:
|
|
1239
|
-
PointLight:
|
|
1240
|
-
SpotLight:
|
|
1241
|
-
HemisphereLight:
|
|
1242
|
-
RectAreaLight:
|
|
1243
|
-
},
|
|
1244
|
-
mounted: (
|
|
1245
|
-
if (!
|
|
1246
|
-
we(`${
|
|
1242
|
+
let U, T;
|
|
1243
|
+
const In = {
|
|
1244
|
+
DirectionalLight: pt,
|
|
1245
|
+
PointLight: mt,
|
|
1246
|
+
SpotLight: vt,
|
|
1247
|
+
HemisphereLight: gt,
|
|
1248
|
+
RectAreaLight: De
|
|
1249
|
+
}, Kn = {
|
|
1250
|
+
mounted: (e) => {
|
|
1251
|
+
if (!e.isLight) {
|
|
1252
|
+
we(`${e.type} is not a light`);
|
|
1247
1253
|
return;
|
|
1248
1254
|
}
|
|
1249
|
-
U =
|
|
1255
|
+
U = In[e.type], e.parent.add(new U(e, 1, e.color.getHex()));
|
|
1250
1256
|
},
|
|
1251
|
-
updated: (
|
|
1252
|
-
|
|
1257
|
+
updated: (e) => {
|
|
1258
|
+
T = e.parent.children.find((r) => r instanceof U), !(T instanceof De) && T.update();
|
|
1253
1259
|
},
|
|
1254
|
-
unmounted: (
|
|
1255
|
-
if (!
|
|
1256
|
-
we(`${
|
|
1260
|
+
unmounted: (e) => {
|
|
1261
|
+
if (!e.isLight) {
|
|
1262
|
+
we(`${e.type} is not a light`);
|
|
1257
1263
|
return;
|
|
1258
1264
|
}
|
|
1259
|
-
|
|
1265
|
+
T = e.parent.children.find((r) => r instanceof U), T && T.dispose && T.dispose(), e.parent.remove(T);
|
|
1260
1266
|
}
|
|
1261
|
-
}, { logWarning:
|
|
1262
|
-
updated: (
|
|
1263
|
-
const
|
|
1264
|
-
if (!
|
|
1265
|
-
|
|
1267
|
+
}, { logWarning: Rn } = P(), Xn = {
|
|
1268
|
+
updated: (e, r) => {
|
|
1269
|
+
const t = Ae(r);
|
|
1270
|
+
if (!t) {
|
|
1271
|
+
Rn(`v-always-look-at: problem with binding value: ${r.value}`);
|
|
1266
1272
|
return;
|
|
1267
1273
|
}
|
|
1268
1274
|
const { onLoop: s } = ae();
|
|
1269
1275
|
s(() => {
|
|
1270
|
-
|
|
1276
|
+
e.lookAt(t);
|
|
1271
1277
|
});
|
|
1272
1278
|
}
|
|
1273
|
-
}, { logWarning:
|
|
1274
|
-
updated: (
|
|
1275
|
-
var
|
|
1276
|
-
const
|
|
1277
|
-
if (!
|
|
1278
|
-
|
|
1279
|
+
}, { logWarning: $n } = P(), Zn = {
|
|
1280
|
+
updated: (e, r) => {
|
|
1281
|
+
var i;
|
|
1282
|
+
const t = Ae(r);
|
|
1283
|
+
if (!t) {
|
|
1284
|
+
$n(`v-distance-to: problem with binding value: ${r.value}`);
|
|
1279
1285
|
return;
|
|
1280
1286
|
}
|
|
1281
|
-
S && (S.dispose(),
|
|
1282
|
-
const s =
|
|
1283
|
-
s.normalize(), S = new
|
|
1287
|
+
S && (S.dispose(), e.parent.remove(S));
|
|
1288
|
+
const s = t.clone().sub(e.position);
|
|
1289
|
+
s.normalize(), S = new ht(s, e.position, e.position.distanceTo(t), 16776960), e.parent.add(S), console.table(
|
|
1284
1290
|
[
|
|
1285
|
-
["Distance:",
|
|
1286
|
-
[`origin: ${
|
|
1287
|
-
[`Destiny: ${
|
|
1291
|
+
["Distance:", e.position.distanceTo(t)],
|
|
1292
|
+
[`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(i = e.position) == null ? void 0 : i.z}`],
|
|
1293
|
+
[`Destiny: ${e.name || e.type}`, `x:${t.x}, y:${t.y}, z:${t == null ? void 0 : t.z}`]
|
|
1288
1294
|
]
|
|
1289
1295
|
);
|
|
1290
1296
|
},
|
|
1291
|
-
unmounted: (
|
|
1292
|
-
S == null || S.dispose(),
|
|
1297
|
+
unmounted: (e) => {
|
|
1298
|
+
S == null || S.dispose(), e.parent.remove(S);
|
|
1293
1299
|
}
|
|
1294
1300
|
};
|
|
1295
1301
|
let S = null;
|
|
1296
|
-
const
|
|
1297
|
-
install(
|
|
1298
|
-
|
|
1302
|
+
const er = {
|
|
1303
|
+
install(e) {
|
|
1304
|
+
e.component("TresCanvas", Bn);
|
|
1299
1305
|
}
|
|
1300
1306
|
};
|
|
1301
1307
|
export {
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1308
|
+
Bn as TresCanvas,
|
|
1309
|
+
ne as catalogue,
|
|
1310
|
+
er as default,
|
|
1311
|
+
re as extend,
|
|
1312
|
+
Un as isProd,
|
|
1313
|
+
Kt as normalizeColor,
|
|
1314
|
+
Gn as normalizeVectorFlexibleParam,
|
|
1315
|
+
Yn as templateCompilerOptions,
|
|
1316
|
+
fn as trasverseObjects,
|
|
1317
|
+
Vt as useCamera,
|
|
1318
|
+
zn as useLoader,
|
|
1313
1319
|
P as useLogger,
|
|
1314
|
-
|
|
1315
|
-
|
|
1320
|
+
mn as usePointerEventHandler,
|
|
1321
|
+
pn as useRaycaster,
|
|
1316
1322
|
ae as useRenderLoop,
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1323
|
+
cn as useRenderer,
|
|
1324
|
+
Jn as useSeek,
|
|
1325
|
+
Vn as useTexture,
|
|
1326
|
+
Qn as useTres,
|
|
1327
|
+
yn as useTresContext,
|
|
1328
|
+
hn as useTresContextProvider,
|
|
1329
|
+
Xn as vAlwaysLookAt,
|
|
1330
|
+
Zn as vDistanceTo,
|
|
1331
|
+
Kn as vLightHelper,
|
|
1332
|
+
qn as vLog
|
|
1327
1333
|
};
|