Skip to content

Commit

Permalink
feat(globe): update to latest version with atmosphere rendering (#1351)
Browse files Browse the repository at this point in the history
  • Loading branch information
usefulthink committed Apr 8, 2024
1 parent ddc2ac2 commit fe647f0
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/scripts/components/main/globe/globe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import {
WebGlGlobe,
WebGlGlobeEventMap
} from '@ubilabs/esa-webgl-globe';

import GLOBE_WORKER_URL from '@ubilabs/esa-webgl-globe/worker?url';
import ATMOSPHERE_TEXTURE_URL from '@ubilabs/esa-webgl-globe/textures/atmosphere.png?url';
import SHADING_TEXTURE_URL from '@ubilabs/esa-webgl-globe/textures/shading.png?url';

import {GlobeProjectionState} from '../../../types/globe-projection-state';
import {Layer} from '../../../types/layer';
Expand All @@ -38,6 +41,10 @@ type LayerLoadingStateChangedEvent =
WebGlGlobeEventMap['layerLoadingStateChanged'];

WebGlGlobe.setTileSelectorWorkerUrl(GLOBE_WORKER_URL);
WebGlGlobe.setTextureUrls({
atmosphere: ATMOSPHERE_TEXTURE_URL,
shading: SHADING_TEXTURE_URL
});

interface Props {
active: boolean;
Expand Down Expand Up @@ -119,7 +126,15 @@ function useWebGlGlobe(view: CameraView) {
return EMPTY_FUNCTION;
}

const newGlobe = new WebGlGlobe(containerEl, {cameraView: view});
const newGlobe = new WebGlGlobe(containerEl, {
cameraView: view,
renderOptions: {
atmosphereEnabled: true,
shadingEnabled: true,
atmosphereStrength: 0.8,
atmosphereColor: [0.58, 0.79, 1] // {r: 148, g: 201, b: 255}
}
});

if ('renderer' in newGlobe) {
// @TODO: Remove this setting after globe controls have been refactored.
Expand Down

0 comments on commit fe647f0

Please sign in to comment.