Skip to content

Commit dcd5bfc

Browse files
authored
Merge pull request #8765 from fredj/cameraUnderground_scene
Add cameraUnderground property to the Scene
2 parents 56f6285 + 6d97829 commit dcd5bfc

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
##### Additions :tada:
66

7+
- Added `Scene.cameraUnderground` for checking whether the camera is underneath the globe. [#8765](https://github.com/CesiumGS/cesium/pull/8765)
78
- Added `RequestScheduler` to the public API; this allows users to have more control over the requests made by CesiumJS. [#8384](https://github.com/CesiumGS/cesium/issues/8384)
89

910
##### Fixes :wrench:

Source/Scene/Scene.js

+16
Original file line numberDiff line numberDiff line change
@@ -1435,6 +1435,7 @@ Object.defineProperties(Scene.prototype, {
14351435
* Gets the scalar used to exaggerate the terrain.
14361436
* @memberof Scene.prototype
14371437
* @type {Number}
1438+
* @readonly
14381439
*/
14391440
terrainExaggeration: {
14401441
get: function () {
@@ -1490,6 +1491,7 @@ Object.defineProperties(Scene.prototype, {
14901491
* Determines if the 2D map is rotatable or can be scrolled infinitely in the horizontal direction.
14911492
* @memberof Scene.prototype
14921493
* @type {MapMode2D}
1494+
* @readonly
14931495
*/
14941496
mapMode2D: {
14951497
get: function () {
@@ -1597,6 +1599,7 @@ Object.defineProperties(Scene.prototype, {
15971599
* Whether or not high dynamic range rendering is supported.
15981600
* @memberof Scene.prototype
15991601
* @type {Boolean}
1602+
* @readonly
16001603
* @default true
16011604
*/
16021605
highDynamicRangeSupported: {
@@ -1609,6 +1612,19 @@ Object.defineProperties(Scene.prototype, {
16091612
},
16101613
},
16111614

1615+
/**
1616+
* Whether or not the camera is underneath the globe.
1617+
* @memberof Scene.prototype
1618+
* @type {Boolean}
1619+
* @readonly
1620+
* @default false
1621+
*/
1622+
cameraUnderground: {
1623+
get: function () {
1624+
return this._cameraUnderground;
1625+
},
1626+
},
1627+
16121628
/**
16131629
* Gets or sets the color of the light emitted by the sun.
16141630
*

Specs/Scene/SceneSpec.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -2035,7 +2035,7 @@ describe(
20352035

20362036
return updateGlobeUntilDone(scene)
20372037
.then(function () {
2038-
expect(scene._cameraUnderground).toBe(false);
2038+
expect(scene.cameraUnderground).toBe(false);
20392039

20402040
// Look underground
20412041
scene.camera.setView({
@@ -2053,7 +2053,7 @@ describe(
20532053
return updateGlobeUntilDone(scene);
20542054
})
20552055
.then(function () {
2056-
expect(scene._cameraUnderground).toBe(true);
2056+
expect(scene.cameraUnderground).toBe(true);
20572057
scene.destroyForSpecs();
20582058
});
20592059
});
@@ -2069,15 +2069,15 @@ describe(
20692069
).and.returnValue(true);
20702070

20712071
return updateGlobeUntilDone(scene).then(function () {
2072-
expect(scene._cameraUnderground).toBe(false);
2072+
expect(scene.cameraUnderground).toBe(false);
20732073
scene.destroyForSpecs();
20742074
});
20752075
});
20762076

20772077
it("detects that camera is above ground if globe is undefined", function () {
20782078
var scene = createScene();
20792079
scene.renderForSpecs();
2080-
expect(scene._cameraUnderground).toBe(false);
2080+
expect(scene.cameraUnderground).toBe(false);
20812081
scene.destroyForSpecs();
20822082
});
20832083

@@ -2086,7 +2086,7 @@ describe(
20862086
var globe = new Globe();
20872087
scene.globe = globe;
20882088
scene.morphTo2D(0.0);
2089-
expect(scene._cameraUnderground).toBe(false);
2089+
expect(scene.cameraUnderground).toBe(false);
20902090
scene.destroyForSpecs();
20912091
});
20922092

@@ -2095,7 +2095,7 @@ describe(
20952095
var globe = new Globe();
20962096
scene.globe = globe;
20972097
scene.morphTo2D(1.0);
2098-
expect(scene._cameraUnderground).toBe(false);
2098+
expect(scene.cameraUnderground).toBe(false);
20992099
scene.destroyForSpecs();
21002100
});
21012101

@@ -2120,7 +2120,7 @@ describe(
21202120
scene.morphToColumbusView(0.0);
21212121

21222122
return updateGlobeUntilDone(scene).then(function () {
2123-
expect(scene._cameraUnderground).toBe(true);
2123+
expect(scene.cameraUnderground).toBe(true);
21242124
scene.destroyForSpecs();
21252125
});
21262126
});

0 commit comments

Comments
 (0)