@loaders.gl/pointclouds 5.0.0-beta.1 → 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/README.md +4 -0
- package/dist/dist.dev.js +39 -15
- package/dist/dist.min.js +19 -19
- 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.js +1 -1
- package/dist/las/las-copc-loader-types.js.map +1 -1
- package/dist/las/las-loader-shared.cjs +1 -1
- package/dist/las/las-loader-shared.js +1 -1
- package/dist/las/las-loader-types.cjs +1 -1
- package/dist/las/las-loader-types.cjs.map +2 -2
- package/dist/las/las-loader-types.js +1 -1
- package/dist/las/las-loader-types.js.map +1 -1
- package/dist/las/las-writer.cjs +1 -1
- package/dist/las/las-writer.js +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.js +1 -1
- package/dist/las/laz-rs-loader-types.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.js +1 -1
- package/dist/las/lazperf-loader-types.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 +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 +170 -59
- 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/pcd-loader-types.cjs +2 -2
- package/dist/pcd/pcd-loader-types.cjs.map +2 -2
- package/dist/pcd/pcd-loader-types.js +2 -2
- package/dist/pcd/pcd-loader-types.js.map +1 -1
- package/dist/pcd/pcd-writer.cjs +1 -1
- package/dist/pcd/pcd-writer.js +1 -1
- 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 +204 -71
- 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/ply-loader-types.cjs +2 -2
- package/dist/ply/ply-loader-types.cjs.map +2 -2
- package/dist/ply/ply-loader-types.js +2 -2
- package/dist/ply/ply-loader-types.js.map +1 -1
- package/dist/ply/ply-writer.cjs +1 -1
- package/dist/ply/ply-writer.js +1 -1
- 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 +204 -71
- 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 +73 -70
- package/src/las/las-copc-loader-types.ts +1 -1
- package/src/las/las-loader-types.ts +1 -1
- package/src/las/laz-rs-loader-types.ts +1 -1
- package/src/las/lazperf-loader-types.ts +1 -1
- 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-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/pcd-loader-types.ts +1 -1
- 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/ply-loader-types.ts +1 -1
- package/src/ply-loader-types.ts +1 -0
- package/src/ply-loader.ts +1 -0
- package/src/ply-writer.ts +1 -0
package/dist/pcd-worker.js
CHANGED
|
@@ -15,29 +15,41 @@
|
|
|
15
15
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
//
|
|
18
|
+
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/node/worker_threads-browser.js
|
|
19
19
|
var parentPort;
|
|
20
20
|
var init_worker_threads_browser = __esm({
|
|
21
|
-
"
|
|
22
|
-
"use strict";
|
|
21
|
+
"../../node_modules/@math.gl/core/dist/worker-utils/lib/node/worker_threads-browser.js"() {
|
|
23
22
|
parentPort = null;
|
|
24
23
|
}
|
|
25
24
|
});
|
|
26
25
|
|
|
27
|
-
//
|
|
26
|
+
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-utils/get-transfer-list.js
|
|
28
27
|
function getTransferList(object, recursive = true, transfers) {
|
|
29
28
|
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
const seen = /* @__PURE__ */ new Set();
|
|
30
|
+
function visit(value) {
|
|
31
|
+
if (!value || typeof value !== "object" || seen.has(value))
|
|
32
|
+
return;
|
|
33
|
+
seen.add(value);
|
|
34
|
+
if (isTransferable(value))
|
|
35
|
+
transfersSet.add(value);
|
|
36
|
+
else if (ArrayBuffer.isView(value)) {
|
|
37
|
+
if (isTransferable(value.buffer))
|
|
38
|
+
transfersSet.add(value.buffer);
|
|
39
|
+
} else if (recursive && value instanceof Map) {
|
|
40
|
+
for (const [key, item] of value) {
|
|
41
|
+
visit(key);
|
|
42
|
+
visit(item);
|
|
43
|
+
}
|
|
44
|
+
} else if (recursive && value instanceof Set) {
|
|
45
|
+
for (const item of value)
|
|
46
|
+
visit(item);
|
|
47
|
+
} else if (recursive) {
|
|
48
|
+
for (const key of Object.keys(value))
|
|
49
|
+
visit(value[key]);
|
|
39
50
|
}
|
|
40
51
|
}
|
|
52
|
+
visit(object);
|
|
41
53
|
return transfers === void 0 ? Array.from(transfersSet) : [];
|
|
42
54
|
}
|
|
43
55
|
function isTransferable(object) {
|
|
@@ -59,12 +71,11 @@
|
|
|
59
71
|
return false;
|
|
60
72
|
}
|
|
61
73
|
var init_get_transfer_list = __esm({
|
|
62
|
-
"
|
|
63
|
-
"use strict";
|
|
74
|
+
"../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
|
|
64
75
|
}
|
|
65
76
|
});
|
|
66
77
|
|
|
67
|
-
//
|
|
78
|
+
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-farm/worker-body.js
|
|
68
79
|
async function getParentPort() {
|
|
69
80
|
return parentPort;
|
|
70
81
|
}
|
|
@@ -77,15 +88,15 @@
|
|
|
77
88
|
}
|
|
78
89
|
var onMessageWrapperMap, WorkerBody;
|
|
79
90
|
var init_worker_body = __esm({
|
|
80
|
-
"
|
|
81
|
-
"use strict";
|
|
91
|
+
"../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-farm/worker-body.js"() {
|
|
82
92
|
init_get_transfer_list();
|
|
83
93
|
init_worker_threads_browser();
|
|
84
94
|
onMessageWrapperMap = /* @__PURE__ */ new Map();
|
|
85
95
|
WorkerBody = class {
|
|
86
96
|
/** Check that we are actually in a worker thread */
|
|
87
97
|
static async inWorkerThread() {
|
|
88
|
-
|
|
98
|
+
const workerGlobalScope = globalThis.WorkerGlobalScope;
|
|
99
|
+
return typeof workerGlobalScope === "function" && globalThis instanceof workerGlobalScope || Boolean(await getParentPort());
|
|
89
100
|
}
|
|
90
101
|
/*
|
|
91
102
|
* (type: WorkerMessageType, payload: WorkerMessagePayload) => any
|
|
@@ -158,15 +169,11 @@
|
|
|
158
169
|
}
|
|
159
170
|
});
|
|
160
171
|
|
|
161
|
-
//
|
|
172
|
+
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/async-queue/async-queue.js
|
|
162
173
|
var AsyncQueue;
|
|
163
174
|
var init_async_queue = __esm({
|
|
164
|
-
"
|
|
165
|
-
"use strict";
|
|
175
|
+
"../../node_modules/@math.gl/core/dist/worker-utils/lib/async-queue/async-queue.js"() {
|
|
166
176
|
AsyncQueue = class {
|
|
167
|
-
_values;
|
|
168
|
-
_settlers;
|
|
169
|
-
_closed;
|
|
170
177
|
constructor() {
|
|
171
178
|
this._values = [];
|
|
172
179
|
this._settlers = [];
|
|
@@ -234,7 +241,51 @@
|
|
|
234
241
|
}
|
|
235
242
|
});
|
|
236
243
|
|
|
237
|
-
//
|
|
244
|
+
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/shared-state.js
|
|
245
|
+
var SharedWorkerState;
|
|
246
|
+
var init_shared_state = __esm({
|
|
247
|
+
"../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/shared-state.js"() {
|
|
248
|
+
SharedWorkerState = class {
|
|
249
|
+
constructor(buffer) {
|
|
250
|
+
if (typeof SharedArrayBuffer === "undefined" || !(buffer instanceof SharedArrayBuffer) || buffer.byteLength !== 16)
|
|
251
|
+
throw new Error("Expected a 16-byte shared worker control buffer");
|
|
252
|
+
this.buffer = buffer;
|
|
253
|
+
this.values = new Int32Array(buffer);
|
|
254
|
+
}
|
|
255
|
+
get snapshot() {
|
|
256
|
+
return {
|
|
257
|
+
cancelled: Atomics.load(this.values, 0) !== 0,
|
|
258
|
+
completed: Atomics.load(this.values, 1),
|
|
259
|
+
total: Atomics.load(this.values, 2),
|
|
260
|
+
revision: Atomics.load(this.values, 3)
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
cancel() {
|
|
264
|
+
Atomics.store(this.values, 0, 1);
|
|
265
|
+
Atomics.add(this.values, 3, 1);
|
|
266
|
+
Atomics.notify(this.values, 0);
|
|
267
|
+
}
|
|
268
|
+
throwIfCancelled() {
|
|
269
|
+
if (Atomics.load(this.values, 0) !== 0) {
|
|
270
|
+
const error = new Error("Shared worker task was cancelled");
|
|
271
|
+
error.name = "AbortError";
|
|
272
|
+
throw error;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/** Integer counters for application-defined work; messages still carry phase names and units. */
|
|
276
|
+
setProgress(completed, total = -1) {
|
|
277
|
+
if (!Number.isInteger(completed) || completed < 0 || completed > 2147483647 || !Number.isInteger(total) || total < -1 || total > 2147483647) {
|
|
278
|
+
throw new RangeError("Shared progress requires nonnegative int32 counts (or total -1)");
|
|
279
|
+
}
|
|
280
|
+
Atomics.store(this.values, 1, completed);
|
|
281
|
+
Atomics.store(this.values, 2, total);
|
|
282
|
+
Atomics.add(this.values, 3, 1);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/create-worker.js
|
|
238
289
|
async function createWorker(process, processInBatches) {
|
|
239
290
|
if (!await WorkerBody.inWorkerThread()) {
|
|
240
291
|
return;
|
|
@@ -243,27 +294,56 @@
|
|
|
243
294
|
process: processOnMainThread
|
|
244
295
|
};
|
|
245
296
|
WorkerBody.onmessage = async (type, payload) => {
|
|
297
|
+
if (type === "cancel") {
|
|
298
|
+
activeController?.abort();
|
|
299
|
+
activeInputBatches?.close();
|
|
300
|
+
activeOutputAcknowledgements?.close();
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
const controller = type === "process" || type === "process-in-batches" ? new AbortController() : void 0;
|
|
304
|
+
if (controller)
|
|
305
|
+
activeController = controller;
|
|
306
|
+
const startedAt = performance.now();
|
|
246
307
|
const reporter = type === "process" || type === "process-in-batches" ? createProgressReporter() : void 0;
|
|
247
|
-
|
|
308
|
+
let sharedState;
|
|
309
|
+
const throwIfAborted = () => {
|
|
310
|
+
controller?.signal.throwIfAborted();
|
|
311
|
+
sharedState?.throwIfCancelled();
|
|
312
|
+
};
|
|
313
|
+
const jobContext = {
|
|
314
|
+
...context,
|
|
315
|
+
signal: controller?.signal,
|
|
316
|
+
sharedState,
|
|
317
|
+
throwIfAborted,
|
|
318
|
+
reportProgress: (progress) => {
|
|
319
|
+
if (!controller?.signal.aborted && !sharedState?.snapshot.cancelled)
|
|
320
|
+
reporter?.report(progress);
|
|
321
|
+
}
|
|
322
|
+
};
|
|
248
323
|
try {
|
|
324
|
+
if (controller && payload.options?.["sharedState"]) {
|
|
325
|
+
sharedState = new SharedWorkerState(payload.options["sharedState"]);
|
|
326
|
+
jobContext.sharedState = sharedState;
|
|
327
|
+
}
|
|
249
328
|
switch (type) {
|
|
250
329
|
case "preload":
|
|
251
330
|
WorkerBody.postMessage("done", {});
|
|
252
331
|
break;
|
|
253
332
|
case "process":
|
|
333
|
+
throwIfAborted();
|
|
254
334
|
if (!process) {
|
|
255
335
|
throw new Error("Worker does not support atomic processing");
|
|
256
336
|
}
|
|
257
|
-
const result = await process(
|
|
258
|
-
|
|
259
|
-
payload.options || {},
|
|
260
|
-
jobContext,
|
|
261
|
-
payload.context || {}
|
|
262
|
-
);
|
|
337
|
+
const result = await process(payload.input, payload.options || {}, jobContext, payload.context || {});
|
|
338
|
+
throwIfAborted();
|
|
263
339
|
reporter?.finish();
|
|
264
|
-
WorkerBody.postMessage("done", {
|
|
340
|
+
await WorkerBody.postMessage("done", {
|
|
341
|
+
result,
|
|
342
|
+
executionMs: performance.now() - startedAt
|
|
343
|
+
});
|
|
265
344
|
break;
|
|
266
345
|
case "process-in-batches":
|
|
346
|
+
throwIfAborted();
|
|
267
347
|
if (!processInBatches) {
|
|
268
348
|
throw new Error("Worker does not support batched processing");
|
|
269
349
|
}
|
|
@@ -272,18 +352,15 @@
|
|
|
272
352
|
activeInputBatches = inputBatches;
|
|
273
353
|
activeOutputAcknowledgements = outputAcknowledgements;
|
|
274
354
|
try {
|
|
275
|
-
const resultIterator = processInBatches(
|
|
276
|
-
createDemandDrivenIterator(inputBatches),
|
|
277
|
-
payload.options || {},
|
|
278
|
-
jobContext,
|
|
279
|
-
payload.context || {}
|
|
280
|
-
);
|
|
355
|
+
const resultIterator = processInBatches(createDemandDrivenIterator(inputBatches), payload.options || {}, jobContext, payload.context || {});
|
|
281
356
|
for await (const batch of resultIterator) {
|
|
357
|
+
throwIfAborted();
|
|
282
358
|
await WorkerBody.postMessage("output-batch", { result: batch });
|
|
283
359
|
await outputAcknowledgements.next();
|
|
284
360
|
}
|
|
361
|
+
throwIfAborted();
|
|
285
362
|
reporter?.finish();
|
|
286
|
-
await WorkerBody.postMessage("done", {});
|
|
363
|
+
await WorkerBody.postMessage("done", { executionMs: performance.now() - startedAt });
|
|
287
364
|
} finally {
|
|
288
365
|
activeInputBatches = null;
|
|
289
366
|
activeOutputAcknowledgements = null;
|
|
@@ -310,11 +387,18 @@
|
|
|
310
387
|
default:
|
|
311
388
|
}
|
|
312
389
|
} catch (error) {
|
|
313
|
-
reporter?.finish();
|
|
390
|
+
reporter?.finish(controller?.signal.aborted || sharedState?.snapshot.cancelled);
|
|
314
391
|
const message = error instanceof Error ? error.message : "";
|
|
315
|
-
WorkerBody.postMessage("error", {
|
|
392
|
+
await WorkerBody.postMessage("error", {
|
|
393
|
+
error: message,
|
|
394
|
+
errorName: error instanceof Error ? error.name : "Error"
|
|
395
|
+
});
|
|
396
|
+
} finally {
|
|
397
|
+
if (controller && activeController === controller)
|
|
398
|
+
activeController = null;
|
|
316
399
|
}
|
|
317
400
|
};
|
|
401
|
+
await WorkerBody.postMessage("ready", {});
|
|
318
402
|
}
|
|
319
403
|
async function* createDemandDrivenIterator(inputBatches) {
|
|
320
404
|
while (true) {
|
|
@@ -327,27 +411,45 @@
|
|
|
327
411
|
}
|
|
328
412
|
}
|
|
329
413
|
function processOnMainThread(arrayBuffer, options = {}, jobContext = {}) {
|
|
414
|
+
const signal = activeController?.signal;
|
|
415
|
+
signal?.throwIfAborted();
|
|
330
416
|
return new Promise((resolve, reject) => {
|
|
331
417
|
const id = requestId++;
|
|
332
|
-
const
|
|
333
|
-
|
|
418
|
+
const cleanup = () => {
|
|
419
|
+
signal?.removeEventListener("abort", abort);
|
|
420
|
+
void WorkerBody.removeEventListener(onMessage);
|
|
421
|
+
};
|
|
422
|
+
const abort = () => {
|
|
423
|
+
cleanup();
|
|
424
|
+
reject(signal?.reason);
|
|
425
|
+
};
|
|
426
|
+
const onMessage = (type, payload) => {
|
|
427
|
+
if (payload.id !== id)
|
|
334
428
|
return;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
case "error":
|
|
342
|
-
WorkerBody.removeEventListener(onMessage);
|
|
343
|
-
reject(payload2.error);
|
|
344
|
-
break;
|
|
345
|
-
default:
|
|
429
|
+
if (type === "done") {
|
|
430
|
+
cleanup();
|
|
431
|
+
resolve(payload.result);
|
|
432
|
+
} else if (type === "error") {
|
|
433
|
+
cleanup();
|
|
434
|
+
reject(payload.error);
|
|
346
435
|
}
|
|
347
436
|
};
|
|
348
|
-
WorkerBody.addEventListener(onMessage)
|
|
349
|
-
|
|
350
|
-
|
|
437
|
+
void WorkerBody.addEventListener(onMessage).then(async () => {
|
|
438
|
+
if (signal?.aborted) {
|
|
439
|
+
abort();
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
443
|
+
await WorkerBody.postMessage("process", {
|
|
444
|
+
id,
|
|
445
|
+
input: arrayBuffer,
|
|
446
|
+
options,
|
|
447
|
+
context: jobContext
|
|
448
|
+
});
|
|
449
|
+
}).catch((error) => {
|
|
450
|
+
cleanup();
|
|
451
|
+
reject(error);
|
|
452
|
+
});
|
|
351
453
|
});
|
|
352
454
|
}
|
|
353
455
|
function createProgressReporter() {
|
|
@@ -364,8 +466,10 @@
|
|
|
364
466
|
return {
|
|
365
467
|
/** Records progress while retaining phase transitions. */
|
|
366
468
|
report(progress) {
|
|
367
|
-
if (finished)
|
|
368
|
-
|
|
469
|
+
if (finished)
|
|
470
|
+
return;
|
|
471
|
+
if (pending && pending.phase !== progress.phase)
|
|
472
|
+
flush();
|
|
369
473
|
pending = { ...progress };
|
|
370
474
|
if (!scheduled) {
|
|
371
475
|
scheduled = true;
|
|
@@ -373,29 +477,58 @@
|
|
|
373
477
|
}
|
|
374
478
|
},
|
|
375
479
|
/** Flushes final progress and suppresses reports from stale callbacks. */
|
|
376
|
-
finish() {
|
|
480
|
+
finish(discard = false) {
|
|
481
|
+
if (discard)
|
|
482
|
+
pending = void 0;
|
|
377
483
|
flush();
|
|
378
484
|
finished = true;
|
|
379
485
|
}
|
|
380
486
|
};
|
|
381
487
|
}
|
|
382
|
-
var requestId, activeInputBatches, activeOutputAcknowledgements;
|
|
488
|
+
var requestId, activeController, activeInputBatches, activeOutputAcknowledgements;
|
|
383
489
|
var init_create_worker = __esm({
|
|
384
|
-
"
|
|
385
|
-
|
|
490
|
+
"../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/create-worker.js"() {
|
|
491
|
+
init_shared_state();
|
|
386
492
|
init_async_queue();
|
|
387
493
|
init_worker_body();
|
|
388
494
|
requestId = 0;
|
|
495
|
+
activeController = null;
|
|
389
496
|
activeInputBatches = null;
|
|
390
497
|
activeOutputAcknowledgements = null;
|
|
391
498
|
}
|
|
392
499
|
});
|
|
393
500
|
|
|
394
|
-
//
|
|
501
|
+
// ../../node_modules/@math.gl/core/dist/worker-utils/index.js
|
|
502
|
+
var import_meta, path, moduleUrl;
|
|
395
503
|
var init_worker_utils = __esm({
|
|
504
|
+
"../../node_modules/@math.gl/core/dist/worker-utils/index.js"() {
|
|
505
|
+
init_create_worker();
|
|
506
|
+
import_meta = {};
|
|
507
|
+
path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
|
|
508
|
+
moduleUrl = path ? `file://${path.startsWith("/") ? "" : "/"}${encodeURI(path).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta.url;
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
// ../../node_modules/@math.gl/core/dist/tasks/index.js
|
|
513
|
+
var init_tasks = __esm({
|
|
514
|
+
"../../node_modules/@math.gl/core/dist/tasks/index.js"() {
|
|
515
|
+
init_worker_utils();
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
// ../core/src/worker-utils/lib/worker-api/create-worker.ts
|
|
520
|
+
var init_create_worker2 = __esm({
|
|
521
|
+
"../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
|
|
522
|
+
"use strict";
|
|
523
|
+
init_tasks();
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
// ../core/src/worker-utils/index.ts
|
|
528
|
+
var init_worker_utils2 = __esm({
|
|
396
529
|
"../core/src/worker-utils/index.ts"() {
|
|
397
530
|
"use strict";
|
|
398
|
-
|
|
531
|
+
init_create_worker2();
|
|
399
532
|
}
|
|
400
533
|
});
|
|
401
534
|
|
|
@@ -539,7 +672,7 @@
|
|
|
539
672
|
var init_create_loader_worker = __esm({
|
|
540
673
|
"../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts"() {
|
|
541
674
|
"use strict";
|
|
542
|
-
|
|
675
|
+
init_worker_utils2();
|
|
543
676
|
}
|
|
544
677
|
});
|
|
545
678
|
|
|
@@ -13413,8 +13546,8 @@ return true;`);
|
|
|
13413
13546
|
});
|
|
13414
13547
|
|
|
13415
13548
|
// ../../node_modules/apache-arrow/ipc/reader.mjs
|
|
13416
|
-
function shouldAutoDestroy(
|
|
13417
|
-
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] :
|
|
13549
|
+
function shouldAutoDestroy(self, options) {
|
|
13550
|
+
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] : self["autoDestroy"];
|
|
13418
13551
|
}
|
|
13419
13552
|
function* readAllSync(source) {
|
|
13420
13553
|
const reader = RecordBatchReader.from(source);
|
|
@@ -17348,7 +17481,7 @@ return true;`);
|
|
|
17348
17481
|
"use strict";
|
|
17349
17482
|
init_pcd_format();
|
|
17350
17483
|
init_arrow_transport();
|
|
17351
|
-
VERSION = true ? "5.0.0-beta.
|
|
17484
|
+
VERSION = true ? "5.0.0-beta.2" : "latest";
|
|
17352
17485
|
PCDLoader = {
|
|
17353
17486
|
...PCDFormat,
|
|
17354
17487
|
dataType: null,
|
|
@@ -0,0 +1,136 @@
|
|
|
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/pcd-writer.ts
|
|
21
|
+
var pcd_writer_exports = {};
|
|
22
|
+
__export(pcd_writer_exports, {
|
|
23
|
+
PCDWriter: () => PCDWriter
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(pcd_writer_exports);
|
|
26
|
+
|
|
27
|
+
// src/pcd/pcd-writer.ts
|
|
28
|
+
var import_schema_utils = require("@loaders.gl/core/schema-utils");
|
|
29
|
+
var import_pcd_format = require("./pcd-format.cjs");
|
|
30
|
+
var VERSION = true ? "5.0.0-beta.2" : "latest";
|
|
31
|
+
var PCDWriter = {
|
|
32
|
+
...import_pcd_format.PCDFormat,
|
|
33
|
+
dataType: null,
|
|
34
|
+
batchType: null,
|
|
35
|
+
version: VERSION,
|
|
36
|
+
options: {
|
|
37
|
+
pcd: {}
|
|
38
|
+
},
|
|
39
|
+
text: true,
|
|
40
|
+
encode: async (data, options) => encodePCDSync(data, options),
|
|
41
|
+
encodeSync: encodePCDSync,
|
|
42
|
+
encodeTextSync: encodePCD
|
|
43
|
+
};
|
|
44
|
+
function encodePCDSync(data, options) {
|
|
45
|
+
const text = encodePCD(data, options);
|
|
46
|
+
return new TextEncoder().encode(text).buffer;
|
|
47
|
+
}
|
|
48
|
+
function encodePCD(data, options) {
|
|
49
|
+
const mesh = (0, import_schema_utils.convertTableToMesh)(normalizeMeshArrowTable(data));
|
|
50
|
+
const positionAttribute = getRequiredAttribute(mesh, "POSITION");
|
|
51
|
+
const normalAttribute = mesh.attributes.NORMAL;
|
|
52
|
+
const colorAttribute = mesh.attributes.COLOR_0;
|
|
53
|
+
const vertexCount = positionAttribute.value.length / positionAttribute.size;
|
|
54
|
+
const fieldNames = ["x", "y", "z"];
|
|
55
|
+
const fieldSizes = ["4", "4", "4"];
|
|
56
|
+
const fieldTypes = ["F", "F", "F"];
|
|
57
|
+
const fieldCounts = ["1", "1", "1"];
|
|
58
|
+
if (normalAttribute) {
|
|
59
|
+
fieldNames.push("normal_x", "normal_y", "normal_z");
|
|
60
|
+
fieldSizes.push("4", "4", "4");
|
|
61
|
+
fieldTypes.push("F", "F", "F");
|
|
62
|
+
fieldCounts.push("1", "1", "1");
|
|
63
|
+
}
|
|
64
|
+
if (colorAttribute) {
|
|
65
|
+
fieldNames.push("rgb");
|
|
66
|
+
fieldSizes.push("4");
|
|
67
|
+
fieldTypes.push("F");
|
|
68
|
+
fieldCounts.push("1");
|
|
69
|
+
}
|
|
70
|
+
const lines = [
|
|
71
|
+
"# .PCD v0.7 - Point Cloud Data file generated by loaders.gl",
|
|
72
|
+
"VERSION 0.7",
|
|
73
|
+
`FIELDS ${fieldNames.join(" ")}`,
|
|
74
|
+
`SIZE ${fieldSizes.join(" ")}`,
|
|
75
|
+
`TYPE ${fieldTypes.join(" ")}`,
|
|
76
|
+
`COUNT ${fieldCounts.join(" ")}`,
|
|
77
|
+
`WIDTH ${vertexCount}`,
|
|
78
|
+
"HEIGHT 1",
|
|
79
|
+
"VIEWPOINT 0 0 0 1 0 0 0",
|
|
80
|
+
`POINTS ${vertexCount}`,
|
|
81
|
+
"DATA ascii"
|
|
82
|
+
];
|
|
83
|
+
for (let vertexIndex = 0; vertexIndex < vertexCount; vertexIndex++) {
|
|
84
|
+
const row = [
|
|
85
|
+
getComponent(positionAttribute, vertexIndex, 0),
|
|
86
|
+
getComponent(positionAttribute, vertexIndex, 1),
|
|
87
|
+
getComponent(positionAttribute, vertexIndex, 2)
|
|
88
|
+
];
|
|
89
|
+
if (normalAttribute) {
|
|
90
|
+
row.push(
|
|
91
|
+
getComponent(normalAttribute, vertexIndex, 0),
|
|
92
|
+
getComponent(normalAttribute, vertexIndex, 1),
|
|
93
|
+
getComponent(normalAttribute, vertexIndex, 2)
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
if (colorAttribute) {
|
|
97
|
+
row.push(getPackedRGB(colorAttribute, vertexIndex));
|
|
98
|
+
}
|
|
99
|
+
lines.push(row.join(" "));
|
|
100
|
+
}
|
|
101
|
+
return `${lines.join("\n")}
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
function normalizeMeshArrowTable(data) {
|
|
105
|
+
if ("shape" in data && data.shape === "arrow-table") {
|
|
106
|
+
return data;
|
|
107
|
+
}
|
|
108
|
+
return (0, import_schema_utils.convertMeshToTable)(data, "arrow-table");
|
|
109
|
+
}
|
|
110
|
+
function getRequiredAttribute(mesh, attributeName) {
|
|
111
|
+
const attribute = mesh.attributes[attributeName];
|
|
112
|
+
if (!attribute) {
|
|
113
|
+
throw new Error(`PCDWriter: ${attributeName} attribute is required`);
|
|
114
|
+
}
|
|
115
|
+
return attribute;
|
|
116
|
+
}
|
|
117
|
+
function getComponent(attribute, vertexIndex, componentIndex) {
|
|
118
|
+
return attribute.value[vertexIndex * attribute.size + componentIndex] || 0;
|
|
119
|
+
}
|
|
120
|
+
function getPackedRGB(attribute, vertexIndex) {
|
|
121
|
+
const bytes = new Uint8Array(4);
|
|
122
|
+
bytes[0] = getColorByte(attribute, vertexIndex, 0);
|
|
123
|
+
bytes[1] = getColorByte(attribute, vertexIndex, 1);
|
|
124
|
+
bytes[2] = getColorByte(attribute, vertexIndex, 2);
|
|
125
|
+
return new DataView(bytes.buffer).getFloat32(0, true);
|
|
126
|
+
}
|
|
127
|
+
function getColorByte(attribute, vertexIndex, componentIndex) {
|
|
128
|
+
const value = getComponent(attribute, vertexIndex, componentIndex);
|
|
129
|
+
const byteValue = attribute.normalized || value <= 1 ? value * 255 : value;
|
|
130
|
+
return Math.max(0, Math.min(255, Math.round(byteValue)));
|
|
131
|
+
}
|
|
132
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
133
|
+
0 && (module.exports = {
|
|
134
|
+
PCDWriter
|
|
135
|
+
});
|
|
136
|
+
//# sourceMappingURL=pcd-writer.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/pcd-writer.ts", "../src/pcd/pcd-writer.ts"],
|
|
4
|
+
"sourcesContent": ["export * from './pcd/pcd-writer.js';\n", "// 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 {PCDFormat} from './pcd-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 `PCDWriter`. */\nexport type PCDWriterOptions = WriterOptions & {\n /** Reserved for future PCD writer options. */\n pcd?: Record<string, never>;\n};\n\n/**\n * Writer for the PCD point cloud format.\n */\nexport const PCDWriter = {\n ...PCDFormat,\n dataType: null as unknown as Mesh | MeshArrowTable,\n batchType: null as never,\n version: VERSION,\n options: {\n pcd: {}\n },\n text: true,\n encode: async (data, options) => encodePCDSync(data, options),\n encodeSync: encodePCDSync,\n encodeTextSync: encodePCD\n} as const satisfies WriterWithEncoder<Mesh | MeshArrowTable, never, PCDWriterOptions>;\n\n/** Encode mesh category data as PCD bytes. */\nfunction encodePCDSync(data: Mesh | MeshArrowTable, options?: PCDWriterOptions): ArrayBuffer {\n const text = encodePCD(data, options);\n return new TextEncoder().encode(text).buffer;\n}\n\n/** Encode mesh category data as ASCII PCD text. */\nfunction encodePCD(data: Mesh | MeshArrowTable, options?: PCDWriterOptions): string {\n const mesh = convertTableToMesh(normalizeMeshArrowTable(data));\n const positionAttribute = getRequiredAttribute(mesh, 'POSITION');\n const normalAttribute = mesh.attributes.NORMAL;\n const colorAttribute = mesh.attributes.COLOR_0;\n const vertexCount = positionAttribute.value.length / positionAttribute.size;\n const fieldNames = ['x', 'y', 'z'];\n const fieldSizes = ['4', '4', '4'];\n const fieldTypes = ['F', 'F', 'F'];\n const fieldCounts = ['1', '1', '1'];\n\n if (normalAttribute) {\n fieldNames.push('normal_x', 'normal_y', 'normal_z');\n fieldSizes.push('4', '4', '4');\n fieldTypes.push('F', 'F', 'F');\n fieldCounts.push('1', '1', '1');\n }\n\n if (colorAttribute) {\n fieldNames.push('rgb');\n fieldSizes.push('4');\n fieldTypes.push('F');\n fieldCounts.push('1');\n }\n\n const lines = [\n '# .PCD v0.7 - Point Cloud Data file generated by loaders.gl',\n 'VERSION 0.7',\n `FIELDS ${fieldNames.join(' ')}`,\n `SIZE ${fieldSizes.join(' ')}`,\n `TYPE ${fieldTypes.join(' ')}`,\n `COUNT ${fieldCounts.join(' ')}`,\n `WIDTH ${vertexCount}`,\n 'HEIGHT 1',\n 'VIEWPOINT 0 0 0 1 0 0 0',\n `POINTS ${vertexCount}`,\n 'DATA ascii'\n ];\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 (colorAttribute) {\n row.push(getPackedRGB(colorAttribute, vertexIndex));\n }\n\n lines.push(row.join(' '));\n }\n\n return `${lines.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(`PCDWriter: ${attributeName} attribute is required`);\n }\n return attribute;\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 an RGB value packed into the PCD float convention. */\nfunction getPackedRGB(attribute: MeshAttribute, vertexIndex: number): number {\n const bytes = new Uint8Array(4);\n bytes[0] = getColorByte(attribute, vertexIndex, 0);\n bytes[1] = getColorByte(attribute, vertexIndex, 1);\n bytes[2] = getColorByte(attribute, vertexIndex, 2);\n return new DataView(bytes.buffer).getFloat32(0, true);\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"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pcd-writer.d.ts","sourceRoot":"","sources":["../src/pcd-writer.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pcd-writer.js","sourceRoot":"","sources":["../src/pcd-writer.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
|
@@ -36,9 +36,9 @@ __export(ply_loader_types_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(ply_loader_types_exports);
|
|
37
37
|
var import_ply_format = require("./ply-format.cjs");
|
|
38
38
|
var import_arrow_transport = require("@loaders.gl/core/schema-utils/arrow-transport");
|
|
39
|
-
var VERSION = true ? "5.0.0-beta.
|
|
39
|
+
var VERSION = true ? "5.0.0-beta.2" : "latest";
|
|
40
40
|
async function preload() {
|
|
41
|
-
const { PLYLoaderWithParser } = await import("@loaders.gl/pointclouds/ply
|
|
41
|
+
const { PLYLoaderWithParser } = await import("@loaders.gl/pointclouds/ply-loader");
|
|
42
42
|
return PLYLoaderWithParser;
|
|
43
43
|
}
|
|
44
44
|
var PLYLoader = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ply/ply-loader-types.ts"],
|
|
4
|
-
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// PLY Loader\nimport type {Loader, LoaderOptions} from '@loaders.gl/core/loader-utils';\nimport type {MeshArrowTable, ArrowTableBatch} from '@loaders.gl/core/schema';\nimport type {PLYMesh} from './lib/ply-types';\nimport type {ParsePLYOptions} from './lib/parse-ply';\nimport {PLYFormat} from './ply-format';\nimport {serializeArrowWorkerTable} from '@loaders.gl/core/schema-utils/arrow-transport';\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\nexport type PLYLoaderOptions = LoaderOptions & {\n ply?: ParsePLYOptions & {\n /** Output shape. Defaults to a Mesh Arrow table. */\n shape?: 'mesh' | 'arrow-table';\n /** Color storage format. Defaults to uint8norm for backwards compatibility. */\n colorFormat?: 'uint8norm' | 'float16' | 'float32';\n /** Treat PLY data as a point cloud by reading only the leading vertex element. */\n pointCloud?: boolean;\n /** Override the URL to the worker bundle (by default loads from unpkg.com) */\n workerUrl?: string;\n };\n};\n\n/**\n * Preloads the parser-bearing PLY loader implementation.\n */\nasync function preload() {\n const {PLYLoaderWithParser} = await import('@loaders.gl/pointclouds/ply
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,wBAAwB;AACxB,6BAAwC;AAIxC,IAAM,UAAU,OAAqC,iBAAc;AAkBnE,eAAe,UAAU;AACvB,QAAM,EAAC,oBAAmB,IAAI,MAAM,OAAO,
|
|
4
|
+
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// PLY Loader\nimport type {Loader, LoaderOptions} from '@loaders.gl/core/loader-utils';\nimport type {MeshArrowTable, ArrowTableBatch} from '@loaders.gl/core/schema';\nimport type {PLYMesh} from './lib/ply-types';\nimport type {ParsePLYOptions} from './lib/parse-ply';\nimport {PLYFormat} from './ply-format';\nimport {serializeArrowWorkerTable} from '@loaders.gl/core/schema-utils/arrow-transport';\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\nexport type PLYLoaderOptions = LoaderOptions & {\n ply?: ParsePLYOptions & {\n /** Output shape. Defaults to a Mesh Arrow table. */\n shape?: 'mesh' | 'arrow-table';\n /** Color storage format. Defaults to uint8norm for backwards compatibility. */\n colorFormat?: 'uint8norm' | 'float16' | 'float32';\n /** Treat PLY data as a point cloud by reading only the leading vertex element. */\n pointCloud?: boolean;\n /** Override the URL to the worker bundle (by default loads from unpkg.com) */\n workerUrl?: string;\n };\n};\n\n/**\n * Preloads the parser-bearing PLY loader implementation.\n */\nasync function preload() {\n const {PLYLoaderWithParser} = await import('@loaders.gl/pointclouds/ply-loader');\n return PLYLoaderWithParser;\n}\n\n/**\n * Metadata-only worker loader for PLY - Polygon File Format (aka Stanford Triangle Format)'\n * links: ['http://paulbourke.net/dataformats/ply/',\n * 'https://en.wikipedia.org/wiki/PLY_(file_format)']\n */\nexport const PLYLoader = {\n dataType: null as unknown as PLYMesh | MeshArrowTable,\n batchType: null as unknown as PLYMesh | ArrowTableBatch,\n\n ...PLYFormat,\n // shapes: ['mesh', 'gltf', 'columnar-table'],\n version: VERSION,\n worker: true,\n /** Enables the stateful input/output batch protocol on the built-in worker. */\n workerInBatches: true,\n serializeWorkerResult: serializeArrowWorkerTable,\n options: {\n ply: {shape: 'arrow-table', colorFormat: 'uint8norm'}\n },\n preload\n} as const satisfies Loader<PLYMesh | MeshArrowTable, PLYMesh | ArrowTableBatch, LoaderOptions>;\n\n/** @deprecated Use PLYLoader. */\nexport const PLYWorkerLoader = PLYLoader;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,wBAAwB;AACxB,6BAAwC;AAIxC,IAAM,UAAU,OAAqC,iBAAc;AAkBnE,eAAe,UAAU;AACvB,QAAM,EAAC,oBAAmB,IAAI,MAAM,OAAO,oCAAoC;AAC/E,SAAO;AACT;AAOO,IAAM,YAAY;AAAA,EACvB,UAAU;AAAA,EACV,WAAW;AAAA,EAEX,GAAG;AAAA;AAAA,EAEH,SAAS;AAAA,EACT,QAAQ;AAAA;AAAA,EAER,iBAAiB;AAAA,EACjB,uBAAuB;AAAA,EACvB,SAAS;AAAA,IACP,KAAK,EAAC,OAAO,eAAe,aAAa,YAAW;AAAA,EACtD;AAAA,EACA;AACF;AAGO,IAAM,kBAAkB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,12 +5,12 @@ import { PLYFormat } from "./ply-format.js";
|
|
|
5
5
|
import { serializeArrowWorkerTable } from '@loaders.gl/core/schema-utils/arrow-transport';
|
|
6
6
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
7
7
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
8
|
-
const VERSION = typeof "5.0.0-beta.
|
|
8
|
+
const VERSION = typeof "5.0.0-beta.2" !== 'undefined' ? "5.0.0-beta.2" : 'latest';
|
|
9
9
|
/**
|
|
10
10
|
* Preloads the parser-bearing PLY loader implementation.
|
|
11
11
|
*/
|
|
12
12
|
async function preload() {
|
|
13
|
-
const { PLYLoaderWithParser } = await import('@loaders.gl/pointclouds/ply
|
|
13
|
+
const { PLYLoaderWithParser } = await import('@loaders.gl/pointclouds/ply-loader');
|
|
14
14
|
return PLYLoaderWithParser;
|
|
15
15
|
}
|
|
16
16
|
/**
|