bruce-cesium 7.3.0 → 7.3.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.
@@ -6575,7 +6575,7 @@
6575
6575
  const adjustedSphere = boundingSphere.sphere.clone();
6576
6576
  // Terrain only matters here because it moves the sphere onto the ground.
6577
6577
  // Far enough away that a plausible ground height is a rounding error against the viewing distance, sampling it is wasted work.
6578
- const cameraDistance = Cesium.Cartesian3.distance(camera.position, adjustedSphere.center);
6578
+ const cameraDistance = Cesium.Cartesian3.distance(camera.positionWC, adjustedSphere.center);
6579
6579
  if (cameraDistance > TERRAIN_SKIP_DISTANCE) {
6580
6580
  adjustedSphere.radius += TERRAIN_SKIP_RADIUS_PAD;
6581
6581
  }
@@ -6588,7 +6588,8 @@
6588
6588
  }
6589
6589
  adjustedSphere.center = grounded;
6590
6590
  }
6591
- const cullingVolume = camera.frustum.computeCullingVolume(camera.position, camera.direction, camera.up);
6591
+ // Camera vectors are frame relative while a reference frame is set (the compass orbits via lookAt).
6592
+ const cullingVolume = camera.frustum.computeCullingVolume(camera.positionWC, camera.directionWC, camera.upWC);
6592
6593
  const visibility = cullingVolume.computeVisibility(adjustedSphere);
6593
6594
  return visibility !== Cesium.Intersect.INSIDE && visibility !== Cesium.Intersect.INTERSECTING;
6594
6595
  }
@@ -6615,14 +6616,14 @@
6615
6616
  return true;
6616
6617
  }
6617
6618
  const camera = viewer.scene.camera;
6618
- if (!((_a = camera === null || camera === void 0 ? void 0 : camera.position) === null || _a === void 0 ? void 0 : _a.x)) {
6619
+ if (!((_a = camera === null || camera === void 0 ? void 0 : camera.positionWC) === null || _a === void 0 ? void 0 : _a.x)) {
6619
6620
  return false;
6620
6621
  }
6621
6622
  const lastRecheck = camera[LAST_RECHECK_KEY];
6622
6623
  if (!lastRecheck) {
6623
6624
  camera[LAST_RECHECK_KEY] = {
6624
- position: camera.position.clone(),
6625
- direction: camera.direction.clone(),
6625
+ position: camera.positionWC.clone(),
6626
+ direction: camera.directionWC.clone(),
6626
6627
  tilesLoading: viewer.scene.globe.tilesLoaded
6627
6628
  };
6628
6629
  return true;
@@ -6631,14 +6632,14 @@
6631
6632
  const tilesLoadingDiff = lastRecheck.tilesLoading != viewer.scene.globe.tilesLoaded;
6632
6633
  let recheck = tilesLoadingDiff;
6633
6634
  if (!recheck) {
6634
- const posDiff = Cesium.Cartesian3.magnitude(Cesium.Cartesian3.subtract(position, camera.position, new Cesium.Cartesian3()));
6635
- const dirDiff = Cesium.Cartesian3.magnitude(Cesium.Cartesian3.subtract(direction, camera.direction, new Cesium.Cartesian3()));
6635
+ const posDiff = Cesium.Cartesian3.magnitude(Cesium.Cartesian3.subtract(position, camera.positionWC, new Cesium.Cartesian3()));
6636
+ const dirDiff = Cesium.Cartesian3.magnitude(Cesium.Cartesian3.subtract(direction, camera.directionWC, new Cesium.Cartesian3()));
6636
6637
  recheck = posDiff > 100 || dirDiff > 0.01;
6637
6638
  }
6638
6639
  if (recheck) {
6639
6640
  camera[LAST_RECHECK_KEY] = {
6640
- position: camera.position.clone(),
6641
- direction: camera.direction.clone(),
6641
+ position: camera.positionWC.clone(),
6642
+ direction: camera.directionWC.clone(),
6642
6643
  tilesLoading: viewer.scene.globe.tilesLoaded
6643
6644
  };
6644
6645
  }
@@ -6691,7 +6692,9 @@
6691
6692
  return;
6692
6693
  }
6693
6694
  const camera = viewer.scene.camera;
6694
- const cullingVolume = camera.frustum.computeCullingVolume(camera.position, camera.direction, camera.up);
6695
+ // Camera vectors are frame relative while a reference frame is set (the compass orbits via lookAt).
6696
+ // These spheres are world space, so only the world coordinate vectors compare against them correctly.
6697
+ const cullingVolume = camera.frustum.computeCullingVolume(camera.positionWC, camera.directionWC, camera.upWC);
6695
6698
  let changed = false;
6696
6699
  for (const rego of tilesets) {
6697
6700
  const tileset = rego.tileset;
@@ -46253,7 +46256,7 @@ void main() {
46253
46256
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
46254
46257
  })(exports.StyleUtils || (exports.StyleUtils = {}));
46255
46258
 
46256
- const VERSION = "7.3.0";
46259
+ const VERSION = "7.3.1";
46257
46260
  /**
46258
46261
  * Updates the environment instance used by bruce-cesium to one specified.
46259
46262
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.