@loaders.gl/3d-tiles 4.0.0-alpha.21 → 4.0.0-alpha.23

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.
Files changed (123) hide show
  1. package/dist/3d-tiles-archive/3d-tiles-archive-archive.d.ts +30 -0
  2. package/dist/3d-tiles-archive/3d-tiles-archive-archive.d.ts.map +1 -0
  3. package/dist/{tz3/tz3-archive.js → 3d-tiles-archive/3d-tiles-archive-archive.js} +16 -16
  4. package/dist/3d-tiles-archive/3d-tiles-archive-parser.d.ts +10 -0
  5. package/dist/3d-tiles-archive/3d-tiles-archive-parser.d.ts.map +1 -0
  6. package/dist/{tz3/tz3-parser.js → 3d-tiles-archive/3d-tiles-archive-parser.js} +5 -5
  7. package/dist/3d-tiles-archive-loader.d.ts +13 -0
  8. package/dist/3d-tiles-archive-loader.d.ts.map +1 -0
  9. package/dist/3d-tiles-archive-loader.js +31 -0
  10. package/dist/cesium-ion-loader.d.ts.map +1 -1
  11. package/dist/cesium-ion-loader.js +0 -1
  12. package/dist/dist.min.js +2218 -1370
  13. package/dist/es5/3d-tiles-archive/3d-tiles-archive-archive.js +126 -0
  14. package/dist/es5/3d-tiles-archive/3d-tiles-archive-archive.js.map +1 -0
  15. package/dist/es5/{tz3/tz3-parser.js → 3d-tiles-archive/3d-tiles-archive-parser.js} +7 -7
  16. package/dist/es5/3d-tiles-archive/3d-tiles-archive-parser.js.map +1 -0
  17. package/dist/es5/3d-tiles-archive-loader.js +50 -0
  18. package/dist/es5/3d-tiles-archive-loader.js.map +1 -0
  19. package/dist/es5/cesium-ion-loader.js.map +1 -1
  20. package/dist/es5/index.js +14 -7
  21. package/dist/es5/index.js.map +1 -1
  22. package/dist/es5/lib/filesystems/tiles-3d-archive-file-system.js +151 -0
  23. package/dist/es5/lib/filesystems/tiles-3d-archive-file-system.js.map +1 -0
  24. package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js +3 -3
  25. package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -1
  26. package/dist/es5/lib/parsers/parse-3d-tile-composite.js +3 -1
  27. package/dist/es5/lib/parsers/parse-3d-tile-composite.js.map +1 -1
  28. package/dist/es5/lib/parsers/parse-3d-tile-gltf.js +14 -12
  29. package/dist/es5/lib/parsers/parse-3d-tile-gltf.js.map +1 -1
  30. package/dist/es5/lib/parsers/parse-3d-tile-header.js +2 -1
  31. package/dist/es5/lib/parsers/parse-3d-tile-header.js.map +1 -1
  32. package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js +6 -6
  33. package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -1
  34. package/dist/es5/lib/parsers/parse-3d-tile.js +3 -1
  35. package/dist/es5/lib/parsers/parse-3d-tile.js.map +1 -1
  36. package/dist/es5/lib/utils/version.js +1 -1
  37. package/dist/es5/tiles-3d-loader.js +2 -0
  38. package/dist/es5/tiles-3d-loader.js.map +1 -1
  39. package/dist/es5/types.js.map +1 -1
  40. package/dist/esm/{tz3/tz3-archive.js → 3d-tiles-archive/3d-tiles-archive-archive.js} +14 -19
  41. package/dist/esm/3d-tiles-archive/3d-tiles-archive-archive.js.map +1 -0
  42. package/dist/esm/{tz3/tz3-parser.js → 3d-tiles-archive/3d-tiles-archive-parser.js} +4 -4
  43. package/dist/esm/3d-tiles-archive/3d-tiles-archive-parser.js.map +1 -0
  44. package/dist/esm/3d-tiles-archive-loader.js +20 -0
  45. package/dist/esm/3d-tiles-archive-loader.js.map +1 -0
  46. package/dist/esm/cesium-ion-loader.js.map +1 -1
  47. package/dist/esm/index.js +2 -1
  48. package/dist/esm/index.js.map +1 -1
  49. package/dist/esm/lib/filesystems/tiles-3d-archive-file-system.js +49 -0
  50. package/dist/esm/lib/filesystems/tiles-3d-archive-file-system.js.map +1 -0
  51. package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js +5 -6
  52. package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -1
  53. package/dist/esm/lib/parsers/parse-3d-tile-composite.js +3 -1
  54. package/dist/esm/lib/parsers/parse-3d-tile-composite.js.map +1 -1
  55. package/dist/esm/lib/parsers/parse-3d-tile-gltf.js +7 -8
  56. package/dist/esm/lib/parsers/parse-3d-tile-gltf.js.map +1 -1
  57. package/dist/esm/lib/parsers/parse-3d-tile-header.js +2 -1
  58. package/dist/esm/lib/parsers/parse-3d-tile-header.js.map +1 -1
  59. package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js +2 -4
  60. package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -1
  61. package/dist/esm/lib/parsers/parse-3d-tile.js +3 -1
  62. package/dist/esm/lib/parsers/parse-3d-tile.js.map +1 -1
  63. package/dist/esm/lib/utils/version.js +1 -1
  64. package/dist/esm/tiles-3d-loader.js +2 -0
  65. package/dist/esm/tiles-3d-loader.js.map +1 -1
  66. package/dist/esm/types.js.map +1 -1
  67. package/dist/index.d.ts +3 -2
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +5 -3
  70. package/dist/lib/filesystems/tiles-3d-archive-file-system.d.ts +32 -0
  71. package/dist/lib/filesystems/tiles-3d-archive-file-system.d.ts.map +1 -0
  72. package/dist/lib/filesystems/tiles-3d-archive-file-system.js +75 -0
  73. package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.d.ts.map +1 -1
  74. package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js +2 -2
  75. package/dist/lib/parsers/parse-3d-tile-composite.js +1 -1
  76. package/dist/lib/parsers/parse-3d-tile-gltf.d.ts +2 -2
  77. package/dist/lib/parsers/parse-3d-tile-gltf.d.ts.map +1 -1
  78. package/dist/lib/parsers/parse-3d-tile-gltf.js +8 -7
  79. package/dist/lib/parsers/parse-3d-tile-header.d.ts.map +1 -1
  80. package/dist/lib/parsers/parse-3d-tile-header.js +2 -1
  81. package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts +1 -1
  82. package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts.map +1 -1
  83. package/dist/lib/parsers/parse-3d-tile-point-cloud.js +10 -2
  84. package/dist/lib/parsers/parse-3d-tile.d.ts +1 -1
  85. package/dist/lib/parsers/parse-3d-tile.d.ts.map +1 -1
  86. package/dist/lib/parsers/parse-3d-tile.js +1 -1
  87. package/dist/tiles-3d-loader.d.ts +2 -1
  88. package/dist/tiles-3d-loader.d.ts.map +1 -1
  89. package/dist/tiles-3d-loader.js +4 -0
  90. package/dist/types.d.ts +2 -0
  91. package/dist/types.d.ts.map +1 -1
  92. package/package.json +8 -7
  93. package/src/{tz3/tz3-archive.ts → 3d-tiles-archive/3d-tiles-archive-archive.ts} +22 -19
  94. package/src/{tz3/tz3-parser.ts → 3d-tiles-archive/3d-tiles-archive-parser.ts} +5 -5
  95. package/src/3d-tiles-archive-loader.ts +47 -0
  96. package/src/cesium-ion-loader.ts +0 -1
  97. package/src/index.ts +3 -2
  98. package/src/lib/filesystems/tiles-3d-archive-file-system.ts +97 -0
  99. package/src/lib/parsers/helpers/parse-3d-tile-gltf-view.ts +8 -3
  100. package/src/lib/parsers/parse-3d-tile-composite.ts +1 -1
  101. package/src/lib/parsers/parse-3d-tile-gltf.ts +11 -10
  102. package/src/lib/parsers/parse-3d-tile-header.ts +2 -1
  103. package/src/lib/parsers/parse-3d-tile-point-cloud.ts +10 -3
  104. package/src/lib/parsers/parse-3d-tile.ts +2 -2
  105. package/src/tiles-3d-loader.ts +16 -4
  106. package/src/types.ts +3 -0
  107. package/dist/es5/tz3/tz3-archive.js +0 -161
  108. package/dist/es5/tz3/tz3-archive.js.map +0 -1
  109. package/dist/es5/tz3/tz3-parser.js.map +0 -1
  110. package/dist/es5/tz3-loader.js +0 -48
  111. package/dist/es5/tz3-loader.js.map +0 -1
  112. package/dist/esm/tz3/tz3-archive.js.map +0 -1
  113. package/dist/esm/tz3/tz3-parser.js.map +0 -1
  114. package/dist/esm/tz3-loader.js +0 -19
  115. package/dist/esm/tz3-loader.js.map +0 -1
  116. package/dist/tz3/tz3-archive.d.ts +0 -23
  117. package/dist/tz3/tz3-archive.d.ts.map +0 -1
  118. package/dist/tz3/tz3-parser.d.ts +0 -10
  119. package/dist/tz3/tz3-parser.d.ts.map +0 -1
  120. package/dist/tz3-loader.d.ts +0 -14
  121. package/dist/tz3-loader.d.ts.map +0 -1
  122. package/dist/tz3-loader.js +0 -30
  123. package/src/tz3-loader.ts +0 -41
@@ -1,4 +1,5 @@
1
1
  import { DracoLoader } from '@loaders.gl/draco';
2
+ import { parseFromContext } from '@loaders.gl/loader-utils';
2
3
  import { GL } from '@loaders.gl/math';
3
4
  import { Vector3 } from '@math.gl/core';
4
5
  import Tile3DFeatureTable from '../classes/tile-3d-feature-table';
