@loaders.gl/3d-tiles 3.3.0 → 3.4.0-alpha.1

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.
package/dist/dist.min.js CHANGED
@@ -751,7 +751,46 @@
751
751
  }
752
752
  });
753
753
 
754
+ // ../loader-utils/src/lib/binary-utils/buffer-utils.ts
755
+ function isBuffer(value) {
756
+ return value && typeof value === "object" && value.isBuffer;
757
+ }
758
+ function bufferToArrayBuffer(buffer) {
759
+ if (isBuffer(buffer)) {
760
+ const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);
761
+ return typedArray.slice().buffer;
762
+ }
763
+ return buffer;
764
+ }
765
+ var init_buffer_utils = __esm({
766
+ "../loader-utils/src/lib/binary-utils/buffer-utils.ts"() {
767
+ }
768
+ });
769
+
754
770
  // ../loader-utils/src/lib/binary-utils/array-buffer-utils.ts
771
+ function toArrayBuffer(data) {
772
+ if (isBuffer(data)) {
773
+ return bufferToArrayBuffer(data);
774
+ }
775
+ if (data instanceof ArrayBuffer) {
776
+ return data;
777
+ }
778
+ if (ArrayBuffer.isView(data)) {
779
+ if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
780
+ return data.buffer;
781
+ }
782
+ return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
783
+ }
784
+ if (typeof data === "string") {
785
+ const text = data;
786
+ const uint8Array = new TextEncoder().encode(text);
787
+ return uint8Array.buffer;
788
+ }
789
+ if (data && typeof data === "object" && data._toArrayBuffer) {
790
+ return data._toArrayBuffer();
791
+ }
792
+ throw new Error("toArrayBuffer");
793
+ }
755
794
  function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
756
795
  byteLength = byteLength || arrayBuffer1.byteLength;
757
796
  if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {
@@ -784,6 +823,7 @@
784
823
  }
785
824
  var init_array_buffer_utils = __esm({
786
825
  "../loader-utils/src/lib/binary-utils/array-buffer-utils.ts"() {
826
+ init_buffer_utils();
787
827
  }
788
828
  });
789
829
 
@@ -811,7 +851,34 @@
811
851
  }
812
852
  });
813
853
 
814
- // ../loader-utils/src/lib/binary-utils/dataview-copy-utils.ts
854
+ // ../loader-utils/src/lib/binary-utils/binary-copy-utils.ts
855
+ function copyPaddedArrayBufferToDataView(dataView, byteOffset, sourceBuffer, padding) {
856
+ const paddedLength = padToNBytes(sourceBuffer.byteLength, padding);
857
+ const padLength = paddedLength - sourceBuffer.byteLength;
858
+ if (dataView) {
859
+ const targetArray = new Uint8Array(dataView.buffer, dataView.byteOffset + byteOffset, sourceBuffer.byteLength);
860
+ const sourceArray = new Uint8Array(sourceBuffer);
861
+ targetArray.set(sourceArray);
862
+ for (let i2 = 0; i2 < padLength; ++i2) {
863
+ dataView.setUint8(byteOffset + sourceBuffer.byteLength + i2, 32);
864
+ }
865
+ }
866
+ byteOffset += paddedLength;
867
+ return byteOffset;
868
+ }
869
+ function copyPaddedStringToDataView(dataView, byteOffset, string, padding) {
870
+ const textEncoder = new TextEncoder();
871
+ const stringBuffer = textEncoder.encode(string);
872
+ byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, stringBuffer, padding);
873
+ return byteOffset;
874
+ }
875
+ var init_binary_copy_utils = __esm({
876
+ "../loader-utils/src/lib/binary-utils/binary-copy-utils.ts"() {
877
+ init_memory_copy_utils();
878
+ }
879
+ });
880
+
881
+ // ../loader-utils/src/lib/binary-utils/encode-utils.ts
815
882
  function padStringToByteAlignment(string, byteAlignment) {
816
883
  const length4 = string.length;
817
884
  const paddedLength = Math.ceil(length4 / byteAlignment) * byteAlignment;
@@ -838,29 +905,8 @@
838
905
  }
