@loaders.gl/tile-converter 4.0.0-alpha.18 → 4.0.0-alpha.19

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 (30) hide show
  1. package/bin/converter.js +1 -1
  2. package/dist/converter.min.js +73 -73
  3. package/dist/deps-installer/deps-installer.d.ts +3 -2
  4. package/dist/deps-installer/deps-installer.d.ts.map +1 -1
  5. package/dist/deps-installer/deps-installer.js +36 -10
  6. package/dist/dist.min.js +77 -67
  7. package/dist/es5/deps-installer/deps-installer.js +112 -38
  8. package/dist/es5/deps-installer/deps-installer.js.map +1 -1
  9. package/dist/es5/i3s-converter/helpers/geometry-converter.js +12 -9
  10. package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
  11. package/dist/es5/i3s-converter/i3s-converter.js +32 -87
  12. package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
  13. package/dist/es5/pgm-loader.js +1 -1
  14. package/dist/esm/deps-installer/deps-installer.js +37 -11
  15. package/dist/esm/deps-installer/deps-installer.js.map +1 -1
  16. package/dist/esm/i3s-converter/helpers/geometry-converter.js +10 -6
  17. package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
  18. package/dist/esm/i3s-converter/i3s-converter.js +11 -28
  19. package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
  20. package/dist/esm/pgm-loader.js +1 -1
  21. package/dist/i3s-converter/helpers/geometry-converter.d.ts +2 -4
  22. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
  23. package/dist/i3s-converter/helpers/geometry-converter.js +18 -13
  24. package/dist/i3s-converter/i3s-converter.d.ts +0 -1
  25. package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
  26. package/dist/i3s-converter/i3s-converter.js +10 -22
  27. package/package.json +14 -14
  28. package/src/deps-installer/deps-installer.ts +55 -10
  29. package/src/i3s-converter/helpers/geometry-converter.ts +19 -14
  30. package/src/i3s-converter/i3s-converter.ts +12 -28
