@loaders.gl/tile-converter 3.3.0-alpha.4 → 3.3.0-alpha.5

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 (32) hide show
  1. package/dist/3d-tiles-attributes-worker.d.ts +1 -1
  2. package/dist/3d-tiles-attributes-worker.js +2 -2
  3. package/dist/3d-tiles-attributes-worker.js.map +2 -2
  4. package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +5 -5
  5. package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
  6. package/dist/3d-tiles-converter/helpers/b3dm-converter.js +21 -17
  7. package/dist/converter.min.js +1 -1
  8. package/dist/dist.min.js +2 -2
  9. package/dist/es5/3d-tiles-attributes-worker.js +2 -2
  10. package/dist/es5/3d-tiles-attributes-worker.js.map +1 -1
  11. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +27 -19
  12. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  13. package/dist/es5/deps-installer/deps-installer.js +1 -1
  14. package/dist/es5/i3s-attributes-worker.js +1 -1
  15. package/dist/es5/pgm-loader.js +1 -1
  16. package/dist/es5/workers/3d-tiles-attributes-worker.js +1 -1
  17. package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -1
  18. package/dist/esm/3d-tiles-attributes-worker.js +2 -2
  19. package/dist/esm/3d-tiles-attributes-worker.js.map +1 -1
  20. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +25 -15
  21. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  22. package/dist/esm/deps-installer/deps-installer.js +1 -1
  23. package/dist/esm/i3s-attributes-worker.js +1 -1
  24. package/dist/esm/pgm-loader.js +1 -1
  25. package/dist/esm/workers/3d-tiles-attributes-worker.js +1 -1
  26. package/dist/esm/workers/3d-tiles-attributes-worker.js.map +1 -1
  27. package/dist/i3s-attributes-worker.js.map +1 -1
  28. package/dist/workers/3d-tiles-attributes-worker.js +1 -1
  29. package/package.json +15 -15
  30. package/src/3d-tiles-attributes-worker.ts +1 -1
  31. package/src/3d-tiles-converter/helpers/b3dm-converter.ts +25 -18
  32. package/src/workers/3d-tiles-attributes-worker.ts +1 -1
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const worker_utils_1 = require("@loaders.gl/worker-utils");
7
7
  const b3dm_converter_1 = __importDefault(require("../3d-tiles-converter/helpers/b3dm-converter"));
8
8
  const b3dmConverter = new b3dm_converter_1.default();
9
- (0, worker_utils_1.createWorker)(async (data, options = {}) => b3dmConverter.convert(data, options.attributes));
9
+ (0, worker_utils_1.createWorker)(async (data, options = {}) => b3dmConverter.convert(data, options.featureAttributes));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/tile-converter",
3
- "version": "3.3.0-alpha.4",
3
+ "version": "3.3.0-alpha.5",
4
4
  "description": "Converter",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -43,19 +43,19 @@
43
43
  "build-3d-tiles-attributes-worker": "esbuild src/workers/3d-tiles-attributes-worker.ts --outfile=dist/3d-tiles-attributes-worker.js --platform=node --target=esnext,node12 --minify --bundle --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\""
44
44
  },
45
45
  "dependencies": {
46
- "@loaders.gl/3d-tiles": "3.3.0-alpha.4",
47
- "@loaders.gl/crypto": "3.3.0-alpha.4",
48
- "@loaders.gl/draco": "3.3.0-alpha.4",
49
- "@loaders.gl/gltf": "3.3.0-alpha.4",
50
- "@loaders.gl/i3s": "3.3.0-alpha.4",
51
- "@loaders.gl/images": "3.3.0-alpha.4",
52
- "@loaders.gl/loader-utils": "3.3.0-alpha.4",
53
- "@loaders.gl/polyfills": "3.3.0-alpha.4",
54
- "@loaders.gl/schema": "3.3.0-alpha.4",
55
- "@loaders.gl/textures": "3.3.0-alpha.4",
56
- "@loaders.gl/tiles": "3.3.0-alpha.4",
57
- "@loaders.gl/worker-utils": "3.3.0-alpha.4",
58
- "@loaders.gl/zip": "3.3.0-alpha.4",
46
+ "@loaders.gl/3d-tiles": "3.3.0-alpha.5",
47
+ "@loaders.gl/crypto": "3.3.0-alpha.5",
48
+ "@loaders.gl/draco": "3.3.0-alpha.5",
49
+ "@loaders.gl/gltf": "3.3.0-alpha.5",
50
+ "@loaders.gl/i3s": "3.3.0-alpha.5",
51
+ "@loaders.gl/images": "3.3.0-alpha.5",
52
+ "@loaders.gl/loader-utils": "3.3.0-alpha.5",
53
+ "@loaders.gl/polyfills": "3.3.0-alpha.5",
54
+ "@loaders.gl/schema": "3.3.0-alpha.5",
55
+ "@loaders.gl/textures": "3.3.0-alpha.5",
56
+ "@loaders.gl/tiles": "3.3.0-alpha.5",
57
+ "@loaders.gl/worker-utils": "3.3.0-alpha.5",
58
+ "@loaders.gl/zip": "3.3.0-alpha.5",
59
59
  "@luma.gl/engine": "^8.5.4",
60
60
  "@math.gl/core": "^3.5.1",
61
61
  "@math.gl/culling": "^3.5.1",
@@ -75,5 +75,5 @@
75
75
  "peerDependencies": {
76
76
  "@loaders.gl/core": "^3.2.0"
77
77
  },
78
- "gitHead": "d1c524fd3cb9296ecd1bf7d185765c4f6aaef6a1"
78
+ "gitHead": "d2df3bead97710c45fd2974cd51ecd7d5f7f5ea4"
79
79
  }
