@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 +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":""}
@@ -1,22 +1,18 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import md5 from 'md5';
3
3
  import { parseZipLocalFileHeader, findBin } from '@loaders.gl/zip';
4
- import { DeflateCompression } from '@loaders.gl/compression';
4
+ import { DeflateCompression, NoCompression } from '@loaders.gl/compression';
5
5
  const COMPRESSION_METHODS = {
6
- 0: async compressedFile => compressedFile,
7
- 8: async compressedFile => {
8
- const compression = new DeflateCompression({
9
- raw: true
10
- });
11
- const decompressedData = await compression.decompress(compressedFile);
12
- return decompressedData;
13
- }
6
+ 0: data => new NoCompression().decompress(data),
7
+ 8: data => new DeflateCompression({
8
+ raw: true
9
+ }).decompress(data)
14
10
  };
15
- export class TZ3Archive {
16
- constructor(tz3Archive, hashFile) {
17
- _defineProperty(this, "tz3Archive", void 0);
11
+ export class Tiles3DArchive {
12
+ constructor(fileProvider, hashFile) {
13
+ _defineProperty(this, "fileProvider", void 0);
18
14
  _defineProperty(this, "hashArray", void 0);
19
- this.tz3Archive = tz3Archive;
15
+ this.fileProvider = fileProvider;
20
16
  this.hashArray = hashFile;
21
17
  }
22
18
  async getFile(path) {
@@ -25,10 +21,9 @@ export class TZ3Archive {
25
21
  data = await this.getFileBytes(path);
26
22
  }
27
23
  if (!data) {
28
- throw new Error('No such file in the archieve');
24
+ throw new Error('No such file in the archive');
29
25
  }
30
- const decompressedFile = Buffer.from(data);
31
- return decompressedFile;
26
+ return data;
32
27
  }
33
28
  async getFileBytes(path) {
34
29
  const nameHash = Buffer.from(md5(path), 'hex');
@@ -36,11 +31,11 @@ export class TZ3Archive {
36
31
  if (!fileInfo) {
37
32
  return null;
38
33
  }
39
- const localFileHeader = await parseZipLocalFileHeader(fileInfo.offset, this.tz3Archive);
34
+ const localFileHeader = await parseZipLocalFileHeader(fileInfo.offset, this.fileProvider);
40
35
  if (!localFileHeader) {
41
36
  return null;
42
37
  }
43
- const compressedFile = await this.tz3Archive.slice(localFileHeader.fileDataOffset, localFileHeader.fileDataOffset + localFileHeader.compressedSize);
38
+ const compressedFile = await this.fileProvider.slice(localFileHeader.fileDataOffset, localFileHeader.fileDataOffset + localFileHeader.compressedSize);
44
39
  const compressionMethod = COMPRESSION_METHODS[localFileHeader.compressionMethod];
45
40
  if (!compressionMethod) {
46
41
  throw Error('Only Deflation compression is supported');
@@ -48,4 +43,4 @@ export class TZ3Archive {
48
43
  return compressionMethod(compressedFile);
49
44
  }
50
45
  }
51
- //# sourceMappingURL=tz3-archive.js.map
46
+ //# sourceMappingURL=3d-tiles-archive-archive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"3d-tiles-archive-archive.js","names":["md5","parseZipLocalFileHeader","findBin","DeflateCompression","NoCompression","COMPRESSION_METHODS","data","decompress","raw","Tiles3DArchive","constructor","fileProvider","hashFile","_defineProperty","hashArray","getFile","path","getFileBytes","toLocaleLowerCase","Error","nameHash","Buffer","from","fileInfo","localFileHeader","offset","compressedFile","slice","fileDataOffset","compressedSize","compressionMethod"],"sources":["../../../src/3d-tiles-archive/3d-tiles-archive-archive.ts"],"sourcesContent":["import md5 from 'md5';\nimport {FileProvider} from '@loaders.gl/loader-utils';\nimport {parseZipLocalFileHeader, HashElement, findBin} from '@loaders.gl/zip';\nimport {DeflateCompression, NoCompression} from '@loaders.gl/compression';\n\ntype CompressionHandler = (compressedFile: ArrayBuffer) => Promise<ArrayBuffer>;\n\n/**\n * Handling different compression types in zip\n */\nconst COMPRESSION_METHODS: {[key: number]: CompressionHandler} = {\n /** No compression */\n 0: (data) => new NoCompression().decompress(data),\n /** Deflation */\n 8: (data) => new DeflateCompression({raw: true}).decompress(data)\n};\n\n/**\n * Class for handling information about 3tz file\n */\nexport class Tiles3DArchive {\n /** FileProvider with whe whole file */\n private fileProvider: FileProvider;\n /** hash info */\n private hashArray: HashElement[];\n\n /**\n * creates Tiles3DArchive handler\n * @param fileProvider - FileProvider with the whole file\n * @param hashFile - hash info\n */\n constructor(fileProvider: FileProvider, hashFile: HashElement[]) {\n this.fileProvider = fileProvider;\n this.hashArray = hashFile;\n }\n\n /**\n * Returns file with the given path from 3tz archive\n * @param path - path inside the 3tz\n * @returns buffer with ready to use file\n */\n async getFile(path: string): Promise<ArrayBuffer> {\n // sometimes paths are not in lower case when hash file is created,\n // so first we're looking for lower case file name and then for original one\n let data = await this.getFileBytes(path.toLocaleLowerCase());\n if (!data) {\n data = await this.getFileBytes(path);\n }\n if (!data) {\n throw new Error('No such file in the archive');\n }\n\n return data;\n }\n\n /**\n * Trying to get raw file data by adress\n * @param path - path inside the archive\n * @returns buffer with the raw file data\n */\n private async getFileBytes(path: string): Promise<ArrayBuffer | null> {\n const nameHash = Buffer.from(md5(path), 'hex');\n const fileInfo = findBin(nameHash, this.hashArray); // implement binary search\n if (!fileInfo) {\n return null;\n }\n\n const localFileHeader = await parseZipLocalFileHeader(fileInfo.offset, this.fileProvider);\n if (!localFileHeader) {\n return null;\n }\n\n const compressedFile = await this.fileProvider.slice(\n localFileHeader.fileDataOffset,\n localFileHeader.fileDataOffset + localFileHeader.compressedSize\n );\n\n const compressionMethod = COMPRESSION_METHODS[localFileHeader.compressionMethod];\n if (!compressionMethod) {\n throw Error('Only Deflation compression is supported');\n }\n\n return compressionMethod(compressedFile);\n }\n}\n"],"mappings":";AAAA,OAAOA,GAAG,MAAM,KAAK;AAErB,SAAQC,uBAAuB,EAAeC,OAAO,QAAO,iBAAiB;AAC7E,SAAQC,kBAAkB,EAAEC,aAAa,QAAO,yBAAyB;AAOzE,MAAMC,mBAAwD,GAAG;EAE/D,CAAC,EAAGC,IAAI,IAAK,IAAIF,aAAa,CAAC,CAAC,CAACG,UAAU,CAACD,IAAI,CAAC;EAEjD,CAAC,EAAGA,IAAI,IAAK,IAAIH,kBAAkB,CAAC;IAACK,GAAG,EAAE;EAAI,CAAC,CAAC,CAACD,UAAU,CAACD,IAAI;AAClE,CAAC;AAKD,OAAO,MAAMG,cAAc,CAAC;EAW1BC,WAAWA,CAACC,YAA0B,EAAEC,QAAuB,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAC/D,IAAI,CAACF,YAAY,GAAGA,YAAY;IAChC,IAAI,CAACG,SAAS,GAAGF,QAAQ;EAC3B;EAOA,MAAMG,OAAOA,CAACC,IAAY,EAAwB;IAGhD,IAAIV,IAAI,GAAG,MAAM,IAAI,CAACW,YAAY,CAACD,IAAI,CAACE,iBAAiB,CAAC,CAAC,CAAC;IAC5D,IAAI,CAACZ,IAAI,EAAE;MACTA,IAAI,GAAG,MAAM,IAAI,CAACW,YAAY,CAACD,IAAI,CAAC;IACtC;IACA,IAAI,CAACV,IAAI,EAAE;MACT,MAAM,IAAIa,KAAK,CAAC,6BAA6B,CAAC;IAChD;IAEA,OAAOb,IAAI;EACb;EAOA,MAAcW,YAAYA,CAACD,IAAY,EAA+B;IACpE,MAAMI,QAAQ,GAAGC,MAAM,CAACC,IAAI,CAACtB,GAAG,CAACgB,IAAI,CAAC,EAAE,KAAK,CAAC;IAC9C,MAAMO,QAAQ,GAAGrB,OAAO,CAACkB,QAAQ,EAAE,IAAI,CAACN,SAAS,CAAC;IAClD,IAAI,CAACS,QAAQ,EAAE;MACb,OAAO,IAAI;IACb;IAEA,MAAMC,eAAe,GAAG,MAAMvB,uBAAuB,CAACsB,QAAQ,CAACE,MAAM,EAAE,IAAI,CAACd,YAAY,CAAC;IACzF,IAAI,CAACa,eAAe,EAAE;MACpB,OAAO,IAAI;IACb;IAEA,MAAME,cAAc,GAAG,MAAM,IAAI,CAACf,YAAY,CAACgB,KAAK,CAClDH,eAAe,CAACI,cAAc,EAC9BJ,eAAe,CAACI,cAAc,GAAGJ,eAAe,CAACK,cACnD,CAAC;IAED,MAAMC,iBAAiB,GAAGzB,mBAAmB,CAACmB,eAAe,CAACM,iBAAiB,CAAC;IAChF,IAAI,CAACA,iBAAiB,EAAE;MACtB,MAAMX,KAAK,CAAC,yCAAyC,CAAC;IACxD;IAEA,OAAOW,iBAAiB,CAACJ,cAAc,CAAC;EAC1C;AACF"}
@@ -1,6 +1,6 @@
1
1
  import { cdSignature as cdHeaderSignature, generateHashInfo, parseHashFile, parseZipCDFileHeader, parseZipLocalFileHeader, searchFromTheEnd } from '@loaders.gl/zip';
2
- import { TZ3Archive } from './tz3-archive';
3
- export const parse3tz = async (fileProvider, cb) => {
2
+ import { Tiles3DArchive } from './3d-tiles-archive-archive';
3
+ export const parse3DTilesArchive = async (fileProvider, cb) => {
4
4
  const hashCDOffset = await searchFromTheEnd(fileProvider, cdHeaderSignature);
5
5
  const cdFileHeader = await parseZipCDFileHeader(hashCDOffset, fileProvider);
6
6
  let hashData;
@@ -18,6 +18,6 @@ export const parse3tz = async (fileProvider, cb) => {
18
18
  const hashFile = await fileProvider.slice(fileDataOffset, fileDataOffset + localFileHeader.compressedSize);
19
19
  hashData = parseHashFile(hashFile);
20
20
  }
21
- return new TZ3Archive(fileProvider, hashData);
21
+ return new Tiles3DArchive(fileProvider, hashData);
22
22
  };
23
- //# sourceMappingURL=tz3-parser.js.map
23
+ //# sourceMappingURL=3d-tiles-archive-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"3d-tiles-archive-parser.js","names":["cdSignature","cdHeaderSignature","generateHashInfo","parseHashFile","parseZipCDFileHeader","parseZipLocalFileHeader","searchFromTheEnd","Tiles3DArchive","parse3DTilesArchive","fileProvider","cb","hashCDOffset","cdFileHeader","hashData","fileName","localFileHeader","localHeaderOffset","Error","fileDataOffset","hashFile","slice","compressedSize"],"sources":["../../../src/3d-tiles-archive/3d-tiles-archive-parser.ts"],"sourcesContent":["import {FileProvider} from '@loaders.gl/loader-utils';\nimport {\n HashElement,\n cdSignature as cdHeaderSignature,\n generateHashInfo,\n parseHashFile,\n parseZipCDFileHeader,\n parseZipLocalFileHeader,\n searchFromTheEnd\n} from '@loaders.gl/zip';\nimport {Tiles3DArchive} from './3d-tiles-archive-archive';\n\n/**\n * Creates 3tz file handler from raw file\n * @param fileProvider raw file data\n * @param cb is called with information message during parsing\n * @returns 3tz file handler\n */\nexport const parse3DTilesArchive = async (\n fileProvider: FileProvider,\n cb?: (msg: string) => void\n): Promise<Tiles3DArchive> => {\n const hashCDOffset = await searchFromTheEnd(fileProvider, cdHeaderSignature);\n\n const cdFileHeader = await parseZipCDFileHeader(hashCDOffset, fileProvider);\n\n let hashData: HashElement[];\n if (cdFileHeader?.fileName !== '@3dtilesIndex1@') {\n cb?.('3tz doesnt contain hash file');\n hashData = await generateHashInfo(fileProvider);\n cb?.('hash info has been composed according to central directory records');\n } else {\n cb?.('3tz contains hash file');\n const localFileHeader = await parseZipLocalFileHeader(\n cdFileHeader.localHeaderOffset,\n fileProvider\n );\n if (!localFileHeader) {\n throw new Error('corrupted 3tz');\n }\n\n const fileDataOffset = localFileHeader.fileDataOffset;\n const hashFile = await fileProvider.slice(\n fileDataOffset,\n fileDataOffset + localFileHeader.compressedSize\n );\n\n hashData = parseHashFile(hashFile);\n }\n\n return new Tiles3DArchive(fileProvider, hashData);\n};\n"],"mappings":"AACA,SAEEA,WAAW,IAAIC,iBAAiB,EAChCC,gBAAgB,EAChBC,aAAa,EACbC,oBAAoB,EACpBC,uBAAuB,EACvBC,gBAAgB,QACX,iBAAiB;AACxB,SAAQC,cAAc,QAAO,4BAA4B;AAQzD,OAAO,MAAMC,mBAAmB,GAAG,MAAAA,CACjCC,YAA0B,EAC1BC,EAA0B,KACE;EAC5B,MAAMC,YAAY,GAAG,MAAML,gBAAgB,CAACG,YAAY,EAAER,iBAAiB,CAAC;EAE5E,MAAMW,YAAY,GAAG,MAAMR,oBAAoB,CAACO,YAAY,EAAEF,YAAY,CAAC;EAE3E,IAAII,QAAuB;EAC3B,IAAI,CAAAD,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEE,QAAQ,MAAK,iBAAiB,EAAE;IAChDJ,EAAE,aAAFA,EAAE,uBAAFA,EAAE,CAAG,8BAA8B,CAAC;IACpCG,QAAQ,GAAG,MAAMX,gBAAgB,CAACO,YAAY,CAAC;IAC/CC,EAAE,aAAFA,EAAE,uBAAFA,EAAE,CAAG,oEAAoE,CAAC;EAC5E,CAAC,MAAM;IACLA,EAAE,aAAFA,EAAE,uBAAFA,EAAE,CAAG,wBAAwB,CAAC;IAC9B,MAAMK,eAAe,GAAG,MAAMV,uBAAuB,CACnDO,YAAY,CAACI,iBAAiB,EAC9BP,YACF,CAAC;IACD,IAAI,CAACM,eAAe,EAAE;MACpB,MAAM,IAAIE,KAAK,CAAC,eAAe,CAAC;IAClC;IAEA,MAAMC,cAAc,GAAGH,eAAe,CAACG,cAAc;IACrD,MAAMC,QAAQ,GAAG,MAAMV,YAAY,CAACW,KAAK,CACvCF,cAAc,EACdA,cAAc,GAAGH,eAAe,CAACM,cACnC,CAAC;IAEDR,QAAQ,GAAGV,aAAa,CAACgB,QAAQ,CAAC;EACpC;EAEA,OAAO,IAAIZ,cAAc,CAACE,YAAY,EAAEI,QAAQ,CAAC;AACnD,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { DataViewFile } from '@loaders.gl/loader-utils';
2
+ import { parse3DTilesArchive as parse3DTilesArchiveFromProvider } from './3d-tiles-archive/3d-tiles-archive-parser';
3
+ const VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
4
+ export const Tiles3DArchiveFileLoader = {
5
+ name: '3tz',
6
+ id: '3tz',
7
+ module: '3d-tiles',
8
+ version: VERSION,
9
+ mimeTypes: ['application/octet-stream', 'application/vnd.maxar.archive.3tz+zip'],
10
+ parse: parse3DTilesArchive,
11
+ extensions: ['3tz'],
12
+ options: {}
13
+ };
14
+ async function parse3DTilesArchive(data) {
15
+ var _options$3dTilesArc, _options$3dTilesArc2;
16
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
17
+ const archive = await parse3DTilesArchiveFromProvider(new DataViewFile(new DataView(data)));
18
+ return archive.getFile((_options$3dTilesArc = (_options$3dTilesArc2 = options['3d-tiles-archive']) === null || _options$3dTilesArc2 === void 0 ? void 0 : _options$3dTilesArc2.path) !== null && _options$3dTilesArc !== void 0 ? _options$3dTilesArc : '');
19
+ }
20
+ //# sourceMappingURL=3d-tiles-archive-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"3d-tiles-archive-loader.js","names":["DataViewFile","parse3DTilesArchive","parse3DTilesArchiveFromProvider","VERSION","Tiles3DArchiveFileLoader","name","id","module","version","mimeTypes","parse","extensions","options","data","_options$3dTilesArc","_options$3dTilesArc2","arguments","length","undefined","archive","DataView","getFile","path"],"sources":["../../src/3d-tiles-archive-loader.ts"],"sourcesContent":["import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {DataViewFile} from '@loaders.gl/loader-utils';\nimport {parse3DTilesArchive as parse3DTilesArchiveFromProvider} from './3d-tiles-archive/3d-tiles-archive-parser';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/** options to load data from 3tz */\nexport type Tiles3DArchiveFileLoaderOptions = LoaderOptions & {\n '3d-tiles-archive'?: {\n /** path inside the 3tz archive */\n path?: string;\n };\n};\n\n/**\n * Loader for 3tz packages\n */\nexport const Tiles3DArchiveFileLoader: LoaderWithParser<\n ArrayBuffer,\n never,\n Tiles3DArchiveFileLoaderOptions\n> = {\n name: '3tz',\n id: '3tz',\n module: '3d-tiles',\n version: VERSION,\n mimeTypes: ['application/octet-stream', 'application/vnd.maxar.archive.3tz+zip'],\n parse: parse3DTilesArchive,\n extensions: ['3tz'],\n options: {}\n};\n\n/**\n * returns a single file from the 3tz archive\n * @param data 3tz archive data\n * @param options options\n * @returns requested file\n */\nasync function parse3DTilesArchive(\n data: ArrayBuffer,\n options: Tiles3DArchiveFileLoaderOptions = {}\n): Promise<ArrayBuffer> {\n const archive = await parse3DTilesArchiveFromProvider(new DataViewFile(new DataView(data)));\n return archive.getFile(options['3d-tiles-archive']?.path ?? '');\n}\n"],"mappings":"AACA,SAAQA,YAAY,QAAO,0BAA0B;AACrD,SAAQC,mBAAmB,IAAIC,+BAA+B,QAAO,4CAA4C;AAIjH,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAa3E,OAAO,MAAMC,wBAIZ,GAAG;EACFC,IAAI,EAAE,KAAK;EACXC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,UAAU;EAClBC,OAAO,EAAEL,OAAO;EAChBM,SAAS,EAAE,CAAC,0BAA0B,EAAE,uCAAuC,CAAC;EAChFC,KAAK,EAAET,mBAAmB;EAC1BU,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,OAAO,EAAE,CAAC;AACZ,CAAC;AAQD,eAAeX,mBAAmBA,CAChCY,IAAiB,EAEK;EAAA,IAAAC,mBAAA,EAAAC,oBAAA;EAAA,IADtBH,OAAwC,GAAAI,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAE7C,MAAMG,OAAO,GAAG,MAAMjB,+BAA+B,CAAC,IAAIF,YAAY,CAAC,IAAIoB,QAAQ,CAACP,IAAI,CAAC,CAAC,CAAC;EAC3F,OAAOM,OAAO,CAACE,OAAO,EAAAP,mBAAA,IAAAC,oBAAA,GAACH,OAAO,CAAC,kBAAkB,CAAC,cAAAG,oBAAA,uBAA3BA,oBAAA,CAA6BO,IAAI,cAAAR,mBAAA,cAAAA,mBAAA,GAAI,EAAE,CAAC;AACjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"cesium-ion-loader.js","names":["Tiles3DLoader","getIonTilesetMetadata","preload","url","options","arguments","length","undefined","accessToken","assetId","Number","isFinite","matched","match","CesiumIonLoader","id","name","parse","data","context","loader"],"sources":["../../src/cesium-ion-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {Tiles3DLoader} from './tiles-3d-loader';\nimport {getIonTilesetMetadata} from './lib/ion/ion';\n\nasync function preload(url, options = {}) {\n options = options['cesium-ion'] || {};\n // @ts-ignore\n const {accessToken} = options;\n // @ts-ignore\n let assetId = options.assetId;\n if (!Number.isFinite(assetId)) {\n const matched = url.match(/\\/([0-9]+)\\/tileset.json/);\n assetId = matched && matched[1];\n }\n return getIonTilesetMetadata(accessToken, assetId);\n}\n\n/**\n * Loader for 3D tiles from Cesium ION\n */\nexport const CesiumIonLoader: LoaderWithParser = {\n ...Tiles3DLoader,\n id: 'cesium-ion',\n name: 'Cesium Ion',\n // @ts-ignore\n preload,\n parse: async (data, options?, context?) => {\n options = {...options};\n options['3d-tiles'] = options['cesium-ion'];\n // @ts-ignore\n options.loader = CesiumIonLoader;\n return Tiles3DLoader.parse(data, options, context); // , loader);\n },\n options: {\n 'cesium-ion': {\n // @ts-expect-error\n ...Tiles3DLoader.options['3d-tiles'],\n accessToken: null\n }\n }\n};\n"],"mappings":"AACA,SAAQA,aAAa,QAAO,mBAAmB;AAC/C,SAAQC,qBAAqB,QAAO,eAAe;AAEnD,eAAeC,OAAOA,CAACC,GAAG,EAAgB;EAAA,IAAdC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACtCD,OAAO,GAAGA,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;EAErC,MAAM;IAACI;EAAW,CAAC,GAAGJ,OAAO;EAE7B,IAAIK,OAAO,GAAGL,OAAO,CAACK,OAAO;EAC7B,IAAI,CAACC,MAAM,CAACC,QAAQ,CAACF,OAAO,CAAC,EAAE;IAC7B,MAAMG,OAAO,GAAGT,GAAG,CAACU,KAAK,CAAC,0BAA0B,CAAC;IACrDJ,OAAO,GAAGG,OAAO,IAAIA,OAAO,CAAC,CAAC,CAAC;EACjC;EACA,OAAOX,qBAAqB,CAACO,WAAW,EAAEC,OAAO,CAAC;AACpD;AAKA,OAAO,MAAMK,eAAiC,GAAG;EAC/C,GAAGd,aAAa;EAChBe,EAAE,EAAE,YAAY;EAChBC,IAAI,EAAE,YAAY;EAElBd,OAAO;EACPe,KAAK,EAAE,MAAAA,CAAOC,IAAI,EAAEd,OAAQ,EAAEe,OAAQ,KAAK;IACzCf,OAAO,GAAG;MAAC,GAAGA;IAAO,CAAC;IACtBA,OAAO,CAAC,UAAU,CAAC,GAAGA,OAAO,CAAC,YAAY,CAAC;IAE3CA,OAAO,CAACgB,MAAM,GAAGN,eAAe;IAChC,OAAOd,aAAa,CAACiB,KAAK,CAACC,IAAI,EAAEd,OAAO,EAAEe,OAAO,CAAC;EACpD,CAAC;EACDf,OAAO,EAAE;IACP,YAAY,EAAE;MAEZ,GAAGJ,aAAa,CAACI,OAAO,CAAC,UAAU,CAAC;MACpCI,WAAW,EAAE;IACf;EACF;AACF,CAAC"}
1
+ {"version":3,"file":"cesium-ion-loader.js","names":["Tiles3DLoader","getIonTilesetMetadata","preload","url","options","arguments","length","undefined","accessToken","assetId","Number","isFinite","matched","match","CesiumIonLoader","id","name","parse","data","context","loader"],"sources":["../../src/cesium-ion-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {Tiles3DLoader} from './tiles-3d-loader';\nimport {getIonTilesetMetadata} from './lib/ion/ion';\n\nasync function preload(url, options = {}) {\n options = options['cesium-ion'] || {};\n // @ts-ignore\n const {accessToken} = options;\n // @ts-ignore\n let assetId = options.assetId;\n if (!Number.isFinite(assetId)) {\n const matched = url.match(/\\/([0-9]+)\\/tileset.json/);\n assetId = matched && matched[1];\n }\n return getIonTilesetMetadata(accessToken, assetId);\n}\n\n/**\n * Loader for 3D tiles from Cesium ION\n */\nexport const CesiumIonLoader: LoaderWithParser = {\n ...Tiles3DLoader,\n id: 'cesium-ion',\n name: 'Cesium Ion',\n // @ts-ignore\n preload,\n parse: async (data, options?, context?) => {\n options = {...options};\n options['3d-tiles'] = options['cesium-ion'];\n // @ts-ignore\n options.loader = CesiumIonLoader;\n return Tiles3DLoader.parse(data, options, context); // , loader);\n },\n options: {\n 'cesium-ion': {\n ...Tiles3DLoader.options['3d-tiles'],\n accessToken: null\n }\n }\n};\n"],"mappings":"AACA,SAAQA,a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
2
2
  export { CesiumIonLoader } from './cesium-ion-loader';
3
3
  export { Tile3DSubtreeLoader } from './tile-3d-subtree-loader';
4
- export { TZ3Loader } from './tz3-loader';
4
+ export { Tiles3DArchiveFileLoader } from './3d-tiles-archive-loader';
5
+ export { Tiles3DArchiveFileSystem } from './lib/filesystems/tiles-3d-archive-file-system';
5
6
  export { Tile3DWriter } from './tile-3d-writer';
6
7
  export { default as Tile3DFeatureTable } from './lib/classes/tile-3d-feature-table';
7
8
  export { default as Tile3DBatchTable } from './lib/classes/tile-3d-batch-table';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Tiles3DLoader","CesiumIonLoader","Tile3DSubtreeLoader","TZ3Loader","Tile3DWriter","default","Tile3DFeatureTable","Tile3DBatchTable","TILE3D_TYPE","getIonTilesetMetadata","_getIonTilesetMetadata"],"sources":["../../src/index.ts"],"sourcesContent":["// LOADERS\nexport {Tiles3DLoader} from './tiles-3d-loader';\nexport {CesiumIonLoader} from './cesium-ion-loader';\nexport {Tile3DSubtreeLoader} from './tile-3d-subtree-loader';\nexport type {TZ3LoaderOptions} from './tz3-loader';\nexport {TZ3Loader} from './tz3-loader';\n\n// WRITERS\nexport {Tile3DWriter} from './tile-3d-writer';\n\n// CLASSES\nexport {default as Tile3DFeatureTable} from './lib/classes/tile-3d-feature-table';\nexport {default as Tile3DBatchTable} from './lib/classes/tile-3d-batch-table';\n\n// EXPERIMENTAL\nexport {TILE3D_TYPE} from './lib/constants';\nexport {getIonTilesetMetadata as _getIonTilesetMetadata} from './lib/ion/ion';\nexport type {\n FeatureTableJson,\n B3DMContent,\n Tile3DBoundingVolume,\n Tiles3DTileJSON,\n Tiles3DTileJSONPostprocessed,\n Tiles3DTilesetJSON,\n Tiles3DTilesetJSONPostprocessed,\n Tiles3DTileContent,\n ImplicitTilingExensionData\n} from './types';\nexport type {Tiles3DLoaderOptions} from './tiles-3d-loader';\n"],"mappings":"AACA,SAAQA,aAAa,QAAO,mBAAmB;AAC/C,SAAQC,eAAe,QAAO,qBAAqB;AACnD,SAAQC,mBAAmB,QAAO,0BAA0B;AAE5D,SAAQC,SAAS,QAAO,cAAc;AAGtC,SAAQC,YAAY,QAAO,kBAAkB;AAG7C,SAAQC,OAAO,IAAIC,kBAAkB,QAAO,qCAAqC;AACjF,SAAQD,OAAO,IAAIE,gBAAgB,QAAO,mCAAmC;AAG7E,SAAQC,WAAW,QAAO,iBAAiB;AAC3C,SAAQC,qBAAqB,IAAIC,sBAAsB,QAAO,eAAe"}
1
+ {"version":3,"file":"index.js","names":["Tiles3DLoader","CesiumIonLoader","Tile3DSubtreeLoader","Tiles3DArchiveFileLoader","Tiles3DArchiveFileSystem","Tile3DWriter","default","Tile3DFeatureTable","Tile3DBatchTable","TILE3D_TYPE","getIonTilesetMetadata","_getIonTilesetMetadata"],"sources":["../../src/index.ts"],"sourcesContent":["// LOADERS\nexport {Tiles3DLoader} from './tiles-3d-loader';\nexport {CesiumIonLoader} from './cesium-ion-loader';\nexport {Tile3DSubtreeLoader} from './tile-3d-subtree-loader';\nexport type {Tiles3DArchiveFileLoaderOptions} from './3d-tiles-archive-loader';\nexport {Tiles3DArchiveFileLoader} from './3d-tiles-archive-loader';\nexport {Tiles3DArchiveFileSystem} from './lib/filesystems/tiles-3d-archive-file-system';\n\n// WRITERS\nexport {Tile3DWriter} from './tile-3d-writer';\n\n// CLASSES\nexport {default as Tile3DFeatureTable} from './lib/classes/tile-3d-feature-table';\nexport {default as Tile3DBatchTable} from './lib/classes/tile-3d-batch-table';\n\n// EXPERIMENTAL\nexport {TILE3D_TYPE} from './lib/constants';\nexport {getIonTilesetMetadata as _getIonTilesetMetadata} from './lib/ion/ion';\nexport type {\n FeatureTableJson,\n B3DMContent,\n Tile3DBoundingVolume,\n Tiles3DTileJSON,\n Tiles3DTileJSONPostprocessed,\n Tiles3DTilesetJSON,\n Tiles3DTilesetJSONPostprocessed,\n Tiles3DTileContent,\n ImplicitTilingExensionData\n} from './types';\nexport type {Tiles3DLoaderOptions} from './tiles-3d-loader';\n"],"mappings":"AACA,SAAQA,aAAa,QAAO,mBAAmB;AAC/C,SAAQC,eAAe,QAAO,qBAAqB;AACnD,SAAQC,mBAAmB,QAAO,0BAA0B;AAE5D,SAAQC,wBAAwB,QAAO,2BAA2B;AAClE,SAAQC,wBAAwB,QAAO,gDAAgD;AAGvF,SAAQC,YAAY,QAAO,kBAAkB;AAG7C,SAAQC,OAAO,IAAIC,kBAAkB,QAAO,qCAAqC;AACjF,SAAQD,OAAO,IAAIE,gBAAgB,QAAO,mCAAmC;AAG7E,SAAQC,WAAW,QAAO,iBAAiB;AAC3C,SAAQC,qBAAqB,IAAIC,sBAAsB,QAAO,eAAe"}
@@ -0,0 +1,49 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import { ZipFileSystem, cdSignature as cdHeaderSignature, searchFromTheEnd, parseZipCDFileHeader, parseHashFile, parseZipLocalFileHeader } from '@loaders.gl/zip';
3
+ import { Tiles3DArchive } from '../../3d-tiles-archive/3d-tiles-archive-archive';
4
+ export class Tiles3DArchiveFileSystem extends ZipFileSystem {
5
+ constructor(file) {
6
+ super(file);
7
+ _defineProperty(this, "hashData", void 0);
8
+ }
9
+ async fetch(filename) {
10
+ const fileProvider = await this.fileProvider;
11
+ if (!fileProvider) {
12
+ throw new Error('No data detected in the zip archive');
13
+ }
14
+ await this.parseHashFile();
15
+ if (this.hashData) {
16
+ const archive = new Tiles3DArchive(fileProvider, this.hashData);
17
+ const fileData = await archive.getFile(filename);
18
+ const response = new Response(fileData);
19
+ Object.defineProperty(response, 'url', {
20
+ value: "".concat(this.fileName || '', "/").concat(filename)
21
+ });
22
+ return response;
23
+ }
24
+ return super.fetch(filename);
25
+ }
26
+ async parseHashFile() {
27
+ if (this.hashData !== undefined) {
28
+ return;
29
+ }
30
+ const fileProvider = await this.fileProvider;
31
+ if (!fileProvider) {
32
+ throw new Error('No data detected in the zip archive');
33
+ }
34
+ const hashCDOffset = await searchFromTheEnd(fileProvider, cdHeaderSignature);
35
+ const cdFileHeader = await parseZipCDFileHeader(hashCDOffset, fileProvider);
36
+ if ((cdFileHeader === null || cdFileHeader === void 0 ? void 0 : cdFileHeader.fileName) === '@3dtilesIndex1@') {
37
+ const localFileHeader = await parseZipLocalFileHeader(cdFileHeader.localHeaderOffset, fileProvider);
38
+ if (!localFileHeader) {
39
+ throw new Error('corrupted 3tz');
40
+ }
41
+ const fileDataOffset = localFileHeader.fileDataOffset;
42
+ const hashFile = await fileProvider.slice(fileDataOffset, fileDataOffset + localFileHeader.compressedSize);
43
+ this.hashData = parseHashFile(hashFile);
44
+ } else {
45
+ this.hashData = null;
46
+ }
47
+ }
48
+ }
49
+ //# sourceMappingURL=tiles-3d-archive-file-system.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tiles-3d-archive-file-system.js","names":["ZipFileSystem","cdSignature","cdHeaderSignature","searchFromTheEnd","parseZipCDFileHeader","parseHashFile","parseZipLocalFileHeader","Tiles3DArchive","Tiles3DArchiveFileSystem","constructor","file","_defineProperty","fetch","filename","fileProvider","Error","hashData","archive","fileData","getFile","response","Response","Object","defineProperty","value","concat","fileName","undefined","hashCDOffset","cdFileHeader","localFileHeader","localHeaderOffset","fileDataOffset","hashFile","slice","compressedSize"],"sources":["../../../../src/lib/filesystems/tiles-3d-archive-file-system.ts"],"sourcesContent":["import {FileProvider} from '@loaders.gl/loader-utils';\nimport {\n ZipFileSystem,\n cdSignature as cdHeaderSignature,\n searchFromTheEnd,\n parseZipCDFileHeader,\n HashElement,\n parseHashFile,\n parseZipLocalFileHeader\n} from '@loaders.gl/zip';\nimport {Tiles3DArchive} from '../../3d-tiles-archive/3d-tiles-archive-archive';\n\n/**\n * FileSystem adapter for a 3tz (3D tiles archive format) file\n * Holds FileProvider object that provides random access to archived files.\n * The difference from ZipFileSystem is usage of `@3dtilesIndex1@` index file that increases\n * access speed to archived files\n * @see https://github.com/erikdahlstrom/3tz-specification/blob/master/Specification.md\n */\nexport class Tiles3DArchiveFileSystem extends ZipFileSystem {\n hashData?: HashElement[] | null;\n\n /**\n * Constructor\n * @param file - instance of FileProvider or file path string\n */\n constructor(file: FileProvider | string) {\n super(file);\n }\n\n /**\n * Implementation of fetch against this file system.\n * It tries to take `@3dtilesIndex1@` file from the archive and use it\n * for faster access to archived files\n * @param filename - name of a file\n * @returns - Response with file data\n */\n async fetch(filename: string): Promise<Response> {\n const fileProvider = await this.fileProvider;\n if (!fileProvider) {\n throw new Error('No data detected in the zip archive');\n }\n await this.parseHashFile();\n if (this.hashData) {\n const archive = new Tiles3DArchive(fileProvider, this.hashData);\n\n const fileData = await archive.getFile(filename);\n const response = new Response(fileData);\n Object.defineProperty(response, 'url', {value: `${this.fileName || ''}/${filename}`});\n return response;\n }\n return super.fetch(filename);\n }\n\n /**\n * Try to get and parse '@3dtilesIndex1@' file, that allows to get direct access\n * to files inside the archive\n * @returns void\n */\n private async parseHashFile(): Promise<void> {\n if (this.hashData !== undefined) {\n return;\n }\n\n const fileProvider = await this.fileProvider;\n if (!fileProvider) {\n throw new Error('No data detected in the zip archive');\n }\n\n const hashCDOffset = await searchFromTheEnd(fileProvider, cdHeaderSignature);\n\n const cdFileHeader = await parseZipCDFileHeader(hashCDOffset, fileProvider);\n\n // '@3dtilesIndex1@' is index file that must be the last in the archive. It allows\n // to improve load and read performance when the archive contains a very large number\n // of files.\n if (cdFileHeader?.fileName === '@3dtilesIndex1@') {\n const localFileHeader = await parseZipLocalFileHeader(\n cdFileHeader.localHeaderOffset,\n fileProvider\n );\n if (!localFileHeader) {\n throw new Error('corrupted 3tz');\n }\n\n const fileDataOffset = localFileHeader.fileDataOffset;\n const hashFile = await fileProvider.slice(\n fileDataOffset,\n fileDataOffset + localFileHeader.compressedSize\n );\n\n this.hashData = parseHashFile(hashFile);\n } else {\n this.hashData = null;\n }\n }\n}\n"],"mappings":";AACA,SACEA,aAAa,EACbC,WAAW,IAAIC,iBAAiB,EAChCC,gBAAgB,EAChBC,oBAAoB,EAEpBC,a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YAAY,GAAG,MAAMzB,oBAAoB,CAACwB,YAAY,EAAEd,YAAY,CAAC;IAK3E,IAAI,CAAAe,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEH,QAAQ,MAAK,iBAAiB,EAAE;MAChD,MAAMI,eAAe,GAAG,MAAMxB,uBAAuB,CACnDuB,YAAY,CAACE,iBAAiB,EAC9BjB,YACF,CAAC;MACD,IAAI,CAACgB,eAAe,EAAE;QACpB,MAAM,IAAIf,KAAK,CAAC,eAAe,CAAC;MAClC;MAEA,MAAMiB,cAAc,GAAGF,eAAe,CAACE,cAAc;MACrD,MAAMC,QAAQ,GAAG,MAAMnB,YAAY,CAACoB,KAAK,CACvCF,cAAc,EACdA,cAAc,GAAGF,eAAe,CAACK,cACnC,CAAC;MAED,IAAI,CAACnB,QAAQ,GAAGX,aAAa,CAAC4B,QAAQ,CAAC;IACzC,CAAC,MAAM;MACL,IAAI,CAACjB,QAAQ,GAAG,IAAI;IACtB;EACF;AACF"}
@@ -1,5 +1,5 @@
1
1
  import { GLTFLoader, postProcessGLTF, _getMemoryUsageGLTF } from '@loaders.gl/gltf';
2
- import { sliceArrayBuffer } from '@loaders.gl/loader-utils';
2
+ import { sliceArrayBuffer, parseFromContext } from '@loaders.gl/loader-utils';
3
3
  export const GLTF_FORMAT = {
4
4
  URI: 0,
5
5
  EMBEDDED: 1
@@ -26,17 +26,16 @@ export async function extractGLTF(tile, gltfFormat, options, context) {
26
26
  if (!context) {
27
27
  return;
28
28
  }
29
- const {
30
- parse,
31
- fetch
32
- } = context;
33
29
  if (tile.gltfUrl) {
30
+ const {
31
+ fetch
32
+ } = context;
34
33
  const response = await fetch(tile.gltfUrl, options);
35
34
  tile.gltfArrayBuffer = await response.arrayBuffer();
36
35
  tile.gltfByteOffset = 0;
37
36
  }
38
37
  if (tile.gltfArrayBuffer) {
39
- const gltfWithBuffers = await parse(tile.gltfArrayBuffer, GLTFLoader, options, context);
38
+ const gltfWithBuffers = await parseFromContext(tile.gltfArrayBuffer, GLTFLoader, options, context);
40
39
  tile.gltf = postProcessGLTF(gltfWithBuffers);
41
40
  tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);
42
41
  delete tile.gltfArrayBuffer;
@@ -1 +1 @@
1
- {"version":3,"file":"parse-3d-tile-gltf-view.js","names":["GLTFLoader","postProcessGLTF","_getMemoryUsageGLTF","sliceArrayBuffer","GLTF_FORMAT","URI","EMBEDDED","parse3DTileGLTFViewSync","tile","arrayBuffer","byteOffset","options","rotateYtoZ","gltfByteLength","byteLength","Error","gltfUpAxis","assetGltfUpAxis","gltfArrayBuffer","gltfByteOffset","console","warn","concat","type","extractGLTF","gltfFormat","context","tile3DOptions","extractGLTFBufferOrURL","loadGLTF","parse","fetch","gltfUrl","response","gltfWithBuffers","gltf","gpuMemoryUsageInBytes","gltfUrlBytes","Uint8Array","textDecoder","TextDecoder","decode","replace"],"sources":["../../../../../src/lib/parsers/helpers/parse-3d-tile-gltf-view.ts"],"sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n// TODO - should we automatically parse the embedded glTF or leave it to the app?\n// - I.e. some apps might work directly on a GLB, in that case no need for us to decode...\n// - And if we decode, do we still keep the GLB in case it is needed?\n// - Do we add an option to control this?\n// - Also, should we have hard dependency on gltf module or use injection or auto-discovery for gltf parser?\n\nimport {GLTFLoader, postProcessGLTF, _getMemoryUsageGLTF} from '@loaders.gl/gltf';\nimport {LoaderContext, sliceArrayBuffer} from '@loaders.gl/loader-utils';\nimport {Tiles3DTileContent} from '../../../types';\nimport {Tiles3DLoaderOptions} from '../../../tiles-3d-loader';\n\nexport const GLTF_FORMAT = {\n URI: 0,\n EMBEDDED: 1\n};\n\nexport function parse3DTileGLTFViewSync(\n tile: Tiles3DTileContent,\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n options: Tiles3DLoaderOptions | undefined\n) {\n // Set flags\n // glTF models need to be rotated from Y to Z up\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up\n tile.rotateYtoZ = true;\n\n // Assume glTF consumes rest of tile\n const gltfByteLength = (tile.byteOffset || 0) + (tile.byteLength || 0) - byteOffset;\n if (gltfByteLength === 0) {\n throw new Error('glTF byte length must be greater than 0.');\n }\n\n // Save gltf up axis\n tile.gltfUpAxis =\n options?.['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis\n ? options['3d-tiles'].assetGltfUpAxis\n : 'Y';\n\n // TODO - We can avoid copy if already 4-byte aligned...\n // However the rest of the code may not be able to accept byteOffsets, so copy anyway\n tile.gltfArrayBuffer = sliceArrayBuffer(arrayBuffer, byteOffset, gltfByteLength);\n tile.gltfByteOffset = 0;\n tile.gltfByteLength = gltfByteLength;\n\n if (byteOffset % 4 === 0) {\n // tile.gltfArrayBuffer = arrayBuffer;\n // tile.gltfByteOffset = byteOffset;\n // tile.gltfByteLength = gltfByteLength;\n } else {\n // Create a copy of the glb so that it is 4-byte aligned\n // eslint-disable-next-line\n console.warn(`${tile.type}: embedded glb is not aligned to a 4-byte boundary.`);\n }\n\n // Entire tile is consumed\n return (tile.byteOffset || 0) + (tile.byteLength || 0);\n}\n\nexport async function extractGLTF(\n tile: Tiles3DTileContent,\n gltfFormat: number,\n options?: Tiles3DLoaderOptions,\n context?: LoaderContext\n): Promise<void> {\n const tile3DOptions = options?.['3d-tiles'] || {};\n\n extractGLTFBufferOrURL(tile, gltfFormat, options);\n\n if (tile3DOptions.loadGLTF) {\n if (!context) {\n return;\n }\n const {parse, fetch} = context;\n if (tile.gltfUrl) {\n const response = await fetch(tile.gltfUrl, options);\n tile.gltfArrayBuffer = await response.arrayBuffer();\n tile.gltfByteOffset = 0;\n }\n if (tile.gltfArrayBuffer) {\n // TODO - Should handle byteOffset... However, not used now...\n const gltfWithBuffers = await parse(tile.gltfArrayBuffer, GLTFLoader, options, context);\n tile.gltf = postProcessGLTF(gltfWithBuffers);\n tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);\n delete tile.gltfArrayBuffer;\n delete tile.gltfByteOffset;\n delete tile.gltfByteLength;\n }\n }\n}\n\nfunction extractGLTFBufferOrURL(\n tile: Tiles3DTileContent,\n gltfFormat: number,\n options: Tiles3DLoaderOptions | undefined\n) {\n switch (gltfFormat) {\n case GLTF_FORMAT.URI:\n // We need to remove padding from the end of the model URL in case this tile was part of a composite tile.\n // This removes all white space and null characters from the end of the string.\n if (tile.gltfArrayBuffer) {\n const gltfUrlBytes = new Uint8Array(tile.gltfArrayBuffer, tile.gltfByteOffset);\n const textDecoder = new TextDecoder();\n const gltfUrl = textDecoder.decode(gltfUrlBytes);\n tile.gltfUrl = gltfUrl.replace(/[\\s\\0]+$/, '');\n }\n delete tile.gltfArrayBuffer;\n delete tile.gltfByteOffset;\n delete tile.gltfByteLength;\n break;\n case GLTF_FORMAT.EMBEDDED:\n break;\n default:\n throw new Error('b3dm: Illegal glTF format field');\n }\n}\n"],"mappings":"AASA,SAAQA,UAAU,EAAEC,eAAe,EAAEC,mBAAmB,QAAO,kBAAkB;AACjF,SAAuBC,gBAAgB,QAAO,0BAA0B;AAIxE,OAAO,MAAMC,WAAW,GAAG;EACzBC,GAAG,EAAE,CAAC;EACNC,QAAQ,EAAE;AACZ,CAAC;AAED,OAAO,SAASC,uBAAuBA,CACrCC,IAAwB,EACxBC,WAAwB,EACxBC,UAAkB,EAClBC,OAAyC,EACzC;EAIAH,IAAI,CAACI,UAAU,GAAG,IAAI;EAGtB,MAAMC,cAAc,GAAG,CAACL,IAAI,CAACE,UAAU,IAAI,CAAC,KAAKF,IAAI,CAACM,UAAU,IAAI,CAAC,CAAC,GAAGJ,UAAU;EACnF,IAAIG,cAAc,KAAK,CAAC,EAAE;IACxB,MAAM,IAAIE,KAAK,CAAC,0CAA0C,CAAC;EAC7D;EAGAP,IAAI,CAACQ,UAAU,GACbL,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAG,UAAU,C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AACtB,IAAI,CAACU,eAAe,EAAElB,UAAU,EAAEW,OAAO,EAAEe,OAAO,CAAC;MACvFlB,IAAI,CAAC2B,IAAI,GAAGlC,eAAe,CAACiC,eAAe,CAAC;MAC5C1B,IAAI,CAAC4B,qBAAqB,GAAGlC,mBAAmB,CAACM,IAAI,CAAC2B,IAAI,CAAC;MAC3D,OAAO3B,IAAI,CAACU,eAAe;MAC3B,OAAOV,IAAI,CAACW,cAAc;MAC1B,OAAOX,IAAI,CAACK,cAAc;IAC5B;EACF;AACF;AAEA,SAASe,sBAAsBA,CAC7BpB,IAAwB,EACxBiB,UAAkB,EAClBd,OAAyC,EACzC;EACA,QAAQc,UAAU;IAChB,KAAKrB,WAAW,CAACC,GAAG;MAGlB,IAAIG,IAAI,CAACU,eAAe,EAAE;QACxB,MAAMmB,YAAY,GAAG,IAAIC,UAAU,CAAC9B,IAAI,CAACU,eAAe,EAAEV,IAAI,CAACW,cAAc,CAAC;QAC9E,MAAMoB,WAAW,GAAG,IAAIC,WAAW,CAAC,CAAC;QACrC,MAAMR,OAAO,GAAGO,WAAW,CAACE,MAAM,CAACJ,YAAY,CAAC;QAChD7B,IAAI,CAACwB,OAAO,GAAGA,OAAO,CAACU,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;MAChD;MACA,OAAOlC,IAAI,CAACU,eAAe;MAC3B,OAAOV,IAAI,CAACW,cAAc;MAC1B,OAAOX,IAAI,CAACK,cAAc;MAC1B;IACF,KAAKT,WAAW,CAACE,QAAQ;MACvB;IACF;MACE,MAAM,IAAIS,KAAK,CAAC,iCAAiC,CAAC;EACtD;AACF"}
1
+ {"version":3,"file":"parse-3d-tile-gltf-view.js","names":["GLTFLoader","postProcessGLTF","_getMemoryUsageGLTF","sliceArrayBuffer","parseFromContext","GLTF_FORMAT","URI","EMBEDDED","parse3DTileGLTFViewSync","tile","arrayBuffer","byteOffset","options","rotateYtoZ","gltfByteLength","byteLength","Error","gltfUpAxis","assetGltfUpAxis","gltfArrayBuffer","gltfByteOffset","console","warn","concat","type","extractGLTF","gltfFormat","context","tile3DOptions","extractGLTFBufferOrURL","loadGLTF","gltfUrl","fetch","response","gltfWithBuffers","gltf","gpuMemoryUsageInBytes","gltfUrlBytes","Uint8Array","textDecoder","TextDecoder","decode","replace"],"sources":["../../../../../src/lib/parsers/helpers/parse-3d-tile-gltf-view.ts"],"sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n// TODO - should we automatically parse the embedded glTF or leave it to the app?\n// - I.e. some apps might work directly on a GLB, in that case no need for us to decode...\n// - And if we decode, do we still keep the GLB in case it is needed?\n// - Do we add an option to control this?\n// - Also, should we have hard dependency on gltf module or use injection or auto-discovery for gltf parser?\n\nimport {GLTFLoader, postProcessGLTF, _getMemoryUsageGLTF} from '@loaders.gl/gltf';\nimport {LoaderContext, sliceArrayBuffer, parseFromContext} from '@loaders.gl/loader-utils';\nimport {Tiles3DTileContent} from '../../../types';\nimport {Tiles3DLoaderOptions} from '../../../tiles-3d-loader';\n\nexport const GLTF_FORMAT = {\n URI: 0,\n EMBEDDED: 1\n};\n\nexport function parse3DTileGLTFViewSync(\n tile: Tiles3DTileContent,\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n options: Tiles3DLoaderOptions | undefined\n) {\n // Set flags\n // glTF models need to be rotated from Y to Z up\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up\n tile.rotateYtoZ = true;\n\n // Assume glTF consumes rest of tile\n const gltfByteLength = (tile.byteOffset || 0) + (tile.byteLength || 0) - byteOffset;\n if (gltfByteLength === 0) {\n throw new Error('glTF byte length must be greater than 0.');\n }\n\n // Save gltf up axis\n tile.gltfUpAxis =\n options?.['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis\n ? options['3d-tiles'].assetGltfUpAxis\n : 'Y';\n\n // TODO - We can avoid copy if already 4-byte aligned...\n // However the rest of the code may not be able to accept byteOffsets, so copy anyway\n tile.gltfArrayBuffer = sliceArrayBuffer(arrayBuffer, byteOffset, gltfByteLength);\n tile.gltfByteOffset = 0;\n tile.gltfByteLength = gltfByteLength;\n\n if (byteOffset % 4 === 0) {\n // tile.gltfArrayBuffer = arrayBuffer;\n // tile.gltfByteOffset = byteOffset;\n // tile.gltfByteLength = gltfByteLength;\n } else {\n // Create a copy of the glb so that it is 4-byte aligned\n // eslint-disable-next-line\n console.warn(`${tile.type}: embedded glb is not aligned to a 4-byte boundary.`);\n }\n\n // Entire tile is consumed\n return (tile.byteOffset || 0) + (tile.byteLength || 0);\n}\n\nexport async function extractGLTF(\n tile: Tiles3DTileContent,\n gltfFormat: number,\n options?: Tiles3DLoaderOptions,\n context?: LoaderContext\n): Promise<void> {\n const tile3DOptions = options?.['3d-tiles'] || {};\n\n extractGLTFBufferOrURL(tile, gltfFormat, options);\n\n if (tile3DOptions.loadGLTF) {\n if (!context) {\n return;\n }\n if (tile.gltfUrl) {\n const {fetch} = context;\n const response = await fetch(tile.gltfUrl, options);\n tile.gltfArrayBuffer = await response.arrayBuffer();\n tile.gltfByteOffset = 0;\n }\n if (tile.gltfArrayBuffer) {\n // TODO - Should handle byteOffset... However, not used now...\n const gltfWithBuffers = await parseFromContext(\n tile.gltfArrayBuffer,\n GLTFLoader,\n options,\n context\n );\n tile.gltf = postProcessGLTF(gltfWithBuffers);\n tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);\n delete tile.gltfArrayBuffer;\n delete tile.gltfByteOffset;\n delete tile.gltfByteLength;\n }\n }\n}\n\nfunction extractGLTFBufferOrURL(\n tile: Tiles3DTileContent,\n gltfFormat: number,\n options: Tiles3DLoaderOptions | undefined\n) {\n switch (gltfFormat) {\n case GLTF_FORMAT.URI:\n // We need to remove padding from the end of the model URL in case this tile was part of a composite tile.\n // This removes all white space and null characters from the end of the string.\n if (tile.gltfArrayBuffer) {\n const gltfUrlBytes = new Uint8Array(tile.gltfArrayBuffer, tile.gltfByteOffset);\n const textDecoder = new TextDecoder();\n const gltfUrl = textDecoder.decode(gltfUrlBytes);\n tile.gltfUrl = gltfUrl.replace(/[\\s\\0]+$/, '');\n }\n delete tile.gltfArrayBuffer;\n delete tile.gltfByteOffset;\n delete tile.gltfByteLength;\n break;\n case GLTF_FORMAT.EMBEDDED:\n break;\n default:\n throw new Error('b3dm: Illegal glTF format field');\n }\n}\n"],"mappings":"AASA,SAAQA,UAAU,EAAEC,eAAe,EAAEC,mBAAmB,QAAO,kBAAkB;AACjF,SAAuBC,gBAAgB,EAAEC,gBAAgB,QAAO,0BAA0B;AAI1F,OAAO,MAAMC,WAAW,GAAG;EACzBC,GAAG,EAAE,CAAC;EACNC,QAAQ,EAAE;AACZ,CAAC;AAED,OAAO,SAASC,uBAAuBA,CACrCC,IAAwB,EACxBC,WAAwB,EACxBC,UAAkB,EAClBC,OAAyC,EACzC;EAIAH,IAAI,CAACI,UAAU,GAAG,IAAI;EAGtB,MAAMC,cAAc,GAAG,CAACL,IAAI,CAACE,UAAU,IAAI,CAAC,KAAKF,IAAI,CAACM,UAAU,IAAI,CAAC,CAAC,GAAGJ,UAAU;EACnF,IAAIG,cAAc,KAAK,CAAC,EAAE;IACxB,MAAM,IAAIE,KAAK,CAAC,0CAA0C,CAAC;EAC7D;EAGAP,IAAI,CAACQ,UAAU,GACbL,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAG,UAAU,CAAC,IAAIA,OAAO,CAAC,UAAU,CAAC,CAACM,eAAe,GACxDN,OAAO,CAAC,UAAU,CAAC,CAACM,eAAe,GACnC,GAAG;EAITT,IAAI,CAACU,eAAe,GAAGhB,gBAAgB,CAACO,WAAW,EAAEC,UAAU,EAAEG,cAAc,CAAC;EAChFL,IAAI,CAACW,cAAc,GAAG,CAAC;EACvBX,IAAI,CAACK,cAAc,GAAGA,cAAc;EAEpC,IAAIH,UAAU,GAAG,CAAC,KAAK,CAAC,EAAE,CAI1B,CAAC,MAAM;IAGLU,OA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pB,IAAwB,EACxBiB,UAAkB,EAClBd,OAAyC,EACzC;EACA,QAAQc,UAAU;IAChB,KAAKrB,WAAW,CAACC,GAAG;MAGlB,IAAIG,IAAI,CAACU,eAAe,EAAE;QACxB,MAAMkB,YAAY,GAAG,IAAIC,UAAU,CAAC7B,IAAI,CAACU,eAAe,EAAEV,IAAI,CAACW,cAAc,CAAC;QAC9E,MAAMmB,WAAW,GAAG,IAAIC,WAAW,CAAC,CAAC;QACrC,MAAMT,OAAO,GAAGQ,WAAW,CAACE,MAAM,CAACJ,YAAY,CAAC;QAChD5B,IAAI,CAACsB,OAAO,GAAGA,OAAO,CAACW,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;MAChD;MACA,OAAOjC,IAAI,CAACU,eAAe;MAC3B,OAAOV,IAAI,CAACW,cAAc;MAC1B,OAAOX,IAAI,CAACK,cAAc;MAC1B;IACF,KAAKT,WAAW,CAACE,QAAQ;MACvB;IACF;MACE,MAAM,IAAIS,KAAK,CAAC,iCAAiC,CAAC;EACtD;AACF"}
@@ -6,7 +6,9 @@ export async function parseComposite3DTile(tile, arrayBuffer, byteOffset, option
6
6
  byteOffset += 4;
7
7
  tile.tiles = [];
8
8
  while (tile.tiles.length < tile.tilesLength && (tile.byteLength || 0) - byteOffset > 12) {
9
- const subtile = {};
9
+ const subtile = {
10
+ shape: 'tile3d'
11
+ };
10
12
  tile.tiles.push(subtile);
11
13
  byteOffset = await parse3DTile(arrayBuffer, byteOffset, options, context, subtile);
12
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"parse-3d-tile-composite.js","names":["parse3DTileHeaderSync","parseComposite3DTile","tile","arrayBuffer","byteOffset","options","context","parse3DTile","view","DataView","tilesLength","getUint32","tiles","length","byteLength","subtile","push"],"sources":["../../../../src/lib/parsers/parse-3d-tile-composite.ts"],"sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n// Reference code:\n// https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Composite3DTileContent.js#L182\n\nimport type {LoaderContext} from '@loaders.gl/loader-utils';\nimport type {Tiles3DLoaderOptions} from '../../tiles-3d-loader';\nimport {parse3DTileHeaderSync} from './helpers/parse-3d-tile-header';\nimport {Tiles3DTileContent} from '../../types';\n\n/** Resolve circulate dependency by passing in parsing function as argument */\ntype Parse3DTile = (\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n options: Tiles3DLoaderOptions | undefined,\n context: LoaderContext | undefined,\n subtile\n) => Promise<number>;\n\n// eslint-disable-next-line max-params\nexport async function parseComposite3DTile(\n tile: Tiles3DTileContent,\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n options: Tiles3DLoaderOptions | undefined,\n context: LoaderContext | undefined,\n parse3DTile: Parse3DTile\n): Promise<number> {\n byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);\n\n const view = new DataView(arrayBuffer);\n\n // Extract number of tiles\n tile.tilesLength = view.getUint32(byteOffset, true);\n byteOffset += 4;\n\n // extract each tile from the byte stream\n tile.tiles = [];\n while (tile.tiles.length < tile.tilesLength && (tile.byteLength || 0) - byteOffset > 12) {\n const subtile = {};\n tile.tiles.push(subtile);\n byteOffset = await parse3DTile(arrayBuffer, byteOffset, options, context, subtile);\n // TODO - do we need to add any padding in between tiles?\n }\n\n return byteOffset;\n}\n"],"mappings":"AAQA,SAAQA,qBAAqB,QAAO,gCAAgC;AAapE,OAAO,eAAeC,oBAAoBA,CACxCC,IAAwB,EACxBC,WAAwB,EACxBC,UAAkB,EAClBC,OAAyC,EACzCC,OAAkC,EAClCC,WAAwB,EACP;EACjBH,UAAU,GAAGJ,qBAAqB,CAACE,IAAI,EAAEC,WAAW,EAAEC,UAAU,CAAC;EAEjE,MAAMI,IAAI,GAAG,IAAIC,QAAQ,CAACN,WAAW,CAAC;EAGtCD,IAAI,CAACQ,WAAW,GAAGF,IAAI,CAACG,SAAS,CAACP,UAAU,EAAE,IAAI,CAAC;EACnDA,UAAU,IAAI,CAAC;EAGfF,IAAI,CAACU,KAAK,GAAG,EAAE;EACf,OAAOV,IAAI,CAACU,KAAK,CAACC,MAAM,GAAGX,IAAI,CAACQ,WAAW,IAAI,CAACR,IAAI,CAACY,UAAU,IAAI,CAAC,IAAIV,UAAU,GAAG,EAAE,EAAE;IACvF,MAAMW,OAAO,GAAG,CAAC,CAAC;IAClBb,IAAI,CAACU,KAAK,CAACI,IAAI,CAACD,OAAO,CAAC;IACxBX,UAAU,GAAG,MAAMG,WAAW,CAACJ,WAAW,EAAEC,UAAU,EAAEC,OAAO,EAAEC,OAAO,EAAES,OAAO,CAAC;EAEpF;EAEA,OAAOX,UAAU;AACnB"}
1
+ {"version":3,"file":"parse-3d-tile-composite.js","names":["parse3DTileHeaderSync","parseComposite3DTile","tile","arrayBuffer","byteOffset","options","context","parse3DTile","view","DataView","tilesLength","getUint32","tiles","length","byteLength","subtile","shape","push"],"sources":["../../../../src/lib/parsers/parse-3d-tile-composite.ts"],"sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n// Reference code:\n// https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Composite3DTileContent.js#L182\n\nimport type {LoaderContext} from '@loaders.gl/loader-utils';\nimport type {Tiles3DLoaderOptions} from '../../tiles-3d-loader';\nimport {parse3DTileHeaderSync} from './helpers/parse-3d-tile-header';\nimport {Tiles3DTileContent} from '../../types';\n\n/** Resolve circulate dependency by passing in parsing function as argument */\ntype Parse3DTile = (\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n options: Tiles3DLoaderOptions | undefined,\n context: LoaderContext | undefined,\n subtile\n) => Promise<number>;\n\n// eslint-disable-next-line max-params\nexport async function parseComposite3DTile(\n tile: Tiles3DTileContent,\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n options: Tiles3DLoaderOptions | undefined,\n context: LoaderContext | undefined,\n parse3DTile: Parse3DTile\n): Promise<number> {\n byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);\n\n const view = new DataView(arrayBuffer);\n\n // Extract number of tiles\n tile.tilesLength = view.getUint32(byteOffset, true);\n byteOffset += 4;\n\n // extract each tile from the byte stream\n tile.tiles = [];\n while (tile.tiles.length < tile.tilesLength && (tile.byteLength || 0) - byteOffset > 12) {\n const subtile: Tiles3DTileContent = {shape: 'tile3d'};\n tile.tiles.push(subtile);\n byteOffset = await parse3DTile(arrayBuffer, byteOffset, options, context, subtile);\n // TODO - do we need to add any padding in between tiles?\n }\n\n return byteOffset;\n}\n"],"mappings":"AAQA,SAAQA,qBAAqB,QAAO,gCAAgC;AAapE,OAAO,eAAeC,oBAAoBA,CACxCC,IAAwB,EACxBC,WAAwB,EACxBC,UAAkB,EAClBC,OAAyC,EACzCC,OAAkC,EAClCC,WAAwB,EACP;EACjBH,UAAU,GAAGJ,qBAAqB,CAACE,IAAI,EAAEC,WAAW,EAAEC,UAAU,CAAC;EAEjE,MAAMI,IAAI,GAAG,IAAIC,QAAQ,CAACN,WAAW,CAAC;EAGtCD,IAAI,CAACQ,WAAW,GAAGF,IAAI,CAACG,SAAS,CAACP,UAAU,EAAE,IAAI,CAAC;EACnDA,UAAU,IAAI,CAAC;EAGfF,IAAI,CAACU,KAAK,GAAG,EAAE;EACf,OAAOV,IAAI,CAACU,KAAK,CAACC,MAAM,GAAGX,IAAI,CAACQ,WAAW,IAAI,CAACR,IAAI,CAACY,UAAU,IAAI,CAAC,IAAIV,UAAU,GAAG,EAAE,EAAE;IACvF,MAAMW,OAA2B,GAAG;MAACC,KAAK,EAAE;IAAQ,CAAC;IACrDd,IAAI,CAACU,KAAK,CAACK,IAAI,CAACF,OAAO,CAAC;IACxBX,UAAU,GAAG,MAAMG,WAAW,CAACJ,WAAW,EAAEC,UAAU,EAAEC,OAAO,EAAEC,OAAO,EAAES,OAAO,CAAC;EAEpF;EAEA,OAAOX,UAAU;AACnB"}
@@ -1,20 +1,19 @@
1
+ import { parseFromContext } from '@loaders.gl/loader-utils';
1
2
  import { _getMemoryUsageGLTF, GLTFLoader, postProcessGLTF } from '@loaders.gl/gltf';
2
3
  export async function parseGltf3DTile(tile, arrayBuffer, options, context) {
3
- var _options$3dTiles;
4
+ var _options$3dTiles, _options$3dTiles2;
4
5
  tile.rotateYtoZ = true;
5
- tile.gltfUpAxis = options !== null && options !== void 0 && options['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis ? options['3d-tiles'].assetGltfUpAxis : 'Y';
6
- if (options !== null && options !== void 0 && (_options$3dTiles = options['3d-tiles']) !== null && _options$3dTiles !== void 0 && _options$3dTiles.loadGLTF) {
6
+ tile.gltfUpAxis = options !== null && options !== void 0 && (_options$3dTiles = options['3d-tiles']) !== null && _options$3dTiles !== void 0 && _options$3dTiles.assetGltfUpAxis ? options['3d-tiles'].assetGltfUpAxis : 'Y';
7
+ if (options !== null && options !== void 0 && (_options$3dTiles2 = options['3d-tiles']) !== null && _options$3dTiles2 !== void 0 && _options$3dTiles2.loadGLTF) {
7
8
  if (!context) {
8
- return;
9
+ return arrayBuffer.byteLength;
9
10
  }
10
- const {
11
- parse
12
- } = context;
13
- const gltfWithBuffers = await parse(arrayBuffer, GLTFLoader, options, context);
11
+ const gltfWithBuffers = await parseFromContext(arrayBuffer, GLTFLoader, options, context);
14
12
  tile.gltf = postProcessGLTF(gltfWithBuffers);
15
13
  tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);
16
14
  } else {
17
15
  tile.gltfArrayBuffer = arrayBuffer;
18
16
  }
17
+ return arrayBuffer.byteLength;
19
18
  }
20
19
  //# sourceMappingURL=parse-3d-tile-gltf.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-3d-tile-gltf.js","names":["_getMemoryUsageGLTF","GLTFLoader","postProcessGLTF","parseGltf3DTile","tile","arrayBuffer","options","context","_options$3dTiles","rotateYtoZ","gltfUpAxis","assetGltfUpAxis","loadGLTF","parse","gltfWithBuffers","gltf","gpuMemoryUsageInBytes","gltfArrayBuffer"],"sources":["../../../../src/lib/parsers/parse-3d-tile-gltf.ts"],"sourcesContent":["import type {LoaderContext} from '@loaders.gl/loader-utils';\nimport type {Tiles3DLoaderOptions} from '../../tiles-3d-loader';\nimport {_getMemoryUsageGLTF, GLTFLoader, postProcessGLTF} from '@loaders.gl/gltf';\nimport {Tiles3DTileContent} from '../../types';\n\nexport async function parseGltf3DTile(\n tile: Tiles3DTileContent,\n arrayBuffer: ArrayBuffer,\n options?: Tiles3DLoaderOptions,\n context?: LoaderContext\n): Promise<void> {\n // Set flags\n // glTF models need to be rotated from Y to Z up\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up\n tile.rotateYtoZ = true;\n // Save gltf up axis\n tile.gltfUpAxis =\n options?.['3d-tiles'] && options['3d-tiles'].assetGltfUpAxis\n ? options['3d-tiles'].assetGltfUpAxis\n : 'Y';\n\n if (options?.['3d-tiles']?.loadGLTF) {\n if (!context) {\n return;\n }\n const {parse} = context;\n const gltfWithBuffers = await parse(arrayBuffer, GLTFLoader, options, context);\n tile.gltf = postProcessGLTF(gltfWithBuffers);\n tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);\n } else {\n tile.gltfArrayBuffer = arrayBuffer;\n }\n}\n"],"mappings":"AAEA,SAAQA,mBAAmB,EAAEC,UAAU,EAAEC,eAAe,QAAO,kBAAkB;AAGjF,OAAO,eAAeC,eAAeA,CACnCC,IAAwB,EACxBC,WAAwB,EACxBC,OAA8B,EAC9BC,OAAuB,EACR;EAAA,IAAAC,gBAAA;EAIfJ,IAAI,CAACK,UAAU,GAAG,IAAI;EAEtBL,IAAI,CAACM,UAAU,GACbJ,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAG,UAAU,CAAC,IAAIA,OAAO,CAAC,UAAU,CAAC,CAACK,eAAe,GACxDL,OAAO,CAAC,UAAU,CAAC,CAACK,eAAe,GACnC,GAAG;EAET,IAAIL,OAAO,aAAPA,OAAO,gBAAAE,gBAAA,GAAPF,OAAO,CAAG,UAAU,CAAC,cAAAE,gBAAA,eAArBA,gBAAA,CAAuBI,QAAQ,EAAE;IACnC,IAAI,CAACL,OAAO,EAAE;MACZ;IACF;IACA,MAAM;MAACM;IAAK,CAAC,GAAGN,OAAO;IACvB,MAAMO,eAAe,GAAG,MAAMD,KAAK,CAACR,WAAW,EAAEJ,UAAU,EAAEK,OAAO,EAAEC,OAAO,CAAC;IAC9EH,IAAI,CAACW,IAAI,GAAGb,eAAe,CAACY,eAAe,CAAC;IAC5CV,IAAI,CAACY,qBAAqB,GAAGhB,mBAAmB,CAACI,IAAI,CAACW,IAAI,CAAC;EAC7D,CAAC,MAAM;IACLX,IAAI,CAACa,eAAe,GAAGZ,WAAW;EACpC;AACF"}
1
+ {"version":3,"file":"parse-3d-tile-gltf.js","names":["parseFromContext","_getMemoryUsageGLTF","GLTFLoader","postProcessGLTF","parseGltf3DTile","tile","arrayBuffer","options","context","_options$3dTiles","_options$3dTiles2","rotateYtoZ","gltfUpAxis","assetGltfUpAxis","loadGLTF","byteLength","gltfWithBuffers","gltf","gpuMemoryUsageInBytes","gltfArrayBuffer"],"sources":["../../../../src/lib/parsers/parse-3d-tile-gltf.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {parseFromContext, LoaderContext} from '@loaders.gl/loader-utils';\nimport {_getMemoryUsageGLTF, GLTFLoader, postProcessGLTF} from '@loaders.gl/gltf';\nimport type {Tiles3DLoaderOptions} from '../../tiles-3d-loader';\nimport {Tiles3DTileContent} from '../../types';\n\nexport async function parseGltf3DTile(\n tile: Tiles3DTileContent,\n arrayBuffer: ArrayBuffer,\n options?: Tiles3DLoaderOptions,\n context?: LoaderContext\n): Promise<number> {\n // Set flags\n // glTF models need to be rotated from Y to Z up\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up\n tile.rotateYtoZ = true;\n // Save gltf up axis\n tile.gltfUpAxis = options?.['3d-tiles']?.assetGltfUpAxis\n ? options['3d-tiles'].assetGltfUpAxis\n : 'Y';\n\n if (options?.['3d-tiles']?.loadGLTF) {\n if (!context) {\n return arrayBuffer.byteLength;\n }\n const gltfWithBuffers = await parseFromContext(arrayBuffer, GLTFLoader, options, context);\n tile.gltf = postProcessGLTF(gltfWithBuffers);\n tile.gpuMemoryUsageInBytes = _getMemoryUsageGLTF(tile.gltf);\n } else {\n tile.gltfArrayBuffer = arrayBuffer;\n }\n return arrayBuffer.byteLength;\n}\n"],"mappings":"AAEA,SAAQA,gBAAgB,QAAsB,0BAA0B;AACxE,SAAQC,mBAAmB,EAAEC,UAAU,EAAEC,eAAe,QAAO,kBAAkB;AAIjF,OAAO,eAAeC,eAAeA,CACnCC,IAAwB,EACxBC,WAAwB,EACxBC,OAA8B,EAC9BC,OAAuB,EACN;EAAA,IAAAC,gBAAA,EAAAC,iBAAA;EAIjBL,IAAI,CAACM,UAAU,GAAG,IAAI;EAEtBN,IAAI,CAACO,UAAU,GAAGL,OAAO,aAAPA,OAAO,gBAAAE,gBAAA,GAAPF,OAAO,CAAG,UAAU,CAAC,cAAAE,gBAAA,eAArBA,gBAAA,CAAuBI,eAAe,GACpDN,OAAO,CAAC,UAAU,CAAC,CAACM,eAAe,GACnC,GAAG;EAEP,IAAIN,OAAO,aAAPA,OAAO,gBAAAG,iBAAA,GAAPH,OAAO,CAAG,UAAU,CAAC,cAAAG,iBAAA,eAArBA,iBAAA,CAAuBI,QAAQ,EAAE;IACnC,IAAI,CAACN,OAAO,EAAE;MACZ,OAAOF,WAAW,CAACS,UAAU;IAC/B;IACA,MAAMC,eAAe,GAAG,MAAMhB,gBAAgB,CAACM,WAAW,EAAEJ,UAAU,EAAEK,OAAO,EAAEC,OAAO,CAAC;IACzFH,IAAI,CAACY,IAAI,GAAGd,eAAe,CAACa,eAAe,CAAC;IAC5CX,IAAI,CAACa,qBAAqB,GAAGjB,mBAAmB,CAACI,IAAI,CAACY,IAAI,CAAC;EAC7D,CAAC,MAAM;IACLZ,IAAI,CAACc,eAAe,GAAGb,WAAW;EACpC;EACA,OAAOA,WAAW,CAACS,UAAU;AAC/B"}
@@ -1,3 +1,4 @@
1
+ import { path } from '@loaders.gl/loader-utils';
1
2
  import { Tile3DSubtreeLoader } from '../../tile-3d-subtree-loader';
2
3
  import { load } from '@loaders.gl/core';
3
4
  import { LOD_METRIC_TYPE, TILE_REFINEMENT, TILE_TYPE } from '@loaders.gl/tiles';
@@ -44,7 +45,7 @@ function resolveUri() {
44
45
  } else if (uri.startsWith('/')) {
45
46
  return uri;
46
47
  }
47
- return "".concat(basePath, "/").concat(uri);
48
+ return path.resolve(basePath, uri);
48
49
  }
49
50
  export function normalizeTileData(tile, basePath) {
50
51
  if (!tile) {
@@ -1 +1 @@
1
- {"version":3,"file":"parse-3d-tile-header.js","names":["Tile3DSubtreeLoader","load","LOD_METRIC_TYPE","TILE_REFINEMENT","TILE_TYPE","parseImplicitTiles","replaceContentUrlTemplate","convertS2BoundingVolumetoOBB","getTileType","tile","tileContentUrl","arguments","length","undefined","EMPTY","contentUrl","split","fileExtension","pop","POINTCLOUD","SCENEGRAPH","getRefine","refine","REPLACE","ADD","resolveUri","uri","basePath","urlSchemeRegex","test","url","URL","concat","decodeURI","toString","startsWith","normalizeTileData","content","_tile$content","contentUri","tilePostprocessed","id","lodMetricType","GEOMETRIC_ERROR","lodMetricValue","geometricError","transformMatrix","transform","type","normalizeTileHeaders","tileset","options","root","rootImplicitTilingExtension","getImplicitTilingExtensionData","normalizeImplicitTileHeaders","stack","push","children","childrenPostprocessed","childHeader","childImplicitTilingExtension","childHeaderPostprocessed","implicitTilingExtension","_tile$content2","_tileset$root","_tile$boundingVolume$","subdivisionScheme","maximumLevel","availableLevels","subtreeLevels","subtrees","subtreesUriTemplate","replacedUrlTemplate","subtreeUrl","subtree","contentUrlTemplate","rootLodMetricValue","s2VolumeInfo","boundingVolume","extensions","box","s2VolumeBox","rootBoundingVolume","implicitOptions","Number","isFinite","normalizeImplicitTileData","rootSubtree","loaderOptions","tileContent","replace","_tile$extensions","implicitTiling"],"sources":["../../../../src/lib/parsers/parse-3d-tile-header.ts"],"sourcesContent":["import type {Tiles3DLoaderOptions} from '../../tiles-3d-loader';\nimport type {LoaderOptions} from '@loaders.gl/loader-utils';\nimport {Tile3DSubtreeLoader} from '../../tile-3d-subtree-loader';\nimport {load} from '@loaders.gl/core';\nimport {LOD_METRIC_TYPE, TILE_REFINEMENT, TILE_TYPE} from '@loaders.gl/tiles';\nimport {\n ImplicitTilingExensionData,\n Subtree,\n Tile3DBoundingVolume,\n Tiles3DTileContentJSON,\n Tiles3DTileJSON,\n Tiles3DTileJSONPostprocessed,\n Tiles3DTilesetJSON\n} from '../../types';\nimport type {S2VolumeBox} from './helpers/parse-3d-implicit-tiles';\nimport {parseImplicitTiles, replaceContentUrlTemplate} from './helpers/parse-3d-implicit-tiles';\nimport type {S2VolumeInfo} from '../utils/obb/s2-corners-to-obb';\nimport {convertS2BoundingVolumetoOBB} from '../utils/obb/s2-corners-to-obb';\n\n/** Options for recursive loading implicit subtrees */\nexport type ImplicitOptions = {\n /** Template of the full url of the content template */\n contentUrlTemplate: string;\n /** Template of the full url of the subtree */\n subtreesUriTemplate: string;\n /** Implicit subdivision scheme */\n subdivisionScheme: 'QUADTREE' | 'OCTREE' | string;\n /** Levels per subtree */\n subtreeLevels: number;\n /** Maximum implicit level through all subtrees */\n maximumLevel?: number;\n /** 3DTiles refine method (add/replace) */\n refine?: string;\n /** Tileset base path */\n basePath: string;\n /** 3DTiles LOD metric type */\n lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR;\n /** Root metric value of the root tile of the implicit subtrees */\n rootLodMetricValue: number;\n /** Bounding volume of the root tile of the implicit subtrees */\n rootBoundingVolume: Tile3DBoundingVolume;\n /** Function that detects TILE_TYPE by tile metadata and content URL */\n getTileType: (tile: Tiles3DTileJSON, tileContentUrl?: string) => TILE_TYPE | string;\n /** Function that converts string refine method to enum value */\n getRefine: (refine?: string) => TILE_REFINEMENT | string | undefined;\n};\n\nfunction getTileType(tile: Tiles3DTileJSON, tileContentUrl: string = ''): TILE_TYPE | string {\n if (!tileContentUrl) {\n return TILE_TYPE.EMPTY;\n }\n\n const contentUrl = tileContentUrl.split('?')[0]; // Discard query string\n const fileExtension = contentUrl.split('.').pop();\n switch (fileExtension) {\n case 'pnts':\n return TILE_TYPE.POINTCLOUD;\n case 'i3dm':\n case 'b3dm':\n case 'glb':\n case 'gltf':\n return TILE_TYPE.SCENEGRAPH;\n default:\n return fileExtension || TILE_TYPE.EMPTY;\n }\n}\n\nfunction getRefine(refine?: string): TILE_REFINEMENT | string | undefined {\n switch (refine) {\n case 'REPLACE':\n case 'replace':\n return TILE_REFINEMENT.REPLACE;\n case 'ADD':\n case 'add':\n return TILE_REFINEMENT.ADD;\n default:\n return refine;\n }\n}\n\nfunction resolveUri(uri: string = '', basePath: string): string {\n // url scheme per RFC3986\n const urlSchemeRegex = /^[a-z][0-9a-z+.-]*:/i;\n\n if (urlSchemeRegex.test(basePath)) {\n const url = new URL(uri, `${basePath}/`);\n return decodeURI(url.toString());\n } else if (uri.startsWith('/')) {\n return uri;\n }\n\n return `${basePath}/${uri}`;\n}\n\nexport function normalizeTileData(\n tile: Tiles3DTileJSON | null,\n basePath: string\n): Tiles3DTileJSONPostprocessed | null {\n if (!tile) {\n return null;\n }\n let tileContentUrl: string | undefined;\n if (tile.content) {\n const contentUri = tile.content.uri || tile.content?.url;\n tileContentUrl = resolveUri(contentUri, basePath);\n }\n const tilePostprocessed: Tiles3DTileJSONPostprocessed = {\n ...tile,\n id: tileContentUrl,\n contentUrl: tileContentUrl,\n lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,\n lodMetricValue: tile.geometricError,\n transformMatrix: tile.transform,\n type: getTileType(tile, tileContentUrl),\n refine: getRefine(tile.refine)\n };\n\n return tilePostprocessed;\n}\n\n// normalize tile headers\nexport async function normalizeTileHeaders(\n tileset: Tiles3DTilesetJSON,\n basePath: string,\n options: LoaderOptions\n): Promise<Tiles3DTileJSONPostprocessed | null> {\n let root: Tiles3DTileJSONPostprocessed | null = null;\n\n const rootImplicitTilingExtension = getImplicitTilingExtensionData(tileset.root);\n if (rootImplicitTilingExtension && tileset.root) {\n root = await normalizeImplicitTileHeaders(\n tileset.root,\n tileset,\n basePath,\n rootImplicitTilingExtension,\n options\n );\n } else {\n root = normalizeTileData(tileset.root, basePath);\n }\n\n const stack: any[] = [];\n stack.push(root);\n\n while (stack.length > 0) {\n const tile = stack.pop() || {};\n const children = tile.children || [];\n const childrenPostprocessed: Tiles3DTileJSONPostprocessed[] = [];\n for (const childHeader of children) {\n const childImplicitTilingExtension = getImplicitTilingExtensionData(childHeader);\n let childHeaderPostprocessed: Tiles3DTileJSONPostprocessed | null;\n if (childImplicitTilingExtension) {\n childHeaderPostprocessed = await normalizeImplicitTileHeaders(\n childHeader,\n tileset,\n basePath,\n childImplicitTilingExtension,\n options\n );\n } else {\n childHeaderPostprocessed = normalizeTileData(childHeader, basePath);\n }\n\n if (childHeaderPostprocessed) {\n childrenPostprocessed.push(childHeaderPostprocessed);\n stack.push(childHeaderPostprocessed);\n }\n }\n tile.children = childrenPostprocessed;\n }\n\n return root;\n}\n\n/**\n * Do normalisation of implicit tile headers\n * TODO Check if Tile3D class can be a return type here.\n * @param tileset\n */\nexport async function normalizeImplicitTileHeaders(\n tile: Tiles3DTileJSON,\n tileset: Tiles3DTilesetJSON,\n basePath: string,\n implicitTilingExtension: ImplicitTilingExensionData,\n options: Tiles3DLoaderOptions\n): Promise<Tiles3DTileJSONPostprocessed | null> {\n const {\n subdivisionScheme,\n maximumLevel,\n availableLevels,\n subtreeLevels,\n subtrees: {uri: subtreesUriTemplate}\n } = implicitTilingExtension;\n const replacedUrlTemplate = replaceContentUrlTemplate(subtreesUriTemplate, 0, 0, 0, 0);\n const subtreeUrl = resolveUri(replacedUrlTemplate, basePath);\n const subtree = await load(subtreeUrl, Tile3DSubtreeLoader, options);\n const contentUrlTemplate = resolveUri(tile.content?.uri, basePath);\n const refine = tileset?.root?.refine;\n // @ts-ignore\n const rootLodMetricValue = tile.geometricError;\n\n // Replace tile.boundingVolume with the the bounding volume specified by the extensions['3DTILES_bounding_volume_S2']\n const s2VolumeInfo: S2VolumeInfo = tile.boundingVolume.extensions?.['3DTILES_bounding_volume_S2'];\n if (s2VolumeInfo) {\n const box = convertS2BoundingVolumetoOBB(s2VolumeInfo);\n const s2VolumeBox: S2VolumeBox = {box, s2VolumeInfo};\n tile.boundingVolume = s2VolumeBox;\n }\n\n const rootBoundingVolume = tile.boundingVolume;\n\n const implicitOptions: ImplicitOptions = {\n contentUrlTemplate,\n subtreesUriTemplate,\n subdivisionScheme,\n subtreeLevels,\n maximumLevel: Number.isFinite(availableLevels) ? availableLevels - 1 : maximumLevel,\n refine,\n basePath,\n lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,\n rootLodMetricValue,\n rootBoundingVolume,\n getTileType,\n getRefine\n };\n\n return await normalizeImplicitTileData(tile, basePath, subtree, implicitOptions, options);\n}\n\n/**\n * Do implicit data normalisation to create hierarchical tile structure\n * @param tile\n * @param rootSubtree\n * @param options\n * @returns\n */\nexport async function normalizeImplicitTileData(\n tile: Tiles3DTileJSON,\n basePath: string,\n rootSubtree: Subtree,\n implicitOptions: ImplicitOptions,\n loaderOptions: Tiles3DLoaderOptions\n): Promise<Tiles3DTileJSONPostprocessed | null> {\n if (!tile) {\n return null;\n }\n\n const {children, contentUrl} = await parseImplicitTiles({\n subtree: rootSubtree,\n implicitOptions,\n loaderOptions\n });\n\n let tileContentUrl: string | undefined;\n let tileContent: Tiles3DTileContentJSON | null = null;\n if (contentUrl) {\n tileContentUrl = contentUrl;\n tileContent = {uri: contentUrl.replace(`${basePath}/`, '')};\n }\n const tilePostprocessed: Tiles3DTileJSONPostprocessed = {\n ...tile,\n id: tileContentUrl,\n contentUrl: tileContentUrl,\n lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,\n lodMetricValue: tile.geometricError,\n transformMatrix: tile.transform,\n type: getTileType(tile, tileContentUrl),\n refine: getRefine(tile.refine),\n content: tileContent || tile.content,\n children\n };\n\n return tilePostprocessed;\n}\n\n/**\n * Implicit Tiling data can be in 3DTILES_implicit_tiling for 3DTiles v.Next or directly in implicitTiling object for 3DTiles v1.1.\n * Spec 3DTiles v.Next - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling\n * Spec 3DTiles v.1.1 - https://github.com/CesiumGS/3d-tiles/tree/draft-1.1/specification/ImplicitTiling\n * @param tile\n * @returns\n */\nfunction getImplicitTilingExtensionData(tile: Tiles3DTileJSON | null): ImplicitTilingExensionData {\n return tile?.extensions?.['3DTILES_implicit_tiling'] || tile?.implicitTiling;\n}\n"],"mappings":"AAEA,SAAQA,mBAAmB,QAAO,8BAA8B;AAChE,SAAQC,IAAI,QAAO,kBAAkB;AACrC,SAAQC,eAAe,EAAEC,eAAe,EAAEC,SAAS,QAAO,mBAAmB;AAW7E,SAAQC,kBAAkB,EAAEC,yBAAyB,QAAO,mCAAmC;AAE/F,SAAQC,4BAA4B,QAAO,gCAAgC;AA8B3E,SAASC,WAAWA,CAACC,IAAqB,EAAmD;EAAA,IAAjDC,cAAsB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EACrE,IAAI,CAACD,cAAc,EAAE;IACnB,OAAON,SAAS,CAACU,KAAK;EACxB;EAEA,MAAMC,UAAU,GAAGL,cAAc,CAACM,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;EAC/C,MAAMC,aAAa,GAAGF,UAAU,CAACC,KAAK,CAAC,GAAG,CAAC,CAACE,GAAG,CAAC,CAAC;EACjD,QAAQD,aAAa;IACnB,KAAK,MAAM;MACT,OAAOb,SAAS,CAACe,UAAU;IAC7B,KAAK,MAAM;IACX,KAAK,MAAM;IAC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EAEA,MAAM;IAACiD,QAAQ;IAAE3C;EAAU,CAAC,GAAG,MAAMV,kBAAkB,CAAC;IACtDsE,OAAO,EAAEa,WAAW;IACpBJ,eAAe;IACfK;EACF,CAAC,CAAC;EAEF,IAAI/E,cAAkC;EACtC,IAAIgF,WAA0C,GAAG,IAAI;EACrD,IAAI3E,UAAU,EAAE;IACdL,cAAc,GAAGK,UAAU;IAC3B2E,WAAW,GAAG;MAAChE,GAAG,EAAEX,UAAU,CAAC4E,OAAO,IAAA3D,MAAA,CAAIL,QAAQ,QAAK,EAAE;IAAC,CAAC;EAC7D;EACA,MAAMa,iBAA+C,GAAG;IACtD,GAAG/B,IAAI;IACPgC,EAAE,EAAE/B,cAAc;IAClBK,UAAU,EAAEL,cAAc;IAC1BgC,aAAa,EAAExC,eAAe,CAACyC,eAAe;IAC9CC,cAAc,EAAEnC,IAAI,CAACoC,cAAc;IACnCC,eAAe,EAAErC,IAAI,CAACsC,SAAS;IAC/BC,IAAI,EAAExC,WAAW,CAACC,IAAI,EAAEC,cAAc,CAAC;IACvCY,MAAM,EAAED,SAAS,CAACZ,IAAI,CAACa,MAAM,CAAC;IAC9Be,OAAO,EAAEqD,WAAW,IAAIjF,IAAI,CAAC4B,OAAO;IACpCqB;EACF,CAAC;EAED,OAAOlB,iBAAiB;AAC1B;AASA,SAASc,8BAA8BA,CAAC7C,IAA4B,EAA8B;EAAA,IAAAmF,gBAAA;EAChG,OAAO,CAAAnF,IAAI,aAAJA,IAAI,wBAAAmF,gBAAA,GAAJnF,IAAI,CAAEuE,UAAU,cAAAY,gBAAA,uBAAhBA,gBAAA,CAAmB,yBAAyB,CAAC,MAAInF,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEoF,cAAc;AAC9E"}
1
+ {"version":3,"file":"parse-3d-tile-header.js","names":["path","Tile3DSubtreeLoader","load","LOD_METRIC_TYPE","TILE_REFINEMENT","TILE_TYPE","parseImplicitTiles","replaceContentUrlTemplate","convertS2BoundingVolumetoOBB","getTileType","tile","tileContentUrl","arguments","length","undefined","EMPTY","contentUrl","split","fileExtension","pop","POINTCLOUD","SCENEGRAPH","getRefine","refine","REPLACE","ADD","resolveUri","uri","basePath","urlSchemeRegex","test","url","URL","concat","decodeURI","toString","startsWith","resolve","normalizeTileData","content","_tile$content","contentUri","tilePostprocessed","id","lodMetricType","GEOMETRIC_ERROR","lodMetricValue","geometricError","transformMatrix","transform","type","normalizeTileHeaders","tileset","options","root","rootImplicitTilingExtension","getImplicitTilingExtensionData","normalizeImplicitTileHeaders","stack","push","children","childrenPostprocessed","childHeader","childImplicitTilingExtension","childHeaderPostprocessed","implicitTilingExtension","_tile$content2","_tileset$root","_tile$boundingVolume$","subdivisionScheme","maximumLevel","availableLevels","subtreeLevels","subtrees","subtreesUriTemplate","replacedUrlTemplate","subtreeUrl","subtree","contentUrlTemplate","rootLodMetricValue","s2VolumeInfo","boundingVolume","extensions","box","s2VolumeBox","rootBoundingVolume","implicitOptions","Number","isFinite","normalizeImplicitTileData","rootSubtree","loaderOptions","tileContent","replace","_tile$extensions","implicitTiling"],"sources":["../../../../src/lib/parsers/parse-3d-tile-header.ts"],"sourcesContent":["import type {Tiles3DLoaderOptions} from '../../tiles-3d-loader';\nimport type {LoaderOptions} from '@loaders.gl/loader-utils';\nimport {path} from '@loaders.gl/loader-utils';\nimport {Tile3DSubtreeLoader} from '../../tile-3d-subtree-loader';\nimport {load} from '@loaders.gl/core';\nimport {LOD_METRIC_TYPE, TILE_REFINEMENT, TILE_TYPE} from '@loaders.gl/tiles';\nimport {\n ImplicitTilingExensionData,\n Subtree,\n Tile3DBoundingVolume,\n Tiles3DTileContentJSON,\n Tiles3DTileJSON,\n Tiles3DTileJSONPostprocessed,\n Tiles3DTilesetJSON\n} from '../../types';\nimport type {S2VolumeBox} from './helpers/parse-3d-implicit-tiles';\nimport {parseImplicitTiles, replaceContentUrlTemplate} from './helpers/parse-3d-implicit-tiles';\nimport type {S2VolumeInfo} from '../utils/obb/s2-corners-to-obb';\nimport {convertS2BoundingVolumetoOBB} from '../utils/obb/s2-corners-to-obb';\n\n/** Options for recursive loading implicit subtrees */\nexport type ImplicitOptions = {\n /** Template of the full url of the content template */\n contentUrlTemplate: string;\n /** Template of the full url of the subtree */\n subtreesUriTemplate: string;\n /** Implicit subdivision scheme */\n subdivisionScheme: 'QUADTREE' | 'OCTREE' | string;\n /** Levels per subtree */\n subtreeLevels: number;\n /** Maximum implicit level through all subtrees */\n maximumLevel?: number;\n /** 3DTiles refine method (add/replace) */\n refine?: string;\n /** Tileset base path */\n basePath: string;\n /** 3DTiles LOD metric type */\n lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR;\n /** Root metric value of the root tile of the implicit subtrees */\n rootLodMetricValue: number;\n /** Bounding volume of the root tile of the implicit subtrees */\n rootBoundingVolume: Tile3DBoundingVolume;\n /** Function that detects TILE_TYPE by tile metadata and content URL */\n getTileType: (tile: Tiles3DTileJSON, tileContentUrl?: string) => TILE_TYPE | string;\n /** Function that converts string refine method to enum value */\n getRefine: (refine?: string) => TILE_REFINEMENT | string | undefined;\n};\n\nfunction getTileType(tile: Tiles3DTileJSON, tileContentUrl: string = ''): TILE_TYPE | string {\n if (!tileContentUrl) {\n return TILE_TYPE.EMPTY;\n }\n\n const contentUrl = tileContentUrl.split('?')[0]; // Discard query string\n const fileExtension = contentUrl.split('.').pop();\n switch (fileExtension) {\n case 'pnts':\n return TILE_TYPE.POINTCLOUD;\n case 'i3dm':\n case 'b3dm':\n case 'glb':\n case 'gltf':\n return TILE_TYPE.SCENEGRAPH;\n default:\n return fileExtension || TILE_TYPE.EMPTY;\n }\n}\n\nfunction getRefine(refine?: string): TILE_REFINEMENT | string | undefined {\n switch (refine) {\n case 'REPLACE':\n case 'replace':\n return TILE_REFINEMENT.REPLACE;\n case 'ADD':\n case 'add':\n return TILE_REFINEMENT.ADD;\n default:\n return refine;\n }\n}\n\nfunction resolveUri(uri: string = '', basePath: string): string {\n // url scheme per RFC3986\n const urlSchemeRegex = /^[a-z][0-9a-z+.-]*:/i;\n\n if (urlSchemeRegex.test(basePath)) {\n const url = new URL(uri, `${basePath}/`);\n return decodeURI(url.toString());\n } else if (uri.startsWith('/')) {\n return uri;\n }\n\n return path.resolve(basePath, uri);\n}\n\nexport function normalizeTileData(\n tile: Tiles3DTileJSON | null,\n basePath: string\n): Tiles3DTileJSONPostprocessed | null {\n if (!tile) {\n return null;\n }\n let tileContentUrl: string | undefined;\n if (tile.content) {\n const contentUri = tile.content.uri || tile.content?.url;\n tileContentUrl = resolveUri(contentUri, basePath);\n }\n const tilePostprocessed: Tiles3DTileJSONPostprocessed = {\n ...tile,\n id: tileContentUrl,\n contentUrl: tileContentUrl,\n lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,\n lodMetricValue: tile.geometricError,\n transformMatrix: tile.transform,\n type: getTileType(tile, tileContentUrl),\n refine: getRefine(tile.refine)\n };\n\n return tilePostprocessed;\n}\n\n// normalize tile headers\nexport async function normalizeTileHeaders(\n tileset: Tiles3DTilesetJSON,\n basePath: string,\n options: LoaderOptions\n): Promise<Tiles3DTileJSONPostprocessed | null> {\n let root: Tiles3DTileJSONPostprocessed | null = null;\n\n const rootImplicitTilingExtension = getImplicitTilingExtensionData(tileset.root);\n if (rootImplicitTilingExtension && tileset.root) {\n root = await normalizeImplicitTileHeaders(\n tileset.root,\n tileset,\n basePath,\n rootImplicitTilingExtension,\n options\n );\n } else {\n root = normalizeTileData(tileset.root, basePath);\n }\n\n const stack: any[] = [];\n stack.push(root);\n\n while (stack.length > 0) {\n const tile = stack.pop() || {};\n const children = tile.children || [];\n const childrenPostprocessed: Tiles3DTileJSONPostprocessed[] = [];\n for (const childHeader of children) {\n const childImplicitTilingExtension = getImplicitTilingExtensionData(childHeader);\n let childHeaderPostprocessed: Tiles3DTileJSONPostprocessed | null;\n if (childImplicitTilingExtension) {\n childHeaderPostprocessed = await normalizeImplicitTileHeaders(\n childHeader,\n tileset,\n basePath,\n childImplicitTilingExtension,\n options\n );\n } else {\n childHeaderPostprocessed = normalizeTileData(childHeader, basePath);\n }\n\n if (childHeaderPostprocessed) {\n childrenPostprocessed.push(childHeaderPostprocessed);\n stack.push(childHeaderPostprocessed);\n }\n }\n tile.children = childrenPostprocessed;\n }\n\n return root;\n}\n\n/**\n * Do normalisation of implicit tile headers\n * TODO Check if Tile3D class can be a return type here.\n * @param tileset\n */\nexport async function normalizeImplicitTileHeaders(\n tile: Tiles3DTileJSON,\n tileset: Tiles3DTilesetJSON,\n basePath: string,\n implicitTilingExtension: ImplicitTilingExensionData,\n options: Tiles3DLoaderOptions\n): Promise<Tiles3DTileJSONPostprocessed | null> {\n const {\n subdivisionScheme,\n maximumLevel,\n availableLevels,\n subtreeLevels,\n subtrees: {uri: subtreesUriTemplate}\n } = implicitTilingExtension;\n const replacedUrlTemplate = replaceContentUrlTemplate(subtreesUriTemplate, 0, 0, 0, 0);\n const subtreeUrl = resolveUri(replacedUrlTemplate, basePath);\n const subtree = await load(subtreeUrl, Tile3DSubtreeLoader, options);\n const contentUrlTemplate = resolveUri(tile.content?.uri, basePath);\n const refine = tileset?.root?.refine;\n // @ts-ignore\n const rootLodMetricValue = tile.geometricError;\n\n // Replace tile.boundingVolume with the the bounding volume specified by the extensions['3DTILES_bounding_volume_S2']\n const s2VolumeInfo: S2VolumeInfo = tile.boundingVolume.extensions?.['3DTILES_bounding_volume_S2'];\n if (s2VolumeInfo) {\n const box = convertS2BoundingVolumetoOBB(s2VolumeInfo);\n const s2VolumeBox: S2VolumeBox = {box, s2VolumeInfo};\n tile.boundingVolume = s2VolumeBox;\n }\n\n const rootBoundingVolume = tile.boundingVolume;\n\n const implicitOptions: ImplicitOptions = {\n contentUrlTemplate,\n subtreesUriTemplate,\n subdivisionScheme,\n subtreeLevels,\n maximumLevel: Number.isFinite(availableLevels) ? availableLevels - 1 : maximumLevel,\n refine,\n basePath,\n lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,\n rootLodMetricValue,\n rootBoundingVolume,\n getTileType,\n getRefine\n };\n\n return await normalizeImplicitTileData(tile, basePath, subtree, implicitOptions, options);\n}\n\n/**\n * Do implicit data normalisation to create hierarchical tile structure\n * @param tile\n * @param rootSubtree\n * @param options\n * @returns\n */\nexport async function normalizeImplicitTileData(\n tile: Tiles3DTileJSON,\n basePath: string,\n rootSubtree: Subtree,\n implicitOptions: ImplicitOptions,\n loaderOptions: Tiles3DLoaderOptions\n): Promise<Tiles3DTileJSONPostprocessed | null> {\n if (!tile) {\n return null;\n }\n\n const {children, contentUrl} = await parseImplicitTiles({\n subtree: rootSubtree,\n implicitOptions,\n loaderOptions\n });\n\n let tileContentUrl: string | undefined;\n let tileContent: Tiles3DTileContentJSON | null = null;\n if (contentUrl) {\n tileContentUrl = contentUrl;\n tileContent = {uri: contentUrl.replace(`${basePath}/`, '')};\n }\n const tilePostprocessed: Tiles3DTileJSONPostprocessed = {\n ...tile,\n id: tileContentUrl,\n contentUrl: tileContentUrl,\n lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,\n lodMetricValue: tile.geometricError,\n transformMatrix: tile.transform,\n type: getTileType(tile, tileContentUrl),\n refine: getRefine(tile.refine),\n content: tileContent || tile.content,\n children\n };\n\n return tilePostprocessed;\n}\n\n/**\n * Implicit Tiling data can be in 3DTILES_implicit_tiling for 3DTiles v.Next or directly in implicitTiling object for 3DTiles v1.1.\n * Spec 3DTiles v.Next - https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_implicit_tiling\n * Spec 3DTiles v.1.1 - https://github.com/CesiumGS/3d-tiles/tree/draft-1.1/specification/ImplicitTiling\n * @param tile\n * @returns\n */\nfunction getImplicitTilingExtensionData(tile: Tiles3DTileJSON | null): ImplicitTilingExensionData {\n return tile?.extensions?.['3DTILES_implicit_tiling'] || tile?.implicitTiling;\n}\n"],"mappings":"AAEA,SAAQA,IAAI,QAAO,0BAA0B;AAC7C,SAAQC,mBAAmB,QAAO,8BAA8B;AAChE,SAAQC,IAAI,QAAO,k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