@@ -1 +1 @@
1
- {"version":3,"file":"i3s-converter.js","names":["load","encode","fetchFile","getLoaderOptions","isBrowser","CesiumIonLoader","Tiles3DLoader","join","v4","uuidv4","process","transform","md5","NodePages","writeFile","removeDir","writeFileForSlpk","removeFile","compressFileWithGzip","compressWithChildProcess","calculateFilesSize","timeConverter","convertB3dmToI3sGeometry","getPropertyTable","createBoundingVolumes","convertBoundingVolumeToI3SFullExtent","createSceneServerPath","convertGeometricErrorToScreenThreshold","PGMLoader","LAYERS","layersTemplate","GEOMETRY_DEFINITION","geometryDefinitionTemlate","SHARED_RESOURCES","sharedResourcesTemplate","validateNodeBoundingVolumes","KTX2BasisWriterWorker","ImageWriter","GltfPrimitiveModeString","getWorkerURL","WorkerFarm","DracoWriterWorker","WriteQueue","BROWSER_ERROR_MESSAGE","createdStorageAttribute","createFieldAttribute","createPopupInfo","getAttributeType","getFieldAttributeType","NodeIndexDocument","loadNestedTileset","loadTile3DContent","Matrix4","createBoundingVolume","traverseDatasetWith","analyzeTileContent","mergePreprocessData","ION_DEFAULT_TOKEN","_process$env","env","IonToken","HARDCODED_NODES_PER_PAGE","_3D_TILES","_3D_OBJECT_LAYER_TYPE","REFRESH_TOKEN_TIMEOUT","CESIUM_DATASET_PREFIX","I3SConverter","constructor","_defineProperty","_nodeWorkers","reuseWorkers","basis","format","workerUrl","draco","fetch","meshTopologyTypes","Set","nodePages","options","layers0Path","materialMap","Map","materialDefinitions","geometryMap","geometryConfigs","vertexCounter","layers0","featuresHashArray","refinementCounter","tilesCount","tilesWithAddRefineCount","validate","generateTextures","generateBoundingVolumes","layersHasTexture","compressList","convert","console","log","conversionStartTime","hrtime","tilesetName","slpk","egmFilePath","inputUrl","outputPath","sevenZipExe","maxDepth","token","instantNodeWriting","mergeMaterials","Boolean","Loader","indexOf","writeQueue","startListening","geoidHeightModel","useWriteFunction","loadWorkers","preloadOptions","_fetchPreloadOptions","tilesetUrl","url","headers","loadOptions","sourceTileset","preprocessResult","preprocessConversion","_createAndSaveTileset","_finishConversion","error","finalize","workerFarm","getWorkerFarm","destroy","sourceRootTile","root","analyzeTile","bind","undefined","preprocessData","concat","Array","from","has","TRIANGLES","TRIANGLE_STRIP","sourceTile","traversalProps","type","id","tileContent","loadGLTF","contentUrl","tilePreprocessData","_this$sourceTileset","_this$sourceTileset$r","_this$sourceTileset$r2","tilesetPath","e","sourceBoundingVolume","boundingVolume","_formLayers0","region","boundingVolumes","push","index","lodThreshold","obb","children","rootNode","createRootNode","parentNodes","convertTile","finalizeTile","geometryDefinitions","map","config","geometryConfig","store","defaultGeometrySchema","ordering","filter","attribute","_writeLayers0","filePath","save","_createSlpk","boundingVolumeRegion","_this$sourceTileset2","fullExtent","zmin","zmax","extent","xmin","ymin","xmax","ymax","layers0data","version","toUpperCase","name","href","nodesPerPage","compressGeometry","enqueue","archiveKey","writePromise","JSON","stringify","slpkTilesetPath","slpkFileName","transformationMatrix","clone","multiplyRight","parentNode","childNodes","_createNode","addChildren","newTraversalProps","conversionResults","currentTraversalProps","result","node","addNeighbors","_this$layers","_this$layers$attribut","_checkAddRefinementTypeForTile","_updateTilesetOptions","propertyTable","attributeStorageInfo","length","_convertPropertyTableToNodeAttributes","resourcesData","_convertResources","inPageId","nodes","nodeIds","nodesInPage","emptyResources","geometry","compressedGeometry","texture","hasUvRegions","sharedResources","meshMaterial","vertexCount","attributes","featureCount","resources","lodSelection","maxScreenThresholdSQ","find","val","metricType","maxError","nodeInPage","_updateNodeInNodePages","nodeData","createNodeIndexDocument","addData","mesh","_writeResources","boundingVolumeWarnings","warn","parentId","_this$layers2","isContentSupported","draftObb","center","halfSize","quaternion","workerSource","definition","findOrCreateGeometryDefinition","resource","material","nodeId","getNodeById","updateAll","updateMaterialByNodeId","_findOrCreateMaterial","texelCountHint","image","height","width","updateTexelCountHintByNodeId","updateVertexCountByNodeId","updateNodeAttributeByNodeId","updateFeatureCountByNodeId","saveNode","nodePath","geometryBuffer","childPath","slpkChildPath","_writeGeometries","_writeShared","_writeTexture","_writeAttributes","slpkGeometryPath","geometryPath","slpkCompressedGeometryPath","compressedGeometryPath","sharedData","sharedDataStr","slpkSharedPath","sharedPath","_getFormatByMimeType","mimeType","formats","textureData","bufferView","data","writeTextureFile","copyArrayBuffer","subarray","arrayToEncode","Uint8Array","ktx2TextureData","source","ktx2","decodedFromKTX2TextureData","textureSetDefinitions","atlas","slpkTexturePath","compress","texturePath","_this$layers3","_this$layers3$attribu","arguments","folderName","key","fileBuffer","slpkAttributesPath","attributesPath","hash","get","newMaterialId","set","hasTexture","newGeometryId","attributeIndex","propertyTableWithObjectId","OBJECTID","firstAttribute","attributeType","storageAttribute","fieldAttributeType","fieldAttribute","popupInfo","fields","layerType","params","addRefinementPercentage","filesSize","diff","conversionTime","preload","accessToken","refreshTokenTime","tile","ADD_TILE_REFINEMENT","refine","includes","sourceResponse","text"],"sources":["../../../src/i3s-converter/i3s-converter.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {\n FeatureTableJson,\n Tiles3DLoaderOptions,\n Tiles3DTileContent,\n Tiles3DTileJSONPostprocessed,\n Tiles3DTilesetJSONPostprocessed\n} from '@loaders.gl/3d-tiles';\nimport type {WriteQueueItem} from '../lib/utils/write-queue';\nimport type {\n SceneLayer3D,\n BoundingVolumes,\n MaxScreenThresholdSQ,\n NodeInPage\n} from '@loaders.gl/i3s';\nimport {load, encode, fetchFile, getLoaderOptions, isBrowser} from '@loaders.gl/core';\nimport {CesiumIonLoader, Tiles3DLoader} from '@loaders.gl/3d-tiles';\nimport {Geoid} from '@math.gl/geoid';\nimport {join} from 'path';\nimport {v4 as uuidv4} from 'uuid';\nimport process from 'process';\nimport transform from 'json-map-transform';\nimport md5 from 'md5';\n\nimport NodePages from './helpers/node-pages';\nimport {writeFile, removeDir, writeFileForSlpk, removeFile} from '../lib/utils/file-utils';\nimport {\n compressFileWithGzip,\n compressWithChildProcess\n // generateHash128FromZip,\n // addFileToZip\n} from '../lib/utils/compress-util';\nimport {calculateFilesSize, timeConverter} from '../lib/utils/statistic-utills';\nimport convertB3dmToI3sGeometry, {getPropertyTable} from './helpers/geometry-converter';\nimport {\n createBoundingVolumes,\n convertBoundingVolumeToI3SFullExtent\n} from './helpers/coordinate-converter';\nimport {createSceneServerPath} from './helpers/create-scene-server-path';\nimport {convertGeometricErrorToScreenThreshold} from '../lib/utils/lod-conversion-utils';\nimport {PGMLoader} from '../pgm-loader';\n\nimport {LAYERS as layersTemplate} from './json-templates/layers';\nimport {GEOMETRY_DEFINITION as geometryDefinitionTemlate} from './json-templates/geometry-definitions';\nimport {SHARED_RESOURCES as sharedResourcesTemplate} from './json-templates/shared-resources';\nimport {validateNodeBoundingVolumes} from './helpers/node-debug';\nimport {KTX2BasisWriterWorker} from '@loaders.gl/textures';\nimport {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {I3SMaterialDefinition, TextureSetDefinitionFormats} from '@loaders.gl/i3s';\nimport {ImageWriter} from '@loaders.gl/images';\nimport {GLTFImagePostprocessed} from '@loaders.gl/gltf';\nimport {\n GltfPrimitiveModeString,\n I3SConvertedResources,\n PreprocessData,\n SharedResourcesArrays\n} from './types';\nimport {getWorkerURL, WorkerFarm} from '@loaders.gl/worker-utils';\nimport {DracoWriterWorker} from '@loaders.gl/draco';\nimport WriteQueue from '../lib/utils/write-queue';\nimport {BROWSER_ERROR_MESSAGE} from '../constants';\nimport {\n createdStorageAttribute,\n createFieldAttribute,\n createPopupInfo,\n getAttributeType,\n getFieldAttributeType\n} from './helpers/feature-attributes';\nimport {NodeIndexDocument} from './helpers/node-index-document';\nimport {loadNestedTileset, loadTile3DContent} from './helpers/load-3d-tiles';\nimport {Matrix4} from '@math.gl/core';\nimport {BoundingSphere, OrientedBoundingBox} from '@math.gl/culling';\nimport {createBoundingVolume} from '@loaders.gl/tiles';\nimport {TraversalConversionProps, traverseDatasetWith} from './helpers/tileset-traversal';\nimport {analyzeTileContent, mergePreprocessData} from './helpers/preprocess-3d-tiles';\n\nconst ION_DEFAULT_TOKEN =\n process.env?.IonToken || // eslint-disable-line\n 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ'; // eslint-disable-line\nconst HARDCODED_NODES_PER_PAGE = 64;\nconst _3D_TILES = '3DTILES';\nconst _3D_OBJECT_LAYER_TYPE = '3DObject';\nconst REFRESH_TOKEN_TIMEOUT = 1800; // 30 minutes in seconds\nconst CESIUM_DATASET_PREFIX = 'https://';\n// const FS_FILE_TOO_LARGE = 'ERR_FS_FILE_TOO_LARGE';\n\n/**\n * Converter from 3d-tiles tileset to i3s layer\n */\nexport default class I3SConverter {\n nodePages: NodePages;\n options: any;\n layers0Path: string;\n materialMap: Map<string, number>;\n materialDefinitions: I3SMaterialDefinition[];\n geometryMap: Map<string, number>;\n geometryConfigs: {hasTexture: boolean; hasUvRegions: boolean}[];\n vertexCounter: number;\n layers0: SceneLayer3D | null;\n featuresHashArray: string[];\n refinementCounter: {\n tilesCount: number;\n tilesWithAddRefineCount: number;\n };\n validate: boolean;\n boundingVolumeWarnings?: string[] = [];\n conversionStartTime: [number, number] = [0, 0];\n refreshTokenTime: [number, number] = [0, 0];\n sourceTileset: Tiles3DTilesetJSONPostprocessed | null = null;\n loadOptions: Tiles3DLoaderOptions = {\n _nodeWorkers: true,\n reuseWorkers: true,\n basis: {\n format: 'rgba32',\n // We need to load local fs workers because nodejs can't load workers from the Internet\n workerUrl: './modules/textures/dist/basis-worker-node.js'\n },\n // We need to load local fs workers because nodejs can't load workers from the Internet\n draco: {workerUrl: './modules/draco/dist/draco-worker-node.js'},\n fetch: {}\n };\n geoidHeightModel: Geoid | null = null;\n Loader: LoaderWithParser = Tiles3DLoader;\n generateTextures: boolean;\n generateBoundingVolumes: boolean;\n layersHasTexture: boolean;\n workerSource: {[key: string]: string} = {};\n writeQueue: WriteQueue<WriteQueueItem> = new WriteQueue();\n compressList: string[] | null = null;\n preprocessData: PreprocessData = {\n meshTopologyTypes: new Set()\n };\n\n constructor() {\n this.nodePages = new NodePages(writeFile, HARDCODED_NODES_PER_PAGE, this);\n this.options = {};\n this.layers0Path = '';\n this.materialMap = new Map();\n this.materialDefinitions = [];\n this.geometryMap = new Map();\n this.geometryConfigs = [];\n this.vertexCounter = 0;\n this.layers0 = null;\n this.featuresHashArray = [];\n this.refinementCounter = {\n tilesCount: 0,\n tilesWithAddRefineCount: 0\n };\n this.validate = false;\n this.generateTextures = false;\n this.generateBoundingVolumes = false;\n this.layersHasTexture = false;\n this.compressList = null;\n }\n\n /**\n * Convert a 3d tileset\n * @param options\n * @param options.inputUrl the url to read the tileset from\n * @param options.outputPath the output filename\n * @param options.tilesetName the output name of the tileset\n * @param options.maxDepth The max tree depth of conversion\n * @param options.slpk Generate slpk (Scene Layer Packages) output file\n * @param options.sevenZipExe Location of 7z.exe archiver to create slpk on Windows\n * @param options.egmFilePath location of *.pgm file to convert heights from ellipsoidal to gravity-related format\n * @param options.token Token for Cesium ION tilesets authentication\n * @param options.draco Generate I3S 1.7 draco compressed geometries\n * @param options.validate -enable validation\n * @param options.generateTextures - generate alternative type of textures (to have non-compressed jpeg/png and compressed ktx2)\n * @param options.generateBoundingVolumes - generate bounding volumes from vertices coordinates instead of source tiles bounding volumes\n * @param options.instantNodeWriting - Keep created 3DNodeIndexDocument files on disk instead of memory. This option reduce memory usage but decelerates conversion speed\n */\n async convert(options: {\n inputUrl: string;\n outputPath: string;\n tilesetName: string;\n sevenZipExe: string;\n egmFilePath: string;\n maxDepth?: number;\n slpk?: boolean;\n token?: string;\n draco?: boolean;\n mergeMaterials?: boolean;\n validate?: boolean;\n generateTextures?: boolean;\n generateBoundingVolumes?: boolean;\n instantNodeWriting?: boolean;\n }): Promise<string> {\n if (isBrowser) {\n console.log(BROWSER_ERROR_MESSAGE);\n return BROWSER_ERROR_MESSAGE;\n }\n this.conversionStartTime = process.hrtime();\n const {\n tilesetName,\n slpk,\n egmFilePath,\n inputUrl,\n validate,\n outputPath,\n draco = true,\n sevenZipExe,\n maxDepth,\n token,\n generateTextures,\n generateBoundingVolumes,\n instantNodeWriting = false,\n mergeMaterials = true\n } = options;\n this.options = {\n maxDepth,\n slpk,\n sevenZipExe,\n egmFilePath,\n draco,\n token,\n inputUrl,\n instantNodeWriting,\n mergeMaterials\n };\n this.compressList = (this.options.instantNodeWriting && []) || null;\n this.validate = Boolean(validate);\n this.Loader = inputUrl.indexOf(CESIUM_DATASET_PREFIX) !== -1 ? CesiumIonLoader : Tiles3DLoader;\n this.generateTextures = Boolean(generateTextures);\n this.generateBoundingVolumes = Boolean(generateBoundingVolumes);\n\n this.writeQueue = new WriteQueue();\n this.writeQueue.startListening();\n\n console.log('Loading egm file...'); // eslint-disable-line\n this.geoidHeightModel = await load(egmFilePath, PGMLoader);\n console.log('Loading egm file completed!'); // eslint-disable-line\n\n if (slpk) {\n this.nodePages.useWriteFunction(writeFileForSlpk);\n }\n\n await this.loadWorkers();\n\n try {\n const preloadOptions = await this._fetchPreloadOptions();\n let tilesetUrl = inputUrl;\n if (preloadOptions.url) {\n tilesetUrl = preloadOptions.url;\n }\n if (preloadOptions.headers) {\n this.loadOptions.fetch = {headers: preloadOptions.headers};\n }\n this.sourceTileset = await load(tilesetUrl, this.Loader, this.loadOptions);\n\n const preprocessResult = await this.preprocessConversion();\n\n if (preprocessResult) {\n await this._createAndSaveTileset(outputPath, tilesetName);\n await this._finishConversion({slpk: Boolean(slpk), outputPath, tilesetName});\n }\n } catch (error) {\n throw error;\n } finally {\n await this.writeQueue.finalize();\n // Clean up worker pools\n const workerFarm = WorkerFarm.getWorkerFarm({});\n workerFarm.destroy();\n }\n return 'success';\n }\n\n /**\n * Preprocess stage of the tile converter. Traverse all the tiles tree and\n * check a tile content to be sure that the data is supported\n * @returns true - the conversion is possible, false - the tileset's content is not supported\n */\n private async preprocessConversion(): Promise<boolean> {\n console.log(`Analyze source tileset`);\n const sourceRootTile: Tiles3DTileJSONPostprocessed = this.sourceTileset!.root!;\n await traverseDatasetWith<null>(\n sourceRootTile,\n null,\n this.analyzeTile.bind(this),\n undefined,\n this.options.maxDepth\n );\n const {meshTopologyTypes} = this.preprocessData;\n console.log(`------------------------------------------------`);\n console.log(`Preprocess results:`);\n console.log(`glTF mesh topology types: ${Array.from(meshTopologyTypes).join(', ')}`);\n console.log(`------------------------------------------------`);\n if (\n !meshTopologyTypes.has(GltfPrimitiveModeString.TRIANGLES) &&\n !meshTopologyTypes.has(GltfPrimitiveModeString.TRIANGLE_STRIP)\n ) {\n console.log(\n 'The tileset is of unsupported mesh topology types. The conversion will be interrupted.'\n );\n console.log(`------------------------------------------------`);\n return false;\n }\n return true;\n }\n\n /**\n * Analyze a tile content. The callback for preprocess stage.\n * @param sourceTile - 3DTiles tile JSON metadata\n * @param traversalProps - mandatory argument but it is not used for the preprocess stage\n * @returns - nothing\n */\n private async analyzeTile(\n sourceTile: Tiles3DTileJSONPostprocessed,\n traversalProps: null\n ): Promise<null> {\n if (sourceTile.type === 'json') {\n await loadNestedTileset(this.sourceTileset, sourceTile, this.loadOptions);\n return null;\n }\n if (sourceTile.id) {\n console.log(`[analyze]: ${sourceTile.id}`); // eslint-disable-line\n }\n\n let tileContent: Tiles3DTileContent | null = null;\n try {\n tileContent = await loadTile3DContent(this.sourceTileset, sourceTile, {\n ...this.loadOptions,\n '3d-tiles': {...this.loadOptions['3d-tiles'], loadGLTF: false}\n });\n } catch (error) {\n console.log(\n `[warning]: Failed to load ${sourceTile.contentUrl}. An I3S tile with empty content will be added to the output tileset`\n );\n }\n const tilePreprocessData = await analyzeTileContent(tileContent);\n mergePreprocessData(this.preprocessData, tilePreprocessData);\n\n return null;\n }\n\n /**\n * Convert and save the layer and embedded tiles\n * @param outputPath - path to save output data\n * @param tilesetName - new tileset path\n */\n private async _createAndSaveTileset(outputPath: string, tilesetName: string): Promise<void> {\n const tilesetPath = join(`${outputPath}`, `${tilesetName}`);\n // Removing the tilesetPath needed to exclude erroneous files after conversion\n try {\n await removeDir(tilesetPath);\n } catch (e) {\n // do nothing\n }\n\n this.layers0Path = join(tilesetPath, 'SceneServer', 'layers', '0');\n\n this.materialDefinitions = [];\n this.materialMap = new Map();\n\n const sourceRootTile: Tiles3DTileJSONPostprocessed = this.sourceTileset!.root!;\n const sourceBoundingVolume = createBoundingVolume(\n sourceRootTile.boundingVolume,\n new Matrix4(sourceRootTile.transform),\n null\n );\n\n this._formLayers0(\n tilesetName,\n sourceBoundingVolume,\n this.sourceTileset?.root?.boundingVolume?.region\n );\n\n const boundingVolumes = createBoundingVolumes(sourceBoundingVolume, this.geoidHeightModel!);\n\n await this.nodePages.push({\n index: 0,\n lodThreshold: 0,\n obb: boundingVolumes.obb,\n children: []\n });\n\n const rootNode = await NodeIndexDocument.createRootNode(boundingVolumes, this);\n await traverseDatasetWith<TraversalConversionProps>(\n sourceRootTile,\n {\n transform: new Matrix4(sourceRootTile.transform),\n parentNodes: [rootNode]\n },\n this.convertTile.bind(this),\n this.finalizeTile.bind(this),\n this.options.maxDepth\n );\n\n this.layers0!.materialDefinitions = this.materialDefinitions;\n // @ts-ignore\n this.layers0.geometryDefinitions = transform(\n this.geometryConfigs.map((config) => ({\n geometryConfig: {...config, draco: this.options.draco}\n })),\n geometryDefinitionTemlate()\n );\n\n if (this.layersHasTexture === false) {\n this.layers0!.store.defaultGeometrySchema.ordering =\n this.layers0!.store.defaultGeometrySchema.ordering.filter(\n (attribute) => attribute !== 'uv0'\n );\n }\n\n await this._writeLayers0();\n createSceneServerPath(tilesetName, this.layers0!, tilesetPath);\n for (const filePath of this.compressList || []) {\n await compressFileWithGzip(filePath);\n await removeFile(filePath);\n }\n await this.nodePages.save();\n await this.writeQueue.finalize();\n await this._createSlpk(tilesetPath);\n }\n\n /**\n * Form object of 3DSceneLayer https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DSceneLayer.cmn.md\n * @param tilesetName - Name of layer\n * @param sourceBoundingVolume - initialized bounding volume of the source root tile\n * @param boundingVolumeRegion - region bounding volume of the source root tile\n */\n private _formLayers0(\n tilesetName: string,\n sourceBoundingVolume: OrientedBoundingBox | BoundingSphere,\n boundingVolumeRegion?: number[]\n ): void {\n if (!this.sourceTileset?.root) {\n return;\n }\n const fullExtent = convertBoundingVolumeToI3SFullExtent(sourceBoundingVolume);\n if (boundingVolumeRegion) {\n fullExtent.zmin = boundingVolumeRegion[4];\n fullExtent.zmax = boundingVolumeRegion[5];\n }\n const extent = [fullExtent.xmin, fullExtent.ymin, fullExtent.xmax, fullExtent.ymax];\n const layers0data = {\n version: `{${uuidv4().toUpperCase()}}`,\n id: 0,\n name: tilesetName,\n href: './layers/0',\n store: {\n id: `{${uuidv4().toUpperCase()}}`,\n extent\n },\n nodePages: {\n nodesPerPage: HARDCODED_NODES_PER_PAGE\n },\n compressGeometry: this.options.draco,\n fullExtent\n };\n this.layers0 = transform(layers0data, layersTemplate());\n }\n\n /**\n * Write 3DSceneLayer https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DSceneLayer.cmn.md in file\n */\n private async _writeLayers0(): Promise<void> {\n if (this.options.slpk) {\n await this.writeQueue.enqueue({\n archiveKey: '3dSceneLayer.json.gz',\n writePromise: () =>\n writeFileForSlpk(this.layers0Path, JSON.stringify(this.layers0), '3dSceneLayer.json')\n });\n } else {\n await this.writeQueue.enqueue({\n writePromise: () => writeFile(this.layers0Path, JSON.stringify(this.layers0))\n });\n }\n }\n\n /**\n * Pack files into *.slpk archive\n * @param tilesetPath - Path to save file\n */\n private async _createSlpk(tilesetPath: string): Promise<void> {\n if (this.options.slpk) {\n const slpkTilesetPath = join(tilesetPath, 'SceneServer', 'layers', '0');\n const slpkFileName = `${tilesetPath}.slpk`;\n await compressWithChildProcess(\n slpkTilesetPath,\n slpkFileName,\n 0,\n '.',\n this.options.sevenZipExe\n );\n\n // TODO: `addFileToZip` corrupts archive so it can't be validated with windows i3s_converter.exe\n // const fileHash128Path = `${tilesetPath}/@specialIndexFileHASH128@`;\n // try {\n // await generateHash128FromZip(slpkFileName, fileHash128Path);\n // await addFileToZip(\n // tilesetPath,\n // '@specialIndexFileHASH128@',\n // slpkFileName,\n // this.options.sevenZipExe\n // );\n // } catch (error) {\n // if (error.code === FS_FILE_TOO_LARGE) {\n // console.warn(`${slpkFileName} file is too big to generate a hash`); // eslint-disable-line\n // } else {\n // console.error(error); // eslint-disable-line\n // }\n // }\n // All converted files are contained in slpk now they can be deleted\n try {\n await removeDir(tilesetPath);\n } catch (e) {\n // do nothing\n }\n }\n }\n\n /**\n * Convert the specific 3DTiles tile to I3S nodes.\n * This is callback function for the traversal generic function\n * @param sourceTile - current 3DTiles tile JSON metadata\n * @param traversalProps - traversal properties calculated recursively\n * @returns - traversal properties for the child tiles\n */\n private async convertTile(\n sourceTile: Tiles3DTileJSONPostprocessed,\n traversalProps: TraversalConversionProps\n ): Promise<TraversalConversionProps> {\n if (sourceTile.type === 'json' || sourceTile.type === 'empty') {\n if (sourceTile.type === 'json') {\n if (sourceTile.id) {\n console.log(`[load]: ${sourceTile.id}`); // eslint-disable-line\n }\n await loadNestedTileset(this.sourceTileset, sourceTile, this.loadOptions);\n }\n return traversalProps;\n }\n if (sourceTile.id) {\n console.log(`[convert]: ${sourceTile.id}`); // eslint-disable-line\n }\n\n const {parentNodes, transform} = traversalProps;\n let transformationMatrix: Matrix4 = transform.clone();\n if (sourceTile.transform) {\n transformationMatrix = transformationMatrix.multiplyRight(sourceTile.transform);\n }\n const parentNode = parentNodes[0];\n const childNodes = await this._createNode(parentNode, sourceTile, transformationMatrix);\n await parentNode.addChildren(childNodes);\n\n const newTraversalProps: TraversalConversionProps = {\n transform: transformationMatrix,\n parentNodes: childNodes\n };\n return newTraversalProps;\n }\n\n /**\n * Do final action with nodes after the current node and all child nodes been converted.\n * @param conversionResults - array of conversion results of the current node\n * @param currentTraversalProps - traversal properties of the current node\n */\n private async finalizeTile(\n conversionResults: TraversalConversionProps[],\n currentTraversalProps: TraversalConversionProps\n ): Promise<void> {\n for (const result of conversionResults) {\n for (const node of result.parentNodes) {\n await node.addNeighbors();\n }\n }\n for (const node of currentTraversalProps.parentNodes) {\n await node.save();\n }\n }\n\n /**\n * Convert tile to one or more I3S nodes\n * @param parentNode - 3DNodeIndexDocument of parent node\n * @param sourceTile - source 3DTile data\n * @param transformationMatrix - transformation matrix of the current tile, calculated recursively multiplying\n * transform of all parent tiles and transform of the current tile\n * @param level - tree level\n */\n private async _createNode(\n parentNode: NodeIndexDocument,\n sourceTile: Tiles3DTileJSONPostprocessed,\n transformationMatrix: Matrix4\n ): Promise<NodeIndexDocument[]> {\n this._checkAddRefinementTypeForTile(sourceTile);\n\n await this._updateTilesetOptions();\n\n let tileContent: Tiles3DTileContent | null = null;\n try {\n tileContent = await loadTile3DContent(this.sourceTileset, sourceTile, this.loadOptions);\n } catch (error) {\n console.log(`[warning]: Failed to load ${sourceTile.contentUrl}`);\n }\n const sourceBoundingVolume = createBoundingVolume(\n sourceTile.boundingVolume,\n transformationMatrix,\n null\n );\n let boundingVolumes = createBoundingVolumes(sourceBoundingVolume, this.geoidHeightModel!);\n\n const propertyTable = getPropertyTable(tileContent);\n\n if (propertyTable && !this.layers0?.attributeStorageInfo?.length) {\n this._convertPropertyTableToNodeAttributes(propertyTable);\n }\n\n const resourcesData = await this._convertResources(\n sourceTile,\n transformationMatrix,\n sourceBoundingVolume,\n tileContent,\n parentNode.inPageId,\n propertyTable\n );\n\n const nodes: NodeIndexDocument[] = [];\n const nodeIds: number[] = [];\n const nodesInPage: NodeInPage[] = [];\n const emptyResources = {\n geometry: null,\n compressedGeometry: null,\n texture: null,\n hasUvRegions: false,\n sharedResources: null,\n meshMaterial: null,\n vertexCount: null,\n attributes: null,\n featureCount: null,\n boundingVolumes: null\n };\n\n for (const resources of resourcesData || [emptyResources]) {\n this.layersHasTexture = this.layersHasTexture || Boolean(resources.texture);\n\n if (this.generateBoundingVolumes && resources.boundingVolumes) {\n boundingVolumes = resources.boundingVolumes;\n }\n\n const lodSelection = convertGeometricErrorToScreenThreshold(sourceTile, boundingVolumes);\n const maxScreenThresholdSQ = lodSelection.find(\n (val) => val.metricType === 'maxScreenThresholdSQ'\n ) || {maxError: 0};\n\n const nodeInPage = await this._updateNodeInNodePages(\n maxScreenThresholdSQ,\n boundingVolumes,\n sourceTile,\n parentNode.inPageId,\n resources\n );\n\n const nodeData = await NodeIndexDocument.createNodeIndexDocument(\n parentNode,\n boundingVolumes,\n lodSelection,\n nodeInPage,\n resources\n );\n const node = await new NodeIndexDocument(nodeInPage.index, this).addData(nodeData);\n nodes.push(node);\n\n if (nodeInPage.mesh) {\n await this._writeResources(resources, node.id);\n }\n\n if (this.validate) {\n this.boundingVolumeWarnings = validateNodeBoundingVolumes(nodeData);\n\n if (this.boundingVolumeWarnings && this.boundingVolumeWarnings.length) {\n console.warn('Bounding Volume Warnings: ', ...this.boundingVolumeWarnings); //eslint-disable-line\n }\n }\n\n nodeIds.push(nodeInPage.index);\n nodesInPage.push(nodeInPage);\n }\n\n return nodes;\n }\n\n /**\n * Convert tile to one or more I3S nodes\n * @param sourceTile - source tile (3DTile)\n * @param transformationMatrix - transformation matrix of the current tile, calculated recursively multiplying\n * transform of all parent tiles and transform of the current tile\n * @param boundingVolume - initialized bounding volume of the source tile\n * @param tileContent - content of the source tile\n * @param parentId - id of parent node in node pages\n * @param propertyTable - batch table from b3dm / feature properties from EXT_FEATURE_METADATA\n * @returns - converted node resources\n */\n private async _convertResources(\n sourceTile: Tiles3DTileJSONPostprocessed,\n transformationMatrix: Matrix4,\n boundingVolume: OrientedBoundingBox | BoundingSphere,\n tileContent: Tiles3DTileContent | null,\n parentId: number,\n propertyTable: FeatureTableJson | null\n ): Promise<I3SConvertedResources[] | null> {\n if (!this.isContentSupported(sourceTile) || !tileContent) {\n return null;\n }\n const draftObb = {\n center: [],\n halfSize: [],\n quaternion: []\n };\n const resourcesData = await convertB3dmToI3sGeometry(\n tileContent,\n transformationMatrix,\n boundingVolume,\n async () => (await this.nodePages.push({index: 0, obb: draftObb}, parentId)).index,\n propertyTable,\n this.featuresHashArray,\n this.layers0?.attributeStorageInfo,\n this.options.draco,\n this.generateBoundingVolumes,\n this.options.mergeMaterials,\n this.geoidHeightModel!,\n this.workerSource\n );\n return resourcesData;\n }\n\n /**\n * Update node object (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/node.cmn.md)\n * in node pages (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/nodePage.cmn.md)\n * @param maxScreenThresholdSQ - Level of Details (LOD) metric\n * @param boundingVolumes - Bounding volumes\n * @param sourceTile - source tile (3DTile)\n * @param parentId - id of parent node in node pages\n * @param resources - the node resources data\n * @param resources.meshMaterial - PBR-like material object\n * @param resources.texture - texture image\n * @param resources.vertexCount - number of vertices in geometry\n * @param resources.featureCount - number of features\n * @param resources.geometry - Uint8Array with geometry attributes\n * @return the node object in node pages\n */\n private async _updateNodeInNodePages(\n maxScreenThresholdSQ: MaxScreenThresholdSQ,\n boundingVolumes: BoundingVolumes,\n sourceTile: Tiles3DTileJSONPostprocessed,\n parentId: number,\n resources: I3SConvertedResources\n ): Promise<NodeInPage> {\n const {meshMaterial, texture, vertexCount, featureCount, geometry, hasUvRegions} = resources;\n const nodeInPage: NodeInPage = {\n index: 0,\n lodThreshold: maxScreenThresholdSQ.maxError,\n obb: boundingVolumes.obb,\n children: []\n };\n if (geometry && this.isContentSupported(sourceTile)) {\n nodeInPage.mesh = {\n geometry: {\n definition: this.findOrCreateGeometryDefinition(Boolean(texture), hasUvRegions),\n resource: 0\n },\n attribute: {\n resource: 0\n },\n material: {\n definition: 0\n }\n };\n }\n\n let nodeId = resources.nodeId;\n let node: NodeInPage;\n if (!nodeId) {\n node = await this.nodePages.push(nodeInPage, parentId);\n } else {\n node = await this.nodePages.getNodeById(nodeId);\n }\n\n if (!nodeInPage.mesh) {\n console.log(`[warning]: node ${node.index} is created with empty content`);\n }\n\n NodePages.updateAll(node, nodeInPage);\n if (meshMaterial) {\n NodePages.updateMaterialByNodeId(node, this._findOrCreateMaterial(meshMaterial));\n }\n if (texture) {\n const texelCountHint = texture.image.height * texture.image.width;\n NodePages.updateTexelCountHintByNodeId(node, texelCountHint);\n }\n if (vertexCount) {\n this.vertexCounter += vertexCount;\n NodePages.updateVertexCountByNodeId(node, vertexCount);\n }\n NodePages.updateNodeAttributeByNodeId(node);\n if (featureCount) {\n NodePages.updateFeatureCountByNodeId(node, featureCount);\n }\n\n this.nodePages.saveNode(node);\n\n return node;\n }\n\n /**\n * Write node resources in files\n * @param resources - source tile (3DTile)\n * @param resources.geometry - Uint8Array with geometry attributes\n * @param resources.compressedGeometry - Uint8Array with compressed (draco) geometry\n * @param resources.texture - texture image\n * @param resources.sharedResources - shared resource data object\n * @param resources.attributes - feature attributes\n * @return {Promise<void>}\n */\n private async _writeResources(resources: I3SConvertedResources, nodePath: string): Promise<void> {\n const {\n geometry: geometryBuffer,\n compressedGeometry,\n texture,\n sharedResources,\n attributes\n } = resources;\n const childPath = join(this.layers0Path, 'nodes', nodePath);\n const slpkChildPath = join('nodes', nodePath);\n\n await this._writeGeometries(geometryBuffer!, compressedGeometry!, childPath, slpkChildPath);\n await this._writeShared(sharedResources, childPath, slpkChildPath, nodePath);\n await this._writeTexture(texture, childPath, slpkChildPath);\n await this._writeAttributes(attributes, childPath, slpkChildPath);\n }\n\n /**\n * Write non-compressed and compressed geometries in files\n * @param geometryBuffer - Uint8Array with geometry attributes\n * @param compressedGeometry - Uint8Array with compressed (draco) geometry\n * @param childPath - a child path to write resources\n * @param slpkChildPath - resource path inside *slpk file\n */\n private async _writeGeometries(\n geometryBuffer: ArrayBuffer,\n compressedGeometry: Promise<ArrayBuffer>,\n childPath: string,\n slpkChildPath: string\n ): Promise<void> {\n if (this.options.slpk) {\n const slpkGeometryPath = join(childPath, 'geometries');\n await this.writeQueue.enqueue({\n archiveKey: `${slpkChildPath}/geometries/0.bin.gz`,\n writePromise: () => writeFileForSlpk(slpkGeometryPath, geometryBuffer, '0.bin')\n });\n } else {\n const geometryPath = join(childPath, 'geometries/0/');\n await this.writeQueue.enqueue({\n writePromise: () => writeFile(geometryPath, geometryBuffer, 'index.bin')\n });\n }\n\n if (this.options.draco) {\n if (this.options.slpk) {\n const slpkCompressedGeometryPath = join(childPath, 'geometries');\n await this.writeQueue.enqueue({\n archiveKey: `${slpkChildPath}/geometries/1.bin.gz`,\n writePromise: () =>\n writeFileForSlpk(slpkCompressedGeometryPath, compressedGeometry, '1.bin')\n });\n } else {\n const compressedGeometryPath = join(childPath, 'geometries/1/');\n await this.writeQueue.enqueue({\n writePromise: () => writeFile(compressedGeometryPath, compressedGeometry, 'index.bin')\n });\n }\n }\n }\n\n /**\n * Write shared resources in a file\n * @param sharedResources - shared resource data object\n * @param childPath - a child path to write resources\n * @param slpkChildPath - resource path inside *slpk file\n * @param nodePath - a node path\n */\n private async _writeShared(\n sharedResources: SharedResourcesArrays | null,\n childPath: string,\n slpkChildPath: string,\n nodePath: string\n ): Promise<void> {\n if (!sharedResources) {\n return;\n }\n sharedResources.nodePath = nodePath;\n const sharedData = transform(sharedResources, sharedResourcesTemplate());\n const sharedDataStr = JSON.stringify(sharedData);\n if (this.options.slpk) {\n const slpkSharedPath = join(childPath, 'shared');\n await this.writeQueue.enqueue({\n archiveKey: `${slpkChildPath}/shared/sharedResource.json.gz`,\n writePromise: () => writeFileForSlpk(slpkSharedPath, sharedDataStr, 'sharedResource.json')\n });\n } else {\n const sharedPath = join(childPath, 'shared/');\n await this.writeQueue.enqueue({writePromise: () => writeFile(sharedPath, sharedDataStr)});\n }\n }\n\n /**\n * Generates textures based on texture mime type and fill in textureSetDefinitions data.\n * @param texture - the texture image\n * @param childPath - a child path to write resources\n * @param slpkChildPath - the resource path inside *slpk file\n */\n private async _writeTexture(\n texture: GLTFImagePostprocessed,\n childPath: string,\n slpkChildPath: string\n ): Promise<void> {\n if (texture) {\n const format = this._getFormatByMimeType(texture?.mimeType);\n const formats: TextureSetDefinitionFormats = [];\n const textureData = texture.bufferView!.data;\n\n switch (format) {\n case 'jpg':\n case 'png': {\n formats.push({name: '0', format});\n await this.writeTextureFile(textureData, '0', format, childPath, slpkChildPath);\n\n if (this.generateTextures) {\n formats.push({name: '1', format: 'ktx2'});\n // For Node.js texture.image.data is type of Buffer\n const copyArrayBuffer = texture.image.data.subarray();\n const arrayToEncode = new Uint8Array(copyArrayBuffer);\n const ktx2TextureData = encode(\n {...texture.image, data: arrayToEncode},\n KTX2BasisWriterWorker,\n {\n ...KTX2BasisWriterWorker.options,\n source: this.workerSource.ktx2,\n reuseWorkers: true,\n _nodeWorkers: true\n }\n );\n\n await this.writeTextureFile(ktx2TextureData, '1', 'ktx2', childPath, slpkChildPath);\n }\n\n break;\n }\n\n case 'ktx2': {\n formats.push({name: '1', format});\n await this.writeTextureFile(textureData, '1', format, childPath, slpkChildPath);\n\n if (this.generateTextures) {\n formats.push({name: '0', format: 'jpg'});\n const decodedFromKTX2TextureData = encode(texture.image!.data[0], ImageWriter);\n await this.writeTextureFile(\n decodedFromKTX2TextureData,\n '0',\n 'jpg',\n childPath,\n slpkChildPath\n );\n }\n }\n }\n\n if (!this.layers0!.textureSetDefinitions!.length) {\n this.layers0!.textureSetDefinitions!.push({formats});\n this.layers0!.textureSetDefinitions!.push({formats, atlas: true});\n }\n }\n }\n\n /**\n * Write the texture image in a file\n * @param textureData\n * @param name\n * @param format\n * @param childPath\n * @param slpkChildPath\n */\n private async writeTextureFile(\n textureData: Uint8Array | Promise<ArrayBuffer>,\n name: string,\n format: 'jpg' | 'png' | 'ktx2',\n childPath: string,\n slpkChildPath: string\n ): Promise<void> {\n if (this.options.slpk) {\n const slpkTexturePath = join(childPath, 'textures');\n const compress = false;\n\n await this.writeQueue.enqueue({\n archiveKey: `${slpkChildPath}/textures/${name}.${format}`,\n writePromise: () =>\n writeFileForSlpk(slpkTexturePath, textureData, `${name}.${format}`, compress)\n });\n } else {\n const texturePath = join(childPath, `textures/${name}/`);\n await this.writeQueue.enqueue({\n writePromise: () => writeFile(texturePath, textureData, `index.${format}`)\n });\n }\n }\n\n /**\n * Write feature attributes in files\n * @param attributes - feature attributes\n * @param childPath - a child path to write resources\n * @param slpkChildPath - the resource path inside *slpk file\n */\n private async _writeAttributes(\n attributes: ArrayBuffer[] | null = [],\n childPath: string,\n slpkChildPath: string\n ): Promise<void> {\n if (attributes?.length && this.layers0?.attributeStorageInfo?.length) {\n for (let index = 0; index < attributes.length; index++) {\n const folderName = this.layers0.attributeStorageInfo[index].key;\n const fileBuffer = new Uint8Array(attributes[index]);\n\n if (this.options.slpk) {\n const slpkAttributesPath = join(childPath, 'attributes', folderName);\n await this.writeQueue.enqueue({\n archiveKey: `${slpkChildPath}/attributes/${folderName}.bin.gz`,\n writePromise: () => writeFileForSlpk(slpkAttributesPath, fileBuffer, '0.bin')\n });\n } else {\n const attributesPath = join(childPath, `attributes/${folderName}/0`);\n await this.writeQueue.enqueue({\n writePromise: () => writeFile(attributesPath, fileBuffer, 'index.bin')\n });\n }\n }\n }\n }\n\n /**\n * Return file format by its MIME type\n * @param mimeType - feature attributes\n */\n private _getFormatByMimeType(mimeType: string | undefined): 'jpg' | 'png' | 'ktx2' {\n switch (mimeType) {\n case 'image/jpeg':\n return 'jpg';\n case 'image/png':\n return 'png';\n case 'image/ktx2':\n return 'ktx2';\n default:\n return 'jpg';\n }\n }\n\n /**\n * Find or create material in materialDefinitions array\n * @param material - end-to-end index of the node\n * @return material id\n */\n private _findOrCreateMaterial(material: I3SMaterialDefinition): number {\n const hash = md5(JSON.stringify(material));\n if (this.materialMap.has(hash)) {\n return this.materialMap.get(hash) || 0;\n }\n const newMaterialId = this.materialDefinitions.push(material) - 1;\n this.materialMap.set(hash, newMaterialId);\n return newMaterialId;\n }\n\n /**\n * Get unique geometry configuration index\n * In the end of conversion configurations will be transformed to geometryDefinitions array\n * @param hasTexture\n * @param hasUvRegions\n * @returns\n */\n private findOrCreateGeometryDefinition(hasTexture: boolean, hasUvRegions: boolean): number {\n const geometryConfig = {hasTexture, hasUvRegions};\n const hash = md5(JSON.stringify(geometryConfig));\n if (this.geometryMap.has(hash)) {\n return this.geometryMap.get(hash) || 0;\n }\n const newGeometryId = this.geometryConfigs.push(geometryConfig) - 1;\n this.geometryMap.set(hash, newGeometryId);\n return newGeometryId;\n }\n\n /**\n * Do conversion of 3DTiles property table to I3s node attributes.\n * @param propertyTable - Table with layer meta data.\n */\n private _convertPropertyTableToNodeAttributes(propertyTable: FeatureTableJson): void {\n let attributeIndex = 0;\n const propertyTableWithObjectId = {\n OBJECTID: [0],\n ...propertyTable\n };\n\n for (const key in propertyTableWithObjectId) {\n const firstAttribute = propertyTableWithObjectId[key][0];\n const attributeType = getAttributeType(key, firstAttribute);\n\n const storageAttribute = createdStorageAttribute(attributeIndex, key, attributeType);\n const fieldAttributeType = getFieldAttributeType(attributeType);\n const fieldAttribute = createFieldAttribute(key, fieldAttributeType);\n const popupInfo = createPopupInfo(propertyTableWithObjectId);\n\n this.layers0!.attributeStorageInfo!.push(storageAttribute);\n this.layers0!.fields!.push(fieldAttribute);\n this.layers0!.popupInfo = popupInfo;\n this.layers0!.layerType = _3D_OBJECT_LAYER_TYPE;\n\n attributeIndex += 1;\n }\n }\n\n /**\n * Print statistics in the end of conversion\n * @param params - output files data\n */\n private async _finishConversion(params: {\n slpk: boolean;\n outputPath: string;\n tilesetName: string;\n }): Promise<void> {\n const {tilesCount, tilesWithAddRefineCount} = this.refinementCounter;\n const addRefinementPercentage = tilesWithAddRefineCount\n ? (tilesWithAddRefineCount / tilesCount) * 100\n : 0;\n const filesSize = await calculateFilesSize(params);\n const diff = process.hrtime(this.conversionStartTime);\n const conversionTime = timeConverter(diff);\n console.log(`------------------------------------------------`); // eslint-disable-line no-undef, no-console\n console.log(`Finishing conversion of ${_3D_TILES}`); // eslint-disable-line no-undef, no-console\n console.log(`Total conversion time: ${conversionTime}`); // eslint-disable-line no-undef, no-console\n console.log(`Vertex count: `, this.vertexCounter); // eslint-disable-line no-undef, no-console\n console.log(`File(s) size: `, filesSize, ' bytes'); // eslint-disable-line no-undef, no-console\n console.log(`Percentage of tiles with \"ADD\" refinement type:`, addRefinementPercentage, '%'); // eslint-disable-line no-undef, no-console\n console.log(`------------------------------------------------`); // eslint-disable-line no-undef, no-console\n }\n\n /**\n * Fetch preload options for ION tileset\n */\n private async _fetchPreloadOptions(): Promise<any> {\n if (!this.Loader.preload) {\n return {};\n }\n const options = {\n 'cesium-ion': {accessToken: this.options.token || ION_DEFAULT_TOKEN}\n };\n const preloadOptions = await this.Loader.preload(this.options.inputUrl, options);\n this.refreshTokenTime = process.hrtime();\n return {...options, ...preloadOptions};\n }\n\n /**\n * Update options of source tileset\n */\n private async _updateTilesetOptions(): Promise<void> {\n const diff = process.hrtime(this.refreshTokenTime);\n if (diff[0] < REFRESH_TOKEN_TIMEOUT) {\n return;\n }\n this.refreshTokenTime = process.hrtime();\n\n const preloadOptions = await this._fetchPreloadOptions();\n if (preloadOptions.headers) {\n this.loadOptions.fetch = {\n ...this.loadOptions.fetch,\n headers: preloadOptions.headers\n };\n console.log('Authorization Bearer token has been updated'); // eslint-disable-line no-undef, no-console\n }\n }\n\n /** Do calculations of all tiles and tiles with \"ADD\" type of refinement.\n * @param tile\n */\n private _checkAddRefinementTypeForTile(tile: Tiles3DTileJSONPostprocessed): void {\n const ADD_TILE_REFINEMENT = 1;\n\n if (tile.refine === ADD_TILE_REFINEMENT) {\n this.refinementCounter.tilesWithAddRefineCount += 1;\n console.warn('This tile uses \"ADD\" type of refinement'); // eslint-disable-line\n }\n\n this.refinementCounter.tilesCount += 1;\n }\n\n /**\n * Check if the tile's content format is supported by the converter\n * @param sourceTile\n * @returns\n */\n private isContentSupported(sourceTile: Tiles3DTileJSONPostprocessed): boolean {\n return ['b3dm', 'glTF', 'scenegraph'].includes(sourceTile.type || '');\n }\n\n private async loadWorkers(): Promise<void> {\n console.log(`Loading workers source...`); // eslint-disable-line no-undef, no-console\n if (this.options.draco) {\n const url = getWorkerURL(DracoWriterWorker, {...getLoaderOptions()});\n const sourceResponse = await fetchFile(url);\n const source = await sourceResponse.text();\n this.workerSource.draco = source;\n }\n\n if (this.generateTextures) {\n const url = getWorkerURL(KTX2BasisWriterWorker, {...getLoaderOptions()});\n const sourceResponse = await fetchFile(url);\n const source = await sourceResponse.text();\n this.workerSource.ktx2 = source;\n }\n\n console.log(`Loading workers source completed!`); // eslint-disable-line no-undef, no-console\n }\n}\n"],"mappings":";;AAgBA,SAAQA,IAAI,EAAEC,MAAM,EAAEC,SAAS,EAAEC,gBAAgB,EAAEC,SAAS,QAAO,kBAAkB;AACrF,SAAQC,eAAe,EAAEC,aAAa,QAAO,sBAAsB;AAEnE,SAAQC,IAAI,QAAO,MAAM;AACzB,SAAQC,EAAE,IAAIC,MAAM,QAAO,MAAM;AACjC,OAAOC,OAAO,MAAM,SAAS;AAC7B,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,GAAG,MAAM,KAAK;AAErB,OAAOC,SAAS,MAAM,sBAAsB;AAC5C,SAAQC,SAAS,EAAEC,SAAS,EAAEC,gBAAgB,EAAEC,UAAU,QAAO,yBAAyB;AAC1F,SACEC,oBAAoB,EACpBC,wBAAwB,QAGnB,4BAA4B;AACnC,SAAQC,kBAAkB,EAAEC,aAAa,QAAO,+BAA+B;AAC/E,OAAOC,wBAAwB,IAAGC,gBAAgB,QAAO,8BAA8B;AACvF,SACEC,qBAAqB,EACrBC,oCAAoC,QAC/B,gCAAgC;AACvC,SAAQC,qBAAqB,QAAO,oCAAoC;AACxE,SAAQC,sCAAsC,QAAO,mCAAmC;AACxF,SAAQC,SAAS,QAAO,eAAe;AAEvC,SAAQC,MAAM,IAAIC,cAAc,QAAO,yBAAyB;AAChE,SAAQC,mBAAmB,IAAIC,yBAAyB,QAAO,uCAAuC;AACtG,SAAQC,gBAAgB,IAAIC,uBAAuB,QAAO,mCAAmC;AAC7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ACC,GAAG,4BAA4B,CAAC;IACxC,IAAI,IAAI,CAACpB,OAAO,CAACL,KAAK,EAAE;MACtB,MAAMiD,GAAG,GAAGpF,YAAY,CAACE,iBAAiB,EAAE;QAAC,GAAGtC,gBAAgB,CAAC;MAAC,CAAC,CAAC;MACpE,MAAM0W,cAAc,GAAG,MAAM3W,SAAS,CAACyH,GAAG,CAAC;MAC3C,MAAMqM,MAAM,GAAG,MAAM6C,cAAc,CAACC,IAAI,CAAC,CAAC;MAC1C,IAAI,CAAC7F,YAAY,CAACvM,KAAK,GAAGsP,MAAM;IAClC;IAEA,IAAI,IAAI,CAACnO,gBAAgB,EAAE;MACzB,MAAM8B,GAAG,GAAGpF,YAAY,CAACH,qBAAqB,EAAE;QAAC,GAAGjC,gBAAgB,CAAC;MAAC,CAAC,CAAC;MACxE,MAAM0W,cAAc,GAAG,MAAM3W,SAAS,CAACyH,GAAG,CAAC;MAC3C,MAAMqM,MAAM,GAAG,MAAM6C,cAAc,CAACC,IAAI,CAAC,CAAC;MAC1C,IAAI,CAAC7F,YAAY,CAACgD,IAAI,GAAGD,MAAM;IACjC;IAEA9N,OAAO,CAACC,GAAG,oCAAoC,CAAC;EAClD;AACF"}
1
+ {"version":3,"file":"i3s-converter.js","names":["load","encode","isBrowser","CesiumIonLoader","Tiles3DLoader","join","v4","uuidv4","process","transform","md5","NodePages","writeFile","removeDir","writeFileForSlpk","removeFile","compressFileWithGzip","compressWithChildProcess","calculateFilesSize","timeConverter","convertB3dmToI3sGeometry","getPropertyTable","createBoundingVolumes","convertBoundingVolumeToI3SFullExtent","createSceneServerPath","convertGeometricErrorToScreenThreshold","PGMLoader","LAYERS","layersTemplate","GEOMETRY_DEFINITION","geometryDefinitionTemlate","SHARED_RESOURCES","sharedResourcesTemplate","validateNodeBoundingVolumes","KTX2BasisWriterWorker","ImageWriter","GltfPrimitiveModeString","WorkerFarm","WriteQueue","BROWSER_ERROR_MESSAGE","createdStorageAttribute","createFieldAttribute","createPopupInfo","getAttributeType","getFieldAttributeType","NodeIndexDocument","loadNestedTileset","loadTile3DContent","Matrix4","createBoundingVolume","traverseDatasetWith","analyzeTileContent","mergePreprocessData","ION_DEFAULT_TOKEN","_process$env","env","IonToken","HARDCODED_NODES_PER_PAGE","_3D_TILES","_3D_OBJECT_LAYER_TYPE","REFRESH_TOKEN_TIMEOUT","CESIUM_DATASET_PREFIX","I3SConverter","constructor","_defineProperty","_nodeWorkers","reuseWorkers","useLocalLibraries","basis","format","workerUrl","draco","fetch","modules","meshTopologyTypes","Set","nodePages","options","layers0Path","materialMap","Map","materialDefinitions","geometryMap","geometryConfigs","vertexCounter","layers0","featuresHashArray","refinementCounter","tilesCount","tilesWithAddRefineCount","validate","generateTextures","generateBoundingVolumes","layersHasTexture","compressList","convert","console","log","conversionStartTime","hrtime","tilesetName","slpk","egmFilePath","inputUrl","outputPath","sevenZipExe","maxDepth","token","instantNodeWriting","mergeMaterials","Boolean","Loader","indexOf","writeQueue","startListening","geoidHeightModel","useWriteFunction","preloadOptions","_fetchPreloadOptions","tilesetUrl","url","headers","loadOptions","sourceTileset","preprocessResult","preprocessConversion","_createAndSaveTileset","_finishConversion","error","finalize","workerFarm","getWorkerFarm","destroy","sourceRootTile","root","analyzeTile","bind","undefined","preprocessData","concat","Array","from","has","TRIANGLES","TRIANGLE_STRIP","sourceTile","traversalProps","type","id","tileContent","loadGLTF","contentUrl","tilePreprocessData","_this$sourceTileset","_this$sourceTileset$r","_this$sourceTileset$r2","tilesetPath","e","sourceBoundingVolume","boundingVolume","_formLayers0","region","boundingVolumes","push","index","lodThreshold","obb","children","rootNode","createRootNode","parentNodes","convertTile","finalizeTile","geometryDefinitions","map","config","geometryConfig","store","defaultGeometrySchema","ordering","filter","attribute","_writeLayers0","filePath","save","_createSlpk","boundingVolumeRegion","_this$sourceTileset2","fullExtent","zmin","zmax","extent","xmin","ymin","xmax","ymax","layers0data","version","toUpperCase","name","href","nodesPerPage","compressGeometry","enqueue","archiveKey","writePromise","JSON","stringify","slpkTilesetPath","slpkFileName","transformationMatrix","clone","multiplyRight","parentNode","childNodes","_createNode","addChildren","newTraversalProps","conversionResults","currentTraversalProps","result","node","addNeighbors","_this$layers","_this$layers$attribut","_checkAddRefinementTypeForTile","_updateTilesetOptions","propertyTable","attributeStorageInfo","length","_convertPropertyTableToNodeAttributes","resourcesData","_convertResources","inPageId","nodes","nodeIds","nodesInPage","emptyResources","geometry","compressedGeometry","texture","hasUvRegions","sharedResources","meshMaterial","vertexCount","attributes","featureCount","resources","lodSelection","maxScreenThresholdSQ","find","val","metricType","maxError","nodeInPage","_updateNodeInNodePages","nodeData","createNodeIndexDocument","addData","mesh","_writeResources","boundingVolumeWarnings","warn","parentId","_this$layers2","isContentSupported","draftObb","center","halfSize","quaternion","definition","findOrCreateGeometryDefinition","resource","material","nodeId","getNodeById","updateAll","updateMaterialByNodeId","_findOrCreateMaterial","texelCountHint","image","height","width","updateTexelCountHintByNodeId","updateVertexCountByNodeId","updateNodeAttributeByNodeId","updateFeatureCountByNodeId","saveNode","nodePath","geometryBuffer","childPath","slpkChildPath","_writeGeometries","_writeShared","_writeTexture","_writeAttributes","slpkGeometryPath","geometryPath","slpkCompressedGeometryPath","compressedGeometryPath","sharedData","sharedDataStr","slpkSharedPath","sharedPath","_getFormatByMimeType","mimeType","formats","textureData","bufferView","data","writeTextureFile","copyArrayBuffer","subarray","arrayToEncode","Uint8Array","ktx2TextureData","decodedFromKTX2TextureData","textureSetDefinitions","atlas","slpkTexturePath","compress","texturePath","_this$layers3","_this$layers3$attribu","arguments","folderName","key","fileBuffer","slpkAttributesPath","attributesPath","hash","get","newMaterialId","set","hasTexture","newGeometryId","attributeIndex","propertyTableWithObjectId","OBJECTID","firstAttribute","attributeType","storageAttribute","fieldAttributeType","fieldAttribute","popupInfo","fields","layerType","params","addRefinementPercentage","filesSize","diff","conversionTime","preload","accessToken","refreshTokenTime","tile","ADD_TILE_REFINEMENT","refine","includes"],"sources":["../../../src/i3s-converter/i3s-converter.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {\n FeatureTableJson,\n Tiles3DLoaderOptions,\n Tiles3DTileContent,\n Tiles3DTileJSONPostprocessed,\n Tiles3DTilesetJSONPostprocessed\n} from '@loaders.gl/3d-tiles';\nimport type {WriteQueueItem} from '../lib/utils/write-queue';\nimport type {\n SceneLayer3D,\n BoundingVolumes,\n MaxScreenThresholdSQ,\n NodeInPage\n} from '@loaders.gl/i3s';\nimport {load, encode, isBrowser} from '@loaders.gl/core';\nimport {CesiumIonLoader, Tiles3DLoader} from '@loaders.gl/3d-tiles';\nimport {Geoid} from '@math.gl/geoid';\nimport {join} from 'path';\nimport {v4 as uuidv4} from 'uuid';\nimport process from 'process';\nimport transform from 'json-map-transform';\nimport md5 from 'md5';\n\nimport NodePages from './helpers/node-pages';\nimport {writeFile, removeDir, writeFileForSlpk, removeFile} from '../lib/utils/file-utils';\nimport {\n compressFileWithGzip,\n compressWithChildProcess\n // generateHash128FromZip,\n // addFileToZip\n} from '../lib/utils/compress-util';\nimport {calculateFilesSize, timeConverter} from '../lib/utils/statistic-utills';\nimport convertB3dmToI3sGeometry, {getPropertyTable} from './helpers/geometry-converter';\nimport {\n createBoundingVolumes,\n convertBoundingVolumeToI3SFullExtent\n} from './helpers/coordinate-converter';\nimport {createSceneServerPath} from './helpers/create-scene-server-path';\nimport {convertGeometricErrorToScreenThreshold} from '../lib/utils/lod-conversion-utils';\nimport {PGMLoader} from '../pgm-loader';\n\nimport {LAYERS as layersTemplate} from './json-templates/layers';\nimport {GEOMETRY_DEFINITION as geometryDefinitionTemlate} from './json-templates/geometry-definitions';\nimport {SHARED_RESOURCES as sharedResourcesTemplate} from './json-templates/shared-resources';\nimport {validateNodeBoundingVolumes} from './helpers/node-debug';\nimport {KTX2BasisWriterWorker} from '@loaders.gl/textures';\nimport {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {I3SMaterialDefinition, TextureSetDefinitionFormats} from '@loaders.gl/i3s';\nimport {ImageWriter} from '@loaders.gl/images';\nimport {GLTFImagePostprocessed} from '@loaders.gl/gltf';\nimport {\n GltfPrimitiveModeString,\n I3SConvertedResources,\n PreprocessData,\n SharedResourcesArrays\n} from './types';\nimport {WorkerFarm} from '@loaders.gl/worker-utils';\nimport WriteQueue from '../lib/utils/write-queue';\nimport {BROWSER_ERROR_MESSAGE} from '../constants';\nimport {\n createdStorageAttribute,\n createFieldAttribute,\n createPopupInfo,\n getAttributeType,\n getFieldAttributeType\n} from './helpers/feature-attributes';\nimport {NodeIndexDocument} from './helpers/node-index-document';\nimport {loadNestedTileset, loadTile3DContent} from './helpers/load-3d-tiles';\nimport {Matrix4} from '@math.gl/core';\nimport {BoundingSphere, OrientedBoundingBox} from '@math.gl/culling';\nimport {createBoundingVolume} from '@loaders.gl/tiles';\nimport {TraversalConversionProps, traverseDatasetWith} from './helpers/tileset-traversal';\nimport {analyzeTileContent, mergePreprocessData} from './helpers/preprocess-3d-tiles';\n\nconst ION_DEFAULT_TOKEN =\n process.env?.IonToken || // eslint-disable-line\n 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ'; // eslint-disable-line\nconst HARDCODED_NODES_PER_PAGE = 64;\nconst _3D_TILES = '3DTILES';\nconst _3D_OBJECT_LAYER_TYPE = '3DObject';\nconst REFRESH_TOKEN_TIMEOUT = 1800; // 30 minutes in seconds\nconst CESIUM_DATASET_PREFIX = 'https://';\n// const FS_FILE_TOO_LARGE = 'ERR_FS_FILE_TOO_LARGE';\n\n/**\n * Converter from 3d-tiles tileset to i3s layer\n */\nexport default class I3SConverter {\n nodePages: NodePages;\n options: any;\n layers0Path: string;\n materialMap: Map<string, number>;\n materialDefinitions: I3SMaterialDefinition[];\n geometryMap: Map<string, number>;\n geometryConfigs: {hasTexture: boolean; hasUvRegions: boolean}[];\n vertexCounter: number;\n layers0: SceneLayer3D | null;\n featuresHashArray: string[];\n refinementCounter: {\n tilesCount: number;\n tilesWithAddRefineCount: number;\n };\n validate: boolean;\n boundingVolumeWarnings?: string[] = [];\n conversionStartTime: [number, number] = [0, 0];\n refreshTokenTime: [number, number] = [0, 0];\n sourceTileset: Tiles3DTilesetJSONPostprocessed | null = null;\n loadOptions: Tiles3DLoaderOptions = {\n _nodeWorkers: true,\n reuseWorkers: true,\n useLocalLibraries: true,\n basis: {\n format: 'rgba32',\n // We need to load local fs workers because nodejs can't load workers from the Internet\n workerUrl: './modules/textures/dist/basis-worker-node.js'\n },\n // We need to load local fs workers because nodejs can't load workers from the Internet\n draco: {workerUrl: './modules/draco/dist/draco-worker-node.js'},\n fetch: {},\n modules: {}\n };\n geoidHeightModel: Geoid | null = null;\n Loader: LoaderWithParser = Tiles3DLoader;\n generateTextures: boolean;\n generateBoundingVolumes: boolean;\n layersHasTexture: boolean;\n workerSource: {[key: string]: string} = {};\n writeQueue: WriteQueue<WriteQueueItem> = new WriteQueue();\n compressList: string[] | null = null;\n preprocessData: PreprocessData = {\n meshTopologyTypes: new Set()\n };\n\n constructor() {\n this.nodePages = new NodePages(writeFile, HARDCODED_NODES_PER_PAGE, this);\n this.options = {};\n this.layers0Path = '';\n this.materialMap = new Map();\n this.materialDefinitions = [];\n this.geometryMap = new Map();\n this.geometryConfigs = [];\n this.vertexCounter = 0;\n this.layers0 = null;\n this.featuresHashArray = [];\n this.refinementCounter = {\n tilesCount: 0,\n tilesWithAddRefineCount: 0\n };\n this.validate = false;\n this.generateTextures = false;\n this.generateBoundingVolumes = false;\n this.layersHasTexture = false;\n this.compressList = null;\n }\n\n /**\n * Convert a 3d tileset\n * @param options\n * @param options.inputUrl the url to read the tileset from\n * @param options.outputPath the output filename\n * @param options.tilesetName the output name of the tileset\n * @param options.maxDepth The max tree depth of conversion\n * @param options.slpk Generate slpk (Scene Layer Packages) output file\n * @param options.sevenZipExe Location of 7z.exe archiver to create slpk on Windows\n * @param options.egmFilePath location of *.pgm file to convert heights from ellipsoidal to gravity-related format\n * @param options.token Token for Cesium ION tilesets authentication\n * @param options.draco Generate I3S 1.7 draco compressed geometries\n * @param options.validate -enable validation\n * @param options.generateTextures - generate alternative type of textures (to have non-compressed jpeg/png and compressed ktx2)\n * @param options.generateBoundingVolumes - generate bounding volumes from vertices coordinates instead of source tiles bounding volumes\n * @param options.instantNodeWriting - Keep created 3DNodeIndexDocument files on disk instead of memory. This option reduce memory usage but decelerates conversion speed\n */\n async convert(options: {\n inputUrl: string;\n outputPath: string;\n tilesetName: string;\n sevenZipExe: string;\n egmFilePath: string;\n maxDepth?: number;\n slpk?: boolean;\n token?: string;\n draco?: boolean;\n mergeMaterials?: boolean;\n validate?: boolean;\n generateTextures?: boolean;\n generateBoundingVolumes?: boolean;\n instantNodeWriting?: boolean;\n }): Promise<string> {\n if (isBrowser) {\n console.log(BROWSER_ERROR_MESSAGE);\n return BROWSER_ERROR_MESSAGE;\n }\n this.conversionStartTime = process.hrtime();\n const {\n tilesetName,\n slpk,\n egmFilePath,\n inputUrl,\n validate,\n outputPath,\n draco = true,\n sevenZipExe,\n maxDepth,\n token,\n generateTextures,\n generateBoundingVolumes,\n instantNodeWriting = false,\n mergeMaterials = true\n } = options;\n this.options = {\n maxDepth,\n slpk,\n sevenZipExe,\n egmFilePath,\n draco,\n token,\n inputUrl,\n instantNodeWriting,\n mergeMaterials\n };\n this.compressList = (this.options.instantNodeWriting && []) || null;\n this.validate = Boolean(validate);\n this.Loader = inputUrl.indexOf(CESIUM_DATASET_PREFIX) !== -1 ? CesiumIonLoader : Tiles3DLoader;\n this.generateTextures = Boolean(generateTextures);\n this.generateBoundingVolumes = Boolean(generateBoundingVolumes);\n\n this.writeQueue = new WriteQueue();\n this.writeQueue.startListening();\n\n console.log('Loading egm file...'); // eslint-disable-line\n this.geoidHeightModel = await load(egmFilePath, PGMLoader);\n console.log('Loading egm file completed!'); // eslint-disable-line\n\n if (slpk) {\n this.nodePages.useWriteFunction(writeFileForSlpk);\n }\n\n try {\n const preloadOptions = await this._fetchPreloadOptions();\n let tilesetUrl = inputUrl;\n if (preloadOptions.url) {\n tilesetUrl = preloadOptions.url;\n }\n if (preloadOptions.headers) {\n this.loadOptions.fetch = {headers: preloadOptions.headers};\n }\n this.sourceTileset = await load(tilesetUrl, this.Loader, this.loadOptions);\n\n const preprocessResult = await this.preprocessConversion();\n\n if (preprocessResult) {\n await this._createAndSaveTileset(outputPath, tilesetName);\n await this._finishConversion({slpk: Boolean(slpk), outputPath, tilesetName});\n }\n } catch (error) {\n throw error;\n } finally {\n await this.writeQueue.finalize();\n // Clean up worker pools\n const workerFarm = WorkerFarm.getWorkerFarm({});\n workerFarm.destroy();\n }\n return 'success';\n }\n\n /**\n * Preprocess stage of the tile converter. Traverse all the tiles tree and\n * check a tile content to be sure that the data is supported\n * @returns true - the conversion is possible, false - the tileset's content is not supported\n */\n private async preprocessConversion(): Promise<boolean> {\n console.log(`Analyze source tileset`);\n const sourceRootTile: Tiles3DTileJSONPostprocessed = this.sourceTileset!.root!;\n await traverseDatasetWith<null>(\n sourceRootTile,\n null,\n this.analyzeTile.bind(this),\n undefined,\n this.options.maxDepth\n );\n const {meshTopologyTypes} = this.preprocessData;\n console.log(`------------------------------------------------`);\n console.log(`Preprocess results:`);\n console.log(`glTF mesh topology types: ${Array.from(meshTopologyTypes).join(', ')}`);\n console.log(`------------------------------------------------`);\n if (\n !meshTopologyTypes.has(GltfPrimitiveModeString.TRIANGLES) &&\n !meshTopologyTypes.has(GltfPrimitiveModeString.TRIANGLE_STRIP)\n ) {\n console.log(\n 'The tileset is of unsupported mesh topology types. The conversion will be interrupted.'\n );\n console.log(`------------------------------------------------`);\n return false;\n }\n return true;\n }\n\n /**\n * Analyze a tile content. The callback for preprocess stage.\n * @param sourceTile - 3DTiles tile JSON metadata\n * @param traversalProps - mandatory argument but it is not used for the preprocess stage\n * @returns - nothing\n */\n private async analyzeTile(\n sourceTile: Tiles3DTileJSONPostprocessed,\n traversalProps: null\n ): Promise<null> {\n if (sourceTile.type === 'json') {\n await loadNestedTileset(this.sourceTileset, sourceTile, this.loadOptions);\n return null;\n }\n if (sourceTile.id) {\n console.log(`[analyze]: ${sourceTile.id}`); // eslint-disable-line\n }\n\n let tileContent: Tiles3DTileContent | null = null;\n try {\n tileContent = await loadTile3DContent(this.sourceTileset, sourceTile, {\n ...this.loadOptions,\n '3d-tiles': {...this.loadOptions['3d-tiles'], loadGLTF: false}\n });\n } catch (error) {\n console.log(\n `[warning]: Failed to load ${sourceTile.contentUrl}. An I3S tile with empty content will be added to the output tileset`\n );\n }\n const tilePreprocessData = await analyzeTileContent(tileContent);\n mergePreprocessData(this.preprocessData, tilePreprocessData);\n\n return null;\n }\n\n /**\n * Convert and save the layer and embedded tiles\n * @param outputPath - path to save output data\n * @param tilesetName - new tileset path\n */\n private async _createAndSaveTileset(outputPath: string, tilesetName: string): Promise<void> {\n const tilesetPath = join(`${outputPath}`, `${tilesetName}`);\n // Removing the tilesetPath needed to exclude erroneous files after conversion\n try {\n await removeDir(tilesetPath);\n } catch (e) {\n // do nothing\n }\n\n this.layers0Path = join(tilesetPath, 'SceneServer', 'layers', '0');\n\n this.materialDefinitions = [];\n this.materialMap = new Map();\n\n const sourceRootTile: Tiles3DTileJSONPostprocessed = this.sourceTileset!.root!;\n const sourceBoundingVolume = createBoundingVolume(\n sourceRootTile.boundingVolume,\n new Matrix4(sourceRootTile.transform),\n null\n );\n\n this._formLayers0(\n tilesetName,\n sourceBoundingVolume,\n this.sourceTileset?.root?.boundingVolume?.region\n );\n\n const boundingVolumes = createBoundingVolumes(sourceBoundingVolume, this.geoidHeightModel!);\n\n await this.nodePages.push({\n index: 0,\n lodThreshold: 0,\n obb: boundingVolumes.obb,\n children: []\n });\n\n const rootNode = await NodeIndexDocument.createRootNode(boundingVolumes, this);\n await traverseDatasetWith<TraversalConversionProps>(\n sourceRootTile,\n {\n transform: new Matrix4(sourceRootTile.transform),\n parentNodes: [rootNode]\n },\n this.convertTile.bind(this),\n this.finalizeTile.bind(this),\n this.options.maxDepth\n );\n\n this.layers0!.materialDefinitions = this.materialDefinitions;\n // @ts-ignore\n this.layers0.geometryDefinitions = transform(\n this.geometryConfigs.map((config) => ({\n geometryConfig: {...config, draco: this.options.draco}\n })),\n geometryDefinitionTemlate()\n );\n\n if (this.layersHasTexture === false) {\n this.layers0!.store.defaultGeometrySchema.ordering =\n this.layers0!.store.defaultGeometrySchema.ordering.filter(\n (attribute) => attribute !== 'uv0'\n );\n }\n\n await this._writeLayers0();\n createSceneServerPath(tilesetName, this.layers0!, tilesetPath);\n for (const filePath of this.compressList || []) {\n await compressFileWithGzip(filePath);\n await removeFile(filePath);\n }\n await this.nodePages.save();\n await this.writeQueue.finalize();\n await this._createSlpk(tilesetPath);\n }\n\n /**\n * Form object of 3DSceneLayer https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DSceneLayer.cmn.md\n * @param tilesetName - Name of layer\n * @param sourceBoundingVolume - initialized bounding volume of the source root tile\n * @param boundingVolumeRegion - region bounding volume of the source root tile\n */\n private _formLayers0(\n tilesetName: string,\n sourceBoundingVolume: OrientedBoundingBox | BoundingSphere,\n boundingVolumeRegion?: number[]\n ): void {\n if (!this.sourceTileset?.root) {\n return;\n }\n const fullExtent = convertBoundingVolumeToI3SFullExtent(sourceBoundingVolume);\n if (boundingVolumeRegion) {\n fullExtent.zmin = boundingVolumeRegion[4];\n fullExtent.zmax = boundingVolumeRegion[5];\n }\n const extent = [fullExtent.xmin, fullExtent.ymin, fullExtent.xmax, fullExtent.ymax];\n const layers0data = {\n version: `{${uuidv4().toUpperCase()}}`,\n id: 0,\n name: tilesetName,\n href: './layers/0',\n store: {\n id: `{${uuidv4().toUpperCase()}}`,\n extent\n },\n nodePages: {\n nodesPerPage: HARDCODED_NODES_PER_PAGE\n },\n compressGeometry: this.options.draco,\n fullExtent\n };\n this.layers0 = transform(layers0data, layersTemplate());\n }\n\n /**\n * Write 3DSceneLayer https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DSceneLayer.cmn.md in file\n */\n private async _writeLayers0(): Promise<void> {\n if (this.options.slpk) {\n await this.writeQueue.enqueue({\n archiveKey: '3dSceneLayer.json.gz',\n writePromise: () =>\n writeFileForSlpk(this.layers0Path, JSON.stringify(this.layers0), '3dSceneLayer.json')\n });\n } else {\n await this.writeQueue.enqueue({\n writePromise: () => writeFile(this.layers0Path, JSON.stringify(this.layers0))\n });\n }\n }\n\n /**\n * Pack files into *.slpk archive\n * @param tilesetPath - Path to save file\n */\n private async _createSlpk(tilesetPath: string): Promise<void> {\n if (this.options.slpk) {\n const slpkTilesetPath = join(tilesetPath, 'SceneServer', 'layers', '0');\n const slpkFileName = `${tilesetPath}.slpk`;\n await compressWithChildProcess(\n slpkTilesetPath,\n slpkFileName,\n 0,\n '.',\n this.options.sevenZipExe\n );\n\n // TODO: `addFileToZip` corrupts archive so it can't be validated with windows i3s_converter.exe\n // const fileHash128Path = `${tilesetPath}/@specialIndexFileHASH128@`;\n // try {\n // await generateHash128FromZip(slpkFileName, fileHash128Path);\n // await addFileToZip(\n // tilesetPath,\n // '@specialIndexFileHASH128@',\n // slpkFileName,\n // this.options.sevenZipExe\n // );\n // } catch (error) {\n // if (error.code === FS_FILE_TOO_LARGE) {\n // console.warn(`${slpkFileName} file is too big to generate a hash`); // eslint-disable-line\n // } else {\n // console.error(error); // eslint-disable-line\n // }\n // }\n // All converted files are contained in slpk now they can be deleted\n try {\n await removeDir(tilesetPath);\n } catch (e) {\n // do nothing\n }\n }\n }\n\n /**\n * Convert the specific 3DTiles tile to I3S nodes.\n * This is callback function for the traversal generic function\n * @param sourceTile - current 3DTiles tile JSON metadata\n * @param traversalProps - traversal properties calculated recursively\n * @returns - traversal properties for the child tiles\n */\n private async convertTile(\n sourceTile: Tiles3DTileJSONPostprocessed,\n traversalProps: TraversalConversionProps\n ): Promise<TraversalConversionProps> {\n if (sourceTile.type === 'json' || sourceTile.type === 'empty') {\n if (sourceTile.type === 'json') {\n if (sourceTile.id) {\n console.log(`[load]: ${sourceTile.id}`); // eslint-disable-line\n }\n await loadNestedTileset(this.sourceTileset, sourceTile, this.loadOptions);\n }\n return traversalProps;\n }\n if (sourceTile.id) {\n console.log(`[convert]: ${sourceTile.id}`); // eslint-disable-line\n }\n\n const {parentNodes, transform} = traversalProps;\n let transformationMatrix: Matrix4 = transform.clone();\n if (sourceTile.transform) {\n transformationMatrix = transformationMatrix.multiplyRight(sourceTile.transform);\n }\n const parentNode = parentNodes[0];\n const childNodes = await this._createNode(parentNode, sourceTile, transformationMatrix);\n await parentNode.addChildren(childNodes);\n\n const newTraversalProps: TraversalConversionProps = {\n transform: transformationMatrix,\n parentNodes: childNodes\n };\n return newTraversalProps;\n }\n\n /**\n * Do final action with nodes after the current node and all child nodes been converted.\n * @param conversionResults - array of conversion results of the current node\n * @param currentTraversalProps - traversal properties of the current node\n */\n private async finalizeTile(\n conversionResults: TraversalConversionProps[],\n currentTraversalProps: TraversalConversionProps\n ): Promise<void> {\n for (const result of conversionResults) {\n for (const node of result.parentNodes) {\n await node.addNeighbors();\n }\n }\n for (const node of currentTraversalProps.parentNodes) {\n await node.save();\n }\n }\n\n /**\n * Convert tile to one or more I3S nodes\n * @param parentNode - 3DNodeIndexDocument of parent node\n * @param sourceTile - source 3DTile data\n * @param transformationMatrix - transformation matrix of the current tile, calculated recursively multiplying\n * transform of all parent tiles and transform of the current tile\n * @param level - tree level\n */\n private async _createNode(\n parentNode: NodeIndexDocument,\n sourceTile: Tiles3DTileJSONPostprocessed,\n transformationMatrix: Matrix4\n ): Promise<NodeIndexDocument[]> {\n this._checkAddRefinementTypeForTile(sourceTile);\n\n await this._updateTilesetOptions();\n\n let tileContent: Tiles3DTileContent | null = null;\n try {\n tileContent = await loadTile3DContent(this.sourceTileset, sourceTile, this.loadOptions);\n } catch (error) {\n console.log(`[warning]: Failed to load ${sourceTile.contentUrl}`);\n }\n const sourceBoundingVolume = createBoundingVolume(\n sourceTile.boundingVolume,\n transformationMatrix,\n null\n );\n let boundingVolumes = createBoundingVolumes(sourceBoundingVolume, this.geoidHeightModel!);\n\n const propertyTable = getPropertyTable(tileContent);\n\n if (propertyTable && !this.layers0?.attributeStorageInfo?.length) {\n this._convertPropertyTableToNodeAttributes(propertyTable);\n }\n\n const resourcesData = await this._convertResources(\n sourceTile,\n transformationMatrix,\n sourceBoundingVolume,\n tileContent,\n parentNode.inPageId,\n propertyTable\n );\n\n const nodes: NodeIndexDocument[] = [];\n const nodeIds: number[] = [];\n const nodesInPage: NodeInPage[] = [];\n const emptyResources = {\n geometry: null,\n compressedGeometry: null,\n texture: null,\n hasUvRegions: false,\n sharedResources: null,\n meshMaterial: null,\n vertexCount: null,\n attributes: null,\n featureCount: null,\n boundingVolumes: null\n };\n\n for (const resources of resourcesData || [emptyResources]) {\n this.layersHasTexture = this.layersHasTexture || Boolean(resources.texture);\n\n if (this.generateBoundingVolumes && resources.boundingVolumes) {\n boundingVolumes = resources.boundingVolumes;\n }\n\n const lodSelection = convertGeometricErrorToScreenThreshold(sourceTile, boundingVolumes);\n const maxScreenThresholdSQ = lodSelection.find(\n (val) => val.metricType === 'maxScreenThresholdSQ'\n ) || {maxError: 0};\n\n const nodeInPage = await this._updateNodeInNodePages(\n maxScreenThresholdSQ,\n boundingVolumes,\n sourceTile,\n parentNode.inPageId,\n resources\n );\n\n const nodeData = await NodeIndexDocument.createNodeIndexDocument(\n parentNode,\n boundingVolumes,\n lodSelection,\n nodeInPage,\n resources\n );\n const node = await new NodeIndexDocument(nodeInPage.index, this).addData(nodeData);\n nodes.push(node);\n\n if (nodeInPage.mesh) {\n await this._writeResources(resources, node.id);\n }\n\n if (this.validate) {\n this.boundingVolumeWarnings = validateNodeBoundingVolumes(nodeData);\n\n if (this.boundingVolumeWarnings && this.boundingVolumeWarnings.length) {\n console.warn('Bounding Volume Warnings: ', ...this.boundingVolumeWarnings); //eslint-disable-line\n }\n }\n\n nodeIds.push(nodeInPage.index);\n nodesInPage.push(nodeInPage);\n }\n\n return nodes;\n }\n\n /**\n * Convert tile to one or more I3S nodes\n * @param sourceTile - source tile (3DTile)\n * @param transformationMatrix - transformation matrix of the current tile, calculated recursively multiplying\n * transform of all parent tiles and transform of the current tile\n * @param boundingVolume - initialized bounding volume of the source tile\n * @param tileContent - content of the source tile\n * @param parentId - id of parent node in node pages\n * @param propertyTable - batch table from b3dm / feature properties from EXT_FEATURE_METADATA\n * @returns - converted node resources\n */\n private async _convertResources(\n sourceTile: Tiles3DTileJSONPostprocessed,\n transformationMatrix: Matrix4,\n boundingVolume: OrientedBoundingBox | BoundingSphere,\n tileContent: Tiles3DTileContent | null,\n parentId: number,\n propertyTable: FeatureTableJson | null\n ): Promise<I3SConvertedResources[] | null> {\n if (!this.isContentSupported(sourceTile) || !tileContent) {\n return null;\n }\n const draftObb = {\n center: [],\n halfSize: [],\n quaternion: []\n };\n const resourcesData = await convertB3dmToI3sGeometry(\n tileContent,\n transformationMatrix,\n boundingVolume,\n async () => (await this.nodePages.push({index: 0, obb: draftObb}, parentId)).index,\n propertyTable,\n this.featuresHashArray,\n this.layers0?.attributeStorageInfo,\n this.options.draco,\n this.generateBoundingVolumes,\n this.options.mergeMaterials,\n this.geoidHeightModel!,\n this.loadOptions.modules as Record<string, string>\n );\n return resourcesData;\n }\n\n /**\n * Update node object (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/node.cmn.md)\n * in node pages (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/nodePage.cmn.md)\n * @param maxScreenThresholdSQ - Level of Details (LOD) metric\n * @param boundingVolumes - Bounding volumes\n * @param sourceTile - source tile (3DTile)\n * @param parentId - id of parent node in node pages\n * @param resources - the node resources data\n * @param resources.meshMaterial - PBR-like material object\n * @param resources.texture - texture image\n * @param resources.vertexCount - number of vertices in geometry\n * @param resources.featureCount - number of features\n * @param resources.geometry - Uint8Array with geometry attributes\n * @return the node object in node pages\n */\n private async _updateNodeInNodePages(\n maxScreenThresholdSQ: MaxScreenThresholdSQ,\n boundingVolumes: BoundingVolumes,\n sourceTile: Tiles3DTileJSONPostprocessed,\n parentId: number,\n resources: I3SConvertedResources\n ): Promise<NodeInPage> {\n const {meshMaterial, texture, vertexCount, featureCount, geometry, hasUvRegions} = resources;\n const nodeInPage: NodeInPage = {\n index: 0,\n lodThreshold: maxScreenThresholdSQ.maxError,\n obb: boundingVolumes.obb,\n children: []\n };\n if (geometry && this.isContentSupported(sourceTile)) {\n nodeInPage.mesh = {\n geometry: {\n definition: this.findOrCreateGeometryDefinition(Boolean(texture), hasUvRegions),\n resource: 0\n },\n attribute: {\n resource: 0\n },\n material: {\n definition: 0\n }\n };\n }\n\n let nodeId = resources.nodeId;\n let node: NodeInPage;\n if (!nodeId) {\n node = await this.nodePages.push(nodeInPage, parentId);\n } else {\n node = await this.nodePages.getNodeById(nodeId);\n }\n\n if (!nodeInPage.mesh) {\n console.log(`[warning]: node ${node.index} is created with empty content`);\n }\n\n NodePages.updateAll(node, nodeInPage);\n if (meshMaterial) {\n NodePages.updateMaterialByNodeId(node, this._findOrCreateMaterial(meshMaterial));\n }\n if (texture) {\n const texelCountHint = texture.image.height * texture.image.width;\n NodePages.updateTexelCountHintByNodeId(node, texelCountHint);\n }\n if (vertexCount) {\n this.vertexCounter += vertexCount;\n NodePages.updateVertexCountByNodeId(node, vertexCount);\n }\n NodePages.updateNodeAttributeByNodeId(node);\n if (featureCount) {\n NodePages.updateFeatureCountByNodeId(node, featureCount);\n }\n\n this.nodePages.saveNode(node);\n\n return node;\n }\n\n /**\n * Write node resources in files\n * @param resources - source tile (3DTile)\n * @param resources.geometry - Uint8Array with geometry attributes\n * @param resources.compressedGeometry - Uint8Array with compressed (draco) geometry\n * @param resources.texture - texture image\n * @param resources.sharedResources - shared resource data object\n * @param resources.attributes - feature attributes\n * @return {Promise<void>}\n */\n private async _writeResources(resources: I3SConvertedResources, nodePath: string): Promise<void> {\n const {\n geometry: geometryBuffer,\n compressedGeometry,\n texture,\n sharedResources,\n attributes\n } = resources;\n const childPath = join(this.layers0Path, 'nodes', nodePath);\n const slpkChildPath = join('nodes', nodePath);\n\n await this._writeGeometries(geometryBuffer!, compressedGeometry!, childPath, slpkChildPath);\n await this._writeShared(sharedResources, childPath, slpkChildPath, nodePath);\n await this._writeTexture(texture, childPath, slpkChildPath);\n await this._writeAttributes(attributes, childPath, slpkChildPath);\n }\n\n /**\n * Write non-compressed and compressed geometries in files\n * @param geometryBuffer - Uint8Array with geometry attributes\n * @param compressedGeometry - Uint8Array with compressed (draco) geometry\n * @param childPath - a child path to write resources\n * @param slpkChildPath - resource path inside *slpk file\n */\n private async _writeGeometries(\n geometryBuffer: ArrayBuffer,\n compressedGeometry: Promise<ArrayBuffer>,\n childPath: string,\n slpkChildPath: string\n ): Promise<void> {\n if (this.options.slpk) {\n const slpkGeometryPath = join(childPath, 'geometries');\n await this.writeQueue.enqueue({\n archiveKey: `${slpkChildPath}/geometries/0.bin.gz`,\n writePromise: () => writeFileForSlpk(slpkGeometryPath, geometryBuffer, '0.bin')\n });\n } else {\n const geometryPath = join(childPath, 'geometries/0/');\n await this.writeQueue.enqueue({\n writePromise: () => writeFile(geometryPath, geometryBuffer, 'index.bin')\n });\n }\n\n if (this.options.draco) {\n if (this.options.slpk) {\n const slpkCompressedGeometryPath = join(childPath, 'geometries');\n await this.writeQueue.enqueue({\n archiveKey: `${slpkChildPath}/geometries/1.bin.gz`,\n writePromise: () =>\n writeFileForSlpk(slpkCompressedGeometryPath, compressedGeometry, '1.bin')\n });\n } else {\n const compressedGeometryPath = join(childPath, 'geometries/1/');\n await this.writeQueue.enqueue({\n writePromise: () => writeFile(compressedGeometryPath, compressedGeometry, 'index.bin')\n });\n }\n }\n }\n\n /**\n * Write shared resources in a file\n * @param sharedResources - shared resource data object\n * @param childPath - a child path to write resources\n * @param slpkChildPath - resource path inside *slpk file\n * @param nodePath - a node path\n */\n private async _writeShared(\n sharedResources: SharedResourcesArrays | null,\n childPath: string,\n slpkChildPath: string,\n nodePath: string\n ): Promise<void> {\n if (!sharedResources) {\n return;\n }\n sharedResources.nodePath = nodePath;\n const sharedData = transform(sharedResources, sharedResourcesTemplate());\n const sharedDataStr = JSON.stringify(sharedData);\n if (this.options.slpk) {\n const slpkSharedPath = join(childPath, 'shared');\n await this.writeQueue.enqueue({\n archiveKey: `${slpkChildPath}/shared/sharedResource.json.gz`,\n writePromise: () => writeFileForSlpk(slpkSharedPath, sharedDataStr, 'sharedResource.json')\n });\n } else {\n const sharedPath = join(childPath, 'shared/');\n await this.writeQueue.enqueue({writePromise: () => writeFile(sharedPath, sharedDataStr)});\n }\n }\n\n /**\n * Generates textures based on texture mime type and fill in textureSetDefinitions data.\n * @param texture - the texture image\n * @param childPath - a child path to write resources\n * @param slpkChildPath - the resource path inside *slpk file\n */\n private async _writeTexture(\n texture: GLTFImagePostprocessed,\n childPath: string,\n slpkChildPath: string\n ): Promise<void> {\n if (texture) {\n const format = this._getFormatByMimeType(texture?.mimeType);\n const formats: TextureSetDefinitionFormats = [];\n const textureData = texture.bufferView!.data;\n\n switch (format) {\n case 'jpg':\n case 'png': {\n formats.push({name: '0', format});\n await this.writeTextureFile(textureData, '0', format, childPath, slpkChildPath);\n\n if (this.generateTextures) {\n formats.push({name: '1', format: 'ktx2'});\n // For Node.js texture.image.data is type of Buffer\n const copyArrayBuffer = texture.image.data.subarray();\n const arrayToEncode = new Uint8Array(copyArrayBuffer);\n const ktx2TextureData = encode(\n {...texture.image, data: arrayToEncode},\n KTX2BasisWriterWorker,\n {\n ...KTX2BasisWriterWorker.options,\n ['ktx2-basis-writer']: {\n // We need to load local fs workers because nodejs can't load workers from the Internet\n workerUrl: './modules/textures/dist/ktx2-basis-writer-worker-node.js'\n },\n reuseWorkers: true,\n _nodeWorkers: true,\n useLocalLibraries: true\n }\n );\n\n await this.writeTextureFile(ktx2TextureData, '1', 'ktx2', childPath, slpkChildPath);\n }\n\n break;\n }\n\n case 'ktx2': {\n formats.push({name: '1', format});\n await this.writeTextureFile(textureData, '1', format, childPath, slpkChildPath);\n\n if (this.generateTextures) {\n formats.push({name: '0', format: 'jpg'});\n const decodedFromKTX2TextureData = encode(texture.image!.data[0], ImageWriter);\n await this.writeTextureFile(\n decodedFromKTX2TextureData,\n '0',\n 'jpg',\n childPath,\n slpkChildPath\n );\n }\n }\n }\n\n if (!this.layers0!.textureSetDefinitions!.length) {\n this.layers0!.textureSetDefinitions!.push({formats});\n this.layers0!.textureSetDefinitions!.push({formats, atlas: true});\n }\n }\n }\n\n /**\n * Write the texture image in a file\n * @param textureData\n * @param name\n * @param format\n * @param childPath\n * @param slpkChildPath\n */\n private async writeTextureFile(\n textureData: Uint8Array | Promise<ArrayBuffer>,\n name: string,\n format: 'jpg' | 'png' | 'ktx2',\n childPath: string,\n slpkChildPath: string\n ): Promise<void> {\n if (this.options.slpk) {\n const slpkTexturePath = join(childPath, 'textures');\n const compress = false;\n\n await this.writeQueue.enqueue({\n archiveKey: `${slpkChildPath}/textures/${name}.${format}`,\n writePromise: () =>\n writeFileForSlpk(slpkTexturePath, textureData, `${name}.${format}`, compress)\n });\n } else {\n const texturePath = join(childPath, `textures/${name}/`);\n await this.writeQueue.enqueue({\n writePromise: () => writeFile(texturePath, textureData, `index.${format}`)\n });\n }\n }\n\n /**\n * Write feature attributes in files\n * @param attributes - feature attributes\n * @param childPath - a child path to write resources\n * @param slpkChildPath - the resource path inside *slpk file\n */\n private async _writeAttributes(\n attributes: ArrayBuffer[] | null = [],\n childPath: string,\n slpkChildPath: string\n ): Promise<void> {\n if (attributes?.length && this.layers0?.attributeStorageInfo?.length) {\n for (let index = 0; index < attributes.length; index++) {\n const folderName = this.layers0.attributeStorageInfo[index].key;\n const fileBuffer = new Uint8Array(attributes[index]);\n\n if (this.options.slpk) {\n const slpkAttributesPath = join(childPath, 'attributes', folderName);\n await this.writeQueue.enqueue({\n archiveKey: `${slpkChildPath}/attributes/${folderName}.bin.gz`,\n writePromise: () => writeFileForSlpk(slpkAttributesPath, fileBuffer, '0.bin')\n });\n } else {\n const attributesPath = join(childPath, `attributes/${folderName}/0`);\n await this.writeQueue.enqueue({\n writePromise: () => writeFile(attributesPath, fileBuffer, 'index.bin')\n });\n }\n }\n }\n }\n\n /**\n * Return file format by its MIME type\n * @param mimeType - feature attributes\n */\n private _getFormatByMimeType(mimeType: string | undefined): 'jpg' | 'png' | 'ktx2' {\n switch (mimeType) {\n case 'image/jpeg':\n return 'jpg';\n case 'image/png':\n return 'png';\n case 'image/ktx2':\n return 'ktx2';\n default:\n return 'jpg';\n }\n }\n\n /**\n * Find or create material in materialDefinitions array\n * @param material - end-to-end index of the node\n * @return material id\n */\n private _findOrCreateMaterial(material: I3SMaterialDefinition): number {\n const hash = md5(JSON.stringify(material));\n if (this.materialMap.has(hash)) {\n return this.materialMap.get(hash) || 0;\n }\n const newMaterialId = this.materialDefinitions.push(material) - 1;\n this.materialMap.set(hash, newMaterialId);\n return newMaterialId;\n }\n\n /**\n * Get unique geometry configuration index\n * In the end of conversion configurations will be transformed to geometryDefinitions array\n * @param hasTexture\n * @param hasUvRegions\n * @returns\n */\n private findOrCreateGeometryDefinition(hasTexture: boolean, hasUvRegions: boolean): number {\n const geometryConfig = {hasTexture, hasUvRegions};\n const hash = md5(JSON.stringify(geometryConfig));\n if (this.geometryMap.has(hash)) {\n return this.geometryMap.get(hash) || 0;\n }\n const newGeometryId = this.geometryConfigs.push(geometryConfig) - 1;\n this.geometryMap.set(hash, newGeometryId);\n return newGeometryId;\n }\n\n /**\n * Do conversion of 3DTiles property table to I3s node attributes.\n * @param propertyTable - Table with layer meta data.\n */\n private _convertPropertyTableToNodeAttributes(propertyTable: FeatureTableJson): void {\n let attributeIndex = 0;\n const propertyTableWithObjectId = {\n OBJECTID: [0],\n ...propertyTable\n };\n\n for (const key in propertyTableWithObjectId) {\n const firstAttribute = propertyTableWithObjectId[key][0];\n const attributeType = getAttributeType(key, firstAttribute);\n\n const storageAttribute = createdStorageAttribute(attributeIndex, key, attributeType);\n const fieldAttributeType = getFieldAttributeType(attributeType);\n const fieldAttribute = createFieldAttribute(key, fieldAttributeType);\n const popupInfo = createPopupInfo(propertyTableWithObjectId);\n\n this.layers0!.attributeStorageInfo!.push(storageAttribute);\n this.layers0!.fields!.push(fieldAttribute);\n this.layers0!.popupInfo = popupInfo;\n this.layers0!.layerType = _3D_OBJECT_LAYER_TYPE;\n\n attributeIndex += 1;\n }\n }\n\n /**\n * Print statistics in the end of conversion\n * @param params - output files data\n */\n private async _finishConversion(params: {\n slpk: boolean;\n outputPath: string;\n tilesetName: string;\n }): Promise<void> {\n const {tilesCount, tilesWithAddRefineCount} = this.refinementCounter;\n const addRefinementPercentage = tilesWithAddRefineCount\n ? (tilesWithAddRefineCount / tilesCount) * 100\n : 0;\n const filesSize = await calculateFilesSize(params);\n const diff = process.hrtime(this.conversionStartTime);\n const conversionTime = timeConverter(diff);\n console.log(`------------------------------------------------`); // eslint-disable-line no-undef, no-console\n console.log(`Finishing conversion of ${_3D_TILES}`); // eslint-disable-line no-undef, no-console\n console.log(`Total conversion time: ${conversionTime}`); // eslint-disable-line no-undef, no-console\n console.log(`Vertex count: `, this.vertexCounter); // eslint-disable-line no-undef, no-console\n console.log(`File(s) size: `, filesSize, ' bytes'); // eslint-disable-line no-undef, no-console\n console.log(`Percentage of tiles with \"ADD\" refinement type:`, addRefinementPercentage, '%'); // eslint-disable-line no-undef, no-console\n console.log(`------------------------------------------------`); // eslint-disable-line no-undef, no-console\n }\n\n /**\n * Fetch preload options for ION tileset\n */\n private async _fetchPreloadOptions(): Promise<any> {\n if (!this.Loader.preload) {\n return {};\n }\n const options = {\n 'cesium-ion': {accessToken: this.options.token || ION_DEFAULT_TOKEN}\n };\n const preloadOptions = await this.Loader.preload(this.options.inputUrl, options);\n this.refreshTokenTime = process.hrtime();\n return {...options, ...preloadOptions};\n }\n\n /**\n * Update options of source tileset\n */\n private async _updateTilesetOptions(): Promise<void> {\n const diff = process.hrtime(this.refreshTokenTime);\n if (diff[0] < REFRESH_TOKEN_TIMEOUT) {\n return;\n }\n this.refreshTokenTime = process.hrtime();\n\n const preloadOptions = await this._fetchPreloadOptions();\n if (preloadOptions.headers) {\n this.loadOptions.fetch = {\n ...this.loadOptions.fetch,\n headers: preloadOptions.headers\n };\n console.log('Authorization Bearer token has been updated'); // eslint-disable-line no-undef, no-console\n }\n }\n\n /** Do calculations of all tiles and tiles with \"ADD\" type of refinement.\n * @param tile\n */\n private _checkAddRefinementTypeForTile(tile: Tiles3DTileJSONPostprocessed): void {\n const ADD_TILE_REFINEMENT = 1;\n\n if (tile.refine === ADD_TILE_REFINEMENT) {\n this.refinementCounter.tilesWithAddRefineCount += 1;\n console.warn('This tile uses \"ADD\" type of refinement'); // eslint-disable-line\n }\n\n this.refinementCounter.tilesCount += 1;\n }\n\n /**\n * Check if the tile's content format is supported by the converter\n * @param sourceTile\n * @returns\n */\n private isContentSupported(sourceTile: Tiles3DTileJSONPostprocessed): boolean {\n return ['b3dm', 'glTF', 'scenegraph'].includes(sourceTile.type || '');\n }\n}\n"],"mappings":";;AAgBA,SAAQA,IAAI,EAAEC,MAAM,EAAEC,SAAS,QAAO,kBAAkB;AACxD,SAAQC,eAAe,EAAEC,aAAa,QAAO,sBAAsB;AAEnE,SAAQC,IAAI,QAAO,MAAM;AACzB,SAAQC,EAAE,IAAIC,MAAM,QAAO,MAAM;AACjC,OAAOC,OAAO,MAAM,SAAS;AAC7B,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,GAAG,MAAM,KAAK;AAErB,OAAOC,SAAS,MAAM,sBAAsB;AAC5C,SAAQC,SAAS,EAAEC,SAAS,EAAEC,gBAAgB,EAAEC,UAAU,QAAO,yBAAyB;AAC1F,SACEC,oBAAoB,EACpBC,wBAAwB,QAGnB,4BAA4B;AACnC,SAAQC,kBAAkB,EAAEC,aAAa,QAAO,+BAA+B;AAC/E,OAAOC,wBAAwB,IAA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E,uBAAuB,IAAI,CAAC;MACnDO,OAAO,CAACsK,IAAI,CAAC,yCAAyC,CAAC;IACzD;IAEA,IAAI,CAAC/K,iBAAiB,CAACC,UAAU,IAAI,CAAC;EACxC;EAOQiL,kBAAkBA,CAACxH,UAAwC,EAAW;IAC5E,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAACqN,QAAQ,CAACrN,UAAU,CAACE,IAAI,IAAI,EAAE,CAAC;EACvE;AACF"}
@@ -1,5 +1,5 @@
1
1
  import { parsePGM } from '@math.gl/geoid';
