@loaders.gl/pointclouds 5.0.0-beta.1 → 5.0.0-beta.10
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/LAS-README.md +1 -1
- package/PCD-README.md +1 -1
- package/PLY-README.md +1 -1
- package/README.md +5 -1
- package/dist/dist.dev.js +3584 -2211
- package/dist/dist.min.js +20 -20
- package/dist/index.cjs +0 -6
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/las/bundled.cjs +0 -3
- package/dist/las/bundled.cjs.map +2 -2
- package/dist/las/bundled.d.ts +0 -1
- package/dist/las/bundled.d.ts.map +1 -1
- package/dist/las/bundled.js +0 -1
- package/dist/las/bundled.js.map +1 -1
- package/dist/las/index.cjs +0 -3
- package/dist/las/index.cjs.map +3 -3
- package/dist/las/index.d.ts +0 -2
- package/dist/las/index.d.ts.map +1 -1
- package/dist/las/index.js +0 -3
- package/dist/las/index.js.map +1 -1
- package/dist/las/las-copc-loader-types.cjs +1 -1
- package/dist/las/las-copc-loader-types.cjs.map +2 -2
- package/dist/las/las-copc-loader-types.d.ts +13 -9
- package/dist/las/las-copc-loader-types.d.ts.map +1 -1
- package/dist/las/las-copc-loader-types.js +1 -1
- package/dist/las/las-copc-loader-types.js.map +1 -1
- package/dist/las/las-copc-loader.cjs +8 -5
- package/dist/las/las-copc-loader.cjs.map +2 -2
- package/dist/las/las-copc-loader.d.ts +8 -6
- package/dist/las/las-copc-loader.d.ts.map +1 -1
- package/dist/las/las-copc-loader.js +11 -6
- package/dist/las/las-copc-loader.js.map +1 -1
- package/dist/las/las-loader-shared.cjs +4 -2
- package/dist/las/las-loader-shared.cjs.map +2 -2
- package/dist/las/las-loader-shared.d.ts +9 -7
- package/dist/las/las-loader-shared.d.ts.map +1 -1
- package/dist/las/las-loader-shared.js +4 -2
- package/dist/las/las-loader-shared.js.map +1 -1
- package/dist/las/las-loader-types.cjs +3 -6
- package/dist/las/las-loader-types.cjs.map +2 -2
- package/dist/las/las-loader-types.d.ts +18 -45
- package/dist/las/las-loader-types.d.ts.map +1 -1
- package/dist/las/las-loader-types.js +1 -3
- package/dist/las/las-loader-types.js.map +1 -1
- package/dist/las/las-loader.cjs +61 -13
- package/dist/las/las-loader.cjs.map +3 -3
- package/dist/las/las-loader.d.ts +51 -5
- package/dist/las/las-loader.d.ts.map +1 -1
- package/dist/las/las-loader.js +56 -6
- package/dist/las/las-loader.js.map +1 -1
- package/dist/las/las-writer.cjs +3 -3
- package/dist/las/las-writer.cjs.map +2 -2
- package/dist/las/las-writer.d.ts +4 -3
- package/dist/las/las-writer.d.ts.map +1 -1
- package/dist/las/las-writer.js +4 -6
- package/dist/las/las-writer.js.map +1 -1
- package/dist/las/laz-rs-loader-types.cjs +1 -1
- package/dist/las/laz-rs-loader-types.cjs.map +2 -2
- package/dist/las/laz-rs-loader-types.d.ts +13 -9
- package/dist/las/laz-rs-loader-types.d.ts.map +1 -1
- package/dist/las/laz-rs-loader-types.js +1 -1
- package/dist/las/laz-rs-loader-types.js.map +1 -1
- package/dist/las/laz-rs-loader.cjs +8 -5
- package/dist/las/laz-rs-loader.cjs.map +2 -2
- package/dist/las/laz-rs-loader.d.ts +8 -6
- package/dist/las/laz-rs-loader.d.ts.map +1 -1
- package/dist/las/laz-rs-loader.js +11 -6
- package/dist/las/laz-rs-loader.js.map +1 -1
- package/dist/las/lazperf-loader-types.cjs +1 -1
- package/dist/las/lazperf-loader-types.cjs.map +2 -2
- package/dist/las/lazperf-loader-types.d.ts +14 -10
- package/dist/las/lazperf-loader-types.d.ts.map +1 -1
- package/dist/las/lazperf-loader-types.js +1 -1
- package/dist/las/lazperf-loader-types.js.map +1 -1
- package/dist/las/lazperf-loader.cjs +9 -6
- package/dist/las/lazperf-loader.cjs.map +2 -2
- package/dist/las/lazperf-loader.d.ts +9 -7
- package/dist/las/lazperf-loader.d.ts.map +1 -1
- package/dist/las/lazperf-loader.js +12 -7
- package/dist/las/lazperf-loader.js.map +1 -1
- package/dist/las/lib/copc/parse-las.cjs +1 -1
- package/dist/las/lib/copc/parse-las.cjs.map +2 -2
- package/dist/las/lib/copc/parse-las.js +1 -1
- package/dist/las/lib/copc/parse-las.js.map +1 -1
- package/dist/las/lib/get-las-schema.cjs +5 -0
- package/dist/las/lib/get-las-schema.cjs.map +2 -2
- package/dist/las/lib/get-las-schema.d.ts.map +1 -1
- package/dist/las/lib/get-las-schema.js +6 -0
- package/dist/las/lib/get-las-schema.js.map +1 -1
- package/dist/las/lib/las-extra-bytes.cjs +6 -1
- package/dist/las/lib/las-extra-bytes.cjs.map +2 -2
- package/dist/las/lib/las-extra-bytes.d.ts.map +1 -1
- package/dist/las/lib/las-extra-bytes.js +6 -4
- package/dist/las/lib/las-extra-bytes.js.map +1 -1
- package/dist/las/lib/laz-perf/parse-las.cjs +9 -8
- package/dist/las/lib/laz-perf/parse-las.cjs.map +3 -3
- package/dist/las/lib/laz-perf/parse-las.js +9 -8
- package/dist/las/lib/laz-perf/parse-las.js.map +1 -1
- package/dist/las/lib/laz-rs-wasm/parse-las.cjs +9 -8
- package/dist/las/lib/laz-rs-wasm/parse-las.cjs.map +3 -3
- package/dist/las/lib/laz-rs-wasm/parse-las.js +9 -8
- package/dist/las/lib/laz-rs-wasm/parse-las.js.map +1 -1
- package/dist/las/lib/typescript/parse-las.cjs +135 -13
- package/dist/las/lib/typescript/parse-las.cjs.map +3 -3
- package/dist/las/lib/typescript/parse-las.d.ts.map +1 -1
- package/dist/las/lib/typescript/parse-las.js +106 -10
- package/dist/las/lib/typescript/parse-las.js.map +1 -1
- package/dist/las/unbundled.cjs +0 -2
- package/dist/las/unbundled.cjs.map +2 -2
- package/dist/las/unbundled.d.ts +1 -1
- package/dist/las/unbundled.d.ts.map +1 -1
- package/dist/las/unbundled.js +1 -1
- package/dist/las/unbundled.js.map +1 -1
- package/dist/las/workers/las-worker.cjs +5 -5
- package/dist/las/workers/las-worker.cjs.map +2 -2
- package/dist/las/workers/las-worker.js +6 -6
- package/dist/las/workers/las-worker.js.map +1 -1
- package/dist/las-copc-loader-types.cjs +51 -0
- package/dist/las-copc-loader-types.cjs.map +7 -0
- package/dist/las-copc-loader-types.d.ts +2 -0
- package/dist/las-copc-loader-types.d.ts.map +1 -0
- package/dist/las-copc-loader-types.js +2 -0
- package/dist/las-copc-loader-types.js.map +1 -0
- package/dist/las-copc-loader.cjs +62 -0
- package/dist/las-copc-loader.cjs.map +7 -0
- package/dist/las-copc-loader.d.ts +2 -0
- package/dist/las-copc-loader.d.ts.map +1 -0
- package/dist/las-copc-loader.js +2 -0
- package/dist/las-copc-loader.js.map +1 -0
- package/dist/las-loader-types.cjs +53 -0
- package/dist/las-loader-types.cjs.map +7 -0
- package/dist/las-loader-types.d.ts +2 -0
- package/dist/las-loader-types.d.ts.map +1 -0
- package/dist/las-loader-types.js +2 -0
- package/dist/las-loader-types.js.map +1 -0
- package/dist/las-loader.cjs +130 -0
- package/dist/las-loader.cjs.map +7 -0
- package/dist/las-loader.d.ts +2 -0
- package/dist/las-loader.d.ts.map +1 -0
- package/dist/las-loader.js +2 -0
- package/dist/las-loader.js.map +1 -0
- package/dist/las-worker.js +1219 -253
- package/dist/las-writer.cjs +1056 -0
- package/dist/las-writer.cjs.map +7 -0
- package/dist/las-writer.d.ts +2 -0
- package/dist/las-writer.d.ts.map +1 -0
- package/dist/las-writer.js +2 -0
- package/dist/las-writer.js.map +1 -0
- package/dist/laz-rs-loader-types.cjs +51 -0
- package/dist/laz-rs-loader-types.cjs.map +7 -0
- package/dist/laz-rs-loader-types.d.ts +2 -0
- package/dist/laz-rs-loader-types.d.ts.map +1 -0
- package/dist/laz-rs-loader-types.js +2 -0
- package/dist/laz-rs-loader-types.js.map +1 -0
- package/dist/laz-rs-loader.cjs +277 -0
- package/dist/laz-rs-loader.cjs.map +7 -0
- package/dist/laz-rs-loader.d.ts +2 -0
- package/dist/laz-rs-loader.d.ts.map +1 -0
- package/dist/laz-rs-loader.js +2 -0
- package/dist/laz-rs-loader.js.map +1 -0
- package/dist/lazperf-loader-types.cjs +51 -0
- package/dist/lazperf-loader-types.cjs.map +7 -0
- package/dist/lazperf-loader-types.d.ts +2 -0
- package/dist/lazperf-loader-types.d.ts.map +1 -0
- package/dist/lazperf-loader-types.js +2 -0
- package/dist/lazperf-loader-types.js.map +1 -0
- package/dist/lazperf-loader.cjs +65 -0
- package/dist/lazperf-loader.cjs.map +7 -0
- package/dist/lazperf-loader.d.ts +2 -0
- package/dist/lazperf-loader.d.ts.map +1 -0
- package/dist/lazperf-loader.js +2 -0
- package/dist/lazperf-loader.js.map +1 -0
- package/dist/pcd/bundled.cjs +2 -4
- package/dist/pcd/bundled.cjs.map +2 -2
- package/dist/pcd/bundled.d.ts +1 -1
- package/dist/pcd/bundled.d.ts.map +1 -1
- package/dist/pcd/bundled.js +1 -1
- package/dist/pcd/bundled.js.map +1 -1
- package/dist/pcd/index.cjs +0 -3
- package/dist/pcd/index.cjs.map +3 -3
- package/dist/pcd/index.d.ts +0 -2
- package/dist/pcd/index.d.ts.map +1 -1
- package/dist/pcd/index.js +0 -3
- package/dist/pcd/index.js.map +1 -1
- package/dist/pcd/pcd-loader-types.cjs +9 -10
- package/dist/pcd/pcd-loader-types.cjs.map +2 -2
- package/dist/pcd/pcd-loader-types.d.ts +18 -41
- package/dist/pcd/pcd-loader-types.d.ts.map +1 -1
- package/dist/pcd/pcd-loader-types.js +6 -6
- package/dist/pcd/pcd-loader-types.js.map +1 -1
- package/dist/pcd/pcd-loader.cjs +82 -25
- package/dist/pcd/pcd-loader.cjs.map +3 -3
- package/dist/pcd/pcd-loader.d.ts +42 -6
- package/dist/pcd/pcd-loader.d.ts.map +1 -1
- package/dist/pcd/pcd-loader.js +72 -21
- package/dist/pcd/pcd-loader.js.map +1 -1
- package/dist/pcd/pcd-writer.cjs +3 -3
- package/dist/pcd/pcd-writer.cjs.map +2 -2
- package/dist/pcd/pcd-writer.d.ts +5 -4
- package/dist/pcd/pcd-writer.d.ts.map +1 -1
- package/dist/pcd/pcd-writer.js +4 -4
- package/dist/pcd/pcd-writer.js.map +1 -1
- package/dist/pcd/unbundled.cjs +2 -4
- package/dist/pcd/unbundled.cjs.map +2 -2
- package/dist/pcd/unbundled.d.ts +1 -1
- package/dist/pcd/unbundled.d.ts.map +1 -1
- package/dist/pcd/unbundled.js +1 -1
- package/dist/pcd/unbundled.js.map +1 -1
- package/dist/pcd/workers/pcd-worker.cjs +5 -5
- package/dist/pcd/workers/pcd-worker.cjs.map +2 -2
- package/dist/pcd/workers/pcd-worker.js +6 -6
- package/dist/pcd/workers/pcd-worker.js.map +1 -1
- package/dist/pcd-loader-types.cjs +65 -0
- package/dist/pcd-loader-types.cjs.map +7 -0
- package/dist/pcd-loader-types.d.ts +2 -0
- package/dist/pcd-loader-types.d.ts.map +1 -0
- package/dist/pcd-loader-types.js +2 -0
- package/dist/pcd-loader-types.js.map +1 -0
- package/dist/pcd-loader.cjs +203 -0
- package/dist/pcd-loader.cjs.map +7 -0
- package/dist/pcd-loader.d.ts +2 -0
- package/dist/pcd-loader.d.ts.map +1 -0
- package/dist/pcd-loader.js +2 -0
- package/dist/pcd-loader.js.map +1 -0
- package/dist/pcd-worker.js +1457 -418
- package/dist/pcd-writer.cjs +136 -0
- package/dist/pcd-writer.cjs.map +7 -0
- package/dist/pcd-writer.d.ts +2 -0
- package/dist/pcd-writer.d.ts.map +1 -0
- package/dist/pcd-writer.js +2 -0
- package/dist/pcd-writer.js.map +1 -0
- package/dist/ply/bundled.cjs +2 -4
- package/dist/ply/bundled.cjs.map +2 -2
- package/dist/ply/bundled.d.ts +1 -1
- package/dist/ply/bundled.d.ts.map +1 -1
- package/dist/ply/bundled.js +1 -1
- package/dist/ply/bundled.js.map +1 -1
- package/dist/ply/index.cjs +0 -3
- package/dist/ply/index.cjs.map +3 -3
- package/dist/ply/index.d.ts +0 -2
- package/dist/ply/index.d.ts.map +1 -1
- package/dist/ply/index.js +0 -3
- package/dist/ply/index.js.map +1 -1
- package/dist/ply/lib/get-ply-schema.cjs +4 -2
- package/dist/ply/lib/get-ply-schema.cjs.map +2 -2
- package/dist/ply/lib/get-ply-schema.d.ts +6 -0
- package/dist/ply/lib/get-ply-schema.d.ts.map +1 -1
- package/dist/ply/lib/get-ply-schema.js +1 -1
- package/dist/ply/lib/get-ply-schema.js.map +1 -1
- package/dist/ply/lib/parse-ply-arrow.cjs +1 -1
- package/dist/ply/lib/parse-ply-arrow.cjs.map +2 -2
- package/dist/ply/lib/parse-ply-arrow.js +2 -2
- package/dist/ply/lib/parse-ply-arrow.js.map +1 -1
- package/dist/ply/lib/parse-ply-in-batches.cjs +14 -8
- package/dist/ply/lib/parse-ply-in-batches.cjs.map +3 -3
- package/dist/ply/lib/parse-ply-in-batches.d.ts.map +1 -1
- package/dist/ply/lib/parse-ply-in-batches.js +9 -4
- package/dist/ply/lib/parse-ply-in-batches.js.map +1 -1
- package/dist/ply/lib/parse-ply.cjs +3 -0
- package/dist/ply/lib/parse-ply.cjs.map +2 -2
- package/dist/ply/lib/parse-ply.d.ts +1 -1
- package/dist/ply/lib/parse-ply.d.ts.map +1 -1
- package/dist/ply/lib/parse-ply.js +4 -0
- package/dist/ply/lib/parse-ply.js.map +1 -1
- package/dist/ply/ply-loader-types.cjs +9 -10
- package/dist/ply/ply-loader-types.cjs.map +2 -2
- package/dist/ply/ply-loader-types.d.ts +19 -42
- package/dist/ply/ply-loader-types.d.ts.map +1 -1
- package/dist/ply/ply-loader-types.js +6 -6
- package/dist/ply/ply-loader-types.js.map +1 -1
- package/dist/ply/ply-loader.cjs +82 -24
- package/dist/ply/ply-loader.cjs.map +3 -3
- package/dist/ply/ply-loader.d.ts +43 -6
- package/dist/ply/ply-loader.d.ts.map +1 -1
- package/dist/ply/ply-loader.js +71 -19
- package/dist/ply/ply-loader.js.map +1 -1
- package/dist/ply/ply-writer.cjs +3 -3
- package/dist/ply/ply-writer.cjs.map +2 -2
- package/dist/ply/ply-writer.d.ts +5 -4
- package/dist/ply/ply-writer.d.ts.map +1 -1
- package/dist/ply/ply-writer.js +4 -4
- package/dist/ply/ply-writer.js.map +1 -1
- package/dist/ply/unbundled.cjs +2 -4
- package/dist/ply/unbundled.cjs.map +2 -2
- package/dist/ply/unbundled.d.ts +1 -1
- package/dist/ply/unbundled.d.ts.map +1 -1
- package/dist/ply/unbundled.js +1 -1
- package/dist/ply/unbundled.js.map +1 -1
- package/dist/ply/workers/ply-worker.cjs +6 -6
- package/dist/ply/workers/ply-worker.cjs.map +2 -2
- package/dist/ply/workers/ply-worker.js +8 -8
- package/dist/ply/workers/ply-worker.js.map +1 -1
- package/dist/ply-loader-types.cjs +66 -0
- package/dist/ply-loader-types.cjs.map +7 -0
- package/dist/ply-loader-types.d.ts +2 -0
- package/dist/ply-loader-types.d.ts.map +1 -0
- package/dist/ply-loader-types.js +2 -0
- package/dist/ply-loader-types.js.map +1 -0
- package/dist/ply-loader.cjs +194 -0
- package/dist/ply-loader.cjs.map +7 -0
- package/dist/ply-loader.d.ts +2 -0
- package/dist/ply-loader.d.ts.map +1 -0
- package/dist/ply-loader.js +2 -0
- package/dist/ply-loader.js.map +1 -0
- package/dist/ply-worker.js +2099 -312
- package/dist/ply-writer.cjs +177 -0
- package/dist/ply-writer.cjs.map +7 -0
- package/dist/ply-writer.d.ts +2 -0
- package/dist/ply-writer.d.ts.map +1 -0
- package/dist/ply-writer.js +2 -0
- package/dist/ply-writer.js.map +1 -0
- package/package.json +75 -71
- package/src/index.ts +3 -3
- package/src/las/bundled.ts +0 -1
- package/src/las/index.ts +0 -4
- package/src/las/las-copc-loader-types.ts +3 -3
- package/src/las/las-copc-loader.ts +12 -12
- package/src/las/las-loader-shared.ts +9 -7
- package/src/las/las-loader-types.ts +3 -6
- package/src/las/las-loader.ts +63 -9
- package/src/las/las-writer.ts +17 -13
- package/src/las/laz-rs-loader-types.ts +3 -3
- package/src/las/laz-rs-loader.ts +11 -11
- package/src/las/lazperf-loader-types.ts +3 -3
- package/src/las/lazperf-loader.ts +13 -13
- package/src/las/lib/copc/parse-las.ts +1 -1
- package/src/las/lib/get-las-schema.ts +5 -0
- package/src/las/lib/las-extra-bytes.ts +6 -4
- package/src/las/lib/laz-perf/parse-las.ts +8 -9
- package/src/las/lib/laz-rs-wasm/parse-las.ts +8 -9
- package/src/las/lib/typescript/parse-las.ts +143 -11
- package/src/las/libs/laz-rs-wasm/README.md +5 -0
- package/src/las/libs/laz-rs-wasm/package.json +6 -0
- package/src/las/unbundled.ts +1 -1
- package/src/las/workers/las-worker.ts +6 -6
- package/src/las-copc-loader-types.ts +1 -0
- package/src/las-copc-loader.ts +1 -0
- package/src/las-loader-types.ts +1 -0
- package/src/las-loader.ts +1 -0
- package/src/las-writer.ts +1 -0
- package/src/laz-rs-loader-types.ts +1 -0
- package/src/laz-rs-loader.ts +1 -0
- package/src/lazperf-loader-types.ts +1 -0
- package/src/lazperf-loader.ts +1 -0
- package/src/pcd/bundled.ts +1 -4
- package/src/pcd/index.ts +0 -4
- package/src/pcd/pcd-loader-types.ts +10 -11
- package/src/pcd/pcd-loader.ts +97 -29
- package/src/pcd/pcd-writer.ts +12 -8
- package/src/pcd/unbundled.ts +1 -1
- package/src/pcd/workers/pcd-worker.ts +6 -6
- package/src/pcd-loader-types.ts +1 -0
- package/src/pcd-loader.ts +1 -0
- package/src/pcd-writer.ts +1 -0
- package/src/ply/bundled.ts +1 -4
- package/src/ply/index.ts +0 -4
- package/src/ply/lib/get-ply-schema.ts +1 -1
- package/src/ply/lib/parse-ply-arrow.ts +2 -2
- package/src/ply/lib/parse-ply-in-batches.ts +9 -4
- package/src/ply/lib/parse-ply.ts +4 -1
- package/src/ply/ply-loader-types.ts +10 -11
- package/src/ply/ply-loader.ts +94 -24
- package/src/ply/ply-writer.ts +12 -8
- package/src/ply/unbundled.ts +1 -1
- package/src/ply/workers/ply-worker.ts +8 -8
- package/src/ply-loader-types.ts +1 -0
- package/src/ply-loader.ts +1 -0
- package/src/ply-writer.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './pcd/pcd-loader-types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './pcd/pcd-loader.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './pcd/pcd-writer.js';
|
package/src/ply/bundled.ts
CHANGED
|
@@ -3,7 +3,4 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
export type {PLYLoaderOptions} from './ply-loader-types';
|
|
6
|
-
export {
|
|
7
|
-
PLYLoaderWithParser as PLYWorkerLoader,
|
|
8
|
-
PLYLoaderWithParser as PLYLoader
|
|
9
|
-
} from './ply-loader';
|
|
6
|
+
export {PLYLoaderWithParser as PLYLoader} from './ply-loader';
|
package/src/ply/index.ts
CHANGED
|
@@ -9,7 +9,3 @@ export type {PLYLoaderOptions} from './ply-loader-types';
|
|
|
9
9
|
export {PLYLoader} from './ply-loader-types';
|
|
10
10
|
export type {PLYWriterOptions} from './ply-writer';
|
|
11
11
|
export {PLYWriter} from './ply-writer';
|
|
12
|
-
|
|
13
|
-
// DEPRECATED EXPORTS
|
|
14
|
-
/** @deprecated Use PLYLoader. */
|
|
15
|
-
export {PLYWorkerLoader} from './ply-loader-types';
|
|
@@ -24,7 +24,7 @@ export function getPLYSchema(plyHeader: PLYHeader, attributes: MeshAttributes):
|
|
|
24
24
|
* @param plyHeader
|
|
25
25
|
* @returns
|
|
26
26
|
*/
|
|
27
|
-
function makeMetadataFromPlyHeader(plyHeader: PLYHeader): Record<string, string> {
|
|
27
|
+
export function makeMetadataFromPlyHeader(plyHeader: PLYHeader): Record<string, string> {
|
|
28
28
|
/* eslint-disable camelcase */
|
|
29
29
|
const metadata: Record<string, string> = {};
|
|
30
30
|
metadata.ply_comments = JSON.stringify(plyHeader.comments);
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
MeshArrowTable,
|
|
10
10
|
TypedArray
|
|
11
11
|
} from '@loaders.gl/core/schema';
|
|
12
|
-
import {getMeshBoundingBox} from '@loaders.gl/core/schema-utils';
|
|
12
|
+
import {getMeshBoundingBox, serializeArrowSchema} from '@loaders.gl/core/schema-utils';
|
|
13
13
|
import * as arrow from 'apache-arrow';
|
|
14
14
|
import type {ParsePLYOptions} from './parse-ply';
|
|
15
15
|
import {parsePLYHeader} from './parse-ply';
|
|
@@ -398,7 +398,7 @@ function convertPLYMeshToArrowTable(mesh: Mesh): MeshArrowTable {
|
|
|
398
398
|
|
|
399
399
|
return {
|
|
400
400
|
shape: 'arrow-table',
|
|
401
|
-
schema:
|
|
401
|
+
schema: serializeArrowSchema(arrowSchema),
|
|
402
402
|
data: new arrow.Table(arrowSchema, columns),
|
|
403
403
|
topology: mesh.topology,
|
|
404
404
|
indices: mesh.indices?.value.length ? mesh.indices : undefined
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
// }
|
|
26
26
|
// });
|
|
27
27
|
|
|
28
|
+
import {log as loaderLog} from '@loaders.gl/core/loader-utils';
|
|
28
29
|
import {
|
|
29
30
|
makeLineIterator,
|
|
30
31
|
makeTextDecoderIterator,
|
|
@@ -32,6 +33,8 @@ import {
|
|
|
32
33
|
toArrayBufferIterator
|
|
33
34
|
} from '@loaders.gl/core/loader-utils';
|
|
34
35
|
import type {MeshArrowTable} from '@loaders.gl/core/schema';
|
|
36
|
+
import {updateArrowTableMetadata} from '@loaders.gl/core/schema-utils';
|
|
37
|
+
import {makeMetadataFromPlyHeader} from './get-ply-schema';
|
|
35
38
|
import normalizePLY from './normalize-ply';
|
|
36
39
|
import {PLYMesh, PLYHeader, PLYElement, PLYProperty, PLYAttributes} from './ply-types';
|
|
37
40
|
import {
|
|
@@ -58,7 +61,7 @@ export async function* parsePLYInBatches(
|
|
|
58
61
|
| Iterable<ArrayBufferLike | ArrayBufferView>,
|
|
59
62
|
options: any
|
|
60
63
|
): AsyncIterable<PLYMesh | MeshArrowTable> {
|
|
61
|
-
if (options?.shape === 'arrow
|
|
64
|
+
if (options?.shape === 'arrow') {
|
|
62
65
|
yield* parseBinaryPLYToArrowInBatches(iterator, options);
|
|
63
66
|
return;
|
|
64
67
|
}
|
|
@@ -108,7 +111,10 @@ async function* parseBinaryPLYToArrowInBatches(
|
|
|
108
111
|
);
|
|
109
112
|
}
|
|
110
113
|
for await (const table of tables) {
|
|
111
|
-
yield {
|
|
114
|
+
yield {
|
|
115
|
+
...updateArrowTableMetadata(table, makeMetadataFromPlyHeader(header)),
|
|
116
|
+
loaderData: header
|
|
117
|
+
} as MeshArrowTable;
|
|
112
118
|
}
|
|
113
119
|
}
|
|
114
120
|
|
|
@@ -656,8 +662,7 @@ async function parseASCIIHeader(
|
|
|
656
662
|
break;
|
|
657
663
|
|
|
658
664
|
default:
|
|
659
|
-
|
|
660
|
-
console.log('unhandled', lineType, lineValues);
|
|
665
|
+
loaderLog.log(0, 'unhandled', lineType, lineValues)();
|
|
661
666
|
}
|
|
662
667
|
|
|
663
668
|
return false;
|
package/src/ply/lib/parse-ply.ts
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
// });
|
|
27
27
|
import type {MeshAttribute, MeshAttributes, MeshArrowTable} from '@loaders.gl/core/schema';
|
|
28
28
|
import * as arrow from 'apache-arrow';
|
|
29
|
+
import {getMeshBoundingBox} from '@loaders.gl/core/schema-utils';
|
|
29
30
|
import type {
|
|
30
31
|
PLYMesh,
|
|
31
32
|
PLYHeader,
|
|
@@ -49,7 +50,7 @@ export type ParsePLYOptions = {
|
|
|
49
50
|
propertyNameMapping?: Record<string, string>;
|
|
50
51
|
/** Treat PLY data as a point cloud by reading only the leading vertex element. */
|
|
51
52
|
pointCloud?: boolean;
|
|
52
|
-
shape?: 'mesh' | 'arrow
|
|
53
|
+
shape?: 'mesh' | 'arrow';
|
|
53
54
|
/** Color storage format. Defaults to uint8norm for backwards compatibility. */
|
|
54
55
|
colorFormat?: 'uint8norm' | 'float16' | 'float32';
|
|
55
56
|
};
|
|
@@ -637,6 +638,8 @@ function makePLYArrowTable(header: PLYHeader, attributes: PLYAttributes): MeshAr
|
|
|
637
638
|
const schema = getPLYSchema(header, meshAttributes);
|
|
638
639
|
schema.metadata.topology = 'point-list';
|
|
639
640
|
schema.metadata.mode = '0';
|
|
641
|
+
const boundingBox = getMeshBoundingBox(meshAttributes);
|
|
642
|
+
if (boundingBox) schema.metadata.boundingBox = JSON.stringify(boundingBox);
|
|
640
643
|
|
|
641
644
|
const columns: Record<string, arrow.Vector> = {};
|
|
642
645
|
const fields: arrow.Field[] = [];
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
// PLY Loader
|
|
6
|
+
import type {Table, RecordBatch} from 'apache-arrow';
|
|
6
7
|
import type {Loader, LoaderOptions} from '@loaders.gl/core/loader-utils';
|
|
7
|
-
import type {MeshArrowTable, ArrowTableBatch} from '@loaders.gl/core/schema';
|
|
8
8
|
import type {PLYMesh} from './lib/ply-types';
|
|
9
9
|
import type {ParsePLYOptions} from './lib/parse-ply';
|
|
10
10
|
import {PLYFormat} from './ply-format';
|
|
11
|
-
import {serializeArrowWorkerTable} from '@loaders.gl/core/
|
|
11
|
+
import {serializeArrowWorkerTable} from '@loaders.gl/core/arrow-worker-transport';
|
|
12
12
|
|
|
13
13
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
14
14
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
@@ -17,7 +17,7 @@ const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
|
17
17
|
export type PLYLoaderOptions = LoaderOptions & {
|
|
18
18
|
ply?: ParsePLYOptions & {
|
|
19
19
|
/** Output shape. Defaults to a Mesh Arrow table. */
|
|
20
|
-
shape?: 'mesh' | 'arrow
|
|
20
|
+
shape?: 'mesh' | 'arrow';
|
|
21
21
|
/** Color storage format. Defaults to uint8norm for backwards compatibility. */
|
|
22
22
|
colorFormat?: 'uint8norm' | 'float16' | 'float32';
|
|
23
23
|
/** Treat PLY data as a point cloud by reading only the leading vertex element. */
|
|
@@ -31,7 +31,7 @@ export type PLYLoaderOptions = LoaderOptions & {
|
|
|
31
31
|
* Preloads the parser-bearing PLY loader implementation.
|
|
32
32
|
*/
|
|
33
33
|
async function preload() {
|
|
34
|
-
const {PLYLoaderWithParser} = await import('@loaders.gl/pointclouds/ply
|
|
34
|
+
const {PLYLoaderWithParser} = await import('@loaders.gl/pointclouds/ply-loader');
|
|
35
35
|
return PLYLoaderWithParser;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -41,8 +41,10 @@ async function preload() {
|
|
|
41
41
|
* 'https://en.wikipedia.org/wiki/PLY_(file_format)']
|
|
42
42
|
*/
|
|
43
43
|
export const PLYLoader = {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
defaultShape: 'arrow',
|
|
45
|
+
supportsNativeArrow: true,
|
|
46
|
+
dataType: null as unknown as PLYMesh | Table,
|
|
47
|
+
batchType: null as unknown as PLYMesh | RecordBatch,
|
|
46
48
|
|
|
47
49
|
...PLYFormat,
|
|
48
50
|
// shapes: ['mesh', 'gltf', 'columnar-table'],
|
|
@@ -52,10 +54,7 @@ export const PLYLoader = {
|
|
|
52
54
|
workerInBatches: true,
|
|
53
55
|
serializeWorkerResult: serializeArrowWorkerTable,
|
|
54
56
|
options: {
|
|
55
|
-
ply: {shape: 'arrow
|
|
57
|
+
ply: {shape: 'arrow', colorFormat: 'uint8norm'}
|
|
56
58
|
},
|
|
57
59
|
preload
|
|
58
|
-
} as const satisfies Loader<PLYMesh |
|
|
59
|
-
|
|
60
|
-
/** @deprecated Use PLYLoader. */
|
|
61
|
-
export const PLYWorkerLoader = PLYLoader;
|
|
60
|
+
} as const satisfies Loader<PLYMesh | Table, PLYMesh | RecordBatch, LoaderOptions>;
|
package/src/ply/ply-loader.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
+
import {refineArrowTableBatches, makeArrowMetadataBatch} from '@loaders.gl/core/schema-utils';
|
|
6
|
+
import type {Table, RecordBatch} from 'apache-arrow';
|
|
5
7
|
import type {PLYLoaderOptions} from './ply-loader-types';
|
|
6
8
|
|
|
7
9
|
// PLY Loader
|
|
@@ -11,10 +13,10 @@ import type {MeshArrowTable, ArrowTableBatch} from '@loaders.gl/core/schema';
|
|
|
11
13
|
import {
|
|
12
14
|
deserializeArrowWorkerTable,
|
|
13
15
|
serializeArrowWorkerTable
|
|
14
|
-
} from '@loaders.gl/core/
|
|
16
|
+
} from '@loaders.gl/core/arrow-worker-transport';
|
|
15
17
|
import type {PLYHeader, PLYMesh} from './lib/ply-types';
|
|
16
18
|
import {
|
|
17
|
-
|
|
19
|
+
convertMeshToArrowTableWrapper,
|
|
18
20
|
convertTableToMesh,
|
|
19
21
|
deduceMeshSchema
|
|
20
22
|
} from '@loaders.gl/core/schema-utils';
|
|
@@ -29,7 +31,7 @@ import {PLYLoader as PLYLoaderMetadata} from './ply-loader-types';
|
|
|
29
31
|
const {preload: _PLYLoaderPreload, ...PLYLoaderMetadataWithoutPreload} = PLYLoaderMetadata;
|
|
30
32
|
|
|
31
33
|
function convertPLYMesh(mesh: PLYMesh, options?: PLYLoaderOptions): PLYMesh | MeshArrowTable {
|
|
32
|
-
const table =
|
|
34
|
+
const table = convertMeshToArrowTableWrapper(mesh);
|
|
33
35
|
return convertPLYTable(table, options, mesh.loaderData);
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -58,28 +60,15 @@ function parsePLYData(
|
|
|
58
60
|
/**
|
|
59
61
|
* Loader for PLY - Polygon File Format
|
|
60
62
|
*/
|
|
61
|
-
export const
|
|
63
|
+
export const PLYColumnLoader = {
|
|
62
64
|
...PLYLoaderMetadataWithoutPreload,
|
|
65
|
+
dataType: null as unknown as PLYMesh | MeshArrowTable,
|
|
66
|
+
batchType: null as unknown as PLYMesh | ArrowTableBatch,
|
|
63
67
|
parse: async (arrayBuffer, options) => parsePLYData(arrayBuffer, options),
|
|
64
68
|
parseTextSync: (arrayBuffer, options) => parsePLYData(arrayBuffer, options),
|
|
65
69
|
parseSync: (arrayBuffer, options) => parsePLYData(arrayBuffer, options),
|
|
66
|
-
parseInBatches:
|
|
67
|
-
|
|
68
|
-
| AsyncIterable<ArrayBufferLike | ArrayBufferView>
|
|
69
|
-
| Iterable<ArrayBufferLike | ArrayBufferView>,
|
|
70
|
-
options
|
|
71
|
-
) {
|
|
72
|
-
const plyOptions = {
|
|
73
|
-
...options?.ply,
|
|
74
|
-
batchSize: options?.batchSize ?? options?.core?.batchSize
|
|
75
|
-
};
|
|
76
|
-
for await (const meshOrTable of parsePLYInBatches(arrayBuffer, plyOptions)) {
|
|
77
|
-
const convertedData = isMeshArrowTable(meshOrTable)
|
|
78
|
-
? convertPLYTable(meshOrTable, options)
|
|
79
|
-
: convertPLYMesh(meshOrTable, options);
|
|
80
|
-
yield isMeshArrowTable(convertedData) ? makeTableScanBatch(convertedData) : convertedData;
|
|
81
|
-
}
|
|
82
|
-
},
|
|
70
|
+
parseInBatches: (input, options) =>
|
|
71
|
+
refineArrowTableBatches(parsePLYWithMetadataInBatches(input, options)),
|
|
83
72
|
serializeWorkerResult: serializeArrowWorkerTable,
|
|
84
73
|
deserializeWorkerResult: deserializePLYWorkerResult,
|
|
85
74
|
serializeWorkerBatch: serializeArrowWorkerTable,
|
|
@@ -101,7 +90,7 @@ function convertPLYTable(
|
|
|
101
90
|
): PLYMesh | MeshArrowTable {
|
|
102
91
|
const loaderData = header || table.loaderData || {comments: [], elements: []};
|
|
103
92
|
const result =
|
|
104
|
-
options?.ply?.shape === 'arrow
|
|
93
|
+
options?.ply?.shape === 'arrow'
|
|
105
94
|
? {...table, loader: 'ply' as const, loaderData}
|
|
106
95
|
: {
|
|
107
96
|
...(convertTableToMesh(table) as PLYMesh),
|
|
@@ -118,9 +107,9 @@ function convertPLYTable(
|
|
|
118
107
|
(isMeshArrowTable(resultData) ? convertTableToMesh(resultData) : resultData) as PLYMesh,
|
|
119
108
|
colorFormat
|
|
120
109
|
);
|
|
121
|
-
return options?.ply?.shape === 'arrow
|
|
110
|
+
return options?.ply?.shape === 'arrow'
|
|
122
111
|
? {
|
|
123
|
-
...
|
|
112
|
+
...convertMeshToArrowTableWrapper(formattedMesh),
|
|
124
113
|
loader: 'ply' as const,
|
|
125
114
|
loaderData
|
|
126
115
|
}
|
|
@@ -183,3 +172,84 @@ function deserializePLYWorkerBatch(
|
|
|
183
172
|
): PLYMesh | ArrowTableBatch {
|
|
184
173
|
return deserializePLYWorkerResult(result, options) as PLYMesh | ArrowTableBatch;
|
|
185
174
|
}
|
|
175
|
+
|
|
176
|
+
/** Parses PLY batches before shared cumulative metadata refinement. */
|
|
177
|
+
async function* parsePLYWithMetadataInBatches(
|
|
178
|
+
arrayBuffer:
|
|
179
|
+
| AsyncIterable<ArrayBufferLike | ArrayBufferView>
|
|
180
|
+
| Iterable<ArrayBufferLike | ArrayBufferView>,
|
|
181
|
+
options?: PLYLoaderOptions
|
|
182
|
+
) {
|
|
183
|
+
const plyOptions = {
|
|
184
|
+
...options?.ply,
|
|
185
|
+
batchSize: options?.core?.batchSize
|
|
186
|
+
};
|
|
187
|
+
for await (const meshOrTable of parsePLYInBatches(arrayBuffer, plyOptions)) {
|
|
188
|
+
const convertedData = isMeshArrowTable(meshOrTable)
|
|
189
|
+
? convertPLYTable(meshOrTable, options)
|
|
190
|
+
: convertPLYMesh(meshOrTable, options);
|
|
191
|
+
yield isMeshArrowTable(convertedData) ? makeTableScanBatch(convertedData) : convertedData;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** Exposes native Arrow output while retaining the worker's column protocol. */
|
|
196
|
+
export const PLYLoaderWithParser = {
|
|
197
|
+
...PLYColumnLoader,
|
|
198
|
+
dataType: PLYLoaderMetadata.dataType,
|
|
199
|
+
batchType: PLYLoaderMetadata.batchType,
|
|
200
|
+
parse: async (input: ArrayBuffer, options?: PLYLoaderOptions) =>
|
|
201
|
+
unwrapPLYTable(await PLYColumnLoader.parse(input, options)),
|
|
202
|
+
parseTextSync: (input: string, options?: PLYLoaderOptions) =>
|
|
203
|
+
unwrapPLYTable(PLYColumnLoader.parseTextSync(input, options)),
|
|
204
|
+
parseSync: (input: ArrayBuffer, options?: PLYLoaderOptions) =>
|
|
205
|
+
unwrapPLYTable(PLYColumnLoader.parseSync(input, options)),
|
|
206
|
+
async *parseInBatches(input, options) {
|
|
207
|
+
for await (const batch of PLYColumnLoader.parseInBatches(input, options)) {
|
|
208
|
+
if (isColumnBatch(batch)) {
|
|
209
|
+
batch.data.schema.metadata.set(
|
|
210
|
+
'loaders.gl.ply.header',
|
|
211
|
+
JSON.stringify((batch as ArrowTableBatch & {loaderData?: unknown}).loaderData)
|
|
212
|
+
);
|
|
213
|
+
for (const recordBatch of batch.data.batches) {
|
|
214
|
+
recordBatch.schema.metadata.set(
|
|
215
|
+
'loaders.gl.ply.header',
|
|
216
|
+
batch.data.schema.metadata.get('loaders.gl.ply.header')!
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
if (batch.data.batches.length) yield* batch.data.batches;
|
|
220
|
+
else yield makeArrowMetadataBatch(batch.data.schema);
|
|
221
|
+
} else yield batch;
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
deserializeWorkerResult: (result: unknown, options?: PLYLoaderOptions) =>
|
|
225
|
+
unwrapPLYTable(PLYColumnLoader.deserializeWorkerResult(result, options)),
|
|
226
|
+
deserializeWorkerBatch(result: unknown, options?: PLYLoaderOptions) {
|
|
227
|
+
const batch = PLYColumnLoader.deserializeWorkerBatch(result, options);
|
|
228
|
+
if (isColumnBatch(batch)) {
|
|
229
|
+
const recordBatch = batch.data.batches[0] ?? makeArrowMetadataBatch(batch.data.schema);
|
|
230
|
+
recordBatch.schema.metadata.set(
|
|
231
|
+
'loaders.gl.ply.header',
|
|
232
|
+
JSON.stringify((batch as ArrowTableBatch & {loaderData?: unknown}).loaderData)
|
|
233
|
+
);
|
|
234
|
+
return recordBatch;
|
|
235
|
+
}
|
|
236
|
+
return batch;
|
|
237
|
+
}
|
|
238
|
+
} as const satisfies LoaderWithParser<PLYMesh | Table, PLYMesh | RecordBatch, PLYLoaderOptions>;
|
|
239
|
+
|
|
240
|
+
/** Returns the Arrow table with its file metadata or the requested mesh. */
|
|
241
|
+
function unwrapPLYTable(result: PLYMesh | MeshArrowTable): PLYMesh | Table {
|
|
242
|
+
if ('shape' in result && result.shape === 'arrow-table') {
|
|
243
|
+
result.data.schema.metadata.set(
|
|
244
|
+
'loaders.gl.ply.header',
|
|
245
|
+
JSON.stringify((result as MeshArrowTable & {loaderData?: unknown}).loaderData)
|
|
246
|
+
);
|
|
247
|
+
return result.data;
|
|
248
|
+
}
|
|
249
|
+
return result as PLYMesh;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** Identifies the private Arrow batch envelope. */
|
|
253
|
+
function isColumnBatch(batch: PLYMesh | ArrowTableBatch): batch is ArrowTableBatch {
|
|
254
|
+
return 'shape' in batch && batch.shape === 'arrow-table';
|
|
255
|
+
}
|
package/src/ply/ply-writer.ts
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
+
import type {Table} from 'apache-arrow';
|
|
5
6
|
import type {WriterOptions, WriterWithEncoder} from '@loaders.gl/core/loader-utils';
|
|
6
7
|
import type {Mesh, MeshArrowTable, MeshAttribute} from '@loaders.gl/core/schema';
|
|
7
|
-
import {
|
|
8
|
+
import {convertMeshToArrowTableWrapper, convertTableToMesh} from '@loaders.gl/core/schema-utils';
|
|
8
9
|
import {PLYFormat} from './ply-format';
|
|
9
10
|
|
|
10
11
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
@@ -22,7 +23,7 @@ export type PLYWriterOptions = WriterOptions & {
|
|
|
22
23
|
*/
|
|
23
24
|
export const PLYWriter = {
|
|
24
25
|
...PLYFormat,
|
|
25
|
-
dataType: null as unknown as Mesh | MeshArrowTable,
|
|
26
|
+
dataType: null as unknown as Mesh | MeshArrowTable | Table,
|
|
26
27
|
batchType: null as never,
|
|
27
28
|
version: VERSION,
|
|
28
29
|
options: {
|
|
@@ -32,16 +33,19 @@ export const PLYWriter = {
|
|
|
32
33
|
encode: async (data, options) => encodePLYSync(data, options),
|
|
33
34
|
encodeSync: encodePLYSync,
|
|
34
35
|
encodeTextSync: encodePLY
|
|
35
|
-
} as const satisfies WriterWithEncoder<Mesh | MeshArrowTable, never, PLYWriterOptions>;
|
|
36
|
+
} as const satisfies WriterWithEncoder<Mesh | MeshArrowTable | Table, never, PLYWriterOptions>;
|
|
36
37
|
|
|
37
38
|
/** Encode mesh category data as PLY bytes. */
|
|
38
|
-
function encodePLYSync(
|
|
39
|
+
function encodePLYSync(
|
|
40
|
+
data: Mesh | MeshArrowTable | Table,
|
|
41
|
+
options?: PLYWriterOptions
|
|
42
|
+
): ArrayBuffer {
|
|
39
43
|
const text = encodePLY(data, options);
|
|
40
44
|
return new TextEncoder().encode(text).buffer;
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
/** Encode mesh category data as ASCII PLY text. */
|
|
44
|
-
function encodePLY(data: Mesh | MeshArrowTable, options?: PLYWriterOptions): string {
|
|
48
|
+
function encodePLY(data: Mesh | MeshArrowTable | Table, options?: PLYWriterOptions): string {
|
|
45
49
|
const mesh = convertTableToMesh(normalizeMeshArrowTable(data));
|
|
46
50
|
const positionAttribute = getRequiredAttribute(mesh, 'POSITION');
|
|
47
51
|
const normalAttribute = mesh.attributes.NORMAL;
|
|
@@ -109,11 +113,11 @@ function encodePLY(data: Mesh | MeshArrowTable, options?: PLYWriterOptions): str
|
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
/** Return mesh data as a MeshArrowTable, converting plain Mesh data first. */
|
|
112
|
-
function normalizeMeshArrowTable(data: Mesh | MeshArrowTable): MeshArrowTable {
|
|
113
|
-
if ('
|
|
116
|
+
function normalizeMeshArrowTable(data: Mesh | MeshArrowTable | Table): MeshArrowTable | Table {
|
|
117
|
+
if (!('attributes' in data)) {
|
|
114
118
|
return data;
|
|
115
119
|
}
|
|
116
|
-
return
|
|
120
|
+
return convertMeshToArrowTableWrapper(data as Mesh);
|
|
117
121
|
}
|
|
118
122
|
|
|
119
123
|
/** Return a required mesh attribute or throw a format-specific error. */
|
package/src/ply/unbundled.ts
CHANGED
|
@@ -4,18 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
import {createLoaderWorker, makeTableScanBatch} from '@loaders.gl/core/loader-utils';
|
|
6
6
|
import type {MeshArrowTable} from '@loaders.gl/core/schema';
|
|
7
|
-
import {
|
|
7
|
+
import {convertMeshToArrowTableWrapper} from '@loaders.gl/core/schema-utils';
|
|
8
8
|
import type {PLYMesh} from '../lib/ply-types';
|
|
9
9
|
import type {PLYLoaderOptions} from '../ply-loader-types';
|
|
10
|
-
import {
|
|
10
|
+
import {PLYColumnLoader} from '../ply-loader';
|
|
11
11
|
|
|
12
12
|
createLoaderWorker({
|
|
13
|
-
...
|
|
13
|
+
...PLYColumnLoader,
|
|
14
14
|
/** Always returns columnar data; legacy mesh conversion runs on the caller. */
|
|
15
15
|
parse(input, options) {
|
|
16
|
-
return
|
|
16
|
+
return PLYColumnLoader.parse(input, {
|
|
17
17
|
...options,
|
|
18
|
-
ply: {...options?.ply, shape: 'arrow
|
|
18
|
+
ply: {...options?.ply, shape: 'arrow'}
|
|
19
19
|
});
|
|
20
20
|
},
|
|
21
21
|
/** Preserves full-mesh parsing while streaming point-cloud vertices as Arrow batches. */
|
|
@@ -23,14 +23,14 @@ createLoaderWorker({
|
|
|
23
23
|
const parseMesh = options?.ply?.shape === 'mesh' && !options?.ply?.pointCloud;
|
|
24
24
|
const parserOptions = parseMesh
|
|
25
25
|
? options
|
|
26
|
-
: {...options, ply: {...options?.ply, shape: 'arrow
|
|
27
|
-
for await (const batch of
|
|
26
|
+
: {...options, ply: {...options?.ply, shape: 'arrow' as const}};
|
|
27
|
+
for await (const batch of PLYColumnLoader.parseInBatches(input, parserOptions)) {
|
|
28
28
|
if ('shape' in batch && batch.shape === 'arrow-table') {
|
|
29
29
|
yield batch;
|
|
30
30
|
} else {
|
|
31
31
|
const mesh = batch as PLYMesh;
|
|
32
32
|
yield makeTableScanBatch({
|
|
33
|
-
...
|
|
33
|
+
...convertMeshToArrowTableWrapper(mesh),
|
|
34
34
|
loader: mesh.loader,
|
|
35
35
|
loaderData: mesh.loaderData
|
|
36
36
|
} as MeshArrowTable);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ply/ply-loader-types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ply/ply-loader.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ply/ply-writer.js';
|