@loaders.gl/tile-converter 4.0.0-alpha.13 → 4.0.0-alpha.15

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 (142) hide show
  1. package/bin/i3s-server.js +4 -0
  2. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +0 -1
  3. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
  4. package/dist/3d-tiles-converter/3d-tiles-converter.js +8 -19
  5. package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +4 -1
  6. package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
  7. package/dist/converter.min.js +65 -65
  8. package/dist/dist.min.js +881 -261
  9. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +34 -67
  10. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  11. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  12. package/dist/es5/deps-installer/deps-installer.js +1 -1
  13. package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
  14. package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
  15. package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  16. package/dist/es5/i3s-converter/i3s-converter.js +36 -43
  17. package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
  18. package/dist/es5/i3s-converter/types.js.map +1 -1
  19. package/dist/es5/i3s-server/README.md +46 -2
  20. package/dist/es5/i3s-server/app.js +3 -3
  21. package/dist/es5/i3s-server/app.js.map +1 -1
  22. package/dist/es5/i3s-server/bin/www.js +61 -0
  23. package/dist/es5/i3s-server/bin/www.js.map +1 -0
  24. package/dist/es5/i3s-server/controllers/slpk-controller.js +14 -18
  25. package/dist/es5/i3s-server/controllers/slpk-controller.js.map +1 -1
  26. package/dist/es5/index.js +7 -0
  27. package/dist/es5/index.js.map +1 -1
  28. package/dist/es5/pgm-loader.js +1 -1
  29. package/dist/es5/slpk-extractor/helpers/file-handle-provider.js +59 -26
  30. package/dist/es5/slpk-extractor/helpers/file-handle-provider.js.map +1 -1
  31. package/dist/es5/slpk-extractor/helpers/fs-promises.js +77 -0
  32. package/dist/es5/slpk-extractor/helpers/fs-promises.js.map +1 -0
  33. package/dist/es5/slpk-extractor/slpk-extractor.js +7 -7
  34. package/dist/es5/slpk-extractor/slpk-extractor.js.map +1 -1
  35. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +8 -18
  36. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  37. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  38. package/dist/esm/deps-installer/deps-installer.js +1 -1
  39. package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
  40. package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
  41. package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  42. package/dist/esm/i3s-converter/i3s-converter.js +5 -8
  43. package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
  44. package/dist/esm/i3s-converter/types.js.map +1 -1
  45. package/dist/esm/i3s-server/README.md +46 -2
  46. package/dist/esm/i3s-server/app.js +4 -4
  47. package/dist/esm/i3s-server/app.js.map +1 -1
  48. package/dist/esm/i3s-server/bin/i3s-server.min.js +614 -0
  49. package/{src/i3s-server/bin/www → dist/esm/i3s-server/bin/www.js} +12 -55
  50. package/dist/esm/i3s-server/bin/www.js.map +1 -0
  51. package/dist/esm/i3s-server/controllers/slpk-controller.js +6 -12
  52. package/dist/esm/i3s-server/controllers/slpk-controller.js.map +1 -1
  53. package/dist/esm/index.js +1 -0
  54. package/dist/esm/index.js.map +1 -1
  55. package/dist/esm/pgm-loader.js +1 -1
  56. package/dist/esm/slpk-extractor/helpers/file-handle-provider.js +17 -6
  57. package/dist/esm/slpk-extractor/helpers/file-handle-provider.js.map +1 -1
  58. package/dist/esm/slpk-extractor/helpers/fs-promises.js +32 -0
  59. package/dist/esm/slpk-extractor/helpers/fs-promises.js.map +1 -0
  60. package/dist/esm/slpk-extractor/slpk-extractor.js +2 -2
  61. package/dist/esm/slpk-extractor/slpk-extractor.js.map +1 -1
  62. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +1 -1
  63. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
  64. package/dist/i3s-converter/helpers/geometry-converter.d.ts +2 -3
  65. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
  66. package/dist/i3s-converter/helpers/gltf-attributes.d.ts +2 -2
  67. package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
  68. package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
  69. package/dist/i3s-converter/i3s-converter.js +5 -6
  70. package/dist/i3s-converter/types.d.ts +32 -1
  71. package/dist/i3s-converter/types.d.ts.map +1 -1
  72. package/dist/i3s-server/app.d.ts.map +1 -1
  73. package/dist/i3s-server/app.js +1 -1
  74. package/dist/i3s-server/bin/www.d.ts +3 -0
  75. package/dist/i3s-server/bin/www.d.ts.map +1 -0
  76. package/dist/i3s-server/bin/www.js +83 -0
  77. package/dist/i3s-server/controllers/slpk-controller.d.ts.map +1 -1
  78. package/dist/i3s-server/controllers/slpk-controller.js +4 -9
  79. package/dist/index.d.ts +1 -0
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +3 -1
  82. package/dist/slpk-extractor/helpers/file-handle-provider.d.ts +15 -12
  83. package/dist/slpk-extractor/helpers/file-handle-provider.d.ts.map +1 -1
  84. package/dist/slpk-extractor/helpers/file-handle-provider.js +25 -10
  85. package/dist/slpk-extractor/helpers/fs-promises.d.ts +38 -0
  86. package/dist/slpk-extractor/helpers/fs-promises.d.ts.map +1 -0
  87. package/dist/slpk-extractor/helpers/fs-promises.js +51 -0
  88. package/dist/slpk-extractor/slpk-extractor.d.ts +2 -2
  89. package/dist/slpk-extractor/slpk-extractor.d.ts.map +1 -1
  90. package/dist/slpk-extractor/slpk-extractor.js +4 -7
  91. package/dist/slpk-extractor.min.js +44 -44
  92. package/package.json +20 -21
  93. package/src/3d-tiles-converter/3d-tiles-converter.ts +10 -28
  94. package/src/3d-tiles-converter/helpers/b3dm-converter.ts +5 -2
  95. package/src/i3s-converter/helpers/batch-ids-extensions.ts +1 -1
  96. package/src/i3s-converter/helpers/geometry-converter.ts +2 -7
  97. package/src/i3s-converter/helpers/gltf-attributes.ts +2 -2
  98. package/src/i3s-converter/i3s-converter.ts +5 -6
  99. package/src/i3s-converter/types.ts +32 -1
  100. package/src/i3s-server/README.md +46 -2
  101. package/src/i3s-server/app.js +1 -1
  102. package/{dist/es5/i3s-server/bin/www → src/i3s-server/bin/www.js} +7 -7
  103. package/src/i3s-server/controllers/slpk-controller.js +4 -11
  104. package/src/index.ts +1 -0
  105. package/src/slpk-extractor/helpers/file-handle-provider.ts +36 -18
  106. package/src/slpk-extractor/helpers/fs-promises.ts +66 -0
  107. package/src/slpk-extractor/slpk-extractor.ts +5 -6
  108. package/dist/3d-tiles-attributes-worker.d.ts +0 -28
  109. package/dist/3d-tiles-attributes-worker.d.ts.map +0 -1
  110. package/dist/3d-tiles-attributes-worker.js +0 -3
  111. package/dist/3d-tiles-attributes-worker.js.map +0 -7
  112. package/dist/es5/3d-tiles-attributes-worker.js +0 -25
  113. package/dist/es5/3d-tiles-attributes-worker.js.map +0 -1
  114. package/dist/es5/i3s-attributes-worker.js +0 -25
  115. package/dist/es5/i3s-attributes-worker.js.map +0 -1
  116. package/dist/es5/workers/3d-tiles-attributes-worker.js +0 -28
  117. package/dist/es5/workers/3d-tiles-attributes-worker.js.map +0 -1
  118. package/dist/es5/workers/i3s-attributes-worker.js +0 -30
  119. package/dist/es5/workers/i3s-attributes-worker.js.map +0 -1
  120. package/dist/esm/3d-tiles-attributes-worker.js +0 -16
  121. package/dist/esm/3d-tiles-attributes-worker.js.map +0 -1
  122. package/dist/esm/i3s-attributes-worker.js +0 -16
  123. package/dist/esm/i3s-attributes-worker.js.map +0 -1
  124. package/dist/esm/i3s-server/bin/www +0 -102
  125. package/dist/esm/workers/3d-tiles-attributes-worker.js +0 -8
  126. package/dist/esm/workers/3d-tiles-attributes-worker.js.map +0 -1
  127. package/dist/esm/workers/i3s-attributes-worker.js +0 -7
  128. package/dist/esm/workers/i3s-attributes-worker.js.map +0 -1
  129. package/dist/i3s-attributes-worker.d.ts +0 -45
  130. package/dist/i3s-attributes-worker.d.ts.map +0 -1
  131. package/dist/i3s-attributes-worker.js +0 -9
  132. package/dist/i3s-attributes-worker.js.map +0 -7
  133. package/dist/workers/3d-tiles-attributes-worker.d.ts +0 -2
  134. package/dist/workers/3d-tiles-attributes-worker.d.ts.map +0 -1
  135. package/dist/workers/3d-tiles-attributes-worker.js +0 -9
  136. package/dist/workers/i3s-attributes-worker.d.ts +0 -2
  137. package/dist/workers/i3s-attributes-worker.d.ts.map +0 -1
  138. package/dist/workers/i3s-attributes-worker.js +0 -5
  139. package/src/3d-tiles-attributes-worker.ts +0 -43
  140. package/src/i3s-attributes-worker.ts +0 -59
  141. package/src/workers/3d-tiles-attributes-worker.ts +0 -6
  142. package/src/workers/i3s-attributes-worker.ts +0 -7
