@luxonis/visualizer-protobuf 2.18.0 → 2.18.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/{deserialization.worker-DsG76nP8.js → deserialization.worker-C9dXbAlS.js} +29 -198
- package/dist/{index-BFMXTxLw.js → index-B-Q9SHDe.js} +2 -2
- package/dist/{index-DdKOhCXT.js → index-BRTt63KE.js} +2 -2
- package/dist/{index-Ci0X5xT3.js → index-BY93INKj.js} +2 -2
- package/dist/{index-BWittpbR.js → index-B_wE-TAZ.js} +2 -2
- package/dist/{index-BomoqOv5.js → index-Bw0wb_7x.js} +2 -2
- package/dist/{index-BT9CBn7l.js → index-C1DjWsph.js} +3 -3
- package/dist/{index-4PQpGzhb.js → index-CWyWOStx.js} +2 -2
- package/dist/{index-ByIsztCr.js → index-CZ83vGC_.js} +2 -2
- package/dist/{index-CrtBH66u.js → index-ClVSD2eR.js} +2 -2
- package/dist/{index-CcIi7pJR.js → index-Cn-9uas1.js} +2 -2
- package/dist/{index-DUUnuN10.js → index-DD1GBu5y.js} +2 -2
- package/dist/{index-CR6XGTJc.js → index-DHft_1uY.js} +61 -30
- package/dist/{index-CXThSQcL.js → index-DQCgeYB2.js} +2 -2
- package/dist/{index-CJRhjhJ0.js → index-DuOl-R4e.js} +2 -2
- package/dist/{index-BeQ1w8aW.js → index-IroDl_1U.js} +2 -2
- package/dist/{index-DchGURxJ.js → index-WMQ28NAM.js} +2 -2
- package/dist/{index-CcP1Qppv.js → index-hFI4BOol.js} +2 -2
- package/dist/{index-CXIVXFcJ.js → index-hGphzS2C.js} +4 -4
- package/dist/{index-BQecGu9I.js → index-lMTiVIpT.js} +2 -2
- package/dist/index.js +2 -2
- package/dist/lib/src/connection/foxglove-connection.d.ts +3 -1
- package/dist/lib/src/connection/foxglove-connection.d.ts.map +1 -1
- package/dist/lib/src/connection/foxglove-connection.js +11 -2
- package/dist/lib/src/connection/foxglove-connection.js.map +1 -1
- package/dist/lib/src/messaging/deserialization/pointcloud/pointcloudFromDepth.worker.d.ts +2 -0
- package/dist/lib/src/messaging/deserialization/pointcloud/pointcloudFromDepth.worker.d.ts.map +1 -0
- package/dist/lib/src/messaging/deserialization/pointcloud/pointcloudFromDepth.worker.js +164 -0
- package/dist/lib/src/messaging/deserialization/pointcloud/pointcloudFromDepth.worker.js.map +1 -0
- package/dist/lib/src/messaging/deserialization/pointcloud/utils.d.ts +9 -1
- package/dist/lib/src/messaging/deserialization/pointcloud/utils.d.ts.map +1 -1
- package/dist/lib/src/messaging/deserialization/pointcloud/utils.js +13 -7
- package/dist/lib/src/messaging/deserialization/pointcloud/utils.js.map +1 -1
- package/dist/lib/src/messaging/deserialization/video/color.js +1 -1
- package/dist/lib/src/messaging/deserialization/video/color.js.map +1 -1
- package/dist/lib/src/messaging/deserialization/video/depth.d.ts +14 -3
- package/dist/lib/src/messaging/deserialization/video/depth.d.ts.map +1 -1
- package/dist/lib/src/messaging/deserialization/video/depth.js +16 -157
- package/dist/lib/src/messaging/deserialization/video/depth.js.map +1 -1
- package/dist/lib/src/messaging/deserialization/video/h264.d.ts.map +1 -1
- package/dist/lib/src/messaging/deserialization/video/h264.js.map +1 -1
- package/dist/lib/src/messaging/deserialization.worker.d.ts +15 -11
- package/dist/lib/src/messaging/deserialization.worker.d.ts.map +1 -1
- package/dist/lib/src/messaging/deserialization.worker.js +6 -5
- package/dist/lib/src/messaging/deserialization.worker.js.map +1 -1
- package/dist/lib/src/messaging/message-handler.d.ts.map +1 -1
- package/dist/lib/src/messaging/message-handler.js +2 -1
- package/dist/lib/src/messaging/message-handler.js.map +1 -1
- package/dist/lib/src/utils/poitcloud-sync.d.ts.map +1 -1
- package/dist/lib/src/utils/poitcloud-sync.js +18 -5
- package/dist/lib/src/utils/poitcloud-sync.js.map +1 -1
- package/dist/pointcloudFromDepth.worker-CnEm_1b0.js +199 -0
- package/dist/{tslib.es6-D98N6tjc.js → tslib.es6-D1dICxG6.js} +15 -8
- package/dist/{useMessageReducer-Cg30zaG9.js → useMessageReducer--GRvgQq6.js} +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as i420ToRgbaToPoitcloudWorker, d as dist$1, e as estimateObjectSize, r as reportError, A as AppError, b as baseFlatten, a as baseEach, c as baseIteratee, f as baseDifference, g as getTag, h as baseKeys, j as baseIsEqual, k as castPath, t as toKey, l as baseGet, m as hasIn, s as sendNotification, n as shallowequal, u as useGuaranteedContext, o as getPanelIdsInsideTabPanels, p as getPanelTypeFromId, T as TAB_PANEL_TYPE, q as removePanelFromTabPanel, v as getPanelIdForType, w as getPathFromNode, x as updateTabPanelLayout, y as getSaveConfigsPayloadForAddedPanel, z as replaceAndRemovePanels, B as inlineTabPanelLayouts, C as getAllPanelIds, D as getConfigsForNestedPanelsInsideTab, E as reorderTabWithinTabPanel, F as moveTabBetweenTabPanels, G as isTabPanelConfig, H as DEFAULT_TAB_PANEL_CONFIG, I as addPanelToTab, J as createAddUpdates, K as filterMap, L as Logger, M as uniq$2, N as useShallowMemo, O as CurrentLayoutContext, P as MessageOrderTracker, Q as AppConfigurationContext, _ as __assign$7, R as __rest$4, S as __spreadArray$4 } from './tslib.es6-D1dICxG6.js';
|
|
2
2
|
import { w as wrap$3, p as proxy } from './comlink-DHMAu6X7.js';
|
|
3
3
|
import { B as BinaryOpcode } from './FoxgloveServer-C39Uooyk.js';
|
|
4
4
|
import { g as getDefaultExportFromCjs, c as commonjsGlobal } from './_commonjsHelpers-E-ZsRS8r.js';
|
|
@@ -443,13 +443,14 @@ class Condvar {
|
|
|
443
443
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
444
444
|
|
|
445
445
|
function initWorker(callback) {
|
|
446
|
-
const workerWrap = wrap$3(new Worker(new URL("deserialization.worker-
|
|
446
|
+
const workerWrap = wrap$3(new Worker(new URL("deserialization.worker-C9dXbAlS.js", import.meta.url), {
|
|
447
447
|
type: "module",
|
|
448
448
|
name: `message-decoder`
|
|
449
449
|
}));
|
|
450
450
|
workerWrap.initCallback(proxy(callback));
|
|
451
451
|
return workerWrap;
|
|
452
452
|
}
|
|
453
|
+
const neuralCameraIntrinsics = JSON.parse(localStorage.getItem("neuralCameraIntrinsics") ?? "{}");
|
|
453
454
|
function createMessageHandler(callback) {
|
|
454
455
|
const workerPool = new Map();
|
|
455
456
|
return {
|
|
@@ -467,7 +468,8 @@ function createMessageHandler(callback) {
|
|
|
467
468
|
worker.handleMessageToDecode({
|
|
468
469
|
schema,
|
|
469
470
|
buffer,
|
|
470
|
-
topic
|
|
471
|
+
topic,
|
|
472
|
+
neuralCameraIntrinsics
|
|
471
473
|
});
|
|
472
474
|
}
|
|
473
475
|
};
|
|
@@ -530,9 +532,15 @@ class PoitCloudSyncFramework {
|
|
|
530
532
|
// biome-ignore lint/style/noNonNullAssertion:
|
|
531
533
|
const midKey = arr[mid].timestamp.nsec;
|
|
532
534
|
if (midKey === targetKey) {
|
|
535
|
+
if (Math.abs(midKey - targetKey) / 10 ** 9 < this.#MAX_DELAY_SEC) {
|
|
536
|
+
return {
|
|
537
|
+
res: bestMatch,
|
|
538
|
+
index: left
|
|
539
|
+
};
|
|
540
|
+
}
|
|
533
541
|
return {
|
|
534
|
-
res:
|
|
535
|
-
index:
|
|
542
|
+
res: null,
|
|
543
|
+
index: mid
|
|
536
544
|
};
|
|
537
545
|
}
|
|
538
546
|
if (midKey < targetKey) {
|
|
@@ -542,13 +550,20 @@ class PoitCloudSyncFramework {
|
|
|
542
550
|
right = mid - 1;
|
|
543
551
|
}
|
|
544
552
|
}
|
|
553
|
+
if (bestMatch && Math.abs(bestMatch.timestamp.nsec - targetKey) / 10 ** 9 < this.#MAX_DELAY_SEC) {
|
|
554
|
+
return {
|
|
555
|
+
res: bestMatch,
|
|
556
|
+
index: left
|
|
557
|
+
};
|
|
558
|
+
}
|
|
545
559
|
return {
|
|
546
|
-
res:
|
|
560
|
+
res: null,
|
|
547
561
|
index: left
|
|
548
562
|
};
|
|
549
563
|
}
|
|
550
564
|
storedFrames = [];
|
|
551
|
-
#
|
|
565
|
+
#MAX_DELAY_SEC = 0.01;
|
|
566
|
+
#MAX_STORED_FRAMES = 15;
|
|
552
567
|
getFrame(nsec) {
|
|
553
568
|
const {
|
|
554
569
|
res,
|
|
@@ -561,8 +576,14 @@ class PoitCloudSyncFramework {
|
|
|
561
576
|
if (res) {
|
|
562
577
|
return res;
|
|
563
578
|
}
|
|
564
|
-
|
|
565
|
-
|
|
579
|
+
const popedFrame = this.storedFrames.pop();
|
|
580
|
+
if (popedFrame) {
|
|
581
|
+
if (Math.abs(popedFrame.timestamp.nsec - nsec) / 10 ** 9 < this.#MAX_DELAY_SEC) {
|
|
582
|
+
return popedFrame;
|
|
583
|
+
}
|
|
584
|
+
this.storedFrames.push(popedFrame);
|
|
585
|
+
}
|
|
586
|
+
return null;
|
|
566
587
|
}
|
|
567
588
|
addFrame(frame) {
|
|
568
589
|
if (Object.keys(this.storedFrames).length > this.#MAX_STORED_FRAMES) {
|
|
@@ -605,6 +626,7 @@ class FoxgloveConnection {
|
|
|
605
626
|
inputMetrics = new MetricsManager();
|
|
606
627
|
decodeMetrics = new MetricsManager();
|
|
607
628
|
PoitCloudSyncFramework = new PoitCloudSyncFramework();
|
|
629
|
+
i420ToRgbaToPoitcloudWorkerPool = new i420ToRgbaToPoitcloudWorker();
|
|
608
630
|
// message handler
|
|
609
631
|
|
|
610
632
|
topics = {};
|
|
@@ -632,9 +654,18 @@ class FoxgloveConnection {
|
|
|
632
654
|
async handleParsePoitcloudMessage(coloredEvent) {
|
|
633
655
|
const poitcloudFrame = this.PoitCloudSyncFramework.getFrame(coloredEvent.receiveTime.nsec);
|
|
634
656
|
if (poitcloudFrame) {
|
|
657
|
+
/* Useful for debugging
|
|
658
|
+
if (Math.abs(coloredEvent.receiveTime.nsec- poitcloudFrame.timestamp.nsec)/10 ** 9) {
|
|
659
|
+
console.log("Sync delay under 1s", Math.abs(coloredEvent.receiveTime.nsec- poitcloudFrame.timestamp.nsec)/ 10 **9);
|
|
660
|
+
}
|
|
661
|
+
else {
|
|
662
|
+
console.log("Sync delay over 1s", Math.abs(coloredEvent.receiveTime.nsec- poitcloudFrame.timestamp.nsec)/10 ** 9);
|
|
663
|
+
}
|
|
664
|
+
*/
|
|
665
|
+
|
|
635
666
|
// @ts-expect-error - ITS unknow
|
|
636
667
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
637
|
-
const message = await i420ToRgbaToPointcloudWorker(coloredEvent.message.data, coloredEvent.message.width, coloredEvent.message.height, poitcloudFrame.width, poitcloudFrame.height, poitcloudFrame.data);
|
|
668
|
+
const message = await this.i420ToRgbaToPoitcloudWorkerPool.i420ToRgbaToPointcloudWorker(coloredEvent.message.data, coloredEvent.message.width, coloredEvent.message.height, poitcloudFrame.width, poitcloudFrame.height, poitcloudFrame.data);
|
|
638
669
|
coloredEvent.topic = "Point Cloud";
|
|
639
670
|
coloredEvent.schemaName = "foxglove.PointCloud";
|
|
640
671
|
coloredEvent.message = poitcloudFrame;
|
|
@@ -84813,7 +84844,7 @@ function legacy(parser) {
|
|
|
84813
84844
|
return new LanguageSupport(StreamLanguage.define(parser));
|
|
84814
84845
|
}
|
|
84815
84846
|
function sql$1(dialectName) {
|
|
84816
|
-
return import('./index-
|
|
84847
|
+
return import('./index-BRTt63KE.js').then(m => m.sql({ dialect: m[dialectName] }));
|
|
84817
84848
|
}
|
|
84818
84849
|
/**
|
|
84819
84850
|
An array of language descriptions for known language packages.
|
|
@@ -84824,7 +84855,7 @@ const languages = [
|
|
|
84824
84855
|
name: "C",
|
|
84825
84856
|
extensions: ["c", "h", "ino"],
|
|
84826
84857
|
load() {
|
|
84827
|
-
return import('./index-
|
|
84858
|
+
return import('./index-WMQ28NAM.js').then(m => m.cpp());
|
|
84828
84859
|
}
|
|
84829
84860
|
}),
|
|
84830
84861
|
/*@__PURE__*/LanguageDescription.of({
|
|
@@ -84832,7 +84863,7 @@ const languages = [
|
|
|
84832
84863
|
alias: ["cpp"],
|
|
84833
84864
|
extensions: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"],
|
|
84834
84865
|
load() {
|
|
84835
|
-
return import('./index-
|
|
84866
|
+
return import('./index-WMQ28NAM.js').then(m => m.cpp());
|
|
84836
84867
|
}
|
|
84837
84868
|
}),
|
|
84838
84869
|
/*@__PURE__*/LanguageDescription.of({
|
|
@@ -84852,7 +84883,7 @@ const languages = [
|
|
|
84852
84883
|
name: "Go",
|
|
84853
84884
|
extensions: ["go"],
|
|
84854
84885
|
load() {
|
|
84855
|
-
return import('./index-
|
|
84886
|
+
return import('./index-hFI4BOol.js').then(m => m.go());
|
|
84856
84887
|
}
|
|
84857
84888
|
}),
|
|
84858
84889
|
/*@__PURE__*/LanguageDescription.of({
|
|
@@ -84867,7 +84898,7 @@ const languages = [
|
|
|
84867
84898
|
name: "Java",
|
|
84868
84899
|
extensions: ["java"],
|
|
84869
84900
|
load() {
|
|
84870
|
-
return import('./index-
|
|
84901
|
+
return import('./index-CZ83vGC_.js').then(m => m.java());
|
|
84871
84902
|
}
|
|
84872
84903
|
}),
|
|
84873
84904
|
/*@__PURE__*/LanguageDescription.of({
|
|
@@ -84883,7 +84914,7 @@ const languages = [
|
|
|
84883
84914
|
alias: ["json5"],
|
|
84884
84915
|
extensions: ["json", "map"],
|
|
84885
84916
|
load() {
|
|
84886
|
-
return import('./index-
|
|
84917
|
+
return import('./index-Cn-9uas1.js').then(m => m.json());
|
|
84887
84918
|
}
|
|
84888
84919
|
}),
|
|
84889
84920
|
/*@__PURE__*/LanguageDescription.of({
|
|
@@ -84897,14 +84928,14 @@ const languages = [
|
|
|
84897
84928
|
name: "LESS",
|
|
84898
84929
|
extensions: ["less"],
|
|
84899
84930
|
load() {
|
|
84900
|
-
return import('./index-
|
|
84931
|
+
return import('./index-CWyWOStx.js').then(m => m.less());
|
|
84901
84932
|
}
|
|
84902
84933
|
}),
|
|
84903
84934
|
/*@__PURE__*/LanguageDescription.of({
|
|
84904
84935
|
name: "Liquid",
|
|
84905
84936
|
extensions: ["liquid"],
|
|
84906
84937
|
load() {
|
|
84907
|
-
return import('./index-
|
|
84938
|
+
return import('./index-B-Q9SHDe.js').then(m => m.liquid());
|
|
84908
84939
|
}
|
|
84909
84940
|
}),
|
|
84910
84941
|
/*@__PURE__*/LanguageDescription.of({
|
|
@@ -84930,7 +84961,7 @@ const languages = [
|
|
|
84930
84961
|
name: "PHP",
|
|
84931
84962
|
extensions: ["php", "php3", "php4", "php5", "php7", "phtml"],
|
|
84932
84963
|
load() {
|
|
84933
|
-
return import('./index-
|
|
84964
|
+
return import('./index-BY93INKj.js').then(m => m.php());
|
|
84934
84965
|
}
|
|
84935
84966
|
}),
|
|
84936
84967
|
/*@__PURE__*/LanguageDescription.of({
|
|
@@ -84947,28 +84978,28 @@ const languages = [
|
|
|
84947
84978
|
extensions: ["BUILD", "bzl", "py", "pyw"],
|
|
84948
84979
|
filename: /^(BUCK|BUILD)$/,
|
|
84949
84980
|
load() {
|
|
84950
|
-
return import('./index-
|
|
84981
|
+
return import('./index-DD1GBu5y.js').then(m => m.python());
|
|
84951
84982
|
}
|
|
84952
84983
|
}),
|
|
84953
84984
|
/*@__PURE__*/LanguageDescription.of({
|
|
84954
84985
|
name: "Rust",
|
|
84955
84986
|
extensions: ["rs"],
|
|
84956
84987
|
load() {
|
|
84957
|
-
return import('./index-
|
|
84988
|
+
return import('./index-DQCgeYB2.js').then(m => m.rust());
|
|
84958
84989
|
}
|
|
84959
84990
|
}),
|
|
84960
84991
|
/*@__PURE__*/LanguageDescription.of({
|
|
84961
84992
|
name: "Sass",
|
|
84962
84993
|
extensions: ["sass"],
|
|
84963
84994
|
load() {
|
|
84964
|
-
return import('./index-
|
|
84995
|
+
return import('./index-Bw0wb_7x.js').then(m => m.sass({ indented: true }));
|
|
84965
84996
|
}
|
|
84966
84997
|
}),
|
|
84967
84998
|
/*@__PURE__*/LanguageDescription.of({
|
|
84968
84999
|
name: "SCSS",
|
|
84969
85000
|
extensions: ["scss"],
|
|
84970
85001
|
load() {
|
|
84971
|
-
return import('./index-
|
|
85002
|
+
return import('./index-Bw0wb_7x.js').then(m => m.sass());
|
|
84972
85003
|
}
|
|
84973
85004
|
}),
|
|
84974
85005
|
/*@__PURE__*/LanguageDescription.of({
|
|
@@ -84999,7 +85030,7 @@ const languages = [
|
|
|
84999
85030
|
name: "WebAssembly",
|
|
85000
85031
|
extensions: ["wat", "wast"],
|
|
85001
85032
|
load() {
|
|
85002
|
-
return import('./index-
|
|
85033
|
+
return import('./index-ClVSD2eR.js').then(m => m.wast());
|
|
85003
85034
|
}
|
|
85004
85035
|
}),
|
|
85005
85036
|
/*@__PURE__*/LanguageDescription.of({
|
|
@@ -85007,7 +85038,7 @@ const languages = [
|
|
|
85007
85038
|
alias: ["rss", "wsdl", "xsd"],
|
|
85008
85039
|
extensions: ["xml", "xsl", "xsd", "svg"],
|
|
85009
85040
|
load() {
|
|
85010
|
-
return import('./index-
|
|
85041
|
+
return import('./index-DuOl-R4e.js').then(m => m.xml());
|
|
85011
85042
|
}
|
|
85012
85043
|
}),
|
|
85013
85044
|
/*@__PURE__*/LanguageDescription.of({
|
|
@@ -85015,7 +85046,7 @@ const languages = [
|
|
|
85015
85046
|
alias: ["yml"],
|
|
85016
85047
|
extensions: ["yaml", "yml"],
|
|
85017
85048
|
load() {
|
|
85018
|
-
return import('./index-
|
|
85049
|
+
return import('./index-lMTiVIpT.js').then(m => m.yaml());
|
|
85019
85050
|
}
|
|
85020
85051
|
}),
|
|
85021
85052
|
// Legacy modes ported from CodeMirror 5
|
|
@@ -85811,13 +85842,13 @@ const languages = [
|
|
|
85811
85842
|
name: "Vue",
|
|
85812
85843
|
extensions: ["vue"],
|
|
85813
85844
|
load() {
|
|
85814
|
-
return import('./index-
|
|
85845
|
+
return import('./index-B_wE-TAZ.js').then(m => m.vue());
|
|
85815
85846
|
}
|
|
85816
85847
|
}),
|
|
85817
85848
|
/*@__PURE__*/LanguageDescription.of({
|
|
85818
85849
|
name: "Angular Template",
|
|
85819
85850
|
load() {
|
|
85820
|
-
return import('./index-
|
|
85851
|
+
return import('./index-IroDl_1U.js').then(m => m.angular());
|
|
85821
85852
|
}
|
|
85822
85853
|
})
|
|
85823
85854
|
];
|
|
@@ -156922,7 +156953,7 @@ function createRenderDelaySampler() {
|
|
|
156922
156953
|
};
|
|
156923
156954
|
}
|
|
156924
156955
|
|
|
156925
|
-
const ImagePanelComponent = /*#__PURE__*/React__default.lazy(async () => await import('./index-
|
|
156956
|
+
const ImagePanelComponent = /*#__PURE__*/React__default.lazy(async () => await import('./index-hGphzS2C.js'));
|
|
156926
156957
|
const ImagePanelBody = ({
|
|
156927
156958
|
topic,
|
|
156928
156959
|
frameRenderedEvent
|
|
@@ -156991,7 +157022,7 @@ const ImagePanel = /*#__PURE__*/React__default.memo(function ImagePanel(props) {
|
|
|
156991
157022
|
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
156992
157023
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
156993
157024
|
|
|
156994
|
-
const ThreeDeeRenderComponent = /*#__PURE__*/React__default.lazy(async () => await import('./index-
|
|
157025
|
+
const ThreeDeeRenderComponent = /*#__PURE__*/React__default.lazy(async () => await import('./index-C1DjWsph.js'));
|
|
156995
157026
|
const PointCloudPanelBody = ({
|
|
156996
157027
|
topic,
|
|
156997
157028
|
frameRenderedEvent
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { U as ExternalTokenizer, N as styleTags, O as tags, V as LRParser, Q as LRLanguage, J as indentNodeProp, K as continuedIndent, M as foldNodeProp, a1 as foldInside, T as LanguageSupport } from './index-
|
|
2
|
-
import './tslib.es6-
|
|
1
|
+
import { U as ExternalTokenizer, N as styleTags, O as tags, V as LRParser, Q as LRLanguage, J as indentNodeProp, K as continuedIndent, M as foldNodeProp, a1 as foldInside, T as LanguageSupport } from './index-DHft_1uY.js';
|
|
2
|
+
import './tslib.es6-D1dICxG6.js';
|
|
3
3
|
import './comlink-DHMAu6X7.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'react-mosaic-component';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a2 as ContextTracker, U as ExternalTokenizer, N as styleTags, O as tags, V as LRParser, Q as LRLanguage, J as indentNodeProp, M as foldNodeProp, ac as bracketMatchingHandle, T as LanguageSupport, a8 as EditorView, Z as syntaxTree, a9 as EditorSelection } from './index-
|
|
2
|
-
import './tslib.es6-
|
|
1
|
+
import { a2 as ContextTracker, U as ExternalTokenizer, N as styleTags, O as tags, V as LRParser, Q as LRLanguage, J as indentNodeProp, M as foldNodeProp, ac as bracketMatchingHandle, T as LanguageSupport, a8 as EditorView, Z as syntaxTree, a9 as EditorSelection } from './index-DHft_1uY.js';
|
|
2
|
+
import './tslib.es6-D1dICxG6.js';
|
|
3
3
|
import './comlink-DHMAu6X7.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'react-mosaic-component';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as styleTags, O as tags, ad as javascriptLanguage, Q as LRLanguage, T as LanguageSupport, V as LRParser, aa as html, ab as parseMixed, U as ExternalTokenizer } from './index-
|
|
2
|
-
import './tslib.es6-
|
|
1
|
+
import { N as styleTags, O as tags, ad as javascriptLanguage, Q as LRLanguage, T as LanguageSupport, V as LRParser, aa as html, ab as parseMixed, U as ExternalTokenizer } from './index-DHft_1uY.js';
|
|
2
|
+
import './tslib.es6-D1dICxG6.js';
|
|
3
3
|
import './comlink-DHMAu6X7.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'react-mosaic-component';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { U as ExternalTokenizer, N as styleTags, O as tags, V as LRParser, Q as LRLanguage, J as indentNodeProp, K as continuedIndent, $ as flatIndent, a0 as delimitedIndent, M as foldNodeProp, a1 as foldInside, T as LanguageSupport } from './index-
|
|
2
|
-
import './tslib.es6-
|
|
1
|
+
import { U as ExternalTokenizer, N as styleTags, O as tags, V as LRParser, Q as LRLanguage, J as indentNodeProp, K as continuedIndent, $ as flatIndent, a0 as delimitedIndent, M as foldNodeProp, a1 as foldInside, T as LanguageSupport } from './index-DHft_1uY.js';
|
|
2
|
+
import './tslib.es6-D1dICxG6.js';
|
|
3
3
|
import './comlink-DHMAu6X7.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'react-mosaic-component';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { U as ExternalTokenizer, a2 as ContextTracker, N as styleTags, O as tags, V as LRParser, a3 as LocalTokenGroup, a4 as snippetCompletion, Z as syntaxTree, Q as LRLanguage, J as indentNodeProp, K as continuedIndent, $ as flatIndent, a0 as delimitedIndent, M as foldNodeProp, a1 as foldInside, T as LanguageSupport, X as ifNotIn, Y as completeFromList, a5 as IterMode, a6 as NodeWeakMap } from './index-
|
|
2
|
-
import './tslib.es6-
|
|
1
|
+
import { U as ExternalTokenizer, a2 as ContextTracker, N as styleTags, O as tags, V as LRParser, a3 as LocalTokenGroup, a4 as snippetCompletion, Z as syntaxTree, Q as LRLanguage, J as indentNodeProp, K as continuedIndent, $ as flatIndent, a0 as delimitedIndent, M as foldNodeProp, a1 as foldInside, T as LanguageSupport, X as ifNotIn, Y as completeFromList, a5 as IterMode, a6 as NodeWeakMap } from './index-DHft_1uY.js';
|
|
2
|
+
import './tslib.es6-D1dICxG6.js';
|
|
3
3
|
import './comlink-DHMAu6X7.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'react-mosaic-component';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ImagePanel } from './index-
|
|
1
|
+
import { ImagePanel } from './index-C1DjWsph.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import 'react-dom';
|
|
4
|
-
import './tslib.es6-
|
|
4
|
+
import './tslib.es6-D1dICxG6.js';
|
|
5
5
|
import './comlink-DHMAu6X7.js';
|
|
6
6
|
import 'react-mosaic-component';
|
|
7
7
|
import './_commonjsHelpers-E-ZsRS8r.js';
|
|
8
8
|
import '@mui/material';
|
|
9
9
|
import './isArrayLikeObject-Bytw9p-q.js';
|
|
10
10
|
import 'zustand';
|
|
11
|
-
import './index-
|
|
11
|
+
import './index-DHft_1uY.js';
|
|
12
12
|
import './FoxgloveServer-C39Uooyk.js';
|
|
13
13
|
import 'ms';
|
|
14
14
|
import './foxglove-protocol-CYoMweAY.js';
|
|
@@ -24,7 +24,7 @@ import 'rehype-sanitize';
|
|
|
24
24
|
import 'extend';
|
|
25
25
|
import 'react-icons';
|
|
26
26
|
import '@pandacss/dev';
|
|
27
|
-
import './useMessageReducer
|
|
27
|
+
import './useMessageReducer--GRvgQq6.js';
|
|
28
28
|
import '@mui/icons-material/FullscreenExit';
|
|
29
29
|
import '@mui/icons-material/Settings';
|
|
30
30
|
import '@mui/icons-material/ChevronRight';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a2 as ContextTracker, U as ExternalTokenizer, N as styleTags, O as tags, V as LRParser, Q as LRLanguage, J as indentNodeProp, a0 as delimitedIndent, M as foldNodeProp, a1 as foldInside, T as LanguageSupport, ab as parseMixed } from './index-
|
|
2
|
-
import './tslib.es6-
|
|
1
|
+
import { a2 as ContextTracker, U as ExternalTokenizer, N as styleTags, O as tags, V as LRParser, Q as LRLanguage, J as indentNodeProp, a0 as delimitedIndent, M as foldNodeProp, a1 as foldInside, T as LanguageSupport, ab as parseMixed } from './index-DHft_1uY.js';
|
|
2
|
+
import './tslib.es6-D1dICxG6.js';
|
|
3
3
|
import './comlink-DHMAu6X7.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'react-mosaic-component';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ah as ImagePanel, ag as PanelLayout, ai as PointCloudPanel, ae as VisualizerConnection, af as VisualizerContext } from './index-
|
|
2
|
-
import './tslib.es6-
|
|
1
|
+
export { ah as ImagePanel, ag as PanelLayout, ai as PointCloudPanel, ae as VisualizerConnection, af as VisualizerContext } from './index-DHft_1uY.js';
|
|
2
|
+
import './tslib.es6-D1dICxG6.js';
|
|
3
3
|
import './comlink-DHMAu6X7.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'react-mosaic-component';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type Time } from "@foxglove/rostime";
|
|
2
2
|
import { type MessageEvent, PlayerPresence, type PlayerProblem, type PlayerState } from "@foxglove/studio-base/players/types";
|
|
3
|
+
import type { FoxgloveMessage } from "./communicator.js";
|
|
4
|
+
import { i420ToRgbaToPoitcloudWorker } from "../messaging/deserialization/pointcloud/utils.js";
|
|
3
5
|
import { type MessageHandler } from "../messaging/message-handler.js";
|
|
4
6
|
import { MetricsManager } from "../utils/metrics-manager.js";
|
|
5
7
|
import { PoitCloudSyncFramework } from "../utils/poitcloud-sync.js";
|
|
6
|
-
import type { FoxgloveMessage } from "./communicator.js";
|
|
7
8
|
export type Metrics = {
|
|
8
9
|
incomingMessagesFps: number;
|
|
9
10
|
decodedMessagesFps: number;
|
|
@@ -33,6 +34,7 @@ export declare abstract class FoxgloveConnection {
|
|
|
33
34
|
protected inputMetrics: MetricsManager;
|
|
34
35
|
protected decodeMetrics: MetricsManager;
|
|
35
36
|
protected PoitCloudSyncFramework: PoitCloudSyncFramework;
|
|
37
|
+
protected i420ToRgbaToPoitcloudWorkerPool: i420ToRgbaToPoitcloudWorker;
|
|
36
38
|
protected messageHandler: MessageHandler;
|
|
37
39
|
protected topics: {
|
|
38
40
|
[key: string]: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"foxglove-connection.d.ts","sourceRoot":"","sources":["../../../../src/connection/foxglove-connection.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,IAAI,EAAyC,MAAM,mBAAmB,CAAC;AAErF,OAAO,EACL,KAAK,YAAY,EAEjB,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,qCAAqC,CAAC;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IAAI,CAAC;IAC3B,SAAS,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC;IAEzB,SAAS,CAAC,UAAU,gBAAa;IACjC,SAAS,CAAC,eAAe,gBAAa;IACtC,SAAS,CAAC,gBAAgB,gBAAa;IACvC,SAAS,CAAC,kBAAkB,gBAAa;IACzC,SAAS,CAAC,aAAa,UAAS;IAChC,SAAS,CAAC,QAAQ,iBAAwB;IAC1C,SAAS,CAAC,YAAY,iBAAwB;IAC9C,SAAS,CAAC,aAAa,iBAAwB;IAC/C,SAAS,CAAC,sBAAsB,yBAAgC;IAChE,SAAS,CAAC,+BAA+B,8BAAoC;IAE7E,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;IAEzC,SAAS,CAAC,MAAM,EAAE;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG;YACb,IAAI,EAAE,MAAM,CAAC;YACb,UAAU,EAAE,MAAM,CAAC;SACpB,CAAC;KACH,CAAM;gBAGY,EAAE,EAAE,MAAM;IAKtB,WAAW,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAKxE,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAO9C,SAAS,CAAC,cAAc,IAAI,IAAI;IAIhC,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,UAAU,CAAC,YAAY,CAAC,eAAe,CAAC,GAAG,IAAI;cAKhE,2BAA2B,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAkCtF,SAAS,CAAC,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAgBxD,SAAS,CAAC,SAAS;;MAyDhB;CACJ"}
|
|
@@ -5,7 +5,7 @@ import { debouncePromise } from "@foxglove/den/async";
|
|
|
5
5
|
import { fromMillis, isGreaterThan, isLessThan } from "@foxglove/rostime";
|
|
6
6
|
import { estimateObjectSize } from "@foxglove/studio-base/players/messageMemoryEstimation";
|
|
7
7
|
import { PlayerCapabilities, PlayerPresence } from "@foxglove/studio-base/players/types";
|
|
8
|
-
import {
|
|
8
|
+
import { i420ToRgbaToPoitcloudWorker } from "../messaging/deserialization/pointcloud/utils.js";
|
|
9
9
|
import { createMessageHandler } from "../messaging/message-handler.js";
|
|
10
10
|
import { MetricsManager } from "../utils/metrics-manager.js";
|
|
11
11
|
import { PoitCloudSyncFramework } from "../utils/poitcloud-sync.js";
|
|
@@ -42,6 +42,7 @@ export class FoxgloveConnection {
|
|
|
42
42
|
inputMetrics = new MetricsManager();
|
|
43
43
|
decodeMetrics = new MetricsManager();
|
|
44
44
|
PoitCloudSyncFramework = new PoitCloudSyncFramework();
|
|
45
|
+
i420ToRgbaToPoitcloudWorkerPool = new i420ToRgbaToPoitcloudWorker();
|
|
45
46
|
// message handler
|
|
46
47
|
messageHandler;
|
|
47
48
|
topics = {};
|
|
@@ -69,9 +70,17 @@ export class FoxgloveConnection {
|
|
|
69
70
|
async handleParsePoitcloudMessage(coloredEvent) {
|
|
70
71
|
const poitcloudFrame = this.PoitCloudSyncFramework.getFrame(coloredEvent.receiveTime.nsec);
|
|
71
72
|
if (poitcloudFrame) {
|
|
73
|
+
/* Useful for debugging
|
|
74
|
+
if (Math.abs(coloredEvent.receiveTime.nsec- poitcloudFrame.timestamp.nsec)/10 ** 9) {
|
|
75
|
+
console.log("Sync delay under 1s", Math.abs(coloredEvent.receiveTime.nsec- poitcloudFrame.timestamp.nsec)/ 10 **9);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
console.log("Sync delay over 1s", Math.abs(coloredEvent.receiveTime.nsec- poitcloudFrame.timestamp.nsec)/10 ** 9);
|
|
79
|
+
}
|
|
80
|
+
*/
|
|
72
81
|
// @ts-expect-error - ITS unknow
|
|
73
82
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
74
|
-
const message = await i420ToRgbaToPointcloudWorker(coloredEvent.message.data, coloredEvent.message.width, coloredEvent.message.height, poitcloudFrame.width, poitcloudFrame.height, poitcloudFrame.data);
|
|
83
|
+
const message = await this.i420ToRgbaToPoitcloudWorkerPool.i420ToRgbaToPointcloudWorker(coloredEvent.message.data, coloredEvent.message.width, coloredEvent.message.height, poitcloudFrame.width, poitcloudFrame.height, poitcloudFrame.data);
|
|
75
84
|
coloredEvent.topic = "Point Cloud";
|
|
76
85
|
coloredEvent.schemaName = "foxglove.PointCloud";
|
|
77
86
|
coloredEvent.message = poitcloudFrame;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"foxglove-connection.js","sourceRoot":"","sources":["../../../../src/connection/foxglove-connection.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,oEAAoE;AACpE,0DAA0D;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAa,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAEL,kBAAkB,EAClB,cAAc,EAGf,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"foxglove-connection.js","sourceRoot":"","sources":["../../../../src/connection/foxglove-connection.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,oEAAoE;AACpE,0DAA0D;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAa,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAEL,kBAAkB,EAClB,cAAc,EAGf,MAAM,qCAAqC,CAAC;AAG7C,OAAO,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAC;AAE/F,OAAO,EAAuB,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,C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CAAC;gBACR,YAAY,EAAE,CAAC;gBACf,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;gBAClC,UAAU,EAAE,IAAI,GAAG,EAAE;gBACrB,SAAS,EAAE,IAAI,GAAG,EAAE;gBACpB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,eAAe,EAAE,IAAI,CAAC,eAAe;gBACrC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;gBACvC,QAAQ,EAAE,IAAI,CAAC,kBAAkB;aAClC;SACF,CAAC;QAEF,MAAM,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pointcloudFromDepth.worker.d.ts","sourceRoot":"","sources":["../../../../../../src/messaging/deserialization/pointcloud/pointcloudFromDepth.worker.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
4
|
+
/// <reference types="@webgpu/types" />
|
|
5
|
+
import { expose } from "comlink";
|
|
6
|
+
function depthToPointCloudBuffer(uint16Array, width, height, fx, fy, cx, cy) {
|
|
7
|
+
const depthData = Array.from({ length: height }, () => new Array(width));
|
|
8
|
+
for (let v = 0; v < height; v++) {
|
|
9
|
+
depthData[v] = depthData[v] ?? [];
|
|
10
|
+
for (let u = 0; u < width; u++) {
|
|
11
|
+
const d = uint16Array[v * width + u] ?? -1;
|
|
12
|
+
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
13
|
+
depthData[v][u] = d > 0 ? d : -1;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const points = [];
|
|
17
|
+
// Accumulate the x, y, z values for each pixel.
|
|
18
|
+
for (let v = 0; v < height; v++) {
|
|
19
|
+
const row = depthData[v];
|
|
20
|
+
if (!row) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
for (let u = 0; u < width; u++) {
|
|
24
|
+
const z = row[u] ?? 0;
|
|
25
|
+
const x = (cx - u) * z / fx;
|
|
26
|
+
const y = (cy - v) * z / fy;
|
|
27
|
+
points.push(x, y, z);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const pointCount = points.length / 3;
|
|
31
|
+
const buffer = new ArrayBuffer(pointCount * 16);
|
|
32
|
+
const view = new DataView(buffer);
|
|
33
|
+
for (let i = 0; i < pointCount; i++) {
|
|
34
|
+
const offset = i * 16;
|
|
35
|
+
view.setFloat32(offset, points[i * 3] ?? 0, true); //X
|
|
36
|
+
view.setFloat32(offset + 4, points[i * 3 + 1] ?? 0, true); //Y
|
|
37
|
+
view.setFloat32(offset + 8, points[i * 3 + 2] ?? 0, true); //Z
|
|
38
|
+
view.setUint8(offset + 12, 0); // R
|
|
39
|
+
view.setUint8(offset + 13, 0); // G
|
|
40
|
+
view.setUint8(offset + 14, 0); // B
|
|
41
|
+
view.setUint8(offset + 15, 255); // A
|
|
42
|
+
}
|
|
43
|
+
return new Uint8Array(buffer);
|
|
44
|
+
}
|
|
45
|
+
const shader = `
|
|
46
|
+
@group(0) @binding(0) var<storage, read> depthBuffer: array<u32>; // Uint16 stored as u32
|
|
47
|
+
@group(0) @binding(1) var<storage, read> intrinsicsBuffer: array<f32>;
|
|
48
|
+
@group(0) @binding(2) var<storage, read_write> xyzColorBuffer: array<u32>; // Stores XYZ + RGBA
|
|
49
|
+
|
|
50
|
+
@compute @workgroup_size(256, 1, 1)
|
|
51
|
+
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
|
|
52
|
+
let i = global_id.x;
|
|
53
|
+
let fx = intrinsicsBuffer[0];
|
|
54
|
+
let fy = intrinsicsBuffer[1];
|
|
55
|
+
let cx = intrinsicsBuffer[2];
|
|
56
|
+
let cy = intrinsicsBuffer[3];
|
|
57
|
+
let scale = intrinsicsBuffer[4];
|
|
58
|
+
let width = intrinsicsBuffer[5];
|
|
59
|
+
let height = intrinsicsBuffer[6];
|
|
60
|
+
|
|
61
|
+
if (i >= u32(width * height)) { return; }
|
|
62
|
+
|
|
63
|
+
let u = i % u32(width);
|
|
64
|
+
let v = i / u32(width);
|
|
65
|
+
|
|
66
|
+
// Convert uint16 depth value to float (stored as u32, so we bitwise mask)
|
|
67
|
+
let rawDepth = depthBuffer[i] & 0xFFFFu;
|
|
68
|
+
let z = f32(rawDepth) * scale;
|
|
69
|
+
|
|
70
|
+
let x = (cx - f32(u)) * z / fx;
|
|
71
|
+
let y = (cy - f32(v)) * z / fy;
|
|
72
|
+
|
|
73
|
+
let base = i * 4u; // 4 values per point (X, Y, Z, Color)
|
|
74
|
+
|
|
75
|
+
// Convert floats to u32 representation for storage
|
|
76
|
+
xyzColorBuffer[base] = bitcast<u32>(x);
|
|
77
|
+
xyzColorBuffer[base + 1u] = bitcast<u32>(y);
|
|
78
|
+
xyzColorBuffer[base + 2u] = bitcast<u32>(z);
|
|
79
|
+
|
|
80
|
+
// Example: RGB set based on depth, Alpha is fixed at 255
|
|
81
|
+
let r = u32(clamp(z * 255.0, 0.0, 255.0));
|
|
82
|
+
let g = u32(clamp(y * 255.0, 0.0, 255.0));
|
|
83
|
+
let b = u32(clamp(x * 255.0, 0.0, 255.0));
|
|
84
|
+
xyzColorBuffer[base + 3u] = (r & 0xFFu) | ((g & 0xFFu) << 8) | ((b & 0xFFu) << 16) | (255u << 24);
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
87
|
+
async function depthToPointcloudGPU(depthArray, width, height, fx, fy, cx, cy) {
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
89
|
+
if (!navigator.gpu) {
|
|
90
|
+
console.warn("WebGPU not supported.");
|
|
91
|
+
return depthToPointCloudBuffer(depthArray, width, height, fx, fy, cx, cy);
|
|
92
|
+
}
|
|
93
|
+
const adapter = await navigator.gpu.requestAdapter();
|
|
94
|
+
if (!adapter) {
|
|
95
|
+
console.warn("Couldn't request WebGPU adapter.");
|
|
96
|
+
return depthToPointCloudBuffer(depthArray, width, height, fx, fy, cx, cy);
|
|
97
|
+
}
|
|
98
|
+
const device = await adapter.requestDevice();
|
|
99
|
+
const queue = device.queue;
|
|
100
|
+
const scale = 1.0;
|
|
101
|
+
const numPixels = width * height;
|
|
102
|
+
const outputSize = numPixels * 16;
|
|
103
|
+
const depthData32 = new Uint32Array(depthArray);
|
|
104
|
+
const intrinsics = new Float32Array([fx, fy, cx, cy, scale, width, height]);
|
|
105
|
+
const depthBuffer = device.createBuffer({
|
|
106
|
+
size: depthData32.byteLength,
|
|
107
|
+
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST,
|
|
108
|
+
});
|
|
109
|
+
const intrinsicsBuffer = device.createBuffer({
|
|
110
|
+
size: intrinsics.byteLength,
|
|
111
|
+
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST,
|
|
112
|
+
});
|
|
113
|
+
const xyzColorBuffer = device.createBuffer({
|
|
114
|
+
size: outputSize,
|
|
115
|
+
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC,
|
|
116
|
+
});
|
|
117
|
+
queue.writeBuffer(depthBuffer, 0, depthData32);
|
|
118
|
+
queue.writeBuffer(intrinsicsBuffer, 0, intrinsics);
|
|
119
|
+
const bindGroupLayout = device.createBindGroupLayout({
|
|
120
|
+
entries: [
|
|
121
|
+
{ binding: 0, visibility: GPUShaderStage.COMPUTE, buffer: { type: "read-only-storage" } },
|
|
122
|
+
{ binding: 1, visibility: GPUShaderStage.COMPUTE, buffer: { type: "read-only-storage" } },
|
|
123
|
+
{ binding: 2, visibility: GPUShaderStage.COMPUTE, buffer: { type: "storage" } },
|
|
124
|
+
],
|
|
125
|
+
});
|
|
126
|
+
const bindGroup = device.createBindGroup({
|
|
127
|
+
layout: bindGroupLayout,
|
|
128
|
+
entries: [
|
|
129
|
+
{ binding: 0, resource: { buffer: depthBuffer } },
|
|
130
|
+
{ binding: 1, resource: { buffer: intrinsicsBuffer } },
|
|
131
|
+
{ binding: 2, resource: { buffer: xyzColorBuffer } },
|
|
132
|
+
],
|
|
133
|
+
});
|
|
134
|
+
const shaderModule = device.createShaderModule({
|
|
135
|
+
code: shader
|
|
136
|
+
});
|
|
137
|
+
const pipeline = device.createComputePipeline({
|
|
138
|
+
layout: device.createPipelineLayout({ bindGroupLayouts: [bindGroupLayout] }),
|
|
139
|
+
compute: { module: shaderModule, entryPoint: "main" },
|
|
140
|
+
});
|
|
141
|
+
const commandEncoder = device.createCommandEncoder();
|
|
142
|
+
const passEncoder = commandEncoder.beginComputePass();
|
|
143
|
+
passEncoder.setPipeline(pipeline);
|
|
144
|
+
passEncoder.setBindGroup(0, bindGroup);
|
|
145
|
+
passEncoder.dispatchWorkgroups(Math.ceil(numPixels / 256));
|
|
146
|
+
passEncoder.end();
|
|
147
|
+
device.queue.submit([commandEncoder.finish()]);
|
|
148
|
+
const outputBuffer = device.createBuffer({
|
|
149
|
+
size: xyzColorBuffer.size,
|
|
150
|
+
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ,
|
|
151
|
+
});
|
|
152
|
+
const copyEncoder = device.createCommandEncoder();
|
|
153
|
+
copyEncoder.copyBufferToBuffer(xyzColorBuffer, 0, outputBuffer, 0, xyzColorBuffer.size);
|
|
154
|
+
device.queue.submit([copyEncoder.finish()]);
|
|
155
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
156
|
+
await outputBuffer.mapAsync(GPUMapMode.READ);
|
|
157
|
+
const mappedRange = outputBuffer.getMappedRange();
|
|
158
|
+
const result = new Uint8Array(mappedRange.byteLength);
|
|
159
|
+
result.set(new Uint8Array(mappedRange));
|
|
160
|
+
outputBuffer.unmap();
|
|
161
|
+
return result;
|
|
162
|
+
}
|
|
163
|
+
expose({ depthToPointcloudGPU });
|
|
164
|
+
//# sourceMappingURL=pointcloudFromDepth.worker.js.map
|