@tresjs/core 2.1.2 → 2.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,67 +1,71 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v2.1.2
3
+ * version: v2.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 E, shallowReactive as me, computed as pe, toRefs as ve, provide as Oe, inject as ke, watchEffect as ge, toRef as je, shallowRef as we, watch as H, onUnmounted as he, createRenderer as De, defineComponent as be, onMounted as Ie, h as D } from "vue";
9
- import * as ye from "three";
10
- import { PerspectiveCamera as N, OrthographicCamera as Be, Clock as Ce, Color as U, SRGBColorSpace as Fe, ACESFilmicToneMapping as ze, PCFSoftShadowMap as Ge, PCFShadowMap as Ve, LinearSRGBColorSpace as re, NoToneMapping as oe, WebGLRenderer as He, LoadingManager as We, TextureLoader as Ye, Raycaster as $e, Vector2 as Ne, BufferAttribute as Ue } from "three";
11
- import { createEventHook as X, useRafFn as Ke, toValue as u, useWindowSize as qe, useElementSize as Je, useDevicePixelRatio as Xe, unrefElement as K, useEventListener as Qe } from "@vueuse/core";
12
- const ie = (e) => typeof e == "function", Ze = (e) => typeof e == "string", Me = (e) => !!e && e.constructor === Array, xe = E({}), Re = (e) => void Object.assign(xe.value, e), p = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "da", "db", "dc", "dd", "de", "df", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff"];
13
- function et() {
14
- const e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, o = Math.random() * 4294967295 | 0, a = Math.random() * 4294967295 | 0;
15
- return (p[e & 255] + p[e >> 8 & 255] + p[e >> 16 & 255] + p[e >> 24 & 255] + "-" + p[t & 255] + p[t >> 8 & 255] + "-" + p[t >> 16 & 15 | 64] + p[t >> 24 & 255] + "-" + p[o & 63 | 128] + p[o >> 8 & 255] + "-" + p[o >> 16 & 255] + p[o >> 24 & 255] + p[a & 255] + p[a >> 8 & 255] + p[a >> 16 & 255] + p[a >> 24 & 255]).toLowerCase();
8
+ import { ref as G, shallowReactive as ce, toRefs as ue, provide as Te, inject as Le, watchEffect as fe, toRef as _e, shallowRef as Ae, computed as V, watch as D, onUnmounted as le, reactive as Se, createRenderer as Oe, defineComponent as de, onMounted as ke, h as L } from "vue";
9
+ import * as q from "three";
10
+ import { PerspectiveCamera as z, OrthographicCamera as je, Clock as pe, Color as W, SRGBColorSpace as De, ACESFilmicToneMapping as Ie, PCFSoftShadowMap as Be, PCFShadowMap as He, LinearSRGBColorSpace as ae, NoToneMapping as ne, WebGLRenderer as Ge, LoadingManager as Ve, TextureLoader as Ne, Raycaster as Fe, Vector2 as ze, BufferAttribute as We } from "three";
11
+ import { createEventHook as A, useRafFn as Ue, toValue as m, useWindowSize as Ye, useElementSize as $e, useDevicePixelRatio as qe, unrefElement as U, usePointer as Ke, useElementBounding as Je } from "@vueuse/core";
12
+ const me = G({}), ve = (e) => void Object.assign(me.value, e), re = (e) => typeof e == "function", ge = (e) => !!e && e.constructor === Array, b = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "da", "db", "dc", "dd", "de", "df", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff"];
13
+ function Xe() {
14
+ const e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, n = Math.random() * 4294967295 | 0, a = Math.random() * 4294967295 | 0;
15
+ return (b[e & 255] + b[e >> 8 & 255] + b[e >> 16 & 255] + b[e >> 24 & 255] + "-" + b[t & 255] + b[t >> 8 & 255] + "-" + b[t >> 16 & 15 | 64] + b[t >> 24 & 255] + "-" + b[n & 63 | 128] + b[n >> 8 & 255] + "-" + b[n >> 16 & 255] + b[n >> 24 & 255] + b[a & 255] + b[a >> 8 & 255] + b[a >> 16 & 255] + b[a >> 24 & 255]).toLowerCase();
16
16
  }
17
- const Q = Symbol();
18
- function tt() {
19
- const e = me({
20
- uuid: et(),
17
+ const K = Symbol();
18
+ function Qe() {
19
+ const e = ce({
20
+ uuid: Xe(),
21
21
  camera: void 0,
22
22
  cameras: [],
23
+ canvas: void 0,
23
24
  scene: void 0,
24
25
  renderer: void 0,
25
- aspectRatio: pe(() => window.innerWidth / window.innerHeight)
26
+ aspectRatio: void 0,
27
+ pointerEventHandler: void 0
26
28
  });
27
- function t(n) {
28
- return e[n];
29
+ function t(o) {
30
+ return e[o];
29
31
  }
30
- function o(n, r) {
31
- e[n] = r;
32
+ function n(o, i) {
33
+ e[o] = i;
32
34
  }
33
35
  const a = {
34
36
  state: e,
35
- ...ve(e),
37
+ ...ue(e),
36
38
  getState: t,
37
- setState: o
39
+ setState: n
38
40
  };
39
- return Oe(Q, a), a;
41
+ return Te(K, a), a;
40
42
  }
41
- const B = () => ke(Q, {
42
- state: me({
43
+ const S = () => Le(K, {
44
+ state: ce({
43
45
  camera: void 0,
44
46
  cameras: [],
47
+ canvas: void 0,
45
48
  scene: void 0,
46
- renderer: void 0
49
+ renderer: void 0,
50
+ pointerEventHandler: void 0
47
51
  })
48
52
  });
49
- var at = /* @__PURE__ */ ((e) => (e.Perspective = "Perspective", e.Orthographic = "Orthographic", e))(at || {});
50
- const nt = 45;
51
- let A;
52
- function Ee() {
53
- const { state: e, setState: t, aspectRatio: o } = B();
54
- function a(s = "Perspective", f) {
55
- var l, d, v;
53
+ var Ze = /* @__PURE__ */ ((e) => (e.Perspective = "Perspective", e.Orthographic = "Orthographic", e))(Ze || {});
54
+ const et = 45;
55
+ let x;
56
+ function tt() {
57
+ const { state: e, setState: t, aspectRatio: n } = S();
58
+ function a(s = "Perspective", c) {
59
+ var l, d, p;
56
60
  if (s === "Perspective") {
57
- const { near: C, far: M, fov: h } = f || {
61
+ const { near: y, far: h, fov: v } = c || {
58
62
  near: 0.1,
59
63
  far: 1e3,
60
- fov: nt
64
+ fov: et
61
65
  };
62
- A = new N(h, ((l = e.aspectRatio) == null ? void 0 : l.value) || window.innerWidth / window.innerHeight, C, M), (d = e.cameras) == null || d.push(A);
66
+ x = new z(v, ((l = e.aspectRatio) == null ? void 0 : l.value) || window.innerWidth / window.innerHeight, y, h), (d = e.cameras) == null || d.push(x);
63
67
  } else {
64
- const { left: C, right: M, top: h, bottom: S, near: w, far: x } = f || {
68
+ const { left: y, right: h, top: v, bottom: M, near: w, far: E } = c || {
65
69
  left: -100,
66
70
  right: 100,
67
71
  top: 100,
@@ -69,342 +73,404 @@ function Ee() {
69
73
  near: 0.1,
70
74
  far: 1e3
71
75
  };
72
- A = new Be(C, M, h, S, w, x), (v = e.cameras) == null || v.push(A);
76
+ x = new je(y, h, v, M, w, E), (p = e.cameras) == null || p.push(x);
73
77
  }
74
- return e.camera = A, t("camera", e.camera), A;
78
+ return e.camera = x, t("camera", e.camera), x;
75
79
  }
76
- function n() {
80
+ function o() {
77
81
  var s;
78
- e.camera instanceof N && e.aspectRatio && (e.camera.aspect = e.aspectRatio.value), (s = e.camera) == null || s.updateProjectionMatrix();
82
+ e.camera instanceof z && e.aspectRatio && (e.camera.aspect = e.aspectRatio.value), (s = e.camera) == null || s.updateProjectionMatrix();
79
83
  }
80
- function r(s) {
81
- var f;
82
- (f = e.cameras) == null || f.push(s), s instanceof N && e.aspectRatio && (s.aspect = e.aspectRatio.value), s.updateProjectionMatrix(), t("camera", s);
84
+ function i(s) {
85
+ var c;
86
+ (c = e.cameras) == null || c.push(s), s instanceof z && e.aspectRatio && (s.aspect = e.aspectRatio.value), s.updateProjectionMatrix(), t("camera", s);
83
87
  }
84
- function c(s) {
85
- var f;
86
- ((f = e.cameras) == null ? void 0 : f.length) === 0 && r(s);
88
+ function u(s) {
89
+ var c;
90
+ ((c = e.cameras) == null ? void 0 : c.length) === 0 && i(s);
87
91
  }
88
- function i() {
92
+ function r() {
89
93
  e.cameras = [];
90
94
  }
91
- return ge(() => {
92
- o != null && o.value && n();
95
+ return fe(() => {
96
+ n != null && n.value && o();
93
97
  }), {
94
- activeCamera: je(e, "camera"),
98
+ activeCamera: _e(e, "camera"),
95
99
  createCamera: a,
96
- updateCamera: n,
97
- pushCamera: r,
98
- clearCameras: i,
99
- setFirstCamera: c
100
+ updateCamera: o,
101
+ pushCamera: i,
102
+ clearCameras: r,
103
+ setFirstCamera: u
100
104
  };
101
105
  }
102
- const Se = X(), Pe = X(), Z = X(), I = new Ce();
103
- let W = 0, Y = 0;
104
- const { pause: rt, resume: ot, isActive: it } = Ke(
106
+ const we = A(), be = A(), J = A(), _ = new pe();
107
+ let I = 0, B = 0;
108
+ const { pause: at, resume: nt, isActive: rt } = Ue(
105
109
  () => {
106
- Se.trigger({ delta: W, elapsed: Y, clock: I }), Pe.trigger({ delta: W, elapsed: Y, clock: I }), Z.trigger({ delta: W, elapsed: Y, clock: I });
110
+ we.trigger({ delta: I, elapsed: B, clock: _ }), be.trigger({ delta: I, elapsed: B, clock: _ }), J.trigger({ delta: I, elapsed: B, clock: _ });
107
111
  },
108
112
  { immediate: !1 }
109
113
  );
110
- Z.on(() => {
111
- W = I.getDelta(), Y = I.getElapsedTime();
114
+ J.on(() => {
115
+ I = _.getDelta(), B = _.getElapsedTime();
112
116
  });
113
- function Te() {
117
+ function he() {
114
118
  return {
115
- onBeforeLoop: Se.on,
116
- onLoop: Pe.on,
117
- onAfterLoop: Z.on,
118
- pause: rt,
119
- resume: ot,
120
- isActive: it
119
+ onBeforeLoop: we.on,
120
+ onLoop: be.on,
121
+ onAfterLoop: J.on,
122
+ pause: at,
123
+ resume: nt,
124
+ isActive: rt
121
125
  };
122
126
  }
123
- function st(e) {
124
- return e instanceof U ? e : Array.isArray(e) ? new U(...e) : new U(e);
127
+ function ot(e) {
128
+ return e instanceof W ? e : Array.isArray(e) ? new W(...e) : new W(e);
125
129
  }
126
- const q = {
130
+ const Y = {
127
131
  realistic: {
128
- outputColorSpace: Fe,
129
- toneMapping: ze,
132
+ outputColorSpace: De,
133
+ toneMapping: Ie,
130
134
  toneMappingExposure: 3,
131
135
  shadowMap: {
132
136
  enabled: !0,
133
- type: Ge
137
+ type: Be
134
138
  }
135
139
  }
136
- }, Le = (e, t) => {
137
- for (const o of Object.keys(t))
138
- t[o] instanceof Object && Object.assign(t[o], Le(e[o], t[o]));
140
+ }, ye = (e, t) => {
141
+ for (const n of Object.keys(t))
142
+ t[n] instanceof Object && Object.assign(t[n], ye(e[n], t[n]));
139
143
  return Object.assign(e || {}, t), e;
140
- }, ct = "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", ft = /* @__PURE__ */ ut(ct);
141
- function V(e) {
142
- return e.replace(/-([a-z])/g, (t, o) => o.toUpperCase());
144
+ }, it = "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", st = /* @__PURE__ */ ct(it);
145
+ function j(e) {
146
+ return e.replace(/-([a-z])/g, (t, n) => n.toUpperCase());
143
147
  }
144
- function ut(e, t) {
145
- const o = /* @__PURE__ */ Object.create(null), a = e.split(",");
146
- for (let n = 0; n < a.length; n++)
147
- o[a[n]] = !0;
148
- return t ? (n) => !!o[n.toLowerCase()] : (n) => !!o[n];
148
+ function ct(e, t) {
149
+ const n = /* @__PURE__ */ Object.create(null), a = e.split(",");
150
+ for (let o = 0; o < a.length; o++)
151
+ n[a[o]] = !0;
152
+ return t ? (o) => !!n[o.toLowerCase()] : (o) => !!n[o];
149
153
  }
150
- const Rt = !0, se = "[TresJS ▲ ■ ●] ";
151
- function F() {
152
- function e(a, n) {
153
- console.error(`${se} ${a}`, n || "");
154
+ const ut = (e, t) => {
155
+ const n = /* @__PURE__ */ new Set(), a = [];
156
+ for (const o of e) {
157
+ const i = t(o);
158
+ n.has(i) || (n.add(i), a.push(o));
159
+ }
160
+ return a;
161
+ }, Mt = !0, oe = "[TresJS ▲ ■ ●] ";
162
+ function O() {
163
+ function e(a, o) {
164
+ console.error(`${oe} ${a}`, o || "");
154
165
  }
155
166
  function t(a) {
156
- console.warn(`${se} ${a}`);
167
+ console.warn(`${oe} ${a}`);
157
168
  }
158
- function o(a, n) {
169
+ function n(a, o) {
159
170
  }
160
171
  return {
161
172
  logError: e,
162
173
  logWarning: t,
163
- logMessage: o
174
+ logMessage: n
164
175
  };
165
176
  }
166
- function lt(e) {
167
- var ae, ne;
168
- const t = we(), o = E(!1), {
177
+ function ft(e) {
178
+ const t = Ae(), n = G(!1), {
169
179
  alpha: a = !0,
170
- antialias: n = !0,
171
- depth: r,
172
- logarithmicDepthBuffer: c,
173
- failIfMajorPerformanceCaveat: i,
180
+ antialias: o = !0,
181
+ depth: i,
182
+ logarithmicDepthBuffer: u,
183
+ failIfMajorPerformanceCaveat: r,
174
184
  precision: s,
175
- premultipliedAlpha: f,
185
+ premultipliedAlpha: c,
176
186
  stencil: l,
177
187
  shadows: d = !1,
178
- shadowMapType: v = Ve,
179
- useLegacyLights: C = !1,
180
- outputColorSpace: M = re,
181
- toneMapping: h = oe,
182
- toneMappingExposure: S = 1,
188
+ shadowMapType: p = He,
189
+ useLegacyLights: y = !1,
190
+ outputColorSpace: h = ae,
191
+ toneMapping: v = ne,
192
+ toneMappingExposure: M = 1,
183
193
  context: w = void 0,
184
- powerPreference: x = "default",
185
- preserveDrawingBuffer: $ = !1,
186
- clearColor: y,
187
- windowSize: m = !1,
188
- preset: R = void 0
189
- } = ve(e), { state: g, setState: b } = B(), { width: O, height: k } = u(m) == !0 || u(m) === "" || u(m) === "true" ? qe() : Je(g.container), { logError: P, logWarning: z } = F(), { pixelRatio: j } = Xe(), { pause: T, resume: G } = Te(), L = pe(() => O.value / k.value);
190
- !u(m) && ((ne = (ae = g.container) == null ? void 0 : ae.value) == null ? void 0 : ne.offsetHeight) === 0 && z(`Oops... Seems like your canvas height is currently 0px, by default it takes the height of it's parent, so make sure it has some height with CSS.
191
- You could set windowSize=true to force the canvas to be the size of the window.`);
194
+ powerPreference: E = "default",
195
+ preserveDrawingBuffer: k = !1,
196
+ clearColor: C,
197
+ windowSize: R = !1,
198
+ preset: N = void 0
199
+ } = ue(e), { state: f, setState: g } = S(), { width: X, height: Q } = m(R) == !0 || m(R) === "" || m(R) === "true" ? Ye() : $e(f.container), { logError: Ee, logWarning: Me } = O(), { pixelRatio: Z } = qe(), { pause: Pe, resume: Ce } = he(), F = V(() => X.value / Q.value);
200
+ setTimeout(() => {
201
+ var P;
202
+ !m(R) && !((P = f.canvas) != null && P.value.offsetHeight) && Me(`Oops... Seems like your canvas height is currently 0px, it's posible that you couldn't watch your scene.
203
+ You could set windowSize=true to force the canvas to be the size of the window.`);
204
+ }, 1e3);
192
205
  const ee = () => {
193
- t.value && (t.value.setSize(O.value, k.value), t.value.setPixelRatio(Math.min(j.value, 2)));
206
+ t.value && (t.value.setSize(X.value, Q.value), t.value.setPixelRatio(Math.min(Z.value, 2)));
194
207
  }, te = () => {
195
208
  if (!t.value)
196
209
  return;
197
- const _ = u(R);
198
- if (_) {
199
- _ in q || P("Renderer Preset must be one of these: " + Object.keys(q).join(", ")), Le(t.value, q[_]);
210
+ const P = m(N);
211
+ if (P) {
212
+ P in Y || Ee("Renderer Preset must be one of these: " + Object.keys(Y).join(", ")), ye(t.value, Y[P]);
200
213
  return;
201
214
  }
202
- t.value.shadowMap.enabled = u(d), t.value.shadowMap.type = u(v), t.value.toneMapping = u(h) || oe, t.value.toneMappingExposure = u(S), t.value.outputColorSpace = u(M) || re, y != null && y.value && t.value.setClearColor(st(u(y))), t.value.useLegacyLights = u(C);
203
- }, _e = () => {
204
- const _ = K(g.canvas);
205
- _ && (t.value = new He({
206
- canvas: _,
207
- alpha: u(a),
208
- antialias: u(n),
209
- context: u(w),
210
- depth: u(r),
211
- failIfMajorPerformanceCaveat: u(i),
212
- logarithmicDepthBuffer: u(c),
213
- powerPreference: u(x),
214
- precision: u(s),
215
- stencil: u(l),
216
- preserveDrawingBuffer: u($),
217
- premultipliedAlpha: u(f)
218
- }), b("renderer", t.value), b("clock", new Ce()), b("aspectRatio", L), te(), ee(), G(), o.value = !0);
219
- }, Ae = () => {
220
- t.value && (t.value.dispose(), t.value = void 0, o.value = !1, T());
215
+ t.value.shadowMap.enabled = m(d), t.value.shadowMap.type = m(p), t.value.toneMapping = m(v) || ne, t.value.toneMappingExposure = m(M), t.value.outputColorSpace = m(h) || ae, C != null && C.value && t.value.setClearColor(ot(m(C))), t.value.useLegacyLights = m(y);
216
+ }, Re = () => {
217
+ const P = U(f.canvas);
218
+ P && (t.value = new Ge({
219
+ canvas: P,
220
+ alpha: m(a),
221
+ antialias: m(o),
222
+ context: m(w),
223
+ depth: m(i),
224
+ failIfMajorPerformanceCaveat: m(r),
225
+ logarithmicDepthBuffer: m(u),
226
+ powerPreference: m(E),
227
+ precision: m(s),
228
+ stencil: m(l),
229
+ preserveDrawingBuffer: m(k),
230
+ premultipliedAlpha: m(c)
231
+ }), g("renderer", t.value), g("clock", new pe()), g("aspectRatio", F), te(), ee(), Ce(), n.value = !0);
232
+ }, xe = () => {
233
+ t.value && (t.value.dispose(), t.value = void 0, n.value = !1, Pe());
221
234
  };
222
- return H([L, j], ee), H(
223
- [d, v, M, C, h, S, y],
235
+ return D([F, Z], ee), D(
236
+ [d, p, h, y, v, M, C],
224
237
  te
225
- ), H(
226
- () => [g.canvas, g.container],
238
+ ), D(
239
+ () => [f.canvas, f.container],
227
240
  () => {
228
- K(g.canvas) && K(g.container) && _e();
241
+ U(f.canvas) && U(f.container) && Re();
229
242
  },
230
243
  { immediate: !0, deep: !0 }
231
244
  ), {
232
245
  renderer: t,
233
- isReady: o,
234
- dispose: Ae,
235
- aspectRatio: L
246
+ isReady: n,
247
+ dispose: xe,
248
+ aspectRatio: F
236
249
  };
237
250
  }
238
- function dt(e) {
251
+ function lt(e) {
239
252
  const t = { nodes: {}, materials: {} };
240
- return e && e.traverse((o) => {
241
- o.name && (t.nodes[o.name] = o), o.material && !t.materials[o.material.name] && (t.materials[o.material.name] = o.material);
253
+ return e && e.traverse((n) => {
254
+ n.name && (t.nodes[n.name] = n), n.material && !t.materials[n.material.name] && (t.materials[n.material.name] = n.material);
242
255
  }), t;
243
256
  }
244
- async function Et(e, t, o, a, n) {
245
- const { logError: r } = F(), c = new e();
246
- n && n(c), o && o(c);
257
+ async function Pt(e, t, n, a, o) {
258
+ const { logError: i } = O(), u = new e();
259
+ o && o(u), n && n(u);
247
260
  const s = (Array.isArray(t) ? t : [t]).map(
248
- (f) => new Promise((l, d) => {
249
- c.load(
250
- f,
251
- (v) => {
252
- v.scene && Object.assign(v, dt(v.scene)), l(v);
261
+ (c) => new Promise((l, d) => {
262
+ u.load(
263
+ c,
264
+ (p) => {
265
+ p.scene && Object.assign(p, lt(p.scene)), l(p);
253
266
  },
254
267
  a,
255
- (v) => d(r("[useLoader] - Failed to load resource", v))
268
+ (p) => d(i("[useLoader] - Failed to load resource", p))
256
269
  );
257
270
  })
258
271
  );
259
- return Me(t) ? await Promise.all(s) : await s[0];
272
+ return ge(t) ? await Promise.all(s) : await s[0];
260
273
  }
261
- async function St(e) {
262
- const t = new We(), o = new Ye(t), a = (n) => new Promise((r, c) => {
263
- o.load(
264
- n,
265
- (i) => r(i),
274
+ async function Ct(e) {
275
+ const t = new Ve(), n = new Ne(t), a = (o) => new Promise((i, u) => {
276
+ n.load(
277
+ o,
278
+ (r) => i(r),
266
279
  () => null,
267
280
  () => {
268
- c(new Error("[useTextures] - Failed to load texture"));
281
+ u(new Error("[useTextures] - Failed to load texture"));
269
282
  }
270
283
  );
271
284
  });
272
- if (Me(e)) {
273
- const n = await Promise.all(e.map((r) => a(r)));
274
- return e.length > 1 ? n : n[0];
285
+ if (ge(e)) {
286
+ const o = await Promise.all(e.map((i) => a(i)));
287
+ return e.length > 1 ? o : o[0];
275
288
  } else {
276
289
  const {
277
- map: n,
278
- displacementMap: r,
279
- normalMap: c,
280
- roughnessMap: i,
290
+ map: o,
291
+ displacementMap: i,
292
+ normalMap: u,
293
+ roughnessMap: r,
281
294
  metalnessMap: s,
282
- aoMap: f,
295
+ aoMap: c,
283
296
  alphaMap: l,
284
297
  matcap: d
285
298
  } = e;
286
299
  return {
287
- map: n ? await a(n) : null,
288
- displacementMap: r ? await a(r) : null,
289
- normalMap: c ? await a(c) : null,
290
- roughnessMap: i ? await a(i) : null,
300
+ map: o ? await a(o) : null,
301
+ displacementMap: i ? await a(i) : null,
302
+ normalMap: u ? await a(u) : null,
303
+ roughnessMap: r ? await a(r) : null,
291
304
  metalnessMap: s ? await a(s) : null,
292
- aoMap: f ? await a(f) : null,
305
+ aoMap: c ? await a(c) : null,
293
306
  alphaMap: l ? await a(l) : null,
294
307
  matcap: d ? await a(d) : null
295
308
  };
296
309
  }
297
310
  }
298
- function mt() {
299
- var c;
300
- const e = we(new $e()), t = E(new Ne()), o = E(null), { setState: a, state: n } = B();
301
- a("raycaster", e.value), a("pointer", t), a("currentInstance", o);
302
- function r(i) {
303
- t.value.x = i.clientX / window.innerWidth * 2 - 1, t.value.y = -(i.clientY / window.innerHeight) * 2 + 1;
304
- }
305
- return (c = n == null ? void 0 : n.renderer) == null || c.domElement.addEventListener("pointermove", r), he(() => {
306
- var i;
307
- (i = n == null ? void 0 : n.renderer) == null || i.domElement.removeEventListener("pointermove", r);
311
+ const dt = (e) => {
312
+ const { state: t } = S(), n = V(() => {
313
+ var f;
314
+ return (f = t.canvas) == null ? void 0 : f.value;
315
+ }), { x: a, y: o } = Ke({ target: n }), { width: i, height: u, top: r, left: s } = Je(n), c = new Fe(), l = ({ x: f, y: g }) => {
316
+ if (n.value)
317
+ return {
318
+ x: (f - s.value) / i.value * 2 - 1,
319
+ y: -((g - r.value) / u.value) * 2 + 1
320
+ };
321
+ }, d = ({ x: f, y: g }) => {
322
+ if (t.camera)
323
+ return c.setFromCamera(new ze(f, g), t.camera), c.intersectObjects(e.value, !1);
324
+ }, p = (f) => {
325
+ const g = l({
326
+ x: (f == null ? void 0 : f.clientX) ?? a.value,
327
+ y: (f == null ? void 0 : f.clientY) ?? o.value
328
+ });
329
+ return g ? d(g) || [] : [];
330
+ }, y = V(() => p()), h = A(), v = A(), M = (f, g) => {
331
+ f.trigger({ event: g, intersects: p(g) });
332
+ }, w = (f) => {
333
+ M(v, f);
334
+ };
335
+ let E;
336
+ const k = (f) => {
337
+ var g;
338
+ E = (g = p(f)[0]) == null ? void 0 : g.object;
339
+ }, C = (f) => {
340
+ var g;
341
+ f instanceof PointerEvent && E === ((g = p(f)[0]) == null ? void 0 : g.object) && M(h, f);
342
+ }, R = (f) => v.trigger({ event: f, intersects: [] }), N = fe(() => {
343
+ n != null && n.value && (n.value.addEventListener("pointerup", C), n.value.addEventListener("pointerdown", k), n.value.addEventListener("pointermove", w), n.value.addEventListener("pointerleave", R), N());
344
+ });
345
+ return le(() => {
346
+ n != null && n.value && (n.value.removeEventListener("pointerup", C), n.value.removeEventListener("pointerdown", k), n.value.removeEventListener("pointermove", w), n.value.removeEventListener("pointerleave", R));
308
347
  }), {
309
- raycaster: e,
310
- pointer: t
348
+ intersects: y,
349
+ onClick: (f) => h.on(f).off,
350
+ onPointerMove: (f) => v.on(f).off
311
351
  };
312
- }
313
- function Pt() {
314
- const { logWarning: e } = F();
315
- function t(a, n, r) {
316
- let c = null;
317
- return a.traverse((i) => {
318
- i[n] === r && (c = i);
319
- }), c || e(`Child with ${n} '${r}' not found.`), c;
352
+ };
353
+ function Rt() {
354
+ const { logWarning: e } = O();
355
+ function t(a, o, i) {
356
+ let u = null;
357
+ return a.traverse((r) => {
358
+ r[o] === i && (u = r);
359
+ }), u || e(`Child with ${o} '${i}' not found.`), u;
320
360
  }
321
- function o(a, n) {
322
- return t(a, "name", n);
361
+ function n(a, o) {
362
+ return t(a, "name", o);
323
363
  }
324
364
  return {
325
365
  seek: t,
326
- seekByName: o
366
+ seekByName: n
327
367
  };
328
368
  }
329
- const pt = /^on[^a-z]/, vt = (e) => pt.test(e);
330
- let J = null, ce = null;
331
- const fe = {
369
+ const pt = () => {
370
+ const e = Se({
371
+ click: /* @__PURE__ */ new Map(),
372
+ pointerMove: /* @__PURE__ */ new Map(),
373
+ pointerEnter: /* @__PURE__ */ new Map(),
374
+ pointerLeave: /* @__PURE__ */ new Map()
375
+ }), t = (r) => {
376
+ Object.values(e).forEach((s) => s.delete(r));
377
+ }, n = (r) => {
378
+ const { onClick: s, onPointerMove: c, onPointerEnter: l, onPointerLeave: d } = r;
379
+ s && e.click.set(r, s), c && e.pointerMove.set(r, c), l && e.pointerEnter.set(r, l), d && e.pointerLeave.set(r, d), r.addEventListener("removed", () => {
380
+ r.traverse((p) => {
381
+ t(p);
382
+ }), t(r);
383
+ });
384
+ }, a = V(
385
+ () => ut(
386
+ Object.values(e).map((r) => Array.from(r.keys())).flat(),
387
+ ({ uuid: r }) => r
388
+ )
389
+ ), { onClick: o, onPointerMove: i } = dt(a);
390
+ o(({ intersects: r, event: s }) => {
391
+ var c;
392
+ r.length && ((c = e.click.get(r[0].object)) == null || c(r[0], s));
393
+ });
394
+ let u;
395
+ return i(({ intersects: r, event: s }) => {
396
+ var y, h, v, M;
397
+ const c = (y = r == null ? void 0 : r[0]) == null ? void 0 : y.object, { pointerLeave: l, pointerEnter: d, pointerMove: p } = e;
398
+ u && u !== c && ((h = l.get(u)) == null || h(u, s)), c && (u !== c && ((v = d.get(c)) == null || v(r[0], s)), (M = p.get(c)) == null || M(r[0], s)), u = c || null;
399
+ }), {
400
+ registerObject: n,
401
+ deregisterObject: t
402
+ };
403
+ }, H = {
332
404
  GEOMETRY_VIA_PROP: "tres__geometryViaProp",
333
- MATERIAL_VIA_PROP: "tres__materialViaProp"
334
- }, { logError: ue } = F();
335
- let le = !0;
336
- const gt = {
337
- createElement(e, t, o, a) {
338
- var s, f;
339
- if (a || (a = {}), a.args || (a.args = []), e === "template" || ft(e))
405
+ MATERIAL_VIA_PROP: "tres__materialViaProp",
406
+ REGISTER_AT_POINTER_EVENT_HANDLER: "tres__registerAtPointerEventHandler"
407
+ };
408
+ let $ = null, T = null;
409
+ const { logError: ie } = O(), mt = {
410
+ createElement(e, t, n, a) {
411
+ var s, c;
412
+ if (a || (a = {}), a.args || (a.args = []), e === "template" || st(e))
340
413
  return null;
341
- let n = e.replace("Tres", ""), r;
414
+ let o = e.replace("Tres", ""), i;
342
415
  if (e === "primitive") {
343
- (a == null ? void 0 : a.object) === void 0 && ue("Tres primitives need a prop 'object'");
416
+ (a == null ? void 0 : a.object) === void 0 && ie("Tres primitives need a prop 'object'");
344
417
  const l = a.object;
345
- n = l.type, r = Object.assign(l, { type: n, attach: a.attach, primitive: !0 });
418
+ o = l.type, i = Object.assign(l, { type: o, attach: a.attach, primitive: !0 });
346
419
  } else {
347
- const l = xe.value[n];
348
- l || ue(`${n} is not defined on the THREE namespace. Use extend to add it to the catalog.`), r = new l(...a.args);
349
- }
350
- if (r.isCamera && le) {
351
- a != null && a.position || r.position.set(3, 3, 3), a != null && a.lookAt || r.lookAt(0, 0, 0);
352
- const { setFirstCamera: l } = Ee();
353
- l(r), le = !1;
420
+ const l = me.value[o];
421
+ l || ie(`${o} is not defined on the THREE namespace. Use extend to add it to the catalog.`), i = new l(...a.args);
354
422
  }
355
- (a == null ? void 0 : a.attach) === void 0 && (r.isMaterial ? r.attach = "material" : r.isBufferGeometry && (r.attach = "geometry"));
356
- const { GEOMETRY_VIA_PROP: c, MATERIAL_VIA_PROP: i } = fe;
357
- return r.isObject3D && ((s = a == null ? void 0 : a.material) != null && s.isMaterial && (r.userData[i] = !0), (f = a == null ? void 0 : a.geometry) != null && f.isBufferGeometry && (r.userData[c] = !0)), r.events = {}, r;
423
+ 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"));
424
+ const { GEOMETRY_VIA_PROP: u, MATERIAL_VIA_PROP: r } = H;
425
+ return i.isObject3D && ((s = a == null ? void 0 : a.material) != null && s.isMaterial && (i.userData[r] = !0), (c = a == null ? void 0 : a.geometry) != null && c.isBufferGeometry && (i.userData[u] = !0)), i;
358
426
  },
359
427
  insert(e, t) {
360
- var o, a, n, r, c;
361
- if (t && t.isScene && (ce = t), (((o = e == null ? void 0 : e.__vnode) == null ? void 0 : o.type) === "TresGroup" || ((a = e == null ? void 0 : e.__vnode) == null ? void 0 : a.type) === "TresObject3D") && t === null && !((r = (n = e == null ? void 0 : e.__vnode) == null ? void 0 : n.ctx) != null && r.asyncResolved)) {
362
- J = e;
428
+ var n, a, o, i, u, r, s;
429
+ if (t && t.isScene && (T = t), (((n = e == null ? void 0 : e.__vnode) == null ? void 0 : n.type) === "TresGroup" || ((a = e == null ? void 0 : e.__vnode) == null ? void 0 : a.type) === "TresObject3D") && t === null && !((i = (o = e == null ? void 0 : e.__vnode) == null ? void 0 : o.ctx) != null && i.asyncResolved)) {
430
+ $ = e;
363
431
  return;
364
432
  } else
365
- (c = e == null ? void 0 : e.__vnode) != null && c.type.includes("Controls") && t === null && (J = ce);
366
- t || (t = J), e != null && e.isObject3D && (t != null && t.isObject3D) ? (t.add(e), e.dispatchEvent({ type: "added" })) : e != null && e.isFog ? t.fog = e : typeof (e == null ? void 0 : e.attach) == "string" && (e.__previousAttach = e[t == null ? void 0 : t.attach], t && (t[e.attach] = e));
433
+ (u = e == null ? void 0 : e.__vnode) != null && u.type.includes("Controls") && t === null && ($ = T);
434
+ t || (t = $), e != null && e.isObject3D && (t != null && t.isObject3D) ? (t.add(e), e.dispatchEvent({ type: "added" }), (s = (r = T == null ? void 0 : T.userData) == null ? void 0 : r[H.REGISTER_AT_POINTER_EVENT_HANDLER]) == null || s.call(r, e)) : e != null && e.isFog ? t.fog = e : typeof (e == null ? void 0 : e.attach) == "string" && (e.__previousAttach = e[t == null ? void 0 : t.attach], t && (t[e.attach] = e));
367
435
  },
368
436
  remove(e) {
369
- var t, o;
437
+ var t, n;
370
438
  if (e) {
371
439
  if (e.isObject3D) {
372
- const a = e, n = (r) => {
373
- var s, f;
374
- const { GEOMETRY_VIA_PROP: c, MATERIAL_VIA_PROP: i } = fe;
375
- r.userData[i] || (s = r.material) == null || s.dispose(), r.userData[c] || (f = r.geometry) == null || f.dispose();
440
+ const a = e, o = (i) => {
441
+ var s, c;
442
+ const { GEOMETRY_VIA_PROP: u, MATERIAL_VIA_PROP: r } = H;
443
+ i.userData[r] || (s = i.material) == null || s.dispose(), i.userData[u] || (c = i.geometry) == null || c.dispose();
376
444
  };
377
- a.traverse((r) => n(r)), n(a);
445
+ a.traverse((i) => {
446
+ o(i);
447
+ }), o(a);
378
448
  }
379
- (t = e.removeFromParent) == null || t.call(e), (o = e.dispose) == null || o.call(e);
449
+ (t = e.removeFromParent) == null || t.call(e), (n = e.dispose) == null || n.call(e);
380
450
  }
381
451
  },
382
- patchProp(e, t, o, a) {
452
+ patchProp(e, t, n, a) {
383
453
  if (e) {
384
- let n = e, r = t, c = V(r), i = n == null ? void 0 : n[c];
385
- if (n.type === "BufferGeometry") {
386
- if (r === "args")
454
+ let o = e, i = t, u = j(i), r = o == null ? void 0 : o[u];
455
+ if (o.type === "BufferGeometry") {
456
+ if (i === "args")
387
457
  return;
388
- n.setAttribute(
389
- V(r),
390
- new Ue(...a)
458
+ o.setAttribute(
459
+ j(i),
460
+ new We(...a)
391
461
  );
392
462
  return;
393
463
  }
394
- if (r.includes("-") && i === void 0) {
395
- const f = r.split("-");
396
- i = f.reduce((l, d) => l[V(d)], n), r = f.pop(), c = r.toLowerCase(), i != null && i.set || (n = f.reduce((l, d) => l[V(d)], n));
397
- }
398
- if (vt(r)) {
399
- const f = r;
400
- e.events[f] = a;
464
+ if (i.includes("-") && r === void 0) {
465
+ const c = i.split("-");
466
+ r = c.reduce((l, d) => l[j(d)], o), i = c.pop(), u = i.toLowerCase(), r != null && r.set || (o = c.reduce((l, d) => l[j(d)], o));
401
467
  }
402
468
  let s = a;
403
- if (s === "" && (s = !0), ie(i)) {
404
- Array.isArray(s) ? e[c](...s) : e[c](s);
469
+ if (s === "" && (s = !0), re(r)) {
470
+ Array.isArray(s) ? e[u](...s) : e[u](s);
405
471
  return;
406
472
  }
407
- !(i != null && i.set) && !ie(i) ? n[c] = s : i.constructor === s.constructor && (i != null && i.copy) ? i == null || i.copy(s) : Array.isArray(s) ? i.set(...s) : !i.isColor && i.setScalar ? i.setScalar(s) : i.set(s);
473
+ !(r != null && r.set) && !re(r) ? o[u] = s : r.constructor === s.constructor && (r != null && r.copy) ? r == null || r.copy(s) : Array.isArray(s) ? r.set(...s) : !r.isColor && r.setScalar ? r.setScalar(s) : r.set(s);
408
474
  }
409
475
  },
410
476
  parentNode(e) {
@@ -419,15 +485,15 @@ const gt = {
419
485
  setScopeId: () => void 0,
420
486
  cloneNode: () => void 0,
421
487
  insertStaticContent: () => void 0
422
- }, { createApp: wt } = De(gt), ht = (e) => {
423
- const t = wt(o);
424
- function o() {
488
+ }, { createApp: vt } = Oe(mt), gt = (e) => {
489
+ const t = vt(n);
490
+ function n() {
425
491
  return e && e.default ? e.default() : [];
426
492
  }
427
493
  return t;
428
494
  };
429
- Re(ye);
430
- const { logWarning: de } = F(), bt = be({
495
+ ve(q);
496
+ const { logWarning: se } = O(), wt = de({
431
497
  name: "TresScene",
432
498
  props: [
433
499
  "shadows",
@@ -446,57 +512,54 @@ const { logWarning: de } = F(), bt = be({
446
512
  "disableRender",
447
513
  "camera"
448
514
  ],
449
- setup(e, { slots: t, expose: o }) {
450
- e.physicallyCorrectLights === !0 && de("physicallyCorrectLights is deprecated, useLegacyLights is now false by default");
451
- const a = E(), n = E(), r = new ye.Scene(), { setState: c } = B();
452
- c("scene", r), c("canvas", n), c("container", a);
453
- const i = E(), s = t && t.default && t.default();
454
- s && (s == null ? void 0 : s.length) > 0 && (i.value = s.some((w) => Ze(w.type) && w.type.includes("Camera")) || e.camera, i.value || de("No camera found in the scene, please add one!"));
455
- const { onLoop: f, resume: l } = Te();
456
- Ie(() => {
457
- M();
458
- }), he(() => {
459
- c("renderer", null);
515
+ setup(e, { slots: t, expose: n }) {
516
+ e.physicallyCorrectLights === !0 && se("physicallyCorrectLights is deprecated, useLegacyLights is now false by default");
517
+ const a = G(), o = G(), i = new q.Scene(), u = pt(), { setState: r } = S();
518
+ i.userData[H.REGISTER_AT_POINTER_EVENT_HANDLER] = u.registerObject, r("scene", i), r("canvas", o), r("container", a), r("pointerEventHandler", u);
519
+ const { onLoop: s, resume: c } = he();
520
+ ke(() => {
521
+ h();
522
+ }), le(() => {
523
+ r("renderer", null);
460
524
  });
461
- const { activeCamera: d, pushCamera: v, clearCameras: C } = Ee();
462
- function M() {
463
- const { renderer: w } = lt(e);
464
- e.camera && v(e.camera);
465
- const { raycaster: x, pointer: $ } = mt();
466
- let y = null, m = null;
467
- ge(() => {
468
- d.value && x.value.setFromCamera($.value, d.value);
469
- }), f(() => {
470
- var R, g, b, O, k, P, z, j, T, G;
471
- if (d.value && e.disableRender !== !0 && ((R = w.value) == null || R.render(r, d.value)), x.value) {
472
- const L = x.value.intersectObjects(r.children);
473
- L.length > 0 ? (m = L[0], y === null && ((O = (b = (g = m.object) == null ? void 0 : g.events) == null ? void 0 : b.onPointerEnter) == null || O.call(b, m)), (z = (P = (k = m.object) == null ? void 0 : k.events) == null ? void 0 : P.onPointerMove) == null || z.call(P, m)) : y !== null && ((G = (T = (j = m == null ? void 0 : m.object) == null ? void 0 : j.events) == null ? void 0 : T.onPointerLeave) == null || G.call(T, y), m = null), y = m;
474
- }
475
- }), Qe(n.value, "click", () => {
476
- var R, g, b;
477
- m !== null && ((b = (g = (R = m.object) == null ? void 0 : R.events) == null ? void 0 : g.onClick) == null || b.call(g, m));
525
+ const { activeCamera: l, pushCamera: d, clearCameras: p } = tt();
526
+ function y() {
527
+ const w = i.getObjectByProperty("isCamera", !0);
528
+ if (w)
529
+ d(w);
530
+ else {
531
+ se("No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene.");
532
+ const E = new q.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1e3);
533
+ E.position.set(3, 3, 3), E.lookAt(0, 0, 0), d(E);
534
+ }
535
+ }
536
+ function h() {
537
+ const { renderer: w } = ft(e);
538
+ e.camera && d(e.camera), s(() => {
539
+ var E;
540
+ l.value && e.disableRender !== !0 && ((E = w.value) == null || E.render(i, l.value));
478
541
  });
479
542
  }
480
- let h;
481
- function S() {
482
- h = ht(t);
483
- const w = B();
484
- h.provide("useTres", w), h.provide(Q, w), h.provide("extend", Re), h.mount(r);
543
+ let v;
544
+ function M() {
545
+ v = gt(t);
546
+ const w = S();
547
+ v.provide("useTres", w), v.provide(K, w), v.provide("extend", ve), v.mount(i), y();
485
548
  }
486
- return S(), o({
487
- scene: r
488
- }), H(
549
+ return M(), n({
550
+ scene: i
551
+ }), D(
489
552
  () => e.camera,
490
553
  (w) => {
491
- w && (C(), v(w));
554
+ w && (p(), d(w));
492
555
  }
493
- ), () => D(
494
- D(
556
+ ), () => L(
557
+ L(
495
558
  "div",
496
559
  {
497
560
  ref: a,
498
- "data-scene": r.uuid,
499
- key: r.uuid,
561
+ "data-scene": i.uuid,
562
+ key: i.uuid,
500
563
  style: {
501
564
  position: "relative",
502
565
  width: "100%",
@@ -506,7 +569,7 @@ const { logWarning: de } = F(), bt = be({
506
569
  }
507
570
  },
508
571
  [
509
- D(
572
+ L(
510
573
  "div",
511
574
  {
512
575
  style: {
@@ -515,9 +578,9 @@ const { logWarning: de } = F(), bt = be({
515
578
  }
516
579
  },
517
580
  [
518
- D("canvas", {
519
- ref: n,
520
- "data-scene": r.uuid,
581
+ L("canvas", {
582
+ ref: o,
583
+ "data-scene": i.uuid,
521
584
  style: {
522
585
  display: "block",
523
586
  width: "100%",
@@ -533,7 +596,7 @@ const { logWarning: de } = F(), bt = be({
533
596
  )
534
597
  );
535
598
  }
536
- }), yt = be({
599
+ }), bt = de({
537
600
  name: "TresCanvas",
538
601
  props: [
539
602
  "shadows",
@@ -552,32 +615,33 @@ const { logWarning: de } = F(), bt = be({
552
615
  "disableRender",
553
616
  "camera"
554
617
  ],
555
- setup(e, { slots: t, expose: o }) {
556
- const a = tt();
557
- return o(a), () => D(bt, e, t);
618
+ setup(e, { slots: t, expose: n }) {
619
+ const a = Qe();
620
+ return n(a), () => L(wt, e, t);
558
621
  }
559
- }), Tt = {
622
+ }), xt = {
560
623
  install(e) {
561
- e.component("TresCanvas", yt);
624
+ e.component("TresCanvas", bt);
562
625
  }
563
626
  };
564
627
  export {
565
- at as CameraType,
566
- Q as TRES_CONTEXT_KEY,
567
- yt as TresCanvas,
568
- xe as catalogue,
569
- Tt as default,
570
- Re as extend,
571
- Rt as isProd,
572
- dt as trasverseObjects,
573
- Ee as useCamera,
574
- Et as useLoader,
575
- F as useLogger,
576
- mt as useRaycaster,
577
- Te as useRenderLoop,
578
- lt as useRenderer,
579
- Pt as useSeek,
580
- St as useTexture,
581
- B as useTres,
582
- tt as useTresProvider
628
+ Ze as CameraType,
629
+ K as TRES_CONTEXT_KEY,
630
+ bt as TresCanvas,
631
+ me as catalogue,
632
+ xt as default,
633
+ ve as extend,
634
+ Mt as isProd,
635
+ lt as trasverseObjects,
636
+ tt as useCamera,
637
+ Pt as useLoader,
638
+ O as useLogger,
639
+ pt as usePointerEventHandler,
640
+ dt as useRaycaster,
641
+ he as useRenderLoop,
642
+ ft as useRenderer,
643
+ Rt as useSeek,
644
+ Ct as useTexture,
645
+ S as useTres,
646
+ Qe as useTresProvider
583
647
  };