@loaders.gl/tile-converter 4.0.0-alpha.6 → 4.0.0-alpha.8

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 (176) hide show
  1. package/bin/converter.js +1 -1
  2. package/dist/3d-tiles-attributes-worker.js +2 -2
  3. package/dist/3d-tiles-attributes-worker.js.map +3 -3
  4. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
  5. package/dist/3d-tiles-converter/3d-tiles-converter.js +4 -3
  6. package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +0 -8
  7. package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
  8. package/dist/3d-tiles-converter/helpers/b3dm-converter.js +2 -15
  9. package/dist/converter.min.js +75 -76
  10. package/dist/deps-installer/deps-installer.js +4 -4
  11. package/dist/dist.min.js +2529 -1884
  12. package/dist/es5/3d-tiles-attributes-worker.js +1 -1
  13. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +0 -3
  14. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  15. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +2 -10
  16. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  17. package/dist/es5/deps-installer/deps-installer.js +5 -5
  18. package/dist/es5/deps-installer/deps-installer.js.map +1 -1
  19. package/dist/es5/i3s-attributes-worker.js +1 -1
  20. package/dist/es5/i3s-attributes-worker.js.map +1 -1
  21. package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +4 -4
  22. package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
  23. package/dist/es5/i3s-converter/helpers/coordinate-converter.js +6 -7
  24. package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
  25. package/dist/es5/i3s-converter/helpers/geometry-converter.js +49 -30
  26. package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
  27. package/dist/es5/i3s-converter/helpers/gltf-attributes.js +46 -16
  28. package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  29. package/dist/es5/i3s-converter/helpers/load-3d-tiles.js +82 -0
  30. package/dist/es5/i3s-converter/helpers/load-3d-tiles.js.map +1 -0
  31. package/dist/es5/i3s-converter/helpers/node-index-document.js +74 -45
  32. package/dist/es5/i3s-converter/helpers/node-index-document.js.map +1 -1
  33. package/dist/es5/i3s-converter/helpers/preprocess-3d-tiles.js +111 -0
  34. package/dist/es5/i3s-converter/helpers/preprocess-3d-tiles.js.map +1 -0
  35. package/dist/es5/i3s-converter/helpers/tileset-traversal.js +82 -0
  36. package/dist/es5/i3s-converter/helpers/tileset-traversal.js.map +1 -0
  37. package/dist/es5/i3s-converter/i3s-converter.js +545 -523
  38. package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
  39. package/dist/es5/i3s-converter/types.js +16 -0
  40. package/dist/es5/i3s-converter/types.js.map +1 -1
  41. package/dist/es5/i3s-server/README.md +19 -0
  42. package/dist/es5/i3s-server/app.js +10 -1
  43. package/dist/es5/i3s-server/app.js.map +1 -1
  44. package/dist/es5/i3s-server/controllers/slpk-controller.js +84 -0
  45. package/dist/es5/i3s-server/controllers/slpk-controller.js.map +1 -0
  46. package/dist/es5/i3s-server/routes/slpk-router.js +71 -0
  47. package/dist/es5/i3s-server/routes/slpk-router.js.map +1 -0
  48. package/dist/es5/i3s-server/utils/create-scene-server.js +17 -0
  49. package/dist/es5/i3s-server/utils/create-scene-server.js.map +1 -0
  50. package/dist/es5/lib/utils/file-utils.js +1 -1
  51. package/dist/es5/lib/utils/file-utils.js.map +1 -1
  52. package/dist/es5/lib/utils/geometry-utils.js +15 -0
  53. package/dist/es5/lib/utils/geometry-utils.js.map +1 -0
  54. package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
  55. package/dist/es5/pgm-loader.js +1 -1
  56. package/dist/esm/3d-tiles-attributes-worker.js +1 -1
  57. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +0 -3
  58. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  59. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +2 -8
  60. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  61. package/dist/esm/deps-installer/deps-installer.js +5 -5
  62. package/dist/esm/deps-installer/deps-installer.js.map +1 -1
  63. package/dist/esm/i3s-attributes-worker.js +1 -1
  64. package/dist/esm/i3s-attributes-worker.js.map +1 -1
  65. package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +4 -4
  66. package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
  67. package/dist/esm/i3s-converter/helpers/coordinate-converter.js +6 -7
  68. package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
  69. package/dist/esm/i3s-converter/helpers/geometry-converter.js +37 -18
  70. package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
  71. package/dist/esm/i3s-converter/helpers/gltf-attributes.js +50 -16
  72. package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  73. package/dist/esm/i3s-converter/helpers/load-3d-tiles.js +35 -0
  74. package/dist/esm/i3s-converter/helpers/load-3d-tiles.js.map +1 -0
  75. package/dist/esm/i3s-converter/helpers/node-index-document.js +14 -1
  76. package/dist/esm/i3s-converter/helpers/node-index-document.js.map +1 -1
  77. package/dist/esm/i3s-converter/helpers/preprocess-3d-tiles.js +48 -0
  78. package/dist/esm/i3s-converter/helpers/preprocess-3d-tiles.js.map +1 -0
  79. package/dist/esm/i3s-converter/helpers/tileset-traversal.js +14 -0
  80. package/dist/esm/i3s-converter/helpers/tileset-traversal.js.map +1 -0
  81. package/dist/esm/i3s-converter/i3s-converter.js +134 -127
  82. package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
  83. package/dist/esm/i3s-converter/types.js +10 -1
  84. package/dist/esm/i3s-converter/types.js.map +1 -1
  85. package/dist/esm/i3s-server/README.md +19 -0
  86. package/dist/esm/i3s-server/app.js +11 -1
  87. package/dist/esm/i3s-server/app.js.map +1 -1
  88. package/dist/esm/i3s-server/controllers/slpk-controller.js +36 -0
  89. package/dist/esm/i3s-server/controllers/slpk-controller.js.map +1 -0
  90. package/dist/esm/i3s-server/routes/slpk-router.js +33 -0
  91. package/dist/esm/i3s-server/routes/slpk-router.js.map +1 -0
  92. package/dist/esm/i3s-server/utils/create-scene-server.js +16 -0
  93. package/dist/esm/i3s-server/utils/create-scene-server.js.map +1 -0
  94. package/dist/esm/lib/utils/file-utils.js +1 -1
  95. package/dist/esm/lib/utils/file-utils.js.map +1 -1
  96. package/dist/esm/lib/utils/geometry-utils.js +8 -0
  97. package/dist/esm/lib/utils/geometry-utils.js.map +1 -0
  98. package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -1
  99. package/dist/esm/pgm-loader.js +1 -1
  100. package/dist/i3s-attributes-worker.d.ts +10 -2
  101. package/dist/i3s-attributes-worker.d.ts.map +1 -1
  102. package/dist/i3s-attributes-worker.js +2 -2
  103. package/dist/i3s-attributes-worker.js.map +3 -3
  104. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +4 -2
  105. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
  106. package/dist/i3s-converter/helpers/batch-ids-extensions.js +4 -7
  107. package/dist/i3s-converter/helpers/coordinate-converter.d.ts +3 -4
  108. package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -1
  109. package/dist/i3s-converter/helpers/coordinate-converter.js +8 -9
  110. package/dist/i3s-converter/helpers/geometry-converter.d.ts +9 -4
  111. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
  112. package/dist/i3s-converter/helpers/geometry-converter.js +84 -54
  113. package/dist/i3s-converter/helpers/gltf-attributes.d.ts +22 -3
  114. package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
  115. package/dist/i3s-converter/helpers/gltf-attributes.js +62 -22
  116. package/dist/i3s-converter/helpers/load-3d-tiles.d.ts +18 -0
  117. package/dist/i3s-converter/helpers/load-3d-tiles.d.ts.map +1 -0
  118. package/dist/i3s-converter/helpers/load-3d-tiles.js +53 -0
  119. package/dist/i3s-converter/helpers/node-index-document.d.ts +8 -0
  120. package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
  121. package/dist/i3s-converter/helpers/node-index-document.js +20 -2
  122. package/dist/i3s-converter/helpers/node-pages.js +1 -1
  123. package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts +23 -0
  124. package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +1 -0
  125. package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +76 -0
  126. package/dist/i3s-converter/helpers/tileset-traversal.d.ts +25 -0
  127. package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +1 -0
  128. package/dist/i3s-converter/helpers/tileset-traversal.js +29 -0
  129. package/dist/i3s-converter/i3s-converter.d.ts +40 -40
  130. package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
  131. package/dist/i3s-converter/i3s-converter.js +150 -125
  132. package/dist/i3s-converter/types.d.ts +18 -0
  133. package/dist/i3s-converter/types.d.ts.map +1 -1
  134. package/dist/i3s-converter/types.js +15 -0
  135. package/dist/i3s-server/app.d.ts.map +1 -1
  136. package/dist/i3s-server/app.js +9 -1
  137. package/dist/i3s-server/controllers/slpk-controller.d.ts +3 -0
  138. package/dist/i3s-server/controllers/slpk-controller.d.ts.map +1 -0
  139. package/dist/i3s-server/controllers/slpk-controller.js +32 -0
  140. package/dist/i3s-server/routes/slpk-router.d.ts +3 -0
  141. package/dist/i3s-server/routes/slpk-router.d.ts.map +1 -0
  142. package/dist/i3s-server/routes/slpk-router.js +33 -0
  143. package/dist/i3s-server/utils/create-scene-server.d.ts +11 -0
  144. package/dist/i3s-server/utils/create-scene-server.d.ts.map +1 -0
  145. package/dist/i3s-server/utils/create-scene-server.js +14 -0
  146. package/dist/lib/utils/file-utils.d.ts.map +1 -1
  147. package/dist/lib/utils/file-utils.js +2 -1
  148. package/dist/lib/utils/geometry-utils.d.ts +9 -0
  149. package/dist/lib/utils/geometry-utils.d.ts.map +1 -0
  150. package/dist/lib/utils/geometry-utils.js +18 -0
  151. package/dist/lib/utils/lod-conversion-utils.d.ts +3 -2
  152. package/dist/lib/utils/lod-conversion-utils.d.ts.map +1 -1
  153. package/dist/lib/utils/lod-conversion-utils.js +1 -1
  154. package/package.json +15 -16
  155. package/src/3d-tiles-converter/3d-tiles-converter.ts +9 -8
  156. package/src/3d-tiles-converter/helpers/b3dm-converter.ts +2 -16
  157. package/src/deps-installer/deps-installer.ts +4 -4
  158. package/src/i3s-attributes-worker.ts +11 -2
  159. package/src/i3s-converter/helpers/batch-ids-extensions.ts +15 -19
  160. package/src/i3s-converter/helpers/coordinate-converter.ts +11 -10
  161. package/src/i3s-converter/helpers/geometry-converter.ts +154 -95
  162. package/src/i3s-converter/helpers/gltf-attributes.ts +85 -25
  163. package/src/i3s-converter/helpers/load-3d-tiles.ts +68 -0
  164. package/src/i3s-converter/helpers/node-index-document.ts +22 -2
  165. package/src/i3s-converter/helpers/preprocess-3d-tiles.ts +81 -0
  166. package/src/i3s-converter/helpers/tileset-traversal.ts +51 -0
  167. package/src/i3s-converter/i3s-converter.ts +229 -178
  168. package/src/i3s-converter/types.ts +20 -0
  169. package/src/i3s-server/README.md +19 -0
  170. package/src/i3s-server/app.js +8 -1
  171. package/src/i3s-server/controllers/slpk-controller.js +38 -0
  172. package/src/i3s-server/routes/slpk-router.js +33 -0
  173. package/src/i3s-server/utils/create-scene-server.js +15 -0
  174. package/src/lib/utils/file-utils.ts +2 -1
  175. package/src/lib/utils/geometry-utils.ts +14 -0
  176. package/src/lib/utils/lod-conversion-utils.ts +6 -2
