From 81bd6ff534e9dd28e94233e703ef226101b80214 Mon Sep 17 00:00:00 2001 From: Connor Manning Date: Wed, 6 Dec 2023 14:01:02 -0600 Subject: [PATCH] Properly handle empty point data nodes for COPC. --- src/loader/ept/LaszipLoader.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/loader/ept/LaszipLoader.js b/src/loader/ept/LaszipLoader.js index cebaab6c..0aea47bb 100644 --- a/src/loader/ept/LaszipLoader.js +++ b/src/loader/ept/LaszipLoader.js @@ -51,7 +51,12 @@ export class CopcLaszipLoader { // isolate the compressed data buffer, which is passed to the worker. // The time-consuming decompression and extracting the data into // GPU-compatible buffers happens in the worker. - const { pointDataOffset, pointDataLength } = node.nodeinfo + const { pointCount, pointDataOffset, pointDataLength } = node.nodeinfo + + // Note that COPC explicitly allows nodes to exist with no data. They + // may have children, but there is no point cloud data. Make sure we + // don't try to fetch a slice of point data in this case. + if (!pointCount) return this.parse(node, new ArrayBuffer()) const compressed = await node.owner.getter( pointDataOffset, pointDataOffset + pointDataLength)