@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/src/components/TresCanvas.vue.d.ts +10 -2
- package/dist/src/composables/useCamera/index.d.ts +12 -12
- package/dist/src/composables/usePointerEventHandler/index.d.ts +6 -8
- package/dist/src/composables/useRaycaster/index.d.ts +3 -3
- package/dist/src/composables/useRenderer/const.d.ts +4 -0
- package/dist/src/composables/useRenderer/index.d.ts +8 -3
- package/dist/src/composables/useSizes/index.d.ts +11 -0
- package/dist/src/composables/useTresContextProvider/index.d.ts +52 -21
- package/dist/src/core/nodeOps.d.ts +3 -2
- package/dist/src/types/index.d.ts +20 -16
- package/dist/tres.js +831 -778
- package/dist/tres.umd.cjs +2 -2
- package/package.json +20 -20
- package/dist/src/core/renderer.d.ts +0 -5
package/dist/tres.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version:
|
|
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
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
import { ref as
|
|
12
|
-
import * as
|
|
13
|
-
import { PerspectiveCamera as
|
|
14
|
-
import { createEventHook as H, useRafFn as
|
|
15
|
-
const
|
|
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
|
-
],
|
|
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
|
-
},
|
|
40
|
+
}, Rt = "./dist/tres.js", $t = "./dist/tres.js", Ht = "./dist/index.d.ts", Nt = [
|
|
41
41
|
"dist",
|
|
42
42
|
"*.d.ts"
|
|
43
|
-
],
|
|
43
|
+
], Ft = {
|
|
44
44
|
access: "public"
|
|
45
|
-
},
|
|
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
|
-
},
|
|
60
|
+
}, Ut = {
|
|
61
61
|
three: ">=0.133",
|
|
62
|
-
vue: ">=3.
|
|
63
|
-
},
|
|
62
|
+
vue: ">=3.4"
|
|
63
|
+
}, Gt = {
|
|
64
64
|
"@alvarosabu/utils": "^3.1.1",
|
|
65
|
-
"@vueuse/core": "^10.7.
|
|
66
|
-
},
|
|
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.
|
|
69
|
+
"@tresjs/cientos": "3.7.0",
|
|
70
70
|
"@tresjs/eslint-config-vue": "^0.2.1",
|
|
71
|
-
"@types/three": "^0.
|
|
72
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
73
|
-
"@typescript-eslint/parser": "^6.
|
|
74
|
-
"@vitejs/plugin-vue": "^
|
|
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.
|
|
76
|
+
"@vitest/ui": "^1.1.1",
|
|
77
77
|
"@vue/test-utils": "^2.4.3",
|
|
78
|
-
eslint: "^8.
|
|
78
|
+
eslint: "^8.56.0",
|
|
79
79
|
"eslint-plugin-vue": "^9.19.2",
|
|
80
80
|
esno: "^4.0.0",
|
|
81
|
-
gsap: "^3.12.
|
|
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.
|
|
90
|
-
three: "^0.
|
|
91
|
-
unocss: "^0.58.
|
|
92
|
-
unplugin: "^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.
|
|
94
|
+
vite: "^5.0.10",
|
|
95
95
|
"vite-plugin-banner": "^0.7.1",
|
|
96
|
-
"vite-plugin-dts": "3.
|
|
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.
|
|
101
|
-
vitest: "^1.
|
|
102
|
-
vue: "^3.3
|
|
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
|
-
},
|
|
105
|
-
name:
|
|
106
|
-
type:
|
|
107
|
-
version:
|
|
104
|
+
}, Vt = {
|
|
105
|
+
name: kt,
|
|
106
|
+
type: Tt,
|
|
107
|
+
version: Pt,
|
|
108
108
|
packageManager: At,
|
|
109
|
-
description:
|
|
110
|
-
author:
|
|
111
|
-
license:
|
|
112
|
-
keywords:
|
|
113
|
-
sideEffects:
|
|
114
|
-
exports:
|
|
115
|
-
main:
|
|
116
|
-
module:
|
|
117
|
-
types:
|
|
118
|
-
files:
|
|
119
|
-
publishConfig:
|
|
120
|
-
scripts:
|
|
121
|
-
peerDependencies:
|
|
122
|
-
dependencies:
|
|
123
|
-
devDependencies:
|
|
124
|
-
},
|
|
125
|
-
const
|
|
126
|
-
() =>
|
|
127
|
-
),
|
|
128
|
-
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
},
|
|
132
|
-
const l =
|
|
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
|
|
136
|
-
|
|
135
|
+
const f = r.value.filter(({ uuid: c }) => c !== l.uuid);
|
|
136
|
+
r.value = [l, ...f];
|
|
137
137
|
};
|
|
138
|
-
return
|
|
139
|
-
|
|
140
|
-
|
|
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
|
-
}),
|
|
143
|
-
|
|
142
|
+
}), J(() => {
|
|
143
|
+
r.value = [];
|
|
144
144
|
}), {
|
|
145
|
-
camera:
|
|
146
|
-
cameras:
|
|
147
|
-
registerCamera:
|
|
148
|
-
deregisterCamera:
|
|
149
|
-
setCameraActive:
|
|
145
|
+
camera: s,
|
|
146
|
+
cameras: r,
|
|
147
|
+
registerCamera: o,
|
|
148
|
+
deregisterCamera: i,
|
|
149
|
+
setCameraActive: n
|
|
150
150
|
};
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
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
|
-
|
|
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
|
-
|
|
160
|
-
|
|
163
|
+
ie.on(() => {
|
|
164
|
+
z = R.getDelta(), V = R.getElapsedTime();
|
|
161
165
|
});
|
|
162
|
-
const
|
|
163
|
-
onBeforeLoop:
|
|
164
|
-
onLoop:
|
|
165
|
-
onAfterLoop:
|
|
166
|
-
pause:
|
|
167
|
-
resume:
|
|
168
|
-
isActive:
|
|
169
|
-
}),
|
|
170
|
-
function
|
|
171
|
-
function
|
|
172
|
-
console.error(`${
|
|
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
|
|
175
|
-
console.warn(`${
|
|
178
|
+
function e(s) {
|
|
179
|
+
console.warn(`${me} ${s}`);
|
|
176
180
|
}
|
|
177
|
-
function
|
|
181
|
+
function r(s, o) {
|
|
178
182
|
}
|
|
179
183
|
return {
|
|
180
|
-
logError:
|
|
181
|
-
logWarning:
|
|
182
|
-
logMessage:
|
|
184
|
+
logError: t,
|
|
185
|
+
logWarning: e,
|
|
186
|
+
logMessage: r
|
|
183
187
|
};
|
|
184
188
|
}
|
|
185
|
-
function
|
|
186
|
-
return typeof
|
|
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
|
|
189
|
-
return
|
|
192
|
+
function Xt(t) {
|
|
193
|
+
return t instanceof G ? t : Array.isArray(t) ? new G(...t) : new G(t);
|
|
190
194
|
}
|
|
191
|
-
class
|
|
192
|
-
constructor(...
|
|
193
|
-
super(...
|
|
194
|
-
|
|
195
|
-
|
|
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
|
|
200
|
-
this.scale.set(
|
|
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
|
|
204
|
-
for (const
|
|
205
|
-
r
|
|
206
|
-
return Object.assign(
|
|
207
|
-
},
|
|
208
|
-
function
|
|
209
|
-
return
|
|
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
|
|
212
|
-
return
|
|
215
|
+
function F(t) {
|
|
216
|
+
return t.replace(/-([a-z])/g, (e, r) => r.toUpperCase());
|
|
213
217
|
}
|
|
214
|
-
function
|
|
215
|
-
const
|
|
216
|
-
for (let
|
|
217
|
-
|
|
218
|
-
return
|
|
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
|
|
221
|
-
const
|
|
222
|
-
for (const
|
|
223
|
-
const
|
|
224
|
-
|
|
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
|
|
227
|
-
},
|
|
228
|
-
if (!
|
|
230
|
+
return s;
|
|
231
|
+
}, ge = (t, e) => {
|
|
232
|
+
if (!e)
|
|
229
233
|
return;
|
|
230
|
-
const
|
|
231
|
-
return
|
|
232
|
-
},
|
|
233
|
-
const
|
|
234
|
-
|
|
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
|
|
237
|
-
if (
|
|
238
|
-
const
|
|
239
|
-
return
|
|
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 (
|
|
245
|
+
if (t === e)
|
|
242
246
|
return !0;
|
|
243
|
-
if (
|
|
247
|
+
if (t === null || typeof t != "object" || e === null || typeof e != "object")
|
|
244
248
|
return !1;
|
|
245
|
-
const
|
|
246
|
-
if (
|
|
249
|
+
const r = Object.keys(t), s = Object.keys(e);
|
|
250
|
+
if (r.length !== s.length)
|
|
247
251
|
return !1;
|
|
248
|
-
for (const
|
|
249
|
-
if (!
|
|
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
|
|
254
|
-
if (!Array.isArray(
|
|
257
|
+
function sr(t, e) {
|
|
258
|
+
if (!Array.isArray(t) || !Array.isArray(e) || t.length !== e.length)
|
|
255
259
|
return !1;
|
|
256
|
-
for (let
|
|
257
|
-
if (!
|
|
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
|
|
262
|
-
function
|
|
263
|
-
const
|
|
264
|
-
if (l.uuid ===
|
|
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
|
|
267
|
-
const
|
|
268
|
-
if (
|
|
269
|
-
return
|
|
270
|
+
for (const f of l.children) {
|
|
271
|
+
const c = o(f);
|
|
272
|
+
if (c)
|
|
273
|
+
return c;
|
|
270
274
|
}
|
|
271
|
-
},
|
|
272
|
-
if (!
|
|
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
|
|
277
|
-
for (let l = 0; l <
|
|
278
|
-
if (
|
|
279
|
-
|
|
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: ${
|
|
285
|
+
console.warn(`Property path is not valid: ${r.join(".")}`);
|
|
282
286
|
return;
|
|
283
287
|
}
|
|
284
|
-
const
|
|
285
|
-
|
|
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
|
|
288
|
-
const
|
|
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:
|
|
299
|
+
side: Ze
|
|
296
300
|
// To e
|
|
297
301
|
});
|
|
298
|
-
return new
|
|
302
|
+
return new Zt(t.geometry.clone(), e);
|
|
299
303
|
}
|
|
300
|
-
function
|
|
301
|
-
var
|
|
302
|
-
let
|
|
303
|
-
return
|
|
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
|
|
309
|
+
const ur = Number.parseInt(et.replace("dev", "")), W = {
|
|
306
310
|
realistic: {
|
|
307
311
|
shadows: !0,
|
|
308
312
|
physicallyCorrectLights: !0,
|
|
309
|
-
outputColorSpace:
|
|
310
|
-
toneMapping:
|
|
313
|
+
outputColorSpace: tt,
|
|
314
|
+
toneMapping: Ce,
|
|
311
315
|
toneMappingExposure: 3,
|
|
312
316
|
shadowMap: {
|
|
313
317
|
enabled: !0,
|
|
314
|
-
type:
|
|
318
|
+
type: rt
|
|
315
319
|
}
|
|
320
|
+
},
|
|
321
|
+
flat: {
|
|
322
|
+
toneMapping: nt,
|
|
323
|
+
toneMappingExposure: 1
|
|
316
324
|
}
|
|
317
325
|
};
|
|
318
|
-
function
|
|
319
|
-
scene:
|
|
320
|
-
canvas:
|
|
321
|
-
options:
|
|
322
|
-
disableRender:
|
|
323
|
-
|
|
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
|
|
326
|
-
alpha: M(
|
|
327
|
-
depth: M(
|
|
328
|
-
canvas:
|
|
329
|
-
context: M(
|
|
330
|
-
stencil: M(
|
|
331
|
-
antialias: M(
|
|
332
|
-
precision: M(
|
|
333
|
-
powerPreference: M(
|
|
334
|
-
premultipliedAlpha: M(
|
|
335
|
-
preserveDrawingBuffer: M(
|
|
336
|
-
logarithmicDepthBuffer: M(
|
|
337
|
-
failIfMajorPerformanceCaveat: M(
|
|
338
|
-
})),
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
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:
|
|
349
|
-
|
|
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:
|
|
352
|
-
type:
|
|
369
|
+
enabled: w.shadowMap.enabled,
|
|
370
|
+
type: w.shadowMap.type
|
|
353
371
|
},
|
|
354
|
-
toneMapping:
|
|
355
|
-
toneMappingExposure:
|
|
356
|
-
outputColorSpace:
|
|
372
|
+
toneMapping: w.toneMapping,
|
|
373
|
+
toneMappingExposure: w.toneMappingExposure,
|
|
374
|
+
outputColorSpace: w.outputColorSpace
|
|
357
375
|
};
|
|
358
|
-
return
|
|
359
|
-
})();
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
const
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
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 (
|
|
369
|
-
return
|
|
370
|
-
const
|
|
371
|
-
return
|
|
372
|
-
},
|
|
373
|
-
|
|
374
|
-
const
|
|
375
|
-
|
|
376
|
-
|
|
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
|
-
|
|
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:
|
|
402
|
+
renderer: u
|
|
387
403
|
};
|
|
388
404
|
}
|
|
389
|
-
const
|
|
390
|
-
function
|
|
391
|
-
const
|
|
392
|
-
return
|
|
393
|
-
|
|
394
|
-
}),
|
|
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
|
|
397
|
-
const { logError:
|
|
398
|
-
|
|
399
|
-
const l = (Array.isArray(
|
|
400
|
-
(
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
(
|
|
404
|
-
|
|
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
|
-
|
|
407
|
-
(
|
|
422
|
+
s,
|
|
423
|
+
(d) => u(i("[useLoader] - Failed to load resource", d))
|
|
408
424
|
);
|
|
409
425
|
})
|
|
410
426
|
);
|
|
411
|
-
return
|
|
427
|
+
return dr(e) ? await Promise.all(l) : await l[0];
|
|
412
428
|
}
|
|
413
|
-
async function
|
|
414
|
-
const
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
(
|
|
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
|
-
|
|
436
|
+
n(new Error("[useTextures] - Failed to load texture"));
|
|
421
437
|
}
|
|
422
438
|
);
|
|
423
439
|
});
|
|
424
|
-
if (
|
|
425
|
-
const
|
|
426
|
-
return
|
|
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:
|
|
430
|
-
displacementMap:
|
|
431
|
-
normalMap:
|
|
432
|
-
roughnessMap:
|
|
445
|
+
map: o,
|
|
446
|
+
displacementMap: i,
|
|
447
|
+
normalMap: n,
|
|
448
|
+
roughnessMap: a,
|
|
433
449
|
metalnessMap: l,
|
|
434
|
-
aoMap:
|
|
435
|
-
alphaMap:
|
|
436
|
-
matcap:
|
|
437
|
-
} =
|
|
450
|
+
aoMap: f,
|
|
451
|
+
alphaMap: c,
|
|
452
|
+
matcap: u
|
|
453
|
+
} = t;
|
|
438
454
|
return {
|
|
439
|
-
map:
|
|
440
|
-
displacementMap:
|
|
441
|
-
normalMap:
|
|
442
|
-
roughnessMap:
|
|
443
|
-
metalnessMap: l ? await
|
|
444
|
-
aoMap:
|
|
445
|
-
alphaMap:
|
|
446
|
-
matcap:
|
|
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
|
|
451
|
-
const
|
|
452
|
-
if (
|
|
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: (
|
|
455
|
-
y: -((
|
|
470
|
+
x: (m - l.value) / i.value * 2 - 1,
|
|
471
|
+
y: -((v - a.value) / n.value) * 2 + 1
|
|
456
472
|
};
|
|
457
|
-
},
|
|
458
|
-
if (
|
|
459
|
-
return
|
|
460
|
-
},
|
|
461
|
-
const
|
|
462
|
-
x: (
|
|
463
|
-
y: (
|
|
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
|
|
466
|
-
},
|
|
467
|
-
|
|
468
|
-
},
|
|
469
|
-
_(h,
|
|
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
|
|
472
|
-
const
|
|
473
|
-
var
|
|
474
|
-
|
|
475
|
-
},
|
|
476
|
-
var
|
|
477
|
-
|
|
478
|
-
},
|
|
479
|
-
return
|
|
480
|
-
|
|
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:
|
|
483
|
-
onClick: (
|
|
484
|
-
onPointerMove: (
|
|
498
|
+
intersects: d,
|
|
499
|
+
onClick: (m) => p.on(m).off,
|
|
500
|
+
onPointerMove: (m) => h.on(m).off
|
|
485
501
|
};
|
|
486
502
|
};
|
|
487
|
-
function
|
|
488
|
-
const { logWarning:
|
|
489
|
-
function
|
|
503
|
+
function Vr() {
|
|
504
|
+
const { logWarning: t } = P();
|
|
505
|
+
function e(i, n, a) {
|
|
490
506
|
let l = null;
|
|
491
|
-
return
|
|
492
|
-
|
|
493
|
-
}), 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
|
|
511
|
+
function r(i, n, a) {
|
|
496
512
|
const l = [];
|
|
497
|
-
return
|
|
498
|
-
|
|
499
|
-
}), l.length ||
|
|
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
|
|
502
|
-
return
|
|
517
|
+
function s(i, n) {
|
|
518
|
+
return e(i, "name", n);
|
|
503
519
|
}
|
|
504
|
-
function
|
|
505
|
-
return
|
|
520
|
+
function o(i, n) {
|
|
521
|
+
return r(i, "name", n);
|
|
506
522
|
}
|
|
507
523
|
return {
|
|
508
|
-
seek:
|
|
509
|
-
seekByName:
|
|
510
|
-
seekAll:
|
|
511
|
-
seekAllByName:
|
|
524
|
+
seek: e,
|
|
525
|
+
seekByName: s,
|
|
526
|
+
seekAll: r,
|
|
527
|
+
seekAllByName: o
|
|
512
528
|
};
|
|
513
529
|
}
|
|
514
|
-
const
|
|
515
|
-
const
|
|
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
|
-
}),
|
|
521
|
-
|
|
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
|
-
|
|
539
|
+
r.value.delete(u);
|
|
526
540
|
}, i = (u) => {
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
() =>
|
|
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(
|
|
535
|
-
...Object.values(
|
|
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
|
-
)
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
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
|
|
545
|
-
return
|
|
546
|
-
var
|
|
547
|
-
const
|
|
548
|
-
|
|
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:
|
|
551
|
-
deregisterObject:
|
|
566
|
+
registerObject: n,
|
|
567
|
+
deregisterObject: i,
|
|
568
|
+
registerBlockingObject: s,
|
|
569
|
+
deregisterBlockingObject: o
|
|
552
570
|
};
|
|
553
571
|
};
|
|
554
|
-
function
|
|
555
|
-
let
|
|
556
|
-
return
|
|
557
|
-
if (
|
|
558
|
-
const
|
|
559
|
-
|
|
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
|
-
}),
|
|
579
|
+
}), e;
|
|
562
580
|
}
|
|
563
|
-
function
|
|
564
|
-
return (
|
|
581
|
+
function vr(t) {
|
|
582
|
+
return (t / 1024).toFixed(2);
|
|
565
583
|
}
|
|
566
|
-
const
|
|
567
|
-
function
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
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
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
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:
|
|
597
|
-
canvas:
|
|
598
|
-
options:
|
|
599
|
-
|
|
600
|
-
|
|
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
|
-
),
|
|
603
|
-
sizes:
|
|
604
|
-
scene:
|
|
605
|
-
camera:
|
|
606
|
-
cameras:
|
|
607
|
-
renderer:
|
|
608
|
-
raycaster:
|
|
609
|
-
controls:
|
|
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
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
650
|
+
render: h,
|
|
651
|
+
advance: y,
|
|
652
|
+
extend: ne,
|
|
653
|
+
invalidate: _,
|
|
654
|
+
registerCamera: u,
|
|
655
|
+
setCameraActive: p,
|
|
656
|
+
deregisterCamera: d
|
|
626
657
|
};
|
|
627
|
-
|
|
628
|
-
|
|
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
|
-
|
|
634
|
-
|
|
635
|
-
|
|
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
|
|
638
|
-
|
|
639
|
-
}),
|
|
670
|
+
return J(() => {
|
|
671
|
+
N();
|
|
672
|
+
}), g;
|
|
640
673
|
}
|
|
641
|
-
function
|
|
642
|
-
const
|
|
643
|
-
if (!
|
|
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
|
|
678
|
+
return t;
|
|
646
679
|
}
|
|
647
|
-
const Jr =
|
|
648
|
-
|
|
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
|
-
]
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
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
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
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
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
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
|
|
696
|
-
var d,
|
|
697
|
-
const
|
|
698
|
-
|
|
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
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
c.isCamera && (
|
|
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
|
-
(
|
|
713
|
-
|
|
714
|
-
}),
|
|
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
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
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
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
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
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
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
|
|
821
|
+
function Be() {
|
|
772
822
|
return typeof navigator < "u" && typeof window < "u" ? window : typeof global < "u" ? global : {};
|
|
773
823
|
}
|
|
774
|
-
const
|
|
775
|
-
let
|
|
824
|
+
const br = typeof Proxy == "function", Mr = "devtools-plugin:setup", _r = "plugin:settings:set";
|
|
825
|
+
let j, oe;
|
|
776
826
|
function Er() {
|
|
777
|
-
var
|
|
778
|
-
return
|
|
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
|
|
781
|
-
return Er() ?
|
|
830
|
+
function Cr() {
|
|
831
|
+
return Er() ? oe.now() : Date.now();
|
|
782
832
|
}
|
|
783
|
-
class
|
|
784
|
-
constructor(
|
|
785
|
-
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin =
|
|
786
|
-
const
|
|
787
|
-
if (
|
|
788
|
-
for (const
|
|
789
|
-
const
|
|
790
|
-
n
|
|
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
|
|
793
|
-
let
|
|
842
|
+
const o = `__vue-devtools-plugin-settings__${e.id}`;
|
|
843
|
+
let i = Object.assign({}, s);
|
|
794
844
|
try {
|
|
795
|
-
const
|
|
796
|
-
Object.assign(
|
|
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
|
|
851
|
+
return i;
|
|
802
852
|
},
|
|
803
|
-
setSettings(
|
|
853
|
+
setSettings(n) {
|
|
804
854
|
try {
|
|
805
|
-
localStorage.setItem(
|
|
855
|
+
localStorage.setItem(o, JSON.stringify(n));
|
|
806
856
|
} catch {
|
|
807
857
|
}
|
|
808
|
-
|
|
858
|
+
i = n;
|
|
809
859
|
},
|
|
810
860
|
now() {
|
|
811
|
-
return
|
|
861
|
+
return Cr();
|
|
812
862
|
}
|
|
813
|
-
},
|
|
814
|
-
|
|
863
|
+
}, r && r.on(_r, (n, a) => {
|
|
864
|
+
n === this.plugin.id && this.fallbacks.setSettings(a);
|
|
815
865
|
}), this.proxiedOn = new Proxy({}, {
|
|
816
|
-
get: (
|
|
866
|
+
get: (n, a) => this.target ? this.target.on[a] : (...l) => {
|
|
817
867
|
this.onQueue.push({
|
|
818
|
-
method:
|
|
868
|
+
method: a,
|
|
819
869
|
args: l
|
|
820
870
|
});
|
|
821
871
|
}
|
|
822
872
|
}), this.proxiedTarget = new Proxy({}, {
|
|
823
|
-
get: (
|
|
824
|
-
method:
|
|
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[
|
|
878
|
+
}), this.fallbacks[a](...l)) : (...l) => new Promise((f) => {
|
|
829
879
|
this.targetQueue.push({
|
|
830
|
-
method:
|
|
880
|
+
method: a,
|
|
831
881
|
args: l,
|
|
832
|
-
resolve:
|
|
882
|
+
resolve: f
|
|
833
883
|
});
|
|
834
884
|
})
|
|
835
885
|
});
|
|
836
886
|
}
|
|
837
|
-
async setRealTarget(
|
|
838
|
-
this.target =
|
|
839
|
-
for (const
|
|
840
|
-
this.target.on[
|
|
841
|
-
for (const
|
|
842
|
-
|
|
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
|
|
846
|
-
const
|
|
847
|
-
if (
|
|
848
|
-
|
|
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
|
|
851
|
-
(
|
|
852
|
-
pluginDescriptor:
|
|
853
|
-
setupFn:
|
|
854
|
-
proxy:
|
|
855
|
-
}),
|
|
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
|
|
859
|
-
const
|
|
860
|
-
typeof __VUE_DEVTOOLS_TOAST__ == "function" ? __VUE_DEVTOOLS_TOAST__(
|
|
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
|
|
863
|
-
const
|
|
864
|
-
id:
|
|
865
|
-
label:
|
|
912
|
+
const je = (t) => {
|
|
913
|
+
const e = {
|
|
914
|
+
id: t.uuid,
|
|
915
|
+
label: t.type,
|
|
866
916
|
children: [],
|
|
867
917
|
tags: []
|
|
868
918
|
};
|
|
869
|
-
|
|
870
|
-
label:
|
|
919
|
+
t.name !== "" && e.tags.push({
|
|
920
|
+
label: t.name,
|
|
871
921
|
textColor: 5750629,
|
|
872
922
|
backgroundColor: 15793395
|
|
873
923
|
});
|
|
874
|
-
const
|
|
875
|
-
return
|
|
876
|
-
label: `${
|
|
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
|
-
}),
|
|
881
|
-
label: `${
|
|
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
|
-
}),
|
|
886
|
-
label: `#${
|
|
935
|
+
}), e.tags.push({
|
|
936
|
+
label: `#${t.color.getHexString()}`,
|
|
887
937
|
textColor: 9738662,
|
|
888
938
|
backgroundColor: 16316922,
|
|
889
939
|
tooltip: "Color"
|
|
890
|
-
})),
|
|
891
|
-
label: `${
|
|
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
|
-
}),
|
|
945
|
+
}), e.tags.push({
|
|
896
946
|
// eslint-disable-next-line max-len
|
|
897
|
-
label: `x: ${Math.round(
|
|
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
|
-
})),
|
|
951
|
+
})), e;
|
|
902
952
|
};
|
|
903
|
-
function
|
|
904
|
-
|
|
905
|
-
if (
|
|
953
|
+
function De(t, e) {
|
|
954
|
+
t.children.forEach((r) => {
|
|
955
|
+
if (r.type === "HightlightMesh")
|
|
906
956
|
return;
|
|
907
|
-
const
|
|
908
|
-
|
|
957
|
+
const s = je(r);
|
|
958
|
+
e.children.push(s), De(r, s);
|
|
909
959
|
});
|
|
910
960
|
}
|
|
911
|
-
const
|
|
961
|
+
const Tr = [], D = "tres:inspector", Pr = be({
|
|
912
962
|
sceneGraph: null
|
|
913
963
|
});
|
|
914
|
-
function Ar(
|
|
915
|
-
|
|
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:
|
|
923
|
-
app:
|
|
972
|
+
componentStateTypes: Tr,
|
|
973
|
+
app: t
|
|
924
974
|
},
|
|
925
|
-
(
|
|
926
|
-
typeof
|
|
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
|
-
),
|
|
930
|
-
id:
|
|
979
|
+
), r.addInspector({
|
|
980
|
+
id: D,
|
|
931
981
|
label: "TresJS 🪐",
|
|
932
982
|
icon: "account_tree",
|
|
933
983
|
treeFilterPlaceholder: "Search instances"
|
|
934
984
|
}), setInterval(() => {
|
|
935
|
-
|
|
985
|
+
r.sendInspectorTree(D);
|
|
936
986
|
}, 1e3), setInterval(() => {
|
|
937
|
-
|
|
938
|
-
}, 5e3),
|
|
939
|
-
if (
|
|
940
|
-
const
|
|
941
|
-
|
|
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
|
|
945
|
-
|
|
946
|
-
if (
|
|
947
|
-
const [
|
|
948
|
-
if (!
|
|
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 (
|
|
951
|
-
const
|
|
952
|
-
|
|
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
|
-
|
|
1004
|
+
i.state = {
|
|
955
1005
|
object: [
|
|
956
1006
|
{
|
|
957
1007
|
key: "uuid",
|
|
958
1008
|
editable: !0,
|
|
959
|
-
value:
|
|
1009
|
+
value: n.uuid
|
|
960
1010
|
},
|
|
961
1011
|
{
|
|
962
1012
|
key: "name",
|
|
963
1013
|
editable: !0,
|
|
964
|
-
value:
|
|
1014
|
+
value: n.name
|
|
965
1015
|
},
|
|
966
1016
|
{
|
|
967
1017
|
key: "type",
|
|
968
1018
|
editable: !0,
|
|
969
|
-
value:
|
|
1019
|
+
value: n.type
|
|
970
1020
|
},
|
|
971
1021
|
{
|
|
972
1022
|
key: "position",
|
|
973
1023
|
editable: !0,
|
|
974
|
-
value:
|
|
1024
|
+
value: n.position
|
|
975
1025
|
},
|
|
976
1026
|
{
|
|
977
1027
|
key: "rotation",
|
|
978
1028
|
editable: !0,
|
|
979
|
-
value:
|
|
1029
|
+
value: n.rotation
|
|
980
1030
|
},
|
|
981
1031
|
{
|
|
982
1032
|
key: "scale",
|
|
983
1033
|
editable: !0,
|
|
984
|
-
value:
|
|
1034
|
+
value: n.scale
|
|
985
1035
|
},
|
|
986
1036
|
{
|
|
987
1037
|
key: "geometry",
|
|
988
|
-
value:
|
|
1038
|
+
value: n.geometry
|
|
989
1039
|
},
|
|
990
1040
|
{
|
|
991
1041
|
key: "material",
|
|
992
|
-
value:
|
|
1042
|
+
value: n.material
|
|
993
1043
|
},
|
|
994
1044
|
{
|
|
995
1045
|
key: "color",
|
|
996
1046
|
editable: !0,
|
|
997
|
-
value:
|
|
1047
|
+
value: n.color
|
|
998
1048
|
},
|
|
999
1049
|
{
|
|
1000
1050
|
key: "intensity",
|
|
1001
1051
|
editable: !0,
|
|
1002
|
-
value:
|
|
1052
|
+
value: n.intensity
|
|
1003
1053
|
},
|
|
1004
1054
|
{
|
|
1005
1055
|
key: "castShadow",
|
|
1006
1056
|
editable: !0,
|
|
1007
|
-
value:
|
|
1057
|
+
value: n.castShadow
|
|
1008
1058
|
},
|
|
1009
1059
|
{
|
|
1010
1060
|
key: "receiveShadow",
|
|
1011
1061
|
editable: !0,
|
|
1012
|
-
value:
|
|
1062
|
+
value: n.receiveShadow
|
|
1013
1063
|
},
|
|
1014
1064
|
{
|
|
1015
1065
|
key: "frustumCulled",
|
|
1016
1066
|
editable: !0,
|
|
1017
|
-
value:
|
|
1067
|
+
value: n.frustumCulled
|
|
1018
1068
|
},
|
|
1019
1069
|
{
|
|
1020
1070
|
key: "matrixAutoUpdate",
|
|
1021
1071
|
editable: !0,
|
|
1022
|
-
value:
|
|
1072
|
+
value: n.matrixAutoUpdate
|
|
1023
1073
|
},
|
|
1024
1074
|
{
|
|
1025
1075
|
key: "matrixWorldNeedsUpdate",
|
|
1026
1076
|
editable: !0,
|
|
1027
|
-
value:
|
|
1077
|
+
value: n.matrixWorldNeedsUpdate
|
|
1028
1078
|
},
|
|
1029
1079
|
{
|
|
1030
1080
|
key: "matrixWorld",
|
|
1031
|
-
value:
|
|
1081
|
+
value: n.matrixWorld
|
|
1032
1082
|
},
|
|
1033
1083
|
{
|
|
1034
1084
|
key: "visible",
|
|
1035
1085
|
editable: !0,
|
|
1036
|
-
value:
|
|
1086
|
+
value: n.visible
|
|
1037
1087
|
}
|
|
1038
1088
|
]
|
|
1039
1089
|
};
|
|
1040
1090
|
}
|
|
1041
|
-
}),
|
|
1042
|
-
|
|
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
|
|
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
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
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
|
|
1079
|
-
return
|
|
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
|
-
}),
|
|
1082
|
-
const
|
|
1083
|
-
|
|
1084
|
-
}, d = (
|
|
1085
|
-
|
|
1086
|
-
},
|
|
1087
|
-
return
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1090
|
-
scene:
|
|
1091
|
-
canvas:
|
|
1092
|
-
windowSize:
|
|
1093
|
-
disableRender:
|
|
1094
|
-
rendererOptions:
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
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
|
-
|
|
1106
|
-
const
|
|
1107
|
-
|
|
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
|
-
|
|
1111
|
-
() =>
|
|
1112
|
-
(
|
|
1113
|
-
|
|
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
|
-
),
|
|
1119
|
-
|
|
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:
|
|
1124
|
-
"data-scene":
|
|
1125
|
-
class:
|
|
1126
|
-
"data-tres": `tresjs ${
|
|
1127
|
-
style:
|
|
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:
|
|
1184
|
+
position: y.windowSize ? "fixed" : "relative",
|
|
1132
1185
|
top: 0,
|
|
1133
1186
|
left: 0,
|
|
1134
1187
|
pointerEvents: "auto",
|
|
1135
1188
|
touchAction: "none",
|
|
1136
|
-
...
|
|
1189
|
+
...y.$attrs.style
|
|
1137
1190
|
})
|
|
1138
|
-
}, null, 14,
|
|
1191
|
+
}, null, 14, Lr));
|
|
1139
1192
|
}
|
|
1140
|
-
}),
|
|
1193
|
+
}), Br = [
|
|
1141
1194
|
"TresCanvas",
|
|
1142
1195
|
"TresLeches",
|
|
1143
1196
|
"TresScene"
|
|
1144
|
-
],
|
|
1197
|
+
], jr = {
|
|
1145
1198
|
template: {
|
|
1146
1199
|
compilerOptions: {
|
|
1147
|
-
isCustomElement: (
|
|
1200
|
+
isCustomElement: (t) => t.startsWith("Tres") && !Br.includes(t) || t === "primitive"
|
|
1148
1201
|
}
|
|
1149
1202
|
}
|
|
1150
|
-
}, Qr =
|
|
1151
|
-
mounted: (
|
|
1152
|
-
if (
|
|
1153
|
-
console.log(`v-log:${
|
|
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",
|
|
1209
|
+
console.log("v-log", t);
|
|
1157
1210
|
}
|
|
1158
1211
|
};
|
|
1159
|
-
class
|
|
1160
|
-
constructor(
|
|
1161
|
-
const
|
|
1162
|
-
|
|
1163
|
-
const
|
|
1164
|
-
super(
|
|
1165
|
-
const
|
|
1166
|
-
|
|
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
|
|
1174
|
-
|
|
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:
|
|
1183
|
-
let
|
|
1184
|
-
const
|
|
1185
|
-
DirectionalLight:
|
|
1186
|
-
PointLight:
|
|
1187
|
-
SpotLight:
|
|
1188
|
-
HemisphereLight:
|
|
1189
|
-
RectAreaLight:
|
|
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: (
|
|
1192
|
-
if (!
|
|
1193
|
-
|
|
1244
|
+
mounted: (t) => {
|
|
1245
|
+
if (!t.isLight) {
|
|
1246
|
+
we(`${t.type} is not a light`);
|
|
1194
1247
|
return;
|
|
1195
1248
|
}
|
|
1196
|
-
|
|
1249
|
+
U = Dr[t.type], t.parent.add(new U(t, 1, t.color.getHex()));
|
|
1197
1250
|
},
|
|
1198
|
-
updated: (
|
|
1199
|
-
|
|
1251
|
+
updated: (t) => {
|
|
1252
|
+
k = t.parent.children.find((e) => e instanceof U), !(k instanceof Ie) && k.update();
|
|
1200
1253
|
},
|
|
1201
|
-
unmounted: (
|
|
1202
|
-
if (!
|
|
1203
|
-
|
|
1254
|
+
unmounted: (t) => {
|
|
1255
|
+
if (!t.isLight) {
|
|
1256
|
+
we(`${t.type} is not a light`);
|
|
1204
1257
|
return;
|
|
1205
1258
|
}
|
|
1206
|
-
|
|
1259
|
+
k = t.parent.children.find((e) => e instanceof U), k && k.dispose && k.dispose(), t.parent.remove(k);
|
|
1207
1260
|
}
|
|
1208
|
-
}, { logWarning:
|
|
1209
|
-
updated: (
|
|
1210
|
-
const
|
|
1211
|
-
if (!
|
|
1212
|
-
|
|
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:
|
|
1216
|
-
|
|
1217
|
-
|
|
1268
|
+
const { onLoop: s } = ae();
|
|
1269
|
+
s(() => {
|
|
1270
|
+
t.lookAt(r);
|
|
1218
1271
|
});
|
|
1219
1272
|
}
|
|
1220
|
-
}, { logWarning:
|
|
1221
|
-
updated: (
|
|
1222
|
-
var
|
|
1223
|
-
const
|
|
1224
|
-
if (!
|
|
1225
|
-
|
|
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
|
-
|
|
1229
|
-
const
|
|
1230
|
-
|
|
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:",
|
|
1233
|
-
[`origin: ${
|
|
1234
|
-
[`Destiny: ${
|
|
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: (
|
|
1239
|
-
|
|
1291
|
+
unmounted: (t) => {
|
|
1292
|
+
S == null || S.dispose(), t.parent.remove(S);
|
|
1240
1293
|
}
|
|
1241
1294
|
};
|
|
1242
|
-
let
|
|
1295
|
+
let S = null;
|
|
1243
1296
|
const Zr = {
|
|
1244
|
-
install(
|
|
1245
|
-
|
|
1297
|
+
install(t) {
|
|
1298
|
+
t.component("TresCanvas", Or);
|
|
1246
1299
|
}
|
|
1247
1300
|
};
|
|
1248
1301
|
export {
|
|
1249
|
-
|
|
1250
|
-
|
|
1302
|
+
Or as TresCanvas,
|
|
1303
|
+
re as catalogue,
|
|
1251
1304
|
Zr as default,
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1305
|
+
ne as extend,
|
|
1306
|
+
Wr as isProd,
|
|
1307
|
+
Xt as normalizeColor,
|
|
1308
|
+
Ur as normalizeVectorFlexibleParam,
|
|
1256
1309
|
Qr as templateCompilerOptions,
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
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
|
-
|
|
1269
|
-
|
|
1321
|
+
yr as useTresContext,
|
|
1322
|
+
hr as useTresContextProvider,
|
|
1270
1323
|
Kr as vAlwaysLookAt,
|
|
1271
1324
|
Xr as vDistanceTo,
|
|
1272
1325
|
qr as vLightHelper,
|