@tresjs/core 3.7.0 → 4.0.0-next.1

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,24 +1,24 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v3.7.0
3
+ * version: v4.0.0-next.1
4
4
  * (c) 2024
5
5
  * description: Declarative ThreeJS using Vue Components
6
6
  * author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
7
7
  */
8
- var je = Object.defineProperty;
9
- var He = (e, r, t) => r in e ? je(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
10
- var J = (e, r, t) => (He(e, typeof r != "symbol" ? r + "" : r, t), t);
11
- import { ref as R, computed as P, watchEffect as O, onUnmounted as F, shallowRef as D, watch as me, reactive as ge, readonly as Re, provide as q, inject as $e, createRenderer as Ie, defineComponent as ne, useSlots as ze, getCurrentInstance as oe, onMounted as Ne, openBlock as Ve, createElementBlock as We, normalizeClass as Ue, unref as Fe, normalizeStyle as Ge, h as se, Fragment as Je } from "vue";
12
- import * as ve from "three";
13
- import { PerspectiveCamera as K, OrthographicCamera as Qe, Camera as Ye, Clock as qe, Vector3 as he, Color as V, MeshBasicMaterial as ye, DoubleSide as Ke, REVISION as Xe, SRGBColorSpace as Ze, ACESFilmicToneMapping as et, PCFSoftShadowMap as tt, WebGLRenderer as Q, LoadingManager as rt, TextureLoader as nt, Vector2 as ot, Raycaster as st, BufferAttribute as it, Scene as at, Line as lt, BufferGeometry as ie, Float32BufferAttribute as ae, LineBasicMaterial as ut, Mesh as ct, BackSide as dt, DirectionalLightHelper as ft, PointLightHelper as pt, SpotLightHelper as mt, HemisphereLightHelper as gt, ArrowHelper as vt } from "three";
14
- import { createEventHook as H, useRafFn as we, toValue as M, unrefElement as ht, useDevicePixelRatio as yt, usePointer as wt, useElementBounding as bt, useWindowSize as _t, useElementSize as Et, refDebounced as Mt, useFps as Ct, useMemory as St } from "@vueuse/core";
15
- const xt = "@tresjs/core", Pt = "module", kt = "3.7.0", At = "pnpm@8.10.2", Tt = "Declarative ThreeJS using Vue Components", Lt = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", Ot = "MIT", Dt = [
8
+ var He = Object.defineProperty;
9
+ var Ne = (t, e, r) => e in t ? He(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
10
+ var Y = (t, e, r) => (Ne(t, typeof e != "symbol" ? e + "" : e, r), r);
11
+ import { ref as T, computed as x, watchEffect as se, onUnmounted as J, shallowRef as $, watch as I, reactive as be, readonly as Z, provide as ee, inject as Fe, defineComponent as le, useSlots as We, getCurrentInstance as ue, onMounted as Ue, openBlock as Ge, createElementBlock as ze, normalizeClass as Ve, unref as Je, normalizeStyle as Qe, createRenderer as Ye, h as ce, Fragment as qe } from "vue";
12
+ import * as Me from "three";
13
+ import { PerspectiveCamera as te, Camera as Ke, Clock as Xe, Vector3 as _e, Color as G, MeshBasicMaterial as Ee, DoubleSide as Ze, REVISION as et, SRGBColorSpace as tt, ACESFilmicToneMapping as Ce, PCFSoftShadowMap as rt, NoToneMapping as nt, WebGLRenderer as q, LoadingManager as ot, TextureLoader as st, Vector2 as it, Raycaster as at, BufferAttribute as lt, Scene as ut, Line as ct, BufferGeometry as de, Float32BufferAttribute as fe, LineBasicMaterial as dt, Mesh as ft, BackSide as pt, DirectionalLightHelper as mt, PointLightHelper as vt, SpotLightHelper as gt, HemisphereLightHelper as ht, ArrowHelper as yt } from "three";
14
+ import { createEventHook as H, useRafFn as Se, toValue as M, unrefElement as wt, useDevicePixelRatio as bt, usePointer as Mt, useElementBounding as _t, useWindowSize as Et, useElementSize as Ct, refDebounced as pe, useFps as St, useMemory as xt } from "@vueuse/core";
15
+ const kt = "@tresjs/core", Tt = "module", Pt = "4.0.0-next.1", At = "pnpm@8.10.2", Lt = "Declarative ThreeJS using Vue Components", Ot = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", Bt = "MIT", jt = [
16
16
  "vue",
17
17
  "3d",
18
18
  "threejs",
19
19
  "three",
20
20
  "threejs-vue"
21
- ], Bt = !1, jt = {
21
+ ], Dt = !1, It = {
22
22
  ".": {
23
23
  types: "./dist/index.d.ts",
24
24
  require: "./dist/tres.umd.cjs",
@@ -37,12 +37,12 @@ const xt = "@tresjs/core", Pt = "module", kt = "3.7.0", At = "pnpm@8.10.2", Tt =
37
37
  types: "./dist/utils/index.d.ts"
38
38
  },
39
39
  "./*": "./*"
40
- }, Ht = "./dist/tres.js", Rt = "./dist/tres.js", $t = "./dist/index.d.ts", It = [
40
+ }, Rt = "./dist/tres.js", $t = "./dist/tres.js", Ht = "./dist/index.d.ts", Nt = [
41
41
  "dist",
42
42
  "*.d.ts"
43
- ], zt = {
43
+ ], Ft = {
44
44
  access: "public"
45
- }, Nt = {
45
+ }, Wt = {
46
46
  dev: "cd playground && npm run dev",
47
47
  build: "vite build",
48
48
  playground: "cd playground && npm run dev",
@@ -57,28 +57,28 @@ const xt = "@tresjs/core", Pt = "module", kt = "3.7.0", At = "pnpm@8.10.2", Tt =
57
57
  "docs:serve": "vitepress serve docs",
58
58
  "docs:preview": "vitepress preview docs",
59
59
  "docs:contributors": "esno scripts/update-contributors.ts"
60
- }, Vt = {
60
+ }, Ut = {
61
61
  three: ">=0.133",
62
- vue: ">=3.3"
63
- }, Wt = {
62
+ vue: ">=3.4"
63
+ }, Gt = {
64
64
  "@alvarosabu/utils": "^3.1.1",
65
- "@vueuse/core": "^10.7.0"
66
- }, Ut = {
65
+ "@vueuse/core": "^10.7.1"
66
+ }, zt = {
67
67
  "@release-it/conventional-changelog": "^8.0.1",
68
68
  "@stackblitz/sdk": "^1.9.0",
69
- "@tresjs/cientos": "3.6.0",
69
+ "@tresjs/cientos": "3.7.0",
70
70
  "@tresjs/eslint-config-vue": "^0.2.1",
71
- "@types/three": "^0.159.0",
72
- "@typescript-eslint/eslint-plugin": "^6.14.0",
73
- "@typescript-eslint/parser": "^6.14.0",
74
- "@vitejs/plugin-vue": "^4.5.2",
71
+ "@types/three": "^0.160.0",
72
+ "@typescript-eslint/eslint-plugin": "^6.17.0",
73
+ "@typescript-eslint/parser": "^6.17.0",
74
+ "@vitejs/plugin-vue": "^5.0.2",
75
75
  "@vitest/coverage-c8": "^0.33.0",
76
- "@vitest/ui": "^1.0.4",
76
+ "@vitest/ui": "^1.1.1",
77
77
  "@vue/test-utils": "^2.4.3",
78
- eslint: "^8.55.0",
78
+ eslint: "^8.56.0",
79
79
  "eslint-plugin-vue": "^9.19.2",
80
80
  esno: "^4.0.0",
81
- gsap: "^3.12.3",
81
+ gsap: "^3.12.4",
82
82
  jsdom: "^23.0.1",
83
83
  kolorist: "^1.8.0",
84
84
  ohmyfetch: "^0.4.21",
@@ -86,527 +86,555 @@ const xt = "@tresjs/core", Pt = "module", kt = "3.7.0", At = "pnpm@8.10.2", Tt =
86
86
  "release-it": "^17.0.1",
87
87
  "rollup-plugin-analyzer": "^4.0.0",
88
88
  "rollup-plugin-copy": "^3.5.0",
89
- "rollup-plugin-visualizer": "^5.11.0",
90
- three: "^0.159.0",
91
- unocss: "^0.58.0",
92
- unplugin: "^1.5.1",
89
+ "rollup-plugin-visualizer": "^5.12.0",
90
+ three: "^0.160.0",
91
+ unocss: "^0.58.3",
92
+ unplugin: "^1.6.0",
93
93
  "unplugin-vue-components": "^0.26.0",
94
- vite: "^5.0.8",
94
+ vite: "^5.0.10",
95
95
  "vite-plugin-banner": "^0.7.1",
96
- "vite-plugin-dts": "3.6.4",
96
+ "vite-plugin-dts": "3.7.0",
97
97
  "vite-plugin-inspect": "^0.8.1",
98
98
  "vite-plugin-require-transform": "^1.0.21",
99
99
  "vite-svg-loader": "^5.1.0",
100
- vitepress: "1.0.0-rc.31",
101
- vitest: "^1.0.4",
102
- vue: "^3.3.11",
100
+ vitepress: "1.0.0-rc.34",
101
+ vitest: "^1.1.1",
102
+ vue: "^3.4.3",
103
103
  "vue-demi": "^0.14.6"
104
- }, Ft = {
105
- name: xt,
106
- type: Pt,
107
- version: kt,
104
+ }, Vt = {
105
+ name: kt,
106
+ type: Tt,
107
+ version: Pt,
108
108
  packageManager: At,
109
- description: Tt,
110
- author: Lt,
111
- license: Ot,
112
- keywords: Dt,
113
- sideEffects: Bt,
114
- exports: jt,
115
- main: Ht,
116
- module: Rt,
117
- types: $t,
118
- files: It,
119
- publishConfig: zt,
120
- scripts: Nt,
121
- peerDependencies: Vt,
122
- dependencies: Wt,
123
- devDependencies: Ut
124
- }, Gt = ({ sizes: e, scene: r }) => {
125
- const t = R([]), n = P(
126
- () => t.value[0]
127
- ), s = (i, l = !1) => {
128
- t.value.some(({ uuid: c }) => c === i.uuid) || (l ? o(i) : t.value.push(i));
129
- }, a = (i) => {
130
- t.value = t.value.filter(({ uuid: l }) => l !== i.uuid);
131
- }, o = (i) => {
132
- const l = i instanceof Ye ? i : t.value.find((p) => p.uuid === i);
109
+ description: Lt,
110
+ author: Ot,
111
+ license: Bt,
112
+ keywords: jt,
113
+ sideEffects: Dt,
114
+ exports: It,
115
+ main: Rt,
116
+ module: $t,
117
+ types: Ht,
118
+ files: Nt,
119
+ publishConfig: Ft,
120
+ scripts: Wt,
121
+ peerDependencies: Ut,
122
+ dependencies: Gt,
123
+ devDependencies: zt
124
+ }, Jt = ({ sizes: t, scene: e }) => {
125
+ const r = T([]), s = x(
126
+ () => r.value[0]
127
+ ), o = (a, l = !1) => {
128
+ r.value.some(({ uuid: f }) => f === a.uuid) || (l ? n(a) : r.value.push(a));
129
+ }, i = (a) => {
130
+ r.value = r.value.filter(({ uuid: l }) => l !== a.uuid);
131
+ }, n = (a) => {
132
+ const l = a instanceof Ke ? a : r.value.find((c) => c.uuid === a);
133
133
  if (!l)
134
134
  return;
135
- const c = t.value.filter(({ uuid: p }) => p !== l.uuid);
136
- t.value = [l, ...c];
135
+ const f = r.value.filter(({ uuid: c }) => c !== l.uuid);
136
+ r.value = [l, ...f];
137
137
  };
138
- return O(() => {
139
- e.aspectRatio.value && t.value.forEach((i) => {
140
- i instanceof K && (i.aspect = e.aspectRatio.value), (i instanceof K || i instanceof Qe) && i.updateProjectionMatrix();
138
+ return se(() => {
139
+ t.aspectRatio.value && r.value.forEach((a) => {
140
+ !a.manual && (a instanceof te || Qt(a)) && (a instanceof te ? a.aspect = t.aspectRatio.value : (a.left = t.width.value * -0.5, a.right = t.width.value * 0.5, a.top = t.height.value * 0.5, a.bottom = t.height.value * -0.5), a.updateProjectionMatrix());
141
141
  });
142
- }), r.userData.tres__registerCamera = s, r.userData.tres__deregisterCamera = a, F(() => {
143
- t.value = [];
142
+ }), J(() => {
143
+ r.value = [];
144
144
  }), {
145
- camera: n,
146
- cameras: t,
147
- registerCamera: s,
148
- deregisterCamera: a,
149
- setCameraActive: o
145
+ camera: s,
146
+ cameras: r,
147
+ registerCamera: o,
148
+ deregisterCamera: i,
149
+ setCameraActive: n
150
150
  };
151
- }, be = H(), _e = H(), ee = H(), j = new qe();
152
- let W = 0, U = 0;
153
- const { pause: Jt, resume: Qt, isActive: Yt } = we(
151
+ };
152
+ function Qt(t) {
153
+ return t.hasOwnProperty("isOrthographicCamera") && t.isOrthographicCamera;
154
+ }
155
+ const xe = H(), ke = H(), ie = H(), R = new Xe();
156
+ let z = 0, V = 0;
157
+ const { pause: Yt, resume: qt, isActive: Kt } = Se(
154
158
  () => {
155
- be.trigger({ delta: W, elapsed: U, clock: j }), _e.trigger({ delta: W, elapsed: U, clock: j }), ee.trigger({ delta: W, elapsed: U, clock: j });
159
+ xe.trigger({ delta: z, elapsed: V, clock: R }), ke.trigger({ delta: z, elapsed: V, clock: R }), ie.trigger({ delta: z, elapsed: V, clock: R });
156
160
  },
157
161
  { immediate: !1 }
158
162
  );
159
- ee.on(() => {
160
- W = j.getDelta(), U = j.getElapsedTime();
163
+ ie.on(() => {
164
+ z = R.getDelta(), V = R.getElapsedTime();
161
165
  });
162
- const te = () => ({
163
- onBeforeLoop: be.on,
164
- onLoop: _e.on,
165
- onAfterLoop: ee.on,
166
- pause: Jt,
167
- resume: Qt,
168
- isActive: Yt
169
- }), Vr = !0, le = "[TresJS ▲ ■ ●] ";
170
- function T() {
171
- function e(n, s) {
172
- console.error(`${le} ${n}`, s || "");
166
+ const ae = () => ({
167
+ onBeforeLoop: xe.on,
168
+ onLoop: ke.on,
169
+ onAfterLoop: ie.on,
170
+ pause: Yt,
171
+ resume: qt,
172
+ isActive: Kt
173
+ }), Wr = !0, me = "[TresJS ▲ ■ ●] ";
174
+ function P() {
175
+ function t(s, o) {
176
+ console.error(`${me} ${s}`, o || "");
173
177
  }
174
- function r(n) {
175
- console.warn(`${le} ${n}`);
178
+ function e(s) {
179
+ console.warn(`${me} ${s}`);
176
180
  }
177
- function t(n, s) {
181
+ function r(s, o) {
178
182
  }
179
183
  return {
180
- logError: e,
181
- logWarning: r,
182
- logMessage: t
184
+ logError: t,
185
+ logWarning: e,
186
+ logMessage: r
183
187
  };
184
188
  }
185
- function Wr(e) {
186
- return typeof e == "number" ? [e, e, e] : e instanceof he ? [e.x, e.y, e.z] : e;
189
+ function Ur(t) {
190
+ return typeof t == "number" ? [t, t, t] : t instanceof _e ? [t.x, t.y, t.z] : t;
187
191
  }
188
- function qt(e) {
189
- return e instanceof V ? e : Array.isArray(e) ? new V(...e) : new V(e);
192
+ function Xt(t) {
193
+ return t instanceof G ? t : Array.isArray(t) ? new G(...t) : new G(t);
190
194
  }
191
- class Kt extends ve.Mesh {
192
- constructor(...t) {
193
- super(...t);
194
- J(this, "type", "HightlightMesh");
195
- J(this, "createTime");
195
+ class Zt extends Me.Mesh {
196
+ constructor(...r) {
197
+ super(...r);
198
+ Y(this, "type", "HightlightMesh");
199
+ Y(this, "createTime");
196
200
  this.createTime = Date.now();
197
201
  }
198
202
  onBeforeRender() {
199
- const n = (Date.now() - this.createTime) / 1e3, o = 1 + 0.07 * Math.sin(2.5 * n);
200
- this.scale.set(o, o, o);
203
+ const s = (Date.now() - this.createTime) / 1e3, n = 1 + 0.07 * Math.sin(2.5 * s);
204
+ this.scale.set(n, n, n);
201
205
  }
202
206
  }
203
- const Ee = (e, r) => {
204
- for (const t of Object.keys(r))
205
- r[t] instanceof Object && Object.assign(r[t], Ee(e[t], r[t]));
206
- return Object.assign(e || {}, r), e;
207
- }, Xt = "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", Zt = /* @__PURE__ */ er(Xt);
208
- function ue(e) {
209
- return e && e.nodeType === 1;
207
+ const Te = (t, e) => {
208
+ for (const r of Object.keys(e))
209
+ e[r] instanceof Object && Object.assign(e[r], Te(t[r], e[r]));
210
+ return Object.assign(t || {}, e), t;
211
+ }, er = "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", tr = /* @__PURE__ */ rr(er);
212
+ function ve(t) {
213
+ return t && t.nodeType === 1;
210
214
  }
211
- function I(e) {
212
- return e.replace(/-([a-z])/g, (r, t) => t.toUpperCase());
215
+ function F(t) {
216
+ return t.replace(/-([a-z])/g, (e, r) => r.toUpperCase());
213
217
  }
214
- function er(e, r) {
215
- const t = /* @__PURE__ */ Object.create(null), n = e.split(",");
216
- for (let s = 0; s < n.length; s++)
217
- t[n[s]] = !0;
218
- return r ? (s) => !!t[s.toLowerCase()] : (s) => !!t[s];
218
+ function rr(t, e) {
219
+ const r = /* @__PURE__ */ Object.create(null), s = t.split(",");
220
+ for (let o = 0; o < s.length; o++)
221
+ r[s[o]] = !0;
222
+ return e ? (o) => !!r[o.toLowerCase()] : (o) => !!r[o];
219
223
  }
220
- const tr = (e, r) => {
221
- const t = /* @__PURE__ */ new Set(), n = [];
222
- for (const s of e) {
223
- const a = r(s);
224
- t.has(a) || (t.add(a), n.push(s));
224
+ const nr = (t, e) => {
225
+ const r = /* @__PURE__ */ new Set(), s = [];
226
+ for (const o of t) {
227
+ const i = e(o);
228
+ r.has(i) || (r.add(i), s.push(o));
225
229
  }
226
- return n;
227
- }, ce = (e, r) => {
228
- if (!r)
230
+ return s;
231
+ }, ge = (t, e) => {
232
+ if (!e)
229
233
  return;
230
- const t = Array.isArray(r) ? r : r.match(/([^[.\]])+/g);
231
- return t == null ? void 0 : t.reduce((n, s) => n && n[s], e);
232
- }, rr = (e, r, t) => {
233
- const n = Array.isArray(r) ? r : r.match(/([^[.\]])+/g);
234
- n && n.reduce((s, a, o) => (s[a] === void 0 && (s[a] = {}), o === n.length - 1 && (s[a] = t), s[a]), e);
234
+ const r = Array.isArray(e) ? e : e.match(/([^[.\]])+/g);
235
+ return r == null ? void 0 : r.reduce((s, o) => s && s[o], t);
236
+ }, or = (t, e, r) => {
237
+ const s = Array.isArray(e) ? e : e.match(/([^[.\]])+/g);
238
+ s && s.reduce((o, i, n) => (o[i] === void 0 && (o[i] = {}), n === s.length - 1 && (o[i] = r), o[i]), t);
235
239
  };
236
- function Me(e, r) {
237
- if (ue(e) && ue(r)) {
238
- const s = e.attributes, a = r.attributes;
239
- return s.length !== a.length ? !1 : Array.from(s).every(({ name: o, value: i }) => r.getAttribute(o) === i);
240
+ function Pe(t, e) {
241
+ if (ve(t) && ve(e)) {
242
+ const o = t.attributes, i = e.attributes;
243
+ return o.length !== i.length ? !1 : Array.from(o).every(({ name: n, value: a }) => e.getAttribute(n) === a);
240
244
  }
241
- if (e === r)
245
+ if (t === e)
242
246
  return !0;
243
- if (e === null || typeof e != "object" || r === null || typeof r != "object")
247
+ if (t === null || typeof t != "object" || e === null || typeof e != "object")
244
248
  return !1;
245
- const t = Object.keys(e), n = Object.keys(r);
246
- if (t.length !== n.length)
249
+ const r = Object.keys(t), s = Object.keys(e);
250
+ if (r.length !== s.length)
247
251
  return !1;
248
- for (const s of t)
249
- if (!n.includes(s) || !Me(e[s], r[s]))
252
+ for (const o of r)
253
+ if (!s.includes(o) || !Pe(t[o], e[o]))
250
254
  return !1;
251
255
  return !0;
252
256
  }
253
- function nr(e, r) {
254
- if (!Array.isArray(e) || !Array.isArray(r) || e.length !== r.length)
257
+ function sr(t, e) {
258
+ if (!Array.isArray(t) || !Array.isArray(e) || t.length !== e.length)
255
259
  return !1;
256
- for (let t = 0; t < e.length; t++)
257
- if (!Me(e[t], r[t]))
260
+ for (let r = 0; r < t.length; r++)
261
+ if (!Pe(t[r], e[r]))
258
262
  return !1;
259
263
  return !0;
260
264
  }
261
- const or = Array.isArray;
262
- function sr(e, r, t, n) {
263
- const s = (l) => {
264
- if (l.uuid === r)
265
+ const ir = Array.isArray;
266
+ function ar(t, e, r, s) {
267
+ const o = (l) => {
268
+ if (l.uuid === e)
265
269
  return l;
266
- for (const c of l.children) {
267
- const p = s(c);
268
- if (p)
269
- return p;
270
+ for (const f of l.children) {
271
+ const c = o(f);
272
+ if (c)
273
+ return c;
270
274
  }
271
- }, a = s(e);
272
- if (!a) {
275
+ }, i = o(t);
276
+ if (!i) {
273
277
  console.warn("Object with UUID not found in the scene.");
274
278
  return;
275
279
  }
276
- let o = a;
277
- for (let l = 0; l < t.length - 1; l++)
278
- if (o[t[l]] !== void 0)
279
- o = o[t[l]];
280
+ let n = i;
281
+ for (let l = 0; l < r.length - 1; l++)
282
+ if (n[r[l]] !== void 0)
283
+ n = n[r[l]];
280
284
  else {
281
- console.warn(`Property path is not valid: ${t.join(".")}`);
285
+ console.warn(`Property path is not valid: ${r.join(".")}`);
282
286
  return;
283
287
  }
284
- const i = t[t.length - 1];
285
- o[i] !== void 0 ? o[i] = n : console.warn(`Property path is not valid: ${t.join(".")}`);
288
+ const a = r[r.length - 1];
289
+ n[a] !== void 0 ? n[a] = s : console.warn(`Property path is not valid: ${r.join(".")}`);
286
290
  }
287
- function ir(e) {
288
- const r = new ye({
291
+ function lr(t) {
292
+ const e = new Ee({
289
293
  color: 11003607,
290
294
  // Highlight color, e.g., yellow
291
295
  transparent: !0,
292
296
  opacity: 0.2,
293
297
  depthTest: !1,
294
298
  // So the highlight is always visible
295
- side: Ke
299
+ side: Ze
296
300
  // To e
297
301
  });
298
- return new Kt(e.geometry.clone(), r);
302
+ return new Zt(t.geometry.clone(), e);
299
303
  }
300
- function Ce(e) {
301
- var t;
302
- let r = e.value;
303
- return e.value && ((t = e.value) != null && t.isMesh) && (r = e.value.position), Array.isArray(e.value) && (r = new he(...r)), r;
304
+ function Ae(t) {
305
+ var r;
306
+ let e = t.value;
307
+ return t.value && ((r = t.value) != null && r.isMesh) && (e = t.value.position), Array.isArray(t.value) && (e = new _e(...e)), e;
304
308
  }
305
- const ar = Number.parseInt(Xe.replace("dev", "")), z = {
309
+ const ur = Number.parseInt(et.replace("dev", "")), W = {
306
310
  realistic: {
307
311
  shadows: !0,
308
312
  physicallyCorrectLights: !0,
309
- outputColorSpace: Ze,
310
- toneMapping: et,
313
+ outputColorSpace: tt,
314
+ toneMapping: Ce,
311
315
  toneMappingExposure: 3,
312
316
  shadowMap: {
313
317
  enabled: !0,
314
- type: tt
318
+ type: rt
315
319
  }
320
+ },
321
+ flat: {
322
+ toneMapping: nt,
323
+ toneMappingExposure: 1
316
324
  }
317
325
  };
318
- function lr({
319
- scene: e,
320
- canvas: r,
321
- options: t,
322
- disableRender: n,
323
- contextParts: { sizes: s, camera: a }
326
+ function cr({
327
+ scene: t,
328
+ canvas: e,
329
+ options: r,
330
+ disableRender: s,
331
+ emit: o,
332
+ contextParts: { sizes: i, camera: n, render: a, invalidate: l, advance: f }
324
333
  }) {
325
- const o = P(() => ({
326
- alpha: M(t.alpha),
327
- depth: M(t.depth),
328
- canvas: ht(r),
329
- context: M(t.context),
330
- stencil: M(t.stencil),
331
- antialias: M(t.antialias) === void 0 ? !0 : M(t.antialias),
332
- precision: M(t.precision),
333
- powerPreference: M(t.powerPreference),
334
- premultipliedAlpha: M(t.premultipliedAlpha),
335
- preserveDrawingBuffer: M(t.preserveDrawingBuffer),
336
- logarithmicDepthBuffer: M(t.logarithmicDepthBuffer),
337
- failIfMajorPerformanceCaveat: M(t.failIfMajorPerformanceCaveat)
338
- })), i = D(new Q(o.value));
339
- me(o, () => {
340
- i.value.dispose(), i.value = new Q(o.value);
341
- }), O(() => {
342
- i.value.setSize(s.width.value, s.height.value);
343
- });
344
- const { pixelRatio: l } = yt();
345
- O(() => {
346
- i.value.setPixelRatio(l.value);
334
+ const c = x(() => ({
335
+ alpha: M(r.alpha) ?? !0,
336
+ depth: M(r.depth),
337
+ canvas: wt(e),
338
+ context: M(r.context),
339
+ stencil: M(r.stencil),
340
+ antialias: M(r.antialias) ?? !0,
341
+ precision: M(r.precision),
342
+ powerPreference: M(r.powerPreference),
343
+ premultipliedAlpha: M(r.premultipliedAlpha),
344
+ preserveDrawingBuffer: M(r.preserveDrawingBuffer),
345
+ logarithmicDepthBuffer: M(r.logarithmicDepthBuffer),
346
+ failIfMajorPerformanceCaveat: M(r.failIfMajorPerformanceCaveat)
347
+ })), u = $(new q(c.value));
348
+ function d() {
349
+ r.renderMode === "on-demand" && l();
350
+ }
351
+ I(c, () => {
352
+ u.value.dispose(), u.value = new q(c.value), d();
353
+ }), I([i.width, i.height], () => {
354
+ u.value.setSize(i.width.value, i.height.value), d();
355
+ }, {
356
+ immediate: !0
357
+ }), I(() => r.clearColor, d);
358
+ const { pixelRatio: p } = bt();
359
+ I(p, () => {
360
+ u.value.setPixelRatio(p.value);
347
361
  });
348
- const { logError: c } = T(), d = (() => {
349
- const f = new Q(), h = {
362
+ const { logError: h } = P(), { resume: _, onLoop: y } = ae();
363
+ y(() => {
364
+ n.value && !M(s) && a.frames.value > 0 && (u.value.render(t, n.value), o("render", u.value)), a.priority.value = 0, M(r.renderMode) === "always" ? a.frames.value = 1 : a.frames.value = Math.max(0, a.frames.value - 1);
365
+ }), _();
366
+ const g = (() => {
367
+ const w = new q(), m = {
350
368
  shadowMap: {
351
- enabled: f.shadowMap.enabled,
352
- type: f.shadowMap.type
369
+ enabled: w.shadowMap.enabled,
370
+ type: w.shadowMap.type
353
371
  },
354
- toneMapping: f.toneMapping,
355
- toneMappingExposure: f.toneMappingExposure,
356
- outputColorSpace: f.outputColorSpace
372
+ toneMapping: w.toneMapping,
373
+ toneMappingExposure: w.toneMappingExposure,
374
+ outputColorSpace: w.outputColorSpace
357
375
  };
358
- return f.dispose(), h;
359
- })();
360
- O(() => {
361
- const f = M(t.preset);
362
- f && (f in z || c(`Renderer Preset must be one of these: ${Object.keys(z).join(", ")}`), Ee(i.value, z[f]));
363
- const h = (C, S) => {
364
- const b = M(C), x = () => {
365
- if (f)
366
- return ce(z[f], S);
376
+ return w.dispose(), m;
377
+ })(), E = M(r.renderMode);
378
+ return E === "on-demand" && l(), E === "manual" && setTimeout(() => {
379
+ f();
380
+ }, 1), se(() => {
381
+ const w = M(r.preset);
382
+ w && (w in W || h(`Renderer Preset must be one of these: ${Object.keys(W).join(", ")}`), Te(u.value, W[w])), E === "always" && (a.frames.value = Math.max(1, a.frames.value));
383
+ const m = (L, A) => {
384
+ const O = M(L), Q = () => {
385
+ if (w)
386
+ return ge(W[w], A);
367
387
  };
368
- if (b !== void 0)
369
- return b;
370
- const g = x();
371
- return g !== void 0 ? g : ce(d, S);
372
- }, _ = (C, S) => rr(i.value, S, h(C, S));
373
- _(t.shadows, "shadowMap.enabled"), _(t.toneMapping, "toneMapping"), _(t.shadowMapType, "shadowMap.type"), ar < 150 && _(!t.useLegacyLights, "physicallyCorrectLights"), _(t.outputColorSpace, "outputColorSpace"), _(t.toneMappingExposure, "toneMappingExposure");
374
- const w = h(t.clearColor, "clearColor");
375
- w && i.value.setClearColor(
376
- w ? qt(w) : new V(0)
388
+ if (O !== void 0)
389
+ return O;
390
+ const N = Q();
391
+ return N !== void 0 ? N : ge(g, A);
392
+ }, v = (L, A) => or(u.value, A, m(L, A));
393
+ v(r.shadows, "shadowMap.enabled"), v(r.toneMapping ?? Ce, "toneMapping"), v(r.shadowMapType, "shadowMap.type"), ur < 150 && v(!r.useLegacyLights, "physicallyCorrectLights"), v(r.outputColorSpace, "outputColorSpace"), v(r.toneMappingExposure, "toneMappingExposure");
394
+ const C = m(r.clearColor, "clearColor");
395
+ C && u.value.setClearColor(
396
+ C ? Xt(C) : new G(0)
377
397
  // default clear color is not easily/efficiently retrievable from three
378
398
  );
379
- });
380
- const { pause: u, resume: m, onLoop: y } = te();
381
- return y(() => {
382
- a.value && !M(n) && i.value.render(e, a.value);
383
- }), m(), F(() => {
384
- u(), i.value.dispose(), i.value.forceContextLoss();
399
+ }), J(() => {
400
+ u.value.dispose(), u.value.forceContextLoss();
385
401
  }), {
386
- renderer: i
402
+ renderer: u
387
403
  };
388
404
  }
389
- const de = (e) => typeof e == "function", ur = (e) => !!e && e.constructor === Array;
390
- function cr(e) {
391
- const r = { nodes: {}, materials: {} };
392
- return e && e.traverse((t) => {
393
- t.name && (r.nodes[t.name] = t), t.material && !r.materials[t.material.name] && (r.materials[t.material.name] = t.material);
394
- }), r;
405
+ const K = (t) => typeof t == "function", dr = (t) => !!t && t.constructor === Array;
406
+ function fr(t) {
407
+ const e = { nodes: {}, materials: {} };
408
+ return t && t.traverse((r) => {
409
+ r.name && (e.nodes[r.name] = r), r.material && !e.materials[r.material.name] && (e.materials[r.material.name] = r.material);
410
+ }), e;
395
411
  }
396
- async function Ur(e, r, t, n, s) {
397
- const { logError: a } = T(), o = new e();
398
- s && s(o), t && t(o);
399
- const l = (Array.isArray(r) ? r : [r]).map(
400
- (c) => new Promise((p, d) => {
401
- o.load(
402
- c,
403
- (u) => {
404
- u.scene && Object.assign(u, cr(u.scene)), p(u);
412
+ async function Gr(t, e, r, s, o) {
413
+ const { logError: i } = P(), n = new t();
414
+ o && o(n), r && r(n);
415
+ const l = (Array.isArray(e) ? e : [e]).map(
416
+ (f) => new Promise((c, u) => {
417
+ n.load(
418
+ f,
419
+ (d) => {
420
+ d.scene && Object.assign(d, fr(d.scene)), c(d);
405
421
  },
406
- n,
407
- (u) => d(a("[useLoader] - Failed to load resource", u))
422
+ s,
423
+ (d) => u(i("[useLoader] - Failed to load resource", d))
408
424
  );
409
425
  })
410
426
  );
411
- return ur(r) ? await Promise.all(l) : await l[0];
427
+ return dr(e) ? await Promise.all(l) : await l[0];
412
428
  }
413
- async function Fr(e) {
414
- const r = new rt(), t = new nt(r), n = (s) => new Promise((a, o) => {
415
- t.load(
416
- s,
417
- (i) => a(i),
429
+ async function zr(t) {
430
+ const e = new ot(), r = new st(e), s = (o) => new Promise((i, n) => {
431
+ r.load(
432
+ o,
433
+ (a) => i(a),
418
434
  () => null,
419
435
  () => {
420
- o(new Error("[useTextures] - Failed to load texture"));
436
+ n(new Error("[useTextures] - Failed to load texture"));
421
437
  }
422
438
  );
423
439
  });
424
- if (or(e)) {
425
- const s = await Promise.all(e.map((a) => n(a)));
426
- return e.length > 1 ? s : s[0];
440
+ if (ir(t)) {
441
+ const o = await Promise.all(t.map((i) => s(i)));
442
+ return t.length > 1 ? o : o[0];
427
443
  } else {
428
444
  const {
429
- map: s,
430
- displacementMap: a,
431
- normalMap: o,
432
- roughnessMap: i,
445
+ map: o,
446
+ displacementMap: i,
447
+ normalMap: n,
448
+ roughnessMap: a,
433
449
  metalnessMap: l,
434
- aoMap: c,
435
- alphaMap: p,
436
- matcap: d
437
- } = e;
450
+ aoMap: f,
451
+ alphaMap: c,
452
+ matcap: u
453
+ } = t;
438
454
  return {
439
- map: s ? await n(s) : null,
440
- displacementMap: a ? await n(a) : null,
441
- normalMap: o ? await n(o) : null,
442
- roughnessMap: i ? await n(i) : null,
443
- metalnessMap: l ? await n(l) : null,
444
- aoMap: c ? await n(c) : null,
445
- alphaMap: p ? await n(p) : null,
446
- matcap: d ? await n(d) : null
455
+ map: o ? await s(o) : null,
456
+ displacementMap: i ? await s(i) : null,
457
+ normalMap: n ? await s(n) : null,
458
+ roughnessMap: a ? await s(a) : null,
459
+ metalnessMap: l ? await s(l) : null,
460
+ aoMap: f ? await s(f) : null,
461
+ alphaMap: c ? await s(c) : null,
462
+ matcap: u ? await s(u) : null
447
463
  };
448
464
  }
449
465
  }
450
- const dr = (e, { renderer: r, camera: t, raycaster: n }) => {
451
- const s = P(() => r.value.domElement), { x: a, y: o } = wt({ target: s }), { width: i, height: l, top: c, left: p } = bt(s), d = ({ x: g, y: E }) => {
452
- if (s.value)
466
+ const pr = (t, e) => {
467
+ const r = x(() => e.renderer.value.domElement), { x: s, y: o } = Mt({ target: r }), { width: i, height: n, top: a, left: l } = _t(r), f = ({ x: m, y: v }) => {
468
+ if (r.value)
453
469
  return {
454
- x: (g - p.value) / i.value * 2 - 1,
455
- y: -((E - c.value) / l.value) * 2 + 1
470
+ x: (m - l.value) / i.value * 2 - 1,
471
+ y: -((v - a.value) / n.value) * 2 + 1
456
472
  };
457
- }, u = ({ x: g, y: E }) => {
458
- if (t.value)
459
- return n.value.setFromCamera(new ot(g, E), t.value), n.value.intersectObjects(e.value, !1);
460
- }, m = (g) => {
461
- const E = d({
462
- x: (g == null ? void 0 : g.clientX) ?? a.value,
463
- y: (g == null ? void 0 : g.clientY) ?? o.value
473
+ }, c = ({ x: m, y: v }) => {
474
+ if (e.camera.value)
475
+ return e.raycaster.value.setFromCamera(new it(m, v), e.camera.value), e.raycaster.value.intersectObjects(t.value, !1);
476
+ }, u = (m) => {
477
+ const v = f({
478
+ x: (m == null ? void 0 : m.clientX) ?? s.value,
479
+ y: (m == null ? void 0 : m.clientY) ?? o.value
464
480
  });
465
- return E ? u(E) || [] : [];
466
- }, y = P(() => m()), f = H(), h = H(), _ = (g, E) => {
467
- g.trigger({ event: E, intersects: m(E) });
468
- }, w = (g) => {
469
- _(h, g);
481
+ return v ? c(v) || [] : [];
482
+ }, d = x(() => u()), p = H(), h = H(), _ = (m, v) => {
483
+ m.trigger({ event: v, intersects: u(v) });
484
+ }, y = (m) => {
485
+ _(h, m);
470
486
  };
471
- let C;
472
- const S = (g) => {
473
- var E;
474
- C = (E = m(g)[0]) == null ? void 0 : E.object;
475
- }, b = (g) => {
476
- var E;
477
- g instanceof PointerEvent && C === ((E = m(g)[0]) == null ? void 0 : E.object) && _(f, g);
478
- }, x = (g) => h.trigger({ event: g, intersects: [] });
479
- return s.value.addEventListener("pointerup", b), s.value.addEventListener("pointerdown", S), s.value.addEventListener("pointermove", w), s.value.addEventListener("pointerleave", x), F(() => {
480
- s != null && s.value && (s.value.removeEventListener("pointerup", b), s.value.removeEventListener("pointerdown", S), s.value.removeEventListener("pointermove", w), s.value.removeEventListener("pointerleave", x));
487
+ let b;
488
+ const g = (m) => {
489
+ var v;
490
+ b = (v = u(m)[0]) == null ? void 0 : v.object;
491
+ }, E = (m) => {
492
+ var v;
493
+ m instanceof PointerEvent && b === ((v = u(m)[0]) == null ? void 0 : v.object) && _(p, m);
494
+ }, w = (m) => h.trigger({ event: m, intersects: [] });
495
+ return r.value.addEventListener("pointerup", E), r.value.addEventListener("pointerdown", g), r.value.addEventListener("pointermove", y), r.value.addEventListener("pointerleave", w), J(() => {
496
+ r != null && r.value && (r.value.removeEventListener("pointerup", E), r.value.removeEventListener("pointerdown", g), r.value.removeEventListener("pointermove", y), r.value.removeEventListener("pointerleave", w));
481
497
  }), {
482
- intersects: y,
483
- onClick: (g) => f.on(g).off,
484
- onPointerMove: (g) => h.on(g).off
498
+ intersects: d,
499
+ onClick: (m) => p.on(m).off,
500
+ onPointerMove: (m) => h.on(m).off
485
501
  };
486
502
  };
487
- function Gr() {
488
- const { logWarning: e } = T();
489
- function r(a, o, i) {
503
+ function Vr() {
504
+ const { logWarning: t } = P();
505
+ function e(i, n, a) {
490
506
  let l = null;
491
- return a.traverse((c) => {
492
- c[o] === i && (l = c);
493
- }), l || e(`Child with ${o} '${i}' not found.`), l;
507
+ return i.traverse((f) => {
508
+ f[n] === a && (l = f);
509
+ }), l || t(`Child with ${n} '${a}' not found.`), l;
494
510
  }
495
- function t(a, o, i) {
511
+ function r(i, n, a) {
496
512
  const l = [];
497
- return a.traverse((c) => {
498
- c[o].includes(i) && l.push(c);
499
- }), l.length || e(`Children with ${o} '${i}' not found.`), l;
513
+ return i.traverse((f) => {
514
+ f[n].includes(a) && l.push(f);
515
+ }), l.length || t(`Children with ${n} '${a}' not found.`), l;
500
516
  }
501
- function n(a, o) {
502
- return r(a, "name", o);
517
+ function s(i, n) {
518
+ return e(i, "name", n);
503
519
  }
504
- function s(a, o) {
505
- return t(a, "name", o);
520
+ function o(i, n) {
521
+ return r(i, "name", n);
506
522
  }
507
523
  return {
508
- seek: r,
509
- seekByName: n,
510
- seekAll: t,
511
- seekAllByName: s
524
+ seek: e,
525
+ seekByName: s,
526
+ seekAll: r,
527
+ seekAllByName: o
512
528
  };
513
529
  }
514
- const fr = ({ scene: e, contextParts: r }) => {
515
- const t = ge({
530
+ const mr = (t) => {
531
+ const e = be({
516
532
  click: /* @__PURE__ */ new Map(),
517
533
  pointerMove: /* @__PURE__ */ new Map(),
518
534
  pointerEnter: /* @__PURE__ */ new Map(),
519
535
  pointerLeave: /* @__PURE__ */ new Map()
520
- }), n = R(/* @__PURE__ */ new Set()), s = (u) => {
521
- n.value.add(u);
522
- }, a = (u) => {
523
- n.value.delete(u);
536
+ }), r = T(/* @__PURE__ */ new Set()), s = (u) => {
537
+ r.value.add(u);
524
538
  }, o = (u) => {
525
- Object.values(t).forEach((m) => m.delete(u)), a(u);
539
+ r.value.delete(u);
526
540
  }, i = (u) => {
527
- const { onClick: m, onPointerMove: y, onPointerEnter: f, onPointerLeave: h } = u;
528
- m && t.click.set(u, m), y && t.pointerMove.set(u, y), f && t.pointerEnter.set(u, f), h && t.pointerLeave.set(u, h);
529
- };
530
- e.userData.tres__registerAtPointerEventHandler = i, e.userData.tres__deregisterAtPointerEventHandler = o, e.userData.tres__registerBlockingObjectAtPointerEventHandler = s, e.userData.tres__deregisterBlockingObjectAtPointerEventHandler = a;
531
- const l = P(
532
- () => tr(
541
+ Object.values(e).forEach((d) => d.delete(u)), o(u);
542
+ }, n = (u) => {
543
+ const { onClick: d, onPointerMove: p, onPointerEnter: h, onPointerLeave: _ } = u;
544
+ d && e.click.set(u, d), p && e.pointerMove.set(u, p), h && e.pointerEnter.set(u, h), _ && e.pointerLeave.set(u, _);
545
+ }, a = x(
546
+ () => nr(
533
547
  [
534
- ...Array.from(n.value),
535
- ...Object.values(t).map((u) => Array.from(u.keys())).flat()
548
+ ...Array.from(r.value),
549
+ ...Object.values(e).map((u) => Array.from(u.keys())).flat()
536
550
  ],
537
551
  ({ uuid: u }) => u
538
552
  )
539
- ), { onClick: c, onPointerMove: p } = dr(l, r);
540
- c(({ intersects: u, event: m }) => {
541
- var y;
542
- u.length && ((y = t.click.get(u[0].object)) == null || y(u[0], m));
553
+ );
554
+ t.registerObjectAtPointerEventHandler = n, t.deregisterObjectAtPointerEventHandler = i, t.registerBlockingObjectAtPointerEventHandler = s, t.deregisterBlockingObjectAtPointerEventHandler = o;
555
+ const { onClick: l, onPointerMove: f } = pr(a, t);
556
+ l(({ intersects: u, event: d }) => {
557
+ var p;
558
+ u.length && ((p = e.click.get(u[0].object)) == null || p(u[0], d));
543
559
  });
544
- let d;
545
- return p(({ intersects: u, event: m }) => {
546
- var w, C, S, b;
547
- const y = (w = u == null ? void 0 : u[0]) == null ? void 0 : w.object, { pointerLeave: f, pointerEnter: h, pointerMove: _ } = t;
548
- d && d !== y && ((C = f.get(d)) == null || C(d, m)), y && (d !== y && ((S = h.get(y)) == null || S(u[0], m)), (b = _.get(y)) == null || b(u[0], m)), d = y || null;
560
+ let c;
561
+ return f(({ intersects: u, event: d }) => {
562
+ var b, g, E, w;
563
+ const p = (b = u == null ? void 0 : u[0]) == null ? void 0 : b.object, { pointerLeave: h, pointerEnter: _, pointerMove: y } = e;
564
+ c && c !== p && ((g = h.get(c)) == null || g(c, d)), p && (c !== p && ((E = _.get(p)) == null || E(u[0], d)), (w = y.get(p)) == null || w(u[0], d)), c = p || null;
549
565
  }), {
550
- registerObject: i,
551
- deregisterObject: o
566
+ registerObject: n,
567
+ deregisterObject: i,
568
+ registerBlockingObject: s,
569
+ deregisterBlockingObject: o
552
570
  };
553
571
  };
554
- function Se(e) {
555
- let r = 0;
556
- return e.traverse((t) => {
557
- if (t.isMesh && t.geometry) {
558
- const n = t.geometry, s = n.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, a = n.index ? n.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, o = n.attributes.normal ? n.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, i = n.attributes.uv ? n.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, l = s + a + o + i;
559
- r += l;
572
+ function Le(t) {
573
+ let e = 0;
574
+ return t.traverse((r) => {
575
+ if (r.isMesh && r.geometry) {
576
+ const s = r.geometry, o = s.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, i = s.index ? s.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, n = s.attributes.normal ? s.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, a = s.attributes.uv ? s.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, l = o + i + n + a;
577
+ e += l;
560
578
  }
561
- }), r;
579
+ }), e;
562
580
  }
563
- function pr(e) {
564
- return (e / 1024).toFixed(2);
581
+ function vr(t) {
582
+ return (t / 1024).toFixed(2);
565
583
  }
566
- const X = R({}), re = (e) => Object.assign(X.value, e);
567
- function mr({
568
- scene: e,
569
- canvas: r,
570
- windowSize: t,
571
- disableRender: n,
572
- rendererOptions: s
584
+ const re = T({}), ne = (t) => Object.assign(re.value, t);
585
+ function gr(t, e, r = 10) {
586
+ const s = M(t) ? Et() : Ct(x(() => M(e).parentElement)), o = Z(pe(s.width, r)), i = Z(pe(s.height, r)), n = x(() => o.value / i.value);
587
+ return {
588
+ height: i,
589
+ width: o,
590
+ aspectRatio: n
591
+ };
592
+ }
593
+ function hr({
594
+ scene: t,
595
+ canvas: e,
596
+ windowSize: r,
597
+ disableRender: s,
598
+ rendererOptions: o,
599
+ emit: i
573
600
  }) {
574
- const a = P(
575
- () => M(t) ? _t() : Et(M(r).parentElement)
576
- ), o = D({
577
- width: 0,
578
- height: 0
579
- }), i = Mt(o, 10), l = O(() => {
580
- o.value = {
581
- width: a.value.width.value,
582
- height: a.value.height.value
583
- };
584
- }), c = P(() => i.value.width / i.value.height), p = {
585
- height: P(() => i.value.height),
586
- width: P(() => i.value.width),
587
- aspectRatio: c
588
- }, d = D(e), {
589
- camera: u,
590
- cameras: m,
591
- registerCamera: y,
592
- deregisterCamera: f,
593
- setCameraActive: h
594
- } = Gt({ sizes: p, scene: e }), { renderer: _ } = lr(
601
+ const { logWarning: n } = P(), a = $(t), l = gr(r, e), {
602
+ camera: f,
603
+ cameras: c,
604
+ registerCamera: u,
605
+ deregisterCamera: d,
606
+ setCameraActive: p
607
+ } = Jt({ sizes: l, scene: t }), h = {
608
+ mode: T(o.renderMode || "always"),
609
+ priority: T(0),
610
+ frames: T(0),
611
+ maxFrames: 60,
612
+ canBeInvalidated: x(() => h.mode.value === "on-demand" && h.frames.value === 0)
613
+ };
614
+ function _(B = 1) {
615
+ o.renderMode === "on-demand" ? h.frames.value = Math.min(h.maxFrames, h.frames.value + B) : n("`invalidate` can only be used when `renderMode` is set to `on-demand`");
616
+ }
617
+ function y() {
618
+ o.renderMode === "manual" ? h.frames.value = 1 : n("`advance` can only be used when `renderMode` is set to `manual`");
619
+ }
620
+ const { renderer: b } = cr(
595
621
  {
596
- scene: e,
597
- canvas: r,
598
- options: s,
599
- contextParts: { sizes: p, camera: u },
600
- disableRender: n
622
+ scene: t,
623
+ canvas: e,
624
+ options: o,
625
+ emit: i,
626
+ // TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
627
+ contextParts: { sizes: l, camera: f, render: h, invalidate: _, advance: y },
628
+ disableRender: s
601
629
  }
602
- ), w = {
603
- sizes: p,
604
- scene: d,
605
- camera: u,
606
- cameras: Re(m),
607
- renderer: _,
608
- raycaster: D(new st()),
609
- controls: R(null),
630
+ ), g = {
631
+ sizes: l,
632
+ scene: a,
633
+ camera: f,
634
+ cameras: Z(c),
635
+ renderer: b,
636
+ raycaster: $(new at()),
637
+ controls: T(null),
610
638
  perf: {
611
639
  maxFrames: 160,
612
640
  fps: {
@@ -619,432 +647,454 @@ function mr({
619
647
  accumulator: []
620
648
  }
621
649
  },
622
- extend: re,
623
- registerCamera: y,
624
- setCameraActive: h,
625
- deregisterCamera: f
650
+ render: h,
651
+ advance: y,
652
+ extend: ne,
653
+ invalidate: _,
654
+ registerCamera: u,
655
+ setCameraActive: p,
656
+ deregisterCamera: d
626
657
  };
627
- q("useTres", w);
628
- const C = 100, S = Ct({ every: C }), { isSupported: b, memory: x } = St({ interval: C }), g = 160;
629
- let E = performance.now();
630
- const Te = ({ timestamp: $ }) => {
631
- w.scene.value && (w.perf.memory.allocatedMem = Se(w.scene.value)), $ - E >= C && (E = $, w.perf.fps.accumulator.push(S.value), w.perf.fps.accumulator.length > g && w.perf.fps.accumulator.shift(), w.perf.fps.value = S.value, b.value && x.value && (w.perf.memory.accumulator.push(x.value.usedJSHeapSize / 1024 / 1024), w.perf.memory.accumulator.length > g && w.perf.memory.accumulator.shift(), w.perf.memory.currentMem = w.perf.memory.accumulator.reduce((De, Be) => De + Be, 0) / w.perf.memory.accumulator.length));
658
+ ee("useTres", g), g.scene.value.__tres = {
659
+ root: g
632
660
  };
633
- let G = 0;
634
- const Le = 1, { pause: Oe, resume: Rr } = we(({ delta: $ }) => {
635
- window.__TRES__DEVTOOLS__ && (Te({ timestamp: performance.now() }), G += $, G >= Le && (window.__TRES__DEVTOOLS__.cb(w), G = 0));
661
+ const E = 100, w = St({ every: E }), { isSupported: m, memory: v } = xt({ interval: E }), C = 160;
662
+ let L = performance.now();
663
+ const A = ({ timestamp: B }) => {
664
+ g.scene.value && (g.perf.memory.allocatedMem = Le(g.scene.value)), B - L >= E && (L = B, g.perf.fps.accumulator.push(w.value), g.perf.fps.accumulator.length > C && g.perf.fps.accumulator.shift(), g.perf.fps.value = w.value, m.value && v.value && (g.perf.memory.accumulator.push(v.value.usedJSHeapSize / 1024 / 1024), g.perf.memory.accumulator.length > C && g.perf.memory.accumulator.shift(), g.perf.memory.currentMem = g.perf.memory.accumulator.reduce((Re, $e) => Re + $e, 0) / g.perf.memory.accumulator.length));
665
+ };
666
+ let O = 0;
667
+ const Q = 1, { pause: N } = Se(({ delta: B }) => {
668
+ window.__TRES__DEVTOOLS__ && (A({ timestamp: performance.now() }), O += B, O >= Q && (window.__TRES__DEVTOOLS__.cb(g), O = 0));
636
669
  }, { immediate: !0 });
637
- return F(() => {
638
- l(), Oe();
639
- }), w;
670
+ return J(() => {
671
+ N();
672
+ }), g;
640
673
  }
641
- function gr() {
642
- const e = $e("useTres");
643
- if (!e)
674
+ function yr() {
675
+ const t = Fe("useTres");
676
+ if (!t)
644
677
  throw new Error("useTresContext must be used together with useTresContextProvider");
645
- return e;
678
+ return t;
646
679
  }
647
- const Jr = gr;
648
- let v = null;
649
- const { logError: fe } = T(), Y = [
680
+ const Jr = yr;
681
+ const { logError: he } = P(), X = [
650
682
  "onClick",
651
683
  "onPointerMove",
652
684
  "onPointerEnter",
653
685
  "onPointerLeave"
654
- ], vr = {
655
- createElement(e, r, t, n) {
656
- var o, i;
657
- if (n || (n = {}), n.args || (n.args = []), e === "template" || Zt(e))
658
- return null;
659
- let s = e.replace("Tres", ""), a;
660
- if (e === "primitive") {
661
- (n == null ? void 0 : n.object) === void 0 && fe("Tres primitives need a prop 'object'");
662
- const l = n.object;
663
- s = l.type, a = Object.assign(l, { type: s, attach: n.attach, primitive: !0 });
664
- } else {
665
- const l = X.value[s];
666
- l || fe(`${s} is not defined on the THREE namespace. Use extend to add it to the catalog.`), a = new l(...n.args);
667
- }
668
- return a.isCamera && (n != null && n.position || a.position.set(3, 3, 3), n != null && n.lookAt || a.lookAt(0, 0, 0)), (n == null ? void 0 : n.attach) === void 0 && (a.isMaterial ? a.attach = "material" : a.isBufferGeometry && (a.attach = "geometry")), a.isObject3D && ((o = n == null ? void 0 : n.material) != null && o.isMaterial && (a.userData.tres__materialViaProp = !0), (i = n == null ? void 0 : n.geometry) != null && i.isBufferGeometry && (a.userData.tres__geometryViaProp = !0)), a.userData = {
669
- ...a.userData,
670
- tres__name: s
671
- }, a;
672
- },
673
- insert(e, r) {
674
- var n, s, a, o;
675
- r && r.isScene && (v = r);
676
- const t = r || v;
677
- if (e != null && e.isObject3D) {
678
- if (e != null && e.isCamera) {
679
- if (!(v != null && v.userData.tres__registerCamera))
680
- throw "could not find tres__registerCamera on scene's userData";
681
- (s = v == null ? void 0 : (n = v.userData).tres__registerCamera) == null || s.call(n, e);
686
+ ];
687
+ function ye(t) {
688
+ const e = t.__tres.root;
689
+ e && e.render && e.render.canBeInvalidated.value && e.invalidate();
690
+ }
691
+ const Oe = () => {
692
+ let t = null;
693
+ return {
694
+ createElement(e, r, s, o) {
695
+ if (o || (o = {}), o.args || (o.args = []), e === "template" || tr(e))
696
+ return null;
697
+ let i = e.replace("Tres", ""), n;
698
+ if (e === "primitive") {
699
+ (o == null ? void 0 : o.object) === void 0 && he("Tres primitives need a prop 'object'");
700
+ const a = o.object;
701
+ i = a.type, n = Object.assign(a.clone(), { type: i });
702
+ } else {
703
+ const a = re.value[i];
704
+ a || he(`${i} is not defined on the THREE namespace. Use extend to add it to the catalog.`), n = new a(...o.args);
682
705
  }
683
- if (e && Y.some((i) => e[i])) {
684
- if (!(v != null && v.userData.tres__registerAtPointerEventHandler))
685
- throw "could not find tres__registerAtPointerEventHandler on scene's userData";
686
- (o = v == null ? void 0 : (a = v.userData).tres__registerAtPointerEventHandler) == null || o.call(a, e);
706
+ return n ? (n.isCamera && (o != null && o.position || n.position.set(3, 3, 3), o != null && o.lookAt || n.lookAt(0, 0, 0)), (o == null ? void 0 : o.attach) === void 0 && (n.isMaterial ? n.attach = "material" : n.isBufferGeometry && (n.attach = "geometry")), n.__tres = {
707
+ ...n.__tres,
708
+ type: i,
709
+ memoizedProps: o,
710
+ eventCount: 0,
711
+ disposable: !0,
712
+ primitive: e === "primitive"
713
+ }, n.isObject3D && (o != null && o.material || o != null && o.geometry) && (n.__tres.disposable = !1), n) : null;
714
+ },
715
+ insert(e, r) {
716
+ if (!e)
717
+ return;
718
+ r && r.isScene && (t = r), t && (e.__tres.root = t.__tres.root);
719
+ const s = r || t;
720
+ if (e != null && e.isObject3D) {
721
+ const { registerCamera: o, registerObjectAtPointerEventHandler: i } = e.__tres.root;
722
+ e != null && e.isCamera && o(e), e && X.some((n) => e[n]) && i(e);
687
723
  }
688
- }
689
- 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));
690
- },
691
- remove(e) {
692
- var r, t;
693
- if (e) {
724
+ e != null && e.isObject3D && (s != null && s.isObject3D) ? (s.add(e), e.dispatchEvent({ type: "added" })) : e != null && e.isFog ? s.fog = e : typeof (e == null ? void 0 : e.attach) == "string" && (e.__previousAttach = e[s == null ? void 0 : s.attach], s && (s[e.attach] = e));
725
+ },
726
+ remove(e) {
727
+ var i, n;
728
+ if (!e)
729
+ return;
730
+ const r = e.__tres;
731
+ e.parent = e.parent || t;
732
+ const {
733
+ deregisterObjectAtPointerEventHandler: s,
734
+ deregisterBlockingObjectAtPointerEventHandler: o
735
+ } = r.root;
694
736
  if (e.isObject3D) {
695
- const n = e, s = (c) => {
696
- var d, u;
697
- const p = c;
698
- c.userData.tres__materialViaProp || ((d = p.material) == null || d.dispose(), p.material = void 0), c.userData.tres__geometryViaProp || ((u = p.geometry) == null || u.dispose(), p.geometry = void 0);
699
- }, a = v == null ? void 0 : v.userData.tres__deregisterAtPointerEventHandler, o = v == null ? void 0 : v.userData.tres__deregisterBlockingObjectAtPointerEventHandler, i = (c) => {
700
- var p, d;
701
- if (!o)
702
- throw "could not find tres__deregisterBlockingObjectAtPointerEventHandler on scene's userData";
703
- if ((d = v == null ? void 0 : (p = v.userData).tres__deregisterBlockingObjectAtPointerEventHandler) == null || d.call(p, c), !a)
704
- throw "could not find tres__deregisterAtPointerEventHandler on scene's userData";
705
- c && Y.some((u) => c[u]) && (a == null || a(c));
737
+ const a = (c) => {
738
+ var d, p;
739
+ const u = c;
740
+ r.disposable && ((d = u.material) == null || d.dispose(), u.material = void 0, (p = u.geometry) == null || p.dispose(), u.geometry = void 0);
706
741
  }, l = (c) => {
707
- const p = v == null ? void 0 : v.userData.tres__deregisterCamera;
708
- if (!p)
709
- throw "could not find tres__deregisterCamera on scene's userData";
710
- c.isCamera && (p == null || p(c));
742
+ o(c), c && X.some((u) => c[u]) && (s == null || s(c));
743
+ }, f = (c) => {
744
+ const u = e.__tres.root.deregisterCamera;
745
+ c.isCamera && (u == null || u(c));
711
746
  };
712
- (r = e.removeFromParent) == null || r.call(e), n.traverse((c) => {
713
- s(c), l(c), i == null || i(c);
714
- }), s(n), l(n), i == null || i(n);
715
- }
716
- (t = e.dispose) == null || t.call(e);
717
- }
718
- },
719
- patchProp(e, r, t, n) {
720
- var s, a, o, i;
721
- if (e) {
722
- let l = e, c = r;
723
- if (e.isObject3D && c === "blocks-pointer-events") {
724
- n || n === "" ? (a = v == null ? void 0 : (s = v.userData).tres__registerBlockingObjectAtPointerEventHandler) == null || a.call(s, e) : (i = v == null ? void 0 : (o = v.userData).tres__deregisterBlockingObjectAtPointerEventHandler) == null || i.call(o, e);
725
- return;
747
+ (i = e.removeFromParent) == null || i.call(e), e.traverse((c) => {
748
+ a(c), f(c), l == null || l(c);
749
+ }), a(e), f(e), l == null || l(e), ye(e), (n = e.dispose) == null || n.call(e);
726
750
  }
727
- let p = I(c), d = l == null ? void 0 : l[p];
728
- if (c === "args") {
729
- const m = e, y = t ?? [], f = n ?? [], h = e.userData.tres__name || e.type;
730
- h && y.length && !nr(y, f) && (l = Object.assign(m, new X.value[h](...n)));
731
- return;
732
- }
733
- if (l.type === "BufferGeometry") {
734
- if (c === "args")
751
+ },
752
+ patchProp(e, r, s, o) {
753
+ if (e) {
754
+ let i = e, n = r;
755
+ if (e.__tres.primitive && n === "object" && s !== null) {
756
+ const c = Oe.createElement("primitive", void 0, void 0, {
757
+ object: o
758
+ });
759
+ for (const u in c) {
760
+ if (u === "uuid")
761
+ continue;
762
+ const d = e[u], p = c[u];
763
+ !(d != null && d.set) && !K(d) ? e[u] = p : d.constructor === p.constructor && (d != null && d.copy) ? d == null || d.copy(p) : Array.isArray(p) ? d.set(...p) : !d.isColor && d.setScalar ? d.setScalar(p) : d.set(p);
764
+ }
765
+ c.__tres.root = t == null ? void 0 : t.__tres.root, c.isGroup ? (e.geometry = void 0, e.material = void 0) : delete e.isGroup;
766
+ }
767
+ if (e.__tres.root) {
768
+ const {
769
+ registerBlockingObjectAtPointerEventHandler: c,
770
+ deregisterBlockingObjectAtPointerEventHandler: u
771
+ } = e.__tres.root;
772
+ if (e.isObject3D && n === "blocks-pointer-events") {
773
+ o || o === "" ? c(e) : u(e);
774
+ return;
775
+ }
776
+ }
777
+ let a = F(n), l = i == null ? void 0 : i[a];
778
+ if (n === "args") {
779
+ const c = e, u = s ?? [], d = o ?? [], p = e.__tres.type || e.type;
780
+ p && u.length && !sr(u, d) && (i = Object.assign(c, new re.value[p](...o)));
735
781
  return;
736
- l.setAttribute(
737
- I(c),
738
- new it(...n)
739
- );
740
- return;
741
- }
742
- if (c.includes("-") && d === void 0) {
743
- const m = c.split("-");
744
- d = m.reduce((y, f) => y[I(f)], l), c = m.pop(), p = c.toLowerCase(), d != null && d.set || (l = m.reduce((y, f) => y[I(f)], l));
745
- }
746
- let u = n;
747
- if (u === "" && (u = !0), de(d)) {
748
- Y.includes(r) || (Array.isArray(u) ? e[p](...u) : e[p](u));
749
- return;
782
+ }
783
+ if (i.type === "BufferGeometry") {
784
+ if (n === "args")
785
+ return;
786
+ i.setAttribute(
787
+ F(n),
788
+ new lt(...o)
789
+ );
790
+ return;
791
+ }
792
+ if (n.includes("-") && l === void 0) {
793
+ const c = n.split("-");
794
+ l = c.reduce((u, d) => u[F(d)], i), n = c.pop(), a = n.toLowerCase(), l != null && l.set || (i = c.reduce((u, d) => u[F(d)], i));
795
+ }
796
+ let f = o;
797
+ if (f === "" && (f = !0), K(l)) {
798
+ X.includes(r) || (Array.isArray(f) ? e[a](...f) : e[a](f));
799
+ return;
800
+ }
801
+ !(l != null && l.set) && !K(l) ? i[a] = f : l.constructor === f.constructor && (l != null && l.copy) ? l == null || l.copy(f) : Array.isArray(f) ? l.set(...f) : !l.isColor && l.setScalar ? l.setScalar(f) : l.set(f), ye(e);
750
802
  }
751
- !(d != null && d.set) && !de(d) ? l[p] = u : d.constructor === u.constructor && (d != null && d.copy) ? d == null || d.copy(u) : Array.isArray(u) ? d.set(...u) : !d.isColor && d.setScalar ? d.setScalar(u) : d.set(u);
752
- }
753
- },
754
- parentNode(e) {
755
- return (e == null ? void 0 : e.parent) || null;
756
- },
757
- createText: () => void 0,
758
- createComment: () => void 0,
759
- setText: () => void 0,
760
- setElementText: () => void 0,
761
- nextSibling: () => void 0,
762
- querySelector: () => void 0,
763
- setScopeId: () => void 0,
764
- cloneNode: () => void 0,
765
- insertStaticContent: () => void 0
766
- }, { render: hr } = Ie(vr);
767
- re(ve);
768
- function yr() {
769
- return xe().__VUE_DEVTOOLS_GLOBAL_HOOK__;
803
+ },
804
+ parentNode(e) {
805
+ return (e == null ? void 0 : e.parent) || null;
806
+ },
807
+ createText: () => void 0,
808
+ createComment: () => void 0,
809
+ setText: () => void 0,
810
+ setElementText: () => void 0,
811
+ nextSibling: () => void 0,
812
+ querySelector: () => void 0,
813
+ setScopeId: () => void 0,
814
+ cloneNode: () => void 0,
815
+ insertStaticContent: () => void 0
816
+ };
817
+ };
818
+ function wr() {
819
+ return Be().__VUE_DEVTOOLS_GLOBAL_HOOK__;
770
820
  }
771
- function xe() {
821
+ function Be() {
772
822
  return typeof navigator < "u" && typeof window < "u" ? window : typeof global < "u" ? global : {};
773
823
  }
774
- const wr = typeof Proxy == "function", br = "devtools-plugin:setup", _r = "plugin:settings:set";
775
- let L, Z;
824
+ const br = typeof Proxy == "function", Mr = "devtools-plugin:setup", _r = "plugin:settings:set";
825
+ let j, oe;
776
826
  function Er() {
777
- var e;
778
- return L !== void 0 || (typeof window < "u" && window.performance ? (L = !0, Z = window.performance) : typeof global < "u" && (!((e = global.perf_hooks) === null || e === void 0) && e.performance) ? (L = !0, Z = global.perf_hooks.performance) : L = !1), L;
827
+ var t;
828
+ return j !== void 0 || (typeof window < "u" && window.performance ? (j = !0, oe = window.performance) : typeof global < "u" && (!((t = global.perf_hooks) === null || t === void 0) && t.performance) ? (j = !0, oe = global.perf_hooks.performance) : j = !1), j;
779
829
  }
780
- function Mr() {
781
- return Er() ? Z.now() : Date.now();
830
+ function Cr() {
831
+ return Er() ? oe.now() : Date.now();
782
832
  }
783
- class Cr {
784
- constructor(r, t) {
785
- this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = r, this.hook = t;
786
- const n = {};
787
- if (r.settings)
788
- for (const o in r.settings) {
789
- const i = r.settings[o];
790
- n[o] = i.defaultValue;
833
+ class Sr {
834
+ constructor(e, r) {
835
+ this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = e, this.hook = r;
836
+ const s = {};
837
+ if (e.settings)
838
+ for (const n in e.settings) {
839
+ const a = e.settings[n];
840
+ s[n] = a.defaultValue;
791
841
  }
792
- const s = `__vue-devtools-plugin-settings__${r.id}`;
793
- let a = Object.assign({}, n);
842
+ const o = `__vue-devtools-plugin-settings__${e.id}`;
843
+ let i = Object.assign({}, s);
794
844
  try {
795
- const o = localStorage.getItem(s), i = JSON.parse(o);
796
- Object.assign(a, i);
845
+ const n = localStorage.getItem(o), a = JSON.parse(n);
846
+ Object.assign(i, a);
797
847
  } catch {
798
848
  }
799
849
  this.fallbacks = {
800
850
  getSettings() {
801
- return a;
851
+ return i;
802
852
  },
803
- setSettings(o) {
853
+ setSettings(n) {
804
854
  try {
805
- localStorage.setItem(s, JSON.stringify(o));
855
+ localStorage.setItem(o, JSON.stringify(n));
806
856
  } catch {
807
857
  }
808
- a = o;
858
+ i = n;
809
859
  },
810
860
  now() {
811
- return Mr();
861
+ return Cr();
812
862
  }
813
- }, t && t.on(_r, (o, i) => {
814
- o === this.plugin.id && this.fallbacks.setSettings(i);
863
+ }, r && r.on(_r, (n, a) => {
864
+ n === this.plugin.id && this.fallbacks.setSettings(a);
815
865
  }), this.proxiedOn = new Proxy({}, {
816
- get: (o, i) => this.target ? this.target.on[i] : (...l) => {
866
+ get: (n, a) => this.target ? this.target.on[a] : (...l) => {
817
867
  this.onQueue.push({
818
- method: i,
868
+ method: a,
819
869
  args: l
820
870
  });
821
871
  }
822
872
  }), this.proxiedTarget = new Proxy({}, {
823
- get: (o, i) => this.target ? this.target[i] : i === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(i) ? (...l) => (this.targetQueue.push({
824
- method: i,
873
+ get: (n, a) => this.target ? this.target[a] : a === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(a) ? (...l) => (this.targetQueue.push({
874
+ method: a,
825
875
  args: l,
826
876
  resolve: () => {
827
877
  }
828
- }), this.fallbacks[i](...l)) : (...l) => new Promise((c) => {
878
+ }), this.fallbacks[a](...l)) : (...l) => new Promise((f) => {
829
879
  this.targetQueue.push({
830
- method: i,
880
+ method: a,
831
881
  args: l,
832
- resolve: c
882
+ resolve: f
833
883
  });
834
884
  })
835
885
  });
836
886
  }
837
- async setRealTarget(r) {
838
- this.target = r;
839
- for (const t of this.onQueue)
840
- this.target.on[t.method](...t.args);
841
- for (const t of this.targetQueue)
842
- t.resolve(await this.target[t.method](...t.args));
887
+ async setRealTarget(e) {
888
+ this.target = e;
889
+ for (const r of this.onQueue)
890
+ this.target.on[r.method](...r.args);
891
+ for (const r of this.targetQueue)
892
+ r.resolve(await this.target[r.method](...r.args));
843
893
  }
844
894
  }
845
- function Sr(e, r) {
846
- const t = e, n = xe(), s = yr(), a = wr && t.enableEarlyProxy;
847
- if (s && (n.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !a))
848
- s.emit(br, e, r);
895
+ function xr(t, e) {
896
+ const r = t, s = Be(), o = wr(), i = br && r.enableEarlyProxy;
897
+ if (o && (s.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !i))
898
+ o.emit(Mr, t, e);
849
899
  else {
850
- const o = a ? new Cr(t, s) : null;
851
- (n.__VUE_DEVTOOLS_PLUGINS__ = n.__VUE_DEVTOOLS_PLUGINS__ || []).push({
852
- pluginDescriptor: t,
853
- setupFn: r,
854
- proxy: o
855
- }), o && r(o.proxiedTarget);
900
+ const n = i ? new Sr(r, o) : null;
901
+ (s.__VUE_DEVTOOLS_PLUGINS__ = s.__VUE_DEVTOOLS_PLUGINS__ || []).push({
902
+ pluginDescriptor: r,
903
+ setupFn: e,
904
+ proxy: n
905
+ }), n && e(n.proxiedTarget);
856
906
  }
857
907
  }
858
- function xr(e, r) {
859
- const t = `▲ ■ ●${e}`;
860
- typeof __VUE_DEVTOOLS_TOAST__ == "function" ? __VUE_DEVTOOLS_TOAST__(t, r) : r === "error" ? console.error(t) : r === "warn" ? console.warn(t) : console.log(t);
908
+ function kr(t, e) {
909
+ const r = `▲ ■ ●${t}`;
910
+ typeof __VUE_DEVTOOLS_TOAST__ == "function" ? __VUE_DEVTOOLS_TOAST__(r, e) : e === "error" ? console.error(r) : e === "warn" ? console.warn(r) : console.log(r);
861
911
  }
862
- const Pe = (e) => {
863
- const r = {
864
- id: e.uuid,
865
- label: e.type,
912
+ const je = (t) => {
913
+ const e = {
914
+ id: t.uuid,
915
+ label: t.type,
866
916
  children: [],
867
917
  tags: []
868
918
  };
869
- e.name !== "" && r.tags.push({
870
- label: e.name,
919
+ t.name !== "" && e.tags.push({
920
+ label: t.name,
871
921
  textColor: 5750629,
872
922
  backgroundColor: 15793395
873
923
  });
874
- const t = Se(e);
875
- return t > 0 && r.tags.push({
876
- label: `${pr(t)} KB`,
924
+ const r = Le(t);
925
+ return r > 0 && e.tags.push({
926
+ label: `${vr(r)} KB`,
877
927
  textColor: 15707189,
878
928
  backgroundColor: 16775644,
879
929
  tooltip: "Memory usage"
880
- }), e.type.includes("Light") && (r.tags.push({
881
- label: `${e.intensity}`,
930
+ }), t.type.includes("Light") && (e.tags.push({
931
+ label: `${t.intensity}`,
882
932
  textColor: 9738662,
883
933
  backgroundColor: 16316922,
884
934
  tooltip: "Intensity"
885
- }), r.tags.push({
886
- label: `#${e.color.getHexString()}`,
935
+ }), e.tags.push({
936
+ label: `#${t.color.getHexString()}`,
887
937
  textColor: 9738662,
888
938
  backgroundColor: 16316922,
889
939
  tooltip: "Color"
890
- })), e.type.includes("Camera") && (r.tags.push({
891
- label: `${e.fov}°`,
940
+ })), t.type.includes("Camera") && (e.tags.push({
941
+ label: `${t.fov}°`,
892
942
  textColor: 9738662,
893
943
  backgroundColor: 16316922,
894
944
  tooltip: "Field of view"
895
- }), r.tags.push({
945
+ }), e.tags.push({
896
946
  // eslint-disable-next-line max-len
897
- label: `x: ${Math.round(e.position.x)} y: ${Math.round(e.position.y)} z: ${Math.round(e.position.z)}`,
947
+ label: `x: ${Math.round(t.position.x)} y: ${Math.round(t.position.y)} z: ${Math.round(t.position.z)}`,
898
948
  textColor: 9738662,
899
949
  backgroundColor: 16316922,
900
950
  tooltip: "Position"
901
- })), r;
951
+ })), e;
902
952
  };
903
- function ke(e, r) {
904
- e.children.forEach((t) => {
905
- if (t.type === "HightlightMesh")
953
+ function De(t, e) {
954
+ t.children.forEach((r) => {
955
+ if (r.type === "HightlightMesh")
906
956
  return;
907
- const n = Pe(t);
908
- r.children.push(n), ke(t, n);
957
+ const s = je(r);
958
+ e.children.push(s), De(r, s);
909
959
  });
910
960
  }
911
- const Pr = [], B = "tres:inspector", kr = ge({
961
+ const Tr = [], D = "tres:inspector", Pr = be({
912
962
  sceneGraph: null
913
963
  });
914
- function Ar(e, r) {
915
- Sr(
964
+ function Ar(t, e) {
965
+ xr(
916
966
  {
917
967
  id: "dev.esm.tres",
918
968
  label: "TresJS 🪐",
919
969
  logo: "https://raw.githubusercontent.com/Tresjs/tres/main/public/favicon.svg",
920
970
  packageName: "tresjs",
921
971
  homepage: "https://tresjs.org",
922
- componentStateTypes: Pr,
923
- app: e
972
+ componentStateTypes: Tr,
973
+ app: t
924
974
  },
925
- (t) => {
926
- typeof t.now != "function" && xr(
975
+ (r) => {
976
+ typeof r.now != "function" && kr(
927
977
  // eslint-disable-next-line max-len
928
978
  "You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html."
929
- ), t.addInspector({
930
- id: B,
979
+ ), r.addInspector({
980
+ id: D,
931
981
  label: "TresJS 🪐",
932
982
  icon: "account_tree",
933
983
  treeFilterPlaceholder: "Search instances"
934
984
  }), setInterval(() => {
935
- t.sendInspectorTree(B);
985
+ r.sendInspectorTree(D);
936
986
  }, 1e3), setInterval(() => {
937
- t.notifyComponentUpdate();
938
- }, 5e3), t.on.getInspectorTree((a) => {
939
- if (a.inspectorId === B) {
940
- const o = Pe(r.scene.value);
941
- ke(r.scene.value, o), kr.sceneGraph = o, a.rootNodes = [o];
987
+ r.notifyComponentUpdate();
988
+ }, 5e3), r.on.getInspectorTree((i) => {
989
+ if (i.inspectorId === D) {
990
+ const n = je(e.scene.value);
991
+ De(e.scene.value, n), Pr.sceneGraph = n, i.rootNodes = [n];
942
992
  }
943
993
  });
944
- let n = null, s = null;
945
- t.on.getInspectorState((a) => {
946
- if (a.inspectorId === B) {
947
- const [o] = r.scene.value.getObjectsByProperty("uuid", a.nodeId);
948
- if (!o)
994
+ let s = null, o = null;
995
+ r.on.getInspectorState((i) => {
996
+ if (i.inspectorId === D) {
997
+ const [n] = e.scene.value.getObjectsByProperty("uuid", i.nodeId);
998
+ if (!n)
949
999
  return;
950
- if (s && n && n.parent && s.remove(n), o.isMesh) {
951
- const i = ir(o);
952
- o.add(i), n = i, s = o;
1000
+ if (o && s && s.parent && o.remove(s), n.isMesh) {
1001
+ const a = lr(n);
1002
+ n.add(a), s = a, o = n;
953
1003
  }
954
- a.state = {
1004
+ i.state = {
955
1005
  object: [
956
1006
  {
957
1007
  key: "uuid",
958
1008
  editable: !0,
959
- value: o.uuid
1009
+ value: n.uuid
960
1010
  },
961
1011
  {
962
1012
  key: "name",
963
1013
  editable: !0,
964
- value: o.name
1014
+ value: n.name
965
1015
  },
966
1016
  {
967
1017
  key: "type",
968
1018
  editable: !0,
969
- value: o.type
1019
+ value: n.type
970
1020
  },
971
1021
  {
972
1022
  key: "position",
973
1023
  editable: !0,
974
- value: o.position
1024
+ value: n.position
975
1025
  },
976
1026
  {
977
1027
  key: "rotation",
978
1028
  editable: !0,
979
- value: o.rotation
1029
+ value: n.rotation
980
1030
  },
981
1031
  {
982
1032
  key: "scale",
983
1033
  editable: !0,
984
- value: o.scale
1034
+ value: n.scale
985
1035
  },
986
1036
  {
987
1037
  key: "geometry",
988
- value: o.geometry
1038
+ value: n.geometry
989
1039
  },
990
1040
  {
991
1041
  key: "material",
992
- value: o.material
1042
+ value: n.material
993
1043
  },
994
1044
  {
995
1045
  key: "color",
996
1046
  editable: !0,
997
- value: o.color
1047
+ value: n.color
998
1048
  },
999
1049
  {
1000
1050
  key: "intensity",
1001
1051
  editable: !0,
1002
- value: o.intensity
1052
+ value: n.intensity
1003
1053
  },
1004
1054
  {
1005
1055
  key: "castShadow",
1006
1056
  editable: !0,
1007
- value: o.castShadow
1057
+ value: n.castShadow
1008
1058
  },
1009
1059
  {
1010
1060
  key: "receiveShadow",
1011
1061
  editable: !0,
1012
- value: o.receiveShadow
1062
+ value: n.receiveShadow
1013
1063
  },
1014
1064
  {
1015
1065
  key: "frustumCulled",
1016
1066
  editable: !0,
1017
- value: o.frustumCulled
1067
+ value: n.frustumCulled
1018
1068
  },
1019
1069
  {
1020
1070
  key: "matrixAutoUpdate",
1021
1071
  editable: !0,
1022
- value: o.matrixAutoUpdate
1072
+ value: n.matrixAutoUpdate
1023
1073
  },
1024
1074
  {
1025
1075
  key: "matrixWorldNeedsUpdate",
1026
1076
  editable: !0,
1027
- value: o.matrixWorldNeedsUpdate
1077
+ value: n.matrixWorldNeedsUpdate
1028
1078
  },
1029
1079
  {
1030
1080
  key: "matrixWorld",
1031
- value: o.matrixWorld
1081
+ value: n.matrixWorld
1032
1082
  },
1033
1083
  {
1034
1084
  key: "visible",
1035
1085
  editable: !0,
1036
- value: o.visible
1086
+ value: n.visible
1037
1087
  }
1038
1088
  ]
1039
1089
  };
1040
1090
  }
1041
- }), t.on.editInspectorState((a) => {
1042
- a.inspectorId === B && sr(r.scene.value, a.nodeId, a.path, a.state.value);
1091
+ }), r.on.editInspectorState((i) => {
1092
+ i.inspectorId === D && ar(e.scene.value, i.nodeId, i.path, i.state.value);
1043
1093
  });
1044
1094
  }
1045
1095
  );
1046
1096
  }
1047
- const Tr = ["data-scene", "data-tres"], Lr = /* @__PURE__ */ ne({
1097
+ const Lr = ["data-scene", "data-tres"], Or = /* @__PURE__ */ le({
1048
1098
  __name: "TresCanvas",
1049
1099
  props: {
1050
1100
  shadows: { type: Boolean, default: void 0 },
@@ -1054,6 +1104,7 @@ const Tr = ["data-scene", "data-tres"], Lr = /* @__PURE__ */ ne({
1054
1104
  useLegacyLights: { type: Boolean, default: void 0 },
1055
1105
  outputColorSpace: {},
1056
1106
  toneMappingExposure: {},
1107
+ renderMode: { default: "always" },
1057
1108
  camera: {},
1058
1109
  preset: {},
1059
1110
  windowSize: { type: Boolean, default: void 0 },
@@ -1070,108 +1121,110 @@ const Tr = ["data-scene", "data-tres"], Lr = /* @__PURE__ */ ne({
1070
1121
  logarithmicDepthBuffer: { type: Boolean, default: void 0 },
1071
1122
  failIfMajorPerformanceCaveat: { type: Boolean, default: void 0 }
1072
1123
  },
1073
- setup(e, { expose: r }) {
1074
- var y;
1075
- const t = e, { logWarning: n } = T(), s = R(), a = D(new at()), { resume: o } = te(), i = ze(), l = (y = oe()) == null ? void 0 : y.appContext.app, c = (f) => ne({
1124
+ emits: ["render"],
1125
+ setup(t, { expose: e, emit: r }) {
1126
+ var _;
1127
+ const s = t, o = r, i = T(), n = $(new ut()), { resume: a } = ae(), l = We(), f = (_ = ue()) == null ? void 0 : _.appContext.app;
1128
+ ne(Me);
1129
+ const c = (y) => le({
1076
1130
  setup() {
1077
- var _;
1078
- const h = (_ = oe()) == null ? void 0 : _.appContext;
1079
- return h && (h.app = l), q("useTres", f), q("extend", re), typeof window < "u" && Ar(h.app, f), () => se(Je, null, i != null && i.default ? i.default() : []);
1131
+ var g;
1132
+ const b = (g = ue()) == null ? void 0 : g.appContext;
1133
+ return b && (b.app = f), ee("useTres", y), ee("extend", ne), typeof window < "u" && Ar(b == null ? void 0 : b.app, y), () => ce(qe, null, l != null && l.default ? l.default() : []);
1080
1134
  }
1081
- }), p = (f) => {
1082
- const h = c(f);
1083
- hr(se(h), a.value);
1084
- }, d = (f, h = !1) => {
1085
- a.value.children = [], h && (f.renderer.value.dispose(), f.renderer.value.renderLists.dispose(), f.renderer.value.forceContextLoss()), p(f), o();
1086
- }, u = P(() => t.disableRender), m = D(null);
1087
- return r({ context: m, dispose: () => d(m.value, !0) }), Ne(() => {
1088
- const f = s;
1089
- m.value = mr({
1090
- scene: a.value,
1091
- canvas: f,
1092
- windowSize: t.windowSize,
1093
- disableRender: u,
1094
- rendererOptions: t
1095
- }), fr({ scene: a.value, contextParts: m.value });
1096
- const { registerCamera: h, camera: _, cameras: w, deregisterCamera: C } = m.value;
1097
- p(m.value);
1098
- const S = () => {
1099
- const b = new K(
1135
+ }), u = (y) => {
1136
+ const b = c(y), { render: g } = Ye(Oe());
1137
+ g(ce(b), n.value);
1138
+ }, d = (y, b = !1) => {
1139
+ n.value.children = [], b && (y.renderer.value.dispose(), y.renderer.value.renderLists.dispose(), y.renderer.value.forceContextLoss()), u(y), a();
1140
+ }, p = x(() => s.disableRender), h = $(null);
1141
+ return e({ context: h, dispose: () => d(h.value, !0) }), Ue(() => {
1142
+ const y = i;
1143
+ h.value = hr({
1144
+ scene: n.value,
1145
+ canvas: y,
1146
+ windowSize: s.windowSize ?? !1,
1147
+ disableRender: p.value ?? !1,
1148
+ rendererOptions: s,
1149
+ emit: o
1150
+ }), mr(h.value);
1151
+ const { registerCamera: b, camera: g, cameras: E, deregisterCamera: w } = h.value;
1152
+ u(h.value);
1153
+ const m = () => {
1154
+ const v = new te(
1100
1155
  45,
1101
1156
  window.innerWidth / window.innerHeight,
1102
1157
  0.1,
1103
1158
  1e3
1104
1159
  );
1105
- b.position.set(3, 3, 3), b.lookAt(0, 0, 0), h(b);
1106
- const x = O(() => {
1107
- w.value.length >= 2 && (b.removeFromParent(), C(b), x == null || x());
1160
+ v.position.set(3, 3, 3), v.lookAt(0, 0, 0), b(v);
1161
+ const C = se(() => {
1162
+ E.value.length >= 2 && (v.removeFromParent(), w(v), C == null || C());
1108
1163
  });
1109
1164
  };
1110
- me(
1111
- () => t.camera,
1112
- (b, x) => {
1113
- b && h(b), x && (x.removeFromParent(), C(x));
1165
+ I(
1166
+ () => s.camera,
1167
+ (v, C) => {
1168
+ v && b(v), C && (C.removeFromParent(), w(C));
1114
1169
  },
1115
1170
  {
1116
1171
  immediate: !0
1117
1172
  }
1118
- ), _.value || (n(
1119
- "No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
1120
- ), S());
1121
- }), (f, h) => (Ve(), We("canvas", {
1173
+ ), g.value || m();
1174
+ }), (y, b) => (Ge(), ze("canvas", {
1122
1175
  ref_key: "canvas",
1123
- ref: s,
1124
- "data-scene": a.value.uuid,
1125
- class: Ue(f.$attrs.class),
1126
- "data-tres": `tresjs ${Fe(Ft).version}`,
1127
- style: Ge({
1176
+ ref: i,
1177
+ "data-scene": n.value.uuid,
1178
+ class: Ve(y.$attrs.class),
1179
+ "data-tres": `tresjs ${Je(Vt).version}`,
1180
+ style: Qe({
1128
1181
  display: "block",
1129
1182
  width: "100%",
1130
1183
  height: "100%",
1131
- position: f.windowSize ? "fixed" : "relative",
1184
+ position: y.windowSize ? "fixed" : "relative",
1132
1185
  top: 0,
1133
1186
  left: 0,
1134
1187
  pointerEvents: "auto",
1135
1188
  touchAction: "none",
1136
- ...f.$attrs.style
1189
+ ...y.$attrs.style
1137
1190
  })
1138
- }, null, 14, Tr));
1191
+ }, null, 14, Lr));
1139
1192
  }
1140
- }), Or = [
1193
+ }), Br = [
1141
1194
  "TresCanvas",
1142
1195
  "TresLeches",
1143
1196
  "TresScene"
1144
- ], Dr = {
1197
+ ], jr = {
1145
1198
  template: {
1146
1199
  compilerOptions: {
1147
- isCustomElement: (e) => e.startsWith("Tres") && !Or.includes(e) || e === "primitive"
1200
+ isCustomElement: (t) => t.startsWith("Tres") && !Br.includes(t) || t === "primitive"
1148
1201
  }
1149
1202
  }
1150
- }, Qr = Dr, Yr = {
1151
- mounted: (e, r) => {
1152
- if (r.arg) {
1153
- console.log(`v-log:${r.arg}`, e[r.arg]);
1203
+ }, Qr = jr, Yr = {
1204
+ mounted: (t, e) => {
1205
+ if (e.arg) {
1206
+ console.log(`v-log:${e.arg}`, t[e.arg]);
1154
1207
  return;
1155
1208
  }
1156
- console.log("v-log", e);
1209
+ console.log("v-log", t);
1157
1210
  }
1158
1211
  };
1159
- class Ae extends lt {
1160
- constructor(r, t) {
1161
- const n = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], s = new ie();
1162
- s.setAttribute("position", new ae(n, 3)), s.computeBoundingSphere();
1163
- const a = new ut({ fog: !1 });
1164
- super(s, a), this.light = r, this.color = t, this.type = "RectAreaLightHelper";
1165
- const o = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], i = new ie();
1166
- i.setAttribute("position", new ae(o, 3)), i.computeBoundingSphere(), this.add(new ct(i, new ye({ side: dt, fog: !1 })));
1212
+ class Ie extends ct {
1213
+ constructor(e, r) {
1214
+ const s = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], o = new de();
1215
+ o.setAttribute("position", new fe(s, 3)), o.computeBoundingSphere();
1216
+ const i = new dt({ fog: !1 });
1217
+ super(o, i), this.light = e, this.color = r, this.type = "RectAreaLightHelper";
1218
+ const n = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], a = new de();
1219
+ a.setAttribute("position", new fe(n, 3)), a.computeBoundingSphere(), this.add(new ft(a, new Ee({ side: pt, fog: !1 })));
1167
1220
  }
1168
1221
  updateMatrixWorld() {
1169
1222
  if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
1170
1223
  this.material.color.set(this.color), this.children[0].material.color.set(this.color);
1171
1224
  else {
1172
1225
  this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);
1173
- const r = this.material.color, t = Math.max(r.r, r.g, r.b);
1174
- t > 1 && r.multiplyScalar(1 / t), this.children[0].material.color.copy(this.material.color);
1226
+ const e = this.material.color, r = Math.max(e.r, e.g, e.b);
1227
+ r > 1 && e.multiplyScalar(1 / r), this.children[0].material.color.copy(this.material.color);
1175
1228
  }
1176
1229
  this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld), this.children[0].matrixWorld.copy(this.matrixWorld);
1177
1230
  }
@@ -1179,94 +1232,94 @@ class Ae extends lt {
1179
1232
  this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
1180
1233
  }
1181
1234
  }
1182
- const { logWarning: pe } = T();
1183
- let N, A;
1184
- const Br = {
1185
- DirectionalLight: ft,
1186
- PointLight: pt,
1187
- SpotLight: mt,
1188
- HemisphereLight: gt,
1189
- RectAreaLight: Ae
1235
+ const { logWarning: we } = P();
1236
+ let U, k;
1237
+ const Dr = {
1238
+ DirectionalLight: mt,
1239
+ PointLight: vt,
1240
+ SpotLight: gt,
1241
+ HemisphereLight: ht,
1242
+ RectAreaLight: Ie
1190
1243
  }, qr = {
1191
- mounted: (e) => {
1192
- if (!e.isLight) {
1193
- pe(`${e.type} is not a light`);
1244
+ mounted: (t) => {
1245
+ if (!t.isLight) {
1246
+ we(`${t.type} is not a light`);
1194
1247
  return;
1195
1248
  }
1196
- N = Br[e.type], e.parent.add(new N(e, 1, e.color.getHex()));
1249
+ U = Dr[t.type], t.parent.add(new U(t, 1, t.color.getHex()));
1197
1250
  },
1198
- updated: (e) => {
1199
- A = e.parent.children.find((r) => r instanceof N), !(A instanceof Ae) && A.update();
1251
+ updated: (t) => {
1252
+ k = t.parent.children.find((e) => e instanceof U), !(k instanceof Ie) && k.update();
1200
1253
  },
1201
- unmounted: (e) => {
1202
- if (!e.isLight) {
1203
- pe(`${e.type} is not a light`);
1254
+ unmounted: (t) => {
1255
+ if (!t.isLight) {
1256
+ we(`${t.type} is not a light`);
1204
1257
  return;
1205
1258
  }
1206
- A = e.parent.children.find((r) => r instanceof N), A && A.dispose && A.dispose(), e.parent.remove(A);
1259
+ k = t.parent.children.find((e) => e instanceof U), k && k.dispose && k.dispose(), t.parent.remove(k);
1207
1260
  }
1208
- }, { logWarning: jr } = T(), Kr = {
1209
- updated: (e, r) => {
1210
- const t = Ce(r);
1211
- if (!t) {
1212
- jr(`v-always-look-at: problem with binding value: ${r.value}`);
1261
+ }, { logWarning: Ir } = P(), Kr = {
1262
+ updated: (t, e) => {
1263
+ const r = Ae(e);
1264
+ if (!r) {
1265
+ Ir(`v-always-look-at: problem with binding value: ${e.value}`);
1213
1266
  return;
1214
1267
  }
1215
- const { onLoop: n } = te();
1216
- n(() => {
1217
- e.lookAt(t);
1268
+ const { onLoop: s } = ae();
1269
+ s(() => {
1270
+ t.lookAt(r);
1218
1271
  });
1219
1272
  }
1220
- }, { logWarning: Hr } = T(), Xr = {
1221
- updated: (e, r) => {
1222
- var s;
1223
- const t = Ce(r);
1224
- if (!t) {
1225
- Hr(`v-distance-to: problem with binding value: ${r.value}`);
1273
+ }, { logWarning: Rr } = P(), Xr = {
1274
+ updated: (t, e) => {
1275
+ var o;
1276
+ const r = Ae(e);
1277
+ if (!r) {
1278
+ Rr(`v-distance-to: problem with binding value: ${e.value}`);
1226
1279
  return;
1227
1280
  }
1228
- k && (k.dispose(), e.parent.remove(k));
1229
- const n = t.clone().sub(e.position);
1230
- n.normalize(), k = new vt(n, e.position, e.position.distanceTo(t), 16776960), e.parent.add(k), console.table(
1281
+ S && (S.dispose(), t.parent.remove(S));
1282
+ const s = r.clone().sub(t.position);
1283
+ s.normalize(), S = new yt(s, t.position, t.position.distanceTo(r), 16776960), t.parent.add(S), console.table(
1231
1284
  [
1232
- ["Distance:", e.position.distanceTo(t)],
1233
- [`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(s = e.position) == null ? void 0 : s.z}`],
1234
- [`Destiny: ${e.name || e.type}`, `x:${t.x}, y:${t.y}, z:${t == null ? void 0 : t.z}`]
1285
+ ["Distance:", t.position.distanceTo(r)],
1286
+ [`origin: ${t.name || t.type}`, `x:${t.position.x}, y:${t.position.y}, z:${(o = t.position) == null ? void 0 : o.z}`],
1287
+ [`Destiny: ${t.name || t.type}`, `x:${r.x}, y:${r.y}, z:${r == null ? void 0 : r.z}`]
1235
1288
  ]
1236
1289
  );
1237
1290
  },
1238
- unmounted: (e) => {
1239
- k == null || k.dispose(), e.parent.remove(k);
1291
+ unmounted: (t) => {
1292
+ S == null || S.dispose(), t.parent.remove(S);
1240
1293
  }
1241
1294
  };
1242
- let k = null;
1295
+ let S = null;
1243
1296
  const Zr = {
1244
- install(e) {
1245
- e.component("TresCanvas", Lr);
1297
+ install(t) {
1298
+ t.component("TresCanvas", Or);
1246
1299
  }
1247
1300
  };
1248
1301
  export {
1249
- Lr as TresCanvas,
1250
- X as catalogue,
1302
+ Or as TresCanvas,
1303
+ re as catalogue,
1251
1304
  Zr as default,
1252
- re as extend,
1253
- Vr as isProd,
1254
- qt as normalizeColor,
1255
- Wr as normalizeVectorFlexibleParam,
1305
+ ne as extend,
1306
+ Wr as isProd,
1307
+ Xt as normalizeColor,
1308
+ Ur as normalizeVectorFlexibleParam,
1256
1309
  Qr as templateCompilerOptions,
1257
- cr as trasverseObjects,
1258
- Gt as useCamera,
1259
- Ur as useLoader,
1260
- T as useLogger,
1261
- fr as usePointerEventHandler,
1262
- dr as useRaycaster,
1263
- te as useRenderLoop,
1264
- lr as useRenderer,
1265
- Gr as useSeek,
1266
- Fr as useTexture,
1310
+ fr as trasverseObjects,
1311
+ Jt as useCamera,
1312
+ Gr as useLoader,
1313
+ P as useLogger,
1314
+ mr as usePointerEventHandler,
1315
+ pr as useRaycaster,
1316
+ ae as useRenderLoop,
1317
+ cr as useRenderer,
1318
+ Vr as useSeek,
1319
+ zr as useTexture,
1267
1320
  Jr as useTres,
1268
- gr as useTresContext,
1269
- mr as useTresContextProvider,
1321
+ yr as useTresContext,
1322
+ hr as useTresContextProvider,
1270
1323
  Kr as vAlwaysLookAt,
1271
1324
  Xr as vDistanceTo,
1272
1325
  qr as vLightHelper,