@@ -1 +1 @@
1
- {"version":3,"file":"gltf-attributes.js","names":["_core","require","_geospatial","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","prepareDataForAttributesConversion","tileContent","tileTransform","boundingVolume","_tileContent$gltf","_tileContent$gltf$sce","_tileContent$gltf2","_tileContent$gltf2$sc","_tileContent$gltf2$sc2","_tileContent$gltf3","_tileContent$gltf4","_tileContent$gltf4$im","nodes","gltf","scene","scenes","images","map","imageObject","_imageObject$image","image","compressed","_imageObject$image2","data","dataCopy","Uint8Array","set","height","width","components","mimeType","prepareNodes","_calculateTransformPr","calculateTransformProps","cartographicOrigin","cartesianModelMatrix","modelMatrix","getB3DMAttributesWithoutBufferView","attributes","attributesWithoutBufferView","attributeName","value","rtcCenter","gltfUpAxis","center","Matrix4","translate","rotationY","rotateX","Math","PI","multiplyRight","rotationX","rotateY","cartesianOrigin","Vector3","Ellipsoid","WGS84","cartesianToCartographic","index","node","mesh","_node$mesh","primitives","primitive","_primitive$indices","_primitive$material","_primitive$material2","indices","material","id","uniqueId","children"],"sources":["../../../../src/i3s-converter/helpers/gltf-attributes.ts"],"sourcesContent":["import type {Tiles3DTileContent} from '@loaders.gl/3d-tiles';\nimport type {GLTFAccessorPostprocessed, GLTFNodePostprocessed} from '@loaders.gl/gltf';\nimport type {B3DMAttributesData} from '../../i3s-attributes-worker';\nimport {Matrix4, TypedArray, Vector3} from '@math.gl/core';\nimport {BoundingSphere, OrientedBoundingBox} from '@math.gl/culling';\nimport {Ellipsoid} from '@math.gl/geospatial';\n\n/**\n * Prepare attributes for conversion to avoid binary data breaking in worker thread.\n * @param tileContent - 3DTiles tile content\n * @param tileTransform - transformation matrix of the 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 * @returns 3DTiles content data, prepared for conversion\n */\nexport function prepareDataForAttributesConversion(\n tileContent: Tiles3DTileContent,\n tileTransform: Matrix4,\n boundingVolume: OrientedBoundingBox | BoundingSphere\n): B3DMAttributesData {\n let nodes =\n tileContent.gltf?.scene?.nodes ||\n tileContent.gltf?.scenes?.[0]?.nodes ||\n tileContent.gltf?.nodes ||\n [];\n\n const images =\n tileContent.gltf?.images?.map((imageObject) => {\n // Need data only for uncompressed images because we can't get batchIds from compressed textures.\n if (imageObject?.image?.compressed) {\n return null;\n } else {\n const data = imageObject?.image?.data;\n const dataCopy = new Uint8Array(data.length);\n dataCopy.set(data);\n return {\n data: dataCopy,\n compressed: false,\n height: imageObject.image.height,\n width: imageObject.image.width,\n components: imageObject.image.components,\n mimeType: imageObject.mimeType\n };\n }\n }) || [];\n\n prepareNodes(nodes);\n\n const {cartographicOrigin, modelMatrix: cartesianModelMatrix} = calculateTransformProps(\n tileContent,\n tileTransform,\n boundingVolume\n );\n\n return {\n nodes,\n images,\n cartographicOrigin,\n cartesianModelMatrix\n };\n}\n\n/**\n * Keep only values for glTF attributes to pass data to worker thread.\n * @param attributes - geometry attributes\n * @returns attributes with only `value` item\n */\nfunction getB3DMAttributesWithoutBufferView(\n attributes: Record<string, GLTFAccessorPostprocessed>\n): Record<string, {value: TypedArray}> {\n const attributesWithoutBufferView: Record<string, {value: TypedArray}> = {};\n\n for (const attributeName in attributes) {\n attributesWithoutBufferView[attributeName] = {\n value: attributes[attributeName].value\n };\n }\n\n return attributesWithoutBufferView;\n}\n\n/**\n * Calculate transformation properties to transform vertex attributes (POSITION, NORMAL, etc.)\n * from METER_OFFSET coorditantes to LNGLAT_OFFSET coordinates\n * @param tileContent - 3DTiles tile content\n * @param tileTransform - transformation matrix of the 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 * @returns modelMatrix - transformation matrix to transform coordinates to cartographic coordinates\n * cartographicOrigin - tile origin coordinates to calculate offsets\n */\nexport function calculateTransformProps(\n tileContent: Tiles3DTileContent,\n tileTransform: Matrix4,\n boundingVolume: OrientedBoundingBox | BoundingSphere\n): {modelMatrix: Matrix4; cartographicOrigin: Vector3} {\n const {rtcCenter, gltfUpAxis} = tileContent;\n const {center} = boundingVolume;\n\n let modelMatrix = new Matrix4(tileTransform);\n\n // Translate if appropriate\n if (rtcCenter) {\n modelMatrix.translate(rtcCenter);\n }\n\n // glTF models need to be rotated from Y to Z up\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up\n switch (gltfUpAxis) {\n case 'Z':\n break;\n case 'Y':\n const rotationY = new Matrix4().rotateX(Math.PI / 2);\n modelMatrix = modelMatrix.multiplyRight(rotationY);\n break;\n case 'X':\n const rotationX = new Matrix4().rotateY(-Math.PI / 2);\n modelMatrix = modelMatrix.multiplyRight(rotationX);\n break;\n default:\n break;\n }\n\n const cartesianOrigin = new Vector3(center);\n const cartographicOrigin = Ellipsoid.WGS84.cartesianToCartographic(\n cartesianOrigin,\n new Vector3()\n );\n return {modelMatrix, cartographicOrigin};\n}\n\n/**\n * Traverse all nodes to replace all sensible data with copy to avoid data corruption in worker.\n * @param nodes\n */\nfunction prepareNodes(nodes: GLTFNodePostprocessed[]): void {\n for (let index = 0; index < nodes.length; index++) {\n const node = nodes[index] as any;\n\n if (node.mesh) {\n nodes[index] = {\n ...node,\n mesh: {\n ...node.mesh,\n primitives: node.mesh?.primitives.map((primitive) => ({\n ...primitive,\n indices: {value: primitive?.indices?.value},\n attributes: getB3DMAttributesWithoutBufferView(primitive.attributes),\n material: {\n id: primitive?.material?.id,\n uniqueId: primitive?.material?.uniqueId\n }\n }))\n }\n };\n }\n\n if (node.children) {\n prepareNodes(node.children);\n }\n }\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAA8C,SAAAE,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OA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,IAAI,CAACY,QAAQ,CAAC;IAC7B;EACF;AACF"}
1
+ {"version":3,"file":"gltf-attributes.js","names":["_core","require","_geospatial","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","prepareDataForAttributesConversion","tileContent","tileTransform","boundingVolume","_tileContent$gltf","_tileContent$gltf$sce","_tileContent$gltf2","_tileContent$gltf2$sc","_tileContent$gltf2$sc2","_tileContent$gltf3","_tileContent$gltf4","_tileContent$gltf4$im","nodes","gltf","scene","scenes","images","map","imageObject","_imageObject$image","image","compressed","_imageObject$image2","data","dataCopy","Uint8Array","set","height","width","components","mimeType","prepareNodes","_calculateTransformPr","calculateTransformProps","cartographicOrigin","cartesianModelMatrix","modelMatrix","getB3DMAttributesWithoutBufferView","attributes","attributesWithoutBufferView","attributeName","value","rtcCenter","gltfUpAxis","center","Matrix4","translate","rotationY","rotateX","Math","PI","multiplyRight","rotationX","rotateY","cartesianOrigin","Vector3","Ellipsoid","WGS84","cartesianToCartographic","index","node","mesh","_node$mesh","primitives","primitive","_primitive$indices","_primitive$material","_primitive$material2","indices","material","id","uniqueId","children"],"sources":["../../../../src/i3s-converter/helpers/gltf-attributes.ts"],"sourcesContent":["import type {Tiles3DTileContent} from '@loaders.gl/3d-tiles';\nimport type {GLTFAccessorPostprocessed, GLTFNodePostprocessed} from '@loaders.gl/gltf';\nimport {Matrix4, TypedArray, Vector3} from '@math.gl/core';\nimport {BoundingSphere, OrientedBoundingBox} from '@math.gl/culling';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport {GLTFAttributesData} from '../types';\n\n/**\n * Prepare attributes for conversion to avoid binary data breaking in worker thread.\n * @param tileContent - 3DTiles tile content\n * @param tileTransform - transformation matrix of the 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 * @returns 3DTiles content data, prepared for conversion\n */\nexport function prepareDataForAttributesConversion(\n tileContent: Tiles3DTileContent,\n tileTransform: Matrix4,\n boundingVolume: OrientedBoundingBox | BoundingSphere\n): GLTFAttributesData {\n let nodes =\n tileContent.gltf?.scene?.nodes ||\n tileContent.gltf?.scenes?.[0]?.nodes ||\n tileContent.gltf?.nodes ||\n [];\n\n const images =\n tileContent.gltf?.images?.map((imageObject) => {\n // Need data only for uncompressed images because we can't get batchIds from compressed textures.\n if (imageObject?.image?.compressed) {\n return null;\n } else {\n const data = imageObject?.image?.data;\n const dataCopy = new Uint8Array(data.length);\n dataCopy.set(data);\n return {\n data: dataCopy,\n compressed: false,\n height: imageObject.image.height,\n width: imageObject.image.width,\n components: imageObject.image.components,\n mimeType: imageObject.mimeType\n };\n }\n }) || [];\n\n prepareNodes(nodes);\n\n const {cartographicOrigin, modelMatrix: cartesianModelMatrix} = calculateTransformProps(\n tileContent,\n tileTransform,\n boundingVolume\n );\n\n return {\n nodes,\n images,\n cartographicOrigin,\n cartesianModelMatrix\n };\n}\n\n/**\n * Keep only values for glTF attributes to pass data to worker thread.\n * @param attributes - geometry attributes\n * @returns attributes with only `value` item\n */\nfunction getB3DMAttributesWithoutBufferView(\n attributes: Record<string, GLTFAccessorPostprocessed>\n): Record<string, {value: TypedArray}> {\n const attributesWithoutBufferView: Record<string, {value: TypedArray}> = {};\n\n for (const attributeName in attributes) {\n attributesWithoutBufferView[attributeName] = {\n value: attributes[attributeName].value\n };\n }\n\n return attributesWithoutBufferView;\n}\n\n/**\n * Calculate transformation properties to transform vertex attributes (POSITION, NORMAL, etc.)\n * from METER_OFFSET coorditantes to LNGLAT_OFFSET coordinates\n * @param tileContent - 3DTiles tile content\n * @param tileTransform - transformation matrix of the 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 * @returns modelMatrix - transformation matrix to transform coordinates to cartographic coordinates\n * cartographicOrigin - tile origin coordinates to calculate offsets\n */\nexport function calculateTransformProps(\n tileContent: Tiles3DTileContent,\n tileTransform: Matrix4,\n boundingVolume: OrientedBoundingBox | BoundingSphere\n): {modelMatrix: Matrix4; cartographicOrigin: Vector3} {\n const {rtcCenter, gltfUpAxis} = tileContent;\n const {center} = boundingVolume;\n\n let modelMatrix = new Matrix4(tileTransform);\n\n // Translate if appropriate\n if (rtcCenter) {\n modelMatrix.translate(rtcCenter);\n }\n\n // glTF models need to be rotated from Y to Z up\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up\n switch (gltfUpAxis) {\n case 'Z':\n break;\n case 'Y':\n const rotationY = new Matrix4().rotateX(Math.PI / 2);\n modelMatrix = modelMatrix.multiplyRight(rotationY);\n break;\n case 'X':\n const rotationX = new Matrix4().rotateY(-Math.PI / 2);\n modelMatrix = modelMatrix.multiplyRight(rotationX);\n break;\n default:\n break;\n }\n\n const cartesianOrigin = new Vector3(center);\n const cartographicOrigin = Ellipsoid.WGS84.cartesianToCartographic(\n cartesianOrigin,\n new Vector3()\n );\n return {modelMatrix, cartographicOrigin};\n}\n\n/**\n * Traverse all nodes to replace all sensible data with copy to avoid data corruption in worker.\n * @param nodes\n */\nfunction prepareNodes(nodes: GLTFNodePostprocessed[]): void {\n for (let index = 0; index < nodes.length; index++) {\n const node = nodes[index] as any;\n\n if (node.mesh) {\n nodes[index] = {\n ...node,\n mesh: {\n ...node.mesh,\n primitives: node.mesh?.primitives.map((primitive) => ({\n ...primitive,\n indices: {value: primitive?.indices?.value},\n attributes: getB3DMAttributesWithoutBufferView(primitive.attributes),\n material: {\n id: primitive?.material?.id,\n uniqueId: primitive?.material?.uniqueId\n }\n }))\n }\n };\n }\n\n if (node.children) {\n prepareNodes(node.children);\n }\n }\n}\n"],"mappings":";;;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAA8C,SAAAE,QAAAC,MAAA,EAAAC,cAAA,QA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AAA,GAATD,SAAS,CAAEI,OAAO,cAAAH,kBAAA,uBAAlBA,kBAAA,CAAoBxB;cAAK,CAAC;cAC3CH,UAAU,EAAED,kCAAkC,CAAC2B,SAAS,CAAC1B,UAAU,CAAC;cACpE+B,QAAQ,EAAE;gBACRC,EAAE,EAAEN,SAAS,aAATA,SAAS,wBAAAE,mBAAA,GAATF,SAAS,CAAEK,QAAQ,cAAAH,mBAAA,uBAAnBA,mBAAA,CAAqBI,EAAE;gBAC3BC,QAAQ,EAAEP,SAAS,aAATA,SAAS,wBAAAG,oBAAA,GAATH,SAAS,CAAEK,QAAQ,cAAAF,oBAAA,uBAAnBA,oBAAA,CAAqBI;cACjC;YAAC;UAAA,CACD;QAAC;MACJ,EACF;IACH;IAEA,IAAIX,IAAI,CAACY,QAAQ,EAAE;MACjBzC,YAAY,CAAC6B,IAAI,CAACY,QAAQ,CAAC;IAC7B;EACF;AACF"}
@@ -38,7 +38,6 @@ var _types = require("./types");
38
38
  var _workerUtils = require("@loaders.gl/worker-utils");
39
39
  var _draco = require("@loaders.gl/draco");
40
40
  var _writeQueue = _interopRequireDefault(require("../lib/utils/write-queue"));
41
- var _i3sAttributesWorker = require("../i3s-attributes-worker");
42
41
  var _constants = require("../constants");
43
42
  var _featureAttributes = require("./helpers/feature-attributes");
44
43
  var _nodeIndexDocument = require("./helpers/node-index-document");
@@ -127,7 +126,7 @@ var I3SConverter = function () {
127
126
  key: "convert",
128
127
  value: function () {
129
128
  var _convert = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(options) {
130
- var tilesetName, slpk, egmFilePath, inputUrl, validate, outputPath, _options$draco, draco, sevenZipExe, maxDepth, token, generateTextures, generateBoundingVolumes, _options$instantNodeW, instantNodeWriting, _options$mergeMateria, mergeMaterials, preloadOptions, preprocessResult, workerFarm;
129
+ var tilesetName, slpk, egmFilePath, inputUrl, validate, outputPath, _options$draco, draco, sevenZipExe, maxDepth, token, generateTextures, generateBoundingVolumes, _options$instantNodeW, instantNodeWriting, _options$mergeMateria, mergeMaterials, preloadOptions, tilesetUrl, preprocessResult, workerFarm;
131
130
  return _regenerator.default.wrap(function _callee$(_context) {
132
131
  while (1) switch (_context.prev = _context.next) {
133
132
  case 0:
@@ -175,54 +174,58 @@ var I3SConverter = function () {
175
174
  return this._fetchPreloadOptions();
176
175
  case 24:
177
176
  preloadOptions = _context.sent;
177
+ tilesetUrl = inputUrl;
178
+ if (preloadOptions.url) {
179
+ tilesetUrl = preloadOptions.url;
180
+ }
178
181
  if (preloadOptions.headers) {
179
182
  this.loadOptions.fetch = {
180
183
  headers: preloadOptions.headers
181
184
  };
182
185
  }
183
- _context.next = 28;
184
- return (0, _core.load)(inputUrl, this.Loader, this.loadOptions);
185
- case 28:
186
+ _context.next = 30;
187
+ return (0, _core.load)(tilesetUrl, this.Loader, this.loadOptions);
188
+ case 30:
186
189
  this.sourceTileset = _context.sent;
187
- _context.next = 31;
190
+ _context.next = 33;
188
191
  return this.preprocessConversion();
189
- case 31:
192
+ case 33:
190
193
  preprocessResult = _context.sent;
191
194
  if (!preprocessResult) {
192
- _context.next = 37;
195
+ _context.next = 39;
193
196
  break;
194
197
  }
195
- _context.next = 35;
196
- return this._createAndSaveTileset(outputPath, tilesetName);
197
- case 35:
198
198
  _context.next = 37;
199
+ return this._createAndSaveTileset(outputPath, tilesetName);
200
+ case 37:
201
+ _context.next = 39;
199
202
  return this._finishConversion({
200
203
  slpk: Boolean(slpk),
201
204
  outputPath: outputPath,
202
205
  tilesetName: tilesetName
203
206
  });
204
- case 37:
205
- _context.next = 42;
206
- break;
207
207
  case 39:
208
- _context.prev = 39;
208
+ _context.next = 44;
209
+ break;
210
+ case 41:
211
+ _context.prev = 41;
209
212
  _context.t0 = _context["catch"](21);
210
213
  throw _context.t0;
211
- case 42:
212
- _context.prev = 42;
213
- _context.next = 45;
214
+ case 44:
215
+ _context.prev = 44;
216
+ _context.next = 47;
214
217
  return this.writeQueue.finalize();
215
- case 45:
218
+ case 47:
216
219
  workerFarm = _workerUtils.WorkerFarm.getWorkerFarm({});
217
220
  workerFarm.destroy();
218
- return _context.finish(42);
219
- case 48:
221
+ return _context.finish(44);
222
+ case 50:
220
223
  return _context.abrupt("return", 'success');
221
- case 49:
224
+ case 51:
222
225
  case "end":
223
226
  return _context.stop();
224
227
  }
225
- }, _callee, this, [[21, 39, 42, 48]]);
228
+ }, _callee, this, [[21, 41, 44, 50]]);
226
229
  }));
