{ "version": 3, "sources": ["index.js", "tiles-3d-loader.js", "lib/utils/version.js", "lib/constants.js", "lib/parsers/helpers/parse-utils.js", "lib/parsers/parse-3d-tile-point-cloud.js", "lib/classes/tile-3d-feature-table.js", "lib/classes/tile-3d-batch-table.js", "lib/classes/helpers/tile-3d-accessor-utils.js", "lib/classes/tile-3d-batch-table-hierarchy.js", "lib/parsers/helpers/parse-3d-tile-header.js", "lib/parsers/helpers/parse-3d-tile-tables.js", "lib/parsers/helpers/normalize-3d-tile-colors.js", "lib/parsers/helpers/normalize-3d-tile-normals.js", "lib/parsers/helpers/normalize-3d-tile-positions.js", "lib/parsers/parse-3d-tile-batched-model.js", "lib/parsers/helpers/parse-3d-tile-gltf-view.js", "lib/parsers/parse-3d-tile-instanced-model.js", "lib/parsers/parse-3d-tile-composite.js", "lib/parsers/parse-3d-tile-gltf.js", "lib/parsers/parse-3d-tile.js", "lib/parsers/parse-3d-tile-header.js", "lib/parsers/helpers/parse-3d-tile-subtree.js", "tile-3d-subtree-loader.js", "lib/parsers/helpers/parse-3d-implicit-tiles.js", "lib/utils/s2/s2-token-functions.js", "lib/utils/s2/s2geometry/s2-geometry.js", "lib/utils/s2/converters/s2-to-boundary.js", "lib/utils/s2/s2geometry/s2-cell-utils.js", "lib/utils/s2/s2-geometry-functions.js", "lib/utils/s2/converters/s2-to-region.js", "lib/utils/s2/converters/s2-to-obb-points.js", "lib/utils/obb/s2-corners-to-obb.js", "lib/ion/ion.js", "cesium-ion-loader.js", "3d-tiles-archive-loader.js", "3d-tiles-archive/3d-tiles-archive-parser.js", "3d-tiles-archive/3d-tiles-archive-archive.js", "lib/encoders/encode-3d-tile.js", "lib/encoders/helpers/encode-3d-tile-header.js", "lib/encoders/encode-3d-tile-composite.js", "lib/encoders/encode-3d-tile-batched-model.js", "lib/encoders/encode-3d-tile-instanced-model.js", "lib/encoders/encode-3d-tile-point-cloud.js", "tile-3d-writer.js"], "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n// LOADERS\nexport { Tiles3DLoader } from \"./tiles-3d-loader.js\";\nexport { CesiumIonLoader } from \"./cesium-ion-loader.js\";\nexport { Tile3DSubtreeLoader } from \"./tile-3d-subtree-loader.js\";\nexport { Tiles3DArchiveFileLoader } from \"./3d-tiles-archive-loader.js\";\n// WRITERS\nexport { Tile3DWriter } from \"./tile-3d-writer.js\";\n// CLASSES\nexport { default as Tile3DFeatureTable } from \"./lib/classes/tile-3d-feature-table.js\";\nexport { default as Tile3DBatchTable } from \"./lib/classes/tile-3d-batch-table.js\";\n// EXPERIMENTAL\nexport { TILE3D_TYPE } from \"./lib/constants.js\";\nexport { getIonTilesetMetadata as _getIonTilesetMetadata } from \"./lib/ion/ion.js\";\nexport { Tiles3DArchive } from \"./3d-tiles-archive/3d-tiles-archive-archive.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { path } from '@loaders.gl/loader-utils';\nimport { TILESET_TYPE, LOD_METRIC_TYPE } from '@loaders.gl/tiles';\nimport { VERSION } from \"./lib/utils/version.js\";\nimport { parse3DTile } from \"./lib/parsers/parse-3d-tile.js\";\nimport { normalizeTileHeaders } from \"./lib/parsers/parse-3d-tile-header.js\";\n/**\n * Loader for 3D Tiles\n */\nexport const Tiles3DLoader = {\n dataType: null,\n batchType: null,\n id: '3d-tiles',\n name: '3D Tiles',\n module: '3d-tiles',\n version: VERSION,\n extensions: ['cmpt', 'pnts', 'b3dm', 'i3dm'],\n mimeTypes: ['application/octet-stream'],\n tests: ['cmpt', 'pnts', 'b3dm', 'i3dm'],\n parse,\n options: {\n '3d-tiles': {\n loadGLTF: true,\n decodeQuantizedPositions: false,\n isTileset: 'auto',\n assetGltfUpAxis: null\n }\n }\n};\n/** Parses a tileset or tile */\nasync function parse(data, options = {}, context) {\n // auto detect file type\n const loaderOptions = options['3d-tiles'] || {};\n let isTileset;\n if (loaderOptions.isTileset === 'auto') {\n isTileset = context?.url && context.url.indexOf('.json') !== -1;\n }\n else {\n isTileset = loaderOptions.isTileset;\n }\n return isTileset ? parseTileset(data, options, context) : parseTile(data, options, context);\n}\n/** Parse a tileset */\nasync function parseTileset(data, options, context) {\n const tilesetJson = JSON.parse(new TextDecoder().decode(data));\n const tilesetUrl = context?.url || '';\n const basePath = getBaseUri(tilesetUrl);\n const normalizedRoot = await normalizeTileHeaders(tilesetJson, basePath, options || {});\n const tilesetJsonPostprocessed = {\n ...tilesetJson,\n shape: 'tileset3d',\n loader: Tiles3DLoader,\n url: tilesetUrl,\n queryString: context?.queryString || '',\n basePath,\n root: normalizedRoot || tilesetJson.root,\n type: TILESET_TYPE.TILES3D,\n lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,\n lodMetricValue: tilesetJson.root?.geometricError || 0\n };\n return tilesetJsonPostprocessed;\n}\n/** Parse a tile */\nasync function parseTile(arrayBuffer, options, context) {\n const tile = {\n content: {\n shape: 'tile3d',\n featureIds: null\n }\n };\n const byteOffset = 0;\n // @ts-expect-error\n await parse3DTile(arrayBuffer, byteOffset, options, context, tile.content);\n // @ts-expect-error\n return tile.content;\n}\n/** Get base name */\nfunction getBaseUri(tilesetUrl) {\n return path.dirname(tilesetUrl);\n}\n", "// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof \"4.3.1\" !== 'undefined' ? \"4.3.1\" : 'latest';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n// TILE TYPES\nexport const TILE3D_TYPE = {\n COMPOSITE: 'cmpt',\n POINT_CLOUD: 'pnts',\n BATCHED_3D_MODEL: 'b3dm',\n INSTANCED_3D_MODEL: 'i3dm',\n GEOMETRY: 'geom',\n VECTOR: 'vect',\n GLTF: 'glTF'\n};\nexport const TILE3D_TYPES = Object.keys(TILE3D_TYPE);\nexport const MAGIC_ARRAY = {\n BATCHED_MODEL: [98, 51, 100, 109],\n INSTANCED_MODEL: [105, 51, 100, 109],\n POINT_CLOUD: [112, 110, 116, 115],\n COMPOSITE: [99, 109, 112, 116]\n};\n// TILE CONSTANTS\nexport const TILE3D_OPTIMIZATION_HINT = {\n NOT_COMPUTED: -1,\n USE_OPTIMIZATION: 1,\n SKIP_OPTIMIZATION: 0\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND Apache-2.0\n// Copyright vis.gl contributors\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\nimport { assert } from '@loaders.gl/loader-utils';\n// Decode the JSON binary array into clear text\nexport function getStringFromArrayBuffer(arrayBuffer, byteOffset, byteLength) {\n assert(arrayBuffer instanceof ArrayBuffer);\n const textDecoder = new TextDecoder('utf8');\n const typedArray = new Uint8Array(arrayBuffer, byteOffset, byteLength);\n const string = textDecoder.decode(typedArray);\n return string;\n}\n// Decode the JSON binary array into clear text\nexport function getStringFromTypedArray(typedArray) {\n assert(ArrayBuffer.isView(typedArray));\n const textDecoder = new TextDecoder('utf8');\n const string = textDecoder.decode(typedArray);\n return string;\n}\nexport function getMagicString(arrayBuffer, byteOffset = 0) {\n const dataView = new DataView(arrayBuffer);\n return `\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 0))}\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 1))}\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 2))}\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 3))}`;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND Apache-2.0\n// Copyright vis.gl contributors\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\nimport { DracoLoader } from '@loaders.gl/draco';\nimport { parseFromContext } from '@loaders.gl/loader-utils';\nimport { GL } from '@loaders.gl/math';\nimport { Vector3 } from '@math.gl/core';\nimport Tile3DFeatureTable from \"../classes/tile-3d-feature-table.js\";\nimport Tile3DBatchTable from \"../classes/tile-3d-batch-table.js\";\nimport { parse3DTileHeaderSync } from \"./helpers/parse-3d-tile-header.js\";\nimport { parse3DTileTablesHeaderSync, parse3DTileTablesSync } from \"./helpers/parse-3d-tile-tables.js\";\nimport { normalize3DTileColorAttribute } from \"./helpers/normalize-3d-tile-colors.js\";\nimport { normalize3DTileNormalAttribute } from \"./helpers/normalize-3d-tile-normals.js\";\nimport { normalize3DTilePositionAttribute } from \"./helpers/normalize-3d-tile-positions.js\";\nexport async function parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context) {\n byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);\n byteOffset = parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset);\n byteOffset = parse3DTileTablesSync(tile, arrayBuffer, byteOffset, options);\n initializeTile(tile);\n const { featureTable, batchTable } = parsePointCloudTables(tile);\n await parseDraco(tile, featureTable, batchTable, options, context);\n parsePositions(tile, featureTable, options);\n // @ts-expect-error TODO - do we need to assert on the batch table?\n parseColors(tile, featureTable, batchTable);\n parseNormals(tile, featureTable);\n return byteOffset;\n}\nfunction initializeTile(tile) {\n // Initialize point cloud tile defaults\n tile.attributes = {\n positions: null,\n colors: null,\n normals: null,\n batchIds: null\n };\n tile.isQuantized = false;\n tile.isTranslucent = false;\n tile.isRGB565 = false;\n tile.isOctEncoded16P = false;\n}\nfunction parsePointCloudTables(tile) {\n const featureTable = new Tile3DFeatureTable(tile.featureTableJson, tile.featureTableBinary);\n const pointsLength = featureTable.getGlobalProperty('POINTS_LENGTH');\n if (!Number.isFinite(pointsLength)) {\n throw new Error('POINTS_LENGTH must be defined');\n }\n featureTable.featuresLength = pointsLength;\n tile.featuresLength = pointsLength;\n tile.pointsLength = pointsLength;\n tile.pointCount = pointsLength;\n tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', GL.FLOAT, 3);\n const batchTable = parseBatchIds(tile, featureTable);\n return { featureTable, batchTable };\n}\nfunction parsePositions(tile, featureTable, options) {\n tile.attributes = tile.attributes || {\n positions: null,\n colors: null,\n normals: null,\n batchIds: null\n };\n if (!tile.attributes.positions) {\n if (featureTable.hasProperty('POSITION')) {\n tile.attributes.positions = featureTable.getPropertyArray('POSITION', GL.FLOAT, 3);\n }\n else if (featureTable.hasProperty('POSITION_QUANTIZED')) {\n const positions = featureTable.getPropertyArray('POSITION_QUANTIZED', GL.UNSIGNED_SHORT, 3);\n tile.isQuantized = true;\n tile.quantizedRange = (1 << 16) - 1;\n tile.quantizedVolumeScale = featureTable.getGlobalProperty('QUANTIZED_VOLUME_SCALE', GL.FLOAT, 3);\n if (!tile.quantizedVolumeScale) {\n throw new Error('QUANTIZED_VOLUME_SCALE must be defined for quantized positions.');\n }\n tile.quantizedVolumeOffset = featureTable.getGlobalProperty('QUANTIZED_VOLUME_OFFSET', GL.FLOAT, 3);\n if (!tile.quantizedVolumeOffset) {\n throw new Error('QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.');\n }\n tile.attributes.positions = normalize3DTilePositionAttribute(tile, positions, options);\n }\n }\n if (!tile.attributes.positions) {\n throw new Error('Either POSITION or POSITION_QUANTIZED must be defined.');\n }\n}\nfunction parseColors(tile, featureTable, batchTable) {\n tile.attributes = tile.attributes || {\n positions: null,\n colors: null,\n normals: null,\n batchIds: null\n };\n if (!tile.attributes.colors) {\n let colors = null;\n if (featureTable.hasProperty('RGBA')) {\n colors = featureTable.getPropertyArray('RGBA', GL.UNSIGNED_BYTE, 4);\n tile.isTranslucent = true;\n }\n else if (featureTable.hasProperty('RGB')) {\n colors = featureTable.getPropertyArray('RGB', GL.UNSIGNED_BYTE, 3);\n }\n else if (featureTable.hasProperty('RGB565')) {\n colors = featureTable.getPropertyArray('RGB565', GL.UNSIGNED_SHORT, 1);\n tile.isRGB565 = true;\n }\n tile.attributes.colors = normalize3DTileColorAttribute(tile, colors, batchTable);\n }\n if (featureTable.hasProperty('CONSTANT_RGBA')) {\n tile.constantRGBA = featureTable.getGlobalProperty('CONSTANT_RGBA', GL.UNSIGNED_BYTE, 4);\n }\n}\nfunction parseNormals(tile, featureTable) {\n tile.attributes = tile.attributes || {\n positions: null,\n colors: null,\n normals: null,\n batchIds: null\n };\n if (!tile.attributes.normals) {\n let normals = null;\n if (featureTable.hasProperty('NORMAL')) {\n normals = featureTable.getPropertyArray('NORMAL', GL.FLOAT, 3);\n }\n else if (featureTable.hasProperty('NORMAL_OCT16P')) {\n normals = featureTable.getPropertyArray('NORMAL_OCT16P', GL.UNSIGNED_BYTE, 2);\n tile.isOctEncoded16P = true;\n }\n tile.attributes.normals = normalize3DTileNormalAttribute(tile, normals);\n }\n}\nfunction parseBatchIds(tile, featureTable) {\n let batchTable = null;\n if (!tile.batchIds && featureTable.hasProperty('BATCH_ID')) {\n tile.batchIds = featureTable.getPropertyArray('BATCH_ID', GL.UNSIGNED_SHORT, 1);\n if (tile.batchIds) {\n const batchFeatureLength = featureTable.getGlobalProperty('BATCH_LENGTH');\n if (!batchFeatureLength) {\n throw new Error('Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.');\n }\n const { batchTableJson, batchTableBinary } = tile;\n batchTable = new Tile3DBatchTable(batchTableJson, batchTableBinary, batchFeatureLength);\n }\n }\n return batchTable;\n}\n// eslint-disable-next-line complexity\nasync function parseDraco(tile, featureTable, batchTable, options, context) {\n let dracoBuffer;\n let dracoFeatureTableProperties;\n let dracoBatchTableProperties;\n const batchTableDraco = tile.batchTableJson &&\n tile.batchTableJson.extensions &&\n tile.batchTableJson.extensions['3DTILES_draco_point_compression'];\n if (batchTableDraco) {\n dracoBatchTableProperties = batchTableDraco.properties;\n }\n const featureTableDraco = featureTable.getExtension('3DTILES_draco_point_compression');\n if (featureTableDraco) {\n dracoFeatureTableProperties = featureTableDraco.properties;\n const dracoByteOffset = featureTableDraco.byteOffset;\n const dracoByteLength = featureTableDraco.byteLength;\n if (!dracoFeatureTableProperties || !Number.isFinite(dracoByteOffset) || !dracoByteLength) {\n throw new Error('Draco properties, byteOffset, and byteLength must be defined');\n }\n dracoBuffer = (tile.featureTableBinary || []).slice(dracoByteOffset, dracoByteOffset + dracoByteLength);\n tile.hasPositions = Number.isFinite(dracoFeatureTableProperties.POSITION);\n tile.hasColors =\n Number.isFinite(dracoFeatureTableProperties.RGB) ||\n Number.isFinite(dracoFeatureTableProperties.RGBA);\n tile.hasNormals = Number.isFinite(dracoFeatureTableProperties.NORMAL);\n tile.hasBatchIds = Number.isFinite(dracoFeatureTableProperties.BATCH_ID);\n tile.isTranslucent = Number.isFinite(dracoFeatureTableProperties.RGBA);\n }\n if (!dracoBuffer) {\n return true;\n }\n const dracoData = {\n buffer: dracoBuffer,\n properties: { ...dracoFeatureTableProperties, ...dracoBatchTableProperties },\n featureTableProperties: dracoFeatureTableProperties,\n batchTableProperties: dracoBatchTableProperties,\n dequantizeInShader: false\n };\n return await loadDraco(tile, dracoData, options, context);\n}\n// eslint-disable-next-line complexity, max-statements\nexport async function loadDraco(tile, dracoData, options, context) {\n if (!context) {\n return;\n }\n const dracoOptions = {\n ...options,\n draco: {\n ...options?.draco,\n extraAttributes: dracoData.batchTableProperties || {}\n }\n };\n // The entire tileset might be included, too expensive to serialize\n delete dracoOptions['3d-tiles'];\n const data = await parseFromContext(dracoData.buffer, DracoLoader, dracoOptions, context);\n const decodedPositions = data.attributes.POSITION && data.attributes.POSITION.value;\n const decodedColors = data.attributes.COLOR_0 && data.attributes.COLOR_0.value;\n const decodedNormals = data.attributes.NORMAL && data.attributes.NORMAL.value;\n const decodedBatchIds = data.attributes.BATCH_ID && data.attributes.BATCH_ID.value;\n // @ts-expect-error\n const isQuantizedDraco = decodedPositions && data.attributes.POSITION.value.quantization;\n // @ts-expect-error\n const isOctEncodedDraco = decodedNormals && data.attributes.NORMAL.value.quantization;\n if (isQuantizedDraco) {\n // Draco quantization range == quantized volume scale - size in meters of the quantized volume\n // Internal quantized range is the range of values of the quantized data, e.g. 255 for 8-bit, 1023 for 10-bit, etc\n // @ts-expect-error This doesn't look right\n const quantization = data.POSITION.data.quantization;\n const range = quantization.range;\n tile.quantizedVolumeScale = new Vector3(range, range, range);\n tile.quantizedVolumeOffset = new Vector3(quantization.minValues);\n tile.quantizedRange = (1 << quantization.quantizationBits) - 1.0;\n tile.isQuantizedDraco = true;\n }\n if (isOctEncodedDraco) {\n // @ts-expect-error This doesn't look right\n tile.octEncodedRange = (1 << data.NORMAL.data.quantization.quantizationBits) - 1.0;\n tile.isOctEncodedDraco = true;\n }\n // Extra batch table attributes\n const batchTableAttributes = {};\n if (dracoData.batchTableProperties) {\n for (const attributeName of Object.keys(dracoData.batchTableProperties)) {\n if (data.attributes[attributeName] && data.attributes[attributeName].value) {\n batchTableAttributes[attributeName.toLowerCase()] = data.attributes[attributeName].value;\n }\n }\n }\n tile.attributes = {\n // @ts-expect-error\n positions: decodedPositions,\n // @ts-expect-error\n colors: normalize3DTileColorAttribute(tile, decodedColors, undefined),\n // @ts-expect-error\n normals: decodedNormals,\n // @ts-expect-error\n batchIds: decodedBatchIds,\n ...batchTableAttributes\n };\n}\n// TODO - this is the remaining code from Cesium's parser\n/*\n const batchTable = new Tile3DBatchTable(tile);\n\n // parseDracoBuffer(tile, featureTable, batchTable);\n\n if (!tile.attributes.positions) {\n throw new Error('Either POSITION or POSITION_QUANTIZED must be defined.');\n }\n}\n/*\n\n if (!tile.attributes.positions) {\n if (featureTable.hasProperty('POSITION')) {\n tile.attributes.positions = featureTable.getPropertyArray('POSITION', GL.FLOAT, 3);\n } else if (featureTable.hasProperty('POSITION_QUANTIZED')) {\n tile.attributes.positions = featureTable.getPropertyArray('POSITION_QUANTIZED', GL.UNSIGNED_SHORT, 3);\n\n\n if (!tile.colors) {\n if (featureTable.hasProperty('RGBA')) {\n tile.colors = featureTable.getPropertyArray('RGBA', GL.UNSIGNED_BYTE, 4);\n tile.isTranslucent = true;\n } else if (featureTable.hasProperty('RGB')) {\n tile.colors = featureTable.getPropertyArray('RGB', GL.UNSIGNED_BYTE, 3);\n } else if (featureTable.hasPropertry('RGB565')) {\n tile.colors = featureTable.getPropertyArray('RGB565', GL.UNSIGNED_SHORT, 1);\n tile.isRGB565 = true;\n }\n }\n\n if (!tile.attributes.normals) {\n if (featureTable.getPropertry('NORMAL')) {\n tile.attributes.normals = featureTable.getPropertyArray('NORMAL', GL.FLOAT, 3);\n } else if (featureTable.getProperty('NORMAL_OCT16P')) {\n tile.attributes.normals = featureTable.getPropertyArray('NORMAL_OCT16P', GL.UNSIGNED_BYTE, 2);\n tile.isOctEncoded16P = true;\n }\n }\n\n if (!tile.batchIds) {\n if (featureTable.hasProperty('BATCH_ID')) {\n tile.batchIds = featureTable.getPropertyArray('BATCH_ID', GL.UNSIGNED_SHORT, 1);\n }\n }\n\n if (!tile.attributes.positions) {\n throw new Error('Either POSITION or POSITION_QUANTIZED must be defined.');\n }\n\n if (featureTable.getPropertry('CONSTANT_RGBA')) {\n tile.constantRGBA = featureTable.getGlobalProperty('CONSTANT_RGBA', GL.UNSIGNED_BYTE, 4);\n }\n\n if (tile.batchIds) {\n const batchLength = featureTable.getGlobalProperty('BATCH_LENGTH');\n if (!defined(batchLength)) {\n throw new Error('Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.');\n }\n\n if (defined(batchTableBinary)) {\n // Copy the batchTableBinary section and let the underlying ArrayBuffer be freed\n batchTableBinary = new Uint8Array(batchTableBinary);\n }\n\n if (defined(pointCloud._batchTableLoaded)) {\n pointCloud._batchTableLoaded(batchLength, batchTableJson, batchTableBinary);\n }\n }\n\n // If points are not batched and there are per-point properties, use these properties for styling purposes\n var styleableProperties;\n if (!hasBatchIds && defined(batchTableBinary)) {\n tile.styleableProperties = Cesium3DTileBatchTable.getBinaryProperties(\n pointsLength,\n batchTableJson,\n batchTableBinary\n );\n }\n\n tile.draco = draco;\n}\n\n// Separate parsing and decoding of Draco\nexport function parseDracoBuffer(tile, featureTable, batchTable) {\n let dracoBuffer;\n let dracoFeatureTableProperties;\n let dracoBatchTableProperties;\n\n const batchTableDraco = batchTable.getExtension('3DTILES_draco_point_compression');\n if (batchTableDraco) {\n dracoBatchTableProperties = batchTableDraco.properties;\n }\n\n const featureTableDraco = featureTable.getExtension('3DTILES_draco_point_compression');\n if (featureTableDraco) {\n dracoFeatureTableProperties = featureTableDraco.properties;\n const dracoByteOffset = featureTableDraco.byteOffset;\n const dracoByteLength = featureTableDraco.byteLength;\n if (!dracoFeatureTableProperties || !dracoByteOffset || !dracoByteLength) {\n throw new Error('Draco properties, byteOffset, and byteLength must be defined');\n }\n\n dracoBuffer = arraySlice(\n featureTableBinary,\n dracoByteOffset,\n dracoByteOffset + dracoByteLength\n );\n tile.hasPositions = dracoFeatureTableProperties.POSITION;\n tile.hasColors = dracoFeatureTableProperties.RGB || dracoFeatureTableProperties.RGBA;\n tile.hasNormals = dracoFeatureTableProperties.NORMAL;\n tile.hasBatchIds = dracoFeatureTableProperties.BATCH_ID;\n tile.isTranslucent = dracoFeatureTableProperties.RGBA;\n }\n\n if (dracoBuffer) {\n tile.draco = {\n buffer: dracoBuffer,\n properties: {...dracoFeatureTableProperties, ...dracoBatchTableProperties},\n featureTableProperties: dracoFeatureTableProperties,\n batchTableProperties: dracoBatchTableProperties,\n dequantizeInShader: false\n };\n\n tile.decodingState = DECODING_STATE.NEEDS_DECODE;\n }\n}\n\n/*\nfunction decodeDraco(tile, context) {\n if (tile.decodingState === DECODING_STATE.READY) {\n return false;\n }\n if (tile.decodingState === DECODING_STATE.NEEDS_DECODE) {\n var parsedContent = tile._parsedContent;\n var draco = parsedContent.draco;\n var decodePromise = DracoLoader.decodePointCloud(draco, context);\n if (defined(decodePromise)) {\n tile.decodingState = DECODING_STATE.DECODING;\n decodePromise.then(function(result) {\n tile.decodingState = DECODING_STATE.READY;\n var decodedPositions = defined(result.POSITION) ? result.POSITION.array : undefined;\n var decodedRgb = defined(result.RGB) ? result.RGB.array : undefined;\n var decodedRgba = defined(result.RGBA) ? result.RGBA.array : undefined;\n var decodedNormals = defined(result.NORMAL) ? result.NORMAL.array : undefined;\n var decodedBatchIds = defined(result.BATCH_ID) ? result.BATCH_ID.array : undefined;\n var isQuantizedDraco = defined(decodedPositions) && defined(result.POSITION.data.quantization);\n var isOctEncodedDraco = defined(decodedNormals) && defined(result.NORMAL.data.quantization);\n if (isQuantizedDraco) {\n // Draco quantization range == quantized volume scale - size in meters of the quantized volume\n // Internal quantized range is the range of values of the quantized data, e.g. 255 for 8-bit, 1023 for 10-bit, etc\n var quantization = result.POSITION.data.quantization;\n var range = quantization.range;\n tile._quantizedVolumeScale = Cartesian3.fromElements(range, range, range);\n tile._quantizedVolumeOffset = Cartesian3.unpack(quantization.minValues);\n tile._quantizedRange = (1 << quantization.quantizationBits) - 1.0;\n tile._isQuantizedDraco = true;\n }\n if (isOctEncodedDraco) {\n tile._octEncodedRange = (1 << result.NORMAL.data.quantization.quantizationBits) - 1.0;\n tile._isOctEncodedDraco = true;\n }\n var styleableProperties = parsedContent.styleableProperties;\n var batchTableProperties = draco.batchTableProperties;\n for (var name in batchTableProperties) {\n if (batchTableProperties.hasOwnProperty(name)) {\n var property = result[name];\n if (!defined(styleableProperties)) {\n styleableProperties = {};\n }\n styleableProperties[name] = {\n typedArray : property.array,\n componentCount : property.data.componentsPerAttribute\n };\n }\n }\n parsedContent.positions = defaultValue(decodedPositions, parsedContent.positions);\n parsedContent.colors = defaultValue(defaultValue(decodedRgba, decodedRgb), parsedContent.colors);\n parsedContent.normals = defaultValue(decodedNormals, parsedContent.normals);\n parsedContent.batchIds = defaultValue(decodedBatchIds, parsedContent.batchIds);\n parsedContent.styleableProperties = styleableProperties;\n }).otherwise(function(error) {\n tile.decodingState = DECODING_STATE.FAILED;\n tile._readyPromise.reject(error);\n });\n }\n }\n return true;\n}\n*/\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND Apache-2.0\n// Copyright vis.gl contributors\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\nimport { GL, GLType } from '@loaders.gl/math';\n// Reference:\n// https://github.com/AnalyticalGraphicsInc/cesium/blob/1de96d087f0b17575eb1a3f736407b348c765d59/Source/Scene/Cesium3DTileFeatureTable.js\nexport default class Tile3DFeatureTable {\n json;\n buffer;\n featuresLength = 0;\n _cachedTypedArrays = {};\n constructor(featureTableJson, featureTableBinary) {\n this.json = featureTableJson;\n this.buffer = featureTableBinary;\n }\n getExtension(extensionName) {\n return this.json.extensions && this.json.extensions[extensionName];\n }\n hasProperty(propertyName) {\n return Boolean(this.json[propertyName]);\n }\n getGlobalProperty(propertyName, componentType = GL.UNSIGNED_INT, componentLength = 1) {\n const jsonValue = this.json[propertyName];\n if (jsonValue && Number.isFinite(jsonValue.byteOffset)) {\n return this._getTypedArrayFromBinary(propertyName, componentType, componentLength, 1, jsonValue.byteOffset);\n }\n return jsonValue;\n }\n getPropertyArray(propertyName, componentType, componentLength) {\n const jsonValue = this.json[propertyName];\n if (jsonValue && Number.isFinite(jsonValue.byteOffset)) {\n if ('componentType' in jsonValue) {\n componentType = GLType.fromName(jsonValue.componentType);\n }\n return this._getTypedArrayFromBinary(propertyName, componentType, componentLength, this.featuresLength, jsonValue.byteOffset);\n }\n return this._getTypedArrayFromArray(propertyName, componentType, jsonValue);\n }\n getProperty(propertyName, componentType, componentLength, featureId, result) {\n const jsonValue = this.json[propertyName];\n if (!jsonValue) {\n return jsonValue;\n }\n const typedArray = this.getPropertyArray(propertyName, componentType, componentLength);\n if (componentLength === 1) {\n return typedArray[featureId];\n }\n for (let i = 0; i < componentLength; ++i) {\n result[i] = typedArray[componentLength * featureId + i];\n }\n return result;\n }\n // HELPERS\n _getTypedArrayFromBinary(propertyName, componentType, componentLength, count, byteOffset) {\n const cachedTypedArrays = this._cachedTypedArrays;\n let typedArray = cachedTypedArrays[propertyName];\n if (!typedArray) {\n typedArray = GLType.createTypedArray(componentType, this.buffer.buffer, this.buffer.byteOffset + byteOffset, count * componentLength);\n cachedTypedArrays[propertyName] = typedArray;\n }\n return typedArray;\n }\n _getTypedArrayFromArray(propertyName, componentType, array) {\n const cachedTypedArrays = this._cachedTypedArrays;\n let typedArray = cachedTypedArrays[propertyName];\n if (!typedArray) {\n typedArray = GLType.createTypedArray(componentType, array);\n cachedTypedArrays[propertyName] = typedArray;\n }\n return typedArray;\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND Apache-2.0\n// Copyright vis.gl contributors\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\nimport { assert } from '@loaders.gl/loader-utils';\nimport { createTypedArrayFromAccessor } from \"./helpers/tile-3d-accessor-utils.js\";\nimport { initializeHierarchy, traverseHierarchy } from \"./tile-3d-batch-table-hierarchy.js\";\nfunction defined(x) {\n return x !== undefined && x !== null;\n}\nconst clone = (x, y) => x;\n// These top level fields in the batch table json are not properties\nconst IGNORED_PROPERTY_FIELDS = {\n HIERARCHY: true, // Deprecated HIERARCHY property\n extensions: true,\n extras: true\n};\n// The size of this array equals the maximum instance count among all loaded tiles, which has the potential to be large.\nexport default class Tile3DBatchTableParser {\n json;\n binary;\n featureCount;\n _extensions;\n // Copy all top-level property fields from the json object, ignoring special fields\n _properties;\n _binaryProperties;\n // TODO: hierarchy support is only partially implemented and not tested\n _hierarchy;\n constructor(json, binary, featureCount, options = {}) {\n assert(featureCount >= 0);\n this.json = json || {};\n this.binary = binary;\n this.featureCount = featureCount;\n this._extensions = this.json?.extensions || {};\n // Copy all top-level property fields from the json object, ignoring special fields\n this._properties = {};\n for (const propertyName in this.json) {\n if (!IGNORED_PROPERTY_FIELDS[propertyName]) {\n this._properties[propertyName] = this.json[propertyName];\n }\n }\n this._binaryProperties = this._initializeBinaryProperties();\n // TODO: hierarchy support is only partially implemented and not tested\n if (options['3DTILES_batch_table_hierarchy']) {\n this._hierarchy = initializeHierarchy(this, this.json, this.binary);\n }\n }\n getExtension(extensionName) {\n return this.json && this.json.extensions && this.json.extensions[extensionName];\n }\n memorySizeInBytes() {\n return 0;\n }\n isClass(batchId, className) {\n this._checkBatchId(batchId);\n assert(typeof className === 'string', className);\n // extension: 3DTILES_batch_table_hierarchy\n if (this._hierarchy) {\n // PERFORMANCE_IDEA : cache results in the ancestor classes\n // to speed up this check if this area becomes a hotspot\n // PERFORMANCE_IDEA : treat class names as integers for faster comparisons\n const result = traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {\n const classId = hierarchy.classIds[instanceIndex];\n const instanceClass = hierarchy.classes[classId];\n return instanceClass.name === className;\n });\n return defined(result);\n }\n return false;\n }\n isExactClass(batchId, className) {\n assert(typeof className === 'string', className);\n return this.getExactClassName(batchId) === className;\n }\n getExactClassName(batchId) {\n this._checkBatchId(batchId);\n // extension: 3DTILES_batch_table_hierarchy\n if (this._hierarchy) {\n const classId = this._hierarchy.classIds[batchId];\n const instanceClass = this._hierarchy.classes[classId];\n return instanceClass.name;\n }\n return undefined;\n }\n hasProperty(batchId, name) {\n this._checkBatchId(batchId);\n assert(typeof name === 'string', name);\n return defined(this._properties[name]) || this._hasPropertyInHierarchy(batchId, name);\n }\n getPropertyNames(batchId, results) {\n this._checkBatchId(batchId);\n results = defined(results) ? results : [];\n results.length = 0;\n const propertyNames = Object.keys(this._properties);\n results.push(...propertyNames);\n if (this._hierarchy) {\n this._getPropertyNamesInHierarchy(batchId, results);\n }\n return results;\n }\n getProperty(batchId, name) {\n this._checkBatchId(batchId);\n assert(typeof name === 'string', name);\n if (this._binaryProperties) {\n const binaryProperty = this._binaryProperties[name];\n if (defined(binaryProperty)) {\n return this._getBinaryProperty(binaryProperty, batchId);\n }\n }\n const propertyValues = this._properties[name];\n if (defined(propertyValues)) {\n return clone(propertyValues[batchId], true);\n }\n // EXTENSION: 3DTILES_batch_table_hierarchy\n if (this._hierarchy) {\n const hierarchyProperty = this._getHierarchyProperty(batchId, name);\n if (defined(hierarchyProperty)) {\n return hierarchyProperty;\n }\n }\n return undefined;\n }\n setProperty(batchId, name, value) {\n const featureCount = this.featureCount;\n this._checkBatchId(batchId);\n assert(typeof name === 'string', name);\n if (this._binaryProperties) {\n const binaryProperty = this._binaryProperties[name];\n if (binaryProperty) {\n this._setBinaryProperty(binaryProperty, batchId, value);\n return;\n }\n }\n // EXTENSION: 3DTILES_batch_table_hierarchy\n if (this._hierarchy) {\n if (this._setHierarchyProperty(this, batchId, name, value)) {\n return;\n }\n }\n let propertyValues = this._properties[name];\n if (!defined(propertyValues)) {\n // Property does not exist. Create it.\n this._properties[name] = new Array(featureCount);\n propertyValues = this._properties[name];\n }\n propertyValues[batchId] = clone(value, true);\n }\n // PRIVATE METHODS\n _checkBatchId(batchId) {\n const valid = batchId >= 0 && batchId < this.featureCount;\n if (!valid) {\n throw new Error('batchId not in range [0, featureCount - 1].');\n }\n }\n _getBinaryProperty(binaryProperty, index) {\n return binaryProperty.unpack(binaryProperty.typedArray, index);\n }\n _setBinaryProperty(binaryProperty, index, value) {\n binaryProperty.pack(value, binaryProperty.typedArray, index);\n }\n _initializeBinaryProperties() {\n let binaryProperties = null;\n for (const name in this._properties) {\n const property = this._properties[name];\n const binaryProperty = this._initializeBinaryProperty(name, property);\n // Store any information needed to access the binary data, including the typed array,\n // componentCount (e.g. a VEC4 would be 4), and the type used to pack and unpack (e.g. Cartesian4).\n if (binaryProperty) {\n binaryProperties = binaryProperties || {};\n binaryProperties[name] = binaryProperty;\n }\n }\n return binaryProperties;\n }\n _initializeBinaryProperty(name, property) {\n if ('byteOffset' in property) {\n // This is a binary property\n const tile3DAccessor = property;\n assert(this.binary, `Property ${name} requires a batch table binary.`);\n assert(tile3DAccessor.type, `Property ${name} requires a type.`);\n const accessor = createTypedArrayFromAccessor(tile3DAccessor, this.binary.buffer, this.binary.byteOffset | 0, this.featureCount);\n // Store any information needed to access the binary data, including the typed array,\n // componentCount (e.g. a VEC4 would be 4), and the type used to pack and unpack (e.g. Cartesian4).\n return {\n typedArray: accessor.values,\n componentCount: accessor.size,\n unpack: accessor.unpacker,\n pack: accessor.packer\n };\n }\n return null;\n }\n // EXTENSION SUPPORT: 3DTILES_batch_table_hierarchy\n _hasPropertyInHierarchy(batchId, name) {\n if (!this._hierarchy) {\n return false;\n }\n const result = traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {\n const classId = hierarchy.classIds[instanceIndex];\n const instances = hierarchy.classes[classId].instances;\n return defined(instances[name]);\n });\n return defined(result);\n }\n _getPropertyNamesInHierarchy(batchId, results) {\n traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {\n const classId = hierarchy.classIds[instanceIndex];\n const instances = hierarchy.classes[classId].instances;\n for (const name in instances) {\n if (instances.hasOwnProperty(name)) {\n if (results.indexOf(name) === -1) {\n results.push(name);\n }\n }\n }\n });\n }\n _getHierarchyProperty(batchId, name) {\n return traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {\n const classId = hierarchy.classIds[instanceIndex];\n const instanceClass = hierarchy.classes[classId];\n const indexInClass = hierarchy.classIndexes[instanceIndex];\n const propertyValues = instanceClass.instances[name];\n if (defined(propertyValues)) {\n if (defined(propertyValues.typedArray)) {\n return this._getBinaryProperty(propertyValues, indexInClass);\n }\n return clone(propertyValues[indexInClass], true);\n }\n return null;\n });\n }\n _setHierarchyProperty(batchTable, batchId, name, value) {\n const result = traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {\n const classId = hierarchy.classIds[instanceIndex];\n const instanceClass = hierarchy.classes[classId];\n const indexInClass = hierarchy.classIndexes[instanceIndex];\n const propertyValues = instanceClass.instances[name];\n if (defined(propertyValues)) {\n assert(instanceIndex === batchId, `Inherited property \"${name}\" is read-only.`);\n if (defined(propertyValues.typedArray)) {\n this._setBinaryProperty(propertyValues, indexInClass, value);\n }\n else {\n propertyValues[indexInClass] = clone(value, true);\n }\n return true;\n }\n return false;\n });\n return defined(result);\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { GLType } from '@loaders.gl/math'; // '@math.gl/geometry';\nimport { assert } from '@loaders.gl/loader-utils';\nconst COMPONENTS_PER_ATTRIBUTE = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n};\n// TODO - could just return typed array views...\n// prettier-ignore\nconst UNPACKER = {\n SCALAR: (values, i) => values[i],\n VEC2: (values, i) => [values[2 * i + 0], values[2 * i + 1]],\n VEC3: (values, i) => [values[3 * i + 0], values[3 * i + 1], values[3 * i + 2]],\n VEC4: (values, i) => [values[4 * i + 0], values[4 * i + 1], values[4 * i + 2], values[4 * i + 3]],\n // TODO: check column major\n MAT2: (values, i) => [\n values[4 * i + 0], values[4 * i + 1],\n values[4 * i + 2], values[4 * i + 3]\n ],\n MAT3: (values, i) => [\n values[9 * i + 0], values[9 * i + 1], values[9 * i + 2],\n values[9 * i + 3], values[9 * i + 4], values[9 * i + 5],\n values[9 * i + 6], values[9 * i + 7], values[9 * i + 8]\n ],\n MAT4: (values, i) => [\n values[16 * i + 0], values[16 * i + 1], values[16 * i + 2], values[16 * i + 3],\n values[16 * i + 4], values[16 * i + 5], values[16 * i + 6], values[16 * i + 7],\n values[16 * i + 8], values[16 * i + 9], values[16 * i + 10], values[16 * i + 11],\n values[16 * i + 12], values[16 * i + 13], values[16 * i + 14], values[16 * i + 15]\n ]\n};\nconst PACKER = {\n SCALAR: (x, values, i) => {\n values[i] = x;\n },\n VEC2: (x, values, i) => {\n values[2 * i + 0] = x[0];\n values[2 * i + 1] = x[1];\n },\n VEC3: (x, values, i) => {\n values[3 * i + 0] = x[0];\n values[3 * i + 1] = x[1];\n values[3 * i + 2] = x[2];\n },\n VEC4: (x, values, i) => {\n values[4 * i + 0] = x[0];\n values[4 * i + 1] = x[1];\n values[4 * i + 2] = x[2];\n values[4 * i + 3] = x[3];\n },\n // TODO: check column major correctness\n MAT2: (x, values, i) => {\n values[4 * i + 0] = x[0];\n values[4 * i + 1] = x[1];\n values[4 * i + 2] = x[2];\n values[4 * i + 3] = x[3];\n },\n MAT3: (x, values, i) => {\n values[9 * i + 0] = x[0];\n values[9 * i + 1] = x[1];\n values[9 * i + 2] = x[2];\n values[9 * i + 3] = x[3];\n values[9 * i + 4] = x[4];\n values[9 * i + 5] = x[5];\n values[9 * i + 6] = x[6];\n values[9 * i + 7] = x[7];\n values[9 * i + 8] = x[8];\n values[9 * i + 9] = x[9];\n },\n MAT4: (x, values, i) => {\n values[16 * i + 0] = x[0];\n values[16 * i + 1] = x[1];\n values[16 * i + 2] = x[2];\n values[16 * i + 3] = x[3];\n values[16 * i + 4] = x[4];\n values[16 * i + 5] = x[5];\n values[16 * i + 6] = x[6];\n values[16 * i + 7] = x[7];\n values[16 * i + 8] = x[8];\n values[16 * i + 9] = x[9];\n values[16 * i + 10] = x[10];\n values[16 * i + 11] = x[11];\n values[16 * i + 12] = x[12];\n values[16 * i + 13] = x[13];\n values[16 * i + 14] = x[14];\n values[16 * i + 15] = x[15];\n }\n};\nexport function createTypedArrayFromAccessor(tile3DAccessor, buffer, byteOffset, length) {\n const { componentType } = tile3DAccessor;\n assert(tile3DAccessor.componentType);\n const type = typeof componentType === 'string' ? GLType.fromName(componentType) : componentType;\n const size = COMPONENTS_PER_ATTRIBUTE[tile3DAccessor.type];\n const unpacker = UNPACKER[tile3DAccessor.type];\n const packer = PACKER[tile3DAccessor.type];\n byteOffset += tile3DAccessor.byteOffset;\n const values = GLType.createTypedArray(type, buffer, byteOffset, size * length);\n return {\n values,\n type,\n size,\n unpacker,\n packer\n };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND Apache-2.0\n// Copyright vis.gl contributors\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n// TODO - Finish hierarchy suypport: this file is only half ported\n/* eslint-disable */\n// @ts-nocheck\nconst defined = (x) => x !== undefined;\nexport function initializeHierarchy(batchTable, jsonHeader, binaryBody) {\n if (!jsonHeader) {\n return null;\n }\n let hierarchy = batchTable.getExtension('3DTILES_batch_table_hierarchy');\n const legacyHierarchy = jsonHeader.HIERARCHY;\n if (legacyHierarchy) {\n // eslint-disable-next-line\n console.warn('3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy.');\n jsonHeader.extensions = jsonHeader.extensions || {};\n jsonHeader.extensions['3DTILES_batch_table_hierarchy'] = legacyHierarchy;\n hierarchy = legacyHierarchy;\n }\n if (!hierarchy) {\n return null;\n }\n return initializeHierarchyValues(hierarchy, binaryBody);\n}\n// eslint-disable-next-line max-statements\nfunction initializeHierarchyValues(hierarchyJson, binaryBody) {\n let i;\n let classId;\n let binaryAccessor;\n const instancesLength = hierarchyJson.instancesLength;\n const classes = hierarchyJson.classes;\n let classIds = hierarchyJson.classIds;\n let parentCounts = hierarchyJson.parentCounts;\n let parentIds = hierarchyJson.parentIds;\n let parentIdsLength = instancesLength;\n if (defined(classIds.byteOffset)) {\n classIds.componentType = defaultValue(classIds.componentType, GL.UNSIGNED_SHORT);\n classIds.type = AttributeType.SCALAR;\n binaryAccessor = getBinaryAccessor(classIds);\n classIds = binaryAccessor.createArrayBufferView(binaryBody.buffer, binaryBody.byteOffset + classIds.byteOffset, instancesLength);\n }\n let parentIndexes;\n if (defined(parentCounts)) {\n if (defined(parentCounts.byteOffset)) {\n parentCounts.componentType = defaultValue(parentCounts.componentType, GL.UNSIGNED_SHORT);\n parentCounts.type = AttributeType.SCALAR;\n binaryAccessor = getBinaryAccessor(parentCounts);\n parentCounts = binaryAccessor.createArrayBufferView(binaryBody.buffer, binaryBody.byteOffset + parentCounts.byteOffset, instancesLength);\n }\n parentIndexes = new Uint16Array(instancesLength);\n parentIdsLength = 0;\n for (i = 0; i < instancesLength; ++i) {\n parentIndexes[i] = parentIdsLength;\n parentIdsLength += parentCounts[i];\n }\n }\n if (defined(parentIds) && defined(parentIds.byteOffset)) {\n parentIds.componentType = defaultValue(parentIds.componentType, GL.UNSIGNED_SHORT);\n parentIds.type = AttributeType.SCALAR;\n binaryAccessor = getBinaryAccessor(parentIds);\n parentIds = binaryAccessor.createArrayBufferView(binaryBody.buffer, binaryBody.byteOffset + parentIds.byteOffset, parentIdsLength);\n }\n const classesLength = classes.length;\n for (i = 0; i < classesLength; ++i) {\n const classInstancesLength = classes[i].length;\n const properties = classes[i].instances;\n const binaryProperties = getBinaryProperties(classInstancesLength, properties, binaryBody);\n classes[i].instances = combine(binaryProperties, properties);\n }\n const classCounts = new Array(classesLength).fill(0);\n const classIndexes = new Uint16Array(instancesLength);\n for (i = 0; i < instancesLength; ++i) {\n classId = classIds[i];\n classIndexes[i] = classCounts[classId];\n ++classCounts[classId];\n }\n const hierarchy = {\n classes,\n classIds,\n classIndexes,\n parentCounts,\n parentIndexes,\n parentIds\n };\n validateHierarchy(hierarchy);\n return hierarchy;\n}\n// HELPER CODE\n// Traverse over the hierarchy and process each instance with the endConditionCallback.\n// When the endConditionCallback returns a value, the traversal stops and that value is returned.\nexport function traverseHierarchy(hierarchy, instanceIndex, endConditionCallback) {\n if (!hierarchy) {\n return;\n }\n const parentCounts = hierarchy.parentCounts;\n const parentIds = hierarchy.parentIds;\n if (parentIds) {\n return endConditionCallback(hierarchy, instanceIndex);\n }\n if (parentCounts > 0) {\n return traverseHierarchyMultipleParents(hierarchy, instanceIndex, endConditionCallback);\n }\n return traverseHierarchySingleParent(hierarchy, instanceIndex, endConditionCallback);\n}\n// eslint-disable-next-line max-statements\nfunction traverseHierarchyMultipleParents(hierarchy, instanceIndex, endConditionCallback) {\n const classIds = hierarchy.classIds;\n const parentCounts = hierarchy.parentCounts;\n const parentIds = hierarchy.parentIds;\n const parentIndexes = hierarchy.parentIndexes;\n const instancesLength = classIds.length;\n // Ignore instances that have already been visited. This occurs in diamond inheritance situations.\n // Use a marker value to indicate that an instance has been visited, which increments with each run.\n // This is more efficient than clearing the visited array every time.\n const visited = scratchVisited;\n visited.length = Math.max(visited.length, instancesLength);\n const visitedMarker = ++marker;\n const stack = scratchStack;\n stack.length = 0;\n stack.push(instanceIndex);\n while (stack.length > 0) {\n instanceIndex = stack.pop();\n if (visited[instanceIndex] === visitedMarker) {\n // This instance has already been visited, stop traversal\n continue;\n }\n visited[instanceIndex] = visitedMarker;\n const result = endConditionCallback(hierarchy, instanceIndex);\n if (defined(result)) {\n // The end condition was met, stop the traversal and return the result\n return result;\n }\n const parentCount = parentCounts[instanceIndex];\n const parentIndex = parentIndexes[instanceIndex];\n for (let i = 0; i < parentCount; ++i) {\n const parentId = parentIds[parentIndex + i];\n // Stop the traversal when the instance has no parent (its parentId equals itself)\n // else add the parent to the stack to continue the traversal.\n if (parentId !== instanceIndex) {\n stack.push(parentId);\n }\n }\n }\n return null;\n}\nfunction traverseHierarchySingleParent(hierarchy, instanceIndex, endConditionCallback) {\n let hasParent = true;\n while (hasParent) {\n const result = endConditionCallback(hierarchy, instanceIndex);\n if (defined(result)) {\n // The end condition was met, stop the traversal and return the result\n return result;\n }\n const parentId = hierarchy.parentIds[instanceIndex];\n hasParent = parentId !== instanceIndex;\n instanceIndex = parentId;\n }\n throw new Error('traverseHierarchySingleParent');\n}\n// DEBUG CODE\nfunction validateHierarchy(hierarchy) {\n const scratchValidateStack = [];\n const classIds = hierarchy.classIds;\n const instancesLength = classIds.length;\n for (let i = 0; i < instancesLength; ++i) {\n validateInstance(hierarchy, i, stack);\n }\n}\nfunction validateInstance(hierarchy, instanceIndex, stack) {\n const parentCounts = hierarchy.parentCounts;\n const parentIds = hierarchy.parentIds;\n const parentIndexes = hierarchy.parentIndexes;\n const classIds = hierarchy.classIds;\n const instancesLength = classIds.length;\n if (!defined(parentIds)) {\n // No need to validate if there are no parents\n return;\n }\n assert(instanceIndex < instancesLength, `Parent index ${instanceIndex} exceeds the total number of instances: ${instancesLength}`);\n assert(stack.indexOf(instanceIndex) === -1, 'Circular dependency detected in the batch table hierarchy.');\n stack.push(instanceIndex);\n const parentCount = defined(parentCounts) ? parentCounts[instanceIndex] : 1;\n const parentIndex = defined(parentCounts) ? parentIndexes[instanceIndex] : instanceIndex;\n for (let i = 0; i < parentCount; ++i) {\n const parentId = parentIds[parentIndex + i];\n // Stop the traversal when the instance has no parent (its parentId equals itself), else continue the traversal.\n if (parentId !== instanceIndex) {\n validateInstance(hierarchy, parentId, stack);\n }\n }\n stack.pop(instanceIndex);\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND Apache-2.0\n// Copyright vis.gl contributors\nconst SIZEOF_UINT32 = 4;\n/* PARSE FIXED HEADER:\nPopulates\n magic, // identifies type of tile\n type, // String version of magic\n version,\n byteLength\n */\nexport function parse3DTileHeaderSync(tile, arrayBuffer, byteOffset = 0) {\n const view = new DataView(arrayBuffer);\n tile.magic = view.getUint32(byteOffset, true);\n byteOffset += SIZEOF_UINT32;\n tile.version = view.getUint32(byteOffset, true);\n byteOffset += SIZEOF_UINT32;\n tile.byteLength = view.getUint32(byteOffset, true);\n byteOffset += SIZEOF_UINT32;\n // TODO - move version check into each tile parser?\n if (tile.version !== 1) {\n throw new Error(`3D Tile Version ${tile.version} not supported`);\n }\n return byteOffset; // Indicates where the parsing ended\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND Apache-2.0\n// Copyright vis.gl contributors\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\nimport { getStringFromArrayBuffer } from \"./parse-utils.js\";\nconst SIZEOF_UINT32 = 4;\nconst DEPRECATION_WARNING = 'b3dm tile in legacy format.';\n// eslint-disable-next-line max-statements\nexport function parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset) {\n const view = new DataView(arrayBuffer);\n let batchLength;\n tile.header = tile.header || {};\n let featureTableJsonByteLength = view.getUint32(byteOffset, true);\n byteOffset += SIZEOF_UINT32;\n let featureTableBinaryByteLength = view.getUint32(byteOffset, true);\n byteOffset += SIZEOF_UINT32;\n let batchTableJsonByteLength = view.getUint32(byteOffset, true);\n byteOffset += SIZEOF_UINT32;\n let batchTableBinaryByteLength = view.getUint32(byteOffset, true);\n byteOffset += SIZEOF_UINT32;\n // First legacy header format - [batchLength] [batchTableByteLength] ('batchTableJsonByteLength': JSON starts with a quotation mark or the glTF magic)\n // Second legacy format - [batchTableJsonByteLength] [batchTableBinaryByteLength] [batchLength] (Second legacy format is similar as first but here we check 'batchTableBinaryByteLength' instead)\n // Current header format - [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength]\n // First byte will be 0x22 or 0x67. The minimum uint32 expected is 0x22000000 = 570425344 = 570MB.\n if (batchTableJsonByteLength >= 570425344) {\n byteOffset -= SIZEOF_UINT32 * 2;\n batchLength = featureTableJsonByteLength;\n batchTableJsonByteLength = featureTableBinaryByteLength;\n batchTableBinaryByteLength = 0;\n featureTableJsonByteLength = 0;\n featureTableBinaryByteLength = 0;\n console.warn(DEPRECATION_WARNING); // eslint-disable-line\n }\n else if (batchTableBinaryByteLength >= 570425344) {\n byteOffset -= SIZEOF_UINT32;\n batchLength = batchTableJsonByteLength;\n batchTableJsonByteLength = featureTableJsonByteLength;\n batchTableBinaryByteLength = featureTableBinaryByteLength;\n featureTableJsonByteLength = 0;\n featureTableBinaryByteLength = 0;\n console.warn(DEPRECATION_WARNING); // eslint-disable-line\n }\n tile.header.featureTableJsonByteLength = featureTableJsonByteLength;\n tile.header.featureTableBinaryByteLength = featureTableBinaryByteLength;\n tile.header.batchTableJsonByteLength = batchTableJsonByteLength;\n tile.header.batchTableBinaryByteLength = batchTableBinaryByteLength;\n tile.header.batchLength = batchLength;\n return byteOffset;\n}\nexport function parse3DTileTablesSync(tile, arrayBuffer, byteOffset, options) {\n byteOffset = parse3DTileFeatureTable(tile, arrayBuffer, byteOffset, options);\n byteOffset = parse3DTileBatchTable(tile, arrayBuffer, byteOffset, options);\n return byteOffset;\n}\nfunction parse3DTileFeatureTable(tile, arrayBuffer, byteOffset, options) {\n const { featureTableJsonByteLength, featureTableBinaryByteLength, batchLength } = tile.header || {};\n tile.featureTableJson = {\n BATCH_LENGTH: batchLength || 0\n };\n if (featureTableJsonByteLength && featureTableJsonByteLength > 0) {\n const featureTableString = getStringFromArrayBuffer(arrayBuffer, byteOffset, featureTableJsonByteLength);\n tile.featureTableJson = JSON.parse(featureTableString);\n }\n byteOffset += featureTableJsonByteLength || 0;\n tile.featureTableBinary = new Uint8Array(arrayBuffer, byteOffset, featureTableBinaryByteLength);\n byteOffset += featureTableBinaryByteLength || 0;\n /*\n const featureTable = parseFeatureTable(featureTableJson, featureTableBinary);\n \n const batchLength = featureTable.getGlobalProperty('BATCH_LENGTH');\n featureTable.featuresLength = batchLength;\n */\n return byteOffset;\n}\nfunction parse3DTileBatchTable(tile, arrayBuffer, byteOffset, options) {\n const { batchTableJsonByteLength, batchTableBinaryByteLength } = tile.header || {};\n if (batchTableJsonByteLength && batchTableJsonByteLength > 0) {\n const batchTableString = getStringFromArrayBuffer(arrayBuffer, byteOffset, batchTableJsonByteLength);\n tile.batchTableJson = JSON.parse(batchTableString);\n byteOffset += batchTableJsonByteLength;\n if (batchTableBinaryByteLength && batchTableBinaryByteLength > 0) {\n // Has a batch table binary\n tile.batchTableBinary = new Uint8Array(arrayBuffer, byteOffset, batchTableBinaryByteLength);\n // Copy the batchTableBinary section and let the underlying ArrayBuffer be freed\n tile.batchTableBinary = new Uint8Array(tile.batchTableBinary);\n byteOffset += batchTableBinaryByteLength;\n }\n }\n return byteOffset;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { decodeRGB565, GL } from '@loaders.gl/math';\n/* eslint-disable complexity*/\nexport function normalize3DTileColorAttribute(tile, colors, batchTable) {\n // no colors defined\n if (!colors && (!tile || !tile.batchIds || !batchTable)) {\n return null;\n }\n const { batchIds, isRGB565, pointCount = 0 } = tile;\n // Batch table, look up colors in table\n if (batchIds && batchTable) {\n const colorArray = new Uint8ClampedArray(pointCount * 3);\n for (let i = 0; i < pointCount; i++) {\n const batchId = batchIds[i];\n // TODO figure out what is `dimensions` used for\n const dimensions = batchTable.getProperty(batchId, 'dimensions');\n const color = dimensions.map((d) => d * 255);\n colorArray[i * 3] = color[0];\n colorArray[i * 3 + 1] = color[1];\n colorArray[i * 3 + 2] = color[2];\n }\n return {\n type: GL.UNSIGNED_BYTE,\n value: colorArray,\n size: 3,\n normalized: true\n };\n }\n // RGB565 case, convert to RGB\n if (colors && isRGB565) {\n const colorArray = new Uint8ClampedArray(pointCount * 3);\n for (let i = 0; i < pointCount; i++) {\n const color = decodeRGB565(colors[i]);\n colorArray[i * 3] = color[0];\n colorArray[i * 3 + 1] = color[1];\n colorArray[i * 3 + 2] = color[2];\n }\n return {\n type: GL.UNSIGNED_BYTE,\n value: colorArray,\n size: 3,\n normalized: true\n };\n }\n // RGB case (tile.isTranslucent)\n if (colors && colors.length === pointCount * 3) {\n return {\n type: GL.UNSIGNED_BYTE,\n value: colors,\n size: 3,\n normalized: true\n };\n }\n // DEFAULT: RGBA case\n return {\n type: GL.UNSIGNED_BYTE,\n value: colors || new Uint8ClampedArray(),\n size: 4,\n normalized: true\n };\n}\n/* eslint-enable complexity*/\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { Vector3 } from '@math.gl/core';\nimport { GL, octDecode } from '@loaders.gl/math';\nconst scratchNormal = new Vector3();\nexport function normalize3DTileNormalAttribute(tile, normals) {\n if (!normals) {\n return null;\n }\n if (tile.isOctEncoded16P) {\n const decodedArray = new Float32Array((tile.pointsLength || 0) * 3);\n for (let i = 0; i < (tile.pointsLength || 0); i++) {\n octDecode(normals[i * 2], normals[i * 2 + 1], scratchNormal);\n // @ts-ignore\n scratchNormal.toArray(decodedArray, i * 3);\n }\n return {\n type: GL.FLOAT,\n size: 2,\n value: decodedArray\n };\n }\n return {\n type: GL.FLOAT,\n size: 2,\n value: normals\n };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { Vector3 } from '@math.gl/core';\nimport { GL } from '@loaders.gl/math';\n// Prepare attribute for positions\nexport function normalize3DTilePositionAttribute(tile, positions, options) {\n if (!tile.isQuantized) {\n return positions;\n }\n // For quantized posititions, either expand to Float32Array or return custom accessor\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/specification/TileFormats/Instanced3DModel/README.md#quantized-positions\n // Optionally decodes quantized positions on GPU, for simpler renderers that don't accept normalized attributes\n if (options['3d-tiles'] && options['3d-tiles'].decodeQuantizedPositions) {\n tile.isQuantized = false;\n return decodeQuantizedPositions(tile, positions);\n }\n // Default: Use normalized shorts directly, no copying/processing.\n // NOTE: The \"missing\" offset/scaling operations are automatically added to modelMatrix if `tile.isQuantized === true`\n return {\n type: GL.UNSIGNED_SHORT,\n value: positions,\n size: 3,\n normalized: true\n };\n}\n// Pre-scale quantized positions on CPU\nfunction decodeQuantizedPositions(tile, positions) {\n const scratchPosition = new Vector3();\n const decodedArray = new Float32Array(tile.pointCount * 3);\n for (let i = 0; i < tile.pointCount; i++) {\n // POSITION = POSITION_QUANTIZED / 65535.0 * QUANTIZED_VOLUME_SCALE + QUANTIZED_VOLUME_OFFSET\n scratchPosition\n .set(positions[i * 3], positions[i * 3 + 1], positions[i * 3 + 2])\n .scale(1 / tile.quantizedRange)\n .multiply(tile.quantizedVolumeScale)\n .add(tile.quantizedVolumeOffset)\n .toArray(decodedArray, i * 3);\n }\n return decodedArray;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND Apache-2.0\n// Copyright vis.gl contributors\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\nimport { GL } from '@loaders.gl/math'; // math.gl/geometry;\nimport Tile3DFeatureTable from \"../classes/tile-3d-feature-table.js\";\n// import Tile3DBatchTable from '../classes/tile-3d-batch-table';\nimport { parse3DTileHeaderSync } from \"./helpers/parse-3d-tile-header.js\";\nimport { parse3DTileTablesHeaderSync, parse3DTileTablesSync } from \"./helpers/parse-3d-tile-tables.js\";\nimport { parse3DTileGLTFViewSync, extractGLTF, GLTF_FORMAT } from \"./helpers/parse-3d-tile-gltf-view.js\";\nexport async function parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context) {\n byteOffset = parseBatchedModel(tile, arrayBuffer, byteOffset, options, context);\n await extractGLTF(tile, GLTF_FORMAT.EMBEDDED, options, context);\n const extensions = tile?.gltf?.extensions;\n if (extensions && extensions.CESIUM_RTC) {\n tile.rtcCenter = extensions.CESIUM_RTC.center;\n }\n return byteOffset;\n}\nfunction parseBatchedModel(tile, arrayBuffer, byteOffset, options, context) {\n byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);\n byteOffset = parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset);\n byteOffset = parse3DTileTablesSync(tile, arrayBuffer, byteOffset, options);\n byteOffset = parse3DTileGLTFViewSync(tile, arrayBuffer, byteOffset, options);\n const featureTable = new Tile3DFeatureTable(tile.featureTableJson, tile.featureTableBinary);\n tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', GL.FLOAT, 3);\n return byteOffset;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND Apache-2.0\n// Copyright vis.gl contributors\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n// TODO - should we automatically parse the embedded glTF or leave it to the app?\n// - I.e. some apps might work directly on a GLB, in that case no need for us to decode...\n// - And if we decode, do we still keep the GLB in case it is needed?\n// - Do we add an option to control this?\n// - Also, should we have hard dependency on gltf module or use injection or auto-discovery for gltf parser?\nimport { GLTFLoader, postProcessGLTF, _getMemoryUsageGLTF } from '@loaders.gl/gltf';\nimport { sliceArrayBuffer, parseFromContext } from '@loaders.gl/loader-utils';\nexport const GLTF_FORMAT = {\n URI: 0,\n EMBEDDED: 1\n};\nexport function parse3DTileGLTFViewSync(tile, arrayBuffer, byteOffset, options) {\n // Set flags\n // glTF models need to be rotated from Y to Z up\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up\n tile.rotateYtoZ = true;\n // Assume glTF consumes rest of tile\n const gltfByteLength = (tile.byteOffset || 0) + (tile.byteLength || 0) - byteOffset;\n if (gltfByteLength === 0) {\n throw new Error('glTF byte length must be greater than 0.');\n }\n // Save gltf up axis\n tile.gltfUpAxis =\n options?.['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis\n ? options['3d-tiles'].assetGltfUpAxis\n : 'Y';\n // TODO - We can avoid copy if already 4-byte aligned...\n // However the rest of the code may not be able to accept byteOffsets, so copy anyway\n tile.gltfArrayBuffer = sliceArrayBuffer(arrayBuffer, byteOffset, gltfByteLength);\n tile.gltfByteOffset = 0;\n tile.gltfByteLength = gltfByteLength;\n if (byteOffset % 4 === 0) {\n // tile.gltfArrayBuffer = arrayBuffer;\n // tile.gltfByteOffset = byteOffset;\n // tile.gltfByteLength = gltfByteLength;\n }\n else {\n // Create a copy of the glb so that it is 4-byte aligned\n // eslint-disable-next-line\n console.warn(`${tile.type}: embedded glb is not aligned to a 4-byte boundary.`);\n }\n // Entire tile is consumed\n return (tile.byteOffset || 0) + (tile.byteLength || 0);\n}\nexport async function extractGLTF(tile, gltfFormat, options, context) {\n const tile3DOptions = options?.['3d-tiles'] || {};\n extractGLTFBufferOrURL(tile, gltfFormat, options);\n if (tile3DOptions.loadGLTF) {\n if (!context) {\n return;\n }\n if (tile.gltfUrl) {\n const { fetch } = context;\n const response = await fetch(tile.gltfUrl, options);\n tile.gltfArrayBuffer = await response.arrayBuffer();\n tile.gltfByteOffset = 0;\n }\n if (tile.gltfArrayBuffer) {\n // TODO - Should handle byteOffset... However, not used now...\n const gltfWithBuffers = await parseFromContext(tile.gltfArrayBuffer, GLTFLoader, options, context);\n tile.gltf = postProcessGLTF(gltfWithBuffers);\n tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);\n delete tile.gltfArrayBuffer;\n delete tile.gltfByteOffset;\n delete tile.gltfByteLength;\n }\n }\n}\nfunction extractGLTFBufferOrURL(tile, gltfFormat, options) {\n switch (gltfFormat) {\n case GLTF_FORMAT.URI:\n // We need to remove padding from the end of the model URL in case this tile was part of a composite tile.\n // This removes all white space and null characters from the end of the string.\n if (tile.gltfArrayBuffer) {\n const gltfUrlBytes = new Uint8Array(tile.gltfArrayBuffer, tile.gltfByteOffset);\n const textDecoder = new TextDecoder();\n const gltfUrl = textDecoder.decode(gltfUrlBytes);\n tile.gltfUrl = gltfUrl.replace(/[\\s\\0]+$/, '');\n }\n delete tile.gltfArrayBuffer;\n delete tile.gltfByteOffset;\n delete tile.gltfByteLength;\n break;\n case GLTF_FORMAT.EMBEDDED:\n break;\n default:\n throw new Error('b3dm: Illegal glTF format field');\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND Apache-2.0\n// Copyright vis.gl contributors\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\nimport { Vector3, Matrix3, Matrix4, Quaternion } from '@math.gl/core';\nimport { Ellipsoid } from '@math.gl/geospatial';\nimport { GL } from '@loaders.gl/math'; // 'math.gl/geometry';\nimport Tile3DFeatureTable from \"../classes/tile-3d-feature-table.js\";\nimport Tile3DBatchTable from \"../classes/tile-3d-batch-table.js\";\nimport { parse3DTileHeaderSync } from \"./helpers/parse-3d-tile-header.js\";\nimport { parse3DTileTablesHeaderSync, parse3DTileTablesSync } from \"./helpers/parse-3d-tile-tables.js\";\nimport { parse3DTileGLTFViewSync, extractGLTF } from \"./helpers/parse-3d-tile-gltf-view.js\";\nexport async function parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context) {\n byteOffset = parseInstancedModel(tile, arrayBuffer, byteOffset, options, context);\n await extractGLTF(tile, tile.gltfFormat || 0, options, context);\n return byteOffset;\n}\nfunction parseInstancedModel(tile, arrayBuffer, byteOffset, options, context) {\n byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);\n if (tile.version !== 1) {\n throw new Error(`Instanced 3D Model version ${tile.version} is not supported`);\n }\n byteOffset = parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset);\n const view = new DataView(arrayBuffer);\n tile.gltfFormat = view.getUint32(byteOffset, true);\n byteOffset += 4;\n // PARSE FEATURE TABLE\n byteOffset = parse3DTileTablesSync(tile, arrayBuffer, byteOffset, options);\n byteOffset = parse3DTileGLTFViewSync(tile, arrayBuffer, byteOffset, options);\n // TODO - Is the feature table sometimes optional or can check be moved into table header parser?\n if (!tile?.header?.featureTableJsonByteLength || tile.header.featureTableJsonByteLength === 0) {\n throw new Error('i3dm parser: featureTableJsonByteLength is zero.');\n }\n const featureTable = new Tile3DFeatureTable(tile.featureTableJson, tile.featureTableBinary);\n const instancesLength = featureTable.getGlobalProperty('INSTANCES_LENGTH');\n featureTable.featuresLength = instancesLength;\n if (!Number.isFinite(instancesLength)) {\n throw new Error('i3dm parser: INSTANCES_LENGTH must be defined');\n }\n tile.eastNorthUp = featureTable.getGlobalProperty('EAST_NORTH_UP');\n tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', GL.FLOAT, 3);\n const batchTable = new Tile3DBatchTable(tile.batchTableJson, tile.batchTableBinary, instancesLength);\n extractInstancedAttributes(tile, featureTable, batchTable, instancesLength);\n return byteOffset;\n}\n// eslint-disable-next-line max-statements, complexity\nfunction extractInstancedAttributes(tile, featureTable, batchTable, instancesLength) {\n const instances = new Array(instancesLength);\n const instancePosition = new Vector3();\n const instanceNormalRight = new Vector3();\n const instanceNormalUp = new Vector3();\n const instanceNormalForward = new Vector3();\n const instanceRotation = new Matrix3();\n const instanceQuaternion = new Quaternion();\n const instanceScale = new Vector3();\n const instanceTranslationRotationScale = {};\n const instanceTransform = new Matrix4();\n const scratch1 = [];\n const scratch2 = [];\n const scratch3 = [];\n const scratch4 = [];\n for (let i = 0; i < instancesLength; i++) {\n let position;\n // Get the instance position\n if (featureTable.hasProperty('POSITION')) {\n position = featureTable.getProperty('POSITION', GL.FLOAT, 3, i, instancePosition);\n }\n else if (featureTable.hasProperty('POSITION_QUANTIZED')) {\n position = featureTable.getProperty('POSITION_QUANTIZED', GL.UNSIGNED_SHORT, 3, i, instancePosition);\n const quantizedVolumeOffset = featureTable.getGlobalProperty('QUANTIZED_VOLUME_OFFSET', GL.FLOAT, 3);\n if (!quantizedVolumeOffset) {\n throw new Error('i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.');\n }\n const quantizedVolumeScale = featureTable.getGlobalProperty('QUANTIZED_VOLUME_SCALE', GL.FLOAT, 3);\n if (!quantizedVolumeScale) {\n throw new Error('i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.');\n }\n const MAX_UNSIGNED_SHORT = 65535.0;\n for (let j = 0; j < 3; j++) {\n position[j] =\n (position[j] / MAX_UNSIGNED_SHORT) * quantizedVolumeScale[j] + quantizedVolumeOffset[j];\n }\n }\n if (!position) {\n throw new Error('i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.');\n }\n instancePosition.copy(position);\n // @ts-expect-error\n instanceTranslationRotationScale.translation = instancePosition;\n // Get the instance rotation\n tile.normalUp = featureTable.getProperty('NORMAL_UP', GL.FLOAT, 3, i, scratch1);\n tile.normalRight = featureTable.getProperty('NORMAL_RIGHT', GL.FLOAT, 3, i, scratch2);\n const hasCustomOrientation = false;\n if (tile.normalUp) {\n if (!tile.normalRight) {\n throw new Error('i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.');\n }\n // Vector3.unpack(normalUp, 0, instanceNormalUp);\n // Vector3.unpack(normalRight, 0, instanceNormalRight);\n tile.hasCustomOrientation = true;\n }\n else {\n tile.octNormalUp = featureTable.getProperty('NORMAL_UP_OCT32P', GL.UNSIGNED_SHORT, 2, i, scratch1);\n tile.octNormalRight = featureTable.getProperty('NORMAL_RIGHT_OCT32P', GL.UNSIGNED_SHORT, 2, i, scratch2);\n if (tile.octNormalUp) {\n if (!tile.octNormalRight) {\n throw new Error('i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P');\n }\n throw new Error('i3dm: oct-encoded orientation not implemented');\n /*\n AttributeCompression.octDecodeInRange(octNormalUp[0], octNormalUp[1], 65535, instanceNormalUp);\n AttributeCompression.octDecodeInRange(octNormalRight[0], octNormalRight[1], 65535, instanceNormalRight);\n hasCustomOrientation = true;\n */\n }\n else if (tile.eastNorthUp) {\n Ellipsoid.WGS84.eastNorthUpToFixedFrame(instancePosition, instanceTransform);\n instanceTransform.getRotationMatrix3(instanceRotation);\n }\n else {\n instanceRotation.identity();\n }\n }\n if (hasCustomOrientation) {\n instanceNormalForward.copy(instanceNormalRight).cross(instanceNormalUp).normalize();\n instanceRotation.setColumn(0, instanceNormalRight);\n instanceRotation.setColumn(1, instanceNormalUp);\n instanceRotation.setColumn(2, instanceNormalForward);\n }\n instanceQuaternion.fromMatrix3(instanceRotation);\n // @ts-expect-error\n instanceTranslationRotationScale.rotation = instanceQuaternion;\n // Get the instance scale\n instanceScale.set(1.0, 1.0, 1.0);\n const scale = featureTable.getProperty('SCALE', GL.FLOAT, 1, i, scratch3);\n if (Number.isFinite(scale)) {\n instanceScale.multiplyByScalar(scale);\n }\n const nonUniformScale = featureTable.getProperty('SCALE_NON_UNIFORM', GL.FLOAT, 3, i, scratch1);\n if (nonUniformScale) {\n instanceScale.scale(nonUniformScale);\n }\n // @ts-expect-error\n instanceTranslationRotationScale.scale = instanceScale;\n // Get the batchId\n let batchId = featureTable.getProperty('BATCH_ID', GL.UNSIGNED_SHORT, 1, i, scratch4);\n if (batchId === undefined) {\n // If BATCH_ID semantic is undefined, batchId is just the instance number\n batchId = i;\n }\n // @ts-expect-error\n const rotationMatrix = new Matrix4().fromQuaternion(instanceTranslationRotationScale.rotation);\n // Create the model matrix and the instance\n instanceTransform.identity();\n // @ts-expect-error\n instanceTransform.translate(instanceTranslationRotationScale.translation);\n instanceTransform.multiplyRight(rotationMatrix);\n // @ts-expect-error\n instanceTransform.scale(instanceTranslationRotationScale.scale);\n const modelMatrix = instanceTransform.clone();\n instances[i] = {\n modelMatrix,\n batchId\n };\n }\n tile.instances = instances;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND Apache-2.0\n// Copyright vis.gl contributors\nimport { parse3DTileHeaderSync } from \"./helpers/parse-3d-tile-header.js\";\n// eslint-disable-next-line max-params\nexport async function parseComposite3DTile(tile, arrayBuffer, byteOffset, options, context, parse3DTile) {\n byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);\n const view = new DataView(arrayBuffer);\n // Extract number of tiles\n tile.tilesLength = view.getUint32(byteOffset, true);\n byteOffset += 4;\n // extract each tile from the byte stream\n tile.tiles = [];\n while (tile.tiles.length < tile.tilesLength && (tile.byteLength || 0) - byteOffset > 12) {\n const subtile = { shape: 'tile3d' };\n tile.tiles.push(subtile);\n byteOffset = await parse3DTile(arrayBuffer, byteOffset, options, context, subtile);\n // TODO - do we need to add any padding in between tiles?\n }\n return byteOffset;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT license\n// Copyright (c) vis.gl contributors\nimport { parseFromContext } from '@loaders.gl/loader-utils';\nimport { _getMemoryUsageGLTF, GLTFLoader, postProcessGLTF } from '@loaders.gl/gltf';\nexport async function parseGltf3DTile(tile, arrayBuffer, options, context) {\n // Set flags\n // glTF models need to be rotated from Y to Z up\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up\n tile.rotateYtoZ = true;\n // Save gltf up axis\n tile.gltfUpAxis = options?.['3d-tiles']?.assetGltfUpAxis\n ? options['3d-tiles'].assetGltfUpAxis\n : 'Y';\n if (options?.['3d-tiles']?.loadGLTF) {\n if (!context) {\n return arrayBuffer.byteLength;\n }\n const gltfWithBuffers = await parseFromContext(arrayBuffer, GLTFLoader, options, context);\n tile.gltf = postProcessGLTF(gltfWithBuffers);\n tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);\n }\n else {\n tile.gltfArrayBuffer = arrayBuffer;\n }\n return arrayBuffer.byteLength;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND Apache-2.0\n// Copyright vis.gl contributors\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\nimport { TILE3D_TYPE } from \"../constants.js\";\nimport { getMagicString } from \"./helpers/parse-utils.js\";\nimport { parsePointCloud3DTile } from \"./parse-3d-tile-point-cloud.js\";\nimport { parseBatchedModel3DTile } from \"./parse-3d-tile-batched-model.js\";\nimport { parseInstancedModel3DTile } from \"./parse-3d-tile-instanced-model.js\";\nimport { parseComposite3DTile } from \"./parse-3d-tile-composite.js\";\nimport { parseGltf3DTile } from \"./parse-3d-tile-gltf.js\";\n// Extracts\nexport async function parse3DTile(arrayBuffer, byteOffset = 0, options, context, tile = { shape: 'tile3d' }) {\n tile.byteOffset = byteOffset;\n tile.type = getMagicString(arrayBuffer, byteOffset);\n switch (tile.type) {\n case TILE3D_TYPE.COMPOSITE:\n // Note: We pass this function as argument so that embedded tiles can be parsed recursively\n return await parseComposite3DTile(tile, arrayBuffer, byteOffset, options, context, parse3DTile);\n case TILE3D_TYPE.BATCHED_3D_MODEL:\n return await parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context);\n case TILE3D_TYPE.GLTF:\n return await parseGltf3DTile(tile, arrayBuffer, options, context);\n case TILE3D_TYPE.INSTANCED_3D_MODEL:\n return await parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context);\n case TILE3D_TYPE.POINT_CLOUD:\n return await parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context);\n default:\n throw new Error(`3DTileLoader: unknown type ${tile.type}`); // eslint-disable-line\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { path } from '@loaders.gl/loader-utils';\nimport { Tile3DSubtreeLoader } from \"../../tile-3d-subtree-loader.js\";\nimport { load } from '@loaders.gl/core';\nimport { LOD_METRIC_TYPE, TILE_REFINEMENT, TILE_TYPE } from '@loaders.gl/tiles';\nimport { parseImplicitTiles, replaceContentUrlTemplate } from \"./helpers/parse-3d-implicit-tiles.js\";\nimport { convertS2BoundingVolumetoOBB } from \"../utils/obb/s2-corners-to-obb.js\";\nfunction getTileType(tile, tileContentUrl = '') {\n if (!tileContentUrl) {\n return TILE_TYPE.EMPTY;\n }\n const contentUrl = tileContentUrl.split('?')[0]; // Discard query string\n const fileExtension = contentUrl.split('.').pop();\n switch (fileExtension) {\n case 'pnts':\n return TILE_TYPE.POINTCLOUD;\n case 'i3dm':\n case 'b3dm':\n case 'glb':\n case 'gltf':\n return TILE_TYPE.SCENEGRAPH;\n default:\n return fileExtension || TILE_TYPE.EMPTY;\n }\n}\nfunction getRefine(refine) {\n switch (refine) {\n case 'REPLACE':\n case 'replace':\n return TILE_REFINEMENT.REPLACE;\n case 'ADD':\n case 'add':\n return TILE_REFINEMENT.ADD;\n default:\n return refine;\n }\n}\nfunction resolveUri(uri, basePath) {\n // url scheme per RFC3986\n const urlSchemeRegex = /^[a-z][0-9a-z+.-]*:/i;\n if (urlSchemeRegex.test(basePath)) {\n const url = new URL(uri, `${basePath}/`);\n return decodeURI(url.toString());\n }\n else if (uri.startsWith('/')) {\n return uri;\n }\n return path.resolve(basePath, uri);\n}\nexport function normalizeTileData(tile, basePath) {\n if (!tile) {\n return null;\n }\n let tileContentUrl;\n if (tile.content) {\n const contentUri = tile.content.uri || tile.content?.url;\n if (typeof contentUri !== 'undefined') {\n // sparse implicit tilesets may not define content for all nodes\n tileContentUrl = resolveUri(contentUri, basePath);\n }\n }\n const tilePostprocessed = {\n ...tile,\n id: tileContentUrl,\n contentUrl: tileContentUrl,\n lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,\n lodMetricValue: tile.geometricError,\n transformMatrix: tile.transform,\n type: getTileType(tile, tileContentUrl),\n refine: getRefine(tile.refine)\n };\n return tilePostprocessed;\n}\n// normalize tile headers\nexport async function normalizeTileHeaders(tileset, basePath, options) {\n let root = null;\n const rootImplicitTilingExtension = getImplicitTilingExtensionData(tileset.root);\n if (rootImplicitTilingExtension && tileset.root) {\n root = await normalizeImplicitTileHeaders(tileset.root, tileset, basePath, rootImplicitTilingExtension, options);\n }\n else {\n root = normalizeTileData(tileset.root, basePath);\n }\n const stack = [];\n stack.push(root);\n while (stack.length > 0) {\n const tile = stack.pop() || {};\n const children = tile.children || [];\n const childrenPostprocessed = [];\n for (const childHeader of children) {\n const childImplicitTilingExtension = getImplicitTilingExtensionData(childHeader);\n let childHeaderPostprocessed;\n if (childImplicitTilingExtension) {\n childHeaderPostprocessed = await normalizeImplicitTileHeaders(childHeader, tileset, basePath, childImplicitTilingExtension, options);\n }\n else {\n childHeaderPostprocessed = normalizeTileData(childHeader, basePath);\n }\n if (childHeaderPostprocessed) {\n childrenPostprocessed.push(childHeaderPostprocessed);\n stack.push(childHeaderPostprocessed);\n }\n }\n tile.children = childrenPostprocessed;\n }\n return root;\n}\n/**\n * Do normalisation of implicit tile headers\n * TODO Check if Tile3D class can be a return type here.\n * @param tileset\n */\nexport async function normalizeImplicitTileHeaders(tile, tileset, basePath, implicitTilingExtension, options) {\n const { subdivisionScheme, maximumLevel, availableLevels, subtreeLevels, subtrees: { uri: subtreesUriTemplate } } = implicitTilingExtension;\n const replacedUrlTemplate = replaceContentUrlTemplate(subtreesUriTemplate, 0, 0, 0, 0);\n const subtreeUrl = resolveUri(replacedUrlTemplate, basePath);\n const subtree = await load(subtreeUrl, Tile3DSubtreeLoader, options);\n const tileContentUri = tile.content?.uri;\n const contentUrlTemplate = tileContentUri ? resolveUri(tileContentUri, basePath) : '';\n const refine = tileset?.root?.refine;\n // @ts-ignore\n const rootLodMetricValue = tile.geometricError;\n // Replace tile.boundingVolume with the the bounding volume specified by the extensions['3DTILES_bounding_volume_S2']\n const s2VolumeInfo = tile.boundingVolume.extensions?.['3DTILES_bounding_volume_S2'];\n if (s2VolumeInfo) {\n const box = convertS2BoundingVolumetoOBB(s2VolumeInfo);\n const s2VolumeBox = { box, s2VolumeInfo };\n tile.boundingVolume = s2VolumeBox;\n }\n const rootBoundingVolume = tile.boundingVolume;\n const implicitOptions = {\n contentUrlTemplate,\n subtreesUriTemplate,\n subdivisionScheme,\n subtreeLevels,\n maximumLevel: Number.isFinite(availableLevels) ? availableLevels - 1 : maximumLevel,\n refine,\n basePath,\n lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,\n rootLodMetricValue,\n rootBoundingVolume,\n getTileType,\n getRefine\n };\n return await normalizeImplicitTileData(tile, basePath, subtree, implicitOptions, options);\n}\n/**\n * Do implicit data normalisation to create hierarchical tile structure\n * @param tile\n * @param rootSubtree\n * @param options\n * @returns\n */\nexport async function normalizeImplicitTileData(tile, basePath, rootSubtree, implicitOptions, loaderOptions) {\n if (!tile) {\n return null;\n }\n const { children, contentUrl } = await parseImplicitTiles({\n subtree: rootSubtree,\n implicitOptions,\n loaderOptions\n });\n let tileContentUrl;\n let tileContent = null;\n if (contentUrl) {\n tileContentUrl = contentUrl;\n tileContent = { uri: contentUrl.replace(`${basePath}/`, '') };\n }\n const tilePostprocessed = {\n ...tile,\n id: tileContentUrl,\n contentUrl: tileContentUrl,\n lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,\n lodMetricValue: tile.geometricError,\n transformMatrix: tile.transform,\n type: getTileType(tile, tileContentUrl),\n refine: getRefine(tile.refine),\n content: tileContent || tile.content,\n children\n };\n return tilePostprocessed;\n}\n/**\n * Implicit Tiling data can be in 3DTILES_implicit_tiling for 3DTiles v.Next or directly in implicitTiling object for 3DTiles v1.1.\n * Spec 3DTiles v.Next - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling\n * Spec 3DTiles v.1.1 - https://github.com/CesiumGS/3d-tiles/tree/draft-1.1/specification/ImplicitTiling\n * @param tile\n * @returns\n */\nfunction getImplicitTilingExtensionData(tile) {\n return tile?.extensions?.['3DTILES_implicit_tiling'] || tile?.implicitTiling;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nconst SUBTREE_FILE_MAGIC = 0x74627573;\nconst SUBTREE_FILE_VERSION = 1;\n/**\n * Parse subtree file\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling#subtree-file-format\n * @param data\n * @returns\n */\n// eslint-disable-next-line max-statements\nexport default async function parse3DTilesSubtree(data, options, context) {\n const magic = new Uint32Array(data.slice(0, 4));\n if (magic[0] !== SUBTREE_FILE_MAGIC) {\n throw new Error('Wrong subtree file magic number');\n }\n const version = new Uint32Array(data.slice(4, 8));\n if (version[0] !== SUBTREE_FILE_VERSION) {\n throw new Error('Wrong subtree file verson, must be 1');\n }\n const jsonByteLength = parseUint64Value(data.slice(8, 16));\n const stringAttribute = new Uint8Array(data, 24, jsonByteLength);\n const textDecoder = new TextDecoder('utf8');\n const string = textDecoder.decode(stringAttribute);\n const subtree = JSON.parse(string);\n const binaryByteLength = parseUint64Value(data.slice(16, 24));\n let internalBinaryBuffer = new ArrayBuffer(0);\n if (binaryByteLength) {\n internalBinaryBuffer = data.slice(24 + jsonByteLength);\n }\n await loadExplicitBitstream(subtree, subtree.tileAvailability, internalBinaryBuffer, context);\n if (Array.isArray(subtree.contentAvailability)) {\n for (const contentAvailability of subtree.contentAvailability) {\n await loadExplicitBitstream(subtree, contentAvailability, internalBinaryBuffer, context);\n }\n }\n else {\n await loadExplicitBitstream(subtree, subtree.contentAvailability, internalBinaryBuffer, context);\n }\n await loadExplicitBitstream(subtree, subtree.childSubtreeAvailability, internalBinaryBuffer, context);\n return subtree;\n}\n/**\n * Load explicit bitstream for subtree availability data.\n * @param subtree - subtree data\n * @param availabilityObject - tileAvailability / contentAvailability / childSubtreeAvailability object\n * @param internalBinaryBuffer - subtree binary buffer\n * @param context - loaders.gl context\n */\nexport async function loadExplicitBitstream(subtree, availabilityObject, internalBinaryBuffer, context) {\n const bufferViewIndex = Number.isFinite(availabilityObject.bitstream)\n ? availabilityObject.bitstream\n : availabilityObject.bufferView;\n if (typeof bufferViewIndex !== 'number') {\n return;\n }\n const bufferView = subtree.bufferViews[bufferViewIndex];\n const buffer = subtree.buffers[bufferView.buffer];\n if (!context?.baseUrl) {\n throw new Error('Url is not provided');\n }\n if (!context.fetch) {\n throw new Error('fetch is not provided');\n }\n // External bitstream loading\n if (buffer.uri) {\n const bufferUri = `${context?.baseUrl || ''}/${buffer.uri}`;\n const response = await context.fetch(bufferUri);\n const data = await response.arrayBuffer();\n availabilityObject.explicitBitstream = new Uint8Array(data, bufferView.byteOffset, bufferView.byteLength);\n return;\n }\n const bufferStart = subtree.buffers\n .slice(0, bufferView.buffer)\n .reduce((offset, buf) => offset + buf.byteLength, 0);\n availabilityObject.explicitBitstream = new Uint8Array(internalBinaryBuffer.slice(bufferStart, bufferStart + buffer.byteLength), bufferView.byteOffset, bufferView.byteLength);\n}\n/**\n * Parse buffer to return uint64 value\n * @param buffer\n * @returns 64-bit value until precision is lost after Number.MAX_SAFE_INTEGER\n */\nfunction parseUint64Value(buffer) {\n const dataView = new DataView(buffer);\n const left = dataView.getUint32(0, true);\n const right = dataView.getUint32(4, true);\n // combine the two 32-bit values\n return left + 2 ** 32 * right;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport parse3DTilesSubtree from \"./lib/parsers/helpers/parse-3d-tile-subtree.js\";\nimport { VERSION } from \"./lib/utils/version.js\";\n/**\n * Loader for 3D Tiles Subtree\n */\nexport const Tile3DSubtreeLoader = {\n dataType: null,\n batchType: null,\n id: '3d-tiles-subtree',\n name: '3D Tiles Subtree',\n module: '3d-tiles',\n version: VERSION,\n extensions: ['subtree'],\n mimeTypes: ['application/octet-stream'],\n tests: ['subtree'],\n parse: parse3DTilesSubtree,\n options: {}\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { Tile3DSubtreeLoader } from \"../../../tile-3d-subtree-loader.js\";\nimport { load } from '@loaders.gl/core';\nimport { default as log } from '@probe.gl/log';\nimport { getS2CellIdFromToken, getS2ChildCellId, getS2TokenFromCellId } from \"../../utils/s2/index.js\";\nimport { convertS2BoundingVolumetoOBB } from \"../../utils/obb/s2-corners-to-obb.js\";\nconst QUADTREE_DIVISION_COUNT = 4;\nconst OCTREE_DIVISION_COUNT = 8;\nconst SUBDIVISION_COUNT_MAP = {\n QUADTREE: QUADTREE_DIVISION_COUNT,\n OCTREE: OCTREE_DIVISION_COUNT\n};\nfunction getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme) {\n if (s2VolumeBox?.box) {\n // Check if the BoundingVolume is of type \"box\"\n const cellId = getS2CellIdFromToken(s2VolumeBox.s2VolumeInfo.token);\n const childCellId = getS2ChildCellId(cellId, index);\n const childToken = getS2TokenFromCellId(childCellId);\n // Clone object. Note, s2VolumeInfo is a plain object that doesn't contain any nested object.\n // So, we can use the Spread Operator to make a shallow copy of the object.\n const s2ChildVolumeInfo = { ...s2VolumeBox.s2VolumeInfo };\n s2ChildVolumeInfo.token = childToken; // replace the token with the child's one\n // In case of QUADTREE the sizeZ should NOT be changed!\n // https://portal.ogc.org/files/102132\n // A quadtree divides space only on the x and y dimensions.\n // It divides each tile into 4 smaller tiles where the x and y dimensions are halved.\n // The quadtree z minimum and maximum remain unchanged.\n switch (subdivisionScheme) {\n case 'OCTREE':\n const s2VolumeInfo = s2VolumeBox.s2VolumeInfo;\n const delta = s2VolumeInfo.maximumHeight - s2VolumeInfo.minimumHeight;\n const sizeZ = delta / 2.0; // It's a next level (a child)\n const midZ = s2VolumeInfo.minimumHeight + delta / 2.0;\n s2VolumeInfo.minimumHeight = midZ - sizeZ;\n s2VolumeInfo.maximumHeight = midZ + sizeZ;\n break;\n default:\n break;\n }\n const box = convertS2BoundingVolumetoOBB(s2ChildVolumeInfo);\n const childS2VolumeBox = {\n box,\n s2VolumeInfo: s2ChildVolumeInfo\n };\n return childS2VolumeBox;\n }\n return undefined;\n}\n/**\n * Recursively parse implicit tiles tree\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling\n * TODO Check out do we able to use Tile3D class as return type here.\n *\n * @param subtree - the current subtree. Subtrees contain availability data for .\n * Once we go deeper than that many levels, we will need load a child subtree to get further availability data.\n * @param subtreeData - the coordinates of the current subtree, relative to the root of this implicit tiles tree.\n * @param parentData - the coordinates of the parent tile, relative to the current subtree.\n * The overall coordinates of the current tile can be found by combining the coordinates of the current subtree, the parent tile,\n * and tje single-bit coordinates that can be calculated from the childIndex.\n * @param childIndex - which child the current tile is of its parent. In the range 0-7 for OCTREE, 0-3 for QUADTREE.\n * @param implicitOptions - options specified at the root of this implicit tile tree - numbers of levels, URL templates.\n * @param loaderOptions - see Tiles3DLoaderOptions.\n */\n// eslint-disable-next-line max-statements, complexity\nexport async function parseImplicitTiles(params) {\n const { subtree, subtreeData = {\n level: 0,\n x: 0,\n y: 0,\n z: 0\n }, parentData = {\n mortonIndex: 0,\n localLevel: -1,\n localX: 0,\n localY: 0,\n localZ: 0\n }, childIndex = 0, implicitOptions, loaderOptions, s2VolumeBox } = params;\n const { subdivisionScheme, subtreeLevels, maximumLevel, contentUrlTemplate, subtreesUriTemplate, basePath } = implicitOptions;\n const tile = { children: [], lodMetricValue: 0, contentUrl: '' };\n if (!maximumLevel) {\n log.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${contentUrlTemplate} won't be loaded...`);\n return tile;\n }\n // Local tile level - relative to the current subtree.\n const localLevel = parentData.localLevel + 1;\n // Global tile level - relative to the root tile of this implicit subdivision scheme.\n const level = subtreeData.level + localLevel;\n if (level > maximumLevel) {\n return tile;\n }\n const childrenPerTile = SUBDIVISION_COUNT_MAP[subdivisionScheme];\n const bitsPerTile = Math.log2(childrenPerTile);\n // childIndex is in range 0...3 for quadtrees and 0...7 for octrees\n const lastBitX = childIndex & 0b01; // Get first bit for X\n const lastBitY = (childIndex >> 1) & 0b01; // Get second bit for Y\n const lastBitZ = (childIndex >> 2) & 0b01; // Get third bit for Z\n // Local tile coordinates - relative to the current subtree root.\n const localX = concatBits(parentData.localX, lastBitX, 1);\n const localY = concatBits(parentData.localY, lastBitY, 1);\n const localZ = concatBits(parentData.localZ, lastBitZ, 1);\n // Global tile coordinates - relative to the implicit-tile-tree root.\n // Found by combining the local coordinates which are relative to the current subtree, with the subtree coordinates.\n const x = concatBits(subtreeData.x, localX, localLevel);\n const y = concatBits(subtreeData.y, localY, localLevel);\n const z = concatBits(subtreeData.z, localZ, localLevel);\n const mortonIndex = concatBits(parentData.mortonIndex, childIndex, bitsPerTile);\n const isChildSubtreeAvailable = localLevel === subtreeLevels &&\n getAvailabilityResult(subtree.childSubtreeAvailability, mortonIndex);\n // Context to provide the next recursive call.\n // This context is set up differently depending on whether its time to start a new subtree or not.\n let nextSubtree;\n let nextSubtreeData;\n let nextParentData;\n let tileAvailabilityIndex;\n if (isChildSubtreeAvailable) {\n const subtreePath = `${basePath}/${subtreesUriTemplate}`;\n const childSubtreeUrl = replaceContentUrlTemplate(subtreePath, level, x, y, z);\n const childSubtree = await load(childSubtreeUrl, Tile3DSubtreeLoader, loaderOptions);\n // The next subtree is the newly-loaded child subtree.\n nextSubtree = childSubtree;\n // The current tile is actually the root tile in the next subtree, so it has a tileAvailabilityIndex of 0.\n tileAvailabilityIndex = 0;\n // The next subtree starts HERE - at the current tile.\n nextSubtreeData = { level, x, y, z };\n // The next parent is also the current tile - so it has local coordinates of 0 relative to the next subtree.\n nextParentData = { mortonIndex: 0, localLevel: 0, localX: 0, localY: 0, localZ: 0 };\n }\n else {\n // Continue on with the same subtree as we're using currently.\n nextSubtree = subtree;\n // Calculate a tileAvailabilityIndex for the current tile within the current subtree.\n const levelOffset = (childrenPerTile ** localLevel - 1) / (childrenPerTile - 1);\n tileAvailabilityIndex = levelOffset + mortonIndex;\n // The next subtree is the same as the current subtree.\n nextSubtreeData = subtreeData;\n // The next parent is the current tile: it has the local coordinates we already calculated.\n nextParentData = { mortonIndex, localLevel, localX, localY, localZ };\n }\n const isTileAvailable = getAvailabilityResult(nextSubtree.tileAvailability, tileAvailabilityIndex);\n if (!isTileAvailable) {\n return tile;\n }\n const isContentAvailable = getAvailabilityResult(nextSubtree.contentAvailability, tileAvailabilityIndex);\n if (isContentAvailable) {\n tile.contentUrl = replaceContentUrlTemplate(contentUrlTemplate, level, x, y, z);\n }\n for (let index = 0; index < childrenPerTile; index++) {\n const childS2VolumeBox = getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme);\n // Recursive calling...\n const childTile = await parseImplicitTiles({\n subtree: nextSubtree,\n subtreeData: nextSubtreeData,\n parentData: nextParentData,\n childIndex: index,\n implicitOptions,\n loaderOptions,\n s2VolumeBox: childS2VolumeBox\n });\n if (childTile.contentUrl || childTile.children.length) {\n // @ts-ignore\n tile.children.push(childTile);\n }\n }\n if (tile.contentUrl || tile.children.length) {\n const coordinates = { level, x, y, z };\n const formattedTile = formatTileData(tile, coordinates, implicitOptions, s2VolumeBox);\n return formattedTile;\n }\n return tile;\n}\n/**\n * Check tile availability in the bitstream array\n * @param availabilityData - tileAvailability / contentAvailability / childSubtreeAvailability object\n * @param index - index in the bitstream array\n * @returns\n */\nfunction getAvailabilityResult(availabilityData, index) {\n let availabilityObject;\n if (Array.isArray(availabilityData)) {\n /** TODO: we don't support `3DTILES_multiple_contents` extension at the moment.\n * https://github.com/CesiumGS/3d-tiles/blob/main/extensions/3DTILES_implicit_tiling/README.md#multiple-contents\n * Take first item in the array\n */\n availabilityObject = availabilityData[0];\n if (availabilityData.length > 1) {\n // eslint-disable-next-line no-console\n log.once('Not supported extension \"3DTILES_multiple_contents\" has been detected');\n }\n }\n else {\n availabilityObject = availabilityData;\n }\n if ('constant' in availabilityObject) {\n return Boolean(availabilityObject.constant);\n }\n if (availabilityObject.explicitBitstream) {\n return getBooleanValueFromBitstream(index, availabilityObject.explicitBitstream);\n }\n return false;\n}\n/**\n * Do formatting of implicit tile data.\n * TODO Check out do we able to use Tile3D class as type here.\n *\n * @param tile - tile data to format.\n * @param coordinates - global tile coordinates (relative to the root of the implicit tile tree).\n * @param options - options specified at the root of this implicit tile tree - numbers of levels, URL templates.\n * @param s2VolumeBox - the S2VolumeBox for this particular child, if available.\n * @returns\n */\nfunction formatTileData(tile, coordinates, options, s2VolumeBox) {\n const { basePath, refine, getRefine, lodMetricType, getTileType, rootLodMetricValue, rootBoundingVolume } = options;\n const uri = tile.contentUrl && tile.contentUrl.replace(`${basePath}/`, '');\n const lodMetricValue = rootLodMetricValue / 2 ** coordinates.level;\n const boundingVolume = s2VolumeBox?.box\n ? { box: s2VolumeBox.box }\n : rootBoundingVolume;\n const boundingVolumeForChildTile = calculateBoundingVolumeForChildTile(boundingVolume, coordinates, options.subdivisionScheme);\n return {\n children: tile.children,\n contentUrl: tile.contentUrl,\n content: { uri },\n id: tile.contentUrl,\n refine: getRefine(refine),\n type: getTileType(tile),\n lodMetricType,\n lodMetricValue,\n geometricError: lodMetricValue,\n transform: tile.transform,\n boundingVolume: boundingVolumeForChildTile\n };\n}\n/**\n * Calculate child bounding volume.\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling#subdivision-rules\n * @param rootBoundingVolume\n * @param coordinates\n * @param subdivisionScheme\n */\nfunction calculateBoundingVolumeForChildTile(rootBoundingVolume, coordinates, subdivisionScheme) {\n if (rootBoundingVolume.region) {\n const { level, x, y, z } = coordinates;\n const [west, south, east, north, minimumHeight, maximumHeight] = rootBoundingVolume.region;\n const boundingVolumesCount = 2 ** level;\n const sizeX = (east - west) / boundingVolumesCount;\n const [childWest, childEast] = [west + sizeX * x, west + sizeX * (x + 1)];\n const sizeY = (north - south) / boundingVolumesCount;\n const [childSouth, childNorth] = [south + sizeY * y, south + sizeY * (y + 1)];\n // In case of QUADTREE the sizeZ should NOT be changed!\n // https://portal.ogc.org/files/102132\n // A quadtree divides space only on the x and y dimensions.\n // It divides each tile into 4 smaller tiles where the x and y dimensions are halved.\n // The quadtree z minimum and maximum remain unchanged.\n let childMinimumHeight;\n let childMaximumHeight;\n if (subdivisionScheme === 'OCTREE') {\n const sizeZ = (maximumHeight - minimumHeight) / boundingVolumesCount;\n [childMinimumHeight, childMaximumHeight] = [\n minimumHeight + sizeZ * z,\n minimumHeight + sizeZ * (z + 1)\n ];\n }\n else {\n [childMinimumHeight, childMaximumHeight] = [minimumHeight, maximumHeight];\n }\n return {\n region: [childWest, childSouth, childEast, childNorth, childMinimumHeight, childMaximumHeight]\n };\n }\n if (rootBoundingVolume.box) {\n return rootBoundingVolume;\n }\n throw new Error(`Unsupported bounding volume type ${JSON.stringify(rootBoundingVolume)}`);\n}\n/**\n * Do binary concatenation\n * @param higher - number to put to higher part of result\n * @param lower - number to put to lower part of result\n * @param shift - number of bits to shift lower number\n */\nfunction concatBits(higher, lower, shift) {\n return (higher << shift) + lower;\n}\n/**\n * Replace implicit tile content url with real coordinates.\n * @param templateUrl\n * @param level\n * @param x\n * @param y\n * @param z\n */\nexport function replaceContentUrlTemplate(templateUrl, level, x, y, z) {\n const mapUrl = generateMapUrl({ level, x, y, z });\n return templateUrl.replace(/{level}|{x}|{y}|{z}/gi, (matched) => mapUrl[matched]);\n}\n/**\n * Get Map object for content url generation\n * @param items\n */\nfunction generateMapUrl(items) {\n const mapUrl = {};\n for (const key in items) {\n mapUrl[`{${key}}`] = items[key];\n }\n return mapUrl;\n}\n/**\n * Get boolean value from bistream by index\n * A boolean value is encoded as a single bit, either 0 (false) or 1 (true).\n * Multiple boolean values are packed tightly in the same buffer.\n * These buffers of tightly-packed bits are sometimes referred to as bitstreams.\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/implicit-revisions/specification/Metadata#booleans\n * @param availabilitiIndex\n */\nfunction getBooleanValueFromBitstream(availabilityIndex, availabilityBuffer) {\n const byteIndex = Math.floor(availabilityIndex / 8);\n const bitIndex = availabilityIndex % 8;\n const bitValue = (availabilityBuffer[byteIndex] >> bitIndex) & 1;\n return bitValue === 1;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport Long from 'long';\nconst MAXIMUM_TOKEN_LENGTH = 16;\n/**\n * Convert the S2 token to the S2 cell ID\n * @param token {string} A string that is the cell's hex token. Zero cell ID is represented as 'X'.\n * @returns {Long} Cell id that is a 64-bit encoding of a face and a Hilbert curve parameter on that face.\n * See {@link https://github.com/google/s2-geometry-library-java/blob/c04b68bf3197a9c34082327eeb3aec7ab7c85da1/src/com/google/common/geometry/S2CellId.java#L439} for more information\n */\nexport function getS2CellIdFromToken(token) {\n if (token === 'X') {\n token = '';\n }\n // pad token with zeros to make the length 16 that is defined in MAXIMUM_TOKEN_LENGTH\n const paddedToken = token.padEnd(MAXIMUM_TOKEN_LENGTH, '0');\n return Long.fromString(paddedToken, true, 16); // Hex base\n}\n/**\n * Convert the S2 cell ID to the S2 token\n * @param cellId {Long} A 64-bit encoding of a face and a Hilbert curve parameter on that face.\n * @returns {string} A string that is the cell's hex token. Zero cell ID is represented as 'X'.\n */\nexport function getS2TokenFromCellId(cellId) {\n if (cellId.isZero()) {\n return 'X';\n }\n let numZeroDigits = cellId.countTrailingZeros();\n const remainder = numZeroDigits % 4;\n numZeroDigits = (numZeroDigits - remainder) / 4;\n const trailingZeroHexChars = numZeroDigits;\n numZeroDigits *= 4;\n const x = cellId.shiftRightUnsigned(numZeroDigits);\n const hexString = x.toString(16).replace(/0+$/, '');\n const zeroString = Array(17 - trailingZeroHexChars - hexString.length).join('0');\n return zeroString + hexString;\n}\n/**\n * Get one of four S2 cell's children.\n * @param cellId {Long} A 64-bit encoding of a face and a Hilbert curve parameter on that face.\n * The cell must NOT be a leaf one. So, the cell's level is in the range [0-29].\n * @param index {number} Child index defines one of four S2 cell's children. Must be in the range [0-3].\n * @returns The ID of the cell's child.\n */\nexport function getS2ChildCellId(cellId, index) {\n // Shift sentinel bit 2 positions to the right.\n const newLsb = lsb(cellId).shiftRightUnsigned(2);\n // Insert child index before the sentinel bit.\n const childCellId = cellId.add(Long.fromNumber(2 * index + 1 - 4).multiply(newLsb));\n return childCellId;\n}\n/**\n * Return the lowest-numbered bit that is on for this cell id.\n * @private\n * @param cellId {Long} Cell id.\n * @returns {Long} The lowest-numbered bit that is on for this cell id.\n */\nfunction lsb(cellId) {\n return cellId.and(cellId.not().add(1)); // eslint-disable-line\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND ISC\n// Copyright vis.gl contributors\n/*\nAdapted from s2-geometry under ISC License (ISC)\nCopyright (c) 2012-2016, Jon Atkins \nCopyright (c) 2016, AJ ONeal \nPermission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n*/\nimport Long from 'long';\n//\n// Functional Style\n//\nconst FACE_BITS = 3;\nconst MAX_LEVEL = 30;\nconst POS_BITS = 2 * MAX_LEVEL + 1; // 61 (60 bits of data, 1 bit lsb marker)\nconst RADIAN_TO_DEGREE = 180 / Math.PI;\n/**\n * Return the S2Cell\n * @param hilbertQuadkey {string} A string that is the Hilbert quad key (containing /)\n * @returns {@link S2Cell}\n */\n// eslint-disable-next-line max-statements\nexport function getS2CellFromQuadKey(hilbertQuadkey) {\n if (hilbertQuadkey.length === 0) {\n throw new Error(`Invalid Hilbert quad key ${hilbertQuadkey}`);\n }\n const parts = hilbertQuadkey.split('/');\n const face = parseInt(parts[0], 10); // face is in the range [0..5]\n const position = parts[1]; // position is in the range [0..4**30-1]\n const maxLevel = position.length;\n let level = 0;\n const point = [0, 0];\n for (let i = maxLevel - 1; i >= 0; i--) {\n level = maxLevel - i;\n const bit = position[i];\n let rx = 0;\n let ry = 0;\n if (bit === '1') {\n ry = 1;\n }\n else if (bit === '2') {\n rx = 1;\n ry = 1;\n }\n else if (bit === '3') {\n rx = 1;\n }\n const val = Math.pow(2, level - 1);\n rotateAndFlipQuadrant(val, point, rx, ry);\n point[0] += val * rx;\n point[1] += val * ry;\n }\n if (face % 2 === 1) {\n const t = point[0];\n point[0] = point[1];\n point[1] = t;\n }\n return { face, ij: point, level };\n}\n/**\n * Convets S2 cell ID to the Hilbert quad key\n * @param cellId {Long} Cell id that is a 64-bit encoding of a face and a Hilbert curve parameter on that face\n * @returns {string} the Hilbert quad key (containing /) as a string in the format 'face/pos', where\n * - face is a 10-base representation of the face number\n * - pos is a 4-base representation of the position along the Hilbert curve. For example,\n * pos == '13' means the following:\n * The face is divided two times. After the first time the child cell with position 1 will be selected.\n * Then, this cell will be divided the second time, and the child cell with position 3 will be selected.\n */\nexport function getS2QuadkeyFromCellId(cellId) {\n if (cellId.isZero()) {\n // Invalid token\n return '';\n }\n let bin = cellId.toString(2);\n while (bin.length < FACE_BITS + POS_BITS) {\n // eslint-disable-next-line prefer-template\n bin = '0' + bin;\n }\n // MUST come AFTER binstr has been left-padded with '0's\n const lsbIndex = bin.lastIndexOf('1');\n // substring(start, end) // includes start, does not include end\n const faceB = bin.substring(0, 3);\n // posB will always be a multiple of 2 (or it's invalid)\n const posB = bin.substring(3, lsbIndex);\n const levelN = posB.length / 2;\n const faceS = Long.fromString(faceB, true, 2).toString(10);\n /*\n Here is a fix for the case when posB is an empty string that causes an exception in Long.fromString\n */\n let posS = '';\n if (levelN !== 0) {\n // posB is not an empty string, because levelN !== 0\n posS = Long.fromString(posB, true, 2).toString(4);\n while (posS.length < levelN) {\n // eslint-disable-next-line prefer-template\n posS = '0' + posS;\n }\n }\n // Note, posS will be \"\" for the level==0, which corresponds to the full face.\n // Example: Full face 0 (No subdivision, so level==0): Returns \"0/\"\n // TODO: Is it ok?\n return `${faceS}/${posS}`;\n}\n/**\n * Convets S2 the Hilbert quad key to cell ID.\n * @param quadkey {string} The Hilbert quad key (containing /) as a string in the format 'face/pos'\n * @returns {Long} Cell id that is a 64-bit encoding of a face and a Hilbert curve parameter on that face\n */\n/* eslint complexity: [\"error\", { \"max\": 14 }] */\nexport function getS2CellIdFromQuadkey(hilbertQuadkey) {\n if (hilbertQuadkey.length === 0 || hilbertQuadkey.indexOf('/') !== 1) {\n throw new Error(`Invalid Hilbert quad key ${hilbertQuadkey}`);\n }\n let idS = '';\n const faceS = hilbertQuadkey[0];\n switch (faceS) {\n case '0':\n idS += '000';\n break;\n case '1':\n idS += '001';\n break;\n case '2':\n idS += '010';\n break;\n case '3':\n idS += '011';\n break;\n case '4':\n idS += '100';\n break;\n case '5':\n idS += '101';\n break;\n default:\n throw new Error(`Invalid Hilbert quad key ${hilbertQuadkey}`);\n }\n const maxLevel = hilbertQuadkey.length;\n // Don't convert position to Long, because it can contain leading zeros, which makes you handle it later.\n for (let i = 2; i < maxLevel; i++) {\n // The first char is a face, the second char is '/'\n const p = hilbertQuadkey[i];\n switch (p) {\n case '0':\n idS += '00';\n break;\n case '1':\n idS += '01';\n break;\n case '2':\n idS += '10';\n break;\n case '3':\n idS += '11';\n break;\n default:\n throw new Error(`Invalid Hilbert quad key ${hilbertQuadkey}`);\n }\n }\n // Append the sentinel bit\n idS += '1';\n const paddedId = idS.padEnd(64, '0');\n const id = Long.fromString(paddedId, true, 2);\n return id;\n}\nexport function IJToST(ij, level, offsets) {\n const maxSize = 1 << level;\n return [(ij[0] + offsets[0]) / maxSize, (ij[1] + offsets[1]) / maxSize];\n}\nfunction singleSTtoUV(st) {\n if (st >= 0.5) {\n return (1 / 3.0) * (4 * st * st - 1);\n }\n return (1 / 3.0) * (1 - 4 * (1 - st) * (1 - st));\n}\nexport function STToUV(st) {\n return [singleSTtoUV(st[0]), singleSTtoUV(st[1])];\n}\nexport function FaceUVToXYZ(face, [u, v]) {\n switch (face) {\n case 0:\n return [1, u, v];\n case 1:\n return [-u, 1, v];\n case 2:\n return [-u, -v, 1];\n case 3:\n return [-1, -v, -u];\n case 4:\n return [v, -1, -u];\n case 5:\n return [v, u, -1];\n default:\n throw new Error('Invalid face');\n }\n}\nexport function XYZToLngLat([x, y, z]) {\n const lat = Math.atan2(z, Math.sqrt(x * x + y * y));\n const lng = Math.atan2(y, x);\n return [lng * RADIAN_TO_DEGREE, lat * RADIAN_TO_DEGREE];\n}\nfunction rotateAndFlipQuadrant(n, point, rx, ry) {\n if (ry === 0) {\n if (rx === 1) {\n point[0] = n - 1 - point[0];\n point[1] = n - 1 - point[1];\n }\n const x = point[0];\n point[0] = point[1];\n point[1] = x;\n }\n}\n/**\n * Retrieve S2 geometry center\n * @param s2cell {S2Cell} S2 cell\n * @returns {[number, number]} Longitude and Latitude coordinates of the S2 cell's center\n */\nexport function getS2LngLatFromS2Cell(s2Cell) {\n const st = IJToST(s2Cell.ij, s2Cell.level, [0.5, 0.5]);\n const uv = STToUV(st);\n const xyz = FaceUVToXYZ(s2Cell.face, uv);\n return XYZToLngLat(xyz);\n}\n/**\n * Return longitude and latitude of four corners of the cell.\n * @param s2Cell {S2Cell} S2 cell\n * @returns {Array<[number, number]>} Array of longitude and latitude pairs (in degrees) for four corners of the cell.\n */\nexport function getCornerLngLats(s2Cell) {\n const result = [];\n const offsets = [\n [0.0, 0.0],\n [0.0, 1.0],\n [1.0, 1.0],\n [1.0, 0.0]\n ];\n for (let i = 0; i < 4; i++) {\n const st = IJToST(s2Cell.ij, s2Cell.level, offsets[i]);\n const uv = STToUV(st);\n const xyz = FaceUVToXYZ(s2Cell.face, uv);\n result.push(XYZToLngLat(xyz));\n }\n return result;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { IJToST, STToUV, FaceUVToXYZ, XYZToLngLat } from \"../s2geometry/s2-geometry.js\";\nconst MAX_RESOLUTION = 100;\n/**\n * Get a polygon with corner coordinates for an S2 cell\n * @param s2cell {S2Cell} S2 cell\n * @return {Float64Array} - a simple polygon in flat array format: [lng0, lat0, lng1, lat1, ...]\n * - the polygon is closed, i.e. last coordinate is a copy of the first coordinate\n */\n// eslint-disable-next-line max-statements\nexport function getS2BoundaryFlatFromS2Cell(s2cell) {\n const { face, ij, level } = s2cell;\n const offsets = [\n [0, 0],\n [0, 1],\n [1, 1],\n [1, 0],\n [0, 0]\n ];\n // The S2 cell edge is curved: http://s2geometry.io/\n // This is more prominent at lower levels\n // resolution is the number of segments to generate per edge.\n // We exponentially reduce resolution as level increases so it doesn't affect perf\n // when there are a large number of cells\n const resolution = Math.max(1, Math.ceil(MAX_RESOLUTION * Math.pow(2, -level)));\n const result = new Float64Array(4 * resolution * 2 + 2);\n let ptIndex = 0;\n let prevLng = 0;\n for (let i = 0; i < 4; i++) {\n const offset = offsets[i].slice(0);\n const nextOffset = offsets[i + 1];\n const stepI = (nextOffset[0] - offset[0]) / resolution;\n const stepJ = (nextOffset[1] - offset[1]) / resolution;\n for (let j = 0; j < resolution; j++) {\n offset[0] += stepI;\n offset[1] += stepJ;\n // Cell can be represented by coordinates IJ, ST, UV, XYZ\n // http://s2geometry.io/devguide/s2cell_hierarchy#coordinate-systems\n const st = IJToST(ij, level, offset);\n const uv = STToUV(st);\n const xyz = FaceUVToXYZ(face, uv);\n const lngLat = XYZToLngLat(xyz);\n // Adjust longitude for Web Mercator projection\n if (Math.abs(lngLat[1]) > 89.999) {\n lngLat[0] = prevLng;\n }\n const deltaLng = lngLat[0] - prevLng;\n lngLat[0] += deltaLng > 180 ? -360 : deltaLng < -180 ? 360 : 0;\n result[ptIndex++] = lngLat[0];\n result[ptIndex++] = lngLat[1];\n prevLng = lngLat[0];\n }\n }\n // close the loop\n result[ptIndex++] = result[0];\n result[ptIndex++] = result[1];\n return result;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { getS2CellFromQuadKey, getS2QuadkeyFromCellId } from \"./s2-geometry.js\";\nimport { getS2CellIdFromToken } from \"../s2-token-functions.js\";\n/**\n * Return the S2Cell from the cell's hex token or the Hilbert quad key\n * @param tokenOrKey {string} A string that is the cell's hex token or the Hilbert quad key (containing /)\n * @returns {@link S2Cell}\n */\nexport function getS2Cell(tokenOrKey) {\n const key = getS2QuadKey(tokenOrKey);\n const s2cell = getS2CellFromQuadKey(key);\n return s2cell;\n}\n/**\n * Get the underlying Hilbert quad key\n * @param tokenOrKey {string} A string that is the cell's hex token or the Hilbert quad key (containing /)\n * @returns Hilbert quad key\n */\nexport function getS2QuadKey(tokenOrKey) {\n if (tokenOrKey.indexOf('/') > 0) {\n // is Hilbert quad key\n return tokenOrKey;\n }\n // is S2 cell's hex token\n const id = getS2CellIdFromToken(tokenOrKey);\n return getS2QuadkeyFromCellId(id);\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { getS2BoundaryFlatFromS2Cell } from \"./converters/s2-to-boundary.js\";\nimport { getS2LngLatFromS2Cell } from \"./s2geometry/s2-geometry.js\";\nimport { getS2Cell } from \"./s2geometry/s2-cell-utils.js\";\n// GEOMETRY\n/**\n * Retrieve S2 geometry center\n * @param s2Token {string} A string that is the cell's hex token\n * @returns {[number, number]} Longitude and Latitude coordinates of the S2 cell's center\n */\nexport function getS2LngLat(s2Token) {\n const s2cell = getS2Cell(s2Token);\n return getS2LngLatFromS2Cell(s2cell);\n}\n/**\n * Get a polygon with corner coordinates for an s2 cell\n * @param tokenOrKey {string} A string that is the cell's hex token or the Hilbert quad key (containing /)\n * @return {Float64Array} - a simple polygon in flat array format: [lng0, lat0, lng1, lat1, ...]\n * - the polygon is closed, i.e. last coordinate is a copy of the first coordinate\n */\nexport function getS2BoundaryFlat(tokenOrKey) {\n const s2cell = getS2Cell(tokenOrKey);\n return getS2BoundaryFlatFromS2Cell(s2cell);\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { getS2BoundaryFlatFromS2Cell } from \"./s2-to-boundary.js\";\nimport { getS2Cell } from \"../s2geometry/s2-cell-utils.js\";\n/**\n * Converts S2 cell to the 2D region\n * @param s2cell {S2Cell} S2 cell to convert to 2D region\n * @returns 2D region as an object containing: west, north, east, south in degrees\n */\nexport function getS2Region(s2cell) {\n let region;\n if (s2cell.face === 2 || s2cell.face === 5) {\n // let corners: Float64Array;\n let corners = null;\n let len = 0;\n for (let i = 0; i < 4; i++) {\n const key = `${s2cell.face}/${i}`;\n const cell = getS2Cell(key);\n const corns = getS2BoundaryFlatFromS2Cell(cell);\n if (typeof corners === 'undefined' || corners === null)\n corners = new Float64Array(4 * corns.length);\n corners.set(corns, len);\n len += corns.length;\n }\n region = get2DRegionFromS2Corners(corners);\n }\n else {\n const corners = getS2BoundaryFlatFromS2Cell(s2cell);\n region = get2DRegionFromS2Corners(corners);\n }\n return region;\n}\n/**\n * Converts the S2 cell defined by its corners to the 2D region\n * @param corners {Float64Array} - a simple polygon in flat array format: [lng0, lat0, lng1, lat1, ...]\n * @returns 2D region as an object containing: west, north, east, south in degrees\n */\nfunction get2DRegionFromS2Corners(corners) {\n if (corners.length % 2 !== 0) {\n throw new Error('Invalid corners');\n }\n const longitudes = [];\n const latitudes = [];\n for (let i = 0; i < corners.length; i += 2) {\n longitudes.push(corners[i]);\n latitudes.push(corners[i + 1]);\n }\n longitudes.sort((a, b) => a - b);\n latitudes.sort((a, b) => a - b);\n // Return the region in degrees\n return {\n west: longitudes[0],\n east: longitudes[longitudes.length - 1],\n north: latitudes[latitudes.length - 1],\n south: latitudes[0]\n };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { getS2Cell } from \"../s2geometry/s2-cell-utils.js\";\nimport { getS2Region } from \"./s2-to-region.js\";\nimport { Vector3 } from '@math.gl/core';\n/**\n * Converts S2HeightInfo to corner points of an oriented bounding box\n * Can be used to constuct an OrientedBoundingBox instance\n * @param tokenOrKey {string} A string that is the cell's hex token or the Hilbert quad key (containing /)\n * @param heightInfo {S2HeightInfo} min and max height of the box\n * @returns corner points of the oriented bounding box\n */\nexport function getS2OrientedBoundingBoxCornerPoints(tokenOrKey, // This can be an S2 key or token\nheightInfo) {\n const min = heightInfo?.minimumHeight || 0;\n const max = heightInfo?.maximumHeight || 0;\n const s2cell = getS2Cell(tokenOrKey);\n const region = getS2Region(s2cell);\n // region lng/lat are in degrees\n const W = region.west;\n const S = region.south;\n const E = region.east;\n const N = region.north;\n const points = [];\n points.push(new Vector3(W, N, min));\n points.push(new Vector3(E, N, min));\n points.push(new Vector3(E, S, min));\n points.push(new Vector3(W, S, min));\n points.push(new Vector3(W, N, max));\n points.push(new Vector3(E, N, max));\n points.push(new Vector3(E, S, max));\n points.push(new Vector3(W, S, max));\n return points;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { Vector3 } from '@math.gl/core';\nimport { makeOrientedBoundingBoxFromPoints } from '@math.gl/culling';\nimport { getS2OrientedBoundingBoxCornerPoints, getS2LngLat } from \"../../utils/s2/index.js\";\nimport { Ellipsoid } from '@math.gl/geospatial';\n/**\n * Converts S2VolumeInfo to OrientedBoundingBox\n * @param {S2VolumeInfo} s2VolumeInfo - s2 volume to convert\n * @returns Oriented Bounding Box of type Box\n */\nexport function convertS2BoundingVolumetoOBB(s2VolumeInfo) {\n const token = s2VolumeInfo.token;\n const heightInfo = {\n minimumHeight: s2VolumeInfo.minimumHeight,\n maximumHeight: s2VolumeInfo.maximumHeight\n };\n const corners = getS2OrientedBoundingBoxCornerPoints(token, heightInfo);\n // Add a point that doesn't allow the box dive under the Earth\n const center = getS2LngLat(token);\n const centerLng = center[0];\n const centerLat = center[1];\n const point = Ellipsoid.WGS84.cartographicToCartesian([\n centerLng,\n centerLat,\n heightInfo.maximumHeight\n ]);\n const centerPointAdditional = new Vector3(point[0], point[1], point[2]);\n corners.push(centerPointAdditional);\n // corners should be an array of Vector3 (XYZ)\n const obb = makeOrientedBoundingBoxFromPoints(corners);\n const box = [...obb.center, ...obb.halfAxes];\n return box;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n// Minimal support to load tilsets from the Cesium ION services\nimport { fetchFile } from '@loaders.gl/core';\nimport { assert } from '@loaders.gl/loader-utils';\nconst CESIUM_ION_URL = 'https://api.cesium.com/v1/assets';\n// Returns `{url, headers, type, attributions}` for an ion tileset\nexport async function getIonTilesetMetadata(accessToken, assetId) {\n // Step 1, if no asset id, look for first 3DTILES asset associated with this token.\n if (!assetId) {\n const assets = await getIonAssets(accessToken);\n for (const item of assets.items) {\n if (item.type === '3DTILES') {\n assetId = item.id;\n }\n }\n }\n // Step 2: Query metdatadata for this asset.\n const ionAssetMetadata = await getIonAssetMetadata(accessToken, assetId);\n const { type, url } = ionAssetMetadata;\n assert(type === '3DTILES' && url);\n // Prepare a headers object for fetch\n ionAssetMetadata.headers = {\n Authorization: `Bearer ${ionAssetMetadata.accessToken}`\n };\n return ionAssetMetadata;\n}\n// Return a list of all assets associated with accessToken\nexport async function getIonAssets(accessToken) {\n assert(accessToken);\n const url = CESIUM_ION_URL;\n const headers = { Authorization: `Bearer ${accessToken}` };\n const response = await fetchFile(url, { headers });\n if (!response.ok) {\n throw new Error(response.statusText);\n }\n return await response.json();\n}\n// Return metadata for a specific asset associated with token\nexport async function getIonAssetMetadata(accessToken, assetId) {\n assert(accessToken, assetId);\n const headers = { Authorization: `Bearer ${accessToken}` };\n const url = `${CESIUM_ION_URL}/${assetId}`;\n // https://cesium.com/docs/rest-api/#operation/getAsset\n // Retrieves metadata information about a specific asset.\n let response = await fetchFile(`${url}`, { headers });\n if (!response.ok) {\n throw new Error(response.statusText);\n }\n let metadata = await response.json();\n // https://cesium.com/docs/rest-api/#operation/getAssetEndpoint\n // Retrieves information and credentials that allow you to access the tiled asset data for visualization and analysis.\n response = await fetchFile(`${url}/endpoint`, { headers });\n if (!response.ok) {\n throw new Error(response.statusText);\n }\n const tilesetInfo = await response.json();\n // extract dataset description\n metadata = {\n ...metadata,\n ...tilesetInfo\n };\n return metadata;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { Tiles3DLoader } from \"./tiles-3d-loader.js\";\nimport { getIonTilesetMetadata } from \"./lib/ion/ion.js\";\nasync function preload(url, options = {}) {\n options = options['cesium-ion'] || {};\n // @ts-ignore\n const { accessToken } = options;\n // @ts-ignore\n let assetId = options.assetId;\n if (!Number.isFinite(assetId)) {\n const matched = url.match(/\\/([0-9]+)\\/tileset.json/);\n assetId = matched && matched[1];\n }\n return getIonTilesetMetadata(accessToken, assetId);\n}\n/**\n * Loader for 3D tiles from Cesium ION\n */\nexport const CesiumIonLoader = {\n ...Tiles3DLoader,\n id: 'cesium-ion',\n name: 'Cesium Ion',\n // @ts-ignore\n preload,\n parse: async (data, options, context) => {\n options = { ...options };\n options['3d-tiles'] = options['cesium-ion'];\n // @ts-ignore\n options.loader = CesiumIonLoader;\n return Tiles3DLoader.parse(data, options, context); // , loader);\n },\n options: {\n 'cesium-ion': {\n ...Tiles3DLoader.options['3d-tiles'],\n accessToken: null\n }\n }\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { DataViewFile } from '@loaders.gl/loader-utils';\nimport { parse3DTilesArchive as parse3DTilesArchiveFromProvider } from \"./3d-tiles-archive/3d-tiles-archive-parser.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.3.1\" !== 'undefined' ? \"4.3.1\" : 'latest';\n/**\n * Loader for 3tz packages\n */\nexport const Tiles3DArchiveFileLoader = {\n dataType: null,\n batchType: null,\n name: '3tz',\n id: '3tz',\n module: '3d-tiles',\n version: VERSION,\n mimeTypes: ['application/octet-stream', 'application/vnd.maxar.archive.3tz+zip'],\n parse: parse3DTilesArchive,\n extensions: ['3tz'],\n options: {}\n};\n/**\n * returns a single file from the 3tz archive\n * @param data 3tz archive data\n * @param options options\n * @returns requested file\n */\nasync function parse3DTilesArchive(data, options = {}) {\n const archive = await parse3DTilesArchiveFromProvider(new DataViewFile(new DataView(data)));\n return archive.getFile(options['3d-tiles-archive']?.path ?? '');\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { CD_HEADER_SIGNATURE, makeHashTableFromZipHeaders, parseHashTable, parseZipCDFileHeader, parseZipLocalFileHeader, searchFromTheEnd } from '@loaders.gl/zip';\nimport { Tiles3DArchive } from \"./3d-tiles-archive-archive.js\";\n/**\n * Creates 3tz file handler from raw file\n * @param fileProvider raw file data\n * @param cb is called with information message during parsing\n * @returns 3tz file handler\n */\nexport const parse3DTilesArchive = async (fileProvider, cb) => {\n const hashCDOffset = await searchFromTheEnd(fileProvider, CD_HEADER_SIGNATURE);\n const cdFileHeader = await parseZipCDFileHeader(hashCDOffset, fileProvider);\n let hashTable;\n if (cdFileHeader?.fileName !== '@3dtilesIndex1@') {\n hashTable = await makeHashTableFromZipHeaders(fileProvider);\n cb?.('3tz doesnt contain hash file, hash info has been composed according to zip archive headers');\n }\n else {\n // cb?.('3tz contains hash file');\n const localFileHeader = await parseZipLocalFileHeader(cdFileHeader.localHeaderOffset, fileProvider);\n if (!localFileHeader) {\n throw new Error('corrupted 3tz zip archive');\n }\n const fileDataOffset = localFileHeader.fileDataOffset;\n const hashFile = await fileProvider.slice(fileDataOffset, fileDataOffset + localFileHeader.compressedSize);\n hashTable = parseHashTable(hashFile);\n }\n return new Tiles3DArchive(fileProvider, hashTable);\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { MD5Hash } from '@loaders.gl/crypto';\nimport { DeflateCompression, NoCompression } from '@loaders.gl/compression';\nimport { IndexedArchive, parseZipLocalFileHeader } from '@loaders.gl/zip';\n/**\n * Handling different compression types in zip\n */\nconst COMPRESSION_METHODS = {\n /** No compression */\n 0: (data) => new NoCompression().decompress(data),\n /** Deflation */\n 8: (data) => new DeflateCompression({ raw: true }).decompress(data)\n};\n/**\n * Class for handling information about 3tz file\n */\nexport class Tiles3DArchive extends IndexedArchive {\n /** hash info */\n hashTable;\n /**\n * creates Tiles3DArchive handler\n * @param fileProvider - FileProvider with the whole file\n * @param hashTable - hash info\n */\n constructor(fileProvider, hashTable, fileName) {\n super(fileProvider, hashTable, fileName);\n this.hashTable = hashTable;\n }\n /**\n * Returns file with the given path from 3tz archive\n * @param path - path inside the 3tz\n * @returns buffer with ready to use file\n */\n async getFile(path) {\n // sometimes paths are not in lower case when hash file is created,\n // so first we're looking for lower case file name and then for original one\n let data = await this.getFileBytes(path.toLocaleLowerCase());\n if (!data) {\n data = await this.getFileBytes(path);\n }\n if (!data) {\n throw new Error(`No such file in the archive: ${path}`);\n }\n return data;\n }\n /**\n * Trying to get raw file data by adress\n * @param path - path inside the archive\n * @returns buffer with the raw file data\n */\n async getFileBytes(path) {\n let uncompressedFile;\n if (this.hashTable) {\n const arrayBuffer = new TextEncoder().encode(path).buffer;\n const nameHash = await new MD5Hash().hash(arrayBuffer, 'hex');\n const byteOffset = this.hashTable[nameHash];\n if (byteOffset === undefined) {\n return null;\n }\n const localFileHeader = await parseZipLocalFileHeader(byteOffset, this.fileProvider);\n if (!localFileHeader) {\n return null;\n }\n const compressedFile = await this.fileProvider.slice(localFileHeader.fileDataOffset, localFileHeader.fileDataOffset + localFileHeader.compressedSize);\n const compressionMethod = COMPRESSION_METHODS[localFileHeader.compressionMethod];\n if (!compressionMethod) {\n throw Error('Only Deflation compression is supported');\n }\n uncompressedFile = await compressionMethod(compressedFile);\n }\n else {\n uncompressedFile = await this.getFileWithoutHash(path);\n }\n return uncompressedFile;\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND Apache-2.0\n// Copyright vis.gl contributors\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\nimport { TILE3D_TYPE } from \"../constants.js\";\nimport { assert } from '@loaders.gl/loader-utils';\nimport { encodeComposite3DTile } from \"./encode-3d-tile-composite.js\";\nimport { encodeBatchedModel3DTile } from \"./encode-3d-tile-batched-model.js\";\nimport { encodeInstancedModel3DTile } from \"./encode-3d-tile-instanced-model.js\";\nimport { encodePointCloud3DTile } from \"./encode-3d-tile-point-cloud.js\";\nexport default function encode3DTile(tile, options) {\n const byteLength = encode3DTileToDataView(tile, null, 0, options);\n const arrayBuffer = new ArrayBuffer(byteLength);\n const dataView = new DataView(arrayBuffer);\n encode3DTileToDataView(tile, dataView, 0, options);\n return arrayBuffer;\n}\nfunction encode3DTileToDataView(tile, dataView, byteOffset, options) {\n assert(typeof tile.type === 'string');\n switch (tile.type) {\n case TILE3D_TYPE.COMPOSITE:\n return encodeComposite3DTile(tile, dataView, byteOffset, options, encode3DTileToDataView);\n case TILE3D_TYPE.POINT_CLOUD:\n return encodePointCloud3DTile(tile, dataView, byteOffset, options);\n case TILE3D_TYPE.BATCHED_3D_MODEL:\n return encodeBatchedModel3DTile(tile, dataView, byteOffset, options);\n case TILE3D_TYPE.INSTANCED_3D_MODEL:\n return encodeInstancedModel3DTile(tile, dataView, byteOffset, options);\n default:\n throw new Error('3D Tiles: unknown tile type');\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n// HELPER ENCODERS\nimport { assert } from '@loaders.gl/loader-utils';\nexport function encode3DTileHeader(tile, dataView, byteOffset) {\n const HEADER_SIZE = 12;\n if (!dataView) {\n return byteOffset + HEADER_SIZE;\n }\n const { magic, version = 1, byteLength = 12 } = tile;\n assert(Array.isArray(magic) && Number.isFinite(version) && Number.isFinite(byteLength));\n dataView.setUint8(byteOffset + 0, magic[0]);\n dataView.setUint8(byteOffset + 1, magic[1]);\n dataView.setUint8(byteOffset + 2, magic[2]);\n dataView.setUint8(byteOffset + 3, magic[3]);\n dataView.setUint32(byteOffset + 4, version, true); // version\n dataView.setUint32(byteOffset + 8, byteLength, true); // byteLength\n byteOffset += HEADER_SIZE;\n return byteOffset;\n}\n// Bytelength is sometimes only known at the end of writing a tile\nexport function encode3DTileByteLength(dataView, byteOffsetTileStart, byteLength) {\n if (!dataView) {\n return;\n }\n dataView.setUint32(byteOffsetTileStart + 8, byteLength, true); // byteLength\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND Apache-2.0\n// Copyright vis.gl contributors\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\nimport { MAGIC_ARRAY } from \"../constants.js\";\nimport { encode3DTileHeader, encode3DTileByteLength } from \"./helpers/encode-3d-tile-header.js\";\nexport function encodeComposite3DTile(tile, dataView, byteOffset, options, encode3DTile) {\n // Add default magic for this tile type\n tile = { magic: MAGIC_ARRAY.COMPOSITE, tiles: [], ...tile };\n const byteOffsetStart = byteOffset;\n byteOffset += encode3DTileHeader(tile, dataView, byteOffset);\n if (dataView) {\n dataView.setUint32(byteOffset, tile.tiles.length, true); // tilesLength\n }\n byteOffset += 4;\n for (let i = 0; i < tile.tiles.length; ++i) {\n byteOffset += encode3DTile(tile.tiles[i], dataView, byteOffset, options);\n }\n // Go \"back\" and rewrite the tile's `byteLength` now that we know the value\n encode3DTileByteLength(dataView, byteOffsetStart, byteOffset - byteOffsetStart);\n return byteOffset;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND Apache-2.0\n// Copyright vis.gl contributors\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\nimport { padToNBytes, copyBinaryToDataView, copyPaddedStringToDataView } from '@loaders.gl/loader-utils';\nimport { MAGIC_ARRAY } from \"../constants.js\";\nimport { encode3DTileHeader, encode3DTileByteLength } from \"./helpers/encode-3d-tile-header.js\";\n// Procedurally encode the tile array dataView for testing purposes\nexport function encodeBatchedModel3DTile(tile, dataView, byteOffset, options) {\n const { featuresLength = 0, batchTable } = tile;\n const featureTableJson = {\n BATCH_LENGTH: featuresLength\n };\n const featureTableJsonString = JSON.stringify(featureTableJson);\n const batchTableJsonString = batchTable ? JSON.stringify(batchTable) : '';\n const featureTableJsonByteLength = padToNBytes(featureTableJsonString.length, 8);\n const batchTableJsonByteLength = batchTableJsonString\n ? padToNBytes(batchTableJsonString.length, 8)\n : 0;\n // Add default magic for this tile type\n tile = { magic: MAGIC_ARRAY.BATCHED_MODEL, ...tile };\n const byteOffsetStart = byteOffset;\n byteOffset = encode3DTileHeader(tile, dataView, byteOffset);\n if (dataView) {\n dataView.setUint32(12, featureTableJsonByteLength, true); // featureTableJsonByteLength\n dataView.setUint32(16, 0, true); // featureTableBinaryByteLength\n dataView.setUint32(20, batchTableJsonByteLength, true); // batchTableJsonByteLength\n dataView.setUint32(24, 0, true); // batchTableBinaryByteLength\n }\n byteOffset += 16;\n // TODO feature table binary\n byteOffset = copyPaddedStringToDataView(dataView, byteOffset, featureTableJsonString, 8);\n if (batchTable) {\n byteOffset = copyPaddedStringToDataView(dataView, byteOffset, batchTableJsonString, 8);\n }\n // Add encoded GLTF to the end of data\n const gltfEncoded = tile.gltfEncoded;\n if (gltfEncoded) {\n byteOffset = copyBinaryToDataView(dataView, byteOffset, gltfEncoded, gltfEncoded.byteLength);\n }\n // Go \"back\" and rewrite the tile's `byteLength` now that we know the value\n encode3DTileByteLength(dataView, byteOffsetStart, byteOffset - byteOffsetStart);\n return byteOffset;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND Apache-2.0\n// Copyright vis.gl contributors\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\nimport { copyStringToDataView } from '@loaders.gl/loader-utils';\nimport { MAGIC_ARRAY } from \"../constants.js\";\nimport { encode3DTileHeader, encode3DTileByteLength } from \"./helpers/encode-3d-tile-header.js\";\n// Procedurally encode the tile array buffer for testing purposes\n// eslint-disable-next-line max-statements\nexport function encodeInstancedModel3DTile(tile, dataView, byteOffset, options) {\n const { featuresLength = 1, gltfFormat = 1, gltfUri = '' } = tile;\n const gltfUriByteLength = gltfUri.length;\n const featureTableJson = {\n INSTANCES_LENGTH: featuresLength,\n POSITION: new Array(featuresLength * 3).fill(0)\n };\n const featureTableJsonString = JSON.stringify(featureTableJson);\n const featureTableJsonByteLength = featureTableJsonString.length;\n // Add default magic for this tile type\n tile = { magic: MAGIC_ARRAY.INSTANCED_MODEL, ...tile };\n const byteOffsetStart = byteOffset;\n byteOffset = encode3DTileHeader(tile, dataView, 0);\n if (dataView) {\n dataView.setUint32(12, featureTableJsonByteLength, true); // featureTableJsonByteLength\n dataView.setUint32(16, 0, true); // featureTableBinaryByteLength\n dataView.setUint32(20, 0, true); // batchTableJsonByteLength\n dataView.setUint32(24, 0, true); // batchTableBinaryByteLength\n dataView.setUint32(28, gltfFormat, true); // gltfFormat\n }\n byteOffset += 20;\n byteOffset += copyStringToDataView(dataView, byteOffset, featureTableJsonString, featureTableJsonByteLength);\n byteOffset += copyStringToDataView(dataView, byteOffset, gltfUri, gltfUriByteLength);\n // Go \"back\" and rewrite the tile's `byteLength` now that we know the value\n encode3DTileByteLength(dataView, byteOffsetStart, byteOffset - byteOffsetStart);\n return byteOffset;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND Apache-2.0\n// Copyright vis.gl contributors\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\nimport { MAGIC_ARRAY } from \"../constants.js\";\nimport { encode3DTileHeader, encode3DTileByteLength } from \"./helpers/encode-3d-tile-header.js\";\nimport { padStringToByteAlignment, copyStringToDataView, copyBinaryToDataView } from '@loaders.gl/loader-utils';\nconst DEFAULT_FEATURE_TABLE_JSON = {\n POINTS_LENGTH: 1,\n POSITIONS: {\n byteOffset: 0\n }\n};\nexport function encodePointCloud3DTile(tile, dataView, byteOffset, options) {\n const { featureTableJson = DEFAULT_FEATURE_TABLE_JSON } = tile;\n let featureTableJsonString = JSON.stringify(featureTableJson);\n featureTableJsonString = padStringToByteAlignment(featureTableJsonString, 4);\n const { featureTableJsonByteLength = featureTableJsonString.length } = tile;\n const featureTableBinary = new ArrayBuffer(12); // Enough space to hold 3 floats\n const featureTableBinaryByteLength = featureTableBinary.byteLength;\n // Add default magic for this tile type\n tile = { magic: MAGIC_ARRAY.POINT_CLOUD, ...tile };\n const byteOffsetStart = byteOffset;\n byteOffset += encode3DTileHeader(tile, dataView, 0);\n if (dataView) {\n dataView.setUint32(byteOffset + 0, featureTableJsonByteLength, true); // featureTableJsonByteLength\n dataView.setUint32(byteOffset + 4, featureTableBinaryByteLength, true); // featureTableBinaryByteLength\n dataView.setUint32(byteOffset + 8, 0, true); // batchTableJsonByteLength\n dataView.setUint32(byteOffset + 12, 0, true); // batchTableBinaryByteLength\n }\n byteOffset += 16;\n byteOffset += copyStringToDataView(dataView, byteOffset, featureTableJsonString, featureTableJsonByteLength);\n byteOffset += copyBinaryToDataView(dataView, byteOffset, featureTableBinary, featureTableBinaryByteLength);\n // Go \"back\" and rewrite the tile's `byteLength` now that we know the value\n encode3DTileByteLength(dataView, byteOffsetStart, byteOffset - byteOffsetStart);\n return byteOffset;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { VERSION } from \"./lib/utils/version.js\";\nimport encode3DTile from \"./lib/encoders/encode-3d-tile.js\";\n/**\n * Exporter for 3D Tiles\n */\nexport const Tile3DWriter = {\n name: '3D Tile',\n id: '3d-tiles',\n module: '3d-tiles',\n version: VERSION,\n extensions: ['cmpt', 'pnts', 'b3dm', 'i3dm'],\n mimeTypes: ['application/octet-stream'],\n binary: true,\n options: {\n ['3d-tiles']: {}\n },\n encode: async (tile, options) => encodeSync(tile, options),\n encodeSync\n};\nfunction encodeSync(tile, options) {\n return encode3DTile(tile, options);\n}\n"], "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,IAAAA,uBAAqB;AACrB,IAAAC,gBAA8C;;;ACDvC,IAAM,UAAU,OAAiC,UAAU;;;ACC3D,IAAM,cAAc;AAAA,EACvB,WAAW;AAAA,EACX,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,MAAM;AACV;AACO,IAAM,eAAe,OAAO,KAAK,WAAW;AAC5C,IAAM,cAAc;AAAA,EACvB,eAAe,CAAC,IAAI,IAAI,KAAK,GAAG;AAAA,EAChC,iBAAiB,CAAC,KAAK,IAAI,KAAK,GAAG;AAAA,EACnC,aAAa,CAAC,KAAK,KAAK,KAAK,GAAG;AAAA,EAChC,WAAW,CAAC,IAAI,KAAK,KAAK,GAAG;AACjC;;;ACdA,0BAAuB;AAEhB,SAAS,yBAAyB,aAAa,YAAY,YAAY;AAC1E,kCAAO,uBAAuB,WAAW;AACzC,QAAM,cAAc,IAAI,YAAY,MAAM;AAC1C,QAAM,aAAa,IAAI,WAAW,aAAa,YAAY,UAAU;AACrE,QAAM,SAAS,YAAY,OAAO,UAAU;AAC5C,SAAO;AACX;AAQO,SAAS,eAAe,aAAa,aAAa,GAAG;AACxD,QAAM,WAAW,IAAI,SAAS,WAAW;AACzC,SAAO,GACT,OAAO,aAAa,SAAS,SAAS,aAAa,CAAC,CAAC,IACrD,OAAO,aAAa,SAAS,SAAS,aAAa,CAAC,CAAC,IACrD,OAAO,aAAa,SAAS,SAAS,aAA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AAAA,IAC5F,KAAK,YAAY;AACb,aAAO,uBAAuB,MAAM,UAAU,YAAY,OAAO;AAAA,IACrE,KAAK,YAAY;AACb,aAAO,yBAAyB,MAAM,UAAU,YAAY,OAAO;AAAA,IACvE,KAAK,YAAY;AACb,aAAO,2BAA2B,MAAM,UAAU,YAAY,OAAO;AAAA,IACzE;AACI,YAAM,IAAI,MAAM,6BAA6B;AAAA,EACrD;AACJ;;;AMxBO,IAAM,eAAe;AAAA,EACxB,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,YAAY,CAAC,QAAQ,QAAQ,QAAQ,MAAM;AAAA,EAC3C,WAAW,CAAC,0BAA0B;AAAA,EACtC,QAAQ;AAAA,EACR,SAAS;AAAA,IACL,CAAC,UAAU,GAAG,CAAC;AAAA,EACnB;AAAA,EACA,QAAQ,OAAO,MAAM,YAAY,WAAW,MAAM,OAAO;AAAA,EACzD;AACJ;AACA,SAAS,WAAW,MAAM,SAAS;AAC/B,SAAO,aAAa,MAAM,OAAO;AACrC;", "names": ["import_loader_utils", "import_tiles", "import_loader_utils", "import_math", "import_core", "import_loader_utils", "import_math", "import_loader_utils", "stack", "defined", "SIZEOF_UINT32", "import_math", "import_math", "import_core", "import_math", "import_math", "import_loader_utils", "import_core", "import_math", "parse3DTile", "import_loader_utils", "import_gltf", "import_loader_utils", "import_core", "import_core", "Long", "import_long", "Long", "import_core", "import_core", "import_geospatial", "log", "getRefine", "getTileType", "stack", "import_core", "import_loader_utils", "import_loader_utils", "import_zip", "path", "VERSION", "parse3DTilesArchive", "import_loader_utils", "import_loader_utils", "encode3DTile", "import_loader_utils", "import_loader_utils", "import_loader_utils"] }