839
906
  return byteOffset + byteLength;
840
907
  }
841
- function copyPaddedArrayBufferToDataView(dataView, byteOffset, sourceBuffer, padding) {
842
- const paddedLength = padToNBytes(sourceBuffer.byteLength, padding);
843
- const padLength = paddedLength - sourceBuffer.byteLength;
844
- if (dataView) {
845
- const targetArray = new Uint8Array(dataView.buffer, dataView.byteOffset + byteOffset, sourceBuffer.byteLength);
846
- const sourceArray = new Uint8Array(sourceBuffer);
847
- targetArray.set(sourceArray);
848
- for (let i2 = 0; i2 < padLength; ++i2) {
849
- dataView.setUint8(byteOffset + sourceBuffer.byteLength + i2, 32);
850
- }
851
- }
852
- byteOffset += paddedLength;
853
- return byteOffset;
854
- }
855
- function copyPaddedStringToDataView(dataView, byteOffset, string, padding) {
856
- const textEncoder = new TextEncoder();
857
- const stringBuffer = textEncoder.encode(string);
858
- byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, stringBuffer, padding);
859
- return byteOffset;
860
- }
861
- var init_dataview_copy_utils = __esm({
862
- "../loader-utils/src/lib/binary-utils/dataview-copy-utils.ts"() {
863
- init_memory_copy_utils();
908
+ var init_encode_utils = __esm({
909
+ "../loader-utils/src/lib/binary-utils/encode-utils.ts"() {
864
910
  }
865
911
  });
866
912
 
@@ -918,45 +964,6 @@
918
964
  }
919
965
  });
920
966
 
921
- // (disabled):../loader-utils/src/lib/node/buffer
922
- var init_buffer = __esm({
923
- "(disabled):../loader-utils/src/lib/node/buffer"() {
924
- }
925
- });
926
-
927
- // ../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts
928
- function isBuffer(value) {
929
- return value && typeof value === "object" && value.isBuffer;
930
- }
931
- function toArrayBuffer2(data) {
932
- if (isBuffer(data)) {
933
- return node2.toArrayBuffer(data);
934
- }
935
- if (data instanceof ArrayBuffer) {
936
- return data;
937
- }
938
- if (ArrayBuffer.isView(data)) {
939
- if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
940
- return data.buffer;
941
- }
942
- return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
943
- }
944
- if (typeof data === "string") {
945
- const text = data;
946
- const uint8Array = new TextEncoder().encode(text);
947
- return uint8Array.buffer;
948
- }
949
- if (data && typeof data === "object" && data._toArrayBuffer) {
950
- return data._toArrayBuffer();
951
- }
952
- throw new Error("toArrayBuffer");
953
- }
954
- var init_memory_conversion_utils = __esm({
955
- "../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts"() {
956
- init_buffer();
957
- }
958
- });
959
-
960
967
  // ../loader-utils/src/lib/path-utils/path.ts
961
968
  var path_exports = {};
962
969
  __export(path_exports, {
@@ -999,10 +1006,10 @@
999
1006
  init_parse_json();
1000
1007
  init_array_buffer_utils();
1001
1008
  init_memory_copy_utils();
1002
- init_dataview_copy_utils();
1009
+ init_binary_copy_utils();
1010
+ init_encode_utils();
1003
1011
  init_async_iteration();
1004
1012
  init_file_aliases();
1005
- init_memory_conversion_utils();
1006
1013
  init_path();
1007
1014
  }
1008
1015
  });
@@ -5763,7 +5770,7 @@
5763
5770
  if (done) {
5764
5771
  return;
5765
5772
  }
