@loaders.gl/tile-converter 4.4.0-alpha.1 → 4.4.0-alpha.9

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 (166) hide show
  1. package/dist/converter.min.cjs +89 -98
  2. package/dist/i3s-server/bin/i3s-server.min.cjs +78 -78
  3. package/package.json +17 -17
  4. package/src/3d-tiles-converter/3d-tiles-converter.ts +11 -7
  5. package/src/3d-tiles-converter/helpers/load-i3s.ts +5 -5
  6. package/src/converter-cli.ts +2 -2
  7. package/src/i3s-converter/helpers/geometry-converter.ts +17 -1
  8. package/src/i3s-converter/helpers/load-3d-tiles.ts +24 -9
  9. package/src/i3s-converter/i3s-converter.ts +25 -9
  10. package/src/i3s-server/controllers/slpk-controller.ts +2 -2
  11. package/src/lib/utils/compress-util.ts +1 -0
  12. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +0 -115
  13. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +0 -1
  14. package/dist/3d-tiles-converter/3d-tiles-converter.js +0 -388
  15. package/dist/3d-tiles-converter/helpers/3d-tiles-content-converter.d.ts +0 -88
  16. package/dist/3d-tiles-converter/helpers/3d-tiles-content-converter.d.ts.map +0 -1
  17. package/dist/3d-tiles-converter/helpers/3d-tiles-content-converter.js +0 -380
  18. package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts +0 -13
  19. package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts.map +0 -1
  20. package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +0 -19
  21. package/dist/3d-tiles-converter/helpers/load-i3s.d.ts +0 -37
  22. package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +0 -1
  23. package/dist/3d-tiles-converter/helpers/load-i3s.js +0 -98
  24. package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts +0 -10
  25. package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts.map +0 -1
  26. package/dist/3d-tiles-converter/helpers/texture-atlas.js +0 -50
  27. package/dist/3d-tiles-converter/json-templates/tileset.d.ts +0 -15
  28. package/dist/3d-tiles-converter/json-templates/tileset.d.ts.map +0 -1
  29. package/dist/3d-tiles-converter/json-templates/tileset.js +0 -39
  30. package/dist/constants.d.ts +0 -3
  31. package/dist/constants.d.ts.map +0 -1
  32. package/dist/constants.js +0 -2
  33. package/dist/converter-cli.d.ts +0 -2
  34. package/dist/converter-cli.d.ts.map +0 -1
  35. package/dist/converter-cli.js +0 -290
  36. package/dist/deps-installer/deps-installer.d.ts +0 -19
  37. package/dist/deps-installer/deps-installer.d.ts.map +0 -1
  38. package/dist/deps-installer/deps-installer.js +0 -95
  39. package/dist/i3s-converter/helpers/attribute-metadata-info.d.ts +0 -84
  40. package/dist/i3s-converter/helpers/attribute-metadata-info.d.ts.map +0 -1
  41. package/dist/i3s-converter/helpers/attribute-metadata-info.js +0 -219
  42. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +0 -26
  43. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +0 -1
  44. package/dist/i3s-converter/helpers/batch-ids-extensions.js +0 -165
  45. package/dist/i3s-converter/helpers/coordinate-converter.d.ts +0 -39
  46. package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +0 -1
  47. package/dist/i3s-converter/helpers/coordinate-converter.js +0 -118
  48. package/dist/i3s-converter/helpers/create-scene-server-path.d.ts +0 -9
  49. package/dist/i3s-converter/helpers/create-scene-server-path.d.ts.map +0 -1
  50. package/dist/i3s-converter/helpers/create-scene-server-path.js +0 -21
  51. package/dist/i3s-converter/helpers/feature-attributes.d.ts +0 -54
  52. package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +0 -1
  53. package/dist/i3s-converter/helpers/feature-attributes.js +0 -193
  54. package/dist/i3s-converter/helpers/geometry-attributes.d.ts +0 -8
  55. package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +0 -1
  56. package/dist/i3s-converter/helpers/geometry-attributes.js +0 -226
  57. package/dist/i3s-converter/helpers/geometry-converter.d.ts +0 -60
  58. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +0 -1
  59. package/dist/i3s-converter/helpers/geometry-converter.js +0 -1309
  60. package/dist/i3s-converter/helpers/gltf-attributes.d.ts +0 -28
  61. package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +0 -1
  62. package/dist/i3s-converter/helpers/gltf-attributes.js +0 -122
  63. package/dist/i3s-converter/helpers/load-3d-tiles.d.ts +0 -33
  64. package/dist/i3s-converter/helpers/load-3d-tiles.d.ts.map +0 -1
  65. package/dist/i3s-converter/helpers/load-3d-tiles.js +0 -121
  66. package/dist/i3s-converter/helpers/node-debug.d.ts +0 -8
  67. package/dist/i3s-converter/helpers/node-debug.d.ts.map +0 -1
  68. package/dist/i3s-converter/helpers/node-debug.js +0 -116
  69. package/dist/i3s-converter/helpers/node-index-document.d.ts +0 -111
  70. package/dist/i3s-converter/helpers/node-index-document.d.ts.map +0 -1
  71. package/dist/i3s-converter/helpers/node-index-document.js +0 -269
  72. package/dist/i3s-converter/helpers/node-pages.d.ts +0 -156
  73. package/dist/i3s-converter/helpers/node-pages.d.ts.map +0 -1
  74. package/dist/i3s-converter/helpers/node-pages.js +0 -285
  75. package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts +0 -22
  76. package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +0 -1
  77. package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +0 -104
  78. package/dist/i3s-converter/helpers/progress.d.ts +0 -90
  79. package/dist/i3s-converter/helpers/progress.d.ts.map +0 -1
  80. package/dist/i3s-converter/helpers/progress.js +0 -148
  81. package/dist/i3s-converter/helpers/tileset-traversal.d.ts +0 -32
  82. package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +0 -1
  83. package/dist/i3s-converter/helpers/tileset-traversal.js +0 -34
  84. package/dist/i3s-converter/i3s-converter.d.ts +0 -312
  85. package/dist/i3s-converter/i3s-converter.d.ts.map +0 -1
  86. package/dist/i3s-converter/i3s-converter.js +0 -1191
  87. package/dist/i3s-converter/json-templates/geometry-definitions.d.ts +0 -7
  88. package/dist/i3s-converter/json-templates/geometry-definitions.d.ts.map +0 -1
  89. package/dist/i3s-converter/json-templates/geometry-definitions.js +0 -80
  90. package/dist/i3s-converter/json-templates/layers.d.ts +0 -70
  91. package/dist/i3s-converter/json-templates/layers.d.ts.map +0 -1
  92. package/dist/i3s-converter/json-templates/layers.js +0 -132
  93. package/dist/i3s-converter/json-templates/metadata.d.ts +0 -22
  94. package/dist/i3s-converter/json-templates/metadata.d.ts.map +0 -1
  95. package/dist/i3s-converter/json-templates/metadata.js +0 -21
  96. package/dist/i3s-converter/json-templates/node.d.ts +0 -61
  97. package/dist/i3s-converter/json-templates/node.d.ts.map +0 -1
  98. package/dist/i3s-converter/json-templates/node.js +0 -82
  99. package/dist/i3s-converter/json-templates/scene-server.d.ts +0 -28
  100. package/dist/i3s-converter/json-templates/scene-server.d.ts.map +0 -1
  101. package/dist/i3s-converter/json-templates/scene-server.js +0 -27
  102. package/dist/i3s-converter/json-templates/shared-resources.d.ts +0 -14
  103. package/dist/i3s-converter/json-templates/shared-resources.d.ts.map +0 -1
  104. package/dist/i3s-converter/json-templates/shared-resources.js +0 -122
  105. package/dist/i3s-converter/json-templates/store.d.ts +0 -95
  106. package/dist/i3s-converter/json-templates/store.d.ts.map +0 -1
  107. package/dist/i3s-converter/json-templates/store.js +0 -100
  108. package/dist/i3s-converter/types.d.ts +0 -226
  109. package/dist/i3s-converter/types.d.ts.map +0 -1
  110. package/dist/i3s-converter/types.js +0 -37
  111. package/dist/i3s-server/app.d.ts +0 -3
  112. package/dist/i3s-server/app.d.ts.map +0 -1
  113. package/dist/i3s-server/app.js +0 -31
  114. package/dist/i3s-server/bin/www.d.ts +0 -3
  115. package/dist/i3s-server/bin/www.d.ts.map +0 -1
  116. package/dist/i3s-server/bin/www.js +0 -46
  117. package/dist/i3s-server/controllers/slpk-controller.d.ts +0 -13
  118. package/dist/i3s-server/controllers/slpk-controller.d.ts.map +0 -1
  119. package/dist/i3s-server/controllers/slpk-controller.js +0 -32
  120. package/dist/i3s-server/routes/slpk-router.d.ts +0 -3
  121. package/dist/i3s-server/routes/slpk-router.d.ts.map +0 -1
  122. package/dist/i3s-server/routes/slpk-router.js +0 -40
  123. package/dist/i3s-server/utils/create-scene-server.d.ts +0 -17
  124. package/dist/i3s-server/utils/create-scene-server.d.ts.map +0 -1
  125. package/dist/i3s-server/utils/create-scene-server.js +0 -18
  126. package/dist/i3s-server/utils/server-utils.d.ts +0 -21
  127. package/dist/i3s-server/utils/server-utils.d.ts.map +0 -1
  128. package/dist/i3s-server/utils/server-utils.js +0 -60
  129. package/dist/index.cjs +0 -6228
  130. package/dist/index.cjs.map +0 -7
  131. package/dist/index.d.ts +0 -3
  132. package/dist/index.d.ts.map +0 -1
  133. package/dist/index.js +0 -2
  134. package/dist/lib/json-schemas/conversion-dump-json-schema.d.ts +0 -463
  135. package/dist/lib/json-schemas/conversion-dump-json-schema.d.ts.map +0 -1
  136. package/dist/lib/json-schemas/conversion-dump-json-schema.js +0 -285
  137. package/dist/lib/utils/cli-utils.d.ts +0 -34
  138. package/dist/lib/utils/cli-utils.d.ts.map +0 -1
  139. package/dist/lib/utils/cli-utils.js +0 -76
  140. package/dist/lib/utils/compress-util.d.ts +0 -8
  141. package/dist/lib/utils/compress-util.d.ts.map +0 -1
  142. package/dist/lib/utils/compress-util.js +0 -25
  143. package/dist/lib/utils/conversion-dump.d.ts +0 -147
  144. package/dist/lib/utils/conversion-dump.d.ts.map +0 -1
  145. package/dist/lib/utils/conversion-dump.js +0 -257
  146. package/dist/lib/utils/file-utils.d.ts +0 -57
  147. package/dist/lib/utils/file-utils.d.ts.map +0 -1
  148. package/dist/lib/utils/file-utils.js +0 -140
  149. package/dist/lib/utils/geometry-utils.d.ts +0 -9
  150. package/dist/lib/utils/geometry-utils.d.ts.map +0 -1
  151. package/dist/lib/utils/geometry-utils.js +0 -14
  152. package/dist/lib/utils/lod-conversion-utils.d.ts +0 -42
  153. package/dist/lib/utils/lod-conversion-utils.d.ts.map +0 -1
  154. package/dist/lib/utils/lod-conversion-utils.js +0 -71
  155. package/dist/lib/utils/queue.d.ts +0 -7
  156. package/dist/lib/utils/queue.d.ts.map +0 -1
  157. package/dist/lib/utils/queue.js +0 -14
  158. package/dist/lib/utils/statistic-utils.d.ts +0 -20
  159. package/dist/lib/utils/statistic-utils.d.ts.map +0 -1
  160. package/dist/lib/utils/statistic-utils.js +0 -88
  161. package/dist/lib/utils/write-queue.d.ts +0 -44
  162. package/dist/lib/utils/write-queue.d.ts.map +0 -1
  163. package/dist/lib/utils/write-queue.js +0 -82
  164. package/dist/pgm-loader.d.ts +0 -28
  165. package/dist/pgm-loader.d.ts.map +0 -1
  166. package/dist/pgm-loader.js +0 -24
