@loaders.gl/3d-tiles 4.0.0-alpha.6 → 4.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.min.js +1462 -1354
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js +7 -5
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -1
- package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -1
- package/dist/es5/lib/parsers/parse-3d-tile-composite.js +4 -4
- package/dist/es5/lib/parsers/parse-3d-tile-composite.js.map +1 -1
- package/dist/es5/lib/parsers/parse-3d-tile-gltf.js +5 -3
- package/dist/es5/lib/parsers/parse-3d-tile-gltf.js.map +1 -1
- package/dist/es5/lib/parsers/parse-3d-tile-header.js +1 -1
- package/dist/es5/lib/parsers/parse-3d-tile-header.js.map +1 -1
- package/dist/es5/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
- package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -1
- package/dist/es5/lib/utils/version.js +1 -1
- package/dist/es5/tiles-3d-loader.js +60 -56
- package/dist/es5/tiles-3d-loader.js.map +1 -1
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js +4 -2
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -1
- package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -1
- package/dist/esm/lib/parsers/parse-3d-tile-composite.js.map +1 -1
- package/dist/esm/lib/parsers/parse-3d-tile-gltf.js +4 -2
- package/dist/esm/lib/parsers/parse-3d-tile-gltf.js.map +1 -1
- package/dist/esm/lib/parsers/parse-3d-tile-header.js +1 -1
- package/dist/esm/lib/parsers/parse-3d-tile-header.js.map +1 -1
- package/dist/esm/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
- package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -1
- package/dist/esm/lib/utils/version.js +1 -1
- package/dist/esm/tiles-3d-loader.js +26 -28
- package/dist/esm/tiles-3d-loader.js.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.d.ts.map +1 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js +3 -1
- package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js +1 -1
- package/dist/lib/parsers/parse-3d-tile-composite.d.ts +6 -1
- package/dist/lib/parsers/parse-3d-tile-composite.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-composite.js +0 -2
- package/dist/lib/parsers/parse-3d-tile-gltf.d.ts +3 -1
- package/dist/lib/parsers/parse-3d-tile-gltf.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-gltf.js +3 -1
- package/dist/lib/parsers/parse-3d-tile-header.d.ts +2 -1
- package/dist/lib/parsers/parse-3d-tile-header.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-header.js +1 -1
- package/dist/lib/parsers/parse-3d-tile-instanced-model.d.ts +3 -1
- package/dist/lib/parsers/parse-3d-tile-instanced-model.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts +4 -2
- package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts.map +1 -1
- package/dist/lib/parsers/parse-3d-tile-point-cloud.js +1 -0
- package/dist/tiles-3d-loader.d.ts +15 -1
- package/dist/tiles-3d-loader.d.ts.map +1 -1
- package/dist/tiles-3d-loader.js +34 -32
- package/package.json +8 -8
- package/src/lib/parsers/helpers/parse-3d-tile-gltf-view.ts +4 -2
- package/src/lib/parsers/helpers/parse-3d-tile-subtree.ts +1 -1
- package/src/lib/parsers/parse-3d-tile-composite.ts +17 -6
- package/src/lib/parsers/parse-3d-tile-gltf.ts +12 -3
- package/src/lib/parsers/parse-3d-tile-header.ts +3 -2
- package/src/lib/parsers/parse-3d-tile-instanced-model.ts +17 -3
- package/src/lib/parsers/parse-3d-tile-point-cloud.ts +37 -10
- package/src/tiles-3d-loader.ts +65 -33
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-3d-tile-point-cloud.js","names":["_draco","require","_math","_core","_tile3dFeatureTable","_interopRequireDefault","_tile3dBatchTable","_parse3dTileHeader","_parse3dTileTables","_normalize3dTileColors","_normalize3dTileNormals","_normalize3dTilePositions","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","parsePointCloud3DTile","_x","_x2","_x3","_x4","_x5","_parsePointCloud3DTile","_asyncToGenerator2","_regenerator","mark","_callee","tile","arrayBuffer","byteOffset","options","context","_parsePointCloudTable","featureTable","batchTable","wrap","_callee$","_context","prev","next","parse3DTileHeaderSync","parse3DTileTablesHeaderSync","parse3DTileTablesSync","initializeTile","parsePointCloudTables","parseDraco","parsePositions","parseColors","parseNormals","abrupt","stop","attributes","positions","colors","normals","batchIds","isQuantized","isTranslucent","isRGB565","isOctEncoded16P","Tile3DFeatureTable","featureTableJson","featureTableBinary","pointsLength","getGlobalProperty","Number","isFinite","Error","featuresLength","pointCount","rtcCenter","GL","FLOAT","parseBatchIds","hasProperty","getPropertyArray","UNSIGNED_SHORT","quantizedRange","quantizedVolumeScale","quantizedVolumeOffset","normalize3DTilePositionAttribute","UNSIGNED_BYTE","normalize3DTileColorAttribute","constantRGBA","normalize3DTileNormalAttribute","batchFeatureLength","batchTableJson","batchTableBinary","Tile3DBatchTable","_x6","_x7","_x8","_x9","_x10","_parseDraco","_callee2","dracoBuffer","dracoFeatureTableProperties","dracoBatchTableProperties","batchTableDraco","featureTableDraco","dracoByteOffset","dracoByteLength","dracoData","_callee2$","_context2","extensions","properties","getExtension","byteLength","slice","hasPositions","POSITION","hasColors","RGB","RGBA","hasNormals","NORMAL","hasBatchIds","BATCH_ID","buffer","featureTableProperties","batchTableProperties","dequantizeInShader","loadDraco","sent","_x11","_x12","_x13","_x14","_loadDraco","_callee3","parse","dracoOptions","data","decodedPositions","decodedColors","decodedNormals","decodedBatchIds","isQuantizedDraco","isOctEncodedDraco","quantization","range","batchTableAttributes","_i","_Object$keys","attributeName","_callee3$","_context3","draco","extraAttributes","DracoLoader","value","COLOR_0","Vector3","minValues","quantizationBits","octEncodedRange","toLowerCase","undefined"],"sources":["../../../../src/lib/parsers/parse-3d-tile-point-cloud.ts"],"sourcesContent":["// 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\nimport {DracoLoader} from '@loaders.gl/draco';\nimport {GL} from '@loaders.gl/math';\nimport {Vector3} from '@math.gl/core';\n\nimport Tile3DFeatureTable from '../classes/tile-3d-feature-table';\nimport Tile3DBatchTable from '../classes/tile-3d-batch-table';\nimport {parse3DTileHeaderSync} from './helpers/parse-3d-tile-header';\nimport {parse3DTileTablesHeaderSync, parse3DTileTablesSync} from './helpers/parse-3d-tile-tables';\nimport {normalize3DTileColorAttribute} from './helpers/normalize-3d-tile-colors';\nimport {normalize3DTileNormalAttribute} from './helpers/normalize-3d-tile-normals';\nimport {normalize3DTilePositionAttribute} from './helpers/normalize-3d-tile-positions';\n\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\n const {featureTable, batchTable} = parsePointCloudTables(tile);\n\n await parseDraco(tile, featureTable, batchTable, options, context);\n\n parsePositions(tile, featureTable, options);\n parseColors(tile, featureTable, batchTable);\n parseNormals(tile, featureTable);\n\n return byteOffset;\n}\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}\n\nfunction parsePointCloudTables(tile) {\n const featureTable = new Tile3DFeatureTable(tile.featureTableJson, tile.featureTableBinary);\n\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\n tile.featuresLength = pointsLength;\n tile.pointsLength = pointsLength;\n tile.pointCount = pointsLength;\n\n tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', GL.FLOAT, 3);\n\n const batchTable = parseBatchIds(tile, featureTable);\n\n return {featureTable, batchTable};\n}\n\nfunction parsePositions(tile, featureTable, options) {\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 const positions = featureTable.getPropertyArray('POSITION_QUANTIZED', GL.UNSIGNED_SHORT, 3);\n\n tile.isQuantized = true;\n tile.quantizedRange = (1 << 16) - 1;\n\n tile.quantizedVolumeScale = featureTable.getGlobalProperty(\n 'QUANTIZED_VOLUME_SCALE',\n GL.FLOAT,\n 3\n );\n if (!tile.quantizedVolumeScale) {\n throw new Error('QUANTIZED_VOLUME_SCALE must be defined for quantized positions.');\n }\n\n tile.quantizedVolumeOffset = featureTable.getGlobalProperty(\n 'QUANTIZED_VOLUME_OFFSET',\n GL.FLOAT,\n 3\n );\n if (!tile.quantizedVolumeOffset) {\n throw new Error('QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.');\n }\n\n tile.attributes.positions = normalize3DTilePositionAttribute(tile, positions, options);\n }\n }\n\n if (!tile.attributes.positions) {\n throw new Error('Either POSITION or POSITION_QUANTIZED must be defined.');\n }\n}\n\nfunction parseColors(tile, featureTable, batchTable) {\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 } else if (featureTable.hasProperty('RGB')) {\n colors = featureTable.getPropertyArray('RGB', GL.UNSIGNED_BYTE, 3);\n } else if (featureTable.hasProperty('RGB565')) {\n colors = featureTable.getPropertyArray('RGB565', GL.UNSIGNED_SHORT, 1);\n tile.isRGB565 = true;\n }\n\n tile.attributes.colors = normalize3DTileColorAttribute(tile, colors, batchTable);\n }\n\n if (featureTable.hasProperty('CONSTANT_RGBA')) {\n tile.constantRGBA = featureTable.getGlobalProperty('CONSTANT_RGBA', GL.UNSIGNED_BYTE, 4);\n }\n}\n\nfunction parseNormals(tile, featureTable) {\n if (!tile.attributes.normals) {\n let normals = null;\n if (featureTable.hasProperty('NORMAL')) {\n normals = featureTable.getPropertyArray('NORMAL', GL.FLOAT, 3);\n } else if (featureTable.hasProperty('NORMAL_OCT16P')) {\n normals = featureTable.getPropertyArray('NORMAL_OCT16P', GL.UNSIGNED_BYTE, 2);\n tile.isOctEncoded16P = true;\n }\n\n tile.attributes.normals = normalize3DTileNormalAttribute(tile, normals);\n }\n}\n\nfunction parseBatchIds(tile, featureTable) {\n let batchTable: Tile3DBatchTable | null = null;\n if (!tile.batchIds && featureTable.hasProperty('BATCH_ID')) {\n tile.batchIds = featureTable.getPropertyArray('BATCH_ID', GL.UNSIGNED_SHORT, 1);\n\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\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 =\n tile.batchTableJson &&\n tile.batchTableJson.extensions &&\n tile.batchTableJson.extensions['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 || !Number.isFinite(dracoByteOffset) || !dracoByteLength) {\n throw new Error('Draco properties, byteOffset, and byteLength must be defined');\n }\n\n dracoBuffer = tile.featureTableBinary.slice(dracoByteOffset, dracoByteOffset + dracoByteLength);\n\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\n if (!dracoBuffer) {\n return true;\n }\n\n const dracoData = {\n buffer: dracoBuffer,\n properties: {...dracoFeatureTableProperties, ...dracoBatchTableProperties},\n featureTableProperties: dracoFeatureTableProperties,\n batchTableProperties: dracoBatchTableProperties,\n dequantizeInShader: false\n };\n\n return await loadDraco(tile, dracoData, options, context);\n}\n\n// eslint-disable-next-line complexity, max-statements\nexport async function loadDraco(tile, dracoData, options, context) {\n const {parse} = context;\n const dracoOptions = {\n ...options,\n draco: {\n ...options.draco,\n extraAttributes: dracoData.batchTableProperties || {}\n }\n };\n\n // The entire tileset might be included, too expensive to serialize\n delete dracoOptions['3d-tiles'];\n\n const data = await parse(dracoData.buffer, DracoLoader, dracoOptions);\n\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 const isQuantizedDraco = decodedPositions && data.attributes.POSITION.value.quantization;\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 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 tile.octEncodedRange = (1 << data.NORMAL.data.quantization.quantizationBits) - 1.0;\n tile.isOctEncodedDraco = true;\n }\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\n tile.attributes = {\n positions: decodedPositions,\n colors: normalize3DTileColorAttribute(tile, decodedColors, undefined),\n normals: decodedNormals,\n batchIds: decodedBatchIds,\n ...batchTableAttributes\n };\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(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","_math","_core","_tile3dFeatureTable","_interopRequireDefault","_tile3dBatchTable","_parse3dTileHeader","_parse3dTileTables","_normalize3dTileColors","_normalize3dTileNormals","_normalize3dTilePositions","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","parsePointCloud3DTile","_x","_x2","_x3","_x4","_x5","_parsePointCloud3DTile","_asyncToGenerator2","_regenerator","mark","_callee","tile","arrayBuffer","byteOffset","options","context","_parsePointCloudTable","featureTable","batchTable","wrap","_callee$","_context","prev","next","parse3DTileHeaderSync","parse3DTileTablesHeaderSync","parse3DTileTablesSync","initializeTile","parsePointCloudTables","parseDraco","parsePositions","parseColors","parseNormals","abrupt","stop","attributes","positions","colors","normals","batchIds","isQuantized","isTranslucent","isRGB565","isOctEncoded16P","Tile3DFeatureTable","featureTableJson","featureTableBinary","pointsLength","getGlobalProperty","Number","isFinite","Error","featuresLength","pointCount","rtcCenter","GL","FLOAT","parseBatchIds","hasProperty","getPropertyArray","UNSIGNED_SHORT","quantizedRange","quantizedVolumeScale","quantizedVolumeOffset","normalize3DTilePositionAttribute","UNSIGNED_BYTE","normalize3DTileColorAttribute","constantRGBA","normalize3DTileNormalAttribute","batchFeatureLength","batchTableJson","batchTableBinary","Tile3DBatchTable","_x6","_x7","_x8","_x9","_x10","_parseDraco","_callee2","dracoBuffer","dracoFeatureTableProperties","dracoBatchTableProperties","batchTableDraco","featureTableDraco","dracoByteOffset","dracoByteLength","dracoData","_callee2$","_context2","extensions","properties","getExtension","byteLength","slice","hasPositions","POSITION","hasColors","RGB","RGBA","hasNormals","NORMAL","hasBatchIds","BATCH_ID","buffer","featureTableProperties","batchTableProperties","dequantizeInShader","loadDraco","sent","_x11","_x12","_x13","_x14","_loadDraco","_callee3","parse","dracoOptions","data","decodedPositions","decodedColors","decodedNormals","decodedBatchIds","isQuantizedDraco","isOctEncodedDraco","quantization","range","batchTableAttributes","_i","_Object$keys","attributeName","_callee3$","_context3","draco","extraAttributes","DracoLoader","value","COLOR_0","Vector3","minValues","quantizationBits","octEncodedRange","toLowerCase","undefined"],"sources":["../../../../src/lib/parsers/parse-3d-tile-point-cloud.ts"],"sourcesContent":["// 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\nimport {DracoLoader} from '@loaders.gl/draco';\nimport {GL} from '@loaders.gl/math';\nimport {Vector3} from '@math.gl/core';\n\nimport Tile3DFeatureTable from '../classes/tile-3d-feature-table';\nimport Tile3DBatchTable from '../classes/tile-3d-batch-table';\nimport {parse3DTileHeaderSync} from './helpers/parse-3d-tile-header';\nimport {parse3DTileTablesHeaderSync, parse3DTileTablesSync} from './helpers/parse-3d-tile-tables';\nimport {normalize3DTileColorAttribute} from './helpers/normalize-3d-tile-colors';\nimport {normalize3DTileNormalAttribute} from './helpers/normalize-3d-tile-normals';\nimport {normalize3DTilePositionAttribute} from './helpers/normalize-3d-tile-positions';\nimport {Tiles3DLoaderOptions} from '../../tiles-3d-loader';\nimport {LoaderContext} from '@loaders.gl/loader-utils';\n\nexport async function parsePointCloud3DTile(\n tile,\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n options: Tiles3DLoaderOptions,\n context: LoaderContext\n): Promise<number> {\n byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);\n byteOffset = parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset);\n byteOffset = parse3DTileTablesSync(tile, arrayBuffer, byteOffset, options);\n initializeTile(tile);\n\n const {featureTable, batchTable} = parsePointCloudTables(tile);\n\n await parseDraco(tile, featureTable, batchTable, options, context);\n\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\n return byteOffset;\n}\n\nfunction initializeTile(tile): void {\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}\n\nfunction parsePointCloudTables(tile): {\n featureTable: Tile3DFeatureTable;\n batchTable: Tile3DBatchTable | null;\n} {\n const featureTable = new Tile3DFeatureTable(tile.featureTableJson, tile.featureTableBinary);\n\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\n tile.featuresLength = pointsLength;\n tile.pointsLength = pointsLength;\n tile.pointCount = pointsLength;\n\n tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', GL.FLOAT, 3);\n\n const batchTable = parseBatchIds(tile, featureTable);\n\n return {featureTable, batchTable};\n}\n\nfunction parsePositions(\n tile,\n featureTable: Tile3DFeatureTable,\n options: Tiles3DLoaderOptions\n): void {\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 const positions = featureTable.getPropertyArray('POSITION_QUANTIZED', GL.UNSIGNED_SHORT, 3);\n\n tile.isQuantized = true;\n tile.quantizedRange = (1 << 16) - 1;\n\n tile.quantizedVolumeScale = featureTable.getGlobalProperty(\n 'QUANTIZED_VOLUME_SCALE',\n GL.FLOAT,\n 3\n );\n if (!tile.quantizedVolumeScale) {\n throw new Error('QUANTIZED_VOLUME_SCALE must be defined for quantized positions.');\n }\n\n tile.quantizedVolumeOffset = featureTable.getGlobalProperty(\n 'QUANTIZED_VOLUME_OFFSET',\n GL.FLOAT,\n 3\n );\n if (!tile.quantizedVolumeOffset) {\n throw new Error('QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.');\n }\n\n tile.attributes.positions = normalize3DTilePositionAttribute(tile, positions, options);\n }\n }\n\n if (!tile.attributes.positions) {\n throw new Error('Either POSITION or POSITION_QUANTIZED must be defined.');\n }\n}\n\nfunction parseColors(tile, featureTable: Tile3DFeatureTable, batchTable: Tile3DBatchTable): void {\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 } else if (featureTable.hasProperty('RGB')) {\n colors = featureTable.getPropertyArray('RGB', GL.UNSIGNED_BYTE, 3);\n } else if (featureTable.hasProperty('RGB565')) {\n colors = featureTable.getPropertyArray('RGB565', GL.UNSIGNED_SHORT, 1);\n tile.isRGB565 = true;\n }\n\n tile.attributes.colors = normalize3DTileColorAttribute(tile, colors, batchTable);\n }\n\n if (featureTable.hasProperty('CONSTANT_RGBA')) {\n tile.constantRGBA = featureTable.getGlobalProperty('CONSTANT_RGBA', GL.UNSIGNED_BYTE, 4);\n }\n}\n\nfunction parseNormals(tile, featureTable: Tile3DFeatureTable): void {\n if (!tile.attributes.normals) {\n let normals = null;\n if (featureTable.hasProperty('NORMAL')) {\n normals = featureTable.getPropertyArray('NORMAL', GL.FLOAT, 3);\n } else if (featureTable.hasProperty('NORMAL_OCT16P')) {\n normals = featureTable.getPropertyArray('NORMAL_OCT16P', GL.UNSIGNED_BYTE, 2);\n tile.isOctEncoded16P = true;\n }\n\n tile.attributes.normals = normalize3DTileNormalAttribute(tile, normals);\n }\n}\n\nfunction parseBatchIds(tile, featureTable: Tile3DFeatureTable): Tile3DBatchTable | null {\n let batchTable: Tile3DBatchTable | null = null;\n if (!tile.batchIds && featureTable.hasProperty('BATCH_ID')) {\n tile.batchIds = featureTable.getPropertyArray('BATCH_ID', GL.UNSIGNED_SHORT, 1);\n\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\n// eslint-disable-next-line complexity\nasync function parseDraco(\n tile,\n featureTable: Tile3DFeatureTable,\n batchTable,\n options: Tiles3DLoaderOptions,\n context: LoaderContext\n) {\n let dracoBuffer;\n let dracoFeatureTableProperties;\n let dracoBatchTableProperties;\n const batchTableDraco =\n tile.batchTableJson &&\n tile.batchTableJson.extensions &&\n tile.batchTableJson.extensions['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 || !Number.isFinite(dracoByteOffset) || !dracoByteLength) {\n throw new Error('Draco properties, byteOffset, and byteLength must be defined');\n }\n\n dracoBuffer = tile.featureTableBinary.slice(dracoByteOffset, dracoByteOffset + dracoByteLength);\n\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\n if (!dracoBuffer) {\n return true;\n }\n\n const dracoData = {\n buffer: dracoBuffer,\n properties: {...dracoFeatureTableProperties, ...dracoBatchTableProperties},\n featureTableProperties: dracoFeatureTableProperties,\n batchTableProperties: dracoBatchTableProperties,\n dequantizeInShader: false\n };\n\n return await loadDraco(tile, dracoData, options, context);\n}\n\n// eslint-disable-next-line complexity, max-statements\nexport async function loadDraco(\n tile,\n dracoData,\n options: Tiles3DLoaderOptions,\n context: LoaderContext\n) {\n const {parse} = context;\n const dracoOptions = {\n ...options,\n draco: {\n ...options.draco,\n extraAttributes: dracoData.batchTableProperties || {}\n }\n };\n\n // The entire tileset might be included, too expensive to serialize\n delete dracoOptions['3d-tiles'];\n\n const data = await parse(dracoData.buffer, DracoLoader, dracoOptions);\n\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 const isQuantizedDraco = decodedPositions && data.attributes.POSITION.value.quantization;\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 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 tile.octEncodedRange = (1 << data.NORMAL.data.quantization.quantizationBits) - 1.0;\n tile.isOctEncodedDraco = true;\n }\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\n tile.attributes = {\n positions: decodedPositions,\n colors: normalize3DTileColorAttribute(tile, decodedColors, undefined),\n normals: decodedNormals,\n batchIds: decodedBatchIds,\n ...batchTableAttributes\n };\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"],"mappings":";;;;;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,mBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,kBAAA,GAAAP,OAAA;AACA,IAAAQ,sBAAA,GAAAR,OAAA;AACA,IAAAS,uBAAA,GAAAT,OAAA;AACA,IAAAU,yBAAA,GAAAV,OAAA;AAAuF,SAAAW,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,S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6B,oDAA6B,EAACvD,IAAI,EAAE6G,aAAa,EAAEuB,SAAS,CAAC;YACrEzG,OAAO,EAAEmF,cAAc;YACvBlF,QAAQ,EAAEmF;UAAe,GACtBK,oBAAoB,CACxB;QAAC;QAAA;UAAA,OAAAK,SAAA,CAAAlG,IAAA;MAAA;IAAA,GAAAiF,QAAA;EAAA,CACH;EAAA,OAAAD,UAAA,CAAAhI,KAAA,OAAAI,SAAA;AAAA"}
|
|
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.VERSION = void 0;
|
|
7
|
-
var VERSION = typeof "4.0.0-alpha.
|
|
7
|
+
var VERSION = typeof "4.0.0-alpha.7" !== 'undefined' ? "4.0.0-alpha.7" : 'latest';
|
|
8
8
|
exports.VERSION = VERSION;
|
|
9
9
|
//# sourceMappingURL=version.js.map
|
|
@@ -31,37 +31,50 @@ var Tiles3DLoader = {
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
exports.Tiles3DLoader = Tiles3DLoader;
|
|
34
|
-
function
|
|
35
|
-
return
|
|
36
|
-
}
|
|
37
|
-
function parseTile(_x, _x2, _x3) {
|
|
38
|
-
return _parseTile.apply(this, arguments);
|
|
34
|
+
function parse(_x) {
|
|
35
|
+
return _parse.apply(this, arguments);
|
|
39
36
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
var
|
|
37
|
+
function _parse() {
|
|
38
|
+
_parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data) {
|
|
39
|
+
var options,
|
|
40
|
+
context,
|
|
41
|
+
loaderOptions,
|
|
42
|
+
isTileset,
|
|
43
|
+
_args = arguments;
|
|
43
44
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
44
45
|
while (1) switch (_context.prev = _context.next) {
|
|
45
46
|
case 0:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return
|
|
56
|
-
case
|
|
47
|
+
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
48
|
+
context = _args.length > 2 ? _args[2] : undefined;
|
|
49
|
+
loaderOptions = options['3d-tiles'] || {};
|
|
50
|
+
if (loaderOptions.isTileset === 'auto') {
|
|
51
|
+
isTileset = (context === null || context === void 0 ? void 0 : context.url) && context.url.indexOf('.json') !== -1;
|
|
52
|
+
} else {
|
|
53
|
+
isTileset = loaderOptions.isTileset;
|
|
54
|
+
}
|
|
55
|
+
_context.next = 6;
|
|
56
|
+
return isTileset;
|
|
57
|
+
case 6:
|
|
58
|
+
if (!_context.sent) {
|
|
59
|
+
_context.next = 10;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
_context.t0 = parseTileset(data, options, context);
|
|
63
|
+
_context.next = 11;
|
|
64
|
+
break;
|
|
65
|
+
case 10:
|
|
66
|
+
_context.t0 = parseTile(data, options, context);
|
|
67
|
+
case 11:
|
|
68
|
+
return _context.abrupt("return", _context.t0);
|
|
69
|
+
case 12:
|
|
57
70
|
case "end":
|
|
58
71
|
return _context.stop();
|
|
59
72
|
}
|
|
60
73
|
}, _callee);
|
|
61
74
|
}));
|
|
62
|
-
return
|
|
75
|
+
return _parse.apply(this, arguments);
|
|
63
76
|
}
|
|
64
|
-
function parseTileset(
|
|
77
|
+
function parseTileset(_x2, _x3, _x4) {
|
|
65
78
|
return _parseTileset.apply(this, arguments);
|
|
66
79
|
}
|
|
67
80
|
function _parseTileset() {
|
|
@@ -72,18 +85,19 @@ function _parseTileset() {
|
|
|
72
85
|
while (1) switch (_context2.prev = _context2.next) {
|
|
73
86
|
case 0:
|
|
74
87
|
tilesetJson = JSON.parse(new TextDecoder().decode(data));
|
|
75
|
-
tilesetJson.loader = options.loader || Tiles3DLoader;
|
|
76
|
-
tilesetJson.url = context.url;
|
|
88
|
+
tilesetJson.loader = (options === null || options === void 0 ? void 0 : options.loader) || Tiles3DLoader;
|
|
89
|
+
tilesetJson.url = (context === null || context === void 0 ? void 0 : context.url) || '';
|
|
90
|
+
tilesetJson.queryString = (context === null || context === void 0 ? void 0 : context.queryString) || '';
|
|
77
91
|
tilesetJson.basePath = getBaseUri(tilesetJson);
|
|
78
|
-
_context2.next =
|
|
79
|
-
return (0, _parse3dTileHeader.normalizeTileHeaders)(tilesetJson, options);
|
|
80
|
-
case
|
|
92
|
+
_context2.next = 7;
|
|
93
|
+
return (0, _parse3dTileHeader.normalizeTileHeaders)(tilesetJson, options || {});
|
|
94
|
+
case 7:
|
|
81
95
|
tilesetJson.root = _context2.sent;
|
|
82
96
|
tilesetJson.type = _tiles.TILESET_TYPE.TILES3D;
|
|
83
97
|
tilesetJson.lodMetricType = _tiles.LOD_METRIC_TYPE.GEOMETRIC_ERROR;
|
|
84
98
|
tilesetJson.lodMetricValue = ((_tilesetJson$root = tilesetJson.root) === null || _tilesetJson$root === void 0 ? void 0 : _tilesetJson$root.lodMetricValue) || 0;
|
|
85
99
|
return _context2.abrupt("return", tilesetJson);
|
|
86
|
-
case
|
|
100
|
+
case 12:
|
|
87
101
|
case "end":
|
|
88
102
|
return _context2.stop();
|
|
89
103
|
}
|
|
@@ -91,44 +105,34 @@ function _parseTileset() {
|
|
|
91
105
|
}));
|
|
92
106
|
return _parseTileset.apply(this, arguments);
|
|
93
107
|
}
|
|
94
|
-
function
|
|
95
|
-
return
|
|
108
|
+
function parseTile(_x5, _x6, _x7) {
|
|
109
|
+
return _parseTile.apply(this, arguments);
|
|
96
110
|
}
|
|
97
|
-
function
|
|
98
|
-
|
|
99
|
-
var
|
|
111
|
+
function _parseTile() {
|
|
112
|
+
_parseTile = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3(arrayBuffer, options, context) {
|
|
113
|
+
var tile, byteOffset;
|
|
100
114
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
101
115
|
while (1) switch (_context3.prev = _context3.next) {
|
|
102
116
|
case 0:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
_context3.next = 5;
|
|
114
|
-
return parseTileset(data, options, context);
|
|
117
|
+
tile = {
|
|
118
|
+
content: {
|
|
119
|
+
featureIds: null
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
byteOffset = 0;
|
|
123
|
+
_context3.next = 4;
|
|
124
|
+
return (0, _parse3dTile.parse3DTile)(arrayBuffer, byteOffset, options, context, tile.content);
|
|
125
|
+
case 4:
|
|
126
|
+
return _context3.abrupt("return", tile.content);
|
|
115
127
|
case 5:
|
|
116
|
-
data = _context3.sent;
|
|
117
|
-
_context3.next = 11;
|
|
118
|
-
break;
|
|
119
|
-
case 8:
|
|
120
|
-
_context3.next = 10;
|
|
121
|
-
return parseTile(data, options, context);
|
|
122
|
-
case 10:
|
|
123
|
-
data = _context3.sent;
|
|
124
|
-
case 11:
|
|
125
|
-
return _context3.abrupt("return", data);
|
|
126
|
-
case 12:
|
|
127
128
|
case "end":
|
|
128
129
|
return _context3.stop();
|
|
129
130
|
}
|
|
130
131
|
}, _callee3);
|
|
131
132
|
}));
|
|
132
|
-
return
|
|
133
|
+
return _parseTile.apply(this, arguments);
|
|
134
|
+
}
|
|
135
|
+
function getBaseUri(tileset) {
|
|
136
|
+
return _loaderUtils.path.dirname(tileset.url);
|
|
133
137
|
}
|
|
134
138
|
//# sourceMappingURL=tiles-3d-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiles-3d-loader.js","names":["_loaderUtils","require","_tiles","_version","_parse3dTile","_parse3dTileHeader","Tiles3DLoader","id","name","module","version","VERSION","extensions","mimeTypes","tests","parse","options","loadGLTF","decodeQuantizedPositions","isTileset","assetGltfUpAxis","exports","
|
|
1
|
+
{"version":3,"file":"tiles-3d-loader.js","names":["_loaderUtils","require","_tiles","_version","_parse3dTile","_parse3dTileHeader","Tiles3DLoader","id","name","module","version","VERSION","extensions","mimeTypes","tests","parse","options","loadGLTF","decodeQuantizedPositions","isTileset","assetGltfUpAxis","exports","_x","_parse","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","context","loaderOptions","_args","wrap","_callee$","_context","prev","next","length","undefined","url","indexOf","sent","t0","parseTileset","parseTile","abrupt","stop","_x2","_x3","_x4","_parseTileset","_callee2","_tilesetJson$root","tilesetJson","_callee2$","_context2","JSON","TextDecoder","decode","loader","queryString","basePath","getBaseUri","normalizeTileHeaders","root","type","TILESET_TYPE","TILES3D","lodMetricType","LOD_METRIC_TYPE","GEOMETRIC_ERROR","lodMetricValue","_x5","_x6","_x7","_parseTile","_callee3","arrayBuffer","tile","byteOffset","_callee3$","_context3","content","featureIds","parse3DTile","tileset","path","dirname"],"sources":["../../src/tiles-3d-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\n// / import type { GLTFLoaderOptions } from '@loaders.gl/gltf';\nimport type {DracoLoaderOptions} from '@loaders.gl/draco';\nimport type {ImageLoaderOptions} from '@loaders.gl/images';\n\nimport {path} from '@loaders.gl/loader-utils';\nimport {TILESET_TYPE, LOD_METRIC_TYPE} from '@loaders.gl/tiles';\nimport {VERSION} from './lib/utils/version';\nimport {parse3DTile} from './lib/parsers/parse-3d-tile';\nimport {normalizeTileHeaders} from './lib/parsers/parse-3d-tile-header';\n\nexport type Tiles3DLoaderOptions = LoaderOptions &\n // GLTFLoaderOptions & - TODO not yet exported\n DracoLoaderOptions &\n ImageLoaderOptions & {\n '3d-tiles'?: {\n /** Whether to parse any embedded glTF binaries (or extract memory for independent glTF parsing) */\n loadGLTF?: boolean;\n /** If renderer doesn't support quantized positions, loader can decode them on CPU */\n decodeQuantizedPositions?: boolean;\n /** Whether this is a tileset or a tile */\n isTileset?: boolean | 'auto';\n /** Controls which axis is \"up\" in glTF files */\n assetGltfUpAxis?: 'x' | 'y' | 'z' | null;\n };\n };\n\n/**\n * Loader for 3D Tiles\n */\nexport const Tiles3DLoader: LoaderWithParser = {\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\n/** Parses a tileset or tile */\nasync function parse(data, options: Tiles3DLoaderOptions = {}, context?: LoaderContext) {\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 } else {\n isTileset = loaderOptions.isTileset;\n }\n\n return (await isTileset)\n ? parseTileset(data, options, context)\n : parseTile(data, options, context);\n}\n\n/** Parse a tileset */\nasync function parseTileset(\n data: ArrayBuffer,\n options?: Tiles3DLoaderOptions,\n context?: LoaderContext\n) {\n const tilesetJson = JSON.parse(new TextDecoder().decode(data));\n\n // eslint-disable-next-line no-use-before-define\n tilesetJson.loader = options?.loader || Tiles3DLoader;\n tilesetJson.url = context?.url || '';\n tilesetJson.queryString = context?.queryString || '';\n\n // base path that non-absolute paths in tileset are relative to.\n tilesetJson.basePath = getBaseUri(tilesetJson);\n // TODO - check option types in normalizeTileHeaders\n tilesetJson.root = await normalizeTileHeaders(tilesetJson, options || {});\n\n tilesetJson.type = TILESET_TYPE.TILES3D;\n\n tilesetJson.lodMetricType = LOD_METRIC_TYPE.GEOMETRIC_ERROR;\n tilesetJson.lodMetricValue = tilesetJson.root?.lodMetricValue || 0;\n\n return tilesetJson;\n}\n\n/** Parse a tile */\nasync function parseTile(\n arrayBuffer: ArrayBuffer,\n options?: Tiles3DLoaderOptions,\n context?: LoaderContext\n) {\n const tile = {\n content: {\n featureIds: null\n }\n };\n const byteOffset = 0;\n await parse3DTile(arrayBuffer, byteOffset, options, context, tile.content);\n return tile.content;\n}\n\n/** Get base name */\nfunction getBaseUri(tileset) {\n return path.dirname(tileset.url);\n}\n"],"mappings":";;;;;;;;;AAKA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AAqBO,IAAMK,aAA+B,GAAG;EAC7CC,EAAE,EAAE,UAAU;EACdC,IAAI,EAAE,UAAU;EAChBC,MAAM,EAAE,UAAU;EAClBC,OAAO,EAAEC,gBAAO;EAChBC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;EAC5CC,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;EACvCC,KAAK,EAALA,KAAK;EACLC,OAAO,EAAE;IACP,UAAU,EAAE;MACVC,QAAQ,EAAE,IAAI;MACdC,wBAAwB,EAAE,KAAK;MAC/BC,SAAS,EAAE,MAAM;MACjBC,eAAe,EAAE;IACnB;EACF;AACF,CAAC;AAACC,OAAA,CAAAf,aAAA,GAAAA,aAAA;AAAA,SAGaS,KAAKA,CAAAO,EAAA;EAAA,OAAAC,MAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,OAAA;EAAAA,MAAA,OAAAG,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAApB,SAAAC,QAAqBC,IAAI;IAAA,IAAAf,OAAA;MAAAgB,OAAA;MAAAC,aAAA;MAAAd,SAAA;MAAAe,KAAA,GAAAT,SAAA;IAAA,OAAAG,YAAA,CAAAD,OAAA,CAAAQ,IAAA,UAAAC,SAAAC,QAA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ltf';
|
|
1
|
+
import { GLTFLoader, postProcessGLTF, _getMemoryUsageGLTF } from '@loaders.gl/gltf';
|
|
2
2
|
import { sliceArrayBuffer } from '@loaders.gl/loader-utils';
|
|
3
3
|
export const GLTF_FORMAT = {
|
|
4
4
|
URI: 0,
|
|
@@ -32,7 +32,9 @@ export async function extractGLTF(tile, gltfFormat, options, context) {
|
|
|
32
32
|
tile.gltfByteOffset = 0;
|
|
33
33
|
}
|
|
34
34
|
if (tile.gltfArrayBuffer) {
|
|
35
|
-
|
|
35
|
+
const gltfWithBuffers = await parse(tile.gltfArrayBuffer, GLTFLoader, options, context);
|
|
36
|
+
tile.gltf = postProcessGLTF(gltfWithBuffers);
|
|
37
|
+
tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);
|
|
36
38
|
delete tile.gltfArrayBuffer;
|
|
37
39
|
delete tile.gltfByteOffset;
|
|
38
40
|
delete tile.gltfByteLength;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-3d-tile-gltf-view.js","names":["GLTFLoader","sliceArrayBuffer","GLTF_FORMAT","URI","EMBEDDED","parse3DTileGLTFViewSync","tile","arrayBuffer","byteOffset","options","rotateYtoZ","gltfByteLength","byteLength","Error","gltfUpAxis","assetGltfUpAxis","gltfArrayBuffer","gltfByteOffset","console","warn","concat","type","extractGLTF","gltfFormat","context","tile3DOptions","extractGLTFBufferOrURL","loadGLTF","parse","fetch","gltfUrl","gltf","gltfUrlBytes","Uint8Array","textDecoder","TextDecoder","decode","replace"],"sources":["../../../../../src/lib/parsers/helpers/parse-3d-tile-gltf-view.ts"],"sourcesContent":["// 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\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?\n\nimport {GLTFLoader} from '@loaders.gl/gltf';\nimport {sliceArrayBuffer} from '@loaders.gl/loader-utils';\n\nexport const GLTF_FORMAT = {\n URI: 0,\n EMBEDDED: 1\n};\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\n // Assume glTF consumes rest of tile\n const gltfByteLength = tile.byteOffset + tile.byteLength - byteOffset;\n if (gltfByteLength === 0) {\n throw new Error('glTF byte length must be greater than 0.');\n }\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\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\n if (byteOffset % 4 === 0) {\n // tile.gltfArrayBuffer = arrayBuffer;\n // tile.gltfByteOffset = byteOffset;\n // tile.gltfByteLength = gltfByteLength;\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\n // Entire tile is consumed\n return tile.byteOffset + tile.byteLength;\n}\n\nexport async function extractGLTF(tile, gltfFormat, options, context) {\n const tile3DOptions = options['3d-tiles'] || {};\n\n extractGLTFBufferOrURL(tile, gltfFormat, options);\n\n if (tile3DOptions.loadGLTF) {\n const {parse, fetch} = context;\n if (tile.gltfUrl) {\n tile.gltfArrayBuffer = await fetch(tile.gltfUrl, options);\n tile.gltfByteOffset = 0;\n }\n if (tile.gltfArrayBuffer) {\n // TODO - Should handle byteOffset... However, not used now...\n
|
|
1
|
+
{"version":3,"file":"parse-3d-tile-gltf-view.js","names":["GLTFLoader","postProcessGLTF","_getMemoryUsageGLTF","sliceArrayBuffer","GLTF_FORMAT","URI","EMBEDDED","parse3DTileGLTFViewSync","tile","arrayBuffer","byteOffset","options","rotateYtoZ","gltfByteLength","byteLength","Error","gltfUpAxis","assetGltfUpAxis","gltfArrayBuffer","gltfByteOffset","console","warn","concat","type","extractGLTF","gltfFormat","context","tile3DOptions","extractGLTFBufferOrURL","loadGLTF","parse","fetch","gltfUrl","gltfWithBuffers","gltf","gpuMemoryUsageInBytes","gltfUrlBytes","Uint8Array","textDecoder","TextDecoder","decode","replace"],"sources":["../../../../../src/lib/parsers/helpers/parse-3d-tile-gltf-view.ts"],"sourcesContent":["// 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\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?\n\nimport {GLTFLoader, postProcessGLTF, _getMemoryUsageGLTF} from '@loaders.gl/gltf';\nimport {sliceArrayBuffer} from '@loaders.gl/loader-utils';\n\nexport const GLTF_FORMAT = {\n URI: 0,\n EMBEDDED: 1\n};\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\n // Assume glTF consumes rest of tile\n const gltfByteLength = tile.byteOffset + tile.byteLength - byteOffset;\n if (gltfByteLength === 0) {\n throw new Error('glTF byte length must be greater than 0.');\n }\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\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\n if (byteOffset % 4 === 0) {\n // tile.gltfArrayBuffer = arrayBuffer;\n // tile.gltfByteOffset = byteOffset;\n // tile.gltfByteLength = gltfByteLength;\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\n // Entire tile is consumed\n return tile.byteOffset + tile.byteLength;\n}\n\nexport async function extractGLTF(tile, gltfFormat, options, context) {\n const tile3DOptions = options['3d-tiles'] || {};\n\n extractGLTFBufferOrURL(tile, gltfFormat, options);\n\n if (tile3DOptions.loadGLTF) {\n const {parse, fetch} = context;\n if (tile.gltfUrl) {\n tile.gltfArrayBuffer = await fetch(tile.gltfUrl, options);\n tile.gltfByteOffset = 0;\n }\n if (tile.gltfArrayBuffer) {\n // TODO - Should handle byteOffset... However, not used now...\n const gltfWithBuffers = await parse(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}\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 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 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"],"mappings":"AASA,SAAQA,UAAU,EAAEC,eAAe,EAAEC,mBAAmB,QAAO,kBAAkB;AACjF,SAAQC,gBAAgB,QAAO,0BAA0B;AAEzD,OAAO,MAAMC,WAAW,GAAG;EACzBC,GAAG,EAAE,CAAC;EACNC,QAAQ,EAAE;AACZ,CAAC;AAED,OAAO,SAASC,uBAAuBA,CAACC,IAAI,EAAEC,WAAW,EAAEC,UAAU,EAAEC,OAAO,EAAE;EAI9EH,IAAI,CAACI,UAAU,GAAG,IAAI;EAGtB,MAAMC,cAAc,GAAGL,IAAI,CAACE,UAAU,GAAGF,IAAI,CAACM,UAAU,GAAGJ,UAAU;EACrE,IAAIG,cAAc,KAAK,CAAC,EAAE;IACxB,MAAM,IAAIE,KAAK,CAAC,0CAA0C,CAAC;EAC7D;EAGAP,IAAI,CAACQ,UAAU,GACbL,OAAO,CAAC,UAAU,CAAC,IAAIA,OAAO,CAAC,UAAU,CAAC,CAACM,eAAe,GACtDN,OAAO,CAAC,UAAU,CAAC,CAACM,eAAe,GACnC,GAAG;EAITT,IAAI,CAACU,eAAe,GAAGf,gBAAgB,CAACM,WAAW,EAAEC,UAAU,EAAEG,cAAc,CAAC;EAChFL,IAAI,CAACW,cAAc,GAAG,CAAC;EACvBX,IAAI,CAACK,cAAc,GAAGA,cAAc;EAEpC,IAAIH,UAAU,GAAG,CAAC,KAAK,CAAC,EAAE,CAI1B,CAAC,MAAM;IAGLU,OAAO,CAACC,IAAI,IAAAC,MAAA,CAAId,IAAI,CAACe,IAAI,wDAAqD,CAAC;EACjF;EAGA,OAAOf,IAAI,CAACE,UAAU,GAAGF,IAAI,CAACM,UAAU;AAC1C;AAEA,OAAO,eAAeU,WAAWA,CAAChB,IAAI,EAAEiB,UAAU,EAAEd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AC,UAAU,EAAE,EAAE,CAAC;MAC9C,OAAOjC,IAAI,CAACU,eAAe;MAC3B,OAAOV,IAAI,CAACW,cAAc;MAC1B,OAAOX,IAAI,CAACK,cAAc;MAC1B;IACF,KAAKT,WAAW,CAACE,QAAQ;MACvB;IACF;MACE,MAAM,IAAIS,KAAK,CAAC,iCAAiC,CAAC;EACtD;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-3d-tile-subtree.js","names":["SUBTREE_FILE_MAGIC","SUBTREE_FILE_VERSION","parse3DTilesSubtree","data","options","context","magic","Uint32Array","slice","Error","version","jsonByteLength","parseUint64Value","stringAttribute","Uint8Array","textDecoder","TextDecoder","string","decode","subtree","JSON","parse","binaryByteLength","internalBinaryBuffer","ArrayBuffer","tileAvailability","explicitBitstream","getExplicitBitstream","contentAvailability","childSubtreeAvailability","resolveBufferUri","bitstreamRelativeUri","basePath","hasProtocol","startsWith","resolvedUri","URL","decodeURI","toString","basePathWithProtocol","concat","host","pathname","name","bufferViewIndex","bufferView","bufferViews","buffer","buffers","url","fetch","uri","bufferUri","response","arrayBuffer","byteOffset","byteLength","dataView","DataView","left","getUint32","right"],"sources":["../../../../../src/lib/parsers/helpers/parse-3d-tile-subtree.ts"],"sourcesContent":["import type {Subtree, ExplicitBitstream} from '../../../types';\nimport type {LoaderContext, LoaderOptions} from '@loaders.gl/loader-utils';\n\nconst SUBTREE_FILE_MAGIC = 0x74627573;\nconst SUBTREE_FILE_VERSION = 1;\n\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(\n data: ArrayBuffer,\n options: LoaderOptions | undefined,\n context: LoaderContext | undefined\n): Promise<Subtree> {\n const magic = new Uint32Array(data.slice(0, 4));\n\n if (magic[0] !== SUBTREE_FILE_MAGIC) {\n throw new Error('Wrong subtree file magic number');\n }\n\n const version = new Uint32Array(data.slice(4, 8));\n\n if (version[0] !== SUBTREE_FILE_VERSION) {\n throw new Error('Wrong subtree file verson, must be 1');\n }\n\n const jsonByteLength = parseUint64Value(data.slice(8, 16));\n const stringAttribute = new Uint8Array(data, 24, jsonByteLength);\n\n const textDecoder = new TextDecoder('utf8');\n const string = textDecoder.decode(stringAttribute);\n const subtree = JSON.parse(string);\n\n const binaryByteLength = parseUint64Value(data.slice(16, 24));\n let internalBinaryBuffer = new ArrayBuffer(0);\n\n if (binaryByteLength) {\n internalBinaryBuffer = data.slice(24 + jsonByteLength);\n }\n\n if ('bufferView' in subtree.tileAvailability) {\n subtree.tileAvailability.explicitBitstream = await getExplicitBitstream(\n subtree,\n 'tileAvailability',\n internalBinaryBuffer,\n context\n );\n }\n\n if ('bufferView' in subtree.contentAvailability) {\n subtree.contentAvailability.explicitBitstream = await getExplicitBitstream(\n subtree,\n 'contentAvailability',\n internalBinaryBuffer,\n context\n );\n }\n\n if ('bufferView' in subtree.childSubtreeAvailability) {\n subtree.childSubtreeAvailability.explicitBitstream = await getExplicitBitstream(\n subtree,\n 'childSubtreeAvailability',\n internalBinaryBuffer,\n context\n );\n }\n\n return subtree;\n}\n\n/**\n * Get url for bitstream downloading\n * @param bitstreamRelativeUri\n * @param
|
|
1
|
+
{"version":3,"file":"parse-3d-tile-subtree.js","names":["SUBTREE_FILE_MAGIC","SUBTREE_FILE_VERSION","parse3DTilesSubtree","data","options","context","magic","Uint32Array","slice","Error","version","jsonByteLength","parseUint64Value","stringAttribute","Uint8Array","textDecoder","TextDecoder","string","decode","subtree","JSON","parse","binaryByteLength","internalBinaryBuffer","ArrayBuffer","tileAvailability","explicitBitstream","getExplicitBitstream","contentAvailability","childSubtreeAvailability","resolveBufferUri","bitstreamRelativeUri","basePath","hasProtocol","startsWith","resolvedUri","URL","decodeURI","toString","basePathWithProtocol","concat","host","pathname","name","bufferViewIndex","bufferView","bufferViews","buffer","buffers","url","fetch","uri","bufferUri","response","arrayBuffer","byteOffset","byteLength","dataView","DataView","left","getUint32","right"],"sources":["../../../../../src/lib/parsers/helpers/parse-3d-tile-subtree.ts"],"sourcesContent":["import type {Subtree, ExplicitBitstream} from '../../../types';\nimport type {LoaderContext, LoaderOptions} from '@loaders.gl/loader-utils';\n\nconst SUBTREE_FILE_MAGIC = 0x74627573;\nconst SUBTREE_FILE_VERSION = 1;\n\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(\n data: ArrayBuffer,\n options: LoaderOptions | undefined,\n context: LoaderContext | undefined\n): Promise<Subtree> {\n const magic = new Uint32Array(data.slice(0, 4));\n\n if (magic[0] !== SUBTREE_FILE_MAGIC) {\n throw new Error('Wrong subtree file magic number');\n }\n\n const version = new Uint32Array(data.slice(4, 8));\n\n if (version[0] !== SUBTREE_FILE_VERSION) {\n throw new Error('Wrong subtree file verson, must be 1');\n }\n\n const jsonByteLength = parseUint64Value(data.slice(8, 16));\n const stringAttribute = new Uint8Array(data, 24, jsonByteLength);\n\n const textDecoder = new TextDecoder('utf8');\n const string = textDecoder.decode(stringAttribute);\n const subtree = JSON.parse(string);\n\n const binaryByteLength = parseUint64Value(data.slice(16, 24));\n let internalBinaryBuffer = new ArrayBuffer(0);\n\n if (binaryByteLength) {\n internalBinaryBuffer = data.slice(24 + jsonByteLength);\n }\n\n if ('bufferView' in subtree.tileAvailability) {\n subtree.tileAvailability.explicitBitstream = await getExplicitBitstream(\n subtree,\n 'tileAvailability',\n internalBinaryBuffer,\n context\n );\n }\n\n if ('bufferView' in subtree.contentAvailability) {\n subtree.contentAvailability.explicitBitstream = await getExplicitBitstream(\n subtree,\n 'contentAvailability',\n internalBinaryBuffer,\n context\n );\n }\n\n if ('bufferView' in subtree.childSubtreeAvailability) {\n subtree.childSubtreeAvailability.explicitBitstream = await getExplicitBitstream(\n subtree,\n 'childSubtreeAvailability',\n internalBinaryBuffer,\n context\n );\n }\n\n return subtree;\n}\n\n/**\n * Get url for bitstream downloading\n * @param bitstreamRelativeUri\n * @param basePath\n * @returns\n */\nfunction resolveBufferUri(bitstreamRelativeUri: string, basePath: string): string {\n const hasProtocol = basePath.startsWith('http');\n\n if (hasProtocol) {\n const resolvedUri = new URL(bitstreamRelativeUri, basePath);\n return decodeURI(resolvedUri.toString());\n }\n\n /**\n * Adding http protocol only for new URL constructor usage.\n * It allows to resolve relative paths like ../../example with basePath.\n */\n const basePathWithProtocol = `http://${basePath}`;\n const resolvedUri = new URL(bitstreamRelativeUri, basePathWithProtocol);\n /**\n * Drop protocol and use just relative path.\n */\n return `/${resolvedUri.host}${resolvedUri.pathname}`;\n}\n\n/**\n * Get explicit bitstream for subtree availability data.\n * @param subtree\n * @param name\n * @param internalBinaryBuffer\n */\nasync function getExplicitBitstream(\n subtree: Subtree,\n name: string,\n internalBinaryBuffer: ArrayBuffer,\n context: LoaderContext | undefined\n): Promise<ExplicitBitstream> {\n const bufferViewIndex = subtree[name].bufferView;\n const bufferView = subtree.bufferViews[bufferViewIndex];\n const buffer = subtree.buffers[bufferView.buffer];\n\n if (!context?.url || !context.fetch) {\n throw new Error('Url is not provided');\n }\n\n if (!context.fetch) {\n throw new Error('fetch is not provided');\n }\n\n // External bitstream loading\n if (buffer.uri) {\n const bufferUri = resolveBufferUri(buffer.uri, context?.url);\n const response = await context.fetch(bufferUri);\n const data = await response.arrayBuffer();\n // Return view of bitstream.\n return new Uint8Array(data, bufferView.byteOffset, bufferView.byteLength);\n }\n // Return view of bitstream.\n return new Uint8Array(internalBinaryBuffer, bufferView.byteOffset, bufferView.byteLength);\n}\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: ArrayBuffer): number {\n const dataView = new DataView(buffer);\n const left = dataView.getUint32(0, true);\n const right = dataView.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,GAAG,CAAC,IAAI,EAAE,GAAGE,KAAK;AAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-3d-tile-composite.js","names":["parse3DTileHeaderSync","parseComposite3DTile","tile","arrayBuffer","byteOffset","options","context","parse3DTile","view","DataView","tilesLength","getUint32","tiles","length","byteLength","subtile","push"],"sources":["../../../../src/lib/parsers/parse-3d-tile-composite.ts"],"sourcesContent":["// 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\n// Reference code:\n// https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Composite3DTileContent.js#L182\n\nimport {parse3DTileHeaderSync} from './helpers/parse-3d-tile-header';\n\n// eslint-disable-next-line max-params\nexport async function parseComposite3DTile(\n tile,\n arrayBuffer,\n byteOffset,\n options,\n context,\n parse3DTile\n) {\n byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);\n\n const view = new DataView(arrayBuffer);\n\n // Extract number of tiles\n tile.tilesLength = view.getUint32(byteOffset, true);\n byteOffset += 4;\n\n // extract each tile from the byte stream\n tile.tiles = [];\n while (tile.tiles.length < tile.tilesLength && tile.byteLength - byteOffset > 12) {\n const subtile = {};\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\n return byteOffset;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse-3d-tile-composite.js","names":["parse3DTileHeaderSync","parseComposite3DTile","tile","arrayBuffer","byteOffset","options","context","parse3DTile","view","DataView","tilesLength","getUint32","tiles","length","byteLength","subtile","push"],"sources":["../../../../src/lib/parsers/parse-3d-tile-composite.ts"],"sourcesContent":["// 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\n// Reference code:\n// https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Composite3DTileContent.js#L182\n\nimport type {LoaderContext} from '@loaders.gl/loader-utils';\nimport type {Tiles3DLoaderOptions} from '../../tiles-3d-loader';\nimport {parse3DTileHeaderSync} from './helpers/parse-3d-tile-header';\n\n/** Resolve circulate dependency by passing in parsing function as argument */\ntype Parse3DTile = (\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n options: Tiles3DLoaderOptions,\n context: LoaderContext,\n subtile\n) => Promise<number>;\n\n// eslint-disable-next-line max-params\nexport async function parseComposite3DTile(\n tile,\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n options: Tiles3DLoaderOptions,\n context: LoaderContext,\n parse3DTile: Parse3DTile\n): Promise<number> {\n byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);\n\n const view = new DataView(arrayBuffer);\n\n // Extract number of tiles\n tile.tilesLength = view.getUint32(byteOffset, true);\n byteOffset += 4;\n\n // extract each tile from the byte stream\n tile.tiles = [];\n while (tile.tiles.length < tile.tilesLength && tile.byteLength - byteOffset > 12) {\n const subtile = {};\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\n return byteOffset;\n}\n"],"mappings":"AAQA,SAAQA,qBAAqB,QAAO,gCAAgC;AAYpE,OAAO,eAAeC,oBAAoBA,CACxCC,IAAI,EACJC,WAAwB,EACxBC,UAAkB,EAClBC,OAA6B,EAC7BC,OAAsB,EACtBC,WAAwB,EACP;EACjBH,UAAU,GAAGJ,qBAAqB,CAACE,IAAI,EAAEC,WAAW,EAAEC,UAAU,CAAC;EAEjE,MAAMI,IAAI,GAAG,IAAIC,QAAQ,CAACN,WAAW,CAAC;EAGtCD,IAAI,CAACQ,WAAW,GAAGF,IAAI,CAACG,SAAS,CAACP,UAAU,EAAE,IAAI,CAAC;EACnDA,UAAU,IAAI,CAAC;EAGfF,IAAI,CAACU,KAAK,GAAG,EAAE;EACf,OAAOV,IAAI,CAACU,KAAK,CAACC,MAAM,GAAGX,IAAI,CAACQ,WAAW,IAAIR,IAAI,CAACY,UAAU,GAAGV,UAAU,GAAG,EAAE,EAAE;IAChF,MAAMW,OAAO,GAAG,CAAC,CAAC;IAClBb,IAAI,CAACU,KAAK,CAACI,IAAI,CAACD,OAAO,CAAC;IACxBX,UAAU,GAAG,MAAMG,WAAW,CAACJ,WAAW,EAAEC,UAAU,EAAEC,OAAO,EAAEC,OAAO,EAAES,OAAO,CAAC;EAEpF;EAEA,OAAOX,UAAU;AACnB"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { GLTFLoader } from '@loaders.gl/gltf';
|
|
1
|
+
import { _getMemoryUsageGLTF, GLTFLoader, postProcessGLTF } from '@loaders.gl/gltf';
|
|
2
2
|
export async function parseGltf3DTile(tile, arrayBuffer, options, context) {
|
|
3
3
|
tile.rotateYtoZ = true;
|
|
4
4
|
tile.gltfUpAxis = options['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis ? options['3d-tiles'].assetGltfUpAxis : 'Y';
|
|
5
5
|
const {
|
|
6
6
|
parse
|
|
7
7
|
} = context;
|
|
8
|
-
|
|
8
|
+
const gltfWithBuffers = await parse(arrayBuffer, GLTFLoader, options, context);
|
|
9
|
+
tile.gltf = postProcessGLTF(gltfWithBuffers);
|
|
10
|
+
tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);
|
|
9
11
|
}
|
|
10
12
|
//# sourceMappingURL=parse-3d-tile-gltf.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-3d-tile-gltf.js","names":["GLTFLoader","parseGltf3DTile","tile","arrayBuffer","options","context","rotateYtoZ","gltfUpAxis","assetGltfUpAxis","parse","gltf"],"sources":["../../../../src/lib/parsers/parse-3d-tile-gltf.ts"],"sourcesContent":["import {GLTFLoader} from '@loaders.gl/gltf';\n\nexport async function parseGltf3DTile(tile
|
|
1
|
+
{"version":3,"file":"parse-3d-tile-gltf.js","names":["_getMemoryUsageGLTF","GLTFLoader","postProcessGLTF","parseGltf3DTile","tile","arrayBuffer","options","context","rotateYtoZ","gltfUpAxis","assetGltfUpAxis","parse","gltfWithBuffers","gltf","gpuMemoryUsageInBytes"],"sources":["../../../../src/lib/parsers/parse-3d-tile-gltf.ts"],"sourcesContent":["import type {LoaderContext} from '@loaders.gl/loader-utils';\nimport type {Tiles3DLoaderOptions} from '../../tiles-3d-loader';\nimport {_getMemoryUsageGLTF, GLTFLoader, postProcessGLTF} from '@loaders.gl/gltf';\n\nexport async function parseGltf3DTile(\n tile,\n arrayBuffer: ArrayBuffer,\n options: Tiles3DLoaderOptions,\n context: LoaderContext\n): Promise<void> {\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 =\n options['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis\n ? options['3d-tiles'].assetGltfUpAxis\n : 'Y';\n\n const {parse} = context;\n const gltfWithBuffers = await parse(arrayBuffer, GLTFLoader, options, context);\n tile.gltf = postProcessGLTF(gltfWithBuffers);\n tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);\n}\n"],"mappings":"AAEA,SAAQA,mBAAmB,EAAEC,UAAU,EAAEC,eAAe,QAAO,kBAAkB;AAEjF,OAAO,eAAeC,eAAeA,CACnCC,IAAI,EACJC,WAAwB,EACxBC,OAA6B,EAC7BC,OAAsB,EACP;EAIfH,IAAI,CAACI,UAAU,GAAG,IAAI;EAEtBJ,IAAI,CAACK,UAAU,GACbH,OAAO,CAAC,UAAU,CAAC,IAAIA,OAAO,CAAC,UAAU,CAAC,CAACI,eAAe,GACtDJ,OAAO,CAAC,UAAU,CAAC,CAACI,eAAe,GACnC,GAAG;EAET,MAAM;IAACC;EAAK,CAAC,GAAGJ,OAAO;EACvB,MAAMK,eAAe,GAAG,MAAMD,KAAK,CAACN,WAAW,EAAEJ,UAAU,EAAEK,OAAO,EAAEC,OAAO,CAAC;EAC9EH,IAAI,CAACS,IAAI,GAAGX,eAAe,CAACU,eAAe,CAAC;EAC5CR,IAAI,CAACU,qBAAqB,GAAGd,mBAAmB,CAACI,IAAI,CAACS,IAAI,CAAC;AAC7D"}
|
|
@@ -7,7 +7,7 @@ function getTileType(tile) {
|
|
|
7
7
|
if (!tile.contentUrl) {
|
|
8
8
|
return TILE_TYPE.EMPTY;
|
|
9
9
|
}
|
|
10
|
-
const contentUrl = tile.contentUrl;
|
|
10
|
+
const contentUrl = tile.contentUrl.split('?')[0];
|
|
11
11
|
const fileExtension = contentUrl.split('.').pop();
|
|
12
12
|
switch (fileExtension) {
|
|
13
13
|
case 'pnts':
|