CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
12.95k stars 3.49k forks source link

SceneTransition should retain camera location #2647

Open mramato opened 9 years ago

mramato commented 9 years ago

An extremely common request on the forum is to retain the current camera view when switching Scene modes. There are also requests for having an easy way to instantly change scenes. I, personally, have wanted this functionality forever too. We should consider adding it soon.

WarpDrive commented 9 years ago

Instant change is already here viewer.sceneModePicker.viewModel.duration=0; The button animation isn't instant though, perhaps that should be instant as well?

When transferring between 3D and CV if you just transfer lon/lat/alt and hea/pit/roll and fov of the camera the view can be different due to the fact that the shape of the Earth is different (accentuated at higher altitudes.) Transferring the camera view (where the 4 corners of the frustum hit the Earth) rather than the camera position/orientation could be another option, though this might not retain the camera location/orienation. So either: -retain location/orientation, but not view -retain view but not location/orientation

I wrote a cam/destination/range method here https://groups.google.com/d/msg/cesium-dev/37Hq0Hj8HSs/NHO5T959moAJ (The camera._mode statements should be swapped with viewer.scene.mode, and timeOut should be removed)

However rather than the cam/destination method, a more accurate method would be determining the globe intersection at the 4 corners of the frustum in addition to center destination (each stored as lon/lat/alt.) If enough hit the Earth you can calculate the complete frustrum you need for any mode, otherwise just transfer lon/lat/alt hea/pit/rol of the camera.

emackey commented 9 years ago

@WarpDrive try adding this CSS:

    .cesium-sceneModePicker-slide-svg {
        -webkit-transition: none;
        -moz-transition: none;
        transition: none;
    }