@loaders.gl/pointclouds 0.0.0-stage → 5.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LAS-README.md +12 -0
- package/LICENSE +24 -0
- package/PCD-README.md +12 -0
- package/PLY-README.md +38 -0
- package/README.md +11 -2
- package/THIRD-PARTY-NOTICES.md +27 -0
- package/dist/dist.dev.js +30165 -0
- package/dist/dist.min.js +54 -0
- package/dist/index.cjs +61 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/las/bundled.cjs +72 -0
- package/dist/las/bundled.cjs.map +7 -0
- package/dist/las/bundled.d.ts +12 -0
- package/dist/las/bundled.d.ts.map +1 -0
- package/dist/las/bundled.js +12 -0
- package/dist/las/bundled.js.map +1 -0
- package/dist/las/index.cjs +78 -0
- package/dist/las/index.cjs.map +7 -0
- package/dist/las/index.d.ts +17 -0
- package/dist/las/index.d.ts.map +1 -0
- package/dist/las/index.js +15 -0
- package/dist/las/index.js.map +1 -0
- package/dist/las/las-copc-loader-types.cjs +49 -0
- package/dist/las/las-copc-loader-types.cjs.map +7 -0
- package/dist/las/las-copc-loader-types.d.ts +63 -0
- package/dist/las/las-copc-loader-types.d.ts.map +1 -0
- package/dist/las/las-copc-loader-types.js +14 -0
- package/dist/las/las-copc-loader-types.js.map +1 -0
- package/dist/las/las-copc-loader.cjs +57 -0
- package/dist/las/las-copc-loader.cjs.map +7 -0
- package/dist/las/las-copc-loader.d.ts +37 -0
- package/dist/las/las-copc-loader.d.ts.map +1 -0
- package/dist/las/las-copc-loader.js +40 -0
- package/dist/las/las-copc-loader.js.map +1 -0
- package/dist/las/las-format.cjs +44 -0
- package/dist/las/las-format.cjs.map +7 -0
- package/dist/las/las-format.d.ts +16 -0
- package/dist/las/las-format.d.ts.map +1 -0
- package/dist/las/las-format.js +19 -0
- package/dist/las/las-format.js.map +1 -0
- package/dist/las/las-loader-shared.cjs +82 -0
- package/dist/las/las-loader-shared.cjs.map +7 -0
- package/dist/las/las-loader-shared.d.ts +66 -0
- package/dist/las/las-loader-shared.d.ts.map +1 -0
- package/dist/las/las-loader-shared.js +58 -0
- package/dist/las/las-loader-shared.js.map +1 -0
- package/dist/las/las-loader-types.cjs +54 -0
- package/dist/las/las-loader-types.cjs.map +7 -0
- package/dist/las/las-loader-types.d.ts +104 -0
- package/dist/las/las-loader-types.d.ts.map +1 -0
- package/dist/las/las-loader-types.js +19 -0
- package/dist/las/las-loader-types.js.map +1 -0
- package/dist/las/las-loader.cjs +80 -0
- package/dist/las/las-loader.cjs.map +7 -0
- package/dist/las/las-loader.d.ts +45 -0
- package/dist/las/las-loader.d.ts.map +1 -0
- package/dist/las/las-loader.js +58 -0
- package/dist/las/las-loader.js.map +1 -0
- package/dist/las/las-writer.cjs +1054 -0
- package/dist/las/las-writer.cjs.map +7 -0
- package/dist/las/las-writer.d.ts +69 -0
- package/dist/las/las-writer.d.ts.map +1 -0
- package/dist/las/las-writer.js +994 -0
- package/dist/las/las-writer.js.map +1 -0
- package/dist/las/laz-rs-loader-types.cjs +49 -0
- package/dist/las/laz-rs-loader-types.cjs.map +7 -0
- package/dist/las/laz-rs-loader-types.d.ts +65 -0
- package/dist/las/laz-rs-loader-types.d.ts.map +1 -0
- package/dist/las/laz-rs-loader-types.js +16 -0
- package/dist/las/laz-rs-loader-types.js.map +1 -0
- package/dist/las/laz-rs-loader.cjs +272 -0
- package/dist/las/laz-rs-loader.cjs.map +7 -0
- package/dist/las/laz-rs-loader.d.ts +37 -0
- package/dist/las/laz-rs-loader.d.ts.map +1 -0
- package/dist/las/laz-rs-loader.js +38 -0
- package/dist/las/laz-rs-loader.js.map +1 -0
- package/dist/las/lazperf-loader-types.cjs +49 -0
- package/dist/las/lazperf-loader-types.cjs.map +7 -0
- package/dist/las/lazperf-loader-types.d.ts +67 -0
- package/dist/las/lazperf-loader-types.d.ts.map +1 -0
- package/dist/las/lazperf-loader-types.js +17 -0
- package/dist/las/lazperf-loader-types.js.map +1 -0
- package/dist/las/lazperf-loader.cjs +60 -0
- package/dist/las/lazperf-loader.cjs.map +7 -0
- package/dist/las/lazperf-loader.d.ts +39 -0
- package/dist/las/lazperf-loader.d.ts.map +1 -0
- package/dist/las/lazperf-loader.js +44 -0
- package/dist/las/lazperf-loader.js.map +1 -0
- package/dist/las/lib/copc/parse-las.cjs +177 -0
- package/dist/las/lib/copc/parse-las.cjs.map +7 -0
- package/dist/las/lib/copc/parse-las.d.ts +17 -0
- package/dist/las/lib/copc/parse-las.d.ts.map +1 -0
- package/dist/las/lib/copc/parse-las.js +215 -0
- package/dist/las/lib/copc/parse-las.js.map +1 -0
- package/dist/las/lib/get-las-schema.cjs +62 -0
- package/dist/las/lib/get-las-schema.cjs.map +7 -0
- package/dist/las/lib/get-las-schema.d.ts +16 -0
- package/dist/las/lib/get-las-schema.d.ts.map +1 -0
- package/dist/las/lib/get-las-schema.js +46 -0
- package/dist/las/lib/get-las-schema.js.map +1 -0
- package/dist/las/lib/las-compatibility.cjs +110 -0
- package/dist/las/lib/las-compatibility.cjs.map +7 -0
- package/dist/las/lib/las-compatibility.d.ts +40 -0
- package/dist/las/lib/las-compatibility.d.ts.map +1 -0
- package/dist/las/lib/las-compatibility.js +115 -0
- package/dist/las/lib/las-compatibility.js.map +1 -0
- package/dist/las/lib/las-extra-bytes.cjs +223 -0
- package/dist/las/lib/las-extra-bytes.cjs.map +7 -0
- package/dist/las/lib/las-extra-bytes.d.ts +35 -0
- package/dist/las/lib/las-extra-bytes.d.ts.map +1 -0
- package/dist/las/lib/las-extra-bytes.js +195 -0
- package/dist/las/lib/las-extra-bytes.js.map +1 -0
- package/dist/las/lib/las-types.cjs +19 -0
- package/dist/las/lib/las-types.cjs.map +7 -0
- package/dist/las/lib/las-types.d.ts +194 -0
- package/dist/las/lib/las-types.d.ts.map +1 -0
- package/dist/las/lib/las-types.js +5 -0
- package/dist/las/lib/las-types.js.map +1 -0
- package/dist/las/lib/las-waveform.cjs +196 -0
- package/dist/las/lib/las-waveform.cjs.map +7 -0
- package/dist/las/lib/las-waveform.d.ts +89 -0
- package/dist/las/lib/las-waveform.d.ts.map +1 -0
- package/dist/las/lib/las-waveform.js +193 -0
- package/dist/las/lib/las-waveform.js.map +1 -0
- package/dist/las/lib/laz-perf/laslaz-decoder.cjs +382 -0
- package/dist/las/lib/laz-perf/laslaz-decoder.cjs.map +7 -0
- package/dist/las/lib/laz-perf/laslaz-decoder.d.ts +129 -0
- package/dist/las/lib/laz-perf/laslaz-decoder.d.ts.map +1 -0
- package/dist/las/lib/laz-perf/laslaz-decoder.js +377 -0
- package/dist/las/lib/laz-perf/laslaz-decoder.js.map +1 -0
- package/dist/las/lib/laz-perf/parse-las.cjs +270 -0
- package/dist/las/lib/laz-perf/parse-las.cjs.map +7 -0
- package/dist/las/lib/laz-perf/parse-las.d.ts +24 -0
- package/dist/las/lib/laz-perf/parse-las.d.ts.map +1 -0
- package/dist/las/lib/laz-perf/parse-las.js +307 -0
- package/dist/las/lib/laz-perf/parse-las.js.map +1 -0
- package/dist/las/lib/laz-rs-wasm/laslaz-decoder.cjs +631 -0
- package/dist/las/lib/laz-rs-wasm/laslaz-decoder.cjs.map +7 -0
- package/dist/las/lib/laz-rs-wasm/laslaz-decoder.d.ts +129 -0
- package/dist/las/lib/laz-rs-wasm/laslaz-decoder.d.ts.map +1 -0
- package/dist/las/lib/laz-rs-wasm/laslaz-decoder.js +414 -0
- package/dist/las/lib/laz-rs-wasm/laslaz-decoder.js.map +1 -0
- package/dist/las/lib/laz-rs-wasm/parse-las.cjs +270 -0
- package/dist/las/lib/laz-rs-wasm/parse-las.cjs.map +7 -0
- package/dist/las/lib/laz-rs-wasm/parse-las.d.ts +24 -0
- package/dist/las/lib/laz-rs-wasm/parse-las.d.ts.map +1 -0
- package/dist/las/lib/laz-rs-wasm/parse-las.js +307 -0
- package/dist/las/lib/laz-rs-wasm/parse-las.js.map +1 -0
- package/dist/las/lib/typescript/parse-las.cjs +2767 -0
- package/dist/las/lib/typescript/parse-las.cjs.map +7 -0
- package/dist/las/lib/typescript/parse-las.d.ts +39 -0
- package/dist/las/lib/typescript/parse-las.d.ts.map +1 -0
- package/dist/las/lib/typescript/parse-las.js +2607 -0
- package/dist/las/lib/typescript/parse-las.js.map +1 -0
- package/dist/las/libs/laz-perf/laz-perf.cjs +18093 -0
- package/dist/las/libs/laz-perf/laz-perf.cjs.map +7 -0
- package/dist/las/libs/laz-perf/laz-perf.d.ts +2 -0
- package/dist/las/libs/laz-perf/laz-perf.d.ts.map +1 -0
- package/dist/las/libs/laz-perf/laz-perf.js +19003 -0
- package/dist/las/libs/laz-perf/laz-perf.js.map +1 -0
- package/dist/las/libs/laz-rs-wasm/laz_rs_wasm.d.ts +95 -0
- package/dist/las/libs/laz-rs-wasm/laz_rs_wasm.d.ts.map +1 -0
- package/dist/las/libs/laz-rs-wasm/laz_rs_wasm.js +442 -0
- package/dist/las/libs/laz-rs-wasm/laz_rs_wasm.js.map +1 -0
- package/dist/las/libs/laz-rs-wasm/laz_rs_wasm_bg.wasm +0 -0
- package/dist/las/libs/laz-rs-wasm/laz_rs_wasm_bg.wasm.d.ts +38 -0
- package/dist/las/unbundled.cjs +71 -0
- package/dist/las/unbundled.cjs.map +7 -0
- package/dist/las/unbundled.d.ts +11 -0
- package/dist/las/unbundled.d.ts.map +1 -0
- package/dist/las/unbundled.js +11 -0
- package/dist/las/unbundled.js.map +1 -0
- package/dist/las/workers/las-worker.cjs +23 -0
- package/dist/las/workers/las-worker.cjs.map +7 -0
- package/dist/las/workers/las-worker.d.ts +2 -0
- package/dist/las/workers/las-worker.d.ts.map +1 -0
- package/dist/las/workers/las-worker.js +23 -0
- package/dist/las/workers/las-worker.js.map +1 -0
- 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 +59 -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 +56 -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 +82 -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 +23169 -0
- 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 +274 -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 +62 -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 +33 -0
- package/dist/pcd/bundled.cjs.map +7 -0
- package/dist/pcd/bundled.d.ts +3 -0
- package/dist/pcd/bundled.d.ts.map +1 -0
- package/dist/pcd/bundled.js +5 -0
- package/dist/pcd/bundled.js.map +1 -0
- package/dist/pcd/index.cjs +40 -0
- package/dist/pcd/index.cjs.map +7 -0
- package/dist/pcd/index.d.ts +8 -0
- package/dist/pcd/index.d.ts.map +1 -0
- package/dist/pcd/index.js +10 -0
- package/dist/pcd/index.js.map +1 -0
- package/dist/pcd/lib/decompress-lzf.cjs +80 -0
- package/dist/pcd/lib/decompress-lzf.cjs.map +7 -0
- package/dist/pcd/lib/decompress-lzf.d.ts +7 -0
- package/dist/pcd/lib/decompress-lzf.d.ts.map +1 -0
- package/dist/pcd/lib/decompress-lzf.js +62 -0
- package/dist/pcd/lib/decompress-lzf.js.map +1 -0
- package/dist/pcd/lib/get-pcd-schema.cjs +70 -0
- package/dist/pcd/lib/get-pcd-schema.cjs.map +7 -0
- package/dist/pcd/lib/get-pcd-schema.d.ts +10 -0
- package/dist/pcd/lib/get-pcd-schema.d.ts.map +1 -0
- package/dist/pcd/lib/get-pcd-schema.js +53 -0
- package/dist/pcd/lib/get-pcd-schema.js.map +1 -0
- package/dist/pcd/lib/parse-pcd.cjs +354 -0
- package/dist/pcd/lib/parse-pcd.cjs.map +7 -0
- package/dist/pcd/lib/parse-pcd.d.ts +20 -0
- package/dist/pcd/lib/parse-pcd.d.ts.map +1 -0
- package/dist/pcd/lib/parse-pcd.js +341 -0
- package/dist/pcd/lib/parse-pcd.js.map +1 -0
- package/dist/pcd/lib/pcd-types.cjs +19 -0
- package/dist/pcd/lib/pcd-types.cjs.map +7 -0
- package/dist/pcd/lib/pcd-types.d.ts +31 -0
- package/dist/pcd/lib/pcd-types.d.ts.map +1 -0
- package/dist/pcd/lib/pcd-types.js +5 -0
- package/dist/pcd/lib/pcd-types.js.map +1 -0
- package/dist/pcd/pcd-format.cjs +42 -0
- package/dist/pcd/pcd-format.cjs.map +7 -0
- package/dist/pcd/pcd-format.d.ts +16 -0
- package/dist/pcd/pcd-format.d.ts.map +1 -0
- package/dist/pcd/pcd-format.js +19 -0
- package/dist/pcd/pcd-format.js.map +1 -0
- package/dist/pcd/pcd-loader-types.cjs +64 -0
- package/dist/pcd/pcd-loader-types.cjs.map +7 -0
- package/dist/pcd/pcd-loader-types.d.ts +105 -0
- package/dist/pcd/pcd-loader-types.d.ts.map +1 -0
- package/dist/pcd/pcd-loader-types.js +35 -0
- package/dist/pcd/pcd-loader-types.js.map +1 -0
- package/dist/pcd/pcd-loader.cjs +144 -0
- package/dist/pcd/pcd-loader.cjs.map +7 -0
- package/dist/pcd/pcd-loader.d.ts +44 -0
- package/dist/pcd/pcd-loader.d.ts.map +1 -0
- package/dist/pcd/pcd-loader.js +128 -0
- package/dist/pcd/pcd-loader.js.map +1 -0
- package/dist/pcd/pcd-writer.cjs +134 -0
- package/dist/pcd/pcd-writer.cjs.map +7 -0
- package/dist/pcd/pcd-writer.d.ts +37 -0
- package/dist/pcd/pcd-writer.d.ts.map +1 -0
- package/dist/pcd/pcd-writer.js +115 -0
- package/dist/pcd/pcd-writer.js.map +1 -0
- package/dist/pcd/unbundled.cjs +33 -0
- package/dist/pcd/unbundled.cjs.map +7 -0
- package/dist/pcd/unbundled.d.ts +3 -0
- package/dist/pcd/unbundled.d.ts.map +1 -0
- package/dist/pcd/unbundled.js +5 -0
- package/dist/pcd/unbundled.js.map +1 -0
- package/dist/pcd/workers/pcd-worker.cjs +23 -0
- package/dist/pcd/workers/pcd-worker.cjs.map +7 -0
- package/dist/pcd/workers/pcd-worker.d.ts +2 -0
- package/dist/pcd/workers/pcd-worker.d.ts.map +1 -0
- package/dist/pcd/workers/pcd-worker.js +23 -0
- package/dist/pcd/workers/pcd-worker.js.map +1 -0
- package/dist/pcd-loader-types.cjs +66 -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 +146 -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 +17655 -0
- 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 +33 -0
- package/dist/ply/bundled.cjs.map +7 -0
- package/dist/ply/bundled.d.ts +3 -0
- package/dist/ply/bundled.d.ts.map +1 -0
- package/dist/ply/bundled.js +5 -0
- package/dist/ply/bundled.js.map +1 -0
- package/dist/ply/index.cjs +40 -0
- package/dist/ply/index.cjs.map +7 -0
- package/dist/ply/index.d.ts +8 -0
- package/dist/ply/index.d.ts.map +1 -0
- package/dist/ply/index.js +11 -0
- package/dist/ply/index.js.map +1 -0
- package/dist/ply/lib/get-ply-schema.cjs +126 -0
- package/dist/ply/lib/get-ply-schema.cjs.map +7 -0
- package/dist/ply/lib/get-ply-schema.d.ts +10 -0
- package/dist/ply/lib/get-ply-schema.d.ts.map +1 -0
- package/dist/ply/lib/get-ply-schema.js +117 -0
- package/dist/ply/lib/get-ply-schema.js.map +1 -0
- package/dist/ply/lib/normalize-ply.cjs +96 -0
- package/dist/ply/lib/normalize-ply.cjs.map +7 -0
- package/dist/ply/lib/normalize-ply.d.ts +8 -0
- package/dist/ply/lib/normalize-ply.d.ts.map +1 -0
- package/dist/ply/lib/normalize-ply.js +89 -0
- package/dist/ply/lib/normalize-ply.js.map +1 -0
- package/dist/ply/lib/parse-ply-arrow.cjs +552 -0
- package/dist/ply/lib/parse-ply-arrow.cjs.map +7 -0
- package/dist/ply/lib/parse-ply-arrow.d.ts +25 -0
- package/dist/ply/lib/parse-ply-arrow.d.ts.map +1 -0
- package/dist/ply/lib/parse-ply-arrow.js +493 -0
- package/dist/ply/lib/parse-ply-arrow.js.map +1 -0
- package/dist/ply/lib/parse-ply-in-batches.cjs +607 -0
- package/dist/ply/lib/parse-ply-in-batches.cjs.map +7 -0
- package/dist/ply/lib/parse-ply-in-batches.d.ts +9 -0
- package/dist/ply/lib/parse-ply-in-batches.d.ts.map +1 -0
- package/dist/ply/lib/parse-ply-in-batches.js +625 -0
- package/dist/ply/lib/parse-ply-in-batches.js.map +1 -0
- package/dist/ply/lib/parse-ply.cjs +755 -0
- package/dist/ply/lib/parse-ply.cjs.map +7 -0
- package/dist/ply/lib/parse-ply.d.ts +69 -0
- package/dist/ply/lib/parse-ply.d.ts.map +1 -0
- package/dist/ply/lib/parse-ply.js +851 -0
- package/dist/ply/lib/parse-ply.js.map +1 -0
- package/dist/ply/lib/ply-types.cjs +19 -0
- package/dist/ply/lib/ply-types.cjs.map +7 -0
- package/dist/ply/lib/ply-types.d.ts +37 -0
- package/dist/ply/lib/ply-types.d.ts.map +1 -0
- package/dist/ply/lib/ply-types.js +2 -0
- package/dist/ply/lib/ply-types.js.map +1 -0
- package/dist/ply/ply-format.cjs +43 -0
- package/dist/ply/ply-format.cjs.map +7 -0
- package/dist/ply/ply-format.d.ts +18 -0
- package/dist/ply/ply-format.d.ts.map +1 -0
- package/dist/ply/ply-format.js +22 -0
- package/dist/ply/ply-format.js.map +1 -0
- package/dist/ply/ply-loader-types.cjs +65 -0
- package/dist/ply/ply-loader-types.cjs.map +7 -0
- package/dist/ply/ply-loader-types.d.ts +111 -0
- package/dist/ply/ply-loader-types.d.ts.map +1 -0
- package/dist/ply/ply-loader-types.js +38 -0
- package/dist/ply/ply-loader-types.js.map +1 -0
- package/dist/ply/ply-loader.cjs +134 -0
- package/dist/ply/ply-loader.cjs.map +7 -0
- package/dist/ply/ply-loader.d.ts +44 -0
- package/dist/ply/ply-loader.d.ts.map +1 -0
- package/dist/ply/ply-loader.js +121 -0
- package/dist/ply/ply-loader.js.map +1 -0
- package/dist/ply/ply-writer.cjs +175 -0
- package/dist/ply/ply-writer.cjs.map +7 -0
- package/dist/ply/ply-writer.d.ts +37 -0
- package/dist/ply/ply-writer.d.ts.map +1 -0
- package/dist/ply/ply-writer.js +140 -0
- package/dist/ply/ply-writer.js.map +1 -0
- package/dist/ply/unbundled.cjs +33 -0
- package/dist/ply/unbundled.cjs.map +7 -0
- package/dist/ply/unbundled.d.ts +3 -0
- package/dist/ply/unbundled.d.ts.map +1 -0
- package/dist/ply/unbundled.js +5 -0
- package/dist/ply/unbundled.js.map +1 -0
- package/dist/ply/workers/ply-worker.cjs +34 -0
- package/dist/ply/workers/ply-worker.cjs.map +7 -0
- package/dist/ply/workers/ply-worker.d.ts +2 -0
- package/dist/ply/workers/ply-worker.d.ts.map +1 -0
- package/dist/ply/workers/ply-worker.js +37 -0
- package/dist/ply/workers/ply-worker.js.map +1 -0
- package/dist/ply-loader-types.cjs +67 -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 +136 -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 +19308 -0
- 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 +237 -4
- package/src/index.ts +19 -0
- package/src/las/bundled.ts +39 -0
- package/src/las/index.ts +70 -0
- package/src/las/las-copc-loader-types.ts +18 -0
- package/src/las/las-copc-loader.ts +61 -0
- package/src/las/las-format.ts +21 -0
- package/src/las/las-loader-shared.ts +124 -0
- package/src/las/las-loader-types.ts +27 -0
- package/src/las/las-loader.ts +109 -0
- package/src/las/las-writer.ts +1473 -0
- package/src/las/laz-rs-loader-types.ts +21 -0
- package/src/las/laz-rs-loader.ts +53 -0
- package/src/las/lazperf-loader-types.ts +22 -0
- package/src/las/lazperf-loader.ts +65 -0
- package/src/las/lib/LASZIP-LICENSE +202 -0
- package/src/las/lib/LASZIP-NOTICE +4 -0
- package/src/las/lib/copc/parse-las.ts +265 -0
- package/src/las/lib/get-las-schema.ts +50 -0
- package/src/las/lib/las-compatibility.ts +178 -0
- package/src/las/lib/las-extra-bytes.ts +274 -0
- package/src/las/lib/las-types.ts +206 -0
- package/src/las/lib/las-waveform.ts +292 -0
- package/src/las/lib/laz-perf/laslaz-decoder.ts +443 -0
- package/src/las/lib/laz-perf/parse-las.ts +412 -0
- package/src/las/lib/laz-rs-wasm/laslaz-decoder.ts +488 -0
- package/src/las/lib/laz-rs-wasm/parse-las.ts +412 -0
- package/src/las/lib/typescript/parse-las.ts +3730 -0
- package/src/las/libs/laz-perf/laz-perf.ts +20615 -0
- package/src/las/libs/laz-rs-wasm/README.md +5 -0
- package/src/las/libs/laz-rs-wasm/laz_rs_wasm.d.ts +89 -0
- package/src/las/libs/laz-rs-wasm/laz_rs_wasm.js +497 -0
- package/src/las/libs/laz-rs-wasm/laz_rs_wasm_bg.wasm +0 -0
- package/src/las/libs/laz-rs-wasm/laz_rs_wasm_bg.wasm.d.ts +38 -0
- package/src/las/libs/laz-rs-wasm/package.json +25 -0
- package/src/las/unbundled.ts +38 -0
- package/src/las/workers/las-worker.ts +24 -0
- 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 +9 -0
- package/src/pcd/index.ts +13 -0
- package/src/pcd/lib/decompress-lzf.ts +68 -0
- package/src/pcd/lib/get-pcd-schema.ts +66 -0
- package/src/pcd/lib/parse-pcd.ts +474 -0
- package/src/pcd/lib/pcd-types.ts +34 -0
- package/src/pcd/pcd-format.ts +21 -0
- package/src/pcd/pcd-loader-types.ts +53 -0
- package/src/pcd/pcd-loader.ts +179 -0
- package/src/pcd/pcd-writer.ts +152 -0
- package/src/pcd/unbundled.ts +6 -0
- package/src/pcd/workers/pcd-worker.ts +24 -0
- 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 +9 -0
- package/src/ply/index.ts +15 -0
- package/src/ply/lib/get-ply-schema.ts +133 -0
- package/src/ply/lib/normalize-ply.ts +110 -0
- package/src/ply/lib/parse-ply-arrow.ts +676 -0
- package/src/ply/lib/parse-ply-in-batches.ts +827 -0
- package/src/ply/lib/parse-ply.ts +1081 -0
- package/src/ply/lib/ply-types.ts +47 -0
- package/src/ply/ply-format.ts +24 -0
- package/src/ply/ply-loader-types.ts +61 -0
- package/src/ply/ply-loader.ts +185 -0
- package/src/ply/ply-writer.ts +215 -0
- package/src/ply/unbundled.ts +6 -0
- package/src/ply/workers/ply-worker.ts +40 -0
- package/src/ply-loader-types.ts +1 -0
- package/src/ply-loader.ts +1 -0
- package/src/ply-writer.ts +1 -0
- package/third-party-licenses/plasio-LICENSE +21 -0
- package/third-party-licenses/three-LICENSE +21 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ply/ply-loader.ts"],
|
|
4
|
+
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {PLYLoaderOptions} from './ply-loader-types';\n\n// PLY Loader\nimport {makeTableScanBatch, type LoaderWithParser} from '@loaders.gl/core/loader-utils';\nimport {convertColorArrayToFloat16, convertColorArrayToFloat32} from '@loaders.gl/core/schema';\nimport type {MeshArrowTable, ArrowTableBatch} from '@loaders.gl/core/schema';\nimport {\n deserializeArrowWorkerTable,\n serializeArrowWorkerTable\n} from '@loaders.gl/core/schema-utils/arrow-transport';\nimport type {PLYHeader, PLYMesh} from './lib/ply-types';\nimport {\n convertMeshToTable,\n convertTableToMesh,\n deduceMeshSchema\n} from '@loaders.gl/core/schema-utils';\nimport {parsePLY, parsePLYHeader, parsePLYToArrowTable} from './lib/parse-ply';\nimport {\n convertPLYElementTablesToMeshArrowTable,\n parsePLYToElementTables\n} from './lib/parse-ply-arrow';\nimport {parsePLYInBatches} from './lib/parse-ply-in-batches';\nimport {PLYLoader as PLYLoaderMetadata} from './ply-loader-types';\n\nconst {preload: _PLYLoaderPreload, ...PLYLoaderMetadataWithoutPreload} = PLYLoaderMetadata;\n\nfunction convertPLYMesh(mesh: PLYMesh, options?: PLYLoaderOptions): PLYMesh | MeshArrowTable {\n const table = convertMeshToTable(mesh, 'arrow-table');\n return convertPLYTable(table, options, mesh.loaderData);\n}\n\n/** Parse PLY data using a direct Arrow path when requested and supported. */\nfunction parsePLYData(\n data: ArrayBuffer | string,\n options?: PLYLoaderOptions\n): PLYMesh | MeshArrowTable {\n if (options?.ply?._useLegacyParser) {\n return convertPLYMesh(parsePLY(data, options?.ply), options);\n }\n\n const arrowTable = parsePLYToArrowTable(data, options?.ply);\n if (arrowTable) {\n return convertPLYTable(arrowTable, options, parsePLYHeader(data, options?.ply));\n }\n\n const elementTables = parsePLYToElementTables(data, options?.ply);\n return convertPLYTable(\n convertPLYElementTablesToMeshArrowTable(elementTables),\n options,\n elementTables.header\n );\n}\n\n/**\n * Loader for PLY - Polygon File Format\n */\nexport const PLYLoaderWithParser = {\n ...PLYLoaderMetadataWithoutPreload,\n parse: async (arrayBuffer, options) => parsePLYData(arrayBuffer, options),\n parseTextSync: (arrayBuffer, options) => parsePLYData(arrayBuffer, options),\n parseSync: (arrayBuffer, options) => parsePLYData(arrayBuffer, options),\n parseInBatches: async function* (\n arrayBuffer:\n | AsyncIterable<ArrayBufferLike | ArrayBufferView>\n | Iterable<ArrayBufferLike | ArrayBufferView>,\n options\n ) {\n const plyOptions = {\n ...options?.ply,\n batchSize: options?.batchSize ?? options?.core?.batchSize\n };\n for await (const meshOrTable of parsePLYInBatches(arrayBuffer, plyOptions)) {\n const convertedData = isMeshArrowTable(meshOrTable)\n ? convertPLYTable(meshOrTable, options)\n : convertPLYMesh(meshOrTable, options);\n yield isMeshArrowTable(convertedData) ? makeTableScanBatch(convertedData) : convertedData;\n }\n },\n serializeWorkerResult: serializeArrowWorkerTable,\n deserializeWorkerResult: deserializePLYWorkerResult,\n serializeWorkerBatch: serializeArrowWorkerTable,\n deserializeWorkerBatch: deserializePLYWorkerBatch\n} as const satisfies LoaderWithParser<\n PLYMesh | MeshArrowTable,\n PLYMesh | ArrowTableBatch,\n PLYLoaderOptions\n>;\n\n/** Return requested public PLY shape from the parser's Arrow table. */\nfunction convertPLYTable(\n table: MeshArrowTable & {\n /** Original source header retained by the streaming parser. */\n loaderData?: PLYHeader;\n },\n options?: PLYLoaderOptions,\n header?: PLYHeader\n): PLYMesh | MeshArrowTable {\n const loaderData = header || table.loaderData || {comments: [], elements: []};\n const result =\n options?.ply?.shape === 'arrow-table'\n ? {...table, loader: 'ply' as const, loaderData}\n : {\n ...(convertTableToMesh(table) as PLYMesh),\n loader: 'ply',\n loaderData\n };\n const colorFormat = options?.ply?.colorFormat || 'uint8norm';\n if (colorFormat === 'uint8norm') {\n return result as PLYMesh | MeshArrowTable;\n }\n\n const resultData = result as PLYMesh | MeshArrowTable;\n const formattedMesh = formatPLYMeshColors(\n (isMeshArrowTable(resultData) ? convertTableToMesh(resultData) : resultData) as PLYMesh,\n colorFormat\n );\n return options?.ply?.shape === 'arrow-table'\n ? {\n ...convertMeshToTable(formattedMesh, 'arrow-table'),\n loader: 'ply' as const,\n loaderData\n }\n : (formattedMesh as PLYMesh);\n}\n\n/** Apply the requested normalized color representation to a decoded PLY mesh. */\nfunction formatPLYMeshColors(\n mesh: PLYMesh,\n colorFormat: 'uint8norm' | 'float16' | 'float32'\n): PLYMesh {\n const colorAttribute = mesh.attributes.COLOR_0;\n if (!colorAttribute) {\n return mesh;\n }\n\n const sourceScale = colorAttribute.value instanceof Uint16Array ? 65535 : 255;\n const value =\n colorFormat === 'float16'\n ? convertColorArrayToFloat16(colorAttribute.value, sourceScale)\n : convertColorArrayToFloat32(colorAttribute.value, sourceScale);\n const attributes = {...mesh.attributes};\n for (const [attributeName, attribute] of Object.entries(attributes)) {\n if (attribute.value === colorAttribute.value) {\n attributes[attributeName] = {\n ...attribute,\n value,\n normalized: false,\n ...(colorFormat === 'float16' ? {componentType: 'float16' as const} : {})\n };\n }\n }\n return {\n ...mesh,\n attributes,\n schema: deduceMeshSchema(attributes, mesh.schema.metadata)\n };\n}\n\n/** Return true if a parsed PLY batch is already a Mesh Arrow table. */\nfunction isMeshArrowTable(data: PLYMesh | MeshArrowTable): data is MeshArrowTable {\n return 'shape' in data && data.shape === 'arrow-table';\n}\n\n/** Hydrates worker columns and applies the requested PLY shape on the caller. */\nfunction deserializePLYWorkerResult(\n result: unknown,\n options?: PLYLoaderOptions\n): PLYMesh | MeshArrowTable {\n const table = deserializeArrowWorkerTable(result);\n return options?.ply?.shape === 'mesh'\n ? {...convertTableToMesh(table), loader: 'ply', loaderData: table.loaderData}\n : table;\n}\n\n/** Converts mesh batches only after the Arrow column buffers reach the caller. */\nfunction deserializePLYWorkerBatch(\n result: unknown,\n options?: PLYLoaderOptions\n): PLYMesh | ArrowTableBatch {\n return deserializePLYWorkerResult(result, options) as PLYMesh | ArrowTableBatch;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,0BAAwD;AACxD,oBAAqE;AAErE,6BAGO;AAEP,0BAIO;AACP,uBAA6D;AAC7D,6BAGO;AACP,kCAAgC;AAChC,8BAA6C;AAE7C,IAAM,EAAC,SAAS,mBAAmB,GAAG,gCAA+B,IAAI,wBAAAA;AAEzE,SAAS,eAAe,MAAe,SAAsD;AAC3F,QAAM,YAAQ,wCAAmB,MAAM,aAAa;AACpD,SAAO,gBAAgB,OAAO,SAAS,KAAK,UAAU;AACxD;AAGA,SAAS,aACP,MACA,SAC0B;AAC1B,MAAI,SAAS,KAAK,kBAAkB;AAClC,WAAO,mBAAe,2BAAS,MAAM,SAAS,GAAG,GAAG,OAAO;AAAA,EAC7D;AAEA,QAAM,iBAAa,uCAAqB,MAAM,SAAS,GAAG;AAC1D,MAAI,YAAY;AACd,WAAO,gBAAgB,YAAY,aAAS,iCAAe,MAAM,SAAS,GAAG,CAAC;AAAA,EAChF;AAEA,QAAM,oBAAgB,gDAAwB,MAAM,SAAS,GAAG;AAChE,SAAO;AAAA,QACL,gEAAwC,aAAa;AAAA,IACrD;AAAA,IACA,cAAc;AAAA,EAChB;AACF;AAKO,IAAM,sBAAsB;AAAA,EACjC,GAAG;AAAA,EACH,OAAO,OAAO,aAAa,YAAY,aAAa,aAAa,OAAO;AAAA,EACxE,eAAe,CAAC,aAAa,YAAY,aAAa,aAAa,OAAO;AAAA,EAC1E,WAAW,CAAC,aAAa,YAAY,aAAa,aAAa,OAAO;AAAA,EACtE,gBAAgB,iBACd,aAGA,SACA;AACA,UAAM,aAAa;AAAA,MACjB,GAAG,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AAC,GAAG,KAAK,WAAU;AACtC,aAAW,CAAC,eAAe,SAAS,KAAK,OAAO,QAAQ,UAAU,GAAG;AACnE,QAAI,UAAU,UAAU,eAAe,OAAO;AAC5C,iBAAW,aAAa,IAAI;AAAA,QAC1B,GAAG;AAAA,QACH;AAAA,QACA,YAAY;AAAA,QACZ,GAAI,gBAAgB,YAAY,EAAC,eAAe,UAAkB,IAAI,CAAC;AAAA,MACzE;AAAA,IACF;AAAA,EACF;AACA,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA,YAAQ,sCAAiB,YAAY,KAAK,OAAO,QAAQ;AAAA,EAC3D;AACF;AAGA,SAAS,iBAAiB,MAAwD;AAChF,SAAO,WAAW,QAAQ,KAAK,UAAU;AAC3C;AAGA,SAAS,2BACP,QACA,SAC0B;AAC1B,QAAM,YAAQ,oDAA4B,MAAM;AAChD,SAAO,SAAS,KAAK,UAAU,SAC3B,EAAC,OAAG,wCAAmB,KAAK,GAAG,QAAQ,OAAO,YAAY,MAAM,WAAU,IAC1E;AACN;AAGA,SAAS,0BACP,QACA,SAC2B;AAC3B,SAAO,2BAA2B,QAAQ,OAAO;AACnD;",
|
|
6
|
+
"names": ["PLYLoaderMetadata"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { PLYLoaderOptions } from "./ply-loader-types.js";
|
|
2
|
+
import type { MeshArrowTable, ArrowTableBatch } from '@loaders.gl/core/schema';
|
|
3
|
+
import { serializeArrowWorkerTable } from '@loaders.gl/core/schema-utils/arrow-transport';
|
|
4
|
+
import type { PLYMesh } from "./lib/ply-types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Loader for PLY - Polygon File Format
|
|
7
|
+
*/
|
|
8
|
+
export declare const PLYLoaderWithParser: {
|
|
9
|
+
readonly parse: (arrayBuffer: ArrayBuffer, options: PLYLoaderOptions | undefined) => Promise<MeshArrowTable | PLYMesh>;
|
|
10
|
+
readonly parseTextSync: (arrayBuffer: string, options: PLYLoaderOptions | undefined) => MeshArrowTable | PLYMesh;
|
|
11
|
+
readonly parseSync: (arrayBuffer: ArrayBuffer, options: PLYLoaderOptions | undefined) => MeshArrowTable | PLYMesh;
|
|
12
|
+
readonly parseInBatches: (arrayBuffer: AsyncIterable<ArrayBufferLike | ArrayBufferView> | Iterable<ArrayBufferLike | ArrayBufferView>, options: PLYLoaderOptions | undefined) => AsyncGenerator<ArrowTableBatch | PLYMesh, void, any>;
|
|
13
|
+
readonly serializeWorkerResult: typeof serializeArrowWorkerTable;
|
|
14
|
+
readonly deserializeWorkerResult: typeof deserializePLYWorkerResult;
|
|
15
|
+
readonly serializeWorkerBatch: typeof serializeArrowWorkerTable;
|
|
16
|
+
readonly deserializeWorkerBatch: typeof deserializePLYWorkerBatch;
|
|
17
|
+
readonly version: any;
|
|
18
|
+
readonly worker: true;
|
|
19
|
+
readonly workerInBatches: true;
|
|
20
|
+
readonly options: {
|
|
21
|
+
readonly ply: {
|
|
22
|
+
readonly shape: "arrow-table";
|
|
23
|
+
readonly colorFormat: "uint8norm";
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
readonly name: "PLY";
|
|
27
|
+
readonly id: "ply";
|
|
28
|
+
readonly module: "pointclouds";
|
|
29
|
+
readonly encoding: "text";
|
|
30
|
+
readonly format: "ply";
|
|
31
|
+
readonly extensions: ["ply"];
|
|
32
|
+
readonly mimeTypes: ["text/plain", "application/octet-stream"];
|
|
33
|
+
readonly text: true;
|
|
34
|
+
readonly binary: true;
|
|
35
|
+
readonly tests: ["ply"];
|
|
36
|
+
readonly dataType: PLYMesh | MeshArrowTable;
|
|
37
|
+
readonly batchType: PLYMesh | ArrowTableBatch;
|
|
38
|
+
};
|
|
39
|
+
/** Hydrates worker columns and applies the requested PLY shape on the caller. */
|
|
40
|
+
declare function deserializePLYWorkerResult(result: unknown, options?: PLYLoaderOptions): PLYMesh | MeshArrowTable;
|
|
41
|
+
/** Converts mesh batches only after the Arrow column buffers reach the caller. */
|
|
42
|
+
declare function deserializePLYWorkerBatch(result: unknown, options?: PLYLoaderOptions): PLYMesh | ArrowTableBatch;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=ply-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ply-loader.d.ts","sourceRoot":"","sources":["../../src/ply/ply-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,gBAAgB,EAAC,8BAA2B;AAKzD,OAAO,KAAK,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAEL,yBAAyB,EAC1B,MAAM,+CAA+C,CAAC;AACvD,OAAO,KAAK,EAAY,OAAO,EAAC,2BAAwB;AA2CxD;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;2CAOxB,aAAa,CAAC,eAAe,GAAG,eAAe,CAAC,GAChD,QAAQ,CAAC,eAAe,GAAG,eAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;CAsBlD,CAAC;AA6EF,iFAAiF;AACjF,iBAAS,0BAA0B,CACjC,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,GAAG,cAAc,CAK1B;AAED,kFAAkF;AAClF,iBAAS,yBAAyB,CAChC,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,GAAG,eAAe,CAE3B"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
// PLY Loader
|
|
5
|
+
import { makeTableScanBatch } from '@loaders.gl/core/loader-utils';
|
|
6
|
+
import { convertColorArrayToFloat16, convertColorArrayToFloat32 } from '@loaders.gl/core/schema';
|
|
7
|
+
import { deserializeArrowWorkerTable, serializeArrowWorkerTable } from '@loaders.gl/core/schema-utils/arrow-transport';
|
|
8
|
+
import { convertMeshToTable, convertTableToMesh, deduceMeshSchema } from '@loaders.gl/core/schema-utils';
|
|
9
|
+
import { parsePLY, parsePLYHeader, parsePLYToArrowTable } from "./lib/parse-ply.js";
|
|
10
|
+
import { convertPLYElementTablesToMeshArrowTable, parsePLYToElementTables } from "./lib/parse-ply-arrow.js";
|
|
11
|
+
import { parsePLYInBatches } from "./lib/parse-ply-in-batches.js";
|
|
12
|
+
import { PLYLoader as PLYLoaderMetadata } from "./ply-loader-types.js";
|
|
13
|
+
const { preload: _PLYLoaderPreload, ...PLYLoaderMetadataWithoutPreload } = PLYLoaderMetadata;
|
|
14
|
+
function convertPLYMesh(mesh, options) {
|
|
15
|
+
const table = convertMeshToTable(mesh, 'arrow-table');
|
|
16
|
+
return convertPLYTable(table, options, mesh.loaderData);
|
|
17
|
+
}
|
|
18
|
+
/** Parse PLY data using a direct Arrow path when requested and supported. */
|
|
19
|
+
function parsePLYData(data, options) {
|
|
20
|
+
if (options?.ply?._useLegacyParser) {
|
|
21
|
+
return convertPLYMesh(parsePLY(data, options?.ply), options);
|
|
22
|
+
}
|
|
23
|
+
const arrowTable = parsePLYToArrowTable(data, options?.ply);
|
|
24
|
+
if (arrowTable) {
|
|
25
|
+
return convertPLYTable(arrowTable, options, parsePLYHeader(data, options?.ply));
|
|
26
|
+
}
|
|
27
|
+
const elementTables = parsePLYToElementTables(data, options?.ply);
|
|
28
|
+
return convertPLYTable(convertPLYElementTablesToMeshArrowTable(elementTables), options, elementTables.header);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Loader for PLY - Polygon File Format
|
|
32
|
+
*/
|
|
33
|
+
export const PLYLoaderWithParser = {
|
|
34
|
+
...PLYLoaderMetadataWithoutPreload,
|
|
35
|
+
parse: async (arrayBuffer, options) => parsePLYData(arrayBuffer, options),
|
|
36
|
+
parseTextSync: (arrayBuffer, options) => parsePLYData(arrayBuffer, options),
|
|
37
|
+
parseSync: (arrayBuffer, options) => parsePLYData(arrayBuffer, options),
|
|
38
|
+
parseInBatches: async function* (arrayBuffer, options) {
|
|
39
|
+
const plyOptions = {
|
|
40
|
+
...options?.ply,
|
|
41
|
+
batchSize: options?.batchSize ?? options?.core?.batchSize
|
|
42
|
+
};
|
|
43
|
+
for await (const meshOrTable of parsePLYInBatches(arrayBuffer, plyOptions)) {
|
|
44
|
+
const convertedData = isMeshArrowTable(meshOrTable)
|
|
45
|
+
? convertPLYTable(meshOrTable, options)
|
|
46
|
+
: convertPLYMesh(meshOrTable, options);
|
|
47
|
+
yield isMeshArrowTable(convertedData) ? makeTableScanBatch(convertedData) : convertedData;
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
serializeWorkerResult: serializeArrowWorkerTable,
|
|
51
|
+
deserializeWorkerResult: deserializePLYWorkerResult,
|
|
52
|
+
serializeWorkerBatch: serializeArrowWorkerTable,
|
|
53
|
+
deserializeWorkerBatch: deserializePLYWorkerBatch
|
|
54
|
+
};
|
|
55
|
+
/** Return requested public PLY shape from the parser's Arrow table. */
|
|
56
|
+
function convertPLYTable(table, options, header) {
|
|
57
|
+
const loaderData = header || table.loaderData || { comments: [], elements: [] };
|
|
58
|
+
const result = options?.ply?.shape === 'arrow-table'
|
|
59
|
+
? { ...table, loader: 'ply', loaderData }
|
|
60
|
+
: {
|
|
61
|
+
...convertTableToMesh(table),
|
|
62
|
+
loader: 'ply',
|
|
63
|
+
loaderData
|
|
64
|
+
};
|
|
65
|
+
const colorFormat = options?.ply?.colorFormat || 'uint8norm';
|
|
66
|
+
if (colorFormat === 'uint8norm') {
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
const resultData = result;
|
|
70
|
+
const formattedMesh = formatPLYMeshColors((isMeshArrowTable(resultData) ? convertTableToMesh(resultData) : resultData), colorFormat);
|
|
71
|
+
return options?.ply?.shape === 'arrow-table'
|
|
72
|
+
? {
|
|
73
|
+
...convertMeshToTable(formattedMesh, 'arrow-table'),
|
|
74
|
+
loader: 'ply',
|
|
75
|
+
loaderData
|
|
76
|
+
}
|
|
77
|
+
: formattedMesh;
|
|
78
|
+
}
|
|
79
|
+
/** Apply the requested normalized color representation to a decoded PLY mesh. */
|
|
80
|
+
function formatPLYMeshColors(mesh, colorFormat) {
|
|
81
|
+
const colorAttribute = mesh.attributes.COLOR_0;
|
|
82
|
+
if (!colorAttribute) {
|
|
83
|
+
return mesh;
|
|
84
|
+
}
|
|
85
|
+
const sourceScale = colorAttribute.value instanceof Uint16Array ? 65535 : 255;
|
|
86
|
+
const value = colorFormat === 'float16'
|
|
87
|
+
? convertColorArrayToFloat16(colorAttribute.value, sourceScale)
|
|
88
|
+
: convertColorArrayToFloat32(colorAttribute.value, sourceScale);
|
|
89
|
+
const attributes = { ...mesh.attributes };
|
|
90
|
+
for (const [attributeName, attribute] of Object.entries(attributes)) {
|
|
91
|
+
if (attribute.value === colorAttribute.value) {
|
|
92
|
+
attributes[attributeName] = {
|
|
93
|
+
...attribute,
|
|
94
|
+
value,
|
|
95
|
+
normalized: false,
|
|
96
|
+
...(colorFormat === 'float16' ? { componentType: 'float16' } : {})
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
...mesh,
|
|
102
|
+
attributes,
|
|
103
|
+
schema: deduceMeshSchema(attributes, mesh.schema.metadata)
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/** Return true if a parsed PLY batch is already a Mesh Arrow table. */
|
|
107
|
+
function isMeshArrowTable(data) {
|
|
108
|
+
return 'shape' in data && data.shape === 'arrow-table';
|
|
109
|
+
}
|
|
110
|
+
/** Hydrates worker columns and applies the requested PLY shape on the caller. */
|
|
111
|
+
function deserializePLYWorkerResult(result, options) {
|
|
112
|
+
const table = deserializeArrowWorkerTable(result);
|
|
113
|
+
return options?.ply?.shape === 'mesh'
|
|
114
|
+
? { ...convertTableToMesh(table), loader: 'ply', loaderData: table.loaderData }
|
|
115
|
+
: table;
|
|
116
|
+
}
|
|
117
|
+
/** Converts mesh batches only after the Arrow column buffers reach the caller. */
|
|
118
|
+
function deserializePLYWorkerBatch(result, options) {
|
|
119
|
+
return deserializePLYWorkerResult(result, options);
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=ply-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ply-loader.js","sourceRoot":"","sources":["../../src/ply/ply-loader.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAIpC,aAAa;AACb,OAAO,EAAC,kBAAkB,EAAwB,MAAM,+BAA+B,CAAC;AACxF,OAAO,EAAC,0BAA0B,EAAE,0BAA0B,EAAC,MAAM,yBAAyB,CAAC;AAE/F,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAE,cAAc,EAAE,oBAAoB,EAAC,2BAAwB;AAC/E,OAAO,EACL,uCAAuC,EACvC,uBAAuB,EACxB,iCAA8B;AAC/B,OAAO,EAAC,iBAAiB,EAAC,sCAAmC;AAC7D,OAAO,EAAC,SAAS,IAAI,iBAAiB,EAAC,8BAA2B;AAElE,MAAM,EAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,+BAA+B,EAAC,GAAG,iBAAiB,CAAC;AAE3F,SAAS,cAAc,CAAC,IAAa,EAAE,OAA0B;IAC/D,MAAM,KAAK,GAAG,kBAAkB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACtD,OAAO,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AAC1D,CAAC;AAED,6EAA6E;AAC7E,SAAS,YAAY,CACnB,IAA0B,EAC1B,OAA0B;IAE1B,IAAI,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAAE,CAAC;QACnC,OAAO,cAAc,CAAC,QAAQ,CAA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,CAAC;AAED,uEAAuE;AACvE,SAAS,gBAAgB,CAAC,IAA8B;IACtD,OAAO,OAAO,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,aAAa,CAAC;AACzD,CAAC;AAED,iFAAiF;AACjF,SAAS,0BAA0B,CACjC,MAAe,EACf,OAA0B;IAE1B,MAAM,KAAK,GAAG,2BAA2B,CAAC,MAAM,CAAC,CAAC;IAClD,OAAO,OAAO,EAAE,GAAG,EAAE,KAAK,KAAK,MAAM;QACnC,CAAC,CAAC,EAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAC;QAC7E,CAAC,CAAC,KAAK,CAAC;AACZ,CAAC;AAED,kFAAkF;AAClF,SAAS,yBAAyB,CAChC,MAAe,EACf,OAA0B;IAE1B,OAAO,0BAA0B,CAAC,MAAM,EAAE,OAAO,CAA8B,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/ply/ply-writer.ts
|
|
21
|
+
var ply_writer_exports = {};
|
|
22
|
+
__export(ply_writer_exports, {
|
|
23
|
+
PLYWriter: () => PLYWriter
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(ply_writer_exports);
|
|
26
|
+
var import_schema_utils = require("@loaders.gl/core/schema-utils");
|
|
27
|
+
var import_ply_format = require("./ply-format.cjs");
|
|
28
|
+
var VERSION = true ? "5.0.0-beta.2" : "latest";
|
|
29
|
+
var PLYWriter = {
|
|
30
|
+
...import_ply_format.PLYFormat,
|
|
31
|
+
dataType: null,
|
|
32
|
+
batchType: null,
|
|
33
|
+
version: VERSION,
|
|
34
|
+
options: {
|
|
35
|
+
ply: {}
|
|
36
|
+
},
|
|
37
|
+
text: true,
|
|
38
|
+
encode: async (data, options) => encodePLYSync(data, options),
|
|
39
|
+
encodeSync: encodePLYSync,
|
|
40
|
+
encodeTextSync: encodePLY
|
|
41
|
+
};
|
|
42
|
+
function encodePLYSync(data, options) {
|
|
43
|
+
const text = encodePLY(data, options);
|
|
44
|
+
return new TextEncoder().encode(text).buffer;
|
|
45
|
+
}
|
|
46
|
+
function encodePLY(data, options) {
|
|
47
|
+
const mesh = (0, import_schema_utils.convertTableToMesh)(normalizeMeshArrowTable(data));
|
|
48
|
+
const positionAttribute = getRequiredAttribute(mesh, "POSITION");
|
|
49
|
+
const normalAttribute = mesh.attributes.NORMAL;
|
|
50
|
+
const textureCoordinateAttribute = mesh.attributes.TEXCOORD_0;
|
|
51
|
+
const colorAttribute = mesh.attributes.COLOR_0;
|
|
52
|
+
const customScalarAttributes = getCustomScalarAttributes(mesh);
|
|
53
|
+
const vertexCount = positionAttribute.value.length / positionAttribute.size;
|
|
54
|
+
const triangleIndices = getTriangleIndices(mesh, vertexCount);
|
|
55
|
+
const header = getPLYHeader(
|
|
56
|
+
vertexCount,
|
|
57
|
+
triangleIndices.length / 3,
|
|
58
|
+
Boolean(normalAttribute),
|
|
59
|
+
Boolean(textureCoordinateAttribute),
|
|
60
|
+
Boolean(colorAttribute),
|
|
61
|
+
customScalarAttributes
|
|
62
|
+
);
|
|
63
|
+
const rows = [];
|
|
64
|
+
for (let vertexIndex = 0; vertexIndex < vertexCount; vertexIndex++) {
|
|
65
|
+
const row = [
|
|
66
|
+
getComponent(positionAttribute, vertexIndex, 0),
|
|
67
|
+
getComponent(positionAttribute, vertexIndex, 1),
|
|
68
|
+
getComponent(positionAttribute, vertexIndex, 2)
|
|
69
|
+
];
|
|
70
|
+
if (normalAttribute) {
|
|
71
|
+
row.push(
|
|
72
|
+
getComponent(normalAttribute, vertexIndex, 0),
|
|
73
|
+
getComponent(normalAttribute, vertexIndex, 1),
|
|
74
|
+
getComponent(normalAttribute, vertexIndex, 2)
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
if (textureCoordinateAttribute) {
|
|
78
|
+
row.push(
|
|
79
|
+
getComponent(textureCoordinateAttribute, vertexIndex, 0),
|
|
80
|
+
getComponent(textureCoordinateAttribute, vertexIndex, 1)
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
if (colorAttribute) {
|
|
84
|
+
row.push(
|
|
85
|
+
getColorByte(colorAttribute, vertexIndex, 0),
|
|
86
|
+
getColorByte(colorAttribute, vertexIndex, 1),
|
|
87
|
+
getColorByte(colorAttribute, vertexIndex, 2)
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
for (const [, attribute] of customScalarAttributes) {
|
|
91
|
+
row.push(getComponent(attribute, vertexIndex, 0));
|
|
92
|
+
}
|
|
93
|
+
rows.push(row.join(" "));
|
|
94
|
+
}
|
|
95
|
+
for (let triangleIndex = 0; triangleIndex < triangleIndices.length; triangleIndex += 3) {
|
|
96
|
+
rows.push(
|
|
97
|
+
`3 ${triangleIndices[triangleIndex]} ${triangleIndices[triangleIndex + 1]} ${triangleIndices[triangleIndex + 2]}`
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
return `${header.concat(rows).join("\n")}
|
|
101
|
+
`;
|
|
102
|
+
}
|
|
103
|
+
function normalizeMeshArrowTable(data) {
|
|
104
|
+
if ("shape" in data && data.shape === "arrow-table") {
|
|
105
|
+
return data;
|
|
106
|
+
}
|
|
107
|
+
return (0, import_schema_utils.convertMeshToTable)(data, "arrow-table");
|
|
108
|
+
}
|
|
109
|
+
function getRequiredAttribute(mesh, attributeName) {
|
|
110
|
+
const attribute = mesh.attributes[attributeName];
|
|
111
|
+
if (!attribute) {
|
|
112
|
+
throw new Error(`PLYWriter: ${attributeName} attribute is required`);
|
|
113
|
+
}
|
|
114
|
+
return attribute;
|
|
115
|
+
}
|
|
116
|
+
function getPLYHeader(vertexCount, faceCount, hasNormals, hasTextureCoordinates, hasColors, customScalarAttributes) {
|
|
117
|
+
const header = [
|
|
118
|
+
"ply",
|
|
119
|
+
"format ascii 1.0",
|
|
120
|
+
"comment generated by loaders.gl",
|
|
121
|
+
`element vertex ${vertexCount}`,
|
|
122
|
+
"property float x",
|
|
123
|
+
"property float y",
|
|
124
|
+
"property float z"
|
|
125
|
+
];
|
|
126
|
+
if (hasNormals) {
|
|
127
|
+
header.push("property float nx", "property float ny", "property float nz");
|
|
128
|
+
}
|
|
129
|
+
if (hasTextureCoordinates) {
|
|
130
|
+
header.push("property float s", "property float t");
|
|
131
|
+
}
|
|
132
|
+
if (hasColors) {
|
|
133
|
+
header.push("property uchar red", "property uchar green", "property uchar blue");
|
|
134
|
+
}
|
|
135
|
+
for (const [attributeName] of customScalarAttributes) {
|
|
136
|
+
header.push(`property float ${attributeName}`);
|
|
137
|
+
}
|
|
138
|
+
if (faceCount > 0) {
|
|
139
|
+
header.push(`element face ${faceCount}`, "property list uchar int vertex_indices");
|
|
140
|
+
}
|
|
141
|
+
header.push("end_header");
|
|
142
|
+
return header;
|
|
143
|
+
}
|
|
144
|
+
function getCustomScalarAttributes(mesh) {
|
|
145
|
+
const reservedAttributeNames = /* @__PURE__ */ new Set(["POSITION", "NORMAL", "TEXCOORD_0", "COLOR_0"]);
|
|
146
|
+
return Object.entries(mesh.attributes).filter(
|
|
147
|
+
([attributeName, attribute]) => !reservedAttributeNames.has(attributeName) && attribute.size === 1
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
function getComponent(attribute, vertexIndex, componentIndex) {
|
|
151
|
+
return attribute.value[vertexIndex * attribute.size + componentIndex] || 0;
|
|
152
|
+
}
|
|
153
|
+
function getColorByte(attribute, vertexIndex, componentIndex) {
|
|
154
|
+
const value = getComponent(attribute, vertexIndex, componentIndex);
|
|
155
|
+
const byteValue = attribute.normalized || value <= 1 ? value * 255 : value;
|
|
156
|
+
return Math.max(0, Math.min(255, Math.round(byteValue)));
|
|
157
|
+
}
|
|
158
|
+
function getTriangleIndices(mesh, vertexCount) {
|
|
159
|
+
if (mesh.indices?.value?.length) {
|
|
160
|
+
return Array.from(mesh.indices.value);
|
|
161
|
+
}
|
|
162
|
+
if (mesh.mode !== 4 && mesh.topology !== "triangle-list") {
|
|
163
|
+
return [];
|
|
164
|
+
}
|
|
165
|
+
const triangleIndices = [];
|
|
166
|
+
for (let vertexIndex = 0; vertexIndex + 2 < vertexCount; vertexIndex += 3) {
|
|
167
|
+
triangleIndices.push(vertexIndex, vertexIndex + 1, vertexIndex + 2);
|
|
168
|
+
}
|
|
169
|
+
return triangleIndices;
|
|
170
|
+
}
|
|
171
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
172
|
+
0 && (module.exports = {
|
|
173
|
+
PLYWriter
|
|
174
|
+
});
|
|
175
|
+
//# sourceMappingURL=ply-writer.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ply/ply-writer.ts"],
|
|
4
|
+
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {WriterOptions, WriterWithEncoder} from '@loaders.gl/core/loader-utils';\nimport type {Mesh, MeshArrowTable, MeshAttribute} from '@loaders.gl/core/schema';\nimport {convertMeshToTable, convertTableToMesh} from '@loaders.gl/core/schema-utils';\nimport {PLYFormat} from './ply-format';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/** Options for `PLYWriter`. */\nexport type PLYWriterOptions = WriterOptions & {\n /** Reserved for future PLY writer options. */\n ply?: Record<string, never>;\n};\n\n/**\n * Writer for the PLY geometry format.\n */\nexport const PLYWriter = {\n ...PLYFormat,\n dataType: null as unknown as Mesh | MeshArrowTable,\n batchType: null as never,\n version: VERSION,\n options: {\n ply: {}\n },\n text: true,\n encode: async (data, options) => encodePLYSync(data, options),\n encodeSync: encodePLYSync,\n encodeTextSync: encodePLY\n} as const satisfies WriterWithEncoder<Mesh | MeshArrowTable, never, PLYWriterOptions>;\n\n/** Encode mesh category data as PLY bytes. */\nfunction encodePLYSync(data: Mesh | MeshArrowTable, options?: PLYWriterOptions): ArrayBuffer {\n const text = encodePLY(data, options);\n return new TextEncoder().encode(text).buffer;\n}\n\n/** Encode mesh category data as ASCII PLY text. */\nfunction encodePLY(data: Mesh | MeshArrowTable, options?: PLYWriterOptions): string {\n const mesh = convertTableToMesh(normalizeMeshArrowTable(data));\n const positionAttribute = getRequiredAttribute(mesh, 'POSITION');\n const normalAttribute = mesh.attributes.NORMAL;\n const textureCoordinateAttribute = mesh.attributes.TEXCOORD_0;\n const colorAttribute = mesh.attributes.COLOR_0;\n const customScalarAttributes = getCustomScalarAttributes(mesh);\n const vertexCount = positionAttribute.value.length / positionAttribute.size;\n const triangleIndices = getTriangleIndices(mesh, vertexCount);\n const header = getPLYHeader(\n vertexCount,\n triangleIndices.length / 3,\n Boolean(normalAttribute),\n Boolean(textureCoordinateAttribute),\n Boolean(colorAttribute),\n customScalarAttributes\n );\n const rows: string[] = [];\n\n for (let vertexIndex = 0; vertexIndex < vertexCount; vertexIndex++) {\n const row = [\n getComponent(positionAttribute, vertexIndex, 0),\n getComponent(positionAttribute, vertexIndex, 1),\n getComponent(positionAttribute, vertexIndex, 2)\n ];\n\n if (normalAttribute) {\n row.push(\n getComponent(normalAttribute, vertexIndex, 0),\n getComponent(normalAttribute, vertexIndex, 1),\n getComponent(normalAttribute, vertexIndex, 2)\n );\n }\n\n if (textureCoordinateAttribute) {\n row.push(\n getComponent(textureCoordinateAttribute, vertexIndex, 0),\n getComponent(textureCoordinateAttribute, vertexIndex, 1)\n );\n }\n\n if (colorAttribute) {\n row.push(\n getColorByte(colorAttribute, vertexIndex, 0),\n getColorByte(colorAttribute, vertexIndex, 1),\n getColorByte(colorAttribute, vertexIndex, 2)\n );\n }\n\n for (const [, attribute] of customScalarAttributes) {\n row.push(getComponent(attribute, vertexIndex, 0));\n }\n\n rows.push(row.join(' '));\n }\n\n for (let triangleIndex = 0; triangleIndex < triangleIndices.length; triangleIndex += 3) {\n rows.push(\n `3 ${triangleIndices[triangleIndex]} ${triangleIndices[triangleIndex + 1]} ${\n triangleIndices[triangleIndex + 2]\n }`\n );\n }\n\n return `${header.concat(rows).join('\\n')}\\n`;\n}\n\n/** Return mesh data as a MeshArrowTable, converting plain Mesh data first. */\nfunction normalizeMeshArrowTable(data: Mesh | MeshArrowTable): MeshArrowTable {\n if ('shape' in data && data.shape === 'arrow-table') {\n return data;\n }\n return convertMeshToTable(data as Mesh, 'arrow-table');\n}\n\n/** Return a required mesh attribute or throw a format-specific error. */\nfunction getRequiredAttribute(mesh: Mesh, attributeName: string): MeshAttribute {\n const attribute = mesh.attributes[attributeName];\n if (!attribute) {\n throw new Error(`PLYWriter: ${attributeName} attribute is required`);\n }\n return attribute;\n}\n\n/** Return the ASCII PLY header lines. */\nfunction getPLYHeader(\n vertexCount: number,\n faceCount: number,\n hasNormals: boolean,\n hasTextureCoordinates: boolean,\n hasColors: boolean,\n customScalarAttributes: [string, MeshAttribute][]\n): string[] {\n const header = [\n 'ply',\n 'format ascii 1.0',\n 'comment generated by loaders.gl',\n `element vertex ${vertexCount}`,\n 'property float x',\n 'property float y',\n 'property float z'\n ];\n\n if (hasNormals) {\n header.push('property float nx', 'property float ny', 'property float nz');\n }\n\n if (hasTextureCoordinates) {\n header.push('property float s', 'property float t');\n }\n\n if (hasColors) {\n header.push('property uchar red', 'property uchar green', 'property uchar blue');\n }\n\n for (const [attributeName] of customScalarAttributes) {\n header.push(`property float ${attributeName}`);\n }\n\n if (faceCount > 0) {\n header.push(`element face ${faceCount}`, 'property list uchar int vertex_indices');\n }\n\n header.push('end_header');\n return header;\n}\n\n/** Return additional one-component attributes that can be represented as scalar PLY properties. */\nfunction getCustomScalarAttributes(mesh: Mesh): [string, MeshAttribute][] {\n const reservedAttributeNames = new Set(['POSITION', 'NORMAL', 'TEXCOORD_0', 'COLOR_0']);\n return Object.entries(mesh.attributes).filter(\n ([attributeName, attribute]) =>\n !reservedAttributeNames.has(attributeName) && attribute.size === 1\n );\n}\n\n/** Return a single attribute component with 0 as the missing component fallback. */\nfunction getComponent(\n attribute: MeshAttribute,\n vertexIndex: number,\n componentIndex: number\n): number {\n return attribute.value[vertexIndex * attribute.size + componentIndex] || 0;\n}\n\n/** Return one color component as an unsigned byte. */\nfunction getColorByte(\n attribute: MeshAttribute,\n vertexIndex: number,\n componentIndex: number\n): number {\n const value = getComponent(attribute, vertexIndex, componentIndex);\n const byteValue = attribute.normalized || value <= 1 ? value * 255 : value;\n return Math.max(0, Math.min(255, Math.round(byteValue)));\n}\n\n/** Return triangle indices for indexed or sequential triangle-list meshes. */\nfunction getTriangleIndices(mesh: Mesh, vertexCount: number): number[] {\n if (mesh.indices?.value?.length) {\n return Array.from(mesh.indices.value);\n }\n\n if (mesh.mode !== 4 && mesh.topology !== 'triangle-list') {\n return [];\n }\n\n const triangleIndices: number[] = [];\n for (let vertexIndex = 0; vertexIndex + 2 < vertexCount; vertexIndex += 3) {\n triangleIndices.push(vertexIndex, vertexIndex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AO,QAAQ;AAC/B,WAAO,MAAM,KAAK,KAAK,QAAQ,KAAK;AAAA,EACtC;AAEA,MAAI,KAAK,SAAS,KAAK,KAAK,aAAa,iBAAiB;AACxD,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,kBAA4B,CAAC;AACnC,WAAS,cAAc,GAAG,cAAc,IAAI,aAAa,eAAe,GAAG;AACzE,oBAAgB,KAAK,aAAa,cAAc,GAAG,cAAc,CAAC;AAAA,EACpE;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { WriterOptions } from '@loaders.gl/core/loader-utils';
|
|
2
|
+
import type { Mesh, MeshArrowTable } from '@loaders.gl/core/schema';
|
|
3
|
+
/** Options for `PLYWriter`. */
|
|
4
|
+
export type PLYWriterOptions = WriterOptions & {
|
|
5
|
+
/** Reserved for future PLY writer options. */
|
|
6
|
+
ply?: Record<string, never>;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Writer for the PLY geometry format.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PLYWriter: {
|
|
12
|
+
readonly dataType: Mesh | MeshArrowTable;
|
|
13
|
+
readonly batchType: never;
|
|
14
|
+
readonly version: any;
|
|
15
|
+
readonly options: {
|
|
16
|
+
readonly ply: {};
|
|
17
|
+
};
|
|
18
|
+
readonly text: true;
|
|
19
|
+
readonly encode: (data: Mesh | MeshArrowTable, options: PLYWriterOptions | undefined) => Promise<ArrayBuffer>;
|
|
20
|
+
readonly encodeSync: typeof encodePLYSync;
|
|
21
|
+
readonly encodeTextSync: typeof encodePLY;
|
|
22
|
+
readonly name: "PLY";
|
|
23
|
+
readonly id: "ply";
|
|
24
|
+
readonly module: "pointclouds";
|
|
25
|
+
readonly encoding: "text";
|
|
26
|
+
readonly format: "ply";
|
|
27
|
+
readonly extensions: ["ply"];
|
|
28
|
+
readonly mimeTypes: ["text/plain", "application/octet-stream"];
|
|
29
|
+
readonly binary: true;
|
|
30
|
+
readonly tests: ["ply"];
|
|
31
|
+
};
|
|
32
|
+
/** Encode mesh category data as PLY bytes. */
|
|
33
|
+
declare function encodePLYSync(data: Mesh | MeshArrowTable, options?: PLYWriterOptions): ArrayBuffer;
|
|
34
|
+
/** Encode mesh category data as ASCII PLY text. */
|
|
35
|
+
declare function encodePLY(data: Mesh | MeshArrowTable, options?: PLYWriterOptions): string;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=ply-writer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ply-writer.d.ts","sourceRoot":"","sources":["../../src/ply/ply-writer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,aAAa,EAAoB,MAAM,+BAA+B,CAAC;AACpF,OAAO,KAAK,EAAC,IAAI,EAAE,cAAc,EAAgB,MAAM,yBAAyB,CAAC;AAQjF,+BAA+B;AAC/B,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS;uBAES,IAAI,GAAG,cAAc;wBAC/B,KAAK;;;;;;;;;;;;;;;;;;CAS4D,CAAC;AAEvF,8CAA8C;AAC9C,iBAAS,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,cAAc,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,WAAW,CAG3F;AAED,mDAAmD;AACnD,iBAAS,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,cAAc,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAiElF"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { convertMeshToTable, convertTableToMesh } from '@loaders.gl/core/schema-utils';
|
|
5
|
+
import { PLYFormat } from "./ply-format.js";
|
|
6
|
+
// __VERSION__ is injected by babel-plugin-version-inline
|
|
7
|
+
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
8
|
+
const VERSION = typeof "5.0.0-beta.2" !== 'undefined' ? "5.0.0-beta.2" : 'latest';
|
|
9
|
+
/**
|
|
10
|
+
* Writer for the PLY geometry format.
|
|
11
|
+
*/
|
|
12
|
+
export const PLYWriter = {
|
|
13
|
+
...PLYFormat,
|
|
14
|
+
dataType: null,
|
|
15
|
+
batchType: null,
|
|
16
|
+
version: VERSION,
|
|
17
|
+
options: {
|
|
18
|
+
ply: {}
|
|
19
|
+
},
|
|
20
|
+
text: true,
|
|
21
|
+
encode: async (data, options) => encodePLYSync(data, options),
|
|
22
|
+
encodeSync: encodePLYSync,
|
|
23
|
+
encodeTextSync: encodePLY
|
|
24
|
+
};
|
|
25
|
+
/** Encode mesh category data as PLY bytes. */
|
|
26
|
+
function encodePLYSync(data, options) {
|
|
27
|
+
const text = encodePLY(data, options);
|
|
28
|
+
return new TextEncoder().encode(text).buffer;
|
|
29
|
+
}
|
|
30
|
+
/** Encode mesh category data as ASCII PLY text. */
|
|
31
|
+
function encodePLY(data, options) {
|
|
32
|
+
const mesh = convertTableToMesh(normalizeMeshArrowTable(data));
|
|
33
|
+
const positionAttribute = getRequiredAttribute(mesh, 'POSITION');
|
|
34
|
+
const normalAttribute = mesh.attributes.NORMAL;
|
|
35
|
+
const textureCoordinateAttribute = mesh.attributes.TEXCOORD_0;
|
|
36
|
+
const colorAttribute = mesh.attributes.COLOR_0;
|
|
37
|
+
const customScalarAttributes = getCustomScalarAttributes(mesh);
|
|
38
|
+
const vertexCount = positionAttribute.value.length / positionAttribute.size;
|
|
39
|
+
const triangleIndices = getTriangleIndices(mesh, vertexCount);
|
|
40
|
+
const header = getPLYHeader(vertexCount, triangleIndices.length / 3, Boolean(normalAttribute), Boolean(textureCoordinateAttribute), Boolean(colorAttribute), customScalarAttributes);
|
|
41
|
+
const rows = [];
|
|
42
|
+
for (let vertexIndex = 0; vertexIndex < vertexCount; vertexIndex++) {
|
|
43
|
+
const row = [
|
|
44
|
+
getComponent(positionAttribute, vertexIndex, 0),
|
|
45
|
+
getComponent(positionAttribute, vertexIndex, 1),
|
|
46
|
+
getComponent(positionAttribute, vertexIndex, 2)
|
|
47
|
+
];
|
|
48
|
+
if (normalAttribute) {
|
|
49
|
+
row.push(getComponent(normalAttribute, vertexIndex, 0), getComponent(normalAttribute, vertexIndex, 1), getComponent(normalAttribute, vertexIndex, 2));
|
|
50
|
+
}
|
|
51
|
+
if (textureCoordinateAttribute) {
|
|
52
|
+
row.push(getComponent(textureCoordinateAttribute, vertexIndex, 0), getComponent(textureCoordinateAttribute, vertexIndex, 1));
|
|
53
|
+
}
|
|
54
|
+
if (colorAttribute) {
|
|
55
|
+
row.push(getColorByte(colorAttribute, vertexIndex, 0), getColorByte(colorAttribute, vertexIndex, 1), getColorByte(colorAttribute, vertexIndex, 2));
|
|
56
|
+
}
|
|
57
|
+
for (const [, attribute] of customScalarAttributes) {
|
|
58
|
+
row.push(getComponent(attribute, vertexIndex, 0));
|
|
59
|
+
}
|
|
60
|
+
rows.push(row.join(' '));
|
|
61
|
+
}
|
|
62
|
+
for (let triangleIndex = 0; triangleIndex < triangleIndices.length; triangleIndex += 3) {
|
|
63
|
+
rows.push(`3 ${triangleIndices[triangleIndex]} ${triangleIndices[triangleIndex + 1]} ${triangleIndices[triangleIndex + 2]}`);
|
|
64
|
+
}
|
|
65
|
+
return `${header.concat(rows).join('\n')}\n`;
|
|
66
|
+
}
|
|
67
|
+
/** Return mesh data as a MeshArrowTable, converting plain Mesh data first. */
|
|
68
|
+
function normalizeMeshArrowTable(data) {
|
|
69
|
+
if ('shape' in data && data.shape === 'arrow-table') {
|
|
70
|
+
return data;
|
|
71
|
+
}
|
|
72
|
+
return convertMeshToTable(data, 'arrow-table');
|
|
73
|
+
}
|
|
74
|
+
/** Return a required mesh attribute or throw a format-specific error. */
|
|
75
|
+
function getRequiredAttribute(mesh, attributeName) {
|
|
76
|
+
const attribute = mesh.attributes[attributeName];
|
|
77
|
+
if (!attribute) {
|
|
78
|
+
throw new Error(`PLYWriter: ${attributeName} attribute is required`);
|
|
79
|
+
}
|
|
80
|
+
return attribute;
|
|
81
|
+
}
|
|
82
|
+
/** Return the ASCII PLY header lines. */
|
|
83
|
+
function getPLYHeader(vertexCount, faceCount, hasNormals, hasTextureCoordinates, hasColors, customScalarAttributes) {
|
|
84
|
+
const header = [
|
|
85
|
+
'ply',
|
|
86
|
+
'format ascii 1.0',
|
|
87
|
+
'comment generated by loaders.gl',
|
|
88
|
+
`element vertex ${vertexCount}`,
|
|
89
|
+
'property float x',
|
|
90
|
+
'property float y',
|
|
91
|
+
'property float z'
|
|
92
|
+
];
|
|
93
|
+
if (hasNormals) {
|
|
94
|
+
header.push('property float nx', 'property float ny', 'property float nz');
|
|
95
|
+
}
|
|
96
|
+
if (hasTextureCoordinates) {
|
|
97
|
+
header.push('property float s', 'property float t');
|
|
98
|
+
}
|
|
99
|
+
if (hasColors) {
|
|
100
|
+
header.push('property uchar red', 'property uchar green', 'property uchar blue');
|
|
101
|
+
}
|
|
102
|
+
for (const [attributeName] of customScalarAttributes) {
|
|
103
|
+
header.push(`property float ${attributeName}`);
|
|
104
|
+
}
|
|
105
|
+
if (faceCount > 0) {
|
|
106
|
+
header.push(`element face ${faceCount}`, 'property list uchar int vertex_indices');
|
|
107
|
+
}
|
|
108
|
+
header.push('end_header');
|
|
109
|
+
return header;
|
|
110
|
+
}
|
|
111
|
+
/** Return additional one-component attributes that can be represented as scalar PLY properties. */
|
|
112
|
+
function getCustomScalarAttributes(mesh) {
|
|
113
|
+
const reservedAttributeNames = new Set(['POSITION', 'NORMAL', 'TEXCOORD_0', 'COLOR_0']);
|
|
114
|
+
return Object.entries(mesh.attributes).filter(([attributeName, attribute]) => !reservedAttributeNames.has(attributeName) && attribute.size === 1);
|
|
115
|
+
}
|
|
116
|
+
/** Return a single attribute component with 0 as the missing component fallback. */
|
|
117
|
+
function getComponent(attribute, vertexIndex, componentIndex) {
|
|
118
|
+
return attribute.value[vertexIndex * attribute.size + componentIndex] || 0;
|
|
119
|
+
}
|
|
120
|
+
/** Return one color component as an unsigned byte. */
|
|
121
|
+
function getColorByte(attribute, vertexIndex, componentIndex) {
|
|
122
|
+
const value = getComponent(attribute, vertexIndex, componentIndex);
|
|
123
|
+
const byteValue = attribute.normalized || value <= 1 ? value * 255 : value;
|
|
124
|
+
return Math.max(0, Math.min(255, Math.round(byteValue)));
|
|
125
|
+
}
|
|
126
|
+
/** Return triangle indices for indexed or sequential triangle-list meshes. */
|
|
127
|
+
function getTriangleIndices(mesh, vertexCount) {
|
|
128
|
+
if (mesh.indices?.value?.length) {
|
|
129
|
+
return Array.from(mesh.indices.value);
|
|
130
|
+
}
|
|
131
|
+
if (mesh.mode !== 4 && mesh.topology !== 'triangle-list') {
|
|
132
|
+
return [];
|
|
133
|
+
}
|
|
134
|
+
const triangleIndices = [];
|
|
135
|
+
for (let vertexIndex = 0; vertexIndex + 2 < vertexCount; vertexIndex += 3) {
|
|
136
|
+
triangleIndices.push(vertexIndex, vertexIndex + 1, vertexIndex + 2);
|
|
137
|
+
}
|
|
138
|
+
return triangleIndices;
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=ply-writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ply-writer.js","sourceRoot":"","sources":["../../src/ply/ply-writer.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAIpC,OAAO,EAAC,kBAAkB,EAAE,kBAAkB,EAAC,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAC,SAAS,EAAC,wBAAqB;AAEvC,yDAAyD;AACzD,qDAAqD;AACrD,MAAM,OAAO,GAAG,qBAAkB,KAAK,WAAW,CAAC,CAAC,gBAAa,CAAC,CAAC,QAAQ,CAAC;AAQ5E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ACzB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/ply/unbundled.ts
|
|
21
|
+
var unbundled_exports = {};
|
|
22
|
+
__export(unbundled_exports, {
|
|
23
|
+
PLYLoader: () => import_ply_loader_types.PLYLoader,
|
|
24
|
+
PLYWorkerLoader: () => import_ply_loader_types.PLYWorkerLoader
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(unbundled_exports);
|
|
27
|
+
var import_ply_loader_types = require("./ply-loader-types.cjs");
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
PLYLoader,
|
|
31
|
+
PLYWorkerLoader
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=unbundled.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ply/unbundled.ts"],
|
|
4
|
+
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport type {PLYLoaderOptions} from './ply-loader-types';\nexport {PLYWorkerLoader, PLYLoader} from './ply-loader-types';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,8BAAyC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|