@loaders.gl/tile-converter 4.0.0-alpha.17 → 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 (69) hide show
  1. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +5 -4
  2. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
  3. package/dist/3d-tiles-converter/3d-tiles-converter.js +39 -37
  4. package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +3 -1
  5. package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
  6. package/dist/3d-tiles-converter/helpers/b3dm-converter.js +4 -2
  7. package/dist/3d-tiles-converter/helpers/load-i3s.d.ts +10 -0
  8. package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +1 -0
  9. package/dist/3d-tiles-converter/helpers/load-i3s.js +42 -0
  10. package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts +2 -1
  11. package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts.map +1 -1
  12. package/dist/3d-tiles-converter/helpers/texture-atlas.js +2 -0
  13. package/dist/converter.min.js +71 -71
  14. package/dist/deps-installer/deps-installer.d.ts +3 -2
  15. package/dist/deps-installer/deps-installer.d.ts.map +1 -1
  16. package/dist/deps-installer/deps-installer.js +36 -10
  17. package/dist/dist.min.js +824 -3079
  18. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +94 -81
  19. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  20. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +6 -4
  21. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  22. package/dist/es5/3d-tiles-converter/helpers/load-i3s.js +63 -0
  23. package/dist/es5/3d-tiles-converter/helpers/load-i3s.js.map +1 -0
  24. package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
  25. package/dist/es5/deps-installer/deps-installer.js +112 -38
  26. package/dist/es5/deps-installer/deps-installer.js.map +1 -1
  27. package/dist/es5/i3s-converter/helpers/geometry-converter.js +12 -9
  28. package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
  29. package/dist/es5/i3s-converter/i3s-converter.js +32 -87
  30. package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
  31. package/dist/es5/lib/utils/lod-conversion-utils.js +10 -4
  32. package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
  33. package/dist/es5/pgm-loader.js +1 -1
  34. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +46 -43
  35. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  36. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +4 -3
  37. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  38. package/dist/esm/3d-tiles-converter/helpers/load-i3s.js +32 -0
  39. package/dist/esm/3d-tiles-converter/helpers/load-i3s.js.map +1 -0
  40. package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
  41. package/dist/esm/deps-installer/deps-installer.js +37 -11
  42. package/dist/esm/deps-installer/deps-installer.js.map +1 -1
  43. package/dist/esm/i3s-converter/helpers/geometry-converter.js +10 -6
  44. package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
  45. package/dist/esm/i3s-converter/i3s-converter.js +11 -28
  46. package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
  47. package/dist/esm/i3s-server/bin/i3s-server.min.js +72 -72
  48. package/dist/esm/lib/utils/lod-conversion-utils.js +6 -4
  49. package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -1
  50. package/dist/esm/pgm-loader.js +1 -1
  51. package/dist/i3s-converter/helpers/geometry-converter.d.ts +2 -4
  52. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
  53. package/dist/i3s-converter/helpers/geometry-converter.js +18 -13
  54. package/dist/i3s-converter/i3s-converter.d.ts +0 -1
  55. package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
  56. package/dist/i3s-converter/i3s-converter.js +10 -22
  57. package/dist/lib/utils/lod-conversion-utils.d.ts +2 -2
  58. package/dist/lib/utils/lod-conversion-utils.d.ts.map +1 -1
  59. package/dist/lib/utils/lod-conversion-utils.js +4 -4
  60. package/dist/slpk-extractor.min.js +38 -38
  61. package/package.json +14 -14
  62. package/src/3d-tiles-converter/3d-tiles-converter.ts +60 -46
  63. package/src/3d-tiles-converter/helpers/b3dm-converter.ts +11 -10
  64. package/src/3d-tiles-converter/helpers/load-i3s.ts +51 -0
  65. package/src/3d-tiles-converter/helpers/texture-atlas.ts +6 -2
  66. package/src/deps-installer/deps-installer.ts +55 -10
  67. package/src/i3s-converter/helpers/geometry-converter.ts +19 -14
  68. package/src/i3s-converter/i3s-converter.ts +12 -28
  69. package/src/lib/utils/lod-conversion-utils.ts +10 -6