227
230
  function convert(_x) {
228
231
  return _convert.apply(this, arguments);
@@ -1498,7 +1501,7 @@ var I3SConverter = function () {
1498
1501
  key: "loadWorkers",
1499
1502
  value: function () {
1500
1503
  var _loadWorkers = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee22() {
1501
- var url, _sourceResponse, _source, _url, _sourceResponse2, _source2, i3sAttributesWorkerUrl, sourceResponse, source;
1504
+ var url, sourceResponse, source, _url, _sourceResponse, _source;
1502
1505
  return _regenerator.default.wrap(function _callee22$(_context23) {
1503
1506
  while (1) switch (_context23.prev = _context23.next) {
1504
1507
  case 0:
@@ -1511,12 +1514,12 @@ var I3SConverter = function () {
1511
1514
  _context23.next = 5;
1512
1515
  return (0, _core.fetchFile)(url);
1513
1516
  case 5:
1514
- _sourceResponse = _context23.sent;
1517
+ sourceResponse = _context23.sent;
1515
1518
  _context23.next = 8;
1516
- return _sourceResponse.text();
1519
+ return sourceResponse.text();
1517
1520
  case 8:
1518
- _source = _context23.sent;
1519
- this.workerSource.draco = _source;
1521
+ source = _context23.sent;
1522
+ this.workerSource.draco = source;
1520
1523
  case 10:
1521
1524
  if (!this.generateTextures) {
1522
1525
  _context23.next = 19;
@@ -1526,25 +1529,15 @@ var I3SConverter = function () {
1526
1529
  _context23.next = 14;
1527
1530
  return (0, _core.fetchFile)(_url);
1528
1531
  case 14:
1529
- _sourceResponse2 = _context23.sent;
1532
+ _sourceResponse = _context23.sent;
1530
1533
  _context23.next = 17;
1531
- return _sourceResponse2.text();
1534
+ return _sourceResponse.text();
1532
1535
  case 17:
1533
- _source2 = _context23.sent;
1534
- this.workerSource.ktx2 = _source2;
1536
+ _source = _context23.sent;
1537
+ this.workerSource.ktx2 = _source;
1535
1538
  case 19:
1536
- i3sAttributesWorkerUrl = (0, _workerUtils.getWorkerURL)(_i3sAttributesWorker.I3SAttributesWorker, _objectSpread({}, (0, _core.getLoaderOptions)()));
1537
- _context23.next = 22;
1538
- return (0, _core.fetchFile)(i3sAttributesWorkerUrl);
1539
- case 22:
1540
- sourceResponse = _context23.sent;
1541
- _context23.next = 25;
1542
- return sourceResponse.text();
1543
- case 25:
1544
- source = _context23.sent;
1545
- this.workerSource.I3SAttributes = source;
1546
1539
  console.log("Loading workers source completed!");
1547
- case 28:
1540
+ case 20:
1548
1541
  case "end":
1549
1542
  return _context23.stop();
1550
1543
  }