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