@loaders.gl/3d-tiles 4.0.0-alpha.12 → 4.0.0-alpha.14

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/dist.min.js +690 -62
  2. package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js +63 -38
  3. package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
  4. package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js +69 -44
  5. package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -1
  6. package/dist/es5/lib/parsers/parse-3d-tile-header.js +12 -11
  7. package/dist/es5/lib/parsers/parse-3d-tile-header.js.map +1 -1
  8. package/dist/es5/lib/utils/version.js +1 -1
  9. package/dist/es5/types.js.map +1 -1
  10. package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js +45 -23
  11. package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
  12. package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js +18 -14
  13. package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -1
  14. package/dist/esm/lib/parsers/parse-3d-tile-header.js +6 -4
  15. package/dist/esm/lib/parsers/parse-3d-tile-header.js.map +1 -1
  16. package/dist/esm/lib/utils/version.js +1 -1
  17. package/dist/esm/types.js.map +1 -1
  18. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts +4 -1
  19. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts.map +1 -1
  20. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js +65 -28
  21. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.d.ts.map +1 -1
  22. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js +24 -18
  23. package/dist/lib/parsers/parse-3d-tile-header.d.ts +30 -2
  24. package/dist/lib/parsers/parse-3d-tile-header.d.ts.map +1 -1
  25. package/dist/lib/parsers/parse-3d-tile-header.js +6 -5
  26. package/dist/types.d.ts +45 -3
  27. package/dist/types.d.ts.map +1 -1
  28. package/package.json +8 -7
  29. package/src/lib/parsers/helpers/parse-3d-implicit-tiles.ts +76 -32
  30. package/src/lib/parsers/helpers/parse-3d-tile-subtree.ts +43 -35
  31. package/src/lib/parsers/parse-3d-tile-header.ts +37 -5
  32. package/src/types.ts +46 -4