@@ -26,7 +26,7 @@ export const Tile3dAttributesWorker = {
26
26
  module: 'tile-converter',
27
27
  version: VERSION,
28
28
  options: {
29
- attributes: null
29
+ featureAttributes: null
30
30
  }
31
31
  };
32
32
 
@@ -27,7 +27,7 @@ export default class B3dmConverter {
27
27
  i3sAttributesData: I3SAttributesData,
28
28
  featureAttributes: any = null
29
29
  ): Promise<ArrayBuffer> {
30
- const gltf = await this.buildGltf(i3sAttributesData);
30
+ const gltf = await this.buildGltf(i3sAttributesData, featureAttributes);
31
31
  const b3dm = encodeSync(
32
32
  {
33
33
  gltfEncoded: new Uint8Array(gltf),
@@ -45,7 +45,10 @@ export default class B3dmConverter {
45
45
  * @param i3sTile - Tile3D instance for I3S node
46
46
  * @returns - encoded glb content
47
47
  */
48
- async buildGltf(i3sAttributesData: I3SAttributesData): Promise<ArrayBuffer> {
48
+ async buildGltf(
49
+ i3sAttributesData: I3SAttributesData,
50
+ featureAttributes: any
51
+ ): Promise<ArrayBuffer> {
49
52
  const {tileContent, textureFormat} = i3sAttributesData;
50
53
  const {
51
54
  material,
@@ -77,6 +80,7 @@ export default class B3dmConverter {
77
80
  cartographicOrigin,
78
81
  modelMatrix
79
82
  );
83
+ this._createBatchIds(tileContent, featureAttributes);
80
84
  if (attributes.normals && !this._checkNormals(attributes.normals.value)) {
81
85
  delete attributes.normals;
82
86
  }
@@ -163,25 +167,28 @@ export default class B3dmConverter {
163
167
  }
164
168
 
165
169
  /**
166
- * Generate batchId attribute from faceRanges.
167
- * @param {Uint32Array} faceRanges - the source array
168
- * @returns {Float32Array} batchId list.
170
+ * Create _BATCHID attribute
171
+ * @param {Object} i3sContent - the source object
172
+ * @returns {void}
169
173
  */
170
- _generateBatchId(faceRanges) {
171
- const batchIdArraySize = (faceRanges[faceRanges.length - 1] + 1) * 3;
172
- const batchId = new Float32Array(batchIdArraySize);
173
- let rangeIndex = 0;
174
- let currentBatchId = 0;
175
-
176
- for (let index = 0; index < faceRanges.length / 2; index++) {
177
- const fromIndex = faceRanges[rangeIndex] * 3;
178
- const untilPosition = (faceRanges[rangeIndex + 1] + 1) * 3;
174
+ _createBatchIds(i3sContent, featureAttributes) {
175
+ const {featureIds} = i3sContent;
176
+ const {OBJECTID: objectIds} = featureAttributes || {};
177
+ if (!featureIds || !objectIds) {
178
+ return;
179
+ }
179
180
 
180
- batchId.fill(currentBatchId, fromIndex, untilPosition);
181
- rangeIndex += 2;
182
- currentBatchId += 1;
181
+ for (let i = 0; i < featureIds.length; i++) {
182
+ const featureId = featureIds[i];
183
+ const batchId = objectIds.indexOf(featureId);
184
+ featureIds[i] = batchId;
183
185
  }
184
- return batchId;
186
+
187
+ i3sContent.attributes._BATCHID = {
188
+ size: 1,
189
+ byteOffset: 0,
190
+ value: featureIds
191
+ };
185
192
  }
186
193
 
187
194
  /**
@@ -3,4 +3,4 @@ import B3dmConverter from '../3d-tiles-converter/helpers/b3dm-converter';
3
3
 
4
4
  const b3dmConverter = new B3dmConverter();
5
5
 
6
- createWorker(async (data, options = {}) => b3dmConverter.convert(data, options.attributes));
6
+ createWorker(async (data, options = {}) => b3dmConverter.convert(data, options.featureAttributes));