@@ -0,0 +1,9 @@
1
+ /**
2
+ * luma.gl can not work without indices now:
3
+ * https://github.com/visgl/luma.gl/blob/d8cad75b9f8ca3e578cf078ed9d19e619c2ddbc9/modules/experimental/src/gltf/gltf-instantiator.js#L115
4
+ * This method generates syntetic indices array: [0, 1, 2, 3, .... , vertexCount-1]
5
+ * @param {number} vertexCount - vertex count in the geometry
6
+ * @returns {Uint32Array} indices array.
7
+ */
8
+ export declare const generateSyntheticIndices: (vertexCount: number) => Uint32Array;
9
+ //# sourceMappingURL=geometry-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometry-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/geometry-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,gBAAiB,MAAM,KAAG,WAM9D,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateSyntheticIndices = void 0;
4
+ /**
5
+ * luma.gl can not work without indices now:
6
+ * https://github.com/visgl/luma.gl/blob/d8cad75b9f8ca3e578cf078ed9d19e619c2ddbc9/modules/experimental/src/gltf/gltf-instantiator.js#L115
7
+ * This method generates syntetic indices array: [0, 1, 2, 3, .... , vertexCount-1]
8
+ * @param {number} vertexCount - vertex count in the geometry
9
+ * @returns {Uint32Array} indices array.
10
+ */
11
+ const generateSyntheticIndices = (vertexCount) => {
12
+ const result = new Uint32Array(vertexCount);
13
+ for (let index = 0; index < vertexCount; index++) {
14
+ result[index] = index;
15
+ }
16
+ return result;
17
+ };
18
+ exports.generateSyntheticIndices = generateSyntheticIndices;
@@ -1,3 +1,4 @@
1
+ import { Tiles3DTileJSONPostprocessed } from '@loaders.gl/3d-tiles';
1
2
  import { BoundingVolumes } from '@loaders.gl/i3s';