package/dist/dist.min.js CHANGED
@@ -5689,23 +5689,23 @@
5689
5689
  var init_color = __esm({
5690
5690
  "../../node_modules/@probe.gl/log/dist/utils/color.js"() {
5691
5691
  init_dist();
5692
- (function(COLOR2) {
5693
- COLOR2[COLOR2["BLACK"] = 30] = "BLACK";
5694
- COLOR2[COLOR2["RED"] = 31] = "RED";
5695
- COLOR2[COLOR2["GREEN"] = 32] = "GREEN";
5696
- COLOR2[COLOR2["YELLOW"] = 33] = "YELLOW";
5697
- COLOR2[COLOR2["BLUE"] = 34] = "BLUE";
5698
- COLOR2[COLOR2["MAGENTA"] = 35] = "MAGENTA";
5699
- COLOR2[COLOR2["CYAN"] = 36] = "CYAN";
5700
- COLOR2[COLOR2["WHITE"] = 37] = "WHITE";
5701
- COLOR2[COLOR2["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
5702
- COLOR2[COLOR2["BRIGHT_RED"] = 91] = "BRIGHT_RED";
5703
- COLOR2[COLOR2["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
5704
- COLOR2[COLOR2["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
5705
- COLOR2[COLOR2["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
5706
- COLOR2[COLOR2["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
5707
- COLOR2[COLOR2["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
5708
- COLOR2[COLOR2["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
5692
+ (function(COLOR3) {
5693
+ COLOR3[COLOR3["BLACK"] = 30] = "BLACK";
5694
+ COLOR3[COLOR3["RED"] = 31] = "RED";
5695
+ COLOR3[COLOR3["GREEN"] = 32] = "GREEN";
5696
+ COLOR3[COLOR3["YELLOW"] = 33] = "YELLOW";
5697
+ COLOR3[COLOR3["BLUE"] = 34] = "BLUE";
5698
+ COLOR3[COLOR3["MAGENTA"] = 35] = "MAGENTA";
5699
+ COLOR3[COLOR3["CYAN"] = 36] = "CYAN";
5700
+ COLOR3[COLOR3["WHITE"] = 37] = "WHITE";
5701
+ COLOR3[COLOR3["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
5702
+ COLOR3[COLOR3["BRIGHT_RED"] = 91] = "BRIGHT_RED";
5703
+ COLOR3[COLOR3["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
5704
+ COLOR3[COLOR3["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
5705
+ COLOR3[COLOR3["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
5706
+ COLOR3[COLOR3["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
5707
+ COLOR3[COLOR3["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
5708
+ COLOR3[COLOR3["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
5709
5709
  })(COLOR || (COLOR = {}));
5710
5710
  BACKGROUND_INCREMENT = 10;
5711
5711
  }
@@ -12676,22 +12676,25 @@
12676
12676
  if (binaryByteLength) {
12677
12677
  internalBinaryBuffer = data.slice(24 + jsonByteLength);
12678
12678
  }
12679
- if ("bufferView" in subtree.tileAvailability) {
12680
- subtree.tileAvailability.explicitBitstream = await getExplicitBitstream(subtree, "tileAvailability", internalBinaryBuffer, context);
12681
- }
12682
- if ("bufferView" in subtree.contentAvailability) {
12683
- subtree.contentAvailability.explicitBitstream = await getExplicitBitstream(subtree, "contentAvailability", internalBinaryBuffer, context);
12684
- }
12685
- if ("bufferView" in subtree.childSubtreeAvailability) {
12686
- subtree.childSubtreeAvailability.explicitBitstream = await getExplicitBitstream(subtree, "childSubtreeAvailability", internalBinaryBuffer, context);
12679
+ await loadExplicitBitstream(subtree, subtree.tileAvailability, internalBinaryBuffer, context);
12680
+ if (Array.isArray(subtree.contentAvailability)) {
12681
+ for (const contentAvailability of subtree.contentAvailability) {
12682
+ await loadExplicitBitstream(subtree, contentAvailability, internalBinaryBuffer, context);
12683
+ }
12684
+ } else {
12685
+ await loadExplicitBitstream(subtree, subtree.contentAvailability, internalBinaryBuffer, context);
12687
12686
  }
12687
+ await loadExplicitBitstream(subtree, subtree.childSubtreeAvailability, internalBinaryBuffer, context);
12688
12688
  return subtree;
12689
12689
  }
12690
- async function getExplicitBitstream(subtree, name10, internalBinaryBuffer, context) {
12691
- const bufferViewIndex = subtree[name10].bufferView;
12690
+ async function loadExplicitBitstream(subtree, availabilityObject, internalBinaryBuffer, context) {
12691
+ const bufferViewIndex = Number.isFinite(availabilityObject.bitstream) ? availabilityObject.bitstream : availabilityObject.bufferView;
12692
+ if (typeof bufferViewIndex !== "number") {
12693
+ return;
12694
+ }
12692
12695
  const bufferView = subtree.bufferViews[bufferViewIndex];
12693
12696
  const buffer = subtree.buffers[bufferView.buffer];
12694
- if (!context?.url || !context.fetch) {
12697
+ if (!context?.baseUrl) {
12695
12698
  throw new Error("Url is not provided");
12696
12699
  }
12697
12700
  if (!context.fetch) {
@@ -12701,9 +12704,10 @@
12701
12704
  const bufferUri = `${context?.baseUrl || ""}/${buffer.uri}`;
12702
12705
  const response = await context.fetch(bufferUri);
12703
12706
  const data = await response.arrayBuffer();
12704
- return new Uint8Array(data, bufferView.byteOffset, bufferView.byteLength);
12707
+ availabilityObject.explicitBitstream = new Uint8Array(data, bufferView.byteOffset, bufferView.byteLength);
12708
+ return;
12705
12709
  }
12706
- return new Uint8Array(internalBinaryBuffer, bufferView.byteOffset, bufferView.byteLength);
12710
+ availabilityObject.explicitBitstream = new Uint8Array(internalBinaryBuffer, bufferView.byteOffset, bufferView.byteLength);
12707
12711
  }
12708
12712
  function parseUint64Value(buffer) {
12709
12713
  const dataView = new DataView(buffer);
@@ -12739,6 +12743,608 @@
12739
12743
  }
12740
12744
  });
12741
12745
 
12746
+ // node_modules/@probe.gl/env/dist/lib/is-electron.js
12747
+ function isElectron2(mockUserAgent) {
12748
+ if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
12749
+ return true;
12750
+ }
12751
+ if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions["electron"])) {
12752
+ return true;
12753
+ }
12754
+ const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
12755
+ const userAgent = mockUserAgent || realUserAgent;
12756
+ if (userAgent && userAgent.indexOf("Electron") >= 0) {
12757
+ return true;
12758
+ }
12759
+ return false;
12760
+ }
12761
+ var init_is_electron2 = __esm({
12762
+ "node_modules/@probe.gl/env/dist/lib/is-electron.js"() {
12763
+ }
12764
+ });
12765
+
12766
+ // node_modules/@probe.gl/env/dist/lib/is-browser.js
12767
+ function isBrowser5() {
12768
+ const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
12769
+ return !isNode || isElectron2();
12770
+ }
12771
+ var init_is_browser2 = __esm({
12772
+ "node_modules/@probe.gl/env/dist/lib/is-browser.js"() {
12773
+ init_is_electron2();
12774
+ }
12775
+ });
12776
+
12777
+ // node_modules/@probe.gl/env/dist/lib/globals.js
12778
+ var self_4, window_4, document_4, process_2, console_2, navigator_2;
12779
+ var init_globals5 = __esm({
12780
+ "node_modules/@probe.gl/env/dist/lib/globals.js"() {
12781
+ self_4 = globalThis.self || globalThis.window || globalThis.global;
12782
+ window_4 = globalThis.window || globalThis.self || globalThis.global;
12783
+ document_4 = globalThis.document || {};
12784
+ process_2 = globalThis.process || {};
12785
+ console_2 = globalThis.console;
12786
+ navigator_2 = globalThis.navigator || {};
12787
+ }
12788
+ });
12789
+
12790
+ // node_modules/@probe.gl/env/dist/utils/globals.js
12791
+ var VERSION10, isBrowser6;
12792
+ var init_globals6 = __esm({
12793
+ "node_modules/@probe.gl/env/dist/utils/globals.js"() {
12794
+ init_is_browser2();
12795
+ VERSION10 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
12796
+ isBrowser6 = isBrowser5();
12797
+ }
12798
+ });
12799
+
12800
+ // node_modules/@probe.gl/env/dist/index.js
12801
+ var init_dist3 = __esm({
12802
+ "node_modules/@probe.gl/env/dist/index.js"() {
12803
+ init_globals6();
12804
+ init_globals5();
12805
+ init_is_browser2();
12806
+ }
12807
+ });
12808
+
12809
+ // node_modules/@probe.gl/log/dist/utils/local-storage.js
12810
+ function getStorage2(type) {
12811
+ try {
12812
+ const storage = window[type];
12813
+ const x = "__storage_test__";
12814
+ storage.setItem(x, x);
12815
+ storage.removeItem(x);
12816
+ return storage;
12817
+ } catch (e) {
12818
+ return null;
12819
+ }
12820
+ }
12821
+ var LocalStorage2;
12822
+ var init_local_storage2 = __esm({
12823
+ "node_modules/@probe.gl/log/dist/utils/local-storage.js"() {
12824
+ LocalStorage2 = class {
12825
+ constructor(id, defaultConfig) {
12826
+ let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
12827
+ this.storage = void 0;
12828
+ this.id = void 0;
12829
+ this.config = void 0;
12830
+ this.storage = getStorage2(type);
12831
+ this.id = id;
12832
+ this.config = defaultConfig;
12833
+ this._loadConfiguration();
12834
+ }
12835
+ getConfiguration() {
12836
+ return this.config;
12837
+ }
12838
+ setConfiguration(configuration) {
12839
+ Object.assign(this.config, configuration);
12840
+ if (this.storage) {
12841
+ const serialized = JSON.stringify(this.config);
12842
+ this.storage.setItem(this.id, serialized);
12843
+ }
12844
+ }
12845
+ _loadConfiguration() {
12846
+ let configuration = {};
12847
+ if (this.storage) {
12848
+ const serializedConfiguration = this.storage.getItem(this.id);
12849
+ configuration = serializedConfiguration ? JSON.parse(serializedConfiguration) : {};
12850
+ }
12851
+ Object.assign(this.config, configuration);
12852
+ return this;
12853
+ }
12854
+ };
12855
+ }
12856
+ });
12857
+
12858
+ // node_modules/@probe.gl/log/dist/utils/formatters.js
12859
+ function formatTime2(ms) {
12860
+ let formatted;
12861
+ if (ms < 10) {
12862
+ formatted = "".concat(ms.toFixed(2), "ms");
12863
+ } else if (ms < 100) {
12864
+ formatted = "".concat(ms.toFixed(1), "ms");
12865
+ } else if (ms < 1e3) {
12866
+ formatted = "".concat(ms.toFixed(0), "ms");
12867
+ } else {
12868
+ formatted = "".concat((ms / 1e3).toFixed(2), "s");
12869
+ }
12870
+ return formatted;
12871
+ }
12872
+ function leftPad2(string) {
12873
+ let length4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
12874
+ const padLength = Math.max(length4 - string.length, 0);
12875
+ return "".concat(" ".repeat(padLength)).concat(string);
12876
+ }
12877
+ function formatImage2(image, message, scale5) {
12878
+ let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
12879
+ const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
12880
+ if (image.width > maxWidth) {
12881
+ scale5 = Math.min(scale5, maxWidth / image.width);
12882
+ }
12883
+ const width = image.width * scale5;
12884
+ const height = image.height * scale5;
12885
+ const style = ["font-size:1px;", "padding:".concat(Math.floor(height / 2), "px ").concat(Math.floor(width / 2), "px;"), "line-height:".concat(height, "px;"), "background:url(".concat(imageUrl, ");"), "background-size:".concat(width, "px ").concat(height, "px;"), "color:transparent;"].join("");
12886
+ return ["".concat(message, " %c+"), style];
12887
+ }
12888
+ var init_formatters2 = __esm({
12889
+ "node_modules/@probe.gl/log/dist/utils/formatters.js"() {
12890
+ }
12891
+ });
12892
+
12893
+ // node_modules/@probe.gl/log/dist/utils/color.js
12894
+ function getColor2(color) {
12895
+ if (typeof color !== "string") {
12896
+ return color;
12897
+ }
12898
+ color = color.toUpperCase();
12899
+ return COLOR2[color] || COLOR2.WHITE;
12900
+ }
12901
+ function addColor2(string, color, background) {
12902
+ if (!isBrowser5 && typeof string === "string") {
12903
+ if (color) {
12904
+ const colorCode = getColor2(color);
12905
+ string = "[".concat(colorCode, "m").concat(string, "");
12906
+ }
12907
+ if (background) {
12908
+ const colorCode = getColor2(background);
12909
+ string = "[".concat(colorCode + BACKGROUND_INCREMENT2, "m").concat(string, "");
12910
+ }
12911
+ }
12912
+ return string;
12913
+ }
12914
+ var COLOR2, BACKGROUND_INCREMENT2;
12915
+ var init_color2 = __esm({
12916
+ "node_modules/@probe.gl/log/dist/utils/color.js"() {
12917
+ init_dist3();
12918
+ (function(COLOR3) {
12919
+ COLOR3[COLOR3["BLACK"] = 30] = "BLACK";
12920
+ COLOR3[COLOR3["RED"] = 31] = "RED";
12921
+ COLOR3[COLOR3["GREEN"] = 32] = "GREEN";
12922
+ COLOR3[COLOR3["YELLOW"] = 33] = "YELLOW";
12923
+ COLOR3[COLOR3["BLUE"] = 34] = "BLUE";
12924
+ COLOR3[COLOR3["MAGENTA"] = 35] = "MAGENTA";
12925
+ COLOR3[COLOR3["CYAN"] = 36] = "CYAN";
12926
+ COLOR3[COLOR3["WHITE"] = 37] = "WHITE";
12927
+ COLOR3[COLOR3["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
12928
+ COLOR3[COLOR3["BRIGHT_RED"] = 91] = "BRIGHT_RED";
12929
+ COLOR3[COLOR3["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
12930
+ COLOR3[COLOR3["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
12931
+ COLOR3[COLOR3["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
12932
+ COLOR3[COLOR3["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
12933
+ COLOR3[COLOR3["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
12934
+ COLOR3[COLOR3["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
12935
+ })(COLOR2 || (COLOR2 = {}));
12936
+ BACKGROUND_INCREMENT2 = 10;
12937
+ }
12938
+ });
12939
+
12940
+ // node_modules/@probe.gl/log/dist/utils/autobind.js
12941
+ function autobind2(obj) {
12942
+ let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
12943
+ const proto = Object.getPrototypeOf(obj);
12944
+ const propNames = Object.getOwnPropertyNames(proto);
12945
+ const object = obj;
12946
+ for (const key of propNames) {
12947
+ const value = object[key];
12948
+ if (typeof value === "function") {
12949
+ if (!predefined.find((name10) => key === name10)) {
12950
+ object[key] = value.bind(obj);
12951
+ }
12952
+ }
12953
+ }
12954
+ }
12955
+ var init_autobind2 = __esm({
12956
+ "node_modules/@probe.gl/log/dist/utils/autobind.js"() {
12957
+ }
12958
+ });
12959
+
12960
+ // node_modules/@probe.gl/log/dist/utils/assert.js
12961
+ function assert8(condition, message) {
12962
+ if (!condition) {
12963
+ throw new Error(message || "Assertion failed");
12964
+ }
12965
+ }
12966
+ var init_assert7 = __esm({
12967
+ "node_modules/@probe.gl/log/dist/utils/assert.js"() {
12968
+ }
12969
+ });
12970
+
12971
+ // node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js
12972
+ function getHiResTimestamp2() {
12973
+ let timestamp;
12974
+ if (isBrowser5() && window_4.performance) {
12975
+ var _window$performance, _window$performance$n;
12976
+ timestamp = window_4 === null || window_4 === void 0 ? void 0 : (_window$performance = window_4.performance) === null || _window$performance === void 0 ? void 0 : (_window$performance$n = _window$performance.now) === null || _window$performance$n === void 0 ? void 0 : _window$performance$n.call(_window$performance);
12977
+ } else if ("hrtime" in process_2) {
12978
+ var _process$hrtime;
12979
+ const timeParts = process_2 === null || process_2 === void 0 ? void 0 : (_process$hrtime = process_2.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process_2);
12980
+ timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
12981
+ } else {
12982
+ timestamp = Date.now();
12983
+ }
12984
+ return timestamp;
12985
+ }
12986
+ var init_hi_res_timestamp2 = __esm({
12987
+ "node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js"() {
12988
+ init_dist3();
12989
+ }
12990
+ });
12991
+
12992
+ // node_modules/@probe.gl/log/dist/log.js
12993
+ function noop2() {
12994
+ }
12995
+ function normalizeLogLevel2(logLevel) {
12996
+ if (!logLevel) {
12997
+ return 0;
12998
+ }
12999
+ let resolvedLevel;
13000
+ switch (typeof logLevel) {
13001
+ case "number":
13002
+ resolvedLevel = logLevel;
13003
+ break;
13004
+ case "object":
13005
+ resolvedLevel = logLevel.logLevel || logLevel.priority || 0;
13006
+ break;
13007
+ default:
13008
+ return 0;
13009
+ }
13010
+ assert8(Number.isFinite(resolvedLevel) && resolvedLevel >= 0);
13011
+ return resolvedLevel;
13012
+ }
13013
+ function normalizeArguments2(opts) {
13014
+ const {
13015
+ logLevel,
13016
+ message
13017
+ } = opts;
13018
+ opts.logLevel = normalizeLogLevel2(logLevel);
13019
+ const args = opts.args ? Array.from(opts.args) : [];
13020
+ while (args.length && args.shift() !== message) {
13021
+ }
13022
+ switch (typeof logLevel) {
13023
+ case "string":
13024
+ case "function":
13025
+ if (message !== void 0) {
13026
+ args.unshift(message);
13027
+ }
13028
+ opts.message = logLevel;
13029
+ break;
13030
+ case "object":
13031
+ Object.assign(opts, logLevel);
13032
+ break;
13033
+ default:
13034
+ }
13035
+ if (typeof opts.message === "function") {
13036
+ opts.message = opts.message();
13037
+ }
13038
+ const messageType = typeof opts.message;
13039
+ assert8(messageType === "string" || messageType === "object");
13040
+ return Object.assign(opts, {
13041
+ args
13042
+ }, opts.opts);
13043
+ }
13044
+ function decorateMessage2(id, message, opts) {
13045
+ if (typeof message === "string") {
13046
+ const time = opts.time ? leftPad2(formatTime2(opts.total)) : "";
13047
+ message = opts.time ? "".concat(id, ": ").concat(time, " ").concat(message) : "".concat(id, ": ").concat(message);
13048
+ message = addColor2(message, opts.color, opts.background);
13049
+ }
13050
+ return message;
13051
+ }
13052
+ function logImageInNode2(_ref2) {
13053
+ let {
13054
+ image,
13055
+ message = "",
13056
+ scale: scale5 = 1
13057
+ } = _ref2;
13058
+ console.warn("removed");
13059
+ return noop2;
13060
+ }
13061
+ function logImageInBrowser2(_ref3) {
13062
+ let {
13063
+ image,
13064
+ message = "",
13065
+ scale: scale5 = 1
13066
+ } = _ref3;
13067
+ if (typeof image === "string") {
13068
+ const img = new Image();
13069
+ img.onload = () => {
13070
+ const args = formatImage2(img, message, scale5);
13071
+ console.log(...args);
13072
+ };
13073
+ img.src = image;
13074
+ return noop2;
13075
+ }
13076
+ const element = image.nodeName || "";
13077
+ if (element.toLowerCase() === "img") {
13078
+ console.log(...formatImage2(image, message, scale5));
13079
+ return noop2;
13080
+ }
13081
+ if (element.toLowerCase() === "canvas") {
13082
+ const img = new Image();
13083
+ img.onload = () => console.log(...formatImage2(img, message, scale5));
13084
+ img.src = image.toDataURL();
13085
+ return noop2;
13086
+ }
13087
+ return noop2;
13088
+ }
13089
+ function getTableHeader2(table) {
13090
+ for (const key in table) {
13091
+ for (const title in table[key]) {
13092
+ return title || "untitled";
13093
+ }
13094
+ }
13095
+ return "empty";
13096
+ }
13097
+ var originalConsole2, DEFAULT_LOG_CONFIGURATION2, cache2, ONCE2, Log2;
13098
+ var init_log3 = __esm({
13099
+ "node_modules/@probe.gl/log/dist/log.js"() {
13100
+ init_dist3();
13101
+ init_local_storage2();
13102
+ init_formatters2();
13103
+ init_color2();
13104
+ init_autobind2();
13105
+ init_assert7();
13106
+ init_hi_res_timestamp2();
13107
+ originalConsole2 = {
13108
+ debug: isBrowser5() ? console.debug || console.log : console.log,
13109
+ log: console.log,
13110
+ info: console.info,
13111
+ warn: console.warn,
13112
+ error: console.error
13113
+ };
13114
+ DEFAULT_LOG_CONFIGURATION2 = {
13115
+ enabled: true,
13116
+ level: 0
13117
+ };
13118
+ cache2 = {};
13119
+ ONCE2 = {
13120
+ once: true
13121
+ };
13122
+ Log2 = class {
13123
+ constructor() {
13124
+ let {
13125
+ id
13126
+ } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
13127
+ id: ""
13128
+ };
13129
+ this.id = void 0;
13130
+ this.VERSION = VERSION10;
13131
+ this._startTs = getHiResTimestamp2();
13132
+ this._deltaTs = getHiResTimestamp2();
13133
+ this._storage = void 0;
13134
+ this.userData = {};
13135
+ this.LOG_THROTTLE_TIMEOUT = 0;
13136
+ this.id = id;
13137
+ this.userData = {};
13138
+ this._storage = new LocalStorage2("__probe-".concat(this.id, "__"), DEFAULT_LOG_CONFIGURATION2);
13139
+ this.timeStamp("".concat(this.id, " started"));
13140
+ autobind2(this);
13141
+ Object.seal(this);
13142
+ }
13143
+ set level(newLevel) {
13144
+ this.setLevel(newLevel);
13145
+ }
13146
+ get level() {
13147
+ return this.getLevel();
13148
+ }
13149
+ isEnabled() {
13150
+ return this._storage.config.enabled;
13151
+ }
13152
+ getLevel() {
13153
+ return this._storage.config.level;
13154
+ }
13155
+ getTotal() {
13156
+ return Number((getHiResTimestamp2() - this._startTs).toPrecision(10));
13157
+ }
13158
+ getDelta() {
13159
+ return Number((getHiResTimestamp2() - this._deltaTs).toPrecision(10));
13160
+ }
13161
+ set priority(newPriority) {
13162
+ this.level = newPriority;
13163
+ }
13164
+ get priority() {
13165
+ return this.level;
13166
+ }
13167
+ getPriority() {
13168
+ return this.level;
13169
+ }
13170
+ enable() {
13171
+ let enabled = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
13172
+ this._storage.setConfiguration({
13173
+ enabled
13174
+ });
13175
+ return this;
13176
+ }
13177
+ setLevel(level) {
13178
+ this._storage.setConfiguration({
13179
+ level
13180
+ });
13181
+ return this;
13182
+ }
13183
+ get(setting) {
13184
+ return this._storage.config[setting];
13185
+ }
13186
+ set(setting, value) {
13187
+ this._storage.setConfiguration({
13188
+ [setting]: value
13189
+ });
13190
+ }
13191
+ settings() {
13192
+ if (console.table) {
13193
+ console.table(this._storage.config);
13194
+ } else {
13195
+ console.log(this._storage.config);
13196
+ }
13197
+ }
13198
+ assert(condition, message) {
13199
+ assert8(condition, message);
13200
+ }
13201
+ warn(message) {
13202
+ return this._getLogFunction(0, message, originalConsole2.warn, arguments, ONCE2);
13203
+ }
13204
+ error(message) {
13205
+ return this._getLogFunction(0, message, originalConsole2.error, arguments);
13206
+ }
13207
+ deprecated(oldUsage, newUsage) {
13208
+ return this.warn("`".concat(oldUsage, "` is deprecated and will be removed in a later version. Use `").concat(newUsage, "` instead"));
13209
+ }
13210
+ removed(oldUsage, newUsage) {
13211
+ return this.error("`".concat(oldUsage, "` has been removed. Use `").concat(newUsage, "` instead"));
13212
+ }
13213
+ probe(logLevel, message) {
13214
+ return this._getLogFunction(logLevel, message, originalConsole2.log, arguments, {
13215
+ time: true,
13216
+ once: true
13217
+ });
13218
+ }
13219
+ log(logLevel, message) {
13220
+ return this._getLogFunction(logLevel, message, originalConsole2.debug, arguments);
13221
+ }
13222
+ info(logLevel, message) {
13223
+ return this._getLogFunction(logLevel, message, console.info, arguments);
13224
+ }
13225
+ once(logLevel, message) {
13226
+ return this._getLogFunction(logLevel, message, originalConsole2.debug || originalConsole2.info, arguments, ONCE2);
13227
+ }
13228
+ table(logLevel, table, columns) {
13229
+ if (table) {
13230
+ return this._getLogFunction(logLevel, table, console.table || noop2, columns && [columns], {
13231
+ tag: getTableHeader2(table)
13232
+ });
13233
+ }
13234
+ return noop2;
13235
+ }
13236
+ image(_ref) {
13237
+ let {
13238
+ logLevel,
13239
+ priority,
13240
+ image,
13241
+ message = "",
13242
+ scale: scale5 = 1
13243
+ } = _ref;
13244
+ if (!this._shouldLog(logLevel || priority)) {
13245
+ return noop2;
13246
+ }
13247
+ return isBrowser5() ? logImageInBrowser2({
13248
+ image,
13249
+ message,
13250
+ scale: scale5
13251
+ }) : logImageInNode2({
13252
+ image,
13253
+ message,
13254
+ scale: scale5
13255
+ });
13256
+ }
13257
+ time(logLevel, message) {
13258
+ return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
13259
+ }
13260
+ timeEnd(logLevel, message) {
13261
+ return this._getLogFunction(logLevel, message, console.timeEnd ? console.timeEnd : console.info);
13262
+ }
13263
+ timeStamp(logLevel, message) {
13264
+ return this._getLogFunction(logLevel, message, console.timeStamp || noop2);
13265
+ }
13266
+ group(logLevel, message) {
13267
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
13268
+ collapsed: false
13269
+ };
13270
+ const options = normalizeArguments2({
13271
+ logLevel,
13272
+ message,
13273
+ opts
13274
+ });
13275
+ const {
13276
+ collapsed
13277
+ } = opts;
13278
+ options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
13279
+ return this._getLogFunction(options);
13280
+ }
13281
+ groupCollapsed(logLevel, message) {
13282
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
13283
+ return this.group(logLevel, message, Object.assign({}, opts, {
13284
+ collapsed: true
13285
+ }));
13286
+ }
13287
+ groupEnd(logLevel) {
13288
+ return this._getLogFunction(logLevel, "", console.groupEnd || noop2);
13289
+ }
13290
+ withGroup(logLevel, message, func) {
13291
+ this.group(logLevel, message)();
13292
+ try {
13293
+ func();
13294
+ } finally {
13295
+ this.groupEnd(logLevel)();
13296
+ }
13297
+ }
13298
+ trace() {
13299
+ if (console.trace) {
13300
+ console.trace();
13301
+ }
13302
+ }
13303
+ _shouldLog(logLevel) {
13304
+ return this.isEnabled() && this.getLevel() >= normalizeLogLevel2(logLevel);
13305
+ }
13306
+ _getLogFunction(logLevel, message, method, args, opts) {
13307
+ if (this._shouldLog(logLevel)) {
13308
+ opts = normalizeArguments2({
13309
+ logLevel,
13310
+ message,
13311
+ args,
13312
+ opts
13313
+ });
13314
+ method = method || opts.method;
13315
+ assert8(method);
13316
+ opts.total = this.getTotal();
13317
+ opts.delta = this.getDelta();
13318
+ this._deltaTs = getHiResTimestamp2();
13319
+ const tag = opts.tag || opts.message;
13320
+ if (opts.once && tag) {
13321
+ if (!cache2[tag]) {
13322
+ cache2[tag] = getHiResTimestamp2();
13323
+ } else {
13324
+ return noop2;
13325
+ }
13326
+ }
13327
+ message = decorateMessage2(this.id, opts.message, opts);
13328
+ return method.bind(console, message, ...opts.args);
13329
+ }
13330
+ return noop2;
13331
+ }
13332
+ };
13333
+ Log2.VERSION = VERSION10;
13334
+ }
13335
+ });
13336
+
13337
+ // node_modules/@probe.gl/log/dist/index.js
13338
+ var dist_default2;
13339
+ var init_dist4 = __esm({
13340
+ "node_modules/@probe.gl/log/dist/index.js"() {
13341
+ init_log3();
13342
+ dist_default2 = new Log2({
13343
+ id: "@probe.gl/log"
13344
+ });
13345
+ }
13346
+ });
13347
+
12742
13348
  // ../../node_modules/long/index.js
12743
13349
  function Long(low, high, unsigned) {
12744
13350
  this.low = low | 0;
@@ -12753,27 +13359,27 @@
12753
13359
  return value ? 31 - c : c;
12754
13360
  }
12755
13361
  function fromInt(value, unsigned) {
12756
- var obj, cachedObj, cache2;
13362
+ var obj, cachedObj, cache3;
12757
13363
  if (unsigned) {
12758
13364
  value >>>= 0;
12759
- if (cache2 = 0 <= value && value < 256) {
13365
+ if (cache3 = 0 <= value && value < 256) {
12760
13366
  cachedObj = UINT_CACHE[value];
12761
13367
  if (cachedObj)
12762
13368
  return cachedObj;
12763
13369
  }
12764
13370
  obj = fromBits(value, 0, true);
12765
- if (cache2)
13371
+ if (cache3)
12766
13372
  UINT_CACHE[value] = obj;
12767
13373
  return obj;
12768
13374
  } else {
12769
13375
  value |= 0;
12770
- if (cache2 = -128 <= value && value < 128) {
13376
+ if (cache3 = -128 <= value && value < 128) {
12771
13377
  cachedObj = INT_CACHE[value];
12772
13378
  if (cachedObj)
12773
13379
  return cachedObj;
12774
13380
  }
12775
13381
  obj = fromBits(value, value < 0 ? -1 : 0, false);
12776
- if (cache2)
13382
+ if (cache3)
12777
13383
  INT_CACHE[value] = obj;
12778
13384
  return obj;
12779
13385
  }
@@ -13995,7 +14601,7 @@
13995
14601
  }
13996
14602
  async function parseImplicitTiles(params) {
13997
14603
  const {
13998
- options,
14604
+ implicitOptions,
13999
14605
  parentData = {
14000
14606
  mortonIndex: 0,
14001
14607
  x: 0,
@@ -14010,7 +14616,8 @@
14010
14616
  y: 0,
14011
14617
  z: 0
14012
14618
  },
14013
- s2VolumeBox
14619
+ s2VolumeBox,
14620
+ loaderOptions
14014
14621
  } = params;
14015
14622
  let { subtree, level = 0 } = params;
14016
14623
  const {
@@ -14020,30 +14627,38 @@
14020
14627
  contentUrlTemplate,
14021
14628
  subtreesUriTemplate,
14022
14629
  basePath
14023
- } = options;
14630
+ } = implicitOptions;
14024
14631
  const tile = { children: [], lodMetricValue: 0, contentUrl: "" };
14632
+ if (!maximumLevel) {
14633
+ dist_default2.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${contentUrlTemplate} won't be loaded...`);
14634
+ return tile;
14635
+ }
14636
+ const lev = level + globalData.level;
14637
+ if (lev > maximumLevel) {
14638
+ return tile;
14639
+ }
14025
14640
  const childrenPerTile = SUBDIVISION_COUNT_MAP[subdivisionScheme];
14641
+ const bitsPerTile = Math.log2(childrenPerTile);
14026
14642
  const childX = childIndex & 1;
14027
14643
  const childY = childIndex >> 1 & 1;
14028
14644
  const childZ = childIndex >> 2 & 1;
14029
14645
  const levelOffset = (childrenPerTile ** level - 1) / (childrenPerTile - 1);
14030
- let childTileMortonIndex = concatBits(parentData.mortonIndex, childIndex);
14646
+ let childTileMortonIndex = concatBits(parentData.mortonIndex, childIndex, bitsPerTile);
14031
14647
  let tileAvailabilityIndex = levelOffset + childTileMortonIndex;
14032
- let childTileX = concatBits(parentData.x, childX);
14033
- let childTileY = concatBits(parentData.y, childY);
14034
- let childTileZ = concatBits(parentData.z, childZ);
14648
+ let childTileX = concatBits(parentData.x, childX, 1);
14649
+ let childTileY = concatBits(parentData.y, childY, 1);
14650
+ let childTileZ = concatBits(parentData.z, childZ, 1);
14035
14651
  let isChildSubtreeAvailable = false;
14036
- if (level + 1 > subtreeLevels) {
14652
+ if (level >= subtreeLevels) {
14037
14653
  isChildSubtreeAvailable = getAvailabilityResult(subtree.childSubtreeAvailability, childTileMortonIndex);
14038
14654
  }
14039
- const x = concatBits(globalData.x, childTileX);
14040
- const y = concatBits(globalData.y, childTileY);
14041
- const z = concatBits(globalData.z, childTileZ);
14042
- const lev = level + globalData.level;
14655
+ const x = concatBits(globalData.x, childTileX, level * bitsPerTile);
14656
+ const y = concatBits(globalData.y, childTileY, level * bitsPerTile);
14657
+ const z = concatBits(globalData.z, childTileZ, level * bitsPerTile);
14043
14658
  if (isChildSubtreeAvailable) {
14044
14659
  const subtreePath = `${basePath}/${subtreesUriTemplate}`;
14045
14660
  const childSubtreeUrl = replaceContentUrlTemplate(subtreePath, lev, x, y, z);
14046
- const childSubtree = await load(childSubtreeUrl, Tile3DSubtreeLoader);
14661
+ const childSubtree = await load(childSubtreeUrl, Tile3DSubtreeLoader, loaderOptions);
14047
14662
  subtree = childSubtree;
14048
14663
  globalData.mortonIndex = childTileMortonIndex;
14049
14664
  globalData.x = childTileX;
@@ -14058,7 +14673,7 @@
14058
14673
  level = 0;
14059
14674
  }
14060
14675
  const isTileAvailable = getAvailabilityResult(subtree.tileAvailability, tileAvailabilityIndex);
14061
- if (!isTileAvailable || level > maximumLevel) {
14676
+ if (!isTileAvailable) {
14062
14677
  return tile;
14063
14678
  }
14064
14679
  const isContentAvailable = getAvailabilityResult(subtree.contentAvailability, tileAvailabilityIndex);
@@ -14071,28 +14686,38 @@
14071
14686
  const childS2VolumeBox = getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme);
14072
14687
  const childTileParsed = await parseImplicitTiles({
14073
14688
  subtree,
14074
- options,
14689
+ implicitOptions,
14690
+ loaderOptions,
14075
14691
  parentData: pData,
14076
14692
  childIndex: index,
14077
14693
  level: childTileLevel,
14078
- globalData,
14694
+ globalData: { ...globalData },
14079
14695
  s2VolumeBox: childS2VolumeBox
14080
14696
  });
14081
14697
  if (childTileParsed.contentUrl || childTileParsed.children.length) {
14082
14698
  const globalLevel = lev + 1;
14083
14699
  const childCoordinates = { childTileX, childTileY, childTileZ };
14084
- const formattedTile = formatTileData(childTileParsed, globalLevel, childCoordinates, options, s2VolumeBox);
14700
+ const formattedTile = formatTileData(childTileParsed, globalLevel, childCoordinates, implicitOptions, s2VolumeBox);
14085
14701
  tile.children.push(formattedTile);
14086
14702
  }
14087
14703
  }
14088
14704
  return tile;
14089
14705
  }
14090
14706
  function getAvailabilityResult(availabilityData, index) {
14091
- if ("constant" in availabilityData) {
14092
- return Boolean(availabilityData.constant);
14707
+ let availabilityObject;
14708
+ if (Array.isArray(availabilityData)) {
14709
+ availabilityObject = availabilityData[0];
14710
+ if (availabilityData.length > 1) {
14711
+ dist_default2.once('Not supported extension "3DTILES_multiple_contents" has been detected');
14712
+ }
14713
+ } else {
14714
+ availabilityObject = availabilityData;
14715
+ }
14716
+ if ("constant" in availabilityObject) {
14717
+ return Boolean(availabilityObject.constant);
14093
14718
  }
14094
- if (availabilityData.explicitBitstream) {
14095
- return getBooleanValueFromBitstream(index, availabilityData.explicitBitstream);
14719
+ if (availabilityObject.explicitBitstream) {
14720
+ return getBooleanValueFromBitstream(index, availabilityObject.explicitBitstream);
14096
14721
  }
14097
14722
  return false;
14098
14723
  }
@@ -14147,8 +14772,8 @@
14147
14772
  }
14148
14773
  throw new Error(`Unsupported bounding volume type ${rootBoundingVolume}`);
14149
14774
  }
14150
- function concatBits(first, second) {
14151
- return parseInt(first.toString(2) + second.toString(2), 2);
14775
+ function concatBits(higher, lower, shift) {
14776
+ return (higher << shift) + lower;
14152
14777
  }
14153
14778
  function replaceContentUrlTemplate(templateUrl, level, x, y, z) {
14154
14779
  const mapUrl = generateMapUrl({ level, x, y, z });
@@ -14172,6 +14797,7 @@
14172
14797
  "src/lib/parsers/helpers/parse-3d-implicit-tiles.ts"() {
14173
14798
  init_tile_3d_subtree_loader();
14174
14799
  init_src3();
14800
+ init_dist4();
14175
14801
  init_s2();
14176
14802
  init_s2_corners_to_obb();
14177
14803
  QUADTREE_DEVISION_COUNT = 4;
@@ -14280,6 +14906,7 @@
14280
14906
  const {
14281
14907
  subdivisionScheme,
14282
14908
  maximumLevel,
14909
+ availableLevels,
14283
14910
  subtreeLevels,
14284
14911
  subtrees: { uri: subtreesUriTemplate }
14285
14912
  } = implicitTilingExtension;
@@ -14301,7 +14928,7 @@
14301
14928
  subtreesUriTemplate,
14302
14929
  subdivisionScheme,
14303
14930
  subtreeLevels,
14304
- maximumLevel,
14931
+ maximumLevel: Number.isFinite(availableLevels) ? availableLevels - 1 : maximumLevel,
14305
14932
  refine,
14306
14933
  basePath,
14307
14934
  lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,
@@ -14310,15 +14937,16 @@
14310
14937
  getTileType,
14311
14938
  getRefine
14312
14939
  };
14313
- return await normalizeImplicitTileData(tile, basePath, subtree, implicitOptions);
14940
+ return await normalizeImplicitTileData(tile, basePath, subtree, implicitOptions, options);
14314
14941
  }
14315
- async function normalizeImplicitTileData(tile, basePath, rootSubtree, options) {
14942
+ async function normalizeImplicitTileData(tile, basePath, rootSubtree, implicitOptions, loaderOptions) {
14316
14943
  if (!tile) {
14317
14944
  return null;
14318
14945
  }
14319
14946
  const { children, contentUrl } = await parseImplicitTiles({
14320
14947
  subtree: rootSubtree,
14321
- options
14948
+ implicitOptions,
14949
+ loaderOptions
14322
14950
  });
14323
14951
  let tileContentUrl;
14324
14952
  let tileContent = null;