@tresjs/core 2.4.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/TresCanvas.vue.d.ts +147 -0
- package/dist/components/TresScene.vue.d.ts +128 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/composables/useCamera/index.d.ts +4 -3
- package/dist/tres.js +332 -352
- package/dist/tres.umd.cjs +3 -3
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/test-utils.d.ts +1 -0
- package/package.json +4 -3
- package/dist/components/TresCanvas.d.ts +0 -25
- package/dist/components/TresScene.d.ts +0 -22
package/dist/tres.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version: v2.4.
|
|
3
|
+
* version: v2.4.1
|
|
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 { ref as
|
|
9
|
-
import * as
|
|
10
|
-
import { PerspectiveCamera as
|
|
11
|
-
import { createEventHook as
|
|
12
|
-
const me =
|
|
13
|
-
function
|
|
8
|
+
import { ref as V, shallowReactive as se, toRefs as ce, provide as Re, inject as Te, watchEffect as ue, toRef as Le, shallowRef as Se, computed as z, watch as B, onUnmounted as fe, reactive as Ae, createRenderer as Oe, defineComponent as le, getCurrentInstance as ke, onMounted as Be, useSlots as je, openBlock as pe, createElementBlock as De, unref as F, createElementVNode as te, normalizeStyle as Ie, createBlock as He, normalizeProps as Ve, guardReactiveProps as ze, withCtx as Ge, renderSlot as Ne } from "vue";
|
|
9
|
+
import * as Fe from "three";
|
|
10
|
+
import { PerspectiveCamera as j, OrthographicCamera as We, Clock as de, Vector3 as $e, Color as W, SRGBColorSpace as Ue, ACESFilmicToneMapping as Ye, PCFSoftShadowMap as qe, PCFShadowMap as Ke, LinearSRGBColorSpace as ne, NoToneMapping as ae, WebGLRenderer as Je, LoadingManager as Xe, TextureLoader as Qe, Raycaster as Ze, Vector2 as et, BufferAttribute as tt, Scene as nt } from "three";
|
|
11
|
+
import { createEventHook as S, useRafFn as at, toValue as m, useWindowSize as ot, useElementSize as rt, useDevicePixelRatio as it, unrefElement as $, usePointer as st, useElementBounding as ct } from "@vueuse/core";
|
|
12
|
+
const me = V({}), ve = (e) => void Object.assign(me.value, e), oe = (e) => typeof e == "function", ge = (e) => !!e && e.constructor === Array, h = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "da", "db", "dc", "dd", "de", "df", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff"];
|
|
13
|
+
function ut() {
|
|
14
14
|
const e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, n = Math.random() * 4294967295 | 0, a = Math.random() * 4294967295 | 0;
|
|
15
|
-
return (
|
|
15
|
+
return (h[e & 255] + h[e >> 8 & 255] + h[e >> 16 & 255] + h[e >> 24 & 255] + "-" + h[t & 255] + h[t >> 8 & 255] + "-" + h[t >> 16 & 15 | 64] + h[t >> 24 & 255] + "-" + h[n & 63 | 128] + h[n >> 8 & 255] + "-" + h[n >> 16 & 255] + h[n >> 24 & 255] + h[a & 255] + h[a >> 8 & 255] + h[a >> 16 & 255] + h[a >> 24 & 255]).toLowerCase();
|
|
16
16
|
}
|
|
17
|
-
const
|
|
18
|
-
function
|
|
19
|
-
const e =
|
|
20
|
-
uuid:
|
|
17
|
+
const q = Symbol();
|
|
18
|
+
function ft() {
|
|
19
|
+
const e = se({
|
|
20
|
+
uuid: ut(),
|
|
21
21
|
camera: void 0,
|
|
22
22
|
cameras: [],
|
|
23
23
|
canvas: void 0,
|
|
@@ -26,22 +26,22 @@ function Ze() {
|
|
|
26
26
|
aspectRatio: void 0,
|
|
27
27
|
pointerEventHandler: void 0
|
|
28
28
|
});
|
|
29
|
-
function t(
|
|
30
|
-
return e[
|
|
29
|
+
function t(r) {
|
|
30
|
+
return e[r];
|
|
31
31
|
}
|
|
32
|
-
function n(
|
|
33
|
-
e[
|
|
32
|
+
function n(r, s) {
|
|
33
|
+
e[r] = s;
|
|
34
34
|
}
|
|
35
35
|
const a = {
|
|
36
36
|
state: e,
|
|
37
|
-
...
|
|
37
|
+
...ce(e),
|
|
38
38
|
getState: t,
|
|
39
39
|
setState: n
|
|
40
40
|
};
|
|
41
|
-
return
|
|
41
|
+
return Re(q, a), a;
|
|
42
42
|
}
|
|
43
|
-
const
|
|
44
|
-
state:
|
|
43
|
+
const A = () => Te(q, {
|
|
44
|
+
state: se({
|
|
45
45
|
camera: void 0,
|
|
46
46
|
cameras: [],
|
|
47
47
|
canvas: void 0,
|
|
@@ -50,22 +50,22 @@ const k = () => Le(K, {
|
|
|
50
50
|
pointerEventHandler: void 0
|
|
51
51
|
})
|
|
52
52
|
});
|
|
53
|
-
var
|
|
54
|
-
const
|
|
55
|
-
let
|
|
56
|
-
function
|
|
57
|
-
const { state: e, setState: t, aspectRatio: n } =
|
|
53
|
+
var lt = /* @__PURE__ */ ((e) => (e.Perspective = "Perspective", e.Orthographic = "Orthographic", e))(lt || {});
|
|
54
|
+
const pt = 45;
|
|
55
|
+
let R;
|
|
56
|
+
function dt() {
|
|
57
|
+
const { state: e, setState: t, aspectRatio: n } = A();
|
|
58
58
|
function a(i = "Perspective", u) {
|
|
59
|
-
var l,
|
|
59
|
+
var l, d, p;
|
|
60
60
|
if (i === "Perspective") {
|
|
61
|
-
const { near:
|
|
61
|
+
const { near: _, far: E, fov: b } = u || {
|
|
62
62
|
near: 0.1,
|
|
63
63
|
far: 1e3,
|
|
64
|
-
fov:
|
|
64
|
+
fov: pt
|
|
65
65
|
};
|
|
66
|
-
|
|
66
|
+
R = new j(b, ((l = e.aspectRatio) == null ? void 0 : l.value) || window.innerWidth / window.innerHeight, _, E), (d = e.cameras) == null || d.push(R);
|
|
67
67
|
} else {
|
|
68
|
-
const { left:
|
|
68
|
+
const { left: _, right: E, top: b, bottom: y, near: C, far: M } = u || {
|
|
69
69
|
left: -100,
|
|
70
70
|
right: 100,
|
|
71
71
|
top: 100,
|
|
@@ -73,103 +73,103 @@ function at() {
|
|
|
73
73
|
near: 0.1,
|
|
74
74
|
far: 1e3
|
|
75
75
|
};
|
|
76
|
-
|
|
76
|
+
R = new We(_, E, b, y, C, M), (p = e.cameras) == null || p.push(R);
|
|
77
77
|
}
|
|
78
|
-
return e.camera =
|
|
78
|
+
return e.camera = R, t("camera", e.camera), R;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function r() {
|
|
81
81
|
var i;
|
|
82
|
-
e.camera instanceof
|
|
82
|
+
e.camera instanceof j && e.aspectRatio && (e.camera.aspect = e.aspectRatio.value), (i = e.camera) == null || i.updateProjectionMatrix();
|
|
83
83
|
}
|
|
84
84
|
function s(i) {
|
|
85
85
|
var u;
|
|
86
|
-
(u = e.cameras) == null || u.push(i), i instanceof
|
|
86
|
+
(u = e.cameras) == null || u.push(i), i instanceof j && e.aspectRatio && (i.aspect = e.aspectRatio.value), i.updateProjectionMatrix(), t("camera", i);
|
|
87
87
|
}
|
|
88
88
|
function c(i) {
|
|
89
89
|
var u;
|
|
90
90
|
((u = e.cameras) == null ? void 0 : u.length) === 0 && s(i);
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function o() {
|
|
93
93
|
e.cameras = [];
|
|
94
94
|
}
|
|
95
|
-
return
|
|
96
|
-
n != null && n.value &&
|
|
95
|
+
return ue(() => {
|
|
96
|
+
n != null && n.value && r();
|
|
97
97
|
}), {
|
|
98
|
-
activeCamera:
|
|
98
|
+
activeCamera: Le(e, "camera"),
|
|
99
99
|
createCamera: a,
|
|
100
|
-
updateCamera:
|
|
100
|
+
updateCamera: r,
|
|
101
101
|
pushCamera: s,
|
|
102
|
-
clearCameras:
|
|
102
|
+
clearCameras: o,
|
|
103
103
|
setFirstCamera: c
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
const
|
|
107
|
-
let
|
|
108
|
-
const { pause:
|
|
106
|
+
const ye = S(), we = S(), K = S(), L = new de();
|
|
107
|
+
let D = 0, I = 0;
|
|
108
|
+
const { pause: mt, resume: vt, isActive: gt } = at(
|
|
109
109
|
() => {
|
|
110
|
-
|
|
110
|
+
ye.trigger({ delta: D, elapsed: I, clock: L }), we.trigger({ delta: D, elapsed: I, clock: L }), K.trigger({ delta: D, elapsed: I, clock: L });
|
|
111
111
|
},
|
|
112
112
|
{ immediate: !1 }
|
|
113
113
|
);
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
K.on(() => {
|
|
115
|
+
D = L.getDelta(), I = L.getElapsedTime();
|
|
116
116
|
});
|
|
117
117
|
function he() {
|
|
118
118
|
return {
|
|
119
|
-
onBeforeLoop:
|
|
120
|
-
onLoop:
|
|
121
|
-
onAfterLoop:
|
|
122
|
-
pause:
|
|
123
|
-
resume:
|
|
124
|
-
isActive:
|
|
119
|
+
onBeforeLoop: ye.on,
|
|
120
|
+
onLoop: we.on,
|
|
121
|
+
onAfterLoop: K.on,
|
|
122
|
+
pause: mt,
|
|
123
|
+
resume: vt,
|
|
124
|
+
isActive: gt
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
return typeof e == "number" ? [e, e, e] : e instanceof
|
|
127
|
+
function Vt(e) {
|
|
128
|
+
return typeof e == "number" ? [e, e, e] : e instanceof $e ? [e.x, e.y, e.z] : e;
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function yt(e) {
|
|
131
131
|
return e instanceof W ? e : Array.isArray(e) ? new W(...e) : new W(e);
|
|
132
132
|
}
|
|
133
133
|
const U = {
|
|
134
134
|
realistic: {
|
|
135
|
-
outputColorSpace:
|
|
136
|
-
toneMapping:
|
|
135
|
+
outputColorSpace: Ue,
|
|
136
|
+
toneMapping: Ye,
|
|
137
137
|
toneMappingExposure: 3,
|
|
138
138
|
shadowMap: {
|
|
139
139
|
enabled: !0,
|
|
140
|
-
type:
|
|
140
|
+
type: qe
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
-
},
|
|
143
|
+
}, be = (e, t) => {
|
|
144
144
|
for (const n of Object.keys(t))
|
|
145
|
-
t[n] instanceof Object && Object.assign(t[n],
|
|
145
|
+
t[n] instanceof Object && Object.assign(t[n], be(e[n], t[n]));
|
|
146
146
|
return Object.assign(e || {}, t), e;
|
|
147
|
-
},
|
|
148
|
-
function
|
|
147
|
+
}, wt = "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", ht = /* @__PURE__ */ bt(wt);
|
|
148
|
+
function k(e) {
|
|
149
149
|
return e.replace(/-([a-z])/g, (t, n) => n.toUpperCase());
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function bt(e, t) {
|
|
152
152
|
const n = /* @__PURE__ */ Object.create(null), a = e.split(",");
|
|
153
|
-
for (let
|
|
154
|
-
n[a[
|
|
155
|
-
return t ? (
|
|
153
|
+
for (let r = 0; r < a.length; r++)
|
|
154
|
+
n[a[r]] = !0;
|
|
155
|
+
return t ? (r) => !!n[r.toLowerCase()] : (r) => !!n[r];
|
|
156
156
|
}
|
|
157
|
-
const
|
|
157
|
+
const Et = (e, t) => {
|
|
158
158
|
const n = /* @__PURE__ */ new Set(), a = [];
|
|
159
|
-
for (const
|
|
160
|
-
const s = t(
|
|
161
|
-
n.has(s) || (n.add(s), a.push(
|
|
159
|
+
for (const r of e) {
|
|
160
|
+
const s = t(r);
|
|
161
|
+
n.has(s) || (n.add(s), a.push(r));
|
|
162
162
|
}
|
|
163
163
|
return a;
|
|
164
|
-
},
|
|
165
|
-
function
|
|
166
|
-
function e(a,
|
|
167
|
-
console.error(`${
|
|
164
|
+
}, zt = !0, re = "[TresJS ▲ ■ ●] ";
|
|
165
|
+
function O() {
|
|
166
|
+
function e(a, r) {
|
|
167
|
+
console.error(`${re} ${a}`, r || "");
|
|
168
168
|
}
|
|
169
169
|
function t(a) {
|
|
170
|
-
console.warn(`${
|
|
170
|
+
console.warn(`${re} ${a}`);
|
|
171
171
|
}
|
|
172
|
-
function n(a,
|
|
172
|
+
function n(a, r) {
|
|
173
173
|
}
|
|
174
174
|
return {
|
|
175
175
|
logError: e,
|
|
@@ -177,108 +177,108 @@ function D() {
|
|
|
177
177
|
logMessage: n
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
|
-
function
|
|
181
|
-
const t = Se(), n =
|
|
180
|
+
function _t(e) {
|
|
181
|
+
const t = Se(), n = V(!1), {
|
|
182
182
|
alpha: a = !0,
|
|
183
|
-
antialias:
|
|
183
|
+
antialias: r = !0,
|
|
184
184
|
depth: s,
|
|
185
185
|
logarithmicDepthBuffer: c,
|
|
186
|
-
failIfMajorPerformanceCaveat:
|
|
186
|
+
failIfMajorPerformanceCaveat: o,
|
|
187
187
|
precision: i,
|
|
188
188
|
premultipliedAlpha: u,
|
|
189
189
|
stencil: l,
|
|
190
|
-
shadows:
|
|
191
|
-
shadowMapType:
|
|
192
|
-
useLegacyLights:
|
|
193
|
-
outputColorSpace:
|
|
194
|
-
toneMapping:
|
|
195
|
-
toneMappingExposure:
|
|
190
|
+
shadows: d = !1,
|
|
191
|
+
shadowMapType: p = Ke,
|
|
192
|
+
useLegacyLights: _ = !1,
|
|
193
|
+
outputColorSpace: E = ne,
|
|
194
|
+
toneMapping: b = ae,
|
|
195
|
+
toneMappingExposure: y = 1,
|
|
196
196
|
context: C = void 0,
|
|
197
|
-
powerPreference:
|
|
198
|
-
preserveDrawingBuffer:
|
|
199
|
-
clearColor:
|
|
200
|
-
windowSize:
|
|
201
|
-
preset:
|
|
202
|
-
} =
|
|
197
|
+
powerPreference: M = "default",
|
|
198
|
+
preserveDrawingBuffer: g = !1,
|
|
199
|
+
clearColor: w,
|
|
200
|
+
windowSize: x = !1,
|
|
201
|
+
preset: G = void 0
|
|
202
|
+
} = ce(e), { state: f, setState: v } = A(), { width: J, height: X } = m(x) == !0 || m(x) === "" || m(x) === "true" ? ot() : rt(f.container), { logError: Ee, logWarning: _e } = O(), { pixelRatio: Q } = it(), { pause: Pe, resume: Ce } = he(), N = z(() => J.value / X.value);
|
|
203
203
|
setTimeout(() => {
|
|
204
204
|
var P;
|
|
205
|
-
!m(
|
|
205
|
+
!m(x) && !((P = f.canvas) != null && P.value.offsetHeight) && _e(`Oops... Seems like your canvas height is currently 0px, it's posible that you couldn't watch your scene.
|
|
206
206
|
You could set windowSize=true to force the canvas to be the size of the window.`);
|
|
207
207
|
}, 1e3);
|
|
208
|
-
const
|
|
209
|
-
t.value && (t.value.setSize(
|
|
210
|
-
},
|
|
208
|
+
const Z = () => {
|
|
209
|
+
t.value && (t.value.setSize(J.value, X.value), t.value.setPixelRatio(Math.min(Q.value, 2)));
|
|
210
|
+
}, ee = () => {
|
|
211
211
|
if (!t.value)
|
|
212
212
|
return;
|
|
213
|
-
const P = m(
|
|
213
|
+
const P = m(G);
|
|
214
214
|
if (P) {
|
|
215
|
-
P in U || Ee("Renderer Preset must be one of these: " + Object.keys(U).join(", ")),
|
|
215
|
+
P in U || Ee("Renderer Preset must be one of these: " + Object.keys(U).join(", ")), be(t.value, U[P]);
|
|
216
216
|
return;
|
|
217
217
|
}
|
|
218
|
-
t.value.shadowMap.enabled = m(
|
|
219
|
-
},
|
|
218
|
+
t.value.shadowMap.enabled = m(d), t.value.shadowMap.type = m(p), t.value.toneMapping = m(b) || ae, t.value.toneMappingExposure = m(y), t.value.outputColorSpace = m(E) || ne, w != null && w.value && t.value.setClearColor(yt(m(w))), t.value.useLegacyLights = m(_);
|
|
219
|
+
}, Me = () => {
|
|
220
220
|
const P = $(f.canvas);
|
|
221
|
-
P && (t.value = new
|
|
221
|
+
P && (t.value = new Je({
|
|
222
222
|
canvas: P,
|
|
223
223
|
alpha: m(a),
|
|
224
|
-
antialias: m(
|
|
224
|
+
antialias: m(r),
|
|
225
225
|
context: m(C),
|
|
226
226
|
depth: m(s),
|
|
227
|
-
failIfMajorPerformanceCaveat: m(
|
|
227
|
+
failIfMajorPerformanceCaveat: m(o),
|
|
228
228
|
logarithmicDepthBuffer: m(c),
|
|
229
|
-
powerPreference: m(
|
|
229
|
+
powerPreference: m(M),
|
|
230
230
|
precision: m(i),
|
|
231
231
|
stencil: m(l),
|
|
232
|
-
preserveDrawingBuffer: m(
|
|
232
|
+
preserveDrawingBuffer: m(g),
|
|
233
233
|
premultipliedAlpha: m(u)
|
|
234
|
-
}), v("renderer", t.value), v("clock", new
|
|
235
|
-
},
|
|
234
|
+
}), v("renderer", t.value), v("clock", new de()), v("aspectRatio", N), ee(), Z(), Ce(), n.value = !0);
|
|
235
|
+
}, xe = () => {
|
|
236
236
|
t.value && (t.value.dispose(), t.value = void 0, n.value = !1, Pe());
|
|
237
237
|
};
|
|
238
|
-
return
|
|
239
|
-
[p,
|
|
240
|
-
|
|
241
|
-
),
|
|
238
|
+
return B([N, Q], Z), B(
|
|
239
|
+
[d, p, E, _, b, y, w],
|
|
240
|
+
ee
|
|
241
|
+
), B(
|
|
242
242
|
() => [f.canvas, f.container],
|
|
243
243
|
() => {
|
|
244
|
-
$(f.canvas) && $(f.container) &&
|
|
244
|
+
$(f.canvas) && $(f.container) && Me();
|
|
245
245
|
},
|
|
246
246
|
{ immediate: !0, deep: !0 }
|
|
247
247
|
), {
|
|
248
248
|
renderer: t,
|
|
249
249
|
isReady: n,
|
|
250
|
-
dispose:
|
|
250
|
+
dispose: xe,
|
|
251
251
|
aspectRatio: N
|
|
252
252
|
};
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function Pt(e) {
|
|
255
255
|
const t = { nodes: {}, materials: {} };
|
|
256
256
|
return e && e.traverse((n) => {
|
|
257
257
|
n.name && (t.nodes[n.name] = n), n.material && !t.materials[n.material.name] && (t.materials[n.material.name] = n.material);
|
|
258
258
|
}), t;
|
|
259
259
|
}
|
|
260
|
-
async function
|
|
261
|
-
const { logError: s } =
|
|
262
|
-
|
|
260
|
+
async function Gt(e, t, n, a, r) {
|
|
261
|
+
const { logError: s } = O(), c = new e();
|
|
262
|
+
r && r(c), n && n(c);
|
|
263
263
|
const i = (Array.isArray(t) ? t : [t]).map(
|
|
264
|
-
(u) => new Promise((l,
|
|
264
|
+
(u) => new Promise((l, d) => {
|
|
265
265
|
c.load(
|
|
266
266
|
u,
|
|
267
|
-
(
|
|
268
|
-
|
|
267
|
+
(p) => {
|
|
268
|
+
p.scene && Object.assign(p, Pt(p.scene)), l(p);
|
|
269
269
|
},
|
|
270
270
|
a,
|
|
271
|
-
(
|
|
271
|
+
(p) => d(s("[useLoader] - Failed to load resource", p))
|
|
272
272
|
);
|
|
273
273
|
})
|
|
274
274
|
);
|
|
275
275
|
return ge(t) ? await Promise.all(i) : await i[0];
|
|
276
276
|
}
|
|
277
|
-
async function
|
|
278
|
-
const t = new
|
|
277
|
+
async function Nt(e) {
|
|
278
|
+
const t = new Xe(), n = new Qe(t), a = (r) => new Promise((s, c) => {
|
|
279
279
|
n.load(
|
|
280
|
-
|
|
281
|
-
(
|
|
280
|
+
r,
|
|
281
|
+
(o) => s(o),
|
|
282
282
|
() => null,
|
|
283
283
|
() => {
|
|
284
284
|
c(new Error("[useTextures] - Failed to load texture"));
|
|
@@ -286,194 +286,194 @@ async function Lt(e) {
|
|
|
286
286
|
);
|
|
287
287
|
});
|
|
288
288
|
if (ge(e)) {
|
|
289
|
-
const
|
|
290
|
-
return e.length > 1 ?
|
|
289
|
+
const r = await Promise.all(e.map((s) => a(s)));
|
|
290
|
+
return e.length > 1 ? r : r[0];
|
|
291
291
|
} else {
|
|
292
292
|
const {
|
|
293
|
-
map:
|
|
293
|
+
map: r,
|
|
294
294
|
displacementMap: s,
|
|
295
295
|
normalMap: c,
|
|
296
|
-
roughnessMap:
|
|
296
|
+
roughnessMap: o,
|
|
297
297
|
metalnessMap: i,
|
|
298
298
|
aoMap: u,
|
|
299
299
|
alphaMap: l,
|
|
300
|
-
matcap:
|
|
300
|
+
matcap: d
|
|
301
301
|
} = e;
|
|
302
302
|
return {
|
|
303
|
-
map:
|
|
303
|
+
map: r ? await a(r) : null,
|
|
304
304
|
displacementMap: s ? await a(s) : null,
|
|
305
305
|
normalMap: c ? await a(c) : null,
|
|
306
|
-
roughnessMap:
|
|
306
|
+
roughnessMap: o ? await a(o) : null,
|
|
307
307
|
metalnessMap: i ? await a(i) : null,
|
|
308
308
|
aoMap: u ? await a(u) : null,
|
|
309
309
|
alphaMap: l ? await a(l) : null,
|
|
310
|
-
matcap:
|
|
310
|
+
matcap: d ? await a(d) : null
|
|
311
311
|
};
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
|
-
const
|
|
315
|
-
const { state: t } =
|
|
314
|
+
const Ct = (e) => {
|
|
315
|
+
const { state: t } = A(), n = z(() => {
|
|
316
316
|
var f;
|
|
317
317
|
return (f = t.canvas) == null ? void 0 : f.value;
|
|
318
|
-
}), { x: a, y:
|
|
318
|
+
}), { x: a, y: r } = st({ target: n }), { width: s, height: c, top: o, left: i } = ct(n), u = new Ze(), l = ({ x: f, y: v }) => {
|
|
319
319
|
if (n.value)
|
|
320
320
|
return {
|
|
321
321
|
x: (f - i.value) / s.value * 2 - 1,
|
|
322
|
-
y: -((v -
|
|
322
|
+
y: -((v - o.value) / c.value) * 2 + 1
|
|
323
323
|
};
|
|
324
|
-
},
|
|
324
|
+
}, d = ({ x: f, y: v }) => {
|
|
325
325
|
if (t.camera)
|
|
326
|
-
return u.setFromCamera(new
|
|
327
|
-
},
|
|
326
|
+
return u.setFromCamera(new et(f, v), t.camera), u.intersectObjects(e.value, !1);
|
|
327
|
+
}, p = (f) => {
|
|
328
328
|
const v = l({
|
|
329
329
|
x: (f == null ? void 0 : f.clientX) ?? a.value,
|
|
330
|
-
y: (f == null ? void 0 : f.clientY) ??
|
|
330
|
+
y: (f == null ? void 0 : f.clientY) ?? r.value
|
|
331
331
|
});
|
|
332
|
-
return v ?
|
|
333
|
-
},
|
|
334
|
-
f.trigger({ event: v, intersects:
|
|
332
|
+
return v ? d(v) || [] : [];
|
|
333
|
+
}, _ = z(() => p()), E = S(), b = S(), y = (f, v) => {
|
|
334
|
+
f.trigger({ event: v, intersects: p(v) });
|
|
335
335
|
}, C = (f) => {
|
|
336
|
-
|
|
336
|
+
y(b, f);
|
|
337
337
|
};
|
|
338
|
-
let
|
|
339
|
-
const
|
|
338
|
+
let M;
|
|
339
|
+
const g = (f) => {
|
|
340
340
|
var v;
|
|
341
|
-
|
|
342
|
-
},
|
|
341
|
+
M = (v = p(f)[0]) == null ? void 0 : v.object;
|
|
342
|
+
}, w = (f) => {
|
|
343
343
|
var v;
|
|
344
|
-
f instanceof PointerEvent &&
|
|
345
|
-
},
|
|
346
|
-
n != null && n.value && (n.value.addEventListener("pointerup",
|
|
344
|
+
f instanceof PointerEvent && M === ((v = p(f)[0]) == null ? void 0 : v.object) && y(E, f);
|
|
345
|
+
}, x = (f) => b.trigger({ event: f, intersects: [] }), G = ue(() => {
|
|
346
|
+
n != null && n.value && (n.value.addEventListener("pointerup", w), n.value.addEventListener("pointerdown", g), n.value.addEventListener("pointermove", C), n.value.addEventListener("pointerleave", x), G());
|
|
347
347
|
});
|
|
348
|
-
return
|
|
349
|
-
n != null && n.value && (n.value.removeEventListener("pointerup",
|
|
348
|
+
return fe(() => {
|
|
349
|
+
n != null && n.value && (n.value.removeEventListener("pointerup", w), n.value.removeEventListener("pointerdown", g), n.value.removeEventListener("pointermove", C), n.value.removeEventListener("pointerleave", x));
|
|
350
350
|
}), {
|
|
351
|
-
intersects:
|
|
352
|
-
onClick: (f) =>
|
|
353
|
-
onPointerMove: (f) =>
|
|
351
|
+
intersects: _,
|
|
352
|
+
onClick: (f) => E.on(f).off,
|
|
353
|
+
onPointerMove: (f) => b.on(f).off
|
|
354
354
|
};
|
|
355
355
|
};
|
|
356
|
-
function
|
|
357
|
-
const { logWarning: e } =
|
|
358
|
-
function t(a,
|
|
356
|
+
function Ft() {
|
|
357
|
+
const { logWarning: e } = O();
|
|
358
|
+
function t(a, r, s) {
|
|
359
359
|
let c = null;
|
|
360
|
-
return a.traverse((
|
|
361
|
-
r
|
|
362
|
-
}), c || e(`Child with ${
|
|
360
|
+
return a.traverse((o) => {
|
|
361
|
+
o[r] === s && (c = o);
|
|
362
|
+
}), c || e(`Child with ${r} '${s}' not found.`), c;
|
|
363
363
|
}
|
|
364
|
-
function n(a,
|
|
365
|
-
return t(a, "name",
|
|
364
|
+
function n(a, r) {
|
|
365
|
+
return t(a, "name", r);
|
|
366
366
|
}
|
|
367
367
|
return {
|
|
368
368
|
seek: t,
|
|
369
369
|
seekByName: n
|
|
370
370
|
};
|
|
371
371
|
}
|
|
372
|
-
const
|
|
372
|
+
const Mt = () => {
|
|
373
373
|
const e = Ae({
|
|
374
374
|
click: /* @__PURE__ */ new Map(),
|
|
375
375
|
pointerMove: /* @__PURE__ */ new Map(),
|
|
376
376
|
pointerEnter: /* @__PURE__ */ new Map(),
|
|
377
377
|
pointerLeave: /* @__PURE__ */ new Map()
|
|
378
|
-
}), t = (
|
|
379
|
-
Object.values(e).forEach((i) => i.delete(
|
|
380
|
-
}, n = (
|
|
381
|
-
const { onClick: i, onPointerMove: u, onPointerEnter: l, onPointerLeave:
|
|
382
|
-
i && e.click.set(
|
|
383
|
-
|
|
384
|
-
t(
|
|
385
|
-
}), t(
|
|
378
|
+
}), t = (o) => {
|
|
379
|
+
Object.values(e).forEach((i) => i.delete(o));
|
|
380
|
+
}, n = (o) => {
|
|
381
|
+
const { onClick: i, onPointerMove: u, onPointerEnter: l, onPointerLeave: d } = o;
|
|
382
|
+
i && e.click.set(o, i), u && e.pointerMove.set(o, u), l && e.pointerEnter.set(o, l), d && e.pointerLeave.set(o, d), o.addEventListener("removed", () => {
|
|
383
|
+
o.traverse((p) => {
|
|
384
|
+
t(p);
|
|
385
|
+
}), t(o);
|
|
386
386
|
});
|
|
387
|
-
}, a =
|
|
388
|
-
() =>
|
|
389
|
-
Object.values(e).map((
|
|
390
|
-
({ uuid:
|
|
387
|
+
}, a = z(
|
|
388
|
+
() => Et(
|
|
389
|
+
Object.values(e).map((o) => Array.from(o.keys())).flat(),
|
|
390
|
+
({ uuid: o }) => o
|
|
391
391
|
)
|
|
392
|
-
), { onClick:
|
|
393
|
-
|
|
392
|
+
), { onClick: r, onPointerMove: s } = Ct(a);
|
|
393
|
+
r(({ intersects: o, event: i }) => {
|
|
394
394
|
var u;
|
|
395
|
-
|
|
395
|
+
o.length && ((u = e.click.get(o[0].object)) == null || u(o[0], i));
|
|
396
396
|
});
|
|
397
397
|
let c;
|
|
398
|
-
return s(({ intersects:
|
|
399
|
-
var
|
|
400
|
-
const u = (
|
|
401
|
-
c && c !== u && ((
|
|
398
|
+
return s(({ intersects: o, event: i }) => {
|
|
399
|
+
var _, E, b, y;
|
|
400
|
+
const u = (_ = o == null ? void 0 : o[0]) == null ? void 0 : _.object, { pointerLeave: l, pointerEnter: d, pointerMove: p } = e;
|
|
401
|
+
c && c !== u && ((E = l.get(c)) == null || E(c, i)), u && (c !== u && ((b = d.get(u)) == null || b(o[0], i)), (y = p.get(u)) == null || y(o[0], i)), c = u || null;
|
|
402
402
|
}), {
|
|
403
403
|
registerObject: n,
|
|
404
404
|
deregisterObject: t
|
|
405
405
|
};
|
|
406
|
-
},
|
|
406
|
+
}, H = {
|
|
407
407
|
GEOMETRY_VIA_PROP: "tres__geometryViaProp",
|
|
408
408
|
MATERIAL_VIA_PROP: "tres__materialViaProp",
|
|
409
409
|
REGISTER_AT_POINTER_EVENT_HANDLER: "tres__registerAtPointerEventHandler"
|
|
410
410
|
};
|
|
411
|
-
let Y = null,
|
|
412
|
-
const { logError: ie } =
|
|
411
|
+
let Y = null, T = null;
|
|
412
|
+
const { logError: ie } = O(), xt = {
|
|
413
413
|
createElement(e, t, n, a) {
|
|
414
414
|
var i, u;
|
|
415
|
-
if (a || (a = {}), a.args || (a.args = []), e === "template" ||
|
|
415
|
+
if (a || (a = {}), a.args || (a.args = []), e === "template" || ht(e))
|
|
416
416
|
return null;
|
|
417
|
-
let
|
|
417
|
+
let r = e.replace("Tres", ""), s;
|
|
418
418
|
if (e === "primitive") {
|
|
419
419
|
(a == null ? void 0 : a.object) === void 0 && ie("Tres primitives need a prop 'object'");
|
|
420
420
|
const l = a.object;
|
|
421
|
-
|
|
421
|
+
r = l.type, s = Object.assign(l, { type: r, attach: a.attach, primitive: !0 });
|
|
422
422
|
} else {
|
|
423
|
-
const l = me.value[
|
|
424
|
-
l || ie(`${
|
|
423
|
+
const l = me.value[r];
|
|
424
|
+
l || ie(`${r} is not defined on the THREE namespace. Use extend to add it to the catalog.`), s = new l(...a.args);
|
|
425
425
|
}
|
|
426
426
|
s.isCamera && (a != null && a.position || s.position.set(3, 3, 3), a != null && a.lookAt || s.lookAt(0, 0, 0)), (a == null ? void 0 : a.attach) === void 0 && (s.isMaterial ? s.attach = "material" : s.isBufferGeometry && (s.attach = "geometry"));
|
|
427
|
-
const { GEOMETRY_VIA_PROP: c, MATERIAL_VIA_PROP:
|
|
428
|
-
return s.isObject3D && ((i = a == null ? void 0 : a.material) != null && i.isMaterial && (s.userData[
|
|
427
|
+
const { GEOMETRY_VIA_PROP: c, MATERIAL_VIA_PROP: o } = H;
|
|
428
|
+
return s.isObject3D && ((i = a == null ? void 0 : a.material) != null && i.isMaterial && (s.userData[o] = !0), (u = a == null ? void 0 : a.geometry) != null && u.isBufferGeometry && (s.userData[c] = !0)), s;
|
|
429
429
|
},
|
|
430
430
|
insert(e, t) {
|
|
431
|
-
var n, a,
|
|
432
|
-
if (t && t.isScene && (
|
|
431
|
+
var n, a, r, s, c, o, i;
|
|
432
|
+
if (t && t.isScene && (T = t), (((n = e == null ? void 0 : e.__vnode) == null ? void 0 : n.type) === "TresGroup" || ((a = e == null ? void 0 : e.__vnode) == null ? void 0 : a.type) === "TresObject3D") && t === null && !((s = (r = e == null ? void 0 : e.__vnode) == null ? void 0 : r.ctx) != null && s.asyncResolved)) {
|
|
433
433
|
Y = e;
|
|
434
434
|
return;
|
|
435
435
|
} else
|
|
436
|
-
(c = e == null ? void 0 : e.__vnode) != null && c.type.includes("Controls") && t === null && (Y =
|
|
437
|
-
t || (t = Y), e != null && e.isObject3D && (t != null && t.isObject3D) ? (t.add(e), e.dispatchEvent({ type: "added" }), (i = (
|
|
436
|
+
(c = e == null ? void 0 : e.__vnode) != null && c.type.includes("Controls") && t === null && (Y = T);
|
|
437
|
+
t || (t = Y), e != null && e.isObject3D && (t != null && t.isObject3D) ? (t.add(e), e.dispatchEvent({ type: "added" }), (i = (o = T == null ? void 0 : T.userData) == null ? void 0 : o[H.REGISTER_AT_POINTER_EVENT_HANDLER]) == null || i.call(o, e)) : 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));
|
|
438
438
|
},
|
|
439
439
|
remove(e) {
|
|
440
440
|
var t, n;
|
|
441
441
|
if (e) {
|
|
442
442
|
if (e.isObject3D) {
|
|
443
|
-
const a = e,
|
|
443
|
+
const a = e, r = (s) => {
|
|
444
444
|
var i, u;
|
|
445
|
-
const { GEOMETRY_VIA_PROP: c, MATERIAL_VIA_PROP:
|
|
446
|
-
s.userData[
|
|
445
|
+
const { GEOMETRY_VIA_PROP: c, MATERIAL_VIA_PROP: o } = H;
|
|
446
|
+
s.userData[o] || (i = s.material) == null || i.dispose(), s.userData[c] || (u = s.geometry) == null || u.dispose();
|
|
447
447
|
};
|
|
448
448
|
a.traverse((s) => {
|
|
449
|
-
|
|
450
|
-
}),
|
|
449
|
+
r(s);
|
|
450
|
+
}), r(a);
|
|
451
451
|
}
|
|
452
452
|
(t = e.removeFromParent) == null || t.call(e), (n = e.dispose) == null || n.call(e);
|
|
453
453
|
}
|
|
454
454
|
},
|
|
455
455
|
patchProp(e, t, n, a) {
|
|
456
456
|
if (e) {
|
|
457
|
-
let
|
|
458
|
-
if (
|
|
457
|
+
let r = e, s = t, c = k(s), o = r == null ? void 0 : r[c];
|
|
458
|
+
if (r.type === "BufferGeometry") {
|
|
459
459
|
if (s === "args")
|
|
460
460
|
return;
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
new
|
|
461
|
+
r.setAttribute(
|
|
462
|
+
k(s),
|
|
463
|
+
new tt(...a)
|
|
464
464
|
);
|
|
465
465
|
return;
|
|
466
466
|
}
|
|
467
|
-
if (s.includes("-") &&
|
|
467
|
+
if (s.includes("-") && o === void 0) {
|
|
468
468
|
const u = s.split("-");
|
|
469
|
-
|
|
469
|
+
o = u.reduce((l, d) => l[k(d)], r), s = u.pop(), c = s.toLowerCase(), o != null && o.set || (r = u.reduce((l, d) => l[k(d)], r));
|
|
470
470
|
}
|
|
471
471
|
let i = a;
|
|
472
|
-
if (i === "" && (i = !0),
|
|
472
|
+
if (i === "" && (i = !0), oe(o)) {
|
|
473
473
|
Array.isArray(i) ? e[c](...i) : e[c](i);
|
|
474
474
|
return;
|
|
475
475
|
}
|
|
476
|
-
!(
|
|
476
|
+
!(o != null && o.set) && !oe(o) ? r[c] = i : o.constructor === i.constructor && (o != null && o.copy) ? o == null || o.copy(i) : Array.isArray(i) ? o.set(...i) : !o.isColor && o.setScalar ? o.setScalar(i) : o.set(i);
|
|
477
477
|
}
|
|
478
478
|
},
|
|
479
479
|
parentNode(e) {
|
|
@@ -488,176 +488,156 @@ const { logError: ie } = D(), vt = {
|
|
|
488
488
|
setScopeId: () => void 0,
|
|
489
489
|
cloneNode: () => void 0,
|
|
490
490
|
insertStaticContent: () => void 0
|
|
491
|
-
}, { createApp:
|
|
492
|
-
const t =
|
|
491
|
+
}, { createApp: Rt } = Oe(xt), Tt = (e) => {
|
|
492
|
+
const t = Rt(n);
|
|
493
493
|
function n() {
|
|
494
494
|
return e && e.default ? e.default() : [];
|
|
495
495
|
}
|
|
496
496
|
return t;
|
|
497
497
|
};
|
|
498
|
-
ve(
|
|
499
|
-
const {
|
|
500
|
-
|
|
501
|
-
props:
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
setup(e, {
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
498
|
+
ve(Fe);
|
|
499
|
+
const Lt = ["data-scene"], St = { style: { width: "100%", height: "100%" } }, At = ["data-scene"], Ot = /* @__PURE__ */ le({
|
|
500
|
+
__name: "TresScene",
|
|
501
|
+
props: {
|
|
502
|
+
shadows: { type: Boolean },
|
|
503
|
+
shadowMapType: {},
|
|
504
|
+
physicallyCorrectLights: { type: Boolean, default: !1 },
|
|
505
|
+
useLegacyLights: { type: Boolean },
|
|
506
|
+
outputColorSpace: {},
|
|
507
|
+
toneMapping: {},
|
|
508
|
+
toneMappingExposure: {},
|
|
509
|
+
context: {},
|
|
510
|
+
powerPreference: {},
|
|
511
|
+
preserveDrawingBuffer: { type: Boolean },
|
|
512
|
+
clearColor: {},
|
|
513
|
+
windowSize: { type: Boolean },
|
|
514
|
+
preset: {},
|
|
515
|
+
disableRender: { type: Boolean },
|
|
516
|
+
camera: {}
|
|
517
|
+
},
|
|
518
|
+
setup(e, { expose: t }) {
|
|
519
|
+
const n = e, { logWarning: a } = O();
|
|
520
|
+
n.physicallyCorrectLights === !0 && a("physicallyCorrectLights is deprecated, useLegacyLights is now false by default");
|
|
521
|
+
const r = V(), s = V(), c = new nt(), o = Mt(), { setState: i } = A();
|
|
522
|
+
c.userData[H.REGISTER_AT_POINTER_EVENT_HANDLER] = o.registerObject, i("scene", c), i("canvas", s), i("container", r), i("pointerEventHandler", o), i("appContext", ke());
|
|
523
|
+
const { onLoop: u, resume: l } = he(), { activeCamera: d, pushCamera: p, clearCameras: _ } = dt();
|
|
524
|
+
Be(() => {
|
|
525
|
+
b();
|
|
526
|
+
}), fe(() => {
|
|
526
527
|
i("renderer", null);
|
|
527
528
|
});
|
|
528
|
-
|
|
529
|
-
function y() {
|
|
529
|
+
function E() {
|
|
530
530
|
const g = c.getObjectByProperty("isCamera", !0);
|
|
531
531
|
if (g)
|
|
532
|
-
|
|
532
|
+
p(g);
|
|
533
533
|
else {
|
|
534
|
-
|
|
535
|
-
const
|
|
536
|
-
|
|
534
|
+
a("No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene.");
|
|
535
|
+
const w = new j(45, window.innerWidth / window.innerHeight, 0.1, 1e3);
|
|
536
|
+
w.position.set(3, 3, 3), w.lookAt(0, 0, 0), p(w);
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
function
|
|
540
|
-
const { renderer: g } =
|
|
541
|
-
|
|
542
|
-
var
|
|
543
|
-
|
|
539
|
+
function b() {
|
|
540
|
+
const { renderer: g } = _t(n);
|
|
541
|
+
n.camera && p(n.camera), u(() => {
|
|
542
|
+
var w;
|
|
543
|
+
d.value && n.disableRender !== !0 && ((w = g.value) == null || w.render(c, d.value));
|
|
544
544
|
});
|
|
545
545
|
}
|
|
546
|
-
let
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
546
|
+
let y;
|
|
547
|
+
const C = je();
|
|
548
|
+
function M() {
|
|
549
|
+
y = Tt(C);
|
|
550
|
+
const g = A();
|
|
551
|
+
y.provide("useTres", g), y.provide(q, g), y.provide("extend", ve), y.mount(c), E();
|
|
551
552
|
}
|
|
552
|
-
return
|
|
553
|
+
return M(), t({
|
|
553
554
|
scene: c
|
|
554
|
-
}),
|
|
555
|
-
() =>
|
|
555
|
+
}), B(
|
|
556
|
+
() => n.camera,
|
|
556
557
|
(g) => {
|
|
557
|
-
g && (
|
|
558
|
+
g && (_(), p(g));
|
|
558
559
|
}
|
|
559
|
-
), () =>
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
_(
|
|
576
|
-
"div",
|
|
577
|
-
{
|
|
578
|
-
style: {
|
|
579
|
-
width: "100%",
|
|
580
|
-
height: "100%"
|
|
581
|
-
}
|
|
582
|
-
},
|
|
583
|
-
[
|
|
584
|
-
_("canvas", {
|
|
585
|
-
ref: s,
|
|
586
|
-
"data-scene": c.uuid,
|
|
587
|
-
style: {
|
|
588
|
-
display: "block",
|
|
589
|
-
width: "100%",
|
|
590
|
-
height: "100%",
|
|
591
|
-
position: e.windowSize ? "fixed" : "absolute",
|
|
592
|
-
top: 0,
|
|
593
|
-
left: 0
|
|
594
|
-
}
|
|
595
|
-
})
|
|
596
|
-
]
|
|
597
|
-
)
|
|
598
|
-
]
|
|
599
|
-
)
|
|
600
|
-
);
|
|
560
|
+
), (g, w) => (pe(), De("div", {
|
|
561
|
+
ref_key: "container",
|
|
562
|
+
ref: r,
|
|
563
|
+
key: F(c).uuid,
|
|
564
|
+
"data-scene": F(c).uuid,
|
|
565
|
+
style: { position: "relative", width: "100%", height: "100%", pointerEvents: "auto", touchAction: "none" }
|
|
566
|
+
}, [
|
|
567
|
+
te("div", St, [
|
|
568
|
+
te("canvas", {
|
|
569
|
+
ref_key: "canvas",
|
|
570
|
+
ref: s,
|
|
571
|
+
"data-scene": F(c).uuid,
|
|
572
|
+
style: Ie({ display: "block", width: "100%", height: "100%", position: g.windowSize ? "fixed" : "absolute", top: 0, left: 0 })
|
|
573
|
+
}, null, 12, At)
|
|
574
|
+
])
|
|
575
|
+
], 8, Lt));
|
|
601
576
|
}
|
|
602
|
-
}),
|
|
603
|
-
|
|
604
|
-
props:
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
setup(e, {
|
|
622
|
-
const a =
|
|
623
|
-
return
|
|
577
|
+
}), kt = /* @__PURE__ */ le({
|
|
578
|
+
__name: "TresCanvas",
|
|
579
|
+
props: {
|
|
580
|
+
shadows: { type: Boolean },
|
|
581
|
+
shadowMapType: {},
|
|
582
|
+
physicallyCorrectLights: { type: Boolean },
|
|
583
|
+
useLegacyLights: { type: Boolean },
|
|
584
|
+
outputColorSpace: {},
|
|
585
|
+
toneMapping: {},
|
|
586
|
+
toneMappingExposure: {},
|
|
587
|
+
context: {},
|
|
588
|
+
powerPreference: {},
|
|
589
|
+
preserveDrawingBuffer: { type: Boolean },
|
|
590
|
+
clearColor: {},
|
|
591
|
+
windowSize: { type: Boolean },
|
|
592
|
+
preset: {},
|
|
593
|
+
disableRender: { type: Boolean },
|
|
594
|
+
camera: {}
|
|
595
|
+
},
|
|
596
|
+
setup(e, { expose: t }) {
|
|
597
|
+
const n = e, a = ft();
|
|
598
|
+
return t(a), (r, s) => (pe(), He(Ot, Ve(ze(n)), {
|
|
599
|
+
default: Ge(() => [
|
|
600
|
+
Ne(r.$slots, "default")
|
|
601
|
+
]),
|
|
602
|
+
_: 3
|
|
603
|
+
}, 16));
|
|
624
604
|
}
|
|
625
|
-
}),
|
|
605
|
+
}), Bt = [
|
|
626
606
|
"TresCanvas",
|
|
627
607
|
"TresLeches",
|
|
628
608
|
"TresScene"
|
|
629
|
-
],
|
|
609
|
+
], jt = {
|
|
630
610
|
template: {
|
|
631
611
|
compilerOptions: {
|
|
632
|
-
isCustomElement: (e) => e.startsWith("Tres") && !
|
|
612
|
+
isCustomElement: (e) => e.startsWith("Tres") && !Bt.includes(e) || e === "primitive"
|
|
633
613
|
}
|
|
634
614
|
}
|
|
635
|
-
},
|
|
615
|
+
}, Wt = jt, $t = {
|
|
636
616
|
install(e) {
|
|
637
|
-
e.component("TresCanvas",
|
|
617
|
+
e.component("TresCanvas", kt);
|
|
638
618
|
}
|
|
639
619
|
};
|
|
640
620
|
export {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
621
|
+
lt as CameraType,
|
|
622
|
+
q as TRES_CONTEXT_KEY,
|
|
623
|
+
kt as TresCanvas,
|
|
644
624
|
me as catalogue,
|
|
645
|
-
|
|
625
|
+
$t as default,
|
|
646
626
|
ve as extend,
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
627
|
+
zt as isProd,
|
|
628
|
+
yt as normalizeColor,
|
|
629
|
+
Vt as normalizeVectorFlexibleParam,
|
|
630
|
+
Wt as templateCompilerOptions,
|
|
631
|
+
Pt as trasverseObjects,
|
|
632
|
+
dt as useCamera,
|
|
633
|
+
Gt as useLoader,
|
|
634
|
+
O as useLogger,
|
|
635
|
+
Mt as usePointerEventHandler,
|
|
636
|
+
Ct as useRaycaster,
|
|
657
637
|
he as useRenderLoop,
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
638
|
+
_t as useRenderer,
|
|
639
|
+
Ft as useSeek,
|
|
640
|
+
Nt as useTexture,
|
|
641
|
+
A as useTres,
|
|
642
|
+
ft as useTresProvider
|
|
663
643
|
};
|