2
3
  import { Tile3D } from '@loaders.gl/tiles';
3
4
  /**
@@ -13,7 +14,7 @@ import { Tile3D } from '@loaders.gl/tiles';
13
14
  * To avoid infinity values when we do calculations of maxError we shold replace 0 with value which allows us
14
15
  * to make child maxError bigger than his parent maxError.
15
16
  *
16
- * @param tile - 3d-tiles tile Object
17
+ * @param tile - 3d-tiles tile JSON
17
18
  * @param coordinates - node converted coordinates
18
19
  * @returns An array of LOD metrics in format compatible with i3s 3DNodeIndexDocument.lodSelection
19
20
  * @example
@@ -28,7 +29,7 @@ import { Tile3D } from '@loaders.gl/tiles';
28
29
  }
29
30
  ]
30
31
  */
31
- export declare function convertGeometricErrorToScreenThreshold(tile: Tile3D, coordinates: BoundingVolumes): {
32
+ export declare function convertGeometricErrorToScreenThreshold(tile: Tiles3DTileJSONPostprocessed, coordinates: BoundingVolumes): {
32
33
  metricType: string;
33
34
  maxError: number;
34
35
  }[];
@@ -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,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AAIzC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,sCAAsC,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe;gBAC9D,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,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"}
@@ -16,7 +16,7 @@ const DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR = 16;
16
16
  * To avoid infinity values when we do calculations of maxError we shold replace 0 with value which allows us
17
17
  * to make child maxError bigger than his parent maxError.
18
18
  *
19
- * @param tile - 3d-tiles tile Object
19
+ * @param tile - 3d-tiles tile JSON
20
20
  * @param coordinates - node converted coordinates
21
21
  * @returns An array of LOD metrics in format compatible with i3s 3DNodeIndexDocument.lodSelection
22
22
  * @example
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/tile-converter",
3
- "version": "4.0.0-alpha.6",
3
+ "version": "4.0.0-alpha.8",
4
4
  "description": "Converter",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -44,19 +44,18 @@
44
44
  "build-3d-tiles-attributes-worker": "esbuild src/workers/3d-tiles-attributes-worker.ts --outfile=dist/3d-tiles-attributes-worker.js --platform=node --target=esnext,node14 --external:join-images --minify --bundle --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\""
45
45
  },
