@loaders.gl/tiles 3.2.3 → 3.3.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/tiles",
3
- "version": "3.2.3",
3
+ "version": "3.3.0-alpha.1",
4
4
  "description": "Common components for different tiles loaders.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -33,8 +33,8 @@
33
33
  "build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
34
34
  },
35
35
  "dependencies": {
36
- "@loaders.gl/loader-utils": "3.2.3",
37
- "@loaders.gl/math": "3.2.3",
36
+ "@loaders.gl/loader-utils": "3.3.0-alpha.1",
37
+ "@loaders.gl/math": "3.3.0-alpha.1",
38
38
  "@math.gl/core": "^3.5.1",
39
39
  "@math.gl/culling": "^3.5.1",
40
40
  "@math.gl/geospatial": "^3.5.1",
@@ -42,7 +42,7 @@
42
42
  "@probe.gl/stats": "^3.5.0"
43
43
  },
44
44
  "peerDependencies": {
45
- "@loaders.gl/core": "3.2.0"
45
+ "@loaders.gl/core": "^3.2.0"
46
46
  },
47
- "gitHead": "ddb4a1f3c0bd948135fd3c3b83481e0a7809f4d7"
47
+ "gitHead": "85ed2df7d17dd0d204c8bd8feb44779f70bc693b"
48
48
  }
@@ -83,8 +83,7 @@ export default class TileHeader {
83
83
  private _shouldRefine: boolean;
84
84
 
85
85
  // Members this are updated every frame for tree traversal and rendering optimizations:
86
- // @ts-ignore
87
- private _distanceToCamera: number;
86
+ public _distanceToCamera: number;
88
87
  // @ts-ignore
89
88
  private _centerZDepth: number;
90
89
  private _screenSpaceError: number;
@@ -285,6 +284,20 @@ export default class TileHeader {
285
284
  return this.contentState === TILE_CONTENT_STATE.FAILED;
286
285
  }
287
286
 
287
+ /**
288
+ * Distance from the tile's bounding volume center to the camera
289
+ */
290
+ get distanceToCamera(): number {
291
+ return this._distanceToCamera;
292
+ }
293
+
294
+ /**
295
+ * Screen space error for LOD selection
296
+ */
297
+ get screenSpaceError(): number {
298
+ return this._screenSpaceError;
299
+ }
300
+
288
301
  /** Get the tile's screen space error. */
289
302
  getScreenSpaceError(frameState, useParentLodMetric) {
290
303
  switch (this.tileset.type) {
@@ -673,7 +673,13 @@ export default class Tileset3D {
673
673
  this.zoom = 1;
674
674
  return;
675
675
  }
676
- this.cartographicCenter = Ellipsoid.WGS84.cartesianToCartographic(center, new Vector3());
676
+
677
+ // cartographic coordinates are undefined at the center of the ellipsoid
678
+ if (center[0] !== 0 || center[1] !== 0 || center[2] !== 0) {
679
+ this.cartographicCenter = Ellipsoid.WGS84.cartesianToCartographic(center, new Vector3());
680
+ } else {
681
+ this.cartographicCenter = new Vector3(0, 0, -Ellipsoid.WGS84.radii[0]);
682
+ }
677
683
  this.cartesianCenter = center;
678
684
  this.zoom = getZoomFromBoundingVolume(root.boundingVolume, this.cartographicCenter);
679
685
  }