@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v4.0.2
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 ge, onUnmounted as N, shallowRef as H, watch as G, reactive as ze, readonly as ce, unref as W, provide as fe, inject as ut, defineComponent as xe, useSlots as ct, getCurrentInstance as Te, onMounted as ft, openBlock as dt, createElementBlock as pt, normalizeClass as mt, normalizeStyle as vt, createRenderer as gt, h as Ae, Fragment as ht } from "vue";
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 de, Camera as yt, Clock as Ve, Vector3 as he, Color as re, Scene as qe, MeshBasicMaterial as Ye, DoubleSide as bt, REVISION as wt, 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 kt, BufferAttribute as St, Object3D as xt, Line as Tt, BufferGeometry as Oe, Float32BufferAttribute as Le, LineBasicMaterial as At, Mesh as Ot, BackSide as Lt, DirectionalLightHelper as Dt, PointLightHelper as Bt, SpotLightHelper as jt, HemisphereLightHelper as Rt, ArrowHelper as It } from "three";
14
- import { createEventHook as O, useRafFn as Qe, toValue as S, unrefElement as Ht, useDevicePixelRatio as Ut, usePointer as $t, useElementBounding as Ft, 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.0.2", Qt = "pnpm@9.1.4", Kt = "Declarative ThreeJS using Vue Components", Xt = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", Zt = "MIT", er = [
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
- }, ur = {
62
+ }, cr = {
63
63
  three: ">=0.133",
64
64
  vue: ">=3.4"
65
- }, cr = {
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
- }, dr = {
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: ur,
127
- dependencies: cr,
126
+ peerDependencies: cr,
127
+ dependencies: ur,
128
128
  devDependencies: fr
129
- }, pr = ({ sizes: e }) => {
129
+ }, dr = ({ sizes: e }) => {
130
130
  const t = L([]), r = D(
131
131
  () => t.value[0]
132
- ), o = (a) => {
133
- const s = a instanceof yt ? a : t.value.find((f) => f.uuid === a);
134
- if (!s)
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 !== s.uuid);
137
- t.value = [s, ...n];
138
- }, i = (a, s = !1) => {
139
- t.value.some(({ uuid: n }) => n === a.uuid) || (s ? o(a) : t.value.push(a));
140
- }, u = (a) => {
141
- t.value = t.value.filter(({ uuid: s }) => s !== a.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 ge(() => {
144
- e.aspectRatio.value && t.value.forEach((a) => {
145
- !a.manual && (a instanceof de || mr(a)) && (a instanceof de ? a.aspect = e.aspectRatio.value : (a.left = e.width.value * -0.5, a.right = e.width.value * 0.5, a.top = e.height.value * 0.5, a.bottom = e.height.value * -0.5), a.updateProjectionMatrix());
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: i,
153
- deregisterCamera: u,
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 = O(), Xe = O(), ye = O(), V = new Ve();
160
+ const Ke = A(), Xe = A(), ye = A(), V = new Ve();
161
161
  let ne = 0, oe = 0;
162
- const { pause: vr, resume: Be, isActive: gr } = Qe(
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: vr,
176
+ pause: gr,
177
177
  resume: Be,
178
- isActive: gr
179
- }), dn = !0, K = "[TresJS ▲ ■ ●] ";
180
- function U() {
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, i) {
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 pn(e) {
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, a = 1 + 0.07 * Math.sin(2.5 * o);
210
- this.scale.set(a, a, a);
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
- }, br = "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", wr = /* @__PURE__ */ _r(br);
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 i = 0; i < o.length; i++)
231
- r[o[i]] = !0;
232
- return (i) => !!r[i];
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 i of e) {
237
- const u = t(i);
238
- r.has(u) || (r.add(u), o.push(i));
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, i) => o && o[i], e);
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((i, u, a) => (i[u] === void 0 && (i[u] = {}), a === o.length - 1 && (i[u] = r), i[u]), e);
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 i = e.attributes, u = t.attributes;
253
- return i.length !== u.length ? !1 : Array.from(i).every(({ name: a, value: s }) => t.getAttribute(a) === s);
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 i of r)
263
- if (!o.includes(i) || !et(e[i], t[i]))
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 kr(e, t) {
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 Sr = Array.isArray;
275
+ const Tr = Array.isArray;
276
276
  function xr(e, t, r, o) {
277
- const i = (n) => {
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 = i(f);
281
+ const h = s(f);
282
282
  if (h)
283
283
  return h;
284
284
  }
285
- }, u = i(e);
286
- if (!u) {
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 a = u;
290
+ let i = c;
291
291
  for (let n = 0; n < r.length - 1; n++)
292
- if (a[r[n]] !== void 0)
293
- a = a[r[n]];
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 s = r[r.length - 1];
299
- a[s] !== void 0 ? a[s] = o : console.warn(`Property path is not valid: ${r.join(".")}`);
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 Tr(e) {
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: bt
309
+ side: wt
310
310
  // To e
311
311
  });
312
312
  return new yr(e.geometry.clone(), t);
313
313
  }
314
- function Ar(e) {
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 Or(e) {
319
+ function Ar(e) {
320
320
  return "map" in e;
321
321
  }
322
322
  function He(e) {
323
- Or(e) && e.map && e.map.dispose(), e.dispose();
323
+ Ar(e) && e.map && e.map.dispose(), e.dispose();
324
324
  }
325
- function be(e) {
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((i) => be(i)), !(e instanceof qe)) {
328
- const i = e;
329
- e && ((o = e.dispose) == null || o.call(e)), i.geometry && (i.geometry.dispose(), delete i.geometry), Array.isArray(i.material) ? (i.material.forEach((u) => He(u)), delete i.material) : i.material && (He(i.material), delete i.material);
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(wt.replace("dev", "")), Z = {
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: i, advance: u }
352
+ contextParts: { sizes: r, render: o, invalidate: s, advance: c }
353
353
  }) {
354
- const a = D(() => ({
355
- alpha: S(t.alpha) ?? !0,
356
- depth: S(t.depth),
354
+ const i = D(() => ({
355
+ alpha: T(t.alpha) ?? !0,
356
+ depth: T(t.depth),
357
357
  canvas: Ht(e),
358
- context: S(t.context),
359
- stencil: S(t.stencil),
360
- antialias: S(t.antialias) ?? !0,
361
- precision: S(t.precision),
362
- powerPreference: S(t.powerPreference),
363
- premultipliedAlpha: S(t.premultipliedAlpha),
364
- preserveDrawingBuffer: S(t.preserveDrawingBuffer),
365
- logarithmicDepthBuffer: S(t.logarithmicDepthBuffer),
366
- failIfMajorPerformanceCaveat: S(t.failIfMajorPerformanceCaveat)
367
- })), s = H(new ae(a.value));
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" && i();
369
+ t.renderMode === "on-demand" && s();
370
370
  }
371
- G(a, () => {
372
- s.value.dispose(), s.value = new ae(a.value), n();
371
+ G(i, () => {
372
+ a.value.dispose(), a.value = new ae(i.value), n();
373
373
  }), G([r.width, r.height], () => {
374
- s.value.setSize(r.width.value, r.height.value), n();
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 } = Ut();
378
+ const { pixelRatio: f } = $t();
379
379
  G(f, () => {
380
- s.value.setPixelRatio(f.value);
380
+ a.value.setPixelRatio(f.value);
381
381
  });
382
- const { logError: h } = U(), b = (() => {
383
- const d = new ae(), P = {
382
+ const { logError: h } = $(), w = (() => {
383
+ const p = new ae(), P = {
384
384
  shadowMap: {
385
- enabled: d.shadowMap.enabled,
386
- type: d.shadowMap.type
385
+ enabled: p.shadowMap.enabled,
386
+ type: p.shadowMap.type
387
387
  },
388
- toneMapping: d.toneMapping,
389
- toneMappingExposure: d.toneMappingExposure,
390
- outputColorSpace: d.outputColorSpace
388
+ toneMapping: p.toneMapping,
389
+ toneMappingExposure: p.toneMappingExposure,
390
+ outputColorSpace: p.outputColorSpace
391
391
  };
392
- return d.dispose(), P;
393
- })(), w = S(t.renderMode);
394
- return w === "on-demand" && i(), w === "manual" && setTimeout(() => {
395
- u();
396
- }, 100), ge(() => {
397
- const d = S(t.preset);
398
- d && (d in Z || h(`Renderer Preset must be one of these: ${Object.keys(Z).join(", ")}`), Ze(s.value, Z[d])), w === "always" && (o.frames.value = Math.max(1, o.frames.value));
399
- const P = (p, M) => {
400
- const _ = S(p), c = () => {
401
- if (d)
402
- return Ie(Z[d], M);
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 g = c();
407
- return g !== void 0 ? g : Ie(b, M);
408
- }, y = (p, M) => Er(s.value, M, P(p, M));
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 v = P(t.clearColor, "clearColor");
411
- v && s.value.setClearColor(
412
- v ? hr(v) : new re(0)
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
- s.value.dispose(), s.value.forceContextLoss();
416
+ a.value.dispose(), a.value.forceContextLoss();
417
417
  }), {
418
- renderer: s
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, i) {
429
- const { logError: u } = U(), a = new e();
430
- i && i(a), r && r(a);
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
- a.load(
433
+ i.load(
434
434
  f,
435
- (b) => {
436
- b.scene && Object.assign(b, jr(b.scene)), h(b);
435
+ (w) => {
436
+ w.scene && Object.assign(w, jr(w.scene)), h(w);
437
437
  },
438
438
  o,
439
- (b) => l(u("[useLoader] - Failed to load resource", b))
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 vn(e, t) {
446
- const r = new Ct(t), o = (i) => new Promise((u, a) => {
445
+ async function gn(e, t) {
446
+ const r = new Ct(t), o = (s) => new Promise((c, i) => {
447
447
  r.load(
448
- i,
449
- (s) => u(s),
448
+ s,
449
+ (a) => c(a),
450
450
  () => null,
451
451
  () => {
452
- a(new Error("[useTextures] - Failed to load texture"));
452
+ i(new Error("[useTextures] - Failed to load texture"));
453
453
  }
454
454
  );
455
455
  });
456
- if (Sr(e)) {
457
- const i = await Promise.all(e.map((u) => o(u)));
458
- return e.length > 1 ? i : i[0];
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: i,
462
- displacementMap: u,
463
- normalMap: a,
464
- roughnessMap: s,
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: i ? await o(i) : null,
472
- displacementMap: u ? await o(u) : null,
473
- normalMap: a ? await o(a) : null,
474
- roughnessMap: s ? await o(s) : null,
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: i, y: u } = $t({ target: r }), a = D(() => e.value.filter((m) => {
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 s = 0;
488
- const { width: n, height: f, top: h, left: l } = Ft(r), b = ({ x: m, y: C }) => {
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
- }, w = ({ x: m, y: C }) => {
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(a.value, !0), o.value;
497
- }, d = (m) => {
498
- const C = b({
499
- x: (m == null ? void 0 : m.clientX) ?? i.value,
500
- y: (m == null ? void 0 : m.clientY) ?? u.value
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 ? w(C) || [] : [];
503
- }, P = O(), y = O(), v = O(), p = O(), M = O(), _ = O(), c = O(), g = O();
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 k = (m, C) => {
511
- var Ee, ke, Se;
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: (ke = t.raycaster) == null ? void 0 : ke.value.ray,
519
- camera: (Se = t.camera) == null ? void 0 : Se.value,
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: s,
521
+ delta: a,
522
522
  stopPropagating: !1
523
523
  });
524
524
  };
525
525
  let B;
526
526
  const x = (m) => {
527
- d(m), k(v, m), B = m;
528
- }, T = () => {
527
+ p(m), S(g, m), B = m;
528
+ }, k = () => {
529
529
  B && x(B);
530
530
  };
531
- let $, A, q;
531
+ let F, O, q;
532
532
  const Y = (m) => {
533
533
  var C;
534
- $ = (C = o.value[0]) == null ? void 0 : C.object, s = 0, A = new le(
535
- (m == null ? void 0 : m.clientX) ?? i.value,
536
- (m == null ? void 0 : m.clientY) ?? u.value
537
- ), k(M, m);
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 && k(_, m), $ === ((C = o.value[0]) == null ? void 0 : C.object) && (q = new le(
543
- (m == null ? void 0 : m.clientX) ?? i.value,
544
- (m == null ? void 0 : m.clientY) ?? u.value
545
- ), s = A == null ? void 0 : A.distanceTo(q), m.button === 0 ? (k(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 && k(c, m)), k(p, m));
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 && (k(y, m), se = void 0, J = !1);
548
- }, _e = (m) => k(v, m), Ce = (m) => k(g, 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) => c.on(m).off,
556
- onPointerMove: (m) => v.on(m).off,
557
- onPointerUp: (m) => p.on(m).off,
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) => g.on(m).off,
561
- forceUpdate: T
560
+ onWheel: (m) => v.on(m).off,
561
+ forceUpdate: k
562
562
  };
563
563
  };
564
- function gn() {
565
- const { logWarning: e } = U();
566
- function t(u, a, s) {
564
+ function vn() {
565
+ const { logWarning: e } = $();
566
+ function t(c, i, a) {
567
567
  let n = null;
568
- return u.traverse((f) => {
569
- f[a] === s && (n = f);
570
- }), n || e(`Child with ${a} '${s}' not found.`), n;
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(u, a, s) {
572
+ function r(c, i, a) {
573
573
  const n = [];
574
- return u.traverse((f) => {
575
- f[a].includes(s) && n.push(f);
576
- }), n.length || e(`Children with ${a} '${s}' not found.`), n;
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(u, a) {
579
- return t(u, "name", a);
578
+ function o(c, i) {
579
+ return t(c, "name", i);
580
580
  }
581
- function i(u, a) {
582
- return r(u, "name", a);
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: i
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
- }, i = (l) => {
599
+ }, s = (l) => {
600
600
  r.value.delete(l);
601
- }, u = (l) => {
602
- Object.values(t).forEach((b) => b.delete(l)), i(l);
603
- }, a = (l) => {
604
- const { onClick: b, onPointerMove: w, onPointerEnter: d, onPointerLeave: P } = l;
605
- b && t.click.set(l, b), w && t.pointerMove.set(l, w), d && t.pointerEnter.set(l, d), P && t.pointerLeave.set(l, P);
606
- }, s = D(
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 = a, e.deregisterObjectAtPointerEventHandler = u, e.registerBlockingObjectAtPointerEventHandler = o, e.deregisterBlockingObjectAtPointerEventHandler = i;
616
- const { onClick: n, onPointerMove: f } = tt(s, e);
617
- n(({ intersects: l, event: b }) => {
618
- var w;
619
- l.length && ((w = t.click.get(l[0].object)) == null || w(l[0], b));
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: b }) => {
623
- var v, p, M, _;
624
- const w = (v = l == null ? void 0 : l[0]) == null ? void 0 : v.object, { pointerLeave: d, pointerEnter: P, pointerMove: y } = t;
625
- h && h !== w && ((p = d.get(h)) == null || p(h, b)), w && (h !== w && ((M = P.get(w)) == null || M(l[0], b)), (_ = y.get(w)) == null || _(l[0], b)), h = w || null;
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: a,
628
- deregisterObject: u,
627
+ registerObject: i,
628
+ deregisterObject: c,
629
629
  registerBlockingObject: o,
630
- deregisterBlockingObject: i
630
+ deregisterBlockingObject: s
631
631
  };
632
632
  };
633
- function we(e) {
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, i = o.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, u = o.index ? o.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, a = o.attributes.normal ? o.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, s = o.attributes.uv ? o.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, n = i + u + a + s;
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 pe = L({}), me = (e) => Object.assign(pe.value, e);
645
+ const de = L({}), me = (e) => Object.assign(de.value, e);
646
646
  function Ir(e, t, r = 10) {
647
- const o = S(e) ? Wt() : Nt(D(() => S(t).parentElement)), i = ce(De(o.width, r)), u = ce(De(o.height, r)), a = D(() => i.value / u.value);
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: u,
650
- width: i,
651
- aspectRatio: a
649
+ height: c,
650
+ width: s,
651
+ aspectRatio: i
652
652
  };
653
653
  }
654
- function ue() {
654
+ function ce() {
655
655
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
656
656
  let r = 0, o = !1;
657
- const i = () => {
657
+ const s = () => {
658
658
  const f = Array.from(e.entries()).sort((h, l) => {
659
- const b = h[1].priority - l[1].priority;
660
- return b === 0 ? h[1].addI - l[1].addI : b;
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
- }, u = (f) => {
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 = () => u(f);
668
+ const l = () => c(f);
669
669
  return zt(l), o = !0, {
670
670
  off: l
671
671
  };
672
- }, off: u, trigger: (...f) => {
673
- o && (i(), o = !1), t.forEach((h) => h(...f));
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 i = Et.generateUUID();
684
- let u = null;
685
- const a = ue(), s = ue(), n = ue();
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, _, c = 0) {
690
+ function l(M, _, u = 0) {
691
691
  switch (_) {
692
692
  case "before":
693
- return a.on(M, c);
693
+ return i.on(M, u);
694
694
  case "render":
695
- return u || (u = M), s.dispose(), s.on(M);
695
+ return c || (c = M), a.dispose(), a.on(M);
696
696
  case "after":
697
- return n.on(M, c);
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 d() {
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 v() {
715
+ function g() {
716
716
  r.value = !1;
717
717
  }
718
- function p() {
719
- const M = e.getDelta(), _ = e.getElapsedTime(), c = {
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
- }, g = { delta: M, elapsed: _, clock: e, ...c };
728
- t.value && a.trigger(g), r.value || (s.count ? s.trigger(g) : u && u(g)), t.value && n.trigger(g), o = requestAnimationFrame(p);
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: i,
732
- register: (M, _, c) => l(M, _, c),
733
- start: b,
734
- stop: w,
735
- pause: d,
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: v,
738
+ resumeRender: g,
739
739
  isRenderPaused: r,
740
740
  isActive: t,
741
741
  setContext: h
742
742
  };
743
743
  }
744
- function Ur({
744
+ function $r({
745
745
  scene: e,
746
746
  canvas: t,
747
747
  windowSize: r,
748
748
  disableRender: o,
749
- rendererOptions: i,
750
- emit: u
749
+ rendererOptions: s,
750
+ emit: c
751
751
  }) {
752
- const { logWarning: a } = U(), s = H(e), n = Ir(r, t), {
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: b,
757
- setCameraActive: w
758
- } = pr({ sizes: n, scene: e }), d = {
759
- mode: L(i.renderMode || "always"),
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(() => d.mode.value === "on-demand" && d.frames.value === 0)
763
+ canBeInvalidated: D(() => p.mode.value === "on-demand" && p.frames.value === 0)
764
764
  };
765
- function P(A = 1) {
766
- i.renderMode === "on-demand" ? d.frames.value = Math.min(d.maxFrames, d.frames.value + A) : a("`invalidate` can only be used when `renderMode` is set to `on-demand`");
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
- i.renderMode === "manual" ? d.frames.value = 1 : a("`advance` can only be used when `renderMode` is set to `manual`");
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: v } = Dr(
771
+ const { renderer: g } = Dr(
772
772
  {
773
773
  scene: e,
774
774
  canvas: t,
775
- options: i,
776
- emit: u,
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: d, invalidate: P, advance: y },
778
+ contextParts: { sizes: n, camera: f, render: p, invalidate: P, advance: y },
779
779
  disableRender: o
780
780
  }
781
- ), p = {
781
+ ), d = {
782
782
  sizes: n,
783
- scene: s,
783
+ scene: a,
784
784
  camera: f,
785
- cameras: ce(h),
786
- renderer: v,
787
- raycaster: H(new kt()),
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: d,
801
+ render: p,
802
802
  advance: y,
803
803
  extend: me,
804
804
  invalidate: P,
805
805
  registerCamera: l,
806
- setCameraActive: w,
807
- deregisterCamera: b,
806
+ setCameraActive: b,
807
+ deregisterCamera: w,
808
808
  loop: Hr()
809
809
  };
810
- fe("useTres", p), p.scene.value.__tres = {
811
- root: p
812
- }, p.loop.register(() => {
813
- f.value && d.frames.value > 0 && (v.value.render(e, f.value), u("render", p.renderer.value)), d.priority.value = 0, d.mode.value === "always" ? d.frames.value = 1 : d.frames.value = Math.max(0, d.frames.value - 1);
814
- }, "render"), p.loop.start(), N(() => {
815
- p.loop.stop();
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: c, memory: g } = Vt({ interval: M }), E = 160;
818
- let k = performance.now();
819
- const B = ({ timestamp: A }) => {
820
- p.scene.value && (p.perf.memory.allocatedMem = we(p.scene.value)), A - k >= M && (k = A, p.perf.fps.accumulator.push(_.value), p.perf.fps.accumulator.length > E && p.perf.fps.accumulator.shift(), p.perf.fps.value = _.value, c.value && g.value && (p.perf.memory.accumulator.push(g.value.usedJSHeapSize / 1024 / 1024), p.perf.memory.accumulator.length > E && p.perf.memory.accumulator.shift(), p.perf.memory.currentMem = p.perf.memory.accumulator.reduce((q, Y) => q + Y, 0) / p.perf.memory.accumulator.length));
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 T = 1, { pause: $ } = Qe(({ delta: A }) => {
824
- window.__TRES__DEVTOOLS__ && (B({ timestamp: performance.now() }), x += A, x >= T && (window.__TRES__DEVTOOLS__.cb(p), x = 0));
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
- }), p;
827
+ F();
828
+ }), d;
829
829
  }
830
830
  function rt() {
831
- const e = ut("useTres");
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 bn() {
837
+ function wn() {
838
838
  const {
839
839
  camera: e,
840
840
  scene: t,
841
841
  renderer: r,
842
842
  loop: o,
843
- raycaster: i,
844
- controls: u,
845
- invalidate: a,
846
- advance: s
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: i,
853
- controls: u,
854
- invalidate: a,
855
- advance: s
852
+ raycaster: s,
853
+ controls: c,
854
+ invalidate: i,
855
+ advance: a
856
856
  });
857
- function n(l, b = 0) {
858
- return o.register(l, "before", b);
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, b = 0) {
864
- return o.register(l, "after", b);
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 $r(e, t, r) {
878
- const o = H(), i = H();
879
- e && (o.value = e), t && (i.value = t);
880
- const u = D(
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 a(c, g) {
884
- if (Array.isArray(c))
885
- for (const E of c)
886
- E(g);
887
- typeof c == "function" && c(g);
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 s(c, g) {
890
- const E = [], k = () => g.stopPropagating = !0;
891
- g.stopPropagation = k;
892
- for (const B of g == null ? void 0 : g.intersections) {
893
- if (g.stopPropagating)
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
- g = { ...g, ...B };
895
+ v = { ...v, ...B };
896
896
  const { object: x } = B;
897
- g.eventObject = x, a(x[c], g), E.push(x);
898
- let T = x.parent;
899
- for (; T !== null && !g.stopPropagating && !E.includes(T); )
900
- g.eventObject = T, a(T[c], g), E.push(T), T = T.parent;
901
- const $ = Pr(c.slice(2));
902
- r($, { intersection: B, event: g });
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: b,
911
- onPointerUp: w,
912
- onPointerMissed: d,
910
+ onPointerDown: w,
911
+ onPointerUp: b,
912
+ onPointerMissed: p,
913
913
  onWheel: P,
914
914
  forceUpdate: y
915
- } = tt(u, t);
916
- w((c) => s("onPointerUp", c)), b((c) => s("onPointerDown", c)), n((c) => s("onClick", c)), f((c) => s("onDoubleClick", c)), h((c) => s("onContextMenu", c)), P((c) => s("onWheel", c));
917
- let v = [];
918
- l((c) => {
919
- const g = c.intersections.map(({ object: k }) => k), E = c.intersections;
920
- v.forEach(({ object: k }) => {
921
- g.includes(k) || (c.intersections = v, s("onPointerLeave", c), s("onPointerOut", c));
922
- }), c.intersections = E, c.intersections.forEach(({ object: k }) => {
923
- v.includes(k) || (s("onPointerEnter", c), s("onPointerOver", c));
924
- }), s("onPointerMove", c), v = c.intersections;
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 p = [];
927
- d((c) => {
928
- const g = () => c.stopPropagating = !0;
929
- c.stopPropagation = g, p.forEach((E) => {
930
- c.stopPropagating || (c.eventObject = E, a(E.onPointerMissed, c));
931
- }), r("pointer-missed", { event: c });
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(c) {
934
- p.push(c);
933
+ function M(u) {
934
+ d.push(u);
935
935
  }
936
- function _(c) {
937
- const g = p.indexOf(c);
938
- g > -1 && p.splice(g, 1);
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: Ue } = U(), $e = [
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 Fe(e) {
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 Fr = () => {
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" || wr(n))
970
+ if (l || (l = {}), l.args || (l.args = []), n === "template" || br(n))
971
971
  return null;
972
- let b = n.replace("Tres", ""), w;
972
+ let w = n.replace("Tres", ""), b;
973
973
  if (n === "primitive") {
974
- (l == null ? void 0 : l.object) === void 0 && Ue("Tres primitives need a prop 'object'");
975
- const d = l.object;
976
- b = d.type, w = Object.assign(d.clone(), { type: b });
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 d = pe.value[b];
979
- d || Ue(
980
- `${b} is not defined on the THREE namespace. Use extend to add it to the catalog.`
981
- ), w = new d(...l.args);
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 w ? (w.isCamera && (l != null && l.position || w.position.set(3, 3, 3), l != null && l.lookAt || w.lookAt(0, 0, 0)), (l == null ? void 0 : l.attach) === void 0 && (w.isMaterial ? w.attach = "material" : w.isBufferGeometry && (w.attach = "geometry")), w.__tres = {
984
- ...w.__tres,
985
- type: b,
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
- }, w.isObject3D && w.__tres && (l != null && l.material || l != null && l.geometry) && (w.__tres.disposable = !1), w) : null;
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, b, w, d, P;
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 && ((b = n == null ? void 0 : n.__tres) != null && b.root) && ((P = (d = (w = n == null ? void 0 : n.__tres) == null ? void 0 : w.root) == null ? void 0 : d.eventManager) == null || P.registerPointerMissedObject(n));
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, b, w;
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 d = (y) => {
1011
- var p, M;
1012
- const v = (M = (p = n == null ? void 0 : n.__tres) == null ? void 0 : p.root) == null ? void 0 : M.deregisterCamera;
1013
- y.isCamera && (v == null || v(y));
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 v, p;
1017
- d(y), y.onPointerMissed && ((p = (v = f == null ? void 0 : f.root) == null ? void 0 : v.eventManager) == null || p.deregisterPointerMissedObject(y));
1018
- }), d(n), Fe(n), !((l = n.__tres) == null ? void 0 : l.primitive) && ((b = n.__tres) != null && b.disposable) && be(n), (w = n.dispose) == null || w.call(n);
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 i(n, f, h, l) {
1022
- var b, w;
1021
+ function s(n, f, h, l) {
1022
+ var w, b;
1023
1023
  if (n) {
1024
- let d = n, P = f;
1025
- if ((b = n == null ? void 0 : n.__tres) != null && b.primitive && P === "object" && h !== null) {
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 c = n[_], g = M[_];
1033
- !(c != null && c.set) && !ee(c) ? n[_] = g : c.constructor === g.constructor && (c != null && c.copy) ? c == null || c.copy(g) : Array.isArray(g) ? c.set(...g) : !c.isColor && c.setScalar ? c.setScalar(g) : c.set(g);
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
- $e.includes(f) && (n.__tres.eventCount += 1);
1042
- let y = X(P), v = d == null ? void 0 : d[y];
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 ?? [], c = l ?? [], g = ((w = n == null ? void 0 : n.__tres) == null ? void 0 : w.type) || n.type;
1045
- g && _.length && !kr(_, c) && (d = Object.assign(
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 pe.value[g](...l)
1047
+ new de.value[v](...l)
1048
1048
  ));
1049
1049
  return;
1050
1050
  }
1051
- if (d.type === "BufferGeometry") {
1051
+ if (p.type === "BufferGeometry") {
1052
1052
  if (P === "args")
1053
1053
  return;
1054
- d.setAttribute(
1054
+ p.setAttribute(
1055
1055
  X(P),
1056
- new St(...l)
1056
+ new Tt(...l)
1057
1057
  );
1058
1058
  return;
1059
1059
  }
1060
- if (P.includes("-") && v === void 0) {
1060
+ if (P.includes("-") && g === void 0) {
1061
1061
  const M = P.split("-");
1062
- v = M.reduce((_, c) => _[X(c)], d), P = M.pop(), y = P, v != null && v.set || (d = M.reduce((_, c) => _[X(c)], d));
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 p = l;
1065
- if (p === "" && (p = !0), ee(v)) {
1066
- $e.includes(f) || (Array.isArray(p) ? n[y](...p) : n[y](p)), y.startsWith("on") && ee(p) && (d[y] = p);
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
- !(v != null && v.set) && !ee(v) ? d[y] = p : v.constructor === p.constructor && (v != null && v.copy) ? v == null || v.copy(p) : Array.isArray(p) ? v.set(...p) : !v.isColor && v.setScalar ? v.setScalar(p) : v.set(p), Fe(n);
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 u(n) {
1072
+ function c(n) {
1073
1073
  return (n == null ? void 0 : n.parent) || null;
1074
1074
  }
1075
- function a(n) {
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 s(n) {
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: i,
1090
- parentNode: u,
1089
+ patchProp: s,
1090
+ parentNode: c,
1091
1091
  createText: () => void 0,
1092
- createComment: a,
1092
+ createComment: i,
1093
1093
  setText: () => void 0,
1094
1094
  setElementText: () => void 0,
1095
- nextSibling: s,
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 F, ve;
1109
+ let U, ge;
1110
1110
  function Vr() {
1111
1111
  var e;
1112
- return F !== void 0 || (typeof window < "u" && window.performance ? (F = !0, ve = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (F = !0, ve = globalThis.perf_hooks.performance) : F = !1), F;
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() ? ve.now() : Date.now();
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 a in t.settings) {
1123
- const s = t.settings[a];
1124
- o[a] = s.defaultValue;
1122
+ for (const i in t.settings) {
1123
+ const a = t.settings[i];
1124
+ o[i] = a.defaultValue;
1125
1125
  }
1126
- const i = `__vue-devtools-plugin-settings__${t.id}`;
1127
- let u = Object.assign({}, o);
1126
+ const s = `__vue-devtools-plugin-settings__${t.id}`;
1127
+ let c = Object.assign({}, o);
1128
1128
  try {
1129
- const a = localStorage.getItem(i), s = JSON.parse(a);
1130
- Object.assign(u, s);
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 u;
1135
+ return c;
1136
1136
  },
1137
- setSettings(a) {
1137
+ setSettings(i) {
1138
1138
  try {
1139
- localStorage.setItem(i, JSON.stringify(a));
1139
+ localStorage.setItem(s, JSON.stringify(i));
1140
1140
  } catch {
1141
1141
  }
1142
- u = a;
1142
+ c = i;
1143
1143
  },
1144
1144
  now() {
1145
1145
  return qr();
1146
1146
  }
1147
- }, r && r.on(Gr, (a, s) => {
1148
- a === this.plugin.id && this.fallbacks.setSettings(s);
1147
+ }, r && r.on(Gr, (i, a) => {
1148
+ i === this.plugin.id && this.fallbacks.setSettings(a);
1149
1149
  }), this.proxiedOn = new Proxy({}, {
1150
- get: (a, s) => this.target ? this.target.on[s] : (...n) => {
1150
+ get: (i, a) => this.target ? this.target.on[a] : (...n) => {
1151
1151
  this.onQueue.push({
1152
- method: s,
1152
+ method: a,
1153
1153
  args: n
1154
1154
  });
1155
1155
  }
1156
1156
  }), this.proxiedTarget = new Proxy({}, {
1157
- get: (a, s) => this.target ? this.target[s] : s === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(s) ? (...n) => (this.targetQueue.push({
1158
- method: s,
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[s](...n)) : (...n) => new Promise((f) => {
1162
+ }), this.fallbacks[a](...n)) : (...n) => new Promise((f) => {
1163
1163
  this.targetQueue.push({
1164
- method: s,
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(), i = Wr(), u = Nr && r.enableEarlyProxy;
1181
- if (i && (o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !u))
1182
- i.emit(zr, e, t);
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 a = u ? new Yr(r, i) : null;
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: a
1189
- }), a && t(a.proxiedTarget);
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 = we(e);
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 i = ot(o);
1244
- t.children.push(i), st(o, i, r);
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((u) => {
1274
- if (u.inspectorId === z) {
1275
- const a = ot(t.scene.value);
1276
- st(t.scene.value, a, u.filter), Xr.sceneGraph = a, u.rootNodes = [a];
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, i = null;
1280
- r.on.getInspectorState((u) => {
1281
- var a;
1282
- if (u.inspectorId === z) {
1283
- const [s] = t.scene.value.getObjectsByProperty("uuid", u.nodeId);
1284
- if (!s)
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 (i && o && o.parent && i.remove(o), s.isMesh) {
1287
- const n = Tr(s);
1288
- s.add(n), o = n, i = s;
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
- u.state = {
1291
- object: [
1292
- {
1293
- key: "uuid",
1294
- editable: !0,
1295
- value: s.uuid
1296
- },
1297
- {
1298
- key: "name",
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
- }, u.state.programs = ((a = t.renderer.value.info.programs) == null ? void 0 : a.map((n) => ({
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((u) => {
1393
- u.inspectorId === z && xr(t.scene.value, u.nodeId, u.path, u.state.value);
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, i = r, u = ct(), { logWarning: a } = U(), s = L(), n = H(new qe()), f = (P = Te()) == null ? void 0 : P.appContext.app;
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 p;
1447
- const v = (p = Te()) == null ? void 0 : p.appContext;
1448
- return v && (v.app = f), fe("useTres", y), fe("extend", me), typeof window < "u" && Zr(v == null ? void 0 : v.app, y), () => Ae(ht, null, u != null && u.default ? u.default() : []);
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 v = h(y), { render: p } = gt(Fr());
1452
- p(Ae(v), n.value);
1453
- }, b = (y, v = !1) => {
1454
- be(y.scene.value), v && (y.renderer.value.dispose(), y.renderer.value.renderLists.dispose(), y.renderer.value.forceContextLoss()), n.value.__tres = {
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
- }, w = D(() => o.disableRender), d = H(null);
1458
- return t({ context: d, dispose: () => b(d.value, !0) }), ft(() => {
1459
- const y = s;
1460
- d.value = Ur({
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: w.value ?? !1,
1385
+ disableRender: b.value ?? !1,
1465
1386
  rendererOptions: o,
1466
- emit: i
1467
- }), $r(n.value, d.value, i);
1468
- const { registerCamera: v, camera: p, cameras: M, deregisterCamera: _ } = d.value;
1469
- l(d.value);
1470
- const c = () => {
1471
- const g = new de(
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
- g.position.set(3, 3, 3), g.lookAt(0, 0, 0), v(g);
1478
- const E = ge(() => {
1479
- M.value.length >= 2 && (g.removeFromParent(), _(g), E == null || E());
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
- (g, E) => {
1485
- g && v(g), E && (E.removeFromParent(), _(E));
1405
+ (v, E) => {
1406
+ v && g(v), E && (E.removeFromParent(), _(E));
1486
1407
  },
1487
1408
  {
1488
1409
  immediate: !0
1489
1410
  }
1490
- ), p.value || (a(
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
- ), c());
1413
+ ), u());
1493
1414
  }), N(() => {
1494
- b(d.value);
1495
- }), (y, v) => (dt(), pt("canvas", {
1415
+ w(p.value);
1416
+ }), (y, g) => (pt(), dt("canvas", {
1496
1417
  ref_key: "canvas",
1497
- ref: s,
1418
+ ref: a,
1498
1419
  "data-scene": n.value.uuid,
1499
1420
  class: mt(y.$attrs.class),
1500
- "data-tres": `tresjs ${W(dr).version}`,
1501
- style: vt({
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
- }, wn = nn, Mn = {
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 Tt {
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], i = new Oe();
1536
- i.setAttribute("position", new Le(o, 3)), i.computeBoundingSphere();
1537
- const u = new At({ fog: !1 });
1538
- super(i, u), this.light = t, this.color = r, this.type = "RectAreaLightHelper";
1539
- const a = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], s = new Oe();
1540
- s.setAttribute("position", new Le(a, 3)), s.computeBoundingSphere(), this.add(new Ot(s, new Ye({ side: Lt, fog: !1 })));
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 } = U();
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 } = U();
1503
+ }, { logWarning: sn } = $();
1583
1504
  let j = null;
1584
1505
  const _n = {
1585
1506
  updated: (e, t) => {
1586
- var i;
1587
- const r = Ar(t);
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:${(i = e.position) == null ? void 0 : i.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
- pe as catalogue,
1533
+ de as catalogue,
1613
1534
  Hr as createRenderLoop,
1614
1535
  Cn as default,
1615
- be as dispose,
1536
+ we as dispose,
1616
1537
  me as extend,
1617
- dn as isProd,
1538
+ pn as isProd,
1618
1539
  hr as normalizeColor,
1619
- pn as normalizeVectorFlexibleParam,
1620
- wn as templateCompilerOptions,
1540
+ dn as normalizeVectorFlexibleParam,
1541
+ bn as templateCompilerOptions,
1621
1542
  jr as trasverseObjects,
1622
- pr as useCamera,
1543
+ dr as useCamera,
1623
1544
  mn as useLoader,
1624
- U as useLogger,
1625
- bn as useLoop,
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
- gn as useSeek,
1631
- vn as useTexture,
1551
+ vn as useSeek,
1552
+ gn as useTexture,
1632
1553
  yn as useTres,
1633
1554
  rt as useTresContext,
1634
- Ur as useTresContextProvider,
1635
- $r as useTresEventManager,
1555
+ $r as useTresContextProvider,
1556
+ Fr as useTresEventManager,
1636
1557
  _n as vDistanceTo,
1637
1558
  Pn as vLightHelper,
1638
1559
  Mn as vLog