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