mirror of https://github.com/CesiumGS/cesium.git
Compare commits
2 Commits
46d2ee5259
...
5eb3d2ce08
| Author | SHA1 | Date |
|---|---|---|
|
|
5eb3d2ce08 | |
|
|
275219a777 |
|
|
@ -3943,12 +3943,26 @@ function callAfterRenderFunctions(scene) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate the height of the globe at the camera position based on the value of {@link ScreenSpaceCameraController.collisionHeightReference},
|
||||||
|
* or undefined if the height cannot be determined.
|
||||||
|
*
|
||||||
|
* @param {Scene} scene
|
||||||
|
* @returns {number|undefined}
|
||||||
|
*/
|
||||||
function getGlobeHeight(scene) {
|
function getGlobeHeight(scene) {
|
||||||
if (scene.mode === SceneMode.MORPHING) {
|
if (
|
||||||
|
scene.mode === SceneMode.MORPHING ||
|
||||||
|
scene._screenSpaceCameraController.collisionHeightReference ===
|
||||||
|
HeightReference.NONE
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const cartographic = scene.camera.positionCartographic;
|
const cartographic = scene.camera.positionCartographic;
|
||||||
return scene.getHeight(cartographic);
|
return scene.getHeight(
|
||||||
|
cartographic,
|
||||||
|
scene._screenSpaceCameraController.collisionHeightReference,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMaxPrimitiveHeight(primitive, cartographic, scene) {
|
function getMaxPrimitiveHeight(primitive, cartographic, scene) {
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import MapMode2D from "./MapMode2D.js";
|
||||||
import SceneMode from "./SceneMode.js";
|
import SceneMode from "./SceneMode.js";
|
||||||
import SceneTransforms from "./SceneTransforms.js";
|
import SceneTransforms from "./SceneTransforms.js";
|
||||||
import TweenCollection from "./TweenCollection.js";
|
import TweenCollection from "./TweenCollection.js";
|
||||||
|
import HeightReference from "./HeightReference.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifies the camera position and orientation based on mouse input to a canvas.
|
* Modifies the camera position and orientation based on mouse input to a canvas.
|
||||||
|
|
@ -265,13 +266,13 @@ function ScreenSpaceCameraController(scene) {
|
||||||
: ellipsoid.minimumRadius * 1.175;
|
: ellipsoid.minimumRadius * 1.175;
|
||||||
this._minimumTrackBallHeight = this.minimumTrackBallHeight;
|
this._minimumTrackBallHeight = this.minimumTrackBallHeight;
|
||||||
/**
|
/**
|
||||||
* When disabled, the values of <code>maximumZoomDistance</code> and <code>minimumZoomDistance</code> are ignored.
|
* This value controls the height reference for the {@link ScreenSpaceCameraController} collision, which is used to limit the camera minimum and maximum zoom.
|
||||||
* Also used in conjunction with {@link Cesium3DTileset#enableCollision} to prevent the camera from moving through or below a 3D Tileset surface.
|
* When set to {@link HeightReference.NONE}, the camera can go underground, and the values of <code>maximumZoomDistance</code> and <code>minimumZoomDistance</code> are ignored.
|
||||||
* This may also affect clamping behavior when using {@link HeightReference.CLAMP_TO_GROUND} on 3D Tiles.
|
* For all other values, the camera is constrained to be above the terrain and/or 3D Tiles (depending on {@link Cesium3DTileset#enableCollision}).
|
||||||
* @type {boolean}
|
* @type {HeightReference}
|
||||||
* @default true
|
* @default HeightReference.CLAMP_TO_GROUND
|
||||||
*/
|
*/
|
||||||
this.enableCollisionDetection = true;
|
this.collisionHeightReference = HeightReference.CLAMP_TO_GROUND;
|
||||||
/**
|
/**
|
||||||
* The angle, relative to the ellipsoid normal, restricting the maximum amount that the user can tilt the camera. If <code>undefined</code>, the angle of the camera tilt is unrestricted.
|
* The angle, relative to the ellipsoid normal, restricting the maximum amount that the user can tilt the camera. If <code>undefined</code>, the angle of the camera tilt is unrestricted.
|
||||||
* @type {number|undefined}
|
* @type {number|undefined}
|
||||||
|
|
@ -353,6 +354,27 @@ function ScreenSpaceCameraController(scene) {
|
||||||
this._maximumUndergroundPickDistance = 10000.0;
|
this._maximumUndergroundPickDistance = 10000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Object.defineProperties(ScreenSpaceCameraController.prototype, {
|
||||||
|
/**
|
||||||
|
* When disabled, the values of <code>maximumZoomDistance</code> and <code>minimumZoomDistance</code> are ignored.
|
||||||
|
* Also used in conjunction with {@link Cesium3DTileset#enableCollision} to prevent the camera from moving through or below a 3D Tileset surface.
|
||||||
|
* This may also affect clamping behavior when using {@link HeightReference.CLAMP_TO_GROUND} on 3D Tiles.
|
||||||
|
* @type {boolean}
|
||||||
|
* @default true
|
||||||
|
* @deprecated Use {@link ScreenSpaceCameraController#collisionHeightReference} instead.
|
||||||
|
*/
|
||||||
|
enableCollisionDetection: {
|
||||||
|
get: function () {
|
||||||
|
return this.collisionHeightReference !== HeightReference.NONE;
|
||||||
|
},
|
||||||
|
set: function (value) {
|
||||||
|
this.collisionHeightReference = value
|
||||||
|
? HeightReference.CLAMP_TO_GROUND
|
||||||
|
: HeightReference.NONE;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
function decay(time, coefficient) {
|
function decay(time, coefficient) {
|
||||||
if (time < 0) {
|
if (time < 0) {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue