@tresjs/core 3.1.0 → 3.2.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,120 +1,132 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v3.1.0
3
+ * version: v3.2.0
4
4
  * (c) 2023
5
5
  * description: Declarative ThreeJS using Vue Components
6
6
  * author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
7
7
  */
8
- import { ref as H, computed as _, watchEffect as L, onUnmounted as N, shallowRef as z, watch as ee, reactive as ie, readonly as ue, provide as I, inject as le, createRenderer as ce, defineComponent as U, useSlots as fe, onMounted as me, openBlock as pe, createElementBlock as ve, normalizeStyle as de, h as J, Fragment as ge } from "vue";
8
+ import { ref as h, computed as M, watchEffect as D, onUnmounted as N, shallowRef as F, watch as ee, reactive as ie, readonly as ue, provide as I, inject as le, createRenderer as ce, defineComponent as U, useSlots as fe, onMounted as me, openBlock as pe, createElementBlock as ve, normalizeStyle as de, h as J, Fragment as ge } from "vue";
9
9
  import * as ye from "three";
10
- import { PerspectiveCamera as V, OrthographicCamera as we, Camera as Ce, Clock as Pe, SRGBColorSpace as Me, ACESFilmicToneMapping as _e, PCFSoftShadowMap as Ee, Vector3 as xe, Color as B, REVISION as Ae, WebGLRenderer as j, LoadingManager as De, TextureLoader as Le, Vector2 as he, Raycaster as ke, BufferAttribute as Te, Scene as be } from "three";
11
- import { createEventHook as k, useRafFn as Se, toValue as w, unrefElement as Oe, useDevicePixelRatio as Be, usePointer as Re, useElementBounding as Fe, useWindowSize as ze, useElementSize as He } from "@vueuse/core";
12
- const je = ({ sizes: e, scene: n }) => {
13
- const t = H([]), a = _(
10
+ import { PerspectiveCamera as W, OrthographicCamera as we, Camera as Ce, Clock as _e, Vector3 as Pe, Color as R, REVISION as Ee, SRGBColorSpace as Me, ACESFilmicToneMapping as Ae, PCFSoftShadowMap as ke, WebGLRenderer as z, LoadingManager as be, TextureLoader as De, Vector2 as Oe, Raycaster as xe, BufferAttribute as he, Scene as Be } from "three";
11
+ import { createEventHook as x, useRafFn as Le, toValue as _, unrefElement as Te, useDevicePixelRatio as Se, usePointer as Re, useElementBounding as je, useWindowSize as He, useElementSize as Fe } from "@vueuse/core";
12
+ const ze = ({ sizes: e, scene: n }) => {
13
+ const t = h([]), r = M(
14
14
  () => t.value[0]
15
- ), r = (o, s = !1) => {
16
- t.value.some(({ uuid: u }) => u === o.uuid) || (s ? l(o) : t.value.push(o));
17
- }, i = (o) => {
18
- t.value = t.value.filter(({ uuid: s }) => s !== o.uuid);
19
- }, l = (o) => {
20
- const s = o instanceof Ce ? o : t.value.find((c) => c.uuid === o);
21
- if (!s)
15
+ ), a = (i, c = !1) => {
16
+ t.value.some(({ uuid: s }) => s === i.uuid) || (c ? f(i) : t.value.push(i));
17
+ }, o = (i) => {
18
+ t.value = t.value.filter(({ uuid: c }) => c !== i.uuid);
19
+ }, f = (i) => {
20
+ const c = i instanceof Ce ? i : t.value.find((m) => m.uuid === i);
21
+ if (!c)
22
22
  return;
23
- const u = t.value.filter(({ uuid: c }) => c !== s.uuid);
24
- t.value = [s, ...u];
23
+ const s = t.value.filter(({ uuid: m }) => m !== c.uuid);
24
+ t.value = [c, ...s];
25
25
  };
26
- return L(() => {
27
- e.aspectRatio.value && t.value.forEach((o) => {
28
- o instanceof V && (o.aspect = e.aspectRatio.value), (o instanceof V || o instanceof we) && o.updateProjectionMatrix();
26
+ return D(() => {
27
+ e.aspectRatio.value && t.value.forEach((i) => {
28
+ i instanceof W && (i.aspect = e.aspectRatio.value), (i instanceof W || i instanceof we) && i.updateProjectionMatrix();
29
29
  });
30
- }), n.userData.tres__registerCamera = r, n.userData.tres__deregisterCamera = i, N(() => {
30
+ }), n.userData.tres__registerCamera = a, n.userData.tres__deregisterCamera = o, N(() => {
31
31
  t.value = [];
32
32
  }), {
33
- camera: a,
33
+ camera: r,
34
34
  cameras: t,
35
- addCamera: r,
36
- removeCamera: i,
37
- setCameraActive: l
35
+ registerCamera: a,
36
+ deregisterCamera: o,
37
+ setCameraActive: f
38
38
  };
39
- }, te = k(), re = k(), $ = k(), h = new Pe();
40
- let R = 0, F = 0;
41
- const { pause: Ge, resume: Ie, isActive: Ve } = Se(
39
+ }, te = x(), re = x(), V = x(), O = new _e();
40
+ let j = 0, H = 0;
41
+ const { pause: Ge, resume: Ie, isActive: We } = Le(
42
42
  () => {
43
- te.trigger({ delta: R, elapsed: F, clock: h }), re.trigger({ delta: R, elapsed: F, clock: h }), $.trigger({ delta: R, elapsed: F, clock: h });
43
+ te.trigger({ delta: j, elapsed: H, clock: O }), re.trigger({ delta: j, elapsed: H, clock: O }), V.trigger({ delta: j, elapsed: H, clock: O });
44
44
  },
45
45
  { immediate: !1 }
46
46
  );
47
- $.on(() => {
48
- R = h.getDelta(), F = h.getElapsedTime();
47
+ V.on(() => {
48
+ j = O.getDelta(), H = O.getElapsedTime();
49
49
  });
50
50
  const ne = () => ({
51
51
  onBeforeLoop: te.on,
52
52
  onLoop: re.on,
53
- onAfterLoop: $.on,
53
+ onAfterLoop: V.on,
54
54
  pause: Ge,
55
55
  resume: Ie,
56
- isActive: Ve
57
- }), S = {
58
- realistic: {
59
- outputColorSpace: Me,
60
- toneMapping: _e,
61
- toneMappingExposure: 3,
62
- shadowMap: {
63
- enabled: !0,
64
- type: Ee
65
- }
56
+ isActive: We
57
+ }), mt = !0, K = "[TresJS ▲ ■ ●] ";
58
+ function B() {
59
+ function e(r, a) {
60
+ console.error(`${K} ${r}`, a || "");
61
+ }
62
+ function n(r) {
63
+ console.warn(`${K} ${r}`);
64
+ }
65
+ function t(r, a) {
66
66
  }
67
- }, ae = (e, n) => {
67
+ return {
68
+ logError: e,
69
+ logWarning: n,
70
+ logMessage: t
71
+ };
72
+ }
73
+ function pt(e) {
74
+ return typeof e == "number" ? [e, e, e] : e instanceof Pe ? [e.x, e.y, e.z] : e;
75
+ }
76
+ function $e(e) {
77
+ return e instanceof R ? e : Array.isArray(e) ? new R(...e) : new R(e);
78
+ }
79
+ const ae = (e, n) => {
68
80
  for (const t of Object.keys(n))
69
81
  n[t] instanceof Object && Object.assign(n[t], ae(e[t], n[t]));
70
82
  return Object.assign(e || {}, n), e;
71
- }, We = "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", Ne = /* @__PURE__ */ $e(We);
72
- function K(e) {
83
+ }, Ne = "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", Ve = /* @__PURE__ */ qe(Ne);
84
+ function X(e) {
73
85
  return e && e.nodeType === 1;
74
86
  }
75
- function O(e) {
87
+ function T(e) {
76
88
  return e.replace(/-([a-z])/g, (n, t) => t.toUpperCase());
77
89
  }
78
- function $e(e, n) {
79
- const t = /* @__PURE__ */ Object.create(null), a = e.split(",");
80
- for (let r = 0; r < a.length; r++)
81
- t[a[r]] = !0;
82
- return n ? (r) => !!t[r.toLowerCase()] : (r) => !!t[r];
90
+ function qe(e, n) {
91
+ const t = /* @__PURE__ */ Object.create(null), r = e.split(",");
92
+ for (let a = 0; a < r.length; a++)
93
+ t[r[a]] = !0;
94
+ return n ? (a) => !!t[a.toLowerCase()] : (a) => !!t[a];
83
95
  }
84
- const qe = (e, n) => {
85
- const t = /* @__PURE__ */ new Set(), a = [];
86
- for (const r of e) {
87
- const i = n(r);
88
- t.has(i) || (t.add(i), a.push(r));
96
+ const Ue = (e, n) => {
97
+ const t = /* @__PURE__ */ new Set(), r = [];
98
+ for (const a of e) {
99
+ const o = n(a);
100
+ t.has(o) || (t.add(o), r.push(a));
89
101
  }
90
- return a;
91
- }, X = (e, n) => {
102
+ return r;
103
+ }, Y = (e, n) => {
92
104
  if (!n)
93
105
  return;
94
106
  const t = Array.isArray(n) ? n : n.match(/([^[.\]])+/g);
95
- return t == null ? void 0 : t.reduce((a, r) => a && a[r], e);
96
- }, Ue = (e, n, t) => {
97
- const a = Array.isArray(n) ? n : n.match(/([^[.\]])+/g);
98
- a && a.reduce((r, i, l) => (r[i] === void 0 && (r[i] = {}), l === a.length - 1 && (r[i] = t), r[i]), e);
107
+ return t == null ? void 0 : t.reduce((r, a) => r && r[a], e);
108
+ }, Je = (e, n, t) => {
109
+ const r = Array.isArray(n) ? n : n.match(/([^[.\]])+/g);
110
+ r && r.reduce((a, o, f) => (a[o] === void 0 && (a[o] = {}), f === r.length - 1 && (a[o] = t), a[o]), e);
99
111
  };
100
112
  function oe(e, n) {
101
- if (K(e) && K(n)) {
102
- const r = e.attributes, i = n.attributes;
103
- return r.length !== i.length ? !1 : Array.from(r).every(({ name: l, value: o }) => n.getAttribute(l) === o);
113
+ if (X(e) && X(n)) {
114
+ const a = e.attributes, o = n.attributes;
115
+ return a.length !== o.length ? !1 : Array.from(a).every(({ name: f, value: i }) => n.getAttribute(f) === i);
104
116
  }
105
117
  if (e === n)
106
118
  return !0;
107
119
  if (e === null || typeof e != "object" || n === null || typeof n != "object")
108
120
  return !1;
109
- const t = Object.keys(e), a = Object.keys(n);
110
- if (t.length !== a.length)
121
+ const t = Object.keys(e), r = Object.keys(n);
122
+ if (t.length !== r.length)
111
123
  return !1;
112
- for (const r of t)
113
- if (!a.includes(r) || !oe(e[r], n[r]))
124
+ for (const a of t)
125
+ if (!r.includes(a) || !oe(e[a], n[a]))
114
126
  return !1;
115
127
  return !0;
116
128
  }
117
- function Je(e, n) {
129
+ function Ke(e, n) {
118
130
  if (!Array.isArray(e) || !Array.isArray(n) || e.length !== n.length)
119
131
  return !1;
120
132
  for (let t = 0; t < e.length; t++)
@@ -122,101 +134,86 @@ function Je(e, n) {
122
134
  return !1;
123
135
  return !0;
124
136
  }
125
- const mt = !0, Y = "[TresJS ▲ ■ ●] ";
126
- function T() {
127
- function e(a, r) {
128
- console.error(`${Y} ${a}`, r || "");
129
- }
130
- function n(a) {
131
- console.warn(`${Y} ${a}`);
132
- }
133
- function t(a, r) {
137
+ const Xe = Number.parseInt(Ee.replace("dev", "")), S = {
138
+ realistic: {
139
+ outputColorSpace: Me,
140
+ toneMapping: Ae,
141
+ toneMappingExposure: 3,
142
+ shadowMap: {
143
+ enabled: !0,
144
+ type: ke
145
+ }
134
146
  }
135
- return {
136
- logError: e,
137
- logWarning: n,
138
- logMessage: t
139
- };
140
- }
141
- function pt(e) {
142
- return typeof e == "number" ? [e, e, e] : e instanceof xe ? [e.x, e.y, e.z] : e;
143
- }
144
- function Ke(e) {
145
- return e instanceof B ? e : Array.isArray(e) ? new B(...e) : new B(e);
146
- }
147
- const Xe = Number.parseInt(Ae.replace("dev", ""));
147
+ };
148
148
  function Ye({
149
149
  scene: e,
150
150
  canvas: n,
151
151
  options: t,
152
- disableRender: a,
153
- contextParts: { sizes: r, camera: i }
152
+ disableRender: r,
153
+ contextParts: { sizes: a, camera: o }
154
154
  }) {
155
- const l = _(() => ({
156
- alpha: w(t.alpha),
157
- depth: w(t.depth),
158
- canvas: Oe(n),
159
- context: w(t.context),
160
- stencil: w(t.stencil),
161
- antialias: w(t.antialias) === void 0 ? (
162
- // an opinionated default of tres
163
- !0
164
- ) : w(t.antialias),
165
- precision: w(t.precision),
166
- powerPreference: w(t.powerPreference),
167
- premultipliedAlpha: w(t.premultipliedAlpha),
168
- preserveDrawingBuffer: w(t.preserveDrawingBuffer),
169
- logarithmicDepthBuffer: w(t.logarithmicDepthBuffer),
170
- failIfMajorPerformanceCaveat: w(t.failIfMajorPerformanceCaveat)
171
- })), o = z(new j(l.value));
172
- ee(l, () => {
173
- o.value.dispose(), o.value = new j(l.value);
174
- }), L(() => {
175
- o.value.setSize(r.width.value, r.height.value);
155
+ const f = M(() => ({
156
+ alpha: _(t.alpha),
157
+ depth: _(t.depth),
158
+ canvas: Te(n),
159
+ context: _(t.context),
160
+ stencil: _(t.stencil),
161
+ antialias: _(t.antialias) === void 0 ? !0 : _(t.antialias),
162
+ precision: _(t.precision),
163
+ powerPreference: _(t.powerPreference),
164
+ premultipliedAlpha: _(t.premultipliedAlpha),
165
+ preserveDrawingBuffer: _(t.preserveDrawingBuffer),
166
+ logarithmicDepthBuffer: _(t.logarithmicDepthBuffer),
167
+ failIfMajorPerformanceCaveat: _(t.failIfMajorPerformanceCaveat)
168
+ })), i = F(new z(f.value));
169
+ ee(f, () => {
170
+ i.value.dispose(), i.value = new z(f.value);
171
+ }), D(() => {
172
+ i.value.setSize(a.width.value, a.height.value);
176
173
  });
177
- const { pixelRatio: s } = Be();
178
- L(() => {
179
- o.value.setPixelRatio(s.value);
174
+ const { pixelRatio: c } = Se();
175
+ D(() => {
176
+ i.value.setPixelRatio(c.value);
180
177
  });
181
- const { logError: u } = T(), f = (() => {
182
- const d = new j(), g = {
178
+ const { logError: s } = B(), l = (() => {
179
+ const v = new z(), w = {
183
180
  shadowMap: {
184
- enabled: d.shadowMap.enabled,
185
- type: d.shadowMap.type
181
+ enabled: v.shadowMap.enabled,
182
+ type: v.shadowMap.type
186
183
  },
187
- toneMapping: d.toneMapping,
188
- toneMappingExposure: d.toneMappingExposure,
189
- outputColorSpace: d.outputColorSpace
184
+ toneMapping: v.toneMapping,
185
+ toneMappingExposure: v.toneMappingExposure,
186
+ outputColorSpace: v.outputColorSpace
190
187
  };
191
- return d.dispose(), g;
188
+ return v.dispose(), w;
192
189
  })();
193
- L(() => {
194
- const d = w(t.preset);
195
- d && (d in S || u("Renderer Preset must be one of these: " + Object.keys(S).join(", ")), ae(o.value, S[d]));
196
- const g = (A, x) => {
197
- const D = w(A), b = () => {
198
- if (d)
199
- return X(S[d], x);
190
+ D(() => {
191
+ const v = _(t.preset);
192
+ v && (v in S || s(`Renderer Preset must be one of these: ${Object.keys(S).join(", ")}`), ae(i.value, S[v]));
193
+ const w = (k, E) => {
194
+ const b = _(k), L = () => {
195
+ if (v)
196
+ return Y(S[v], E);
200
197
  };
201
- if (D !== void 0)
202
- return D;
203
- const m = b();
204
- return m !== void 0 ? m : X(f, x);
205
- }, p = (A, x) => Ue(o.value, x, g(A, x));
206
- p(t.shadows, "shadowMap.enabled"), p(t.toneMapping, "toneMapping"), p(t.shadowMapType, "shadowMap.type"), Xe < 150 && p(!t.useLegacyLights, "physicallyCorrectLights"), p(t.outputColorSpace, "outputColorSpace"), p(t.toneMappingExposure, "toneMappingExposure");
207
- const E = g(t.clearColor, "clearColor");
208
- E && o.value.setClearColor(
209
- E ? Ke(E) : new B(0)
198
+ if (b !== void 0)
199
+ return b;
200
+ const d = L();
201
+ return d !== void 0 ? d : Y(l, E);
202
+ }, C = (k, E) => Je(i.value, E, w(k, E));
203
+ C(t.shadows, "shadowMap.enabled"), C(t.toneMapping, "toneMapping"), C(t.shadowMapType, "shadowMap.type"), Xe < 150 && C(!t.useLegacyLights, "physicallyCorrectLights"), C(t.outputColorSpace, "outputColorSpace"), C(t.toneMappingExposure, "toneMappingExposure");
204
+ const A = w(t.clearColor, "clearColor");
205
+ A && i.value.setClearColor(
206
+ A ? $e(A) : new R(0)
210
207
  // default clear color is not easily/efficiently retrievable from three
211
208
  );
212
209
  });
213
- const { pause: v, resume: C, onLoop: M } = ne();
214
- return M(() => {
215
- i.value && !w(a) && o.value.render(e, i.value);
216
- }), C(), N(() => {
217
- v(), o.value.dispose(), o.value.forceContextLoss();
210
+ const { pause: u, resume: y, onLoop: g } = ne();
211
+ return g(() => {
212
+ o.value && !_(r) && i.value.render(e, o.value);
213
+ }), y(), N(() => {
214
+ u(), i.value.dispose(), i.value.forceContextLoss();
218
215
  }), {
219
- renderer: o
216
+ renderer: i
220
217
  };
221
218
  }
222
219
  const Q = (e) => typeof e == "function", se = (e) => !!e && e.constructor === Array;
@@ -226,107 +223,107 @@ function Qe(e) {
226
223
  t.name && (n.nodes[t.name] = t), t.material && !n.materials[t.material.name] && (n.materials[t.material.name] = t.material);
227
224
  }), n;
228
225
  }
229
- async function vt(e, n, t, a, r) {
230
- const { logError: i } = T(), l = new e();
231
- r && r(l), t && t(l);
232
- const s = (Array.isArray(n) ? n : [n]).map(
233
- (u) => new Promise((c, f) => {
234
- l.load(
235
- u,
236
- (v) => {
237
- v.scene && Object.assign(v, Qe(v.scene)), c(v);
226
+ async function vt(e, n, t, r, a) {
227
+ const { logError: o } = B(), f = new e();
228
+ a && a(f), t && t(f);
229
+ const c = (Array.isArray(n) ? n : [n]).map(
230
+ (s) => new Promise((m, l) => {
231
+ f.load(
232
+ s,
233
+ (u) => {
234
+ u.scene && Object.assign(u, Qe(u.scene)), m(u);
238
235
  },
239
- a,
240
- (v) => f(i("[useLoader] - Failed to load resource", v))
236
+ r,
237
+ (u) => l(o("[useLoader] - Failed to load resource", u))
241
238
  );
242
239
  })
243
240
  );
244
- return se(n) ? await Promise.all(s) : await s[0];
241
+ return se(n) ? await Promise.all(c) : await c[0];
245
242
  }
246
243
  async function dt(e) {
247
- const n = new De(), t = new Le(n), a = (r) => new Promise((i, l) => {
244
+ const n = new be(), t = new De(n), r = (a) => new Promise((o, f) => {
248
245
  t.load(
249
- r,
250
- (o) => i(o),
246
+ a,
247
+ (i) => o(i),
251
248
  () => null,
252
249
  () => {
253
- l(new Error("[useTextures] - Failed to load texture"));
250
+ f(new Error("[useTextures] - Failed to load texture"));
254
251
  }
255
252
  );
256
253
  });
257
254
  if (se(e)) {
258
- const r = await Promise.all(e.map((i) => a(i)));
259
- return e.length > 1 ? r : r[0];
255
+ const a = await Promise.all(e.map((o) => r(o)));
256
+ return e.length > 1 ? a : a[0];
260
257
  } else {
261
258
  const {
262
- map: r,
263
- displacementMap: i,
264
- normalMap: l,
265
- roughnessMap: o,
266
- metalnessMap: s,
267
- aoMap: u,
268
- alphaMap: c,
269
- matcap: f
259
+ map: a,
260
+ displacementMap: o,
261
+ normalMap: f,
262
+ roughnessMap: i,
263
+ metalnessMap: c,
264
+ aoMap: s,
265
+ alphaMap: m,
266
+ matcap: l
270
267
  } = e;
271
268
  return {
272
- map: r ? await a(r) : null,
273
- displacementMap: i ? await a(i) : null,
274
- normalMap: l ? await a(l) : null,
275
- roughnessMap: o ? await a(o) : null,
276
- metalnessMap: s ? await a(s) : null,
277
- aoMap: u ? await a(u) : null,
278
- alphaMap: c ? await a(c) : null,
279
- matcap: f ? await a(f) : null
269
+ map: a ? await r(a) : null,
270
+ displacementMap: o ? await r(o) : null,
271
+ normalMap: f ? await r(f) : null,
272
+ roughnessMap: i ? await r(i) : null,
273
+ metalnessMap: c ? await r(c) : null,
274
+ aoMap: s ? await r(s) : null,
275
+ alphaMap: m ? await r(m) : null,
276
+ matcap: l ? await r(l) : null
280
277
  };
281
278
  }
282
279
  }
283
- const Ze = (e, { renderer: n, camera: t, raycaster: a }) => {
284
- const r = _(() => n.value.domElement), { x: i, y: l } = Re({ target: r }), { width: o, height: s, top: u, left: c } = Fe(r), f = ({ x: m, y: P }) => {
285
- if (r.value)
280
+ const Ze = (e, { renderer: n, camera: t, raycaster: r }) => {
281
+ const a = M(() => n.value.domElement), { x: o, y: f } = Re({ target: a }), { width: i, height: c, top: s, left: m } = je(a), l = ({ x: d, y: P }) => {
282
+ if (a.value)
286
283
  return {
287
- x: (m - c.value) / o.value * 2 - 1,
288
- y: -((P - u.value) / s.value) * 2 + 1
284
+ x: (d - m.value) / i.value * 2 - 1,
285
+ y: -((P - s.value) / c.value) * 2 + 1
289
286
  };
290
- }, v = ({ x: m, y: P }) => {
287
+ }, u = ({ x: d, y: P }) => {
291
288
  if (t.value)
292
- return a.value.setFromCamera(new he(m, P), t.value), a.value.intersectObjects(e.value, !1);
293
- }, C = (m) => {
294
- const P = f({
295
- x: (m == null ? void 0 : m.clientX) ?? i.value,
296
- y: (m == null ? void 0 : m.clientY) ?? l.value
289
+ return r.value.setFromCamera(new Oe(d, P), t.value), r.value.intersectObjects(e.value, !1);
290
+ }, y = (d) => {
291
+ const P = l({
292
+ x: (d == null ? void 0 : d.clientX) ?? o.value,
293
+ y: (d == null ? void 0 : d.clientY) ?? f.value
297
294
  });
298
- return P ? v(P) || [] : [];
299
- }, M = _(() => C()), d = k(), g = k(), p = (m, P) => {
300
- m.trigger({ event: P, intersects: C(P) });
301
- }, E = (m) => {
302
- p(g, m);
295
+ return P ? u(P) || [] : [];
296
+ }, g = M(() => y()), v = x(), w = x(), C = (d, P) => {
297
+ d.trigger({ event: P, intersects: y(P) });
298
+ }, A = (d) => {
299
+ C(w, d);
303
300
  };
304
- let A;
305
- const x = (m) => {
301
+ let k;
302
+ const E = (d) => {
306
303
  var P;
307
- A = (P = C(m)[0]) == null ? void 0 : P.object;
308
- }, D = (m) => {
304
+ k = (P = y(d)[0]) == null ? void 0 : P.object;
305
+ }, b = (d) => {
309
306
  var P;
310
- m instanceof PointerEvent && A === ((P = C(m)[0]) == null ? void 0 : P.object) && p(d, m);
311
- }, b = (m) => g.trigger({ event: m, intersects: [] });
312
- return r.value.addEventListener("pointerup", D), r.value.addEventListener("pointerdown", x), r.value.addEventListener("pointermove", E), r.value.addEventListener("pointerleave", b), N(() => {
313
- r != null && r.value && (r.value.removeEventListener("pointerup", D), r.value.removeEventListener("pointerdown", x), r.value.removeEventListener("pointermove", E), r.value.removeEventListener("pointerleave", b));
307
+ d instanceof PointerEvent && k === ((P = y(d)[0]) == null ? void 0 : P.object) && C(v, d);
308
+ }, L = (d) => w.trigger({ event: d, intersects: [] });
309
+ return a.value.addEventListener("pointerup", b), a.value.addEventListener("pointerdown", E), a.value.addEventListener("pointermove", A), a.value.addEventListener("pointerleave", L), N(() => {
310
+ a != null && a.value && (a.value.removeEventListener("pointerup", b), a.value.removeEventListener("pointerdown", E), a.value.removeEventListener("pointermove", A), a.value.removeEventListener("pointerleave", L));
314
311
  }), {
315
- intersects: M,
316
- onClick: (m) => d.on(m).off,
317
- onPointerMove: (m) => g.on(m).off
312
+ intersects: g,
313
+ onClick: (d) => v.on(d).off,
314
+ onPointerMove: (d) => w.on(d).off
318
315
  };
319
316
  };
320
317
  function gt() {
321
- const { logWarning: e } = T();
322
- function n(a, r, i) {
323
- let l = null;
324
- return a.traverse((o) => {
325
- o[r] === i && (l = o);
326
- }), l || e(`Child with ${r} '${i}' not found.`), l;
318
+ const { logWarning: e } = B();
319
+ function n(r, a, o) {
320
+ let f = null;
321
+ return r.traverse((i) => {
322
+ i[a] === o && (f = i);
323
+ }), f || e(`Child with ${a} '${o}' not found.`), f;
327
324
  }
328
- function t(a, r) {
329
- return n(a, "name", r);
325
+ function t(r, a) {
326
+ return n(r, "name", a);
330
327
  }
331
328
  return {
332
329
  seek: n,
@@ -339,74 +336,81 @@ const et = ({ scene: e, contextParts: n }) => {
339
336
  pointerMove: /* @__PURE__ */ new Map(),
340
337
  pointerEnter: /* @__PURE__ */ new Map(),
341
338
  pointerLeave: /* @__PURE__ */ new Map()
342
- }), a = (u) => {
343
- Object.values(t).forEach((c) => c.delete(u));
344
- }, r = (u) => {
345
- const { onClick: c, onPointerMove: f, onPointerEnter: v, onPointerLeave: C } = u;
346
- c && t.click.set(u, c), f && t.pointerMove.set(u, f), v && t.pointerEnter.set(u, v), C && t.pointerLeave.set(u, C);
339
+ }), r = h(/* @__PURE__ */ new Set()), a = (u) => {
340
+ r.value.add(u);
341
+ }, o = (u) => {
342
+ r.value.delete(u);
343
+ }, f = (u) => {
344
+ Object.values(t).forEach((y) => y.delete(u)), o(u);
345
+ }, i = (u) => {
346
+ const { onClick: y, onPointerMove: g, onPointerEnter: v, onPointerLeave: w } = u;
347
+ y && t.click.set(u, y), g && t.pointerMove.set(u, g), v && t.pointerEnter.set(u, v), w && t.pointerLeave.set(u, w);
347
348
  };
348
- e.userData.tres__registerAtPointerEventHandler = r, e.userData.tres__deregisterAtPointerEventHandler = a;
349
- const i = _(
350
- () => qe(
351
- Object.values(t).map((u) => Array.from(u.keys())).flat(),
349
+ e.userData.tres__registerAtPointerEventHandler = i, e.userData.tres__deregisterAtPointerEventHandler = f, e.userData.tres__registerBlockingObjectAtPointerEventHandler = a, e.userData.tres__deregisterBlockingObjectAtPointerEventHandler = o;
350
+ const c = M(
351
+ () => Ue(
352
+ [
353
+ ...Array.from(r.value),
354
+ ...Object.values(t).map((u) => Array.from(u.keys())).flat()
355
+ ],
352
356
  ({ uuid: u }) => u
353
357
  )
354
- ), { onClick: l, onPointerMove: o } = Ze(i, n);
355
- l(({ intersects: u, event: c }) => {
356
- var f;
357
- u.length && ((f = t.click.get(u[0].object)) == null || f(u[0], c));
358
+ ), { onClick: s, onPointerMove: m } = Ze(c, n);
359
+ s(({ intersects: u, event: y }) => {
360
+ var g;
361
+ u.length && ((g = t.click.get(u[0].object)) == null || g(u[0], y));
358
362
  });
359
- let s;
360
- return o(({ intersects: u, event: c }) => {
361
- var d, g, p, E;
362
- const f = (d = u == null ? void 0 : u[0]) == null ? void 0 : d.object, { pointerLeave: v, pointerEnter: C, pointerMove: M } = t;
363
- s && s !== f && ((g = v.get(s)) == null || g(s, c)), f && (s !== f && ((p = C.get(f)) == null || p(u[0], c)), (E = M.get(f)) == null || E(u[0], c)), s = f || null;
363
+ let l;
364
+ return m(({ intersects: u, event: y }) => {
365
+ var A, k, E, b;
366
+ const g = (A = u == null ? void 0 : u[0]) == null ? void 0 : A.object, { pointerLeave: v, pointerEnter: w, pointerMove: C } = t;
367
+ l && l !== g && ((k = v.get(l)) == null || k(l, y)), g && (l !== g && ((E = w.get(g)) == null || E(u[0], y)), (b = C.get(g)) == null || b(u[0], y)), l = g || null;
364
368
  }), {
365
- registerObject: r,
366
- deregisterObject: a
369
+ registerObject: i,
370
+ deregisterObject: f
367
371
  };
368
- }, W = H({}), q = (e) => void Object.assign(W.value, e);
372
+ }, $ = h({}), q = (e) => Object.assign($.value, e);
369
373
  function tt({
370
374
  scene: e,
371
375
  canvas: n,
372
376
  windowSize: t,
373
- disableRender: a,
374
- rendererOptions: r
377
+ disableRender: r,
378
+ rendererOptions: a
375
379
  }) {
376
- const i = _(
377
- () => w(t) ? ze() : He(w(n).parentElement)
378
- ), l = _(() => i.value.width.value), o = _(() => i.value.height.value), s = _(() => l.value / o.value), u = {
379
- height: o,
380
- width: l,
381
- aspectRatio: s
382
- }, c = z(e), {
383
- camera: f,
384
- cameras: v,
385
- addCamera: C,
386
- removeCamera: M,
387
- setCameraActive: d
388
- } = je({ sizes: u, scene: e }), { renderer: g } = Ye(
380
+ const o = M(
381
+ () => _(t) ? He() : Fe(_(n).parentElement)
382
+ ), f = M(() => o.value.width.value), i = M(() => o.value.height.value), c = M(() => f.value / i.value), s = {
383
+ height: i,
384
+ width: f,
385
+ aspectRatio: c
386
+ }, m = F(e), {
387
+ camera: l,
388
+ cameras: u,
389
+ registerCamera: y,
390
+ deregisterCamera: g,
391
+ setCameraActive: v
392
+ } = ze({ sizes: s, scene: e }), { renderer: w } = Ye(
389
393
  {
390
394
  scene: e,
391
395
  canvas: n,
392
- options: r,
393
- contextParts: { sizes: u, camera: f },
394
- disableRender: a
396
+ options: a,
397
+ contextParts: { sizes: s, camera: l },
398
+ disableRender: r
395
399
  }
396
- ), p = {
397
- sizes: u,
398
- scene: c,
399
- camera: f,
400
- cameras: ue(v),
401
- renderer: g,
402
- raycaster: z(new ke()),
403
- controls: H(null),
400
+ ), C = {
401
+ sizes: s,
402
+ scene: m,
403
+ camera: l,
404
+ cameras: ue(u),
405
+ renderer: w,
406
+ raycaster: F(new xe()),
407
+ controls: h(null),
404
408
  extend: q,
405
- addCamera: C,
406
- removeCamera: M,
407
- setCameraActive: d
409
+ registerCamera: y,
410
+ setCameraActive: v,
411
+ deregisterCamera: g
408
412
  };
409
- return I("useTres", p), p;
413
+ return I("useTres", C), C;
410
414
  }
411
415
  function rt() {
412
416
  const e = le("useTres");
@@ -415,43 +419,43 @@ function rt() {
415
419
  return e;
416
420
  }
417
421
  const yt = rt;
418
- let G = null, y = null;
419
- const { logError: Z } = T(), nt = {
420
- createElement(e, n, t, a) {
421
- var l, o;
422
- if (a || (a = {}), a.args || (a.args = []), e === "template" || Ne(e))
422
+ let G = null, p = null;
423
+ const { logError: Z } = B(), nt = {
424
+ createElement(e, n, t, r) {
425
+ var f, i;
426
+ if (r || (r = {}), r.args || (r.args = []), e === "template" || Ve(e))
423
427
  return null;
424
- let r = e.replace("Tres", ""), i;
428
+ let a = e.replace("Tres", ""), o;
425
429
  if (e === "primitive") {
426
- (a == null ? void 0 : a.object) === void 0 && Z("Tres primitives need a prop 'object'");
427
- const s = a.object;
428
- r = s.type, i = Object.assign(s, { type: r, attach: a.attach, primitive: !0 });
430
+ (r == null ? void 0 : r.object) === void 0 && Z("Tres primitives need a prop 'object'");
431
+ const c = r.object;
432
+ a = c.type, o = Object.assign(c, { type: a, attach: r.attach, primitive: !0 });
429
433
  } else {
430
- const s = W.value[r];
431
- s || Z(`${r} is not defined on the THREE namespace. Use extend to add it to the catalog.`), i = new s(...a.args);
434
+ const c = $.value[a];
435
+ c || Z(`${a} is not defined on the THREE namespace. Use extend to add it to the catalog.`), o = new c(...r.args);
432
436
  }
433
- return i.isCamera && (a != null && a.position || i.position.set(3, 3, 3), a != null && a.lookAt || i.lookAt(0, 0, 0)), (a == null ? void 0 : a.attach) === void 0 && (i.isMaterial ? i.attach = "material" : i.isBufferGeometry && (i.attach = "geometry")), i.isObject3D && ((l = a == null ? void 0 : a.material) != null && l.isMaterial && (i.userData.tres__materialViaProp = !0), (o = a == null ? void 0 : a.geometry) != null && o.isBufferGeometry && (i.userData.tres__geometryViaProp = !0)), i.userData = {
434
- ...i.userData,
435
- tres__name: r
436
- }, i;
437
+ return o.isCamera && (r != null && r.position || o.position.set(3, 3, 3), r != null && r.lookAt || o.lookAt(0, 0, 0)), (r == null ? void 0 : r.attach) === void 0 && (o.isMaterial ? o.attach = "material" : o.isBufferGeometry && (o.attach = "geometry")), o.isObject3D && ((f = r == null ? void 0 : r.material) != null && f.isMaterial && (o.userData.tres__materialViaProp = !0), (i = r == null ? void 0 : r.geometry) != null && i.isBufferGeometry && (o.userData.tres__geometryViaProp = !0)), o.userData = {
438
+ ...o.userData,
439
+ tres__name: a
440
+ }, o;
437
441
  },
438
442
  insert(e, n) {
439
- var t, a, r, i, l, o, s, u, c;
440
- if (n && n.isScene && (y = n), (((t = e == null ? void 0 : e.__vnode) == null ? void 0 : t.type) === "TresGroup" || ((a = e == null ? void 0 : e.__vnode) == null ? void 0 : a.type) === "TresObject3D") && n === null && !((i = (r = e == null ? void 0 : e.__vnode) == null ? void 0 : r.ctx) != null && i.asyncResolved)) {
443
+ var t, r, a, o, f, i, c, s, m;
444
+ if (n && n.isScene && (p = n), (((t = e == null ? void 0 : e.__vnode) == null ? void 0 : t.type) === "TresGroup" || ((r = e == null ? void 0 : e.__vnode) == null ? void 0 : r.type) === "TresObject3D") && n === null && !((o = (a = e == null ? void 0 : e.__vnode) == null ? void 0 : a.ctx) != null && o.asyncResolved)) {
441
445
  G = e;
442
446
  return;
443
447
  } else
444
- (l = e == null ? void 0 : e.__vnode) != null && l.type.includes("Controls") && n === null && (G = y);
448
+ (f = e == null ? void 0 : e.__vnode) != null && f.type.includes("Controls") && n === null && (G = p);
445
449
  if (n || (n = G), e != null && e.isObject3D) {
446
450
  if (e != null && e.isCamera) {
447
- if (!(y != null && y.userData.tres__registerCamera))
451
+ if (!(p != null && p.userData.tres__registerCamera))
448
452
  throw "could not find tres__registerCamera on scene's userData";
449
- (s = y == null ? void 0 : (o = y.userData).tres__registerCamera) == null || s.call(o, e);
453
+ (c = p == null ? void 0 : (i = p.userData).tres__registerCamera) == null || c.call(i, e);
450
454
  }
451
455
  if (e != null && e.onClick || e != null && e.onPointerMove || e != null && e.onPointerEnter || e != null && e.onPointerLeave) {
452
- if (!(y != null && y.userData.tres__registerAtPointerEventHandler))
456
+ if (!(p != null && p.userData.tres__registerAtPointerEventHandler))
453
457
  throw "could not find tres__registerAtPointerEventHandler on scene's userData";
454
- (c = y == null ? void 0 : (u = y.userData).tres__registerAtPointerEventHandler) == null || c.call(u, e);
458
+ (m = p == null ? void 0 : (s = p.userData).tres__registerAtPointerEventHandler) == null || m.call(s, e);
455
459
  }
456
460
  }
457
461
  e != null && e.isObject3D && (n != null && n.isObject3D) ? (n.add(e), e.dispatchEvent({ type: "added" })) : e != null && e.isFog ? n.fog = e : typeof (e == null ? void 0 : e.attach) == "string" && (e.__previousAttach = e[n == null ? void 0 : n.attach], n && (n[e.attach] = e));
@@ -460,54 +464,63 @@ const { logError: Z } = T(), nt = {
460
464
  var n, t;
461
465
  if (e) {
462
466
  if (e.isObject3D) {
463
- const a = e, r = (s) => {
464
- var c, f;
465
- const u = s;
466
- s.userData.tres__materialViaProp || (c = u.material) == null || c.dispose(), s.userData.tres__geometryViaProp || (f = u.geometry) == null || f.dispose();
467
- }, i = y == null ? void 0 : y.userData.tres__deregisterAtPointerEventHandler, l = (s) => {
468
- if (!i)
467
+ const r = e, a = (s) => {
468
+ var l, u;
469
+ const m = s;
470
+ s.userData.tres__materialViaProp || (l = m.material) == null || l.dispose(), s.userData.tres__geometryViaProp || (u = m.geometry) == null || u.dispose();
471
+ }, o = p == null ? void 0 : p.userData.tres__deregisterAtPointerEventHandler, f = p == null ? void 0 : p.userData.tres__deregisterBlockingObjectAtPointerEventHandler, i = (s) => {
472
+ var m, l;
473
+ if (!f)
474
+ throw "could not find tres__deregisterBlockingObjectAtPointerEventHandler on scene's userData";
475
+ if ((l = p == null ? void 0 : (m = p.userData).tres__deregisterBlockingObjectAtPointerEventHandler) == null || l.call(m, s), !o)
469
476
  throw "could not find tres__deregisterAtPointerEventHandler on scene's userData";
470
- (s != null && s.onClick || s != null && s.onPointerMove || s != null && s.onPointerEnter || s != null && s.onPointerLeave) && (i == null || i(s));
471
- }, o = (s) => {
472
- const u = y == null ? void 0 : y.userData.tres__deregisterCamera;
473
- if (!u)
477
+ (s != null && s.onClick || s != null && s.onPointerMove || s != null && s.onPointerEnter || s != null && s.onPointerLeave) && (o == null || o(s));
478
+ }, c = (s) => {
479
+ const m = p == null ? void 0 : p.userData.tres__deregisterCamera;
480
+ if (!m)
474
481
  throw "could not find tres__deregisterCamera on scene's userData";
475
- s.isCamera && (u == null || u(s));
482
+ s.isCamera && (m == null || m(s));
476
483
  };
477
- a.traverse((s) => {
478
- r(s), o(s), l == null || l(s);
479
- }), r(a), o(a), l == null || l(a);
484
+ r.traverse((s) => {
485
+ a(s), c(s), i == null || i(s);
486
+ }), a(r), c(r), i == null || i(r);
480
487
  }
481
488
  (n = e.removeFromParent) == null || n.call(e), (t = e.dispose) == null || t.call(e);
482
489
  }
483
490
  },
484
- patchProp(e, n, t, a) {
491
+ patchProp(e, n, t, r) {
492
+ var a, o, f, i;
485
493
  if (e) {
486
- let r = e, i = n, l = O(i), o = r == null ? void 0 : r[l];
487
- if (i === "args") {
488
- const u = e, c = t ?? [], f = a ?? [], v = e.userData.tres__name || e.type;
489
- v && c.length && !Je(c, f) && (r = Object.assign(u, new W.value[v](...a)));
494
+ let c = e, s = n;
495
+ if (e.isObject3D && s === "blocks-pointer-events") {
496
+ r || r === "" ? (o = p == null ? void 0 : (a = p.userData).tres__registerBlockingObjectAtPointerEventHandler) == null || o.call(a, e) : (i = p == null ? void 0 : (f = p.userData).tres__deregisterBlockingObjectAtPointerEventHandler) == null || i.call(f, e);
490
497
  return;
491
498
  }
492
- if (r.type === "BufferGeometry") {
493
- if (i === "args")
499
+ let m = T(s), l = c == null ? void 0 : c[m];
500
+ if (s === "args") {
501
+ const y = e, g = t ?? [], v = r ?? [], w = e.userData.tres__name || e.type;
502
+ w && g.length && !Ke(g, v) && (c = Object.assign(y, new $.value[w](...r)));
503
+ return;
504
+ }
505
+ if (c.type === "BufferGeometry") {
506
+ if (s === "args")
494
507
  return;
495
- r.setAttribute(
496
- O(i),
497
- new Te(...a)
508
+ c.setAttribute(
509
+ T(s),
510
+ new he(...r)
498
511
  );
499
512
  return;
500
513
  }
501
- if (i.includes("-") && o === void 0) {
502
- const u = i.split("-");
503
- o = u.reduce((c, f) => c[O(f)], r), i = u.pop(), l = i.toLowerCase(), o != null && o.set || (r = u.reduce((c, f) => c[O(f)], r));
514
+ if (s.includes("-") && l === void 0) {
515
+ const y = s.split("-");
516
+ l = y.reduce((g, v) => g[T(v)], c), s = y.pop(), m = s.toLowerCase(), l != null && l.set || (c = y.reduce((g, v) => g[T(v)], c));
504
517
  }
505
- let s = a;
506
- if (s === "" && (s = !0), Q(o)) {
507
- Array.isArray(s) ? e[l](...s) : e[l](s);
518
+ let u = r;
519
+ if (u === "" && (u = !0), Q(l)) {
520
+ Array.isArray(u) ? e[m](...u) : e[m](u);
508
521
  return;
509
522
  }
510
- !(o != null && o.set) && !Q(o) ? r[l] = s : o.constructor === s.constructor && (o != null && o.copy) ? o == null || o.copy(s) : Array.isArray(s) ? o.set(...s) : !o.isColor && o.setScalar ? o.setScalar(s) : o.set(s);
523
+ !(l != null && l.set) && !Q(l) ? c[m] = u : l.constructor === u.constructor && (l != null && l.copy) ? l == null || l.copy(u) : Array.isArray(u) ? l.set(...u) : !l.isColor && l.setScalar ? l.setScalar(u) : l.set(u);
511
524
  }
512
525
  },
513
526
  parentNode(e) {
@@ -527,81 +540,87 @@ q(ye);
527
540
  const ot = ["data-scene"], st = /* @__PURE__ */ U({
528
541
  __name: "TresCanvas",
529
542
  props: {
530
- shadows: { type: Boolean },
543
+ shadows: { type: Boolean, default: void 0 },
531
544
  clearColor: {},
532
545
  toneMapping: {},
533
546
  shadowMapType: {},
534
- useLegacyLights: { type: Boolean },
547
+ useLegacyLights: { type: Boolean, default: void 0 },
535
548
  outputColorSpace: {},
536
549
  toneMappingExposure: {},
537
- windowSize: { type: Boolean },
538
- preset: {},
539
- disableRender: { type: Boolean },
540
550
  camera: {},
551
+ preset: {},
552
+ windowSize: { type: Boolean, default: void 0 },
553
+ disableRender: { type: Boolean, default: void 0 },
541
554
  context: {},
542
555
  precision: {},
543
- alpha: { type: Boolean, default: !1 },
556
+ alpha: { type: Boolean, default: void 0 },
544
557
  premultipliedAlpha: { type: Boolean },
545
- antialias: { type: Boolean, default: !0 },
546
- stencil: { type: Boolean, default: !0 },
547
- preserveDrawingBuffer: { type: Boolean, default: !1 },
558
+ antialias: { type: Boolean, default: void 0 },
559
+ stencil: { type: Boolean, default: void 0 },
560
+ preserveDrawingBuffer: { type: Boolean, default: void 0 },
548
561
  powerPreference: {},
549
- depth: { type: Boolean, default: !0 },
550
- logarithmicDepthBuffer: { type: Boolean },
551
- failIfMajorPerformanceCaveat: { type: Boolean }
562
+ depth: { type: Boolean, default: void 0 },
563
+ logarithmicDepthBuffer: { type: Boolean, default: void 0 },
564
+ failIfMajorPerformanceCaveat: { type: Boolean, default: void 0 }
552
565
  },
553
566
  setup(e) {
554
- const n = e, { logWarning: t } = T(), a = H(), r = z(new be());
567
+ const n = e, { logWarning: t } = B(), r = h(), a = F(new Be());
555
568
  ne();
556
- const i = fe(), l = (u) => U({
569
+ const o = fe(), f = (s) => U({
557
570
  setup() {
558
- return I("useTres", u), I("extend", q), () => J(ge, null, i != null && i.default ? i.default() : []);
571
+ return I("useTres", s), I("extend", q), () => J(ge, null, o != null && o.default ? o.default() : []);
559
572
  }
560
- }), o = (u) => {
561
- const c = l(u);
562
- at(J(c), r.value);
563
- }, s = _(() => n.disableRender);
573
+ }), i = (s) => {
574
+ const m = f(s);
575
+ at(J(m), a.value);
576
+ }, c = M(() => n.disableRender);
564
577
  return me(() => {
565
- const u = a, c = tt({
566
- scene: r.value,
567
- canvas: u,
578
+ const s = r, m = tt({
579
+ scene: a.value,
580
+ canvas: s,
568
581
  windowSize: n.windowSize,
569
- disableRender: s,
582
+ disableRender: c,
570
583
  rendererOptions: n
571
584
  });
572
- et({ scene: r.value, contextParts: c });
573
- const { addCamera: f, camera: v, cameras: C, removeCamera: M } = c;
574
- o(c);
575
- const d = () => {
576
- const g = new V(45, window.innerWidth / window.innerHeight, 0.1, 1e3);
577
- g.position.set(3, 3, 3), g.lookAt(0, 0, 0), f(g);
578
- const p = L(
579
- () => {
580
- C.value.length >= 2 && (g.removeFromParent(), M(g), p == null || p());
581
- }
585
+ et({ scene: a.value, contextParts: m });
586
+ const { registerCamera: l, camera: u, cameras: y, deregisterCamera: g } = m;
587
+ i(m);
588
+ const v = () => {
589
+ const w = new W(
590
+ 45,
591
+ window.innerWidth / window.innerHeight,
592
+ 0.1,
593
+ 1e3
582
594
  );
595
+ w.position.set(3, 3, 3), w.lookAt(0, 0, 0), l(w);
596
+ const C = D(() => {
597
+ y.value.length >= 2 && (w.removeFromParent(), g(w), C == null || C());
598
+ });
583
599
  };
584
- ee(() => n.camera, (g, p) => {
585
- g ? f(g) : p && (p.removeFromParent(), M(p));
586
- }, {
587
- immediate: !0
588
- }), v.value || (t(
600
+ ee(
601
+ () => n.camera,
602
+ (w, C) => {
603
+ w ? l(w) : C && (C.removeFromParent(), g(C));
604
+ },
605
+ {
606
+ immediate: !0
607
+ }
608
+ ), u.value || (t(
589
609
  "No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
590
- ), d());
591
- }), (u, c) => (pe(), ve("canvas", {
610
+ ), v());
611
+ }), (s, m) => (pe(), ve("canvas", {
592
612
  ref_key: "canvas",
593
- ref: a,
594
- "data-scene": r.value.uuid,
613
+ ref: r,
614
+ "data-scene": a.value.uuid,
595
615
  style: de({
596
616
  display: "block",
597
617
  width: "100%",
598
618
  height: "100%",
599
- position: u.windowSize ? "fixed" : "relative",
619
+ position: s.windowSize ? "fixed" : "relative",
600
620
  top: 0,
601
621
  left: 0,
602
622
  pointerEvents: "auto",
603
- touchAction: "none",
604
- zIndex: 1
623
+ touchAction: "none"
605
624
  })
606
625
  }, null, 12, ot));
607
626
  }
@@ -622,17 +641,17 @@ const ot = ["data-scene"], st = /* @__PURE__ */ U({
622
641
  };
623
642
  export {
624
643
  st as TresCanvas,
625
- W as catalogue,
644
+ $ as catalogue,
626
645
  Ct as default,
627
646
  q as extend,
628
647
  mt as isProd,
629
- Ke as normalizeColor,
648
+ $e as normalizeColor,
630
649
  pt as normalizeVectorFlexibleParam,
631
650
  wt as templateCompilerOptions,
632
651
  Qe as trasverseObjects,
633
- je as useCamera,
652
+ ze as useCamera,
634
653
  vt as useLoader,
635
- T as useLogger,
654
+ B as useLogger,
636
655
  et as usePointerEventHandler,
637
656
  Ze as useRaycaster,
638
657
  ne as useRenderLoop,