46
46
  "dependencies": {
47
- "@loaders.gl/3d-tiles": "4.0.0-alpha.6",
48
- "@loaders.gl/crypto": "4.0.0-alpha.6",
49
- "@loaders.gl/draco": "4.0.0-alpha.6",
50
- "@loaders.gl/gltf": "4.0.0-alpha.6",
51
- "@loaders.gl/i3s": "4.0.0-alpha.6",
52
- "@loaders.gl/images": "4.0.0-alpha.6",
53
- "@loaders.gl/loader-utils": "4.0.0-alpha.6",
54
- "@loaders.gl/polyfills": "4.0.0-alpha.6",
55
- "@loaders.gl/schema": "4.0.0-alpha.6",
56
- "@loaders.gl/textures": "4.0.0-alpha.6",
57
- "@loaders.gl/tiles": "4.0.0-alpha.6",
58
- "@loaders.gl/worker-utils": "4.0.0-alpha.6",
59
- "@loaders.gl/zip": "4.0.0-alpha.6",
47
+ "@loaders.gl/3d-tiles": "4.0.0-alpha.8",
48
+ "@loaders.gl/crypto": "4.0.0-alpha.8",
49
+ "@loaders.gl/draco": "4.0.0-alpha.8",
50
+ "@loaders.gl/gltf": "4.0.0-alpha.8",
51
+ "@loaders.gl/i3s": "4.0.0-alpha.8",
52
+ "@loaders.gl/images": "4.0.0-alpha.8",
53
+ "@loaders.gl/loader-utils": "4.0.0-alpha.8",
54
+ "@loaders.gl/polyfills": "4.0.0-alpha.8",
55
+ "@loaders.gl/textures": "4.0.0-alpha.8",
56
+ "@loaders.gl/tiles": "4.0.0-alpha.8",
57
+ "@loaders.gl/worker-utils": "4.0.0-alpha.8",
58
+ "@loaders.gl/zip": "4.0.0-alpha.8",
60
59
  "@math.gl/core": "^3.5.1",
61
60
  "@math.gl/culling": "^3.5.1",
62
61
  "@math.gl/geoid": "^3.5.1",
@@ -73,11 +72,11 @@
73
72
  "uuid": "^8.1.0"
74
73
  },