5766
- yield toArrayBuffer2(value);
5773
+ yield toArrayBuffer(value);
5767
5774
  }
5768
5775
  } catch (error) {
5769
5776
  reader.releaseLock();
@@ -5771,7 +5778,7 @@
5771
5778
  }
5772
5779
  async function* makeNodeStreamIterator(stream, options) {
5773
5780
  for await (const chunk of stream) {
5774
- yield toArrayBuffer2(chunk);
5781
+ yield toArrayBuffer(chunk);
5775
5782
  }
5776
5783
  }
5777
5784
  var init_make_stream_iterator = __esm({
@@ -9631,8 +9638,8 @@
9631
9638
  this.json.scenes.push({ nodes: nodeIndices });
9632
9639
  return this.json.scenes.length - 1;
9633
9640
  }
9634
- addNode(node3) {
9635
- const { meshIndex, matrix } = node3;
9641
+ addNode(node2) {
9642
+ const { meshIndex, matrix } = node2;
9636
9643
  this.json.nodes = this.json.nodes || [];
9637
9644
  const nodeData = { mesh: meshIndex };
9638
9645
  if (matrix) {
@@ -10502,12 +10509,12 @@
10502
10509
  gltfScenegraph.json.lights = extension.lights;
10503
10510
  gltfScenegraph.removeExtension(KHR_LIGHTS_PUNCTUAL);
10504
10511
  }
10505
- for (const node3 of json.nodes || []) {
10506
- const nodeExtension = gltfScenegraph.getObjectExtension(node3, KHR_LIGHTS_PUNCTUAL);
10512
+ for (const node2 of json.nodes || []) {
10513
+ const nodeExtension = gltfScenegraph.getObjectExtension(node2, KHR_LIGHTS_PUNCTUAL);
10507
10514
  if (nodeExtension) {
10508
- node3.light = nodeExtension.light;
10515
+ node2.light = nodeExtension.light;
10509
10516
  }
10510
- gltfScenegraph.removeObjectExtension(node3, KHR_LIGHTS_PUNCTUAL);
10517
+ gltfScenegraph.removeObjectExtension(node2, KHR_LIGHTS_PUNCTUAL);
10511
10518
  }
10512
10519
  }
10513
10520
  async function encode2(gltfData) {
@@ -10521,8 +10528,8 @@
10521
10528
  }
10522
10529
  if (gltfScenegraph.json.lights) {
10523
10530
  for (const light of gltfScenegraph.json.lights) {
10524
- const node3 = light.node;
10525
- gltfScenegraph.addObjectExtension(node3, KHR_LIGHTS_PUNCTUAL, light);
10531
+ const node2 = light.node;
10532
+ gltfScenegraph.addObjectExtension(node2, KHR_LIGHTS_PUNCTUAL, light);
10526
10533
  }
10527
10534
  delete gltfScenegraph.json.lights;
10528
10535
  }
@@ -10913,11 +10920,11 @@
10913
10920
  for (const mesh of json.meshes) {
10914
10921
  this._convertMeshIds(mesh);
10915
10922
  }
10916
- for (const node3 of json.nodes) {
10917
- this._convertNodeIds(node3);
10923
+ for (const node2 of json.nodes) {
10924
+ this._convertNodeIds(node2);
10918
10925
  }
10919
- for (const node3 of json.scenes) {
10920
- this._convertSceneIds(node3);
10926
+ for (const node2 of json.scenes) {
10927
+ this._convertSceneIds(node2);
10921
10928
  }
10922
10929
  }
10923
10930
  _convertTextureIds(texture) {
@@ -10939,17 +10946,17 @@
10939
10946
  }
10940
10947
  }
10941
10948
  }
10942
- _convertNodeIds(node3) {
10943
- if (node3.children) {
10944
- node3.children = node3.children.map((child) => this._convertIdToIndex(child, "node"));
10949
+ _convertNodeIds(node2) {
10950
+ if (node2.children) {
10951
+ node2.children = node2.children.map((child) => this._convertIdToIndex(child, "node"));
10945
10952
  }
10946
- if (node3.meshes) {
10947
- node3.meshes = node3.meshes.map((mesh) => this._convertIdToIndex(mesh, "mesh"));
10953
+ if (node2.meshes) {
10954
+ node2.meshes = node2.meshes.map((mesh) => this._convertIdToIndex(mesh, "mesh"));
10948
10955
  }
10949
10956
  }
10950
10957
  _convertSceneIds(scene) {
10951
10958
  if (scene.nodes) {
10952
- scene.nodes = scene.nodes.map((node3) => this._convertIdToIndex(node3, "node"));
10959
+ scene.nodes = scene.nodes.map((node2) => this._convertIdToIndex(node2, "node"));
10953
10960
  }
10954
10961
  }
10955
10962
  _convertIdsToIndices(json, topLevelArrayName) {
@@ -11092,7 +11099,7 @@
11092
11099
  json.meshes = json.meshes.map((mesh, i2) => this._resolveMesh(mesh, i2));
11093
11100
  }
11094
11101
  if (json.nodes) {
11095
- json.nodes = json.nodes.map((node3, i2) => this._resolveNode(node3, i2));
11102
+ json.nodes = json.nodes.map((node2, i2) => this._resolveNode(node2, i2));
11096
11103
  }
11097
11104
  if (json.skins) {
11098
11105
  json.skins = json.skins.map((skin, i2) => this._resolveSkin(skin, i2));
@@ -11152,31 +11159,31 @@
11152
11159
  }
11153
11160
  _resolveScene(scene, index) {
11154
11161
  scene.id = scene.id || `scene-${index}`;
11155
- scene.nodes = (scene.nodes || []).map((node3) => this.getNode(node3));
11162
+ scene.nodes = (scene.nodes || []).map((node2) => this.getNode(node2));
11156
11163
  return scene;
11157
11164
  }
11158
- _resolveNode(node3, index) {
11159
- node3.id = node3.id || `node-${index}`;
11160
- if (node3.children) {
11161
- node3.children = node3.children.map((child) => this.getNode(child));
11165
+ _resolveNode(node2, index) {
11166
+ node2.id = node2.id || `node-${index}`;
11167
+ if (node2.children) {
11168
+ node2.children = node2.children.map((child) => this.getNode(child));
11162
11169
  }
11163
- if (node3.mesh !== void 0) {
11164
- node3.mesh = this.getMesh(node3.mesh);
11165
- } else if (node3.meshes !== void 0 && node3.meshes.length) {
11166
- node3.mesh = node3.meshes.reduce((accum, meshIndex) => {
11170
+ if (node2.mesh !== void 0) {
11171
+ node2.mesh = this.getMesh(node2.mesh);
11172
+ } else if (node2.meshes !== void 0 && node2.meshes.length) {
11173
+ node2.mesh = node2.meshes.reduce((accum, meshIndex) => {
11167
11174
  const mesh = this.getMesh(meshIndex);
11168
11175
  accum.id = mesh.id;
11169
11176
  accum.primitives = accum.primitives.concat(mesh.primitives);
11170
11177
  return accum;
11171
11178
  }, { primitives: [] });
11172
11179
  }
11173
- if (node3.camera !== void 0) {
11174
- node3.camera = this.getCamera(node3.camera);
11180
+ if (node2.camera !== void 0) {
11181
+ node2.camera = this.getCamera(node2.camera);
11175
11182
  }
11176
- if (node3.skin !== void 0) {
11177
- node3.skin = this.getSkin(node3.skin);
11183
+ if (node2.skin !== void 0) {
11184
+ node2.skin = this.getSkin(node2.skin);
11178
11185
  }
11179
- return node3;
11186
+ return node2;
11180
11187
  }
11181
11188
  _resolveSkin(skin, index) {
11182
11189
  skin.id = skin.id || `skin-${index}`;
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.VERSION = void 0;
7
- var VERSION = typeof "3.3.0" !== 'undefined' ? "3.3.0" : 'latest';
7
+ var VERSION = typeof "3.4.0-alpha.1" !== 'undefined' ? "3.4.0-alpha.1" : 'latest';
8
8
  exports.VERSION = VERSION;
9
9
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","names":["VERSION"],"sources":["../../../../src/lib/utils/version.ts"],"sourcesContent":["// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n"],"mappings":";;;;;;AAGO,IAAMA,OAAO,GAAG,cAAkB,KAAK,WAAW,aAAiB,QAAQ;AAAC"}
1
+ {"version":3,"file":"version.js","names":["VERSION"],"sources":["../../../../src/lib/utils/version.ts"],"sourcesContent":["// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n"],"mappings":";;;;;;AAGO,IAAMA,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAAC"}
@@ -1,3 +1,3 @@
1
1
 
2
- export const VERSION = typeof "3.3.0" !== 'undefined' ? "3.3.0" : 'latest';
2
+ export const VERSION = typeof "3.4.0-alpha.1" !== 'undefined' ? "3.4.0-alpha.1" : 'latest';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","names":["VERSION"],"sources":["../../../../src/lib/utils/version.ts"],"sourcesContent":["// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n"],"mappings":";AAGA,OAAO,MAAMA,OAAO,GAAG,cAAkB,KAAK,WAAW,aAAiB,QAAQ"}
1
+ {"version":3,"file":"version.js","names":["VERSION"],"sources":["../../../../src/lib/utils/version.ts"],"sourcesContent":["// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n"],"mappings":";AAGA,OAAO,MAAMA,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ"}
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.parseBatchedModel3DTile = void 0;
9
9
  const math_1 = require("@loaders.gl/math"); // math.gl/geometry;
10
10
  const tile_3d_feature_table_1 = __importDefault(require("../classes/tile-3d-feature-table"));
11
- // import Tile3DBatchTable from '../classes/tile-3d-batch-table.js';
11
+ // import Tile3DBatchTable from '../classes/tile-3d-batch-table';
12
12
  const parse_3d_tile_header_1 = require("./helpers/parse-3d-tile-header");
13
13
  const parse_3d_tile_tables_1 = require("./helpers/parse-3d-tile-tables");
14
14
  const parse_3d_tile_gltf_view_1 = require("./helpers/parse-3d-tile-gltf-view");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/3d-tiles",
3
- "version": "3.3.0",
3
+ "version": "3.4.0-alpha.1",
4
4
  "description": "3D Tiles, an open standard for streaming massive heterogeneous 3D geospatial datasets.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -34,16 +34,16 @@
34
34
  "build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
35
35
  },
36
36
  "dependencies": {
37
- "@loaders.gl/draco": "3.3.0",
38
- "@loaders.gl/gltf": "3.3.0",
39
- "@loaders.gl/loader-utils": "3.3.0",
40
- "@loaders.gl/math": "3.3.0",
41
- "@loaders.gl/tiles": "3.3.0",
37
+ "@loaders.gl/draco": "3.4.0-alpha.1",
38
+ "@loaders.gl/gltf": "3.4.0-alpha.1",
39
+ "@loaders.gl/loader-utils": "3.4.0-alpha.1",
40
+ "@loaders.gl/math": "3.4.0-alpha.1",
41
+ "@loaders.gl/tiles": "3.4.0-alpha.1",
42
42
  "@math.gl/core": "^3.5.1",
43
43
  "@math.gl/geospatial": "^3.5.1"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@loaders.gl/core": "^3.2.0"
47
47
  },
48
- "gitHead": "566d194f175a03e042d3e588cdd514048f428cc1"
48
+ "gitHead": "4085b0323050e4361614471319a1fb4729547bbf"
49
49
  }