@loaders.gl/tiles 4.2.0-alpha.5 → 4.2.0-beta.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/index.cjs CHANGED
@@ -44,6 +44,9 @@ var import_loader_utils4 = require("@loaders.gl/loader-utils");
44
44
 
45
45
  // dist/utils/doubly-linked-list-node.js
46
46
  var DoublyLinkedListNode = class {
47
+ item;
48
+ previous;
49
+ next;
47
50
  constructor(item, previous, next) {
48
51
  this.item = item;
49
52
  this.previous = previous;
@@ -53,11 +56,9 @@ var DoublyLinkedListNode = class {
53
56
 
54
57
  // dist/utils/doubly-linked-list.js
55
58
  var DoublyLinkedList = class {
56
- constructor() {
57
- this.head = null;
58
- this.tail = null;
59
- this._length = 0;
60
- }
59
+ head = null;
60
+ tail = null;
61
+ _length = 0;
61
62
  get length() {
62
63
  return this._length;
63
64
  }
@@ -131,6 +132,9 @@ var DoublyLinkedList = class {
131
132
 
132
133
  // dist/tileset/tileset-cache.js
133
134
  var TilesetCache = class {
135
+ _list;
136
+ _sentinel;
137
+ _trimTiles;
134
138
  constructor() {
135
139
  this._list = new DoublyLinkedList();
136
140
  this._sentinel = this._list.add("sentinel");
@@ -707,8 +711,10 @@ function get3dTilesOptions(tileset) {
707
711
  // dist/utils/managed-array.js
708
712
  var import_loader_utils3 = require("@loaders.gl/loader-utils");
709
713
  var ManagedArray = class {
714
+ _map = /* @__PURE__ */ new Map();
715
+ _array;
716
+ _length;
710
717
  constructor(length = 0) {
711
- this._map = /* @__PURE__ */ new Map();
712
718
  this._array = new Array(length);
713
719
  this._length = length;
714
720
  }
@@ -854,21 +860,28 @@ var DEFAULT_PROPS = {
854
860
  basePath: ""
855
861
  };
856
862
  var TilesetTraverser = class {
863
+ options;
864
+ // fulfill in traverse call
865
+ root = null;
866
+ // tiles should be rendered
867
+ selectedTiles = {};
868
+ // tiles should be loaded from server
869
+ requestedTiles = {};
870
+ // tiles does not have render content
871
+ emptyTiles = {};
872
+ lastUpdate = new Date().getTime();
873
+ updateDebounceTime = 1e3;
874
+ /** temporary storage to hold the traversed tiles during a traversal */
875
+ _traversalStack = new ManagedArray();
876
+ _emptyTraversalStack = new ManagedArray();
877
+ /** set in every traverse cycle */
878
+ _frameNumber = null;
857
879
  // RESULT
858
880
  traversalFinished(frameState) {
859
881
  return true;
860
882
  }
861
883
  // TODO nested props
862
884
  constructor(options) {
863
- this.root = null;
864
- this.selectedTiles = {};
865
- this.requestedTiles = {};
866
- this.emptyTiles = {};
867
- this.lastUpdate = new Date().getTime();
868
- this.updateDebounceTime = 1e3;
869
- this._traversalStack = new ManagedArray();
870
- this._emptyTraversalStack = new ManagedArray();
871
- this._frameNumber = null;
872
885
  this.options = { ...DEFAULT_PROPS, ...options };
873
886
  }
874
887
  // tiles should be visible
@@ -1095,6 +1108,70 @@ function defined2(x) {
1095
1108
  return x !== void 0 && x !== null;
1096
1109
  }
1097
1110
  var Tile3D = class {
1111
+ tileset;
1112
+ header;
1113
+ id;
1114
+ url;
1115
+ parent;
1116
+ /* Specifies the type of refine that is used when traversing this tile for rendering. */
1117
+ refine;
1118
+ type;
1119
+ contentUrl;
1120
+ /** Different refinement algorithms used by I3S and 3D tiles */
1121
+ lodMetricType = "geometricError";
1122
+ /** The error, in meters, introduced if this tile is rendered and its children are not. */
1123
+ lodMetricValue = 0;
1124
+ /** @todo math.gl is not exporting BoundingVolume base type? */
1125
+ boundingVolume = null;
1126
+ /**
1127
+ * The tile's content. This represents the actual tile's payload,
1128
+ * not the content's metadata in the tileset JSON file.
1129
+ */
1130
+ content = null;
1131
+ contentState = TILE_CONTENT_STATE.UNLOADED;
1132
+ gpuMemoryUsageInBytes = 0;
1133
+ /** The tile's children - an array of Tile3D objects. */
1134
+ children = [];
1135
+ depth = 0;
1136
+ viewportIds = [];
1137
+ transform = new import_core7.Matrix4();
1138
+ extensions = null;
1139
+ /** TODO Cesium 3d tiles specific */
1140
+ implicitTiling = null;
1141
+ /** Container to store application specific data */
1142
+ userData = {};
1143
+ computedTransform;
1144
+ hasEmptyContent = false;
1145
+ hasTilesetContent = false;
1146
+ traverser = new TilesetTraverser({});
1147
+ /** Used by TilesetCache */
1148
+ _cacheNode = null;
1149
+ _frameNumber = null;
1150
+ // TODO Cesium 3d tiles specific
1151
+ _expireDate = null;
1152
+ _expiredContent = null;
1153
+ _boundingBox = void 0;
1154
+ /** updated every frame for tree traversal and rendering optimizations: */
1155
+ _distanceToCamera = 0;
1156
+ _screenSpaceError = 0;
1157
+ _visibilityPlaneMask;
1158
+ _visible = void 0;
1159
+ _contentBoundingVolume;
1160
+ _viewerRequestVolume;
1161
+ _initialTransform = new import_core7.Matrix4();
1162
+ // Used by traverser, cannot be marked private
1163
+ _priority = 0;
1164
+ _selectedFrame = 0;
1165
+ _requestedFrame = 0;
1166
+ _selectionDepth = 0;
1167
+ _touchedFrame = 0;
1168
+ _centerZDepth = 0;
1169
+ _shouldRefine = false;
1170
+ _stackLength = 0;
1171
+ _visitedFrame = 0;
1172
+ _inRequestVolume = false;
1173
+ _lodJudge = null;
1174
+ // TODO i3s specific, needs to remove
1098
1175
  /**
1099
1176
  * @constructs
1100
1177
  * Create a Tile3D instance
@@ -1106,42 +1183,6 @@ var Tile3D = class {
1106
1183
  */
1107
1184
  // eslint-disable-next-line max-statements
1108
1185
  constructor(tileset, header, parentHeader, extendedId = "") {
1109
- this.lodMetricType = "geometricError";
1110
- this.lodMetricValue = 0;
1111
- this.boundingVolume = null;
1112
- this.content = null;
1113
- this.contentState = TILE_CONTENT_STATE.UNLOADED;
1114
- this.gpuMemoryUsageInBytes = 0;
1115
- this.children = [];
1116
- this.depth = 0;
1117
- this.viewportIds = [];
1118
- this.transform = new import_core7.Matrix4();
1119
- this.extensions = null;
1120
- this.implicitTiling = null;
1121
- this.userData = {};
1122
- this.hasEmptyContent = false;
1123
- this.hasTilesetContent = false;
1124
- this.traverser = new TilesetTraverser({});
1125
- this._cacheNode = null;
1126
- this._frameNumber = null;
1127
- this._expireDate = null;
1128
- this._expiredContent = null;
1129
- this._boundingBox = void 0;
1130
- this._distanceToCamera = 0;
1131
- this._screenSpaceError = 0;
1132
- this._visible = void 0;
1133
- this._initialTransform = new import_core7.Matrix4();
1134
- this._priority = 0;
1135
- this._selectedFrame = 0;
1136
- this._requestedFrame = 0;
1137
- this._selectionDepth = 0;
1138
- this._touchedFrame = 0;
1139
- this._centerZDepth = 0;
1140
- this._shouldRefine = false;
1141
- this._stackLength = 0;
1142
- this._visitedFrame = 0;
1143
- this._inRequestVolume = false;
1144
- this._lodJudge = null;
1145
1186
  this.header = header;
1146
1187
  this.tileset = tileset;
1147
1188
  this.id = extendedId || header.id;
@@ -1608,9 +1649,7 @@ var import_core9 = require("@loaders.gl/core");
1608
1649
 
1609
1650
  // dist/tileset/format-i3s/i3s-pending-tiles-register.js
1610
1651
  var I3SPendingTilesRegister = class {
1611
- constructor() {
1612
- this.frameNumberMap = /* @__PURE__ */ new Map();
1613
- }
1652
+ frameNumberMap = /* @__PURE__ */ new Map();
1614
1653
  /**
1615
1654
  * Register a new pending tile header for the particular frameNumber
1616
1655
  * @param viewportId
@@ -1655,8 +1694,9 @@ var STATUS = {
1655
1694
  ERROR: "ERROR"
1656
1695
  };
1657
1696
  var I3STileManager = class {
1697
+ _statusMap;
1698
+ pendingTilesRegister = new I3SPendingTilesRegister();
1658
1699
  constructor() {
1659
- this.pendingTilesRegister = new I3SPendingTilesRegister();
1660
1700
  this._statusMap = {};
1661
1701
  }
1662
1702
  /**
@@ -1719,6 +1759,7 @@ var I3STileManager = class {
1719
1759
 
1720
1760
  // dist/tileset/format-i3s/i3s-tileset-traverser.js
1721
1761
  var I3STilesetTraverser = class extends TilesetTraverser {
1762
+ _tileManager;
1722
1763
  constructor(options) {
1723
1764
  super(options);
1724
1765
  this._tileManager = new I3STileManager();
@@ -1833,6 +1874,78 @@ var POINTS_COUNT = "Points/Vertices";
1833
1874
  var TILES_GPU_MEMORY = "Tile Memory Use";
1834
1875
  var MAXIMUM_SSE = "Maximum Screen Space Error";
1835
1876
  var Tileset3D = class {
1877
+ // props: Tileset3DProps;
1878
+ options;
1879
+ loadOptions;
1880
+ type;
1881
+ tileset;
1882
+ loader;
1883
+ url;
1884
+ basePath;
1885
+ modelMatrix;
1886
+ ellipsoid;
1887
+ lodMetricType;
1888
+ lodMetricValue;
1889
+ refine;
1890
+ root = null;
1891
+ roots = {};
1892
+ /** @todo any->unknown */
1893
+ asset = {};
1894
+ // Metadata for the entire tileset
1895
+ description = "";
1896
+ properties;
1897
+ extras = null;
1898
+ attributions = {};
1899
+ credits = {};
1900
+ stats;
1901
+ /** flags that contain information about data types in nested tiles */
1902
+ contentFormats = { draco: false, meshopt: false, dds: false, ktx2: false };
1903
+ // view props
1904
+ cartographicCenter = null;
1905
+ cartesianCenter = null;
1906
+ zoom = 1;
1907
+ boundingVolume = null;
1908
+ /** Updated based on the camera position and direction */
1909
+ dynamicScreenSpaceErrorComputedDensity = 0;
1910
+ // METRICS
1911
+ /**
1912
+ * The maximum amount of GPU memory (in MB) that may be used to cache tiles
1913
+ * Tiles not in view are unloaded to enforce private
1914
+ */
1915
+ maximumMemoryUsage = 32;
1916
+ /** The total amount of GPU memory in bytes used by the tileset. */
1917
+ gpuMemoryUsageInBytes = 0;
1918
+ /**
1919
+ * If loading the level of detail required by maximumScreenSpaceError
1920
+ * results in the memory usage exceeding maximumMemoryUsage (GPU), level of detail refinement
1921
+ * will instead use this (larger) adjusted screen space error to achieve the
1922
+ * best possible visual quality within the available memory.
1923
+ */
1924
+ memoryAdjustedScreenSpaceError = 0;
1925
+ _cacheBytes = 0;
1926
+ _cacheOverflowBytes = 0;
1927
+ /** Update tracker. increase in each update cycle. */
1928
+ _frameNumber = 0;
1929
+ _queryParams = {};
1930
+ _extensionsUsed = [];
1931
+ _tiles = {};
1932
+ /** counter for tracking tiles requests */
1933
+ _pendingCount = 0;
1934
+ /** Hold traversal results */
1935
+ selectedTiles = [];
1936
+ // TRAVERSAL
1937
+ traverseCounter = 0;
1938
+ geometricError = 0;
1939
+ lastUpdatedVieports = null;
1940
+ _requestedTiles = [];
1941
+ _emptyTiles = [];
1942
+ frameStateData = {};
1943
+ _traverser;
1944
+ _cache = new TilesetCache();
1945
+ _requestScheduler;
1946
+ // Promise tracking
1947
+ updatePromise = null;
1948
+ tilesetInitializationPromise;
1836
1949
  /**
1837
1950
  * Create a new Tileset3D
1838
1951
  * @param json
@@ -1840,38 +1953,6 @@ var Tileset3D = class {
1840
1953
  */
1841
1954
  // eslint-disable-next-line max-statements
1842
1955
  constructor(tileset, options) {
1843
- this.root = null;
1844
- this.roots = {};
1845
- this.asset = {};
1846
- this.description = "";
1847
- this.extras = null;
1848
- this.attributions = {};
1849
- this.credits = {};
1850
- this.contentFormats = { draco: false, meshopt: false, dds: false, ktx2: false };
1851
- this.cartographicCenter = null;
1852
- this.cartesianCenter = null;
1853
- this.zoom = 1;
1854
- this.boundingVolume = null;
1855
- this.dynamicScreenSpaceErrorComputedDensity = 0;
1856
- this.maximumMemoryUsage = 32;
1857
- this.gpuMemoryUsageInBytes = 0;
1858
- this.memoryAdjustedScreenSpaceError = 0;
1859
- this._cacheBytes = 0;
1860
- this._cacheOverflowBytes = 0;
1861
- this._frameNumber = 0;
1862
- this._queryParams = {};
1863
- this._extensionsUsed = [];
1864
- this._tiles = {};
1865
- this._pendingCount = 0;
1866
- this.selectedTiles = [];
1867
- this.traverseCounter = 0;
1868
- this.geometricError = 0;
1869
- this.lastUpdatedVieports = null;
1870
- this._requestedTiles = [];
1871
- this._emptyTiles = [];
1872
- this.frameStateData = {};
1873
- this._cache = new TilesetCache();
1874
- this.updatePromise = null;
1875
1956
  this.options = { ...DEFAULT_PROPS2, ...options };
1876
1957
  this.tileset = tileset;
1877
1958
  this.loader = tileset.loader;