75
74
  "peerDependencies": {
76
- "@loaders.gl/core": "4.0.0-alpha.5"
75
+ "@loaders.gl/core": "4.0.0-alpha.6"
77
76
  },
78
77
  "quarantinedDependencies": {
79
78
  "join-images": "^1.1.3",
80
79
  "sharp": "^0.31.3"
81
80
  },
82
- "gitHead": "acc1985050dfaa0f1f0c066f8da5bce7454a046c"
81
+ "gitHead": "c35d6640c8d26deab99e277a8e698b5174233789"
83
82
  }
@@ -1,5 +1,5 @@
1
1
  import type {AttributeStorageInfo, FeatureAttribute, NodeReference} from '@loaders.gl/i3s';
2
- import type {Node3D} from '@loaders.gl/3d-tiles';
2
+ import type {Tiles3DTileJSON} from '@loaders.gl/3d-tiles';
3
3
 
4
4
  import {join} from 'path';
5
5
  import process from 'process';
@@ -86,10 +86,11 @@ export default class Tiles3DConverter {
86
86
  loadOptions: {
87
87
  _nodeWorkers: true,
88
88
  reuseWorkers: true,
89
- 'i3s-content-nodejs': {
90
- workerUrl: './modules/i3s/dist/i3s-content-nodejs-worker.js'
91
- },
92
89
  i3s: {coordinateSystem: COORDINATE_SYSTEM.LNGLAT_OFFSETS, decodeTextures: false}
90
+ // TODO should no longer be needed with new workers
91
+ // 'i3s-content-nodejs': {
92
+ // workerUrl: './modules/i3s/dist/i3s-content-nodejs-worker.js'
93
+ // }
93
94
  }
94
95
  });
95
96
 
@@ -108,7 +109,7 @@ export default class Tiles3DConverter {
108
109
  // do nothing
109
110
  }
110
111
 
