Skip to content

Commit

Permalink
fix(3dtiles): fix batchtable reading
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyGlt authored and mgermerie committed Jun 16, 2023
1 parent 1ec89f2 commit b245301
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/Parser/PntsParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ export default {
if (pntsHeader.BTJSONLength > 0) {
// parse batch table
const sizeBegin = byteOffset + pntsHeader.FTJSONLength + pntsHeader.FTBinaryLength;
const BTBuffer = buffer.slice(sizeBegin, pntsHeader.BTJSONLength + sizeBegin);
batchTable = new C3DTBatchTable(BTBuffer, pntsHeader.BTJSONLength, pntsHeader.BTBinaryLength, FTJSON.BATCH_LENGTH, registeredExtensions);
const BTBuffer = buffer.slice(sizeBegin, pntsHeader.BTJSONLength + pntsHeader.BTBinaryLength + sizeBegin);

// If the BATCH_ID semantic is not defined, then the Batch Table stores per-point metadata, and the length of the Batch Table arrays will equal POINTS_LENGTH.
batchTable = new C3DTBatchTable(BTBuffer, pntsHeader.BTJSONLength, pntsHeader.BTBinaryLength, (FTJSON.BATCH_ID && FTJSON.BATCH_LENGTH) ? FTJSON.BATCH_LENGTH : FTJSON.POINTS_LENGTH, registeredExtensions);
}

const pnts = { point, batchTable };
Expand Down
4 changes: 3 additions & 1 deletion src/Provider/3dTilesProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ function pntsParse(data, layer) {
points.position.copy(result.point.offset);
}

return { object3d: points };
return { object3d: points ,
batchTable: result.batchTable,
};
});
}

Expand Down

0 comments on commit b245301

Please sign in to comment.