@@ -183,9 +184,6 @@ export async function loadDraco(tile, dracoData, options, context) {
183
184
  if (!context) {
184
185
  return;
185
186
  }
186
- const {
187
- parse
188
- } = context;
189
187
  const dracoOptions = {
190
188
  ...options,
191
189
  draco: {
@@ -194,7 +192,7 @@ export async function loadDraco(tile, dracoData, options, context) {
194
192
  }
195
193
  };
196
194
  delete dracoOptions['3d-tiles'];
197
- const data = await parse(dracoData.buffer, DracoLoader, dracoOptions);
195
+ const data = await parseFromContext(dracoData.buffer, DracoLoader, dracoOptions, context);
198
196
  const decodedPositions = data.attributes.POSITION && data.attributes.POSITION.value;
199
197
  const decodedColors = data.attributes.COLOR_0 && data.attributes.COLOR_0.value;
200
198
  const decodedNormals = data.attributes.NORMAL && data.attributes.NORMAL.value;
@@ -1 +1 @@
1
- {"version":3,"file":"parse-3d-tile-point-cloud.js","names":["DracoLoader","GL","Vector3","Tile3DFeatureTable","Tile3DBatchTable","parse3DTileHeaderSync","parse3DTileTablesHeaderSync","parse3DTileTablesSync","normalize3DTileColorAttribute","normalize3DTileNormalAttribute","normalize3DTilePositionAttribute","parsePointCloud3DTile","tile","arrayBuffer","byteOffset","options","context","initializeTile","featureTable","batchTable","parsePointCloudTables","parseDraco","parsePositions","parseColors","parseNormals","attributes","positions","colors","normals","batchIds","isQuantized","isTranslucent","isRGB565","isOctEncoded16P","featureTableJson","featureTableBinary","pointsLength","getGlobalProperty","Number","isFinite","Error","featuresLength","pointCount","rtcCenter","FLOAT","parseBatchIds","hasProperty","getPropertyArray","UNSIGNED_SHORT","quantizedRange","quantizedVolumeScale","quantizedVolumeOffset","UNSIGNED_BYTE","constantRGBA","batchFeatureLength","batchTableJson","batchTableBinary","dracoBuffer","dracoFeatureTableProperties","dracoBatchTableProperties","batchTableDraco","extensions","properties","featureTableDraco","getExtension","dracoByteOffset","dracoByteLength","byteLength","slice","hasPositions","POSITION","hasColors","RGB","RGBA","hasNormals","NORMAL","hasBatchIds","BATCH_ID","dracoData","buffer","featureTableProperties","batchTableProperties","dequantizeInShader","loadDraco","parse","dracoOptions","draco","extraAttributes","data","decodedPositions","value","decodedColors","COLOR_0","decodedNormals","decodedBatchIds","isQuantizedDraco","quantization","isOctEncodedDraco","range","minValues","quantizationBits","octEncodedRange","batchTableAttributes","attributeName","Object","keys","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';\nimport {Tiles3DTileContent} from '../../types';\n\nexport async function parsePointCloud3DTile(\n tile: Tiles3DTileContent,\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: Tiles3DTileContent): 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: Tiles3DTileContent): {\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: Tiles3DTileContent,\n featureTable: Tile3DFeatureTable,\n options: Tiles3DLoaderOptions | undefined\n): void {\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 } 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(\n tile: Tiles3DTileContent,\n featureTable: Tile3DFeatureTable,\n batchTable: Tile3DBatchTable\n): void {\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 } 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: Tiles3DTileContent, featureTable: Tile3DFeatureTable): void {\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 } 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(\n tile: Tiles3DTileContent,\n featureTable: Tile3DFeatureTable\n): 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: Tiles3DTileContent,\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(\n dracoByteOffset,\n dracoByteOffset + dracoByteLength\n );\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: Tiles3DTileContent,\n dracoData,\n options?: Tiles3DLoaderOptions,\n context?: LoaderContext\n): Promise<void> {\n if (!context) {\n return;\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_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AAI,CAACb,MAAM,CAACa,IAAI,CAACQ,YAAY,CAACI,gBAAgB,IAAI,GAAG;IAClFxF,IAAI,CAACqF,iBAAiB,GAAG,IAAI;EAC/B;EAGA,MAAMK,oBAAoB,GAAG,CAAC,CAAC;EAC/B,IAAIxB,SAAS,CAACG,oBAAoB,EAAE;IAClC,KAAK,MAAMsB,aAAa,IAAIC,MAAM,CAACC,IAAI,CAAC3B,SAAS,CAACG,oBAAoB,CAAC,EAAE;MACvE,IAAIO,IAAI,CAAC/D,UAAU,CAAC8E,aAAa,CAAC,IAAIf,IAAI,CAAC/D,UAAU,CAAC8E,aAAa,CAAC,CAACb,KAAK,EAAE;QAC1EY,oBAAoB,CAACC,aAAa,CAACG,WAAW,CAAC,CAAC,CAAC,GAAGlB,IAAI,CAAC/D,UAAU,CAAC8E,aAAa,CAAC,CAACb,KAAK;MAC1F;IACF;EACF;EAEA9E,IAAI,CAACa,UAAU,GAAG;IAChBC,SAAS,EAAE+D,gBAAgB;IAC3B9D,MAAM,EAAEnB,6BAA6B,CAACI,IAAI,EAAE+E,aAAa,EAAEgB,SAAS,CAAC;IACrE/E,OAAO,EAAEiE,cAAc;IACvBhE,QAAQ,EAAEiE,eAAe;IACzB,GAAGQ;EACL,CAAC;AACH"}
1
+ {"version":3,"file":"parse-3d-tile-point-cloud.js","names":["DracoLoader","parseFromContext","GL","Vector3","Tile3DFeatureTable","Tile3DBatchTable","parse3DTileHeaderSync","parse3DTileTablesHeaderSync","parse3DTileTablesSync","normalize3DTileColorAttribute","normalize3DTileNormalAttribute","normalize3DTilePositionAttribute","parsePointCloud3DTile","tile","arrayBuffer","byteOffset","options","context","initializeTile","featureTable","batchTable","parsePointCloudTables","parseDraco","parsePositions","parseColors","parseNormals","attributes","positions","colors","normals","batchIds","isQuantized","isTranslucent","isRGB565","isOctEncoded16P","featureTableJson","featureTableBinary","pointsLength","getGlobalProperty","Number","isFinite","Error","featuresLength","pointCount","rtcCenter","FLOAT","parseBatchIds","hasProperty","getPropertyArray","UNSIGNED_SHORT","quantizedRange","quantizedVolumeScale","quantizedVolumeOffset","UNSIGNED_BYTE","constantRGBA","batchFeatureLength","batchTableJson","batchTableBinary","dracoBuffer","dracoFeatureTableProperties","dracoBatchTableProperties","batchTableDraco","extensions","properties","featureTableDraco","getExtension","dracoByteOffset","dracoByteLength","byteLength","slice","hasPositions","POSITION","hasColors","RGB","RGBA","hasNormals","NORMAL","hasBatchIds","BATCH_ID","dracoData","buffer","featureTableProperties","batchTableProperties","dequantizeInShader","loadDraco","dracoOptions","draco","extraAttributes","data","decodedPositions","value","decodedColors","COLOR_0","decodedNormals","decodedBatchIds","isQuantizedDraco","quantization","isOctEncodedDraco","range","minValues","quantizationBits","octEncodedRange","batchTableAttributes","attributeName","Object","keys","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 {LoaderContext, parseFromContext} from '@loaders.gl/loader-utils';\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 {Tiles3DTileContent} from '../../types';\n\nexport async function parsePointCloud3DTile(\n tile: Tiles3DTileContent,\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: Tiles3DTileContent): 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: Tiles3DTileContent): {\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: Tiles3DTileContent,\n featureTable: Tile3DFeatureTable,\n options: Tiles3DLoaderOptions | undefined\n): void {\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 } 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(\n tile: Tiles3DTileContent,\n featureTable: Tile3DFeatureTable,\n batchTable: Tile3DBatchTable\n): void {\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 } 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: Tiles3DTileContent, featureTable: Tile3DFeatureTable): void {\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 } 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(\n tile: Tiles3DTileContent,\n featureTable: Tile3DFeatureTable\n): 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: Tiles3DTileContent,\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(\n dracoByteOffset,\n dracoByteOffset + dracoByteLength\n );\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: Tiles3DTileContent,\n dracoData,\n options?: Tiles3DLoaderOptions,\n context?: LoaderContext\n): Promise<void> {\n if (!context) {\n return;\n }\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 parseFromContext(dracoData.buffer, DracoLoader, dracoOptions, context);\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 // @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\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 // @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\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);\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,CAACY,IAAI,CAACQ,YAAY,CAACI,gBAAgB,IAAI,GAAG;IAClFvF,IAAI,CAACoF,iBAAiB,GAAG,IAAI;EAC/B;EAGA,MAAMK,oBAAoB,GAAG,CAAC,CAAC;EAC/B,IAAIvB,SAAS,CAACG,oBAAoB,EAAE;IAClC,KAAK,MAAMqB,aAAa,IAAIC,MAAM,CAACC,IAAI,CAAC1B,SAAS,CAACG,oBAAoB,CAAC,EAAE;MACvE,IAAIM,IAAI,CAAC9D,UAAU,CAAC6E,aAAa,CAAC,IAAIf,IAAI,CAAC9D,UAAU,CAAC6E,aAAa,CAAC,CAACb,KAAK,EAAE;QAC1EY,oBAAoB,CAACC,aAAa,CAACG,WAAW,CAAC,CAAC,CAAC,GAAGlB,IAAI,CAAC9D,UAAU,CAAC6E,aAAa,CAAC,CAACb,KAAK;MAC1F;IACF;EACF;EAEA7E,IAAI,CAACa,UAAU,GAAG;IAEhBC,SAAS,EAAE8D,gBAAgB;IAE3B7D,MAAM,EAAEnB,6BAA6B,CAACI,IAAI,EAAE8E,aAAa,EAAEgB,SAAS,CAAC;IAErE9E,OAAO,EAAEgE,cAAc;IAEvB/D,QAAQ,EAAEgE,eAAe;IACzB,GAAGQ;EACL,CAAC;AACH"}
@@ -9,7 +9,9 @@ export async function parse3DTile(arrayBuffer) {
9
9
  let byteOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
10
10
  let options = arguments.length > 2 ? arguments[2] : undefined;
11
11
  let context = arguments.length > 3 ? arguments[3] : undefined;
12
- let tile = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
12
+ let tile = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
13
+ shape: 'tile3d'
14
+ };
13
15
  tile.byteOffset = byteOffset;
14
16
  tile.type = getMagicString(arrayBuffer, byteOffset);
15
17
  switch (tile.type) {
@@ -1 +1 @@
1
- {"version":3,"file":"parse-3d-tile.js","names":["TILE3D_TYPE","getMagicString","parsePointCloud3DTile","parseBatchedModel3DTile","parseInstancedModel3DTile","parseComposite3DTile","parseGltf3DTile","parse3DTile","arrayBuffer","byteOffset","arguments","length","undefined","options","context","tile","type","COMPOSITE","BATCHED_3D_MODEL","GLTF","INSTANCED_3D_MODEL","POINT_CLOUD","Error","concat"],"sources":["../../../../src/lib/parsers/parse-3d-tile.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 {TILE3D_TYPE} from '../constants';\nimport {getMagicString} from './helpers/parse-utils';\n\nimport {parsePointCloud3DTile} from './parse-3d-tile-point-cloud';\nimport {parseBatchedModel3DTile} from './parse-3d-tile-batched-model';\nimport {parseInstancedModel3DTile} from './parse-3d-tile-instanced-model';\nimport {parseComposite3DTile} from './parse-3d-tile-composite';\nimport {parseGltf3DTile} from './parse-3d-tile-gltf';\nimport {LoaderContext} from '@loaders.gl/loader-utils';\nimport {Tiles3DLoaderOptions} from '../../tiles-3d-loader';\nimport {Tiles3DTileContent} from '../../types';\n\n// Extracts\nexport async function parse3DTile(\n arrayBuffer: ArrayBuffer,\n byteOffset = 0,\n options: Tiles3DLoaderOptions | undefined,\n context: LoaderContext | undefined,\n tile: Tiles3DTileContent = {}\n) {\n tile.byteOffset = byteOffset;\n tile.type = getMagicString(arrayBuffer, byteOffset);\n\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(\n tile,\n arrayBuffer,\n byteOffset,\n options,\n context,\n parse3DTile\n );\n\n case TILE3D_TYPE.BATCHED_3D_MODEL:\n return await parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context);\n\n case TILE3D_TYPE.GLTF:\n return await parseGltf3DTile(tile, arrayBuffer, options, context);\n\n case TILE3D_TYPE.INSTANCED_3D_MODEL:\n return await parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context);\n\n case TILE3D_TYPE.POINT_CLOUD:\n return await parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context);\n\n default:\n throw new Error(`3DTileLoader: unknown type ${tile.type}`); // eslint-disable-line\n }\n}\n"],"mappings":"AAGA,SAAQA,WAAW,QAAO,cAAc;AACxC,SAAQC,cAAc,QAAO,uBAAuB;AAEpD,SAAQC,qBAAqB,QAAO,6BAA6B;AACjE,SAAQC,uBAAuB,QAAO,+BAA+B;AACrE,SAAQC,yBAAyB,QAAO,iCAAiC;AACzE,SAAQC,oBAAoB,QAAO,2BAA2B;AAC9D,SAAQC,eAAe,QAAO,sBAAsB;AAMpD,OAAO,eAAeC,WAAWA,CAC/BC,WAAwB,EAKxB;EAAA,IAJAC,UAAU,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAAA,IACdG,OAAyC,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAAA,IACzCE,OAAkC,GAAAJ,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAAA,IAClCG,IAAwB,GAAAL,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAE7BK,IAAI,CAACN,UAAU,GAAGA,UAAU;EAC5BM,IAAI,CAACC,IAAI,GAAGf,cAAc,CAACO,WAAW,EAAEC,UAAU,CAAC;EAEnD,QAAQM,IAAI,CAACC,IAAI;IACf,KAAKhB,WAAW,CAACiB,SAAS;MAExB,OAAO,MAAMZ,oBAAoB,CAC/BU,IAAI,EACJP,WAAW,EACXC,UAAU,EACVI,OAAO,EACPC,OAAO,EACPP,WACF,CAAC;IAEH,KAAKP,WAAW,CAACkB,gBAAgB;MAC/B,OAAO,MAAMf,uBAAuB,CAACY,IAAI,EAAEP,WAAW,EAAEC,UAAU,EAAEI,OAAO,EAAEC,OAAO,CAAC;IAEvF,KAAKd,WAAW,CAACmB,IAAI;MACnB,OAAO,MAAMb,eAAe,CAACS,IAAI,EAAEP,WAAW,EAAEK,OAAO,EAAEC,OAAO,CAAC;IAEnE,KAAKd,WAAW,CAACoB,kBAAkB;MACjC,OAAO,MAAMhB,yBAAyB,CAACW,IAAI,EAAEP,WAAW,EAAEC,UAAU,EAAEI,OAAO,EAAEC,OAAO,CAAC;IAEzF,KAAKd,WAAW,CAACqB,WAAW;MAC1B,OAAO,MAAMnB,qBAAqB,CAACa,IAAI,EAAEP,WAAW,EAAEC,UAAU,EAAEI,OAAO,EAAEC,OAAO,CAAC;IAErF;MACE,MAAM,IAAIQ,KAAK,+BAAAC,MAAA,CAA+BR,IAAI,CAACC,IAAI,CAAE,CAAC;EAC9D;AACF"}
1
+ {"version":3,"file":"parse-3d-tile.js","names":["TILE3D_TYPE","getMagicString","parsePointCloud3DTile","parseBatchedModel3DTile","parseInstancedModel3DTile","parseComposite3DTile","parseGltf3DTile","parse3DTile","arrayBuffer","byteOffset","arguments","length","undefined","options","context","tile","shape","type","COMPOSITE","BATCHED_3D_MODEL","GLTF","INSTANCED_3D_MODEL","POINT_CLOUD","Error","concat"],"sources":["../../../../src/lib/parsers/parse-3d-tile.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 {TILE3D_TYPE} from '../constants';\nimport {getMagicString} from './helpers/parse-utils';\n\nimport {parsePointCloud3DTile} from './parse-3d-tile-point-cloud';\nimport {parseBatchedModel3DTile} from './parse-3d-tile-batched-model';\nimport {parseInstancedModel3DTile} from './parse-3d-tile-instanced-model';\nimport {parseComposite3DTile} from './parse-3d-tile-composite';\nimport {parseGltf3DTile} from './parse-3d-tile-gltf';\nimport {LoaderContext} from '@loaders.gl/loader-utils';\nimport {Tiles3DLoaderOptions} from '../../tiles-3d-loader';\nimport {Tiles3DTileContent} from '../../types';\n\n// Extracts\nexport async function parse3DTile(\n arrayBuffer: ArrayBuffer,\n byteOffset = 0,\n options: Tiles3DLoaderOptions | undefined,\n context: LoaderContext | undefined,\n tile: Tiles3DTileContent = {shape: 'tile3d'}\n): Promise<number> {\n tile.byteOffset = byteOffset;\n tile.type = getMagicString(arrayBuffer, byteOffset);\n\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(\n tile,\n arrayBuffer,\n byteOffset,\n options,\n context,\n parse3DTile\n );\n\n case TILE3D_TYPE.BATCHED_3D_MODEL:\n return await parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context);\n\n case TILE3D_TYPE.GLTF:\n return await parseGltf3DTile(tile, arrayBuffer, options, context);\n\n case TILE3D_TYPE.INSTANCED_3D_MODEL:\n return await parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context);\n\n case TILE3D_TYPE.POINT_CLOUD:\n return await parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context);\n\n default:\n throw new Error(`3DTileLoader: unknown type ${tile.type}`); // eslint-disable-line\n }\n}\n"],"mappings":"AAGA,SAAQA,WAAW,QAAO,cAAc;AACxC,SAAQC,cAAc,QAAO,uBAAuB;AAEpD,SAAQC,qBAAqB,QAAO,6BAA6B;AACjE,SAAQC,uBAAuB,QAAO,+BAA+B;AACrE,SAAQC,yBAAyB,QAAO,iCAAiC;AACzE,SAAQC,oBAAoB,QAAO,2BAA2B;AAC9D,SAAQC,eAAe,QAAO,sBAAsB;AAMpD,OAAO,eAAeC,WAAWA,CAC/BC,WAAwB,EAKP;EAAA,IAJjBC,UAAU,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAAA,IACdG,OAAyC,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAAA,IACzCE,OAAkC,GAAAJ,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAAA,IAClCG,IAAwB,GAAAL,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG;IAACM,KAAK,EAAE;EAAQ,CAAC;EAE5CD,IAAI,CAACN,UAAU,GAAGA,UAAU;EAC5BM,IAAI,CAACE,IAAI,GAAGhB,cAAc,CAACO,WAAW,EAAEC,UAAU,CAAC;EAEnD,QAAQM,IAAI,CAACE,IAAI;IACf,KAAKjB,WAAW,CAACkB,SAAS;MAExB,OAAO,MAAMb,oBAAoB,CAC/BU,IAAI,EACJP,WAAW,EACXC,UAAU,EACVI,OAAO,EACPC,OAAO,EACPP,WACF,CAAC;IAEH,KAAKP,WAAW,CAACmB,gBAAgB;MAC/B,OAAO,MAAMhB,uBAAuB,CAACY,IAAI,EAAEP,WAAW,EAAEC,UAAU,EAAEI,OAAO,EAAEC,OAAO,CAAC;IAEvF,KAAKd,WAAW,CAACoB,IAAI;MACnB,OAAO,MAAMd,eAAe,CAACS,IAAI,EAAEP,WAAW,EAAEK,OAAO,EAAEC,OAAO,CAAC;IAEnE,KAAKd,WAAW,CAACqB,kBAAkB;MACjC,OAAO,MAAMjB,yBAAyB,CAACW,IAAI,EAAEP,WAAW,EAAEC,UAAU,EAAEI,OAAO,EAAEC,OAAO,CAAC;IAEzF,KAAKd,WAAW,CAACsB,WAAW;MAC1B,OAAO,MAAMpB,qBAAqB,CAACa,IAAI,EAAEP,WAAW,EAAEC,UAAU,EAAEI,OAAO,EAAEC,OAAO,CAAC;IAErF;MACE,MAAM,IAAIS,KAAK,+BAAAC,MAAA,CAA+BT,IAAI,CAACE,IAAI,CAAE,CAAC;EAC9D;AACF"}
@@ -1,2 +1,2 @@
1
- export const VERSION = typeof "4.0.0-alpha.21" !== 'undefined' ? "4.0.0-alpha.21" : 'latest';
1
+ export const VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
2
2
  //# sourceMappingURL=version.js.map
@@ -41,6 +41,7 @@ async function parseTileset(data, options, context) {
41
41
  const normalizedRoot = await normalizeTileHeaders(tilesetJson, basePath, options || {});
42
42
  const tilesetJsonPostprocessed = {
43
43
  ...tilesetJson,
44
+ shape: 'tileset3d',
44
45
  loader: Tiles3DLoader,
45
46
  url: tilesetUrl,
46
47
  queryString: (context === null || context === void 0 ? void 0 : context.queryString) || '',
@@ -55,6 +56,7 @@ async function parseTileset(data, options, context) {
55
56
  async function parseTile(arrayBuffer, options, context) {
56
57
  const tile = {
57
58
  content: {
59
+ shape: 'tile3d',
58
60
  featureIds: null
59
61
  }
60
62
  };
@@ -1 +1 @@
1
- {"version":3,"file":"tiles-3d-loader.js","names":["path","TILESET_TYPE","LOD_METRIC_TYPE","VERSION","parse3DTile","normalizeTileHeaders","Tiles3DLoader","id","name","module","version","extensions","mimeTypes","tests","parse","options","loadGLTF","decodeQuantizedPositions","isTileset","assetGltfUpAxis","data","arguments","length","undefined","context","loaderOptions","url","indexOf","parseTileset","parseTile","_tilesetJson$root","tilesetJson","JSON","TextDecoder","decode","tilesetUrl","basePath","getBaseUri","normalizedRoot","tilesetJsonPostprocessed","loader","queryString","root","type","TILES3D","lodMetricType","GEOMETRIC_ERROR","lodMetricValue","geometricError","arrayBuffer","tile","content","featureIds","byteOffset","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';\nimport {Tiles3DTilesetJSON, Tiles3DTilesetJSONPostprocessed} from './types';\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 isTileset ? parseTileset(data, options, context) : parseTile(data, options, context);\n}\n\n/** Parse a tileset */\nasync function parseTileset(\n data: ArrayBuffer,\n options?: Tiles3DLoaderOptions,\n context?: LoaderContext\n): Promise<Tiles3DTilesetJSONPostprocessed> {\n const tilesetJson: Tiles3DTilesetJSON = JSON.parse(new TextDecoder().decode(data));\n\n const tilesetUrl = context?.url || '';\n const basePath = getBaseUri(tilesetUrl);\n const normalizedRoot = await normalizeTileHeaders(tilesetJson, basePath, options || {});\n const tilesetJsonPostprocessed: Tiles3DTilesetJSONPostprocessed = {\n ...tilesetJson,\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\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(tilesetUrl: string): string {\n return path.dirname(tilesetUrl);\n}\n"],"mappings":"AAKA,SAAQA,IAAI,QAAO,0BAA0B;AAC7C,SAAQC,YAAY,EAAEC,eAAe,QAAO,mBAAmB;AAC/D,SAAQC,OAAO,QAAO,qBAAqB;AAC3C,SAAQC,WAAW,QAAO,6BAA6B;AACvD,SAAQC,oBAAoB,QAAO,oCAAoC;AAsBvE,OAAO,MAAMC,aAA+B,GAAG;EAC7CC,EAAE,EAAE,UAAU;EACdC,IAAI,EAAE,UAAU;EAChBC,MAAM,EAAE,UAAU;EAClBC,OAAO,EAAEP,OAAO;EAChBQ,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;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;AAGD,eAAeL,KAAKA,CAACM,IAAI,EAA+D;EAAA,IAA7DL,OAA6B,GAAAM,SAAA,CAAAC,MAAA,Q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,CAAEiB,WAAW,KAAI,EAAE;IACvCL,QAAQ;IACRM,IAAI,EAAEJ,cAAc,IAAIP,WAAW,CAACW,IAAI;IACxCC,IAAI,EAAE1C,YAAY,CAAC2C,OAAO;IAC1BC,aAAa,EAAE3C,eAAe,CAAC4C,eAAe;IAC9CC,cAAc,EAAE,EAAAjB,iBAAA,GAAAC,WAAW,CAACW,IAAI,cAAAZ,iBAAA,uBAAhBA,iBAAA,CAAkBkB,cAAc,KAAI;EACtD,CAAC;EACD,OAAOT,wBAAwB;AACjC;AAGA,eAAeV,SAASA,CACtBoB,WAAwB,EACxBlC,OAA8B,EAC9BS,OAAuB,EACvB;EACA,MAAM0B,IAAI,GAAG;IACXC,OAAO,EAAE;MACPC,UAAU,EAAE;IACd;EACF,CAAC;EACD,MAAMC,UAAU,GAAG,CAAC;EACpB,MAAMjD,WAAW,CAAC6C,WAAW,EAAEI,UAAU,EAAEtC,OAAO,EAAES,OAAO,EAAE0B,IAAI,CAACC,OAAO,CAAC;EAC1E,OAAOD,IAAI,CAACC,OAAO;AACrB;AAGA,SAASd,UAAUA,CAACF,UAAkB,EAAU;EAC9C,OAAOnC,IAAI,CAACsD,OAAO,CAACnB,UAAU,CAAC;AACjC"}
1
+ {"version":3,"file":"tiles-3d-loader.js","names":["path","TILESET_TYPE","LOD_METRIC_TYPE","VERSION","parse3DTile","normalizeTileHeaders","Tiles3DLoader","id","name","module","version","extensions","mimeTypes","tests","parse","options","loadGLTF","decodeQuantizedPositions","isTileset","assetGltfUpAxis","data","arguments","length","undefined","context","loaderOptions","url","indexOf","parseTileset","parseTile","_tilesetJson$root","tilesetJson","JSON","TextDecoder","decode","tilesetUrl","basePath","getBaseUri","normalizedRoot","tilesetJsonPostprocessed","shape","loader","queryString","root","type","TILES3D","lodMetricType","GEOMETRIC_ERROR","lodMetricValue","geometricError","arrayBuffer","tile","content","featureIds","byteOffset","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';\nimport {Tiles3DTilesetJSON, Tiles3DTileContent, Tiles3DTilesetJSONPostprocessed} from './types';\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 any, // Tiles3DTileContent | Tiles3DTilesetJSONPostprocessed,\n never,\n Tiles3DLoaderOptions\n> = {\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(\n data,\n options: Tiles3DLoaderOptions = {},\n context?: LoaderContext\n): Promise<Tiles3DTileContent | Tiles3DTilesetJSONPostprocessed> {\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 isTileset ? parseTileset(data, options, context) : parseTile(data, options, context);\n}\n\n/** Parse a tileset */\nasync function parseTileset(\n data: ArrayBuffer,\n options?: Tiles3DLoaderOptions,\n context?: LoaderContext\n): Promise<Tiles3DTilesetJSONPostprocessed> {\n const tilesetJson: Tiles3DTilesetJSON = JSON.parse(new TextDecoder().decode(data));\n\n const tilesetUrl = context?.url || '';\n const basePath = getBaseUri(tilesetUrl);\n const normalizedRoot = await normalizeTileHeaders(tilesetJson, basePath, options || {});\n const tilesetJsonPostprocessed: Tiles3DTilesetJSONPostprocessed = {\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\n/** Parse a tile */\nasync function parseTile(\n arrayBuffer: ArrayBuffer,\n options?: Tiles3DLoaderOptions,\n context?: LoaderContext\n): Promise<Tiles3DTileContent> {\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\n/** Get base name */\nfunction getBaseUri(tilesetUrl: string): string {\n return path.dirname(tilesetUrl);\n}\n"],"mappings":"AAKA,SAAQA,IAAI,QAAO,0BAA0B;AAC7C,SAAQC,YAAY,EAAEC,eAAe,QAAO,mBAAmB;AAC/D,SAAQC,OAAO,QAAO,qBAAqB;AAC3C,SAAQC,WAAW,QAAO,6BAA6B;AAC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EvC,OAAO,EAAES,OAAO,EAAE2B,IAAI,CAACC,OAAO,CAAC;EAE1E,OAAOD,IAAI,CAACC,OAAO;AACrB;AAGA,SAASf,UAAUA,CAACF,UAAkB,EAAU;EAC9C,OAAOnC,IAAI,CAACuD,OAAO,CAACpB,UAAU,CAAC;AACjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["import type {GLTFPostprocessed} from '@loaders.gl/gltf';\nimport {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {Matrix4, Vector3} from '@math.gl/core';\nimport {TILESET_TYPE, LOD_METRIC_TYPE, TILE_TYPE, TILE_REFINEMENT} from '@loaders.gl/tiles';\n\nexport type FeatureTableJson = {\n [key: string]: any[];\n};\n\nexport type B3DMContent = {\n batchTableJson?: FeatureTableJson;\n byteLength: number;\n byteOffset: number;\n cartesianModelMatrix: Matrix4;\n cartesianOrigin: Vector3;\n cartographicModelMatrix: Matrix4;\n cartographicOrigin: Vector3;\n featureIds?: number[] | null;\n featureTableBinary?: Uint8Array;\n featureTableJson?: FeatureTableJson;\n gltf?: GLTFPostprocessed;\n gltfUpAxis: string;\n header: GLTFHeader;\n magic: number;\n modelMatrix: Matrix4;\n rotateYtoZ: boolean;\n rtcCenter: [number, number, number];\n type: string;\n version: number;\n};\n\nexport type GLTFHeader = {\n batchLength?: number;\n batchTableBinaryByteLength: number;\n batchTableJsonByteLength: number;\n featureTableBinaryByteLength: number;\n featureTableJsonByteLength: number;\n};\n\n/**\n * A 3D Tiles tileset JSON\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#property-reference\n */\nexport type Tiles3DTilesetJSON = {\n /** Metadata about the entire tileset.\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#asset\n */\n asset: {\n /** The 3D Tiles version. The version defines the JSON schema for the tileset JSON and the base set of tile formats. */\n version: string;\n /** Application-specific version of this tileset, e.g., for when an existing tileset is updated. */\n tilesetVersion?: string;\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n /** Not mentioned in 1.0 spec but some tilesets contain this option */\n gltfUpAxis?: string;\n };\n /** A dictionary object of metadata about per-feature properties. */\n properties?: Record<string, TilesetProperty>;\n /** The error, in meters, introduced if this tileset is not rendered. At runtime, the geometric error is used to compute screen space error (SSE), i.e., the error measured in pixels. */\n geometricError: number;\n /** A tile in a 3D Tiles tileset. */\n root: Tiles3DTileJSON;\n /** Names of 3D Tiles extensions used somewhere in this tileset. */\n extensionsUsed?: string[];\n /** Names of 3D Tiles extensions required to properly load this tileset. */\n extensionsRequired?: string[];\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n};\n\n/** TilesetJSON postprocessed by Tiles3DLoader */\nexport type Tiles3DTilesetJSONPostprocessed = Omit<Tiles3DTilesetJSON, 'root'> & {\n /**\n * Loader used\n * @deprecated\n */\n loader: LoaderWithParser;\n /** URL used to load a tileset resource */\n url: string;\n /** HTTP request query string */\n queryString: string;\n /** base path that non-absolute paths in tileset are relative to. */\n basePath: string;\n /** tileset type */\n type: TILESET_TYPE.TILES3D;\n /** LOD metric type */\n lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR;\n /** LOD metric value */\n lodMetricValue: number;\n /** Postprocessed root */\n root: Tiles3DTileJSONPostprocessed;\n};\n\n/**\n * A tile in a 3D Tiles tileset.\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#tile\n */\nexport type Tiles3DTileJSON = {\n /** A bounding volume that encloses a tile or its content. */\n boundingVolume: Tile3DBoundingVolume;\n /** A bounding volume that encloses a tile or its content. */\n viewerRequestVolume?: object;\n /** The error, in meters, introduced if this tile is rendered and its children are not. At runtime, the geometric error is used to compute screen space error (SSE), i.e., the error measured in pixels. */\n geometricError: number;\n /**\n * Specifies if additive or replacement refinement is used when traversing the tileset for rendering. This property is required for the root tile of a tileset; it is optional for all other tiles.\n * The default is to inherit from the parent tile.\n */\n refine?: string;\n /** A floating-point 4x4 affine transformation matrix, stored in column-major order, that transforms the tile's content */\n transform?: number[];\n /** Metadata about the tile's content and a link to the content. */\n content?: Tiles3DTileContentJSON;\n /** An array of objects that define child tiles. */\n children: Tiles3DTileJSON[];\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n\n /** 3DTiles v1.1 properties\n * https://github.com/CesiumGS/3d-tiles/blob/draft-1.1/specification/schema/tile.schema.json\n */\n /** This object allows a tile to be implicitly subdivided. Tile and content availability and metadata is stored in subtrees which are referenced externally. */\n implicitTiling?: ImplicitTilingData;\n};\n\nexport type Tiles3DTileJSONPostprocessed = Omit<Tiles3DTileJSON, 'refine' | 'children'> & {\n /** Unique ID */\n id?: string;\n /** Content full URL */\n contentUrl?: string;\n /** LOD metric type */\n lodMetricType?: LOD_METRIC_TYPE.GEOMETRIC_ERROR;\n /** LOD metric value */\n lodMetricValue?: number;\n /** Duplicate of transform */\n transformMatrix?: number[];\n /** Type of tile */\n type?: TILE_TYPE | string;\n /**\n * Specifies if additive or replacement refinement is used when traversing the tileset for rendering. This property is required for the root tile of a tileset; it is optional for all other tiles.\n * The default is to inherit from the parent tile.\n */\n refine?: TILE_REFINEMENT | string;\n /** An array of objects that define child tiles. */\n children: Tiles3DTileJSONPostprocessed[];\n};\n\n/** Metadata about the tile's content and a link to the content. */\nexport type Tiles3DTileContentJSON = {\n /** A uri that points to the tile's content. When the uri is relative, it is relative to the referring tileset JSON file. */\n uri: string;\n /** url doesn't allign the spec but we support it same way as uri */\n url?: string;\n /** A bounding volume that encloses a tile or its content. At least one bounding volume property is required. Bounding volumes include box, region, or sphere. */\n boundingVolume?: Tile3DBoundingVolume;\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n};\n\n/** A bounding volume that encloses a tile or its content.\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#bounding-volume\n */\nexport type Tile3DBoundingVolume = {\n /** An array of 12 numbers that define an oriented bounding box. The first three elements define the x, y, and z values for the center of the box.\n * The next three elements (with indices 3, 4, and 5) define the x axis direction and half-length. The next three elements (indices 6, 7, and 8) define\n * the y axis direction and half-length. The last three elements (indices 9, 10, and 11) define the z axis direction and half-length. */\n box?: number[];\n /** An array of four numbers that define a bounding sphere. The first three elements define the x, y, and z values for the center of the sphere.\n * The last element (with index 3) defines the radius in meters. */\n sphere?: number[];\n /** An array of six numbers that define a bounding geographic region in EPSG:4979 coordinates with the order [west, south, east, north, minimum height, maximum height].\n * Longitudes and latitudes are in radians, and heights are in meters above (or below) the WGS84 ellipsoid. */\n region?: number[];\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n};\n\n/**\n * A dictionary object of metadata about per-feature properties.\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#properties\n */\nexport type TilesetProperty = {\n /** The maximum value of this property of all the features in the tileset. */\n maximum: number;\n /** The minimum value of this property of all the features in the tileset. */\n minimum: number;\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n};\n\nexport type Tiles3DTileContent = {\n /** Common properties */\n byteOffset?: number;\n type?: string;\n featureIds?: null;\n\n /** 3DTile header */\n magic?: number;\n version?: number;\n byteLength?: number;\n\n /** 3DTile tables header */\n header?: {\n featureTableJsonByteLength?: number;\n featureTableBinaryByteLength?: number;\n batchTableJsonByteLength?: number;\n batchTableBinaryByteLength?: number;\n batchLength?: number;\n };\n\n /** 3DTile tables */\n featureTableJson?:\n | {\n BATCH_LENGTH?: number;\n }\n | Record<string, any>;\n featureTableBinary?: Uint8Array;\n batchTableJson?: Record<string, (string | number)[]>;\n batchTableBinary?: Uint8Array;\n rtcCenter?: number[];\n\n /** 3DTile glTF */\n gltfArrayBuffer?: ArrayBuffer;\n gltfByteOffset?: number;\n gltfByteLength?: number;\n rotateYtoZ?: boolean;\n gltfUpAxis?: 'x' | 'X' | 'y' | 'Y' | 'z' | 'Z';\n gltfUrl?: string;\n gpuMemoryUsageInBytes?: number;\n gltf?: GLTFPostprocessed;\n\n /** For Composite tiles */\n tilesLength?: number;\n tiles?: Tiles3DTileContent[];\n\n /** For Instances model and Pointcloud tiles */\n featuresLength?: number;\n\n /** For Instanced model tiles */\n gltfFormat?: number;\n eastNorthUp?: boolean;\n normalUp?: number[];\n normalRight?: number[];\n hasCustomOrientation?: boolean;\n octNormalUp?: number[];\n octNormalRight?: number[];\n instances?: {\n modelMatrix: Matrix4;\n batchId: number;\n }[];\n\n /** For Pointcloud tiles */\n attributes?: {\n positions: null | number[];\n colors:\n | null\n | number[]\n | {type: number; value: Uint8ClampedArray; size: number; normalized: boolean};\n normals: null | number[] | {type: number; size: number; value: Float32Array};\n batchIds: null | number[];\n };\n constantRGBA?: number[];\n isQuantized?: boolean;\n isTranslucent?: boolean;\n isRGB565?: boolean;\n isOctEncoded16P?: boolean;\n pointsLength?: number;\n pointCount?: number;\n batchIds?: number[];\n hasPositions?: boolean;\n hasColors?: boolean;\n hasNormals?: boolean;\n hasBatchIds?: boolean;\n quantizedVolumeScale?: Vector3;\n quantizedVolumeOffset?: Vector3;\n quantizedRange?: number;\n isQuantizedDraco?: boolean;\n octEncodedRange?: number;\n isOctEncodedDraco?: boolean;\n};\n\n/**\n * 3DTILES_implicit_tiling types\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling\n * JSON Schema v1.1 https://github.com/CesiumGS/3d-tiles/blob/8e5e67e078850cc8ce15bd1873fe54f11bbee02f/specification/schema/Subtree/subtree.schema.json\n * JSON Schema vNext https://github.com/CesiumGS/3d-tiles/blob/8e5e67e078850cc8ce15bd1873fe54f11bbee02f/extensions/3DTILES_implicit_tiling/schema/subtree/subtree.schema.json\n */\nexport type Subtree = {\n /** An array of buffers. */\n buffers: Buffer[];\n /** An array of buffer views. */\n bufferViews: BufferView[];\n /** The availability of tiles in the subtree. The availability bitstream is a 1D boolean array where tiles are ordered by their level in the subtree and Morton index\n * within that level. A tile's availability is determined by a single bit, 1 meaning a tile exists at that spatial index, and 0 meaning it does not.\n * The number of elements in the array is `(N^subtreeLevels - 1)/(N - 1)` where N is 4 for subdivision scheme `QUADTREE` and 8 for `OCTREE`.\n * Availability may be stored in a buffer view or as a constant value that applies to all tiles. If a non-root tile's availability is 1 its parent\n * tile's availability shall also be 1. `tileAvailability.constant: 0` is disallowed, as subtrees shall have at least one tile.\n */\n tileAvailability: Availability;\n /** It is array by spec but there are tiles that has a single object\n * An array of content availability objects. If the tile has a single content this array will have one element; if the tile has multiple contents -\n * as supported by 3DTILES_multiple_contents and 3D Tiles 1.1 - this array will have multiple elements.\n */\n contentAvailability: Availability | Availability[];\n /** The availability of children subtrees. The availability bitstream is a 1D boolean array where subtrees are ordered by their Morton index in the level of the tree\n * immediately below the bottom row of the subtree. A child subtree's availability is determined by a single bit, 1 meaning a subtree exists at that spatial index,\n * and 0 meaning it does not. The number of elements in the array is `N^subtreeLevels` where N is 4 for subdivision scheme `QUADTREE` and 8 for `OCTREE`.\n * Availability may be stored in a buffer view or as a constant value that applies to all child subtrees. If availability is 0 for all child subtrees,\n * then the tileset does not subdivide further.\n */\n childSubtreeAvailability: Availability;\n // TODO: These are unused properties. Improve types when they are required\n propertyTables: unknown;\n tileMetadata: unknown;\n contentMetadata: unknown;\n subtreeMetadata: unknown;\n};\n\nexport type Availability = {\n /** Integer indicating whether all of the elements are available (1) or all are unavailable (0). */\n constant?: 0 | 1;\n /** Index of a buffer view that indicates whether each element is available. The bitstream conforms to the boolean array encoding described\n * in the 3D Metadata specification. If an element is available, its bit is 1, and if it is unavailable, its bit is 0. */\n bitstream?: number;\n /**\n * v1.1 https://github.com/CesiumGS/3d-tiles/blob/8e5e67e078850cc8ce15bd1873fe54f11bbee02f/specification/schema/Subtree/availability.schema.json\n * vNext https://github.com/CesiumGS/3d-tiles/blob/8e5e67e078850cc8ce15bd1873fe54f11bbee02f/extensions/3DTILES_implicit_tiling/schema/subtree/availability.schema.json\n * The schemas of vNext and 1.1 are same but there are tiles with `bufferView` property instead of `bitstream`\n */\n bufferView?: number;\n /**\n * Postprocessing property\n * contain availability bits loaded from the bufferView\n */\n explicitBitstream?: ExplicitBitstream;\n};\n\nexport type ExplicitBitstream = Uint8Array;\n\n/**\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling#subdivision-scheme\n */\nexport type SubdivisionScheme = 'QUADTREE' | 'OCTREE';\n\ntype Buffer = {\n name: string;\n uri?: string;\n byteLength: number;\n};\n\n/** Subtree buffer view */\nexport type BufferView = {\n buffer: number;\n byteOffset: number;\n byteLength: number;\n};\n\n/**\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling\n */\nexport type ImplicitTilingExensionData = ImplicitTilingData & {\n /** This property is not part of the schema\n * https://github.com/CesiumGS/3d-tiles/blob/main/extensions/3DTILES_implicit_tiling/schema/tile.3DTILES_implicit_tiling.schema.json\n * But it can be seen in some test datasets. It is handled as substitute of `availableLevels`\n */\n maximumLevel?: number;\n};\n\n/** 3DTiles v1.1 types */\n\n/**\n * This object allows a tile to be implicitly subdivided. Tile and content availability and metadata is stored in subtrees which are referenced externally.\n * https://github.com/CesiumGS/3d-tiles/blob/draft-1.1/specification/schema/tile.implicitTiling.schema.json\n * */\ntype ImplicitTilingData = {\n /** A string describing the subdivision scheme used within the tileset. */\n subdivisionScheme: 'QUADTREE' | 'OCTREE' | string;\n /** The number of distinct levels in each subtree. For example, a quadtree with `subtreeLevels = 2` will have subtrees with 5 nodes (one root and 4 children). */\n subtreeLevels: number;\n /** The numbers of the levels in the tree with available tiles. */\n availableLevels: number;\n /** An object describing the location of subtree files. */\n subtrees: {\n /** A template URI pointing to subtree files. A subtree is a fixed-depth (defined by `subtreeLevels`) portion of the tree to keep memory use bounded.\n * The URI of each file is substituted with the subtree root's global level, x, and y. For subdivision scheme `OCTREE`, z shall also be given. Relative paths are relative to the tileset JSON. */\n uri: string;\n };\n};\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["import type {GLTFPostprocessed} from '@loaders.gl/gltf';\nimport {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {Matrix4, Vector3} from '@math.gl/core';\nimport {TILESET_TYPE, LOD_METRIC_TYPE, TILE_TYPE, TILE_REFINEMENT} from '@loaders.gl/tiles';\n\nexport type FeatureTableJson = {\n [key: string]: any[];\n};\n\nexport type B3DMContent = {\n batchTableJson?: FeatureTableJson;\n byteLength: number;\n byteOffset: number;\n cartesianModelMatrix: Matrix4;\n cartesianOrigin: Vector3;\n cartographicModelMatrix: Matrix4;\n cartographicOrigin: Vector3;\n featureIds?: number[] | null;\n featureTableBinary?: Uint8Array;\n featureTableJson?: FeatureTableJson;\n gltf?: GLTFPostprocessed;\n gltfUpAxis: string;\n header: GLTFHeader;\n magic: number;\n modelMatrix: Matrix4;\n rotateYtoZ: boolean;\n rtcCenter: [number, number, number];\n type: string;\n version: number;\n};\n\nexport type GLTFHeader = {\n batchLength?: number;\n batchTableBinaryByteLength: number;\n batchTableJsonByteLength: number;\n featureTableBinaryByteLength: number;\n featureTableJsonByteLength: number;\n};\n\n/**\n * A 3D Tiles tileset JSON\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#property-reference\n */\nexport type Tiles3DTilesetJSON = {\n shape: 'tileset3d';\n /** Metadata about the entire tileset.\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#asset\n */\n asset: {\n /** The 3D Tiles version. The version defines the JSON schema for the tileset JSON and the base set of tile formats. */\n version: string;\n /** Application-specific version of this tileset, e.g., for when an existing tileset is updated. */\n tilesetVersion?: string;\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n /** Not mentioned in 1.0 spec but some tilesets contain this option */\n gltfUpAxis?: string;\n };\n /** A dictionary object of metadata about per-feature properties. */\n properties?: Record<string, TilesetProperty>;\n /** The error, in meters, introduced if this tileset is not rendered. At runtime, the geometric error is used to compute screen space error (SSE), i.e., the error measured in pixels. */\n geometricError: number;\n /** A tile in a 3D Tiles tileset. */\n root: Tiles3DTileJSON;\n /** Names of 3D Tiles extensions used somewhere in this tileset. */\n extensionsUsed?: string[];\n /** Names of 3D Tiles extensions required to properly load this tileset. */\n extensionsRequired?: string[];\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n};\n\n/** TilesetJSON postprocessed by Tiles3DLoader */\nexport type Tiles3DTilesetJSONPostprocessed = Omit<Tiles3DTilesetJSON, 'root'> & {\n /**\n * Loader used\n * @deprecated\n */\n loader: LoaderWithParser;\n /** URL used to load a tileset resource */\n url: string;\n /** HTTP request query string */\n queryString: string;\n /** base path that non-absolute paths in tileset are relative to. */\n basePath: string;\n /** tileset type */\n type: TILESET_TYPE.TILES3D;\n /** LOD metric type */\n lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR;\n /** LOD metric value */\n lodMetricValue: number;\n /** Postprocessed root */\n root: Tiles3DTileJSONPostprocessed;\n};\n\n/**\n * A tile in a 3D Tiles tileset.\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#tile\n */\nexport type Tiles3DTileJSON = {\n /** A bounding volume that encloses a tile or its content. */\n boundingVolume: Tile3DBoundingVolume;\n /** A bounding volume that encloses a tile or its content. */\n viewerRequestVolume?: object;\n /** The error, in meters, introduced if this tile is rendered and its children are not. At runtime, the geometric error is used to compute screen space error (SSE), i.e., the error measured in pixels. */\n geometricError: number;\n /**\n * Specifies if additive or replacement refinement is used when traversing the tileset for rendering. This property is required for the root tile of a tileset; it is optional for all other tiles.\n * The default is to inherit from the parent tile.\n */\n refine?: string;\n /** A floating-point 4x4 affine transformation matrix, stored in column-major order, that transforms the tile's content */\n transform?: number[];\n /** Metadata about the tile's content and a link to the content. */\n content?: Tiles3DTileContentJSON;\n /** An array of objects that define child tiles. */\n children: Tiles3DTileJSON[];\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n\n /** 3DTiles v1.1 properties\n * https://github.com/CesiumGS/3d-tiles/blob/draft-1.1/specification/schema/tile.schema.json\n */\n /** This object allows a tile to be implicitly subdivided. Tile and content availability and metadata is stored in subtrees which are referenced externally. */\n implicitTiling?: ImplicitTilingData;\n};\n\nexport type Tiles3DTileJSONPostprocessed = Omit<Tiles3DTileJSON, 'refine' | 'children'> & {\n /** Unique ID */\n id?: string;\n /** Content full URL */\n contentUrl?: string;\n /** LOD metric type */\n lodMetricType?: LOD_METRIC_TYPE.GEOMETRIC_ERROR;\n /** LOD metric value */\n lodMetricValue?: number;\n /** Duplicate of transform */\n transformMatrix?: number[];\n /** Type of tile */\n type?: TILE_TYPE | string;\n /**\n * Specifies if additive or replacement refinement is used when traversing the tileset for rendering. This property is required for the root tile of a tileset; it is optional for all other tiles.\n * The default is to inherit from the parent tile.\n */\n refine?: TILE_REFINEMENT | string;\n /** An array of objects that define child tiles. */\n children: Tiles3DTileJSONPostprocessed[];\n};\n\n/** Metadata about the tile's content and a link to the content. */\nexport type Tiles3DTileContentJSON = {\n /** A uri that points to the tile's content. When the uri is relative, it is relative to the referring tileset JSON file. */\n uri: string;\n /** url doesn't allign the spec but we support it same way as uri */\n url?: string;\n /** A bounding volume that encloses a tile or its content. At least one bounding volume property is required. Bounding volumes include box, region, or sphere. */\n boundingVolume?: Tile3DBoundingVolume;\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n};\n\n/** A bounding volume that encloses a tile or its content.\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#bounding-volume\n */\nexport type Tile3DBoundingVolume = {\n /** An array of 12 numbers that define an oriented bounding box. The first three elements define the x, y, and z values for the center of the box.\n * The next three elements (with indices 3, 4, and 5) define the x axis direction and half-length. The next three elements (indices 6, 7, and 8) define\n * the y axis direction and half-length. The last three elements (indices 9, 10, and 11) define the z axis direction and half-length. */\n box?: number[];\n /** An array of four numbers that define a bounding sphere. The first three elements define the x, y, and z values for the center of the sphere.\n * The last element (with index 3) defines the radius in meters. */\n sphere?: number[];\n /** An array of six numbers that define a bounding geographic region in EPSG:4979 coordinates with the order [west, south, east, north, minimum height, maximum height].\n * Longitudes and latitudes are in radians, and heights are in meters above (or below) the WGS84 ellipsoid. */\n region?: number[];\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n};\n\n/**\n * A dictionary object of metadata about per-feature properties.\n * https://github.com/CesiumGS/3d-tiles/tree/main/specification#properties\n */\nexport type TilesetProperty = {\n /** The maximum value of this property of all the features in the tileset. */\n maximum: number;\n /** The minimum value of this property of all the features in the tileset. */\n minimum: number;\n /** Dictionary object with extension-specific objects. */\n extensions?: object;\n /** Application-specific data. */\n extras?: any;\n};\n\nexport type Tiles3DTileContent = {\n shape: 'tile3d';\n\n /** Common properties */\n byteOffset?: number;\n type?: string;\n featureIds?: null;\n\n /** 3DTile header */\n magic?: number;\n version?: number;\n byteLength?: number;\n\n /** 3DTile tables header */\n header?: {\n featureTableJsonByteLength?: number;\n featureTableBinaryByteLength?: number;\n batchTableJsonByteLength?: number;\n batchTableBinaryByteLength?: number;\n batchLength?: number;\n };\n\n /** 3DTile tables */\n featureTableJson?:\n | {\n BATCH_LENGTH?: number;\n }\n | Record<string, any>;\n featureTableBinary?: Uint8Array;\n batchTableJson?: Record<string, (string | number)[]>;\n batchTableBinary?: Uint8Array;\n rtcCenter?: number[];\n\n /** 3DTile glTF */\n gltfArrayBuffer?: ArrayBuffer;\n gltfByteOffset?: number;\n gltfByteLength?: number;\n rotateYtoZ?: boolean;\n gltfUpAxis?: 'x' | 'X' | 'y' | 'Y' | 'z' | 'Z';\n gltfUrl?: string;\n gpuMemoryUsageInBytes?: number;\n gltf?: GLTFPostprocessed;\n\n /** For Composite tiles */\n tilesLength?: number;\n tiles?: Tiles3DTileContent[];\n\n /** For Instances model and Pointcloud tiles */\n featuresLength?: number;\n\n /** For Instanced model tiles */\n gltfFormat?: number;\n eastNorthUp?: boolean;\n normalUp?: number[];\n normalRight?: number[];\n hasCustomOrientation?: boolean;\n octNormalUp?: number[];\n octNormalRight?: number[];\n instances?: {\n modelMatrix: Matrix4;\n batchId: number;\n }[];\n\n /** For Pointcloud tiles */\n attributes?: {\n positions: null | number[];\n colors:\n | null\n | number[]\n | {type: number; value: Uint8ClampedArray; size: number; normalized: boolean};\n normals: null | number[] | {type: number; size: number; value: Float32Array};\n batchIds: null | number[];\n };\n constantRGBA?: number[];\n isQuantized?: boolean;\n isTranslucent?: boolean;\n isRGB565?: boolean;\n isOctEncoded16P?: boolean;\n pointsLength?: number;\n pointCount?: number;\n batchIds?: number[];\n hasPositions?: boolean;\n hasColors?: boolean;\n hasNormals?: boolean;\n hasBatchIds?: boolean;\n quantizedVolumeScale?: Vector3;\n quantizedVolumeOffset?: Vector3;\n quantizedRange?: number;\n isQuantizedDraco?: boolean;\n octEncodedRange?: number;\n isOctEncodedDraco?: boolean;\n};\n\n/**\n * 3DTILES_implicit_tiling types\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling\n * JSON Schema v1.1 https://github.com/CesiumGS/3d-tiles/blob/8e5e67e078850cc8ce15bd1873fe54f11bbee02f/specification/schema/Subtree/subtree.schema.json\n * JSON Schema vNext https://github.com/CesiumGS/3d-tiles/blob/8e5e67e078850cc8ce15bd1873fe54f11bbee02f/extensions/3DTILES_implicit_tiling/schema/subtree/subtree.schema.json\n */\nexport type Subtree = {\n /** An array of buffers. */\n buffers: Buffer[];\n /** An array of buffer views. */\n bufferViews: BufferView[];\n /** The availability of tiles in the subtree. The availability bitstream is a 1D boolean array where tiles are ordered by their level in the subtree and Morton index\n * within that level. A tile's availability is determined by a single bit, 1 meaning a tile exists at that spatial index, and 0 meaning it does not.\n * The number of elements in the array is `(N^subtreeLevels - 1)/(N - 1)` where N is 4 for subdivision scheme `QUADTREE` and 8 for `OCTREE`.\n * Availability may be stored in a buffer view or as a constant value that applies to all tiles. If a non-root tile's availability is 1 its parent\n * tile's availability shall also be 1. `tileAvailability.constant: 0` is disallowed, as subtrees shall have at least one tile.\n */\n tileAvailability: Availability;\n /** It is array by spec but there are tiles that has a single object\n * An array of content availability objects. If the tile has a single content this array will have one element; if the tile has multiple contents -\n * as supported by 3DTILES_multiple_contents and 3D Tiles 1.1 - this array will have multiple elements.\n */\n contentAvailability: Availability | Availability[];\n /** The availability of children subtrees. The availability bitstream is a 1D boolean array where subtrees are ordered by their Morton index in the level of the tree\n * immediately below the bottom row of the subtree. A child subtree's availability is determined by a single bit, 1 meaning a subtree exists at that spatial index,\n * and 0 meaning it does not. The number of elements in the array is `N^subtreeLevels` where N is 4 for subdivision scheme `QUADTREE` and 8 for `OCTREE`.\n * Availability may be stored in a buffer view or as a constant value that applies to all child subtrees. If availability is 0 for all child subtrees,\n * then the tileset does not subdivide further.\n */\n childSubtreeAvailability: Availability;\n // TODO: These are unused properties. Improve types when they are required\n propertyTables: unknown;\n tileMetadata: unknown;\n contentMetadata: unknown;\n subtreeMetadata: unknown;\n};\n\nexport type Availability = {\n /** Integer indicating whether all of the elements are available (1) or all are unavailable (0). */\n constant?: 0 | 1;\n /** Index of a buffer view that indicates whether each element is available. The bitstream conforms to the boolean array encoding described\n * in the 3D Metadata specification. If an element is available, its bit is 1, and if it is unavailable, its bit is 0. */\n bitstream?: number;\n /**\n * v1.1 https://github.com/CesiumGS/3d-tiles/blob/8e5e67e078850cc8ce15bd1873fe54f11bbee02f/specification/schema/Subtree/availability.schema.json\n * vNext https://github.com/CesiumGS/3d-tiles/blob/8e5e67e078850cc8ce15bd1873fe54f11bbee02f/extensions/3DTILES_implicit_tiling/schema/subtree/availability.schema.json\n * The schemas of vNext and 1.1 are same but there are tiles with `bufferView` property instead of `bitstream`\n */\n bufferView?: number;\n /**\n * Postprocessing property\n * contain availability bits loaded from the bufferView\n */\n explicitBitstream?: ExplicitBitstream;\n};\n\nexport type ExplicitBitstream = Uint8Array;\n\n/**\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling#subdivision-scheme\n */\nexport type SubdivisionScheme = 'QUADTREE' | 'OCTREE';\n\ntype Buffer = {\n name: string;\n uri?: string;\n byteLength: number;\n};\n\n/** Subtree buffer view */\nexport type BufferView = {\n buffer: number;\n byteOffset: number;\n byteLength: number;\n};\n\n/**\n * Spec - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling\n */\nexport type ImplicitTilingExensionData = ImplicitTilingData & {\n /** This property is not part of the schema\n * https://github.com/CesiumGS/3d-tiles/blob/main/extensions/3DTILES_implicit_tiling/schema/tile.3DTILES_implicit_tiling.schema.json\n * But it can be seen in some test datasets. It is handled as substitute of `availableLevels`\n */\n maximumLevel?: number;\n};\n\n/** 3DTiles v1.1 types */\n\n/**\n * This object allows a tile to be implicitly subdivided. Tile and content availability and metadata is stored in subtrees which are referenced externally.\n * https://github.com/CesiumGS/3d-tiles/blob/draft-1.1/specification/schema/tile.implicitTiling.schema.json\n * */\ntype ImplicitTilingData = {\n /** A string describing the subdivision scheme used within the tileset. */\n subdivisionScheme: 'QUADTREE' | 'OCTREE' | string;\n /** The number of distinct levels in each subtree. For example, a quadtree with `subtreeLevels = 2` will have subtrees with 5 nodes (one root and 4 children). */\n subtreeLevels: number;\n /** The numbers of the levels in the tree with available tiles. */\n availableLevels: number;\n /** An object describing the location of subtree files. */\n subtrees: {\n /** A template URI pointing to subtree files. A subtree is a fixed-depth (defined by `subtreeLevels`) portion of the tree to keep memory use bounded.\n * The URI of each file is substituted with the subtree root's global level, x, and y. For subdivision scheme `OCTREE`, z shall also be given. Relative paths are relative to the tileset JSON. */\n uri: string;\n };\n};\n"],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  export { Tiles3DLoader } from './tiles-3d-loader';
2
2
  export { CesiumIonLoader } from './cesium-ion-loader';
3
3
  export { Tile3DSubtreeLoader } from './tile-3d-subtree-loader';
4
- export type { TZ3LoaderOptions } from './tz3-loader';
5
- export { TZ3Loader } from './tz3-loader';
4
+ export type { Tiles3DArchiveFileLoaderOptions } from './3d-tiles-archive-loader';
5
+ export { Tiles3DArchiveFileLoader } from './3d-tiles-archive-loader';
6
+ export { Tiles3DArchiveFileSystem } from './lib/filesystems/tiles-3d-archive-file-system';
6
7
  export { Tile3DWriter } from './tile-3d-writer';
7
8
  export { default as Tile3DFeatureTable } from './lib/classes/tile-3d-feature-table';
8
9
  export { default as Tile3DBatchTable } from './lib/classes/tile-3d-batch-table';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAC,mBAAmB,EAAC,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,mCAAmC,CAAC;AAG9E,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAC,qBAAqB,IAAI,sBAAsB,EAAC,MAAM,eAAe,CAAC;AAC9E,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,4BAA4B,EAC5B,kBAAkB,EAClB,+BAA+B,EAC/B,kBAAkB,EAClB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AACjB,YAAY,EAAC,oBAAoB,EAAC,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAC,mBAAmB,EAAC,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EAAC,+BAA+B,EAAC,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAC,wBAAwB,EAAC,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAC,wBAAwB,EAAC,MAAM,gDAAgD,CAAC;AAGxF,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,mCAAmC,CAAC;AAG9E,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAC,qBAAqB,IAAI,sBAAsB,EAAC,MAAM,eAAe,CAAC;AAC9E,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,4BAA4B,EAC5B,kBAAkB,EAClB,+BAA+B,EAC/B,kBAAkB,EAClB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AACjB,YAAY,EAAC,oBAAoB,EAAC,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports._getIonTilesetMetadata = exports.TILE3D_TYPE = exports.Tile3DBatchTable = exports.Tile3DFeatureTable = exports.Tile3DWriter = exports.TZ3Loader = exports.Tile3DSubtreeLoader = exports.CesiumIonLoader = exports.Tiles3DLoader = void 0;
6
+ exports._getIonTilesetMetadata = exports.TILE3D_TYPE = exports.Tile3DBatchTable = exports.Tile3DFeatureTable = exports.Tile3DWriter = exports.Tiles3DArchiveFileSystem = exports.Tiles3DArchiveFileLoader = exports.Tile3DSubtreeLoader = exports.CesiumIonLoader = exports.Tiles3DLoader = void 0;
7
7
  // LOADERS
8
8
  var tiles_3d_loader_1 = require("./tiles-3d-loader");
9
9
  Object.defineProperty(exports, "Tiles3DLoader", { enumerable: true, get: function () { return tiles_3d_loader_1.Tiles3DLoader; } });
@@ -11,8 +11,10 @@ var cesium_ion_loader_1 = require("./cesium-ion-loader");
11
11
  Object.defineProperty(exports, "CesiumIonLoader", { enumerable: true, get: function () { return cesium_ion_loader_1.CesiumIonLoader; } });
12
12
  var tile_3d_subtree_loader_1 = require("./tile-3d-subtree-loader");
13
13
  Object.defineProperty(exports, "Tile3DSubtreeLoader", { enumerable: true, get: function () { return tile_3d_subtree_loader_1.Tile3DSubtreeLoader; } });
14
- var tz3_loader_1 = require("./tz3-loader");
15
- Object.defineProperty(exports, "TZ3Loader", { enumerable: true, get: function () { return tz3_loader_1.TZ3Loader; } });
14
+ var _3d_tiles_archive_loader_1 = require("./3d-tiles-archive-loader");
15
+ Object.defineProperty(exports, "Tiles3DArchiveFileLoader", { enumerable: true, get: function () { return _3d_tiles_archive_loader_1.Tiles3DArchiveFileLoader; } });
16
+ var tiles_3d_archive_file_system_1 = require("./lib/filesystems/tiles-3d-archive-file-system");
17
+ Object.defineProperty(exports, "Tiles3DArchiveFileSystem", { enumerable: true, get: function () { return tiles_3d_archive_file_system_1.Tiles3DArchiveFileSystem; } });
16
18
  // WRITERS
17
19
  var tile_3d_writer_1 = require("./tile-3d-writer");
18
20
  Object.defineProperty(exports, "Tile3DWriter", { enumerable: true, get: function () { return tile_3d_writer_1.Tile3DWriter; } });
@@ -0,0 +1,32 @@
1
+ import { FileProvider } from '@loaders.gl/loader-utils';
2
+ import { ZipFileSystem, HashElement } from '@loaders.gl/zip';
3
+ /**
4
+ * FileSystem adapter for a 3tz (3D tiles archive format) file
5
+ * Holds FileProvider object that provides random access to archived files.
6
+ * The difference from ZipFileSystem is usage of `@3dtilesIndex1@` index file that increases
7
+ * access speed to archived files
8
+ * @see https://github.com/erikdahlstrom/3tz-specification/blob/master/Specification.md
9
+ */
10
+ export declare class Tiles3DArchiveFileSystem extends ZipFileSystem {
11
+ hashData?: HashElement[] | null;
12
+ /**
13
+ * Constructor
14
+ * @param file - instance of FileProvider or file path string
15
+ */
16
+ constructor(file: FileProvider | string);
17
+ /**
18
+ * Implementation of fetch against this file system.
19
+ * It tries to take `@3dtilesIndex1@` file from the archive and use it
20
+ * for faster access to archived files
21
+ * @param filename - name of a file
22
+ * @returns - Response with file data
23
+ */
24
+ fetch(filename: string): Promise<Response>;
25
+ /**
26
+ * Try to get and parse '@3dtilesIndex1@' file, that allows to get direct access
27
+ * to files inside the archive
28
+ * @returns void
29
+ */
30
+ private parseHashFile;
31
+ }
32
+ //# sourceMappingURL=tiles-3d-archive-file-system.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tiles-3d-archive-file-system.d.ts","sourceRoot":"","sources":["../../../src/lib/filesystems/tiles-3d-archive-file-system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,EACL,aAAa,EAIb,WAAW,EAGZ,MAAM,iBAAiB,CAAC;AAGzB;;;;;;GAMG;AACH,qBAAa,wBAAyB,SAAQ,aAAa;IACzD,QAAQ,CAAC,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;IAEhC;;;OAGG;gBACS,IAAI,EAAE,YAAY,GAAG,MAAM;IAIvC;;;;;;OAMG;IACG,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAiBhD;;;;OAIG;YACW,aAAa;CAqC5B"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Tiles3DArchiveFileSystem = void 0;
4
+ const zip_1 = require("@loaders.gl/zip");
5
+ const _3d_tiles_archive_archive_1 = require("../../3d-tiles-archive/3d-tiles-archive-archive");
6
+ /**
7
+ * FileSystem adapter for a 3tz (3D tiles archive format) file
8
+ * Holds FileProvider object that provides random access to archived files.
9
+ * The difference from ZipFileSystem is usage of `@3dtilesIndex1@` index file that increases
10
+ * access speed to archived files
11
+ * @see https://github.com/erikdahlstrom/3tz-specification/blob/master/Specification.md
12
+ */
13
+ class Tiles3DArchiveFileSystem extends zip_1.ZipFileSystem {
14
+ /**
15
+ * Constructor
16
+ * @param file - instance of FileProvider or file path string
17
+ */
18
+ constructor(file) {
19
+ super(file);
20
+ }
21
+ /**
22
+ * Implementation of fetch against this file system.
23
+ * It tries to take `@3dtilesIndex1@` file from the archive and use it
24
+ * for faster access to archived files
25
+ * @param filename - name of a file
26
+ * @returns - Response with file data
27
+ */
28
+ async fetch(filename) {
29
+ const fileProvider = await this.fileProvider;
30
+ if (!fileProvider) {
31
+ throw new Error('No data detected in the zip archive');
32
+ }
33
+ await this.parseHashFile();
34
+ if (this.hashData) {
35
+ const archive = new _3d_tiles_archive_archive_1.Tiles3DArchive(fileProvider, this.hashData);
36
+ const fileData = await archive.getFile(filename);
37
+ const response = new Response(fileData);
38
+ Object.defineProperty(response, 'url', { value: `${this.fileName || ''}/${filename}` });
39
+ return response;
40
+ }
41
+ return super.fetch(filename);
42
+ }
43
+ /**
44
+ * Try to get and parse '@3dtilesIndex1@' file, that allows to get direct access
45
+ * to files inside the archive
46
+ * @returns void
47
+ */
48
+ async parseHashFile() {
49
+ if (this.hashData !== undefined) {
50
+ return;
51
+ }
52
+ const fileProvider = await this.fileProvider;
53
+ if (!fileProvider) {
54
+ throw new Error('No data detected in the zip archive');
55
+ }
56
+ const hashCDOffset = await (0, zip_1.searchFromTheEnd)(fileProvider, zip_1.cdSignature);
57
+ const cdFileHeader = await (0, zip_1.parseZipCDFileHeader)(hashCDOffset, fileProvider);
58
+ // '@3dtilesIndex1@' is index file that must be the last in the archive. It allows
59
+ // to improve load and read performance when the archive contains a very large number
60
+ // of files.
61
+ if (cdFileHeader?.fileName === '@3dtilesIndex1@') {
62
+ const localFileHeader = await (0, zip_1.parseZipLocalFileHeader)(cdFileHeader.localHeaderOffset, fileProvider);
63
+ if (!localFileHeader) {
64
+ throw new Error('corrupted 3tz');
65
+ }
66
+ const fileDataOffset = localFileHeader.fileDataOffset;
67
+ const hashFile = await fileProvider.slice(fileDataOffset, fileDataOffset + localFileHeader.compressedSize);
68
+ this.hashData = (0, zip_1.parseHashFile)(hashFile);
69
+ }
70
+ else {
71
+ this.hashData = null;
72
+ }
73
+ }
74
+ }
75
+ exports.Tiles3DArchiveFileSystem = Tiles3DArchiveFileSystem;
@@ -1 +1 @@
1
- {"version":3,"file":"parse-3d-tile-gltf-view.d.ts","sourceRoot":"","sources":["../../../../src/lib/parsers/helpers/parse-3d-tile-gltf-view.ts"],"names":[],"mappings":"AAUA,OAAO,EAAC,aAAa,EAAmB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAC,oBAAoB,EAAC,MAAM,0BAA0B,CAAC;AAE9D,eAAO,MAAM,WAAW;;;CAGvB,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,kBAAkB,EACxB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,oBAAoB,GAAG,SAAS,UAqC1C;AAED,wBAAsB,WAAW,CAC/B,IAAI,EAAE,kBAAkB,EACxB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,IAAI,CAAC,CAyBf"}
1
+ {"version":3,"file":"parse-3d-tile-gltf-view.d.ts","sourceRoot":"","sources":["../../../../src/lib/parsers/helpers/parse-3d-tile-gltf-view.ts"],"names":[],"mappings":"AAUA,OAAO,EAAC,aAAa,EAAqC,MAAM,0BAA0B,CAAC;AAC3F,OAAO,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAC,oBAAoB,EAAC,MAAM,0BAA0B,CAAC;AAE9D,eAAO,MAAM,WAAW;;;CAGvB,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,kBAAkB,EACxB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,oBAAoB,GAAG,SAAS,UAqC1C;AAED,wBAAsB,WAAW,CAC/B,IAAI,EAAE,kBAAkB,EACxB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,IAAI,CAAC,CA8Bf"}
@@ -55,15 +55,15 @@ async function extractGLTF(tile, gltfFormat, options, context) {
55
55
  if (!context) {
56
56
  return;
57
57
  }
58
- const { parse, fetch } = context;
59
58
  if (tile.gltfUrl) {
59
+ const { fetch } = context;
60
60
  const response = await fetch(tile.gltfUrl, options);
61
61
  tile.gltfArrayBuffer = await response.arrayBuffer();
62
62
  tile.gltfByteOffset = 0;
63
63
  }
64
64
  if (tile.gltfArrayBuffer) {
65
65
  // TODO - Should handle byteOffset... However, not used now...
66
- const gltfWithBuffers = await parse(tile.gltfArrayBuffer, gltf_1.GLTFLoader, options, context);
66
+ const gltfWithBuffers = await (0, loader_utils_1.parseFromContext)(tile.gltfArrayBuffer, gltf_1.GLTFLoader, options, context);
67
67
  tile.gltf = (0, gltf_1.postProcessGLTF)(gltfWithBuffers);
68
68
  tile.gpuMemoryUsageInBytes = (0, gltf_1._getMemoryUsageGLTF)(tile.gltf);
69
69
  delete tile.gltfArrayBuffer;
@@ -14,7 +14,7 @@ async function parseComposite3DTile(tile, arrayBuffer, byteOffset, options, cont
14
14
  // extract each tile from the byte stream
15
15
  tile.tiles = [];
16
16
  while (tile.tiles.length < tile.tilesLength && (tile.byteLength || 0) - byteOffset > 12) {
17
- const subtile = {};
17
+ const subtile = { shape: 'tile3d' };
18
18
  tile.tiles.push(subtile);
19
19
  byteOffset = await parse3DTile(arrayBuffer, byteOffset, options, context, subtile);
20
20
  // TODO - do we need to add any padding in between tiles?
@@ -1,5 +1,5 @@
1
- import type { LoaderContext } from '@loaders.gl/loader-utils';
1
+ import { LoaderContext } from '@loaders.gl/loader-utils';
2
2
  import type { Tiles3DLoaderOptions } from '../../tiles-3d-loader';
3
3
  import { Tiles3DTileContent } from '../../types';
4
- export declare function parseGltf3DTile(tile: Tiles3DTileContent, arrayBuffer: ArrayBuffer, options?: Tiles3DLoaderOptions, context?: LoaderContext): Promise<void>;
4
+ export declare function parseGltf3DTile(tile: Tiles3DTileContent, arrayBuffer: ArrayBuffer, options?: Tiles3DLoaderOptions, context?: LoaderContext): Promise<number>;
5
5
  //# sourceMappingURL=parse-3d-tile-gltf.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-3d-tile-gltf.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-3d-tile-gltf.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAC,kBAAkB,EAAC,MAAM,aAAa,CAAC;AAE/C,wBAAsB,eAAe,CACnC,IAAI,EAAE,kBAAkB,EACxB,WAAW,EAAE,WAAW,EACxB,OAAO,CAAC,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,IAAI,CAAC,CAsBf"}
1
+ {"version":3,"file":"parse-3d-tile-gltf.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-3d-tile-gltf.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAEzE,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAC,kBAAkB,EAAC,MAAM,aAAa,CAAC;AAE/C,wBAAsB,eAAe,CACnC,IAAI,EAAE,kBAAkB,EACxB,WAAW,EAAE,WAAW,EACxB,OAAO,CAAC,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,MAAM,CAAC,CAqBjB"}