Is there a possibility to “reload” the viewer somehow or what has to be done after changing the camera setting from PerspectiveFrustum
to OrthographicFrustum
during runtime?
I use the following code snippet, but then the earth is displayed in stripes when changing the fov
or whole frustum
. Only when the browser window changes a little bit in size, the earth is shown correctly again (CesiumJS 1.71, Chrome 83.0.4103.116):
const cameraSettings = {
ortographicCameraActive: false,
fov: 60,
ofOptions: {
width: 1000000,
aspectRatio: 2.356589147286822,
near: 0.1,
far: 10000000000
},
pfOptions: {
aspectRatio: 1905,
near: 0.1,
far: 10000000000,
xOffset: 0.0,
yOffset: 0.0
}
};
const {
ortographicCameraActive,
fov,
ofOptions,
pfOptions
} = cameraSettings;
if(viewer.scene) {
if (ortographicCameraActive) {
viewer.scene.camera.frustum = new OrthographicFrustum(ofOptions);
} else {
let fovRadians = fov * Math.PI / 180;
pfOptions['fov'] = fovRadians;
viewer.scene.camera.frustum = new PerspectiveFrustum(pfOptions);
}
}
I have added a Sandcastle here, if you click the button the first time, it changes into OrthographicFrustum
another click shows the false display of the earth as displayed above. Reesizing the broswer window corrects the display of the earth.