@expofp/floorplan 3.26.0 → 3.27.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/browser/{Button-DI5g1CPS.js → Button-KGleP3m4.js} +6 -6
- package/dist/browser/{CookieConsent-Qws_nQ3N.js → CookieConsent-_czkUaUS.js} +8 -8
- package/dist/browser/{Debug-DTNPNDds.js → Debug-bz6KlGgY.js} +8 -8
- package/dist/browser/DebugTools-CHRXev1e.js +1922 -0
- package/dist/browser/{Demo-BDZjOBQc.js → Demo-Duw5xaxW.js} +10 -10
- package/dist/browser/{Free-Cage9TkV.js → Free-CTEgif-b.js} +10 -10
- package/dist/browser/{GalleryContainer-EeLKgziN.js → GalleryContainer-DHLJOPfK.js} +11 -11
- package/dist/browser/{GpsLoader-CJMX_mJN.js → GpsLoader-CJ5KyhZa.js} +34 -34
- package/dist/browser/{KioskStore-BSza48xl.js → KioskStore-BMvlzIQe.js} +58 -107
- package/dist/browser/{MaplibreAdapter-evVQiVQj.js → MaplibreAdapter-YyHtIPQy.js} +2056 -2141
- package/dist/browser/{ModalContainer-CTKDfIyR.js → ModalContainer-DuilVP6n.js} +11 -11
- package/dist/browser/{PermissionNotice-O469DuWb.js → PermissionNotice-C5Z1g99X.js} +7 -7
- package/dist/browser/SetKioskMode-BcAj0bcd.js +48 -0
- package/dist/browser/{ShowKiosk-DumFiuHU.js → ShowKiosk-D7Klhgza.js} +11 -11
- package/dist/browser/{ViewerMenuPanel-ByFemA_T.js → ViewerMenuPanel-apP-IAf0.js} +17 -17
- package/dist/browser/{add-debug-secret-listener-TLumKuSo.js → add-debug-secret-listener-HZVxK64L.js} +1 -1
- package/dist/browser/{adopt-global-settings-ghJrZaU5.js → adopt-global-settings-CWSlkexR.js} +10 -10
- package/dist/browser/{boolean-editor-WIpm-pFP.js → boolean-editor-BcBAWb-G.js} +10 -10
- package/dist/browser/{bootIntercom-BR_Ehbyl.js → bootIntercom-Jil5W-0K.js} +3 -3
- package/dist/browser/bundle.json +77 -65
- package/dist/browser/camera-events-DrdhxgVS.js +18 -0
- package/dist/browser/{classnames-BmlkHMS8.js → classnames-BU0Ok49m.js} +2 -2
- package/dist/browser/{client-CIHxJZmk.js → client-BU_uyO3_.js} +793 -992
- package/dist/browser/{components-7lxOhyyi.js → components-CppHY7O7.js} +1952 -2013
- package/dist/browser/debug-context-C_w9lssh.js +24315 -0
- package/dist/browser/{debug-overlay-B7jCqVlX.js → debug-overlay-fKIQx7R_.js} +11 -11
- package/dist/browser/{debug-ui-D1ApG52e.js → debug-ui-BO_gZvdf.js} +7 -7
- package/dist/browser/dimming-WtGfPnAD.js +1108 -0
- package/dist/browser/{dist-BrF5yJyj.js → dist-BfpVKsX1.js} +6 -6
- package/dist/browser/{dist-C67OkD_4.js → dist-C2P11Xlj.js} +7 -7
- package/dist/browser/{dist-CnpnDA-V.js → dist-PTVsGItC.js} +3 -3
- package/dist/browser/{efp-debug-init-BqEN61Fo.js → efp-debug-init-Ce-CZeeI.js} +4 -4
- package/dist/browser/{enum-editor-Cy6VeZZd.js → enum-editor-CupsYrxs.js} +5 -5
- package/dist/browser/{es5-DyV1fctu.js → es5-DI5LkTYN.js} +2 -2
- package/dist/browser/{event-not-found-BpFVdXz_.js → event-not-found-D4Xi--mZ.js} +1 -1
- package/dist/browser/{exports-C7NzL4lf.js → exports-CePcAVlz.js} +1 -1
- package/dist/browser/{favicon-BHscWjwp.js → favicon-Dcly9HEc.js} +1 -1
- package/dist/browser/{fetch-retry.umd-BytZeydp.js → fetch-retry.umd-dWO0gw3b.js} +2 -2
- package/dist/browser/{flex-BQBLAC6l.js → flex-nmgYIErO.js} +6 -6
- package/dist/browser/{floorplan.loader-DkaQPhwC.js → floorplan.loader-Nb2QDU7l.js} +10 -10
- package/dist/browser/{floorplan.ready-DwuXZphI.js → floorplan.ready-D_9nn960.js} +344 -308
- package/dist/browser/{fuse-DZTwJ52u.js → fuse-s0oxaMyr.js} +2 -2
- package/dist/browser/{i18n-Bcv8xw_q.js → i18n-D0X-IbhS.js} +5 -5
- package/dist/browser/index.js +14 -14
- package/dist/browser/{index.module-BFxDVa3K.js → index.module-CtQP4Qv8.js} +4 -4
- package/dist/browser/{integrateKiosk-VTNZSSfD.js → integrateKiosk-CTKZOTyE.js} +5 -5
- package/dist/browser/{is-webview-CjItzxdV.js → is-webview-C5K2dDqT.js} +1 -1
- package/dist/browser/{jsx-runtime-CT2c-IhD.js → jsx-runtime-hIg99QxI.js} +2 -2
- package/dist/browser/{kiosk-record-v7r7q7t0.js → kiosk-record-BkSt5SU1.js} +1 -1
- package/dist/browser/{lib-DGh8lZgT.js → lib-DyJ1LDRt.js} +3 -3
- package/dist/browser/{loadImage-a_ahClbD.js → loadImage-Chw6Qd0w.js} +4 -4
- package/dist/browser/{logDeviceInfo-DHfa6NcE.js → logDeviceInfo-3jqov_0t.js} +9 -9
- package/dist/browser/{mobx-dAtztuiQ.js → mobx-C29RNezs.js} +7 -7
- package/dist/browser/{optional-boolean-editor-D43-yLO3.js → optional-boolean-editor-DYudule5.js} +4 -4
- package/dist/browser/{optional-enum-editor-Cvn8TV-x.js → optional-enum-editor-CdOjFlrE.js} +5 -5
- package/dist/browser/{optional-string-editor-sY0yVw_j.js → optional-string-editor-DIJigrO5.js} +5 -5
- package/dist/browser/{particles.min-BD7iDSr6.js → particles.min-BZCTScUM.js} +2 -2
- package/dist/browser/{react-BJopqGbW.js → react-D4xfjtF6.js} +2 -2
- package/dist/browser/{react-dom-B77nDdqp.js → react-dom-B6MtngPG.js} +3 -3
- package/dist/browser/{rolldown-runtime-BmHtYG9i.js → rolldown-runtime-hkgDPyCj.js} +1 -1
- package/dist/browser/scheduler-CUIe3W2m.js +212 -0
- package/dist/browser/{select-ByU-Ym6-.js → select-Dt6UIEBZ.js} +11 -11
- package/dist/browser/{settings-CEH1i0Pj.js → settings-CyYgXisa.js} +2 -2
- package/dist/browser/{settings-item-_PTji9Bz.js → settings-item-COIUD8kZ.js} +7 -7
- package/dist/browser/store-C33lZtwI.js +31207 -0
- package/dist/browser/{string-editor-DaF1t7MK.js → string-editor-kOSWCbwh.js} +5 -5
- package/dist/browser/{text-field-XRLZPyNV.js → text-field-DD6CFKaL.js} +6 -6
- package/dist/browser/{theme-D0OZcdto.js → theme-gxjTjrZ9.js} +9 -9
- package/dist/browser/{ui-7ozfXlN3.js → ui-DBItAumt.js} +9 -9
- package/dist/browser/{useRenderTarget-BG295f3e.js → useRenderTarget-DkuQpLE2.js} +5 -5
- package/dist/browser/viewport-A_9Nzrm0.js +41 -0
- package/dist/esm/components/Kiosk/KioskStore.d.ts +5 -2
- package/dist/esm/components/Kiosk/KioskStore.js +1 -1
- package/dist/esm/components/Kiosk/SetKioskMode.d.ts +1 -2
- package/dist/esm/components/Kiosk/SetKioskMode.js +1 -1
- package/dist/esm/components/Map/Map.d.ts +1 -1
- package/dist/esm/components/Map/Map.js +1 -1
- package/dist/esm/components/Map/MapCamera.d.ts +17 -0
- package/dist/esm/components/Map/MapCamera.js +1 -0
- package/dist/esm/components/Map/MapViewport.d.ts +12 -0
- package/dist/esm/components/Map/MapViewport.js +1 -0
- package/dist/esm/components/Map/booth-by-xy.d.ts +13 -0
- package/dist/esm/components/Map/booth-by-xy.js +1 -1
- package/dist/esm/components/Map/camera-events.d.ts +16 -0
- package/dist/esm/components/Map/camera-events.js +1 -0
- package/dist/esm/components/Map/camera.d.ts +48 -0
- package/dist/esm/components/Map/camera.js +1 -0
- package/dist/esm/components/Map/drawing/config/TextFitter.d.ts +1 -1
- package/dist/esm/components/Map/drawing/config/config-all.d.ts +1 -2
- package/dist/esm/components/Map/drawing/config/config-all.js +1 -1
- package/dist/esm/components/Map/drawing/config/config-bg.d.ts +1 -2
- package/dist/esm/components/Map/drawing/config/config-bg.js +1 -1
- package/dist/esm/components/Map/drawing/config/config-booth-badge.d.ts +70 -3
- package/dist/esm/components/Map/drawing/config/config-booth-badge.js +1 -1
- package/dist/esm/components/Map/drawing/config/config-booth-bg.d.ts +3 -6
- package/dist/esm/components/Map/drawing/config/config-booth-bg.js +1 -1
- package/dist/esm/components/Map/drawing/config/config-booth-bookmark.d.ts +11 -7
- package/dist/esm/components/Map/drawing/config/config-booth-bookmark.js +1 -1
- package/dist/esm/components/Map/drawing/config/config-booth-border.d.ts +2 -3
- package/dist/esm/components/Map/drawing/config/config-booth-border.js +1 -1
- package/dist/esm/components/Map/drawing/config/config-booth-labels-special.d.ts +16 -3
- package/dist/esm/components/Map/drawing/config/config-booth-labels-special.js +2 -2
- package/dist/esm/components/Map/drawing/config/config-booth-labels.d.ts +18 -4
- package/dist/esm/components/Map/drawing/config/config-booth-labels.js +1 -1
- package/dist/esm/components/Map/drawing/config/config-booths.d.ts +1 -2
- package/dist/esm/components/Map/drawing/config/config-booths.js +1 -1
- package/dist/esm/components/Map/drawing/config/config-load-layer.d.ts +1 -2
- package/dist/esm/components/Map/drawing/config/config-load-layer.js +1 -1
- package/dist/esm/components/Map/drawing/config/config-markers.d.ts +23 -2
- package/dist/esm/components/Map/drawing/config/config-markers.js +1 -1
- package/dist/esm/components/Map/drawing/config/layer-images.d.ts +35 -0
- package/dist/esm/components/Map/drawing/config/layer-images.js +1 -0
- package/dist/esm/components/Map/drawing/config/loadBoothsImages.d.ts +38 -3
- package/dist/esm/components/Map/drawing/config/loadBoothsImages.js +1 -1
- package/dist/esm/components/Map/pointer.d.ts +73 -0
- package/dist/esm/components/Map/pointer.js +1 -0
- package/dist/esm/components/Map/scene.d.ts +20 -0
- package/dist/esm/components/Map/scene.js +1 -0
- package/dist/esm/components/Map/traffic/trafficLayers.d.ts +2 -7
- package/dist/esm/components/Map/traffic/trafficLayers.js +1 -1
- package/dist/esm/components/Map/traffic/useBuildRoute.d.ts +4 -3
- package/dist/esm/components/Map/traffic/useBuildRoute.js +6 -6
- package/dist/esm/components/Map/traffic/useManageTraffic.d.ts +4 -3
- package/dist/esm/components/Map/traffic/useManageTraffic.js +1 -1
- package/dist/esm/components/Map/viewport.d.ts +63 -0
- package/dist/esm/components/Map/viewport.js +1 -0
- package/dist/esm/components/Maplibre/MaplibreAdapter.d.ts +6 -2
- package/dist/esm/components/Maplibre/MaplibreAdapter.js +1 -1
- package/dist/esm/components/Maplibre/MaplibreWrapper.d.ts +30 -8
- package/dist/esm/components/Maplibre/MaplibreWrapper.js +1 -1
- package/dist/esm/components/Maplibre/useDimming.d.ts +2 -2
- package/dist/esm/components/Maplibre/useDimming.js +1 -1
- package/dist/esm/components/Maplibre/useKioskIdleEvents.d.ts +5 -6
- package/dist/esm/components/Maplibre/useLayerVisibilitySync.d.ts +2 -2
- package/dist/esm/components/Maplibre/useLayerVisibilitySync.js +1 -1
- package/dist/esm/components/Maplibre/usePoiMarkers.d.ts +1 -2
- package/dist/esm/components/Maplibre/useWayfindingAndMarkers.d.ts +8 -5
- package/dist/esm/components/Maplibre/useWayfindingAndMarkers.js +1 -1
- package/dist/esm/components/Maplibre/utils/layer-defs.d.ts +8 -3
- package/dist/esm/components/Maplibre/utils/layer-defs.js +1 -1
- package/dist/esm/components/Maplibre/utils/poi-marker-hit-test.d.ts +3 -3
- package/dist/esm/components/Ws.js +1 -1
- package/dist/esm/engine/defs.d.ts +30 -0
- package/dist/esm/engine/defs.js +3 -0
- package/dist/esm/engine/fonts.js +1 -0
- package/dist/esm/engine/update-def.d.ts +52 -0
- package/dist/esm/engine/update-def.js +1 -0
- package/dist/esm/engine/utils/rotation.d.ts +6 -0
- package/dist/esm/engine/utils/rotation.js +1 -0
- package/dist/esm/floorplan.ready.d.ts +2 -0
- package/dist/esm/floorplan.ready.js +1 -1
- package/dist/esm/store/BoothStore.d.ts +11 -0
- package/dist/esm/store/LayerStore.d.ts +2 -0
- package/dist/esm/store/LayerStore.js +1 -1
- package/dist/esm/store/RootStore.d.ts +0 -2
- package/dist/esm/store/RootStore.js +1 -1
- package/dist/esm/store/RouteStore.js +1 -1
- package/dist/esm/store/UIState.js +1 -1
- package/dist/esm/store/details-events.d.ts +11 -0
- package/dist/esm/store/details-events.js +1 -0
- package/dist/esm/store/init/init-booths.js +1 -1
- package/dist/esm/utils/dimming.d.ts +13 -2
- package/dist/esm/utils/dimming.js +1 -1
- package/dist/esm/utils/mobx.d.ts +2 -2
- package/dist/esm/utils/mobx.js +1 -1
- package/dist/esm/utils/scene-bounds.d.ts +1 -1
- package/dist/esm/utils/scene-bounds.js +1 -1
- package/dist/esm/wayfinding/adapters/canvasIconProvider.js +1 -1
- package/dist/esm/wayfinding/createWayfinding.d.ts +19 -2
- package/dist/esm/wayfinding/createWayfinding.js +1 -1
- package/package.json +11 -10
- package/dist/browser/SetKioskMode-DUk4c-Gs.js +0 -57
- package/dist/browser/booth-by-xy-CyZpg1Fn.js +0 -1130
- package/dist/browser/main-sUuehgQu.js +0 -289
- package/dist/browser/store-Oj0dGPnb.js +0 -41431
- package/dist/esm/components/Map/pointInConvexQuad.d.ts +0 -3
- package/dist/esm/components/Map/pointInConvexQuad.js +0 -1
- package/dist/esm/components/Map/visibleArea.d.ts +0 -16
- package/dist/esm/components/Map/visibleArea.js +0 -1
- package/dist/esm/components/Maplibre/useRendererEvents.d.ts +0 -9
- package/dist/esm/components/Maplibre/useRendererEvents.js +0 -1
- package/dist/esm/components/Maplibre/utils/update-pump.d.ts +0 -18
- package/dist/esm/components/Maplibre/utils/update-pump.js +0 -1
- package/dist/esm/renderer/HandlerRegistry.d.ts +0 -18
- package/dist/esm/renderer/HandlerRegistry.js +0 -1
- package/dist/esm/renderer/RendererService.d.ts +0 -44
- package/dist/esm/renderer/RendererService.js +0 -1
- package/dist/esm/renderer/engine-core/defs.d.ts +0 -40
- package/dist/esm/renderer/engine-core/defs.js +0 -3
- package/dist/esm/renderer/engine-core/fonts.js +0 -1
- package/dist/esm/renderer/engine-core/settings.d.ts +0 -4
- package/dist/esm/renderer/engine-core/settings.js +0 -1
- package/dist/esm/renderer/engine-core/types.d.ts +0 -50
- package/dist/esm/renderer/engine-core/types.js +0 -1
- package/dist/esm/renderer/engine-core/update-def.d.ts +0 -12
- package/dist/esm/renderer/engine-core/update-def.js +0 -1
- package/dist/esm/renderer/engine-core/utils/rotation.d.ts +0 -17
- package/dist/esm/renderer/engine-core/utils/rotation.js +0 -1
- package/dist/esm/renderer/index.d.ts +0 -19
- package/dist/esm/renderer/index.js +0 -1
- /package/dist/esm/{renderer/engine-core → engine}/canvases.d.ts +0 -0
- /package/dist/esm/{renderer/engine-core → engine}/canvases.js +0 -0
- /package/dist/esm/{renderer/engine-core → engine}/fonts.d.ts +0 -0
|
@@ -0,0 +1,1922 @@
|
|
|
1
|
+
function __vite_inject_css__(css, id, forceLightDom){ if (typeof document==='undefined') return; var shadow=!forceLightDom&&typeof window!=='undefined'&&window.__efpShadowDOMStyleParent; var parent=shadow||document.head; var s=document.createElement('style'); s.setAttribute('data-chunk-style', id); s.appendChild(document.createTextNode(css)); parent.appendChild(s); if (shadow) (window.__efpStyleElements||(window.__efpStyleElements=[])).push(s);}
|
|
2
|
+
(function() {
|
|
3
|
+
try {
|
|
4
|
+
var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {};
|
|
5
|
+
e.SENTRY_RELEASE = { id: "3.27.1" };
|
|
6
|
+
var t = new e.Error().stack;
|
|
7
|
+
t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "592d9901-400e-4908-adc8-f845daf2fa9f", e._sentryDebugIdIdentifier = "sentry-dbid-592d9901-400e-4908-adc8-f845daf2fa9f");
|
|
8
|
+
} catch {}
|
|
9
|
+
})();
|
|
10
|
+
import { r as e } from "./rolldown-runtime-hkgDPyCj.js";
|
|
11
|
+
import { t } from "./react-D4xfjtF6.js";
|
|
12
|
+
import { t as n } from "./jsx-runtime-hIg99QxI.js";
|
|
13
|
+
import { t as r } from "./client-BU_uyO3_.js";
|
|
14
|
+
import { c as i, mn as a, n as o, t as s, y as c } from "./debug-context-C_w9lssh.js";
|
|
15
|
+
//#region ../../node_modules/.pnpm/webgl-memory@1.1.3/node_modules/webgl-memory/webgl-memory.js
|
|
16
|
+
var l = a();
|
|
17
|
+
(function(e) {
|
|
18
|
+
typeof define == "function" && define.amd ? define(e) : e();
|
|
19
|
+
})((function() {
|
|
20
|
+
let e = 5121, t = 5126, n = 32819, r = 32820, i = 5131, a = 36193, o;
|
|
21
|
+
function s(s) {
|
|
22
|
+
if (!o) {
|
|
23
|
+
let s = {};
|
|
24
|
+
s[6406] = {
|
|
25
|
+
bytesPerElement: [
|
|
26
|
+
1,
|
|
27
|
+
2,
|
|
28
|
+
2,
|
|
29
|
+
4
|
|
30
|
+
],
|
|
31
|
+
type: [
|
|
32
|
+
e,
|
|
33
|
+
i,
|
|
34
|
+
a,
|
|
35
|
+
t
|
|
36
|
+
]
|
|
37
|
+
}, s[6409] = {
|
|
38
|
+
bytesPerElement: [
|
|
39
|
+
1,
|
|
40
|
+
2,
|
|
41
|
+
2,
|
|
42
|
+
4
|
|
43
|
+
],
|
|
44
|
+
type: [
|
|
45
|
+
e,
|
|
46
|
+
i,
|
|
47
|
+
a,
|
|
48
|
+
t
|
|
49
|
+
]
|
|
50
|
+
}, s[6410] = {
|
|
51
|
+
bytesPerElement: [
|
|
52
|
+
2,
|
|
53
|
+
4,
|
|
54
|
+
4,
|
|
55
|
+
8
|
|
56
|
+
],
|
|
57
|
+
type: [
|
|
58
|
+
e,
|
|
59
|
+
i,
|
|
60
|
+
a,
|
|
61
|
+
t
|
|
62
|
+
]
|
|
63
|
+
}, s[6407] = {
|
|
64
|
+
bytesPerElement: [
|
|
65
|
+
3,
|
|
66
|
+
6,
|
|
67
|
+
6,
|
|
68
|
+
12,
|
|
69
|
+
2
|
|
70
|
+
],
|
|
71
|
+
type: [
|
|
72
|
+
e,
|
|
73
|
+
i,
|
|
74
|
+
a,
|
|
75
|
+
t,
|
|
76
|
+
33635
|
|
77
|
+
]
|
|
78
|
+
}, s[6408] = {
|
|
79
|
+
bytesPerElement: [
|
|
80
|
+
4,
|
|
81
|
+
8,
|
|
82
|
+
8,
|
|
83
|
+
16,
|
|
84
|
+
2,
|
|
85
|
+
2
|
|
86
|
+
],
|
|
87
|
+
type: [
|
|
88
|
+
e,
|
|
89
|
+
i,
|
|
90
|
+
a,
|
|
91
|
+
t,
|
|
92
|
+
n,
|
|
93
|
+
r
|
|
94
|
+
]
|
|
95
|
+
}, s[35906] = {
|
|
96
|
+
bytesPerElement: [
|
|
97
|
+
4,
|
|
98
|
+
8,
|
|
99
|
+
8,
|
|
100
|
+
16,
|
|
101
|
+
2,
|
|
102
|
+
2
|
|
103
|
+
],
|
|
104
|
+
type: [
|
|
105
|
+
e,
|
|
106
|
+
i,
|
|
107
|
+
a,
|
|
108
|
+
t,
|
|
109
|
+
n,
|
|
110
|
+
r
|
|
111
|
+
]
|
|
112
|
+
}, s[6402] = {
|
|
113
|
+
bytesPerElement: [2, 4],
|
|
114
|
+
type: [5125, 5123]
|
|
115
|
+
}, s[34041] = { bytesPerElement: [4] }, s[33321] = { bytesPerElement: [1] }, s[36756] = { bytesPerElement: [1] }, s[33325] = { bytesPerElement: [2] }, s[33326] = { bytesPerElement: [4] }, s[33330] = { bytesPerElement: [1] }, s[33329] = { bytesPerElement: [1] }, s[33332] = { bytesPerElement: [2] }, s[33331] = { bytesPerElement: [2] }, s[33334] = { bytesPerElement: [4] }, s[33333] = { bytesPerElement: [4] }, s[33323] = { bytesPerElement: [2] }, s[36757] = { bytesPerElement: [2] }, s[33327] = { bytesPerElement: [4] }, s[33328] = { bytesPerElement: [8] }, s[33336] = { bytesPerElement: [2] }, s[33335] = { bytesPerElement: [2] }, s[33338] = { bytesPerElement: [4] }, s[33337] = { bytesPerElement: [4] }, s[33340] = { bytesPerElement: [8] }, s[33339] = { bytesPerElement: [8] }, s[32849] = { bytesPerElement: [3] }, s[35905] = { bytesPerElement: [3] }, s[36194] = { bytesPerElement: [2] }, s[36758] = { bytesPerElement: [3] }, s[35898] = { bytesPerElement: [4] }, s[35901] = { bytesPerElement: [4] }, s[34843] = { bytesPerElement: [6] }, s[34837] = { bytesPerElement: [12] }, s[36221] = { bytesPerElement: [3] }, s[36239] = { bytesPerElement: [3] }, s[36215] = { bytesPerElement: [6] }, s[36233] = { bytesPerElement: [6] }, s[36209] = { bytesPerElement: [12] }, s[36227] = { bytesPerElement: [12] }, s[32856] = { bytesPerElement: [4] }, s[35907] = { bytesPerElement: [4] }, s[36759] = { bytesPerElement: [4] }, s[32855] = { bytesPerElement: [2] }, s[32854] = { bytesPerElement: [2] }, s[32857] = { bytesPerElement: [4] }, s[34842] = { bytesPerElement: [8] }, s[34836] = { bytesPerElement: [16] }, s[36220] = { bytesPerElement: [4] }, s[36238] = { bytesPerElement: [4] }, s[36975] = { bytesPerElement: [4] }, s[36214] = { bytesPerElement: [8] }, s[36232] = { bytesPerElement: [8] }, s[36226] = { bytesPerElement: [16] }, s[36208] = { bytesPerElement: [16] }, s[33189] = { bytesPerElement: [2] }, s[33190] = { bytesPerElement: [4] }, s[36012] = { bytesPerElement: [4] }, s[35056] = { bytesPerElement: [4] }, s[36013] = { bytesPerElement: [4] }, s[36168] = { bytesPerElement: [1] }, o = s;
|
|
116
|
+
}
|
|
117
|
+
return o[s];
|
|
118
|
+
}
|
|
119
|
+
function c(e, t, n) {
|
|
120
|
+
return function(r, i, a) {
|
|
121
|
+
return ((r + e - 1) / e | 0) * ((i + t - 1) / t | 0) * n * a;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function l(e, t, n) {
|
|
125
|
+
return function(r, i, a) {
|
|
126
|
+
return (Math.max(r, e) * Math.max(i, t) / n | 0) * a;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
let u = /* @__PURE__ */ new Map([
|
|
130
|
+
[33776, c(4, 4, 8)],
|
|
131
|
+
[33777, c(4, 4, 8)],
|
|
132
|
+
[33778, c(4, 4, 16)],
|
|
133
|
+
[33779, c(4, 4, 16)],
|
|
134
|
+
[36196, c(4, 4, 8)],
|
|
135
|
+
[35840, l(8, 8, 2)],
|
|
136
|
+
[35842, l(8, 8, 2)],
|
|
137
|
+
[35841, l(16, 8, 4)],
|
|
138
|
+
[35843, l(16, 8, 4)],
|
|
139
|
+
[37488, c(4, 4, 8)],
|
|
140
|
+
[37489, c(4, 4, 8)],
|
|
141
|
+
[37492, c(4, 4, 8)],
|
|
142
|
+
[37493, c(4, 4, 8)],
|
|
143
|
+
[37494, c(4, 4, 8)],
|
|
144
|
+
[37495, c(4, 4, 8)],
|
|
145
|
+
[37490, c(4, 4, 16)],
|
|
146
|
+
[37491, c(4, 4, 16)],
|
|
147
|
+
[37496, c(4, 4, 16)],
|
|
148
|
+
[37497, c(4, 4, 16)],
|
|
149
|
+
[37808, c(4, 4, 16)],
|
|
150
|
+
[37840, c(4, 4, 16)],
|
|
151
|
+
[37809, c(5, 4, 16)],
|
|
152
|
+
[37841, c(5, 4, 16)],
|
|
153
|
+
[37810, c(5, 5, 16)],
|
|
154
|
+
[37842, c(5, 5, 16)],
|
|
155
|
+
[37811, c(6, 5, 16)],
|
|
156
|
+
[37843, c(6, 5, 16)],
|
|
157
|
+
[37812, c(6, 6, 16)],
|
|
158
|
+
[37844, c(6, 6, 16)],
|
|
159
|
+
[37813, c(8, 5, 16)],
|
|
160
|
+
[37845, c(8, 5, 16)],
|
|
161
|
+
[37814, c(8, 6, 16)],
|
|
162
|
+
[37846, c(8, 6, 16)],
|
|
163
|
+
[37815, c(8, 8, 16)],
|
|
164
|
+
[37847, c(8, 8, 16)],
|
|
165
|
+
[37816, c(10, 5, 16)],
|
|
166
|
+
[37848, c(10, 5, 16)],
|
|
167
|
+
[37817, c(10, 6, 16)],
|
|
168
|
+
[37849, c(10, 6, 16)],
|
|
169
|
+
[37818, c(10, 8, 16)],
|
|
170
|
+
[37850, c(10, 8, 16)],
|
|
171
|
+
[37819, c(10, 10, 16)],
|
|
172
|
+
[37851, c(10, 10, 16)],
|
|
173
|
+
[37820, c(12, 10, 16)],
|
|
174
|
+
[37852, c(12, 10, 16)],
|
|
175
|
+
[37821, c(12, 12, 16)],
|
|
176
|
+
[37853, c(12, 12, 16)],
|
|
177
|
+
[35916, c(4, 4, 8)],
|
|
178
|
+
[35917, c(4, 4, 8)],
|
|
179
|
+
[35918, c(4, 4, 16)],
|
|
180
|
+
[35919, c(4, 4, 16)],
|
|
181
|
+
[36492, c(4, 4, 16)],
|
|
182
|
+
[36493, c(4, 4, 16)],
|
|
183
|
+
[36494, c(4, 4, 16)],
|
|
184
|
+
[36495, c(4, 4, 16)],
|
|
185
|
+
[36283, c(4, 4, 8)],
|
|
186
|
+
[36284, c(4, 4, 8)],
|
|
187
|
+
[36285, c(4, 4, 16)],
|
|
188
|
+
[36286, c(4, 4, 16)]
|
|
189
|
+
]);
|
|
190
|
+
function d(e, t) {
|
|
191
|
+
let n = s(e);
|
|
192
|
+
if (!n) throw "unknown internal format";
|
|
193
|
+
if (n.type) {
|
|
194
|
+
let r = n.type.indexOf(t);
|
|
195
|
+
if (r < 0) throw Error(`unsupported type ${t} for internalformat ${e}`);
|
|
196
|
+
return n.bytesPerElement[r];
|
|
197
|
+
}
|
|
198
|
+
return n.bytesPerElement[0];
|
|
199
|
+
}
|
|
200
|
+
function f(e, t, n, r, i) {
|
|
201
|
+
let a = d(e, i);
|
|
202
|
+
return t * n * r * a;
|
|
203
|
+
}
|
|
204
|
+
function p(e, t, n, r, i) {
|
|
205
|
+
let a = u.get(e);
|
|
206
|
+
return a ? a(t, n, r) : f(e, t, n, r, i);
|
|
207
|
+
}
|
|
208
|
+
function m(e) {
|
|
209
|
+
return e && e.buffer && e.buffer instanceof ArrayBuffer;
|
|
210
|
+
}
|
|
211
|
+
function h(e) {
|
|
212
|
+
return m(e) || e instanceof ArrayBuffer;
|
|
213
|
+
}
|
|
214
|
+
function g(e) {
|
|
215
|
+
return {
|
|
216
|
+
samples: e.getParameter(e.SAMPLES) || 1,
|
|
217
|
+
depthBits: e.getParameter(e.DEPTH_BITS),
|
|
218
|
+
stencilBits: e.getParameter(e.STENCIL_BITS),
|
|
219
|
+
contextAttributes: e.getContextAttributes()
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
function _(e) {
|
|
223
|
+
let { depthBits: t, stencilBits: n } = e, r = (t + n + 7) / 8 | 0;
|
|
224
|
+
return r === 3 ? 4 : r;
|
|
225
|
+
}
|
|
226
|
+
function v(e, t) {
|
|
227
|
+
if (e.isContextLost()) return 0;
|
|
228
|
+
let { samples: n } = t, r = e.drawingBufferWidth * e.drawingBufferHeight, i = _(t);
|
|
229
|
+
return r * 4 + r * n * 4 + r * i;
|
|
230
|
+
}
|
|
231
|
+
function y(e) {
|
|
232
|
+
return typeof e == "number";
|
|
233
|
+
}
|
|
234
|
+
function b(e, t) {
|
|
235
|
+
return [...e.webglObjectToMemory.keys()].filter((e) => e instanceof t).map((t) => e.webglObjectToMemory.get(t));
|
|
236
|
+
}
|
|
237
|
+
function x() {
|
|
238
|
+
return (/* @__PURE__ */ Error()).stack.split("\n").slice(2).filter((e) => !e.includes("webgl-memory.js")).join("\n");
|
|
239
|
+
}
|
|
240
|
+
let S = /* @__PURE__ */ new Set();
|
|
241
|
+
function C(e, t, n = {}) {
|
|
242
|
+
if (S.has(e)) return e;
|
|
243
|
+
S.add(e);
|
|
244
|
+
let r = n.origGLErrorFn || e.getError;
|
|
245
|
+
function i(e) {
|
|
246
|
+
let t = g(e), r = {
|
|
247
|
+
baseContext: e,
|
|
248
|
+
config: n,
|
|
249
|
+
apis: { gman_webgl_memory: { ctx: {
|
|
250
|
+
getMemoryInfo() {
|
|
251
|
+
let n = v(e, t);
|
|
252
|
+
return {
|
|
253
|
+
memory: {
|
|
254
|
+
...l,
|
|
255
|
+
drawingbuffer: n,
|
|
256
|
+
total: n + l.buffer + l.texture + l.renderbuffer
|
|
257
|
+
},
|
|
258
|
+
resources: { ...u }
|
|
259
|
+
};
|
|
260
|
+
},
|
|
261
|
+
getResourcesInfo(e) {
|
|
262
|
+
return b(r, e);
|
|
263
|
+
}
|
|
264
|
+
} } },
|
|
265
|
+
resources: {},
|
|
266
|
+
memory: {
|
|
267
|
+
texture: 0,
|
|
268
|
+
buffer: 0,
|
|
269
|
+
renderbuffer: 0
|
|
270
|
+
},
|
|
271
|
+
bindings: /* @__PURE__ */ new Map(),
|
|
272
|
+
defaultVertexArray: {},
|
|
273
|
+
webglObjectToMemory: /* @__PURE__ */ new Map()
|
|
274
|
+
}, i = /* @__PURE__ */ new Set([
|
|
275
|
+
"webgl",
|
|
276
|
+
"webgl2",
|
|
277
|
+
"webgl_lose_context"
|
|
278
|
+
]);
|
|
279
|
+
function a() {
|
|
280
|
+
r.bindings.clear(), r.webglObjectToMemory.clear(), r.webglObjectToMemory.set(r.defaultVertexArray, {}), r.currentVertexArray = r.defaultVertexArray, r.activeTextureUnit = 33984, [r.resources, r.memory].forEach(function(e) {
|
|
281
|
+
for (let t in e) e[t] = 0;
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
function o() {
|
|
285
|
+
a(), r.isContextLost = !0;
|
|
286
|
+
for (let [e, { ctx: t, origFuncs: n }] of [...Object.entries(r.apis)]) if (!i.has(e) && n) {
|
|
287
|
+
S.delete(t);
|
|
288
|
+
for (let [e, r] of Object.entries(n)) t[e] = r;
|
|
289
|
+
delete s[e];
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
function c() {
|
|
293
|
+
r.isContextLost = !1;
|
|
294
|
+
}
|
|
295
|
+
return e.canvas && (e.canvas.addEventListener("webglcontextlost", o), e.canvas.addEventListener("webglcontextrestored", c)), a(), r;
|
|
296
|
+
}
|
|
297
|
+
function a(e) {
|
|
298
|
+
return `${o.activeTextureUnit}_${e}`;
|
|
299
|
+
}
|
|
300
|
+
let o = n.sharedState || i(e);
|
|
301
|
+
n.sharedState = o;
|
|
302
|
+
let { apis: s, bindings: c, memory: l, resources: u, webglObjectToMemory: d } = o, f = {};
|
|
303
|
+
function m() {}
|
|
304
|
+
function _(e, t, n) {
|
|
305
|
+
return e[n || `create${t[0].toUpperCase()}${t.substr(1)}`] ? (u[t] = 0, function(e, n, r, i) {
|
|
306
|
+
o.isContextLost || (++u[t], d.set(i, {
|
|
307
|
+
size: 0,
|
|
308
|
+
stackCreated: x()
|
|
309
|
+
}));
|
|
310
|
+
}) : null;
|
|
311
|
+
}
|
|
312
|
+
function w(t, n = m, r) {
|
|
313
|
+
return e[r || `delete${t[0].toUpperCase()}${t.substr(1)}`] ? function(e, r, i) {
|
|
314
|
+
if (o.isContextLost) return;
|
|
315
|
+
let [a] = i, s = d.get(a);
|
|
316
|
+
s && (--u[t], n(a, s), d.delete(a));
|
|
317
|
+
} : null;
|
|
318
|
+
}
|
|
319
|
+
function T(e, t, n, r, i) {
|
|
320
|
+
if (o.isContextLost) return;
|
|
321
|
+
let a = c.get(e);
|
|
322
|
+
if (!a) throw Error(`no renderbuffer bound to ${e}`);
|
|
323
|
+
let s = d.get(a);
|
|
324
|
+
if (!s) throw Error(`unknown renderbuffer ${a}`);
|
|
325
|
+
let u = p(n, r, i, 1) * t;
|
|
326
|
+
l.renderbuffer -= s.size, s.size = u, s.stackUpdated = x(), l.renderbuffer += u;
|
|
327
|
+
}
|
|
328
|
+
let E = 34963, D = 5121, O = 34067, k = 35866, A = 34069, j = /* @__PURE__ */ new Set([
|
|
329
|
+
A,
|
|
330
|
+
34070,
|
|
331
|
+
34071,
|
|
332
|
+
34072,
|
|
333
|
+
34073,
|
|
334
|
+
34074
|
|
335
|
+
]);
|
|
336
|
+
function M(e) {
|
|
337
|
+
return j.has(e);
|
|
338
|
+
}
|
|
339
|
+
function N(e) {
|
|
340
|
+
e = M(e) ? O : e;
|
|
341
|
+
let t = a(e), n = c.get(t);
|
|
342
|
+
if (!n) throw Error(`no texture bound to ${e} on unit ${o.activeTextureUnit - 33984}`);
|
|
343
|
+
let r = d.get(n);
|
|
344
|
+
if (!r) throw Error(`unknown texture ${n}`);
|
|
345
|
+
return r;
|
|
346
|
+
}
|
|
347
|
+
function P(e, t, n, r, i, a, o, s) {
|
|
348
|
+
let c = e.size, u = p(r, i, a, o, s), d = M(t) ? t - A : 0;
|
|
349
|
+
e.mips = e.mips || [], e.mips[n] = e.mips[n] || [];
|
|
350
|
+
let f = e.mips[n][d] || {};
|
|
351
|
+
e.size -= f.size || 0, f.size = u, f.internalFormat = r, f.type = s, f.width = i, f.height = a, f.depth = o, e.mips[n][d] = f, e.size += u, l.texture -= c, l.texture += e.size, e.stackUpdated = x();
|
|
352
|
+
}
|
|
353
|
+
function F(e, t, n, r, i, a) {
|
|
354
|
+
let o = N(e), s = e === O ? 6 : 1, c = e === O ? A : e;
|
|
355
|
+
for (let l = 0; l < t; ++l) {
|
|
356
|
+
for (let e = 0; e < s; ++e) P(o, c + e, l, n, r, i, a);
|
|
357
|
+
r = Math.ceil(Math.max(r / 2, 1)), i = Math.ceil(Math.max(i / 2, 1)), a = e === k ? a : Math.ceil(Math.max(a / 2, 1));
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
function I(e, t, n) {
|
|
361
|
+
if (o.isContextLost) return;
|
|
362
|
+
let [r] = n;
|
|
363
|
+
o.currentVertexArray = r || o.defaultVertexArray;
|
|
364
|
+
}
|
|
365
|
+
function L(e, t) {
|
|
366
|
+
if (!o.isContextLost) switch (e) {
|
|
367
|
+
case E: {
|
|
368
|
+
let e = d.get(o.currentVertexArray);
|
|
369
|
+
e.elementArrayBuffer = t;
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
default:
|
|
373
|
+
c.set(e, t);
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
let R = {}, z = {
|
|
378
|
+
bufferData(e, t, n) {
|
|
379
|
+
if (o.isContextLost) return;
|
|
380
|
+
let [r, i, , , a = void 0] = n, s;
|
|
381
|
+
switch (r) {
|
|
382
|
+
case E:
|
|
383
|
+
s = d.get(o.currentVertexArray).elementArrayBuffer;
|
|
384
|
+
break;
|
|
385
|
+
default:
|
|
386
|
+
s = c.get(r);
|
|
387
|
+
break;
|
|
388
|
+
}
|
|
389
|
+
if (!s) throw Error(`no buffer bound to ${r}`);
|
|
390
|
+
let u = 0;
|
|
391
|
+
if (a !== void 0) u = a * i.BYTES_PER_ELEMENT;
|
|
392
|
+
else if (h(i)) u = i.byteLength;
|
|
393
|
+
else if (y(i)) u = i;
|
|
394
|
+
else throw Error(`unsupported bufferData src type ${i}`);
|
|
395
|
+
let f = d.get(s);
|
|
396
|
+
if (!f) throw Error(`unknown buffer ${s}`);
|
|
397
|
+
l.buffer -= f.size, f.size = u, f.stackUpdated = x(), l.buffer += u;
|
|
398
|
+
},
|
|
399
|
+
bindVertexArray: I,
|
|
400
|
+
bindVertexArrayOES: I,
|
|
401
|
+
bindBuffer(e, t, n) {
|
|
402
|
+
let [r, i] = n;
|
|
403
|
+
L(r, i);
|
|
404
|
+
},
|
|
405
|
+
bindBufferBase(e, t, n) {
|
|
406
|
+
let [r, , i] = n;
|
|
407
|
+
L(r, i);
|
|
408
|
+
},
|
|
409
|
+
bindBufferRange(e, t, n) {
|
|
410
|
+
let [r, , i, ,] = n;
|
|
411
|
+
L(r, i);
|
|
412
|
+
},
|
|
413
|
+
bindRenderbuffer(e, t, n) {
|
|
414
|
+
if (o.isContextLost) return;
|
|
415
|
+
let [r, i] = n;
|
|
416
|
+
c.set(r, i);
|
|
417
|
+
},
|
|
418
|
+
activeTexture(e, t, n) {
|
|
419
|
+
if (o.isContextLost) return;
|
|
420
|
+
let [r] = n;
|
|
421
|
+
o.activeTextureUnit = r;
|
|
422
|
+
},
|
|
423
|
+
bindTexture(e, t, n) {
|
|
424
|
+
if (o.isContextLost) return;
|
|
425
|
+
let [r, i] = n, s = a(r);
|
|
426
|
+
c.set(s, i);
|
|
427
|
+
},
|
|
428
|
+
copyTexImage2D(e, t, n) {
|
|
429
|
+
if (o.isContextLost) return;
|
|
430
|
+
let [r, i, a, , , s, c] = n;
|
|
431
|
+
P(N(r), r, i, a, s, c, 1, D);
|
|
432
|
+
},
|
|
433
|
+
createBuffer: _(e, "buffer"),
|
|
434
|
+
createFramebuffer: _(e, "framebuffer"),
|
|
435
|
+
createRenderbuffer: _(e, "renderbuffer"),
|
|
436
|
+
createProgram: _(e, "program"),
|
|
437
|
+
createQuery: _(e, "query"),
|
|
438
|
+
createShader: _(e, "shader"),
|
|
439
|
+
createSampler: _(e, "sampler"),
|
|
440
|
+
createTexture: _(e, "texture"),
|
|
441
|
+
createTransformFeedback: _(e, "transformFeedback"),
|
|
442
|
+
createVertexArray: _(e, "vertexArray"),
|
|
443
|
+
createVertexArrayOES: _(e, "vertexArray", "createVertexArrayOES"),
|
|
444
|
+
compressedTexImage2D(e, t, n) {
|
|
445
|
+
if (o.isContextLost) return;
|
|
446
|
+
let [r, i, a, s, c] = n;
|
|
447
|
+
P(N(r), r, i, a, s, c, 1, D);
|
|
448
|
+
},
|
|
449
|
+
compressedTexImage3D(e, t, n) {
|
|
450
|
+
if (o.isContextLost) return;
|
|
451
|
+
let [r, i, a, s, c, l] = n;
|
|
452
|
+
P(N(r), r, i, a, s, c, l, D);
|
|
453
|
+
},
|
|
454
|
+
deleteBuffer: w("buffer", function(e, t) {
|
|
455
|
+
l.buffer -= t.size;
|
|
456
|
+
}),
|
|
457
|
+
deleteFramebuffer: w("framebuffer"),
|
|
458
|
+
deleteProgram: w("program"),
|
|
459
|
+
deleteQuery: w("query"),
|
|
460
|
+
deleteRenderbuffer: w("renderbuffer", function(e, t) {
|
|
461
|
+
l.renderbuffer -= t.size;
|
|
462
|
+
}),
|
|
463
|
+
deleteSampler: w("sampler"),
|
|
464
|
+
deleteShader: w("shader"),
|
|
465
|
+
deleteSync: w("sync"),
|
|
466
|
+
deleteTexture: w("texture", function(e, t) {
|
|
467
|
+
l.texture -= t.size;
|
|
468
|
+
}),
|
|
469
|
+
deleteTransformFeedback: w("transformFeedback"),
|
|
470
|
+
deleteVertexArray: w("vertexArray"),
|
|
471
|
+
deleteVertexArrayOES: w("vertexArray", m, "deleteVertexArrayOES"),
|
|
472
|
+
fenceSync: function(e) {
|
|
473
|
+
if (!o.isContextLost && e.fenceSync) return u.sync = 0, function(e, t, n, r) {
|
|
474
|
+
++u.sync, d.set(r, { size: 0 });
|
|
475
|
+
};
|
|
476
|
+
}(e),
|
|
477
|
+
generateMipmap(e, t, n) {
|
|
478
|
+
if (o.isContextLost) return;
|
|
479
|
+
let [r] = n, i = N(r), a = i.parameters && i.parameters.get(33084) || 0, s = i.parameters && i.parameters.get(33085) || 1024, c = i.mips[a][0], { width: l, height: u, depth: d } = c, { internalFormat: f, type: p } = c, m = a + 1, h = r === O ? 6 : 1, g = r === O ? A : r;
|
|
480
|
+
for (; m <= s && !(l === 1 && u === 1 && (d === 1 || r === k));) {
|
|
481
|
+
l = Math.ceil(Math.max(l / 2, 1)), u = Math.ceil(Math.max(u / 2, 1)), d = r === k ? d : Math.ceil(Math.max(d / 2, 1));
|
|
482
|
+
for (let e = 0; e < h; ++e) P(i, g + e, m, f, l, u, d, p);
|
|
483
|
+
++m;
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
getSupportedExtensions(e, t, n, r) {
|
|
487
|
+
o.isContextLost || r.push("GMAN_webgl_memory");
|
|
488
|
+
},
|
|
489
|
+
renderbufferStorage(e, t, n) {
|
|
490
|
+
let [r, i, a, o] = n;
|
|
491
|
+
T(r, 1, i, a, o);
|
|
492
|
+
},
|
|
493
|
+
renderbufferStorageMultisample(e, t, n) {
|
|
494
|
+
let [r, i, a, o, s] = n;
|
|
495
|
+
T(r, i, a, o, s);
|
|
496
|
+
},
|
|
497
|
+
texImage2D(e, t, n) {
|
|
498
|
+
if (o.isContextLost) return;
|
|
499
|
+
let [r, i, a] = n, s, c, l;
|
|
500
|
+
if (n.length === 6) {
|
|
501
|
+
let e = n[5];
|
|
502
|
+
s = e.width, c = e.height, l = n[4];
|
|
503
|
+
} else s = n[3], c = n[4], l = n[7];
|
|
504
|
+
P(N(r), r, i, a, s, c, 1, l);
|
|
505
|
+
},
|
|
506
|
+
texImage3D(e, t, n) {
|
|
507
|
+
if (o.isContextLost) return;
|
|
508
|
+
let [r, i, a, s, c, l, , , u] = n;
|
|
509
|
+
P(N(r), r, i, a, s, c, l, u);
|
|
510
|
+
},
|
|
511
|
+
texParameteri(e, t, n) {
|
|
512
|
+
if (o.isContextLost) return;
|
|
513
|
+
let [r, i, a] = n, s = N(r);
|
|
514
|
+
s.parameters = s.parameters || /* @__PURE__ */ new Map(), s.parameters.set(i, a);
|
|
515
|
+
},
|
|
516
|
+
texStorage2D(e, t, n) {
|
|
517
|
+
let [r, i, a, o, s] = n;
|
|
518
|
+
F(r, i, a, o, s, 1);
|
|
519
|
+
},
|
|
520
|
+
texStorage3D(e, t, n) {
|
|
521
|
+
let [r, i, a, o, s, c] = n;
|
|
522
|
+
F(r, i, a, o, s, c);
|
|
523
|
+
}
|
|
524
|
+
}, B = { getExtension(e, t) {
|
|
525
|
+
if (o.isContextLost) return;
|
|
526
|
+
let i = e[t];
|
|
527
|
+
e[t] = function(...t) {
|
|
528
|
+
let a = t[0].toLowerCase(), o = s[a];
|
|
529
|
+
if (o) return o.ctx;
|
|
530
|
+
let c = i.call(e, ...t);
|
|
531
|
+
return c && C(c, a, {
|
|
532
|
+
...n,
|
|
533
|
+
origGLErrorFn: r
|
|
534
|
+
}), c;
|
|
535
|
+
};
|
|
536
|
+
} };
|
|
537
|
+
function V(e, t) {
|
|
538
|
+
let n = e[t], i = R[t] || m, a = z[t] || m;
|
|
539
|
+
if (i === m && z === m) return;
|
|
540
|
+
e[t] = function(...r) {
|
|
541
|
+
i(e, t, r);
|
|
542
|
+
let o = n.call(e, ...r);
|
|
543
|
+
return a(e, t, r, o), o;
|
|
544
|
+
};
|
|
545
|
+
let o = B[t];
|
|
546
|
+
o && o(e, t, r);
|
|
547
|
+
}
|
|
548
|
+
for (let t in e) typeof e[t] == "function" && (f[t] = e[t], V(e, t));
|
|
549
|
+
s[t.toLowerCase()] = {
|
|
550
|
+
ctx: e,
|
|
551
|
+
origFuncs: f
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
function w(e) {
|
|
555
|
+
let t = e.prototype.getContext;
|
|
556
|
+
e.prototype.getContext = function(e, ...n) {
|
|
557
|
+
let r = t.call(this, e, ...n);
|
|
558
|
+
return r && r.bindTexture && (C(r, e, {}), r.getExtension("GMAN_webgl_memory")), r;
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
typeof HTMLCanvasElement < "u" && w(HTMLCanvasElement), typeof OffscreenCanvas < "u" && w(OffscreenCanvas);
|
|
562
|
+
}));
|
|
563
|
+
//#endregion
|
|
564
|
+
//#region ../renderer/src/debug/components/Panel.module.css
|
|
565
|
+
var u = /* @__PURE__ */ e(t(), 1), d = r(), f = {
|
|
566
|
+
info: "_info_hhyz2_1",
|
|
567
|
+
toggle: "_toggle_hhyz2_9",
|
|
568
|
+
container: "_container_hhyz2_26",
|
|
569
|
+
left: "_left_hhyz2_40",
|
|
570
|
+
right: "_right_hhyz2_44"
|
|
571
|
+
}, p = n();
|
|
572
|
+
function m(e) {
|
|
573
|
+
let t = (0, l.c)(17), { corner: n, label: r, value: i } = e, [a, o] = (0, u.useState)(!1), s;
|
|
574
|
+
t[0] === e ? s = t[1] : (s = function(t, n) {
|
|
575
|
+
return Array.isArray(n) ? `[${n.join(", ")}]` : e.replacer ? e.replacer(t, n) : n;
|
|
576
|
+
}, t[0] = e, t[1] = s);
|
|
577
|
+
let c = s, d;
|
|
578
|
+
t[2] !== a || t[3] !== c || t[4] !== i ? (d = function() {
|
|
579
|
+
if (!a) return "";
|
|
580
|
+
let e = i;
|
|
581
|
+
if (typeof i == "object" && i) {
|
|
582
|
+
let t = Object.keys(i);
|
|
583
|
+
e = t.length === 1 ? i[t[0]] : i;
|
|
584
|
+
}
|
|
585
|
+
return JSON.stringify(e, c, 2).replaceAll("\"", "");
|
|
586
|
+
}, t[2] = a, t[3] = c, t[4] = i, t[5] = d) : d = t[5];
|
|
587
|
+
let m = d, g = `${f.container} ${f[n]}`, _;
|
|
588
|
+
t[6] === Symbol.for("react.memo_cache_sentinel") ? (_ = () => o(h), t[6] = _) : _ = t[6];
|
|
589
|
+
let v = a ? "Hide" : "Show", y;
|
|
590
|
+
t[7] !== r || t[8] !== v ? (y = /* @__PURE__ */ (0, p.jsxs)("button", {
|
|
591
|
+
className: f.toggle,
|
|
592
|
+
onClick: _,
|
|
593
|
+
children: [
|
|
594
|
+
v,
|
|
595
|
+
" ",
|
|
596
|
+
r
|
|
597
|
+
]
|
|
598
|
+
}), t[7] = r, t[8] = v, t[9] = y) : y = t[9];
|
|
599
|
+
let b;
|
|
600
|
+
t[10] !== a || t[11] !== m ? (b = a && /* @__PURE__ */ (0, p.jsx)("div", {
|
|
601
|
+
className: f.info,
|
|
602
|
+
children: m()
|
|
603
|
+
}), t[10] = a, t[11] = m, t[12] = b) : b = t[12];
|
|
604
|
+
let x;
|
|
605
|
+
return t[13] !== g || t[14] !== y || t[15] !== b ? (x = /* @__PURE__ */ (0, p.jsxs)("div", {
|
|
606
|
+
className: g,
|
|
607
|
+
children: [y, b]
|
|
608
|
+
}), t[13] = g, t[14] = y, t[15] = b, t[16] = x) : x = t[16], x;
|
|
609
|
+
}
|
|
610
|
+
function h(e) {
|
|
611
|
+
return !e;
|
|
612
|
+
}
|
|
613
|
+
function g(e) {
|
|
614
|
+
let t = (0, l.c)(9), { corner: n, label: r, value: i, replacer: a } = e, [o] = (0, u.useState)(_), s = (0, u.useRef)(null), c = (0, u.useRef)(!1), f, h;
|
|
615
|
+
t[0] === o ? (f = t[1], h = t[2]) : (f = () => {
|
|
616
|
+
var e;
|
|
617
|
+
c.current = !1, document.body.appendChild(o);
|
|
618
|
+
let t = (e = s.current) == null ? (0, d.createRoot)(o) : e;
|
|
619
|
+
return s.current = t, () => {
|
|
620
|
+
o.remove(), c.current = !0, Promise.resolve().then(() => {
|
|
621
|
+
var e;
|
|
622
|
+
c.current && ((e = s.current) == null || e.unmount(), s.current = null);
|
|
623
|
+
});
|
|
624
|
+
};
|
|
625
|
+
}, h = [o], t[0] = o, t[1] = f, t[2] = h), (0, u.useEffect)(f, h);
|
|
626
|
+
let g, v;
|
|
627
|
+
return t[3] !== n || t[4] !== r || t[5] !== a || t[6] !== i ? (g = () => {
|
|
628
|
+
var e;
|
|
629
|
+
(e = s.current) == null || e.render(/* @__PURE__ */ (0, p.jsx)(m, {
|
|
630
|
+
corner: n,
|
|
631
|
+
label: r,
|
|
632
|
+
value: i,
|
|
633
|
+
replacer: a
|
|
634
|
+
}));
|
|
635
|
+
}, v = [
|
|
636
|
+
n,
|
|
637
|
+
r,
|
|
638
|
+
i,
|
|
639
|
+
a
|
|
640
|
+
], t[3] = n, t[4] = r, t[5] = a, t[6] = i, t[7] = g, t[8] = v) : (g = t[7], v = t[8]), (0, u.useEffect)(g, v), null;
|
|
641
|
+
}
|
|
642
|
+
function _() {
|
|
643
|
+
return document.createElement("div");
|
|
644
|
+
}
|
|
645
|
+
//#endregion
|
|
646
|
+
//#region ../renderer/src/debug/components/DebugPanelProvider.tsx
|
|
647
|
+
function v(e) {
|
|
648
|
+
let t = (0, l.c)(7), { children: n } = e, r;
|
|
649
|
+
t[0] === Symbol.for("react.memo_cache_sentinel") ? (r = {}, t[0] = r) : r = t[0];
|
|
650
|
+
let [i, a] = (0, u.useState)(r), o;
|
|
651
|
+
t[1] === Symbol.for("react.memo_cache_sentinel") ? (o = {
|
|
652
|
+
set(e, t) {
|
|
653
|
+
a((n) => e in n && Object.is(n[e], t) ? n : {
|
|
654
|
+
...n,
|
|
655
|
+
[e]: t
|
|
656
|
+
});
|
|
657
|
+
},
|
|
658
|
+
remove(e) {
|
|
659
|
+
a((t) => {
|
|
660
|
+
if (!(e in t)) return t;
|
|
661
|
+
let n = { ...t };
|
|
662
|
+
return delete n[e], n;
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
}, t[1] = o) : o = t[1];
|
|
666
|
+
let c = o, d;
|
|
667
|
+
t[2] === i ? d = t[3] : (d = /* @__PURE__ */ (0, p.jsx)(g, {
|
|
668
|
+
corner: "right",
|
|
669
|
+
label: "Debug",
|
|
670
|
+
value: i
|
|
671
|
+
}), t[2] = i, t[3] = d);
|
|
672
|
+
let f;
|
|
673
|
+
return t[4] !== n || t[5] !== d ? (f = /* @__PURE__ */ (0, p.jsxs)(s, {
|
|
674
|
+
value: c,
|
|
675
|
+
children: [n, d]
|
|
676
|
+
}), t[4] = n, t[5] = d, t[6] = f) : f = t[6], f;
|
|
677
|
+
}
|
|
678
|
+
//#endregion
|
|
679
|
+
//#region ../../node_modules/.pnpm/lil-gui@0.21.0/node_modules/lil-gui/dist/lil-gui.esm.js
|
|
680
|
+
var y = class e {
|
|
681
|
+
constructor(t, n, r, i, a = "div") {
|
|
682
|
+
this.parent = t, this.object = n, this.property = r, this._disabled = !1, this._hidden = !1, this.initialValue = this.getValue(), this.domElement = document.createElement(a), this.domElement.classList.add("lil-controller"), this.domElement.classList.add(i), this.$name = document.createElement("div"), this.$name.classList.add("lil-name"), e.nextNameID = e.nextNameID || 0, this.$name.id = `lil-gui-name-${++e.nextNameID}`, this.$widget = document.createElement("div"), this.$widget.classList.add("lil-widget"), this.$disable = this.$widget, this.domElement.appendChild(this.$name), this.domElement.appendChild(this.$widget), this.domElement.addEventListener("keydown", (e) => e.stopPropagation()), this.domElement.addEventListener("keyup", (e) => e.stopPropagation()), this.parent.children.push(this), this.parent.controllers.push(this), this.parent.$children.appendChild(this.domElement), this._listenCallback = this._listenCallback.bind(this), this.name(r);
|
|
683
|
+
}
|
|
684
|
+
name(e) {
|
|
685
|
+
return this._name = e, this.$name.textContent = e, this;
|
|
686
|
+
}
|
|
687
|
+
onChange(e) {
|
|
688
|
+
return this._onChange = e, this;
|
|
689
|
+
}
|
|
690
|
+
_callOnChange() {
|
|
691
|
+
this.parent._callOnChange(this), this._onChange !== void 0 && this._onChange.call(this, this.getValue()), this._changed = !0;
|
|
692
|
+
}
|
|
693
|
+
onFinishChange(e) {
|
|
694
|
+
return this._onFinishChange = e, this;
|
|
695
|
+
}
|
|
696
|
+
_callOnFinishChange() {
|
|
697
|
+
this._changed && (this.parent._callOnFinishChange(this), this._onFinishChange !== void 0 && this._onFinishChange.call(this, this.getValue())), this._changed = !1;
|
|
698
|
+
}
|
|
699
|
+
reset() {
|
|
700
|
+
return this.setValue(this.initialValue), this._callOnFinishChange(), this;
|
|
701
|
+
}
|
|
702
|
+
enable(e = !0) {
|
|
703
|
+
return this.disable(!e);
|
|
704
|
+
}
|
|
705
|
+
disable(e = !0) {
|
|
706
|
+
return e === this._disabled ? this : (this._disabled = e, this.domElement.classList.toggle("lil-disabled", e), this.$disable.toggleAttribute("disabled", e), this);
|
|
707
|
+
}
|
|
708
|
+
show(e = !0) {
|
|
709
|
+
return this._hidden = !e, this.domElement.style.display = this._hidden ? "none" : "", this;
|
|
710
|
+
}
|
|
711
|
+
hide() {
|
|
712
|
+
return this.show(!1);
|
|
713
|
+
}
|
|
714
|
+
options(e) {
|
|
715
|
+
let t = this.parent.add(this.object, this.property, e);
|
|
716
|
+
return t.name(this._name), this.destroy(), t;
|
|
717
|
+
}
|
|
718
|
+
min(e) {
|
|
719
|
+
return this;
|
|
720
|
+
}
|
|
721
|
+
max(e) {
|
|
722
|
+
return this;
|
|
723
|
+
}
|
|
724
|
+
step(e) {
|
|
725
|
+
return this;
|
|
726
|
+
}
|
|
727
|
+
decimals(e) {
|
|
728
|
+
return this;
|
|
729
|
+
}
|
|
730
|
+
listen(e = !0) {
|
|
731
|
+
return this._listening = e, this._listenCallbackID !== void 0 && (cancelAnimationFrame(this._listenCallbackID), this._listenCallbackID = void 0), this._listening && this._listenCallback(), this;
|
|
732
|
+
}
|
|
733
|
+
_listenCallback() {
|
|
734
|
+
this._listenCallbackID = requestAnimationFrame(this._listenCallback);
|
|
735
|
+
let e = this.save();
|
|
736
|
+
e !== this._listenPrevValue && this.updateDisplay(), this._listenPrevValue = e;
|
|
737
|
+
}
|
|
738
|
+
getValue() {
|
|
739
|
+
return this.object[this.property];
|
|
740
|
+
}
|
|
741
|
+
setValue(e) {
|
|
742
|
+
return this.getValue() !== e && (this.object[this.property] = e, this._callOnChange(), this.updateDisplay()), this;
|
|
743
|
+
}
|
|
744
|
+
updateDisplay() {
|
|
745
|
+
return this;
|
|
746
|
+
}
|
|
747
|
+
load(e) {
|
|
748
|
+
return this.setValue(e), this._callOnFinishChange(), this;
|
|
749
|
+
}
|
|
750
|
+
save() {
|
|
751
|
+
return this.getValue();
|
|
752
|
+
}
|
|
753
|
+
destroy() {
|
|
754
|
+
this.listen(!1), this.parent.children.splice(this.parent.children.indexOf(this), 1), this.parent.controllers.splice(this.parent.controllers.indexOf(this), 1), this.parent.$children.removeChild(this.domElement);
|
|
755
|
+
}
|
|
756
|
+
}, b = class extends y {
|
|
757
|
+
constructor(e, t, n) {
|
|
758
|
+
super(e, t, n, "lil-boolean", "label"), this.$input = document.createElement("input"), this.$input.setAttribute("type", "checkbox"), this.$input.setAttribute("aria-labelledby", this.$name.id), this.$widget.appendChild(this.$input), this.$input.addEventListener("change", () => {
|
|
759
|
+
this.setValue(this.$input.checked), this._callOnFinishChange();
|
|
760
|
+
}), this.$disable = this.$input, this.updateDisplay();
|
|
761
|
+
}
|
|
762
|
+
updateDisplay() {
|
|
763
|
+
return this.$input.checked = this.getValue(), this;
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
function x(e) {
|
|
767
|
+
let t, n;
|
|
768
|
+
return (t = e.match(/(#|0x)?([a-f0-9]{6})/i)) ? n = t[2] : (t = e.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/)) ? n = parseInt(t[1]).toString(16).padStart(2, 0) + parseInt(t[2]).toString(16).padStart(2, 0) + parseInt(t[3]).toString(16).padStart(2, 0) : (t = e.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i)) && (n = t[1] + t[1] + t[2] + t[2] + t[3] + t[3]), n ? "#" + n : !1;
|
|
769
|
+
}
|
|
770
|
+
var S = {
|
|
771
|
+
isPrimitive: !0,
|
|
772
|
+
match: (e) => typeof e == "string",
|
|
773
|
+
fromHexString: x,
|
|
774
|
+
toHexString: x
|
|
775
|
+
}, C = {
|
|
776
|
+
isPrimitive: !0,
|
|
777
|
+
match: (e) => typeof e == "number",
|
|
778
|
+
fromHexString: (e) => parseInt(e.substring(1), 16),
|
|
779
|
+
toHexString: (e) => "#" + e.toString(16).padStart(6, 0)
|
|
780
|
+
}, w = [
|
|
781
|
+
S,
|
|
782
|
+
C,
|
|
783
|
+
{
|
|
784
|
+
isPrimitive: !1,
|
|
785
|
+
match: (e) => Array.isArray(e) || ArrayBuffer.isView(e),
|
|
786
|
+
fromHexString(e, t, n = 1) {
|
|
787
|
+
let r = C.fromHexString(e);
|
|
788
|
+
t[0] = (r >> 16 & 255) / 255 * n, t[1] = (r >> 8 & 255) / 255 * n, t[2] = (r & 255) / 255 * n;
|
|
789
|
+
},
|
|
790
|
+
toHexString([e, t, n], r = 1) {
|
|
791
|
+
r = 255 / r;
|
|
792
|
+
let i = e * r << 16 ^ t * r << 8 ^ n * r << 0;
|
|
793
|
+
return C.toHexString(i);
|
|
794
|
+
}
|
|
795
|
+
},
|
|
796
|
+
{
|
|
797
|
+
isPrimitive: !1,
|
|
798
|
+
match: (e) => Object(e) === e,
|
|
799
|
+
fromHexString(e, t, n = 1) {
|
|
800
|
+
let r = C.fromHexString(e);
|
|
801
|
+
t.r = (r >> 16 & 255) / 255 * n, t.g = (r >> 8 & 255) / 255 * n, t.b = (r & 255) / 255 * n;
|
|
802
|
+
},
|
|
803
|
+
toHexString({ r: e, g: t, b: n }, r = 1) {
|
|
804
|
+
r = 255 / r;
|
|
805
|
+
let i = e * r << 16 ^ t * r << 8 ^ n * r << 0;
|
|
806
|
+
return C.toHexString(i);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
];
|
|
810
|
+
function T(e) {
|
|
811
|
+
return w.find((t) => t.match(e));
|
|
812
|
+
}
|
|
813
|
+
var E = class extends y {
|
|
814
|
+
constructor(e, t, n, r) {
|
|
815
|
+
super(e, t, n, "lil-color"), this.$input = document.createElement("input"), this.$input.setAttribute("type", "color"), this.$input.setAttribute("tabindex", -1), this.$input.setAttribute("aria-labelledby", this.$name.id), this.$text = document.createElement("input"), this.$text.setAttribute("type", "text"), this.$text.setAttribute("spellcheck", "false"), this.$text.setAttribute("aria-labelledby", this.$name.id), this.$display = document.createElement("div"), this.$display.classList.add("lil-display"), this.$display.appendChild(this.$input), this.$widget.appendChild(this.$display), this.$widget.appendChild(this.$text), this._format = T(this.initialValue), this._rgbScale = r, this._initialValueHexString = this.save(), this._textFocused = !1, this.$input.addEventListener("input", () => {
|
|
816
|
+
this._setValueFromHexString(this.$input.value);
|
|
817
|
+
}), this.$input.addEventListener("blur", () => {
|
|
818
|
+
this._callOnFinishChange();
|
|
819
|
+
}), this.$text.addEventListener("input", () => {
|
|
820
|
+
let e = x(this.$text.value);
|
|
821
|
+
e && this._setValueFromHexString(e);
|
|
822
|
+
}), this.$text.addEventListener("focus", () => {
|
|
823
|
+
this._textFocused = !0, this.$text.select();
|
|
824
|
+
}), this.$text.addEventListener("blur", () => {
|
|
825
|
+
this._textFocused = !1, this.updateDisplay(), this._callOnFinishChange();
|
|
826
|
+
}), this.$disable = this.$text, this.updateDisplay();
|
|
827
|
+
}
|
|
828
|
+
reset() {
|
|
829
|
+
return this._setValueFromHexString(this._initialValueHexString), this;
|
|
830
|
+
}
|
|
831
|
+
_setValueFromHexString(e) {
|
|
832
|
+
if (this._format.isPrimitive) {
|
|
833
|
+
let t = this._format.fromHexString(e);
|
|
834
|
+
this.setValue(t);
|
|
835
|
+
} else this._format.fromHexString(e, this.getValue(), this._rgbScale), this._callOnChange(), this.updateDisplay();
|
|
836
|
+
}
|
|
837
|
+
save() {
|
|
838
|
+
return this._format.toHexString(this.getValue(), this._rgbScale);
|
|
839
|
+
}
|
|
840
|
+
load(e) {
|
|
841
|
+
return this._setValueFromHexString(e), this._callOnFinishChange(), this;
|
|
842
|
+
}
|
|
843
|
+
updateDisplay() {
|
|
844
|
+
return this.$input.value = this._format.toHexString(this.getValue(), this._rgbScale), this._textFocused || (this.$text.value = this.$input.value.substring(1)), this.$display.style.backgroundColor = this.$input.value, this;
|
|
845
|
+
}
|
|
846
|
+
}, D = class extends y {
|
|
847
|
+
constructor(e, t, n) {
|
|
848
|
+
super(e, t, n, "lil-function"), this.$button = document.createElement("button"), this.$button.appendChild(this.$name), this.$widget.appendChild(this.$button), this.$button.addEventListener("click", (e) => {
|
|
849
|
+
e.preventDefault(), this.getValue().call(this.object), this._callOnChange();
|
|
850
|
+
}), this.$button.addEventListener("touchstart", () => {}, { passive: !0 }), this.$disable = this.$button;
|
|
851
|
+
}
|
|
852
|
+
}, O = class extends y {
|
|
853
|
+
constructor(e, t, n, r, i, a) {
|
|
854
|
+
super(e, t, n, "lil-number"), this._initInput(), this.min(r), this.max(i);
|
|
855
|
+
let o = a !== void 0;
|
|
856
|
+
this.step(o ? a : this._getImplicitStep(), o), this.updateDisplay();
|
|
857
|
+
}
|
|
858
|
+
decimals(e) {
|
|
859
|
+
return this._decimals = e, this.updateDisplay(), this;
|
|
860
|
+
}
|
|
861
|
+
min(e) {
|
|
862
|
+
return this._min = e, this._onUpdateMinMax(), this;
|
|
863
|
+
}
|
|
864
|
+
max(e) {
|
|
865
|
+
return this._max = e, this._onUpdateMinMax(), this;
|
|
866
|
+
}
|
|
867
|
+
step(e, t = !0) {
|
|
868
|
+
return this._step = e, this._stepExplicit = t, this;
|
|
869
|
+
}
|
|
870
|
+
updateDisplay() {
|
|
871
|
+
let e = this.getValue();
|
|
872
|
+
if (this._hasSlider) {
|
|
873
|
+
let t = (e - this._min) / (this._max - this._min);
|
|
874
|
+
t = Math.max(0, Math.min(t, 1)), this.$fill.style.width = t * 100 + "%";
|
|
875
|
+
}
|
|
876
|
+
return this._inputFocused || (this.$input.value = this._decimals === void 0 ? e : e.toFixed(this._decimals)), this;
|
|
877
|
+
}
|
|
878
|
+
_initInput() {
|
|
879
|
+
this.$input = document.createElement("input"), this.$input.setAttribute("type", "text"), this.$input.setAttribute("aria-labelledby", this.$name.id), window.matchMedia("(pointer: coarse)").matches && (this.$input.setAttribute("type", "number"), this.$input.setAttribute("step", "any")), this.$widget.appendChild(this.$input), this.$disable = this.$input;
|
|
880
|
+
let e = () => {
|
|
881
|
+
let e = parseFloat(this.$input.value);
|
|
882
|
+
isNaN(e) || (this._stepExplicit && (e = this._snap(e)), this.setValue(this._clamp(e)));
|
|
883
|
+
}, t = (e) => {
|
|
884
|
+
let t = parseFloat(this.$input.value);
|
|
885
|
+
isNaN(t) || (this._snapClampSetValue(t + e), this.$input.value = this.getValue());
|
|
886
|
+
}, n = (e) => {
|
|
887
|
+
e.key === "Enter" && this.$input.blur(), e.code === "ArrowUp" && (e.preventDefault(), t(this._step * this._arrowKeyMultiplier(e))), e.code === "ArrowDown" && (e.preventDefault(), t(this._step * this._arrowKeyMultiplier(e) * -1));
|
|
888
|
+
}, r = (e) => {
|
|
889
|
+
this._inputFocused && (e.preventDefault(), t(this._step * this._normalizeMouseWheel(e)));
|
|
890
|
+
}, i = !1, a, o, s, c, l, u = (e) => {
|
|
891
|
+
a = e.clientX, o = s = e.clientY, i = !0, c = this.getValue(), l = 0, window.addEventListener("mousemove", d), window.addEventListener("mouseup", f);
|
|
892
|
+
}, d = (e) => {
|
|
893
|
+
if (i) {
|
|
894
|
+
let t = e.clientX - a, n = e.clientY - o;
|
|
895
|
+
Math.abs(n) > 5 ? (e.preventDefault(), this.$input.blur(), i = !1, this._setDraggingStyle(!0, "vertical")) : Math.abs(t) > 5 && f();
|
|
896
|
+
}
|
|
897
|
+
if (!i) {
|
|
898
|
+
let t = e.clientY - s;
|
|
899
|
+
l -= t * this._step * this._arrowKeyMultiplier(e), c + l > this._max ? l = this._max - c : c + l < this._min && (l = this._min - c), this._snapClampSetValue(c + l);
|
|
900
|
+
}
|
|
901
|
+
s = e.clientY;
|
|
902
|
+
}, f = () => {
|
|
903
|
+
this._setDraggingStyle(!1, "vertical"), this._callOnFinishChange(), window.removeEventListener("mousemove", d), window.removeEventListener("mouseup", f);
|
|
904
|
+
};
|
|
905
|
+
this.$input.addEventListener("input", e), this.$input.addEventListener("keydown", n), this.$input.addEventListener("wheel", r, { passive: !1 }), this.$input.addEventListener("mousedown", u), this.$input.addEventListener("focus", () => {
|
|
906
|
+
this._inputFocused = !0;
|
|
907
|
+
}), this.$input.addEventListener("blur", () => {
|
|
908
|
+
this._inputFocused = !1, this.updateDisplay(), this._callOnFinishChange();
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
_initSlider() {
|
|
912
|
+
this._hasSlider = !0, this.$slider = document.createElement("div"), this.$slider.classList.add("lil-slider"), this.$fill = document.createElement("div"), this.$fill.classList.add("lil-fill"), this.$slider.appendChild(this.$fill), this.$widget.insertBefore(this.$slider, this.$input), this.domElement.classList.add("lil-has-slider");
|
|
913
|
+
let e = (e, t, n, r, i) => (e - t) / (n - t) * (i - r) + r, t = (t) => {
|
|
914
|
+
let n = this.$slider.getBoundingClientRect(), r = e(t, n.left, n.right, this._min, this._max);
|
|
915
|
+
this._snapClampSetValue(r);
|
|
916
|
+
}, n = (e) => {
|
|
917
|
+
this._setDraggingStyle(!0), t(e.clientX), window.addEventListener("mousemove", r), window.addEventListener("mouseup", i);
|
|
918
|
+
}, r = (e) => {
|
|
919
|
+
t(e.clientX);
|
|
920
|
+
}, i = () => {
|
|
921
|
+
this._callOnFinishChange(), this._setDraggingStyle(!1), window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", i);
|
|
922
|
+
}, a = !1, o, s, c = (e) => {
|
|
923
|
+
e.preventDefault(), this._setDraggingStyle(!0), t(e.touches[0].clientX), a = !1;
|
|
924
|
+
}, l = (e) => {
|
|
925
|
+
e.touches.length > 1 || (this._hasScrollBar ? (o = e.touches[0].clientX, s = e.touches[0].clientY, a = !0) : c(e), window.addEventListener("touchmove", u, { passive: !1 }), window.addEventListener("touchend", d));
|
|
926
|
+
}, u = (e) => {
|
|
927
|
+
if (a) {
|
|
928
|
+
let t = e.touches[0].clientX - o, n = e.touches[0].clientY - s;
|
|
929
|
+
Math.abs(t) > Math.abs(n) ? c(e) : (window.removeEventListener("touchmove", u), window.removeEventListener("touchend", d));
|
|
930
|
+
} else e.preventDefault(), t(e.touches[0].clientX);
|
|
931
|
+
}, d = () => {
|
|
932
|
+
this._callOnFinishChange(), this._setDraggingStyle(!1), window.removeEventListener("touchmove", u), window.removeEventListener("touchend", d);
|
|
933
|
+
}, f = this._callOnFinishChange.bind(this), p;
|
|
934
|
+
this.$slider.addEventListener("mousedown", n), this.$slider.addEventListener("touchstart", l, { passive: !1 }), this.$slider.addEventListener("wheel", (e) => {
|
|
935
|
+
if (Math.abs(e.deltaX) < Math.abs(e.deltaY) && this._hasScrollBar) return;
|
|
936
|
+
e.preventDefault();
|
|
937
|
+
let t = this._normalizeMouseWheel(e) * this._step;
|
|
938
|
+
this._snapClampSetValue(this.getValue() + t), this.$input.value = this.getValue(), clearTimeout(p), p = setTimeout(f, 400);
|
|
939
|
+
}, { passive: !1 });
|
|
940
|
+
}
|
|
941
|
+
_setDraggingStyle(e, t = "horizontal") {
|
|
942
|
+
this.$slider && this.$slider.classList.toggle("lil-active", e), document.body.classList.toggle("lil-dragging", e), document.body.classList.toggle(`lil-${t}`, e);
|
|
943
|
+
}
|
|
944
|
+
_getImplicitStep() {
|
|
945
|
+
return this._hasMin && this._hasMax ? (this._max - this._min) / 1e3 : .1;
|
|
946
|
+
}
|
|
947
|
+
_onUpdateMinMax() {
|
|
948
|
+
!this._hasSlider && this._hasMin && this._hasMax && (this._stepExplicit || this.step(this._getImplicitStep(), !1), this._initSlider(), this.updateDisplay());
|
|
949
|
+
}
|
|
950
|
+
_normalizeMouseWheel(e) {
|
|
951
|
+
let { deltaX: t, deltaY: n } = e;
|
|
952
|
+
return Math.floor(e.deltaY) !== e.deltaY && e.wheelDelta && (t = 0, n = -e.wheelDelta / 120, n *= this._stepExplicit ? 1 : 10), t + -n;
|
|
953
|
+
}
|
|
954
|
+
_arrowKeyMultiplier(e) {
|
|
955
|
+
let t = this._stepExplicit ? 1 : 10;
|
|
956
|
+
return e.shiftKey ? t *= 10 : e.altKey && (t /= 10), t;
|
|
957
|
+
}
|
|
958
|
+
_snap(e) {
|
|
959
|
+
let t = 0;
|
|
960
|
+
return this._hasMin ? t = this._min : this._hasMax && (t = this._max), e -= t, e = Math.round(e / this._step) * this._step, e += t, e = parseFloat(e.toPrecision(15)), e;
|
|
961
|
+
}
|
|
962
|
+
_clamp(e) {
|
|
963
|
+
return e < this._min && (e = this._min), e > this._max && (e = this._max), e;
|
|
964
|
+
}
|
|
965
|
+
_snapClampSetValue(e) {
|
|
966
|
+
this.setValue(this._clamp(this._snap(e)));
|
|
967
|
+
}
|
|
968
|
+
get _hasScrollBar() {
|
|
969
|
+
let e = this.parent.root.$children;
|
|
970
|
+
return e.scrollHeight > e.clientHeight;
|
|
971
|
+
}
|
|
972
|
+
get _hasMin() {
|
|
973
|
+
return this._min !== void 0;
|
|
974
|
+
}
|
|
975
|
+
get _hasMax() {
|
|
976
|
+
return this._max !== void 0;
|
|
977
|
+
}
|
|
978
|
+
}, k = class extends y {
|
|
979
|
+
constructor(e, t, n, r) {
|
|
980
|
+
super(e, t, n, "lil-option"), this.$select = document.createElement("select"), this.$select.setAttribute("aria-labelledby", this.$name.id), this.$display = document.createElement("div"), this.$display.classList.add("lil-display"), this.$select.addEventListener("change", () => {
|
|
981
|
+
this.setValue(this._values[this.$select.selectedIndex]), this._callOnFinishChange();
|
|
982
|
+
}), this.$select.addEventListener("focus", () => {
|
|
983
|
+
this.$display.classList.add("lil-focus");
|
|
984
|
+
}), this.$select.addEventListener("blur", () => {
|
|
985
|
+
this.$display.classList.remove("lil-focus");
|
|
986
|
+
}), this.$widget.appendChild(this.$select), this.$widget.appendChild(this.$display), this.$disable = this.$select, this.options(r);
|
|
987
|
+
}
|
|
988
|
+
options(e) {
|
|
989
|
+
return this._values = Array.isArray(e) ? e : Object.values(e), this._names = Array.isArray(e) ? e : Object.keys(e), this.$select.replaceChildren(), this._names.forEach((e) => {
|
|
990
|
+
let t = document.createElement("option");
|
|
991
|
+
t.textContent = e, this.$select.appendChild(t);
|
|
992
|
+
}), this.updateDisplay(), this;
|
|
993
|
+
}
|
|
994
|
+
updateDisplay() {
|
|
995
|
+
let e = this.getValue(), t = this._values.indexOf(e);
|
|
996
|
+
return this.$select.selectedIndex = t, this.$display.textContent = t === -1 ? e : this._names[t], this;
|
|
997
|
+
}
|
|
998
|
+
}, A = class extends y {
|
|
999
|
+
constructor(e, t, n) {
|
|
1000
|
+
super(e, t, n, "lil-string"), this.$input = document.createElement("input"), this.$input.setAttribute("type", "text"), this.$input.setAttribute("spellcheck", "false"), this.$input.setAttribute("aria-labelledby", this.$name.id), this.$input.addEventListener("input", () => {
|
|
1001
|
+
this.setValue(this.$input.value);
|
|
1002
|
+
}), this.$input.addEventListener("keydown", (e) => {
|
|
1003
|
+
e.code === "Enter" && this.$input.blur();
|
|
1004
|
+
}), this.$input.addEventListener("blur", () => {
|
|
1005
|
+
this._callOnFinishChange();
|
|
1006
|
+
}), this.$widget.appendChild(this.$input), this.$disable = this.$input, this.updateDisplay();
|
|
1007
|
+
}
|
|
1008
|
+
updateDisplay() {
|
|
1009
|
+
return this.$input.value = this.getValue(), this;
|
|
1010
|
+
}
|
|
1011
|
+
}, j = ".lil-gui {\n font-family: var(--font-family);\n font-size: var(--font-size);\n line-height: 1;\n font-weight: normal;\n font-style: normal;\n text-align: left;\n color: var(--text-color);\n user-select: none;\n -webkit-user-select: none;\n touch-action: manipulation;\n --background-color: #1f1f1f;\n --text-color: #ebebeb;\n --title-background-color: #111111;\n --title-text-color: #ebebeb;\n --widget-color: #424242;\n --hover-color: #4f4f4f;\n --focus-color: #595959;\n --number-color: #2cc9ff;\n --string-color: #a2db3c;\n --font-size: 11px;\n --input-font-size: 11px;\n --font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Arial, sans-serif;\n --font-family-mono: Menlo, Monaco, Consolas, \"Droid Sans Mono\", monospace;\n --padding: 4px;\n --spacing: 4px;\n --widget-height: 20px;\n --title-height: calc(var(--widget-height) + var(--spacing) * 1.25);\n --name-width: 45%;\n --slider-knob-width: 2px;\n --slider-input-width: 27%;\n --color-input-width: 27%;\n --slider-input-min-width: 45px;\n --color-input-min-width: 45px;\n --folder-indent: 7px;\n --widget-padding: 0 0 0 3px;\n --widget-border-radius: 2px;\n --checkbox-size: calc(0.75 * var(--widget-height));\n --scrollbar-width: 5px;\n}\n.lil-gui, .lil-gui * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n}\n.lil-gui.lil-root {\n width: var(--width, 245px);\n display: flex;\n flex-direction: column;\n background: var(--background-color);\n}\n.lil-gui.lil-root > .lil-title {\n background: var(--title-background-color);\n color: var(--title-text-color);\n}\n.lil-gui.lil-root > .lil-children {\n overflow-x: hidden;\n overflow-y: auto;\n}\n.lil-gui.lil-root > .lil-children::-webkit-scrollbar {\n width: var(--scrollbar-width);\n height: var(--scrollbar-width);\n background: var(--background-color);\n}\n.lil-gui.lil-root > .lil-children::-webkit-scrollbar-thumb {\n border-radius: var(--scrollbar-width);\n background: var(--focus-color);\n}\n@media (pointer: coarse) {\n .lil-gui.lil-allow-touch-styles, .lil-gui.lil-allow-touch-styles .lil-gui {\n --widget-height: 28px;\n --padding: 6px;\n --spacing: 6px;\n --font-size: 13px;\n --input-font-size: 16px;\n --folder-indent: 10px;\n --scrollbar-width: 7px;\n --slider-input-min-width: 50px;\n --color-input-min-width: 65px;\n }\n}\n.lil-gui.lil-force-touch-styles, .lil-gui.lil-force-touch-styles .lil-gui {\n --widget-height: 28px;\n --padding: 6px;\n --spacing: 6px;\n --font-size: 13px;\n --input-font-size: 16px;\n --folder-indent: 10px;\n --scrollbar-width: 7px;\n --slider-input-min-width: 50px;\n --color-input-min-width: 65px;\n}\n.lil-gui.lil-auto-place, .lil-gui.autoPlace {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 1001;\n}\n\n.lil-controller {\n display: flex;\n align-items: center;\n padding: 0 var(--padding);\n margin: var(--spacing) 0;\n}\n.lil-controller.lil-disabled {\n opacity: 0.5;\n}\n.lil-controller.lil-disabled, .lil-controller.lil-disabled * {\n pointer-events: none !important;\n}\n.lil-controller > .lil-name {\n min-width: var(--name-width);\n flex-shrink: 0;\n white-space: pre;\n padding-right: var(--spacing);\n line-height: var(--widget-height);\n}\n.lil-controller .lil-widget {\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n min-height: var(--widget-height);\n}\n.lil-controller.lil-string input {\n color: var(--string-color);\n}\n.lil-controller.lil-boolean {\n cursor: pointer;\n}\n.lil-controller.lil-color .lil-display {\n width: 100%;\n height: var(--widget-height);\n border-radius: var(--widget-border-radius);\n position: relative;\n}\n@media (hover: hover) {\n .lil-controller.lil-color .lil-display:hover:before {\n content: \" \";\n display: block;\n position: absolute;\n border-radius: var(--widget-border-radius);\n border: 1px solid #fff9;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n }\n}\n.lil-controller.lil-color input[type=color] {\n opacity: 0;\n width: 100%;\n height: 100%;\n cursor: pointer;\n}\n.lil-controller.lil-color input[type=text] {\n margin-left: var(--spacing);\n font-family: var(--font-family-mono);\n min-width: var(--color-input-min-width);\n width: var(--color-input-width);\n flex-shrink: 0;\n}\n.lil-controller.lil-option select {\n opacity: 0;\n position: absolute;\n width: 100%;\n max-width: 100%;\n}\n.lil-controller.lil-option .lil-display {\n position: relative;\n pointer-events: none;\n border-radius: var(--widget-border-radius);\n height: var(--widget-height);\n line-height: var(--widget-height);\n max-width: 100%;\n overflow: hidden;\n word-break: break-all;\n padding-left: 0.55em;\n padding-right: 1.75em;\n background: var(--widget-color);\n}\n@media (hover: hover) {\n .lil-controller.lil-option .lil-display.lil-focus {\n background: var(--focus-color);\n }\n}\n.lil-controller.lil-option .lil-display.lil-active {\n background: var(--focus-color);\n}\n.lil-controller.lil-option .lil-display:after {\n font-family: \"lil-gui\";\n content: \"↕\";\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n padding-right: 0.375em;\n}\n.lil-controller.lil-option .lil-widget,\n.lil-controller.lil-option select {\n cursor: pointer;\n}\n@media (hover: hover) {\n .lil-controller.lil-option .lil-widget:hover .lil-display {\n background: var(--hover-color);\n }\n}\n.lil-controller.lil-number input {\n color: var(--number-color);\n}\n.lil-controller.lil-number.lil-has-slider input {\n margin-left: var(--spacing);\n width: var(--slider-input-width);\n min-width: var(--slider-input-min-width);\n flex-shrink: 0;\n}\n.lil-controller.lil-number .lil-slider {\n width: 100%;\n height: var(--widget-height);\n background: var(--widget-color);\n border-radius: var(--widget-border-radius);\n padding-right: var(--slider-knob-width);\n overflow: hidden;\n cursor: ew-resize;\n touch-action: pan-y;\n}\n@media (hover: hover) {\n .lil-controller.lil-number .lil-slider:hover {\n background: var(--hover-color);\n }\n}\n.lil-controller.lil-number .lil-slider.lil-active {\n background: var(--focus-color);\n}\n.lil-controller.lil-number .lil-slider.lil-active .lil-fill {\n opacity: 0.95;\n}\n.lil-controller.lil-number .lil-fill {\n height: 100%;\n border-right: var(--slider-knob-width) solid var(--number-color);\n box-sizing: content-box;\n}\n\n.lil-dragging .lil-gui {\n --hover-color: var(--widget-color);\n}\n.lil-dragging * {\n cursor: ew-resize !important;\n}\n.lil-dragging.lil-vertical * {\n cursor: ns-resize !important;\n}\n\n.lil-gui .lil-title {\n height: var(--title-height);\n font-weight: 600;\n padding: 0 var(--padding);\n width: 100%;\n text-align: left;\n background: none;\n text-decoration-skip: objects;\n}\n.lil-gui .lil-title:before {\n font-family: \"lil-gui\";\n content: \"▾\";\n padding-right: 2px;\n display: inline-block;\n}\n.lil-gui .lil-title:active {\n background: var(--title-background-color);\n opacity: 0.75;\n}\n@media (hover: hover) {\n body:not(.lil-dragging) .lil-gui .lil-title:hover {\n background: var(--title-background-color);\n opacity: 0.85;\n }\n .lil-gui .lil-title:focus {\n text-decoration: underline var(--focus-color);\n }\n}\n.lil-gui.lil-root > .lil-title:focus {\n text-decoration: none !important;\n}\n.lil-gui.lil-closed > .lil-title:before {\n content: \"▸\";\n}\n.lil-gui.lil-closed > .lil-children {\n transform: translateY(-7px);\n opacity: 0;\n}\n.lil-gui.lil-closed:not(.lil-transition) > .lil-children {\n display: none;\n}\n.lil-gui.lil-transition > .lil-children {\n transition-duration: 300ms;\n transition-property: height, opacity, transform;\n transition-timing-function: cubic-bezier(0.2, 0.6, 0.35, 1);\n overflow: hidden;\n pointer-events: none;\n}\n.lil-gui .lil-children:empty:before {\n content: \"Empty\";\n padding: 0 var(--padding);\n margin: var(--spacing) 0;\n display: block;\n height: var(--widget-height);\n font-style: italic;\n line-height: var(--widget-height);\n opacity: 0.5;\n}\n.lil-gui.lil-root > .lil-children > .lil-gui > .lil-title {\n border: 0 solid var(--widget-color);\n border-width: 1px 0;\n transition: border-color 300ms;\n}\n.lil-gui.lil-root > .lil-children > .lil-gui.lil-closed > .lil-title {\n border-bottom-color: transparent;\n}\n.lil-gui + .lil-controller {\n border-top: 1px solid var(--widget-color);\n margin-top: 0;\n padding-top: var(--spacing);\n}\n.lil-gui .lil-gui .lil-gui > .lil-title {\n border: none;\n}\n.lil-gui .lil-gui .lil-gui > .lil-children {\n border: none;\n margin-left: var(--folder-indent);\n border-left: 2px solid var(--widget-color);\n}\n.lil-gui .lil-gui .lil-controller {\n border: none;\n}\n\n.lil-gui label, .lil-gui input, .lil-gui button {\n -webkit-tap-highlight-color: transparent;\n}\n.lil-gui input {\n border: 0;\n outline: none;\n font-family: var(--font-family);\n font-size: var(--input-font-size);\n border-radius: var(--widget-border-radius);\n height: var(--widget-height);\n background: var(--widget-color);\n color: var(--text-color);\n width: 100%;\n}\n@media (hover: hover) {\n .lil-gui input:hover {\n background: var(--hover-color);\n }\n .lil-gui input:active {\n background: var(--focus-color);\n }\n}\n.lil-gui input:disabled {\n opacity: 1;\n}\n.lil-gui input[type=text],\n.lil-gui input[type=number] {\n padding: var(--widget-padding);\n -moz-appearance: textfield;\n}\n.lil-gui input[type=text]:focus,\n.lil-gui input[type=number]:focus {\n background: var(--focus-color);\n}\n.lil-gui input[type=checkbox] {\n appearance: none;\n width: var(--checkbox-size);\n height: var(--checkbox-size);\n border-radius: var(--widget-border-radius);\n text-align: center;\n cursor: pointer;\n}\n.lil-gui input[type=checkbox]:checked:before {\n font-family: \"lil-gui\";\n content: \"✓\";\n font-size: var(--checkbox-size);\n line-height: var(--checkbox-size);\n}\n@media (hover: hover) {\n .lil-gui input[type=checkbox]:focus {\n box-shadow: inset 0 0 0 1px var(--focus-color);\n }\n}\n.lil-gui button {\n outline: none;\n cursor: pointer;\n font-family: var(--font-family);\n font-size: var(--font-size);\n color: var(--text-color);\n width: 100%;\n border: none;\n}\n.lil-gui .lil-controller button {\n height: var(--widget-height);\n text-transform: none;\n background: var(--widget-color);\n border-radius: var(--widget-border-radius);\n}\n@media (hover: hover) {\n .lil-gui .lil-controller button:hover {\n background: var(--hover-color);\n }\n .lil-gui .lil-controller button:focus {\n box-shadow: inset 0 0 0 1px var(--focus-color);\n }\n}\n.lil-gui .lil-controller button:active {\n background: var(--focus-color);\n}\n\n@font-face {\n font-family: \"lil-gui\";\n src: url(\"data:application/font-woff2;charset=utf-8;base64,d09GMgABAAAAAALkAAsAAAAABtQAAAKVAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACDMgqBBIEbATYCJAMUCwwABCAFhAoHgQQbHAbIDiUFEYVARAAAYQTVWNmz9MxhEgodq49wYRUFKE8GWNiUBxI2LBRaVnc51U83Gmhs0Q7JXWMiz5eteLwrKwuxHO8VFxUX9UpZBs6pa5ABRwHA+t3UxUnH20EvVknRerzQgX6xC/GH6ZUvTcAjAv122dF28OTqCXrPuyaDER30YBA1xnkVutDDo4oCi71Ca7rrV9xS8dZHbPHefsuwIyCpmT7j+MnjAH5X3984UZoFFuJ0yiZ4XEJFxjagEBeqs+e1iyK8Xf/nOuwF+vVK0ur765+vf7txotUi0m3N0m/84RGSrBCNrh8Ee5GjODjF4gnWP+dJrH/Lk9k4oT6d+gr6g/wssA2j64JJGP6cmx554vUZnpZfn6ZfX2bMwPPrlANsB86/DiHjhl0OP+c87+gaJo/gY084s3HoYL/ZkWHTRfBXvvoHnnkHvngKun4KBE/ede7tvq3/vQOxDXB1/fdNz6XbPdcr0Vhpojj9dG+owuSKFsslCi1tgEjirjXdwMiov2EioadxmqTHUCIwo8NgQaeIasAi0fTYSPTbSmwbMOFduyh9wvBrESGY0MtgRjtgQR8Q1bRPohn2UoCRZf9wyYANMXFeJTysqAe0I4mrherOekFdKMrYvJjLvOIUM9SuwYB5DVZUwwVjJJOaUnZCmcEkIZZrKqNvRGRMvmFZsmhP4VMKCSXBhSqUBxgMS7h0cZvEd71AWkEhGWaeMFcNnpqyJkyXgYL7PQ1MoSq0wDAkRtJIijkZSmqYTiSImfLiSWXIZwhRh3Rug2X0kk1Dgj+Iu43u5p98ghopcpSo0Uyc8SnjlYX59WUeaMoDqmVD2TOWD9a4pCRAzf2ECgwGcrHjPOWY9bNxq/OL3I/QjwEAAAA=\") format(\"woff2\");\n}";
|
|
1012
|
+
function M(e) {
|
|
1013
|
+
let t = document.createElement("style");
|
|
1014
|
+
t.innerHTML = e;
|
|
1015
|
+
let n = document.querySelector("head link[rel=stylesheet], head style");
|
|
1016
|
+
n ? document.head.insertBefore(t, n) : document.head.appendChild(t);
|
|
1017
|
+
}
|
|
1018
|
+
var N = !1, P = class e {
|
|
1019
|
+
constructor({ parent: e, autoPlace: t = e === void 0, container: n, width: r, title: i = "Controls", closeFolders: a = !1, injectStyles: o = !0, touchStyles: s = !0 } = {}) {
|
|
1020
|
+
if (this.parent = e, this.root = e ? e.root : this, this.children = [], this.controllers = [], this.folders = [], this._closed = !1, this._hidden = !1, this.domElement = document.createElement("div"), this.domElement.classList.add("lil-gui"), this.$title = document.createElement("button"), this.$title.classList.add("lil-title"), this.$title.setAttribute("aria-expanded", !0), this.$title.addEventListener("click", () => this.openAnimated(this._closed)), this.$title.addEventListener("touchstart", () => {}, { passive: !0 }), this.$children = document.createElement("div"), this.$children.classList.add("lil-children"), this.domElement.appendChild(this.$title), this.domElement.appendChild(this.$children), this.title(i), this.parent) {
|
|
1021
|
+
this.parent.children.push(this), this.parent.folders.push(this), this.parent.$children.appendChild(this.domElement);
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
1024
|
+
this.domElement.classList.add("lil-root"), s && this.domElement.classList.add("lil-allow-touch-styles"), !N && o && (M(j), N = !0), n ? n.appendChild(this.domElement) : t && (this.domElement.classList.add("lil-auto-place", "autoPlace"), document.body.appendChild(this.domElement)), r && this.domElement.style.setProperty("--width", r + "px"), this._closeFolders = a;
|
|
1025
|
+
}
|
|
1026
|
+
add(e, t, n, r, i) {
|
|
1027
|
+
if (Object(n) === n) return new k(this, e, t, n);
|
|
1028
|
+
let a = e[t];
|
|
1029
|
+
switch (typeof a) {
|
|
1030
|
+
case "number": return new O(this, e, t, n, r, i);
|
|
1031
|
+
case "boolean": return new b(this, e, t);
|
|
1032
|
+
case "string": return new A(this, e, t);
|
|
1033
|
+
case "function": return new D(this, e, t);
|
|
1034
|
+
}
|
|
1035
|
+
console.error("gui.add failed\n property:", t, "\n object:", e, "\n value:", a);
|
|
1036
|
+
}
|
|
1037
|
+
addColor(e, t, n = 1) {
|
|
1038
|
+
return new E(this, e, t, n);
|
|
1039
|
+
}
|
|
1040
|
+
addFolder(t) {
|
|
1041
|
+
let n = new e({
|
|
1042
|
+
parent: this,
|
|
1043
|
+
title: t
|
|
1044
|
+
});
|
|
1045
|
+
return this.root._closeFolders && n.close(), n;
|
|
1046
|
+
}
|
|
1047
|
+
load(e, t = !0) {
|
|
1048
|
+
return e.controllers && this.controllers.forEach((t) => {
|
|
1049
|
+
t instanceof D || t._name in e.controllers && t.load(e.controllers[t._name]);
|
|
1050
|
+
}), t && e.folders && this.folders.forEach((t) => {
|
|
1051
|
+
t._title in e.folders && t.load(e.folders[t._title]);
|
|
1052
|
+
}), this;
|
|
1053
|
+
}
|
|
1054
|
+
save(e = !0) {
|
|
1055
|
+
let t = {
|
|
1056
|
+
controllers: {},
|
|
1057
|
+
folders: {}
|
|
1058
|
+
};
|
|
1059
|
+
return this.controllers.forEach((e) => {
|
|
1060
|
+
if (!(e instanceof D)) {
|
|
1061
|
+
if (e._name in t.controllers) throw Error(`Cannot save GUI with duplicate property "${e._name}"`);
|
|
1062
|
+
t.controllers[e._name] = e.save();
|
|
1063
|
+
}
|
|
1064
|
+
}), e && this.folders.forEach((e) => {
|
|
1065
|
+
if (e._title in t.folders) throw Error(`Cannot save GUI with duplicate folder "${e._title}"`);
|
|
1066
|
+
t.folders[e._title] = e.save();
|
|
1067
|
+
}), t;
|
|
1068
|
+
}
|
|
1069
|
+
open(e = !0) {
|
|
1070
|
+
return this._setClosed(!e), this.$title.setAttribute("aria-expanded", !this._closed), this.domElement.classList.toggle("lil-closed", this._closed), this;
|
|
1071
|
+
}
|
|
1072
|
+
close() {
|
|
1073
|
+
return this.open(!1);
|
|
1074
|
+
}
|
|
1075
|
+
_setClosed(e) {
|
|
1076
|
+
this._closed !== e && (this._closed = e, this._callOnOpenClose(this));
|
|
1077
|
+
}
|
|
1078
|
+
show(e = !0) {
|
|
1079
|
+
return this._hidden = !e, this.domElement.style.display = this._hidden ? "none" : "", this;
|
|
1080
|
+
}
|
|
1081
|
+
hide() {
|
|
1082
|
+
return this.show(!1);
|
|
1083
|
+
}
|
|
1084
|
+
openAnimated(e = !0) {
|
|
1085
|
+
return this._setClosed(!e), this.$title.setAttribute("aria-expanded", !this._closed), requestAnimationFrame(() => {
|
|
1086
|
+
let t = this.$children.clientHeight;
|
|
1087
|
+
this.$children.style.height = t + "px", this.domElement.classList.add("lil-transition");
|
|
1088
|
+
let n = (e) => {
|
|
1089
|
+
e.target === this.$children && (this.$children.style.height = "", this.domElement.classList.remove("lil-transition"), this.$children.removeEventListener("transitionend", n));
|
|
1090
|
+
};
|
|
1091
|
+
this.$children.addEventListener("transitionend", n);
|
|
1092
|
+
let r = e ? this.$children.scrollHeight : 0;
|
|
1093
|
+
this.domElement.classList.toggle("lil-closed", !e), requestAnimationFrame(() => {
|
|
1094
|
+
this.$children.style.height = r + "px";
|
|
1095
|
+
});
|
|
1096
|
+
}), this;
|
|
1097
|
+
}
|
|
1098
|
+
title(e) {
|
|
1099
|
+
return this._title = e, this.$title.textContent = e, this;
|
|
1100
|
+
}
|
|
1101
|
+
reset(e = !0) {
|
|
1102
|
+
return (e ? this.controllersRecursive() : this.controllers).forEach((e) => e.reset()), this;
|
|
1103
|
+
}
|
|
1104
|
+
onChange(e) {
|
|
1105
|
+
return this._onChange = e, this;
|
|
1106
|
+
}
|
|
1107
|
+
_callOnChange(e) {
|
|
1108
|
+
this.parent && this.parent._callOnChange(e), this._onChange !== void 0 && this._onChange.call(this, {
|
|
1109
|
+
object: e.object,
|
|
1110
|
+
property: e.property,
|
|
1111
|
+
value: e.getValue(),
|
|
1112
|
+
controller: e
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
onFinishChange(e) {
|
|
1116
|
+
return this._onFinishChange = e, this;
|
|
1117
|
+
}
|
|
1118
|
+
_callOnFinishChange(e) {
|
|
1119
|
+
this.parent && this.parent._callOnFinishChange(e), this._onFinishChange !== void 0 && this._onFinishChange.call(this, {
|
|
1120
|
+
object: e.object,
|
|
1121
|
+
property: e.property,
|
|
1122
|
+
value: e.getValue(),
|
|
1123
|
+
controller: e
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
onOpenClose(e) {
|
|
1127
|
+
return this._onOpenClose = e, this;
|
|
1128
|
+
}
|
|
1129
|
+
_callOnOpenClose(e) {
|
|
1130
|
+
this.parent && this.parent._callOnOpenClose(e), this._onOpenClose !== void 0 && this._onOpenClose.call(this, e);
|
|
1131
|
+
}
|
|
1132
|
+
destroy() {
|
|
1133
|
+
this.parent && (this.parent.children.splice(this.parent.children.indexOf(this), 1), this.parent.folders.splice(this.parent.folders.indexOf(this), 1)), this.domElement.parentElement && this.domElement.parentElement.removeChild(this.domElement), Array.from(this.children).forEach((e) => e.destroy());
|
|
1134
|
+
}
|
|
1135
|
+
controllersRecursive() {
|
|
1136
|
+
let e = Array.from(this.controllers);
|
|
1137
|
+
return this.folders.forEach((t) => {
|
|
1138
|
+
e = e.concat(t.controllersRecursive());
|
|
1139
|
+
}), e;
|
|
1140
|
+
}
|
|
1141
|
+
foldersRecursive() {
|
|
1142
|
+
let e = Array.from(this.folders);
|
|
1143
|
+
return this.folders.forEach((t) => {
|
|
1144
|
+
e = e.concat(t.foldersRecursive());
|
|
1145
|
+
}), e;
|
|
1146
|
+
}
|
|
1147
|
+
};
|
|
1148
|
+
//#endregion
|
|
1149
|
+
//#region ../renderer/src/debug/components/Gui.tsx
|
|
1150
|
+
function F(e) {
|
|
1151
|
+
let t = (0, l.c)(6), { children: n } = e, [r] = (0, u.useState)(I), i, a;
|
|
1152
|
+
t[0] === r ? (i = t[1], a = t[2]) : (i = () => (r.domElement.classList.add("lil-auto-place", "autoPlace"), document.body.appendChild(r.domElement), r.close(), () => r.destroy()), a = [r], t[0] = r, t[1] = i, t[2] = a), (0, u.useEffect)(i, a);
|
|
1153
|
+
let s;
|
|
1154
|
+
return t[3] !== n || t[4] !== r ? (s = /* @__PURE__ */ (0, p.jsx)(o, {
|
|
1155
|
+
value: r,
|
|
1156
|
+
children: n
|
|
1157
|
+
}), t[3] = n, t[4] = r, t[5] = s) : s = t[5], s;
|
|
1158
|
+
}
|
|
1159
|
+
function I() {
|
|
1160
|
+
return new P({
|
|
1161
|
+
autoPlace: !1,
|
|
1162
|
+
closeFolders: !0
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
//#endregion
|
|
1166
|
+
//#region ../renderer/src/debug/components/MemoryInfo.tsx
|
|
1167
|
+
function L() {
|
|
1168
|
+
let e = (0, l.c)(5), t = c(R), [n, r] = (0, u.useState)(null), a, o;
|
|
1169
|
+
e[0] === t ? (a = e[1], o = e[2]) : (a = () => {
|
|
1170
|
+
let e = t.getContext().getExtension("GMAN_webgl_memory");
|
|
1171
|
+
if (e) return i(() => {
|
|
1172
|
+
r({
|
|
1173
|
+
...e.getMemoryInfo(),
|
|
1174
|
+
drawCalls: t.info.render.calls
|
|
1175
|
+
});
|
|
1176
|
+
});
|
|
1177
|
+
}, o = [t], e[0] = t, e[1] = a, e[2] = o), (0, u.useEffect)(a, o);
|
|
1178
|
+
let s;
|
|
1179
|
+
return e[3] === n ? s = e[4] : (s = /* @__PURE__ */ (0, p.jsx)(g, {
|
|
1180
|
+
corner: "left",
|
|
1181
|
+
label: "Memory Info",
|
|
1182
|
+
value: n,
|
|
1183
|
+
replacer: z
|
|
1184
|
+
}), e[3] = n, e[4] = s), s;
|
|
1185
|
+
}
|
|
1186
|
+
function R(e) {
|
|
1187
|
+
return e.gl;
|
|
1188
|
+
}
|
|
1189
|
+
function z(e, t) {
|
|
1190
|
+
return typeof t == "number" ? t.toLocaleString() : t;
|
|
1191
|
+
}
|
|
1192
|
+
//#endregion
|
|
1193
|
+
//#region ../../node_modules/.pnpm/stats-gl@4.2.3_three@0.185.1/node_modules/stats-gl/dist/core.js
|
|
1194
|
+
var B = class {
|
|
1195
|
+
constructor({ trackGPU: e = !1, trackCPT: t = !1, trackHz: n = !1, trackFPS: r = !0, logsPerSecond: i = 4, graphsPerSecond: a = 30, samplesLog: o = 40, samplesGraph: s = 10, precision: c = 2, maxTimestampPairs: l = 2048 } = {}) {
|
|
1196
|
+
this.gl = null, this.ext = null, this.gpuDevice = null, this.gpuBackend = null, this.renderer = null, this.activeQuery = null, this.gpuQueries = [], this.threeRendererPatched = !1, this.maxTimestampPairs = 2048, this.webgpuNative = !1, this.gpuQuerySet = null, this.gpuResolveBuffer = null, this.gpuTimestampBufferSize = 0, this.frameCursor = 0, this.slotTypes = [], this.readBufferPool = [], this.inFlightFrames = [], this.poolWarnThreshold = 8, this.warnedMapError = !1, this.warnedSlotOverflow = !1, this.warnedPoolGrowth = !1, this.frameTimes = [], this.frameTimesHead = 0, this.renderCount = 0, this.cpuStartTime = 0, this.isRunningCPUProfiling = !1, this.totalCpuDuration = 0, this.totalGpuDuration = 0, this.totalGpuDurationCompute = 0, this.averageFps = {
|
|
1197
|
+
logs: [],
|
|
1198
|
+
graph: []
|
|
1199
|
+
}, this.averageCpu = {
|
|
1200
|
+
logs: [],
|
|
1201
|
+
graph: []
|
|
1202
|
+
}, this.averageGpu = {
|
|
1203
|
+
logs: [],
|
|
1204
|
+
graph: []
|
|
1205
|
+
}, this.averageGpuCompute = {
|
|
1206
|
+
logs: [],
|
|
1207
|
+
graph: []
|
|
1208
|
+
}, this.trackGPU = e, this.trackCPT = t, this.trackHz = n, this.trackFPS = r, this.samplesLog = o, this.samplesGraph = s, this.precision = c, this.logsPerSecond = i, this.graphsPerSecond = a, this.maxTimestampPairs = Math.max(1, l);
|
|
1209
|
+
let u = performance.now();
|
|
1210
|
+
this.prevGraphTime = u, this.beginTime = u, this.prevTextTime = u, this.prevCpuTime = u;
|
|
1211
|
+
}
|
|
1212
|
+
async init(e) {
|
|
1213
|
+
if (!e) {
|
|
1214
|
+
console.error("Stats: The \"canvas\" parameter is undefined.");
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
if (!this.handleThreeRenderer(e) && !await this.handleWebGPURenderer(e) && !this.handleNativeWebGPU(e)) if (this.initializeWebGL(e)) {
|
|
1218
|
+
this.trackGPU && this.initializeGPUTracking();
|
|
1219
|
+
return;
|
|
1220
|
+
} else console.error("Stats-gl: Failed to initialize WebGL context");
|
|
1221
|
+
}
|
|
1222
|
+
handleNativeWebGPU(e) {
|
|
1223
|
+
var t;
|
|
1224
|
+
return e && typeof e.createCommandEncoder == "function" && typeof e.createQuerySet == "function" && e.queue ? (this.gpuDevice = e, this.webgpuNative = !0, this.trackGPU && (t = e.features) != null && t.has("timestamp-query") && (this.initializeWebGPUTiming(), this.onWebGPUTimestampSupported()), !0) : !1;
|
|
1225
|
+
}
|
|
1226
|
+
initializeWebGPUTiming() {
|
|
1227
|
+
if (!this.gpuDevice) return;
|
|
1228
|
+
let e = this.maxTimestampPairs * 2;
|
|
1229
|
+
this.gpuTimestampBufferSize = e * 8, this.gpuQuerySet = this.gpuDevice.createQuerySet({
|
|
1230
|
+
type: "timestamp",
|
|
1231
|
+
count: e
|
|
1232
|
+
}), this.gpuResolveBuffer = this.gpuDevice.createBuffer({
|
|
1233
|
+
size: this.gpuTimestampBufferSize,
|
|
1234
|
+
usage: GPUBufferUsage.QUERY_RESOLVE | GPUBufferUsage.COPY_SRC
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
acquireReadBuffer() {
|
|
1238
|
+
if (!this.gpuDevice) return null;
|
|
1239
|
+
let e = this.readBufferPool.pop();
|
|
1240
|
+
if (e) return e;
|
|
1241
|
+
let t = this.inFlightFrames.length + this.readBufferPool.length + 1;
|
|
1242
|
+
return t > this.poolWarnThreshold && !this.warnedPoolGrowth && (console.warn(`stats-gl: WebGPU timestamp readback pool grew to ${t} buffers — is update() being called every frame after queue.submit?`), this.warnedPoolGrowth = !0), this.gpuDevice.createBuffer({
|
|
1243
|
+
size: this.gpuTimestampBufferSize,
|
|
1244
|
+
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
handleThreeRenderer(e) {
|
|
1248
|
+
return e.isWebGLRenderer && !this.threeRendererPatched ? (this.patchThreeRenderer(e), this.gl = e.getContext(), this.trackGPU && this.initializeGPUTracking(), !0) : !1;
|
|
1249
|
+
}
|
|
1250
|
+
async handleWebGPURenderer(e) {
|
|
1251
|
+
var t;
|
|
1252
|
+
return e.isWebGPURenderer ? (this.renderer = e, (this.trackGPU || this.trackCPT) && (e.backend.trackTimestamp = !0, e._initialized || await e.init(), e.hasFeature("timestamp-query") && this.onWebGPUTimestampSupported()), this.info = e.info, this.gpuBackend = e.backend, this.gpuDevice = ((t = e.backend) == null ? void 0 : t.device) || null, this.patchThreeWebGPU(e), !0) : !1;
|
|
1253
|
+
}
|
|
1254
|
+
onWebGPUTimestampSupported() {}
|
|
1255
|
+
initializeWebGL(e) {
|
|
1256
|
+
if (e instanceof WebGL2RenderingContext) this.gl = e;
|
|
1257
|
+
else if (e instanceof HTMLCanvasElement || e instanceof OffscreenCanvas) {
|
|
1258
|
+
if (this.gl = e.getContext("webgl2"), !this.gl) return console.error("Stats: Unable to obtain WebGL2 context."), !1;
|
|
1259
|
+
} else return console.error("Stats: Invalid input type. Expected WebGL2RenderingContext, HTMLCanvasElement, or OffscreenCanvas."), !1;
|
|
1260
|
+
return !0;
|
|
1261
|
+
}
|
|
1262
|
+
initializeGPUTracking() {
|
|
1263
|
+
this.gl && (this.ext = this.gl.getExtension("EXT_disjoint_timer_query_webgl2"), this.ext && this.onGPUTrackingInitialized());
|
|
1264
|
+
}
|
|
1265
|
+
onGPUTrackingInitialized() {}
|
|
1266
|
+
getTimestampWrites(e = "render") {
|
|
1267
|
+
if (!this.webgpuNative || !this.gpuQuerySet) return;
|
|
1268
|
+
if (this.frameCursor >= this.maxTimestampPairs) {
|
|
1269
|
+
this.warnedSlotOverflow || (console.warn(`stats-gl: WebGPU timestamp pair budget exhausted (maxTimestampPairs=${this.maxTimestampPairs}). Increase maxTimestampPairs in StatsOptions to instrument more passes.`), this.warnedSlotOverflow = !0);
|
|
1270
|
+
return;
|
|
1271
|
+
}
|
|
1272
|
+
let t = this.frameCursor++;
|
|
1273
|
+
return this.slotTypes[t] = e, {
|
|
1274
|
+
querySet: this.gpuQuerySet,
|
|
1275
|
+
beginningOfPassWriteIndex: t * 2,
|
|
1276
|
+
endOfPassWriteIndex: t * 2 + 1
|
|
1277
|
+
};
|
|
1278
|
+
}
|
|
1279
|
+
begin(e) {
|
|
1280
|
+
if (this.beginProfiling(), this.webgpuNative) {
|
|
1281
|
+
this.frameCursor = 0, this.slotTypes.length = 0;
|
|
1282
|
+
return;
|
|
1283
|
+
}
|
|
1284
|
+
!this.gl || !this.ext || (this.activeQuery && this.gl.endQuery(this.ext.TIME_ELAPSED_EXT), this.activeQuery = this.gl.createQuery(), this.activeQuery && this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT, this.activeQuery));
|
|
1285
|
+
}
|
|
1286
|
+
end(e) {
|
|
1287
|
+
if (this.renderCount++, this.webgpuNative && e && this.gpuQuerySet && this.gpuResolveBuffer) {
|
|
1288
|
+
let t = this.frameCursor;
|
|
1289
|
+
if (t > 0) {
|
|
1290
|
+
let n = t * 2, r = n * 8;
|
|
1291
|
+
e.resolveQuerySet(this.gpuQuerySet, 0, n, this.gpuResolveBuffer, 0);
|
|
1292
|
+
let i = this.acquireReadBuffer();
|
|
1293
|
+
i && (e.copyBufferToBuffer(this.gpuResolveBuffer, 0, i, 0, r), this.inFlightFrames.push({
|
|
1294
|
+
buffer: i,
|
|
1295
|
+
pairCount: t,
|
|
1296
|
+
slotTypes: this.slotTypes.slice(0, t),
|
|
1297
|
+
mapPromise: null,
|
|
1298
|
+
ready: !1,
|
|
1299
|
+
error: null
|
|
1300
|
+
}));
|
|
1301
|
+
}
|
|
1302
|
+
this.endProfiling();
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
1305
|
+
this.gl && this.ext && this.activeQuery && (this.gl.endQuery(this.ext.TIME_ELAPSED_EXT), this.gpuQueries.push({ query: this.activeQuery }), this.activeQuery = null), this.endProfiling();
|
|
1306
|
+
}
|
|
1307
|
+
async resolveTimestampsAsync() {
|
|
1308
|
+
if (!this.webgpuNative) return this.totalGpuDuration;
|
|
1309
|
+
for (let e of this.inFlightFrames) e.mapPromise === null && (e.mapPromise = e.buffer.mapAsync(GPUMapMode.READ).then(() => {
|
|
1310
|
+
e.ready = !0;
|
|
1311
|
+
}, (t) => {
|
|
1312
|
+
e.error = t, e.ready = !0;
|
|
1313
|
+
}));
|
|
1314
|
+
for (; this.inFlightFrames.length > 0 && this.inFlightFrames[0].ready;) {
|
|
1315
|
+
let e = this.inFlightFrames.shift();
|
|
1316
|
+
if (e.error) {
|
|
1317
|
+
this.warnedMapError || (console.warn("stats-gl: WebGPU timestamp mapAsync failed", e.error), this.warnedMapError = !0), this.totalGpuDuration = 0, this.totalGpuDurationCompute = 0, this.readBufferPool.push(e.buffer);
|
|
1318
|
+
continue;
|
|
1319
|
+
}
|
|
1320
|
+
let t = new BigUint64Array(e.buffer.getMappedRange()), n = 0, r = 0;
|
|
1321
|
+
for (let i = 0; i < e.pairCount; i++) {
|
|
1322
|
+
let a = t[i * 2], o = t[i * 2 + 1], s = o >= a ? Number(o - a) : 0;
|
|
1323
|
+
e.slotTypes[i] === "compute" ? r += s : n += s;
|
|
1324
|
+
}
|
|
1325
|
+
e.buffer.unmap(), this.readBufferPool.push(e.buffer), this.totalGpuDuration = n / 1e6, this.totalGpuDurationCompute = r / 1e6;
|
|
1326
|
+
}
|
|
1327
|
+
return this.totalGpuDuration;
|
|
1328
|
+
}
|
|
1329
|
+
processGpuQueries() {
|
|
1330
|
+
if (!(!this.gl || !this.ext)) {
|
|
1331
|
+
this.totalGpuDuration = 0;
|
|
1332
|
+
for (let e = this.gpuQueries.length - 1; e >= 0; e--) {
|
|
1333
|
+
let t = this.gpuQueries[e], n = this.gl.getQueryParameter(t.query, this.gl.QUERY_RESULT_AVAILABLE), r = this.gl.getParameter(this.ext.GPU_DISJOINT_EXT);
|
|
1334
|
+
if (n && !r) {
|
|
1335
|
+
let n = this.gl.getQueryParameter(t.query, this.gl.QUERY_RESULT) * 1e-6;
|
|
1336
|
+
this.totalGpuDuration += n, this.gl.deleteQuery(t.query), this.gpuQueries.splice(e, 1);
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
processWebGPUTimestamps() {
|
|
1342
|
+
this.totalGpuDuration = this.info.render.timestamp, this.totalGpuDurationCompute = this.info.compute.timestamp;
|
|
1343
|
+
}
|
|
1344
|
+
beginProfiling() {
|
|
1345
|
+
this.cpuStartTime = performance.now(), this.isRunningCPUProfiling = !0;
|
|
1346
|
+
}
|
|
1347
|
+
endProfiling() {
|
|
1348
|
+
this.isRunningCPUProfiling && (this.totalCpuDuration += performance.now() - this.cpuStartTime, this.isRunningCPUProfiling = !1);
|
|
1349
|
+
}
|
|
1350
|
+
calculateFps() {
|
|
1351
|
+
let e = performance.now(), t = e - 1e3;
|
|
1352
|
+
for (this.frameTimes.push(e); this.frameTimesHead < this.frameTimes.length && this.frameTimes[this.frameTimesHead] <= t;) this.frameTimesHead++;
|
|
1353
|
+
return this.frameTimesHead > 128 && (this.frameTimes = this.frameTimes.slice(this.frameTimesHead), this.frameTimesHead = 0), Math.round(this.frameTimes.length - this.frameTimesHead);
|
|
1354
|
+
}
|
|
1355
|
+
updateAverages() {
|
|
1356
|
+
this.addToAverage(this.totalCpuDuration, this.averageCpu), this.addToAverage(this.totalGpuDuration, this.averageGpu), (this.info || this.webgpuNative) && this.totalGpuDurationCompute !== void 0 && this.addToAverage(this.totalGpuDurationCompute, this.averageGpuCompute);
|
|
1357
|
+
}
|
|
1358
|
+
addToAverage(e, t) {
|
|
1359
|
+
for (t.logs.push(e); t.logs.length > this.samplesLog;) t.logs.shift();
|
|
1360
|
+
for (t.graph.push(e); t.graph.length > this.samplesGraph;) t.graph.shift();
|
|
1361
|
+
}
|
|
1362
|
+
resetCounters() {
|
|
1363
|
+
this.renderCount = 0, this.totalCpuDuration = 0, this.beginTime = performance.now();
|
|
1364
|
+
}
|
|
1365
|
+
getData() {
|
|
1366
|
+
let e = this.averageFps.logs, t = this.averageCpu.logs, n = this.averageGpu.logs, r = this.averageGpuCompute.logs;
|
|
1367
|
+
return {
|
|
1368
|
+
fps: e.length > 0 ? e[e.length - 1] : 0,
|
|
1369
|
+
cpu: t.length > 0 ? t[t.length - 1] : 0,
|
|
1370
|
+
gpu: n.length > 0 ? n[n.length - 1] : 0,
|
|
1371
|
+
gpuCompute: r.length > 0 ? r[r.length - 1] : 0
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
patchThreeWebGPU(e) {
|
|
1375
|
+
let t = e.info.reset, n = this;
|
|
1376
|
+
e.info.reset = function() {
|
|
1377
|
+
n.beginProfiling(), t.call(this);
|
|
1378
|
+
};
|
|
1379
|
+
}
|
|
1380
|
+
patchThreeRenderer(e) {
|
|
1381
|
+
let t = e.render, n = this;
|
|
1382
|
+
e.render = function(e, r) {
|
|
1383
|
+
n.begin(), t.call(this, e, r), n.end();
|
|
1384
|
+
}, this.threeRendererPatched = !0;
|
|
1385
|
+
}
|
|
1386
|
+
dispose() {
|
|
1387
|
+
if (this.gl) {
|
|
1388
|
+
if (this.activeQuery && this.ext) {
|
|
1389
|
+
try {
|
|
1390
|
+
this.gl.endQuery(this.ext.TIME_ELAPSED_EXT);
|
|
1391
|
+
} catch {}
|
|
1392
|
+
this.gl.deleteQuery(this.activeQuery), this.activeQuery = null;
|
|
1393
|
+
}
|
|
1394
|
+
for (let e of this.gpuQueries) this.gl.deleteQuery(e.query);
|
|
1395
|
+
this.gpuQueries.length = 0;
|
|
1396
|
+
}
|
|
1397
|
+
this.gpuQuerySet && (this.gpuQuerySet.destroy(), this.gpuQuerySet = null), this.gpuResolveBuffer && (this.gpuResolveBuffer.destroy(), this.gpuResolveBuffer = null);
|
|
1398
|
+
for (let e of this.inFlightFrames) {
|
|
1399
|
+
try {
|
|
1400
|
+
e.buffer.mapState === "mapped" && e.buffer.unmap();
|
|
1401
|
+
} catch {}
|
|
1402
|
+
e.buffer.destroy();
|
|
1403
|
+
}
|
|
1404
|
+
this.inFlightFrames.length = 0;
|
|
1405
|
+
for (let e of this.readBufferPool) e.destroy();
|
|
1406
|
+
this.readBufferPool.length = 0, this.frameCursor = 0, this.slotTypes.length = 0, this.gpuTimestampBufferSize = 0, this.warnedMapError = !1, this.warnedSlotOverflow = !1, this.warnedPoolGrowth = !1, this.webgpuNative = !1, this.gl = null, this.ext = null, this.info = void 0, this.gpuDevice = null, this.gpuBackend = null, this.renderer = null, this.frameTimes.length = 0, this.frameTimesHead = 0, this.averageFps.logs.length = 0, this.averageFps.graph.length = 0, this.averageCpu.logs.length = 0, this.averageCpu.graph.length = 0, this.averageGpu.logs.length = 0, this.averageGpu.graph.length = 0, this.averageGpuCompute.logs.length = 0, this.averageGpuCompute.graph.length = 0;
|
|
1407
|
+
}
|
|
1408
|
+
}, V = class {
|
|
1409
|
+
constructor(e, t, n) {
|
|
1410
|
+
this.id = 0, this.name = e, this.fg = t, this.bg = n, this.gradient = null, this.PR = Math.round(typeof window < "u" && window.devicePixelRatio || 1), this.WIDTH = 90 * this.PR, this.HEIGHT = 48 * this.PR, this.TEXT_X = 3 * this.PR, this.TEXT_Y = 2 * this.PR, this.GRAPH_X = 3 * this.PR, this.GRAPH_Y = 15 * this.PR, this.GRAPH_WIDTH = 84 * this.PR, this.GRAPH_HEIGHT = 30 * this.PR, this.canvas = typeof document < "u" ? document.createElement("canvas") : new OffscreenCanvas(this.WIDTH, this.HEIGHT), this.canvas.width = this.WIDTH, this.canvas.height = this.HEIGHT, this.canvas.style.width = "90px", this.canvas.style.height = "48px", this.canvas.style.position = "absolute", this.canvas.style.cssText = "width:90px;height:48px;background-color: transparent !important;", this.context = this.canvas.getContext("2d"), this.initializeCanvas();
|
|
1411
|
+
}
|
|
1412
|
+
createGradient() {
|
|
1413
|
+
if (!this.context) throw Error("No context");
|
|
1414
|
+
let e = this.context.createLinearGradient(0, this.GRAPH_Y, 0, this.GRAPH_Y + this.GRAPH_HEIGHT), t, n = this.fg;
|
|
1415
|
+
switch (this.fg.toLowerCase()) {
|
|
1416
|
+
case "#0ff":
|
|
1417
|
+
t = "#006666";
|
|
1418
|
+
break;
|
|
1419
|
+
case "#0f0":
|
|
1420
|
+
t = "#006600";
|
|
1421
|
+
break;
|
|
1422
|
+
case "#ff0":
|
|
1423
|
+
t = "#666600";
|
|
1424
|
+
break;
|
|
1425
|
+
case "#e1e1e1":
|
|
1426
|
+
t = "#666666";
|
|
1427
|
+
break;
|
|
1428
|
+
default:
|
|
1429
|
+
t = this.bg;
|
|
1430
|
+
break;
|
|
1431
|
+
}
|
|
1432
|
+
return e.addColorStop(0, t), e.addColorStop(1, n), e;
|
|
1433
|
+
}
|
|
1434
|
+
initializeCanvas() {
|
|
1435
|
+
this.context && (this.context.imageSmoothingEnabled = !1, this.context.font = "bold " + 9 * this.PR + "px Helvetica,Arial,sans-serif", this.context.textBaseline = "top", this.gradient = this.createGradient(), this.context.fillStyle = this.bg, this.context.fillRect(0, 0, this.WIDTH, this.HEIGHT), this.context.fillStyle = this.fg, this.context.fillText(this.name, this.TEXT_X, this.TEXT_Y), this.context.fillStyle = this.bg, this.context.globalAlpha = .9, this.context.fillRect(this.GRAPH_X, this.GRAPH_Y, this.GRAPH_WIDTH, this.GRAPH_HEIGHT));
|
|
1436
|
+
}
|
|
1437
|
+
update(e, t, n = 0, r = "") {
|
|
1438
|
+
if (!this.context || !this.gradient) return;
|
|
1439
|
+
let i = Math.min(Infinity, e), a = Math.max(t, e);
|
|
1440
|
+
this.context.globalAlpha = 1, this.context.fillStyle = this.bg, this.context.fillRect(0, 0, this.WIDTH, this.GRAPH_Y);
|
|
1441
|
+
let o = `${e.toFixed(n)} ${this.name}`;
|
|
1442
|
+
this.context.fillStyle = this.fg, this.context.fillText(o, this.TEXT_X, this.TEXT_Y);
|
|
1443
|
+
let s = this.TEXT_X + this.context.measureText(o).width;
|
|
1444
|
+
r && (this.context.fillStyle = "#f90", this.context.fillText(r, s, this.TEXT_Y), s += this.context.measureText(r).width), this.context.fillStyle = this.fg, this.context.fillText(` (${i.toFixed(n)}-${parseFloat(a.toFixed(n))})`, s, this.TEXT_Y);
|
|
1445
|
+
}
|
|
1446
|
+
updateGraph(e, t) {
|
|
1447
|
+
if (!this.context || !this.gradient) return;
|
|
1448
|
+
e === 0 && t === 0 && (t = 1), t = Math.max(t, e, .1), e = Math.max(e, 0);
|
|
1449
|
+
let n = Math.round(this.GRAPH_X), r = Math.round(this.GRAPH_Y), i = Math.round(this.GRAPH_WIDTH), a = Math.round(this.GRAPH_HEIGHT), o = Math.round(this.PR);
|
|
1450
|
+
this.context.drawImage(this.canvas, n + o, r, i - o, a, n, r, i - o, a), this.context.fillStyle = this.bg, this.context.fillRect(n + i - o, r, o, a);
|
|
1451
|
+
let s = Math.min(a, Math.round(e / t * a));
|
|
1452
|
+
s > 0 && (this.context.globalAlpha = .9, this.context.fillStyle = this.gradient, this.context.fillRect(n + i - o, r + (a - s), o, s)), this.context.globalAlpha = 1;
|
|
1453
|
+
}
|
|
1454
|
+
}, H = class extends V {
|
|
1455
|
+
constructor(e, t, n) {
|
|
1456
|
+
super(e, t, n), this.vsyncValue = 0, this.SMALL_HEIGHT = 9 * this.PR, this.HEIGHT = this.SMALL_HEIGHT, this.WIDTH = 35 * this.PR, this.TEXT_Y = 0 * this.PR, this.canvas.height = this.HEIGHT, this.canvas.width = this.WIDTH, this.canvas.style.height = "9px", this.canvas.style.width = "35px", this.canvas.style.cssText = "\n width: 35px;\n height: 9px;\n position: absolute;\n top: 0;\n left: 0;\n background-color: transparent !important;\n pointer-events: none;\n ", this.initializeCanvas();
|
|
1457
|
+
}
|
|
1458
|
+
initializeCanvas() {
|
|
1459
|
+
this.context && (this.context.imageSmoothingEnabled = !1, this.context.font = "bold " + 9 * this.PR + "px Helvetica,Arial,sans-serif", this.context.textBaseline = "top", this.context.globalAlpha = 1);
|
|
1460
|
+
}
|
|
1461
|
+
update(e, t, n = 0) {
|
|
1462
|
+
this.context && (this.vsyncValue = e, this.context.clearRect(0, 0, this.WIDTH, this.HEIGHT), this.context.globalAlpha = 1, this.context.fillStyle = this.bg, this.context.fillText(`${e.toFixed(0)}Hz`, this.TEXT_X, this.TEXT_Y));
|
|
1463
|
+
}
|
|
1464
|
+
updateGraph(e, t) {}
|
|
1465
|
+
setOffset(e, t) {
|
|
1466
|
+
this.canvas.style.transform = `translate(${e}px, ${t}px)`;
|
|
1467
|
+
}
|
|
1468
|
+
}, U = class extends V {
|
|
1469
|
+
constructor(e) {
|
|
1470
|
+
super(e, "#fff", "#111"), this.currentBitmap = null, this.sourceAspect = 1, this.initializeCanvas();
|
|
1471
|
+
}
|
|
1472
|
+
initializeCanvas() {
|
|
1473
|
+
this.context && (this.context.imageSmoothingEnabled = !0, this.context.font = "bold " + 9 * this.PR + "px Helvetica,Arial,sans-serif", this.context.textBaseline = "top", this.context.fillStyle = "#000", this.context.fillRect(0, 0, this.WIDTH, this.HEIGHT), this.drawLabelOverlay());
|
|
1474
|
+
}
|
|
1475
|
+
drawLabelOverlay() {
|
|
1476
|
+
this.context && (this.context.fillStyle = "rgba(0, 0, 0, 0.5)", this.context.fillRect(0, 0, this.WIDTH, this.GRAPH_Y), this.context.fillStyle = this.fg, this.context.fillText(this.name, this.TEXT_X, this.TEXT_Y));
|
|
1477
|
+
}
|
|
1478
|
+
setSourceSize(e, t) {
|
|
1479
|
+
this.sourceAspect = e / t;
|
|
1480
|
+
}
|
|
1481
|
+
updateTexture(e) {
|
|
1482
|
+
if (!this.context) return;
|
|
1483
|
+
this.currentBitmap && this.currentBitmap.close(), this.currentBitmap = e, this.context.fillStyle = "#000", this.context.fillRect(0, 0, this.WIDTH, this.HEIGHT);
|
|
1484
|
+
let t = this.WIDTH / this.HEIGHT, n, r, i, a;
|
|
1485
|
+
this.sourceAspect > t ? (n = this.WIDTH, r = this.WIDTH / this.sourceAspect, i = 0, a = (this.HEIGHT - r) / 2) : (r = this.HEIGHT, n = this.HEIGHT * this.sourceAspect, i = (this.WIDTH - n) / 2, a = 0), this.context.drawImage(e, i, a, n, r), this.drawLabelOverlay();
|
|
1486
|
+
}
|
|
1487
|
+
setLabel(e) {
|
|
1488
|
+
this.name = e, this.drawLabelOverlay();
|
|
1489
|
+
}
|
|
1490
|
+
update(e, t, n = 0, r = "") {}
|
|
1491
|
+
updateGraph(e, t) {}
|
|
1492
|
+
dispose() {
|
|
1493
|
+
this.currentBitmap && (this.currentBitmap.close(), this.currentBitmap = null);
|
|
1494
|
+
}
|
|
1495
|
+
}, W = class {
|
|
1496
|
+
constructor(e, t = 90, n = 48) {
|
|
1497
|
+
this.previewFbo = null, this.previewTexture = null, this.gl = e, this.previewWidth = t, this.previewHeight = n, this.pixels = new Uint8Array(t * n * 4), this.flippedPixels = new Uint8Array(t * n * 4), this.initResources();
|
|
1498
|
+
}
|
|
1499
|
+
resize(e, t) {
|
|
1500
|
+
e === this.previewWidth && t === this.previewHeight || (this.previewWidth = e, this.previewHeight = t, this.pixels = new Uint8Array(e * t * 4), this.flippedPixels = new Uint8Array(e * t * 4), this.dispose(), this.initResources());
|
|
1501
|
+
}
|
|
1502
|
+
initResources() {
|
|
1503
|
+
let e = this.gl;
|
|
1504
|
+
this.previewTexture = e.createTexture(), e.bindTexture(e.TEXTURE_2D, this.previewTexture), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA8, this.previewWidth, this.previewHeight, 0, e.RGBA, e.UNSIGNED_BYTE, null), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), this.previewFbo = e.createFramebuffer(), e.bindFramebuffer(e.FRAMEBUFFER, this.previewFbo), e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, this.previewTexture, 0), e.bindFramebuffer(e.FRAMEBUFFER, null), e.bindTexture(e.TEXTURE_2D, null);
|
|
1505
|
+
}
|
|
1506
|
+
async capture(e, t, n, r = "default") {
|
|
1507
|
+
let i = this.gl, a = i.getParameter(i.READ_FRAMEBUFFER_BINDING), o = i.getParameter(i.DRAW_FRAMEBUFFER_BINDING);
|
|
1508
|
+
i.bindFramebuffer(i.READ_FRAMEBUFFER, e), i.bindFramebuffer(i.DRAW_FRAMEBUFFER, this.previewFbo), i.blitFramebuffer(0, 0, t, n, 0, 0, this.previewWidth, this.previewHeight, i.COLOR_BUFFER_BIT, i.LINEAR), i.bindFramebuffer(i.READ_FRAMEBUFFER, this.previewFbo), i.readPixels(0, 0, this.previewWidth, this.previewHeight, i.RGBA, i.UNSIGNED_BYTE, this.pixels), i.bindFramebuffer(i.READ_FRAMEBUFFER, a), i.bindFramebuffer(i.DRAW_FRAMEBUFFER, o);
|
|
1509
|
+
let s = this.flipY(this.pixels, this.previewWidth, this.previewHeight), c = new ImageData(new Uint8ClampedArray(s), this.previewWidth, this.previewHeight);
|
|
1510
|
+
return createImageBitmap(c);
|
|
1511
|
+
}
|
|
1512
|
+
flipY(e, t, n) {
|
|
1513
|
+
let r = t * 4;
|
|
1514
|
+
for (let t = 0; t < n; t++) {
|
|
1515
|
+
let i = t * r, a = (n - 1 - t) * r;
|
|
1516
|
+
this.flippedPixels.set(e.subarray(i, i + r), a);
|
|
1517
|
+
}
|
|
1518
|
+
return this.flippedPixels;
|
|
1519
|
+
}
|
|
1520
|
+
removeSource(e) {}
|
|
1521
|
+
dispose() {
|
|
1522
|
+
let e = this.gl;
|
|
1523
|
+
this.previewFbo && (e.deleteFramebuffer(this.previewFbo), this.previewFbo = null), this.previewTexture && (e.deleteTexture(this.previewTexture), this.previewTexture = null);
|
|
1524
|
+
}
|
|
1525
|
+
}, G = class {
|
|
1526
|
+
constructor(e, t = 90, n = 48) {
|
|
1527
|
+
this.previewTexture = null, this.stagingBuffer = null, this.blitPipeline = null, this.sampler = null, this.bindGroupLayout = null, this.initialized = !1, this.device = e, this.previewWidth = t, this.previewHeight = n, this.pixelsBuffer = new Uint8ClampedArray(t * n * 4);
|
|
1528
|
+
}
|
|
1529
|
+
resize(e, t) {
|
|
1530
|
+
e === this.previewWidth && t === this.previewHeight || (this.previewWidth = e, this.previewHeight = t, this.pixelsBuffer = new Uint8ClampedArray(e * t * 4), this.previewTexture && this.previewTexture.destroy(), this.stagingBuffer && this.stagingBuffer.destroy(), this.previewTexture = null, this.stagingBuffer = null, this.initialized && this.createSizeResources());
|
|
1531
|
+
}
|
|
1532
|
+
createSizeResources() {
|
|
1533
|
+
let e = this.device;
|
|
1534
|
+
this.previewTexture = e.createTexture({
|
|
1535
|
+
size: {
|
|
1536
|
+
width: this.previewWidth,
|
|
1537
|
+
height: this.previewHeight
|
|
1538
|
+
},
|
|
1539
|
+
format: "rgba8unorm",
|
|
1540
|
+
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC
|
|
1541
|
+
});
|
|
1542
|
+
let t = Math.ceil(this.previewWidth * 4 / 256) * 256;
|
|
1543
|
+
this.stagingBuffer = e.createBuffer({
|
|
1544
|
+
size: t * this.previewHeight,
|
|
1545
|
+
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ
|
|
1546
|
+
});
|
|
1547
|
+
}
|
|
1548
|
+
async initResources() {
|
|
1549
|
+
if (this.initialized) return;
|
|
1550
|
+
let e = this.device;
|
|
1551
|
+
this.createSizeResources(), this.sampler = e.createSampler({
|
|
1552
|
+
minFilter: "linear",
|
|
1553
|
+
magFilter: "linear"
|
|
1554
|
+
});
|
|
1555
|
+
let t = e.createShaderModule({ code: "\n @group(0) @binding(0) var texSampler: sampler;\n @group(0) @binding(1) var texInput: texture_2d<f32>;\n\n struct VertexOutput {\n @builtin(position) position: vec4f,\n @location(0) uv: vec2f\n }\n\n @vertex\n fn vertexMain(@builtin(vertex_index) vertexIndex: u32) -> VertexOutput {\n var positions = array<vec2f, 3>(\n vec2f(-1.0, -1.0),\n vec2f(3.0, -1.0),\n vec2f(-1.0, 3.0)\n );\n var uvs = array<vec2f, 3>(\n vec2f(0.0, 1.0),\n vec2f(2.0, 1.0),\n vec2f(0.0, -1.0)\n );\n\n var output: VertexOutput;\n output.position = vec4f(positions[vertexIndex], 0.0, 1.0);\n output.uv = uvs[vertexIndex];\n return output;\n }\n\n @fragment\n fn fragmentMain(@location(0) uv: vec2f) -> @location(0) vec4f {\n return textureSample(texInput, texSampler, uv);\n }\n " });
|
|
1556
|
+
this.bindGroupLayout = e.createBindGroupLayout({ entries: [{
|
|
1557
|
+
binding: 0,
|
|
1558
|
+
visibility: GPUShaderStage.FRAGMENT,
|
|
1559
|
+
sampler: { type: "filtering" }
|
|
1560
|
+
}, {
|
|
1561
|
+
binding: 1,
|
|
1562
|
+
visibility: GPUShaderStage.FRAGMENT,
|
|
1563
|
+
texture: { sampleType: "float" }
|
|
1564
|
+
}] }), this.blitPipeline = e.createRenderPipeline({
|
|
1565
|
+
layout: e.createPipelineLayout({ bindGroupLayouts: [this.bindGroupLayout] }),
|
|
1566
|
+
vertex: {
|
|
1567
|
+
module: t,
|
|
1568
|
+
entryPoint: "vertexMain"
|
|
1569
|
+
},
|
|
1570
|
+
fragment: {
|
|
1571
|
+
module: t,
|
|
1572
|
+
entryPoint: "fragmentMain",
|
|
1573
|
+
targets: [{ format: "rgba8unorm" }]
|
|
1574
|
+
},
|
|
1575
|
+
primitive: { topology: "triangle-list" }
|
|
1576
|
+
}), this.initialized = !0;
|
|
1577
|
+
}
|
|
1578
|
+
async capture(e) {
|
|
1579
|
+
if (await this.initResources(), !this.previewTexture || !this.stagingBuffer || !this.blitPipeline || !this.sampler || !this.bindGroupLayout) return null;
|
|
1580
|
+
let t = this.device, n = t.createBindGroup({
|
|
1581
|
+
layout: this.bindGroupLayout,
|
|
1582
|
+
entries: [{
|
|
1583
|
+
binding: 0,
|
|
1584
|
+
resource: this.sampler
|
|
1585
|
+
}, {
|
|
1586
|
+
binding: 1,
|
|
1587
|
+
resource: e.createView()
|
|
1588
|
+
}]
|
|
1589
|
+
}), r = t.createCommandEncoder(), i = r.beginRenderPass({ colorAttachments: [{
|
|
1590
|
+
view: this.previewTexture.createView(),
|
|
1591
|
+
loadOp: "clear",
|
|
1592
|
+
storeOp: "store",
|
|
1593
|
+
clearValue: {
|
|
1594
|
+
r: 0,
|
|
1595
|
+
g: 0,
|
|
1596
|
+
b: 0,
|
|
1597
|
+
a: 1
|
|
1598
|
+
}
|
|
1599
|
+
}] });
|
|
1600
|
+
i.setPipeline(this.blitPipeline), i.setBindGroup(0, n), i.draw(3), i.end();
|
|
1601
|
+
let a = Math.ceil(this.previewWidth * 4 / 256) * 256;
|
|
1602
|
+
r.copyTextureToBuffer({ texture: this.previewTexture }, {
|
|
1603
|
+
buffer: this.stagingBuffer,
|
|
1604
|
+
bytesPerRow: a
|
|
1605
|
+
}, {
|
|
1606
|
+
width: this.previewWidth,
|
|
1607
|
+
height: this.previewHeight
|
|
1608
|
+
}), t.queue.submit([r.finish()]), await this.stagingBuffer.mapAsync(GPUMapMode.READ);
|
|
1609
|
+
let o = new Uint8Array(this.stagingBuffer.getMappedRange());
|
|
1610
|
+
for (let e = 0; e < this.previewHeight; e++) {
|
|
1611
|
+
let t = e * a, n = e * this.previewWidth * 4;
|
|
1612
|
+
this.pixelsBuffer.set(o.subarray(t, t + this.previewWidth * 4), n);
|
|
1613
|
+
}
|
|
1614
|
+
this.stagingBuffer.unmap();
|
|
1615
|
+
let s = new ImageData(new Uint8ClampedArray(this.pixelsBuffer), this.previewWidth, this.previewHeight);
|
|
1616
|
+
return createImageBitmap(s);
|
|
1617
|
+
}
|
|
1618
|
+
dispose() {
|
|
1619
|
+
this.previewTexture && this.previewTexture.destroy(), this.stagingBuffer && this.stagingBuffer.destroy(), this.previewTexture = null, this.stagingBuffer = null, this.blitPipeline = null, this.sampler = null, this.bindGroupLayout = null, this.initialized = !1;
|
|
1620
|
+
}
|
|
1621
|
+
};
|
|
1622
|
+
function K(e, t) {
|
|
1623
|
+
return e.isWebGLRenderTarget && e.__webglFramebuffer ? {
|
|
1624
|
+
framebuffer: e.__webglFramebuffer,
|
|
1625
|
+
width: e.width || 1,
|
|
1626
|
+
height: e.height || 1
|
|
1627
|
+
} : null;
|
|
1628
|
+
}
|
|
1629
|
+
function q(e, t) {
|
|
1630
|
+
if (e.isRenderTarget && e.texture && t.get) {
|
|
1631
|
+
let n = t.get(e.texture);
|
|
1632
|
+
return (n == null ? void 0 : n.texture) || null;
|
|
1633
|
+
}
|
|
1634
|
+
return null;
|
|
1635
|
+
}
|
|
1636
|
+
//#endregion
|
|
1637
|
+
//#region ../../node_modules/.pnpm/stats-gl@4.2.3_three@0.185.1/node_modules/stats-gl/dist/main.js
|
|
1638
|
+
var J = class e extends B {
|
|
1639
|
+
constructor({ trackGPU: t = !1, trackCPT: n = !1, trackHz: r = !1, trackFPS: i = !0, logsPerSecond: a = 4, graphsPerSecond: o = 30, samplesLog: s = 40, samplesGraph: c = 10, precision: l = 2, minimal: u = !1, horizontal: d = !0, mode: f = 0 } = {}) {
|
|
1640
|
+
super({
|
|
1641
|
+
trackGPU: t,
|
|
1642
|
+
trackCPT: n,
|
|
1643
|
+
trackHz: r,
|
|
1644
|
+
trackFPS: i,
|
|
1645
|
+
logsPerSecond: a,
|
|
1646
|
+
graphsPerSecond: o,
|
|
1647
|
+
samplesLog: s,
|
|
1648
|
+
samplesGraph: c,
|
|
1649
|
+
precision: l
|
|
1650
|
+
}), this.fpsPanel = null, this.msPanel = null, this.gpuPanel = null, this.gpuPanelCompute = null, this.vsyncPanel = null, this.workerCpuPanel = null, this.texturePanels = /* @__PURE__ */ new Map(), this.texturePanelRow = null, this.textureCaptureWebGL = null, this.textureCaptureWebGPU = null, this.textureSourcesWebGL = /* @__PURE__ */ new Map(), this.textureSourcesWebGPU = /* @__PURE__ */ new Map(), this.texturePreviewWidth = 90, this.texturePreviewHeight = 48, this.lastRendererWidth = 0, this.lastRendererHeight = 0, this.textureUpdatePending = !1, this.updateCounter = 0, this.lastMin = {}, this.lastMax = {}, this.lastValue = {}, this.VSYNC_RATES = [
|
|
1651
|
+
{
|
|
1652
|
+
refreshRate: 60,
|
|
1653
|
+
frameTime: 16.67
|
|
1654
|
+
},
|
|
1655
|
+
{
|
|
1656
|
+
refreshRate: 75,
|
|
1657
|
+
frameTime: 13.33
|
|
1658
|
+
},
|
|
1659
|
+
{
|
|
1660
|
+
refreshRate: 90,
|
|
1661
|
+
frameTime: 11.11
|
|
1662
|
+
},
|
|
1663
|
+
{
|
|
1664
|
+
refreshRate: 120,
|
|
1665
|
+
frameTime: 8.33
|
|
1666
|
+
},
|
|
1667
|
+
{
|
|
1668
|
+
refreshRate: 144,
|
|
1669
|
+
frameTime: 6.94
|
|
1670
|
+
},
|
|
1671
|
+
{
|
|
1672
|
+
refreshRate: 165,
|
|
1673
|
+
frameTime: 6.06
|
|
1674
|
+
},
|
|
1675
|
+
{
|
|
1676
|
+
refreshRate: 240,
|
|
1677
|
+
frameTime: 4.17
|
|
1678
|
+
}
|
|
1679
|
+
], this.detectedVSync = null, this.frameTimeHistory = [], this.HISTORY_SIZE = 120, this.VSYNC_THRESHOLD = .05, this.lastFrameTime = 0, this.externalData = null, this.hasNewExternalData = !1, this.isWorker = !1, this.averageWorkerCpu = {
|
|
1680
|
+
logs: [],
|
|
1681
|
+
graph: []
|
|
1682
|
+
}, this.handleClick = (e) => {
|
|
1683
|
+
e.preventDefault(), this.showPanel(++this.mode % this.dom.children.length);
|
|
1684
|
+
}, this.handleResize = () => {
|
|
1685
|
+
this.fpsPanel && this.resizePanel(this.fpsPanel), this.msPanel && this.resizePanel(this.msPanel), this.workerCpuPanel && this.resizePanel(this.workerCpuPanel), this.gpuPanel && this.resizePanel(this.gpuPanel), this.gpuPanelCompute && this.resizePanel(this.gpuPanelCompute);
|
|
1686
|
+
}, this.mode = f, this.horizontal = d, this.minimal = u, this.dom = document.createElement("div"), this.initializeDOM(), this._panelId = 0, this.trackFPS && (this.fpsPanel = this.addPanel(new e.Panel("FPS", "#0ff", "#002")), this.msPanel = this.addPanel(new e.Panel("CPU", "#0f0", "#020"))), this.trackGPU && (this.gpuPanel = this.addPanel(new e.Panel("GPU", "#ff0", "#220"))), this.trackCPT && (this.gpuPanelCompute = this.addPanel(new e.Panel("CPT", "#e1e1e1", "#212121"))), this.trackHz === !0 && (this.vsyncPanel = new H("", "#f0f", "#202"), this.dom.appendChild(this.vsyncPanel.canvas), this.vsyncPanel.setOffset(56, 35)), this.setupEventListeners();
|
|
1687
|
+
}
|
|
1688
|
+
initializeDOM() {
|
|
1689
|
+
this.dom.style.cssText = `
|
|
1690
|
+
position: fixed;
|
|
1691
|
+
top: 0;
|
|
1692
|
+
left: 0;
|
|
1693
|
+
opacity: 0.9;
|
|
1694
|
+
z-index: 10000;
|
|
1695
|
+
${this.minimal ? "cursor: pointer;" : ""}
|
|
1696
|
+
`;
|
|
1697
|
+
}
|
|
1698
|
+
setupEventListeners() {
|
|
1699
|
+
this.minimal ? (this.dom.addEventListener("click", this.handleClick), this.showPanel(this.mode)) : window.addEventListener("resize", this.handleResize);
|
|
1700
|
+
}
|
|
1701
|
+
updateTexturePreviewDimensions() {
|
|
1702
|
+
var e, t;
|
|
1703
|
+
if (!this.renderer) return;
|
|
1704
|
+
let n = ((e = this.renderer.domElement) == null ? void 0 : e.width) || 0, r = ((t = this.renderer.domElement) == null ? void 0 : t.height) || 0;
|
|
1705
|
+
if (n === this.lastRendererWidth && r === this.lastRendererHeight || n === 0 || r === 0) return;
|
|
1706
|
+
this.lastRendererWidth = n, this.lastRendererHeight = r;
|
|
1707
|
+
let i = n / r, a, o;
|
|
1708
|
+
if (i > 1.875 ? (a = 90, o = Math.round(90 / i)) : (o = 48, a = Math.round(48 * i)), a = Math.max(a, 16), o = Math.max(o, 16), a !== this.texturePreviewWidth || o !== this.texturePreviewHeight) {
|
|
1709
|
+
this.texturePreviewWidth = a, this.texturePreviewHeight = o, this.textureCaptureWebGL && this.textureCaptureWebGL.resize(a, o), this.textureCaptureWebGPU && this.textureCaptureWebGPU.resize(a, o);
|
|
1710
|
+
for (let e of this.texturePanels.values()) e.setSourceSize(n, r);
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
onWebGPUTimestampSupported() {}
|
|
1714
|
+
onGPUTrackingInitialized() {}
|
|
1715
|
+
setData(t) {
|
|
1716
|
+
if (this.externalData = t, this.hasNewExternalData = !0, !this.isWorker && this.msPanel) {
|
|
1717
|
+
this.isWorker = !0, this.workerCpuPanel = new e.Panel("WRK", "#f90", "#220");
|
|
1718
|
+
let t = this.msPanel.id + 1;
|
|
1719
|
+
this.workerCpuPanel.id = t, this.gpuPanel && this.gpuPanel.id >= t && (this.gpuPanel.id++, this.resizePanel(this.gpuPanel)), this.gpuPanelCompute && this.gpuPanelCompute.id >= t && (this.gpuPanelCompute.id++, this.resizePanel(this.gpuPanelCompute));
|
|
1720
|
+
let n = this.msPanel.canvas;
|
|
1721
|
+
n.nextSibling ? this.dom.insertBefore(this.workerCpuPanel.canvas, n.nextSibling) : this.dom.appendChild(this.workerCpuPanel.canvas), this.resizePanel(this.workerCpuPanel), this._panelId++;
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
update() {
|
|
1725
|
+
this.externalData ? this.updateFromExternalData() : this.updateFromInternalData();
|
|
1726
|
+
}
|
|
1727
|
+
updateFromExternalData() {
|
|
1728
|
+
let e = this.externalData;
|
|
1729
|
+
this.endProfiling(), this.addToAverage(this.totalCpuDuration, this.averageCpu), this.totalCpuDuration = 0, this.hasNewExternalData && (this.addToAverage(e.cpu, this.averageWorkerCpu), this.addToAverage(e.fps, this.averageFps), this.addToAverage(e.gpu, this.averageGpu), this.addToAverage(e.gpuCompute, this.averageGpuCompute), this.hasNewExternalData = !1), this.renderPanels();
|
|
1730
|
+
}
|
|
1731
|
+
updateFromInternalData() {
|
|
1732
|
+
this.endProfiling(), this.webgpuNative ? this.resolveTimestampsAsync() : this.info ? this.processWebGPUTimestamps() : this.processGpuQueries(), this.updateAverages(), this.resetCounters(), this.renderPanels();
|
|
1733
|
+
}
|
|
1734
|
+
renderPanels() {
|
|
1735
|
+
var e;
|
|
1736
|
+
let t = performance.now();
|
|
1737
|
+
if (!this.isWorker) {
|
|
1738
|
+
for (this.frameTimes.push(t); this.frameTimes.length > 0 && this.frameTimes[0] <= t - 1e3;) this.frameTimes.shift();
|
|
1739
|
+
let e = Math.round(this.frameTimes.length);
|
|
1740
|
+
this.addToAverage(e, this.averageFps);
|
|
1741
|
+
}
|
|
1742
|
+
let n = t >= this.prevTextTime + 1e3 / this.logsPerSecond, r = t >= this.prevGraphTime + 1e3 / this.graphsPerSecond, i = this.isWorker ? " ⛭" : "";
|
|
1743
|
+
if (this.updatePanelComponents(this.fpsPanel, this.averageFps, 0, n, r, i), this.updatePanelComponents(this.msPanel, this.averageCpu, this.precision, n, r, ""), this.workerCpuPanel && this.isWorker && this.updatePanelComponents(this.workerCpuPanel, this.averageWorkerCpu, this.precision, n, r, " ⛭"), this.gpuPanel && this.updatePanelComponents(this.gpuPanel, this.averageGpu, this.precision, n, r, i), this.trackCPT && this.gpuPanelCompute && this.updatePanelComponents(this.gpuPanelCompute, this.averageGpuCompute, this.precision, n, r, i), n && (this.prevTextTime = t), r && (this.prevGraphTime = t, this.texturePanels.size > 0 && !this.textureUpdatePending && (this.textureUpdatePending = !0, this.updateTexturePanels().finally(() => {
|
|
1744
|
+
this.textureUpdatePending = !1;
|
|
1745
|
+
})), this.captureStatsGLNodes()), this.vsyncPanel !== null) {
|
|
1746
|
+
this.detectVSync(t);
|
|
1747
|
+
let r = ((e = this.detectedVSync) == null ? void 0 : e.refreshRate) || 0;
|
|
1748
|
+
n && r > 0 && this.vsyncPanel.update(r, r);
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
resetCounters() {
|
|
1752
|
+
this.renderCount = 0, this.totalCpuDuration = 0, this.beginTime = performance.now();
|
|
1753
|
+
}
|
|
1754
|
+
resizePanel(e) {
|
|
1755
|
+
e.canvas.style.position = "absolute", this.minimal ? e.canvas.style.display = "none" : (e.canvas.style.display = "block", this.horizontal ? (e.canvas.style.top = "0px", e.canvas.style.left = e.id * e.WIDTH / e.PR + "px") : (e.canvas.style.left = "0px", e.canvas.style.top = e.id * e.HEIGHT / e.PR + "px"));
|
|
1756
|
+
}
|
|
1757
|
+
addPanel(e) {
|
|
1758
|
+
return e.canvas && (this.dom.appendChild(e.canvas), e.id = this._panelId, this.resizePanel(e), this._panelId++), e;
|
|
1759
|
+
}
|
|
1760
|
+
showPanel(e) {
|
|
1761
|
+
for (let t = 0; t < this.dom.children.length; t++) {
|
|
1762
|
+
let n = this.dom.children[t];
|
|
1763
|
+
n.style.display = t === e ? "block" : "none";
|
|
1764
|
+
}
|
|
1765
|
+
this.mode = e;
|
|
1766
|
+
}
|
|
1767
|
+
addTexturePanel(e) {
|
|
1768
|
+
this.texturePanelRow || (this.texturePanelRow = document.createElement("div"), this.texturePanelRow.style.cssText = "\n position: absolute;\n top: 48px;\n left: 0;\n display: flex;\n flex-direction: row;\n ", this.dom.appendChild(this.texturePanelRow));
|
|
1769
|
+
let t = new U(e);
|
|
1770
|
+
return t.canvas.style.position = "relative", t.canvas.style.left = "", t.canvas.style.top = "", this.texturePanelRow.appendChild(t.canvas), this.texturePanels.set(e, t), t;
|
|
1771
|
+
}
|
|
1772
|
+
setTexture(e, t) {
|
|
1773
|
+
this.updateTexturePreviewDimensions(), this.gl && !this.textureCaptureWebGL && (this.textureCaptureWebGL = new W(this.gl, this.texturePreviewWidth, this.texturePreviewHeight)), this.gpuDevice && !this.textureCaptureWebGPU && (this.textureCaptureWebGPU = new G(this.gpuDevice, this.texturePreviewWidth, this.texturePreviewHeight));
|
|
1774
|
+
let n = this.texturePanels.get(e);
|
|
1775
|
+
if (t.isWebGLRenderTarget && this.gl) {
|
|
1776
|
+
let r = K(t, this.gl);
|
|
1777
|
+
r && (this.textureSourcesWebGL.set(e, {
|
|
1778
|
+
target: t,
|
|
1779
|
+
...r
|
|
1780
|
+
}), n && n.setSourceSize(r.width, r.height));
|
|
1781
|
+
return;
|
|
1782
|
+
}
|
|
1783
|
+
if (t.isRenderTarget && this.gpuBackend) {
|
|
1784
|
+
let r = q(t, this.gpuBackend);
|
|
1785
|
+
r && (this.textureSourcesWebGPU.set(e, r), n && t.width && t.height && n.setSourceSize(t.width, t.height));
|
|
1786
|
+
return;
|
|
1787
|
+
}
|
|
1788
|
+
if (t && typeof t.createView == "function") {
|
|
1789
|
+
this.textureSourcesWebGPU.set(e, t);
|
|
1790
|
+
return;
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
setTextureWebGL(e, t, n, r) {
|
|
1794
|
+
this.updateTexturePreviewDimensions(), this.gl && !this.textureCaptureWebGL && (this.textureCaptureWebGL = new W(this.gl, this.texturePreviewWidth, this.texturePreviewHeight)), this.textureSourcesWebGL.set(e, {
|
|
1795
|
+
target: { isWebGLRenderTarget: !0 },
|
|
1796
|
+
framebuffer: t,
|
|
1797
|
+
width: n,
|
|
1798
|
+
height: r
|
|
1799
|
+
});
|
|
1800
|
+
let i = this.texturePanels.get(e);
|
|
1801
|
+
i && i.setSourceSize(n, r);
|
|
1802
|
+
}
|
|
1803
|
+
setTextureBitmap(e, t, n, r) {
|
|
1804
|
+
let i = this.texturePanels.get(e);
|
|
1805
|
+
i && (n !== void 0 && r !== void 0 && i.setSourceSize(n, r), i.updateTexture(t));
|
|
1806
|
+
}
|
|
1807
|
+
removeTexturePanel(e) {
|
|
1808
|
+
let t = this.texturePanels.get(e);
|
|
1809
|
+
t && (t.dispose(), t.canvas.remove(), this.texturePanels.delete(e), this.textureSourcesWebGL.delete(e), this.textureSourcesWebGPU.delete(e));
|
|
1810
|
+
}
|
|
1811
|
+
async updateTexturePanels() {
|
|
1812
|
+
if (this.updateTexturePreviewDimensions(), this.textureCaptureWebGL) for (let [e, t] of this.textureSourcesWebGL) {
|
|
1813
|
+
let n = this.texturePanels.get(e);
|
|
1814
|
+
if (n) {
|
|
1815
|
+
let r = t.framebuffer, i = t.width, a = t.height;
|
|
1816
|
+
t.target.isWebGLRenderTarget && t.target.__webglFramebuffer && (r = t.target.__webglFramebuffer, i = t.target.width || i, a = t.target.height || a);
|
|
1817
|
+
let o = await this.textureCaptureWebGL.capture(r, i, a, e);
|
|
1818
|
+
o && n.updateTexture(o);
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
if (this.textureCaptureWebGPU) for (let [e, t] of this.textureSourcesWebGPU) {
|
|
1822
|
+
let n = this.texturePanels.get(e);
|
|
1823
|
+
if (n) {
|
|
1824
|
+
let e = await this.textureCaptureWebGPU.capture(t);
|
|
1825
|
+
e && n.updateTexture(e);
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
captureStatsGLNodes() {
|
|
1830
|
+
let e = this._statsGLCaptures;
|
|
1831
|
+
if (!(!e || e.size === 0 || !this.renderer)) for (let t of e.values()) t.capture && t.capture(this.renderer);
|
|
1832
|
+
}
|
|
1833
|
+
detectVSync(e) {
|
|
1834
|
+
if (this.lastFrameTime === 0) {
|
|
1835
|
+
this.lastFrameTime = e;
|
|
1836
|
+
return;
|
|
1837
|
+
}
|
|
1838
|
+
let t = e - this.lastFrameTime;
|
|
1839
|
+
if (this.lastFrameTime = e, this.frameTimeHistory.push(t), this.frameTimeHistory.length > this.HISTORY_SIZE && this.frameTimeHistory.shift(), this.frameTimeHistory.length < 60) return;
|
|
1840
|
+
let n = this.frameTimeHistory.reduce((e, t) => e + t) / this.frameTimeHistory.length, r = this.frameTimeHistory.reduce((e, t) => e + (t - n) ** 2, 0) / this.frameTimeHistory.length;
|
|
1841
|
+
if (Math.sqrt(r) > 2) {
|
|
1842
|
+
this.detectedVSync = null;
|
|
1843
|
+
return;
|
|
1844
|
+
}
|
|
1845
|
+
let i = null, a = Infinity;
|
|
1846
|
+
for (let e of this.VSYNC_RATES) {
|
|
1847
|
+
let t = Math.abs(n - e.frameTime);
|
|
1848
|
+
t < a && (a = t, i = e);
|
|
1849
|
+
}
|
|
1850
|
+
i && a / i.frameTime <= this.VSYNC_THRESHOLD ? this.detectedVSync = i : this.detectedVSync = null;
|
|
1851
|
+
}
|
|
1852
|
+
updatePanelComponents(e, t, n, r, i, a = "") {
|
|
1853
|
+
if (!e || t.logs.length === 0) return;
|
|
1854
|
+
let o = String(e.id);
|
|
1855
|
+
o in this.lastMin || (this.lastMin[o] = Infinity, this.lastMax[o] = 0, this.lastValue[o] = 0);
|
|
1856
|
+
let s = t.logs[t.logs.length - 1];
|
|
1857
|
+
this.lastMax[o] = Math.max(...t.logs), this.lastMin[o] = Math.min(this.lastMin[o], s), this.lastValue[o] = this.lastValue[o] * .7 + s * .3;
|
|
1858
|
+
let c = Math.max(Math.max(...t.logs), ...t.graph.slice(-this.samplesGraph));
|
|
1859
|
+
this.updateCounter++, r && e.update(this.lastValue[o], this.lastMax[o], n, a), i && e.updateGraph(s, c);
|
|
1860
|
+
}
|
|
1861
|
+
updatePanel(e, t, n = 2) {
|
|
1862
|
+
if (!e || t.logs.length === 0) return;
|
|
1863
|
+
let r = performance.now();
|
|
1864
|
+
e.name in this.lastMin || (this.lastMin[e.name] = Infinity, this.lastMax[e.name] = 0, this.lastValue[e.name] = 0);
|
|
1865
|
+
let i = t.logs[t.logs.length - 1], a = Math.max(...t.logs.slice(-30));
|
|
1866
|
+
this.lastMin[e.name] = Math.min(this.lastMin[e.name], i), this.lastMax[e.name] = Math.max(this.lastMax[e.name], i), this.lastValue[e.name] = this.lastValue[e.name] * .7 + i * .3;
|
|
1867
|
+
let o = Math.max(a, ...t.graph.slice(-this.samplesGraph));
|
|
1868
|
+
this.updateCounter++, this.updateCounter % (this.logsPerSecond * 2) == 0 && (this.lastMax[e.name] = a, this.lastMin[e.name] = i), e.update && (r >= this.prevCpuTime + 1e3 / this.logsPerSecond && e.update(this.lastValue[e.name], i, this.lastMax[e.name], o, n), r >= this.prevGraphTime + 1e3 / this.graphsPerSecond && (e.updateGraph(i, o), this.prevGraphTime = r));
|
|
1869
|
+
}
|
|
1870
|
+
get domElement() {
|
|
1871
|
+
return this.dom;
|
|
1872
|
+
}
|
|
1873
|
+
dispose() {
|
|
1874
|
+
this.minimal ? this.dom.removeEventListener("click", this.handleClick) : window.removeEventListener("resize", this.handleResize), this.textureCaptureWebGL && (this.textureCaptureWebGL.dispose(), this.textureCaptureWebGL = null), this.textureCaptureWebGPU && (this.textureCaptureWebGPU.dispose(), this.textureCaptureWebGPU = null);
|
|
1875
|
+
for (let e of this.texturePanels.values()) e.dispose();
|
|
1876
|
+
this.texturePanels.clear(), this.textureSourcesWebGL.clear(), this.textureSourcesWebGPU.clear();
|
|
1877
|
+
let e = this._statsGLCaptures;
|
|
1878
|
+
if (e) {
|
|
1879
|
+
for (let t of e.values()) t.dispose && t.dispose();
|
|
1880
|
+
e.clear();
|
|
1881
|
+
}
|
|
1882
|
+
this.texturePanelRow && (this.texturePanelRow.remove(), this.texturePanelRow = null), this.dom.remove(), this.fpsPanel = null, this.msPanel = null, this.gpuPanel = null, this.gpuPanelCompute = null, this.vsyncPanel = null, this.workerCpuPanel = null, this.frameTimeHistory.length = 0, this.averageWorkerCpu.logs.length = 0, this.averageWorkerCpu.graph.length = 0, super.dispose();
|
|
1883
|
+
}
|
|
1884
|
+
};
|
|
1885
|
+
J.Panel = V, J.PanelTexture = U;
|
|
1886
|
+
var Y = J;
|
|
1887
|
+
//#endregion
|
|
1888
|
+
//#region ../renderer/src/debug/components/Stats.tsx
|
|
1889
|
+
function X() {
|
|
1890
|
+
let e = (0, l.c)(3), t = c(Z), n, r;
|
|
1891
|
+
return e[0] === t ? (n = e[1], r = e[2]) : (n = () => {
|
|
1892
|
+
let e = new Y({
|
|
1893
|
+
trackGPU: !0,
|
|
1894
|
+
trackHz: !0
|
|
1895
|
+
});
|
|
1896
|
+
e.init(t), document.body.appendChild(e.domElement);
|
|
1897
|
+
let n = i(() => e.update());
|
|
1898
|
+
return () => {
|
|
1899
|
+
e.dispose(), n();
|
|
1900
|
+
};
|
|
1901
|
+
}, r = [t], e[0] = t, e[1] = n, e[2] = r), (0, u.useEffect)(n, r), null;
|
|
1902
|
+
}
|
|
1903
|
+
function Z(e) {
|
|
1904
|
+
return e.gl;
|
|
1905
|
+
}
|
|
1906
|
+
//#endregion
|
|
1907
|
+
//#region ../renderer/src/debug/components/DebugTools.tsx
|
|
1908
|
+
function Q(e) {
|
|
1909
|
+
let t = (0, l.c)(4), { children: n } = e, r, i;
|
|
1910
|
+
t[0] === Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ (0, p.jsx)(X, {}), i = /* @__PURE__ */ (0, p.jsx)(L, {}), t[0] = r, t[1] = i) : (r = t[0], i = t[1]);
|
|
1911
|
+
let a;
|
|
1912
|
+
return t[2] === n ? a = t[3] : (a = /* @__PURE__ */ (0, p.jsx)(F, { children: /* @__PURE__ */ (0, p.jsxs)(v, { children: [
|
|
1913
|
+
n,
|
|
1914
|
+
r,
|
|
1915
|
+
i
|
|
1916
|
+
] }) }), t[2] = n, t[3] = a), a;
|
|
1917
|
+
}
|
|
1918
|
+
//#endregion
|
|
1919
|
+
export { Q as DebugTools };
|
|
1920
|
+
|
|
1921
|
+
;/* vite-per-chunk-css */
|
|
1922
|
+
__vite_inject_css__("._info_hhyz2_1{color:#fff;white-space:pre;padding:.5em;font-family:monospace;line-height:1.5}._toggle_hhyz2_9{color:#ebebeb;cursor:pointer;background:#111;border:none;height:25px;padding:0 4px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Arial,sans-serif;font-size:11px;font-weight:600;transition:background .2s}._toggle_hhyz2_9:hover{opacity:.85}._container_hhyz2_26{z-index:1;background:#1f1f1fa0;flex-direction:column-reverse;align-items:stretch;width:250px;display:flex;position:absolute;bottom:0}._left_hhyz2_40{left:0}._right_hhyz2_44{width:350px;right:0}\n/*$vite$:1*/", "DebugTools.css", true);
|