@@ -21,10 +21,12 @@ export function convertGeometricErrorToScreenThreshold(tile, coordinates) {
21
21
  return lodSelection;
22
22
  }
23
23
  export function convertScreenThresholdToGeometricError(node) {
24
- const metricData = node.header.lodSelection.maxScreenThreshold || {};
25
- let maxError = metricData.maxError;
24
+ var _node$lodSelection;
25
+ const metricData = (_node$lodSelection = node.lodSelection) === null || _node$lodSelection === void 0 ? void 0 : _node$lodSelection.find(metric => metric.metricType === 'maxScreenThreshold');
26
+ let maxError = metricData === null || metricData === void 0 ? void 0 : metricData.maxError;
26
27
  if (!maxError) {
27
- const sqMetricData = node.header.lodSelection.maxScreenThresholdSQ;
28
+ var _node$lodSelection2;
29
+ const sqMetricData = (_node$lodSelection2 = node.lodSelection) === null || _node$lodSelection2 === void 0 ? void 0 : _node$lodSelection2.find(metric => metric.metricType === 'maxScreenThresholdSQ');
28
30
  if (sqMetricData) {
29
31
  maxError = Math.sqrt(sqMetricData.maxError / (Math.PI * 0.25));
30
32
  }
@@ -32,6 +34,6 @@ export function convertScreenThresholdToGeometricError(node) {
32
34
  if (!maxError) {
33
35
  maxError = DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR;
34
36
  }
35
- return node.header.mbs[3] * 2 * DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR / maxError;
37
+ return node.mbs[3] * 2 * DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR / maxError;
36
38
  }
37
39
  //# sourceMappingURL=lod-conversion-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lod-conversion-utils.js","names":["DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR","convertGeometricErrorToScreenThreshold","tile","coordinates","lodSelection","boundingVolume","lodMetricValue","maxScreenThreshold","metricType","maxError","mbs","maxScreenThresholdSQ","Math","PI","constructor","name","push","convertScreenThresholdToGeometricError","node","metricData","header","sqMetricData","sqrt"],"sources":["../../../../src/lib/utils/lod-conversion-utils.ts"],"sourcesContent":["import {Tiles3DTileJSONPostprocessed} from '@loaders.gl/3d-tiles';\nimport {BoundingVolumes} from '@loaders.gl/i3s';\nimport {Tile3D} from '@loaders.gl/tiles';\n\n// https://cesium.com/docs/cesiumjs-ref-doc/Cesium3DTileset.html\nconst DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR = 16;\n/**\n * Do conversion from geometric error to screen threshold\n * \n * In 3DTiles we have HLOD logic and parent tile also has bigger lodMetric value then its children.\n * In I3s we have reverse logic related to maxError. Parent has lower maxError than its child.\n * In nodes where are no children tile.lodMetricValue is 0. This is because of logic of HLOD in 3DTiles\n * 3DTiles spec:\n * https://github.com/CesiumGS/3d-tiles/tree/master/specification#geometric-error\n * I3S spec:\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/lodSelection.cmn.md\n * To avoid infinity values when we do calculations of maxError we shold replace 0 with value which allows us\n * to make child maxError bigger than his parent maxError.\n * \n * @param tile - 3d-tiles tile JSON\n * @param coordinates - node converted coordinates\n * @returns An array of LOD metrics in format compatible with i3s 3DNodeIndexDocument.lodSelection\n * @example \n * [\n {\n \"metricType\": \"maxScreenThresholdSQ\",\n \"maxError\": 870638.071285568\n },\n {\n \"metricType\": \"maxScreenThreshold\",\n \"maxError\": 1052.8679031638949\n }\n ]\n */\nexport function convertGeometricErrorToScreenThreshold(\n tile: Tiles3DTileJSONPostprocessed,\n coordinates: BoundingVolumes\n) {\n const lodSelection: {metricType: string; maxError: number}[] = [];\n const boundingVolume = tile.boundingVolume;\n const lodMetricValue = tile.lodMetricValue || 0.1;\n const maxScreenThreshold = {\n metricType: 'maxScreenThreshold',\n maxError: (coordinates.mbs[3] * 2 * DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR) / lodMetricValue\n };\n const maxScreenThresholdSQ = {\n metricType: 'maxScreenThresholdSQ',\n maxError: Math.PI * 0.25 * maxScreenThreshold.maxError * maxScreenThreshold.maxError\n };\n\n if (boundingVolume.constructor.name === 'OrientedBoundingBox') {\n lodSelection.push(maxScreenThresholdSQ);\n lodSelection.push(maxScreenThreshold);\n } else {\n lodSelection.push(maxScreenThreshold);\n lodSelection.push(maxScreenThresholdSQ);\n }\n\n return lodSelection;\n}\n\n/**\n * Convert LOD metric from \"Screen Threshold\" to \"Screen Space Error\"\n * @param node - i3s node data\n * @returns lod metric in 3d-tiles format\n */\nexport function convertScreenThresholdToGeometricError(node: Tile3D): number {\n const metricData = node.header.lodSelection.maxScreenThreshold || {};\n let maxError = metricData.maxError;\n if (!maxError) {\n const sqMetricData = node.header.lodSelection.maxScreenThresholdSQ;\n if (sqMetricData) {\n maxError = Math.sqrt(sqMetricData.maxError / (Math.PI * 0.25));\n }\n }\n\n if (!maxError) {\n maxError = DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR;\n }\n\n return (node.header.mbs[3] * 2 * DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR) / maxError;\n}\n"],"mappings":"AAKA,MAAMA,kCAAkC,GAAG,EAAE;AA6B7C,OAAO,SAASC,sCAAsCA,CACpDC,IAAkC,EAClCC,WAA4B,EAC5B;EACA,MAAMC,YAAsD,GAAG,EAAE;EACjE,MAAMC,cAAc,GAAGH,IAAI,C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MAAM,CAACV,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAGV,kCAAkC,GAAIS,QAAQ;AACjF"}
1
+ {"version":3,"file":"lod-conversion-utils.js","names":["DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR","convertGeometricErrorToScreenThreshold","tile","coordinates","lodSelection","boundingVolume","lodMetricValue","maxScreenThreshold","metricType","maxError","mbs","maxScreenThresholdSQ","Math","PI","constructor","name","push","convertScreenThresholdToGeometricError","node","_node$lodSelection","metricData","find","metric","_node$lodSelection2","sqMetricData","sqrt"],"sources":["../../../../src/lib/utils/lod-conversion-utils.ts"],"sourcesContent":["import {Tiles3DTileJSONPostprocessed} from '@loaders.gl/3d-tiles';\nimport {BoundingVolumes} from '@loaders.gl/i3s';\nimport {I3STileHeader} from '@loaders.gl/i3s/src/types';\n\n// https://cesium.com/docs/cesiumjs-ref-doc/Cesium3DTileset.html\nconst DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR = 16;\n/**\n * Do conversion from geometric error to screen threshold\n * \n * In 3DTiles we have HLOD logic and parent tile also has bigger lodMetric value then its children.\n * In I3s we have reverse logic related to maxError. Parent has lower maxError than its child.\n * In nodes where are no children tile.lodMetricValue is 0. This is because of logic of HLOD in 3DTiles\n * 3DTiles spec:\n * https://github.com/CesiumGS/3d-tiles/tree/master/specification#geometric-error\n * I3S spec:\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/lodSelection.cmn.md\n * To avoid infinity values when we do calculations of maxError we shold replace 0 with value which allows us\n * to make child maxError bigger than his parent maxError.\n * \n * @param tile - 3d-tiles tile JSON\n * @param coordinates - node converted coordinates\n * @returns An array of LOD metrics in format compatible with i3s 3DNodeIndexDocument.lodSelection\n * @example \n * [\n {\n \"metricType\": \"maxScreenThresholdSQ\",\n \"maxError\": 870638.071285568\n },\n {\n \"metricType\": \"maxScreenThreshold\",\n \"maxError\": 1052.8679031638949\n }\n ]\n */\nexport function convertGeometricErrorToScreenThreshold(\n tile: Tiles3DTileJSONPostprocessed,\n coordinates: BoundingVolumes\n) {\n const lodSelection: {metricType: string; maxError: number}[] = [];\n const boundingVolume = tile.boundingVolume;\n const lodMetricValue = tile.lodMetricValue || 0.1;\n const maxScreenThreshold = {\n metricType: 'maxScreenThreshold',\n maxError: (coordinates.mbs[3] * 2 * DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR) / lodMetricValue\n };\n const maxScreenThresholdSQ = {\n metricType: 'maxScreenThresholdSQ',\n maxError: Math.PI * 0.25 * maxScreenThreshold.maxError * maxScreenThreshold.maxError\n };\n\n if (boundingVolume.constructor.name === 'OrientedBoundingBox') {\n lodSelection.push(maxScreenThresholdSQ);\n lodSelection.push(maxScreenThreshold);\n } else {\n lodSelection.push(maxScreenThreshold);\n lodSelection.push(maxScreenThresholdSQ);\n }\n\n return lodSelection;\n}\n\n/**\n * Convert LOD metric from \"Screen Threshold\" to \"Screen Space Error\"\n * @param node - i3s node data\n * @returns lod metric in 3d-tiles format\n */\nexport function convertScreenThresholdToGeometricError(node: I3STileHeader): number {\n const metricData = node.lodSelection?.find(\n (metric) => metric.metricType === 'maxScreenThreshold'\n );\n let maxError = metricData?.maxError;\n if (!maxError) {\n const sqMetricData = node.lodSelection?.find(\n (metric) => metric.metricType === 'maxScreenThresholdSQ'\n );\n if (sqMetricData) {\n maxError = Math.sqrt(sqMetricData.maxError / (Math.PI * 0.25));\n }\n }\n\n if (!maxError) {\n maxError = DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR;\n }\n\n return (node.mbs[3] * 2 * DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR) / maxError;\n}\n"],"mappings":"AAKA,MAAMA,kCAAkC,GAAG,EAAE;AA6B7C,OAAO,SAASC,sCAAsCA,CACpDC,IAAkC,EAClCC,WAA4B,EAC5B;EACA,MAAMC,YAAsD,GAAG,EAAE;EACjE,MAAMC,cAAc,GAAGH,IAAI,CAACG,cAAc;EAC1C,MAAMC,cAAc,GAAGJ,IAAI,CAACI,cAAc,IAAI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AACf,QAAQ,IAAIG,IAAI,CAACC,EAAE,GAAG,IAAI,CAAC,CAAC;IAChE;EACF;EAEA,IAAI,CAACJ,QAAQ,EAAE;IACbA,QAAQ,GAAGT,kCAAkC;EAC/C;EAEA,OAAQkB,IAAI,CAACR,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAGV,kCAAkC,GAAIS,QAAQ;AAC1E"}
@@ -1,5 +1,5 @@
1
1
  import { parsePGM } from '@math.gl/geoid';
2
- const VERSION = typeof "4.0.0-alpha.17" !== 'undefined' ? "4.0.0-alpha.17" : '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,KAAK,EACvB,YAAY,EAAE;IAAC,CAAC,GAAG,EAAE,MAAM,G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,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,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAC;AAC7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CAAC,qBAAqB;IAU7B;;;;;;OAMG;IACH,OAAO,CAAC,8BAA8B;IAWtC;;;OAGG;IACH,OAAO,CAAC,qCAAqC;IAyB7C;;;OAGG;YACW,iBAAiB;IAqB/B;;OAEG;YACW,oBAAoB;IAYlC;;OAEG;YACW,qBAAqB;IAiBnC;;OAEG;IACH,OAAO,CAAC,8BAA8B;IAWtC;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;CAG3B"}
@@ -51,7 +51,6 @@ const textures_1 = require("@loaders.gl/textures");
51
51
  const images_1 = require("@loaders.gl/images");
52
52
  const types_1 = require("./types");
53
53
  const worker_utils_1 = require("@loaders.gl/worker-utils");
54
- const draco_1 = require("@loaders.gl/draco");
55
54
  const write_queue_1 = __importDefault(require("../lib/utils/write-queue"));
56
55
  const constants_1 = require("../constants");
57
56
  const feature_attributes_1 = require("./helpers/feature-attributes");
@@ -81,6 +80,7 @@ class I3SConverter {
81
80
  this.loadOptions = {
82
81
  _nodeWorkers: true,
83
82
  reuseWorkers: true,
83
+ useLocalLibraries: true,
84
84
  basis: {
85
85
  format: 'rgba32',
86
86
  // We need to load local fs workers because nodejs can't load workers from the Internet
@@ -88,7 +88,8 @@ class I3SConverter {
88
88
  },
89
89
  // We need to load local fs workers because nodejs can't load workers from the Internet
90
90
  draco: { workerUrl: './modules/draco/dist/draco-worker-node.js' },
91
- fetch: {}
91
+ fetch: {},
92
+ modules: {}
92
93
  };
93
94
  this.geoidHeightModel = null;
94
95
  this.Loader = _3d_tiles_1.Tiles3DLoader;
@@ -166,7 +167,6 @@ class I3SConverter {
166
167
  if (slpk) {
167
168
  this.nodePages.useWriteFunction(file_utils_1.writeFileForSlpk);
168
169
  }
169
- await this.loadWorkers();
170
170
  try {
171
171
  const preloadOptions = await this._fetchPreloadOptions();
172
172
  let tilesetUrl = inputUrl;
@@ -513,7 +513,7 @@ class I3SConverter {
513
513
  halfSize: [],
514
514
  quaternion: []
515
515
  };
516
- const resourcesData = await (0, geometry_converter_1.default)(tileContent, transformationMatrix, boundingVolume, async () => (await this.nodePages.push({ index: 0, obb: draftObb }, parentId)).index, propertyTable, this.featuresHashArray, this.layers0?.attributeStorageInfo, this.options.draco, this.generateBoundingVolumes, this.options.mergeMaterials, this.geoidHeightModel, this.workerSource);
516
+ const resourcesData = await (0, geometry_converter_1.default)(tileContent, transformationMatrix, boundingVolume, async () => (await this.nodePages.push({ index: 0, obb: draftObb }, parentId)).index, propertyTable, this.featuresHashArray, this.layers0?.attributeStorageInfo, this.options.draco, this.generateBoundingVolumes, this.options.mergeMaterials, this.geoidHeightModel, this.loadOptions.modules);
517
517
  return resourcesData;
518
518
  }
519
519
  /**
@@ -688,9 +688,13 @@ class I3SConverter {
688
688
  const arrayToEncode = new Uint8Array(copyArrayBuffer);
689
689
  const ktx2TextureData = (0, core_1.encode)({ ...texture.image, data: arrayToEncode }, textures_1.KTX2BasisWriterWorker, {
690
690
  ...textures_1.KTX2BasisWriterWorker.options,
691
- source: this.workerSource.ktx2,
691
+ ['ktx2-basis-writer']: {
692
+ // We need to load local fs workers because nodejs can't load workers from the Internet
693
+ workerUrl: './modules/textures/dist/ktx2-basis-writer-worker-node.js'
694
+ },
692
695
  reuseWorkers: true,
693
- _nodeWorkers: true
696
+ _nodeWorkers: true,
697
+ useLocalLibraries: true
694
698
  });
695
699
  await this.writeTextureFile(ktx2TextureData, '1', 'ktx2', childPath, slpkChildPath);
696
700
  }
@@ -905,21 +909,5 @@ class I3SConverter {
905
909
  isContentSupported(sourceTile) {
906
910
  return ['b3dm', 'glTF', 'scenegraph'].includes(sourceTile.type || '');
907
911
  }
908
- async loadWorkers() {
909
- console.log(`Loading workers source...`); // eslint-disable-line no-undef, no-console
910
- if (this.options.draco) {
911
- const url = (0, worker_utils_1.getWorkerURL)(draco_1.DracoWriterWorker, { ...(0, core_1.getLoaderOptions)() });
912
- const sourceResponse = await (0, core_1.fetchFile)(url);
913
- const source = await sourceResponse.text();
914
- this.workerSource.draco = source;
915
- }
916
- if (this.generateTextures) {
917
- const url = (0, worker_utils_1.getWorkerURL)(textures_1.KTX2BasisWriterWorker, { ...(0, core_1.getLoaderOptions)() });
918
- const sourceResponse = await (0, core_1.fetchFile)(url);
919
- const source = await sourceResponse.text();
920
- this.workerSource.ktx2 = source;
921
- }
922
- console.log(`Loading workers source completed!`); // eslint-disable-line no-undef, no-console
923
- }
924
912
  }
925
913
  exports.default = I3SConverter;
@@ -1,6 +1,6 @@
1
1
  import { Tiles3DTileJSONPostprocessed } from '@loaders.gl/3d-tiles';
2
2
  import { BoundingVolumes } from '@loaders.gl/i3s';
3
- import { Tile3D } from '@loaders.gl/tiles';
3
+ import { I3STileHeader } from '@loaders.gl/i3s/src/types';
4
4
  /**
5
5
  * Do conversion from geometric error to screen threshold
6
6
  *
@@ -38,5 +38,5 @@ export declare function convertGeometricErrorToScreenThreshold(tile: Tiles3DTile
38
38
  * @param node - i3s node data
39
39
  * @returns lod metric in 3d-tiles format
40
40
  */
41
- export declare function convertScreenThresholdToGeometricError(node: Tile3D): number;
41
+ export declare function convertScreenThresholdToGeometricError(node: I3STileHeader): number;
42
42
  //# sourceMappingURL=lod-conversion-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lod-conversion-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/lod-conversion-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,4BAA4B,EAAC,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AAIzC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,sCAAsC,CACpD,IAAI,EAAE,4BAA4B,EAClC,WAAW,EAAE,eAAe;gBAEK,MAAM;cAAY,MAAM;IAqB1D;AAED;;;;GAIG;AACH,wBAAgB,sCAAsC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAe3E"}
1
+ {"version":3,"file":"lod-conversion-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/lod-conversion-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,4BAA4B,EAAC,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAC;AAIxD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,sCAAsC,CACpD,IAAI,EAAE,4BAA4B,EAClC,WAAW,EAAE,eAAe;gBAEK,MAAM;cAAY,MAAM;IAqB1D;AAED;;;;GAIG;AACH,wBAAgB,sCAAsC,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAmBlF"}
@@ -60,10 +60,10 @@ exports.convertGeometricErrorToScreenThreshold = convertGeometricErrorToScreenTh
60
60
  * @returns lod metric in 3d-tiles format
61
61
  */
62
62
  function convertScreenThresholdToGeometricError(node) {
63
- const metricData = node.header.lodSelection.maxScreenThreshold || {};
64
- let maxError = metricData.maxError;
63
+ const metricData = node.lodSelection?.find((metric) => metric.metricType === 'maxScreenThreshold');
64
+ let maxError = metricData?.maxError;
65
65
  if (!maxError) {
66
- const sqMetricData = node.header.lodSelection.maxScreenThresholdSQ;
66
+ const sqMetricData = node.lodSelection?.find((metric) => metric.metricType === 'maxScreenThresholdSQ');
67
67
  if (sqMetricData) {
68
68
  maxError = Math.sqrt(sqMetricData.maxError / (Math.PI * 0.25));
69
69
  }
@@ -71,6 +71,6 @@ function convertScreenThresholdToGeometricError(node) {
71
71
  if (!maxError) {
72
72
  maxError = DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR;
73
73
  }
74
- return (node.header.mbs[3] * 2 * DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR) / maxError;
74
+ return (node.mbs[3] * 2 * DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR) / maxError;
75
75
  }
76
76
  exports.convertScreenThresholdToGeometricError = convertScreenThresholdToGeometricError;