UNPKG

@itwin/core-common

Version:

iTwin.js components common to frontend and backend

45 lines 1.94 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Tile */ import { utf8ToString } from "@itwin/core-bentley"; import { TileFormat, TileHeader } from "./TileIO"; /** Header preceding tile content in [i3dm](https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification/TileFormats/Instanced3DModel) format. * @internal */ export class I3dmHeader extends TileHeader { length; featureTableJsonPosition; featureTableJsonLength; featureTableBinaryLength; batchTableJsonLength; batchTableBinaryLength; gltfVersion; batchTableJson; get isValid() { return TileFormat.I3dm === this.format; } constructor(stream) { super(stream); this.length = stream.readUint32(); this.featureTableJsonLength = stream.readUint32(); this.featureTableBinaryLength = stream.readUint32(); this.batchTableJsonLength = stream.readUint32(); this.batchTableBinaryLength = stream.readUint32(); this.gltfVersion = stream.readUint32(); this.featureTableJsonPosition = stream.curPos; stream.advance(this.featureTableJsonLength); stream.advance(this.featureTableBinaryLength); if (0 !== this.batchTableJsonLength) { const batchStrData = stream.nextBytes(this.batchTableJsonLength); const batchStr = utf8ToString(batchStrData); if (batchStr) this.batchTableJson = JSON.parse(batchStr); } stream.advance(this.batchTableBinaryLength); if (stream.isPastTheEnd) this.invalidate(); } } //# sourceMappingURL=I3dmTileIO.js.map