@@ -1,28 +0,0 @@
1
- import type { Tiles3DTileContent } from '@loaders.gl/3d-tiles';
2
- import { Matrix4, Vector3 } from '@math.gl/core';
3
- import { BoundingSphere, OrientedBoundingBox } from '@math.gl/culling';
4
- import { GLTFAttributesData } from "../types.js";
5
- /**
6
- * Prepare attributes for conversion to avoid binary data breaking in worker thread.
7
- * @param tileContent - 3DTiles tile content
8
- * @param tileTransform - transformation matrix of the tile, calculated recursively multiplying
9
- * transform of all parent tiles and transform of the current tile
10
- * @param boundingVolume - initialized bounding volume of the source tile
11
- * @returns 3DTiles content data, prepared for conversion
12
- */
13
- export declare function prepareDataForAttributesConversion(tileContent: Tiles3DTileContent, tileTransform: Matrix4, boundingVolume: OrientedBoundingBox | BoundingSphere): GLTFAttributesData;
14
- /**
15
- * Calculate transformation properties to transform vertex attributes (POSITION, NORMAL, etc.)
16
- * from METER_OFFSET coorditantes to LNGLAT_OFFSET coordinates
17
- * @param tileContent - 3DTiles tile content
18
- * @param tileTransform - transformation matrix of the tile, calculated recursively multiplying
19
- * transform of all parent tiles and transform of the current tile
20
- * @param boundingVolume - initialized bounding volume of the source tile
21
- * @returns modelMatrix - transformation matrix to transform coordinates to cartographic coordinates
22
- * cartographicOrigin - tile origin coordinates to calculate offsets
23
- */
24
- export declare function calculateTransformProps(tileContent: Tiles3DTileContent, tileTransform: Matrix4, boundingVolume: OrientedBoundingBox | BoundingSphere): {
25
- modelMatrix: Matrix4;
26
- cartographicOrigin: Vector3;
27
- };
28
- //# sourceMappingURL=gltf-attributes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gltf-attributes.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/gltf-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAC,OAAO,EAAc,OAAO,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAC,kBAAkB,EAAC,oBAAiB;AAE5C;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,CAChD,WAAW,EAAE,kBAAkB,EAC/B,aAAa,EAAE,OAAO,EACtB,cAAc,EAAE,mBAAmB,GAAG,cAAc,GACnD,kBAAkB,CAwCpB;AAqBD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,kBAAkB,EAC/B,aAAa,EAAE,OAAO,EACtB,cAAc,EAAE,mBAAmB,GAAG,cAAc,GACnD;IAAC,WAAW,EAAE,OAAO,CAAC;IAAC,kBAAkB,EAAE,OAAO,CAAA;CAAC,CAkCrD"}
@@ -1,122 +0,0 @@
1
- import { Matrix4, Vector3 } from '@math.gl/core';
2
- import { Ellipsoid } from '@math.gl/geospatial';
3
- /**
4
- * Prepare attributes for conversion to avoid binary data breaking in worker thread.
5
- * @param tileContent - 3DTiles tile content
6
- * @param tileTransform - transformation matrix of the tile, calculated recursively multiplying
7
- * transform of all parent tiles and transform of the current tile
8
- * @param boundingVolume - initialized bounding volume of the source tile
9
- * @returns 3DTiles content data, prepared for conversion
10
- */
11
- export function prepareDataForAttributesConversion(tileContent, tileTransform, boundingVolume) {
12
- const nodes = tileContent.gltf?.scene?.nodes ||
13
- tileContent.gltf?.scenes?.[0]?.nodes ||
14
- tileContent.gltf?.nodes ||
15
- [];
16
- const images = tileContent.gltf?.images?.map((imageObject) => {
17
- // Need data only for uncompressed images because we can't get batchIds from compressed textures.
18
- if (imageObject?.image?.compressed) {
19
- return null;
20
- }
21
- const data = imageObject?.image?.data;
22
- const dataCopy = new Uint8Array(data.length);
23
- dataCopy.set(data);
24
- return {
25
- data: dataCopy,
26
- compressed: false,
27
- height: imageObject.image.height,
28
- width: imageObject.image.width,
29
- components: imageObject.image.components,
30
- mimeType: imageObject.mimeType
31
- };
32
- }) || [];
33
- prepareNodes(nodes);
34
- const { cartographicOrigin, modelMatrix: cartesianModelMatrix } = calculateTransformProps(tileContent, tileTransform, boundingVolume);
35
- return {
36
- nodes,
37
- images,
38
- cartographicOrigin,
39
- cartesianModelMatrix
40
- };
41
- }
42
- /**
43
- * Keep only values for glTF attributes to pass data to worker thread.
44
- * @param attributes - geometry attributes
45
- * @returns attributes with only `value` item
46
- */
47
- function getB3DMAttributesWithoutBufferView(attributes) {
48
- const attributesWithoutBufferView = {};
49
- for (const attributeName in attributes) {
50
- attributesWithoutBufferView[attributeName] = {
51
- value: attributes[attributeName].value
52
- };
53
- }
54
- return attributesWithoutBufferView;
55
- }
56
- /**
57
- * Calculate transformation properties to transform vertex attributes (POSITION, NORMAL, etc.)
58
- * from METER_OFFSET coorditantes to LNGLAT_OFFSET coordinates
59
- * @param tileContent - 3DTiles tile content
60
- * @param tileTransform - transformation matrix of the tile, calculated recursively multiplying
61
- * transform of all parent tiles and transform of the current tile
62
- * @param boundingVolume - initialized bounding volume of the source tile
63
- * @returns modelMatrix - transformation matrix to transform coordinates to cartographic coordinates
64
- * cartographicOrigin - tile origin coordinates to calculate offsets
65
- */
66
- export function calculateTransformProps(tileContent, tileTransform, boundingVolume) {
67
- const { rtcCenter, gltfUpAxis } = tileContent;
68
- const { center } = boundingVolume;
69
- let modelMatrix = new Matrix4(tileTransform);
70
- // Translate if appropriate
71
- if (rtcCenter) {
72
- modelMatrix.translate(rtcCenter);
73
- }
74
- // glTF models need to be rotated from Y to Z up
75
- // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up
76
- switch (gltfUpAxis) {
77
- case 'Z':
78
- break;
79
- case 'Y':
80
- const rotationY = new Matrix4().rotateX(Math.PI / 2);
81
- modelMatrix = modelMatrix.multiplyRight(rotationY);
82
- break;
83
- case 'X':
84
- const rotationX = new Matrix4().rotateY(-Math.PI / 2);
85
- modelMatrix = modelMatrix.multiplyRight(rotationX);
86
- break;
87
- default:
88
- break;
89
- }
90
- const cartesianOrigin = new Vector3(center);
91
- const cartographicOrigin = Ellipsoid.WGS84.cartesianToCartographic(cartesianOrigin, new Vector3());
92
- return { modelMatrix, cartographicOrigin };
93
- }
94
- /**
95
- * Traverse all nodes to replace all sensible data with copy to avoid data corruption in worker.
96
- * @param nodes
97
- */
98
- function prepareNodes(nodes) {
99
- for (let index = 0; index < nodes.length; index++) {
100
- const node = nodes[index];
101
- if (node.mesh) {
102
- nodes[index] = {
103
- ...node,
104
- mesh: {
105
- ...node.mesh,
106
- primitives: node.mesh?.primitives.map((primitive) => ({
107
- ...primitive,
108
- indices: { value: primitive?.indices?.value },
109
- attributes: getB3DMAttributesWithoutBufferView(primitive.attributes),
110
- material: {
111
- id: primitive?.material?.id,
112
- uniqueId: primitive?.material?.uniqueId
113
- }
114
- }))
115
- }
116
- };
117
- }
118
- if (node.children) {
119
- prepareNodes(node.children);
120
- }
121
- }
122
- }
@@ -1,33 +0,0 @@
1
- import type { Tiles3DLoaderOptions, Tiles3DTileContent, Tiles3DTileJSONPostprocessed, Tiles3DTilesetJSONPostprocessed } from '@loaders.gl/3d-tiles';
2
- import { LoaderWithParser } from '@loaders.gl/core';
3
- /**
4
- * Load nested 3DTiles tileset. If the sourceTile is not nested tileset - do nothing
5
- * @param sourceTileset - source root tileset JSON
6
- * @param sourceTile - source tile JSON that is supposed to has link to nested tileset
7
- * @param tilesetLoadOptions - load options for Tiles3DLoader
8
- * @returns nothing
9
- */
10
- export declare const loadNestedTileset: (sourceTileset: Tiles3DTilesetJSONPostprocessed | null, sourceTile: Tiles3DTileJSONPostprocessed, tilesetLoadOptions: Tiles3DLoaderOptions) => Promise<void>;
11
- /**
12
- * Load 3DTiles tile content, that includes glTF object
13
- * @param sourceTileset - source root tileset JSON
14
- * @param sourceTile - source tile JSON that has link to content data
15
- * @param tilesetLoadOptions - load options for Tiles3DLoader
16
- * @returns - 3DTiles tile content or null
17
- */
18
- export declare const loadTile3DContent: (sourceTileset: Tiles3DTilesetJSONPostprocessed | null, sourceTile: Tiles3DTileJSONPostprocessed, tilesetLoadOptions: Tiles3DLoaderOptions) => Promise<Tiles3DTileContent | null>;
19
- /**
20
- * Load a resource with load options and .3tz format support
21
- * @param url - resource URL
22
- * @param loader - loader to parse data (Tiles3DLoader / CesiumIonLoader)
23
- * @param loadOptions - 3d-tiles loader options
24
- * @returns 3d-tiles resource
25
- */
26
- export declare function loadFromArchive(url: string, loader: LoaderWithParser, loadOptions: Tiles3DLoaderOptions): Promise<any>;
27
- /**
28
- * Check if tile is nested tileset
29
- * @param tile - 3DTiles header data
30
- * @returns true if tile is nested tileset
31
- */
32
- export declare function isNestedTileset(tile: Tiles3DTileJSONPostprocessed): boolean;
33
- //# sourceMappingURL=load-3d-tiles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"load-3d-tiles.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/load-3d-tiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,4BAA4B,EAC5B,+BAA+B,EAChC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,gBAAgB,EAAO,MAAM,kBAAkB,CAAC;AAWxD;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,kBACb,+BAA+B,GAAG,IAAI,cACzC,4BAA4B,sBACpB,oBAAoB,KACvC,OAAO,CAAC,IAAI,CAsBd,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,kBACb,+BAA+B,GAAG,IAAI,cACzC,4BAA4B,sBACpB,oBAAoB,KACvC,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAsBnC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,gBAAgB,EACxB,WAAW,EAAE,oBAAoB,gBA6BlC;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,4BAA4B,WAEjE"}
@@ -1,121 +0,0 @@
1
- import { Tiles3DArchive } from '@loaders.gl/3d-tiles';
2
- import { load } from '@loaders.gl/core';
3
- import { FileHandleFile } from '@loaders.gl/loader-utils';
4
- import { CD_HEADER_SIGNATURE, ZipFileSystem, parseHashTable, parseZipCDFileHeader, parseZipLocalFileHeader, searchFromTheEnd } from '@loaders.gl/zip';
5
- /**
6
- * Load nested 3DTiles tileset. If the sourceTile is not nested tileset - do nothing
7
- * @param sourceTileset - source root tileset JSON
8
- * @param sourceTile - source tile JSON that is supposed to has link to nested tileset
9
- * @param tilesetLoadOptions - load options for Tiles3DLoader
10
- * @returns nothing
11
- */
12
- export const loadNestedTileset = async (sourceTileset, sourceTile, tilesetLoadOptions) => {
13
- const isTileset = isNestedTileset(sourceTile);
14
- if (!sourceTileset || !sourceTile.contentUrl || !isTileset) {
15
- return;
16
- }
17
- const loadOptions = {
18
- ...tilesetLoadOptions,
19
- [sourceTileset.loader.id]: {
20
- isTileset,
21
- assetGltfUpAxis: (sourceTileset.asset && sourceTileset.asset.gltfUpAxis) || 'Y'
22
- }
23
- };
24
- const tileContent = await loadFromArchive(sourceTile.contentUrl, sourceTileset.loader, loadOptions);
25
- if (tileContent.root) {
26
- sourceTile.children = [tileContent.root];
27
- }
28
- };
29
- /**
30
- * Load 3DTiles tile content, that includes glTF object
31
- * @param sourceTileset - source root tileset JSON
32
- * @param sourceTile - source tile JSON that has link to content data
33
- * @param tilesetLoadOptions - load options for Tiles3DLoader
34
- * @returns - 3DTiles tile content or null
35
- */
36
- export const loadTile3DContent = async (sourceTileset, sourceTile, tilesetLoadOptions) => {
37
- const isTileset = isNestedTileset(sourceTile);
38
- if (!sourceTileset || !sourceTile.contentUrl || isTileset) {
39
- return null;
40
- }
41
- const loadOptions = {
42
- ...tilesetLoadOptions,
43
- [sourceTileset.loader.id]: {
44
- // @ts-ignore
45
- ...(tilesetLoadOptions[sourceTileset.loader.id] || {}),
46
- isTileset,
47
- assetGltfUpAxis: (sourceTileset.asset && sourceTileset.asset.gltfUpAxis) || 'Y'
48
- }
49
- };
50
- const tileContent = await loadFromArchive(sourceTile.contentUrl, sourceTileset.loader, loadOptions);
51
- return tileContent;
52
- };
53
- /**
54
- * Load a resource with load options and .3tz format support
55
- * @param url - resource URL
56
- * @param loader - loader to parse data (Tiles3DLoader / CesiumIonLoader)
57
- * @param loadOptions - 3d-tiles loader options
58
- * @returns 3d-tiles resource
59
- */
60
- export async function loadFromArchive(url, loader, loadOptions) {
61
- const tz3UrlParts = url.split('.3tz');
62
- let filename;
63
- // No '.3tz'. The file will be loaded with global fetch function
64
- if (tz3UrlParts.length === 1) {
65
- filename = null;
66
- }
67
- else if (tz3UrlParts.length === 2) {
68
- filename = tz3UrlParts[1].slice(1);
69
- if (filename === '') {
70
- filename = 'tileset.json';
71
- }
72
- }
73
- else {
74
- throw new Error('Unexpected URL format');
75
- }
76
- if (filename) {
77
- const tz3Path = `${tz3UrlParts[0]}.3tz`;
78
- const fileProvider = new FileHandleFile(tz3Path);
79
- const hashTable = await loadHashTable(fileProvider);
80
- const archive = new Tiles3DArchive(fileProvider, hashTable, tz3Path);
81
- const fileSystem = new ZipFileSystem(archive);
82
- const content = await load(filename, loader, {
83
- ...loadOptions,
84
- fetch: fileSystem.fetch.bind(fileSystem)
85
- });
86
- await fileSystem.destroy();
87
- return content;
88
- }
89
- return await load(url, loader, loadOptions);
90
- }
91
- /**
92
- * Check if tile is nested tileset
93
- * @param tile - 3DTiles header data
94
- * @returns true if tile is nested tileset
95
- */
96
- export function isNestedTileset(tile) {
97
- return tile?.type === 'json' || tile?.type === '3tz';
98
- }
99
- /**
100
- * Load hash file from 3TZ
101
- * @param fileProvider - binary reader of 3TZ
102
- * @returns hash table of the 3TZ file content or undefined if the hash file is not presented inside
103
- */
104
- async function loadHashTable(fileProvider) {
105
- let hashTable;
106
- const hashCDOffset = await searchFromTheEnd(fileProvider, CD_HEADER_SIGNATURE);
107
- const cdFileHeader = await parseZipCDFileHeader(hashCDOffset, fileProvider);
108
- // '@3dtilesIndex1@' is index file that must be the last in the archive. It allows
109
- // to improve load and read performance when the archive contains a very large number
110
- // of files.
111
- if (cdFileHeader?.fileName === '@3dtilesIndex1@') {
112
- const localFileHeader = await parseZipLocalFileHeader(cdFileHeader.localHeaderOffset, fileProvider);
113
- if (!localFileHeader) {
114
- throw new Error('corrupted 3tz');
115
- }
116
- const fileDataOffset = localFileHeader.fileDataOffset;
117
- const hashFile = await fileProvider.slice(fileDataOffset, fileDataOffset + localFileHeader.compressedSize);
118
- hashTable = parseHashTable(hashFile);
119
- }
120
- return hashTable;
121
- }
@@ -1,8 +0,0 @@
1
- import type { Node3DIndexDocument } from '@loaders.gl/i3s';
2
- /**
3
- * Do validation of bounding volumes for particular node.
4
- * Generates special warnings if there are some issues.
5
- * @param node
6
- */
7
- export declare function validateNodeBoundingVolumes(node: Node3DIndexDocument): string[];
8
- //# sourceMappingURL=node-debug.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"node-debug.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/node-debug.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAM,mBAAmB,EAAM,MAAM,iBAAiB,CAAC;AAiBnE;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,EAAE,CAW/E"}
@@ -1,116 +0,0 @@
1
- import { OrientedBoundingBox, BoundingSphere } from '@math.gl/culling';
2
- import { Vector3 } from '@math.gl/core';
3
- import { Ellipsoid } from '@math.gl/geospatial';
4
- // prettier-ignore
5
- const CUBE_POSITIONS = new Float32Array([
6
- -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1,
7
- -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1,
8
- -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1,
9
- -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1,
10
- 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1,
11
- -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1
12
- ]);
13
- // TODO Unite Tile validation logic in i3s-17-and-debug with this code.
14
- /**
15
- * Do validation of bounding volumes for particular node.
16
- * Generates special warnings if there are some issues.
17
- * @param node
18
- */
19
- export function validateNodeBoundingVolumes(node) {
20
- if (!node?.parentNode?.obb || !node?.parentNode?.mbs) {
21
- return [];
22
- }
23
- const tileWarnings = [];
24
- validateObb(tileWarnings, node);
25
- validateMbs(tileWarnings, node);
26
- return tileWarnings;
27
- }
28
- /**
29
- * Check if child Obb fit into parent Obb.
30
- * @param tileWarnings
31
- * @param node
32
- */
33
- function validateObb(tileWarnings, node) {
34
- // @ts-expect-error
35
- const parentObb = createBoundingBoxFromTileObb(node.parentNode.obb);
36
- const tileVertices = getTileObbVertices(node);
37
- const isTileObbInsideParentObb = isAllVerticesInsideBoundingVolume(parentObb, tileVertices);
38
- if (isTileObbInsideParentObb) {
39
- return;
40
- }
41
- const title = `OBB of Tile (${node.id}) doesn't fit into Parent (${node.parentNode?.id}) tile OBB`;
42
- tileWarnings.push(title);
43
- }
44
- /**
45
- * Check if child Mbs fit into parent Mbs.
46
- * @param tileWarnings
47
- * @param node
48
- */
49
- function validateMbs(tileWarnings, node) {
50
- // @ts-expect-error
51
- const tileMbs = createBoundingSphereFromTileMbs(node.mbs);
52
- // @ts-expect-error
53
- const parentMbs = createBoundingSphereFromTileMbs(node.parentNode.mbs);
54
- const distanceBetweenCenters = tileMbs.center.distanceTo(parentMbs.center);
55
- if (distanceBetweenCenters + tileMbs.radius > parentMbs.radius) {
56
- const title = `MBS of Tile (${node.id}) doesn't fit into Parent (${node.parentNode?.id}) tile MBS`;
57
- tileWarnings.push(title);
58
- }
59
- }
60
- /**
61
- * Generates bounding sphere from mbs
62
- * @param mbs
63
- */
64
- function createBoundingSphereFromTileMbs(mbs) {
65
- return new BoundingSphere([mbs[0], mbs[1], mbs[2]], mbs[3]);
66
- }
67
- /**
68
- * Generates oriented bounding box from tile obb
69
- * @param obb
70
- * @returns
71
- */
72
- function createBoundingBoxFromTileObb(obb) {
73
- const { center, halfSize, quaternion } = obb;
74
- return new OrientedBoundingBox().fromCenterHalfSizeQuaternion(center, halfSize, quaternion);
75
- }
76
- /**
77
- * Get vertices fromnode obb
78
- * TODO check if Obb generates properly
79
- * @param node
80
- */
81
- function getTileObbVertices(node) {
82
- // @ts-expect-error
83
- const halfSize = node.obb.halfSize;
84
- const positions = CUBE_POSITIONS;
85
- // @ts-expect-error
86
- const obbCenterCartesian = Ellipsoid.WGS84.cartographicToCartesian(node.obb.center);
87
- let vertices = [];
88
- for (let i = 0; i < positions.length; i += 3) {
89
- const positionsVector = new Vector3((positions[i] *= halfSize[0]), (positions[i + 1] *= halfSize[1]), (positions[i + 2] *= halfSize[2]));
90
- const rotatedPositions = positionsVector
91
- // @ts-expect-error
92
- .transformByQuaternion(node.obb.quaternion)
93
- .add(obbCenterCartesian);
94
- // @ts-expect-error
95
- vertices = vertices.concat(rotatedPositions);
96
- }
97
- return vertices;
98
- }
99
- /**
100
- * Check if all vertices inside bounding volume
101
- * @param boundingVolume
102
- * @param positions
103
- */
104
- function isAllVerticesInsideBoundingVolume(boundingVolume, positions) {
105
- let isVerticesInsideObb = true;
106
- for (let index = 0; index < positions.length / 3; index += 3) {
107
- const point = [positions[index], positions[index + 1], positions[index + 2]];
108
- const cartographicPoint = Ellipsoid.WGS84.cartesianToCartographic(point);
109
- const distance = boundingVolume.distanceTo(cartographicPoint);
110
- if (distance > 0) {
111
- isVerticesInsideObb = false;
112
- break;
113
- }
114
- }
115
- return isVerticesInsideObb;
116
- }
@@ -1,111 +0,0 @@
1
- import { BoundingVolumes, LodSelection, Node3DIndexDocument, NodeInPage } from '@loaders.gl/i3s';
2
- import I3SConverter from "../i3s-converter.js";
3
- import { I3SConvertedResources } from "../types.js";
4
- import { DumpMetadata } from "../../lib/utils/conversion-dump.js";
5
- /**
6
- * Wrapper for https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md data
7
- * The class allows working with 3DNodeIndexDocument in 2 modes:
8
- * in memory: the data is stored in `data` field
9
- * on disk: the data is written on disk in a file. The file can be rewritten when new childrend or neighbors have to be added
10
- */
11
- export declare class NodeIndexDocument {
12
- /** Node id */
13
- id: string;
14
- /** Id in node pages */
15
- inPageId: number;
16
- /** 3DNodeIndexDocument data */
17
- data: Node3DIndexDocument | null;
18
- /** children */
19
- children: NodeIndexDocument[];
20
- /** converter instance */
21
- private converter;
22
- /**
23
- * Finalized property. It means that all child nodes are saved and their data
24
- * is unloaded
25
- */
26
- private _finalized;
27
- get finalized(): boolean;
28
- /**
29
- * Constructor
30
- * @param id - id of the node in node pages
31
- * @param converter - converter instance
32
- */
33
- constructor(id: number, converter: I3SConverter);
34
- /**
35
- * Add Node3DIndexDocument data to the node
36
- * @param data Node3DIndexDocument data
37
- * @returns this NodeIndexDocument instance (to recurring with constructor)
38
- */
39
- addData(data: Node3DIndexDocument): Promise<NodeIndexDocument>;
40
- /**
41
- * Add child node references
42
- * @param childNodes - child NodeIndexDocument instances
43
- */
44
- addChildren(childNodes: NodeIndexDocument[]): Promise<void>;
45
- /**
46
- * Add neighbors to child nodes of this node
47
- */
48
- addNeighbors(): Promise<void>;
49
- /** Save 3DNodeIndexDocument in file on disk */
50
- save(): Promise<void>;
51
- /** Finalize the node */
52
- private finalize;
53
- /**
54
- * Write 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md
55
- * @param node - Node3DIndexDocument object
56
- */
57
- private write;
58
- /**
59
- * Load 3DNodeIndexDocument data from file on disk
60
- * @returns 3DNodeIndexDocument object
61
- */
62
- private load;
63
- /**
64
- * Unload the Node data
65
- */
66
- private flush;
67
- /**
68
- * Create root node of the tree
69
- * @param boundingVolumes - MBS and OOB bounding volumes data
70
- * @param converter - I3SConverter instance
71
- * @returns instance of NodeIndexDocument
72
- */
73
- static createRootNode(boundingVolumes: BoundingVolumes, converter: I3SConverter): Promise<NodeIndexDocument>;
74
- /**
75
- * Create NodeIndexDocument instance
76
- * @param parentNode - parent NodeIndexDocument
77
- * @param boundingVolumes - MBS and OOB bounding volumes data
78
- * @param lodSelection - LOD metrics data
79
- * @param nodeInPage - node data in node pages
80
- * @param resources - resources extracted from gltf/b3dm file
81
- * @param converter - I3SConverter instance
82
- * @returns NodeIndexDocument instance
83
- */
84
- static createNode({ parentNode, boundingVolumes, lodSelection, nodeInPage, resources, converter }: {
85
- parentNode: NodeIndexDocument;
86
- boundingVolumes: BoundingVolumes;
87
- lodSelection: LodSelection[];
88
- nodeInPage: NodeInPage;
89
- resources: I3SConvertedResources;
90
- converter: I3SConverter;
91
- }): Promise<NodeIndexDocument>;
92
- /**
93
- * Form 3DNodeIndexDocument data for the root node
94
- * @param boundingVolumes - mbs and obb data about node's bounding volume
95
- * @return 3DNodeIndexDocument data https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md
96
- */
97
- static createRootNodeIndexDocument(boundingVolumes: BoundingVolumes): Node3DIndexDocument;
98
- /**
99
- * Create a new Node3DIndexDocument
100
- * @param parentNode - 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md object of the parent node
101
- * @param boundingVolumes - Bounding volumes
102
- * @param lodSelection - Level of Details (LOD) metrics
103
- * @param nodeInPage - corresponding node object in a node page
104
- * @param resources - the node resources data
105
- * @param resources.texture - texture image
106
- * @param resources.attributes - feature attributes
107
- * @return 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md object
108
- */
109
- static createNodeIndexDocument(parentNode: NodeIndexDocument, boundingVolumes: BoundingVolumes, lodSelection: LodSelection[], nodeInPage: NodeInPage, resources: I3SConvertedResources | DumpMetadata): Promise<Node3DIndexDocument>;
110
- }
111
- //# sourceMappingURL=node-index-document.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"node-index-document.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/node-index-document.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,UAAU,EAEX,MAAM,iBAAiB,CAAC;AAIzB,OAAO,YAAY,4BAAyB;AAE5C,OAAO,EAAC,qBAAqB,EAAC,oBAAiB;AAC/C,OAAO,EAAC,YAAY,EAAC,2CAAwC;AAE7D;;;;;GAKG;AACH,qBAAa,iBAAiB;IAC5B,cAAc;IACP,EAAE,EAAE,MAAM,CAAC;IAClB,uBAAuB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACxB,+BAA+B;IACxB,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAAQ;IAC/C,eAAe;IACR,QAAQ,EAAE,iBAAiB,EAAE,CAAM;IAC1C,yBAAyB;IACzB,OAAO,CAAC,SAAS,CAAe;IAEhC;;;OAGG;IACH,OAAO,CAAC,UAAU,CAAkB;IACpC,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;;;OAIG;gBACS,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY;IAM/C;;;;OAIG;IACU,OAAO,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAS3E;;;OAGG;IACU,WAAW,CAAC,UAAU,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BxE;;OAEG;IACU,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAmC1C,+CAA+C;IAClC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAMlC,wBAAwB;IACxB,OAAO,CAAC,QAAQ;IAOhB;;;OAGG;YACW,KAAK;IAkBnB;;;OAGG;YACW,IAAI;IAUlB;;OAEG;IACH,OAAO,CAAC,KAAK;IAIb;;;;;OAKG;WACU,cAAc,CACzB,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,iBAAiB,CAAC;IAM7B;;;;;;;;;OASG;WACU,UAAU,CAAC,EACtB,UAAU,EACV,eAAe,EACf,YAAY,EACZ,UAAU,EACV,SAAS,EACT,SAAS,EACV,EAAE;QACD,UAAU,EAAE,iBAAiB,CAAC;QAC9B,eAAe,EAAE,eAAe,CAAC;QACjC,YAAY,EAAE,YAAY,EAAE,CAAC;QAC7B,UAAU,EAAE,UAAU,CAAC;QACvB,SAAS,EAAE,qBAAqB,CAAC;QACjC,SAAS,EAAE,YAAY,CAAC;KACzB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAY9B;;;;OAIG;IACH,MAAM,CAAC,2BAA2B,CAAC,eAAe,EAAE,eAAe,GAAG,mBAAmB;IAqBzF;;;;;;;;;;OAUG;WAEU,uBAAuB,CAClC,UAAU,EAAE,iBAAiB,EAC7B,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAAE,EAC5B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,qBAAqB,GAAG,YAAY,GAC9C,OAAO,CAAC,mBAAmB,CAAC;CAyDhC"}