@tresjs/core 4.0.2 → 4.1.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tres.js +505 -584
- package/dist/tres.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/tres.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version: v4.0.
|
|
3
|
+
* version: v4.1.0-next.0
|
|
4
4
|
* (c) 2024
|
|
5
5
|
* description: Declarative ThreeJS using Vue Components
|
|
6
6
|
* author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
var at = Object.defineProperty;
|
|
9
9
|
var lt = (e, t, r) => t in e ? at(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
10
10
|
var ie = (e, t, r) => (lt(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
11
|
-
import { ref as L, computed as D, watchEffect as
|
|
11
|
+
import { ref as L, computed as D, watchEffect as ve, onUnmounted as N, shallowRef as H, watch as G, reactive as ze, readonly as ue, unref as W, provide as fe, inject as ct, defineComponent as xe, useSlots as ut, getCurrentInstance as ke, onMounted as ft, openBlock as pt, createElementBlock as dt, normalizeClass as mt, normalizeStyle as gt, createRenderer as vt, h as Oe, Fragment as ht } from "vue";
|
|
12
12
|
import * as Ge from "three";
|
|
13
|
-
import { PerspectiveCamera as
|
|
14
|
-
import { createEventHook as
|
|
15
|
-
const qt = "@tresjs/core", Yt = "module", Jt = "4.0.
|
|
13
|
+
import { PerspectiveCamera as pe, Camera as yt, Clock as Ve, Vector3 as he, Color as re, Scene as qe, MeshBasicMaterial as Ye, DoubleSide as wt, REVISION as bt, SRGBColorSpace as Mt, ACESFilmicToneMapping as Je, PCFSoftShadowMap as Pt, NoToneMapping as _t, WebGLRenderer as ae, TextureLoader as Ct, Vector2 as le, MathUtils as Et, Raycaster as St, BufferAttribute as Tt, Object3D as xt, Line as kt, BufferGeometry as Ae, Float32BufferAttribute as Le, LineBasicMaterial as Ot, Mesh as At, BackSide as Lt, DirectionalLightHelper as Dt, PointLightHelper as Bt, SpotLightHelper as jt, HemisphereLightHelper as Rt, ArrowHelper as It } from "three";
|
|
14
|
+
import { createEventHook as A, useRafFn as Qe, toValue as T, unrefElement as Ht, useDevicePixelRatio as $t, usePointer as Ft, useElementBounding as Ut, useWindowSize as Wt, useElementSize as Nt, refDebounced as De, tryOnScopeDispose as zt, useFps as Gt, useMemory as Vt } from "@vueuse/core";
|
|
15
|
+
const qt = "@tresjs/core", Yt = "module", Jt = "4.1.0-next.0", Qt = "pnpm@9.1.4", Kt = "Declarative ThreeJS using Vue Components", Xt = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", Zt = "MIT", er = [
|
|
16
16
|
"vue",
|
|
17
17
|
"3d",
|
|
18
18
|
"threejs",
|
|
@@ -59,10 +59,10 @@ const qt = "@tresjs/core", Yt = "module", Jt = "4.0.2", Qt = "pnpm@9.1.4", Kt =
|
|
|
59
59
|
"docs:preview": "vitepress preview docs",
|
|
60
60
|
"docs:contributors": "esno scripts/update-contributors.ts",
|
|
61
61
|
prepare: "node .husky/install.mjs"
|
|
62
|
-
},
|
|
62
|
+
}, cr = {
|
|
63
63
|
three: ">=0.133",
|
|
64
64
|
vue: ">=3.4"
|
|
65
|
-
},
|
|
65
|
+
}, ur = {
|
|
66
66
|
"@alvarosabu/utils": "^3.2.0",
|
|
67
67
|
"@vue/devtools-api": "^6.6.2",
|
|
68
68
|
"@vueuse/core": "^10.10.0"
|
|
@@ -106,7 +106,7 @@ const qt = "@tresjs/core", Yt = "module", Jt = "4.0.2", Qt = "pnpm@9.1.4", Kt =
|
|
|
106
106
|
vitest: "^1.6.0",
|
|
107
107
|
vue: "^3.4.27",
|
|
108
108
|
"vue-demi": "^0.14.8"
|
|
109
|
-
},
|
|
109
|
+
}, pr = {
|
|
110
110
|
name: qt,
|
|
111
111
|
type: Yt,
|
|
112
112
|
version: Jt,
|
|
@@ -123,43 +123,43 @@ const qt = "@tresjs/core", Yt = "module", Jt = "4.0.2", Qt = "pnpm@9.1.4", Kt =
|
|
|
123
123
|
files: ir,
|
|
124
124
|
publishConfig: ar,
|
|
125
125
|
scripts: lr,
|
|
126
|
-
peerDependencies:
|
|
127
|
-
dependencies:
|
|
126
|
+
peerDependencies: cr,
|
|
127
|
+
dependencies: ur,
|
|
128
128
|
devDependencies: fr
|
|
129
|
-
},
|
|
129
|
+
}, dr = ({ sizes: e }) => {
|
|
130
130
|
const t = L([]), r = D(
|
|
131
131
|
() => t.value[0]
|
|
132
|
-
), o = (
|
|
133
|
-
const
|
|
134
|
-
if (!
|
|
132
|
+
), o = (i) => {
|
|
133
|
+
const a = i instanceof yt ? i : t.value.find((f) => f.uuid === i);
|
|
134
|
+
if (!a)
|
|
135
135
|
return;
|
|
136
|
-
const n = t.value.filter(({ uuid: f }) => f !==
|
|
137
|
-
t.value = [
|
|
138
|
-
},
|
|
139
|
-
t.value.some(({ uuid: n }) => n ===
|
|
140
|
-
},
|
|
141
|
-
t.value = t.value.filter(({ uuid:
|
|
136
|
+
const n = t.value.filter(({ uuid: f }) => f !== a.uuid);
|
|
137
|
+
t.value = [a, ...n];
|
|
138
|
+
}, s = (i, a = !1) => {
|
|
139
|
+
t.value.some(({ uuid: n }) => n === i.uuid) || (a ? o(i) : t.value.push(i));
|
|
140
|
+
}, c = (i) => {
|
|
141
|
+
t.value = t.value.filter(({ uuid: a }) => a !== i.uuid);
|
|
142
142
|
};
|
|
143
|
-
return
|
|
144
|
-
e.aspectRatio.value && t.value.forEach((
|
|
145
|
-
!
|
|
143
|
+
return ve(() => {
|
|
144
|
+
e.aspectRatio.value && t.value.forEach((i) => {
|
|
145
|
+
!i.manual && (i instanceof pe || mr(i)) && (i instanceof pe ? i.aspect = e.aspectRatio.value : (i.left = e.width.value * -0.5, i.right = e.width.value * 0.5, i.top = e.height.value * 0.5, i.bottom = e.height.value * -0.5), i.updateProjectionMatrix());
|
|
146
146
|
});
|
|
147
147
|
}), N(() => {
|
|
148
148
|
t.value = [];
|
|
149
149
|
}), {
|
|
150
150
|
camera: r,
|
|
151
151
|
cameras: t,
|
|
152
|
-
registerCamera:
|
|
153
|
-
deregisterCamera:
|
|
152
|
+
registerCamera: s,
|
|
153
|
+
deregisterCamera: c,
|
|
154
154
|
setCameraActive: o
|
|
155
155
|
};
|
|
156
156
|
};
|
|
157
157
|
function mr(e) {
|
|
158
158
|
return e.hasOwnProperty("isOrthographicCamera") && e.isOrthographicCamera;
|
|
159
159
|
}
|
|
160
|
-
const Ke =
|
|
160
|
+
const Ke = A(), Xe = A(), ye = A(), V = new Ve();
|
|
161
161
|
let ne = 0, oe = 0;
|
|
162
|
-
const { pause:
|
|
162
|
+
const { pause: gr, resume: Be, isActive: vr } = Qe(
|
|
163
163
|
() => {
|
|
164
164
|
Ke.trigger({ delta: ne, elapsed: oe, clock: V }), Xe.trigger({ delta: ne, elapsed: oe, clock: V }), ye.trigger({ delta: ne, elapsed: oe, clock: V });
|
|
165
165
|
},
|
|
@@ -173,18 +173,18 @@ const fn = () => (je || (je = !0, Be()), {
|
|
|
173
173
|
onBeforeLoop: Ke.on,
|
|
174
174
|
onLoop: Xe.on,
|
|
175
175
|
onAfterLoop: ye.on,
|
|
176
|
-
pause:
|
|
176
|
+
pause: gr,
|
|
177
177
|
resume: Be,
|
|
178
|
-
isActive:
|
|
179
|
-
}),
|
|
180
|
-
function
|
|
178
|
+
isActive: vr
|
|
179
|
+
}), pn = !0, K = "[TresJS ▲ ■ ●] ";
|
|
180
|
+
function $() {
|
|
181
181
|
function e(...o) {
|
|
182
182
|
typeof o[0] == "string" ? o[0] = K + o[0] : o.unshift(K), console.error(...o);
|
|
183
183
|
}
|
|
184
184
|
function t(...o) {
|
|
185
185
|
typeof o[0] == "string" ? o[0] = K + o[0] : o.unshift(K), console.warn(...o);
|
|
186
186
|
}
|
|
187
|
-
function r(o,
|
|
187
|
+
function r(o, s) {
|
|
188
188
|
}
|
|
189
189
|
return {
|
|
190
190
|
logError: e,
|
|
@@ -192,7 +192,7 @@ function U() {
|
|
|
192
192
|
logMessage: r
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function dn(e) {
|
|
196
196
|
return typeof e == "number" ? [e, e, e] : e instanceof he ? [e.x, e.y, e.z] : e;
|
|
197
197
|
}
|
|
198
198
|
function hr(e) {
|
|
@@ -206,15 +206,15 @@ class yr extends Ge.Mesh {
|
|
|
206
206
|
this.createTime = Date.now();
|
|
207
207
|
}
|
|
208
208
|
onBeforeRender() {
|
|
209
|
-
const o = (Date.now() - this.createTime) / 1e3,
|
|
210
|
-
this.scale.set(
|
|
209
|
+
const o = (Date.now() - this.createTime) / 1e3, i = 1 + 0.07 * Math.sin(2.5 * o);
|
|
210
|
+
this.scale.set(i, i, i);
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
const Ze = (e, t) => {
|
|
214
214
|
for (const r of Object.keys(t))
|
|
215
215
|
t[r] instanceof Object && Object.assign(t[r], Ze(e[r], t[r]));
|
|
216
216
|
return Object.assign(e || {}, t), e;
|
|
217
|
-
},
|
|
217
|
+
}, wr = "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", br = /* @__PURE__ */ _r(wr);
|
|
218
218
|
function Re(e) {
|
|
219
219
|
return e && e.nodeType === 1;
|
|
220
220
|
}
|
|
@@ -227,30 +227,30 @@ function Pr(e) {
|
|
|
227
227
|
}
|
|
228
228
|
function _r(e, t) {
|
|
229
229
|
const r = /* @__PURE__ */ Object.create(null), o = e.split(",");
|
|
230
|
-
for (let
|
|
231
|
-
r[o[
|
|
232
|
-
return (
|
|
230
|
+
for (let s = 0; s < o.length; s++)
|
|
231
|
+
r[o[s]] = !0;
|
|
232
|
+
return (s) => !!r[s];
|
|
233
233
|
}
|
|
234
234
|
const Cr = (e, t) => {
|
|
235
235
|
const r = /* @__PURE__ */ new Set(), o = [];
|
|
236
|
-
for (const
|
|
237
|
-
const
|
|
238
|
-
r.has(
|
|
236
|
+
for (const s of e) {
|
|
237
|
+
const c = t(s);
|
|
238
|
+
r.has(c) || (r.add(c), o.push(s));
|
|
239
239
|
}
|
|
240
240
|
return o;
|
|
241
241
|
}, Ie = (e, t) => {
|
|
242
242
|
if (!t)
|
|
243
243
|
return;
|
|
244
244
|
const r = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
|
|
245
|
-
return r == null ? void 0 : r.reduce((o,
|
|
245
|
+
return r == null ? void 0 : r.reduce((o, s) => o && o[s], e);
|
|
246
246
|
}, Er = (e, t, r) => {
|
|
247
247
|
const o = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
|
|
248
|
-
o && o.reduce((
|
|
248
|
+
o && o.reduce((s, c, i) => (s[c] === void 0 && (s[c] = {}), i === o.length - 1 && (s[c] = r), s[c]), e);
|
|
249
249
|
};
|
|
250
250
|
function et(e, t) {
|
|
251
251
|
if (Re(e) && Re(t)) {
|
|
252
|
-
const
|
|
253
|
-
return
|
|
252
|
+
const s = e.attributes, c = t.attributes;
|
|
253
|
+
return s.length !== c.length ? !1 : Array.from(s).every(({ name: i, value: a }) => t.getAttribute(i) === a);
|
|
254
254
|
}
|
|
255
255
|
if (e === t)
|
|
256
256
|
return !0;
|
|
@@ -259,12 +259,12 @@ function et(e, t) {
|
|
|
259
259
|
const r = Object.keys(e), o = Object.keys(t);
|
|
260
260
|
if (r.length !== o.length)
|
|
261
261
|
return !1;
|
|
262
|
-
for (const
|
|
263
|
-
if (!o.includes(
|
|
262
|
+
for (const s of r)
|
|
263
|
+
if (!o.includes(s) || !et(e[s], t[s]))
|
|
264
264
|
return !1;
|
|
265
265
|
return !0;
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function Sr(e, t) {
|
|
268
268
|
if (!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length)
|
|
269
269
|
return !1;
|
|
270
270
|
for (let r = 0; r < e.length; r++)
|
|
@@ -272,33 +272,33 @@ function kr(e, t) {
|
|
|
272
272
|
return !1;
|
|
273
273
|
return !0;
|
|
274
274
|
}
|
|
275
|
-
const
|
|
275
|
+
const Tr = Array.isArray;
|
|
276
276
|
function xr(e, t, r, o) {
|
|
277
|
-
const
|
|
277
|
+
const s = (n) => {
|
|
278
278
|
if (n.uuid === t)
|
|
279
279
|
return n;
|
|
280
280
|
for (const f of n.children) {
|
|
281
|
-
const h =
|
|
281
|
+
const h = s(f);
|
|
282
282
|
if (h)
|
|
283
283
|
return h;
|
|
284
284
|
}
|
|
285
|
-
},
|
|
286
|
-
if (!
|
|
285
|
+
}, c = s(e);
|
|
286
|
+
if (!c) {
|
|
287
287
|
console.warn("Object with UUID not found in the scene.");
|
|
288
288
|
return;
|
|
289
289
|
}
|
|
290
|
-
let
|
|
290
|
+
let i = c;
|
|
291
291
|
for (let n = 0; n < r.length - 1; n++)
|
|
292
|
-
if (
|
|
293
|
-
|
|
292
|
+
if (i[r[n]] !== void 0)
|
|
293
|
+
i = i[r[n]];
|
|
294
294
|
else {
|
|
295
295
|
console.warn(`Property path is not valid: ${r.join(".")}`);
|
|
296
296
|
return;
|
|
297
297
|
}
|
|
298
|
-
const
|
|
299
|
-
a
|
|
298
|
+
const a = r[r.length - 1];
|
|
299
|
+
i[a] !== void 0 ? i[a] = o : console.warn(`Property path is not valid: ${r.join(".")}`);
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function kr(e) {
|
|
302
302
|
const t = new Ye({
|
|
303
303
|
color: 11003607,
|
|
304
304
|
// Highlight color, e.g., yellow
|
|
@@ -306,30 +306,30 @@ function Tr(e) {
|
|
|
306
306
|
opacity: 0.2,
|
|
307
307
|
depthTest: !1,
|
|
308
308
|
// So the highlight is always visible
|
|
309
|
-
side:
|
|
309
|
+
side: wt
|
|
310
310
|
// To e
|
|
311
311
|
});
|
|
312
312
|
return new yr(e.geometry.clone(), t);
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function Or(e) {
|
|
315
315
|
var r;
|
|
316
316
|
let t = e.value;
|
|
317
317
|
return e.value && ((r = e.value) != null && r.isMesh) && (t = e.value.position), Array.isArray(e.value) && (t = new he(...t)), t;
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function Ar(e) {
|
|
320
320
|
return "map" in e;
|
|
321
321
|
}
|
|
322
322
|
function He(e) {
|
|
323
|
-
|
|
323
|
+
Ar(e) && e.map && e.map.dispose(), e.dispose();
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function we(e) {
|
|
326
326
|
var r, o;
|
|
327
|
-
if (e.parent && ((r = e.removeFromParent) == null || r.call(e)), delete e.__tres, [...e.children].forEach((
|
|
328
|
-
const
|
|
329
|
-
e && ((o = e.dispose) == null || o.call(e)),
|
|
327
|
+
if (e.parent && ((r = e.removeFromParent) == null || r.call(e)), delete e.__tres, [...e.children].forEach((s) => we(s)), !(e instanceof qe)) {
|
|
328
|
+
const s = e;
|
|
329
|
+
e && ((o = e.dispose) == null || o.call(e)), s.geometry && (s.geometry.dispose(), delete s.geometry), Array.isArray(s.material) ? (s.material.forEach((c) => He(c)), delete s.material) : s.material && (He(s.material), delete s.material);
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
|
-
const Lr = Number.parseInt(
|
|
332
|
+
const Lr = Number.parseInt(bt.replace("dev", "")), Z = {
|
|
333
333
|
realistic: {
|
|
334
334
|
shadows: !0,
|
|
335
335
|
physicallyCorrectLights: !0,
|
|
@@ -349,73 +349,73 @@ const Lr = Number.parseInt(wt.replace("dev", "")), Z = {
|
|
|
349
349
|
function Dr({
|
|
350
350
|
canvas: e,
|
|
351
351
|
options: t,
|
|
352
|
-
contextParts: { sizes: r, render: o, invalidate:
|
|
352
|
+
contextParts: { sizes: r, render: o, invalidate: s, advance: c }
|
|
353
353
|
}) {
|
|
354
|
-
const
|
|
355
|
-
alpha:
|
|
356
|
-
depth:
|
|
354
|
+
const i = D(() => ({
|
|
355
|
+
alpha: T(t.alpha) ?? !0,
|
|
356
|
+
depth: T(t.depth),
|
|
357
357
|
canvas: Ht(e),
|
|
358
|
-
context:
|
|
359
|
-
stencil:
|
|
360
|
-
antialias:
|
|
361
|
-
precision:
|
|
362
|
-
powerPreference:
|
|
363
|
-
premultipliedAlpha:
|
|
364
|
-
preserveDrawingBuffer:
|
|
365
|
-
logarithmicDepthBuffer:
|
|
366
|
-
failIfMajorPerformanceCaveat:
|
|
367
|
-
})),
|
|
358
|
+
context: T(t.context),
|
|
359
|
+
stencil: T(t.stencil),
|
|
360
|
+
antialias: T(t.antialias) ?? !0,
|
|
361
|
+
precision: T(t.precision),
|
|
362
|
+
powerPreference: T(t.powerPreference),
|
|
363
|
+
premultipliedAlpha: T(t.premultipliedAlpha),
|
|
364
|
+
preserveDrawingBuffer: T(t.preserveDrawingBuffer),
|
|
365
|
+
logarithmicDepthBuffer: T(t.logarithmicDepthBuffer),
|
|
366
|
+
failIfMajorPerformanceCaveat: T(t.failIfMajorPerformanceCaveat)
|
|
367
|
+
})), a = H(new ae(i.value));
|
|
368
368
|
function n() {
|
|
369
|
-
t.renderMode === "on-demand" &&
|
|
369
|
+
t.renderMode === "on-demand" && s();
|
|
370
370
|
}
|
|
371
|
-
G(
|
|
372
|
-
|
|
371
|
+
G(i, () => {
|
|
372
|
+
a.value.dispose(), a.value = new ae(i.value), n();
|
|
373
373
|
}), G([r.width, r.height], () => {
|
|
374
|
-
|
|
374
|
+
a.value.setSize(r.width.value, r.height.value), n();
|
|
375
375
|
}, {
|
|
376
376
|
immediate: !0
|
|
377
377
|
}), G(() => t.clearColor, n);
|
|
378
|
-
const { pixelRatio: f } =
|
|
378
|
+
const { pixelRatio: f } = $t();
|
|
379
379
|
G(f, () => {
|
|
380
|
-
|
|
380
|
+
a.value.setPixelRatio(f.value);
|
|
381
381
|
});
|
|
382
|
-
const { logError: h } =
|
|
383
|
-
const
|
|
382
|
+
const { logError: h } = $(), w = (() => {
|
|
383
|
+
const p = new ae(), P = {
|
|
384
384
|
shadowMap: {
|
|
385
|
-
enabled:
|
|
386
|
-
type:
|
|
385
|
+
enabled: p.shadowMap.enabled,
|
|
386
|
+
type: p.shadowMap.type
|
|
387
387
|
},
|
|
388
|
-
toneMapping:
|
|
389
|
-
toneMappingExposure:
|
|
390
|
-
outputColorSpace:
|
|
388
|
+
toneMapping: p.toneMapping,
|
|
389
|
+
toneMappingExposure: p.toneMappingExposure,
|
|
390
|
+
outputColorSpace: p.outputColorSpace
|
|
391
391
|
};
|
|
392
|
-
return
|
|
393
|
-
})(),
|
|
394
|
-
return
|
|
395
|
-
|
|
396
|
-
}, 100),
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
const P = (
|
|
400
|
-
const _ =
|
|
401
|
-
if (
|
|
402
|
-
return Ie(Z[
|
|
392
|
+
return p.dispose(), P;
|
|
393
|
+
})(), b = T(t.renderMode);
|
|
394
|
+
return b === "on-demand" && s(), b === "manual" && setTimeout(() => {
|
|
395
|
+
c();
|
|
396
|
+
}, 100), ve(() => {
|
|
397
|
+
const p = T(t.preset);
|
|
398
|
+
p && (p in Z || h(`Renderer Preset must be one of these: ${Object.keys(Z).join(", ")}`), Ze(a.value, Z[p])), b === "always" && (o.frames.value = Math.max(1, o.frames.value));
|
|
399
|
+
const P = (d, M) => {
|
|
400
|
+
const _ = T(d), u = () => {
|
|
401
|
+
if (p)
|
|
402
|
+
return Ie(Z[p], M);
|
|
403
403
|
};
|
|
404
404
|
if (_ !== void 0)
|
|
405
405
|
return _;
|
|
406
|
-
const
|
|
407
|
-
return
|
|
408
|
-
}, y = (
|
|
406
|
+
const v = u();
|
|
407
|
+
return v !== void 0 ? v : Ie(w, M);
|
|
408
|
+
}, y = (d, M) => Er(a.value, M, P(d, M));
|
|
409
409
|
y(t.shadows, "shadowMap.enabled"), y(t.toneMapping ?? Je, "toneMapping"), y(t.shadowMapType, "shadowMap.type"), Lr < 150 && y(!t.useLegacyLights, "physicallyCorrectLights"), y(t.outputColorSpace, "outputColorSpace"), y(t.toneMappingExposure, "toneMappingExposure");
|
|
410
|
-
const
|
|
411
|
-
|
|
412
|
-
|
|
410
|
+
const g = P(t.clearColor, "clearColor");
|
|
411
|
+
g && a.value.setClearColor(
|
|
412
|
+
g ? hr(g) : new re(0)
|
|
413
413
|
// default clear color is not easily/efficiently retrievable from three
|
|
414
414
|
);
|
|
415
415
|
}), N(() => {
|
|
416
|
-
|
|
416
|
+
a.value.dispose(), a.value.forceContextLoss();
|
|
417
417
|
}), {
|
|
418
|
-
renderer:
|
|
418
|
+
renderer: a
|
|
419
419
|
};
|
|
420
420
|
}
|
|
421
421
|
const ee = (e) => typeof e == "function", Br = (e) => !!e && e.constructor === Array;
|
|
@@ -425,53 +425,53 @@ function jr(e) {
|
|
|
425
425
|
r.name && (t.nodes[r.name] = r), r.material && !t.materials[r.material.name] && (t.materials[r.material.name] = r.material);
|
|
426
426
|
}), t;
|
|
427
427
|
}
|
|
428
|
-
async function mn(e, t, r, o,
|
|
429
|
-
const { logError:
|
|
430
|
-
|
|
428
|
+
async function mn(e, t, r, o, s) {
|
|
429
|
+
const { logError: c } = $(), i = new e();
|
|
430
|
+
s && s(i), r && r(i);
|
|
431
431
|
const n = (Array.isArray(t) ? t : [t]).map(
|
|
432
432
|
(f) => new Promise((h, l) => {
|
|
433
|
-
|
|
433
|
+
i.load(
|
|
434
434
|
f,
|
|
435
|
-
(
|
|
436
|
-
|
|
435
|
+
(w) => {
|
|
436
|
+
w.scene && Object.assign(w, jr(w.scene)), h(w);
|
|
437
437
|
},
|
|
438
438
|
o,
|
|
439
|
-
(
|
|
439
|
+
(w) => l(c("[useLoader] - Failed to load resource", w))
|
|
440
440
|
);
|
|
441
441
|
})
|
|
442
442
|
);
|
|
443
443
|
return Br(t) ? await Promise.all(n) : await n[0];
|
|
444
444
|
}
|
|
445
|
-
async function
|
|
446
|
-
const r = new Ct(t), o = (
|
|
445
|
+
async function gn(e, t) {
|
|
446
|
+
const r = new Ct(t), o = (s) => new Promise((c, i) => {
|
|
447
447
|
r.load(
|
|
448
|
-
|
|
449
|
-
(
|
|
448
|
+
s,
|
|
449
|
+
(a) => c(a),
|
|
450
450
|
() => null,
|
|
451
451
|
() => {
|
|
452
|
-
|
|
452
|
+
i(new Error("[useTextures] - Failed to load texture"));
|
|
453
453
|
}
|
|
454
454
|
);
|
|
455
455
|
});
|
|
456
|
-
if (
|
|
457
|
-
const
|
|
458
|
-
return e.length > 1 ?
|
|
456
|
+
if (Tr(e)) {
|
|
457
|
+
const s = await Promise.all(e.map((c) => o(c)));
|
|
458
|
+
return e.length > 1 ? s : s[0];
|
|
459
459
|
} else {
|
|
460
460
|
const {
|
|
461
|
-
map:
|
|
462
|
-
displacementMap:
|
|
463
|
-
normalMap:
|
|
464
|
-
roughnessMap:
|
|
461
|
+
map: s,
|
|
462
|
+
displacementMap: c,
|
|
463
|
+
normalMap: i,
|
|
464
|
+
roughnessMap: a,
|
|
465
465
|
metalnessMap: n,
|
|
466
466
|
aoMap: f,
|
|
467
467
|
alphaMap: h,
|
|
468
468
|
matcap: l
|
|
469
469
|
} = e;
|
|
470
470
|
return {
|
|
471
|
-
map:
|
|
472
|
-
displacementMap:
|
|
473
|
-
normalMap:
|
|
474
|
-
roughnessMap:
|
|
471
|
+
map: s ? await o(s) : null,
|
|
472
|
+
displacementMap: c ? await o(c) : null,
|
|
473
|
+
normalMap: i ? await o(i) : null,
|
|
474
|
+
roughnessMap: a ? await o(a) : null,
|
|
475
475
|
metalnessMap: n ? await o(n) : null,
|
|
476
476
|
aoMap: f ? await o(f) : null,
|
|
477
477
|
alphaMap: h ? await o(h) : null,
|
|
@@ -480,112 +480,112 @@ async function vn(e, t) {
|
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
const tt = (e, t) => {
|
|
483
|
-
const r = D(() => t.renderer.value.domElement), o = H([]), { x:
|
|
483
|
+
const r = D(() => t.renderer.value.domElement), o = H([]), { x: s, y: c } = Ft({ target: r }), i = D(() => e.value.filter((m) => {
|
|
484
484
|
var C;
|
|
485
485
|
return ((C = m.__tres) == null ? void 0 : C.eventCount) > 0;
|
|
486
486
|
}));
|
|
487
|
-
let
|
|
488
|
-
const { width: n, height: f, top: h, left: l } =
|
|
487
|
+
let a = 0;
|
|
488
|
+
const { width: n, height: f, top: h, left: l } = Ut(r), w = ({ x: m, y: C }) => {
|
|
489
489
|
if (r.value)
|
|
490
490
|
return {
|
|
491
491
|
x: (m - l.value) / n.value * 2 - 1,
|
|
492
492
|
y: -((C - h.value) / f.value) * 2 + 1
|
|
493
493
|
};
|
|
494
|
-
},
|
|
494
|
+
}, b = ({ x: m, y: C }) => {
|
|
495
495
|
if (t.camera.value)
|
|
496
|
-
return t.raycaster.value.setFromCamera(new le(m, C), t.camera.value), o.value = t.raycaster.value.intersectObjects(
|
|
497
|
-
},
|
|
498
|
-
const C =
|
|
499
|
-
x: (m == null ? void 0 : m.clientX) ??
|
|
500
|
-
y: (m == null ? void 0 : m.clientY) ??
|
|
496
|
+
return t.raycaster.value.setFromCamera(new le(m, C), t.camera.value), o.value = t.raycaster.value.intersectObjects(i.value, !0), o.value;
|
|
497
|
+
}, p = (m) => {
|
|
498
|
+
const C = w({
|
|
499
|
+
x: (m == null ? void 0 : m.clientX) ?? s.value,
|
|
500
|
+
y: (m == null ? void 0 : m.clientY) ?? c.value
|
|
501
501
|
});
|
|
502
|
-
return C ?
|
|
503
|
-
}, P =
|
|
502
|
+
return C ? b(C) || [] : [];
|
|
503
|
+
}, P = A(), y = A(), g = A(), d = A(), M = A(), _ = A(), u = A(), v = A();
|
|
504
504
|
function E(m) {
|
|
505
505
|
const C = {};
|
|
506
506
|
for (const R in m)
|
|
507
507
|
typeof R != "function" && (C[R] = m[R]);
|
|
508
508
|
return C;
|
|
509
509
|
}
|
|
510
|
-
const
|
|
511
|
-
var Ee,
|
|
510
|
+
const S = (m, C) => {
|
|
511
|
+
var Ee, Se, Te;
|
|
512
512
|
const R = E(C), Q = new he(C == null ? void 0 : C.clientX, C == null ? void 0 : C.clientY, 0).unproject((Ee = t.camera) == null ? void 0 : Ee.value);
|
|
513
513
|
m.trigger({
|
|
514
514
|
...R,
|
|
515
515
|
intersections: o.value,
|
|
516
516
|
// The unprojectedPoint is wrong, math needs to be fixed
|
|
517
517
|
unprojectedPoint: Q,
|
|
518
|
-
ray: (
|
|
519
|
-
camera: (
|
|
518
|
+
ray: (Se = t.raycaster) == null ? void 0 : Se.value.ray,
|
|
519
|
+
camera: (Te = t.camera) == null ? void 0 : Te.value,
|
|
520
520
|
sourceEvent: C,
|
|
521
|
-
delta:
|
|
521
|
+
delta: a,
|
|
522
522
|
stopPropagating: !1
|
|
523
523
|
});
|
|
524
524
|
};
|
|
525
525
|
let B;
|
|
526
526
|
const x = (m) => {
|
|
527
|
-
|
|
528
|
-
},
|
|
527
|
+
p(m), S(g, m), B = m;
|
|
528
|
+
}, k = () => {
|
|
529
529
|
B && x(B);
|
|
530
530
|
};
|
|
531
|
-
let
|
|
531
|
+
let F, O, q;
|
|
532
532
|
const Y = (m) => {
|
|
533
533
|
var C;
|
|
534
|
-
|
|
535
|
-
(m == null ? void 0 : m.clientX) ??
|
|
536
|
-
(m == null ? void 0 : m.clientY) ??
|
|
537
|
-
),
|
|
534
|
+
F = (C = o.value[0]) == null ? void 0 : C.object, a = 0, O = new le(
|
|
535
|
+
(m == null ? void 0 : m.clientX) ?? s.value,
|
|
536
|
+
(m == null ? void 0 : m.clientY) ?? c.value
|
|
537
|
+
), S(M, m);
|
|
538
538
|
};
|
|
539
539
|
let se, J = !1;
|
|
540
540
|
const Me = (m) => {
|
|
541
541
|
var C, R, Q;
|
|
542
|
-
m instanceof PointerEvent && (o.value.length === 0 &&
|
|
543
|
-
(m == null ? void 0 : m.clientX) ??
|
|
544
|
-
(m == null ? void 0 : m.clientY) ??
|
|
545
|
-
),
|
|
542
|
+
m instanceof PointerEvent && (o.value.length === 0 && S(_, m), F === ((C = o.value[0]) == null ? void 0 : C.object) && (q = new le(
|
|
543
|
+
(m == null ? void 0 : m.clientX) ?? s.value,
|
|
544
|
+
(m == null ? void 0 : m.clientY) ?? c.value
|
|
545
|
+
), a = O == null ? void 0 : O.distanceTo(q), m.button === 0 ? (S(P, m), se === ((R = o.value[0]) == null ? void 0 : R.object) ? J = !0 : (se = (Q = o.value[0]) == null ? void 0 : Q.object, J = !1)) : m.button === 2 && S(u, m)), S(d, m));
|
|
546
546
|
}, Pe = (m) => {
|
|
547
|
-
J && (
|
|
548
|
-
}, _e = (m) =>
|
|
547
|
+
J && (S(y, m), se = void 0, J = !1);
|
|
548
|
+
}, _e = (m) => S(g, m), Ce = (m) => S(v, m);
|
|
549
549
|
return r.value.addEventListener("pointerup", Me), r.value.addEventListener("pointerdown", Y), r.value.addEventListener("pointermove", x), r.value.addEventListener("pointerleave", _e), r.value.addEventListener("dblclick", Pe), r.value.addEventListener("wheel", Ce), N(() => {
|
|
550
550
|
r != null && r.value && (r.value.removeEventListener("pointerup", Me), r.value.removeEventListener("pointerdown", Y), r.value.removeEventListener("pointermove", x), r.value.removeEventListener("pointerleave", _e), r.value.removeEventListener("dblclick", Pe), r.value.removeEventListener("wheel", Ce));
|
|
551
551
|
}), {
|
|
552
552
|
intersects: o,
|
|
553
553
|
onClick: (m) => P.on(m).off,
|
|
554
554
|
onDblClick: (m) => y.on(m).off,
|
|
555
|
-
onContextMenu: (m) =>
|
|
556
|
-
onPointerMove: (m) =>
|
|
557
|
-
onPointerUp: (m) =>
|
|
555
|
+
onContextMenu: (m) => u.on(m).off,
|
|
556
|
+
onPointerMove: (m) => g.on(m).off,
|
|
557
|
+
onPointerUp: (m) => d.on(m).off,
|
|
558
558
|
onPointerDown: (m) => M.on(m).off,
|
|
559
559
|
onPointerMissed: (m) => _.on(m).off,
|
|
560
|
-
onWheel: (m) =>
|
|
561
|
-
forceUpdate:
|
|
560
|
+
onWheel: (m) => v.on(m).off,
|
|
561
|
+
forceUpdate: k
|
|
562
562
|
};
|
|
563
563
|
};
|
|
564
|
-
function
|
|
565
|
-
const { logWarning: e } =
|
|
566
|
-
function t(
|
|
564
|
+
function vn() {
|
|
565
|
+
const { logWarning: e } = $();
|
|
566
|
+
function t(c, i, a) {
|
|
567
567
|
let n = null;
|
|
568
|
-
return
|
|
569
|
-
f[
|
|
570
|
-
}), n || e(`Child with ${
|
|
568
|
+
return c.traverse((f) => {
|
|
569
|
+
f[i] === a && (n = f);
|
|
570
|
+
}), n || e(`Child with ${i} '${a}' not found.`), n;
|
|
571
571
|
}
|
|
572
|
-
function r(
|
|
572
|
+
function r(c, i, a) {
|
|
573
573
|
const n = [];
|
|
574
|
-
return
|
|
575
|
-
f[
|
|
576
|
-
}), n.length || e(`Children with ${
|
|
574
|
+
return c.traverse((f) => {
|
|
575
|
+
f[i].includes(a) && n.push(f);
|
|
576
|
+
}), n.length || e(`Children with ${i} '${a}' not found.`), n;
|
|
577
577
|
}
|
|
578
|
-
function o(
|
|
579
|
-
return t(
|
|
578
|
+
function o(c, i) {
|
|
579
|
+
return t(c, "name", i);
|
|
580
580
|
}
|
|
581
|
-
function
|
|
582
|
-
return r(
|
|
581
|
+
function s(c, i) {
|
|
582
|
+
return r(c, "name", i);
|
|
583
583
|
}
|
|
584
584
|
return {
|
|
585
585
|
seek: t,
|
|
586
586
|
seekByName: o,
|
|
587
587
|
seekAll: r,
|
|
588
|
-
seekAllByName:
|
|
588
|
+
seekAllByName: s
|
|
589
589
|
};
|
|
590
590
|
}
|
|
591
591
|
const hn = (e) => {
|
|
@@ -596,14 +596,14 @@ const hn = (e) => {
|
|
|
596
596
|
pointerLeave: /* @__PURE__ */ new Map()
|
|
597
597
|
}), r = L(/* @__PURE__ */ new Set()), o = (l) => {
|
|
598
598
|
r.value.add(l);
|
|
599
|
-
},
|
|
599
|
+
}, s = (l) => {
|
|
600
600
|
r.value.delete(l);
|
|
601
|
-
},
|
|
602
|
-
Object.values(t).forEach((
|
|
603
|
-
},
|
|
604
|
-
const { onClick:
|
|
605
|
-
|
|
606
|
-
},
|
|
601
|
+
}, c = (l) => {
|
|
602
|
+
Object.values(t).forEach((w) => w.delete(l)), s(l);
|
|
603
|
+
}, i = (l) => {
|
|
604
|
+
const { onClick: w, onPointerMove: b, onPointerEnter: p, onPointerLeave: P } = l;
|
|
605
|
+
w && t.click.set(l, w), b && t.pointerMove.set(l, b), p && t.pointerEnter.set(l, p), P && t.pointerLeave.set(l, P);
|
|
606
|
+
}, a = D(
|
|
607
607
|
() => Cr(
|
|
608
608
|
[
|
|
609
609
|
...Array.from(r.value),
|
|
@@ -612,29 +612,29 @@ const hn = (e) => {
|
|
|
612
612
|
({ uuid: l }) => l
|
|
613
613
|
)
|
|
614
614
|
);
|
|
615
|
-
e.registerObjectAtPointerEventHandler =
|
|
616
|
-
const { onClick: n, onPointerMove: f } = tt(
|
|
617
|
-
n(({ intersects: l, event:
|
|
618
|
-
var
|
|
619
|
-
l.length && ((
|
|
615
|
+
e.registerObjectAtPointerEventHandler = i, e.deregisterObjectAtPointerEventHandler = c, e.registerBlockingObjectAtPointerEventHandler = o, e.deregisterBlockingObjectAtPointerEventHandler = s;
|
|
616
|
+
const { onClick: n, onPointerMove: f } = tt(a, e);
|
|
617
|
+
n(({ intersects: l, event: w }) => {
|
|
618
|
+
var b;
|
|
619
|
+
l.length && ((b = t.click.get(l[0].object)) == null || b(l[0], w));
|
|
620
620
|
});
|
|
621
621
|
let h;
|
|
622
|
-
return f(({ intersects: l, event:
|
|
623
|
-
var
|
|
624
|
-
const
|
|
625
|
-
h && h !==
|
|
622
|
+
return f(({ intersects: l, event: w }) => {
|
|
623
|
+
var g, d, M, _;
|
|
624
|
+
const b = (g = l == null ? void 0 : l[0]) == null ? void 0 : g.object, { pointerLeave: p, pointerEnter: P, pointerMove: y } = t;
|
|
625
|
+
h && h !== b && ((d = p.get(h)) == null || d(h, w)), b && (h !== b && ((M = P.get(b)) == null || M(l[0], w)), (_ = y.get(b)) == null || _(l[0], w)), h = b || null;
|
|
626
626
|
}), {
|
|
627
|
-
registerObject:
|
|
628
|
-
deregisterObject:
|
|
627
|
+
registerObject: i,
|
|
628
|
+
deregisterObject: c,
|
|
629
629
|
registerBlockingObject: o,
|
|
630
|
-
deregisterBlockingObject:
|
|
630
|
+
deregisterBlockingObject: s
|
|
631
631
|
};
|
|
632
632
|
};
|
|
633
|
-
function
|
|
633
|
+
function be(e) {
|
|
634
634
|
let t = 0;
|
|
635
635
|
return e.traverse((r) => {
|
|
636
636
|
if (r.isMesh && r.geometry) {
|
|
637
|
-
const o = r.geometry,
|
|
637
|
+
const o = r.geometry, s = o.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, c = o.index ? o.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, i = o.attributes.normal ? o.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, a = o.attributes.uv ? o.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, n = s + c + i + a;
|
|
638
638
|
t += n;
|
|
639
639
|
}
|
|
640
640
|
}), t;
|
|
@@ -642,35 +642,35 @@ function we(e) {
|
|
|
642
642
|
function Rr(e) {
|
|
643
643
|
return (e / 1024).toFixed(2);
|
|
644
644
|
}
|
|
645
|
-
const
|
|
645
|
+
const de = L({}), me = (e) => Object.assign(de.value, e);
|
|
646
646
|
function Ir(e, t, r = 10) {
|
|
647
|
-
const o =
|
|
647
|
+
const o = T(e) ? Wt() : Nt(D(() => T(t).parentElement)), s = ue(De(o.width, r)), c = ue(De(o.height, r)), i = D(() => s.value / c.value);
|
|
648
648
|
return {
|
|
649
|
-
height:
|
|
650
|
-
width:
|
|
651
|
-
aspectRatio:
|
|
649
|
+
height: c,
|
|
650
|
+
width: s,
|
|
651
|
+
aspectRatio: i
|
|
652
652
|
};
|
|
653
653
|
}
|
|
654
|
-
function
|
|
654
|
+
function ce() {
|
|
655
655
|
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
|
|
656
656
|
let r = 0, o = !1;
|
|
657
|
-
const
|
|
657
|
+
const s = () => {
|
|
658
658
|
const f = Array.from(e.entries()).sort((h, l) => {
|
|
659
|
-
const
|
|
660
|
-
return
|
|
659
|
+
const w = h[1].priority - l[1].priority;
|
|
660
|
+
return w === 0 ? h[1].addI - l[1].addI : w;
|
|
661
661
|
});
|
|
662
662
|
t.clear(), f.forEach((h) => t.add(h[0]));
|
|
663
|
-
},
|
|
663
|
+
}, c = (f) => {
|
|
664
664
|
e.delete(f), t.delete(f);
|
|
665
665
|
};
|
|
666
666
|
return { on: (f, h = 0) => {
|
|
667
667
|
e.set(f, { priority: h, addI: r++ });
|
|
668
|
-
const l = () =>
|
|
668
|
+
const l = () => c(f);
|
|
669
669
|
return zt(l), o = !0, {
|
|
670
670
|
off: l
|
|
671
671
|
};
|
|
672
|
-
}, off:
|
|
673
|
-
o && (
|
|
672
|
+
}, off: c, trigger: (...f) => {
|
|
673
|
+
o && (s(), o = !1), t.forEach((h) => h(...f));
|
|
674
674
|
}, dispose: () => {
|
|
675
675
|
e.clear(), t.clear();
|
|
676
676
|
}, get count() {
|
|
@@ -680,30 +680,30 @@ function ue() {
|
|
|
680
680
|
function Hr() {
|
|
681
681
|
const e = new Ve(!1), t = L(!1), r = L(!1);
|
|
682
682
|
let o;
|
|
683
|
-
const
|
|
684
|
-
let
|
|
685
|
-
const
|
|
683
|
+
const s = Et.generateUUID();
|
|
684
|
+
let c = null;
|
|
685
|
+
const i = ce(), a = ce(), n = ce();
|
|
686
686
|
let f = {};
|
|
687
687
|
function h(M) {
|
|
688
688
|
f = M;
|
|
689
689
|
}
|
|
690
|
-
function l(M, _,
|
|
690
|
+
function l(M, _, u = 0) {
|
|
691
691
|
switch (_) {
|
|
692
692
|
case "before":
|
|
693
|
-
return
|
|
693
|
+
return i.on(M, u);
|
|
694
694
|
case "render":
|
|
695
|
-
return
|
|
695
|
+
return c || (c = M), a.dispose(), a.on(M);
|
|
696
696
|
case "after":
|
|
697
|
-
return n.on(M,
|
|
697
|
+
return n.on(M, u);
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
|
-
function b() {
|
|
701
|
-
t.value || (e.start(), t.value = !0, p());
|
|
702
|
-
}
|
|
703
700
|
function w() {
|
|
701
|
+
t.value || (e.start(), t.value = !0, d());
|
|
702
|
+
}
|
|
703
|
+
function b() {
|
|
704
704
|
t.value && (e.stop(), cancelAnimationFrame(o), t.value = !1);
|
|
705
705
|
}
|
|
706
|
-
function
|
|
706
|
+
function p() {
|
|
707
707
|
e.stop(), t.value = !1;
|
|
708
708
|
}
|
|
709
709
|
function P() {
|
|
@@ -712,11 +712,11 @@ function Hr() {
|
|
|
712
712
|
function y() {
|
|
713
713
|
r.value = !0;
|
|
714
714
|
}
|
|
715
|
-
function
|
|
715
|
+
function g() {
|
|
716
716
|
r.value = !1;
|
|
717
717
|
}
|
|
718
|
-
function
|
|
719
|
-
const M = e.getDelta(), _ = e.getElapsedTime(),
|
|
718
|
+
function d() {
|
|
719
|
+
const M = e.getDelta(), _ = e.getElapsedTime(), u = {
|
|
720
720
|
camera: W(f.camera),
|
|
721
721
|
scene: W(f.scene),
|
|
722
722
|
renderer: W(f.renderer),
|
|
@@ -724,67 +724,67 @@ function Hr() {
|
|
|
724
724
|
controls: W(f.controls),
|
|
725
725
|
invalidate: f.invalidate,
|
|
726
726
|
advance: f.advance
|
|
727
|
-
},
|
|
728
|
-
t.value &&
|
|
727
|
+
}, v = { delta: M, elapsed: _, clock: e, ...u };
|
|
728
|
+
t.value && i.trigger(v), r.value || (a.count ? a.trigger(v) : c && c(v)), t.value && n.trigger(v), o = requestAnimationFrame(d);
|
|
729
729
|
}
|
|
730
730
|
return {
|
|
731
|
-
loopId:
|
|
732
|
-
register: (M, _,
|
|
733
|
-
start:
|
|
734
|
-
stop:
|
|
735
|
-
pause:
|
|
731
|
+
loopId: s,
|
|
732
|
+
register: (M, _, u) => l(M, _, u),
|
|
733
|
+
start: w,
|
|
734
|
+
stop: b,
|
|
735
|
+
pause: p,
|
|
736
736
|
resume: P,
|
|
737
737
|
pauseRender: y,
|
|
738
|
-
resumeRender:
|
|
738
|
+
resumeRender: g,
|
|
739
739
|
isRenderPaused: r,
|
|
740
740
|
isActive: t,
|
|
741
741
|
setContext: h
|
|
742
742
|
};
|
|
743
743
|
}
|
|
744
|
-
function
|
|
744
|
+
function $r({
|
|
745
745
|
scene: e,
|
|
746
746
|
canvas: t,
|
|
747
747
|
windowSize: r,
|
|
748
748
|
disableRender: o,
|
|
749
|
-
rendererOptions:
|
|
750
|
-
emit:
|
|
749
|
+
rendererOptions: s,
|
|
750
|
+
emit: c
|
|
751
751
|
}) {
|
|
752
|
-
const { logWarning:
|
|
752
|
+
const { logWarning: i } = $(), a = H(e), n = Ir(r, t), {
|
|
753
753
|
camera: f,
|
|
754
754
|
cameras: h,
|
|
755
755
|
registerCamera: l,
|
|
756
|
-
deregisterCamera:
|
|
757
|
-
setCameraActive:
|
|
758
|
-
} =
|
|
759
|
-
mode: L(
|
|
756
|
+
deregisterCamera: w,
|
|
757
|
+
setCameraActive: b
|
|
758
|
+
} = dr({ sizes: n, scene: e }), p = {
|
|
759
|
+
mode: L(s.renderMode || "always"),
|
|
760
760
|
priority: L(0),
|
|
761
761
|
frames: L(0),
|
|
762
762
|
maxFrames: 60,
|
|
763
|
-
canBeInvalidated: D(() =>
|
|
763
|
+
canBeInvalidated: D(() => p.mode.value === "on-demand" && p.frames.value === 0)
|
|
764
764
|
};
|
|
765
|
-
function P(
|
|
766
|
-
|
|
765
|
+
function P(O = 1) {
|
|
766
|
+
s.renderMode === "on-demand" ? p.frames.value = Math.min(p.maxFrames, p.frames.value + O) : i("`invalidate` can only be used when `renderMode` is set to `on-demand`");
|
|
767
767
|
}
|
|
768
768
|
function y() {
|
|
769
|
-
|
|
769
|
+
s.renderMode === "manual" ? p.frames.value = 1 : i("`advance` can only be used when `renderMode` is set to `manual`");
|
|
770
770
|
}
|
|
771
|
-
const { renderer:
|
|
771
|
+
const { renderer: g } = Dr(
|
|
772
772
|
{
|
|
773
773
|
scene: e,
|
|
774
774
|
canvas: t,
|
|
775
|
-
options:
|
|
776
|
-
emit:
|
|
775
|
+
options: s,
|
|
776
|
+
emit: c,
|
|
777
777
|
// TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
|
|
778
|
-
contextParts: { sizes: n, camera: f, render:
|
|
778
|
+
contextParts: { sizes: n, camera: f, render: p, invalidate: P, advance: y },
|
|
779
779
|
disableRender: o
|
|
780
780
|
}
|
|
781
|
-
),
|
|
781
|
+
), d = {
|
|
782
782
|
sizes: n,
|
|
783
|
-
scene:
|
|
783
|
+
scene: a,
|
|
784
784
|
camera: f,
|
|
785
|
-
cameras:
|
|
786
|
-
renderer:
|
|
787
|
-
raycaster: H(new
|
|
785
|
+
cameras: ue(h),
|
|
786
|
+
renderer: g,
|
|
787
|
+
raycaster: H(new St()),
|
|
788
788
|
controls: L(null),
|
|
789
789
|
perf: {
|
|
790
790
|
maxFrames: 160,
|
|
@@ -798,70 +798,70 @@ function Ur({
|
|
|
798
798
|
accumulator: []
|
|
799
799
|
}
|
|
800
800
|
},
|
|
801
|
-
render:
|
|
801
|
+
render: p,
|
|
802
802
|
advance: y,
|
|
803
803
|
extend: me,
|
|
804
804
|
invalidate: P,
|
|
805
805
|
registerCamera: l,
|
|
806
|
-
setCameraActive:
|
|
807
|
-
deregisterCamera:
|
|
806
|
+
setCameraActive: b,
|
|
807
|
+
deregisterCamera: w,
|
|
808
808
|
loop: Hr()
|
|
809
809
|
};
|
|
810
|
-
fe("useTres",
|
|
811
|
-
root:
|
|
812
|
-
},
|
|
813
|
-
f.value &&
|
|
814
|
-
}, "render"),
|
|
815
|
-
|
|
810
|
+
fe("useTres", d), d.scene.value.__tres = {
|
|
811
|
+
root: d
|
|
812
|
+
}, d.loop.register(() => {
|
|
813
|
+
f.value && p.frames.value > 0 && (g.value.render(e, f.value), c("render", d.renderer.value)), p.priority.value = 0, p.mode.value === "always" ? p.frames.value = 1 : p.frames.value = Math.max(0, p.frames.value - 1);
|
|
814
|
+
}, "render"), d.loop.start(), N(() => {
|
|
815
|
+
d.loop.stop();
|
|
816
816
|
});
|
|
817
|
-
const M = 100, _ = Gt({ every: M }), { isSupported:
|
|
818
|
-
let
|
|
819
|
-
const B = ({ timestamp:
|
|
820
|
-
|
|
817
|
+
const M = 100, _ = Gt({ every: M }), { isSupported: u, memory: v } = Vt({ interval: M }), E = 160;
|
|
818
|
+
let S = performance.now();
|
|
819
|
+
const B = ({ timestamp: O }) => {
|
|
820
|
+
d.scene.value && (d.perf.memory.allocatedMem = be(d.scene.value)), O - S >= M && (S = O, d.perf.fps.accumulator.push(_.value), d.perf.fps.accumulator.length > E && d.perf.fps.accumulator.shift(), d.perf.fps.value = _.value, u.value && v.value && (d.perf.memory.accumulator.push(v.value.usedJSHeapSize / 1024 / 1024), d.perf.memory.accumulator.length > E && d.perf.memory.accumulator.shift(), d.perf.memory.currentMem = d.perf.memory.accumulator.reduce((q, Y) => q + Y, 0) / d.perf.memory.accumulator.length));
|
|
821
821
|
};
|
|
822
822
|
let x = 0;
|
|
823
|
-
const
|
|
824
|
-
window.__TRES__DEVTOOLS__ && (B({ timestamp: performance.now() }), x +=
|
|
823
|
+
const k = 1, { pause: F } = Qe(({ delta: O }) => {
|
|
824
|
+
window.__TRES__DEVTOOLS__ && (B({ timestamp: performance.now() }), x += O, x >= k && (window.__TRES__DEVTOOLS__.cb(d), x = 0));
|
|
825
825
|
}, { immediate: !0 });
|
|
826
826
|
return N(() => {
|
|
827
|
-
|
|
828
|
-
}),
|
|
827
|
+
F();
|
|
828
|
+
}), d;
|
|
829
829
|
}
|
|
830
830
|
function rt() {
|
|
831
|
-
const e =
|
|
831
|
+
const e = ct("useTres");
|
|
832
832
|
if (!e)
|
|
833
833
|
throw new Error("useTresContext must be used together with useTresContextProvider");
|
|
834
834
|
return e;
|
|
835
835
|
}
|
|
836
836
|
const yn = rt;
|
|
837
|
-
function
|
|
837
|
+
function wn() {
|
|
838
838
|
const {
|
|
839
839
|
camera: e,
|
|
840
840
|
scene: t,
|
|
841
841
|
renderer: r,
|
|
842
842
|
loop: o,
|
|
843
|
-
raycaster:
|
|
844
|
-
controls:
|
|
845
|
-
invalidate:
|
|
846
|
-
advance:
|
|
843
|
+
raycaster: s,
|
|
844
|
+
controls: c,
|
|
845
|
+
invalidate: i,
|
|
846
|
+
advance: a
|
|
847
847
|
} = rt();
|
|
848
848
|
o.setContext({
|
|
849
849
|
camera: e,
|
|
850
850
|
scene: t,
|
|
851
851
|
renderer: r,
|
|
852
|
-
raycaster:
|
|
853
|
-
controls:
|
|
854
|
-
invalidate:
|
|
855
|
-
advance:
|
|
852
|
+
raycaster: s,
|
|
853
|
+
controls: c,
|
|
854
|
+
invalidate: i,
|
|
855
|
+
advance: a
|
|
856
856
|
});
|
|
857
|
-
function n(l,
|
|
858
|
-
return o.register(l, "before",
|
|
857
|
+
function n(l, w = 0) {
|
|
858
|
+
return o.register(l, "before", w);
|
|
859
859
|
}
|
|
860
860
|
function f(l) {
|
|
861
861
|
return o.register(l, "render");
|
|
862
862
|
}
|
|
863
|
-
function h(l,
|
|
864
|
-
return o.register(l, "after",
|
|
863
|
+
function h(l, w = 0) {
|
|
864
|
+
return o.register(l, "after", w);
|
|
865
865
|
}
|
|
866
866
|
return {
|
|
867
867
|
pause: o.pause,
|
|
@@ -874,32 +874,32 @@ function bn() {
|
|
|
874
874
|
onAfterRender: h
|
|
875
875
|
};
|
|
876
876
|
}
|
|
877
|
-
function
|
|
878
|
-
const o = H(),
|
|
879
|
-
e && (o.value = e), t && (
|
|
880
|
-
const
|
|
877
|
+
function Fr(e, t, r) {
|
|
878
|
+
const o = H(), s = H();
|
|
879
|
+
e && (o.value = e), t && (s.value = t);
|
|
880
|
+
const c = D(
|
|
881
881
|
() => o.value ? o.value.children : []
|
|
882
882
|
);
|
|
883
|
-
function
|
|
884
|
-
if (Array.isArray(
|
|
885
|
-
for (const E of
|
|
886
|
-
E(
|
|
887
|
-
typeof
|
|
883
|
+
function i(u, v) {
|
|
884
|
+
if (Array.isArray(u))
|
|
885
|
+
for (const E of u)
|
|
886
|
+
E(v);
|
|
887
|
+
typeof u == "function" && u(v);
|
|
888
888
|
}
|
|
889
|
-
function
|
|
890
|
-
const E = [],
|
|
891
|
-
|
|
892
|
-
for (const B of
|
|
893
|
-
if (
|
|
889
|
+
function a(u, v) {
|
|
890
|
+
const E = [], S = () => v.stopPropagating = !0;
|
|
891
|
+
v.stopPropagation = S;
|
|
892
|
+
for (const B of v == null ? void 0 : v.intersections) {
|
|
893
|
+
if (v.stopPropagating)
|
|
894
894
|
return;
|
|
895
|
-
|
|
895
|
+
v = { ...v, ...B };
|
|
896
896
|
const { object: x } = B;
|
|
897
|
-
|
|
898
|
-
let
|
|
899
|
-
for (;
|
|
900
|
-
|
|
901
|
-
const
|
|
902
|
-
r(
|
|
897
|
+
v.eventObject = x, i(x[u], v), E.push(x);
|
|
898
|
+
let k = x.parent;
|
|
899
|
+
for (; k !== null && !v.stopPropagating && !E.includes(k); )
|
|
900
|
+
v.eventObject = k, i(k[u], v), E.push(k), k = k.parent;
|
|
901
|
+
const F = Pr(u.slice(2));
|
|
902
|
+
r(F, { intersection: B, event: v });
|
|
903
903
|
}
|
|
904
904
|
}
|
|
905
905
|
const {
|
|
@@ -907,35 +907,35 @@ function $r(e, t, r) {
|
|
|
907
907
|
onDblClick: f,
|
|
908
908
|
onContextMenu: h,
|
|
909
909
|
onPointerMove: l,
|
|
910
|
-
onPointerDown:
|
|
911
|
-
onPointerUp:
|
|
912
|
-
onPointerMissed:
|
|
910
|
+
onPointerDown: w,
|
|
911
|
+
onPointerUp: b,
|
|
912
|
+
onPointerMissed: p,
|
|
913
913
|
onWheel: P,
|
|
914
914
|
forceUpdate: y
|
|
915
|
-
} = tt(
|
|
916
|
-
|
|
917
|
-
let
|
|
918
|
-
l((
|
|
919
|
-
const
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
}),
|
|
923
|
-
|
|
924
|
-
}),
|
|
915
|
+
} = tt(c, t);
|
|
916
|
+
b((u) => a("onPointerUp", u)), w((u) => a("onPointerDown", u)), n((u) => a("onClick", u)), f((u) => a("onDoubleClick", u)), h((u) => a("onContextMenu", u)), P((u) => a("onWheel", u));
|
|
917
|
+
let g = [];
|
|
918
|
+
l((u) => {
|
|
919
|
+
const v = u.intersections.map(({ object: S }) => S), E = u.intersections;
|
|
920
|
+
g.forEach(({ object: S }) => {
|
|
921
|
+
v.includes(S) || (u.intersections = g, a("onPointerLeave", u), a("onPointerOut", u));
|
|
922
|
+
}), u.intersections = E, u.intersections.forEach(({ object: S }) => {
|
|
923
|
+
g.includes(S) || (a("onPointerEnter", u), a("onPointerOver", u));
|
|
924
|
+
}), a("onPointerMove", u), g = u.intersections;
|
|
925
925
|
});
|
|
926
|
-
const
|
|
927
|
-
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
}), r("pointer-missed", { event:
|
|
926
|
+
const d = [];
|
|
927
|
+
p((u) => {
|
|
928
|
+
const v = () => u.stopPropagating = !0;
|
|
929
|
+
u.stopPropagation = v, d.forEach((E) => {
|
|
930
|
+
u.stopPropagating || (u.eventObject = E, i(E.onPointerMissed, u));
|
|
931
|
+
}), r("pointer-missed", { event: u });
|
|
932
932
|
});
|
|
933
|
-
function M(
|
|
934
|
-
|
|
933
|
+
function M(u) {
|
|
934
|
+
d.push(u);
|
|
935
935
|
}
|
|
936
|
-
function _(
|
|
937
|
-
const
|
|
938
|
-
|
|
936
|
+
function _(u) {
|
|
937
|
+
const v = d.indexOf(u);
|
|
938
|
+
v > -1 && d.splice(v, 1);
|
|
939
939
|
}
|
|
940
940
|
return t.eventManager = {
|
|
941
941
|
forceUpdate: y,
|
|
@@ -943,7 +943,7 @@ function $r(e, t, r) {
|
|
|
943
943
|
deregisterPointerMissedObject: _
|
|
944
944
|
}, { forceUpdate: y, registerPointerMissedObject: M, deregisterPointerMissedObject: _ };
|
|
945
945
|
}
|
|
946
|
-
const { logError:
|
|
946
|
+
const { logError: $e } = $(), Fe = [
|
|
947
947
|
"onClick",
|
|
948
948
|
"onContextMenu",
|
|
949
949
|
"onPointerMove",
|
|
@@ -959,78 +959,78 @@ const { logError: Ue } = U(), $e = [
|
|
|
959
959
|
"onLostPointerCapture",
|
|
960
960
|
"onWheel"
|
|
961
961
|
];
|
|
962
|
-
function
|
|
962
|
+
function Ue(e) {
|
|
963
963
|
var r;
|
|
964
964
|
const t = (r = e == null ? void 0 : e.__tres) == null ? void 0 : r.root;
|
|
965
965
|
t && t.render && t.render.canBeInvalidated.value && t.invalidate();
|
|
966
966
|
}
|
|
967
|
-
const
|
|
967
|
+
const Ur = () => {
|
|
968
968
|
let e = null;
|
|
969
969
|
function t(n, f, h, l) {
|
|
970
|
-
if (l || (l = {}), l.args || (l.args = []), n === "template" ||
|
|
970
|
+
if (l || (l = {}), l.args || (l.args = []), n === "template" || br(n))
|
|
971
971
|
return null;
|
|
972
|
-
let
|
|
972
|
+
let w = n.replace("Tres", ""), b;
|
|
973
973
|
if (n === "primitive") {
|
|
974
|
-
(l == null ? void 0 : l.object) === void 0 &&
|
|
975
|
-
const
|
|
976
|
-
|
|
974
|
+
(l == null ? void 0 : l.object) === void 0 && $e("Tres primitives need a prop 'object'");
|
|
975
|
+
const p = l.object;
|
|
976
|
+
w = p.type, b = Object.assign(p.clone(), { type: w });
|
|
977
977
|
} else {
|
|
978
|
-
const
|
|
979
|
-
|
|
980
|
-
`${
|
|
981
|
-
),
|
|
978
|
+
const p = de.value[w];
|
|
979
|
+
p || $e(
|
|
980
|
+
`${w} is not defined on the THREE namespace. Use extend to add it to the catalog.`
|
|
981
|
+
), b = new p(...l.args);
|
|
982
982
|
}
|
|
983
|
-
return
|
|
984
|
-
...
|
|
985
|
-
type:
|
|
983
|
+
return b ? (b.isCamera && (l != null && l.position || b.position.set(3, 3, 3), l != null && l.lookAt || b.lookAt(0, 0, 0)), (l == null ? void 0 : l.attach) === void 0 && (b.isMaterial ? b.attach = "material" : b.isBufferGeometry && (b.attach = "geometry")), b.__tres = {
|
|
984
|
+
...b.__tres,
|
|
985
|
+
type: w,
|
|
986
986
|
memoizedProps: l,
|
|
987
987
|
eventCount: 0,
|
|
988
988
|
disposable: !0,
|
|
989
989
|
primitive: n === "primitive"
|
|
990
|
-
},
|
|
990
|
+
}, b.isObject3D && b.__tres && (l != null && l.material || l != null && l.geometry) && (b.__tres.disposable = !1), b) : null;
|
|
991
991
|
}
|
|
992
992
|
function r(n, f) {
|
|
993
|
-
var l,
|
|
993
|
+
var l, w, b, p, P;
|
|
994
994
|
if (!n)
|
|
995
995
|
return;
|
|
996
996
|
f && f.isScene && (e = f), e && n.__tres && (n.__tres.root = e.__tres.root);
|
|
997
997
|
const h = f || e;
|
|
998
998
|
if (n != null && n.isObject3D) {
|
|
999
999
|
const { registerCamera: y } = (l = n == null ? void 0 : n.__tres) == null ? void 0 : l.root;
|
|
1000
|
-
n != null && n.isCamera && y(n), n.onPointerMissed && ((
|
|
1000
|
+
n != null && n.isCamera && y(n), n.onPointerMissed && ((w = n == null ? void 0 : n.__tres) != null && w.root) && ((P = (p = (b = n == null ? void 0 : n.__tres) == null ? void 0 : b.root) == null ? void 0 : p.eventManager) == null || P.registerPointerMissedObject(n));
|
|
1001
1001
|
}
|
|
1002
1002
|
n != null && n.isObject3D && (h != null && h.isObject3D) ? (h.add(n), n.dispatchEvent({ type: "added" })) : n != null && n.isFog ? h.fog = n : typeof (n == null ? void 0 : n.attach) == "string" && (n.__previousAttach = n[h == null ? void 0 : h.attach], h && (h[n.attach] = n));
|
|
1003
1003
|
}
|
|
1004
1004
|
function o(n) {
|
|
1005
|
-
var h, l,
|
|
1005
|
+
var h, l, w, b;
|
|
1006
1006
|
if (!n)
|
|
1007
1007
|
return;
|
|
1008
1008
|
const f = n.__tres;
|
|
1009
1009
|
if (n.parent = n.parent || e, n.isObject3D) {
|
|
1010
|
-
const
|
|
1011
|
-
var
|
|
1012
|
-
const
|
|
1013
|
-
y.isCamera && (
|
|
1010
|
+
const p = (y) => {
|
|
1011
|
+
var d, M;
|
|
1012
|
+
const g = (M = (d = n == null ? void 0 : n.__tres) == null ? void 0 : d.root) == null ? void 0 : M.deregisterCamera;
|
|
1013
|
+
y.isCamera && (g == null || g(y));
|
|
1014
1014
|
};
|
|
1015
1015
|
(h = n.removeFromParent) == null || h.call(n), n.traverse((y) => {
|
|
1016
|
-
var
|
|
1017
|
-
|
|
1018
|
-
}),
|
|
1016
|
+
var g, d;
|
|
1017
|
+
p(y), y.onPointerMissed && ((d = (g = f == null ? void 0 : f.root) == null ? void 0 : g.eventManager) == null || d.deregisterPointerMissedObject(y));
|
|
1018
|
+
}), p(n), Ue(n), !((l = n.__tres) == null ? void 0 : l.primitive) && ((w = n.__tres) != null && w.disposable) && we(n), (b = n.dispose) == null || b.call(n);
|
|
1019
1019
|
}
|
|
1020
1020
|
}
|
|
1021
|
-
function
|
|
1022
|
-
var
|
|
1021
|
+
function s(n, f, h, l) {
|
|
1022
|
+
var w, b;
|
|
1023
1023
|
if (n) {
|
|
1024
|
-
let
|
|
1025
|
-
if ((
|
|
1024
|
+
let p = n, P = f;
|
|
1025
|
+
if ((w = n == null ? void 0 : n.__tres) != null && w.primitive && P === "object" && h !== null) {
|
|
1026
1026
|
const M = t("primitive", void 0, void 0, {
|
|
1027
1027
|
object: l
|
|
1028
1028
|
});
|
|
1029
1029
|
for (const _ in M) {
|
|
1030
1030
|
if (_ === "uuid")
|
|
1031
1031
|
continue;
|
|
1032
|
-
const
|
|
1033
|
-
!(
|
|
1032
|
+
const u = n[_], v = M[_];
|
|
1033
|
+
!(u != null && u.set) && !ee(u) ? n[_] = v : u.constructor === v.constructor && (u != null && u.copy) ? u == null || u.copy(v) : Array.isArray(v) ? u.set(...v) : !u.isColor && u.setScalar ? u.setScalar(v) : u.set(v);
|
|
1034
1034
|
}
|
|
1035
1035
|
M != null && M.__tres && (M.__tres.root = e == null ? void 0 : e.__tres.root), M != null && M.isGroup ? (n.geometry = void 0, n.material = void 0) : delete n.isGroup;
|
|
1036
1036
|
}
|
|
@@ -1038,45 +1038,45 @@ const Fr = () => {
|
|
|
1038
1038
|
l || l === "" ? n[P] = l : delete n[P];
|
|
1039
1039
|
return;
|
|
1040
1040
|
}
|
|
1041
|
-
|
|
1042
|
-
let y = X(P),
|
|
1041
|
+
Fe.includes(f) && (n.__tres.eventCount += 1);
|
|
1042
|
+
let y = X(P), g = p == null ? void 0 : p[y];
|
|
1043
1043
|
if (P === "args") {
|
|
1044
|
-
const M = n, _ = h ?? [],
|
|
1045
|
-
|
|
1044
|
+
const M = n, _ = h ?? [], u = l ?? [], v = ((b = n == null ? void 0 : n.__tres) == null ? void 0 : b.type) || n.type;
|
|
1045
|
+
v && _.length && !Sr(_, u) && (p = Object.assign(
|
|
1046
1046
|
M,
|
|
1047
|
-
new
|
|
1047
|
+
new de.value[v](...l)
|
|
1048
1048
|
));
|
|
1049
1049
|
return;
|
|
1050
1050
|
}
|
|
1051
|
-
if (
|
|
1051
|
+
if (p.type === "BufferGeometry") {
|
|
1052
1052
|
if (P === "args")
|
|
1053
1053
|
return;
|
|
1054
|
-
|
|
1054
|
+
p.setAttribute(
|
|
1055
1055
|
X(P),
|
|
1056
|
-
new
|
|
1056
|
+
new Tt(...l)
|
|
1057
1057
|
);
|
|
1058
1058
|
return;
|
|
1059
1059
|
}
|
|
1060
|
-
if (P.includes("-") &&
|
|
1060
|
+
if (P.includes("-") && g === void 0) {
|
|
1061
1061
|
const M = P.split("-");
|
|
1062
|
-
|
|
1062
|
+
g = M.reduce((_, u) => _[X(u)], p), P = M.pop(), y = P, g != null && g.set || (p = M.reduce((_, u) => _[X(u)], p));
|
|
1063
1063
|
}
|
|
1064
|
-
let
|
|
1065
|
-
if (
|
|
1066
|
-
|
|
1064
|
+
let d = l;
|
|
1065
|
+
if (d === "" && (d = !0), ee(g)) {
|
|
1066
|
+
Fe.includes(f) || (Array.isArray(d) ? n[y](...d) : n[y](d)), y.startsWith("on") && ee(d) && (p[y] = d);
|
|
1067
1067
|
return;
|
|
1068
1068
|
}
|
|
1069
|
-
!(
|
|
1069
|
+
!(g != null && g.set) && !ee(g) ? p[y] = d : g.constructor === d.constructor && (g != null && g.copy) ? g == null || g.copy(d) : Array.isArray(d) ? g.set(...d) : !g.isColor && g.setScalar ? g.setScalar(d) : g.set(d), Ue(n);
|
|
1070
1070
|
}
|
|
1071
1071
|
}
|
|
1072
|
-
function
|
|
1072
|
+
function c(n) {
|
|
1073
1073
|
return (n == null ? void 0 : n.parent) || null;
|
|
1074
1074
|
}
|
|
1075
|
-
function
|
|
1075
|
+
function i(n) {
|
|
1076
1076
|
const f = new xt();
|
|
1077
1077
|
return f.name = n, f.__tres = { type: "Comment" }, f.__tres.root = e == null ? void 0 : e.__tres.root, f;
|
|
1078
1078
|
}
|
|
1079
|
-
function
|
|
1079
|
+
function a(n) {
|
|
1080
1080
|
if (!n)
|
|
1081
1081
|
return null;
|
|
1082
1082
|
const f = n.parent || e, h = f.children.indexOf(n);
|
|
@@ -1086,13 +1086,13 @@ const Fr = () => {
|
|
|
1086
1086
|
insert: r,
|
|
1087
1087
|
remove: o,
|
|
1088
1088
|
createElement: t,
|
|
1089
|
-
patchProp:
|
|
1090
|
-
parentNode:
|
|
1089
|
+
patchProp: s,
|
|
1090
|
+
parentNode: c,
|
|
1091
1091
|
createText: () => void 0,
|
|
1092
|
-
createComment:
|
|
1092
|
+
createComment: i,
|
|
1093
1093
|
setText: () => void 0,
|
|
1094
1094
|
setElementText: () => void 0,
|
|
1095
|
-
nextSibling:
|
|
1095
|
+
nextSibling: a,
|
|
1096
1096
|
querySelector: () => void 0,
|
|
1097
1097
|
setScopeId: () => void 0,
|
|
1098
1098
|
cloneNode: () => void 0,
|
|
@@ -1106,62 +1106,62 @@ function nt() {
|
|
|
1106
1106
|
return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
|
|
1107
1107
|
}
|
|
1108
1108
|
const Nr = typeof Proxy == "function", zr = "devtools-plugin:setup", Gr = "plugin:settings:set";
|
|
1109
|
-
let
|
|
1109
|
+
let U, ge;
|
|
1110
1110
|
function Vr() {
|
|
1111
1111
|
var e;
|
|
1112
|
-
return
|
|
1112
|
+
return U !== void 0 || (typeof window < "u" && window.performance ? (U = !0, ge = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (U = !0, ge = globalThis.perf_hooks.performance) : U = !1), U;
|
|
1113
1113
|
}
|
|
1114
1114
|
function qr() {
|
|
1115
|
-
return Vr() ?
|
|
1115
|
+
return Vr() ? ge.now() : Date.now();
|
|
1116
1116
|
}
|
|
1117
1117
|
class Yr {
|
|
1118
1118
|
constructor(t, r) {
|
|
1119
1119
|
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = r;
|
|
1120
1120
|
const o = {};
|
|
1121
1121
|
if (t.settings)
|
|
1122
|
-
for (const
|
|
1123
|
-
const
|
|
1124
|
-
o[
|
|
1122
|
+
for (const i in t.settings) {
|
|
1123
|
+
const a = t.settings[i];
|
|
1124
|
+
o[i] = a.defaultValue;
|
|
1125
1125
|
}
|
|
1126
|
-
const
|
|
1127
|
-
let
|
|
1126
|
+
const s = `__vue-devtools-plugin-settings__${t.id}`;
|
|
1127
|
+
let c = Object.assign({}, o);
|
|
1128
1128
|
try {
|
|
1129
|
-
const
|
|
1130
|
-
Object.assign(
|
|
1129
|
+
const i = localStorage.getItem(s), a = JSON.parse(i);
|
|
1130
|
+
Object.assign(c, a);
|
|
1131
1131
|
} catch {
|
|
1132
1132
|
}
|
|
1133
1133
|
this.fallbacks = {
|
|
1134
1134
|
getSettings() {
|
|
1135
|
-
return
|
|
1135
|
+
return c;
|
|
1136
1136
|
},
|
|
1137
|
-
setSettings(
|
|
1137
|
+
setSettings(i) {
|
|
1138
1138
|
try {
|
|
1139
|
-
localStorage.setItem(
|
|
1139
|
+
localStorage.setItem(s, JSON.stringify(i));
|
|
1140
1140
|
} catch {
|
|
1141
1141
|
}
|
|
1142
|
-
|
|
1142
|
+
c = i;
|
|
1143
1143
|
},
|
|
1144
1144
|
now() {
|
|
1145
1145
|
return qr();
|
|
1146
1146
|
}
|
|
1147
|
-
}, r && r.on(Gr, (
|
|
1148
|
-
|
|
1147
|
+
}, r && r.on(Gr, (i, a) => {
|
|
1148
|
+
i === this.plugin.id && this.fallbacks.setSettings(a);
|
|
1149
1149
|
}), this.proxiedOn = new Proxy({}, {
|
|
1150
|
-
get: (
|
|
1150
|
+
get: (i, a) => this.target ? this.target.on[a] : (...n) => {
|
|
1151
1151
|
this.onQueue.push({
|
|
1152
|
-
method:
|
|
1152
|
+
method: a,
|
|
1153
1153
|
args: n
|
|
1154
1154
|
});
|
|
1155
1155
|
}
|
|
1156
1156
|
}), this.proxiedTarget = new Proxy({}, {
|
|
1157
|
-
get: (
|
|
1158
|
-
method:
|
|
1157
|
+
get: (i, a) => this.target ? this.target[a] : a === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(a) ? (...n) => (this.targetQueue.push({
|
|
1158
|
+
method: a,
|
|
1159
1159
|
args: n,
|
|
1160
1160
|
resolve: () => {
|
|
1161
1161
|
}
|
|
1162
|
-
}), this.fallbacks[
|
|
1162
|
+
}), this.fallbacks[a](...n)) : (...n) => new Promise((f) => {
|
|
1163
1163
|
this.targetQueue.push({
|
|
1164
|
-
method:
|
|
1164
|
+
method: a,
|
|
1165
1165
|
args: n,
|
|
1166
1166
|
resolve: f
|
|
1167
1167
|
});
|
|
@@ -1177,16 +1177,16 @@ class Yr {
|
|
|
1177
1177
|
}
|
|
1178
1178
|
}
|
|
1179
1179
|
function Jr(e, t) {
|
|
1180
|
-
const r = e, o = nt(),
|
|
1181
|
-
if (
|
|
1182
|
-
|
|
1180
|
+
const r = e, o = nt(), s = Wr(), c = Nr && r.enableEarlyProxy;
|
|
1181
|
+
if (s && (o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !c))
|
|
1182
|
+
s.emit(zr, e, t);
|
|
1183
1183
|
else {
|
|
1184
|
-
const
|
|
1184
|
+
const i = c ? new Yr(r, s) : null;
|
|
1185
1185
|
(o.__VUE_DEVTOOLS_PLUGINS__ = o.__VUE_DEVTOOLS_PLUGINS__ || []).push({
|
|
1186
1186
|
pluginDescriptor: r,
|
|
1187
1187
|
setupFn: t,
|
|
1188
|
-
proxy:
|
|
1189
|
-
}),
|
|
1188
|
+
proxy: i
|
|
1189
|
+
}), i && t(i.proxiedTarget);
|
|
1190
1190
|
}
|
|
1191
1191
|
}
|
|
1192
1192
|
function Qr(e, t) {
|
|
@@ -1208,7 +1208,7 @@ const ot = (e) => {
|
|
|
1208
1208
|
textColor: 5750629,
|
|
1209
1209
|
backgroundColor: 15793395
|
|
1210
1210
|
});
|
|
1211
|
-
const r =
|
|
1211
|
+
const r = be(e);
|
|
1212
1212
|
return r > 0 && t.tags.push({
|
|
1213
1213
|
label: `${Rr(r)} KB`,
|
|
1214
1214
|
textColor: 15707189,
|
|
@@ -1240,8 +1240,8 @@ function st(e, t, r = "") {
|
|
|
1240
1240
|
e.children.forEach((o) => {
|
|
1241
1241
|
if (o.type === "HightlightMesh" || r && !o.type.includes(r) && !o.name.includes(r))
|
|
1242
1242
|
return;
|
|
1243
|
-
const
|
|
1244
|
-
t.children.push(
|
|
1243
|
+
const s = ot(o);
|
|
1244
|
+
t.children.push(s), st(o, s, r);
|
|
1245
1245
|
});
|
|
1246
1246
|
}
|
|
1247
1247
|
const Kr = [], z = "tres:inspector", Xr = ze({
|
|
@@ -1270,116 +1270,37 @@ function Zr(e, t) {
|
|
|
1270
1270
|
r.sendInspectorTree(z);
|
|
1271
1271
|
}, 1e3), setInterval(() => {
|
|
1272
1272
|
r.notifyComponentUpdate();
|
|
1273
|
-
}, 5e3), r.on.getInspectorTree((
|
|
1274
|
-
if (
|
|
1275
|
-
const
|
|
1276
|
-
st(t.scene.value,
|
|
1273
|
+
}, 5e3), r.on.getInspectorTree((c) => {
|
|
1274
|
+
if (c.inspectorId === z) {
|
|
1275
|
+
const i = ot(t.scene.value);
|
|
1276
|
+
st(t.scene.value, i, c.filter), Xr.sceneGraph = i, c.rootNodes = [i];
|
|
1277
1277
|
}
|
|
1278
1278
|
});
|
|
1279
|
-
let o = null,
|
|
1280
|
-
r.on.getInspectorState((
|
|
1281
|
-
var
|
|
1282
|
-
if (
|
|
1283
|
-
const [
|
|
1284
|
-
if (!
|
|
1279
|
+
let o = null, s = null;
|
|
1280
|
+
r.on.getInspectorState((c) => {
|
|
1281
|
+
var i;
|
|
1282
|
+
if (c.inspectorId === z) {
|
|
1283
|
+
const [a] = t.scene.value.getObjectsByProperty("uuid", c.nodeId);
|
|
1284
|
+
if (!a)
|
|
1285
1285
|
return;
|
|
1286
|
-
if (
|
|
1287
|
-
const n =
|
|
1288
|
-
|
|
1286
|
+
if (s && o && o.parent && s.remove(o), a.isMesh) {
|
|
1287
|
+
const n = kr(a);
|
|
1288
|
+
a.add(n), o = n, s = a;
|
|
1289
1289
|
}
|
|
1290
|
-
|
|
1291
|
-
object: [
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
editable: !0,
|
|
1300
|
-
value: s.name
|
|
1301
|
-
},
|
|
1302
|
-
{
|
|
1303
|
-
key: "type",
|
|
1304
|
-
editable: !0,
|
|
1305
|
-
value: s.type
|
|
1306
|
-
},
|
|
1307
|
-
{
|
|
1308
|
-
key: "position",
|
|
1309
|
-
editable: !0,
|
|
1310
|
-
value: s.position
|
|
1311
|
-
},
|
|
1312
|
-
{
|
|
1313
|
-
key: "rotation",
|
|
1314
|
-
editable: !0,
|
|
1315
|
-
value: s.rotation
|
|
1316
|
-
},
|
|
1317
|
-
{
|
|
1318
|
-
key: "scale",
|
|
1319
|
-
editable: !0,
|
|
1320
|
-
value: s.scale
|
|
1321
|
-
},
|
|
1322
|
-
{
|
|
1323
|
-
key: "geometry",
|
|
1324
|
-
value: s.geometry
|
|
1325
|
-
},
|
|
1326
|
-
{
|
|
1327
|
-
key: "material",
|
|
1328
|
-
value: s.material
|
|
1329
|
-
},
|
|
1330
|
-
{
|
|
1331
|
-
key: "color",
|
|
1332
|
-
editable: !0,
|
|
1333
|
-
value: s.color
|
|
1334
|
-
},
|
|
1335
|
-
{
|
|
1336
|
-
key: "intensity",
|
|
1337
|
-
editable: !0,
|
|
1338
|
-
value: s.intensity
|
|
1339
|
-
},
|
|
1340
|
-
{
|
|
1341
|
-
key: "castShadow",
|
|
1342
|
-
editable: !0,
|
|
1343
|
-
value: s.castShadow
|
|
1344
|
-
},
|
|
1345
|
-
{
|
|
1346
|
-
key: "receiveShadow",
|
|
1347
|
-
editable: !0,
|
|
1348
|
-
value: s.receiveShadow
|
|
1349
|
-
},
|
|
1350
|
-
{
|
|
1351
|
-
key: "frustumCulled",
|
|
1352
|
-
editable: !0,
|
|
1353
|
-
value: s.frustumCulled
|
|
1354
|
-
},
|
|
1355
|
-
{
|
|
1356
|
-
key: "matrixAutoUpdate",
|
|
1357
|
-
editable: !0,
|
|
1358
|
-
value: s.matrixAutoUpdate
|
|
1359
|
-
},
|
|
1360
|
-
{
|
|
1361
|
-
key: "matrixWorldNeedsUpdate",
|
|
1362
|
-
editable: !0,
|
|
1363
|
-
value: s.matrixWorldNeedsUpdate
|
|
1364
|
-
},
|
|
1365
|
-
{
|
|
1366
|
-
key: "matrixWorld",
|
|
1367
|
-
value: s.matrixWorld
|
|
1368
|
-
},
|
|
1369
|
-
{
|
|
1370
|
-
key: "visible",
|
|
1371
|
-
editable: !0,
|
|
1372
|
-
value: s.visible
|
|
1373
|
-
}
|
|
1374
|
-
]
|
|
1375
|
-
}, s.isScene && (u.state.info = {
|
|
1376
|
-
memory: we(s),
|
|
1377
|
-
objects: s.children.length,
|
|
1290
|
+
c.state = {
|
|
1291
|
+
object: Object.entries(a).map(([n, f]) => ({
|
|
1292
|
+
key: n,
|
|
1293
|
+
value: f,
|
|
1294
|
+
editable: !0
|
|
1295
|
+
})).filter(({ key: n }) => n !== "parent")
|
|
1296
|
+
}, a.isScene && (c.state.info = {
|
|
1297
|
+
memory: be(a),
|
|
1298
|
+
objects: a.children.length,
|
|
1378
1299
|
calls: t.renderer.value.info.render.calls,
|
|
1379
1300
|
triangles: t.renderer.value.info.render.triangles,
|
|
1380
1301
|
points: t.renderer.value.info.render.points,
|
|
1381
1302
|
lines: t.renderer.value.info.render.lines
|
|
1382
|
-
},
|
|
1303
|
+
}, c.state.programs = ((i = t.renderer.value.info.programs) == null ? void 0 : i.map((n) => ({
|
|
1383
1304
|
key: n.name,
|
|
1384
1305
|
value: {
|
|
1385
1306
|
...n,
|
|
@@ -1389,8 +1310,8 @@ function Zr(e, t) {
|
|
|
1389
1310
|
}
|
|
1390
1311
|
}))) || []);
|
|
1391
1312
|
}
|
|
1392
|
-
}), r.on.editInspectorState((
|
|
1393
|
-
|
|
1313
|
+
}), r.on.editInspectorState((c) => {
|
|
1314
|
+
c.inspectorId === z && xr(t.scene.value, c.nodeId, c.path, c.state.value);
|
|
1394
1315
|
});
|
|
1395
1316
|
}
|
|
1396
1317
|
);
|
|
@@ -1439,66 +1360,66 @@ const en = ["data-scene", "data-tres"], tn = /* @__PURE__ */ xe({
|
|
|
1439
1360
|
],
|
|
1440
1361
|
setup(e, { expose: t, emit: r }) {
|
|
1441
1362
|
var P;
|
|
1442
|
-
const o = e,
|
|
1363
|
+
const o = e, s = r, c = ut(), { logWarning: i } = $(), a = L(), n = H(new qe()), f = (P = ke()) == null ? void 0 : P.appContext.app;
|
|
1443
1364
|
me(Ge);
|
|
1444
1365
|
const h = (y) => xe({
|
|
1445
1366
|
setup() {
|
|
1446
|
-
var
|
|
1447
|
-
const
|
|
1448
|
-
return
|
|
1367
|
+
var d;
|
|
1368
|
+
const g = (d = ke()) == null ? void 0 : d.appContext;
|
|
1369
|
+
return g && (g.app = f), fe("useTres", y), fe("extend", me), typeof window < "u" && Zr(g == null ? void 0 : g.app, y), () => Oe(ht, null, c != null && c.default ? c.default() : []);
|
|
1449
1370
|
}
|
|
1450
1371
|
}), l = (y) => {
|
|
1451
|
-
const
|
|
1452
|
-
|
|
1453
|
-
},
|
|
1454
|
-
|
|
1372
|
+
const g = h(y), { render: d } = vt(Ur());
|
|
1373
|
+
d(Oe(g), n.value);
|
|
1374
|
+
}, w = (y, g = !1) => {
|
|
1375
|
+
we(y.scene.value), g && (y.renderer.value.dispose(), y.renderer.value.renderLists.dispose(), y.renderer.value.forceContextLoss()), n.value.__tres = {
|
|
1455
1376
|
root: y
|
|
1456
1377
|
}, l(y);
|
|
1457
|
-
},
|
|
1458
|
-
return t({ context:
|
|
1459
|
-
const y =
|
|
1460
|
-
|
|
1378
|
+
}, b = D(() => o.disableRender), p = H(null);
|
|
1379
|
+
return t({ context: p, dispose: () => w(p.value, !0) }), ft(() => {
|
|
1380
|
+
const y = a;
|
|
1381
|
+
p.value = $r({
|
|
1461
1382
|
scene: n.value,
|
|
1462
1383
|
canvas: y,
|
|
1463
1384
|
windowSize: o.windowSize ?? !1,
|
|
1464
|
-
disableRender:
|
|
1385
|
+
disableRender: b.value ?? !1,
|
|
1465
1386
|
rendererOptions: o,
|
|
1466
|
-
emit:
|
|
1467
|
-
}),
|
|
1468
|
-
const { registerCamera:
|
|
1469
|
-
l(
|
|
1470
|
-
const
|
|
1471
|
-
const
|
|
1387
|
+
emit: s
|
|
1388
|
+
}), Fr(n.value, p.value, s);
|
|
1389
|
+
const { registerCamera: g, camera: d, cameras: M, deregisterCamera: _ } = p.value;
|
|
1390
|
+
l(p.value);
|
|
1391
|
+
const u = () => {
|
|
1392
|
+
const v = new pe(
|
|
1472
1393
|
45,
|
|
1473
1394
|
window.innerWidth / window.innerHeight,
|
|
1474
1395
|
0.1,
|
|
1475
1396
|
1e3
|
|
1476
1397
|
);
|
|
1477
|
-
|
|
1478
|
-
const E =
|
|
1479
|
-
M.value.length >= 2 && (
|
|
1398
|
+
v.position.set(3, 3, 3), v.lookAt(0, 0, 0), g(v);
|
|
1399
|
+
const E = ve(() => {
|
|
1400
|
+
M.value.length >= 2 && (v.removeFromParent(), _(v), E == null || E());
|
|
1480
1401
|
});
|
|
1481
1402
|
};
|
|
1482
1403
|
G(
|
|
1483
1404
|
() => o.camera,
|
|
1484
|
-
(
|
|
1485
|
-
|
|
1405
|
+
(v, E) => {
|
|
1406
|
+
v && g(v), E && (E.removeFromParent(), _(E));
|
|
1486
1407
|
},
|
|
1487
1408
|
{
|
|
1488
1409
|
immediate: !0
|
|
1489
1410
|
}
|
|
1490
|
-
),
|
|
1411
|
+
), d.value || (i(
|
|
1491
1412
|
"No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
|
|
1492
|
-
),
|
|
1413
|
+
), u());
|
|
1493
1414
|
}), N(() => {
|
|
1494
|
-
|
|
1495
|
-
}), (y,
|
|
1415
|
+
w(p.value);
|
|
1416
|
+
}), (y, g) => (pt(), dt("canvas", {
|
|
1496
1417
|
ref_key: "canvas",
|
|
1497
|
-
ref:
|
|
1418
|
+
ref: a,
|
|
1498
1419
|
"data-scene": n.value.uuid,
|
|
1499
1420
|
class: mt(y.$attrs.class),
|
|
1500
|
-
"data-tres": `tresjs ${W(
|
|
1501
|
-
style:
|
|
1421
|
+
"data-tres": `tresjs ${W(pr).version}`,
|
|
1422
|
+
style: gt({
|
|
1502
1423
|
display: "block",
|
|
1503
1424
|
width: "100%",
|
|
1504
1425
|
height: "100%",
|
|
@@ -1521,7 +1442,7 @@ const en = ["data-scene", "data-tres"], tn = /* @__PURE__ */ xe({
|
|
|
1521
1442
|
isCustomElement: (e) => e.startsWith("Tres") && !rn.includes(e) || e === "primitive"
|
|
1522
1443
|
}
|
|
1523
1444
|
}
|
|
1524
|
-
},
|
|
1445
|
+
}, bn = nn, Mn = {
|
|
1525
1446
|
mounted: (e, t) => {
|
|
1526
1447
|
if (t.arg) {
|
|
1527
1448
|
console.log(`v-log:${t.arg}`, e[t.arg]);
|
|
@@ -1530,14 +1451,14 @@ const en = ["data-scene", "data-tres"], tn = /* @__PURE__ */ xe({
|
|
|
1530
1451
|
console.log("v-log", e);
|
|
1531
1452
|
}
|
|
1532
1453
|
};
|
|
1533
|
-
class it extends
|
|
1454
|
+
class it extends kt {
|
|
1534
1455
|
constructor(t, r) {
|
|
1535
|
-
const o = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0],
|
|
1536
|
-
|
|
1537
|
-
const
|
|
1538
|
-
super(
|
|
1539
|
-
const
|
|
1540
|
-
|
|
1456
|
+
const o = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], s = new Ae();
|
|
1457
|
+
s.setAttribute("position", new Le(o, 3)), s.computeBoundingSphere();
|
|
1458
|
+
const c = new Ot({ fog: !1 });
|
|
1459
|
+
super(s, c), this.light = t, this.color = r, this.type = "RectAreaLightHelper";
|
|
1460
|
+
const i = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], a = new Ae();
|
|
1461
|
+
a.setAttribute("position", new Le(i, 3)), a.computeBoundingSphere(), this.add(new At(a, new Ye({ side: Lt, fog: !1 })));
|
|
1541
1462
|
}
|
|
1542
1463
|
updateMatrixWorld() {
|
|
1543
1464
|
if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
|
|
@@ -1553,7 +1474,7 @@ class it extends Tt {
|
|
|
1553
1474
|
this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
|
|
1554
1475
|
}
|
|
1555
1476
|
}
|
|
1556
|
-
const { logWarning: Ne } =
|
|
1477
|
+
const { logWarning: Ne } = $();
|
|
1557
1478
|
let te, I;
|
|
1558
1479
|
const on = {
|
|
1559
1480
|
DirectionalLight: Dt,
|
|
@@ -1579,12 +1500,12 @@ const on = {
|
|
|
1579
1500
|
}
|
|
1580
1501
|
I = e.parent.children.find((t) => t instanceof te), I && I.dispose && I.dispose(), e.parent.remove(I);
|
|
1581
1502
|
}
|
|
1582
|
-
}, { logWarning: sn } =
|
|
1503
|
+
}, { logWarning: sn } = $();
|
|
1583
1504
|
let j = null;
|
|
1584
1505
|
const _n = {
|
|
1585
1506
|
updated: (e, t) => {
|
|
1586
|
-
var
|
|
1587
|
-
const r =
|
|
1507
|
+
var s;
|
|
1508
|
+
const r = Or(t);
|
|
1588
1509
|
if (!r) {
|
|
1589
1510
|
sn(`v-distance-to: problem with binding value: ${t.value}`);
|
|
1590
1511
|
return;
|
|
@@ -1594,7 +1515,7 @@ const _n = {
|
|
|
1594
1515
|
o.normalize(), j = new It(o, e.position, e.position.distanceTo(r), 16776960), e.parent.add(j), console.table(
|
|
1595
1516
|
[
|
|
1596
1517
|
["Distance:", e.position.distanceTo(r)],
|
|
1597
|
-
[`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(
|
|
1518
|
+
[`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(s = e.position) == null ? void 0 : s.z}`],
|
|
1598
1519
|
[`Destiny: ${e.name || e.type}`, `x:${r.x}, y:${r.y}, z:${r == null ? void 0 : r.z}`]
|
|
1599
1520
|
]
|
|
1600
1521
|
);
|
|
@@ -1609,30 +1530,30 @@ const _n = {
|
|
|
1609
1530
|
};
|
|
1610
1531
|
export {
|
|
1611
1532
|
tn as TresCanvas,
|
|
1612
|
-
|
|
1533
|
+
de as catalogue,
|
|
1613
1534
|
Hr as createRenderLoop,
|
|
1614
1535
|
Cn as default,
|
|
1615
|
-
|
|
1536
|
+
we as dispose,
|
|
1616
1537
|
me as extend,
|
|
1617
|
-
|
|
1538
|
+
pn as isProd,
|
|
1618
1539
|
hr as normalizeColor,
|
|
1619
|
-
|
|
1620
|
-
|
|
1540
|
+
dn as normalizeVectorFlexibleParam,
|
|
1541
|
+
bn as templateCompilerOptions,
|
|
1621
1542
|
jr as trasverseObjects,
|
|
1622
|
-
|
|
1543
|
+
dr as useCamera,
|
|
1623
1544
|
mn as useLoader,
|
|
1624
|
-
|
|
1625
|
-
|
|
1545
|
+
$ as useLogger,
|
|
1546
|
+
wn as useLoop,
|
|
1626
1547
|
hn as usePointerEventHandler,
|
|
1627
1548
|
tt as useRaycaster,
|
|
1628
1549
|
fn as useRenderLoop,
|
|
1629
1550
|
Dr as useRenderer,
|
|
1630
|
-
|
|
1631
|
-
|
|
1551
|
+
vn as useSeek,
|
|
1552
|
+
gn as useTexture,
|
|
1632
1553
|
yn as useTres,
|
|
1633
1554
|
rt as useTresContext,
|
|
1634
|
-
|
|
1635
|
-
|
|
1555
|
+
$r as useTresContextProvider,
|
|
1556
|
+
Fr as useTresEventManager,
|
|
1636
1557
|
_n as vDistanceTo,
|
|
1637
1558
|
Pn as vLightHelper,
|
|
1638
1559
|
Mn as vLog
|