@tresjs/core 0.4.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.d.ts +1 -1
- package/dist/core/{useCatalog → useCatalogue}/index.d.ts +1 -1
- package/dist/core/useInstanceCreator/index.d.ts +2 -2
- package/dist/core/useLoader/index.d.ts +12 -17
- package/dist/env.d.ts +2 -0
- package/dist/favicon-16x16.png +0 -0
- package/dist/favicon-32x32.png +0 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.d.ts +5 -1
- package/dist/logo-dark.svg +5 -0
- package/dist/models/AkuAku.gltf +1177 -0
- package/dist/tres.js +224 -197
- package/dist/tres.umd.cjs +2 -2
- package/dist/types/index.d.ts +11 -14
- package/package.json +5 -2
package/dist/tres.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version:
|
|
3
|
+
* version: v1.0.0
|
|
4
4
|
* (c) 2022
|
|
5
5
|
* description: Declarative ThreeJS using Vue Components
|
|
6
6
|
* author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
|
|
7
7
|
*/
|
|
8
|
-
import { computed as
|
|
9
|
-
import { useWindowSize as
|
|
10
|
-
import * as
|
|
11
|
-
import { PerspectiveCamera as
|
|
12
|
-
var
|
|
8
|
+
import { computed as D, watch as O, inject as X, defineComponent as _, shallowRef as j, reactive as fe, toRefs as me, ref as F, provide as A, onBeforeUnmount as de, h as J } from "vue";
|
|
9
|
+
import { useWindowSize as Y, createEventHook as U, useRafFn as ge, useElementSize as he, useDevicePixelRatio as we, unrefElement as B, resolveUnref as S } from "@vueuse/core";
|
|
10
|
+
import * as ve from "three";
|
|
11
|
+
import { PerspectiveCamera as $, OrthographicCamera as Ce, Color as I, Vector3 as ye, Clock as Me, Scene as Se, LoadingManager as xe, TextureLoader as Ee, PCFShadowMap as Pe, LinearEncoding as Le, NoToneMapping as Te, WebGLRenderer as Re } from "three";
|
|
12
|
+
var Oe = /* @__PURE__ */ ((e) => (e.Perspective = "Perspective", e.Orthographic = "Orthographic", e))(Oe || {});
|
|
13
13
|
const P = {
|
|
14
14
|
cameras: []
|
|
15
|
-
},
|
|
16
|
-
let
|
|
15
|
+
}, Ae = 45;
|
|
16
|
+
let E;
|
|
17
17
|
function Z() {
|
|
18
|
-
const { width: e, height: t } =
|
|
19
|
-
function a(
|
|
20
|
-
if (
|
|
21
|
-
const { near:
|
|
18
|
+
const { width: e, height: t } = Y(), { setState: n } = oe();
|
|
19
|
+
function a(i = "Perspective", f) {
|
|
20
|
+
if (i === "Perspective") {
|
|
21
|
+
const { near: u, far: m, fov: d } = f || {
|
|
22
22
|
near: 0.1,
|
|
23
23
|
far: 1e3,
|
|
24
|
-
fov:
|
|
24
|
+
fov: Ae
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
E = new $(d, r.value, u, m), P.cameras.push(E);
|
|
27
27
|
} else {
|
|
28
|
-
const { left:
|
|
28
|
+
const { left: u, right: m, top: d, bottom: w, near: C, far: x } = f || {
|
|
29
29
|
left: -100,
|
|
30
30
|
right: 100,
|
|
31
31
|
top: 100,
|
|
@@ -33,26 +33,26 @@ function Z() {
|
|
|
33
33
|
near: 0.1,
|
|
34
34
|
far: 1e3
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
E = new Ce(u, m, d, w, C, x), P.cameras.push(E);
|
|
37
37
|
}
|
|
38
|
-
return P.cameras.push(
|
|
38
|
+
return P.cameras.push(E), E;
|
|
39
39
|
}
|
|
40
|
-
const r =
|
|
41
|
-
function
|
|
42
|
-
|
|
40
|
+
const r = D(() => e.value / t.value), o = D(() => P.cameras[0]);
|
|
41
|
+
function s() {
|
|
42
|
+
o.value instanceof $ && (o.value.aspect = r.value), o.value.updateProjectionMatrix();
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
const
|
|
46
|
-
|
|
44
|
+
function c(i) {
|
|
45
|
+
const f = X("camera");
|
|
46
|
+
i && f && (f.value = i, n("camera", f.value)), P.cameras.push(i), i instanceof $ && (i.aspect = r.value), i.updateProjectionMatrix();
|
|
47
47
|
}
|
|
48
|
-
return
|
|
49
|
-
activeCamera:
|
|
48
|
+
return O(r, s), {
|
|
49
|
+
activeCamera: o,
|
|
50
50
|
createCamera: a,
|
|
51
|
-
updateCamera:
|
|
52
|
-
pushCamera:
|
|
51
|
+
updateCamera: s,
|
|
52
|
+
pushCamera: c
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
let b = { ...
|
|
55
|
+
let b = { ...ve };
|
|
56
56
|
delete b.Scene;
|
|
57
57
|
function be() {
|
|
58
58
|
return {
|
|
@@ -62,222 +62,246 @@ function be() {
|
|
|
62
62
|
catalogue: b
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
const
|
|
66
|
-
function
|
|
67
|
-
return typeof e == "number" ? [e, e, e] : e instanceof
|
|
65
|
+
const Be = (e) => typeof e < "u", V = (e) => !!e && e.constructor === Array;
|
|
66
|
+
function $e(e) {
|
|
67
|
+
return typeof e == "number" ? [e, e, e] : e instanceof ye ? [e.x, e.y, e.z] : e;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
return e instanceof
|
|
69
|
+
function q(e) {
|
|
70
|
+
return e instanceof I ? e : Array.isArray(e) ? new I(...e) : new I(e);
|
|
71
71
|
}
|
|
72
|
-
const
|
|
73
|
-
function
|
|
74
|
-
function e(
|
|
75
|
-
console.error(`${
|
|
72
|
+
const K = "[TresJS \u25B2 \u25A0 \u25CF] ";
|
|
73
|
+
function W() {
|
|
74
|
+
function e(a, r) {
|
|
75
|
+
console.error(`${K} ${a}`, r || "");
|
|
76
76
|
}
|
|
77
|
-
function t(
|
|
78
|
-
console.warn(`${
|
|
77
|
+
function t(a) {
|
|
78
|
+
console.warn(`${K} ${a}`);
|
|
79
79
|
}
|
|
80
|
-
function a
|
|
80
|
+
function n(a, r) {
|
|
81
81
|
}
|
|
82
82
|
return {
|
|
83
83
|
logError: e,
|
|
84
84
|
logWarning: t,
|
|
85
|
-
logMessage:
|
|
85
|
+
logMessage: n
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
const
|
|
89
|
-
function
|
|
90
|
-
const {
|
|
91
|
-
function r
|
|
92
|
-
return Object.entries(
|
|
93
|
-
var
|
|
94
|
-
return (
|
|
95
|
-
}).map(([
|
|
96
|
-
const
|
|
97
|
-
name:
|
|
98
|
-
setup(
|
|
99
|
-
t(
|
|
100
|
-
props:
|
|
101
|
-
slots:
|
|
102
|
-
attrs:
|
|
88
|
+
const Ie = ["rotation", "scale", "position"];
|
|
89
|
+
function ze(e) {
|
|
90
|
+
const { logMessage: t, logError: n } = W();
|
|
91
|
+
function a(r) {
|
|
92
|
+
return Object.entries(r).filter(([o, s]) => {
|
|
93
|
+
var c, i;
|
|
94
|
+
return (i = (c = s == null ? void 0 : s.prototype) == null ? void 0 : c.constructor) == null ? void 0 : i.toString().includes("class");
|
|
95
|
+
}).map(([o, s]) => {
|
|
96
|
+
const c = `${e}${o}`, i = _({
|
|
97
|
+
name: c,
|
|
98
|
+
setup(f, { slots: u, attrs: m, ...d }) {
|
|
99
|
+
t(c, {
|
|
100
|
+
props: f,
|
|
101
|
+
slots: u,
|
|
102
|
+
attrs: m,
|
|
103
103
|
ctx: d
|
|
104
104
|
});
|
|
105
|
-
let
|
|
106
|
-
const { scene:
|
|
107
|
-
function
|
|
108
|
-
if ((
|
|
109
|
-
const
|
|
110
|
-
var
|
|
111
|
-
let
|
|
112
|
-
|
|
105
|
+
let w;
|
|
106
|
+
const { scene: C } = ae(), { pushCamera: x } = Z();
|
|
107
|
+
function L() {
|
|
108
|
+
if ((u == null ? void 0 : u.default) && (u == null ? void 0 : u.default())) {
|
|
109
|
+
const y = u.default().map((l) => {
|
|
110
|
+
var h;
|
|
111
|
+
let v;
|
|
112
|
+
const g = l.type.name.replace(e, "");
|
|
113
|
+
return (h = l == null ? void 0 : l.props) != null && h.args ? v = new r[g](...l.props.args) : v = new r[g](), l != null && l.props && T(l.props, v), v;
|
|
113
114
|
});
|
|
114
|
-
|
|
115
|
+
w = new s(...y);
|
|
115
116
|
} else
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
m.args ? w = new s(...m.args) : w = new s();
|
|
118
|
+
T(m, w), c.includes("Camera") && x(w), w.isObject3D && (C == null || C.value.add(w)), t("Instance added", C), d.expose(w);
|
|
118
119
|
}
|
|
119
|
-
function
|
|
120
|
-
Object.entries(
|
|
121
|
-
const
|
|
122
|
-
if (!(
|
|
123
|
-
|
|
120
|
+
function T(y, l) {
|
|
121
|
+
Object.entries(y).forEach(([v, g]) => {
|
|
122
|
+
const h = v.replace(/(-\w)/g, (M) => M[1].toUpperCase());
|
|
123
|
+
if (!(h === "args" || g === void 0)) {
|
|
124
|
+
Ie.includes(v) && g && (g = $e(g));
|
|
124
125
|
try {
|
|
125
|
-
|
|
126
|
-
} catch (
|
|
127
|
-
|
|
126
|
+
l[h] && Be(l[h].set) ? V(g) ? l[h].set(...g) : l[h].set(g) : (g === "" && (g = !0), l[h] = g);
|
|
127
|
+
} catch (M) {
|
|
128
|
+
n(`There was an error setting ${h} property`, M);
|
|
128
129
|
}
|
|
129
130
|
}
|
|
130
|
-
}),
|
|
131
|
+
}), y.ref && (y.ref = l);
|
|
131
132
|
}
|
|
132
|
-
return
|
|
133
|
+
return L(), () => {
|
|
133
134
|
};
|
|
134
135
|
}
|
|
135
136
|
});
|
|
136
|
-
return [
|
|
137
|
+
return [c, i];
|
|
137
138
|
});
|
|
138
139
|
}
|
|
139
140
|
return {
|
|
140
|
-
createComponentInstances:
|
|
141
|
+
createComponentInstances: a
|
|
141
142
|
};
|
|
142
143
|
}
|
|
143
|
-
const
|
|
144
|
+
const ee = U(), te = U(), ne = U(), Q = new Me(), { pause: De, resume: Fe, isActive: _e } = ge(
|
|
144
145
|
() => {
|
|
145
|
-
const e =
|
|
146
|
-
|
|
146
|
+
const e = Q.getElapsedTime(), t = Q.getDelta();
|
|
147
|
+
ee.trigger({ delta: t, elapsed: e }), te.trigger({ delta: t, elapsed: e }), ne.trigger({ delta: t, elapsed: e });
|
|
147
148
|
},
|
|
148
149
|
{ immediate: !1 }
|
|
149
150
|
);
|
|
150
|
-
function
|
|
151
|
+
function re() {
|
|
151
152
|
return {
|
|
152
|
-
onBeforeLoop:
|
|
153
|
-
onLoop:
|
|
154
|
-
onAfterLoop:
|
|
155
|
-
pause:
|
|
156
|
-
resume:
|
|
157
|
-
isActive:
|
|
153
|
+
onBeforeLoop: ee.on,
|
|
154
|
+
onLoop: te.on,
|
|
155
|
+
onAfterLoop: ne.on,
|
|
156
|
+
pause: De,
|
|
157
|
+
resume: Fe,
|
|
158
|
+
isActive: _e
|
|
158
159
|
};
|
|
159
160
|
}
|
|
160
|
-
const
|
|
161
|
-
function
|
|
161
|
+
const je = j(new Se());
|
|
162
|
+
function ae() {
|
|
162
163
|
return {
|
|
163
|
-
scene:
|
|
164
|
+
scene: je
|
|
164
165
|
};
|
|
165
166
|
}
|
|
166
|
-
function
|
|
167
|
-
const
|
|
168
|
-
return
|
|
167
|
+
function Ue(e) {
|
|
168
|
+
const t = { nodes: {}, materials: {} };
|
|
169
|
+
return e && e.traverse((n) => {
|
|
170
|
+
n.name && (t.nodes[n.name] = n), n.material && !t.materials[n.material.name] && (t.materials[n.material.name] = n.material);
|
|
171
|
+
}), t;
|
|
172
|
+
}
|
|
173
|
+
async function Je(e, t, n, a, r) {
|
|
174
|
+
const { logError: o } = W(), s = new e();
|
|
175
|
+
r && r(s), n && n(e);
|
|
176
|
+
const i = (Array.isArray(t) ? t : [t]).map(
|
|
177
|
+
(f) => new Promise((u, m) => {
|
|
178
|
+
s.load(
|
|
179
|
+
f,
|
|
180
|
+
(d) => {
|
|
181
|
+
d.scene && Object.assign(d, Ue(d.scene)), u(d);
|
|
182
|
+
},
|
|
183
|
+
a,
|
|
184
|
+
(d) => m(o("[useLoader] - Failed to load resource", d))
|
|
185
|
+
);
|
|
186
|
+
})
|
|
187
|
+
);
|
|
188
|
+
return V(t) ? await Promise.all(i) : await i[0];
|
|
169
189
|
}
|
|
170
|
-
async function
|
|
171
|
-
const t = new
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
(
|
|
190
|
+
async function qe(e) {
|
|
191
|
+
const t = new xe(), n = new Ee(t), a = (r) => new Promise((o, s) => {
|
|
192
|
+
n.load(
|
|
193
|
+
r,
|
|
194
|
+
(c) => o(c),
|
|
175
195
|
() => null,
|
|
176
196
|
() => {
|
|
177
|
-
|
|
197
|
+
s(new Error("[useTextures] - Failed to load texture"));
|
|
178
198
|
}
|
|
179
199
|
);
|
|
180
200
|
});
|
|
181
|
-
if (
|
|
182
|
-
const
|
|
183
|
-
return e.length > 1 ?
|
|
201
|
+
if (V(e)) {
|
|
202
|
+
const r = await Promise.all(e.map((o) => a(o)));
|
|
203
|
+
return e.length > 1 ? r : r[0];
|
|
184
204
|
} else {
|
|
185
|
-
const { map:
|
|
205
|
+
const { map: r, displacementMap: o, normalMap: s, roughnessMap: c, metalnessMap: i, aoMap: f } = e;
|
|
186
206
|
return {
|
|
187
|
-
map:
|
|
188
|
-
displacementMap: o ? await
|
|
189
|
-
normalMap:
|
|
190
|
-
roughnessMap:
|
|
191
|
-
metalnessMap: i ? await
|
|
192
|
-
aoMap:
|
|
207
|
+
map: r ? await a(r) : null,
|
|
208
|
+
displacementMap: o ? await a(o) : null,
|
|
209
|
+
normalMap: s ? await a(s) : null,
|
|
210
|
+
roughnessMap: c ? await a(c) : null,
|
|
211
|
+
metalnessMap: i ? await a(i) : null,
|
|
212
|
+
aoMap: f ? await a(f) : null
|
|
193
213
|
};
|
|
194
214
|
}
|
|
195
215
|
}
|
|
196
|
-
const
|
|
197
|
-
function
|
|
198
|
-
function e(
|
|
199
|
-
return
|
|
216
|
+
const R = fe({});
|
|
217
|
+
function oe() {
|
|
218
|
+
function e(n) {
|
|
219
|
+
return R[n];
|
|
200
220
|
}
|
|
201
|
-
function t(
|
|
202
|
-
|
|
221
|
+
function t(n, a) {
|
|
222
|
+
R[n] = a;
|
|
203
223
|
}
|
|
204
224
|
return {
|
|
205
|
-
state:
|
|
206
|
-
...
|
|
225
|
+
state: R,
|
|
226
|
+
...me(R),
|
|
207
227
|
getState: e,
|
|
208
228
|
setState: t
|
|
209
229
|
};
|
|
210
230
|
}
|
|
211
|
-
const
|
|
212
|
-
function
|
|
231
|
+
const p = j(), z = F(!1);
|
|
232
|
+
function Ve(e, t, n) {
|
|
213
233
|
const {
|
|
214
|
-
alpha:
|
|
215
|
-
antialias:
|
|
234
|
+
alpha: a = !1,
|
|
235
|
+
antialias: r,
|
|
216
236
|
depth: o,
|
|
217
|
-
logarithmicDepthBuffer:
|
|
218
|
-
failIfMajorPerformanceCaveat:
|
|
237
|
+
logarithmicDepthBuffer: s,
|
|
238
|
+
failIfMajorPerformanceCaveat: c,
|
|
219
239
|
precision: i,
|
|
220
|
-
premultipliedAlpha:
|
|
221
|
-
stencil:
|
|
240
|
+
premultipliedAlpha: f,
|
|
241
|
+
stencil: u,
|
|
222
242
|
shadows: m = !1,
|
|
223
|
-
shadowMapType:
|
|
224
|
-
physicallyCorrectLights:
|
|
225
|
-
outputEncoding:
|
|
226
|
-
toneMapping: x =
|
|
227
|
-
toneMappingExposure:
|
|
228
|
-
context:
|
|
229
|
-
powerPreference:
|
|
230
|
-
preserveDrawingBuffer:
|
|
231
|
-
clearColor:
|
|
232
|
-
windowSize:
|
|
233
|
-
} =
|
|
234
|
-
!
|
|
243
|
+
shadowMapType: d = Pe,
|
|
244
|
+
physicallyCorrectLights: w = !1,
|
|
245
|
+
outputEncoding: C = Le,
|
|
246
|
+
toneMapping: x = Te,
|
|
247
|
+
toneMappingExposure: L = 1,
|
|
248
|
+
context: T = void 0,
|
|
249
|
+
powerPreference: y = "default",
|
|
250
|
+
preserveDrawingBuffer: l = !1,
|
|
251
|
+
clearColor: v = q("#000000"),
|
|
252
|
+
windowSize: g = !1
|
|
253
|
+
} = n, { width: h, height: M } = g ? Y() : he(t), { pixelRatio: k } = we(), { pause: se, resume: ie } = re(), ce = D(() => h.value / M.value), N = () => {
|
|
254
|
+
!p.value || (p.value.setSize(h.value, M.value), p.value.setPixelRatio(k.value));
|
|
235
255
|
}, H = () => {
|
|
236
|
-
!
|
|
256
|
+
!p.value || (p.value.shadowMap.enabled = S(m), p.value.outputEncoding = S(C), p.value.shadowMap.type = S(d), p.value.physicallyCorrectLights = S(w), p.value.toneMapping = S(x), p.value.toneMappingExposure = S(L), p.value.setClearColor(q(S(v))));
|
|
237
257
|
}, ue = () => {
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
258
|
+
const G = B(e);
|
|
259
|
+
if (p.value || !G)
|
|
260
|
+
return;
|
|
261
|
+
p.value = new Re({
|
|
262
|
+
canvas: G,
|
|
263
|
+
alpha: a,
|
|
264
|
+
antialias: r,
|
|
265
|
+
context: T,
|
|
244
266
|
depth: o,
|
|
245
|
-
failIfMajorPerformanceCaveat:
|
|
246
|
-
logarithmicDepthBuffer:
|
|
247
|
-
powerPreference:
|
|
267
|
+
failIfMajorPerformanceCaveat: c,
|
|
268
|
+
logarithmicDepthBuffer: s,
|
|
269
|
+
powerPreference: y,
|
|
248
270
|
precision: i,
|
|
249
|
-
stencil:
|
|
250
|
-
preserveDrawingBuffer:
|
|
251
|
-
premultipliedAlpha:
|
|
252
|
-
})
|
|
253
|
-
|
|
254
|
-
|
|
271
|
+
stencil: u,
|
|
272
|
+
preserveDrawingBuffer: l,
|
|
273
|
+
premultipliedAlpha: f
|
|
274
|
+
});
|
|
275
|
+
const { setState: pe } = oe();
|
|
276
|
+
pe("renderer", p.value), H(), N(), ie(), z.value = !0;
|
|
277
|
+
}, le = () => {
|
|
278
|
+
!p.value || (p.value.dispose(), p.value = void 0, z.value = !1, se());
|
|
255
279
|
};
|
|
256
|
-
return
|
|
280
|
+
return O([h, M, k], N), O(
|
|
257
281
|
() => [
|
|
258
282
|
m,
|
|
259
|
-
|
|
260
|
-
S,
|
|
261
|
-
M,
|
|
262
|
-
x,
|
|
283
|
+
d,
|
|
263
284
|
C,
|
|
264
|
-
|
|
285
|
+
w,
|
|
286
|
+
x,
|
|
287
|
+
L,
|
|
288
|
+
v
|
|
265
289
|
],
|
|
266
290
|
H
|
|
267
|
-
),
|
|
291
|
+
), O(
|
|
268
292
|
() => [e, t],
|
|
269
293
|
() => {
|
|
270
|
-
|
|
294
|
+
B(e) && B(t) && ue();
|
|
271
295
|
},
|
|
272
296
|
{ immediate: !0, deep: !0 }
|
|
273
297
|
), {
|
|
274
|
-
renderer:
|
|
275
|
-
isReady:
|
|
276
|
-
dispose:
|
|
298
|
+
renderer: p,
|
|
299
|
+
isReady: z,
|
|
300
|
+
dispose: le,
|
|
277
301
|
aspectRatio: ce
|
|
278
302
|
};
|
|
279
303
|
}
|
|
280
|
-
const
|
|
304
|
+
const We = _({
|
|
281
305
|
name: "TresCanvas",
|
|
282
306
|
props: {
|
|
283
307
|
shadows: Boolean,
|
|
@@ -292,13 +316,14 @@ const $e = _({
|
|
|
292
316
|
clearColor: String,
|
|
293
317
|
windowSize: Boolean
|
|
294
318
|
},
|
|
295
|
-
setup(e, { slots: t, attrs:
|
|
296
|
-
const { logError:
|
|
297
|
-
return
|
|
298
|
-
|
|
299
|
-
|
|
319
|
+
setup(e, { slots: t, attrs: n }) {
|
|
320
|
+
const { logError: a } = W(), r = F(), o = F(), { renderer: s, dispose: c, aspectRatio: i } = Ve(r, o, e), f = j();
|
|
321
|
+
return A("camera", f), A("renderer", s), A("aspect-ratio", i), t.default && !t.default().some((u) => u.type.name === "Scene") && a("TresCanvas must contain a Scene component."), t.default && !t.default().some((u) => {
|
|
322
|
+
var m;
|
|
323
|
+
return (m = u.type.name) == null ? void 0 : m.includes("Camera");
|
|
324
|
+
}) && a("Scene must contain a Camera component."), de(() => c()), () => {
|
|
300
325
|
if (t.default)
|
|
301
|
-
return
|
|
326
|
+
return J(
|
|
302
327
|
"div",
|
|
303
328
|
{
|
|
304
329
|
ref: o,
|
|
@@ -306,12 +331,12 @@ const $e = _({
|
|
|
306
331
|
position: "relative",
|
|
307
332
|
width: "100%",
|
|
308
333
|
height: "100vh",
|
|
309
|
-
...
|
|
334
|
+
...n.style
|
|
310
335
|
}
|
|
311
336
|
},
|
|
312
337
|
[
|
|
313
|
-
|
|
314
|
-
ref:
|
|
338
|
+
J("canvas", {
|
|
339
|
+
ref: r,
|
|
315
340
|
style: { width: "100%", height: "100%", position: "absolute", top: 0, left: 0 }
|
|
316
341
|
}),
|
|
317
342
|
t.default()
|
|
@@ -319,37 +344,39 @@ const $e = _({
|
|
|
319
344
|
);
|
|
320
345
|
};
|
|
321
346
|
}
|
|
322
|
-
}),
|
|
347
|
+
}), ke = _({
|
|
323
348
|
name: "Scene",
|
|
324
349
|
setup(e, { slots: t }) {
|
|
325
|
-
const { scene:
|
|
326
|
-
return
|
|
327
|
-
(
|
|
350
|
+
const { scene: n } = ae(), a = X("renderer"), { activeCamera: r } = Z(), { onLoop: o } = re();
|
|
351
|
+
return A("local-scene", n), o(() => {
|
|
352
|
+
(a == null ? void 0 : a.value) && (r == null ? void 0 : r.value) && (n == null ? void 0 : n.value) && a.value.render(n == null ? void 0 : n.value, r.value);
|
|
328
353
|
}), () => {
|
|
329
354
|
if (t.default)
|
|
330
355
|
return t.default();
|
|
331
356
|
};
|
|
332
357
|
}
|
|
333
|
-
}),
|
|
334
|
-
install(e) {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
358
|
+
}), Ke = Symbol("UseTresState"), Qe = {
|
|
359
|
+
install(e, t) {
|
|
360
|
+
const n = (t == null ? void 0 : t.prefix) || "Tres";
|
|
361
|
+
e.component(`${n}Canvas`, We), e.component(`${n}Scene`, ke);
|
|
362
|
+
const { catalogue: a } = be(), { createComponentInstances: r } = ze(n);
|
|
363
|
+
r(t != null && t.extends ? { ...a, ...t.extends } : a).forEach(([s, c]) => {
|
|
364
|
+
e.component(s, c);
|
|
339
365
|
});
|
|
340
366
|
}
|
|
341
367
|
};
|
|
342
368
|
export {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
369
|
+
Oe as CameraType,
|
|
370
|
+
Ke as UseTresStateSymbol,
|
|
371
|
+
Qe as default,
|
|
372
|
+
Ue as trasverseObjects,
|
|
346
373
|
Z as useCamera,
|
|
347
|
-
be as
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
374
|
+
be as useCatalogue,
|
|
375
|
+
ze as useInstanceCreator,
|
|
376
|
+
Je as useLoader,
|
|
377
|
+
re as useRenderLoop,
|
|
378
|
+
Ve as useRenderer,
|
|
379
|
+
ae as useScene,
|
|
380
|
+
qe as useTexture,
|
|
381
|
+
oe as useTres
|
|
355
382
|
};
|