@tresjs/core 2.4.0-next.0 → 2.4.0-next.10
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 +179 -64
- package/dist/composables/index.d.ts +1 -1
- package/dist/composables/useCamera/index.d.ts +3204 -7
- package/dist/composables/usePointerEventHandler/index.d.ts +7 -2
- package/dist/composables/useRaycaster/index.d.ts +4 -3
- package/dist/composables/useRenderLoop/index.d.ts +1 -1
- package/dist/composables/useRenderer/index.d.ts +25 -32
- package/dist/composables/useTresContextProvider/index.d.ts +25 -0
- package/dist/core/nodeOps.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/tres.js +425 -417
- package/dist/tres.umd.cjs +2 -2
- package/dist/types/index.d.ts +13 -4
- package/dist/utils/index.d.ts +2 -0
- package/package.json +1 -1
- package/dist/composables/useCamera/old.d.ts +0 -98
- package/dist/composables/useTres/index.d.ts +0 -142
- package/dist/keys.d.ts +0 -6
- package/dist/provider/index.d.ts +0 -20
- package/dist/utils/test-utils.d.ts +0 -1
package/dist/tres.js
CHANGED
|
@@ -1,471 +1,471 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version: v2.4.0
|
|
3
|
+
* version: v2.4.0-next.10
|
|
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
|
-
import {
|
|
9
|
-
import * as
|
|
10
|
-
import { PerspectiveCamera as
|
|
11
|
-
import { createEventHook as
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
8
|
+
import { ref as G, computed as _, watchEffect as b, onUnmounted as W, shallowRef as j, watch as J, reactive as re, readonly as ne, provide as ae, inject as oe, createRenderer as se, defineComponent as ie, useSlots as ue, onMounted as le, openBlock as ce, createElementBlock as fe, normalizeStyle as me } from "vue";
|
|
9
|
+
import * as pe from "three";
|
|
10
|
+
import { PerspectiveCamera as V, OrthographicCamera as ve, Camera as de, Clock as ge, SRGBColorSpace as we, ACESFilmicToneMapping as ye, PCFSoftShadowMap as Ce, Vector3 as Pe, Color as O, WebGLRenderer as z, LoadingManager as Me, TextureLoader as _e, Raycaster as Ee, Vector2 as xe, BufferAttribute as Le, Scene as Te } from "three";
|
|
11
|
+
import { createEventHook as A, useRafFn as be, toValue as y, unrefElement as De, useDevicePixelRatio as Ae, usePointer as ke, useElementBounding as Se, useWindowSize as he, useElementSize as Be } from "@vueuse/core";
|
|
12
|
+
const K = G({}), X = (e) => void Object.assign(K.value, e), I = (e) => typeof e == "function", Y = (e) => !!e && e.constructor === Array, Oe = ({ sizes: e, scene: n }) => {
|
|
13
|
+
const r = G([]), t = _(
|
|
14
|
+
() => r.value[0]
|
|
15
|
+
), o = (a, s = !1) => {
|
|
16
|
+
r.value.some(({ uuid: u }) => u === a.uuid) || (s ? l(a) : r.value.push(a));
|
|
17
|
+
}, i = (a) => {
|
|
18
|
+
r.value = r.value.filter(({ uuid: s }) => s !== a.uuid);
|
|
19
|
+
}, l = (a) => {
|
|
20
|
+
const s = a instanceof de ? a : r.value.find((c) => c.uuid === a);
|
|
21
|
+
if (!s)
|
|
22
|
+
return;
|
|
23
|
+
const u = r.value.filter(({ uuid: c }) => c !== s.uuid);
|
|
24
|
+
r.value = [s, ...u];
|
|
25
|
+
};
|
|
26
|
+
return b(() => {
|
|
27
|
+
e.aspectRatio.value && r.value.forEach((a) => {
|
|
28
|
+
a instanceof V && (a.aspect = e.aspectRatio.value), (a instanceof V || a instanceof ve) && a.updateProjectionMatrix();
|
|
29
|
+
});
|
|
30
|
+
}), n.userData.tres__registerCamera = o, n.userData.tres__deregisterCamera = i, W(() => {
|
|
31
|
+
r.value = [];
|
|
29
32
|
}), {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
addCamera:
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
camera: t,
|
|
34
|
+
cameras: r,
|
|
35
|
+
addCamera: o,
|
|
36
|
+
removeCamera: i,
|
|
37
|
+
setCameraActive: l
|
|
35
38
|
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const { pause: Xe, resume: Qe, isActive: Ze } = We(
|
|
39
|
+
}, Q = A(), Z = A(), $ = A(), D = new ge();
|
|
40
|
+
let R = 0, F = 0;
|
|
41
|
+
const { pause: Re, resume: Fe, isActive: ze } = be(
|
|
40
42
|
() => {
|
|
41
|
-
|
|
43
|
+
Q.trigger({ delta: R, elapsed: F, clock: D }), Z.trigger({ delta: R, elapsed: F, clock: D }), $.trigger({ delta: R, elapsed: F, clock: D });
|
|
42
44
|
},
|
|
43
45
|
{ immediate: !1 }
|
|
44
46
|
);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
$.on(() => {
|
|
48
|
+
R = D.getDelta(), F = D.getElapsedTime();
|
|
47
49
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function Tt(e) {
|
|
59
|
-
return typeof e == "number" ? [e, e, e] : e instanceof Oe ? [e.x, e.y, e.z] : e;
|
|
60
|
-
}
|
|
61
|
-
function et(e) {
|
|
62
|
-
return e instanceof G ? e : Array.isArray(e) ? new G(...e) : new G(e);
|
|
63
|
-
}
|
|
64
|
-
const H = {
|
|
50
|
+
const ee = () => ({
|
|
51
|
+
onBeforeLoop: Q.on,
|
|
52
|
+
onLoop: Z.on,
|
|
53
|
+
onAfterLoop: $.on,
|
|
54
|
+
pause: Re,
|
|
55
|
+
resume: Fe,
|
|
56
|
+
isActive: ze
|
|
57
|
+
}), h = {
|
|
65
58
|
realistic: {
|
|
66
|
-
outputColorSpace:
|
|
67
|
-
toneMapping:
|
|
59
|
+
outputColorSpace: we,
|
|
60
|
+
toneMapping: ye,
|
|
68
61
|
toneMappingExposure: 3,
|
|
69
62
|
shadowMap: {
|
|
70
63
|
enabled: !0,
|
|
71
|
-
type:
|
|
64
|
+
type: Ce
|
|
72
65
|
}
|
|
73
66
|
}
|
|
74
|
-
},
|
|
75
|
-
for (const
|
|
76
|
-
n[
|
|
67
|
+
}, te = (e, n) => {
|
|
68
|
+
for (const r of Object.keys(n))
|
|
69
|
+
n[r] instanceof Object && Object.assign(n[r], te(e[r], n[r]));
|
|
77
70
|
return Object.assign(e || {}, n), e;
|
|
78
|
-
},
|
|
71
|
+
}, He = "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", Ve = /* @__PURE__ */ Ge(He);
|
|
79
72
|
function B(e) {
|
|
80
|
-
return e.replace(/-([a-z])/g, (n,
|
|
73
|
+
return e.replace(/-([a-z])/g, (n, r) => r.toUpperCase());
|
|
81
74
|
}
|
|
82
|
-
function
|
|
83
|
-
const
|
|
84
|
-
for (let
|
|
85
|
-
|
|
86
|
-
return n ? (
|
|
75
|
+
function Ge(e, n) {
|
|
76
|
+
const r = /* @__PURE__ */ Object.create(null), t = e.split(",");
|
|
77
|
+
for (let o = 0; o < t.length; o++)
|
|
78
|
+
r[t[o]] = !0;
|
|
79
|
+
return n ? (o) => !!r[o.toLowerCase()] : (o) => !!r[o];
|
|
87
80
|
}
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
for (const
|
|
91
|
-
const i = n(
|
|
92
|
-
|
|
81
|
+
const We = (e, n) => {
|
|
82
|
+
const r = /* @__PURE__ */ new Set(), t = [];
|
|
83
|
+
for (const o of e) {
|
|
84
|
+
const i = n(o);
|
|
85
|
+
r.has(i) || (r.add(i), t.push(o));
|
|
93
86
|
}
|
|
94
87
|
return t;
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
88
|
+
}, N = (e, n) => {
|
|
89
|
+
if (!n)
|
|
90
|
+
return;
|
|
91
|
+
const r = Array.isArray(n) ? n : n.match(/([^[.\]])+/g);
|
|
92
|
+
return r == null ? void 0 : r.reduce((t, o) => t && t[o], e);
|
|
93
|
+
}, je = (e, n, r) => {
|
|
94
|
+
const t = Array.isArray(n) ? n : n.match(/([^[.\]])+/g);
|
|
95
|
+
t && t.reduce((o, i, l) => (o[i] === void 0 && (o[i] = {}), l === t.length - 1 && (o[i] = r), o[i]), e);
|
|
96
|
+
}, ot = !0, q = "[TresJS ▲ ■ ●] ";
|
|
97
|
+
function k() {
|
|
98
|
+
function e(t, o) {
|
|
99
|
+
console.error(`${q} ${t}`, o || "");
|
|
99
100
|
}
|
|
100
101
|
function n(t) {
|
|
101
|
-
console.warn(`${
|
|
102
|
+
console.warn(`${q} ${t}`);
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
+
function r(t, o) {
|
|
104
105
|
}
|
|
105
106
|
return {
|
|
106
107
|
logError: e,
|
|
107
108
|
logWarning: n,
|
|
108
|
-
logMessage:
|
|
109
|
+
logMessage: r
|
|
109
110
|
};
|
|
110
111
|
}
|
|
111
|
-
function
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
112
|
+
function st(e) {
|
|
113
|
+
return typeof e == "number" ? [e, e, e] : e instanceof Pe ? [e.x, e.y, e.z] : e;
|
|
114
|
+
}
|
|
115
|
+
function $e(e) {
|
|
116
|
+
return e instanceof O ? e : Array.isArray(e) ? new O(...e) : new O(e);
|
|
117
|
+
}
|
|
118
|
+
function Ie({
|
|
119
|
+
scene: e,
|
|
120
|
+
canvas: n,
|
|
121
|
+
options: r,
|
|
122
|
+
disableRender: t,
|
|
123
|
+
contextParts: { sizes: o, camera: i }
|
|
124
|
+
}) {
|
|
125
|
+
const l = _(() => ({
|
|
126
|
+
alpha: y(r.alpha),
|
|
127
|
+
depth: y(r.depth),
|
|
128
|
+
canvas: De(n),
|
|
129
|
+
context: y(r.context),
|
|
130
|
+
stencil: y(r.stencil),
|
|
131
|
+
antialias: y(r.antialias) === void 0 ? (
|
|
132
|
+
// an opinionated default of tres
|
|
133
|
+
!0
|
|
134
|
+
) : y(r.antialias),
|
|
135
|
+
precision: y(r.precision),
|
|
136
|
+
powerPreference: y(r.powerPreference),
|
|
137
|
+
premultipliedAlpha: y(r.premultipliedAlpha),
|
|
138
|
+
preserveDrawingBuffer: y(r.preserveDrawingBuffer),
|
|
139
|
+
logarithmicDepthBuffer: y(r.logarithmicDepthBuffer),
|
|
140
|
+
failIfMajorPerformanceCaveat: y(r.failIfMajorPerformanceCaveat)
|
|
141
|
+
})), a = j(new z(l.value));
|
|
142
|
+
J(l, () => {
|
|
143
|
+
a.value.dispose(), a.value = new z(l.value);
|
|
144
|
+
}), b(() => {
|
|
145
|
+
a.value.setSize(o.width.value, o.height.value);
|
|
146
|
+
});
|
|
147
|
+
const { pixelRatio: s } = Ae();
|
|
148
|
+
b(() => {
|
|
149
|
+
a.value.setPixelRatio(s.value);
|
|
150
|
+
});
|
|
151
|
+
const { logError: u } = k(), f = (() => {
|
|
152
|
+
const p = new z(), d = {
|
|
153
|
+
shadowMap: {
|
|
154
|
+
enabled: p.shadowMap.enabled,
|
|
155
|
+
type: p.shadowMap.type
|
|
156
|
+
},
|
|
157
|
+
toneMapping: p.toneMapping,
|
|
158
|
+
toneMappingExposure: p.toneMappingExposure,
|
|
159
|
+
outputColorSpace: p.outputColorSpace,
|
|
160
|
+
useLegacyLights: p.useLegacyLights
|
|
161
|
+
};
|
|
162
|
+
return p.dispose(), d;
|
|
163
|
+
})();
|
|
164
|
+
b(() => {
|
|
165
|
+
const p = y(r.preset);
|
|
166
|
+
p && (p in h || u("Renderer Preset must be one of these: " + Object.keys(h).join(", ")), te(a.value, h[p]));
|
|
167
|
+
const d = (L, x) => {
|
|
168
|
+
const T = y(L), S = () => {
|
|
169
|
+
if (p)
|
|
170
|
+
return N(h[p], x);
|
|
171
|
+
};
|
|
172
|
+
if (T !== void 0)
|
|
173
|
+
return T;
|
|
174
|
+
const m = S();
|
|
175
|
+
return m !== void 0 ? m : N(f, x);
|
|
176
|
+
}, v = (L, x) => je(a.value, x, d(L, x));
|
|
177
|
+
v(r.shadows, "shadowMap.enabled"), v(r.toneMapping, "toneMapping"), v(r.shadowMapType, "shadowMap.type"), v(r.useLegacyLights, "useLegacyLights"), v(r.outputColorSpace, "outputColorSpace"), v(r.toneMappingExposure, "toneMappingExposure");
|
|
178
|
+
const E = d(r.clearColor, "clearColor");
|
|
179
|
+
E && a.value.setClearColor(
|
|
180
|
+
E ? $e(E) : new O(0)
|
|
181
|
+
// default clear color is not easily/efficiently retrievable from three
|
|
182
|
+
);
|
|
183
|
+
});
|
|
184
|
+
const { pause: w, resume: C, onLoop: M } = ee();
|
|
185
|
+
return M(() => {
|
|
186
|
+
i.value && !y(t) && a.value.render(e, i.value);
|
|
187
|
+
}), C(), W(() => {
|
|
188
|
+
w(), a.value.dispose(), a.value.forceContextLoss();
|
|
189
|
+
}), {
|
|
190
|
+
renderer: a
|
|
179
191
|
};
|
|
180
192
|
}
|
|
181
|
-
|
|
182
|
-
function it(e) {
|
|
193
|
+
function Ne(e) {
|
|
183
194
|
const n = { nodes: {}, materials: {} };
|
|
184
|
-
return e && e.traverse((
|
|
185
|
-
|
|
195
|
+
return e && e.traverse((r) => {
|
|
196
|
+
r.name && (n.nodes[r.name] = r), r.material && !n.materials[r.material.name] && (n.materials[r.material.name] = r.material);
|
|
186
197
|
}), n;
|
|
187
198
|
}
|
|
188
|
-
async function
|
|
189
|
-
const { logError: i } =
|
|
190
|
-
|
|
199
|
+
async function it(e, n, r, t, o) {
|
|
200
|
+
const { logError: i } = k(), l = new e();
|
|
201
|
+
o && o(l), r && r(l);
|
|
191
202
|
const s = (Array.isArray(n) ? n : [n]).map(
|
|
192
|
-
(u) => new Promise((
|
|
193
|
-
|
|
203
|
+
(u) => new Promise((c, f) => {
|
|
204
|
+
l.load(
|
|
194
205
|
u,
|
|
195
|
-
(
|
|
196
|
-
|
|
206
|
+
(w) => {
|
|
207
|
+
w.scene && Object.assign(w, Ne(w.scene)), c(w);
|
|
197
208
|
},
|
|
198
209
|
t,
|
|
199
|
-
(
|
|
210
|
+
(w) => f(i("[useLoader] - Failed to load resource", w))
|
|
200
211
|
);
|
|
201
212
|
})
|
|
202
213
|
);
|
|
203
|
-
return
|
|
214
|
+
return Y(n) ? await Promise.all(s) : await s[0];
|
|
204
215
|
}
|
|
205
|
-
async function
|
|
206
|
-
const n = new
|
|
207
|
-
|
|
208
|
-
|
|
216
|
+
async function ut(e) {
|
|
217
|
+
const n = new Me(), r = new _e(n), t = (o) => new Promise((i, l) => {
|
|
218
|
+
r.load(
|
|
219
|
+
o,
|
|
209
220
|
(a) => i(a),
|
|
210
221
|
() => null,
|
|
211
222
|
() => {
|
|
212
|
-
|
|
223
|
+
l(new Error("[useTextures] - Failed to load texture"));
|
|
213
224
|
}
|
|
214
225
|
);
|
|
215
226
|
});
|
|
216
|
-
if (
|
|
217
|
-
const
|
|
218
|
-
return e.length > 1 ?
|
|
227
|
+
if (Y(e)) {
|
|
228
|
+
const o = await Promise.all(e.map((i) => t(i)));
|
|
229
|
+
return e.length > 1 ? o : o[0];
|
|
219
230
|
} else {
|
|
220
231
|
const {
|
|
221
|
-
map:
|
|
232
|
+
map: o,
|
|
222
233
|
displacementMap: i,
|
|
223
|
-
normalMap:
|
|
234
|
+
normalMap: l,
|
|
224
235
|
roughnessMap: a,
|
|
225
236
|
metalnessMap: s,
|
|
226
237
|
aoMap: u,
|
|
227
|
-
alphaMap:
|
|
228
|
-
matcap:
|
|
238
|
+
alphaMap: c,
|
|
239
|
+
matcap: f
|
|
229
240
|
} = e;
|
|
230
241
|
return {
|
|
231
|
-
map:
|
|
242
|
+
map: o ? await t(o) : null,
|
|
232
243
|
displacementMap: i ? await t(i) : null,
|
|
233
|
-
normalMap:
|
|
244
|
+
normalMap: l ? await t(l) : null,
|
|
234
245
|
roughnessMap: a ? await t(a) : null,
|
|
235
246
|
metalnessMap: s ? await t(s) : null,
|
|
236
247
|
aoMap: u ? await t(u) : null,
|
|
237
|
-
alphaMap:
|
|
238
|
-
matcap:
|
|
248
|
+
alphaMap: c ? await t(c) : null,
|
|
249
|
+
matcap: f ? await t(f) : null
|
|
239
250
|
};
|
|
240
251
|
}
|
|
241
252
|
}
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
return (b[e & 255] + b[e >> 8 & 255] + b[e >> 16 & 255] + b[e >> 24 & 255] + "-" + b[n & 255] + b[n >> 8 & 255] + "-" + b[n >> 16 & 15 | 64] + b[n >> 24 & 255] + "-" + b[o & 63 | 128] + b[o >> 8 & 255] + "-" + b[o >> 16 & 255] + b[o >> 24 & 255] + b[t & 255] + b[t >> 8 & 255] + b[t >> 16 & 255] + b[t >> 24 & 255]).toLowerCase();
|
|
246
|
-
}
|
|
247
|
-
const de = Symbol();
|
|
248
|
-
function Rt() {
|
|
249
|
-
const e = ae({
|
|
250
|
-
uuid: st(),
|
|
251
|
-
camera: void 0,
|
|
252
|
-
cameras: [],
|
|
253
|
-
canvas: void 0,
|
|
254
|
-
scene: void 0,
|
|
255
|
-
renderer: void 0,
|
|
256
|
-
aspectRatio: void 0,
|
|
257
|
-
pointerEventHandler: void 0
|
|
258
|
-
});
|
|
259
|
-
function n(r) {
|
|
260
|
-
return e[r];
|
|
261
|
-
}
|
|
262
|
-
function o(r, i) {
|
|
263
|
-
e[r] = i;
|
|
264
|
-
}
|
|
265
|
-
const t = {
|
|
266
|
-
state: e,
|
|
267
|
-
...ne(e),
|
|
268
|
-
getState: n,
|
|
269
|
-
setState: o
|
|
270
|
-
};
|
|
271
|
-
return oe(de, t), t;
|
|
272
|
-
}
|
|
273
|
-
const ct = () => Me(de, {
|
|
274
|
-
state: ae({
|
|
275
|
-
camera: void 0,
|
|
276
|
-
cameras: [],
|
|
277
|
-
canvas: void 0,
|
|
278
|
-
scene: void 0,
|
|
279
|
-
renderer: void 0,
|
|
280
|
-
pointerEventHandler: void 0
|
|
281
|
-
})
|
|
282
|
-
}), ut = (e) => {
|
|
283
|
-
const { state: n } = ct(), o = h(() => {
|
|
284
|
-
var f;
|
|
285
|
-
return (f = n.canvas) == null ? void 0 : f.value;
|
|
286
|
-
}), { x: t, y: r } = Ue({ target: o }), { width: i, height: c, top: a, left: s } = Ye(o), u = new Ge(), l = ({ x: f, y: v }) => {
|
|
287
|
-
if (o.value)
|
|
253
|
+
const qe = (e, { renderer: n, camera: r }) => {
|
|
254
|
+
const t = _(() => n.value.domElement), { x: o, y: i } = ke({ target: t }), { width: l, height: a, top: s, left: u } = Se(t), c = new Ee(), f = ({ x: m, y: P }) => {
|
|
255
|
+
if (t.value)
|
|
288
256
|
return {
|
|
289
|
-
x: (
|
|
290
|
-
y: -((
|
|
257
|
+
x: (m - u.value) / l.value * 2 - 1,
|
|
258
|
+
y: -((P - s.value) / a.value) * 2 + 1
|
|
291
259
|
};
|
|
292
|
-
},
|
|
293
|
-
if (
|
|
294
|
-
return
|
|
295
|
-
},
|
|
296
|
-
const
|
|
297
|
-
x: (
|
|
298
|
-
y: (
|
|
260
|
+
}, w = ({ x: m, y: P }) => {
|
|
261
|
+
if (r.value)
|
|
262
|
+
return c.setFromCamera(new xe(m, P), r.value), c.intersectObjects(e.value, !1);
|
|
263
|
+
}, C = (m) => {
|
|
264
|
+
const P = f({
|
|
265
|
+
x: (m == null ? void 0 : m.clientX) ?? o.value,
|
|
266
|
+
y: (m == null ? void 0 : m.clientY) ?? i.value
|
|
299
267
|
});
|
|
300
|
-
return
|
|
301
|
-
}, M =
|
|
302
|
-
|
|
303
|
-
},
|
|
304
|
-
|
|
268
|
+
return P ? w(P) || [] : [];
|
|
269
|
+
}, M = _(() => C()), p = A(), d = A(), v = (m, P) => {
|
|
270
|
+
m.trigger({ event: P, intersects: C(P) });
|
|
271
|
+
}, E = (m) => {
|
|
272
|
+
v(d, m);
|
|
305
273
|
};
|
|
306
|
-
let
|
|
307
|
-
const
|
|
308
|
-
var
|
|
309
|
-
|
|
310
|
-
},
|
|
311
|
-
var
|
|
312
|
-
|
|
313
|
-
},
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
return re(() => {
|
|
317
|
-
o != null && o.value && (o.value.removeEventListener("pointerup", O), o.value.removeEventListener("pointerdown", L), o.value.removeEventListener("pointermove", y), o.value.removeEventListener("pointerleave", k));
|
|
274
|
+
let L;
|
|
275
|
+
const x = (m) => {
|
|
276
|
+
var P;
|
|
277
|
+
L = (P = C(m)[0]) == null ? void 0 : P.object;
|
|
278
|
+
}, T = (m) => {
|
|
279
|
+
var P;
|
|
280
|
+
m instanceof PointerEvent && L === ((P = C(m)[0]) == null ? void 0 : P.object) && v(p, m);
|
|
281
|
+
}, S = (m) => d.trigger({ event: m, intersects: [] });
|
|
282
|
+
return t.value.addEventListener("pointerup", T), t.value.addEventListener("pointerdown", x), t.value.addEventListener("pointermove", E), t.value.addEventListener("pointerleave", S), W(() => {
|
|
283
|
+
t != null && t.value && (t.value.removeEventListener("pointerup", T), t.value.removeEventListener("pointerdown", x), t.value.removeEventListener("pointermove", E), t.value.removeEventListener("pointerleave", S));
|
|
318
284
|
}), {
|
|
319
285
|
intersects: M,
|
|
320
|
-
onClick: (
|
|
321
|
-
onPointerMove: (
|
|
286
|
+
onClick: (m) => p.on(m).off,
|
|
287
|
+
onPointerMove: (m) => d.on(m).off
|
|
322
288
|
};
|
|
323
289
|
};
|
|
324
|
-
function
|
|
325
|
-
const { logWarning: e } =
|
|
326
|
-
function n(t,
|
|
327
|
-
let
|
|
290
|
+
function lt() {
|
|
291
|
+
const { logWarning: e } = k();
|
|
292
|
+
function n(t, o, i) {
|
|
293
|
+
let l = null;
|
|
328
294
|
return t.traverse((a) => {
|
|
329
|
-
a[
|
|
330
|
-
}),
|
|
295
|
+
a[o] === i && (l = a);
|
|
296
|
+
}), l || e(`Child with ${o} '${i}' not found.`), l;
|
|
331
297
|
}
|
|
332
|
-
function
|
|
333
|
-
return n(t, "name",
|
|
298
|
+
function r(t, o) {
|
|
299
|
+
return n(t, "name", o);
|
|
334
300
|
}
|
|
335
301
|
return {
|
|
336
302
|
seek: n,
|
|
337
|
-
seekByName:
|
|
303
|
+
seekByName: r
|
|
338
304
|
};
|
|
339
305
|
}
|
|
340
|
-
const
|
|
341
|
-
const
|
|
306
|
+
const Ue = ({ scene: e, contextParts: n }) => {
|
|
307
|
+
const r = re({
|
|
342
308
|
click: /* @__PURE__ */ new Map(),
|
|
343
309
|
pointerMove: /* @__PURE__ */ new Map(),
|
|
344
310
|
pointerEnter: /* @__PURE__ */ new Map(),
|
|
345
311
|
pointerLeave: /* @__PURE__ */ new Map()
|
|
346
|
-
}),
|
|
347
|
-
Object.values(
|
|
348
|
-
}, o = (
|
|
349
|
-
const { onClick:
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
Object.values(e).map((a) => Array.from(a.keys())).flat(),
|
|
358
|
-
({ uuid: a }) => a
|
|
312
|
+
}), t = (u) => {
|
|
313
|
+
Object.values(r).forEach((c) => c.delete(u));
|
|
314
|
+
}, o = (u) => {
|
|
315
|
+
const { onClick: c, onPointerMove: f, onPointerEnter: w, onPointerLeave: C } = u;
|
|
316
|
+
c && r.click.set(u, c), f && r.pointerMove.set(u, f), w && r.pointerEnter.set(u, w), C && r.pointerLeave.set(u, C);
|
|
317
|
+
};
|
|
318
|
+
e.userData.tres__registerAtPointerEventHandler = o, e.userData.tres__deregisterAtPointerEventHandler = t;
|
|
319
|
+
const i = _(
|
|
320
|
+
() => We(
|
|
321
|
+
Object.values(r).map((u) => Array.from(u.keys())).flat(),
|
|
322
|
+
({ uuid: u }) => u
|
|
359
323
|
)
|
|
360
|
-
), { onClick:
|
|
361
|
-
|
|
362
|
-
var
|
|
363
|
-
|
|
324
|
+
), { onClick: l, onPointerMove: a } = qe(i, n);
|
|
325
|
+
l(({ intersects: u, event: c }) => {
|
|
326
|
+
var f;
|
|
327
|
+
u.length && ((f = r.click.get(u[0].object)) == null || f(u[0], c));
|
|
364
328
|
});
|
|
365
|
-
let
|
|
366
|
-
return
|
|
367
|
-
var
|
|
368
|
-
const
|
|
369
|
-
|
|
329
|
+
let s;
|
|
330
|
+
return a(({ intersects: u, event: c }) => {
|
|
331
|
+
var p, d, v, E;
|
|
332
|
+
const f = (p = u == null ? void 0 : u[0]) == null ? void 0 : p.object, { pointerLeave: w, pointerEnter: C, pointerMove: M } = r;
|
|
333
|
+
s && s !== f && ((d = w.get(s)) == null || d(s, c)), f && (s !== f && ((v = C.get(f)) == null || v(u[0], c)), (E = M.get(f)) == null || E(u[0], c)), s = f || null;
|
|
370
334
|
}), {
|
|
371
335
|
registerObject: o,
|
|
372
|
-
deregisterObject:
|
|
336
|
+
deregisterObject: t
|
|
373
337
|
};
|
|
374
|
-
}
|
|
375
|
-
function
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
camera:
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
338
|
+
};
|
|
339
|
+
function Je({
|
|
340
|
+
scene: e,
|
|
341
|
+
canvas: n,
|
|
342
|
+
windowSize: r,
|
|
343
|
+
disableRender: t,
|
|
344
|
+
rendererOptions: o
|
|
345
|
+
}) {
|
|
346
|
+
const i = _(
|
|
347
|
+
() => y(r) ? he() : Be(y(n).parentElement)
|
|
348
|
+
), l = _(() => i.value.width.value), a = _(() => i.value.height.value), s = _(() => l.value / a.value), u = {
|
|
349
|
+
height: a,
|
|
350
|
+
width: l,
|
|
351
|
+
aspectRatio: s
|
|
352
|
+
}, c = j(e), {
|
|
353
|
+
camera: f,
|
|
354
|
+
cameras: w,
|
|
355
|
+
addCamera: C,
|
|
356
|
+
removeCamera: M,
|
|
357
|
+
setCameraActive: p
|
|
358
|
+
} = Oe({ sizes: u, scene: e }), { renderer: d } = Ie(
|
|
359
|
+
{
|
|
360
|
+
scene: e,
|
|
361
|
+
canvas: n,
|
|
362
|
+
options: o,
|
|
363
|
+
contextParts: { sizes: u, camera: f },
|
|
364
|
+
disableRender: t
|
|
365
|
+
}
|
|
366
|
+
), v = {
|
|
367
|
+
sizes: u,
|
|
368
|
+
scene: c,
|
|
369
|
+
camera: f,
|
|
370
|
+
cameras: ne(w),
|
|
371
|
+
renderer: d,
|
|
372
|
+
addCamera: C,
|
|
373
|
+
removeCamera: M,
|
|
374
|
+
setCameraActive: p
|
|
395
375
|
};
|
|
396
|
-
return
|
|
376
|
+
return ae("useTres", v), v;
|
|
397
377
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
378
|
+
function ct() {
|
|
379
|
+
const e = oe("useTres");
|
|
380
|
+
if (!e)
|
|
381
|
+
throw new Error("useTresContext must be used together with useTresContextProvider");
|
|
382
|
+
return e;
|
|
383
|
+
}
|
|
384
|
+
let H = null, g = null;
|
|
385
|
+
const { logError: U } = k(), Ke = {
|
|
386
|
+
createElement(e, n, r, t) {
|
|
387
|
+
var l, a;
|
|
388
|
+
if (t || (t = {}), t.args || (t.args = []), e === "template" || Ve(e))
|
|
408
389
|
return null;
|
|
409
|
-
let
|
|
390
|
+
let o = e.replace("Tres", ""), i;
|
|
410
391
|
if (e === "primitive") {
|
|
411
|
-
(t == null ? void 0 : t.object) === void 0 &&
|
|
412
|
-
const
|
|
413
|
-
|
|
392
|
+
(t == null ? void 0 : t.object) === void 0 && U("Tres primitives need a prop 'object'");
|
|
393
|
+
const s = t.object;
|
|
394
|
+
o = s.type, i = Object.assign(s, { type: o, attach: t.attach, primitive: !0 });
|
|
414
395
|
} else {
|
|
415
|
-
const
|
|
416
|
-
|
|
396
|
+
const s = K.value[o];
|
|
397
|
+
s || U(`${o} is not defined on the THREE namespace. Use extend to add it to the catalog.`), i = new s(...t.args);
|
|
417
398
|
}
|
|
418
|
-
i.isCamera && (t != null && t.position || i.position.set(3, 3, 3), t != null && t.lookAt || i.lookAt(0, 0, 0)), (t == null ? void 0 : t.attach) === void 0 && (i.isMaterial ? i.attach = "material" : i.isBufferGeometry && (i.attach = "geometry"));
|
|
419
|
-
const { GEOMETRY_VIA_PROP: c, MATERIAL_VIA_PROP: a } = F;
|
|
420
|
-
return i.isObject3D && ((s = t == null ? void 0 : t.material) != null && s.isMaterial && (i.userData[a] = !0), (u = t == null ? void 0 : t.geometry) != null && u.isBufferGeometry && (i.userData[c] = !0)), i;
|
|
399
|
+
return i.isCamera && (t != null && t.position || i.position.set(3, 3, 3), t != null && t.lookAt || i.lookAt(0, 0, 0)), (t == null ? void 0 : t.attach) === void 0 && (i.isMaterial ? i.attach = "material" : i.isBufferGeometry && (i.attach = "geometry")), i.isObject3D && ((l = t == null ? void 0 : t.material) != null && l.isMaterial && (i.userData.tres__materialViaProp = !0), (a = t == null ? void 0 : t.geometry) != null && a.isBufferGeometry && (i.userData.tres__geometryViaProp = !0)), i;
|
|
421
400
|
},
|
|
422
401
|
insert(e, n) {
|
|
423
|
-
var
|
|
424
|
-
if (n && n.isScene && (
|
|
425
|
-
|
|
402
|
+
var r, t, o, i, l, a, s, u, c;
|
|
403
|
+
if (n && n.isScene && (g = n), (((r = e == null ? void 0 : e.__vnode) == null ? void 0 : r.type) === "TresGroup" || ((t = e == null ? void 0 : e.__vnode) == null ? void 0 : t.type) === "TresObject3D") && n === null && !((i = (o = e == null ? void 0 : e.__vnode) == null ? void 0 : o.ctx) != null && i.asyncResolved)) {
|
|
404
|
+
H = e;
|
|
426
405
|
return;
|
|
427
406
|
} else
|
|
428
|
-
(
|
|
429
|
-
n || (n =
|
|
407
|
+
(l = e == null ? void 0 : e.__vnode) != null && l.type.includes("Controls") && n === null && (H = g);
|
|
408
|
+
if (n || (n = H), e != null && e.isObject3D) {
|
|
409
|
+
if (e != null && e.isCamera) {
|
|
410
|
+
if (!(g != null && g.userData.tres__registerCamera))
|
|
411
|
+
throw "could not find tres__registerCamera on scene's userData";
|
|
412
|
+
(s = g == null ? void 0 : (a = g.userData).tres__registerCamera) == null || s.call(a, e);
|
|
413
|
+
}
|
|
414
|
+
if (e != null && e.onClick || e != null && e.onPointerMove || e != null && e.onPointerEnter || e != null && e.onPointerLeave) {
|
|
415
|
+
if (!(g != null && g.userData.tres__registerAtPointerEventHandler))
|
|
416
|
+
throw "could not find tres__registerAtPointerEventHandler on scene's userData";
|
|
417
|
+
(c = g == null ? void 0 : (u = g.userData).tres__registerAtPointerEventHandler) == null || c.call(u, e);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
e != null && e.isObject3D && (n != null && n.isObject3D) ? (n.add(e), e.dispatchEvent({ type: "added" })) : e != null && e.isFog ? n.fog = e : typeof (e == null ? void 0 : e.attach) == "string" && (e.__previousAttach = e[n == null ? void 0 : n.attach], n && (n[e.attach] = e));
|
|
430
421
|
},
|
|
431
422
|
remove(e) {
|
|
432
|
-
var n,
|
|
423
|
+
var n, r;
|
|
433
424
|
if (e) {
|
|
434
425
|
if (e.isObject3D) {
|
|
435
|
-
const t = e,
|
|
436
|
-
var
|
|
437
|
-
const
|
|
438
|
-
|
|
426
|
+
const t = e, o = (s) => {
|
|
427
|
+
var c, f;
|
|
428
|
+
const u = s;
|
|
429
|
+
s.userData.tres__materialViaProp || (c = u.material) == null || c.dispose(), s.userData.tres__geometryViaProp || (f = u.geometry) == null || f.dispose();
|
|
430
|
+
}, i = g == null ? void 0 : g.userData.tres__deregisterAtPointerEventHandler, l = (s) => {
|
|
431
|
+
if (!i)
|
|
432
|
+
throw "could not find tres__deregisterAtPointerEventHandler on scene's userData";
|
|
433
|
+
(s != null && s.onClick || s != null && s.onPointerMove || s != null && s.onPointerEnter || s != null && s.onPointerLeave) && (i == null || i(s));
|
|
434
|
+
}, a = (s) => {
|
|
435
|
+
const u = g == null ? void 0 : g.userData.tres__deregisterCamera;
|
|
436
|
+
if (!u)
|
|
437
|
+
throw "could not find tres__deregisterCamera on scene's userData";
|
|
438
|
+
s.isCamera && (u == null || u(s));
|
|
439
439
|
};
|
|
440
|
-
t.traverse((
|
|
441
|
-
|
|
442
|
-
}),
|
|
440
|
+
t.traverse((s) => {
|
|
441
|
+
o(s), a(s), l == null || l(s);
|
|
442
|
+
}), o(t), a(t), l == null || l(t);
|
|
443
443
|
}
|
|
444
|
-
(n = e.removeFromParent) == null || n.call(e), (
|
|
444
|
+
(n = e.removeFromParent) == null || n.call(e), (r = e.dispose) == null || r.call(e);
|
|
445
445
|
}
|
|
446
446
|
},
|
|
447
|
-
patchProp(e, n,
|
|
447
|
+
patchProp(e, n, r, t) {
|
|
448
448
|
if (e) {
|
|
449
|
-
let
|
|
450
|
-
if (
|
|
449
|
+
let o = e, i = n, l = B(i), a = o == null ? void 0 : o[l];
|
|
450
|
+
if (o.type === "BufferGeometry") {
|
|
451
451
|
if (i === "args")
|
|
452
452
|
return;
|
|
453
|
-
|
|
453
|
+
o.setAttribute(
|
|
454
454
|
B(i),
|
|
455
|
-
new
|
|
455
|
+
new Le(...t)
|
|
456
456
|
);
|
|
457
457
|
return;
|
|
458
458
|
}
|
|
459
459
|
if (i.includes("-") && a === void 0) {
|
|
460
460
|
const u = i.split("-");
|
|
461
|
-
a = u.reduce((
|
|
461
|
+
a = u.reduce((c, f) => c[B(f)], o), i = u.pop(), l = i.toLowerCase(), a != null && a.set || (o = u.reduce((c, f) => c[B(f)], o));
|
|
462
462
|
}
|
|
463
463
|
let s = t;
|
|
464
|
-
if (s === "" && (s = !0),
|
|
465
|
-
Array.isArray(s) ? e[
|
|
464
|
+
if (s === "" && (s = !0), I(a)) {
|
|
465
|
+
Array.isArray(s) ? e[l](...s) : e[l](s);
|
|
466
466
|
return;
|
|
467
467
|
}
|
|
468
|
-
!(a != null && a.set) && !
|
|
468
|
+
!(a != null && a.set) && !I(a) ? o[l] = s : a.constructor === s.constructor && (a != null && a.copy) ? a == null || a.copy(s) : Array.isArray(s) ? a.set(...s) : !a.isColor && a.setScalar ? a.setScalar(s) : a.set(s);
|
|
469
469
|
}
|
|
470
470
|
},
|
|
471
471
|
parentNode(e) {
|
|
@@ -480,118 +480,126 @@ const { logError: te } = T(), dt = {
|
|
|
480
480
|
setScopeId: () => void 0,
|
|
481
481
|
cloneNode: () => void 0,
|
|
482
482
|
insertStaticContent: () => void 0
|
|
483
|
-
}, { createApp:
|
|
484
|
-
const n =
|
|
485
|
-
function
|
|
483
|
+
}, { createApp: Xe } = se(Ke), Ye = (e) => {
|
|
484
|
+
const n = Xe(r);
|
|
485
|
+
function r() {
|
|
486
486
|
return e && e.default ? e.default() : [];
|
|
487
487
|
}
|
|
488
488
|
return n;
|
|
489
489
|
};
|
|
490
|
-
pe
|
|
491
|
-
const
|
|
490
|
+
X(pe);
|
|
491
|
+
const Qe = ["data-scene"], Ze = /* @__PURE__ */ ie({
|
|
492
492
|
__name: "TresCanvas",
|
|
493
493
|
props: {
|
|
494
494
|
shadows: { type: Boolean },
|
|
495
|
+
clearColor: {},
|
|
496
|
+
toneMapping: {},
|
|
495
497
|
shadowMapType: {},
|
|
496
498
|
useLegacyLights: { type: Boolean },
|
|
497
499
|
outputColorSpace: {},
|
|
498
|
-
toneMapping: {},
|
|
499
500
|
toneMappingExposure: {},
|
|
500
|
-
context: {},
|
|
501
|
-
powerPreference: {},
|
|
502
|
-
preserveDrawingBuffer: { type: Boolean },
|
|
503
|
-
clearColor: {},
|
|
504
501
|
windowSize: { type: Boolean },
|
|
505
502
|
preset: {},
|
|
506
503
|
disableRender: { type: Boolean },
|
|
507
|
-
camera: {}
|
|
504
|
+
camera: {},
|
|
505
|
+
context: {},
|
|
506
|
+
precision: {},
|
|
507
|
+
alpha: { type: Boolean, default: !1 },
|
|
508
|
+
premultipliedAlpha: { type: Boolean },
|
|
509
|
+
antialias: { type: Boolean, default: !0 },
|
|
510
|
+
stencil: { type: Boolean, default: !0 },
|
|
511
|
+
preserveDrawingBuffer: { type: Boolean, default: !1 },
|
|
512
|
+
powerPreference: {},
|
|
513
|
+
depth: { type: Boolean, default: !0 },
|
|
514
|
+
logarithmicDepthBuffer: { type: Boolean },
|
|
515
|
+
failIfMajorPerformanceCaveat: { type: Boolean }
|
|
508
516
|
},
|
|
509
517
|
setup(e) {
|
|
510
|
-
const n = e, { logWarning:
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
518
|
+
const n = e, { logWarning: r } = k(), t = G(), o = j(new Te());
|
|
519
|
+
ee();
|
|
520
|
+
const i = ue();
|
|
521
|
+
let l;
|
|
522
|
+
const a = (u) => {
|
|
523
|
+
l = Ye(i), l.provide("useTres", u), l.provide("extend", X), l.mount(o.value);
|
|
524
|
+
}, s = _(() => n.disableRender);
|
|
525
|
+
return le(() => {
|
|
526
|
+
const u = t, c = Je({
|
|
527
|
+
scene: o.value,
|
|
528
|
+
canvas: u,
|
|
529
|
+
windowSize: n.windowSize,
|
|
530
|
+
disableRender: s,
|
|
531
|
+
rendererOptions: n
|
|
522
532
|
});
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
W(
|
|
533
|
-
() => n.camera,
|
|
534
|
-
(y) => {
|
|
535
|
-
y && (p(), u(y));
|
|
533
|
+
Ue({ scene: o.value, contextParts: c });
|
|
534
|
+
const { addCamera: f, camera: w, cameras: C, removeCamera: M } = c;
|
|
535
|
+
a(c);
|
|
536
|
+
const p = () => {
|
|
537
|
+
const d = new V(45, window.innerWidth / window.innerHeight, 0.1, 1e3);
|
|
538
|
+
d.position.set(3, 3, 3), d.lookAt(0, 0, 0), f(d);
|
|
539
|
+
const v = b(
|
|
540
|
+
() => {
|
|
541
|
+
C.value.length >= 2 && (d.removeFromParent(), M(d), v == null || v());
|
|
536
542
|
}
|
|
537
543
|
);
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
+
};
|
|
545
|
+
J(() => n.camera, (d, v) => {
|
|
546
|
+
d ? f(d) : v && (v.removeFromParent(), M(v));
|
|
547
|
+
}, {
|
|
548
|
+
immediate: !0
|
|
549
|
+
}), w.value || (r(
|
|
550
|
+
"No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
|
|
551
|
+
), p());
|
|
552
|
+
}), (u, c) => (ce(), fe("canvas", {
|
|
544
553
|
ref_key: "canvas",
|
|
545
554
|
ref: t,
|
|
546
|
-
"data-scene":
|
|
547
|
-
style:
|
|
555
|
+
"data-scene": o.value.uuid,
|
|
556
|
+
style: me({
|
|
548
557
|
display: "block",
|
|
549
558
|
width: "100%",
|
|
550
559
|
height: "100%",
|
|
551
|
-
position:
|
|
560
|
+
position: u.windowSize ? "fixed" : "relative",
|
|
552
561
|
top: 0,
|
|
553
562
|
left: 0,
|
|
554
563
|
pointerEvents: "auto",
|
|
555
564
|
touchAction: "none",
|
|
556
565
|
zIndex: 1
|
|
557
566
|
})
|
|
558
|
-
}, null, 12,
|
|
567
|
+
}, null, 12, Qe));
|
|
559
568
|
}
|
|
560
|
-
}),
|
|
569
|
+
}), et = [
|
|
561
570
|
"TresCanvas",
|
|
562
571
|
"TresLeches",
|
|
563
572
|
"TresScene"
|
|
564
|
-
],
|
|
573
|
+
], tt = {
|
|
565
574
|
template: {
|
|
566
575
|
compilerOptions: {
|
|
567
|
-
isCustomElement: (e) => e.startsWith("Tres") && !
|
|
576
|
+
isCustomElement: (e) => e.startsWith("Tres") && !et.includes(e) || e === "primitive"
|
|
568
577
|
}
|
|
569
578
|
}
|
|
570
|
-
},
|
|
579
|
+
}, ft = tt, mt = {
|
|
571
580
|
install(e) {
|
|
572
|
-
e.component("TresCanvas",
|
|
581
|
+
e.component("TresCanvas", Ze);
|
|
573
582
|
}
|
|
574
583
|
};
|
|
575
584
|
export {
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
Rt as useTresProvider
|
|
585
|
+
Ze as TresCanvas,
|
|
586
|
+
K as catalogue,
|
|
587
|
+
mt as default,
|
|
588
|
+
X as extend,
|
|
589
|
+
ot as isProd,
|
|
590
|
+
$e as normalizeColor,
|
|
591
|
+
st as normalizeVectorFlexibleParam,
|
|
592
|
+
ft as templateCompilerOptions,
|
|
593
|
+
Ne as trasverseObjects,
|
|
594
|
+
Oe as useCamera,
|
|
595
|
+
it as useLoader,
|
|
596
|
+
k as useLogger,
|
|
597
|
+
Ue as usePointerEventHandler,
|
|
598
|
+
qe as useRaycaster,
|
|
599
|
+
ee as useRenderLoop,
|
|
600
|
+
Ie as useRenderer,
|
|
601
|
+
lt as useSeek,
|
|
602
|
+
ut as useTexture,
|
|
603
|
+
ct as useTresContext,
|
|
604
|
+
Je as useTresContextProvider
|
|
597
605
|
};
|