@loaders.gl/3d-tiles 3.1.3 → 3.1.7

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
@@ -879,6 +879,25 @@
879
879
  }
880
880
  });
881
881
 
882
+ // ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
883
+ function _defineProperty(obj, key, value) {
884
+ if (key in obj) {
885
+ Object.defineProperty(obj, key, {
886
+ value,
887
+ enumerable: true,
888
+ configurable: true,
889
+ writable: true
890
+ });
891
+ } else {
892
+ obj[key] = value;
893
+ }
894
+ return obj;
895
+ }
896
+ var init_defineProperty = __esm({
897
+ "../../node_modules/@babel/runtime/helpers/esm/defineProperty.js"() {
898
+ }
899
+ });
900
+
882
901
  // ../loader-utils/src/lib/path-utils/file-aliases.ts
883
902
  function resolvePath(filename2) {
884
903
  for (const alias in fileAliases) {
@@ -5291,6 +5310,638 @@
5291
5310
  }
5292
5311
  });
5293
5312
 
5313
+ // ../../node_modules/@probe.gl/env/dist/esm/lib/is-electron.js
5314
+ function isElectron2(mockUserAgent) {
5315
+ if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
5316
+ return true;
5317
+ }
5318
+ if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions.electron)) {
5319
+ return true;
5320
+ }
5321
+ const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
5322
+ const userAgent = mockUserAgent || realUserAgent;
5323
+ if (userAgent && userAgent.indexOf("Electron") >= 0) {
5324
+ return true;
5325
+ }
5326
+ return false;
5327
+ }
5328
+ var init_is_electron2 = __esm({
5329
+ "../../node_modules/@probe.gl/env/dist/esm/lib/is-electron.js"() {
5330
+ }
5331
+ });
5332
+
5333
+ // ../../node_modules/@probe.gl/env/dist/esm/lib/is-browser.js
5334
+ function isBrowser5() {
5335
+ const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
5336
+ return !isNode || isElectron2();
5337
+ }
5338
+ var init_is_browser2 = __esm({
5339
+ "../../node_modules/@probe.gl/env/dist/esm/lib/is-browser.js"() {
5340
+ init_is_electron2();
5341
+ }
5342
+ });
5343
+
5344
+ // ../../node_modules/@probe.gl/env/dist/esm/lib/globals.js
5345
+ var globals5, self_4, window_4, document_4, process_2;
5346
+ var init_globals5 = __esm({
5347
+ "../../node_modules/@probe.gl/env/dist/esm/lib/globals.js"() {
5348
+ globals5 = {
5349
+ self: typeof self !== "undefined" && self,
5350
+ window: typeof window !== "undefined" && window,
5351
+ global: typeof global !== "undefined" && global,
5352
+ document: typeof document !== "undefined" && document,
5353
+ process: typeof process === "object" && process
5354
+ };
5355
+ self_4 = globals5.self || globals5.window || globals5.global;
5356
+ window_4 = globals5.window || globals5.self || globals5.global;
5357
+ document_4 = globals5.document || {};
5358
+ process_2 = globals5.process || {};
5359
+ }
5360
+ });
5361
+
5362
+ // ../../node_modules/@probe.gl/env/dist/esm/utils/globals.js
5363
+ var VERSION4, isBrowser6;
5364
+ var init_globals6 = __esm({
5365
+ "../../node_modules/@probe.gl/env/dist/esm/utils/globals.js"() {
5366
+ init_is_browser2();
5367
+ VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
5368
+ isBrowser6 = isBrowser5();
5369
+ }
5370
+ });
5371
+
5372
+ // ../../node_modules/@probe.gl/env/dist/esm/index.js
5373
+ var init_esm5 = __esm({
5374
+ "../../node_modules/@probe.gl/env/dist/esm/index.js"() {
5375
+ init_globals6();
5376
+ init_globals5();
5377
+ init_is_browser2();
5378
+ }
5379
+ });
5380
+
5381
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/local-storage.js
5382
+ function getStorage2(type) {
5383
+ try {
5384
+ const storage = window[type];
5385
+ const x = "__storage_test__";
5386
+ storage.setItem(x, x);
5387
+ storage.removeItem(x);
5388
+ return storage;
5389
+ } catch (e) {
5390
+ return null;
5391
+ }
5392
+ }
5393
+ var LocalStorage2;
5394
+ var init_local_storage2 = __esm({
5395
+ "../../node_modules/@probe.gl/log/dist/esm/utils/local-storage.js"() {
5396
+ init_defineProperty();
5397
+ LocalStorage2 = class {
5398
+ constructor(id) {
5399
+ let defaultSettings = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
5400
+ let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
5401
+ _defineProperty(this, "storage", void 0);
5402
+ _defineProperty(this, "id", void 0);
5403
+ _defineProperty(this, "config", {});
5404
+ this.storage = getStorage2(type);
5405
+ this.id = id;
5406
+ this.config = {};
5407
+ Object.assign(this.config, defaultSettings);
5408
+ this._loadConfiguration();
5409
+ }
5410
+ getConfiguration() {
5411
+ return this.config;
5412
+ }
5413
+ setConfiguration(configuration) {
5414
+ this.config = {};
5415
+ return this.updateConfiguration(configuration);
5416
+ }
5417
+ updateConfiguration(configuration) {
5418
+ Object.assign(this.config, configuration);
5419
+ if (this.storage) {
5420
+ const serialized = JSON.stringify(this.config);
5421
+ this.storage.setItem(this.id, serialized);
5422
+ }
5423
+ return this;
5424
+ }
5425
+ _loadConfiguration() {
5426
+ let configuration = {};
5427
+ if (this.storage) {
5428
+ const serializedConfiguration = this.storage.getItem(this.id);
5429
+ configuration = serializedConfiguration ? JSON.parse(serializedConfiguration) : {};
5430
+ }
5431
+ Object.assign(this.config, configuration);
5432
+ return this;
5433
+ }
5434
+ };
5435
+ }
5436
+ });
5437
+
5438
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/formatters.js
5439
+ function formatTime2(ms) {
5440
+ let formatted;
5441
+ if (ms < 10) {
5442
+ formatted = "".concat(ms.toFixed(2), "ms");
5443
+ } else if (ms < 100) {
5444
+ formatted = "".concat(ms.toFixed(1), "ms");
5445
+ } else if (ms < 1e3) {
5446
+ formatted = "".concat(ms.toFixed(0), "ms");
5447
+ } else {
5448
+ formatted = "".concat((ms / 1e3).toFixed(2), "s");
5449
+ }
5450
+ return formatted;
5451
+ }
5452
+ function leftPad2(string) {
5453
+ let length4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
5454
+ const padLength = Math.max(length4 - string.length, 0);
5455
+ return "".concat(" ".repeat(padLength)).concat(string);
5456
+ }
5457
+ function formatImage2(image, message, scale5) {
5458
+ let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
5459
+ const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
5460
+ if (image.width > maxWidth) {
5461
+ scale5 = Math.min(scale5, maxWidth / image.width);
5462
+ }
5463
+ const width = image.width * scale5;
5464
+ const height = image.height * scale5;
5465
+ 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("");
5466
+ return ["".concat(message, " %c+"), style];
5467
+ }
5468
+ var init_formatters2 = __esm({
5469
+ "../../node_modules/@probe.gl/log/dist/esm/utils/formatters.js"() {
5470
+ }
5471
+ });
5472
+
5473
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/color.js
5474
+ function getColor2(color) {
5475
+ return typeof color === "string" ? COLOR2[color.toUpperCase()] || COLOR2.WHITE : color;
5476
+ }
5477
+ function addColor2(string, color, background) {
5478
+ if (!isBrowser5 && typeof string === "string") {
5479
+ if (color) {
5480
+ color = getColor2(color);
5481
+ string = "[".concat(color, "m").concat(string, "");
5482
+ }
5483
+ if (background) {
5484
+ color = getColor2(background);
5485
+ string = "[".concat(background + 10, "m").concat(string, "");
5486
+ }
5487
+ }
5488
+ return string;
5489
+ }
5490
+ var COLOR2;
5491
+ var init_color2 = __esm({
5492
+ "../../node_modules/@probe.gl/log/dist/esm/utils/color.js"() {
5493
+ init_esm5();
5494
+ (function(COLOR3) {
5495
+ COLOR3[COLOR3["BLACK"] = 30] = "BLACK";
5496
+ COLOR3[COLOR3["RED"] = 31] = "RED";
5497
+ COLOR3[COLOR3["GREEN"] = 32] = "GREEN";
5498
+ COLOR3[COLOR3["YELLOW"] = 33] = "YELLOW";
5499
+ COLOR3[COLOR3["BLUE"] = 34] = "BLUE";
5500
+ COLOR3[COLOR3["MAGENTA"] = 35] = "MAGENTA";
5501
+ COLOR3[COLOR3["CYAN"] = 36] = "CYAN";
5502
+ COLOR3[COLOR3["WHITE"] = 37] = "WHITE";
5503
+ COLOR3[COLOR3["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
5504
+ COLOR3[COLOR3["BRIGHT_RED"] = 91] = "BRIGHT_RED";
5505
+ COLOR3[COLOR3["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
5506
+ COLOR3[COLOR3["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
5507
+ COLOR3[COLOR3["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
5508
+ COLOR3[COLOR3["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
5509
+ COLOR3[COLOR3["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
5510
+ COLOR3[COLOR3["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
5511
+ })(COLOR2 || (COLOR2 = {}));
5512
+ }
5513
+ });
5514
+
5515
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/autobind.js
5516
+ function autobind2(obj) {
5517
+ let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
5518
+ const proto = Object.getPrototypeOf(obj);
5519
+ const propNames = Object.getOwnPropertyNames(proto);
5520
+ for (const key of propNames) {
5521
+ if (typeof obj[key] === "function") {
5522
+ if (!predefined.find((name8) => key === name8)) {
5523
+ obj[key] = obj[key].bind(obj);
5524
+ }
5525
+ }
5526
+ }
5527
+ }
5528
+ var init_autobind2 = __esm({
5529
+ "../../node_modules/@probe.gl/log/dist/esm/utils/autobind.js"() {
5530
+ }
5531
+ });
5532
+
5533
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/assert.js
5534
+ function assert6(condition, message) {
5535
+ if (!condition) {
5536
+ throw new Error(message || "Assertion failed");
5537
+ }
5538
+ }
5539
+ var init_assert5 = __esm({
5540
+ "../../node_modules/@probe.gl/log/dist/esm/utils/assert.js"() {
5541
+ }
5542
+ });
5543
+
5544
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/hi-res-timestamp.js
5545
+ function getHiResTimestamp3() {
5546
+ let timestamp;
5547
+ if (isBrowser5 && "performance" in window_4) {
5548
+ var _window$performance, _window$performance$n;
5549
+ 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);
5550
+ } else if ("hrtime" in process_2) {
5551
+ var _process$hrtime;
5552
+ 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);
5553
+ timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
5554
+ } else {
5555
+ timestamp = Date.now();
5556
+ }
5557
+ return timestamp;
5558
+ }
5559
+ var init_hi_res_timestamp3 = __esm({
5560
+ "../../node_modules/@probe.gl/log/dist/esm/utils/hi-res-timestamp.js"() {
5561
+ init_esm5();
5562
+ }
5563
+ });
5564
+
5565
+ // ../../node_modules/@probe.gl/log/dist/esm/log.js
5566
+ function noop3() {
5567
+ }
5568
+ function normalizeLogLevel2(logLevel) {
5569
+ if (!logLevel) {
5570
+ return 0;
5571
+ }
5572
+ let resolvedLevel;
5573
+ switch (typeof logLevel) {
5574
+ case "number":
5575
+ resolvedLevel = logLevel;
5576
+ break;
5577
+ case "object":
5578
+ resolvedLevel = logLevel.logLevel || logLevel.priority || 0;
5579
+ break;
5580
+ default:
5581
+ return 0;
5582
+ }
5583
+ assert6(Number.isFinite(resolvedLevel) && resolvedLevel >= 0);
5584
+ return resolvedLevel;
5585
+ }
5586
+ function normalizeArguments2(opts) {
5587
+ const {
5588
+ logLevel,
5589
+ message
5590
+ } = opts;
5591
+ opts.logLevel = normalizeLogLevel2(logLevel);
5592
+ const args = opts.args ? Array.from(opts.args) : [];
5593
+ while (args.length && args.shift() !== message) {
5594
+ }
5595
+ switch (typeof logLevel) {
5596
+ case "string":
5597
+ case "function":
5598
+ if (message !== void 0) {
5599
+ args.unshift(message);
5600
+ }
5601
+ opts.message = logLevel;
5602
+ break;
5603
+ case "object":
5604
+ Object.assign(opts, logLevel);
5605
+ break;
5606
+ default:
5607
+ }
5608
+ if (typeof opts.message === "function") {
5609
+ opts.message = opts.message();
5610
+ }
5611
+ const messageType = typeof opts.message;
5612
+ assert6(messageType === "string" || messageType === "object");
5613
+ return Object.assign(opts, {
5614
+ args
5615
+ }, opts.opts);
5616
+ }
5617
+ function decorateMessage2(id, message, opts) {
5618
+ if (typeof message === "string") {
5619
+ const time = opts.time ? leftPad2(formatTime2(opts.total)) : "";
5620
+ message = opts.time ? "".concat(id, ": ").concat(time, " ").concat(message) : "".concat(id, ": ").concat(message);
5621
+ message = addColor2(message, opts.color, opts.background);
5622
+ }
5623
+ return message;
5624
+ }
5625
+ function logImageInNode2(_ref2) {
5626
+ let {
5627
+ image,
5628
+ message = "",
5629
+ scale: scale5 = 1
5630
+ } = _ref2;
5631
+ let asciify = null;
5632
+ try {
5633
+ asciify = module.require("asciify-image");
5634
+ } catch (error) {
5635
+ }
5636
+ if (asciify) {
5637
+ return () => asciify(image, {
5638
+ fit: "box",
5639
+ width: "".concat(Math.round(80 * scale5), "%")
5640
+ }).then((data) => console.log(data));
5641
+ }
5642
+ return noop3;
5643
+ }
5644
+ function logImageInBrowser2(_ref3) {
5645
+ let {
5646
+ image,
5647
+ message = "",
5648
+ scale: scale5 = 1
5649
+ } = _ref3;
5650
+ if (typeof image === "string") {
5651
+ const img = new Image();
5652
+ img.onload = () => {
5653
+ const args = formatImage2(img, message, scale5);
5654
+ console.log(...args);
5655
+ };
5656
+ img.src = image;
5657
+ return noop3;
5658
+ }
5659
+ const element = image.nodeName || "";
5660
+ if (element.toLowerCase() === "img") {
5661
+ console.log(...formatImage2(image, message, scale5));
5662
+ return noop3;
5663
+ }
5664
+ if (element.toLowerCase() === "canvas") {
5665
+ const img = new Image();
5666
+ img.onload = () => console.log(...formatImage2(img, message, scale5));
5667
+ img.src = image.toDataURL();
5668
+ return noop3;
5669
+ }
5670
+ return noop3;
5671
+ }
5672
+ function getTableHeader2(table) {
5673
+ for (const key in table) {
5674
+ for (const title in table[key]) {
5675
+ return title || "untitled";
5676
+ }
5677
+ }
5678
+ return "empty";
5679
+ }
5680
+ var originalConsole2, DEFAULT_SETTINGS2, cache2, ONCE2, Log2;
5681
+ var init_log2 = __esm({
5682
+ "../../node_modules/@probe.gl/log/dist/esm/log.js"() {
5683
+ init_defineProperty();
5684
+ init_esm5();
5685
+ init_local_storage2();
5686
+ init_formatters2();
5687
+ init_color2();
5688
+ init_autobind2();
5689
+ init_assert5();
5690
+ init_hi_res_timestamp3();
5691
+ originalConsole2 = {
5692
+ debug: isBrowser5 ? console.debug || console.log : console.log,
5693
+ log: console.log,
5694
+ info: console.info,
5695
+ warn: console.warn,
5696
+ error: console.error
5697
+ };
5698
+ DEFAULT_SETTINGS2 = {
5699
+ enabled: true,
5700
+ level: 0
5701
+ };
5702
+ cache2 = {};
5703
+ ONCE2 = {
5704
+ once: true
5705
+ };
5706
+ Log2 = class {
5707
+ constructor() {
5708
+ let {
5709
+ id
5710
+ } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
5711
+ id: ""
5712
+ };
5713
+ _defineProperty(this, "id", void 0);
5714
+ _defineProperty(this, "VERSION", VERSION4);
5715
+ _defineProperty(this, "_startTs", getHiResTimestamp3());
5716
+ _defineProperty(this, "_deltaTs", getHiResTimestamp3());
5717
+ _defineProperty(this, "_storage", void 0);
5718
+ _defineProperty(this, "userData", {});
5719
+ _defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
5720
+ this.id = id;
5721
+ this._storage = new LocalStorage2("__probe-".concat(this.id, "__"), DEFAULT_SETTINGS2);
5722
+ this.userData = {};
5723
+ this.timeStamp("".concat(this.id, " started"));
5724
+ autobind2(this);
5725
+ Object.seal(this);
5726
+ }
5727
+ set level(newLevel) {
5728
+ this.setLevel(newLevel);
5729
+ }
5730
+ get level() {
5731
+ return this.getLevel();
5732
+ }
5733
+ isEnabled() {
5734
+ return this._storage.config.enabled;
5735
+ }
5736
+ getLevel() {
5737
+ return this._storage.config.level;
5738
+ }
5739
+ getTotal() {
5740
+ return Number((getHiResTimestamp3() - this._startTs).toPrecision(10));
5741
+ }
5742
+ getDelta() {
5743
+ return Number((getHiResTimestamp3() - this._deltaTs).toPrecision(10));
5744
+ }
5745
+ set priority(newPriority) {
5746
+ this.level = newPriority;
5747
+ }
5748
+ get priority() {
5749
+ return this.level;
5750
+ }
5751
+ getPriority() {
5752
+ return this.level;
5753
+ }
5754
+ enable() {
5755
+ let enabled = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
5756
+ this._storage.updateConfiguration({
5757
+ enabled
5758
+ });
5759
+ return this;
5760
+ }
5761
+ setLevel(level) {
5762
+ this._storage.updateConfiguration({
5763
+ level
5764
+ });
5765
+ return this;
5766
+ }
5767
+ get(setting) {
5768
+ return this._storage.config[setting];
5769
+ }
5770
+ set(setting, value) {
5771
+ this._storage.updateConfiguration({
5772
+ [setting]: value
5773
+ });
5774
+ }
5775
+ settings() {
5776
+ if (console.table) {
5777
+ console.table(this._storage.config);
5778
+ } else {
5779
+ console.log(this._storage.config);
5780
+ }
5781
+ }
5782
+ assert(condition, message) {
5783
+ assert6(condition, message);
5784
+ }
5785
+ warn(message) {
5786
+ return this._getLogFunction(0, message, originalConsole2.warn, arguments, ONCE2);
5787
+ }
5788
+ error(message) {
5789
+ return this._getLogFunction(0, message, originalConsole2.error, arguments);
5790
+ }
5791
+ deprecated(oldUsage, newUsage) {
5792
+ return this.warn("`".concat(oldUsage, "` is deprecated and will be removed in a later version. Use `").concat(newUsage, "` instead"));
5793
+ }
5794
+ removed(oldUsage, newUsage) {
5795
+ return this.error("`".concat(oldUsage, "` has been removed. Use `").concat(newUsage, "` instead"));
5796
+ }
5797
+ probe(logLevel, message) {
5798
+ return this._getLogFunction(logLevel, message, originalConsole2.log, arguments, {
5799
+ time: true,
5800
+ once: true
5801
+ });
5802
+ }
5803
+ log(logLevel, message) {
5804
+ return this._getLogFunction(logLevel, message, originalConsole2.debug, arguments);
5805
+ }
5806
+ info(logLevel, message) {
5807
+ return this._getLogFunction(logLevel, message, console.info, arguments);
5808
+ }
5809
+ once(logLevel, message) {
5810
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
5811
+ args[_key - 2] = arguments[_key];
5812
+ }
5813
+ return this._getLogFunction(logLevel, message, originalConsole2.debug || originalConsole2.info, arguments, ONCE2);
5814
+ }
5815
+ table(logLevel, table, columns) {
5816
+ if (table) {
5817
+ return this._getLogFunction(logLevel, table, console.table || noop3, columns && [columns], {
5818
+ tag: getTableHeader2(table)
5819
+ });
5820
+ }
5821
+ return noop3;
5822
+ }
5823
+ image(_ref) {
5824
+ let {
5825
+ logLevel,
5826
+ priority,
5827
+ image,
5828
+ message = "",
5829
+ scale: scale5 = 1
5830
+ } = _ref;
5831
+ if (!this._shouldLog(logLevel || priority)) {
5832
+ return noop3;
5833
+ }
5834
+ return isBrowser5 ? logImageInBrowser2({
5835
+ image,
5836
+ message,
5837
+ scale: scale5
5838
+ }) : logImageInNode2({
5839
+ image,
5840
+ message,
5841
+ scale: scale5
5842
+ });
5843
+ }
5844
+ time(logLevel, message) {
5845
+ return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
5846
+ }
5847
+ timeEnd(logLevel, message) {
5848
+ return this._getLogFunction(logLevel, message, console.timeEnd ? console.timeEnd : console.info);
5849
+ }
5850
+ timeStamp(logLevel, message) {
5851
+ return this._getLogFunction(logLevel, message, console.timeStamp || noop3);
5852
+ }
5853
+ group(logLevel, message) {
5854
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
5855
+ collapsed: false
5856
+ };
5857
+ const options = normalizeArguments2({
5858
+ logLevel,
5859
+ message,
5860
+ opts
5861
+ });
5862
+ const {
5863
+ collapsed
5864
+ } = opts;
5865
+ options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
5866
+ return this._getLogFunction(options);
5867
+ }
5868
+ groupCollapsed(logLevel, message) {
5869
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
5870
+ return this.group(logLevel, message, Object.assign({}, opts, {
5871
+ collapsed: true
5872
+ }));
5873
+ }
5874
+ groupEnd(logLevel) {
5875
+ return this._getLogFunction(logLevel, "", console.groupEnd || noop3);
5876
+ }
5877
+ withGroup(logLevel, message, func) {
5878
+ this.group(logLevel, message)();
5879
+ try {
5880
+ func();
5881
+ } finally {
5882
+ this.groupEnd(logLevel)();
5883
+ }
5884
+ }
5885
+ trace() {
5886
+ if (console.trace) {
5887
+ console.trace();
5888
+ }
5889
+ }
5890
+ _shouldLog(logLevel) {
5891
+ return this.isEnabled() && this.getLevel() >= normalizeLogLevel2(logLevel);
5892
+ }
5893
+ _getLogFunction(logLevel, message, method, args, opts) {
5894
+ if (this._shouldLog(logLevel)) {
5895
+ opts = normalizeArguments2({
5896
+ logLevel,
5897
+ message,
5898
+ args,
5899
+ opts
5900
+ });
5901
+ method = method || opts.method;
5902
+ assert6(method);
5903
+ opts.total = this.getTotal();
5904
+ opts.delta = this.getDelta();
5905
+ this._deltaTs = getHiResTimestamp3();
5906
+ const tag = opts.tag || opts.message;
5907
+ if (opts.once) {
5908
+ if (!cache2[tag]) {
5909
+ cache2[tag] = getHiResTimestamp3();
5910
+ } else {
5911
+ return noop3;
5912
+ }
5913
+ }
5914
+ message = decorateMessage2(this.id, opts.message, opts);
5915
+ return method.bind(console, message, ...opts.args);
5916
+ }
5917
+ return noop3;
5918
+ }
5919
+ };
5920
+ _defineProperty(Log2, "VERSION", VERSION4);
5921
+ }
5922
+ });
5923
+
5924
+ // ../../node_modules/@probe.gl/log/dist/esm/index.js
5925
+ var esm_default2;
5926
+ var init_esm6 = __esm({
5927
+ "../../node_modules/@probe.gl/log/dist/esm/index.js"() {
5928
+ init_log2();
5929
+ init_log2();
5930
+ esm_default2 = new Log2({
5931
+ id: "@probe.gl/log"
5932
+ });
5933
+ }
5934
+ });
5935
+
5936
+ // ../core/src/lib/utils/log.ts
5937
+ var log;
5938
+ var init_log3 = __esm({
5939
+ "../core/src/lib/utils/log.ts"() {
5940
+ init_esm6();
5941
+ log = new Log2({ id: "loaders.gl" });
5942
+ }
5943
+ });
5944
+
5294
5945
  // ../core/src/lib/api/select-loader.ts
5295
5946
  async function selectLoader(data, loaders = [], options, context) {
5296
5947
  if (!validHTTPResponse(data)) {
@@ -5334,13 +5985,22 @@
5334
5985
  const { url, type } = getResourceUrlAndType(data);
5335
5986
  const testUrl = url || context?.url;
5336
5987
  let loader = null;
5988
+ let reason = "";
5337
5989
  if (options?.mimeType) {
5338
5990
  loader = findLoaderByMIMEType(loaders, options?.mimeType);
5991
+ reason = `match forced by supplied MIME type ${options?.mimeType}`;
5339
5992
  }
5340
5993
  loader = loader || findLoaderByUrl(loaders, testUrl);
5994
+ reason = reason || (loader ? `matched url ${testUrl}` : "");
5341
5995
  loader = loader || findLoaderByMIMEType(loaders, type);
5996
+ reason = reason || (loader ? `matched MIME type ${type}` : "");
5342
5997
  loader = loader || findLoaderByInitialBytes(loaders, data);
5998
+ reason = reason || (loader ? `matched initial data ${getFirstCharacters2(data)}` : "");
5343
5999
  loader = loader || findLoaderByMIMEType(loaders, options?.fallbackMimeType);
6000
+ reason = reason || (loader ? `matched fallback MIME type ${type}` : "");
6001
+ if (reason) {
6002
+ log.log(1, `selectLoader selected ${loader?.name}: ${reason}.`);
6003
+ }
5344
6004
  return loader;
5345
6005
  }
5346
6006
  function validHTTPResponse(data) {
@@ -5467,6 +6127,7 @@
5467
6127
  "../core/src/lib/api/select-loader.ts"() {
5468
6128
  init_src2();
5469
6129
  init_normalize_loader();
6130
+ init_log3();
5470
6131
  init_resource_utils();
5471
6132
  init_register_loaders();
5472
6133
  init_is_type();
@@ -5812,10 +6473,10 @@
5812
6473
  });
5813
6474
 
5814
6475
  // src/lib/utils/version.ts
5815
- var VERSION4;
6476
+ var VERSION5;
5816
6477
  var init_version2 = __esm({
5817
6478
  "src/lib/utils/version.ts"() {
5818
- VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
6479
+ VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
5819
6480
  }
5820
6481
  });
5821
6482
 
@@ -5861,10 +6522,10 @@
5861
6522
  });
5862
6523
 
5863
6524
  // ../draco/src/lib/utils/version.ts
5864
- var VERSION5;
6525
+ var VERSION6;
5865
6526
  var init_version3 = __esm({
5866
6527
  "../draco/src/lib/utils/version.ts"() {
5867
- VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
6528
+ VERSION6 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
5868
6529
  }
5869
6530
  });
5870
6531
 
@@ -5886,7 +6547,7 @@
5886
6547
  id: "draco",
5887
6548
  module: "draco",
5888
6549
  shapes: ["mesh"],
5889
- version: VERSION5,
6550
+ version: VERSION6,
5890
6551
  worker: true,
5891
6552
  extensions: ["drc"],
5892
6553
  mimeTypes: ["application/octet-stream"],
@@ -5929,12 +6590,12 @@
5929
6590
  });
5930
6591
 
5931
6592
  // ../schema/src/lib/utils/assert.ts
5932
- function assert6(condition, message) {
6593
+ function assert7(condition, message) {
5933
6594
  if (!condition) {
5934
6595
  throw new Error(message || "loader assertion failed.");
5935
6596
  }
5936
6597
  }
5937
- var init_assert5 = __esm({
6598
+ var init_assert6 = __esm({
5938
6599
  "../schema/src/lib/utils/assert.ts"() {
5939
6600
  }
5940
6601
  });
@@ -5955,10 +6616,10 @@
5955
6616
  var Schema;
5956
6617
  var init_schema = __esm({
5957
6618
  "../schema/src/lib/schema/impl/schema.ts"() {
5958
- init_assert5();
6619
+ init_assert6();
5959
6620
  Schema = class {
5960
6621
  constructor(fields, metadata) {
5961
- assert6(Array.isArray(fields));
6622
+ assert7(Array.isArray(fields));
5962
6623
  checkNames(fields);
5963
6624
  this.fields = fields;
5964
6625
  this.metadata = metadata || new Map();
@@ -7046,12 +7707,12 @@
7046
7707
  });
7047
7708
 
7048
7709
  // ../math/src/geometry/utils/assert.ts
7049
- function assert7(condition, message) {
7710
+ function assert8(condition, message) {
7050
7711
  if (!condition) {
7051
7712
  throw new Error(`math.gl assertion failed. ${message}`);
7052
7713
  }
7053
7714
  }
7054
- var init_assert6 = __esm({
7715
+ var init_assert7 = __esm({
7055
7716
  "../math/src/geometry/utils/assert.ts"() {
7056
7717
  }
7057
7718
  });
@@ -7079,7 +7740,7 @@
7079
7740
  return value < 0 ? -1 : 1;
7080
7741
  }
7081
7742
  function octDecodeInRange(x, y, rangeMax, result) {
7082
- assert7(result);
7743
+ assert8(result);
7083
7744
  if (x < 0 || x > rangeMax || y < 0 || y > rangeMax) {
7084
7745
  throw new Error(`x and y must be unsigned normalized integers between 0 and ${rangeMax}`);
7085
7746
  }
@@ -7100,7 +7761,7 @@
7100
7761
  var init_attribute_compression = __esm({
7101
7762
  "../math/src/geometry/compression/attribute-compression.ts"() {
7102
7763
  init_esm();
7103
- init_assert6();
7764
+ init_assert7();
7104
7765
  RIGHT_SHIFT = 1 / 256;
7105
7766
  scratchVector23 = new Vector2();
7106
7767
  scratchVector32 = new Vector3();
@@ -8152,18 +8813,18 @@
8152
8813
  });
8153
8814
 
8154
8815
  // ../gltf/src/lib/utils/version.ts
8155
- var VERSION6;
8816
+ var VERSION7;
8156
8817
  var init_version4 = __esm({
8157
8818
  "../gltf/src/lib/utils/version.ts"() {
8158
- VERSION6 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
8819
+ VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
8159
8820
  }
8160
8821
  });
8161
8822
 
8162
8823
  // ../textures/src/lib/utils/version.ts
8163
- var VERSION7;
8824
+ var VERSION8;
8164
8825
  var init_version5 = __esm({
8165
8826
  "../textures/src/lib/utils/version.ts"() {
8166
- VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
8827
+ VERSION8 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
8167
8828
  }
8168
8829
  });
8169
8830
 
@@ -8230,13 +8891,13 @@
8230
8891
  });
8231
8892
  });
8232
8893
  }
8233
- var VERSION8, BASIS_CDN_ENCODER_WASM, BASIS_CDN_ENCODER_JS, loadBasisTranscoderPromise, loadBasisEncoderPromise;
8894
+ var VERSION9, BASIS_CDN_ENCODER_WASM, BASIS_CDN_ENCODER_JS, loadBasisTranscoderPromise, loadBasisEncoderPromise;
8234
8895
  var init_basis_module_loader = __esm({
8235
8896
  "../textures/src/lib/parsers/basis-module-loader.ts"() {
8236
8897
  init_src();
8237
- VERSION8 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
8238
- BASIS_CDN_ENCODER_WASM = `https://unpkg.com/@loaders.gl/textures@${VERSION8}/dist/libs/basis_encoder.wasm`;
8239
- BASIS_CDN_ENCODER_JS = `https://unpkg.com/@loaders.gl/textures@${VERSION8}/dist/libs/basis_encoder.js`;
8898
+ VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
8899
+ BASIS_CDN_ENCODER_WASM = `https://unpkg.com/@loaders.gl/textures@${VERSION9}/dist/libs/basis_encoder.wasm`;
8900
+ BASIS_CDN_ENCODER_JS = `https://unpkg.com/@loaders.gl/textures@${VERSION9}/dist/libs/basis_encoder.js`;
8240
8901
  }
8241
8902
  });
8242
8903
 
@@ -8598,7 +9259,7 @@
8598
9259
  name: "Basis",
8599
9260
  id: "basis",
8600
9261
  module: "textures",
8601
- version: VERSION7,
9262
+ version: VERSION8,
8602
9263
  worker: true,
8603
9264
  extensions: ["basis", "ktx2"],
8604
9265
  mimeTypes: ["application/octet-stream", "image/ktx2"],
@@ -8621,10 +9282,10 @@
8621
9282
  });
8622
9283
 
8623
9284
  // ../images/src/lib/utils/version.ts
8624
- var VERSION9;
9285
+ var VERSION10;
8625
9286
  var init_version6 = __esm({
8626
9287
  "../images/src/lib/utils/version.ts"() {
8627
- VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
9288
+ VERSION10 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
8628
9289
  }
8629
9290
  });
8630
9291
 
@@ -9019,7 +9680,7 @@
9019
9680
  id: "image",
9020
9681
  module: "images",
9021
9682
  name: "Images",
9022
- version: VERSION9,
9683
+ version: VERSION10,
9023
9684
  mimeTypes: MIME_TYPES,
9024
9685
  extensions: EXTENSIONS,
9025
9686
  parse: parseImage,
@@ -9088,12 +9749,12 @@
9088
9749
  });
9089
9750
 
9090
9751
  // ../gltf/src/lib/utils/assert.ts
9091
- function assert8(condition, message) {
9752
+ function assert9(condition, message) {
9092
9753
  if (!condition) {
9093
9754
  throw new Error(message || "assert failed: gltf");
9094
9755
  }
9095
9756
  }
9096
- var init_assert7 = __esm({
9757
+ var init_assert8 = __esm({
9097
9758
  "../gltf/src/lib/utils/assert.ts"() {
9098
9759
  }
9099
9760
  });
@@ -9118,16 +9779,16 @@
9118
9779
  // ../gltf/src/lib/gltf-utils/get-typed-array.ts
9119
9780
  function getTypedArrayForBufferView(json, buffers, bufferViewIndex) {
9120
9781
  const bufferView = json.bufferViews[bufferViewIndex];
9121
- assert8(bufferView);
9782
+ assert9(bufferView);
9122
9783
  const bufferIndex = bufferView.buffer;
9123
9784
  const binChunk = buffers[bufferIndex];
9124
- assert8(binChunk);
9785
+ assert9(binChunk);
9125
9786
  const byteOffset = (bufferView.byteOffset || 0) + binChunk.byteOffset;
9126
9787
  return new Uint8Array(binChunk.arrayBuffer, byteOffset, bufferView.byteLength);
9127
9788
  }
9128
9789
  var init_get_typed_array = __esm({
9129
9790
  "../gltf/src/lib/gltf-utils/get-typed-array.ts"() {
9130
- init_assert7();
9791
+ init_assert8();
9131
9792
  }
9132
9793
  });
9133
9794
 
@@ -9149,13 +9810,13 @@
9149
9810
  const bytesPerComponent = ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[accessor.componentType];
9150
9811
  const length4 = accessor.count * components;
9151
9812
  const byteLength = accessor.count * components * bytesPerComponent;
9152
- assert8(byteLength >= 0 && byteLength <= bufferView.byteLength);
9813
+ assert9(byteLength >= 0 && byteLength <= bufferView.byteLength);
9153
9814
  return { ArrayType, length: length4, byteLength };
9154
9815
  }
9155
9816
  var TYPES, ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT, ARRAY_TO_COMPONENT_TYPE, ATTRIBUTE_TYPE_TO_COMPONENTS, ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE, ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY;
9156
9817
  var init_gltf_utils = __esm({
9157
9818
  "../gltf/src/lib/gltf-utils/gltf-utils.ts"() {
9158
- init_assert7();
9819
+ init_assert8();
9159
9820
  TYPES = ["SCALAR", "VEC2", "VEC3", "VEC4"];
9160
9821
  ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT = [
9161
9822
  [Int8Array, 5120],
@@ -9201,7 +9862,7 @@
9201
9862
  "../gltf/src/lib/api/gltf-scenegraph.ts"() {
9202
9863
  init_src8();
9203
9864
  init_src2();
9204
- init_assert7();
9865
+ init_assert8();
9205
9866
  init_gltf_utils();
9206
9867
  DEFAULT_GLTF_JSON = {
9207
9868
  asset: {
@@ -9300,7 +9961,7 @@
9300
9961
  bufferView = this.getBufferView(bufferView);
9301
9962
  const bufferIndex = bufferView.buffer;
9302
9963
  const binChunk = this.gltf.buffers[bufferIndex];
9303
- assert8(binChunk);
9964
+ assert9(binChunk);
9304
9965
  const byteOffset = (bufferView.byteOffset || 0) + binChunk.byteOffset;
9305
9966
  return new Uint8Array(binChunk.arrayBuffer, byteOffset, bufferView.byteLength);
9306
9967
  }
@@ -9347,14 +10008,14 @@
9347
10008
  return extension;
9348
10009
  }
9349
10010
  addExtension(extensionName, extensionData = {}) {
9350
- assert8(extensionData);
10011
+ assert9(extensionData);
9351
10012
  this.json.extensions = this.json.extensions || {};
9352
10013
  this.json.extensions[extensionName] = extensionData;
9353
10014
  this.registerUsedExtension(extensionName);
9354
10015
  return extensionData;
9355
10016
  }
9356
10017
  addRequiredExtension(extensionName, extensionData = {}) {
9357
- assert8(extensionData);
10018
+ assert9(extensionData);
9358
10019
  this.addExtension(extensionName, extensionData);
9359
10020
  this.registerRequiredExtension(extensionName);
9360
10021
  return extensionData;
@@ -9452,7 +10113,7 @@
9452
10113
  }
9453
10114
  addBufferView(buffer) {
9454
10115
  const byteLength = buffer.byteLength;
9455
- assert8(Number.isFinite(byteLength));
10116
+ assert9(Number.isFinite(byteLength));
9456
10117
  this.sourceBuffers = this.sourceBuffers || [];
9457
10118
  this.sourceBuffers.push(buffer);
9458
10119
  const glTFBufferView = {
@@ -10099,7 +10760,7 @@
10099
10760
  const { json } = gltfScenegraph;
10100
10761
  if (json.lights) {
10101
10762
  const extension = gltfScenegraph.addExtension(KHR_LIGHTS_PUNCTUAL);
10102
- assert8(!extension.lights);
10763
+ assert9(!extension.lights);
10103
10764
  extension.lights = json.lights;
10104
10765
  delete json.lights;
10105
10766
  }
@@ -10114,7 +10775,7 @@
10114
10775
  var KHR_LIGHTS_PUNCTUAL, name5;
10115
10776
  var init_KHR_lights_punctual = __esm({
10116
10777
  "../gltf/src/lib/extensions/deprecated/KHR_lights_punctual.ts"() {
10117
- init_assert7();
10778
+ init_assert8();
10118
10779
  init_gltf_scenegraph();
10119
10780
  KHR_LIGHTS_PUNCTUAL = "KHR_lights_punctual";
10120
10781
  name5 = KHR_LIGHTS_PUNCTUAL;
@@ -10507,7 +11168,7 @@
10507
11168
  var COMPONENTS, BYTES, GL_SAMPLER, SAMPLER_PARAMETER_GLTF_TO_GL, DEFAULT_SAMPLER, GLTFPostProcessor;
10508
11169
  var init_post_process_gltf = __esm({
10509
11170
  "../gltf/src/lib/api/post-process-gltf.ts"() {
10510
- init_assert7();
11171
+ init_assert8();
10511
11172
  init_gltf_utils();
10512
11173
  COMPONENTS = {
10513
11174
  SCALAR: 1,
@@ -10556,7 +11217,7 @@
10556
11217
  }
10557
11218
  postProcess(gltf, options = {}) {
10558
11219
  const { json, buffers = [], images = [], baseUri = "" } = gltf;
10559
- assert8(json);
11220
+ assert9(json);
10560
11221
  this.baseUri = baseUri;
10561
11222
  this.json = json;
10562
11223
  this.buffers = buffers;
@@ -10960,11 +11621,11 @@
10960
11621
  } else if (data instanceof ArrayBuffer) {
10961
11622
  const glb = {};
10962
11623
  byteOffset = parseGLBSync(glb, data, byteOffset, options.glb);
10963
- assert8(glb.type === "glTF", `Invalid GLB magic string ${glb.type}`);
11624
+ assert9(glb.type === "glTF", `Invalid GLB magic string ${glb.type}`);
10964
11625
  gltf._glb = glb;
10965
11626
  gltf.json = glb.json;
10966
11627
  } else {
10967
- assert8(false, "GLTF: must be ArrayBuffer or string");
11628
+ assert9(false, "GLTF: must be ArrayBuffer or string");
10968
11629
  }
10969
11630
  const buffers = gltf.json.buffers || [];
10970
11631
  gltf.buffers = new Array(buffers.length).fill(null);
@@ -10985,7 +11646,7 @@
10985
11646
  const buffer = buffers[i2];
10986
11647
  if (buffer.uri) {
10987
11648
  const { fetch: fetch2 } = context;
10988
- assert8(fetch2);
11649
+ assert9(fetch2);
10989
11650
  const uri = resolveUrl(buffer.uri, options);
10990
11651
  const response = await context?.fetch?.(uri);
10991
11652
  const arrayBuffer = await response?.arrayBuffer?.();
@@ -11029,7 +11690,7 @@
11029
11690
  const array = getTypedArrayForBufferView(gltf.json, gltf.buffers, image.bufferView);
11030
11691
  arrayBuffer = sliceArrayBuffer(array.buffer, array.byteOffset, array.byteLength);
11031
11692
  }
11032
- assert8(arrayBuffer, "glTF image has no data");
11693
+ assert9(arrayBuffer, "glTF image has no data");
11033
11694
  let parsedImage = await parse5(arrayBuffer, [ImageLoader, BasisLoader], { mimeType: image.mimeType, basis: options.basis || { format: selectSupportedBasisFormat() } }, context);
11034
11695
  if (parsedImage && parsedImage[0]) {
11035
11696
  parsedImage = {
@@ -11048,7 +11709,7 @@
11048
11709
  init_src9();
11049
11710
  init_src8();
11050
11711
  init_src2();
11051
- init_assert7();
11712
+ init_assert8();
11052
11713
  init_resolve_url();
11053
11714
  init_get_typed_array();
11054
11715
  init_gltf_extensions();
@@ -11075,7 +11736,7 @@
11075
11736
  name: "glTF",
11076
11737
  id: "gltf",
11077
11738
  module: "gltf",
11078
- version: VERSION6,
11739
+ version: VERSION7,
11079
11740
  extensions: ["gltf", "glb"],
11080
11741
  mimeTypes: ["model/gltf+json", "model/gltf-binary"],
11081
11742
  text: true,
@@ -11487,7 +12148,7 @@
11487
12148
  id: "3d-tiles-subtree",
11488
12149
  name: "3D Tiles Subtree",
11489
12150
  module: "3d-tiles",
11490
- version: VERSION4,
12151
+ version: VERSION5,
11491
12152
  extensions: ["subtree"],
11492
12153
  mimeTypes: ["application/octet-stream"],
11493
12154
  tests: ["subtree"],
@@ -11568,7 +12229,8 @@
11568
12229
  const currentTile = await parseImplicitTiles(subtree, options, pData, index, childTileLevel, globalData);
11569
12230
  if (currentTile.contentUrl || currentTile.children.length) {
11570
12231
  const globalLevel = lev + 1;
11571
- const formattedTile = formatTileData(currentTile, globalLevel, options);
12232
+ const childCoordinates = { childTileX, childTileY, childTileZ };
12233
+ const formattedTile = formatTileData(currentTile, globalLevel, childCoordinates, options);
11572
12234
  tile.children.push(formattedTile);
11573
12235
  }
11574
12236
  }
@@ -11583,10 +12245,19 @@
11583
12245
  }
11584
12246
  return false;
11585
12247
  }
11586
- function formatTileData(tile, level, options) {
11587
- const { basePath, refine, getRefine: getRefine2, lodMetricType, getTileType: getTileType2, rootLodMetricValue } = options;
12248
+ function formatTileData(tile, level, childCoordinates, options) {
12249
+ const {
12250
+ basePath,
12251
+ refine,
12252
+ getRefine: getRefine2,
12253
+ lodMetricType,
12254
+ getTileType: getTileType2,
12255
+ rootLodMetricValue,
12256
+ rootBoundingVolume
12257
+ } = options;
11588
12258
  const uri = tile.contentUrl && tile.contentUrl.replace(`${basePath}/`, "");
11589
12259
  const lodMetricValue = rootLodMetricValue / 2 ** level;
12260
+ const boundingVolume = calculateBoundingVolumeForChildTile(level, rootBoundingVolume, childCoordinates);
11590
12261
  return {
11591
12262
  children: tile.children,
11592
12263
  contentUrl: tile.contentUrl,
@@ -11595,9 +12266,31 @@
11595
12266
  refine: getRefine2(refine),
11596
12267
  type: getTileType2(tile),
11597
12268
  lodMetricType,
11598
- lodMetricValue
12269
+ lodMetricValue,
12270
+ boundingVolume
11599
12271
  };
11600
12272
  }
12273
+ function calculateBoundingVolumeForChildTile(level, rootBoundingVolume, childCoordinates) {
12274
+ if (rootBoundingVolume.region) {
12275
+ const { childTileX, childTileY, childTileZ } = childCoordinates;
12276
+ const [west, south, east, north, minimumHeight, maximumHeight] = rootBoundingVolume.region;
12277
+ const boundingVolumesCount = 2 ** level;
12278
+ const sizeX = (east - west) / boundingVolumesCount;
12279
+ const sizeY = (north - south) / boundingVolumesCount;
12280
+ const sizeZ = (maximumHeight - minimumHeight) / boundingVolumesCount;
12281
+ const [childWest, childEast] = [west + sizeX * childTileX, west + sizeX * (childTileX + 1)];
12282
+ const [childSouth, childNorth] = [south + sizeY * childTileY, south + sizeY * (childTileY + 1)];
12283
+ const [childMinimumHeight, childMaximumHeight] = [
12284
+ minimumHeight + sizeZ * childTileZ,
12285
+ minimumHeight + sizeZ * (childTileZ + 1)
12286
+ ];
12287
+ return {
12288
+ region: [childWest, childSouth, childEast, childNorth, childMinimumHeight, childMaximumHeight]
12289
+ };
12290
+ }
12291
+ console.warn("Unsupported bounding volume type: ", rootBoundingVolume);
12292
+ return null;
12293
+ }
11601
12294
  function concatBits(first, second) {
11602
12295
  return parseInt(first.toString(2) + second.toString(2), 2);
11603
12296
  }
@@ -11712,6 +12405,7 @@
11712
12405
  const contentUrlTemplate = `${basePath}/${tileset.root.content.uri}`;
11713
12406
  const refine = tileset.root.refine;
11714
12407
  const rootLodMetricValue = tileset.root.geometricError;
12408
+ const rootBoundingVolume = tileset.root.boundingVolume;
11715
12409
  const options = {
11716
12410
  contentUrlTemplate,
11717
12411
  subtreesUriTemplate,
@@ -11722,6 +12416,7 @@
11722
12416
  basePath,
11723
12417
  lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,
11724
12418
  rootLodMetricValue,
12419
+ rootBoundingVolume,
11725
12420
  getTileType,
11726
12421
  getRefine
11727
12422
  };
@@ -11810,7 +12505,7 @@
11810
12505
  id: "3d-tiles",
11811
12506
  name: "3D Tiles",
11812
12507
  module: "3d-tiles",
11813
- version: VERSION4,
12508
+ version: VERSION5,
11814
12509
  extensions: ["cmpt", "pnts", "b3dm", "i3dm"],
11815
12510
  mimeTypes: ["application/octet-stream"],
11816
12511
  tests: ["cmpt", "pnts", "b3dm", "i3dm"],
@@ -12130,7 +12825,7 @@
12130
12825
  name: "3D Tile",
12131
12826
  id: "3d-tiles",
12132
12827
  module: "3d-tiles",
12133
- version: VERSION4,
12828
+ version: VERSION5,
12134
12829
  extensions: ["cmpt", "pnts", "b3dm", "i3dm"],
12135
12830
  mimeTypes: ["application/octet-stream"],
12136
12831
  encodeSync,