@tresjs/core 3.7.0-next.0 → 4.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/TresCanvas.vue.d.ts +4 -3
- package/dist/composables/useRenderer/index.d.ts +1 -1
- package/dist/devtools/highlight.d.ts +7 -0
- package/dist/devtools/index.d.ts +1 -0
- package/dist/devtools/plugin.d.ts +15 -0
- package/dist/devtools/utils.d.ts +7 -0
- package/dist/index.d.ts +1 -2
- package/dist/tres.js +779 -457
- package/dist/tres.umd.cjs +2 -2
- package/dist/utils/index.d.ts +7 -8
- package/package.json +1 -1
package/dist/tres.js
CHANGED
|
@@ -1,441 +1,490 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version:
|
|
3
|
+
* version: v4.0.0-next.0
|
|
4
4
|
* (c) 2023
|
|
5
5
|
* description: Declarative ThreeJS using Vue Components
|
|
6
6
|
* author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
var Me = Object.defineProperty;
|
|
9
|
+
var Pe = (e, r, t) => r in e ? Me(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
10
|
+
var G = (e, r, t) => (Pe(e, typeof r != "symbol" ? r + "" : r, t), t);
|
|
11
|
+
import { ref as B, computed as k, watchEffect as A, onUnmounted as U, shallowRef as D, watch as ie, reactive as le, readonly as Se, provide as Q, inject as ke, createRenderer as Te, defineComponent as Z, useSlots as Oe, getCurrentInstance as ee, onMounted as Ae, openBlock as xe, createElementBlock as De, normalizeClass as Le, normalizeStyle as Be, h as te, Fragment as je } from "vue";
|
|
12
|
+
import * as ue from "three";
|
|
13
|
+
import { PerspectiveCamera as Y, OrthographicCamera as Ie, Camera as Re, Clock as He, Vector3 as Ne, Color as N, MeshBasicMaterial as Ve, DoubleSide as $e, REVISION as Ue, SRGBColorSpace as Fe, ACESFilmicToneMapping as Ge, PCFSoftShadowMap as ze, WebGLRenderer as z, LoadingManager as We, TextureLoader as Qe, Vector2 as Ye, Raycaster as Je, BufferAttribute as Ke, Scene as qe } from "three";
|
|
14
|
+
import { createEventHook as L, useRafFn as ce, toValue as E, unrefElement as Xe, useDevicePixelRatio as Ze, usePointer as et, useElementBounding as tt, useWindowSize as rt, useElementSize as nt, useFps as ot, useMemory as at } from "@vueuse/core";
|
|
15
|
+
const st = ({ sizes: e, scene: r }) => {
|
|
16
|
+
const t = B([]), n = k(
|
|
14
17
|
() => t.value[0]
|
|
15
|
-
), a = (
|
|
16
|
-
t.value.some(({ uuid:
|
|
17
|
-
},
|
|
18
|
-
t.value = t.value.filter(({ uuid:
|
|
19
|
-
},
|
|
20
|
-
const
|
|
21
|
-
if (!
|
|
18
|
+
), a = (i, l = !1) => {
|
|
19
|
+
t.value.some(({ uuid: c }) => c === i.uuid) || (l ? o(i) : t.value.push(i));
|
|
20
|
+
}, s = (i) => {
|
|
21
|
+
t.value = t.value.filter(({ uuid: l }) => l !== i.uuid);
|
|
22
|
+
}, o = (i) => {
|
|
23
|
+
const l = i instanceof Re ? i : t.value.find((m) => m.uuid === i);
|
|
24
|
+
if (!l)
|
|
22
25
|
return;
|
|
23
|
-
const
|
|
24
|
-
t.value = [
|
|
26
|
+
const c = t.value.filter(({ uuid: m }) => m !== l.uuid);
|
|
27
|
+
t.value = [l, ...c];
|
|
25
28
|
};
|
|
26
|
-
return
|
|
27
|
-
e.aspectRatio.value && t.value.forEach((
|
|
28
|
-
|
|
29
|
+
return A(() => {
|
|
30
|
+
e.aspectRatio.value && t.value.forEach((i) => {
|
|
31
|
+
i instanceof Y && (i.aspect = e.aspectRatio.value), (i instanceof Y || i instanceof Ie) && i.updateProjectionMatrix();
|
|
29
32
|
});
|
|
30
|
-
}),
|
|
33
|
+
}), r.userData.tres__registerCamera = a, r.userData.tres__deregisterCamera = s, U(() => {
|
|
31
34
|
t.value = [];
|
|
32
35
|
}), {
|
|
33
|
-
camera:
|
|
36
|
+
camera: n,
|
|
34
37
|
cameras: t,
|
|
35
38
|
registerCamera: a,
|
|
36
|
-
deregisterCamera:
|
|
37
|
-
setCameraActive:
|
|
39
|
+
deregisterCamera: s,
|
|
40
|
+
setCameraActive: o
|
|
38
41
|
};
|
|
39
|
-
},
|
|
40
|
-
let
|
|
41
|
-
const { pause:
|
|
42
|
+
}, fe = L(), de = L(), q = L(), x = new He();
|
|
43
|
+
let V = 0, $ = 0;
|
|
44
|
+
const { pause: it, resume: lt, isActive: ut } = ce(
|
|
42
45
|
() => {
|
|
43
|
-
|
|
46
|
+
fe.trigger({ delta: V, elapsed: $, clock: x }), de.trigger({ delta: V, elapsed: $, clock: x }), q.trigger({ delta: V, elapsed: $, clock: x });
|
|
44
47
|
},
|
|
45
48
|
{ immediate: !1 }
|
|
46
49
|
);
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
q.on(() => {
|
|
51
|
+
V = x.getDelta(), $ = x.getElapsedTime();
|
|
49
52
|
});
|
|
50
|
-
const
|
|
51
|
-
onBeforeLoop:
|
|
52
|
-
onLoop:
|
|
53
|
-
onAfterLoop:
|
|
54
|
-
pause:
|
|
55
|
-
resume:
|
|
56
|
-
isActive:
|
|
57
|
-
}),
|
|
58
|
-
function
|
|
59
|
-
function e(
|
|
60
|
-
console.error(`${
|
|
53
|
+
const me = () => ({
|
|
54
|
+
onBeforeLoop: fe.on,
|
|
55
|
+
onLoop: de.on,
|
|
56
|
+
onAfterLoop: q.on,
|
|
57
|
+
pause: it,
|
|
58
|
+
resume: lt,
|
|
59
|
+
isActive: ut
|
|
60
|
+
}), Zt = !0, re = "[TresJS ▲ ■ ●] ";
|
|
61
|
+
function j() {
|
|
62
|
+
function e(n, a) {
|
|
63
|
+
console.error(`${re} ${n}`, a || "");
|
|
61
64
|
}
|
|
62
|
-
function n
|
|
63
|
-
console.warn(`${
|
|
65
|
+
function r(n) {
|
|
66
|
+
console.warn(`${re} ${n}`);
|
|
64
67
|
}
|
|
65
|
-
function t(
|
|
68
|
+
function t(n, a) {
|
|
66
69
|
}
|
|
67
70
|
return {
|
|
68
71
|
logError: e,
|
|
69
|
-
logWarning:
|
|
72
|
+
logWarning: r,
|
|
70
73
|
logMessage: t
|
|
71
74
|
};
|
|
72
75
|
}
|
|
73
|
-
function
|
|
74
|
-
return typeof e == "number" ? [e, e, e] : e instanceof
|
|
76
|
+
function er(e) {
|
|
77
|
+
return typeof e == "number" ? [e, e, e] : e instanceof Ne ? [e.x, e.y, e.z] : e;
|
|
75
78
|
}
|
|
76
|
-
function
|
|
77
|
-
return e instanceof
|
|
79
|
+
function ct(e) {
|
|
80
|
+
return e instanceof N ? e : Array.isArray(e) ? new N(...e) : new N(e);
|
|
78
81
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
class ft extends ue.Mesh {
|
|
83
|
+
constructor(...t) {
|
|
84
|
+
super(...t);
|
|
85
|
+
G(this, "type", "HightlightMesh");
|
|
86
|
+
G(this, "createTime");
|
|
87
|
+
this.createTime = Date.now();
|
|
88
|
+
}
|
|
89
|
+
onBeforeRender() {
|
|
90
|
+
const n = (Date.now() - this.createTime) / 1e3, o = 1 + 0.07 * Math.sin(2.5 * n);
|
|
91
|
+
this.scale.set(o, o, o);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const pe = (e, r) => {
|
|
95
|
+
for (const t of Object.keys(r))
|
|
96
|
+
r[t] instanceof Object && Object.assign(r[t], pe(e[t], r[t]));
|
|
97
|
+
return Object.assign(e || {}, r), e;
|
|
98
|
+
}, dt = "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", mt = /* @__PURE__ */ pt(dt);
|
|
99
|
+
function ne(e) {
|
|
85
100
|
return e && e.nodeType === 1;
|
|
86
101
|
}
|
|
87
|
-
function
|
|
88
|
-
return e.replace(/-([a-z])/g, (
|
|
102
|
+
function R(e) {
|
|
103
|
+
return e.replace(/-([a-z])/g, (r, t) => t.toUpperCase());
|
|
89
104
|
}
|
|
90
|
-
function
|
|
91
|
-
const t = /* @__PURE__ */ Object.create(null),
|
|
92
|
-
for (let a = 0; a <
|
|
93
|
-
t[
|
|
94
|
-
return
|
|
105
|
+
function pt(e, r) {
|
|
106
|
+
const t = /* @__PURE__ */ Object.create(null), n = e.split(",");
|
|
107
|
+
for (let a = 0; a < n.length; a++)
|
|
108
|
+
t[n[a]] = !0;
|
|
109
|
+
return r ? (a) => !!t[a.toLowerCase()] : (a) => !!t[a];
|
|
95
110
|
}
|
|
96
|
-
const
|
|
97
|
-
const t = /* @__PURE__ */ new Set(),
|
|
111
|
+
const gt = (e, r) => {
|
|
112
|
+
const t = /* @__PURE__ */ new Set(), n = [];
|
|
98
113
|
for (const a of e) {
|
|
99
|
-
const
|
|
100
|
-
t.has(
|
|
114
|
+
const s = r(a);
|
|
115
|
+
t.has(s) || (t.add(s), n.push(a));
|
|
101
116
|
}
|
|
102
|
-
return
|
|
103
|
-
},
|
|
104
|
-
if (!
|
|
117
|
+
return n;
|
|
118
|
+
}, oe = (e, r) => {
|
|
119
|
+
if (!r)
|
|
105
120
|
return;
|
|
106
|
-
const t = Array.isArray(
|
|
107
|
-
return t == null ? void 0 : t.reduce((
|
|
108
|
-
},
|
|
109
|
-
const
|
|
110
|
-
|
|
121
|
+
const t = Array.isArray(r) ? r : r.match(/([^[.\]])+/g);
|
|
122
|
+
return t == null ? void 0 : t.reduce((n, a) => n && n[a], e);
|
|
123
|
+
}, vt = (e, r, t) => {
|
|
124
|
+
const n = Array.isArray(r) ? r : r.match(/([^[.\]])+/g);
|
|
125
|
+
n && n.reduce((a, s, o) => (a[s] === void 0 && (a[s] = {}), o === n.length - 1 && (a[s] = t), a[s]), e);
|
|
111
126
|
};
|
|
112
|
-
function
|
|
113
|
-
if (
|
|
114
|
-
const a = e.attributes,
|
|
115
|
-
return a.length !==
|
|
127
|
+
function ge(e, r) {
|
|
128
|
+
if (ne(e) && ne(r)) {
|
|
129
|
+
const a = e.attributes, s = r.attributes;
|
|
130
|
+
return a.length !== s.length ? !1 : Array.from(a).every(({ name: o, value: i }) => r.getAttribute(o) === i);
|
|
116
131
|
}
|
|
117
|
-
if (e ===
|
|
132
|
+
if (e === r)
|
|
118
133
|
return !0;
|
|
119
|
-
if (e === null || typeof e != "object" ||
|
|
134
|
+
if (e === null || typeof e != "object" || r === null || typeof r != "object")
|
|
120
135
|
return !1;
|
|
121
|
-
const t = Object.keys(e),
|
|
122
|
-
if (t.length !==
|
|
136
|
+
const t = Object.keys(e), n = Object.keys(r);
|
|
137
|
+
if (t.length !== n.length)
|
|
123
138
|
return !1;
|
|
124
139
|
for (const a of t)
|
|
125
|
-
if (!
|
|
140
|
+
if (!n.includes(a) || !ge(e[a], r[a]))
|
|
126
141
|
return !1;
|
|
127
142
|
return !0;
|
|
128
143
|
}
|
|
129
|
-
function
|
|
130
|
-
if (!Array.isArray(e) || !Array.isArray(
|
|
144
|
+
function ht(e, r) {
|
|
145
|
+
if (!Array.isArray(e) || !Array.isArray(r) || e.length !== r.length)
|
|
131
146
|
return !1;
|
|
132
147
|
for (let t = 0; t < e.length; t++)
|
|
133
|
-
if (!
|
|
148
|
+
if (!ge(e[t], r[t]))
|
|
134
149
|
return !1;
|
|
135
150
|
return !0;
|
|
136
151
|
}
|
|
137
|
-
const
|
|
138
|
-
function
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
152
|
+
const yt = Array.isArray;
|
|
153
|
+
function _t(e, r, t, n) {
|
|
154
|
+
const a = (l) => {
|
|
155
|
+
if (l.uuid === r)
|
|
156
|
+
return l;
|
|
157
|
+
for (const c of l.children) {
|
|
158
|
+
const m = a(c);
|
|
159
|
+
if (m)
|
|
160
|
+
return m;
|
|
161
|
+
}
|
|
162
|
+
}, s = a(e);
|
|
163
|
+
if (!s) {
|
|
164
|
+
console.warn("Object with UUID not found in the scene.");
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
let o = s;
|
|
168
|
+
for (let l = 0; l < t.length - 1; l++)
|
|
169
|
+
if (o[t[l]] !== void 0)
|
|
170
|
+
o = o[t[l]];
|
|
171
|
+
else {
|
|
172
|
+
console.warn(`Property path is not valid: ${t.join(".")}`);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
const i = t[t.length - 1];
|
|
176
|
+
o[i] !== void 0 ? o[i] = n : console.warn(`Property path is not valid: ${t.join(".")}`);
|
|
177
|
+
}
|
|
178
|
+
function wt(e) {
|
|
179
|
+
const r = new Ve({
|
|
180
|
+
color: 11003607,
|
|
181
|
+
// Highlight color, e.g., yellow
|
|
182
|
+
transparent: !0,
|
|
183
|
+
opacity: 0.2,
|
|
184
|
+
depthTest: !1,
|
|
185
|
+
// So the highlight is always visible
|
|
186
|
+
side: $e
|
|
187
|
+
// To e
|
|
188
|
+
});
|
|
189
|
+
return new ft(e.geometry.clone(), r);
|
|
144
190
|
}
|
|
145
|
-
const
|
|
191
|
+
const bt = Number.parseInt(Ue.replace("dev", "")), H = {
|
|
146
192
|
realistic: {
|
|
147
193
|
shadows: !0,
|
|
148
194
|
physicallyCorrectLights: !0,
|
|
149
|
-
outputColorSpace:
|
|
150
|
-
toneMapping:
|
|
195
|
+
outputColorSpace: Fe,
|
|
196
|
+
toneMapping: Ge,
|
|
151
197
|
toneMappingExposure: 3,
|
|
152
198
|
shadowMap: {
|
|
153
199
|
enabled: !0,
|
|
154
|
-
type:
|
|
200
|
+
type: ze
|
|
155
201
|
}
|
|
156
202
|
}
|
|
157
203
|
};
|
|
158
|
-
function
|
|
204
|
+
function Et({
|
|
159
205
|
scene: e,
|
|
160
|
-
canvas:
|
|
206
|
+
canvas: r,
|
|
161
207
|
options: t,
|
|
162
|
-
disableRender:
|
|
163
|
-
contextParts: { sizes: a, camera:
|
|
208
|
+
disableRender: n,
|
|
209
|
+
contextParts: { sizes: a, camera: s }
|
|
164
210
|
}) {
|
|
165
|
-
const
|
|
166
|
-
alpha:
|
|
167
|
-
depth:
|
|
168
|
-
canvas:
|
|
169
|
-
context:
|
|
170
|
-
stencil:
|
|
171
|
-
antialias:
|
|
172
|
-
precision:
|
|
173
|
-
powerPreference:
|
|
174
|
-
premultipliedAlpha:
|
|
175
|
-
preserveDrawingBuffer:
|
|
176
|
-
logarithmicDepthBuffer:
|
|
177
|
-
failIfMajorPerformanceCaveat:
|
|
178
|
-
})),
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}),
|
|
182
|
-
|
|
211
|
+
const o = k(() => ({
|
|
212
|
+
alpha: E(t.alpha),
|
|
213
|
+
depth: E(t.depth),
|
|
214
|
+
canvas: Xe(r),
|
|
215
|
+
context: E(t.context),
|
|
216
|
+
stencil: E(t.stencil),
|
|
217
|
+
antialias: E(t.antialias) === void 0 ? !0 : E(t.antialias),
|
|
218
|
+
precision: E(t.precision),
|
|
219
|
+
powerPreference: E(t.powerPreference),
|
|
220
|
+
premultipliedAlpha: E(t.premultipliedAlpha),
|
|
221
|
+
preserveDrawingBuffer: E(t.preserveDrawingBuffer),
|
|
222
|
+
logarithmicDepthBuffer: E(t.logarithmicDepthBuffer),
|
|
223
|
+
failIfMajorPerformanceCaveat: E(t.failIfMajorPerformanceCaveat)
|
|
224
|
+
})), i = D(new z(o.value));
|
|
225
|
+
ie(o, () => {
|
|
226
|
+
i.value.dispose(), i.value = new z(o.value);
|
|
227
|
+
}), A(() => {
|
|
228
|
+
i.value.setSize(a.width.value, a.height.value);
|
|
183
229
|
});
|
|
184
|
-
const { pixelRatio:
|
|
185
|
-
|
|
186
|
-
|
|
230
|
+
const { pixelRatio: l } = Ze();
|
|
231
|
+
A(() => {
|
|
232
|
+
i.value.setPixelRatio(l.value);
|
|
187
233
|
});
|
|
188
|
-
const { logError:
|
|
189
|
-
const
|
|
234
|
+
const { logError: c } = j(), f = (() => {
|
|
235
|
+
const d = new z(), y = {
|
|
190
236
|
shadowMap: {
|
|
191
|
-
enabled:
|
|
192
|
-
type:
|
|
237
|
+
enabled: d.shadowMap.enabled,
|
|
238
|
+
type: d.shadowMap.type
|
|
193
239
|
},
|
|
194
|
-
toneMapping:
|
|
195
|
-
toneMappingExposure:
|
|
196
|
-
outputColorSpace:
|
|
240
|
+
toneMapping: d.toneMapping,
|
|
241
|
+
toneMappingExposure: d.toneMappingExposure,
|
|
242
|
+
outputColorSpace: d.outputColorSpace
|
|
197
243
|
};
|
|
198
|
-
return
|
|
244
|
+
return d.dispose(), y;
|
|
199
245
|
})();
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
const
|
|
205
|
-
if (
|
|
206
|
-
return
|
|
246
|
+
A(() => {
|
|
247
|
+
const d = E(t.preset);
|
|
248
|
+
d && (d in H || c(`Renderer Preset must be one of these: ${Object.keys(H).join(", ")}`), pe(i.value, H[d]));
|
|
249
|
+
const y = (M, P) => {
|
|
250
|
+
const w = E(M), S = () => {
|
|
251
|
+
if (d)
|
|
252
|
+
return oe(H[d], P);
|
|
207
253
|
};
|
|
208
|
-
if (
|
|
209
|
-
return
|
|
210
|
-
const
|
|
211
|
-
return
|
|
212
|
-
},
|
|
213
|
-
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
254
|
+
if (w !== void 0)
|
|
255
|
+
return w;
|
|
256
|
+
const v = S();
|
|
257
|
+
return v !== void 0 ? v : oe(f, P);
|
|
258
|
+
}, p = (M, P) => vt(i.value, P, y(M, P));
|
|
259
|
+
p(t.shadows, "shadowMap.enabled"), p(t.toneMapping, "toneMapping"), p(t.shadowMapType, "shadowMap.type"), bt < 150 && p(!t.useLegacyLights, "physicallyCorrectLights"), p(t.outputColorSpace, "outputColorSpace"), p(t.toneMappingExposure, "toneMappingExposure");
|
|
260
|
+
const C = y(t.clearColor, "clearColor");
|
|
261
|
+
C && i.value.setClearColor(
|
|
262
|
+
C ? ct(C) : new N(0)
|
|
217
263
|
// default clear color is not easily/efficiently retrievable from three
|
|
218
264
|
);
|
|
219
265
|
});
|
|
220
|
-
const { pause:
|
|
221
|
-
return
|
|
222
|
-
|
|
223
|
-
}),
|
|
224
|
-
|
|
266
|
+
const { pause: u, resume: g, onLoop: _ } = me();
|
|
267
|
+
return _(() => {
|
|
268
|
+
s.value && !E(n) && i.value.render(e, s.value);
|
|
269
|
+
}), g(), U(() => {
|
|
270
|
+
u(), i.value.dispose(), i.value.forceContextLoss();
|
|
225
271
|
}), {
|
|
226
|
-
renderer:
|
|
272
|
+
renderer: i
|
|
227
273
|
};
|
|
228
274
|
}
|
|
229
|
-
const
|
|
230
|
-
function
|
|
231
|
-
const
|
|
275
|
+
const ae = (e) => typeof e == "function", Ct = (e) => !!e && e.constructor === Array;
|
|
276
|
+
function Mt(e) {
|
|
277
|
+
const r = { nodes: {}, materials: {} };
|
|
232
278
|
return e && e.traverse((t) => {
|
|
233
|
-
t.name && (
|
|
234
|
-
}),
|
|
279
|
+
t.name && (r.nodes[t.name] = t), t.material && !r.materials[t.material.name] && (r.materials[t.material.name] = t.material);
|
|
280
|
+
}), r;
|
|
235
281
|
}
|
|
236
|
-
async function
|
|
237
|
-
const { logError:
|
|
238
|
-
a && a(
|
|
239
|
-
const
|
|
240
|
-
(
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
(
|
|
244
|
-
|
|
282
|
+
async function tr(e, r, t, n, a) {
|
|
283
|
+
const { logError: s } = j(), o = new e();
|
|
284
|
+
a && a(o), t && t(o);
|
|
285
|
+
const l = (Array.isArray(r) ? r : [r]).map(
|
|
286
|
+
(c) => new Promise((m, f) => {
|
|
287
|
+
o.load(
|
|
288
|
+
c,
|
|
289
|
+
(u) => {
|
|
290
|
+
u.scene && Object.assign(u, Mt(u.scene)), m(u);
|
|
245
291
|
},
|
|
246
|
-
|
|
247
|
-
(
|
|
292
|
+
n,
|
|
293
|
+
(u) => f(s("[useLoader] - Failed to load resource", u))
|
|
248
294
|
);
|
|
249
295
|
})
|
|
250
296
|
);
|
|
251
|
-
return
|
|
297
|
+
return Ct(r) ? await Promise.all(l) : await l[0];
|
|
252
298
|
}
|
|
253
|
-
async function
|
|
254
|
-
const
|
|
299
|
+
async function rr(e) {
|
|
300
|
+
const r = new We(), t = new Qe(r), n = (a) => new Promise((s, o) => {
|
|
255
301
|
t.load(
|
|
256
302
|
a,
|
|
257
|
-
(
|
|
303
|
+
(i) => s(i),
|
|
258
304
|
() => null,
|
|
259
305
|
() => {
|
|
260
|
-
|
|
306
|
+
o(new Error("[useTextures] - Failed to load texture"));
|
|
261
307
|
}
|
|
262
308
|
);
|
|
263
309
|
});
|
|
264
|
-
if (
|
|
265
|
-
const a = await Promise.all(e.map((
|
|
310
|
+
if (yt(e)) {
|
|
311
|
+
const a = await Promise.all(e.map((s) => n(s)));
|
|
266
312
|
return e.length > 1 ? a : a[0];
|
|
267
313
|
} else {
|
|
268
314
|
const {
|
|
269
315
|
map: a,
|
|
270
|
-
displacementMap:
|
|
271
|
-
normalMap:
|
|
272
|
-
roughnessMap:
|
|
273
|
-
metalnessMap:
|
|
274
|
-
aoMap:
|
|
275
|
-
alphaMap:
|
|
276
|
-
matcap:
|
|
316
|
+
displacementMap: s,
|
|
317
|
+
normalMap: o,
|
|
318
|
+
roughnessMap: i,
|
|
319
|
+
metalnessMap: l,
|
|
320
|
+
aoMap: c,
|
|
321
|
+
alphaMap: m,
|
|
322
|
+
matcap: f
|
|
277
323
|
} = e;
|
|
278
324
|
return {
|
|
279
|
-
map: a ? await
|
|
280
|
-
displacementMap:
|
|
281
|
-
normalMap:
|
|
282
|
-
roughnessMap:
|
|
283
|
-
metalnessMap:
|
|
284
|
-
aoMap:
|
|
285
|
-
alphaMap:
|
|
286
|
-
matcap:
|
|
325
|
+
map: a ? await n(a) : null,
|
|
326
|
+
displacementMap: s ? await n(s) : null,
|
|
327
|
+
normalMap: o ? await n(o) : null,
|
|
328
|
+
roughnessMap: i ? await n(i) : null,
|
|
329
|
+
metalnessMap: l ? await n(l) : null,
|
|
330
|
+
aoMap: c ? await n(c) : null,
|
|
331
|
+
alphaMap: m ? await n(m) : null,
|
|
332
|
+
matcap: f ? await n(f) : null
|
|
287
333
|
};
|
|
288
334
|
}
|
|
289
335
|
}
|
|
290
|
-
const
|
|
291
|
-
const a =
|
|
336
|
+
const Pt = (e, { renderer: r, camera: t, raycaster: n }) => {
|
|
337
|
+
const a = k(() => r.value.domElement), { x: s, y: o } = et({ target: a }), { width: i, height: l, top: c, left: m } = tt(a), f = ({ x: v, y: b }) => {
|
|
292
338
|
if (a.value)
|
|
293
339
|
return {
|
|
294
|
-
x: (
|
|
295
|
-
y: -((
|
|
340
|
+
x: (v - m.value) / i.value * 2 - 1,
|
|
341
|
+
y: -((b - c.value) / l.value) * 2 + 1
|
|
296
342
|
};
|
|
297
|
-
},
|
|
343
|
+
}, u = ({ x: v, y: b }) => {
|
|
298
344
|
if (t.value)
|
|
299
|
-
return
|
|
300
|
-
},
|
|
301
|
-
const
|
|
302
|
-
x: (
|
|
303
|
-
y: (
|
|
345
|
+
return n.value.setFromCamera(new Ye(v, b), t.value), n.value.intersectObjects(e.value, !1);
|
|
346
|
+
}, g = (v) => {
|
|
347
|
+
const b = f({
|
|
348
|
+
x: (v == null ? void 0 : v.clientX) ?? s.value,
|
|
349
|
+
y: (v == null ? void 0 : v.clientY) ?? o.value
|
|
304
350
|
});
|
|
305
|
-
return
|
|
306
|
-
},
|
|
307
|
-
|
|
308
|
-
},
|
|
309
|
-
|
|
351
|
+
return b ? u(b) || [] : [];
|
|
352
|
+
}, _ = k(() => g()), d = L(), y = L(), p = (v, b) => {
|
|
353
|
+
v.trigger({ event: b, intersects: g(b) });
|
|
354
|
+
}, C = (v) => {
|
|
355
|
+
p(y, v);
|
|
310
356
|
};
|
|
311
|
-
let
|
|
312
|
-
const
|
|
313
|
-
var
|
|
314
|
-
|
|
315
|
-
},
|
|
316
|
-
var
|
|
317
|
-
|
|
318
|
-
},
|
|
319
|
-
return a.value.addEventListener("pointerup",
|
|
320
|
-
a != null && a.value && (a.value.removeEventListener("pointerup",
|
|
357
|
+
let M;
|
|
358
|
+
const P = (v) => {
|
|
359
|
+
var b;
|
|
360
|
+
M = (b = g(v)[0]) == null ? void 0 : b.object;
|
|
361
|
+
}, w = (v) => {
|
|
362
|
+
var b;
|
|
363
|
+
v instanceof PointerEvent && M === ((b = g(v)[0]) == null ? void 0 : b.object) && p(d, v);
|
|
364
|
+
}, S = (v) => y.trigger({ event: v, intersects: [] });
|
|
365
|
+
return a.value.addEventListener("pointerup", w), a.value.addEventListener("pointerdown", P), a.value.addEventListener("pointermove", C), a.value.addEventListener("pointerleave", S), U(() => {
|
|
366
|
+
a != null && a.value && (a.value.removeEventListener("pointerup", w), a.value.removeEventListener("pointerdown", P), a.value.removeEventListener("pointermove", C), a.value.removeEventListener("pointerleave", S));
|
|
321
367
|
}), {
|
|
322
|
-
intersects:
|
|
323
|
-
onClick: (
|
|
324
|
-
onPointerMove: (
|
|
368
|
+
intersects: _,
|
|
369
|
+
onClick: (v) => d.on(v).off,
|
|
370
|
+
onPointerMove: (v) => y.on(v).off
|
|
325
371
|
};
|
|
326
372
|
};
|
|
327
|
-
function
|
|
328
|
-
const { logWarning: e } =
|
|
329
|
-
function
|
|
330
|
-
let
|
|
331
|
-
return
|
|
332
|
-
|
|
333
|
-
}),
|
|
373
|
+
function nr() {
|
|
374
|
+
const { logWarning: e } = j();
|
|
375
|
+
function r(s, o, i) {
|
|
376
|
+
let l = null;
|
|
377
|
+
return s.traverse((c) => {
|
|
378
|
+
c[o] === i && (l = c);
|
|
379
|
+
}), l || e(`Child with ${o} '${i}' not found.`), l;
|
|
334
380
|
}
|
|
335
|
-
function t(
|
|
336
|
-
const
|
|
337
|
-
return
|
|
338
|
-
|
|
339
|
-
}),
|
|
381
|
+
function t(s, o, i) {
|
|
382
|
+
const l = [];
|
|
383
|
+
return s.traverse((c) => {
|
|
384
|
+
c[o].includes(i) && l.push(c);
|
|
385
|
+
}), l.length || e(`Children with ${o} '${i}' not found.`), l;
|
|
340
386
|
}
|
|
341
|
-
function
|
|
342
|
-
return
|
|
387
|
+
function n(s, o) {
|
|
388
|
+
return r(s, "name", o);
|
|
343
389
|
}
|
|
344
|
-
function a(
|
|
345
|
-
return t(
|
|
390
|
+
function a(s, o) {
|
|
391
|
+
return t(s, "name", o);
|
|
346
392
|
}
|
|
347
393
|
return {
|
|
348
|
-
seek:
|
|
349
|
-
seekByName:
|
|
394
|
+
seek: r,
|
|
395
|
+
seekByName: n,
|
|
350
396
|
seekAll: t,
|
|
351
397
|
seekAllByName: a
|
|
352
398
|
};
|
|
353
399
|
}
|
|
354
|
-
const
|
|
355
|
-
const t =
|
|
400
|
+
const St = ({ scene: e, contextParts: r }) => {
|
|
401
|
+
const t = le({
|
|
356
402
|
click: /* @__PURE__ */ new Map(),
|
|
357
403
|
pointerMove: /* @__PURE__ */ new Map(),
|
|
358
404
|
pointerEnter: /* @__PURE__ */ new Map(),
|
|
359
405
|
pointerLeave: /* @__PURE__ */ new Map()
|
|
360
|
-
}),
|
|
361
|
-
|
|
362
|
-
},
|
|
363
|
-
|
|
364
|
-
},
|
|
365
|
-
Object.values(t).forEach((
|
|
366
|
-
},
|
|
367
|
-
const { onClick:
|
|
368
|
-
|
|
406
|
+
}), n = B(/* @__PURE__ */ new Set()), a = (u) => {
|
|
407
|
+
n.value.add(u);
|
|
408
|
+
}, s = (u) => {
|
|
409
|
+
n.value.delete(u);
|
|
410
|
+
}, o = (u) => {
|
|
411
|
+
Object.values(t).forEach((g) => g.delete(u)), s(u);
|
|
412
|
+
}, i = (u) => {
|
|
413
|
+
const { onClick: g, onPointerMove: _, onPointerEnter: d, onPointerLeave: y } = u;
|
|
414
|
+
g && t.click.set(u, g), _ && t.pointerMove.set(u, _), d && t.pointerEnter.set(u, d), y && t.pointerLeave.set(u, y);
|
|
369
415
|
};
|
|
370
|
-
e.userData.tres__registerAtPointerEventHandler =
|
|
371
|
-
const
|
|
372
|
-
() =>
|
|
416
|
+
e.userData.tres__registerAtPointerEventHandler = i, e.userData.tres__deregisterAtPointerEventHandler = o, e.userData.tres__registerBlockingObjectAtPointerEventHandler = a, e.userData.tres__deregisterBlockingObjectAtPointerEventHandler = s;
|
|
417
|
+
const l = k(
|
|
418
|
+
() => gt(
|
|
373
419
|
[
|
|
374
|
-
...Array.from(
|
|
375
|
-
...Object.values(t).map((
|
|
420
|
+
...Array.from(n.value),
|
|
421
|
+
...Object.values(t).map((u) => Array.from(u.keys())).flat()
|
|
376
422
|
],
|
|
377
|
-
({ uuid:
|
|
423
|
+
({ uuid: u }) => u
|
|
378
424
|
)
|
|
379
|
-
), { onClick:
|
|
380
|
-
|
|
381
|
-
var
|
|
382
|
-
|
|
425
|
+
), { onClick: c, onPointerMove: m } = Pt(l, r);
|
|
426
|
+
c(({ intersects: u, event: g }) => {
|
|
427
|
+
var _;
|
|
428
|
+
u.length && ((_ = t.click.get(u[0].object)) == null || _(u[0], g));
|
|
383
429
|
});
|
|
384
|
-
let
|
|
385
|
-
return
|
|
386
|
-
var M, P,
|
|
387
|
-
const
|
|
388
|
-
|
|
430
|
+
let f;
|
|
431
|
+
return m(({ intersects: u, event: g }) => {
|
|
432
|
+
var C, M, P, w;
|
|
433
|
+
const _ = (C = u == null ? void 0 : u[0]) == null ? void 0 : C.object, { pointerLeave: d, pointerEnter: y, pointerMove: p } = t;
|
|
434
|
+
f && f !== _ && ((M = d.get(f)) == null || M(f, g)), _ && (f !== _ && ((P = y.get(_)) == null || P(u[0], g)), (w = p.get(_)) == null || w(u[0], g)), f = _ || null;
|
|
389
435
|
}), {
|
|
390
|
-
registerObject:
|
|
391
|
-
deregisterObject:
|
|
436
|
+
registerObject: i,
|
|
437
|
+
deregisterObject: o
|
|
392
438
|
};
|
|
393
439
|
};
|
|
394
|
-
function
|
|
395
|
-
let
|
|
440
|
+
function ve(e) {
|
|
441
|
+
let r = 0;
|
|
396
442
|
return e.traverse((t) => {
|
|
397
443
|
if (t.isMesh && t.geometry) {
|
|
398
|
-
const
|
|
399
|
-
|
|
444
|
+
const n = t.geometry, a = n.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, s = n.index ? n.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, o = n.attributes.normal ? n.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, i = n.attributes.uv ? n.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, l = a + s + o + i;
|
|
445
|
+
r += l;
|
|
400
446
|
}
|
|
401
|
-
}),
|
|
447
|
+
}), r;
|
|
448
|
+
}
|
|
449
|
+
function kt(e) {
|
|
450
|
+
return (e / 1024).toFixed(2);
|
|
402
451
|
}
|
|
403
|
-
const
|
|
404
|
-
function
|
|
452
|
+
const J = B({}), X = (e) => Object.assign(J.value, e);
|
|
453
|
+
function Tt({
|
|
405
454
|
scene: e,
|
|
406
|
-
canvas:
|
|
455
|
+
canvas: r,
|
|
407
456
|
windowSize: t,
|
|
408
|
-
disableRender:
|
|
457
|
+
disableRender: n,
|
|
409
458
|
rendererOptions: a
|
|
410
459
|
}) {
|
|
411
|
-
const
|
|
412
|
-
() =>
|
|
413
|
-
),
|
|
414
|
-
height:
|
|
415
|
-
width:
|
|
416
|
-
aspectRatio:
|
|
417
|
-
},
|
|
418
|
-
camera:
|
|
419
|
-
cameras:
|
|
420
|
-
registerCamera:
|
|
421
|
-
deregisterCamera:
|
|
422
|
-
setCameraActive:
|
|
423
|
-
} =
|
|
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 = {
|
|
463
|
+
height: i,
|
|
464
|
+
width: o,
|
|
465
|
+
aspectRatio: l
|
|
466
|
+
}, m = D(e), {
|
|
467
|
+
camera: f,
|
|
468
|
+
cameras: u,
|
|
469
|
+
registerCamera: g,
|
|
470
|
+
deregisterCamera: _,
|
|
471
|
+
setCameraActive: d
|
|
472
|
+
} = st({ sizes: c, scene: e }), { renderer: y } = Et(
|
|
424
473
|
{
|
|
425
474
|
scene: e,
|
|
426
|
-
canvas:
|
|
475
|
+
canvas: r,
|
|
427
476
|
options: a,
|
|
428
|
-
contextParts: { sizes:
|
|
429
|
-
disableRender:
|
|
477
|
+
contextParts: { sizes: c, camera: f },
|
|
478
|
+
disableRender: n
|
|
430
479
|
}
|
|
431
|
-
),
|
|
432
|
-
sizes:
|
|
433
|
-
scene:
|
|
434
|
-
camera:
|
|
435
|
-
cameras:
|
|
436
|
-
renderer:
|
|
437
|
-
raycaster:
|
|
438
|
-
controls:
|
|
480
|
+
), p = {
|
|
481
|
+
sizes: c,
|
|
482
|
+
scene: m,
|
|
483
|
+
camera: f,
|
|
484
|
+
cameras: Se(u),
|
|
485
|
+
renderer: y,
|
|
486
|
+
raycaster: D(new Je()),
|
|
487
|
+
controls: B(null),
|
|
439
488
|
perf: {
|
|
440
489
|
maxFrames: 160,
|
|
441
490
|
fps: {
|
|
@@ -448,136 +497,136 @@ function vt({
|
|
|
448
497
|
accumulator: []
|
|
449
498
|
}
|
|
450
499
|
},
|
|
451
|
-
extend:
|
|
452
|
-
registerCamera:
|
|
453
|
-
setCameraActive:
|
|
454
|
-
deregisterCamera:
|
|
500
|
+
extend: X,
|
|
501
|
+
registerCamera: g,
|
|
502
|
+
setCameraActive: d,
|
|
503
|
+
deregisterCamera: _
|
|
455
504
|
};
|
|
456
|
-
|
|
457
|
-
const
|
|
458
|
-
let
|
|
459
|
-
const
|
|
460
|
-
|
|
505
|
+
Q("useTres", p);
|
|
506
|
+
const C = 100, M = ot({ every: C }), { isSupported: P, memory: w } = at({ interval: C }), S = 160;
|
|
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));
|
|
461
510
|
};
|
|
462
|
-
let
|
|
463
|
-
const
|
|
464
|
-
window.__TRES__DEVTOOLS__ && (
|
|
511
|
+
let F = 0;
|
|
512
|
+
const we = 1, { pause: be, resume: Yt } = ce(({ delta: I }) => {
|
|
513
|
+
window.__TRES__DEVTOOLS__ && (b({ timestamp: performance.now() }), F += I, F >= we && (window.__TRES__DEVTOOLS__.cb(p), F = 0));
|
|
465
514
|
}, { immediate: !0 });
|
|
466
|
-
return
|
|
467
|
-
|
|
468
|
-
}),
|
|
515
|
+
return U(() => {
|
|
516
|
+
be();
|
|
517
|
+
}), p;
|
|
469
518
|
}
|
|
470
|
-
function
|
|
471
|
-
const e =
|
|
519
|
+
function Ot() {
|
|
520
|
+
const e = ke("useTres");
|
|
472
521
|
if (!e)
|
|
473
522
|
throw new Error("useTresContext must be used together with useTresContextProvider");
|
|
474
523
|
return e;
|
|
475
524
|
}
|
|
476
|
-
const
|
|
477
|
-
let
|
|
478
|
-
const { logError:
|
|
525
|
+
const or = Ot;
|
|
526
|
+
let h = null;
|
|
527
|
+
const { logError: se } = j(), W = [
|
|
479
528
|
"onClick",
|
|
480
529
|
"onPointerMove",
|
|
481
530
|
"onPointerEnter",
|
|
482
531
|
"onPointerLeave"
|
|
483
|
-
],
|
|
484
|
-
createElement(e,
|
|
485
|
-
var
|
|
486
|
-
if (
|
|
532
|
+
], At = {
|
|
533
|
+
createElement(e, r, t, n) {
|
|
534
|
+
var o, i;
|
|
535
|
+
if (n || (n = {}), n.args || (n.args = []), e === "template" || mt(e))
|
|
487
536
|
return null;
|
|
488
|
-
let a = e.replace("Tres", ""),
|
|
537
|
+
let a = e.replace("Tres", ""), s;
|
|
489
538
|
if (e === "primitive") {
|
|
490
|
-
(
|
|
491
|
-
const
|
|
492
|
-
a =
|
|
539
|
+
(n == null ? void 0 : n.object) === void 0 && se("Tres primitives need a prop 'object'");
|
|
540
|
+
const l = n.object;
|
|
541
|
+
a = l.type, s = Object.assign(l, { type: a, attach: n.attach, primitive: !0 });
|
|
493
542
|
} else {
|
|
494
|
-
const
|
|
495
|
-
|
|
543
|
+
const l = J.value[a];
|
|
544
|
+
l || se(`${a} is not defined on the THREE namespace. Use extend to add it to the catalog.`), s = new l(...n.args);
|
|
496
545
|
}
|
|
497
|
-
return
|
|
498
|
-
...
|
|
546
|
+
return s.isCamera && (n != null && n.position || s.position.set(3, 3, 3), n != null && n.lookAt || s.lookAt(0, 0, 0)), (n == null ? void 0 : n.attach) === void 0 && (s.isMaterial ? s.attach = "material" : s.isBufferGeometry && (s.attach = "geometry")), s.isObject3D && ((o = n == null ? void 0 : n.material) != null && o.isMaterial && (s.userData.tres__materialViaProp = !0), (i = n == null ? void 0 : n.geometry) != null && i.isBufferGeometry && (s.userData.tres__geometryViaProp = !0)), s.userData = {
|
|
547
|
+
...s.userData,
|
|
499
548
|
tres__name: a
|
|
500
|
-
},
|
|
549
|
+
}, s;
|
|
501
550
|
},
|
|
502
|
-
insert(e,
|
|
503
|
-
var
|
|
504
|
-
|
|
505
|
-
const t =
|
|
551
|
+
insert(e, r) {
|
|
552
|
+
var n, a, s, o;
|
|
553
|
+
r && r.isScene && (h = r);
|
|
554
|
+
const t = r || h;
|
|
506
555
|
if (e != null && e.isObject3D) {
|
|
507
556
|
if (e != null && e.isCamera) {
|
|
508
|
-
if (!(
|
|
557
|
+
if (!(h != null && h.userData.tres__registerCamera))
|
|
509
558
|
throw "could not find tres__registerCamera on scene's userData";
|
|
510
|
-
(a =
|
|
559
|
+
(a = h == null ? void 0 : (n = h.userData).tres__registerCamera) == null || a.call(n, e);
|
|
511
560
|
}
|
|
512
|
-
if (e &&
|
|
513
|
-
if (!(
|
|
561
|
+
if (e && W.some((i) => e[i])) {
|
|
562
|
+
if (!(h != null && h.userData.tres__registerAtPointerEventHandler))
|
|
514
563
|
throw "could not find tres__registerAtPointerEventHandler on scene's userData";
|
|
515
|
-
(
|
|
564
|
+
(o = h == null ? void 0 : (s = h.userData).tres__registerAtPointerEventHandler) == null || o.call(s, e);
|
|
516
565
|
}
|
|
517
566
|
}
|
|
518
567
|
e != null && e.isObject3D && (t != null && t.isObject3D) ? (t.add(e), e.dispatchEvent({ type: "added" })) : e != null && e.isFog ? t.fog = e : typeof (e == null ? void 0 : e.attach) == "string" && (e.__previousAttach = e[t == null ? void 0 : t.attach], t && (t[e.attach] = e));
|
|
519
568
|
},
|
|
520
569
|
remove(e) {
|
|
521
|
-
var
|
|
522
|
-
if (
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
570
|
+
var r, t;
|
|
571
|
+
if (e) {
|
|
572
|
+
if (e.isObject3D) {
|
|
573
|
+
const n = e, a = (c) => {
|
|
574
|
+
var f, u;
|
|
575
|
+
const m = c;
|
|
576
|
+
c.userData.tres__materialViaProp || ((f = m.material) == null || f.dispose(), m.material = void 0), c.userData.tres__geometryViaProp || ((u = m.geometry) == null || u.dispose(), m.geometry = void 0);
|
|
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));
|
|
584
|
+
}, l = (c) => {
|
|
585
|
+
const m = h == null ? void 0 : h.userData.tres__deregisterCamera;
|
|
586
|
+
if (!m)
|
|
587
|
+
throw "could not find tres__deregisterCamera on scene's userData";
|
|
588
|
+
c.isCamera && (m == null || m(c));
|
|
589
|
+
};
|
|
590
|
+
(r = e.removeFromParent) == null || r.call(e), n.traverse((c) => {
|
|
591
|
+
a(c), l(c), i == null || i(c);
|
|
592
|
+
}), a(n), l(n), i == null || i(n);
|
|
593
|
+
}
|
|
594
|
+
(t = e.dispose) == null || t.call(e);
|
|
545
595
|
}
|
|
546
|
-
l && e.dispose && e.type !== "Scene" && e.dispose();
|
|
547
596
|
},
|
|
548
|
-
patchProp(e,
|
|
549
|
-
var a,
|
|
597
|
+
patchProp(e, r, t, n) {
|
|
598
|
+
var a, s, o, i;
|
|
550
599
|
if (e) {
|
|
551
|
-
let
|
|
552
|
-
if (e.isObject3D &&
|
|
553
|
-
|
|
600
|
+
let l = e, c = r;
|
|
601
|
+
if (e.isObject3D && c === "blocks-pointer-events") {
|
|
602
|
+
n || n === "" ? (s = h == null ? void 0 : (a = h.userData).tres__registerBlockingObjectAtPointerEventHandler) == null || s.call(a, e) : (i = h == null ? void 0 : (o = h.userData).tres__deregisterBlockingObjectAtPointerEventHandler) == null || i.call(o, e);
|
|
554
603
|
return;
|
|
555
604
|
}
|
|
556
|
-
let
|
|
557
|
-
if (
|
|
558
|
-
const
|
|
559
|
-
|
|
605
|
+
let m = R(c), f = l == null ? void 0 : l[m];
|
|
606
|
+
if (c === "args") {
|
|
607
|
+
const g = e, _ = t ?? [], d = n ?? [], y = e.userData.tres__name || e.type;
|
|
608
|
+
y && _.length && !ht(_, d) && (l = Object.assign(g, new J.value[y](...n)));
|
|
560
609
|
return;
|
|
561
610
|
}
|
|
562
|
-
if (
|
|
563
|
-
if (
|
|
611
|
+
if (l.type === "BufferGeometry") {
|
|
612
|
+
if (c === "args")
|
|
564
613
|
return;
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
new
|
|
614
|
+
l.setAttribute(
|
|
615
|
+
R(c),
|
|
616
|
+
new Ke(...n)
|
|
568
617
|
);
|
|
569
618
|
return;
|
|
570
619
|
}
|
|
571
|
-
if (
|
|
572
|
-
const
|
|
573
|
-
|
|
620
|
+
if (c.includes("-") && f === void 0) {
|
|
621
|
+
const g = c.split("-");
|
|
622
|
+
f = g.reduce((_, d) => _[R(d)], l), c = g.pop(), m = c.toLowerCase(), f != null && f.set || (l = g.reduce((_, d) => _[R(d)], l));
|
|
574
623
|
}
|
|
575
|
-
let
|
|
576
|
-
if (
|
|
577
|
-
|
|
624
|
+
let u = n;
|
|
625
|
+
if (u === "" && (u = !0), ae(f)) {
|
|
626
|
+
W.includes(r) || (Array.isArray(u) ? e[m](...u) : e[m](u));
|
|
578
627
|
return;
|
|
579
628
|
}
|
|
580
|
-
!(
|
|
629
|
+
!(f != null && f.set) && !ae(f) ? l[m] = u : f.constructor === u.constructor && (f != null && f.copy) ? f == null || f.copy(u) : Array.isArray(u) ? f.set(...u) : !f.isColor && f.setScalar ? f.setScalar(u) : f.set(u);
|
|
581
630
|
}
|
|
582
631
|
},
|
|
583
632
|
parentNode(e) {
|
|
@@ -592,9 +641,288 @@ const { logError: re } = B(), V = [
|
|
|
592
641
|
setScopeId: () => void 0,
|
|
593
642
|
cloneNode: () => void 0,
|
|
594
643
|
insertStaticContent: () => void 0
|
|
595
|
-
}, { render:
|
|
596
|
-
|
|
597
|
-
|
|
644
|
+
}, { render: xt } = Te(At);
|
|
645
|
+
X(ue);
|
|
646
|
+
function Dt() {
|
|
647
|
+
return he().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
|
648
|
+
}
|
|
649
|
+
function he() {
|
|
650
|
+
return typeof navigator < "u" && typeof window < "u" ? window : typeof global < "u" ? global : {};
|
|
651
|
+
}
|
|
652
|
+
const Lt = typeof Proxy == "function", Bt = "devtools-plugin:setup", jt = "plugin:settings:set";
|
|
653
|
+
let T, K;
|
|
654
|
+
function It() {
|
|
655
|
+
var e;
|
|
656
|
+
return T !== void 0 || (typeof window < "u" && window.performance ? (T = !0, K = window.performance) : typeof global < "u" && (!((e = global.perf_hooks) === null || e === void 0) && e.performance) ? (T = !0, K = global.perf_hooks.performance) : T = !1), T;
|
|
657
|
+
}
|
|
658
|
+
function Rt() {
|
|
659
|
+
return It() ? K.now() : Date.now();
|
|
660
|
+
}
|
|
661
|
+
class Ht {
|
|
662
|
+
constructor(r, t) {
|
|
663
|
+
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = r, this.hook = t;
|
|
664
|
+
const n = {};
|
|
665
|
+
if (r.settings)
|
|
666
|
+
for (const o in r.settings) {
|
|
667
|
+
const i = r.settings[o];
|
|
668
|
+
n[o] = i.defaultValue;
|
|
669
|
+
}
|
|
670
|
+
const a = `__vue-devtools-plugin-settings__${r.id}`;
|
|
671
|
+
let s = Object.assign({}, n);
|
|
672
|
+
try {
|
|
673
|
+
const o = localStorage.getItem(a), i = JSON.parse(o);
|
|
674
|
+
Object.assign(s, i);
|
|
675
|
+
} catch {
|
|
676
|
+
}
|
|
677
|
+
this.fallbacks = {
|
|
678
|
+
getSettings() {
|
|
679
|
+
return s;
|
|
680
|
+
},
|
|
681
|
+
setSettings(o) {
|
|
682
|
+
try {
|
|
683
|
+
localStorage.setItem(a, JSON.stringify(o));
|
|
684
|
+
} catch {
|
|
685
|
+
}
|
|
686
|
+
s = o;
|
|
687
|
+
},
|
|
688
|
+
now() {
|
|
689
|
+
return Rt();
|
|
690
|
+
}
|
|
691
|
+
}, t && t.on(jt, (o, i) => {
|
|
692
|
+
o === this.plugin.id && this.fallbacks.setSettings(i);
|
|
693
|
+
}), this.proxiedOn = new Proxy({}, {
|
|
694
|
+
get: (o, i) => this.target ? this.target.on[i] : (...l) => {
|
|
695
|
+
this.onQueue.push({
|
|
696
|
+
method: i,
|
|
697
|
+
args: l
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
}), this.proxiedTarget = new Proxy({}, {
|
|
701
|
+
get: (o, i) => this.target ? this.target[i] : i === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(i) ? (...l) => (this.targetQueue.push({
|
|
702
|
+
method: i,
|
|
703
|
+
args: l,
|
|
704
|
+
resolve: () => {
|
|
705
|
+
}
|
|
706
|
+
}), this.fallbacks[i](...l)) : (...l) => new Promise((c) => {
|
|
707
|
+
this.targetQueue.push({
|
|
708
|
+
method: i,
|
|
709
|
+
args: l,
|
|
710
|
+
resolve: c
|
|
711
|
+
});
|
|
712
|
+
})
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
async setRealTarget(r) {
|
|
716
|
+
this.target = r;
|
|
717
|
+
for (const t of this.onQueue)
|
|
718
|
+
this.target.on[t.method](...t.args);
|
|
719
|
+
for (const t of this.targetQueue)
|
|
720
|
+
t.resolve(await this.target[t.method](...t.args));
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
function Nt(e, r) {
|
|
724
|
+
const t = e, n = he(), a = Dt(), s = Lt && t.enableEarlyProxy;
|
|
725
|
+
if (a && (n.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !s))
|
|
726
|
+
a.emit(Bt, e, r);
|
|
727
|
+
else {
|
|
728
|
+
const o = s ? new Ht(t, a) : null;
|
|
729
|
+
(n.__VUE_DEVTOOLS_PLUGINS__ = n.__VUE_DEVTOOLS_PLUGINS__ || []).push({
|
|
730
|
+
pluginDescriptor: t,
|
|
731
|
+
setupFn: r,
|
|
732
|
+
proxy: o
|
|
733
|
+
}), o && r(o.proxiedTarget);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
function Vt(e, r) {
|
|
737
|
+
const t = `▲ ■ ●${e}`;
|
|
738
|
+
typeof __VUE_DEVTOOLS_TOAST__ == "function" ? __VUE_DEVTOOLS_TOAST__(t, r) : r === "error" ? console.error(t) : r === "warn" ? console.warn(t) : console.log(t);
|
|
739
|
+
}
|
|
740
|
+
const ye = (e) => {
|
|
741
|
+
const r = {
|
|
742
|
+
id: e.uuid,
|
|
743
|
+
label: e.type,
|
|
744
|
+
children: [],
|
|
745
|
+
tags: []
|
|
746
|
+
};
|
|
747
|
+
e.name !== "" && r.tags.push({
|
|
748
|
+
label: e.name,
|
|
749
|
+
textColor: 5750629,
|
|
750
|
+
backgroundColor: 15793395
|
|
751
|
+
});
|
|
752
|
+
const t = ve(e);
|
|
753
|
+
return t > 0 && r.tags.push({
|
|
754
|
+
label: `${kt(t)} KB`,
|
|
755
|
+
textColor: 15707189,
|
|
756
|
+
backgroundColor: 16775644,
|
|
757
|
+
tooltip: "Memory usage"
|
|
758
|
+
}), e.type.includes("Light") && (r.tags.push({
|
|
759
|
+
label: `${e.intensity}`,
|
|
760
|
+
textColor: 9738662,
|
|
761
|
+
backgroundColor: 16316922,
|
|
762
|
+
tooltip: "Intensity"
|
|
763
|
+
}), r.tags.push({
|
|
764
|
+
label: `#${e.color.getHexString()}`,
|
|
765
|
+
textColor: 9738662,
|
|
766
|
+
backgroundColor: 16316922,
|
|
767
|
+
tooltip: "Color"
|
|
768
|
+
})), e.type.includes("Camera") && (r.tags.push({
|
|
769
|
+
label: `${e.fov}°`,
|
|
770
|
+
textColor: 9738662,
|
|
771
|
+
backgroundColor: 16316922,
|
|
772
|
+
tooltip: "Field of view"
|
|
773
|
+
}), r.tags.push({
|
|
774
|
+
// eslint-disable-next-line max-len
|
|
775
|
+
label: `x: ${Math.round(e.position.x)} y: ${Math.round(e.position.y)} z: ${Math.round(e.position.z)}`,
|
|
776
|
+
textColor: 9738662,
|
|
777
|
+
backgroundColor: 16316922,
|
|
778
|
+
tooltip: "Position"
|
|
779
|
+
})), r;
|
|
780
|
+
};
|
|
781
|
+
function _e(e, r) {
|
|
782
|
+
e.children.forEach((t) => {
|
|
783
|
+
if (t.type === "HightlightMesh")
|
|
784
|
+
return;
|
|
785
|
+
const n = ye(t);
|
|
786
|
+
r.children.push(n), _e(t, n);
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
const $t = [], O = "tres:inspector", Ut = le({
|
|
790
|
+
sceneGraph: null
|
|
791
|
+
});
|
|
792
|
+
function Ft(e, r) {
|
|
793
|
+
Nt(
|
|
794
|
+
{
|
|
795
|
+
id: "dev.esm.tres",
|
|
796
|
+
label: "TresJS 🪐",
|
|
797
|
+
logo: "https://raw.githubusercontent.com/Tresjs/tres/main/public/favicon.svg",
|
|
798
|
+
packageName: "tresjs",
|
|
799
|
+
homepage: "https://tresjs.org",
|
|
800
|
+
componentStateTypes: $t,
|
|
801
|
+
app: e
|
|
802
|
+
},
|
|
803
|
+
(t) => {
|
|
804
|
+
typeof t.now != "function" && Vt(
|
|
805
|
+
// eslint-disable-next-line max-len
|
|
806
|
+
"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
|
+
), t.addInspector({
|
|
808
|
+
id: O,
|
|
809
|
+
label: "TresJS 🪐",
|
|
810
|
+
icon: "account_tree",
|
|
811
|
+
treeFilterPlaceholder: "Search instances"
|
|
812
|
+
}), setInterval(() => {
|
|
813
|
+
t.sendInspectorTree(O);
|
|
814
|
+
}, 1e3), setInterval(() => {
|
|
815
|
+
t.notifyComponentUpdate();
|
|
816
|
+
}, 5e3), t.on.getInspectorTree((s) => {
|
|
817
|
+
if (s.inspectorId === O) {
|
|
818
|
+
const o = ye(r.scene.value);
|
|
819
|
+
_e(r.scene.value, o), Ut.sceneGraph = o, s.rootNodes = [o];
|
|
820
|
+
}
|
|
821
|
+
});
|
|
822
|
+
let n = null, a = null;
|
|
823
|
+
t.on.getInspectorState((s) => {
|
|
824
|
+
if (s.inspectorId === O) {
|
|
825
|
+
const [o] = r.scene.value.getObjectsByProperty("uuid", s.nodeId);
|
|
826
|
+
if (!o)
|
|
827
|
+
return;
|
|
828
|
+
if (a && n && n.parent && a.remove(n), o.isMesh) {
|
|
829
|
+
const i = wt(o);
|
|
830
|
+
o.add(i), n = i, a = o;
|
|
831
|
+
}
|
|
832
|
+
s.state = {
|
|
833
|
+
object: [
|
|
834
|
+
{
|
|
835
|
+
key: "uuid",
|
|
836
|
+
editable: !0,
|
|
837
|
+
value: o.uuid
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
key: "name",
|
|
841
|
+
editable: !0,
|
|
842
|
+
value: o.name
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
key: "type",
|
|
846
|
+
editable: !0,
|
|
847
|
+
value: o.type
|
|
848
|
+
},
|
|
849
|
+
{
|
|
850
|
+
key: "position",
|
|
851
|
+
editable: !0,
|
|
852
|
+
value: o.position
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
key: "rotation",
|
|
856
|
+
editable: !0,
|
|
857
|
+
value: o.rotation
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
key: "scale",
|
|
861
|
+
editable: !0,
|
|
862
|
+
value: o.scale
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
key: "geometry",
|
|
866
|
+
value: o.geometry
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
key: "material",
|
|
870
|
+
value: o.material
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
key: "color",
|
|
874
|
+
editable: !0,
|
|
875
|
+
value: o.color
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
key: "intensity",
|
|
879
|
+
editable: !0,
|
|
880
|
+
value: o.intensity
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
key: "castShadow",
|
|
884
|
+
editable: !0,
|
|
885
|
+
value: o.castShadow
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
key: "receiveShadow",
|
|
889
|
+
editable: !0,
|
|
890
|
+
value: o.receiveShadow
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
key: "frustumCulled",
|
|
894
|
+
editable: !0,
|
|
895
|
+
value: o.frustumCulled
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
key: "matrixAutoUpdate",
|
|
899
|
+
editable: !0,
|
|
900
|
+
value: o.matrixAutoUpdate
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
key: "matrixWorldNeedsUpdate",
|
|
904
|
+
editable: !0,
|
|
905
|
+
value: o.matrixWorldNeedsUpdate
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
key: "matrixWorld",
|
|
909
|
+
value: o.matrixWorld
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
key: "visible",
|
|
913
|
+
editable: !0,
|
|
914
|
+
value: o.visible
|
|
915
|
+
}
|
|
916
|
+
]
|
|
917
|
+
};
|
|
918
|
+
}
|
|
919
|
+
}), t.on.editInspectorState((s) => {
|
|
920
|
+
s.inspectorId === O && _t(r.scene.value, s.nodeId, s.path, s.state.value);
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
);
|
|
924
|
+
}
|
|
925
|
+
const Gt = ["data-scene"], zt = /* @__PURE__ */ Z({
|
|
598
926
|
__name: "TresCanvas",
|
|
599
927
|
props: {
|
|
600
928
|
shadows: { type: Boolean, default: void 0 },
|
|
@@ -620,113 +948,107 @@ const ht = ["data-scene"], wt = /* @__PURE__ */ J({
|
|
|
620
948
|
logarithmicDepthBuffer: { type: Boolean, default: void 0 },
|
|
621
949
|
failIfMajorPerformanceCaveat: { type: Boolean, default: void 0 }
|
|
622
950
|
},
|
|
623
|
-
setup(e, { expose:
|
|
624
|
-
var
|
|
625
|
-
const t = e, { logWarning:
|
|
626
|
-
ie();
|
|
627
|
-
const u = Ee(), l = (d = K()) == null ? void 0 : d.appContext.app;
|
|
628
|
-
let c = null;
|
|
629
|
-
const m = (p) => J({
|
|
951
|
+
setup(e, { expose: r }) {
|
|
952
|
+
var _;
|
|
953
|
+
const t = e, { logWarning: n } = j(), a = B(), s = D(new qe()), { resume: o } = me(), i = Oe(), l = (_ = ee()) == null ? void 0 : _.appContext.app, c = (d) => Z({
|
|
630
954
|
setup() {
|
|
631
|
-
var
|
|
632
|
-
const
|
|
633
|
-
return
|
|
955
|
+
var p;
|
|
956
|
+
const y = (p = ee()) == null ? void 0 : p.appContext;
|
|
957
|
+
return y && (y.app = l), Q("useTres", d), Q("extend", X), typeof window < "u" && Ft(y.app, d), () => te(je, null, i != null && i.default ? i.default() : []);
|
|
634
958
|
}
|
|
635
|
-
}),
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
959
|
+
}), m = (d) => {
|
|
960
|
+
const y = c(d);
|
|
961
|
+
xt(te(y), s.value);
|
|
962
|
+
}, f = (d, y = !1) => {
|
|
963
|
+
s.value.children = [], y && (d.renderer.value.dispose(), d.renderer.value.renderLists.dispose(), d.renderer.value.forceContextLoss()), m(d), o();
|
|
964
|
+
}, u = k(() => t.disableRender), g = D(null);
|
|
965
|
+
return r({ context: g, dispose: () => f(g.value, !0) }), Ae(() => {
|
|
966
|
+
const d = a;
|
|
967
|
+
g.value = Tt({
|
|
968
|
+
scene: s.value,
|
|
969
|
+
canvas: d,
|
|
645
970
|
windowSize: t.windowSize,
|
|
646
|
-
disableRender:
|
|
971
|
+
disableRender: u,
|
|
647
972
|
rendererOptions: t
|
|
648
|
-
}),
|
|
649
|
-
const { registerCamera:
|
|
650
|
-
|
|
651
|
-
const
|
|
652
|
-
const
|
|
973
|
+
}), St({ scene: s.value, contextParts: g.value });
|
|
974
|
+
const { registerCamera: y, camera: p, cameras: C, deregisterCamera: M } = g.value;
|
|
975
|
+
m(g.value);
|
|
976
|
+
const P = () => {
|
|
977
|
+
const w = new Y(
|
|
653
978
|
45,
|
|
654
979
|
window.innerWidth / window.innerHeight,
|
|
655
980
|
0.1,
|
|
656
981
|
1e3
|
|
657
982
|
);
|
|
658
|
-
|
|
659
|
-
const
|
|
660
|
-
|
|
983
|
+
w.position.set(3, 3, 3), w.lookAt(0, 0, 0), y(w);
|
|
984
|
+
const S = A(() => {
|
|
985
|
+
C.value.length >= 2 && (w.removeFromParent(), M(w), S == null || S());
|
|
661
986
|
});
|
|
662
987
|
};
|
|
663
|
-
|
|
988
|
+
ie(
|
|
664
989
|
() => t.camera,
|
|
665
|
-
(
|
|
666
|
-
|
|
990
|
+
(w, S) => {
|
|
991
|
+
w && y(w), S && (S.removeFromParent(), M(S));
|
|
667
992
|
},
|
|
668
993
|
{
|
|
669
994
|
immediate: !0
|
|
670
995
|
}
|
|
671
|
-
),
|
|
996
|
+
), p.value || (n(
|
|
672
997
|
"No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
|
|
673
|
-
),
|
|
674
|
-
}),
|
|
675
|
-
f.value && i(f.value);
|
|
676
|
-
}), (p, w) => (Ce(), Me("canvas", {
|
|
998
|
+
), P());
|
|
999
|
+
}), (d, y) => (xe(), De("canvas", {
|
|
677
1000
|
ref_key: "canvas",
|
|
678
1001
|
ref: a,
|
|
679
|
-
"data-scene":
|
|
680
|
-
class:
|
|
681
|
-
style:
|
|
1002
|
+
"data-scene": s.value.uuid,
|
|
1003
|
+
class: Le(d.$attrs.class),
|
|
1004
|
+
style: Be({
|
|
682
1005
|
display: "block",
|
|
683
1006
|
width: "100%",
|
|
684
1007
|
height: "100%",
|
|
685
|
-
position:
|
|
1008
|
+
position: d.windowSize ? "fixed" : "relative",
|
|
686
1009
|
top: 0,
|
|
687
1010
|
left: 0,
|
|
688
1011
|
pointerEvents: "auto",
|
|
689
1012
|
touchAction: "none",
|
|
690
|
-
...
|
|
1013
|
+
...d.$attrs.style
|
|
691
1014
|
})
|
|
692
|
-
}, null, 14,
|
|
1015
|
+
}, null, 14, Gt));
|
|
693
1016
|
}
|
|
694
|
-
}),
|
|
1017
|
+
}), Wt = [
|
|
695
1018
|
"TresCanvas",
|
|
696
1019
|
"TresLeches",
|
|
697
1020
|
"TresScene"
|
|
698
|
-
],
|
|
1021
|
+
], Qt = {
|
|
699
1022
|
template: {
|
|
700
1023
|
compilerOptions: {
|
|
701
|
-
isCustomElement: (e) => e.startsWith("Tres") && !
|
|
1024
|
+
isCustomElement: (e) => e.startsWith("Tres") && !Wt.includes(e) || e === "primitive"
|
|
702
1025
|
}
|
|
703
1026
|
}
|
|
704
|
-
},
|
|
1027
|
+
}, ar = Qt, sr = {
|
|
705
1028
|
install(e) {
|
|
706
|
-
e.component("TresCanvas",
|
|
1029
|
+
e.component("TresCanvas", zt);
|
|
707
1030
|
}
|
|
708
1031
|
};
|
|
709
1032
|
export {
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
vt as useTresContextProvider
|
|
1033
|
+
zt as TresCanvas,
|
|
1034
|
+
J as catalogue,
|
|
1035
|
+
sr as default,
|
|
1036
|
+
X as extend,
|
|
1037
|
+
Zt as isProd,
|
|
1038
|
+
ct as normalizeColor,
|
|
1039
|
+
er as normalizeVectorFlexibleParam,
|
|
1040
|
+
ar as templateCompilerOptions,
|
|
1041
|
+
Mt as trasverseObjects,
|
|
1042
|
+
st as useCamera,
|
|
1043
|
+
tr as useLoader,
|
|
1044
|
+
j as useLogger,
|
|
1045
|
+
St as usePointerEventHandler,
|
|
1046
|
+
Pt as useRaycaster,
|
|
1047
|
+
me as useRenderLoop,
|
|
1048
|
+
Et as useRenderer,
|
|
1049
|
+
nr as useSeek,
|
|
1050
|
+
rr as useTexture,
|
|
1051
|
+
or as useTres,
|
|
1052
|
+
Ot as useTresContext,
|
|
1053
|
+
Tt as useTresContextProvider
|
|
732
1054
|
};
|