@tresjs/core 4.3.1 → 4.3.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/src/components/TresCanvas.vue.d.ts +3 -2
- package/dist/src/composables/useCamera/index.d.ts +1030 -812
- package/dist/src/composables/useLoader/component.vue.d.ts +7 -8
- package/dist/src/composables/useLoader/index.d.ts +1 -1
- package/dist/src/composables/useTexture/component.vue.d.ts +2 -1
- package/dist/src/types/index.d.ts +1 -8
- package/dist/tres.js +84 -181
- package/dist/tres.umd.cjs +3 -3
- package/package.json +26 -27
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { LoaderProto } from './index';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
loader: LoaderProto<unknown>;
|
|
4
|
+
url: string | string[];
|
|
5
|
+
};
|
|
2
6
|
declare function __VLS_template(): {
|
|
7
|
+
attrs: Partial<{}>;
|
|
3
8
|
slots: {
|
|
4
9
|
default?(_: {
|
|
5
10
|
data: unknown;
|
|
6
11
|
}): any;
|
|
7
12
|
};
|
|
8
13
|
refs: {};
|
|
9
|
-
|
|
14
|
+
rootEl: any;
|
|
10
15
|
};
|
|
11
16
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
12
|
-
declare const __VLS_component: import('vue').DefineComponent<{
|
|
13
|
-
loader: LoaderProto<unknown>;
|
|
14
|
-
url: string | string[];
|
|
15
|
-
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
16
|
-
loader: LoaderProto<unknown>;
|
|
17
|
-
url: string | string[];
|
|
18
|
-
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
19
18
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
20
19
|
export default _default;
|
|
21
20
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
@@ -12,7 +12,7 @@ export type LoaderReturnType<T, L extends LoaderProto<T>> = T extends unknown ?
|
|
|
12
12
|
* @param {Object3D} object
|
|
13
13
|
* @return { [key: string]: any }
|
|
14
14
|
*/
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function traverseObjects(object: Object3D): {
|
|
16
16
|
[key: string]: any;
|
|
17
17
|
};
|
|
18
18
|
export type Extensions<T extends {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PBRUseTextureMap } from './index';
|
|
2
2
|
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
3
4
|
slots: {
|
|
4
5
|
default?(_: {
|
|
5
6
|
textures: {
|
|
@@ -15,7 +16,7 @@ declare function __VLS_template(): {
|
|
|
15
16
|
}): any;
|
|
16
17
|
};
|
|
17
18
|
refs: {};
|
|
18
|
-
|
|
19
|
+
rootEl: any;
|
|
19
20
|
};
|
|
20
21
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
21
22
|
declare const __VLS_component: import('vue').DefineComponent<PBRUseTextureMap, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<PBRUseTextureMap> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -187,14 +187,7 @@ type TresComponents = {
|
|
|
187
187
|
};
|
|
188
188
|
declare module 'vue' {
|
|
189
189
|
interface GlobalComponents extends TresComponents {
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
declare module '@vue/runtime-core' {
|
|
193
|
-
interface GlobalComponents extends TresComponents {
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
declare module '@vue/runtime-dom' {
|
|
197
|
-
interface GlobalComponents extends TresComponents {
|
|
190
|
+
primitive: DefineComponent<TresPrimitive>;
|
|
198
191
|
}
|
|
199
192
|
}
|
|
200
193
|
export {};
|
package/dist/tres.js
CHANGED
|
@@ -1,115 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version: v4.3.
|
|
4
|
-
* (c)
|
|
3
|
+
* version: v4.3.2
|
|
4
|
+
* (c) 2025
|
|
5
5
|
* description: Declarative ThreeJS using Vue Components
|
|
6
6
|
* author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
|
|
7
7
|
*/
|
|
8
8
|
var Et = Object.defineProperty;
|
|
9
9
|
var Tt = (e, t, n) => t in e ? Et(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
10
10
|
var he = (e, t, n) => Tt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
11
|
-
import { defineComponent as fe, withAsyncContext as nt, reactive as Se, renderSlot as rt, unref as W, ref as I, computed as K, watchEffect as
|
|
11
|
+
import { defineComponent as fe, withAsyncContext as nt, reactive as Se, renderSlot as rt, unref as W, ref as I, computed as K, watchEffect as Ae, onUnmounted as J, shallowRef as $, watch as ae, readonly as we, provide as le, inject as St, isRef as At, useSlots as xt, getCurrentInstance as He, onMounted as Lt, openBlock as kt, createElementBlock as Rt, normalizeClass as Ot, normalizeStyle as Dt, createRenderer as jt, h as Ue, Fragment as Bt } from "vue";
|
|
12
12
|
import * as ot from "three";
|
|
13
|
-
import { Scene as st, Vector3 as
|
|
14
|
-
import { tryOnScopeDispose as nn, toValue as
|
|
15
|
-
const dn = "@tresjs/core", pn = "module", mn = "4.3.
|
|
16
|
-
type: "git",
|
|
17
|
-
url: "git+https://github.com/Tresjs/tres.git"
|
|
18
|
-
}, wn = [
|
|
19
|
-
"vue",
|
|
20
|
-
"3d",
|
|
21
|
-
"threejs",
|
|
22
|
-
"three",
|
|
23
|
-
"threejs-vue"
|
|
24
|
-
], bn = !1, Mn = {
|
|
25
|
-
".": {
|
|
26
|
-
types: "./dist/index.d.ts",
|
|
27
|
-
import: "./dist/tres.js",
|
|
28
|
-
require: "./dist/tres.umd.cjs"
|
|
29
|
-
},
|
|
30
|
-
"./components": {
|
|
31
|
-
types: "./dist/src/components/index.d.ts"
|
|
32
|
-
},
|
|
33
|
-
"./composables": {
|
|
34
|
-
types: "./dist/src/composables/index.d.ts"
|
|
35
|
-
},
|
|
36
|
-
"./types": {
|
|
37
|
-
types: "./dist/src/types/index.d.ts"
|
|
38
|
-
},
|
|
39
|
-
"./utils": {
|
|
40
|
-
types: "./dist/src/utils/index.d.ts"
|
|
41
|
-
},
|
|
42
|
-
"./*": "./*"
|
|
43
|
-
}, Pn = "./dist/tres.js", Cn = "./dist/tres.js", En = "./dist/index.d.ts", Tn = [
|
|
44
|
-
"*.d.ts",
|
|
45
|
-
"dist"
|
|
46
|
-
], Sn = {
|
|
47
|
-
access: "public"
|
|
48
|
-
}, xn = {
|
|
49
|
-
dev: "cd playground/vue && npm run dev",
|
|
50
|
-
"dev:nuxt": "cd playground/nuxt && npm run dev",
|
|
51
|
-
build: "vite build",
|
|
52
|
-
test: "vitest",
|
|
53
|
-
"test:ci": "vitest run",
|
|
54
|
-
"test:ui": "vitest --ui --coverage.enabled=true",
|
|
55
|
-
release: "release-it",
|
|
56
|
-
coverage: "vitest run --coverage",
|
|
57
|
-
lint: "eslint .",
|
|
58
|
-
"lint:fix": "eslint . --fix",
|
|
59
|
-
"docs:dev": "vitepress dev docs",
|
|
60
|
-
"docs:build": "vitepress build docs",
|
|
61
|
-
"docs:serve": "vitepress serve docs",
|
|
62
|
-
"docs:preview": "vitepress preview docs",
|
|
63
|
-
"docs:contributors": "esno scripts/update-contributors.ts"
|
|
64
|
-
}, An = {
|
|
65
|
-
three: ">=0.133",
|
|
66
|
-
vue: ">=3.4"
|
|
67
|
-
}, kn = {
|
|
68
|
-
"@alvarosabu/utils": "^3.2.0",
|
|
69
|
-
"@vue/devtools-api": "^6.6.3",
|
|
70
|
-
"@vueuse/core": "^11.1.0"
|
|
71
|
-
}, Ln = {
|
|
72
|
-
"@release-it/conventional-changelog": "^9.0.0",
|
|
73
|
-
"@stackblitz/sdk": "^1.11.0",
|
|
74
|
-
"@tresjs/cientos": "4.0.3",
|
|
75
|
-
"@tresjs/eslint-config": "^1.4.0",
|
|
76
|
-
"@types/three": "^0.169.0",
|
|
77
|
-
"@typescript-eslint/eslint-plugin": "^8.8.1",
|
|
78
|
-
"@typescript-eslint/parser": "^8.8.1",
|
|
79
|
-
"@vitejs/plugin-vue": "^5.1.4",
|
|
80
|
-
"@vitest/coverage-c8": "^0.33.0",
|
|
81
|
-
"@vitest/coverage-v8": "^2.1.2",
|
|
82
|
-
"@vitest/ui": "^2.1.2",
|
|
83
|
-
"@vue/test-utils": "^2.4.6",
|
|
84
|
-
eslint: "^9.12.0",
|
|
85
|
-
"eslint-plugin-vue": "^9.29.0",
|
|
86
|
-
esno: "^4.8.0",
|
|
87
|
-
gsap: "^3.12.5",
|
|
88
|
-
husky: "^9.1.6",
|
|
89
|
-
jsdom: "^25.0.1",
|
|
90
|
-
kolorist: "^1.8.0",
|
|
91
|
-
ohmyfetch: "^0.4.21",
|
|
92
|
-
pathe: "^1.1.2",
|
|
93
|
-
"release-it": "^17.8.2",
|
|
94
|
-
"rollup-plugin-analyzer": "^4.0.0",
|
|
95
|
-
"rollup-plugin-copy": "^3.5.0",
|
|
96
|
-
"rollup-plugin-visualizer": "^5.12.0",
|
|
97
|
-
sponsorkit: "^0.15.5",
|
|
98
|
-
three: "^0.169.0",
|
|
99
|
-
unocss: "^0.63.4",
|
|
100
|
-
unplugin: "^1.14.1",
|
|
101
|
-
"unplugin-vue-components": "^0.27.4",
|
|
102
|
-
vite: "^5.4.8",
|
|
103
|
-
"vite-plugin-banner": "^0.8.0",
|
|
104
|
-
"vite-plugin-dts": "4.2.4",
|
|
105
|
-
"vite-plugin-inspect": "^0.8.7",
|
|
106
|
-
"vite-plugin-require-transform": "^1.0.21",
|
|
107
|
-
"vite-svg-loader": "^5.1.0",
|
|
108
|
-
vitepress: "1.4.0",
|
|
109
|
-
vitest: "^2.1.2",
|
|
110
|
-
vue: "3.5.12",
|
|
111
|
-
"vue-demi": "^0.14.10"
|
|
112
|
-
}, Rn = {
|
|
13
|
+
import { Scene as st, Vector3 as xe, MathUtils as it, MeshBasicMaterial as at, DoubleSide as It, TextureLoader as $t, PerspectiveCamera as be, Camera as Ht, Clock as lt, REVISION as Ut, Color as Z, SRGBColorSpace as Ft, ACESFilmicToneMapping as ct, PCFSoftShadowMap as Wt, NoToneMapping as Nt, WebGLRenderer as ge, Vector2 as ve, Raycaster as zt, BufferAttribute as Gt, Object3D as Vt, ArrowHelper as Yt, Line as qt, BufferGeometry as Fe, Float32BufferAttribute as We, LineBasicMaterial as Kt, Mesh as Jt, BackSide as Qt, DirectionalLightHelper as Xt, PointLightHelper as Zt, SpotLightHelper as en, HemisphereLightHelper as tn } from "three";
|
|
14
|
+
import { tryOnScopeDispose as nn, toValue as A, unrefElement as rn, useDevicePixelRatio as on, useWindowSize as sn, useElementSize as an, refDebounced as Ne, usePointer as ln, useElementBounding as cn, createEventHook as D, useFps as un, useMemory as fn, useRafFn as ut } from "@vueuse/core";
|
|
15
|
+
const dn = "@tresjs/core", pn = "module", mn = "4.3.2", hn = "pnpm@9.15.1", gn = "Declarative ThreeJS using Vue Components", vn = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", yn = "MIT", _n = { type: "git", url: "git+https://github.com/Tresjs/tres.git" }, wn = ["vue", "3d", "threejs", "three", "threejs-vue"], bn = !1, Mn = { ".": { types: "./dist/index.d.ts", import: "./dist/tres.js", require: "./dist/tres.umd.cjs" }, "./components": { types: "./dist/src/components/index.d.ts" }, "./composables": { types: "./dist/src/composables/index.d.ts" }, "./types": { types: "./dist/src/types/index.d.ts" }, "./utils": { types: "./dist/src/utils/index.d.ts" }, "./*": "./*" }, Pn = "./dist/tres.js", Cn = "./dist/tres.js", En = "./dist/index.d.ts", Tn = ["*.d.ts", "dist"], Sn = { access: "public" }, An = { dev: "pnpm --filter='./playground/vue' dev", "dev:nuxt": "pnpm --filter='./playground/nuxt' dev", build: "vite build", test: "vitest", "test:ci": "vitest run", "test:ui": "vitest --ui --coverage.enabled=true", release: "release-it", coverage: "vitest run --coverage", lint: "eslint .", "lint:fix": "eslint . --fix", "docs:dev": "vitepress dev docs", "docs:build": "vitepress build docs", "docs:serve": "vitepress serve docs", "docs:preview": "vitepress preview docs", "docs:contributors": "esno scripts/update-contributors.ts" }, xn = { three: ">=0.133", vue: ">=3.4" }, Ln = { "@alvarosabu/utils": "^3.2.0", "@vue/devtools-api": "^6.6.3", "@vueuse/core": "^12.0.0" }, kn = { "@release-it/conventional-changelog": "^9.0.3", "@stackblitz/sdk": "^1.11.0", "@tresjs/cientos": "4.0.3", "@tresjs/eslint-config": "^1.4.0", "@types/three": "^0.171.0", "@typescript-eslint/eslint-plugin": "^8.18.1", "@typescript-eslint/parser": "^8.18.1", "@vitejs/plugin-vue": "^5.2.1", "@vitest/coverage-c8": "^0.33.0", "@vitest/coverage-v8": "^2.1.8", "@vitest/ui": "^2.1.8", "@vue/test-utils": "^2.4.6", eslint: "^9.17.0", "eslint-plugin-vue": "^9.32.0", esno: "^4.8.0", gsap: "^3.12.5", jsdom: "^25.0.1", kolorist: "^1.8.0", ohmyfetch: "^0.4.21", pathe: "^1.1.2", "release-it": "^17.10.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-copy": "^3.5.0", "rollup-plugin-visualizer": "^5.12.0", sponsorkit: "^0.16.2", three: "^0.171.0", unocss: "^0.65.2", unplugin: "^2.1.0", "unplugin-vue-components": "^0.28.0", vite: "^6.0.5", "vite-plugin-banner": "^0.8.0", "vite-plugin-dts": "4.4.0", "vite-plugin-inspect": "^0.10.4", "vite-plugin-require-transform": "^1.0.21", "vite-svg-loader": "^5.1.0", vitepress: "1.5.0", vitest: "2.1.8", vue: "3.5.13", "vue-demi": "^0.14.10" }, Rn = {
|
|
113
16
|
name: dn,
|
|
114
17
|
type: pn,
|
|
115
18
|
version: mn,
|
|
@@ -126,10 +29,10 @@ const dn = "@tresjs/core", pn = "module", mn = "4.3.1", hn = "pnpm@9.1.4", gn =
|
|
|
126
29
|
types: En,
|
|
127
30
|
files: Tn,
|
|
128
31
|
publishConfig: Sn,
|
|
129
|
-
scripts:
|
|
130
|
-
peerDependencies:
|
|
131
|
-
dependencies:
|
|
132
|
-
devDependencies:
|
|
32
|
+
scripts: An,
|
|
33
|
+
peerDependencies: xn,
|
|
34
|
+
dependencies: Ln,
|
|
35
|
+
devDependencies: kn
|
|
133
36
|
};
|
|
134
37
|
function On(e) {
|
|
135
38
|
const t = { nodes: {}, materials: {} };
|
|
@@ -319,7 +222,7 @@ function Xn(e) {
|
|
|
319
222
|
function Zn(e) {
|
|
320
223
|
var n;
|
|
321
224
|
let t = e.value;
|
|
322
|
-
return e.value && ((n = e.value) != null && n.isMesh) && (t = e.value.position), Array.isArray(e.value) && (t = new
|
|
225
|
+
return e.value && ((n = e.value) != null && n.isMesh) && (t = e.value.position), Array.isArray(e.value) && (t = new xe(...t)), t;
|
|
323
226
|
}
|
|
324
227
|
function er(e) {
|
|
325
228
|
return "map" in e;
|
|
@@ -404,7 +307,7 @@ function or(e, t, n) {
|
|
|
404
307
|
if (!G(e.setPixelRatio))
|
|
405
308
|
return;
|
|
406
309
|
let r = 0;
|
|
407
|
-
if (de(n) && n.length >= 2) {
|
|
310
|
+
if (n && de(n) && n.length >= 2) {
|
|
408
311
|
const [l, i] = n;
|
|
409
312
|
r = it.clamp(t, l, i);
|
|
410
313
|
} else Bn(n) ? r = n : r = t;
|
|
@@ -517,7 +420,7 @@ const qr = /* @__PURE__ */ fe({
|
|
|
517
420
|
t.value = t.value.filter(({ uuid: c }) => c !== a.uuid);
|
|
518
421
|
}
|
|
519
422
|
};
|
|
520
|
-
return
|
|
423
|
+
return Ae(() => {
|
|
521
424
|
e.aspectRatio.value && t.value.forEach((i) => {
|
|
522
425
|
!i.manual && (i instanceof be || lr(i)) && (i instanceof be ? i.aspect = e.aspectRatio.value : (i.left = e.width.value * -0.5, i.right = e.width.value * 0.5, i.top = e.height.value * 0.5, i.bottom = e.height.value * -0.5), i.updateProjectionMatrix());
|
|
523
426
|
});
|
|
@@ -589,8 +492,8 @@ function dr() {
|
|
|
589
492
|
function v(M) {
|
|
590
493
|
u = M;
|
|
591
494
|
}
|
|
592
|
-
function h(M,
|
|
593
|
-
switch (
|
|
495
|
+
function h(M, x, p = 0) {
|
|
496
|
+
switch (x) {
|
|
594
497
|
case "before":
|
|
595
498
|
return o.on(M, p);
|
|
596
499
|
case "render":
|
|
@@ -622,7 +525,7 @@ function dr() {
|
|
|
622
525
|
i = requestAnimationFrame(b);
|
|
623
526
|
return;
|
|
624
527
|
}
|
|
625
|
-
const M = r.getDelta(),
|
|
528
|
+
const M = r.getDelta(), x = r.getElapsedTime(), p = {
|
|
626
529
|
camera: W(u.camera),
|
|
627
530
|
scene: W(u.scene),
|
|
628
531
|
renderer: W(u.renderer),
|
|
@@ -630,7 +533,7 @@ function dr() {
|
|
|
630
533
|
controls: W(u.controls),
|
|
631
534
|
invalidate: u.invalidate,
|
|
632
535
|
advance: u.advance
|
|
633
|
-
}, w = { delta: M, elapsed:
|
|
536
|
+
}, w = { delta: M, elapsed: x, clock: r, ...p };
|
|
634
537
|
s.value && o.trigger(w), l.value || (f.count ? f.trigger(w) : c && c(w)), s.value && y.trigger(w), i = requestAnimationFrame(b);
|
|
635
538
|
}
|
|
636
539
|
function E() {
|
|
@@ -639,7 +542,7 @@ function dr() {
|
|
|
639
542
|
}
|
|
640
543
|
return {
|
|
641
544
|
loopId: a,
|
|
642
|
-
register: (M,
|
|
545
|
+
register: (M, x, p) => h(M, x, p),
|
|
643
546
|
start: g,
|
|
644
547
|
stop: d,
|
|
645
548
|
pause: P,
|
|
@@ -652,7 +555,7 @@ function dr() {
|
|
|
652
555
|
setReady: (M) => e = M
|
|
653
556
|
};
|
|
654
557
|
}
|
|
655
|
-
function
|
|
558
|
+
function Le(e) {
|
|
656
559
|
let t = 0;
|
|
657
560
|
return e.traverse((n) => {
|
|
658
561
|
if (n.isMesh && n.geometry && n.type !== "HightlightMesh") {
|
|
@@ -666,7 +569,7 @@ function pr(e) {
|
|
|
666
569
|
}
|
|
667
570
|
const mr = Number.parseInt(Ut.replace("dev", ""));
|
|
668
571
|
function Jr(e) {
|
|
669
|
-
return typeof e == "number" ? [e, e, e] : e instanceof
|
|
572
|
+
return typeof e == "number" ? [e, e, e] : e instanceof xe ? [e.x, e.y, e.z] : e;
|
|
670
573
|
}
|
|
671
574
|
function hr(e) {
|
|
672
575
|
return e instanceof Z ? e : Array.isArray(e) ? new Z(...e) : new Z(e);
|
|
@@ -694,18 +597,18 @@ function gr({
|
|
|
694
597
|
contextParts: { sizes: n, render: r, invalidate: s, advance: l }
|
|
695
598
|
}) {
|
|
696
599
|
const i = K(() => ({
|
|
697
|
-
alpha:
|
|
698
|
-
depth:
|
|
600
|
+
alpha: A(t.alpha) ?? !0,
|
|
601
|
+
depth: A(t.depth),
|
|
699
602
|
canvas: rn(e),
|
|
700
|
-
context:
|
|
701
|
-
stencil:
|
|
702
|
-
antialias:
|
|
703
|
-
precision:
|
|
704
|
-
powerPreference:
|
|
705
|
-
premultipliedAlpha:
|
|
706
|
-
preserveDrawingBuffer:
|
|
707
|
-
logarithmicDepthBuffer:
|
|
708
|
-
failIfMajorPerformanceCaveat:
|
|
603
|
+
context: A(t.context),
|
|
604
|
+
stencil: A(t.stencil),
|
|
605
|
+
antialias: A(t.antialias) ?? !0,
|
|
606
|
+
precision: A(t.precision),
|
|
607
|
+
powerPreference: A(t.powerPreference),
|
|
608
|
+
premultipliedAlpha: A(t.premultipliedAlpha),
|
|
609
|
+
preserveDrawingBuffer: A(t.preserveDrawingBuffer),
|
|
610
|
+
logarithmicDepthBuffer: A(t.logarithmicDepthBuffer),
|
|
611
|
+
failIfMajorPerformanceCaveat: A(t.failIfMajorPerformanceCaveat)
|
|
709
612
|
})), a = $(new ge(i.value));
|
|
710
613
|
function c() {
|
|
711
614
|
t.renderMode === "on-demand" && s();
|
|
@@ -728,14 +631,14 @@ function gr({
|
|
|
728
631
|
outputColorSpace: h.outputColorSpace
|
|
729
632
|
};
|
|
730
633
|
return h.dispose(), g;
|
|
731
|
-
})(), v =
|
|
634
|
+
})(), v = A(t.renderMode);
|
|
732
635
|
return v === "on-demand" && s(), v === "manual" && setTimeout(() => {
|
|
733
636
|
l();
|
|
734
|
-
}, 100),
|
|
735
|
-
const h =
|
|
736
|
-
h && (h in se || f(`Renderer Preset must be one of these: ${Object.keys(se).join(", ")}`), dt(a.value, se[h])), or(a.value, o.value,
|
|
637
|
+
}, 100), Ae(() => {
|
|
638
|
+
const h = A(t.preset);
|
|
639
|
+
h && (h in se || f(`Renderer Preset must be one of these: ${Object.keys(se).join(", ")}`), dt(a.value, se[h])), or(a.value, o.value, A(t.dpr)), v === "always" && (r.frames.value = Math.max(1, r.frames.value));
|
|
737
640
|
const g = (P, C) => {
|
|
738
|
-
const T =
|
|
641
|
+
const T = A(P), b = () => {
|
|
739
642
|
if (h)
|
|
740
643
|
return Ve(se[h], C);
|
|
741
644
|
};
|
|
@@ -757,7 +660,7 @@ function gr({
|
|
|
757
660
|
};
|
|
758
661
|
}
|
|
759
662
|
function vr(e, t, n = 10) {
|
|
760
|
-
const r =
|
|
663
|
+
const r = A(e) ? sn() : an(K(() => A(t).parentElement)), s = we(Ne(r.width, n)), l = we(Ne(r.height, n)), i = K(() => s.value / l.value);
|
|
761
664
|
return {
|
|
762
665
|
height: l,
|
|
763
666
|
width: s,
|
|
@@ -791,7 +694,7 @@ const yr = (e, t) => {
|
|
|
791
694
|
}
|
|
792
695
|
const M = (m, S) => {
|
|
793
696
|
var Be, Ie, $e;
|
|
794
|
-
const U = E(S), ne = new
|
|
697
|
+
const U = E(S), ne = new xe(S == null ? void 0 : S.clientX, S == null ? void 0 : S.clientY, 0).unproject((Be = t.camera) == null ? void 0 : Be.value);
|
|
795
698
|
m.trigger({
|
|
796
699
|
...U,
|
|
797
700
|
intersections: r.value,
|
|
@@ -804,16 +707,16 @@ const yr = (e, t) => {
|
|
|
804
707
|
stopPropagating: !1
|
|
805
708
|
});
|
|
806
709
|
};
|
|
807
|
-
let
|
|
710
|
+
let x;
|
|
808
711
|
const p = (m) => {
|
|
809
|
-
v(m), M(d, m),
|
|
712
|
+
v(m), M(d, m), x = m;
|
|
810
713
|
}, w = () => {
|
|
811
|
-
|
|
714
|
+
x && p(x);
|
|
812
715
|
};
|
|
813
|
-
let
|
|
716
|
+
let L, k, R;
|
|
814
717
|
const j = (m) => {
|
|
815
718
|
var S;
|
|
816
|
-
|
|
719
|
+
L = (S = r.value[0]) == null ? void 0 : S.object, i = 0, k = new ve(
|
|
817
720
|
(m == null ? void 0 : m.clientX) ?? s.value,
|
|
818
721
|
(m == null ? void 0 : m.clientY) ?? l.value
|
|
819
722
|
), M(P, m);
|
|
@@ -821,10 +724,10 @@ const yr = (e, t) => {
|
|
|
821
724
|
let O, Y = !1;
|
|
822
725
|
const Re = (m) => {
|
|
823
726
|
var S, U, ne;
|
|
824
|
-
m instanceof PointerEvent && (r.value.length === 0 && M(C, m),
|
|
727
|
+
m instanceof PointerEvent && (r.value.length === 0 && M(C, m), L === ((S = r.value[0]) == null ? void 0 : S.object) && (R = new ve(
|
|
825
728
|
(m == null ? void 0 : m.clientX) ?? s.value,
|
|
826
729
|
(m == null ? void 0 : m.clientY) ?? l.value
|
|
827
|
-
), i =
|
|
730
|
+
), i = k == null ? void 0 : k.distanceTo(R), m.button === 0 ? (M(h, m), O === ((U = r.value[0]) == null ? void 0 : U.object) ? Y = !0 : (O = (ne = r.value[0]) == null ? void 0 : ne.object, Y = !1)) : m.button === 2 && M(T, m)), M(_, m));
|
|
828
731
|
}, Oe = (m) => {
|
|
829
732
|
Y && (M(g, m), O = void 0, Y = !1);
|
|
830
733
|
}, De = (m) => M(d, m), je = (m) => M(b, m);
|
|
@@ -850,7 +753,7 @@ function _e(e, t) {
|
|
|
850
753
|
typeof e == "function" && e(t);
|
|
851
754
|
}
|
|
852
755
|
function _r(e, t, n) {
|
|
853
|
-
var
|
|
756
|
+
var x;
|
|
854
757
|
const r = $(), s = $();
|
|
855
758
|
e && (r.value = e), t && (s.value = t);
|
|
856
759
|
const l = (p) => {
|
|
@@ -858,20 +761,20 @@ function _r(e, t, n) {
|
|
|
858
761
|
return ((w = p.__tres) == null ? void 0 : w.eventCount) > 0;
|
|
859
762
|
}, i = (p) => {
|
|
860
763
|
var w;
|
|
861
|
-
return ((w = p.children) == null ? void 0 : w.some((
|
|
862
|
-
}, a = $(((
|
|
764
|
+
return ((w = p.children) == null ? void 0 : w.some((L) => i(L))) || l(p);
|
|
765
|
+
}, a = $(((x = r.value) == null ? void 0 : x.children).filter(i) || []);
|
|
863
766
|
function c(p, w) {
|
|
864
|
-
const
|
|
865
|
-
w.stopPropagation =
|
|
767
|
+
const L = [], k = () => w.stopPropagating = !0;
|
|
768
|
+
w.stopPropagation = k;
|
|
866
769
|
for (const R of w == null ? void 0 : w.intersections) {
|
|
867
770
|
if (w.stopPropagating)
|
|
868
771
|
return;
|
|
869
772
|
w = { ...w, ...R };
|
|
870
773
|
const { object: j } = R;
|
|
871
|
-
w.eventObject = j, _e(j[p], w),
|
|
774
|
+
w.eventObject = j, _e(j[p], w), L.push(j);
|
|
872
775
|
let O = j.parent;
|
|
873
|
-
for (; O !== null && !w.stopPropagating && !
|
|
874
|
-
w.eventObject = O, _e(O[p], w),
|
|
776
|
+
for (; O !== null && !w.stopPropagating && !L.includes(O); )
|
|
777
|
+
w.eventObject = O, _e(O[p], w), L.push(O), O = O.parent;
|
|
875
778
|
const Y = Vn(p.slice(2));
|
|
876
779
|
n(Y, { intersection: R, event: w });
|
|
877
780
|
}
|
|
@@ -890,18 +793,18 @@ function _r(e, t, n) {
|
|
|
890
793
|
h((p) => c("onPointerUp", p)), v((p) => c("onPointerDown", p)), o((p) => c("onClick", p)), f((p) => c("onDoubleClick", p)), y((p) => c("onContextMenu", p)), d((p) => c("onWheel", p));
|
|
891
794
|
let P = [];
|
|
892
795
|
u((p) => {
|
|
893
|
-
const w = p.intersections.map(({ object:
|
|
894
|
-
P.forEach(({ object:
|
|
895
|
-
w.includes(
|
|
896
|
-
}), p.intersections =
|
|
897
|
-
P.includes(
|
|
796
|
+
const w = p.intersections.map(({ object: k }) => k), L = p.intersections;
|
|
797
|
+
P.forEach(({ object: k }) => {
|
|
798
|
+
w.includes(k) || (p.intersections = P, c("onPointerLeave", p), c("onPointerOut", p));
|
|
799
|
+
}), p.intersections = L, p.intersections.forEach(({ object: k }) => {
|
|
800
|
+
P.includes(k) || (c("onPointerEnter", p), c("onPointerOver", p));
|
|
898
801
|
}), c("onPointerMove", p), P = p.intersections;
|
|
899
802
|
});
|
|
900
803
|
const C = [];
|
|
901
804
|
g((p) => {
|
|
902
805
|
const w = () => p.stopPropagating = !0;
|
|
903
|
-
p.stopPropagation = w, C.forEach((
|
|
904
|
-
p.stopPropagating || (p.eventObject =
|
|
806
|
+
p.stopPropagation = w, C.forEach((L) => {
|
|
807
|
+
p.stopPropagating || (p.eventObject = L, _e(L.onPointerMissed, p));
|
|
905
808
|
}), n("pointer-missed", { event: p });
|
|
906
809
|
});
|
|
907
810
|
function T(p) {
|
|
@@ -1060,16 +963,16 @@ function br({
|
|
|
1060
963
|
P(), d.loop.stop();
|
|
1061
964
|
});
|
|
1062
965
|
const C = 100, T = un({ every: C }), { isSupported: b, memory: E } = fn({ interval: C }), M = 160;
|
|
1063
|
-
let
|
|
966
|
+
let x = performance.now();
|
|
1064
967
|
const p = ({ timestamp: R }) => {
|
|
1065
|
-
d.scene.value && (d.perf.memory.allocatedMem =
|
|
968
|
+
d.scene.value && (d.perf.memory.allocatedMem = Le(d.scene.value)), R - x >= C && (x = R, d.perf.fps.accumulator.push(T.value), d.perf.fps.accumulator.length > M && d.perf.fps.accumulator.shift(), d.perf.fps.value = T.value, b.value && E.value && (d.perf.memory.accumulator.push(E.value.usedJSHeapSize / 1024 / 1024), d.perf.memory.accumulator.length > M && d.perf.memory.accumulator.shift(), d.perf.memory.currentMem = d.perf.memory.accumulator.reduce((j, O) => j + O, 0) / d.perf.memory.accumulator.length));
|
|
1066
969
|
};
|
|
1067
970
|
let w = 0;
|
|
1068
|
-
const
|
|
1069
|
-
window.__TRES__DEVTOOLS__ && (p({ timestamp: performance.now() }), w += R, w >=
|
|
971
|
+
const L = 1, { pause: k } = ut(({ delta: R }) => {
|
|
972
|
+
window.__TRES__DEVTOOLS__ && (p({ timestamp: performance.now() }), w += R, w >= L && (window.__TRES__DEVTOOLS__.cb(d), w = 0));
|
|
1070
973
|
}, { immediate: !0 });
|
|
1071
974
|
return J(() => {
|
|
1072
|
-
|
|
975
|
+
k();
|
|
1073
976
|
}), d;
|
|
1074
977
|
}
|
|
1075
978
|
function me() {
|
|
@@ -1119,22 +1022,22 @@ function Zr() {
|
|
|
1119
1022
|
onAfterRender: f
|
|
1120
1023
|
};
|
|
1121
1024
|
}
|
|
1122
|
-
const _t = D(), wt = D(),
|
|
1025
|
+
const _t = D(), wt = D(), ke = D(), te = new lt();
|
|
1123
1026
|
let ce = 0, ue = 0;
|
|
1124
1027
|
const { pause: Mr, resume: Je, isActive: Pr } = ut(
|
|
1125
1028
|
() => {
|
|
1126
|
-
_t.trigger({ delta: ce, elapsed: ue, clock: te }), wt.trigger({ delta: ce, elapsed: ue, clock: te }),
|
|
1029
|
+
_t.trigger({ delta: ce, elapsed: ue, clock: te }), wt.trigger({ delta: ce, elapsed: ue, clock: te }), ke.trigger({ delta: ce, elapsed: ue, clock: te });
|
|
1127
1030
|
},
|
|
1128
1031
|
{ immediate: !1 }
|
|
1129
1032
|
);
|
|
1130
|
-
|
|
1033
|
+
ke.on(() => {
|
|
1131
1034
|
ce = te.getDelta(), ue = te.getElapsedTime();
|
|
1132
1035
|
});
|
|
1133
1036
|
let Qe = !1;
|
|
1134
1037
|
const eo = () => (Qe || (Qe = !0, Je()), {
|
|
1135
1038
|
onBeforeLoop: _t.on,
|
|
1136
1039
|
onLoop: wt.on,
|
|
1137
|
-
onAfterLoop:
|
|
1040
|
+
onAfterLoop: ke.on,
|
|
1138
1041
|
pause: Mr,
|
|
1139
1042
|
resume: Je,
|
|
1140
1043
|
isActive: Pr
|
|
@@ -1207,7 +1110,7 @@ const { logError: Xe } = V(), Ze = [
|
|
|
1207
1110
|
return null;
|
|
1208
1111
|
let v = o.replace("Tres", ""), h;
|
|
1209
1112
|
if (o === "primitive") {
|
|
1210
|
-
(!H(u.object) ||
|
|
1113
|
+
(!H(u.object) || At(u.object)) && Xe(
|
|
1211
1114
|
"Tres primitives need an 'object' prop, whose value is an object or shallowRef<object>"
|
|
1212
1115
|
), v = u.object.type;
|
|
1213
1116
|
const g = {};
|
|
@@ -1353,14 +1256,14 @@ function Tr() {
|
|
|
1353
1256
|
function bt() {
|
|
1354
1257
|
return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
|
|
1355
1258
|
}
|
|
1356
|
-
const Sr = typeof Proxy == "function",
|
|
1259
|
+
const Sr = typeof Proxy == "function", Ar = "devtools-plugin:setup", xr = "plugin:settings:set";
|
|
1357
1260
|
let q, Te;
|
|
1358
|
-
function
|
|
1261
|
+
function Lr() {
|
|
1359
1262
|
var e;
|
|
1360
1263
|
return q !== void 0 || (typeof window < "u" && window.performance ? (q = !0, Te = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (q = !0, Te = globalThis.perf_hooks.performance) : q = !1), q;
|
|
1361
1264
|
}
|
|
1362
|
-
function
|
|
1363
|
-
return
|
|
1265
|
+
function kr() {
|
|
1266
|
+
return Lr() ? Te.now() : Date.now();
|
|
1364
1267
|
}
|
|
1365
1268
|
class Rr {
|
|
1366
1269
|
constructor(t, n) {
|
|
@@ -1390,9 +1293,9 @@ class Rr {
|
|
|
1390
1293
|
l = i;
|
|
1391
1294
|
},
|
|
1392
1295
|
now() {
|
|
1393
|
-
return
|
|
1296
|
+
return kr();
|
|
1394
1297
|
}
|
|
1395
|
-
}, n && n.on(
|
|
1298
|
+
}, n && n.on(xr, (i, a) => {
|
|
1396
1299
|
i === this.plugin.id && this.fallbacks.setSettings(a);
|
|
1397
1300
|
}), this.proxiedOn = new Proxy({}, {
|
|
1398
1301
|
get: (i, a) => this.target ? this.target.on[a] : (...c) => {
|
|
@@ -1427,7 +1330,7 @@ class Rr {
|
|
|
1427
1330
|
function Or(e, t) {
|
|
1428
1331
|
const n = e, r = bt(), s = Tr(), l = Sr && n.enableEarlyProxy;
|
|
1429
1332
|
if (s && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !l))
|
|
1430
|
-
s.emit(
|
|
1333
|
+
s.emit(Ar, e, t);
|
|
1431
1334
|
else {
|
|
1432
1335
|
const i = l ? new Rr(n, s) : null;
|
|
1433
1336
|
(r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({
|
|
@@ -1456,7 +1359,7 @@ const Mt = (e) => {
|
|
|
1456
1359
|
textColor: 5750629,
|
|
1457
1360
|
backgroundColor: 15793395
|
|
1458
1361
|
});
|
|
1459
|
-
const n =
|
|
1362
|
+
const n = Le(e);
|
|
1460
1363
|
return n > 0 && t.tags.push({
|
|
1461
1364
|
label: `${pr(n)} KB`,
|
|
1462
1365
|
textColor: 15707189,
|
|
@@ -1539,7 +1442,7 @@ function Ir(e, t) {
|
|
|
1539
1442
|
object: Object.entries(a).map(([c, o]) => c === "children" ? { key: c, value: o.filter((f) => f.type !== "HightlightMesh") } : { key: c, value: o, editable: !0 }).filter(({ key: c }) => c !== "parent")
|
|
1540
1443
|
}, a.isScene && (l.state.info = {
|
|
1541
1444
|
objects: a.children.length,
|
|
1542
|
-
memory:
|
|
1445
|
+
memory: Le(a),
|
|
1543
1446
|
calls: t.renderer.value.info.render.calls,
|
|
1544
1447
|
triangles: t.renderer.value.info.render.triangles,
|
|
1545
1448
|
points: t.renderer.value.info.render.points,
|
|
@@ -1606,7 +1509,7 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
|
|
|
1606
1509
|
"ready"
|
|
1607
1510
|
],
|
|
1608
1511
|
setup(e, { expose: t, emit: n }) {
|
|
1609
|
-
const r = e, s = n, l =
|
|
1512
|
+
const r = e, s = n, l = xt(), { logWarning: i } = V(), a = I(), c = $(new st()), o = He();
|
|
1610
1513
|
Ee(ot);
|
|
1611
1514
|
const f = (g, d = !1) => fe({
|
|
1612
1515
|
setup() {
|
|
@@ -1633,7 +1536,7 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
|
|
|
1633
1536
|
const h = () => {
|
|
1634
1537
|
u(v.value), y(v.value, !0);
|
|
1635
1538
|
};
|
|
1636
|
-
return
|
|
1539
|
+
return Lt(() => {
|
|
1637
1540
|
const g = a;
|
|
1638
1541
|
v.value = br({
|
|
1639
1542
|
scene: c.value,
|
|
@@ -1652,7 +1555,7 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
|
|
|
1652
1555
|
1e3
|
|
1653
1556
|
);
|
|
1654
1557
|
b.position.set(3, 3, 3), b.lookAt(0, 0, 0), d(b);
|
|
1655
|
-
const E =
|
|
1558
|
+
const E = Ae(() => {
|
|
1656
1559
|
P.value.length >= 2 && (b.removeFromParent(), C(b), E == null || E());
|
|
1657
1560
|
});
|
|
1658
1561
|
};
|
|
@@ -1667,7 +1570,7 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
|
|
|
1667
1570
|
), _.value || (i(
|
|
1668
1571
|
"No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
|
|
1669
1572
|
), T());
|
|
1670
|
-
}), J(h), (g, d) => (
|
|
1573
|
+
}), J(h), (g, d) => (kt(), Rt("canvas", {
|
|
1671
1574
|
ref_key: "canvas",
|
|
1672
1575
|
ref: a,
|
|
1673
1576
|
"data-scene": c.value.uuid,
|
|
@@ -1796,7 +1699,7 @@ export {
|
|
|
1796
1699
|
Jr as normalizeVectorFlexibleParam,
|
|
1797
1700
|
Qr as onTresReady,
|
|
1798
1701
|
no as templateCompilerOptions,
|
|
1799
|
-
On as
|
|
1702
|
+
On as traverseObjects,
|
|
1800
1703
|
ar as useCamera,
|
|
1801
1704
|
Dn as useLoader,
|
|
1802
1705
|
V as useLogger,
|