@tresjs/core 4.0.0-next.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/index.d.ts +3 -17
- package/dist/{components → src/components}/TresCanvas.vue.d.ts +10 -2
- package/dist/{composables → src/composables}/useCamera/index.d.ts +12 -12
- package/dist/src/composables/usePointerEventHandler/index.d.ts +17 -0
- package/dist/{composables → src/composables}/useRaycaster/index.d.ts +3 -3
- package/dist/{composables → src/composables}/useRenderer/const.d.ts +4 -0
- package/dist/{composables → 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 +75 -0
- package/dist/src/core/nodeOps.d.ts +4 -0
- package/dist/src/directives/index.d.ts +5 -0
- package/dist/src/directives/vAlwaysLookAt.d.ts +6 -0
- package/dist/src/directives/vDistanceTo.d.ts +6 -0
- package/dist/src/directives/vLightHelper.d.ts +6 -0
- package/dist/src/directives/vLog.d.ts +6 -0
- package/dist/src/index.d.ts +18 -0
- package/dist/{types → src/types}/index.d.ts +20 -16
- package/dist/{utils → src/utils}/index.d.ts +3 -2
- package/dist/tres.js +938 -665
- package/dist/tres.umd.cjs +3 -3
- package/package.json +20 -20
- package/dist/composables/usePointerEventHandler/index.d.ts +0 -19
- package/dist/composables/useTresContextProvider/index.d.ts +0 -44
- package/dist/core/nodeOps.d.ts +0 -3
- package/dist/core/renderer.d.ts +0 -5
- /package/dist/{components → src/components}/index.d.ts +0 -0
- /package/dist/{composables → src/composables}/index.d.ts +0 -0
- /package/dist/{composables → src/composables}/useLoader/index.d.ts +0 -0
- /package/dist/{composables → src/composables}/useLogger.d.ts +0 -0
- /package/dist/{composables → src/composables}/useRenderLoop/index.d.ts +0 -0
- /package/dist/{composables → src/composables}/useSeek/index.d.ts +0 -0
- /package/dist/{composables → src/composables}/useTexture/index.d.ts +0 -0
- /package/dist/{core → src/core}/catalogue.d.ts +0 -0
- /package/dist/{core → src/core}/revision.d.ts +0 -0
- /package/dist/{devtools → src/devtools}/highlight.d.ts +0 -0
- /package/dist/{devtools → src/devtools}/index.d.ts +0 -0
- /package/dist/{devtools → src/devtools}/plugin.d.ts +0 -0
- /package/dist/{devtools → src/devtools}/utils.d.ts +0 -0
- /package/dist/{utils → src/utils}/normalize.d.ts +0 -0
- /package/dist/{utils → src/utils}/perf.d.ts +0 -0
- /package/dist/{utils → src/utils}/template-compiler-options.d.ts +0 -0
- /package/dist/{utils → src/utils}/test-utils.d.ts +0 -0
package/dist/tres.js
CHANGED
|
@@ -1,490 +1,640 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version: v4.0.0-next.
|
|
4
|
-
* (c)
|
|
3
|
+
* version: v4.0.0-next.1
|
|
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
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
+
"vue",
|
|
17
|
+
"3d",
|
|
18
|
+
"threejs",
|
|
19
|
+
"three",
|
|
20
|
+
"threejs-vue"
|
|
21
|
+
], Dt = !1, It = {
|
|
22
|
+
".": {
|
|
23
|
+
types: "./dist/index.d.ts",
|
|
24
|
+
require: "./dist/tres.umd.cjs",
|
|
25
|
+
import: "./dist/tres.js"
|
|
26
|
+
},
|
|
27
|
+
"./components": {
|
|
28
|
+
types: "./dist/components/index.d.ts"
|
|
29
|
+
},
|
|
30
|
+
"./composables": {
|
|
31
|
+
types: "./dist/composables/index.d.ts"
|
|
32
|
+
},
|
|
33
|
+
"./types": {
|
|
34
|
+
types: "./dist/types/index.d.ts"
|
|
35
|
+
},
|
|
36
|
+
"./utils": {
|
|
37
|
+
types: "./dist/utils/index.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"./*": "./*"
|
|
40
|
+
}, Rt = "./dist/tres.js", $t = "./dist/tres.js", Ht = "./dist/index.d.ts", Nt = [
|
|
41
|
+
"dist",
|
|
42
|
+
"*.d.ts"
|
|
43
|
+
], Ft = {
|
|
44
|
+
access: "public"
|
|
45
|
+
}, Wt = {
|
|
46
|
+
dev: "cd playground && npm run dev",
|
|
47
|
+
build: "vite build",
|
|
48
|
+
playground: "cd playground && npm run dev",
|
|
49
|
+
test: "vitest",
|
|
50
|
+
"test:ci": "vitest run",
|
|
51
|
+
"test:ui": "vitest --ui",
|
|
52
|
+
release: "release-it",
|
|
53
|
+
coverage: "vitest run --coverage",
|
|
54
|
+
lint: "eslint . --ext .js,.jsx,.ts,.tsx,.vue",
|
|
55
|
+
"docs:dev": "vitepress dev docs",
|
|
56
|
+
"docs:build": "vitepress build docs",
|
|
57
|
+
"docs:serve": "vitepress serve docs",
|
|
58
|
+
"docs:preview": "vitepress preview docs",
|
|
59
|
+
"docs:contributors": "esno scripts/update-contributors.ts"
|
|
60
|
+
}, Ut = {
|
|
61
|
+
three: ">=0.133",
|
|
62
|
+
vue: ">=3.4"
|
|
63
|
+
}, Gt = {
|
|
64
|
+
"@alvarosabu/utils": "^3.1.1",
|
|
65
|
+
"@vueuse/core": "^10.7.1"
|
|
66
|
+
}, zt = {
|
|
67
|
+
"@release-it/conventional-changelog": "^8.0.1",
|
|
68
|
+
"@stackblitz/sdk": "^1.9.0",
|
|
69
|
+
"@tresjs/cientos": "3.7.0",
|
|
70
|
+
"@tresjs/eslint-config-vue": "^0.2.1",
|
|
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
|
+
"@vitest/coverage-c8": "^0.33.0",
|
|
76
|
+
"@vitest/ui": "^1.1.1",
|
|
77
|
+
"@vue/test-utils": "^2.4.3",
|
|
78
|
+
eslint: "^8.56.0",
|
|
79
|
+
"eslint-plugin-vue": "^9.19.2",
|
|
80
|
+
esno: "^4.0.0",
|
|
81
|
+
gsap: "^3.12.4",
|
|
82
|
+
jsdom: "^23.0.1",
|
|
83
|
+
kolorist: "^1.8.0",
|
|
84
|
+
ohmyfetch: "^0.4.21",
|
|
85
|
+
pathe: "^1.1.1",
|
|
86
|
+
"release-it": "^17.0.1",
|
|
87
|
+
"rollup-plugin-analyzer": "^4.0.0",
|
|
88
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
89
|
+
"rollup-plugin-visualizer": "^5.12.0",
|
|
90
|
+
three: "^0.160.0",
|
|
91
|
+
unocss: "^0.58.3",
|
|
92
|
+
unplugin: "^1.6.0",
|
|
93
|
+
"unplugin-vue-components": "^0.26.0",
|
|
94
|
+
vite: "^5.0.10",
|
|
95
|
+
"vite-plugin-banner": "^0.7.1",
|
|
96
|
+
"vite-plugin-dts": "3.7.0",
|
|
97
|
+
"vite-plugin-inspect": "^0.8.1",
|
|
98
|
+
"vite-plugin-require-transform": "^1.0.21",
|
|
99
|
+
"vite-svg-loader": "^5.1.0",
|
|
100
|
+
vitepress: "1.0.0-rc.34",
|
|
101
|
+
vitest: "^1.1.1",
|
|
102
|
+
vue: "^3.4.3",
|
|
103
|
+
"vue-demi": "^0.14.6"
|
|
104
|
+
}, Vt = {
|
|
105
|
+
name: kt,
|
|
106
|
+
type: Tt,
|
|
107
|
+
version: Pt,
|
|
108
|
+
packageManager: At,
|
|
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);
|
|
24
133
|
if (!l)
|
|
25
134
|
return;
|
|
26
|
-
const
|
|
27
|
-
|
|
135
|
+
const f = r.value.filter(({ uuid: c }) => c !== l.uuid);
|
|
136
|
+
r.value = [l, ...f];
|
|
28
137
|
};
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
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());
|
|
32
141
|
});
|
|
33
|
-
}),
|
|
34
|
-
|
|
142
|
+
}), J(() => {
|
|
143
|
+
r.value = [];
|
|
35
144
|
}), {
|
|
36
|
-
camera:
|
|
37
|
-
cameras:
|
|
38
|
-
registerCamera:
|
|
39
|
-
deregisterCamera:
|
|
40
|
-
setCameraActive:
|
|
145
|
+
camera: s,
|
|
146
|
+
cameras: r,
|
|
147
|
+
registerCamera: o,
|
|
148
|
+
deregisterCamera: i,
|
|
149
|
+
setCameraActive: n
|
|
41
150
|
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
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(
|
|
45
158
|
() => {
|
|
46
|
-
|
|
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 });
|
|
47
160
|
},
|
|
48
161
|
{ immediate: !1 }
|
|
49
162
|
);
|
|
50
|
-
|
|
51
|
-
|
|
163
|
+
ie.on(() => {
|
|
164
|
+
z = R.getDelta(), V = R.getElapsedTime();
|
|
52
165
|
});
|
|
53
|
-
const
|
|
54
|
-
onBeforeLoop:
|
|
55
|
-
onLoop:
|
|
56
|
-
onAfterLoop:
|
|
57
|
-
pause:
|
|
58
|
-
resume:
|
|
59
|
-
isActive:
|
|
60
|
-
}),
|
|
61
|
-
function
|
|
62
|
-
function
|
|
63
|
-
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 || "");
|
|
64
177
|
}
|
|
65
|
-
function
|
|
66
|
-
console.warn(`${
|
|
178
|
+
function e(s) {
|
|
179
|
+
console.warn(`${me} ${s}`);
|
|
67
180
|
}
|
|
68
|
-
function
|
|
181
|
+
function r(s, o) {
|
|
69
182
|
}
|
|
70
183
|
return {
|
|
71
|
-
logError:
|
|
72
|
-
logWarning:
|
|
73
|
-
logMessage:
|
|
184
|
+
logError: t,
|
|
185
|
+
logWarning: e,
|
|
186
|
+
logMessage: r
|
|
74
187
|
};
|
|
75
188
|
}
|
|
76
|
-
function
|
|
77
|
-
return typeof
|
|
189
|
+
function Ur(t) {
|
|
190
|
+
return typeof t == "number" ? [t, t, t] : t instanceof _e ? [t.x, t.y, t.z] : t;
|
|
78
191
|
}
|
|
79
|
-
function
|
|
80
|
-
return
|
|
192
|
+
function Xt(t) {
|
|
193
|
+
return t instanceof G ? t : Array.isArray(t) ? new G(...t) : new G(t);
|
|
81
194
|
}
|
|
82
|
-
class
|
|
83
|
-
constructor(...
|
|
84
|
-
super(...
|
|
85
|
-
|
|
86
|
-
|
|
195
|
+
class Zt extends Me.Mesh {
|
|
196
|
+
constructor(...r) {
|
|
197
|
+
super(...r);
|
|
198
|
+
Y(this, "type", "HightlightMesh");
|
|
199
|
+
Y(this, "createTime");
|
|
87
200
|
this.createTime = Date.now();
|
|
88
201
|
}
|
|
89
202
|
onBeforeRender() {
|
|
90
|
-
const
|
|
91
|
-
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);
|
|
92
205
|
}
|
|
93
206
|
}
|
|
94
|
-
const
|
|
95
|
-
for (const
|
|
96
|
-
r
|
|
97
|
-
return Object.assign(
|
|
98
|
-
},
|
|
99
|
-
function
|
|
100
|
-
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;
|
|
101
214
|
}
|
|
102
|
-
function
|
|
103
|
-
return
|
|
215
|
+
function F(t) {
|
|
216
|
+
return t.replace(/-([a-z])/g, (e, r) => r.toUpperCase());
|
|
104
217
|
}
|
|
105
|
-
function
|
|
106
|
-
const
|
|
107
|
-
for (let
|
|
108
|
-
|
|
109
|
-
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];
|
|
110
223
|
}
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
-
for (const
|
|
114
|
-
const
|
|
115
|
-
|
|
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));
|
|
116
229
|
}
|
|
117
|
-
return
|
|
118
|
-
},
|
|
119
|
-
if (!
|
|
230
|
+
return s;
|
|
231
|
+
}, ge = (t, e) => {
|
|
232
|
+
if (!e)
|
|
120
233
|
return;
|
|
121
|
-
const
|
|
122
|
-
return
|
|
123
|
-
},
|
|
124
|
-
const
|
|
125
|
-
|
|
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);
|
|
126
239
|
};
|
|
127
|
-
function
|
|
128
|
-
if (
|
|
129
|
-
const
|
|
130
|
-
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);
|
|
131
244
|
}
|
|
132
|
-
if (
|
|
245
|
+
if (t === e)
|
|
133
246
|
return !0;
|
|
134
|
-
if (
|
|
247
|
+
if (t === null || typeof t != "object" || e === null || typeof e != "object")
|
|
135
248
|
return !1;
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
249
|
+
const r = Object.keys(t), s = Object.keys(e);
|
|
250
|
+
if (r.length !== s.length)
|
|
138
251
|
return !1;
|
|
139
|
-
for (const
|
|
140
|
-
if (!
|
|
252
|
+
for (const o of r)
|
|
253
|
+
if (!s.includes(o) || !Pe(t[o], e[o]))
|
|
141
254
|
return !1;
|
|
142
255
|
return !0;
|
|
143
256
|
}
|
|
144
|
-
function
|
|
145
|
-
if (!Array.isArray(
|
|
257
|
+
function sr(t, e) {
|
|
258
|
+
if (!Array.isArray(t) || !Array.isArray(e) || t.length !== e.length)
|
|
146
259
|
return !1;
|
|
147
|
-
for (let
|
|
148
|
-
if (!
|
|
260
|
+
for (let r = 0; r < t.length; r++)
|
|
261
|
+
if (!Pe(t[r], e[r]))
|
|
149
262
|
return !1;
|
|
150
263
|
return !0;
|
|
151
264
|
}
|
|
152
|
-
const
|
|
153
|
-
function
|
|
154
|
-
const
|
|
155
|
-
if (l.uuid ===
|
|
265
|
+
const ir = Array.isArray;
|
|
266
|
+
function ar(t, e, r, s) {
|
|
267
|
+
const o = (l) => {
|
|
268
|
+
if (l.uuid === e)
|
|
156
269
|
return l;
|
|
157
|
-
for (const
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
160
|
-
return
|
|
270
|
+
for (const f of l.children) {
|
|
271
|
+
const c = o(f);
|
|
272
|
+
if (c)
|
|
273
|
+
return c;
|
|
161
274
|
}
|
|
162
|
-
},
|
|
163
|
-
if (!
|
|
275
|
+
}, i = o(t);
|
|
276
|
+
if (!i) {
|
|
164
277
|
console.warn("Object with UUID not found in the scene.");
|
|
165
278
|
return;
|
|
166
279
|
}
|
|
167
|
-
let
|
|
168
|
-
for (let l = 0; l <
|
|
169
|
-
if (
|
|
170
|
-
|
|
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]];
|
|
171
284
|
else {
|
|
172
|
-
console.warn(`Property path is not valid: ${
|
|
285
|
+
console.warn(`Property path is not valid: ${r.join(".")}`);
|
|
173
286
|
return;
|
|
174
287
|
}
|
|
175
|
-
const
|
|
176
|
-
|
|
288
|
+
const a = r[r.length - 1];
|
|
289
|
+
n[a] !== void 0 ? n[a] = s : console.warn(`Property path is not valid: ${r.join(".")}`);
|
|
177
290
|
}
|
|
178
|
-
function
|
|
179
|
-
const
|
|
291
|
+
function lr(t) {
|
|
292
|
+
const e = new Ee({
|
|
180
293
|
color: 11003607,
|
|
181
294
|
// Highlight color, e.g., yellow
|
|
182
295
|
transparent: !0,
|
|
183
296
|
opacity: 0.2,
|
|
184
297
|
depthTest: !1,
|
|
185
298
|
// So the highlight is always visible
|
|
186
|
-
side:
|
|
299
|
+
side: Ze
|
|
187
300
|
// To e
|
|
188
301
|
});
|
|
189
|
-
return new
|
|
302
|
+
return new Zt(t.geometry.clone(), e);
|
|
303
|
+
}
|
|
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;
|
|
190
308
|
}
|
|
191
|
-
const
|
|
309
|
+
const ur = Number.parseInt(et.replace("dev", "")), W = {
|
|
192
310
|
realistic: {
|
|
193
311
|
shadows: !0,
|
|
194
312
|
physicallyCorrectLights: !0,
|
|
195
|
-
outputColorSpace:
|
|
196
|
-
toneMapping:
|
|
313
|
+
outputColorSpace: tt,
|
|
314
|
+
toneMapping: Ce,
|
|
197
315
|
toneMappingExposure: 3,
|
|
198
316
|
shadowMap: {
|
|
199
317
|
enabled: !0,
|
|
200
|
-
type:
|
|
318
|
+
type: rt
|
|
201
319
|
}
|
|
320
|
+
},
|
|
321
|
+
flat: {
|
|
322
|
+
toneMapping: nt,
|
|
323
|
+
toneMappingExposure: 1
|
|
202
324
|
}
|
|
203
325
|
};
|
|
204
|
-
function
|
|
205
|
-
scene:
|
|
206
|
-
canvas:
|
|
207
|
-
options:
|
|
208
|
-
disableRender:
|
|
209
|
-
|
|
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 }
|
|
210
333
|
}) {
|
|
211
|
-
const
|
|
212
|
-
alpha:
|
|
213
|
-
depth:
|
|
214
|
-
canvas:
|
|
215
|
-
context:
|
|
216
|
-
stencil:
|
|
217
|
-
antialias:
|
|
218
|
-
precision:
|
|
219
|
-
powerPreference:
|
|
220
|
-
premultipliedAlpha:
|
|
221
|
-
preserveDrawingBuffer:
|
|
222
|
-
logarithmicDepthBuffer:
|
|
223
|
-
failIfMajorPerformanceCaveat:
|
|
224
|
-
})),
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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);
|
|
233
361
|
});
|
|
234
|
-
const { logError:
|
|
235
|
-
|
|
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 = {
|
|
236
368
|
shadowMap: {
|
|
237
|
-
enabled:
|
|
238
|
-
type:
|
|
369
|
+
enabled: w.shadowMap.enabled,
|
|
370
|
+
type: w.shadowMap.type
|
|
239
371
|
},
|
|
240
|
-
toneMapping:
|
|
241
|
-
toneMappingExposure:
|
|
242
|
-
outputColorSpace:
|
|
372
|
+
toneMapping: w.toneMapping,
|
|
373
|
+
toneMappingExposure: w.toneMappingExposure,
|
|
374
|
+
outputColorSpace: w.outputColorSpace
|
|
243
375
|
};
|
|
244
|
-
return
|
|
245
|
-
})();
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
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);
|
|
253
387
|
};
|
|
254
|
-
if (
|
|
255
|
-
return
|
|
256
|
-
const
|
|
257
|
-
return
|
|
258
|
-
},
|
|
259
|
-
|
|
260
|
-
const C =
|
|
261
|
-
C &&
|
|
262
|
-
C ?
|
|
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)
|
|
263
397
|
// default clear color is not easily/efficiently retrievable from three
|
|
264
398
|
);
|
|
265
|
-
})
|
|
266
|
-
|
|
267
|
-
return _(() => {
|
|
268
|
-
s.value && !E(n) && i.value.render(e, s.value);
|
|
269
|
-
}), g(), U(() => {
|
|
270
|
-
u(), i.value.dispose(), i.value.forceContextLoss();
|
|
399
|
+
}), J(() => {
|
|
400
|
+
u.value.dispose(), u.value.forceContextLoss();
|
|
271
401
|
}), {
|
|
272
|
-
renderer:
|
|
402
|
+
renderer: u
|
|
273
403
|
};
|
|
274
404
|
}
|
|
275
|
-
const
|
|
276
|
-
function
|
|
277
|
-
const
|
|
278
|
-
return
|
|
279
|
-
|
|
280
|
-
}),
|
|
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;
|
|
281
411
|
}
|
|
282
|
-
async function
|
|
283
|
-
const { logError:
|
|
284
|
-
|
|
285
|
-
const l = (Array.isArray(
|
|
286
|
-
(
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
(
|
|
290
|
-
|
|
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);
|
|
291
421
|
},
|
|
292
|
-
|
|
293
|
-
(
|
|
422
|
+
s,
|
|
423
|
+
(d) => u(i("[useLoader] - Failed to load resource", d))
|
|
294
424
|
);
|
|
295
425
|
})
|
|
296
426
|
);
|
|
297
|
-
return
|
|
427
|
+
return dr(e) ? await Promise.all(l) : await l[0];
|
|
298
428
|
}
|
|
299
|
-
async function
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
(
|
|
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),
|
|
304
434
|
() => null,
|
|
305
435
|
() => {
|
|
306
|
-
|
|
436
|
+
n(new Error("[useTextures] - Failed to load texture"));
|
|
307
437
|
}
|
|
308
438
|
);
|
|
309
439
|
});
|
|
310
|
-
if (
|
|
311
|
-
const
|
|
312
|
-
return
|
|
440
|
+
if (ir(t)) {
|
|
441
|
+
const o = await Promise.all(t.map((i) => s(i)));
|
|
442
|
+
return t.length > 1 ? o : o[0];
|
|
313
443
|
} else {
|
|
314
444
|
const {
|
|
315
|
-
map:
|
|
316
|
-
displacementMap:
|
|
317
|
-
normalMap:
|
|
318
|
-
roughnessMap:
|
|
445
|
+
map: o,
|
|
446
|
+
displacementMap: i,
|
|
447
|
+
normalMap: n,
|
|
448
|
+
roughnessMap: a,
|
|
319
449
|
metalnessMap: l,
|
|
320
|
-
aoMap:
|
|
321
|
-
alphaMap:
|
|
322
|
-
matcap:
|
|
323
|
-
} =
|
|
450
|
+
aoMap: f,
|
|
451
|
+
alphaMap: c,
|
|
452
|
+
matcap: u
|
|
453
|
+
} = t;
|
|
324
454
|
return {
|
|
325
|
-
map:
|
|
326
|
-
displacementMap:
|
|
327
|
-
normalMap:
|
|
328
|
-
roughnessMap:
|
|
329
|
-
metalnessMap: l ? await
|
|
330
|
-
aoMap:
|
|
331
|
-
alphaMap:
|
|
332
|
-
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
|
|
333
463
|
};
|
|
334
464
|
}
|
|
335
465
|
}
|
|
336
|
-
const
|
|
337
|
-
const
|
|
338
|
-
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)
|
|
339
469
|
return {
|
|
340
|
-
x: (
|
|
341
|
-
y: -((
|
|
470
|
+
x: (m - l.value) / i.value * 2 - 1,
|
|
471
|
+
y: -((v - a.value) / n.value) * 2 + 1
|
|
342
472
|
};
|
|
343
|
-
},
|
|
344
|
-
if (
|
|
345
|
-
return
|
|
346
|
-
},
|
|
347
|
-
const
|
|
348
|
-
x: (
|
|
349
|
-
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
|
|
350
480
|
});
|
|
351
|
-
return
|
|
352
|
-
},
|
|
353
|
-
|
|
354
|
-
},
|
|
355
|
-
|
|
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);
|
|
356
486
|
};
|
|
357
|
-
let
|
|
358
|
-
const
|
|
359
|
-
var
|
|
360
|
-
|
|
361
|
-
},
|
|
362
|
-
var
|
|
363
|
-
|
|
364
|
-
},
|
|
365
|
-
return
|
|
366
|
-
|
|
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));
|
|
367
497
|
}), {
|
|
368
|
-
intersects:
|
|
369
|
-
onClick: (
|
|
370
|
-
onPointerMove: (
|
|
498
|
+
intersects: d,
|
|
499
|
+
onClick: (m) => p.on(m).off,
|
|
500
|
+
onPointerMove: (m) => h.on(m).off
|
|
371
501
|
};
|
|
372
502
|
};
|
|
373
|
-
function
|
|
374
|
-
const { logWarning:
|
|
375
|
-
function
|
|
503
|
+
function Vr() {
|
|
504
|
+
const { logWarning: t } = P();
|
|
505
|
+
function e(i, n, a) {
|
|
376
506
|
let l = null;
|
|
377
|
-
return
|
|
378
|
-
|
|
379
|
-
}), l ||
|
|
507
|
+
return i.traverse((f) => {
|
|
508
|
+
f[n] === a && (l = f);
|
|
509
|
+
}), l || t(`Child with ${n} '${a}' not found.`), l;
|
|
380
510
|
}
|
|
381
|
-
function
|
|
511
|
+
function r(i, n, a) {
|
|
382
512
|
const l = [];
|
|
383
|
-
return
|
|
384
|
-
|
|
385
|
-
}), 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;
|
|
386
516
|
}
|
|
387
|
-
function
|
|
388
|
-
return
|
|
517
|
+
function s(i, n) {
|
|
518
|
+
return e(i, "name", n);
|
|
389
519
|
}
|
|
390
|
-
function
|
|
391
|
-
return
|
|
520
|
+
function o(i, n) {
|
|
521
|
+
return r(i, "name", n);
|
|
392
522
|
}
|
|
393
523
|
return {
|
|
394
|
-
seek:
|
|
395
|
-
seekByName:
|
|
396
|
-
seekAll:
|
|
397
|
-
seekAllByName:
|
|
524
|
+
seek: e,
|
|
525
|
+
seekByName: s,
|
|
526
|
+
seekAll: r,
|
|
527
|
+
seekAllByName: o
|
|
398
528
|
};
|
|
399
529
|
}
|
|
400
|
-
const
|
|
401
|
-
const
|
|
530
|
+
const mr = (t) => {
|
|
531
|
+
const e = be({
|
|
402
532
|
click: /* @__PURE__ */ new Map(),
|
|
403
533
|
pointerMove: /* @__PURE__ */ new Map(),
|
|
404
534
|
pointerEnter: /* @__PURE__ */ new Map(),
|
|
405
535
|
pointerLeave: /* @__PURE__ */ new Map()
|
|
406
|
-
}),
|
|
407
|
-
|
|
408
|
-
}, s = (u) => {
|
|
409
|
-
n.value.delete(u);
|
|
536
|
+
}), r = T(/* @__PURE__ */ new Set()), s = (u) => {
|
|
537
|
+
r.value.add(u);
|
|
410
538
|
}, o = (u) => {
|
|
411
|
-
|
|
539
|
+
r.value.delete(u);
|
|
412
540
|
}, i = (u) => {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
() =>
|
|
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(
|
|
419
547
|
[
|
|
420
|
-
...Array.from(
|
|
421
|
-
...Object.values(
|
|
548
|
+
...Array.from(r.value),
|
|
549
|
+
...Object.values(e).map((u) => Array.from(u.keys())).flat()
|
|
422
550
|
],
|
|
423
551
|
({ uuid: u }) => u
|
|
424
552
|
)
|
|
425
|
-
)
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
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));
|
|
429
559
|
});
|
|
430
|
-
let
|
|
431
|
-
return
|
|
432
|
-
var
|
|
433
|
-
const
|
|
434
|
-
|
|
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;
|
|
435
565
|
}), {
|
|
436
|
-
registerObject:
|
|
437
|
-
deregisterObject:
|
|
566
|
+
registerObject: n,
|
|
567
|
+
deregisterObject: i,
|
|
568
|
+
registerBlockingObject: s,
|
|
569
|
+
deregisterBlockingObject: o
|
|
438
570
|
};
|
|
439
571
|
};
|
|
440
|
-
function
|
|
441
|
-
let
|
|
442
|
-
return
|
|
443
|
-
if (
|
|
444
|
-
const
|
|
445
|
-
|
|
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;
|
|
446
578
|
}
|
|
447
|
-
}),
|
|
579
|
+
}), e;
|
|
448
580
|
}
|
|
449
|
-
function
|
|
450
|
-
return (
|
|
581
|
+
function vr(t) {
|
|
582
|
+
return (t / 1024).toFixed(2);
|
|
451
583
|
}
|
|
452
|
-
const
|
|
453
|
-
function
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
windowSize: t,
|
|
457
|
-
disableRender: n,
|
|
458
|
-
rendererOptions: a
|
|
459
|
-
}) {
|
|
460
|
-
const s = k(
|
|
461
|
-
() => E(t) ? rt() : nt(E(r).parentElement)
|
|
462
|
-
), o = k(() => s.value.width.value), i = k(() => s.value.height.value), l = k(() => o.value / i.value), c = {
|
|
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 {
|
|
463
588
|
height: i,
|
|
464
589
|
width: o,
|
|
465
|
-
aspectRatio:
|
|
466
|
-
}
|
|
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
|
|
600
|
+
}) {
|
|
601
|
+
const { logWarning: n } = P(), a = $(t), l = gr(r, e), {
|
|
467
602
|
camera: f,
|
|
468
|
-
cameras:
|
|
469
|
-
registerCamera:
|
|
470
|
-
deregisterCamera:
|
|
471
|
-
setCameraActive:
|
|
472
|
-
} =
|
|
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(
|
|
473
621
|
{
|
|
474
|
-
scene:
|
|
475
|
-
canvas:
|
|
476
|
-
options:
|
|
477
|
-
|
|
478
|
-
|
|
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
|
|
479
629
|
}
|
|
480
|
-
),
|
|
481
|
-
sizes:
|
|
482
|
-
scene:
|
|
630
|
+
), g = {
|
|
631
|
+
sizes: l,
|
|
632
|
+
scene: a,
|
|
483
633
|
camera: f,
|
|
484
|
-
cameras:
|
|
485
|
-
renderer:
|
|
486
|
-
raycaster:
|
|
487
|
-
controls:
|
|
634
|
+
cameras: Z(c),
|
|
635
|
+
renderer: b,
|
|
636
|
+
raycaster: $(new at()),
|
|
637
|
+
controls: T(null),
|
|
488
638
|
perf: {
|
|
489
639
|
maxFrames: 160,
|
|
490
640
|
fps: {
|
|
@@ -497,432 +647,454 @@ function Tt({
|
|
|
497
647
|
accumulator: []
|
|
498
648
|
}
|
|
499
649
|
},
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
650
|
+
render: h,
|
|
651
|
+
advance: y,
|
|
652
|
+
extend: ne,
|
|
653
|
+
invalidate: _,
|
|
654
|
+
registerCamera: u,
|
|
655
|
+
setCameraActive: p,
|
|
656
|
+
deregisterCamera: d
|
|
504
657
|
};
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
let v = performance.now();
|
|
508
|
-
const b = ({ timestamp: I }) => {
|
|
509
|
-
p.scene.value && (p.perf.memory.allocatedMem = ve(p.scene.value)), I - v >= C && (v = I, p.perf.fps.accumulator.push(M.value), p.perf.fps.accumulator.length > S && p.perf.fps.accumulator.shift(), p.perf.fps.value = M.value, P.value && w.value && (p.perf.memory.accumulator.push(w.value.usedJSHeapSize / 1024 / 1024), p.perf.memory.accumulator.length > S && p.perf.memory.accumulator.shift(), p.perf.memory.currentMem = p.perf.memory.accumulator.reduce((Ee, Ce) => Ee + Ce, 0) / p.perf.memory.accumulator.length));
|
|
658
|
+
ee("useTres", g), g.scene.value.__tres = {
|
|
659
|
+
root: g
|
|
510
660
|
};
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
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));
|
|
514
669
|
}, { immediate: !0 });
|
|
515
|
-
return
|
|
516
|
-
|
|
517
|
-
}),
|
|
670
|
+
return J(() => {
|
|
671
|
+
N();
|
|
672
|
+
}), g;
|
|
518
673
|
}
|
|
519
|
-
function
|
|
520
|
-
const
|
|
521
|
-
if (!
|
|
674
|
+
function yr() {
|
|
675
|
+
const t = Fe("useTres");
|
|
676
|
+
if (!t)
|
|
522
677
|
throw new Error("useTresContext must be used together with useTresContextProvider");
|
|
523
|
-
return
|
|
678
|
+
return t;
|
|
524
679
|
}
|
|
525
|
-
const
|
|
526
|
-
|
|
527
|
-
const { logError: se } = j(), W = [
|
|
680
|
+
const Jr = yr;
|
|
681
|
+
const { logError: he } = P(), X = [
|
|
528
682
|
"onClick",
|
|
529
683
|
"onPointerMove",
|
|
530
684
|
"onPointerEnter",
|
|
531
685
|
"onPointerLeave"
|
|
532
|
-
]
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
insert(e, r) {
|
|
552
|
-
var n, a, s, o;
|
|
553
|
-
r && r.isScene && (h = r);
|
|
554
|
-
const t = r || h;
|
|
555
|
-
if (e != null && e.isObject3D) {
|
|
556
|
-
if (e != null && e.isCamera) {
|
|
557
|
-
if (!(h != null && h.userData.tres__registerCamera))
|
|
558
|
-
throw "could not find tres__registerCamera on scene's userData";
|
|
559
|
-
(a = h == null ? void 0 : (n = h.userData).tres__registerCamera) == null || a.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);
|
|
560
705
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
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);
|
|
565
723
|
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
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;
|
|
572
736
|
if (e.isObject3D) {
|
|
573
|
-
const
|
|
574
|
-
var
|
|
575
|
-
const
|
|
576
|
-
|
|
577
|
-
}, s = h == null ? void 0 : h.userData.tres__deregisterAtPointerEventHandler, o = h == null ? void 0 : h.userData.tres__deregisterBlockingObjectAtPointerEventHandler, i = (c) => {
|
|
578
|
-
var m, f;
|
|
579
|
-
if (!o)
|
|
580
|
-
throw "could not find tres__deregisterBlockingObjectAtPointerEventHandler on scene's userData";
|
|
581
|
-
if ((f = h == null ? void 0 : (m = h.userData).tres__deregisterBlockingObjectAtPointerEventHandler) == null || f.call(m, c), !s)
|
|
582
|
-
throw "could not find tres__deregisterAtPointerEventHandler on scene's userData";
|
|
583
|
-
c && W.some((u) => c[u]) && (s == null || s(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);
|
|
584
741
|
}, l = (c) => {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
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));
|
|
589
746
|
};
|
|
590
|
-
(
|
|
591
|
-
a(c),
|
|
592
|
-
}), a(
|
|
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);
|
|
593
750
|
}
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
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)));
|
|
613
781
|
return;
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
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);
|
|
628
802
|
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
function Dt() {
|
|
647
|
-
return he().__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__;
|
|
648
820
|
}
|
|
649
|
-
function
|
|
821
|
+
function Be() {
|
|
650
822
|
return typeof navigator < "u" && typeof window < "u" ? window : typeof global < "u" ? global : {};
|
|
651
823
|
}
|
|
652
|
-
const
|
|
653
|
-
let
|
|
654
|
-
function
|
|
655
|
-
var
|
|
656
|
-
return
|
|
824
|
+
const br = typeof Proxy == "function", Mr = "devtools-plugin:setup", _r = "plugin:settings:set";
|
|
825
|
+
let j, oe;
|
|
826
|
+
function Er() {
|
|
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;
|
|
657
829
|
}
|
|
658
|
-
function
|
|
659
|
-
return
|
|
830
|
+
function Cr() {
|
|
831
|
+
return Er() ? oe.now() : Date.now();
|
|
660
832
|
}
|
|
661
|
-
class
|
|
662
|
-
constructor(
|
|
663
|
-
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin =
|
|
664
|
-
const
|
|
665
|
-
if (
|
|
666
|
-
for (const
|
|
667
|
-
const
|
|
668
|
-
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;
|
|
669
841
|
}
|
|
670
|
-
const
|
|
671
|
-
let
|
|
842
|
+
const o = `__vue-devtools-plugin-settings__${e.id}`;
|
|
843
|
+
let i = Object.assign({}, s);
|
|
672
844
|
try {
|
|
673
|
-
const
|
|
674
|
-
Object.assign(
|
|
845
|
+
const n = localStorage.getItem(o), a = JSON.parse(n);
|
|
846
|
+
Object.assign(i, a);
|
|
675
847
|
} catch {
|
|
676
848
|
}
|
|
677
849
|
this.fallbacks = {
|
|
678
850
|
getSettings() {
|
|
679
|
-
return
|
|
851
|
+
return i;
|
|
680
852
|
},
|
|
681
|
-
setSettings(
|
|
853
|
+
setSettings(n) {
|
|
682
854
|
try {
|
|
683
|
-
localStorage.setItem(
|
|
855
|
+
localStorage.setItem(o, JSON.stringify(n));
|
|
684
856
|
} catch {
|
|
685
857
|
}
|
|
686
|
-
|
|
858
|
+
i = n;
|
|
687
859
|
},
|
|
688
860
|
now() {
|
|
689
|
-
return
|
|
861
|
+
return Cr();
|
|
690
862
|
}
|
|
691
|
-
},
|
|
692
|
-
|
|
863
|
+
}, r && r.on(_r, (n, a) => {
|
|
864
|
+
n === this.plugin.id && this.fallbacks.setSettings(a);
|
|
693
865
|
}), this.proxiedOn = new Proxy({}, {
|
|
694
|
-
get: (
|
|
866
|
+
get: (n, a) => this.target ? this.target.on[a] : (...l) => {
|
|
695
867
|
this.onQueue.push({
|
|
696
|
-
method:
|
|
868
|
+
method: a,
|
|
697
869
|
args: l
|
|
698
870
|
});
|
|
699
871
|
}
|
|
700
872
|
}), this.proxiedTarget = new Proxy({}, {
|
|
701
|
-
get: (
|
|
702
|
-
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,
|
|
703
875
|
args: l,
|
|
704
876
|
resolve: () => {
|
|
705
877
|
}
|
|
706
|
-
}), this.fallbacks[
|
|
878
|
+
}), this.fallbacks[a](...l)) : (...l) => new Promise((f) => {
|
|
707
879
|
this.targetQueue.push({
|
|
708
|
-
method:
|
|
880
|
+
method: a,
|
|
709
881
|
args: l,
|
|
710
|
-
resolve:
|
|
882
|
+
resolve: f
|
|
711
883
|
});
|
|
712
884
|
})
|
|
713
885
|
});
|
|
714
886
|
}
|
|
715
|
-
async setRealTarget(
|
|
716
|
-
this.target =
|
|
717
|
-
for (const
|
|
718
|
-
this.target.on[
|
|
719
|
-
for (const
|
|
720
|
-
|
|
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));
|
|
721
893
|
}
|
|
722
894
|
}
|
|
723
|
-
function
|
|
724
|
-
const
|
|
725
|
-
if (
|
|
726
|
-
|
|
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);
|
|
727
899
|
else {
|
|
728
|
-
const
|
|
729
|
-
(
|
|
730
|
-
pluginDescriptor:
|
|
731
|
-
setupFn:
|
|
732
|
-
proxy:
|
|
733
|
-
}),
|
|
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);
|
|
734
906
|
}
|
|
735
907
|
}
|
|
736
|
-
function
|
|
737
|
-
const
|
|
738
|
-
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);
|
|
739
911
|
}
|
|
740
|
-
const
|
|
741
|
-
const
|
|
742
|
-
id:
|
|
743
|
-
label:
|
|
912
|
+
const je = (t) => {
|
|
913
|
+
const e = {
|
|
914
|
+
id: t.uuid,
|
|
915
|
+
label: t.type,
|
|
744
916
|
children: [],
|
|
745
917
|
tags: []
|
|
746
918
|
};
|
|
747
|
-
|
|
748
|
-
label:
|
|
919
|
+
t.name !== "" && e.tags.push({
|
|
920
|
+
label: t.name,
|
|
749
921
|
textColor: 5750629,
|
|
750
922
|
backgroundColor: 15793395
|
|
751
923
|
});
|
|
752
|
-
const
|
|
753
|
-
return
|
|
754
|
-
label: `${
|
|
924
|
+
const r = Le(t);
|
|
925
|
+
return r > 0 && e.tags.push({
|
|
926
|
+
label: `${vr(r)} KB`,
|
|
755
927
|
textColor: 15707189,
|
|
756
928
|
backgroundColor: 16775644,
|
|
757
929
|
tooltip: "Memory usage"
|
|
758
|
-
}),
|
|
759
|
-
label: `${
|
|
930
|
+
}), t.type.includes("Light") && (e.tags.push({
|
|
931
|
+
label: `${t.intensity}`,
|
|
760
932
|
textColor: 9738662,
|
|
761
933
|
backgroundColor: 16316922,
|
|
762
934
|
tooltip: "Intensity"
|
|
763
|
-
}),
|
|
764
|
-
label: `#${
|
|
935
|
+
}), e.tags.push({
|
|
936
|
+
label: `#${t.color.getHexString()}`,
|
|
765
937
|
textColor: 9738662,
|
|
766
938
|
backgroundColor: 16316922,
|
|
767
939
|
tooltip: "Color"
|
|
768
|
-
})),
|
|
769
|
-
label: `${
|
|
940
|
+
})), t.type.includes("Camera") && (e.tags.push({
|
|
941
|
+
label: `${t.fov}°`,
|
|
770
942
|
textColor: 9738662,
|
|
771
943
|
backgroundColor: 16316922,
|
|
772
944
|
tooltip: "Field of view"
|
|
773
|
-
}),
|
|
945
|
+
}), e.tags.push({
|
|
774
946
|
// eslint-disable-next-line max-len
|
|
775
|
-
label: `x: ${Math.round(
|
|
947
|
+
label: `x: ${Math.round(t.position.x)} y: ${Math.round(t.position.y)} z: ${Math.round(t.position.z)}`,
|
|
776
948
|
textColor: 9738662,
|
|
777
949
|
backgroundColor: 16316922,
|
|
778
950
|
tooltip: "Position"
|
|
779
|
-
})),
|
|
951
|
+
})), e;
|
|
780
952
|
};
|
|
781
|
-
function
|
|
782
|
-
|
|
783
|
-
if (
|
|
953
|
+
function De(t, e) {
|
|
954
|
+
t.children.forEach((r) => {
|
|
955
|
+
if (r.type === "HightlightMesh")
|
|
784
956
|
return;
|
|
785
|
-
const
|
|
786
|
-
|
|
957
|
+
const s = je(r);
|
|
958
|
+
e.children.push(s), De(r, s);
|
|
787
959
|
});
|
|
788
960
|
}
|
|
789
|
-
const
|
|
961
|
+
const Tr = [], D = "tres:inspector", Pr = be({
|
|
790
962
|
sceneGraph: null
|
|
791
963
|
});
|
|
792
|
-
function
|
|
793
|
-
|
|
964
|
+
function Ar(t, e) {
|
|
965
|
+
xr(
|
|
794
966
|
{
|
|
795
967
|
id: "dev.esm.tres",
|
|
796
968
|
label: "TresJS 🪐",
|
|
797
969
|
logo: "https://raw.githubusercontent.com/Tresjs/tres/main/public/favicon.svg",
|
|
798
970
|
packageName: "tresjs",
|
|
799
971
|
homepage: "https://tresjs.org",
|
|
800
|
-
componentStateTypes:
|
|
801
|
-
app:
|
|
972
|
+
componentStateTypes: Tr,
|
|
973
|
+
app: t
|
|
802
974
|
},
|
|
803
|
-
(
|
|
804
|
-
typeof
|
|
975
|
+
(r) => {
|
|
976
|
+
typeof r.now != "function" && kr(
|
|
805
977
|
// eslint-disable-next-line max-len
|
|
806
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."
|
|
807
|
-
),
|
|
808
|
-
id:
|
|
979
|
+
), r.addInspector({
|
|
980
|
+
id: D,
|
|
809
981
|
label: "TresJS 🪐",
|
|
810
982
|
icon: "account_tree",
|
|
811
983
|
treeFilterPlaceholder: "Search instances"
|
|
812
984
|
}), setInterval(() => {
|
|
813
|
-
|
|
985
|
+
r.sendInspectorTree(D);
|
|
814
986
|
}, 1e3), setInterval(() => {
|
|
815
|
-
|
|
816
|
-
}, 5e3),
|
|
817
|
-
if (
|
|
818
|
-
const
|
|
819
|
-
|
|
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];
|
|
820
992
|
}
|
|
821
993
|
});
|
|
822
|
-
let
|
|
823
|
-
|
|
824
|
-
if (
|
|
825
|
-
const [
|
|
826
|
-
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)
|
|
827
999
|
return;
|
|
828
|
-
if (
|
|
829
|
-
const
|
|
830
|
-
|
|
1000
|
+
if (o && s && s.parent && o.remove(s), n.isMesh) {
|
|
1001
|
+
const a = lr(n);
|
|
1002
|
+
n.add(a), s = a, o = n;
|
|
831
1003
|
}
|
|
832
|
-
|
|
1004
|
+
i.state = {
|
|
833
1005
|
object: [
|
|
834
1006
|
{
|
|
835
1007
|
key: "uuid",
|
|
836
1008
|
editable: !0,
|
|
837
|
-
value:
|
|
1009
|
+
value: n.uuid
|
|
838
1010
|
},
|
|
839
1011
|
{
|
|
840
1012
|
key: "name",
|
|
841
1013
|
editable: !0,
|
|
842
|
-
value:
|
|
1014
|
+
value: n.name
|
|
843
1015
|
},
|
|
844
1016
|
{
|
|
845
1017
|
key: "type",
|
|
846
1018
|
editable: !0,
|
|
847
|
-
value:
|
|
1019
|
+
value: n.type
|
|
848
1020
|
},
|
|
849
1021
|
{
|
|
850
1022
|
key: "position",
|
|
851
1023
|
editable: !0,
|
|
852
|
-
value:
|
|
1024
|
+
value: n.position
|
|
853
1025
|
},
|
|
854
1026
|
{
|
|
855
1027
|
key: "rotation",
|
|
856
1028
|
editable: !0,
|
|
857
|
-
value:
|
|
1029
|
+
value: n.rotation
|
|
858
1030
|
},
|
|
859
1031
|
{
|
|
860
1032
|
key: "scale",
|
|
861
1033
|
editable: !0,
|
|
862
|
-
value:
|
|
1034
|
+
value: n.scale
|
|
863
1035
|
},
|
|
864
1036
|
{
|
|
865
1037
|
key: "geometry",
|
|
866
|
-
value:
|
|
1038
|
+
value: n.geometry
|
|
867
1039
|
},
|
|
868
1040
|
{
|
|
869
1041
|
key: "material",
|
|
870
|
-
value:
|
|
1042
|
+
value: n.material
|
|
871
1043
|
},
|
|
872
1044
|
{
|
|
873
1045
|
key: "color",
|
|
874
1046
|
editable: !0,
|
|
875
|
-
value:
|
|
1047
|
+
value: n.color
|
|
876
1048
|
},
|
|
877
1049
|
{
|
|
878
1050
|
key: "intensity",
|
|
879
1051
|
editable: !0,
|
|
880
|
-
value:
|
|
1052
|
+
value: n.intensity
|
|
881
1053
|
},
|
|
882
1054
|
{
|
|
883
1055
|
key: "castShadow",
|
|
884
1056
|
editable: !0,
|
|
885
|
-
value:
|
|
1057
|
+
value: n.castShadow
|
|
886
1058
|
},
|
|
887
1059
|
{
|
|
888
1060
|
key: "receiveShadow",
|
|
889
1061
|
editable: !0,
|
|
890
|
-
value:
|
|
1062
|
+
value: n.receiveShadow
|
|
891
1063
|
},
|
|
892
1064
|
{
|
|
893
1065
|
key: "frustumCulled",
|
|
894
1066
|
editable: !0,
|
|
895
|
-
value:
|
|
1067
|
+
value: n.frustumCulled
|
|
896
1068
|
},
|
|
897
1069
|
{
|
|
898
1070
|
key: "matrixAutoUpdate",
|
|
899
1071
|
editable: !0,
|
|
900
|
-
value:
|
|
1072
|
+
value: n.matrixAutoUpdate
|
|
901
1073
|
},
|
|
902
1074
|
{
|
|
903
1075
|
key: "matrixWorldNeedsUpdate",
|
|
904
1076
|
editable: !0,
|
|
905
|
-
value:
|
|
1077
|
+
value: n.matrixWorldNeedsUpdate
|
|
906
1078
|
},
|
|
907
1079
|
{
|
|
908
1080
|
key: "matrixWorld",
|
|
909
|
-
value:
|
|
1081
|
+
value: n.matrixWorld
|
|
910
1082
|
},
|
|
911
1083
|
{
|
|
912
1084
|
key: "visible",
|
|
913
1085
|
editable: !0,
|
|
914
|
-
value:
|
|
1086
|
+
value: n.visible
|
|
915
1087
|
}
|
|
916
1088
|
]
|
|
917
1089
|
};
|
|
918
1090
|
}
|
|
919
|
-
}),
|
|
920
|
-
|
|
1091
|
+
}), r.on.editInspectorState((i) => {
|
|
1092
|
+
i.inspectorId === D && ar(e.scene.value, i.nodeId, i.path, i.state.value);
|
|
921
1093
|
});
|
|
922
1094
|
}
|
|
923
1095
|
);
|
|
924
1096
|
}
|
|
925
|
-
const
|
|
1097
|
+
const Lr = ["data-scene", "data-tres"], Or = /* @__PURE__ */ le({
|
|
926
1098
|
__name: "TresCanvas",
|
|
927
1099
|
props: {
|
|
928
1100
|
shadows: { type: Boolean, default: void 0 },
|
|
@@ -932,6 +1104,7 @@ const Gt = ["data-scene"], zt = /* @__PURE__ */ Z({
|
|
|
932
1104
|
useLegacyLights: { type: Boolean, default: void 0 },
|
|
933
1105
|
outputColorSpace: {},
|
|
934
1106
|
toneMappingExposure: {},
|
|
1107
|
+
renderMode: { default: "always" },
|
|
935
1108
|
camera: {},
|
|
936
1109
|
preset: {},
|
|
937
1110
|
windowSize: { type: Boolean, default: void 0 },
|
|
@@ -948,107 +1121,207 @@ const Gt = ["data-scene"], zt = /* @__PURE__ */ Z({
|
|
|
948
1121
|
logarithmicDepthBuffer: { type: Boolean, default: void 0 },
|
|
949
1122
|
failIfMajorPerformanceCaveat: { type: Boolean, default: void 0 }
|
|
950
1123
|
},
|
|
951
|
-
|
|
1124
|
+
emits: ["render"],
|
|
1125
|
+
setup(t, { expose: e, emit: r }) {
|
|
952
1126
|
var _;
|
|
953
|
-
const
|
|
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({
|
|
954
1130
|
setup() {
|
|
955
|
-
var
|
|
956
|
-
const
|
|
957
|
-
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() : []);
|
|
958
1134
|
}
|
|
959
|
-
}),
|
|
960
|
-
const
|
|
961
|
-
|
|
962
|
-
},
|
|
963
|
-
|
|
964
|
-
},
|
|
965
|
-
return
|
|
966
|
-
const
|
|
967
|
-
|
|
968
|
-
scene:
|
|
969
|
-
canvas:
|
|
970
|
-
windowSize:
|
|
971
|
-
disableRender:
|
|
972
|
-
rendererOptions:
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
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(
|
|
978
1155
|
45,
|
|
979
1156
|
window.innerWidth / window.innerHeight,
|
|
980
1157
|
0.1,
|
|
981
1158
|
1e3
|
|
982
1159
|
);
|
|
983
|
-
|
|
984
|
-
const
|
|
985
|
-
|
|
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());
|
|
986
1163
|
});
|
|
987
1164
|
};
|
|
988
|
-
|
|
989
|
-
() =>
|
|
990
|
-
(
|
|
991
|
-
|
|
1165
|
+
I(
|
|
1166
|
+
() => s.camera,
|
|
1167
|
+
(v, C) => {
|
|
1168
|
+
v && b(v), C && (C.removeFromParent(), w(C));
|
|
992
1169
|
},
|
|
993
1170
|
{
|
|
994
1171
|
immediate: !0
|
|
995
1172
|
}
|
|
996
|
-
),
|
|
997
|
-
|
|
998
|
-
), P());
|
|
999
|
-
}), (d, y) => (xe(), De("canvas", {
|
|
1173
|
+
), g.value || m();
|
|
1174
|
+
}), (y, b) => (Ge(), ze("canvas", {
|
|
1000
1175
|
ref_key: "canvas",
|
|
1001
|
-
ref:
|
|
1002
|
-
"data-scene":
|
|
1003
|
-
class:
|
|
1004
|
-
|
|
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({
|
|
1005
1181
|
display: "block",
|
|
1006
1182
|
width: "100%",
|
|
1007
1183
|
height: "100%",
|
|
1008
|
-
position:
|
|
1184
|
+
position: y.windowSize ? "fixed" : "relative",
|
|
1009
1185
|
top: 0,
|
|
1010
1186
|
left: 0,
|
|
1011
1187
|
pointerEvents: "auto",
|
|
1012
1188
|
touchAction: "none",
|
|
1013
|
-
...
|
|
1189
|
+
...y.$attrs.style
|
|
1014
1190
|
})
|
|
1015
|
-
}, null, 14,
|
|
1191
|
+
}, null, 14, Lr));
|
|
1016
1192
|
}
|
|
1017
|
-
}),
|
|
1193
|
+
}), Br = [
|
|
1018
1194
|
"TresCanvas",
|
|
1019
1195
|
"TresLeches",
|
|
1020
1196
|
"TresScene"
|
|
1021
|
-
],
|
|
1197
|
+
], jr = {
|
|
1022
1198
|
template: {
|
|
1023
1199
|
compilerOptions: {
|
|
1024
|
-
isCustomElement: (
|
|
1200
|
+
isCustomElement: (t) => t.startsWith("Tres") && !Br.includes(t) || t === "primitive"
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
}, Qr = jr, Yr = {
|
|
1204
|
+
mounted: (t, e) => {
|
|
1205
|
+
if (e.arg) {
|
|
1206
|
+
console.log(`v-log:${e.arg}`, t[e.arg]);
|
|
1207
|
+
return;
|
|
1025
1208
|
}
|
|
1209
|
+
console.log("v-log", t);
|
|
1210
|
+
}
|
|
1211
|
+
};
|
|
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 })));
|
|
1026
1220
|
}
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1221
|
+
updateMatrixWorld() {
|
|
1222
|
+
if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
|
|
1223
|
+
this.material.color.set(this.color), this.children[0].material.color.set(this.color);
|
|
1224
|
+
else {
|
|
1225
|
+
this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);
|
|
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);
|
|
1228
|
+
}
|
|
1229
|
+
this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld), this.children[0].matrixWorld.copy(this.matrixWorld);
|
|
1230
|
+
}
|
|
1231
|
+
dispose() {
|
|
1232
|
+
this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
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
|
|
1243
|
+
}, qr = {
|
|
1244
|
+
mounted: (t) => {
|
|
1245
|
+
if (!t.isLight) {
|
|
1246
|
+
we(`${t.type} is not a light`);
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
U = Dr[t.type], t.parent.add(new U(t, 1, t.color.getHex()));
|
|
1250
|
+
},
|
|
1251
|
+
updated: (t) => {
|
|
1252
|
+
k = t.parent.children.find((e) => e instanceof U), !(k instanceof Ie) && k.update();
|
|
1253
|
+
},
|
|
1254
|
+
unmounted: (t) => {
|
|
1255
|
+
if (!t.isLight) {
|
|
1256
|
+
we(`${t.type} is not a light`);
|
|
1257
|
+
return;
|
|
1258
|
+
}
|
|
1259
|
+
k = t.parent.children.find((e) => e instanceof U), k && k.dispose && k.dispose(), t.parent.remove(k);
|
|
1260
|
+
}
|
|
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}`);
|
|
1266
|
+
return;
|
|
1267
|
+
}
|
|
1268
|
+
const { onLoop: s } = ae();
|
|
1269
|
+
s(() => {
|
|
1270
|
+
t.lookAt(r);
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
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}`);
|
|
1279
|
+
return;
|
|
1280
|
+
}
|
|
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(
|
|
1284
|
+
[
|
|
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}`]
|
|
1288
|
+
]
|
|
1289
|
+
);
|
|
1290
|
+
},
|
|
1291
|
+
unmounted: (t) => {
|
|
1292
|
+
S == null || S.dispose(), t.parent.remove(S);
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
let S = null;
|
|
1296
|
+
const Zr = {
|
|
1297
|
+
install(t) {
|
|
1298
|
+
t.component("TresCanvas", Or);
|
|
1030
1299
|
}
|
|
1031
1300
|
};
|
|
1032
1301
|
export {
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1302
|
+
Or as TresCanvas,
|
|
1303
|
+
re as catalogue,
|
|
1304
|
+
Zr as default,
|
|
1305
|
+
ne as extend,
|
|
1306
|
+
Wr as isProd,
|
|
1307
|
+
Xt as normalizeColor,
|
|
1308
|
+
Ur as normalizeVectorFlexibleParam,
|
|
1309
|
+
Qr as templateCompilerOptions,
|
|
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,
|
|
1320
|
+
Jr as useTres,
|
|
1321
|
+
yr as useTresContext,
|
|
1322
|
+
hr as useTresContextProvider,
|
|
1323
|
+
Kr as vAlwaysLookAt,
|
|
1324
|
+
Xr as vDistanceTo,
|
|
1325
|
+
qr as vLightHelper,
|
|
1326
|
+
Yr as vLog
|
|
1054
1327
|
};
|