@tresjs/core 4.3.3 → 4.3.5
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/utils/is.d.ts +20 -2
- package/dist/src/utils/primitive/createRetargetingProxy.d.ts +1 -1
- package/dist/tres.js +772 -757
- package/dist/tres.umd.cjs +2 -2
- package/package.json +2 -2
package/dist/tres.js
CHANGED
|
@@ -1,162 +1,180 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version: v4.3.
|
|
3
|
+
* version: v4.3.5
|
|
4
4
|
* (c) 2025
|
|
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 { defineComponent as
|
|
12
|
-
import * as
|
|
13
|
-
import { Scene as
|
|
14
|
-
import { tryOnScopeDispose as
|
|
15
|
-
const
|
|
16
|
-
name:
|
|
17
|
-
type:
|
|
18
|
-
version:
|
|
19
|
-
packageManager:
|
|
20
|
-
description:
|
|
21
|
-
author:
|
|
22
|
-
license:
|
|
23
|
-
repository:
|
|
24
|
-
keywords:
|
|
25
|
-
sideEffects:
|
|
26
|
-
exports:
|
|
27
|
-
main:
|
|
28
|
-
module:
|
|
29
|
-
types:
|
|
30
|
-
files:
|
|
31
|
-
publishConfig:
|
|
32
|
-
scripts:
|
|
33
|
-
peerDependencies:
|
|
34
|
-
dependencies:
|
|
35
|
-
devDependencies:
|
|
8
|
+
var At = Object.defineProperty;
|
|
9
|
+
var xt = (e, t, r) => t in e ? At(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
10
|
+
var de = (e, t, r) => xt(e, typeof t != "symbol" ? t + "" : t, r);
|
|
11
|
+
import { defineComponent as ue, withAsyncContext as ot, reactive as Se, renderSlot as st, unref as W, ref as $, computed as q, watchEffect as Ae, onUnmounted as K, shallowRef as H, watch as ie, readonly as _e, provide as ae, inject as kt, isRef as Lt, useSlots as Rt, getCurrentInstance as Ue, onMounted as Ot, createElementBlock as Dt, openBlock as jt, normalizeStyle as Bt, normalizeClass as It, createRenderer as $t, h as Fe, Fragment as Ht } from "vue";
|
|
12
|
+
import * as it from "three";
|
|
13
|
+
import { Layers as Ut, Scene as at, MathUtils as lt, Vector3 as xe, MeshBasicMaterial as ct, DoubleSide as Ft, TextureLoader as Wt, PerspectiveCamera as we, Camera as Nt, Clock as ut, REVISION as zt, Color as Z, NoToneMapping as Gt, PCFSoftShadowMap as Vt, ACESFilmicToneMapping as ft, SRGBColorSpace as Yt, WebGLRenderer as me, Vector2 as ge, Raycaster as qt, Object3D as Kt, BufferAttribute as Jt, ArrowHelper as Qt, Line as Xt, BufferGeometry as We, Float32BufferAttribute as Ne, LineBasicMaterial as Zt, Mesh as er, BackSide as tr, HemisphereLightHelper as rr, SpotLightHelper as nr, PointLightHelper as or, DirectionalLightHelper as sr } from "three";
|
|
14
|
+
import { tryOnScopeDispose as ir, toValue as A, unrefElement as ar, useDevicePixelRatio as lr, useWindowSize as cr, useElementSize as ur, refDebounced as ze, usePointer as fr, useElementBounding as pr, createEventHook as D, useFps as dr, useMemory as mr, useRafFn as pt } from "@vueuse/core";
|
|
15
|
+
const gr = "@tresjs/core", hr = "module", vr = "4.3.5", yr = "pnpm@10.6.3", _r = "Declarative ThreeJS using Vue Components", wr = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", br = "MIT", Mr = { type: "git", url: "git+https://github.com/Tresjs/tres.git" }, Pr = ["vue", "3d", "threejs", "three", "threejs-vue"], Cr = !1, Er = { ".": { types: "./dist/index.d.ts", import: "./dist/tres.js", require: "./dist/tres.umd.cjs" }, "./components": { types: "./dist/src/components/index.d.ts" }, "./composables": { types: "./dist/src/composables/index.d.ts" }, "./types": { types: "./dist/src/types/index.d.ts" }, "./utils": { types: "./dist/src/utils/index.d.ts" }, "./*": "./*" }, Tr = "./dist/tres.js", Sr = "./dist/tres.js", Ar = "./dist/index.d.ts", xr = ["*.d.ts", "dist"], kr = { access: "public" }, Lr = { dev: "pnpm --filter='./playground/vue' dev", "dev:nuxt": "pnpm --filter='./playground/nuxt' dev", build: "vite build", test: "vitest", "test:ci": "vitest run", "test:ui": "vitest --ui --coverage.enabled=true", release: "release-it", coverage: "vitest run --coverage", lint: "eslint .", "lint:fix": "eslint . --fix", "docs:dev": "vitepress dev docs", "docs:build": "vitepress build docs", "docs:serve": "vitepress serve docs", "docs:preview": "vitepress preview docs", "docs:contributors": "esno scripts/update-contributors.ts" }, Rr = { three: ">=0.133", vue: ">=3.4" }, Or = { "@alvarosabu/utils": "^3.2.0", "@vue/devtools-api": "^6.6.3", "@vueuse/core": "^12.5.0" }, Dr = { "@release-it/conventional-changelog": "^10.0.0", "@stackblitz/sdk": "^1.11.0", "@tresjs/cientos": "4.1.0", "@tresjs/eslint-config": "^1.4.0", "@types/three": "^0.173.0", "@typescript-eslint/eslint-plugin": "^8.23.0", "@typescript-eslint/parser": "^8.23.0", "@vitejs/plugin-vue": "^5.2.1", "@vitest/coverage-c8": "^0.33.0", "@vitest/coverage-v8": "^3.0.5", "@vitest/ui": "^3.0.5", "@vue/test-utils": "^2.4.6", eslint: "^9.19.0", "eslint-plugin-vue": "^9.32.0", esno: "^4.8.0", gsap: "^3.12.7", jsdom: "^26.0.0", kolorist: "^1.8.0", ohmyfetch: "^0.4.21", pathe: "^2.0.2", "release-it": "^18.1.2", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-copy": "^3.5.0", "rollup-plugin-visualizer": "^5.14.0", sponsorkit: "^16.3.0", three: "^0.173.0", unocss: "^65.4.3", unplugin: "^2.1.2", "unplugin-vue-components": "^28.0.0", vite: "^6.1.0", "vite-plugin-banner": "^0.8.0", "vite-plugin-dts": "4.5.0", "vite-plugin-inspect": "^10.1.0", "vite-plugin-require-transform": "^1.0.21", "vite-svg-loader": "^5.1.0", vitepress: "1.6.3", vitest: "3.0.5", vue: "3.5.13", "vue-demi": "^0.14.10" }, jr = {
|
|
16
|
+
name: gr,
|
|
17
|
+
type: hr,
|
|
18
|
+
version: vr,
|
|
19
|
+
packageManager: yr,
|
|
20
|
+
description: _r,
|
|
21
|
+
author: wr,
|
|
22
|
+
license: br,
|
|
23
|
+
repository: Mr,
|
|
24
|
+
keywords: Pr,
|
|
25
|
+
sideEffects: Cr,
|
|
26
|
+
exports: Er,
|
|
27
|
+
main: Tr,
|
|
28
|
+
module: Sr,
|
|
29
|
+
types: Ar,
|
|
30
|
+
files: xr,
|
|
31
|
+
publishConfig: kr,
|
|
32
|
+
scripts: Lr,
|
|
33
|
+
peerDependencies: Rr,
|
|
34
|
+
dependencies: Or,
|
|
35
|
+
devDependencies: Dr
|
|
36
36
|
};
|
|
37
|
-
function
|
|
37
|
+
function Br(e) {
|
|
38
38
|
const t = { nodes: {}, materials: {} };
|
|
39
|
-
return e && e.traverse((
|
|
40
|
-
|
|
39
|
+
return e && e.traverse((r) => {
|
|
40
|
+
r.name && (t.nodes[r.name] = r), r.material && !t.materials[r.material.name] && (t.materials[r.material.name] = r.material);
|
|
41
41
|
}), t;
|
|
42
42
|
}
|
|
43
|
-
async function
|
|
43
|
+
async function Ir(e, t, r, n, o) {
|
|
44
44
|
const { logError: l } = Q(), s = new e();
|
|
45
|
-
return o && o(s),
|
|
45
|
+
return o && o(s), r && r(s), await new Promise((a, c) => {
|
|
46
46
|
s.load(
|
|
47
47
|
t,
|
|
48
48
|
(i) => {
|
|
49
49
|
const f = i;
|
|
50
|
-
f.scene && Object.assign(f,
|
|
50
|
+
f.scene && Object.assign(f, Br(f.scene)), a(f);
|
|
51
51
|
},
|
|
52
|
-
|
|
52
|
+
n,
|
|
53
53
|
(i) => {
|
|
54
54
|
l("[useLoader] - Failed to load resource", i), c(i);
|
|
55
55
|
}
|
|
56
56
|
);
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
const
|
|
59
|
+
const eo = /* @__PURE__ */ ue({
|
|
60
60
|
__name: "component",
|
|
61
61
|
props: {
|
|
62
62
|
loader: {},
|
|
63
63
|
url: {}
|
|
64
64
|
},
|
|
65
65
|
async setup(e) {
|
|
66
|
-
let t,
|
|
67
|
-
const
|
|
68
|
-
return (l, s) =>
|
|
66
|
+
let t, r;
|
|
67
|
+
const n = e, o = ([t, r] = ot(() => Se(Ir(n.loader, n.url))), t = await t, r(), t);
|
|
68
|
+
return (l, s) => st(l.$slots, "default", { data: W(o) });
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
|
-
class
|
|
72
|
-
constructor(...
|
|
73
|
-
super(...
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
class $r extends it.Mesh {
|
|
72
|
+
constructor(...r) {
|
|
73
|
+
super(...r);
|
|
74
|
+
de(this, "type", "HightlightMesh");
|
|
75
|
+
de(this, "createTime");
|
|
76
76
|
this.createTime = Date.now();
|
|
77
77
|
}
|
|
78
78
|
onBeforeRender() {
|
|
79
|
-
const
|
|
79
|
+
const n = (Date.now() - this.createTime) / 1e3, s = 1 + 0.07 * Math.sin(2.5 * n);
|
|
80
80
|
this.scale.set(s, s, s);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function be(e) {
|
|
84
84
|
return typeof e > "u";
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function ke(e) {
|
|
87
87
|
return Array.isArray(e);
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function Hr(e) {
|
|
90
90
|
return typeof e == "number";
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function dt(e) {
|
|
93
93
|
return typeof e == "string";
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function Y(e) {
|
|
96
96
|
return typeof e == "function";
|
|
97
97
|
}
|
|
98
|
-
function
|
|
99
|
-
return e === Object(e) && !
|
|
98
|
+
function j(e) {
|
|
99
|
+
return e === Object(e) && !ke(e) && !Y(e);
|
|
100
100
|
}
|
|
101
101
|
function N(e) {
|
|
102
|
-
return
|
|
102
|
+
return j(e) && !!e.isObject3D;
|
|
103
|
+
}
|
|
104
|
+
function mt(e) {
|
|
105
|
+
return j(e) && !!e.isColor;
|
|
106
|
+
}
|
|
107
|
+
function Ur(e) {
|
|
108
|
+
return e != null && (typeof e == "string" || typeof e == "number" || mt(e));
|
|
103
109
|
}
|
|
104
|
-
function
|
|
105
|
-
return
|
|
110
|
+
function Me(e) {
|
|
111
|
+
return e !== null && typeof e == "object" && "set" in e && typeof e.set == "function";
|
|
112
|
+
}
|
|
113
|
+
function Fr(e) {
|
|
114
|
+
return Me(e) && "copy" in e && typeof e.copy == "function";
|
|
115
|
+
}
|
|
116
|
+
function Wr(e) {
|
|
117
|
+
return !!(e != null && e.constructor);
|
|
118
|
+
}
|
|
119
|
+
function Ge(e) {
|
|
120
|
+
return e instanceof Ut;
|
|
106
121
|
}
|
|
107
|
-
function
|
|
108
|
-
return
|
|
122
|
+
function Ve(e) {
|
|
123
|
+
return j(e) && !!e.isCamera;
|
|
109
124
|
}
|
|
110
|
-
function
|
|
111
|
-
return
|
|
125
|
+
function Nr(e) {
|
|
126
|
+
return j(e) && !!e.isBufferGeometry;
|
|
112
127
|
}
|
|
113
|
-
function
|
|
114
|
-
return
|
|
128
|
+
function zr(e) {
|
|
129
|
+
return j(e) && !!e.isMaterial;
|
|
115
130
|
}
|
|
116
|
-
function
|
|
117
|
-
return
|
|
131
|
+
function Gr(e) {
|
|
132
|
+
return j(e) && !!e.isLight;
|
|
118
133
|
}
|
|
119
|
-
function
|
|
120
|
-
return
|
|
134
|
+
function Vr(e) {
|
|
135
|
+
return j(e) && !!e.isFog;
|
|
121
136
|
}
|
|
122
|
-
function
|
|
123
|
-
return
|
|
137
|
+
function Yr(e) {
|
|
138
|
+
return j(e) && !!e.isScene;
|
|
124
139
|
}
|
|
125
|
-
function
|
|
126
|
-
return
|
|
140
|
+
function ne(e) {
|
|
141
|
+
return N(e) || Nr(e) || zr(e) || Vr(e);
|
|
127
142
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
143
|
+
function qr(e) {
|
|
144
|
+
return j(e) && !!e.isPrimitive;
|
|
145
|
+
}
|
|
146
|
+
const gt = (e, t) => {
|
|
147
|
+
for (const r of Object.keys(t))
|
|
148
|
+
t[r] instanceof Object && Object.assign(t[r], gt(e[r], t[r]));
|
|
131
149
|
return Object.assign(e || {}, t), e;
|
|
132
|
-
},
|
|
133
|
-
function
|
|
150
|
+
}, Kr = "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", Jr = /* @__PURE__ */ Zr(Kr);
|
|
151
|
+
function Ye(e) {
|
|
134
152
|
return e && e.nodeType === 1;
|
|
135
153
|
}
|
|
136
|
-
function
|
|
137
|
-
return e.replace(/-([a-z])/g, (t,
|
|
154
|
+
function he(e) {
|
|
155
|
+
return e.replace(/-([a-z])/g, (t, r) => r.toUpperCase());
|
|
138
156
|
}
|
|
139
|
-
const
|
|
140
|
-
function
|
|
141
|
-
return e.replace(
|
|
157
|
+
const Qr = /\B([A-Z])/g;
|
|
158
|
+
function Xr(e) {
|
|
159
|
+
return e.replace(Qr, "-$1").toLowerCase();
|
|
142
160
|
}
|
|
143
|
-
function
|
|
144
|
-
const
|
|
145
|
-
for (let o = 0; o <
|
|
146
|
-
n[
|
|
147
|
-
return t ? (o) => !!
|
|
161
|
+
function Zr(e, t) {
|
|
162
|
+
const r = /* @__PURE__ */ Object.create(null), n = e.split(",");
|
|
163
|
+
for (let o = 0; o < n.length; o++)
|
|
164
|
+
r[n[o]] = !0;
|
|
165
|
+
return t ? (o) => !!r[o.toLowerCase()] : (o) => !!r[o];
|
|
148
166
|
}
|
|
149
|
-
const
|
|
167
|
+
const qe = (e, t) => {
|
|
150
168
|
if (!t)
|
|
151
169
|
return;
|
|
152
|
-
const n = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
|
|
153
|
-
return n == null ? void 0 : n.reduce((r, o) => r && r[o], e);
|
|
154
|
-
}, qn = (e, t, n) => {
|
|
155
170
|
const r = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
|
|
156
|
-
|
|
171
|
+
return r == null ? void 0 : r.reduce((n, o) => n && n[o], e);
|
|
172
|
+
}, en = (e, t, r) => {
|
|
173
|
+
const n = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
|
|
174
|
+
n && n.reduce((o, l, s) => (o[l] === void 0 && (o[l] = {}), s === n.length - 1 && (o[l] = r), o[l]), e);
|
|
157
175
|
};
|
|
158
|
-
function
|
|
159
|
-
if (
|
|
176
|
+
function ht(e, t) {
|
|
177
|
+
if (Ye(e) && Ye(t)) {
|
|
160
178
|
const o = e.attributes, l = t.attributes;
|
|
161
179
|
return o.length !== l.length ? !1 : Array.from(o).every(({ name: s, value: a }) => t.getAttribute(s) === a);
|
|
162
180
|
}
|
|
@@ -164,24 +182,24 @@ function pt(e, t) {
|
|
|
164
182
|
return !0;
|
|
165
183
|
if (e === null || typeof e != "object" || t === null || typeof t != "object")
|
|
166
184
|
return !1;
|
|
167
|
-
const
|
|
168
|
-
if (
|
|
185
|
+
const r = Object.keys(e), n = Object.keys(t);
|
|
186
|
+
if (r.length !== n.length)
|
|
169
187
|
return !1;
|
|
170
|
-
for (const o of
|
|
171
|
-
if (!
|
|
188
|
+
for (const o of r)
|
|
189
|
+
if (!n.includes(o) || !ht(e[o], t[o]))
|
|
172
190
|
return !1;
|
|
173
191
|
return !0;
|
|
174
192
|
}
|
|
175
|
-
function
|
|
193
|
+
function tn(e, t) {
|
|
176
194
|
if (!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length)
|
|
177
195
|
return !1;
|
|
178
|
-
for (let
|
|
179
|
-
if (!
|
|
196
|
+
for (let r = 0; r < e.length; r++)
|
|
197
|
+
if (!ht(e[r], t[r]))
|
|
180
198
|
return !1;
|
|
181
199
|
return !0;
|
|
182
200
|
}
|
|
183
|
-
const
|
|
184
|
-
function
|
|
201
|
+
const rn = Array.isArray;
|
|
202
|
+
function nn(e, t, r, n) {
|
|
185
203
|
const o = (c) => {
|
|
186
204
|
if (c.uuid === t)
|
|
187
205
|
return c;
|
|
@@ -196,160 +214,157 @@ function Qn(e, t, n, r) {
|
|
|
196
214
|
return;
|
|
197
215
|
}
|
|
198
216
|
let s = l;
|
|
199
|
-
for (let c = 0; c <
|
|
200
|
-
if (s[
|
|
201
|
-
s = s[
|
|
217
|
+
for (let c = 0; c < r.length - 1; c++)
|
|
218
|
+
if (s[r[c]] !== void 0)
|
|
219
|
+
s = s[r[c]];
|
|
202
220
|
else {
|
|
203
|
-
console.warn(`Property path is not valid: ${
|
|
221
|
+
console.warn(`Property path is not valid: ${r.join(".")}`);
|
|
204
222
|
return;
|
|
205
223
|
}
|
|
206
|
-
const a =
|
|
207
|
-
s[a] !== void 0 ? s[a] =
|
|
224
|
+
const a = r[r.length - 1];
|
|
225
|
+
s[a] !== void 0 ? s[a] = n : console.warn(`Property path is not valid: ${r.join(".")}`);
|
|
208
226
|
}
|
|
209
|
-
function
|
|
210
|
-
const t = new
|
|
227
|
+
function on(e) {
|
|
228
|
+
const t = new ct({
|
|
211
229
|
color: 11003607,
|
|
212
230
|
// Highlight color, e.g., yellow
|
|
213
231
|
transparent: !0,
|
|
214
232
|
opacity: 0.2,
|
|
215
233
|
depthTest: !1,
|
|
216
234
|
// So the highlight is always visible
|
|
217
|
-
side:
|
|
235
|
+
side: Ft
|
|
218
236
|
// To e
|
|
219
237
|
});
|
|
220
|
-
return new
|
|
238
|
+
return new $r(e.geometry.clone(), t);
|
|
221
239
|
}
|
|
222
|
-
function
|
|
223
|
-
var
|
|
240
|
+
function sn(e) {
|
|
241
|
+
var r;
|
|
224
242
|
let t = e.value;
|
|
225
|
-
return e.value && ((
|
|
243
|
+
return e.value && ((r = e.value) != null && r.isMesh) && (t = e.value.position), Array.isArray(e.value) && (t = new xe(...t)), t;
|
|
226
244
|
}
|
|
227
|
-
function
|
|
245
|
+
function an(e) {
|
|
228
246
|
return "map" in e;
|
|
229
247
|
}
|
|
230
|
-
function
|
|
231
|
-
|
|
248
|
+
function Ke(e) {
|
|
249
|
+
an(e) && e.map && e.map.dispose(), e.dispose();
|
|
232
250
|
}
|
|
233
|
-
function
|
|
234
|
-
var
|
|
235
|
-
if (e.parent && ((
|
|
251
|
+
function vt(e) {
|
|
252
|
+
var r, n;
|
|
253
|
+
if (e.parent && ((r = e.removeFromParent) == null || r.call(e)), delete e.__tres, [...e.children].forEach((o) => vt(o)), !(e instanceof at)) {
|
|
236
254
|
const o = e;
|
|
237
|
-
e && ((
|
|
255
|
+
e && ((n = e.dispose) == null || n.call(e)), o.geometry && o.geometry.dispose(), Array.isArray(o.material) ? o.material.forEach((l) => Ke(l)) : o.material && Ke(o.material);
|
|
238
256
|
}
|
|
239
257
|
}
|
|
240
|
-
function
|
|
241
|
-
let
|
|
242
|
-
for (let
|
|
243
|
-
t(e[
|
|
244
|
-
return e.length =
|
|
258
|
+
function ln(e, t) {
|
|
259
|
+
let r = 0;
|
|
260
|
+
for (let n = 0; n < e.length; n++)
|
|
261
|
+
t(e[n], n) && (e[r] = e[n], r++);
|
|
262
|
+
return e.length = r, e;
|
|
245
263
|
}
|
|
246
264
|
function Pe(e, t) {
|
|
247
|
-
let
|
|
265
|
+
let r = e;
|
|
248
266
|
if (t.includes("-")) {
|
|
249
|
-
const
|
|
250
|
-
let o =
|
|
251
|
-
for (;
|
|
252
|
-
o in
|
|
253
|
-
return { target:
|
|
267
|
+
const n = t.split("-");
|
|
268
|
+
let o = n.shift();
|
|
269
|
+
for (; r && n.length; )
|
|
270
|
+
o in r ? (r = r[o], o = n.shift()) : o = Je(o, n.shift());
|
|
271
|
+
return { target: r, key: Je(o, ...n) };
|
|
254
272
|
} else
|
|
255
|
-
return { target:
|
|
273
|
+
return { target: r, key: t };
|
|
256
274
|
}
|
|
257
|
-
function
|
|
258
|
-
return e.map((t,
|
|
275
|
+
function Je(...e) {
|
|
276
|
+
return e.map((t, r) => r === 0 ? t : t.charAt(0).toUpperCase() + t.slice(1)).join("");
|
|
259
277
|
}
|
|
260
|
-
const
|
|
261
|
-
function
|
|
262
|
-
if (
|
|
263
|
-
if (
|
|
264
|
-
const l =
|
|
278
|
+
const Qe = /-\d+$/;
|
|
279
|
+
function cn(e, t, r) {
|
|
280
|
+
if (dt(r)) {
|
|
281
|
+
if (Qe.test(r)) {
|
|
282
|
+
const l = r.replace(Qe, ""), { target: s, key: a } = Pe(e, l);
|
|
265
283
|
if (!Array.isArray(s[a])) {
|
|
266
284
|
const c = s[a], i = [];
|
|
267
285
|
i.__tresDetach = () => {
|
|
268
|
-
i.every((f) =>
|
|
286
|
+
i.every((f) => be(f)) && (s[a] = c);
|
|
269
287
|
}, s[a] = i;
|
|
270
288
|
}
|
|
271
289
|
}
|
|
272
|
-
const { target:
|
|
273
|
-
t.__tres.previousAttach =
|
|
290
|
+
const { target: n, key: o } = Pe(e, r);
|
|
291
|
+
t.__tres.previousAttach = n[o], n[o] = J(t);
|
|
274
292
|
} else
|
|
275
|
-
t.__tres.previousAttach =
|
|
293
|
+
t.__tres.previousAttach = r(e, t);
|
|
276
294
|
}
|
|
277
|
-
function
|
|
278
|
-
var
|
|
279
|
-
if (
|
|
280
|
-
const { target: s, key: a } = Pe(e,
|
|
295
|
+
function un(e, t, r) {
|
|
296
|
+
var n, o, l;
|
|
297
|
+
if (dt(r)) {
|
|
298
|
+
const { target: s, key: a } = Pe(e, r), c = t.__tres.previousAttach;
|
|
281
299
|
c === void 0 ? delete s[a] : s[a] = c, "__tresDetach" in s && s.__tresDetach();
|
|
282
300
|
} else
|
|
283
|
-
(o = (
|
|
301
|
+
(o = (n = t.__tres) == null ? void 0 : n.previousAttach) == null || o.call(n, e, t);
|
|
284
302
|
(l = t.__tres) == null || delete l.previousAttach;
|
|
285
303
|
}
|
|
286
|
-
function z(e, t,
|
|
287
|
-
const
|
|
288
|
-
return
|
|
304
|
+
function z(e, t, r) {
|
|
305
|
+
const n = e;
|
|
306
|
+
return n.__tres = {
|
|
289
307
|
type: "unknown",
|
|
290
308
|
eventCount: 0,
|
|
291
|
-
root:
|
|
309
|
+
root: r,
|
|
292
310
|
handlers: {},
|
|
293
311
|
memoizedProps: {},
|
|
294
312
|
objects: [],
|
|
295
313
|
parent: null,
|
|
296
314
|
previousAttach: null,
|
|
297
315
|
...t
|
|
298
|
-
},
|
|
316
|
+
}, n.__tres.attach || (n.isMaterial ? n.__tres.attach = "material" : n.isBufferGeometry ? n.__tres.attach = "geometry" : n.isFog && (n.__tres.attach = "fog")), n;
|
|
299
317
|
}
|
|
300
|
-
function
|
|
301
|
-
var
|
|
302
|
-
const t = (
|
|
318
|
+
function yt(e) {
|
|
319
|
+
var r;
|
|
320
|
+
const t = (r = e == null ? void 0 : e.__tres) == null ? void 0 : r.root;
|
|
303
321
|
t && t.render && t.render.canBeInvalidated.value && t.invalidate();
|
|
304
322
|
}
|
|
305
|
-
function
|
|
323
|
+
function fn(e, t, r) {
|
|
306
324
|
var o;
|
|
307
|
-
if (!
|
|
325
|
+
if (!Y(e.setPixelRatio))
|
|
308
326
|
return;
|
|
309
|
-
let
|
|
310
|
-
if (
|
|
311
|
-
const l =
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
}
|
|
316
|
-
} else Bn(n) ? r = n : r = t;
|
|
317
|
-
r !== ((o = e.getPixelRatio) == null ? void 0 : o.call(e)) && e.setPixelRatio(r);
|
|
327
|
+
let n = 0;
|
|
328
|
+
if (r && ke(r) && r.length >= 2) {
|
|
329
|
+
const [l, s] = r;
|
|
330
|
+
n = lt.clamp(t, l, s);
|
|
331
|
+
} else Hr(r) ? n = r : n = t;
|
|
332
|
+
n !== ((o = e.getPixelRatio) == null ? void 0 : o.call(e)) && e.setPixelRatio(n);
|
|
318
333
|
}
|
|
319
|
-
function
|
|
334
|
+
function pn(e, t, r, n, o) {
|
|
320
335
|
const l = [...t.__tres.objects], s = J(t);
|
|
321
336
|
if (e = J(e), s === e)
|
|
322
337
|
return !0;
|
|
323
338
|
const a = z(e, t.__tres ?? {}, o), c = t.parent ?? t.__tres.parent ?? null, i = { ...t.__tres.memoizedProps };
|
|
324
339
|
delete i.object;
|
|
325
340
|
for (const f of l)
|
|
326
|
-
|
|
327
|
-
s.__tres.objects = [],
|
|
328
|
-
for (const [f,
|
|
329
|
-
|
|
330
|
-
|
|
341
|
+
_t(f, o), wt(f, o);
|
|
342
|
+
s.__tres.objects = [], n.remove(t);
|
|
343
|
+
for (const [f, v] of Object.entries(i))
|
|
344
|
+
n.patchProp(a, f, a[f], v);
|
|
345
|
+
r(e), n.insert(t, c);
|
|
331
346
|
for (const f of l)
|
|
332
|
-
|
|
347
|
+
n.insert(f, t);
|
|
333
348
|
return !0;
|
|
334
349
|
}
|
|
335
350
|
function J(e) {
|
|
336
|
-
return
|
|
351
|
+
return qr(e) ? (e.object.__tres = e.__tres, e.object) : e;
|
|
337
352
|
}
|
|
338
|
-
function
|
|
339
|
-
var
|
|
340
|
-
const
|
|
341
|
-
e.__tres && (e.__tres.parent = null),
|
|
353
|
+
function _t(e, t) {
|
|
354
|
+
var n, o, l, s;
|
|
355
|
+
const r = ((n = e.__tres) == null ? void 0 : n.parent) || t.scene.value;
|
|
356
|
+
e.__tres && (e.__tres.parent = null), r && r.__tres && "objects" in r.__tres && ln(r.__tres.objects, (a) => a !== e), (o = e.__tres) != null && o.attach ? un(r, e, e.__tres.attach) : ((s = (l = e.parent) == null ? void 0 : l.remove) == null || s.call(l, J(e)), e.parent = null);
|
|
342
357
|
}
|
|
343
|
-
function
|
|
344
|
-
var
|
|
345
|
-
(
|
|
358
|
+
function wt(e, t) {
|
|
359
|
+
var r;
|
|
360
|
+
(r = e.traverse) == null || r.call(e, (n) => {
|
|
346
361
|
var o;
|
|
347
|
-
t.deregisterCamera(
|
|
348
|
-
}), t.deregisterCamera(e),
|
|
362
|
+
t.deregisterCamera(n), (o = t.eventManager) == null || o.deregisterPointerMissedObject(n);
|
|
363
|
+
}), t.deregisterCamera(e), yt(e);
|
|
349
364
|
}
|
|
350
|
-
async function
|
|
351
|
-
const
|
|
352
|
-
|
|
365
|
+
async function dn(e, t) {
|
|
366
|
+
const r = new Wt(t), n = (o) => new Promise((l, s) => {
|
|
367
|
+
r.load(
|
|
353
368
|
o,
|
|
354
369
|
(a) => l(a),
|
|
355
370
|
() => null,
|
|
@@ -358,8 +373,8 @@ async function ir(e, t) {
|
|
|
358
373
|
}
|
|
359
374
|
);
|
|
360
375
|
});
|
|
361
|
-
if (
|
|
362
|
-
const o = await Promise.all(e.map((l) =>
|
|
376
|
+
if (rn(e)) {
|
|
377
|
+
const o = await Promise.all(e.map((l) => n(l)));
|
|
363
378
|
return e.length > 1 ? o : o[0];
|
|
364
379
|
} else {
|
|
365
380
|
const {
|
|
@@ -370,21 +385,21 @@ async function ir(e, t) {
|
|
|
370
385
|
metalnessMap: c,
|
|
371
386
|
aoMap: i,
|
|
372
387
|
alphaMap: f,
|
|
373
|
-
matcap:
|
|
388
|
+
matcap: v
|
|
374
389
|
} = e;
|
|
375
390
|
return {
|
|
376
|
-
map: o ? await
|
|
377
|
-
displacementMap: l ? await
|
|
378
|
-
normalMap: s ? await
|
|
379
|
-
roughnessMap: a ? await
|
|
380
|
-
metalnessMap: c ? await
|
|
381
|
-
aoMap: i ? await
|
|
382
|
-
alphaMap: f ? await
|
|
383
|
-
matcap:
|
|
391
|
+
map: o ? await n(o) : null,
|
|
392
|
+
displacementMap: l ? await n(l) : null,
|
|
393
|
+
normalMap: s ? await n(s) : null,
|
|
394
|
+
roughnessMap: a ? await n(a) : null,
|
|
395
|
+
metalnessMap: c ? await n(c) : null,
|
|
396
|
+
aoMap: i ? await n(i) : null,
|
|
397
|
+
alphaMap: f ? await n(f) : null,
|
|
398
|
+
matcap: v ? await n(v) : null
|
|
384
399
|
};
|
|
385
400
|
}
|
|
386
401
|
}
|
|
387
|
-
const
|
|
402
|
+
const to = /* @__PURE__ */ ue({
|
|
388
403
|
__name: "component",
|
|
389
404
|
props: {
|
|
390
405
|
map: {},
|
|
@@ -397,130 +412,130 @@ const qr = /* @__PURE__ */ fe({
|
|
|
397
412
|
matcap: {}
|
|
398
413
|
},
|
|
399
414
|
async setup(e) {
|
|
400
|
-
let t,
|
|
401
|
-
const
|
|
402
|
-
return (l, s) =>
|
|
415
|
+
let t, r;
|
|
416
|
+
const n = e, o = ([t, r] = ot(() => Se(dn(n))), t = await t, r(), t);
|
|
417
|
+
return (l, s) => st(l.$slots, "default", { textures: W(o) });
|
|
403
418
|
}
|
|
404
|
-
}),
|
|
405
|
-
const t =
|
|
419
|
+
}), mn = ({ sizes: e }) => {
|
|
420
|
+
const t = $([]), r = q(
|
|
406
421
|
() => t.value[0]
|
|
407
|
-
),
|
|
408
|
-
const a = s instanceof
|
|
422
|
+
), n = (s) => {
|
|
423
|
+
const a = s instanceof Nt ? s : t.value.find((i) => i.uuid === s);
|
|
409
424
|
if (!a)
|
|
410
425
|
return;
|
|
411
426
|
const c = t.value.filter(({ uuid: i }) => i !== a.uuid);
|
|
412
427
|
t.value = [a, ...c];
|
|
413
428
|
}, o = (s, a = !1) => {
|
|
414
|
-
if (
|
|
429
|
+
if (Ve(s)) {
|
|
415
430
|
const c = s;
|
|
416
431
|
if (t.value.some(({ uuid: i }) => i === c.uuid))
|
|
417
432
|
return;
|
|
418
|
-
a ?
|
|
433
|
+
a ? n(c) : t.value.push(c);
|
|
419
434
|
}
|
|
420
435
|
}, l = (s) => {
|
|
421
|
-
if (
|
|
436
|
+
if (Ve(s)) {
|
|
422
437
|
const a = s;
|
|
423
438
|
t.value = t.value.filter(({ uuid: c }) => c !== a.uuid);
|
|
424
439
|
}
|
|
425
440
|
};
|
|
426
441
|
return Ae(() => {
|
|
427
442
|
e.aspectRatio.value && t.value.forEach((s) => {
|
|
428
|
-
!s.manual && (s instanceof
|
|
443
|
+
!s.manual && (s instanceof we || gn(s)) && (s instanceof we ? s.aspect = e.aspectRatio.value : (s.left = e.width.value * -0.5, s.right = e.width.value * 0.5, s.top = e.height.value * 0.5, s.bottom = e.height.value * -0.5), s.updateProjectionMatrix());
|
|
429
444
|
});
|
|
430
445
|
}), K(() => {
|
|
431
446
|
t.value = [];
|
|
432
447
|
}), {
|
|
433
|
-
camera:
|
|
448
|
+
camera: r,
|
|
434
449
|
cameras: t,
|
|
435
450
|
registerCamera: o,
|
|
436
451
|
deregisterCamera: l,
|
|
437
|
-
setCameraActive:
|
|
452
|
+
setCameraActive: n
|
|
438
453
|
};
|
|
439
454
|
};
|
|
440
|
-
function
|
|
455
|
+
function gn(e) {
|
|
441
456
|
return e.hasOwnProperty("isOrthographicCamera") && e.isOrthographicCamera;
|
|
442
457
|
}
|
|
443
|
-
const
|
|
444
|
-
function
|
|
445
|
-
typeof e[0] == "string" ? e[0] =
|
|
458
|
+
const ro = !0, fe = "[TresJS ▲ ■ ●] ";
|
|
459
|
+
function hn(...e) {
|
|
460
|
+
typeof e[0] == "string" ? e[0] = fe + e[0] : e.unshift(fe), console.error(...e);
|
|
446
461
|
}
|
|
447
|
-
function
|
|
448
|
-
typeof e[0] == "string" ? e[0] =
|
|
462
|
+
function vn(...e) {
|
|
463
|
+
typeof e[0] == "string" ? e[0] = fe + e[0] : e.unshift(fe), console.warn(...e);
|
|
449
464
|
}
|
|
450
|
-
function
|
|
465
|
+
function yn(e, t) {
|
|
451
466
|
}
|
|
452
467
|
function Q() {
|
|
453
468
|
return {
|
|
454
|
-
logError:
|
|
455
|
-
logWarning:
|
|
456
|
-
logMessage:
|
|
469
|
+
logError: hn,
|
|
470
|
+
logWarning: vn,
|
|
471
|
+
logMessage: yn
|
|
457
472
|
};
|
|
458
473
|
}
|
|
459
|
-
const Ce =
|
|
460
|
-
function
|
|
474
|
+
const Ce = $({}), Ee = (e) => Object.assign(Ce.value, e);
|
|
475
|
+
function ve() {
|
|
461
476
|
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
|
|
462
|
-
let
|
|
477
|
+
let r = 0, n = !1;
|
|
463
478
|
const o = () => {
|
|
464
|
-
const i = Array.from(e.entries()).sort((f,
|
|
465
|
-
const u = f[1].priority -
|
|
466
|
-
return u === 0 ? f[1].addI -
|
|
479
|
+
const i = Array.from(e.entries()).sort((f, v) => {
|
|
480
|
+
const u = f[1].priority - v[1].priority;
|
|
481
|
+
return u === 0 ? f[1].addI - v[1].addI : u;
|
|
467
482
|
});
|
|
468
483
|
t.clear(), i.forEach((f) => t.add(f[0]));
|
|
469
484
|
}, l = (i) => {
|
|
470
485
|
e.delete(i), t.delete(i);
|
|
471
486
|
};
|
|
472
487
|
return { on: (i, f = 0) => {
|
|
473
|
-
e.set(i, { priority: f, addI:
|
|
474
|
-
const
|
|
475
|
-
return
|
|
476
|
-
off:
|
|
488
|
+
e.set(i, { priority: f, addI: r++ });
|
|
489
|
+
const v = () => l(i);
|
|
490
|
+
return ir(v), n = !0, {
|
|
491
|
+
off: v
|
|
477
492
|
};
|
|
478
493
|
}, off: l, trigger: (...i) => {
|
|
479
|
-
|
|
494
|
+
n && (o(), n = !1), t.forEach((f) => f(...i));
|
|
480
495
|
}, dispose: () => {
|
|
481
496
|
e.clear(), t.clear();
|
|
482
497
|
}, get count() {
|
|
483
498
|
return e.size;
|
|
484
499
|
} };
|
|
485
500
|
}
|
|
486
|
-
function
|
|
487
|
-
let e = !0, t = !0,
|
|
488
|
-
const
|
|
501
|
+
function _n() {
|
|
502
|
+
let e = !0, t = !0, r = !1;
|
|
503
|
+
const n = new ut(!1), o = $(n.running), l = $(!1);
|
|
489
504
|
let s;
|
|
490
|
-
const a =
|
|
505
|
+
const a = lt.generateUUID();
|
|
491
506
|
let c = null;
|
|
492
|
-
const i =
|
|
507
|
+
const i = ve(), f = ve(), v = ve();
|
|
493
508
|
S();
|
|
494
509
|
let u = {};
|
|
495
|
-
function
|
|
510
|
+
function _(M) {
|
|
496
511
|
u = M;
|
|
497
512
|
}
|
|
498
|
-
function
|
|
513
|
+
function d(M, x, m = 0) {
|
|
499
514
|
switch (x) {
|
|
500
515
|
case "before":
|
|
501
516
|
return i.on(M, m);
|
|
502
517
|
case "render":
|
|
503
518
|
return c || (c = M), f.dispose(), f.on(M);
|
|
504
519
|
case "after":
|
|
505
|
-
return
|
|
520
|
+
return v.on(M, m);
|
|
506
521
|
}
|
|
507
522
|
}
|
|
508
|
-
function
|
|
523
|
+
function y() {
|
|
509
524
|
t && (t = !1, S(), E());
|
|
510
525
|
}
|
|
511
|
-
function
|
|
526
|
+
function p() {
|
|
512
527
|
t = !0, S(), cancelAnimationFrame(s);
|
|
513
528
|
}
|
|
514
|
-
function
|
|
515
|
-
|
|
529
|
+
function h() {
|
|
530
|
+
r = !1, S();
|
|
516
531
|
}
|
|
517
532
|
function P() {
|
|
518
|
-
|
|
533
|
+
r = !0, S();
|
|
519
534
|
}
|
|
520
535
|
function C() {
|
|
521
536
|
l.value = !0;
|
|
522
537
|
}
|
|
523
|
-
function
|
|
538
|
+
function b() {
|
|
524
539
|
l.value = !1;
|
|
525
540
|
}
|
|
526
541
|
function E() {
|
|
@@ -528,7 +543,7 @@ function dr() {
|
|
|
528
543
|
s = requestAnimationFrame(E);
|
|
529
544
|
return;
|
|
530
545
|
}
|
|
531
|
-
const M =
|
|
546
|
+
const M = n.getDelta(), x = n.getElapsedTime(), m = {
|
|
532
547
|
camera: W(u.camera),
|
|
533
548
|
scene: W(u.scene),
|
|
534
549
|
renderer: W(u.renderer),
|
|
@@ -536,73 +551,73 @@ function dr() {
|
|
|
536
551
|
controls: W(u.controls),
|
|
537
552
|
invalidate: u.invalidate,
|
|
538
553
|
advance: u.advance
|
|
539
|
-
},
|
|
540
|
-
o.value && i.trigger(
|
|
554
|
+
}, w = { delta: M, elapsed: x, clock: n, ...m };
|
|
555
|
+
o.value && i.trigger(w), l.value || (f.count ? f.trigger(w) : c && c(w)), o.value && v.trigger(w), s = requestAnimationFrame(E);
|
|
541
556
|
}
|
|
542
557
|
function S() {
|
|
543
|
-
const M = !t && !
|
|
544
|
-
|
|
558
|
+
const M = !t && !r;
|
|
559
|
+
n.running !== M && (n.running ? n.stop() : n.start()), o.value = n.running;
|
|
545
560
|
}
|
|
546
561
|
return {
|
|
547
562
|
loopId: a,
|
|
548
|
-
register: (M, x, m) =>
|
|
549
|
-
start:
|
|
550
|
-
stop:
|
|
563
|
+
register: (M, x, m) => d(M, x, m),
|
|
564
|
+
start: y,
|
|
565
|
+
stop: p,
|
|
551
566
|
pause: P,
|
|
552
|
-
resume:
|
|
567
|
+
resume: h,
|
|
553
568
|
pauseRender: C,
|
|
554
|
-
resumeRender:
|
|
569
|
+
resumeRender: b,
|
|
555
570
|
isRenderPaused: l,
|
|
556
571
|
isActive: o,
|
|
557
|
-
setContext:
|
|
572
|
+
setContext: _,
|
|
558
573
|
setReady: (M) => e = M
|
|
559
574
|
};
|
|
560
575
|
}
|
|
561
|
-
function
|
|
576
|
+
function Le(e) {
|
|
562
577
|
let t = 0;
|
|
563
|
-
return e.traverse((
|
|
564
|
-
if (
|
|
565
|
-
const
|
|
578
|
+
return e.traverse((r) => {
|
|
579
|
+
if (r.isMesh && r.geometry && r.type !== "HightlightMesh") {
|
|
580
|
+
const n = r.geometry, o = n.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, l = n.index ? n.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, s = n.attributes.normal ? n.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, a = n.attributes.uv ? n.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, c = o + l + s + a;
|
|
566
581
|
t += c;
|
|
567
582
|
}
|
|
568
583
|
}), t;
|
|
569
584
|
}
|
|
570
|
-
function
|
|
585
|
+
function wn(e) {
|
|
571
586
|
return (e / 1024).toFixed(2);
|
|
572
587
|
}
|
|
573
|
-
const
|
|
574
|
-
function
|
|
588
|
+
const bn = Number.parseInt(zt.replace("dev", ""));
|
|
589
|
+
function no(e) {
|
|
575
590
|
return typeof e == "number" ? [e, e, e] : e instanceof xe ? [e.x, e.y, e.z] : e;
|
|
576
591
|
}
|
|
577
|
-
function
|
|
592
|
+
function Mn(e) {
|
|
578
593
|
return e instanceof Z ? e : Array.isArray(e) ? new Z(...e) : new Z(e);
|
|
579
594
|
}
|
|
580
|
-
const
|
|
595
|
+
const oe = {
|
|
581
596
|
realistic: {
|
|
582
597
|
shadows: !0,
|
|
583
598
|
physicallyCorrectLights: !0,
|
|
584
|
-
outputColorSpace:
|
|
585
|
-
toneMapping:
|
|
599
|
+
outputColorSpace: Yt,
|
|
600
|
+
toneMapping: ft,
|
|
586
601
|
toneMappingExposure: 3,
|
|
587
602
|
shadowMap: {
|
|
588
603
|
enabled: !0,
|
|
589
|
-
type:
|
|
604
|
+
type: Vt
|
|
590
605
|
}
|
|
591
606
|
},
|
|
592
607
|
flat: {
|
|
593
|
-
toneMapping:
|
|
608
|
+
toneMapping: Gt,
|
|
594
609
|
toneMappingExposure: 1
|
|
595
610
|
}
|
|
596
611
|
};
|
|
597
|
-
function
|
|
612
|
+
function Pn({
|
|
598
613
|
canvas: e,
|
|
599
614
|
options: t,
|
|
600
|
-
contextParts: { sizes:
|
|
615
|
+
contextParts: { sizes: r, render: n, invalidate: o, advance: l }
|
|
601
616
|
}) {
|
|
602
617
|
const s = q(() => ({
|
|
603
618
|
alpha: A(t.alpha) ?? !0,
|
|
604
619
|
depth: A(t.depth),
|
|
605
|
-
canvas:
|
|
620
|
+
canvas: ar(e),
|
|
606
621
|
context: A(t.context),
|
|
607
622
|
stencil: A(t.stencil),
|
|
608
623
|
antialias: A(t.antialias) ?? !0,
|
|
@@ -612,48 +627,48 @@ function gr({
|
|
|
612
627
|
preserveDrawingBuffer: A(t.preserveDrawingBuffer),
|
|
613
628
|
logarithmicDepthBuffer: A(t.logarithmicDepthBuffer),
|
|
614
629
|
failIfMajorPerformanceCaveat: A(t.failIfMajorPerformanceCaveat)
|
|
615
|
-
})), a =
|
|
630
|
+
})), a = H(new me(s.value));
|
|
616
631
|
function c() {
|
|
617
632
|
t.renderMode === "on-demand" && o();
|
|
618
633
|
}
|
|
619
|
-
|
|
620
|
-
a.value.dispose(), a.value = new
|
|
621
|
-
}),
|
|
622
|
-
a.value.setSize(
|
|
634
|
+
ie(s, () => {
|
|
635
|
+
a.value.dispose(), a.value = new me(s.value), c();
|
|
636
|
+
}), ie([r.width, r.height], () => {
|
|
637
|
+
a.value.setSize(r.width.value, r.height.value), c();
|
|
623
638
|
}, {
|
|
624
639
|
immediate: !0
|
|
625
|
-
}),
|
|
626
|
-
const { pixelRatio: i } =
|
|
627
|
-
const
|
|
640
|
+
}), ie(() => t.clearColor, c);
|
|
641
|
+
const { pixelRatio: i } = lr(), { logError: f } = Q(), u = (() => {
|
|
642
|
+
const d = new me(), y = {
|
|
628
643
|
shadowMap: {
|
|
629
|
-
enabled:
|
|
630
|
-
type:
|
|
644
|
+
enabled: d.shadowMap.enabled,
|
|
645
|
+
type: d.shadowMap.type
|
|
631
646
|
},
|
|
632
|
-
toneMapping:
|
|
633
|
-
toneMappingExposure:
|
|
634
|
-
outputColorSpace:
|
|
647
|
+
toneMapping: d.toneMapping,
|
|
648
|
+
toneMappingExposure: d.toneMappingExposure,
|
|
649
|
+
outputColorSpace: d.outputColorSpace
|
|
635
650
|
};
|
|
636
|
-
return
|
|
637
|
-
})(),
|
|
638
|
-
return
|
|
651
|
+
return d.dispose(), y;
|
|
652
|
+
})(), _ = A(t.renderMode);
|
|
653
|
+
return _ === "on-demand" && o(), _ === "manual" && setTimeout(() => {
|
|
639
654
|
l();
|
|
640
655
|
}, 100), Ae(() => {
|
|
641
|
-
const
|
|
642
|
-
|
|
643
|
-
const
|
|
644
|
-
const
|
|
645
|
-
if (
|
|
646
|
-
return
|
|
656
|
+
const d = A(t.preset);
|
|
657
|
+
d && (d in oe || f(`Renderer Preset must be one of these: ${Object.keys(oe).join(", ")}`), gt(a.value, oe[d])), fn(a.value, i.value, A(t.dpr)), _ === "always" && (n.frames.value = Math.max(1, n.frames.value));
|
|
658
|
+
const y = (P, C) => {
|
|
659
|
+
const b = A(P), E = () => {
|
|
660
|
+
if (d)
|
|
661
|
+
return qe(oe[d], C);
|
|
647
662
|
};
|
|
648
|
-
if (
|
|
649
|
-
return
|
|
663
|
+
if (b !== void 0)
|
|
664
|
+
return b;
|
|
650
665
|
const S = E();
|
|
651
|
-
return S !== void 0 ? S :
|
|
652
|
-
},
|
|
653
|
-
|
|
654
|
-
const
|
|
655
|
-
|
|
656
|
-
|
|
666
|
+
return S !== void 0 ? S : qe(u, C);
|
|
667
|
+
}, p = (P, C) => en(a.value, C, y(P, C));
|
|
668
|
+
p(t.shadows, "shadowMap.enabled"), p(t.toneMapping ?? ft, "toneMapping"), p(t.shadowMapType, "shadowMap.type"), bn < 150 && p(!t.useLegacyLights, "physicallyCorrectLights"), p(t.outputColorSpace, "outputColorSpace"), p(t.toneMappingExposure, "toneMappingExposure");
|
|
669
|
+
const h = y(t.clearColor, "clearColor");
|
|
670
|
+
h && a.value.setClearColor(
|
|
671
|
+
h ? Mn(h) : new Z(0)
|
|
657
672
|
// default clear color is not easily/efficiently retrievable from three
|
|
658
673
|
);
|
|
659
674
|
}), K(() => {
|
|
@@ -662,199 +677,199 @@ function gr({
|
|
|
662
677
|
renderer: a
|
|
663
678
|
};
|
|
664
679
|
}
|
|
665
|
-
function
|
|
666
|
-
const
|
|
680
|
+
function Cn(e, t, r = 10) {
|
|
681
|
+
const n = A(e) ? cr() : ur(q(() => A(t).parentElement)), o = _e(ze(n.width, r)), l = _e(ze(n.height, r)), s = q(() => o.value / l.value);
|
|
667
682
|
return {
|
|
668
683
|
height: l,
|
|
669
684
|
width: o,
|
|
670
685
|
aspectRatio: s
|
|
671
686
|
};
|
|
672
687
|
}
|
|
673
|
-
const
|
|
674
|
-
const
|
|
688
|
+
const En = (e, t) => {
|
|
689
|
+
const r = q(() => t.renderer.value.domElement), n = H([]), { x: o, y: l } = fr({ target: r });
|
|
675
690
|
let s = 0;
|
|
676
|
-
const { width: a, height: c, top: i, left: f } =
|
|
677
|
-
if (
|
|
691
|
+
const { width: a, height: c, top: i, left: f } = pr(r), v = ({ x: g, y: T }) => {
|
|
692
|
+
if (r.value)
|
|
678
693
|
return {
|
|
679
|
-
x: (
|
|
694
|
+
x: (g - f.value) / a.value * 2 - 1,
|
|
680
695
|
y: -((T - i.value) / c.value) * 2 + 1
|
|
681
696
|
};
|
|
682
|
-
}, u = ({ x:
|
|
697
|
+
}, u = ({ x: g, y: T }) => {
|
|
683
698
|
if (t.camera.value)
|
|
684
|
-
return t.raycaster.value.setFromCamera(new
|
|
685
|
-
},
|
|
686
|
-
const T =
|
|
687
|
-
x: (
|
|
688
|
-
y: (
|
|
699
|
+
return t.raycaster.value.setFromCamera(new ge(g, T), t.camera.value), n.value = t.raycaster.value.intersectObjects(e.value, !0), n.value;
|
|
700
|
+
}, _ = (g) => {
|
|
701
|
+
const T = v({
|
|
702
|
+
x: (g == null ? void 0 : g.clientX) ?? o.value,
|
|
703
|
+
y: (g == null ? void 0 : g.clientY) ?? l.value
|
|
689
704
|
});
|
|
690
705
|
return T ? u(T) || [] : [];
|
|
691
|
-
},
|
|
692
|
-
function S(
|
|
706
|
+
}, d = D(), y = D(), p = D(), h = D(), P = D(), C = D(), b = D(), E = D();
|
|
707
|
+
function S(g) {
|
|
693
708
|
const T = {};
|
|
694
|
-
for (const U in
|
|
695
|
-
typeof U != "function" && (T[U] =
|
|
709
|
+
for (const U in g)
|
|
710
|
+
typeof U != "function" && (T[U] = g[U]);
|
|
696
711
|
return T;
|
|
697
712
|
}
|
|
698
|
-
const M = (
|
|
699
|
-
var
|
|
700
|
-
const U = S(T),
|
|
701
|
-
|
|
713
|
+
const M = (g, T) => {
|
|
714
|
+
var Ie, $e, He;
|
|
715
|
+
const U = S(T), re = new xe(T == null ? void 0 : T.clientX, T == null ? void 0 : T.clientY, 0).unproject((Ie = t.camera) == null ? void 0 : Ie.value);
|
|
716
|
+
g.trigger({
|
|
702
717
|
...U,
|
|
703
|
-
intersections:
|
|
718
|
+
intersections: n.value,
|
|
704
719
|
// The unprojectedPoint is wrong, math needs to be fixed
|
|
705
|
-
unprojectedPoint:
|
|
706
|
-
ray: (
|
|
707
|
-
camera: (
|
|
720
|
+
unprojectedPoint: re,
|
|
721
|
+
ray: ($e = t.raycaster) == null ? void 0 : $e.value.ray,
|
|
722
|
+
camera: (He = t.camera) == null ? void 0 : He.value,
|
|
708
723
|
sourceEvent: T,
|
|
709
724
|
delta: s,
|
|
710
725
|
stopPropagating: !1
|
|
711
726
|
});
|
|
712
727
|
};
|
|
713
728
|
let x;
|
|
714
|
-
const m = (
|
|
715
|
-
|
|
716
|
-
},
|
|
729
|
+
const m = (g) => {
|
|
730
|
+
_(g), M(p, g), x = g;
|
|
731
|
+
}, w = () => {
|
|
717
732
|
x && m(x);
|
|
718
733
|
};
|
|
719
734
|
let k, L, R;
|
|
720
|
-
const
|
|
735
|
+
const B = (g) => {
|
|
721
736
|
var T;
|
|
722
|
-
k = (T =
|
|
723
|
-
(
|
|
724
|
-
(
|
|
725
|
-
), M(P,
|
|
737
|
+
k = (T = n.value[0]) == null ? void 0 : T.object, s = 0, L = new ge(
|
|
738
|
+
(g == null ? void 0 : g.clientX) ?? o.value,
|
|
739
|
+
(g == null ? void 0 : g.clientY) ?? l.value
|
|
740
|
+
), M(P, g);
|
|
726
741
|
};
|
|
727
|
-
let O,
|
|
728
|
-
const
|
|
729
|
-
var T, U,
|
|
730
|
-
|
|
731
|
-
(
|
|
732
|
-
(
|
|
733
|
-
), s = L == null ? void 0 : L.distanceTo(R),
|
|
734
|
-
},
|
|
735
|
-
|
|
736
|
-
},
|
|
737
|
-
return
|
|
738
|
-
|
|
742
|
+
let O, G = !1;
|
|
743
|
+
const Oe = (g) => {
|
|
744
|
+
var T, U, re;
|
|
745
|
+
g instanceof PointerEvent && (n.value.length === 0 && M(C, g), k === ((T = n.value[0]) == null ? void 0 : T.object) && (R = new ge(
|
|
746
|
+
(g == null ? void 0 : g.clientX) ?? o.value,
|
|
747
|
+
(g == null ? void 0 : g.clientY) ?? l.value
|
|
748
|
+
), s = L == null ? void 0 : L.distanceTo(R), g.button === 0 ? (M(d, g), O === ((U = n.value[0]) == null ? void 0 : U.object) ? G = !0 : (O = (re = n.value[0]) == null ? void 0 : re.object, G = !1)) : g.button === 2 && M(b, g)), M(h, g));
|
|
749
|
+
}, De = (g) => {
|
|
750
|
+
G && (M(y, g), O = void 0, G = !1);
|
|
751
|
+
}, je = (g) => M(p, g), Be = (g) => M(E, g);
|
|
752
|
+
return r.value.addEventListener("pointerup", Oe), r.value.addEventListener("pointerdown", B), r.value.addEventListener("pointermove", m), r.value.addEventListener("pointerleave", je), r.value.addEventListener("dblclick", De), r.value.addEventListener("wheel", Be), K(() => {
|
|
753
|
+
r != null && r.value && (r.value.removeEventListener("pointerup", Oe), r.value.removeEventListener("pointerdown", B), r.value.removeEventListener("pointermove", m), r.value.removeEventListener("pointerleave", je), r.value.removeEventListener("dblclick", De), r.value.removeEventListener("wheel", Be));
|
|
739
754
|
}), {
|
|
740
|
-
intersects:
|
|
741
|
-
onClick: (
|
|
742
|
-
onDblClick: (
|
|
743
|
-
onContextMenu: (
|
|
744
|
-
onPointerMove: (
|
|
745
|
-
onPointerUp: (
|
|
746
|
-
onPointerDown: (
|
|
747
|
-
onPointerMissed: (
|
|
748
|
-
onWheel: (
|
|
749
|
-
forceUpdate:
|
|
755
|
+
intersects: n,
|
|
756
|
+
onClick: (g) => d.on(g).off,
|
|
757
|
+
onDblClick: (g) => y.on(g).off,
|
|
758
|
+
onContextMenu: (g) => b.on(g).off,
|
|
759
|
+
onPointerMove: (g) => p.on(g).off,
|
|
760
|
+
onPointerUp: (g) => h.on(g).off,
|
|
761
|
+
onPointerDown: (g) => P.on(g).off,
|
|
762
|
+
onPointerMissed: (g) => C.on(g).off,
|
|
763
|
+
onWheel: (g) => E.on(g).off,
|
|
764
|
+
forceUpdate: w
|
|
750
765
|
};
|
|
751
766
|
};
|
|
752
|
-
function
|
|
767
|
+
function ye(e, t) {
|
|
753
768
|
if (Array.isArray(e))
|
|
754
|
-
for (const
|
|
755
|
-
|
|
769
|
+
for (const r of e)
|
|
770
|
+
r(t);
|
|
756
771
|
typeof e == "function" && e(t);
|
|
757
772
|
}
|
|
758
|
-
function
|
|
773
|
+
function Tn(e, t, r) {
|
|
759
774
|
var x;
|
|
760
|
-
const
|
|
761
|
-
e && (
|
|
775
|
+
const n = H(), o = H();
|
|
776
|
+
e && (n.value = e), t && (o.value = t);
|
|
762
777
|
const l = (m) => {
|
|
763
|
-
var
|
|
764
|
-
return ((
|
|
778
|
+
var w;
|
|
779
|
+
return ((w = m.__tres) == null ? void 0 : w.eventCount) > 0;
|
|
765
780
|
}, s = (m) => {
|
|
766
|
-
var
|
|
767
|
-
return ((
|
|
768
|
-
}, a =
|
|
769
|
-
function c(m,
|
|
770
|
-
const k = [], L = () =>
|
|
771
|
-
|
|
772
|
-
for (const R of
|
|
773
|
-
if (
|
|
781
|
+
var w;
|
|
782
|
+
return ((w = m.children) == null ? void 0 : w.some((k) => s(k))) || l(m);
|
|
783
|
+
}, a = H(((x = n.value) == null ? void 0 : x.children).filter(s) || []);
|
|
784
|
+
function c(m, w) {
|
|
785
|
+
const k = [], L = () => w.stopPropagating = !0;
|
|
786
|
+
w.stopPropagation = L;
|
|
787
|
+
for (const R of w == null ? void 0 : w.intersections) {
|
|
788
|
+
if (w.stopPropagating)
|
|
774
789
|
return;
|
|
775
|
-
|
|
776
|
-
const { object:
|
|
777
|
-
|
|
778
|
-
let O =
|
|
779
|
-
for (; O !== null && !
|
|
780
|
-
|
|
781
|
-
const
|
|
782
|
-
|
|
790
|
+
w = { ...w, ...R };
|
|
791
|
+
const { object: B } = R;
|
|
792
|
+
w.eventObject = B, ye(B[m], w), k.push(B);
|
|
793
|
+
let O = B.parent;
|
|
794
|
+
for (; O !== null && !w.stopPropagating && !k.includes(O); )
|
|
795
|
+
w.eventObject = O, ye(O[m], w), k.push(O), O = O.parent;
|
|
796
|
+
const G = Xr(m.slice(2));
|
|
797
|
+
r(G, { intersection: R, event: w });
|
|
783
798
|
}
|
|
784
799
|
}
|
|
785
800
|
const {
|
|
786
801
|
onClick: i,
|
|
787
802
|
onDblClick: f,
|
|
788
|
-
onContextMenu:
|
|
803
|
+
onContextMenu: v,
|
|
789
804
|
onPointerMove: u,
|
|
790
|
-
onPointerDown:
|
|
791
|
-
onPointerUp:
|
|
792
|
-
onPointerMissed:
|
|
793
|
-
onWheel:
|
|
794
|
-
forceUpdate:
|
|
795
|
-
} =
|
|
796
|
-
|
|
805
|
+
onPointerDown: _,
|
|
806
|
+
onPointerUp: d,
|
|
807
|
+
onPointerMissed: y,
|
|
808
|
+
onWheel: p,
|
|
809
|
+
forceUpdate: h
|
|
810
|
+
} = En(a, t);
|
|
811
|
+
d((m) => c("onPointerUp", m)), _((m) => c("onPointerDown", m)), i((m) => c("onClick", m)), f((m) => c("onDoubleClick", m)), v((m) => c("onContextMenu", m)), p((m) => c("onWheel", m));
|
|
797
812
|
let P = [];
|
|
798
813
|
u((m) => {
|
|
799
|
-
const
|
|
814
|
+
const w = m.intersections.map(({ object: L }) => L), k = m.intersections;
|
|
800
815
|
P.forEach(({ object: L }) => {
|
|
801
|
-
|
|
816
|
+
w.includes(L) || (m.intersections = P, c("onPointerLeave", m), c("onPointerOut", m));
|
|
802
817
|
}), m.intersections = k, m.intersections.forEach(({ object: L }) => {
|
|
803
818
|
P.includes(L) || (c("onPointerEnter", m), c("onPointerOver", m));
|
|
804
819
|
}), c("onPointerMove", m), P = m.intersections;
|
|
805
820
|
});
|
|
806
821
|
const C = [];
|
|
807
|
-
|
|
808
|
-
const
|
|
809
|
-
m.stopPropagation =
|
|
810
|
-
m.stopPropagating || (m.eventObject = k,
|
|
811
|
-
}),
|
|
822
|
+
y((m) => {
|
|
823
|
+
const w = () => m.stopPropagating = !0;
|
|
824
|
+
m.stopPropagation = w, C.forEach((k) => {
|
|
825
|
+
m.stopPropagating || (m.eventObject = k, ye(k.onPointerMissed, m));
|
|
826
|
+
}), r("pointer-missed", { event: m });
|
|
812
827
|
});
|
|
813
|
-
function
|
|
814
|
-
|
|
828
|
+
function b(m) {
|
|
829
|
+
ne(m) && N(m) && a.value.push(m);
|
|
815
830
|
}
|
|
816
831
|
function E(m) {
|
|
817
|
-
if (
|
|
818
|
-
const
|
|
819
|
-
|
|
832
|
+
if (ne(m) && N(m)) {
|
|
833
|
+
const w = a.value.indexOf(m);
|
|
834
|
+
w > -1 && a.value.splice(w, 1);
|
|
820
835
|
}
|
|
821
836
|
}
|
|
822
837
|
function S(m) {
|
|
823
|
-
|
|
838
|
+
ne(m) && N(m) && m.onPointerMissed && C.push(m);
|
|
824
839
|
}
|
|
825
840
|
function M(m) {
|
|
826
|
-
if (
|
|
827
|
-
const
|
|
828
|
-
|
|
841
|
+
if (ne(m) && N(m)) {
|
|
842
|
+
const w = C.indexOf(m);
|
|
843
|
+
w > -1 && C.splice(w, 1);
|
|
829
844
|
}
|
|
830
845
|
}
|
|
831
846
|
return t.eventManager = {
|
|
832
|
-
forceUpdate:
|
|
833
|
-
registerObject:
|
|
847
|
+
forceUpdate: h,
|
|
848
|
+
registerObject: b,
|
|
834
849
|
deregisterObject: E,
|
|
835
850
|
registerPointerMissedObject: S,
|
|
836
851
|
deregisterPointerMissedObject: M
|
|
837
852
|
}, {
|
|
838
|
-
forceUpdate:
|
|
839
|
-
registerObject:
|
|
853
|
+
forceUpdate: h,
|
|
854
|
+
registerObject: b,
|
|
840
855
|
deregisterObject: E,
|
|
841
856
|
registerPointerMissedObject: S,
|
|
842
857
|
deregisterPointerMissedObject: M
|
|
843
858
|
};
|
|
844
859
|
}
|
|
845
|
-
function
|
|
846
|
-
|
|
847
|
-
const
|
|
860
|
+
function Sn(e, t, r = 100) {
|
|
861
|
+
r = r <= 0 ? 100 : r;
|
|
862
|
+
const n = D(), o = /* @__PURE__ */ new Set();
|
|
848
863
|
let l = !1, s = !1, a = null;
|
|
849
864
|
function c() {
|
|
850
|
-
a && clearTimeout(a), !s && !l && e() ? (
|
|
865
|
+
a && clearTimeout(a), !s && !l && e() ? (n.trigger(t), o.forEach((u) => u()), o.clear(), l = !0) : !s && !l && (a = setTimeout(c, r));
|
|
851
866
|
}
|
|
852
867
|
function i() {
|
|
853
868
|
s = !0, a && clearTimeout(a);
|
|
854
869
|
}
|
|
855
870
|
c();
|
|
856
|
-
const f = (u, ...
|
|
857
|
-
u(...
|
|
871
|
+
const f = (u, ..._) => {
|
|
872
|
+
u(..._);
|
|
858
873
|
};
|
|
859
874
|
return {
|
|
860
875
|
on: (u) => {
|
|
@@ -862,22 +877,22 @@ function wr(e, t, n = 100) {
|
|
|
862
877
|
return f(u, t), { off: () => {
|
|
863
878
|
} };
|
|
864
879
|
{
|
|
865
|
-
const
|
|
866
|
-
return o.add(
|
|
880
|
+
const _ = n.on(u);
|
|
881
|
+
return o.add(_.off), n.on(u);
|
|
867
882
|
}
|
|
868
883
|
},
|
|
869
|
-
off:
|
|
870
|
-
trigger:
|
|
871
|
-
clear:
|
|
884
|
+
off: n.off,
|
|
885
|
+
trigger: n.trigger,
|
|
886
|
+
clear: n.clear,
|
|
872
887
|
cancel: i
|
|
873
888
|
};
|
|
874
889
|
}
|
|
875
890
|
const ee = /* @__PURE__ */ new WeakMap();
|
|
876
|
-
function
|
|
877
|
-
if (e = e ||
|
|
891
|
+
function bt(e) {
|
|
892
|
+
if (e = e || pe(), ee.has(e))
|
|
878
893
|
return ee.get(e);
|
|
879
|
-
const t = 100,
|
|
880
|
-
if (Date.now() -
|
|
894
|
+
const t = 100, r = Date.now(), l = Sn(() => {
|
|
895
|
+
if (Date.now() - r >= t)
|
|
881
896
|
return !0;
|
|
882
897
|
{
|
|
883
898
|
const s = e.renderer.value, a = (s == null ? void 0 : s.domElement) || { width: 0, height: 0 };
|
|
@@ -886,52 +901,52 @@ function yt(e) {
|
|
|
886
901
|
}, e);
|
|
887
902
|
return ee.set(e, l), l;
|
|
888
903
|
}
|
|
889
|
-
function
|
|
890
|
-
const t =
|
|
904
|
+
function oo(e) {
|
|
905
|
+
const t = pe();
|
|
891
906
|
if (t)
|
|
892
|
-
return ee.has(t) ? ee.get(t).on(e) :
|
|
907
|
+
return ee.has(t) ? ee.get(t).on(e) : bt(t).on(e);
|
|
893
908
|
}
|
|
894
|
-
function
|
|
909
|
+
function An({
|
|
895
910
|
scene: e,
|
|
896
911
|
canvas: t,
|
|
897
|
-
windowSize:
|
|
898
|
-
rendererOptions:
|
|
912
|
+
windowSize: r,
|
|
913
|
+
rendererOptions: n,
|
|
899
914
|
emit: o
|
|
900
915
|
}) {
|
|
901
|
-
const l =
|
|
916
|
+
const l = H(e), s = Cn(r, t), {
|
|
902
917
|
camera: a,
|
|
903
918
|
cameras: c,
|
|
904
919
|
registerCamera: i,
|
|
905
920
|
deregisterCamera: f,
|
|
906
|
-
setCameraActive:
|
|
907
|
-
} =
|
|
908
|
-
mode:
|
|
909
|
-
priority:
|
|
910
|
-
frames:
|
|
921
|
+
setCameraActive: v
|
|
922
|
+
} = mn({ sizes: s }), u = {
|
|
923
|
+
mode: $(n.renderMode || "always"),
|
|
924
|
+
priority: $(0),
|
|
925
|
+
frames: $(0),
|
|
911
926
|
maxFrames: 60,
|
|
912
927
|
canBeInvalidated: q(() => u.mode.value === "on-demand" && u.frames.value === 0)
|
|
913
928
|
};
|
|
914
|
-
function
|
|
915
|
-
|
|
929
|
+
function _(R = 1) {
|
|
930
|
+
n.renderMode === "on-demand" && (u.frames.value = Math.min(u.maxFrames, u.frames.value + R));
|
|
916
931
|
}
|
|
917
|
-
function
|
|
918
|
-
|
|
932
|
+
function d() {
|
|
933
|
+
n.renderMode === "manual" && (u.frames.value = 1);
|
|
919
934
|
}
|
|
920
|
-
const { renderer:
|
|
935
|
+
const { renderer: y } = Pn(
|
|
921
936
|
{
|
|
922
937
|
canvas: t,
|
|
923
|
-
options:
|
|
938
|
+
options: n,
|
|
924
939
|
// TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
|
|
925
|
-
contextParts: { sizes: s, render: u, invalidate:
|
|
940
|
+
contextParts: { sizes: s, render: u, invalidate: _, advance: d }
|
|
926
941
|
}
|
|
927
|
-
),
|
|
942
|
+
), p = {
|
|
928
943
|
sizes: s,
|
|
929
944
|
scene: l,
|
|
930
945
|
camera: a,
|
|
931
|
-
cameras:
|
|
932
|
-
renderer:
|
|
933
|
-
raycaster:
|
|
934
|
-
controls:
|
|
946
|
+
cameras: _e(c),
|
|
947
|
+
renderer: y,
|
|
948
|
+
raycaster: H(new qt()),
|
|
949
|
+
controls: $(null),
|
|
935
950
|
perf: {
|
|
936
951
|
maxFrames: 160,
|
|
937
952
|
fps: {
|
|
@@ -945,106 +960,106 @@ function br({
|
|
|
945
960
|
}
|
|
946
961
|
},
|
|
947
962
|
render: u,
|
|
948
|
-
advance:
|
|
963
|
+
advance: d,
|
|
949
964
|
extend: Ee,
|
|
950
|
-
invalidate:
|
|
965
|
+
invalidate: _,
|
|
951
966
|
registerCamera: i,
|
|
952
|
-
setCameraActive:
|
|
967
|
+
setCameraActive: v,
|
|
953
968
|
deregisterCamera: f,
|
|
954
|
-
loop:
|
|
969
|
+
loop: _n()
|
|
955
970
|
};
|
|
956
|
-
|
|
957
|
-
root:
|
|
958
|
-
},
|
|
959
|
-
a.value && u.frames.value > 0 && (
|
|
971
|
+
ae("useTres", p), p.scene.value.__tres = {
|
|
972
|
+
root: p
|
|
973
|
+
}, p.loop.register(() => {
|
|
974
|
+
a.value && u.frames.value > 0 && (y.value.render(e, a.value), o("render", p.renderer.value)), u.priority.value = 0, u.mode.value === "always" ? u.frames.value = 1 : u.frames.value = Math.max(0, u.frames.value - 1);
|
|
960
975
|
}, "render");
|
|
961
|
-
const { on:
|
|
962
|
-
|
|
963
|
-
o("ready",
|
|
976
|
+
const { on: h, cancel: P } = bt(p);
|
|
977
|
+
p.loop.setReady(!1), p.loop.start(), h(() => {
|
|
978
|
+
o("ready", p), p.loop.setReady(!0), Tn(e, p, o);
|
|
964
979
|
}), K(() => {
|
|
965
|
-
P(),
|
|
980
|
+
P(), p.loop.stop();
|
|
966
981
|
});
|
|
967
|
-
const C = 100,
|
|
982
|
+
const C = 100, b = dr({ every: C }), { isSupported: E, memory: S } = mr({ interval: C }), M = 160;
|
|
968
983
|
let x = performance.now();
|
|
969
984
|
const m = ({ timestamp: R }) => {
|
|
970
|
-
|
|
985
|
+
p.scene.value && (p.perf.memory.allocatedMem = Le(p.scene.value)), R - x >= C && (x = R, p.perf.fps.accumulator.push(b.value), p.perf.fps.accumulator.length > M && p.perf.fps.accumulator.shift(), p.perf.fps.value = b.value, E.value && S.value && (p.perf.memory.accumulator.push(S.value.usedJSHeapSize / 1024 / 1024), p.perf.memory.accumulator.length > M && p.perf.memory.accumulator.shift(), p.perf.memory.currentMem = p.perf.memory.accumulator.reduce((B, O) => B + O, 0) / p.perf.memory.accumulator.length));
|
|
971
986
|
};
|
|
972
|
-
let
|
|
973
|
-
const k = 1, { pause: L } =
|
|
974
|
-
window.__TRES__DEVTOOLS__ && (m({ timestamp: performance.now() }),
|
|
987
|
+
let w = 0;
|
|
988
|
+
const k = 1, { pause: L } = pt(({ delta: R }) => {
|
|
989
|
+
window.__TRES__DEVTOOLS__ && (m({ timestamp: performance.now() }), w += R, w >= k && (window.__TRES__DEVTOOLS__.cb(p), w = 0));
|
|
975
990
|
}, { immediate: !0 });
|
|
976
991
|
return K(() => {
|
|
977
992
|
L();
|
|
978
|
-
}),
|
|
993
|
+
}), p;
|
|
979
994
|
}
|
|
980
|
-
function
|
|
981
|
-
const e =
|
|
995
|
+
function pe() {
|
|
996
|
+
const e = kt("useTres");
|
|
982
997
|
if (!e)
|
|
983
998
|
throw new Error("useTresContext must be used together with useTresContextProvider");
|
|
984
999
|
return e;
|
|
985
1000
|
}
|
|
986
|
-
const
|
|
987
|
-
function
|
|
1001
|
+
const so = pe;
|
|
1002
|
+
function io() {
|
|
988
1003
|
const {
|
|
989
1004
|
camera: e,
|
|
990
1005
|
scene: t,
|
|
991
|
-
renderer:
|
|
992
|
-
loop:
|
|
1006
|
+
renderer: r,
|
|
1007
|
+
loop: n,
|
|
993
1008
|
raycaster: o,
|
|
994
1009
|
controls: l,
|
|
995
1010
|
invalidate: s,
|
|
996
1011
|
advance: a
|
|
997
|
-
} =
|
|
998
|
-
|
|
1012
|
+
} = pe();
|
|
1013
|
+
n.setContext({
|
|
999
1014
|
camera: e,
|
|
1000
1015
|
scene: t,
|
|
1001
|
-
renderer:
|
|
1016
|
+
renderer: r,
|
|
1002
1017
|
raycaster: o,
|
|
1003
1018
|
controls: l,
|
|
1004
1019
|
invalidate: s,
|
|
1005
1020
|
advance: a
|
|
1006
1021
|
});
|
|
1007
|
-
function c(
|
|
1008
|
-
return
|
|
1022
|
+
function c(v, u = 0) {
|
|
1023
|
+
return n.register(v, "before", u);
|
|
1009
1024
|
}
|
|
1010
|
-
function i(
|
|
1011
|
-
return
|
|
1025
|
+
function i(v) {
|
|
1026
|
+
return n.register(v, "render");
|
|
1012
1027
|
}
|
|
1013
|
-
function f(
|
|
1014
|
-
return
|
|
1028
|
+
function f(v, u = 0) {
|
|
1029
|
+
return n.register(v, "after", u);
|
|
1015
1030
|
}
|
|
1016
1031
|
return {
|
|
1017
|
-
pause:
|
|
1018
|
-
resume:
|
|
1019
|
-
pauseRender:
|
|
1020
|
-
resumeRender:
|
|
1021
|
-
isActive:
|
|
1032
|
+
pause: n.pause,
|
|
1033
|
+
resume: n.resume,
|
|
1034
|
+
pauseRender: n.pauseRender,
|
|
1035
|
+
resumeRender: n.resumeRender,
|
|
1036
|
+
isActive: n.isActive,
|
|
1022
1037
|
onBeforeRender: c,
|
|
1023
1038
|
render: i,
|
|
1024
1039
|
onAfterRender: f
|
|
1025
1040
|
};
|
|
1026
1041
|
}
|
|
1027
|
-
const
|
|
1028
|
-
let
|
|
1029
|
-
const { pause:
|
|
1042
|
+
const Mt = D(), Pt = D(), Re = D(), te = new ut();
|
|
1043
|
+
let le = 0, ce = 0;
|
|
1044
|
+
const { pause: xn, resume: Xe, isActive: kn } = pt(
|
|
1030
1045
|
() => {
|
|
1031
|
-
|
|
1046
|
+
Mt.trigger({ delta: le, elapsed: ce, clock: te }), Pt.trigger({ delta: le, elapsed: ce, clock: te }), Re.trigger({ delta: le, elapsed: ce, clock: te });
|
|
1032
1047
|
},
|
|
1033
1048
|
{ immediate: !1 }
|
|
1034
1049
|
);
|
|
1035
|
-
|
|
1036
|
-
|
|
1050
|
+
Re.on(() => {
|
|
1051
|
+
le = te.getDelta(), ce = te.getElapsedTime();
|
|
1037
1052
|
});
|
|
1038
|
-
let
|
|
1039
|
-
const
|
|
1040
|
-
onBeforeLoop:
|
|
1041
|
-
onLoop:
|
|
1042
|
-
onAfterLoop:
|
|
1043
|
-
pause:
|
|
1044
|
-
resume:
|
|
1045
|
-
isActive:
|
|
1053
|
+
let Ze = !1;
|
|
1054
|
+
const ao = () => (Ze || (Ze = !0, Xe()), {
|
|
1055
|
+
onBeforeLoop: Mt.on,
|
|
1056
|
+
onLoop: Pt.on,
|
|
1057
|
+
onAfterLoop: Re.on,
|
|
1058
|
+
pause: xn,
|
|
1059
|
+
resume: Xe,
|
|
1060
|
+
isActive: kn
|
|
1046
1061
|
});
|
|
1047
|
-
function
|
|
1062
|
+
function lo() {
|
|
1048
1063
|
const { logWarning: e } = Q();
|
|
1049
1064
|
function t(l, s, a) {
|
|
1050
1065
|
let c = null;
|
|
@@ -1052,46 +1067,45 @@ function to() {
|
|
|
1052
1067
|
i[s] === a && (c = i);
|
|
1053
1068
|
}), c || e(`Child with ${s} '${a}' not found.`), c;
|
|
1054
1069
|
}
|
|
1055
|
-
function
|
|
1070
|
+
function r(l, s, a) {
|
|
1056
1071
|
const c = [];
|
|
1057
1072
|
return l.traverse((i) => {
|
|
1058
1073
|
i[s].includes(a) && c.push(i);
|
|
1059
1074
|
}), c.length || e(`Children with ${s} '${a}' not found.`), c;
|
|
1060
1075
|
}
|
|
1061
|
-
function
|
|
1076
|
+
function n(l, s) {
|
|
1062
1077
|
return t(l, "name", s);
|
|
1063
1078
|
}
|
|
1064
1079
|
function o(l, s) {
|
|
1065
|
-
return
|
|
1080
|
+
return r(l, "name", s);
|
|
1066
1081
|
}
|
|
1067
1082
|
return {
|
|
1068
1083
|
seek: t,
|
|
1069
|
-
seekByName:
|
|
1070
|
-
seekAll:
|
|
1084
|
+
seekByName: n,
|
|
1085
|
+
seekAll: r,
|
|
1071
1086
|
seekAllByName: o
|
|
1072
1087
|
};
|
|
1073
1088
|
}
|
|
1074
|
-
function
|
|
1075
|
-
let
|
|
1089
|
+
function Ln(e, t = {}, r = {}) {
|
|
1090
|
+
let n = e;
|
|
1076
1091
|
const o = (a) => {
|
|
1077
|
-
|
|
1092
|
+
n = a;
|
|
1078
1093
|
};
|
|
1079
1094
|
let l = new Proxy({}, {});
|
|
1080
1095
|
const s = {
|
|
1081
1096
|
has(a, c) {
|
|
1082
|
-
return c in t || c in
|
|
1097
|
+
return c in t || c in n;
|
|
1083
1098
|
},
|
|
1084
1099
|
get(a, c, i) {
|
|
1085
|
-
return c in t ? t[c](
|
|
1100
|
+
return c in t ? t[c](n) : n[c];
|
|
1086
1101
|
},
|
|
1087
1102
|
set(a, c, i) {
|
|
1088
|
-
|
|
1089
|
-
return f && typeof f == "function" ? f(i, r, l, o) : r[c] = i, !0;
|
|
1103
|
+
return r[c] ? r[c](i, n, l, o) : n[c] = i, !0;
|
|
1090
1104
|
}
|
|
1091
1105
|
};
|
|
1092
1106
|
return l = new Proxy({}, s), l;
|
|
1093
1107
|
}
|
|
1094
|
-
const { logError:
|
|
1108
|
+
const { logError: et } = Q(), tt = [
|
|
1095
1109
|
"onClick",
|
|
1096
1110
|
"onContextMenu",
|
|
1097
1111
|
"onPointerMove",
|
|
@@ -1106,68 +1120,68 @@ const { logError: Xe } = Q(), Ze = [
|
|
|
1106
1120
|
"onPointerMissed",
|
|
1107
1121
|
"onLostPointerCapture",
|
|
1108
1122
|
"onWheel"
|
|
1109
|
-
],
|
|
1123
|
+
], Rn = (e) => {
|
|
1110
1124
|
const t = e.scene.value;
|
|
1111
|
-
function
|
|
1112
|
-
if (u || (u = {}), u.args || (u.args = []), i === "template" ||
|
|
1125
|
+
function r(i, f, v, u) {
|
|
1126
|
+
if (u || (u = {}), u.args || (u.args = []), i === "template" || Jr(i))
|
|
1113
1127
|
return null;
|
|
1114
|
-
let
|
|
1128
|
+
let _ = i.replace("Tres", ""), d;
|
|
1115
1129
|
if (i === "primitive") {
|
|
1116
|
-
(!
|
|
1130
|
+
(!j(u.object) || Lt(u.object)) && et(
|
|
1117
1131
|
"Tres primitives need an 'object' prop, whose value is an object or shallowRef<object>"
|
|
1118
|
-
),
|
|
1119
|
-
const
|
|
1120
|
-
|
|
1132
|
+
), _ = u.object.type;
|
|
1133
|
+
const y = {};
|
|
1134
|
+
d = Ln(
|
|
1121
1135
|
u.object,
|
|
1122
1136
|
{
|
|
1123
|
-
object: (
|
|
1137
|
+
object: (h) => h,
|
|
1124
1138
|
isPrimitive: () => !0,
|
|
1125
|
-
__tres: () =>
|
|
1139
|
+
__tres: () => y
|
|
1126
1140
|
},
|
|
1127
1141
|
{
|
|
1128
|
-
object: (
|
|
1129
|
-
|
|
1142
|
+
object: (h, P, C, b) => {
|
|
1143
|
+
pn(h, C, b, { patchProp: l, remove: o, insert: n }, e);
|
|
1130
1144
|
},
|
|
1131
|
-
__tres: (
|
|
1132
|
-
Object.assign(
|
|
1145
|
+
__tres: (h) => {
|
|
1146
|
+
Object.assign(y, h);
|
|
1133
1147
|
}
|
|
1134
1148
|
}
|
|
1135
1149
|
);
|
|
1136
1150
|
} else {
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1139
|
-
`${
|
|
1140
|
-
),
|
|
1151
|
+
const y = Ce.value[_];
|
|
1152
|
+
y || et(
|
|
1153
|
+
`${_} is not defined on the THREE namespace. Use extend to add it to the catalog.`
|
|
1154
|
+
), d = new y(...u.args);
|
|
1141
1155
|
}
|
|
1142
|
-
return
|
|
1143
|
-
...
|
|
1144
|
-
type:
|
|
1156
|
+
return d ? (d.isCamera && (u != null && u.position || d.position.set(3, 3, 3), u != null && u.lookAt || d.lookAt(0, 0, 0)), d = z(d, {
|
|
1157
|
+
...d.__tres,
|
|
1158
|
+
type: _,
|
|
1145
1159
|
memoizedProps: u,
|
|
1146
1160
|
eventCount: 0,
|
|
1147
1161
|
primitive: i === "primitive",
|
|
1148
1162
|
attach: u.attach
|
|
1149
|
-
}, e),
|
|
1163
|
+
}, e), d) : null;
|
|
1150
1164
|
}
|
|
1151
|
-
function
|
|
1152
|
-
var
|
|
1165
|
+
function n(i, f) {
|
|
1166
|
+
var _, d, y;
|
|
1153
1167
|
if (!i)
|
|
1154
1168
|
return;
|
|
1155
1169
|
f = f || t;
|
|
1156
|
-
const
|
|
1157
|
-
i = J(
|
|
1170
|
+
const v = i.__tres ? i : z(i, {}, e), u = f.__tres ? f : z(f, {}, e);
|
|
1171
|
+
i = J(v), f = J(u), i.__tres && ((_ = i.__tres) == null ? void 0 : _.eventCount) > 0 && ((d = e.eventManager) == null || d.registerObject(i)), e.registerCamera(i), (y = e.eventManager) == null || y.registerPointerMissedObject(i), v.__tres.attach ? cn(u, v, v.__tres.attach) : N(i) && N(u) && (u.add(i), i.dispatchEvent({ type: "added" })), v.__tres.parent = u, u.__tres.objects && !u.__tres.objects.includes(v) && u.__tres.objects.push(v);
|
|
1158
1172
|
}
|
|
1159
1173
|
function o(i, f) {
|
|
1160
|
-
var
|
|
1174
|
+
var d, y, p, h;
|
|
1161
1175
|
if (!i)
|
|
1162
1176
|
return;
|
|
1163
|
-
i != null && i.__tres && ((
|
|
1164
|
-
const
|
|
1165
|
-
|
|
1166
|
-
const u = (
|
|
1167
|
-
if (i.__tres && "objects" in i.__tres && [...i.__tres.objects].forEach((P) => o(P, f)),
|
|
1168
|
-
if (
|
|
1177
|
+
i != null && i.__tres && ((d = i.__tres) == null ? void 0 : d.eventCount) > 0 && ((y = e.eventManager) == null || y.deregisterObject(i)), f = be(f) ? "default" : f;
|
|
1178
|
+
const v = (p = i.__tres) == null ? void 0 : p.dispose;
|
|
1179
|
+
be(v) || (v === null ? f = !1 : f = v);
|
|
1180
|
+
const u = (h = i.__tres) == null ? void 0 : h.primitive, _ = f === "default" ? !u : !!f;
|
|
1181
|
+
if (i.__tres && "objects" in i.__tres && [...i.__tres.objects].forEach((P) => o(P, f)), _ && i.children && [...i.children].forEach((P) => o(P, f)), _t(i, e), wt(i, e), _ && !Yr(i)) {
|
|
1182
|
+
if (Y(f))
|
|
1169
1183
|
f(i);
|
|
1170
|
-
else if (
|
|
1184
|
+
else if (Y(i.dispose))
|
|
1171
1185
|
try {
|
|
1172
1186
|
i.dispose();
|
|
1173
1187
|
} catch {
|
|
@@ -1175,71 +1189,72 @@ const { logError: Xe } = Q(), Ze = [
|
|
|
1175
1189
|
}
|
|
1176
1190
|
"__tres" in i && delete i.__tres;
|
|
1177
1191
|
}
|
|
1178
|
-
function l(i, f,
|
|
1192
|
+
function l(i, f, v, u) {
|
|
1179
1193
|
var P, C;
|
|
1180
1194
|
if (!i)
|
|
1181
1195
|
return;
|
|
1182
|
-
let
|
|
1196
|
+
let _ = i, d = f;
|
|
1183
1197
|
if (i.__tres && (i.__tres.memoizedProps[f] = u), f === "attach") {
|
|
1184
|
-
const
|
|
1185
|
-
o(i), z(i, { attach: u }, e),
|
|
1198
|
+
const b = ((P = i.__tres) == null ? void 0 : P.parent) || i.parent;
|
|
1199
|
+
o(i), z(i, { attach: u }, e), b && n(i, b);
|
|
1186
1200
|
return;
|
|
1187
1201
|
}
|
|
1188
1202
|
if (f === "dispose") {
|
|
1189
1203
|
i.__tres || (i = z(i, {}, e)), i.__tres.dispose = u;
|
|
1190
1204
|
return;
|
|
1191
1205
|
}
|
|
1192
|
-
if (N(i) &&
|
|
1193
|
-
u || u === "" ? i[
|
|
1206
|
+
if (N(i) && d === "blocks-pointer-events") {
|
|
1207
|
+
u || u === "" ? i[d] = u : delete i[d];
|
|
1194
1208
|
return;
|
|
1195
1209
|
}
|
|
1196
|
-
|
|
1197
|
-
let
|
|
1198
|
-
if (
|
|
1199
|
-
const
|
|
1200
|
-
M && E.length && !
|
|
1201
|
-
|
|
1210
|
+
tt.includes(f) && i.__tres && (i.__tres.eventCount += 1);
|
|
1211
|
+
let y = he(d), p = _ == null ? void 0 : _[y];
|
|
1212
|
+
if (d === "args") {
|
|
1213
|
+
const b = i, E = v ?? [], S = u ?? [], M = ((C = i.__tres) == null ? void 0 : C.type) || i.type;
|
|
1214
|
+
M && E.length && !tn(E, S) && (_ = Object.assign(
|
|
1215
|
+
b,
|
|
1202
1216
|
new Ce.value[M](...u)
|
|
1203
1217
|
));
|
|
1204
1218
|
return;
|
|
1205
1219
|
}
|
|
1206
|
-
if (
|
|
1207
|
-
if (
|
|
1220
|
+
if (_.type === "BufferGeometry") {
|
|
1221
|
+
if (d === "args")
|
|
1208
1222
|
return;
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
new
|
|
1223
|
+
_.setAttribute(
|
|
1224
|
+
he(d),
|
|
1225
|
+
new Jt(...u)
|
|
1212
1226
|
);
|
|
1213
1227
|
return;
|
|
1214
1228
|
}
|
|
1215
|
-
if (
|
|
1216
|
-
|
|
1217
|
-
|
|
1229
|
+
if (d.includes("-") && p === void 0) {
|
|
1230
|
+
p = _;
|
|
1231
|
+
for (const b of d.split("-"))
|
|
1232
|
+
y = d = he(b), _ = p, p = p == null ? void 0 : p[d];
|
|
1218
1233
|
}
|
|
1219
|
-
let
|
|
1220
|
-
if (
|
|
1221
|
-
|
|
1234
|
+
let h = u;
|
|
1235
|
+
if (h === "" && (h = !0), Y(p)) {
|
|
1236
|
+
tt.includes(f) || (ke(h) ? i[y](...h) : i[y](h)), y.startsWith("on") && Y(h) && (_[y] = h);
|
|
1222
1237
|
return;
|
|
1223
1238
|
}
|
|
1224
|
-
|
|
1239
|
+
Ge(p) && Ge(h) ? p.mask = h.mask : mt(p) && Ur(h) ? p.set(h) : Fr(p) && Wr(h) && p.constructor === h.constructor ? p.copy(h) : Me(p) && Array.isArray(h) ? "fromArray" in p && typeof p.fromArray == "function" ? p.fromArray(h) : p.set(...h) : Me(p) && typeof h == "number" ? "setScalar" in p && typeof p.setScalar == "function" ? p.setScalar(h) : p.set(h) : _[y] = h, yt(i);
|
|
1225
1240
|
}
|
|
1226
1241
|
function s(i) {
|
|
1227
1242
|
var f;
|
|
1228
1243
|
return ((f = i == null ? void 0 : i.__tres) == null ? void 0 : f.parent) || null;
|
|
1229
1244
|
}
|
|
1230
1245
|
function a(i) {
|
|
1231
|
-
const f = z(new
|
|
1246
|
+
const f = z(new Kt(), { type: "Comment" }, e);
|
|
1232
1247
|
return f.name = i, f;
|
|
1233
1248
|
}
|
|
1234
1249
|
function c(i) {
|
|
1235
|
-
var
|
|
1236
|
-
const f = s(i),
|
|
1237
|
-
return u < 0 || u >=
|
|
1250
|
+
var _;
|
|
1251
|
+
const f = s(i), v = ((_ = f == null ? void 0 : f.__tres) == null ? void 0 : _.objects) || [], u = v.indexOf(i);
|
|
1252
|
+
return u < 0 || u >= v.length - 1 ? null : v[u + 1];
|
|
1238
1253
|
}
|
|
1239
1254
|
return {
|
|
1240
|
-
insert:
|
|
1255
|
+
insert: n,
|
|
1241
1256
|
remove: o,
|
|
1242
|
-
createElement:
|
|
1257
|
+
createElement: r,
|
|
1243
1258
|
patchProp: l,
|
|
1244
1259
|
parentNode: s,
|
|
1245
1260
|
createText: () => void 0,
|
|
@@ -1253,32 +1268,32 @@ const { logError: Xe } = Q(), Ze = [
|
|
|
1253
1268
|
insertStaticContent: () => void 0
|
|
1254
1269
|
};
|
|
1255
1270
|
};
|
|
1256
|
-
function
|
|
1257
|
-
return
|
|
1271
|
+
function On() {
|
|
1272
|
+
return Ct().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
|
1258
1273
|
}
|
|
1259
|
-
function
|
|
1274
|
+
function Ct() {
|
|
1260
1275
|
return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
|
|
1261
1276
|
}
|
|
1262
|
-
const
|
|
1263
|
-
let
|
|
1264
|
-
function
|
|
1277
|
+
const Dn = typeof Proxy == "function", jn = "devtools-plugin:setup", Bn = "plugin:settings:set";
|
|
1278
|
+
let V, Te;
|
|
1279
|
+
function In() {
|
|
1265
1280
|
var e;
|
|
1266
|
-
return
|
|
1281
|
+
return V !== void 0 || (typeof window < "u" && window.performance ? (V = !0, Te = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (V = !0, Te = globalThis.perf_hooks.performance) : V = !1), V;
|
|
1267
1282
|
}
|
|
1268
|
-
function
|
|
1269
|
-
return
|
|
1283
|
+
function $n() {
|
|
1284
|
+
return In() ? Te.now() : Date.now();
|
|
1270
1285
|
}
|
|
1271
|
-
class
|
|
1272
|
-
constructor(t,
|
|
1273
|
-
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook =
|
|
1274
|
-
const
|
|
1286
|
+
class Hn {
|
|
1287
|
+
constructor(t, r) {
|
|
1288
|
+
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = r;
|
|
1289
|
+
const n = {};
|
|
1275
1290
|
if (t.settings)
|
|
1276
1291
|
for (const s in t.settings) {
|
|
1277
1292
|
const a = t.settings[s];
|
|
1278
|
-
|
|
1293
|
+
n[s] = a.defaultValue;
|
|
1279
1294
|
}
|
|
1280
1295
|
const o = `__vue-devtools-plugin-settings__${t.id}`;
|
|
1281
|
-
let l = Object.assign({},
|
|
1296
|
+
let l = Object.assign({}, n);
|
|
1282
1297
|
try {
|
|
1283
1298
|
const s = localStorage.getItem(o), a = JSON.parse(s);
|
|
1284
1299
|
Object.assign(l, a);
|
|
@@ -1296,9 +1311,9 @@ class Rr {
|
|
|
1296
1311
|
l = s;
|
|
1297
1312
|
},
|
|
1298
1313
|
now() {
|
|
1299
|
-
return
|
|
1314
|
+
return $n();
|
|
1300
1315
|
}
|
|
1301
|
-
},
|
|
1316
|
+
}, r && r.on(Bn, (s, a) => {
|
|
1302
1317
|
s === this.plugin.id && this.fallbacks.setSettings(a);
|
|
1303
1318
|
}), this.proxiedOn = new Proxy({}, {
|
|
1304
1319
|
get: (s, a) => this.target ? this.target.on[a] : (...c) => {
|
|
@@ -1324,33 +1339,33 @@ class Rr {
|
|
|
1324
1339
|
}
|
|
1325
1340
|
async setRealTarget(t) {
|
|
1326
1341
|
this.target = t;
|
|
1327
|
-
for (const
|
|
1328
|
-
this.target.on[
|
|
1329
|
-
for (const
|
|
1330
|
-
|
|
1342
|
+
for (const r of this.onQueue)
|
|
1343
|
+
this.target.on[r.method](...r.args);
|
|
1344
|
+
for (const r of this.targetQueue)
|
|
1345
|
+
r.resolve(await this.target[r.method](...r.args));
|
|
1331
1346
|
}
|
|
1332
1347
|
}
|
|
1333
|
-
function
|
|
1334
|
-
const
|
|
1335
|
-
if (o && (
|
|
1336
|
-
o.emit(
|
|
1348
|
+
function Un(e, t) {
|
|
1349
|
+
const r = e, n = Ct(), o = On(), l = Dn && r.enableEarlyProxy;
|
|
1350
|
+
if (o && (n.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !l))
|
|
1351
|
+
o.emit(jn, e, t);
|
|
1337
1352
|
else {
|
|
1338
|
-
const s = l ? new
|
|
1339
|
-
(
|
|
1340
|
-
pluginDescriptor:
|
|
1353
|
+
const s = l ? new Hn(r, o) : null;
|
|
1354
|
+
(n.__VUE_DEVTOOLS_PLUGINS__ = n.__VUE_DEVTOOLS_PLUGINS__ || []).push({
|
|
1355
|
+
pluginDescriptor: r,
|
|
1341
1356
|
setupFn: t,
|
|
1342
1357
|
proxy: s
|
|
1343
1358
|
}), s && t(s.proxiedTarget);
|
|
1344
1359
|
}
|
|
1345
1360
|
}
|
|
1346
|
-
function
|
|
1347
|
-
const
|
|
1348
|
-
typeof
|
|
1361
|
+
function Fn(e, t) {
|
|
1362
|
+
const r = `▲ ■ ●${e}`;
|
|
1363
|
+
typeof rt == "function" ? rt(r, t) : console.log(r);
|
|
1349
1364
|
}
|
|
1350
|
-
function
|
|
1365
|
+
function rt(e, t) {
|
|
1351
1366
|
throw new Error(e + t);
|
|
1352
1367
|
}
|
|
1353
|
-
const
|
|
1368
|
+
const Et = (e) => {
|
|
1354
1369
|
const t = {
|
|
1355
1370
|
id: e.uuid,
|
|
1356
1371
|
label: e.type,
|
|
@@ -1362,13 +1377,13 @@ const Mt = (e) => {
|
|
|
1362
1377
|
textColor: 5750629,
|
|
1363
1378
|
backgroundColor: 15793395
|
|
1364
1379
|
});
|
|
1365
|
-
const
|
|
1366
|
-
return
|
|
1367
|
-
label: `${
|
|
1380
|
+
const r = Le(e);
|
|
1381
|
+
return r > 0 && t.tags.push({
|
|
1382
|
+
label: `${wn(r)} KB`,
|
|
1368
1383
|
textColor: 15707189,
|
|
1369
1384
|
backgroundColor: 16775644,
|
|
1370
1385
|
tooltip: "Memory usage"
|
|
1371
|
-
}), e.type.includes("Light") && (
|
|
1386
|
+
}), e.type.includes("Light") && (Gr(e) && t.tags.push({
|
|
1372
1387
|
label: `${e.intensity}`,
|
|
1373
1388
|
textColor: 9738662,
|
|
1374
1389
|
backgroundColor: 16316922,
|
|
@@ -1390,56 +1405,56 @@ const Mt = (e) => {
|
|
|
1390
1405
|
tooltip: "Position"
|
|
1391
1406
|
})), t;
|
|
1392
1407
|
};
|
|
1393
|
-
function
|
|
1394
|
-
e.children.forEach((
|
|
1395
|
-
if (
|
|
1408
|
+
function Tt(e, t, r = "") {
|
|
1409
|
+
e.children.forEach((n) => {
|
|
1410
|
+
if (n.type === "HightlightMesh" || r && !n.type.includes(r) && !n.name.includes(r))
|
|
1396
1411
|
return;
|
|
1397
|
-
const o =
|
|
1398
|
-
t.children.push(o),
|
|
1412
|
+
const o = Et(n);
|
|
1413
|
+
t.children.push(o), Tt(n, o, r);
|
|
1399
1414
|
});
|
|
1400
1415
|
}
|
|
1401
|
-
const
|
|
1416
|
+
const Wn = [], X = "tres:inspector", Nn = Se({
|
|
1402
1417
|
sceneGraph: null
|
|
1403
1418
|
});
|
|
1404
|
-
function
|
|
1405
|
-
|
|
1419
|
+
function zn(e, t) {
|
|
1420
|
+
Un(
|
|
1406
1421
|
{
|
|
1407
1422
|
id: "dev.esm.tres",
|
|
1408
1423
|
label: "TresJS 🪐",
|
|
1409
1424
|
logo: "https://raw.githubusercontent.com/Tresjs/tres/main/public/favicon.svg",
|
|
1410
1425
|
packageName: "tresjs",
|
|
1411
1426
|
homepage: "https://tresjs.org",
|
|
1412
|
-
componentStateTypes:
|
|
1427
|
+
componentStateTypes: Wn,
|
|
1413
1428
|
app: e
|
|
1414
1429
|
},
|
|
1415
|
-
(
|
|
1416
|
-
typeof
|
|
1430
|
+
(r) => {
|
|
1431
|
+
typeof r.now != "function" && Fn(
|
|
1417
1432
|
"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."
|
|
1418
|
-
),
|
|
1433
|
+
), r.addInspector({
|
|
1419
1434
|
id: X,
|
|
1420
1435
|
label: "TresJS 🪐",
|
|
1421
1436
|
icon: "account_tree",
|
|
1422
1437
|
treeFilterPlaceholder: "Search instances"
|
|
1423
1438
|
}), setInterval(() => {
|
|
1424
|
-
|
|
1439
|
+
r.sendInspectorTree(X);
|
|
1425
1440
|
}, 1e3), setInterval(() => {
|
|
1426
|
-
|
|
1427
|
-
}, 5e3),
|
|
1441
|
+
r.notifyComponentUpdate();
|
|
1442
|
+
}, 5e3), r.on.getInspectorTree((l) => {
|
|
1428
1443
|
if (l.inspectorId === X) {
|
|
1429
|
-
const s =
|
|
1430
|
-
|
|
1444
|
+
const s = Et(t.scene.value);
|
|
1445
|
+
Tt(t.scene.value, s, l.filter), Nn.sceneGraph = s, l.rootNodes = [s];
|
|
1431
1446
|
}
|
|
1432
1447
|
});
|
|
1433
|
-
let
|
|
1434
|
-
|
|
1448
|
+
let n = null, o = null;
|
|
1449
|
+
r.on.getInspectorState((l) => {
|
|
1435
1450
|
var s;
|
|
1436
1451
|
if (l.inspectorId === X) {
|
|
1437
1452
|
const [a] = t.scene.value.getObjectsByProperty("uuid", l.nodeId);
|
|
1438
1453
|
if (!a)
|
|
1439
1454
|
return;
|
|
1440
|
-
if (o &&
|
|
1441
|
-
const c =
|
|
1442
|
-
a.add(c),
|
|
1455
|
+
if (o && n && n.parent && o.remove(n), a.isMesh) {
|
|
1456
|
+
const c = on(a);
|
|
1457
|
+
a.add(c), n = c, o = a;
|
|
1443
1458
|
}
|
|
1444
1459
|
l.state = {
|
|
1445
1460
|
object: Object.entries(a).map(([c, i]) => c === "children" ? { key: c, value: i.filter((f) => f.type !== "HightlightMesh") } : { key: c, value: i, editable: !0 }).filter(({ key: c }) => c !== "parent")
|
|
@@ -1450,7 +1465,7 @@ function Ir(e, t) {
|
|
|
1450
1465
|
key: "Scene Info",
|
|
1451
1466
|
value: {
|
|
1452
1467
|
objects: a.children.length,
|
|
1453
|
-
memory:
|
|
1468
|
+
memory: Le(a),
|
|
1454
1469
|
calls: t.renderer.value.info.render.calls,
|
|
1455
1470
|
triangles: t.renderer.value.info.render.triangles,
|
|
1456
1471
|
points: t.renderer.value.info.render.points,
|
|
@@ -1467,13 +1482,13 @@ function Ir(e, t) {
|
|
|
1467
1482
|
]
|
|
1468
1483
|
});
|
|
1469
1484
|
}
|
|
1470
|
-
}),
|
|
1471
|
-
l.inspectorId === X &&
|
|
1485
|
+
}), r.on.editInspectorState((l) => {
|
|
1486
|
+
l.inspectorId === X && nn(t.scene.value, l.nodeId, l.path, l.state.value);
|
|
1472
1487
|
});
|
|
1473
1488
|
}
|
|
1474
1489
|
);
|
|
1475
1490
|
}
|
|
1476
|
-
const
|
|
1491
|
+
const Gn = ["data-scene", "data-tres"], Vn = /* @__PURE__ */ ue({
|
|
1477
1492
|
__name: "TresCanvas",
|
|
1478
1493
|
props: {
|
|
1479
1494
|
shadows: { type: Boolean, default: void 0 },
|
|
@@ -1518,135 +1533,135 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
|
|
|
1518
1533
|
"wheel",
|
|
1519
1534
|
"ready"
|
|
1520
1535
|
],
|
|
1521
|
-
setup(e, { expose: t, emit:
|
|
1522
|
-
const
|
|
1523
|
-
Ee(
|
|
1524
|
-
const i = (
|
|
1536
|
+
setup(e, { expose: t, emit: r }) {
|
|
1537
|
+
const n = e, o = r, l = Rt(), s = $(), a = H(new at()), c = Ue();
|
|
1538
|
+
Ee(it);
|
|
1539
|
+
const i = (d, y = !1) => ue({
|
|
1525
1540
|
setup() {
|
|
1526
1541
|
var C;
|
|
1527
|
-
const
|
|
1528
|
-
|
|
1529
|
-
const
|
|
1530
|
-
function P(
|
|
1531
|
-
|
|
1542
|
+
const p = (C = Ue()) == null ? void 0 : C.appContext;
|
|
1543
|
+
p && (p.app = c == null ? void 0 : c.appContext.app);
|
|
1544
|
+
const h = {};
|
|
1545
|
+
function P(b) {
|
|
1546
|
+
b && (b.parent && P(b.parent), b.provides && Object.assign(h, b.provides));
|
|
1532
1547
|
}
|
|
1533
|
-
return c != null && c.parent &&
|
|
1534
|
-
|
|
1535
|
-
})),
|
|
1548
|
+
return c != null && c.parent && n.enableProvideBridge && (P(c.parent), Reflect.ownKeys(h).forEach((b) => {
|
|
1549
|
+
ae(b, h[b]);
|
|
1550
|
+
})), ae("useTres", d), ae("extend", Ee), typeof window < "u" && zn(p == null ? void 0 : p.app, d), () => Fe(Ht, null, y ? [] : l.default());
|
|
1536
1551
|
}
|
|
1537
|
-
}), f = (
|
|
1538
|
-
const
|
|
1539
|
-
|
|
1540
|
-
},
|
|
1541
|
-
|
|
1542
|
-
root:
|
|
1552
|
+
}), f = (d, y = !1) => {
|
|
1553
|
+
const p = i(d, y), { render: h } = $t(Rn(d));
|
|
1554
|
+
h(Fe(p), a.value);
|
|
1555
|
+
}, v = (d, y = !1) => {
|
|
1556
|
+
vt(d.scene.value), y && (d.renderer.value.dispose(), d.renderer.value.renderLists.dispose(), d.renderer.value.forceContextLoss()), a.value.__tres = {
|
|
1557
|
+
root: d
|
|
1543
1558
|
};
|
|
1544
|
-
}, u =
|
|
1545
|
-
t({ context: u, dispose: () =>
|
|
1546
|
-
const
|
|
1547
|
-
|
|
1559
|
+
}, u = H(null);
|
|
1560
|
+
t({ context: u, dispose: () => v(u.value, !0) });
|
|
1561
|
+
const _ = () => {
|
|
1562
|
+
v(u.value), f(u.value, !0);
|
|
1548
1563
|
};
|
|
1549
|
-
return
|
|
1550
|
-
const
|
|
1551
|
-
u.value =
|
|
1564
|
+
return Ot(() => {
|
|
1565
|
+
const d = s;
|
|
1566
|
+
u.value = An({
|
|
1552
1567
|
scene: a.value,
|
|
1553
|
-
canvas:
|
|
1554
|
-
windowSize:
|
|
1555
|
-
rendererOptions:
|
|
1568
|
+
canvas: d,
|
|
1569
|
+
windowSize: n.windowSize ?? !1,
|
|
1570
|
+
rendererOptions: n,
|
|
1556
1571
|
emit: o
|
|
1557
1572
|
});
|
|
1558
|
-
const { registerCamera:
|
|
1573
|
+
const { registerCamera: y, camera: p, cameras: h, deregisterCamera: P } = u.value;
|
|
1559
1574
|
f(u.value);
|
|
1560
1575
|
const C = () => {
|
|
1561
|
-
const
|
|
1576
|
+
const b = new we(
|
|
1562
1577
|
45,
|
|
1563
1578
|
window.innerWidth / window.innerHeight,
|
|
1564
1579
|
0.1,
|
|
1565
1580
|
1e3
|
|
1566
1581
|
);
|
|
1567
|
-
|
|
1582
|
+
b.position.set(3, 3, 3), b.lookAt(0, 0, 0), y(b);
|
|
1568
1583
|
const E = Ae(() => {
|
|
1569
|
-
|
|
1584
|
+
h.value.length >= 2 && (b.removeFromParent(), P(b), E == null || E());
|
|
1570
1585
|
});
|
|
1571
1586
|
};
|
|
1572
|
-
|
|
1573
|
-
() =>
|
|
1574
|
-
(
|
|
1575
|
-
|
|
1587
|
+
ie(
|
|
1588
|
+
() => n.camera,
|
|
1589
|
+
(b, E) => {
|
|
1590
|
+
b && y(b), E && (E.removeFromParent(), P(E));
|
|
1576
1591
|
},
|
|
1577
1592
|
{
|
|
1578
1593
|
immediate: !0
|
|
1579
1594
|
}
|
|
1580
|
-
),
|
|
1581
|
-
}), K(
|
|
1595
|
+
), p.value || C();
|
|
1596
|
+
}), K(_), (d, y) => (jt(), Dt("canvas", {
|
|
1582
1597
|
ref_key: "canvas",
|
|
1583
1598
|
ref: s,
|
|
1584
1599
|
"data-scene": a.value.uuid,
|
|
1585
|
-
class:
|
|
1586
|
-
"data-tres": `tresjs ${W(
|
|
1587
|
-
style:
|
|
1600
|
+
class: It(d.$attrs.class),
|
|
1601
|
+
"data-tres": `tresjs ${W(jr).version}`,
|
|
1602
|
+
style: Bt({
|
|
1588
1603
|
display: "block",
|
|
1589
1604
|
width: "100%",
|
|
1590
1605
|
height: "100%",
|
|
1591
|
-
position:
|
|
1606
|
+
position: d.windowSize ? "fixed" : "relative",
|
|
1592
1607
|
top: 0,
|
|
1593
1608
|
left: 0,
|
|
1594
1609
|
pointerEvents: "auto",
|
|
1595
1610
|
touchAction: "none",
|
|
1596
|
-
...
|
|
1611
|
+
...d.$attrs.style
|
|
1597
1612
|
})
|
|
1598
|
-
}, null, 14,
|
|
1613
|
+
}, null, 14, Gn));
|
|
1599
1614
|
}
|
|
1600
|
-
}),
|
|
1615
|
+
}), Yn = [
|
|
1601
1616
|
"TresCanvas",
|
|
1602
1617
|
"TresLeches",
|
|
1603
1618
|
"TresScene"
|
|
1604
|
-
],
|
|
1619
|
+
], co = {
|
|
1605
1620
|
template: {
|
|
1606
1621
|
compilerOptions: {
|
|
1607
|
-
isCustomElement: (e) => e.startsWith("Tres") && !
|
|
1622
|
+
isCustomElement: (e) => e.startsWith("Tres") && !Yn.includes(e) || e === "primitive"
|
|
1608
1623
|
}
|
|
1609
1624
|
}
|
|
1610
|
-
}, { logWarning:
|
|
1611
|
-
let
|
|
1612
|
-
const
|
|
1625
|
+
}, { logWarning: qn } = Q();
|
|
1626
|
+
let I = null;
|
|
1627
|
+
const uo = {
|
|
1613
1628
|
updated: (e, t) => {
|
|
1614
1629
|
var o;
|
|
1615
|
-
const
|
|
1616
|
-
if (!
|
|
1617
|
-
|
|
1630
|
+
const r = sn(t);
|
|
1631
|
+
if (!r) {
|
|
1632
|
+
qn(`v-distance-to: problem with binding value: ${t.value}`);
|
|
1618
1633
|
return;
|
|
1619
1634
|
}
|
|
1620
|
-
|
|
1621
|
-
const
|
|
1622
|
-
|
|
1635
|
+
I && (I.dispose(), e.parent.remove(I));
|
|
1636
|
+
const n = r.clone().sub(e.position);
|
|
1637
|
+
n.normalize(), I = new Qt(n, e.position, e.position.distanceTo(r), 16776960), e.parent.add(I), console.table(
|
|
1623
1638
|
[
|
|
1624
|
-
["Distance:", e.position.distanceTo(
|
|
1639
|
+
["Distance:", e.position.distanceTo(r)],
|
|
1625
1640
|
[`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(o = e.position) == null ? void 0 : o.z}`],
|
|
1626
|
-
[`Destiny: ${e.name || e.type}`, `x:${
|
|
1641
|
+
[`Destiny: ${e.name || e.type}`, `x:${r.x}, y:${r.y}, z:${r == null ? void 0 : r.z}`]
|
|
1627
1642
|
]
|
|
1628
1643
|
);
|
|
1629
1644
|
},
|
|
1630
1645
|
unmounted: (e) => {
|
|
1631
|
-
|
|
1646
|
+
I == null || I.dispose(), e.parent && e.parent.remove(I);
|
|
1632
1647
|
}
|
|
1633
1648
|
};
|
|
1634
|
-
class
|
|
1635
|
-
constructor(t,
|
|
1636
|
-
const
|
|
1637
|
-
o.setAttribute("position", new
|
|
1638
|
-
const l = new
|
|
1639
|
-
super(o, l), this.light = t, this.color =
|
|
1640
|
-
const s = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], a = new
|
|
1641
|
-
a.setAttribute("position", new
|
|
1649
|
+
class St extends Xt {
|
|
1650
|
+
constructor(t, r) {
|
|
1651
|
+
const n = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], o = new We();
|
|
1652
|
+
o.setAttribute("position", new Ne(n, 3)), o.computeBoundingSphere();
|
|
1653
|
+
const l = new Zt({ fog: !1 });
|
|
1654
|
+
super(o, l), this.light = t, this.color = r, this.type = "RectAreaLightHelper";
|
|
1655
|
+
const s = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], a = new We();
|
|
1656
|
+
a.setAttribute("position", new Ne(s, 3)), a.computeBoundingSphere(), this.add(new er(a, new ct({ side: tr, fog: !1 })));
|
|
1642
1657
|
}
|
|
1643
1658
|
updateMatrixWorld() {
|
|
1644
1659
|
if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
|
|
1645
1660
|
this.material.color.set(this.color), this.children[0].material.color.set(this.color);
|
|
1646
1661
|
else {
|
|
1647
1662
|
this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);
|
|
1648
|
-
const t = this.material.color,
|
|
1649
|
-
|
|
1663
|
+
const t = this.material.color, r = Math.max(t.r, t.g, t.b);
|
|
1664
|
+
r > 1 && t.multiplyScalar(1 / r), this.children[0].material.color.copy(this.material.color);
|
|
1650
1665
|
}
|
|
1651
1666
|
this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld), this.children[0].matrixWorld.copy(this.matrixWorld);
|
|
1652
1667
|
}
|
|
@@ -1654,33 +1669,33 @@ class Ct extends qt {
|
|
|
1654
1669
|
this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
|
|
1655
1670
|
}
|
|
1656
1671
|
}
|
|
1657
|
-
const { logWarning:
|
|
1658
|
-
let
|
|
1659
|
-
const
|
|
1660
|
-
DirectionalLight:
|
|
1661
|
-
PointLight:
|
|
1662
|
-
SpotLight:
|
|
1663
|
-
HemisphereLight:
|
|
1664
|
-
RectAreaLight:
|
|
1665
|
-
},
|
|
1672
|
+
const { logWarning: nt } = Q();
|
|
1673
|
+
let se, F;
|
|
1674
|
+
const Kn = {
|
|
1675
|
+
DirectionalLight: sr,
|
|
1676
|
+
PointLight: or,
|
|
1677
|
+
SpotLight: nr,
|
|
1678
|
+
HemisphereLight: rr,
|
|
1679
|
+
RectAreaLight: St
|
|
1680
|
+
}, fo = {
|
|
1666
1681
|
mounted: (e) => {
|
|
1667
1682
|
if (!e.isLight) {
|
|
1668
|
-
|
|
1683
|
+
nt(`${e.type} is not a light`);
|
|
1669
1684
|
return;
|
|
1670
1685
|
}
|
|
1671
|
-
|
|
1686
|
+
se = Kn[e.type], e.parent.add(new se(e, 1, e.color.getHex()));
|
|
1672
1687
|
},
|
|
1673
1688
|
updated: (e) => {
|
|
1674
|
-
F = e.parent.children.find((t) => t instanceof
|
|
1689
|
+
F = e.parent.children.find((t) => t instanceof se), !(F instanceof St) && F.update();
|
|
1675
1690
|
},
|
|
1676
1691
|
unmounted: (e) => {
|
|
1677
1692
|
if (!e.isLight) {
|
|
1678
|
-
|
|
1693
|
+
nt(`${e.type} is not a light`);
|
|
1679
1694
|
return;
|
|
1680
1695
|
}
|
|
1681
|
-
F = e.parent.children.find((t) => t instanceof
|
|
1696
|
+
F = e.parent.children.find((t) => t instanceof se), F && F.dispose && F.dispose(), e.parent && e.parent.remove(F);
|
|
1682
1697
|
}
|
|
1683
|
-
},
|
|
1698
|
+
}, po = {
|
|
1684
1699
|
mounted: (e, t) => {
|
|
1685
1700
|
if (t.arg) {
|
|
1686
1701
|
console.log(`v-log:${t.arg}`, e[t.arg]);
|
|
@@ -1688,40 +1703,40 @@ const Wr = {
|
|
|
1688
1703
|
}
|
|
1689
1704
|
console.log("v-log", e);
|
|
1690
1705
|
}
|
|
1691
|
-
},
|
|
1706
|
+
}, mo = {
|
|
1692
1707
|
install(e) {
|
|
1693
|
-
e.component("TresCanvas",
|
|
1708
|
+
e.component("TresCanvas", Vn);
|
|
1694
1709
|
}
|
|
1695
1710
|
};
|
|
1696
1711
|
export {
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1712
|
+
Vn as TresCanvas,
|
|
1713
|
+
eo as UseLoader,
|
|
1714
|
+
to as UseTexture,
|
|
1700
1715
|
Ce as catalogue,
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1716
|
+
_n as createRenderLoop,
|
|
1717
|
+
mo as default,
|
|
1718
|
+
vt as dispose,
|
|
1704
1719
|
Ee as extend,
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1720
|
+
ro as isProd,
|
|
1721
|
+
Mn as normalizeColor,
|
|
1722
|
+
no as normalizeVectorFlexibleParam,
|
|
1723
|
+
oo as onTresReady,
|
|
1724
|
+
co as templateCompilerOptions,
|
|
1725
|
+
Br as traverseObjects,
|
|
1726
|
+
mn as useCamera,
|
|
1727
|
+
Ir as useLoader,
|
|
1713
1728
|
Q as useLogger,
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1729
|
+
io as useLoop,
|
|
1730
|
+
En as useRaycaster,
|
|
1731
|
+
ao as useRenderLoop,
|
|
1732
|
+
Pn as useRenderer,
|
|
1733
|
+
lo as useSeek,
|
|
1734
|
+
dn as useTexture,
|
|
1735
|
+
so as useTres,
|
|
1736
|
+
pe as useTresContext,
|
|
1737
|
+
An as useTresContextProvider,
|
|
1738
|
+
Tn as useTresEventManager,
|
|
1739
|
+
uo as vDistanceTo,
|
|
1740
|
+
fo as vLightHelper,
|
|
1741
|
+
po as vLog
|
|
1727
1742
|
};
|