111
- const rootTile: Node3D = {
112
+ const rootTile: Tiles3DTileJSON = {
112
113
  boundingVolume: {
113
114
  box: i3sObbTo3dTilesObb(rootNode.header.obb, this.geoidHeightModel)
114
115
  },
@@ -137,7 +138,7 @@ export default class Tiles3DConverter {
137
138
  */
138
139
  private async convertChildNode(
139
140
  parentSourceNode: Tile3D,
140
- parentNode: Node3D,
141
+ parentNode: Tiles3DTileJSON,
141
142
  level: number,
142
143
  childNodeInfo: NodeReference
143
144
  ): Promise<void> {
@@ -159,7 +160,7 @@ export default class Tiles3DConverter {
159
160
  const boundingVolume = {
160
161
  box: i3sObbTo3dTilesObb(sourceChild.header.obb, this.geoidHeightModel)
161
162
  };
162
- const child: Node3D = {
163
+ const child: Tiles3DTileJSON = {
163
164
  boundingVolume,
164
165
  geometricError: convertScreenThresholdToGeometricError(sourceChild),
165
166
  children: []
@@ -197,7 +198,7 @@ export default class Tiles3DConverter {
197
198
  */
198
199
  private async _addChildren(
199
200
  parentSourceNode: Tile3D,
200
- parentNode: Node3D,
201
+ parentNode: Tiles3DTileJSON,
201
202
  level: number
202
203
  ): Promise<void> {
203
204
  if (this.options.maxDepth && level > this.options.maxDepth) {
@@ -6,6 +6,7 @@ import {Tile3DWriter} from '@loaders.gl/3d-tiles';
6
6
  import {Matrix4, Vector3} from '@math.gl/core';
7
7
  import {Ellipsoid} from '@math.gl/geospatial';
8
8
  import {convertTextureAtlas} from './texture-atlas';
9
+ import {generateSyntheticIndices} from '../../lib/utils/geometry-utils';
9
10
 
10
11
  const Z_UP_TO_Y_UP_MATRIX = new Matrix4([1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
11
12
  const scratchVector = new Vector3();
@@ -85,7 +86,7 @@ export default class B3dmConverter {
85
86
  delete attributes.normals;
86
87
  }
87
88
  const indices =
88
- originalIndices || this._generateSynteticIndices(positionsValue.length / positions.size);
89
+ originalIndices || generateSyntheticIndices(positionsValue.length / positions.size);
89
90
  const meshIndex = gltfBuilder.addMesh({
90
91
  attributes,
91
92
  indices,
@@ -191,21 +192,6 @@ export default class B3dmConverter {
191
192
  };
192
193
  }
193
194
 
194
- /**
195
- * luma.gl can not work without indices now:
196
- * https://github.com/visgl/luma.gl/blob/d8cad75b9f8ca3e578cf078ed9d19e619c2ddbc9/modules/experimental/src/gltf/gltf-instantiator.js#L115
197
- * This method generates syntetic indices array: [0, 1, 2, 3, .... , vertexCount-1]
198
- * @param {number} vertexCount - vertex count in the geometry
199
- * @returns {Uint32Array} indices array.
200
- */
201
- _generateSynteticIndices(vertexCount) {
202
- const result = new Uint32Array(vertexCount);
203
- for (let index = 0; index < vertexCount; index++) {
204
- result.set([index], index);
205
- }
206
- return result;
207
- }
208
-
209
195
  /**
210
196
  * Deduce mime type by format from `textureSetDefinition.formats[0].format`
211
197
  * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/textureSetDefinitionFormat.cmn.md
@@ -35,13 +35,13 @@ export class DepsInstaller {
35
35
  await writeFile(depsPath, new Uint8Array(fileMap['geoids/egm2008-5.pgm']), 'egm2008-5.pgm');
36
36
 
37
37
  console.log('Installing "I3S Content Loader worker"'); // eslint-disable-line no-console
38
- await this.installWorker('i3s', 'i3s-content-nodejs-worker.js', workersPath);
38
+ await this.installWorker('i3s', 'i3s-content-worker-node.js', workersPath);
39
39
 
40
40
  console.log('Installing "Draco Loader worker"'); // eslint-disable-line no-console
41
- await this.installWorker('draco', 'draco-nodejs-worker.js', workersPath);
41
+ await this.installWorker('draco', 'draco-worker-node.js', workersPath);
42
42
 
43
43
  console.log('Installing "Basis Loader worker"'); // eslint-disable-line no-console
44
- await this.installWorker('textures', 'basis-nodejs-worker.js', workersPath);
44
+ await this.installWorker('textures', 'basis-worker-node.js', workersPath);
45
45
 
46
46
  console.log('Installing "join-images" npm package');
47
47
  const childProcess = new ChildProcessProxy();
@@ -50,7 +50,7 @@ export class DepsInstaller {
50
50
  // `npm install sharp join-images` works unstable. It fails because installed `sharp` version
51
51
  // may be different from the version required by `join-images`. Pointing to specific versions
52
52
  // resolve this issue
53
- arguments: ['install', 'sharp@^0.30.4', 'join-images@^1.1.3'],
53
+ arguments: ['install', 'sharp@0.30.4', 'join-images@1.1.3'],
54
54
  wait: 0
55
55
  });
56
56
 
@@ -1,7 +1,7 @@
1
1
  import type {WorkerObject} from '@loaders.gl/worker-utils';
2
2
  import type {ConvertedAttributes} from './i3s-converter/types';
3
3
  import type {Matrix4, Vector3} from '@math.gl/core';
4
- import type {GLTFImagePostprocessed, GLTFNodePostprocessed} from '@loaders.gl/gltf';
4
+ import type {GLTFNodePostprocessed} from '@loaders.gl/gltf';
5
5
 
6
6
  import {processOnWorker} from '@loaders.gl/worker-utils';
7
7
 
@@ -16,10 +16,19 @@ export type I3SAttributesWorkerOptions = {
16
16
  source: string;
17
17
  };
18
18
 
19
+ export type TextureImageProperties = {
20
+ data: Uint8Array;
21
+ compressed?: boolean;
22
+ height?: number;
23
+ width?: number;
24
+ components?: number;
25
+ mimeType?: string;
26
+ };
27
+
19
28
  export type B3DMAttributesData = {
20
29
  gltfMaterials?: {id: string}[];
21
30
  nodes: GLTFNodePostprocessed[];
22
- images: GLTFImagePostprocessed[];
31
+ images: (null | TextureImageProperties)[];
23
32
  cartographicOrigin: Vector3;
24
33
  cartesianModelMatrix: Matrix4;
25
34
  };
@@ -1,12 +1,11 @@
1
- import {
2
- GLTFAccessorPostprocessed,
3
- GLTFImagePostprocessed,
4
- GLTFMeshPrimitivePostprocessed
5
- } from '@loaders.gl/gltf';
1
+ import {GLTFAccessorPostprocessed, GLTFMeshPrimitivePostprocessed} from '@loaders.gl/gltf';
2
+ import type {NumericArray} from '@loaders.gl/loader-utils';
6
3
  import type {
7
4
  GLTF_EXT_feature_metadata_attribute,
8
5
  GLTF_EXT_feature_metadata_primitive
9
- } from 'modules/gltf/src/lib/types/gltf-json-schema';
6
+ } from '@loaders.gl/gltf';
7
+ import {TypedArray} from '@math.gl/core';
8
+ import {TextureImageProperties} from '../../i3s-attributes-worker';
10
9
 
11
10
  const EXT_MESH_FEATURES = 'EXT_mesh_features';
12
11
  const EXT_FEATURE_METADATA = 'EXT_feature_metadata';
@@ -22,8 +21,8 @@ export function handleBatchIdsExtensions(
22
21
  [key: string]: GLTFAccessorPostprocessed;
23
22
  },
24
23
  primitive: GLTFMeshPrimitivePostprocessed,
25
- images: GLTFImagePostprocessed[]
26
- ): number[] {
24
+ images: (TextureImageProperties | null)[]
25
+ ): NumericArray {
27
26
  const extensions = primitive?.extensions;
28
27
 
29
28
  if (!extensions) {
@@ -61,8 +60,8 @@ function handleExtFeatureMetadataExtension(
61
60
  [key: string]: GLTFAccessorPostprocessed;
62
61
  },
63
62
  extFeatureMetadata: GLTF_EXT_feature_metadata_primitive,
64
- images: GLTFImagePostprocessed[]
65
- ): number[] {
63
+ images: (TextureImageProperties | null)[]
64
+ ): NumericArray {
66
65
  // Take only first extension object to get batchIds attribute name.
67
66
  const featureIdAttribute = extFeatureMetadata?.featureIdAttributes?.[0];
68
67
 
@@ -98,12 +97,9 @@ function handleExtFeatureMetadataExtension(
98
97
  const featureTexture =
99
98
  extFeatureMetadata?.featureTextures && extFeatureMetadata?.featureTextures[0];
100
99
 
101
- /**
102
- * TODO need to get batchIds from root extension
103
- */
104
100
  if (featureTexture) {
105
- console.warn("EXT_feature_metadata doesn't yet support featureTextures in primitive");
106
- return [];
101
+ const batchIdsAttribute = attributes[featureTexture];
102
+ return batchIdsAttribute.value;
107
103
  }
108
104
 
109
105
  return [];
@@ -151,8 +147,8 @@ function generateImplicitFeatureIds(
151
147
  */
152
148
  function generateBatchIdsFromTexture(
153
149
  featureIdTexture: GLTF_EXT_feature_metadata_attribute,
154
- textureCoordinates: Float32Array,
155
- images: GLTFImagePostprocessed[]
150
+ textureCoordinates: TypedArray,
151
+ images: (TextureImageProperties | null)[]
156
152
  ) {
157
153
  if (!images?.length) {
158
154
  return [];
@@ -176,7 +172,7 @@ function generateBatchIdsFromTexture(
176
172
  const batchIds: number[] = [];
177
173
  const channels = CHANNELS_MAP[featureChannel];
178
174
 
179
- if (!image.compressed) {
175
+ if (image && image?.width && image?.height && image?.components) {
180
176
  for (let index = 0; index < textureCoordinates.length; index += 2) {
181
177
  const u = textureCoordinates[index];
182
178
  const v = textureCoordinates[index + 1];
@@ -190,7 +186,7 @@ function generateBatchIdsFromTexture(
190
186
  batchIds.push(batchId);
191
187
  }
192
188
  } else {
193
- console.warn(`Can't get batch Ids from ${image.mimeType} compressed texture`);
189
+ console.warn(`Can't get batch Ids from ${image?.mimeType || ''} compressed texture`);
194
190
  }
195
191
 
196
192
  return batchIds;
@@ -8,34 +8,35 @@ import {
8
8
  makeBoundingSphereFromPoints,
9
9
  BoundingSphere
10
10
  } from '@math.gl/culling';
11
- import {Tile3D} from '@loaders.gl/tiles';
12
11
  import {Geoid} from '@math.gl/geoid';
13
12
 
14
13
  /**
15
14
  * Create bounding volumes object from tile and geoid height model.
16
- * @param tile
17
- * @param geoidHeightModel
15
+ * @param sourceBoundingVolume - initialized bounding volume of the source tile
16
+ * @param geoidHeightModel - instance of Geoid class that converts elevation from geoidal to ellipsoidal and back
18
17
  * @returns - Bounding volumes object
19
18
  */
20
- export function createBoundingVolumes(tile: Tile3D, geoidHeightModel: Geoid): BoundingVolumes {
19
+ export function createBoundingVolumes(
20
+ sourceBoundingVolume: OrientedBoundingBox | BoundingSphere,
21
+ geoidHeightModel: Geoid
22
+ ): BoundingVolumes {
21
23
  let radius;
22
24
  let halfSize;
23
25
  let quaternion;
24
26
 
25
- const boundingVolume = tile.boundingVolume;
26
27
  const cartographicCenter = Ellipsoid.WGS84.cartesianToCartographic(
27
- boundingVolume.center,
28
+ sourceBoundingVolume.center,
28
29
  new Vector3()
29
30
  );
30
31
  cartographicCenter[2] =
31
32
  cartographicCenter[2] -
32
33
  geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);
33
- if (boundingVolume instanceof OrientedBoundingBox) {
34
- halfSize = boundingVolume.halfSize;
34
+ if (sourceBoundingVolume instanceof OrientedBoundingBox) {
35
+ halfSize = sourceBoundingVolume.halfSize;
35
36
  radius = new Vector3(halfSize[0], halfSize[1], halfSize[2]).len();
36
- quaternion = boundingVolume.quaternion;
37
+ quaternion = sourceBoundingVolume.quaternion;
37
38
  } else {
38
- radius = tile.boundingVolume.radius;
39
+ radius = sourceBoundingVolume.radius;
39
40
  halfSize = [radius, radius, radius];
40
41
  quaternion = new Quaternion()
41
42
  .fromMatrix3(new Matrix3([halfSize[0], 0, 0, 0, halfSize[1], 0, 0, 0, halfSize[2]]))