make getHeight pick in 3D mode

This commit is contained in:
Daniel Leone 2022-05-08 12:16:35 +08:00
parent 3f69f5f8e0
commit 8c48cb0407
2 changed files with 10 additions and 5 deletions

View File

@ -202,13 +202,14 @@ TerrainMesh.prototype.pickRay = function (
const hasOctree = !!this._octreeTrianglePicking;
const canUseOctree =
hasOctree &&
// 3d mode only
mode === SceneMode.SCENE3D /* 3d mode only*/ &&
// the octree is baked for default terrain exaggeration, so we can only trust its result when we're
// not using terrain exaggeration
this.encoding.exaggeration === 1;
if (hasOctree && canUseOctree) {
if (canUseOctree) {
newPickValue = this._octreeTrianglePicking.rayIntersect(
ray,
cullBackFaces,
@ -217,7 +218,10 @@ TerrainMesh.prototype.pickRay = function (
);
}
if (!window.disableDefaultPickStrategy) {
if (!window.disableDefaultPickStrategy || !canUseOctree) {
// if we've not elected to disable the default pick strategy entirely;
// or we can't use the octree, so we have no other choice, then
// use the default pick strategy
oldPickValue = this._defaultPickStrategy.rayIntersect(
ray,
cullBackFaces,

View File

@ -775,7 +775,7 @@ Globe.prototype.pickWorldCoordinates = function (
for (i = 0; i < length; ++i) {
intersection = sphereIntersections[i].pick(
ray,
scene.frameState,
scene.mode,
scene.mapProjection,
cullBackFaces,
result
@ -938,8 +938,9 @@ Globe.prototype.getHeight = function (cartographic) {
const intersection = tile.data.pick(
ray,
// why is mode passed as undefined? I'm not sure, it's always been this way
undefined,
// If you're asking for globe "height", you're probably expecting the answer
// with respect to 3D mode, not whatever mode the scene is currently in
SceneMode.SCENE3D,
projection,
false,
scratchGetHeightIntersection