2
- const VERSION = typeof "4.0.0-alpha.18" !== 'undefined' ? "4.0.0-alpha.18" : 'latest';
2
+ const VERSION = typeof "4.0.0-alpha.19" !== 'undefined' ? "4.0.0-alpha.19" : 'latest';
3
3
  export const PGMLoader = {
4
4
  name: 'PGM - Netpbm grayscale image format',
5
5
  id: 'pgm',
@@ -20,12 +20,10 @@ import { BoundingSphere, OrientedBoundingBox } from '@math.gl/culling';
20
20
  * @param generateBoundingVolumes - is converter should create accurate bounding voulmes from geometry attributes
21
21
  * @param shouldMergeMaterials - Try to merge similar materials to be able to merge meshes into one node
22
22
  * @param geoidHeightModel - model to convert elevation from elipsoidal to geoid
23
- * @param workerSource - source code of used workers
23
+ * @param libraries - dynamicaly loaded 3rd-party libraries
24
24
  * @returns Array of node resources to create one or more i3s nodes
25
25
  */
26
- export default function convertB3dmToI3sGeometry(tileContent: Tiles3DTileContent, tileTransform: Matrix4, tileBoundingVolume: OrientedBoundingBox | BoundingSphere, addNodeToNodePage: () => Promise<number>, propertyTable: FeatureTableJson | null, featuresHashArray: string[], attributeStorageInfo: AttributeStorageInfo[] | undefined, draco: boolean, generateBoundingVolumes: boolean, shouldMergeMaterials: boolean, geoidHeightModel: Geoid, workerSource: {
27
- [key: string]: string;
28
- }): Promise<I3SConvertedResources[] | null>;
26
+ export default function convertB3dmToI3sGeometry(tileContent: Tiles3DTileContent, tileTransform: Matrix4, tileBoundingVolume: OrientedBoundingBox | BoundingSphere, addNodeToNodePage: () => Promise<number>, propertyTable: FeatureTableJson | null, featuresHashArray: string[], attributeStorageInfo: AttributeStorageInfo[] | undefined, draco: boolean, generateBoundingVolumes: boolean, shouldMergeMaterials: boolean, geoidHeightModel: Geoid, libraries: Record<string, string>): Promise<I3SConvertedResources[] | null>;
29
27
  /**
30
28
  * Convert attributes from the gltf nodes tree to i3s plain geometry
31
29
  * @param attributesData - geometry attributes from gltf
@@ -1 +1 @@
1
- {"version":3,"file":"geometry-converter.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/geometry-converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAW/E,OAAO,EAAU,OAAO,EAAU,MAAM,eAAe,CAAC;AAUxD,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EAGvB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,oBAAoB,EAIrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAWrC,OAAO,KAAK,EAAC,kBAAkB,EAAgD,MAAM,UAAU,CAAC;AAEhG,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AA0BrE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAA8B,wBAAwB,CACpD,WAAW,EAAE,kBAAkB,EAC/B,aAAa,EAAE,OAAO,EACtB,kBAAkB,EAAE,mBAAmB,GAAG,cAAc,EACxD,iBAAiB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EACxC,aAAa,EAAE,gBAAgB,GAAG,IAAI,EACtC,iBAAiB,EAAE,MAAM,EAAE,EAC3B,oBAAoB,EAAE,oBAAoB,EAAE,GAAG,SAAS,EACxD,KAAK,EAAE,OAAO,EACd,uBAAuB,EAAE,OAAO,EAChC,oBAAoB,EAAE,OAAO,EAC7B,gBAAgB,EAAE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iB,EAAE,MAAM,EAAE,EAC3B,oBAAoB,EAAE,oBAAoB,EAAE,GAAG,SAAS,EACxD,KAAK,EAAE,OAAO,EACd,uBAAuB,EAAE,OAAO,EAChC,oBAAoB,EAAE,OAAO,EAC7B,gBAAgB,EAAE,KAAK,EACvB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,OAAO,CAAC,qBAAqB,EAAE,GAAG,IAAI,CAAC,CA8DzC;AA6ID;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,cAAc,EAAE,kBAAkB,EAClC,sBAAsB,EAAE,sBAAsB,EAAE,EAChD,qBAAqB,EAAE,OAAO,GAC7B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAgD3C;AAiqCD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,kBAAkB,GAAG,IAAI,GAAG,gBAAgB,GAAG,IAAI,CAwBhG"}
@@ -75,10 +75,10 @@ let scratchVector = new core_1.Vector3();
75
75
  * @param generateBoundingVolumes - is converter should create accurate bounding voulmes from geometry attributes
76
76
  * @param shouldMergeMaterials - Try to merge similar materials to be able to merge meshes into one node
77
77
  * @param geoidHeightModel - model to convert elevation from elipsoidal to geoid
78
- * @param workerSource - source code of used workers
78
+ * @param libraries - dynamicaly loaded 3rd-party libraries
79
79
  * @returns Array of node resources to create one or more i3s nodes
80
80
  */
81
- async function convertB3dmToI3sGeometry(tileContent, tileTransform, tileBoundingVolume, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, shouldMergeMaterials, geoidHeightModel, workerSource) {
81
+ async function convertB3dmToI3sGeometry(tileContent, tileTransform, tileBoundingVolume, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, shouldMergeMaterials, geoidHeightModel, libraries) {
82
82
  const useCartesianPositions = generateBoundingVolumes;
83
83
  const materialAndTextureList = await convertMaterials(tileContent.gltf?.materials, shouldMergeMaterials);
84
84
  const dataForAttributesConversion = (0, gltf_attributes_1.prepareDataForAttributesConversion)(tileContent, tileTransform, tileBoundingVolume);
@@ -116,7 +116,7 @@ async function convertB3dmToI3sGeometry(tileContent, tileTransform, tileBounding
116
116
  propertyTable,
117
117
  attributeStorageInfo,
118
118
  draco,
119
- workerSource
119
+ libraries
120
120
  }));
121
121
  }
122
122
  if (!result.length) {
@@ -157,10 +157,10 @@ function _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeigh
157
157
  * @param params.propertyTable - batch table (corresponding to feature attributes data)
158
158
  * @param params.attributeStorageInfo - attributes metadata from 3DSceneLayer json
159
159
  * @param params.draco - is converter should create draco compressed geometry
160
- * @param params.workerSource - source code of used workers
160
+ * @param libraries - dynamicaly loaded 3rd-party libraries
161
161
  * @returns Array of I3S node resources
162
162
  */
163
- async function _makeNodeResources({ convertedAttributes, material, texture, tileContent, nodeId, featuresHashArray, propertyTable, attributeStorageInfo, draco, workerSource }) {
163
+ async function _makeNodeResources({ convertedAttributes, material, texture, tileContent, nodeId, featuresHashArray, propertyTable, attributeStorageInfo, draco, libraries }) {
164
164
  const boundingVolumes = convertedAttributes.boundingVolumes;
165
165
  const vertexCount = convertedAttributes.positions.length / VALUES_PER_VERTEX;
166
166
  const { faceRange, featureIds, positions, normals, colors, uvRegions, texCoords, featureCount } = (0, geometry_attributes_1.generateAttributes)(convertedAttributes);
@@ -180,7 +180,7 @@ async function _makeNodeResources({ convertedAttributes, material, texture, tile
180
180
  uvRegions,
181
181
  featureIds,
182
182
  faceRange
183
- }, workerSource.draco)
183
+ }, libraries)
184
184
  : null;
185
185
  let attributes = [];
186
186
  if (attributeStorageInfo && propertyTable) {
@@ -1069,13 +1069,13 @@ function generateBigUint64Array(featureIds) {
1069
1069
  }
1070
1070
  /**
1071
1071
  * Generates draco compressed geometry
1072
- * @param {Number} vertexCount
1073
- * @param {Object} convertedAttributes - get rid of this argument here
1074
- * @param {Object} attributes - geometry attributes to compress
1075
- * @param {string} dracoWorkerSoure - draco worker source code
1076
- * @returns {Promise<object>} - COmpressed geometry.
1072
+ * @param vertexCount
1073
+ * @param convertedAttributes - get rid of this argument here
1074
+ * @param attributes - geometry attributes to compress
1075
+ * @param libraries - dynamicaly loaded 3rd-party libraries
1076
+ * @returns - Compressed geometry.
1077
1077
  */
1078
- async function generateCompressedGeometry(vertexCount, convertedAttributes, attributes, dracoWorkerSoure) {
1078
+ async function generateCompressedGeometry(vertexCount, convertedAttributes, attributes, libraries) {
1079
1079
  const { positions, normals, texCoords, colors, uvRegions, featureIds, faceRange } = attributes;
1080
1080
  const indices = new Uint32Array(vertexCount);
1081
1081
  for (let index = 0; index < indices.length; index++) {
@@ -1106,12 +1106,17 @@ async function generateCompressedGeometry(vertexCount, convertedAttributes, attr
1106
1106
  }
1107
1107
  return (0, core_2.encode)({ attributes: compressedAttributes, indices }, draco_1.DracoWriterWorker, {
1108
1108
  ...draco_1.DracoWriterWorker.options,
1109
- source: dracoWorkerSoure,
1110
1109
  reuseWorkers: true,
1111
1110
  _nodeWorkers: true,
1111
+ modules: libraries,
1112
+ useLocalLibraries: true,
1112
1113
  draco: {
1113
1114
  method: 'MESH_SEQUENTIAL_ENCODING',
1114
1115
  attributesMetadata
1116
+ },
1117
+ ['draco-writer']: {
1118
+ // We need to load local fs workers because nodejs can't load workers from the Internet
1119
+ workerUrl: './modules/draco/dist/draco-writer-worker-node.js'
1115
1120
  }
1116
1121
  });
1117
1122
  }
@@ -262,6 +262,5 @@ export default class I3SConverter {
262
262
  * @returns
263
263
  */
264
264
  private isContentSupported;
265
- private loadWorkers;
266
265
  }
267
266
  //# sourceMappingURL=i3s-converter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"i3s-converter.d.ts","sourceRoot":"","sources":["../../src/i3s-converter/i3s-converter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,oBAAoB,EAGpB,+BAA+B,EAChC,MAAM,sBAAsB,CAAC;AAC9B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