Skip to content

Commit

Permalink
Simplify ion demo
Browse files Browse the repository at this point in the history
  • Loading branch information
gkjohnson committed Jan 9, 2025
1 parent 44ac7c9 commit 84b8573
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions example/ionLunar.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,9 @@ import {
WebGLRenderer,
PerspectiveCamera,
} from 'three';
import { GUI } from 'three/examples/jsm/libs/lil-gui.module.min.js';

let controls, scene, camera, renderer, tiles;

const apiKey = localStorage.getItem( 'ionApiKey' ) ?? import.meta.env.VITE_ION_KEY ?? 'put-your-api-key-here';
const params = {

apiKey: apiKey,
reload: reinstantiateTiles,

};

window.ENV = import.meta.env;

init();
animate();

Expand All @@ -40,10 +29,8 @@ function reinstantiateTiles() {

}

localStorage.setItem( 'ionApiKey', params.apiKey );

tiles = new TilesRenderer();
tiles.registerPlugin( new CesiumIonAuthPlugin( { apiToken: params.apiKey, assetId: '2684829', autoRefreshToken: true } ) );
tiles.registerPlugin( new CesiumIonAuthPlugin( { apiToken: import.meta.env.VITE_ION_KEY, assetId: '2684829', autoRefreshToken: true } ) );
tiles.registerPlugin( new TileCompressionPlugin() );
tiles.registerPlugin( new UpdateOnChangePlugin() );
tiles.registerPlugin( new TilesFadePlugin() );
Expand Down Expand Up @@ -79,13 +66,6 @@ function init() {
onWindowResize();
window.addEventListener( 'resize', onWindowResize, false );

// GUI
const gui = new GUI();
gui.width = 300;
gui.add( params, 'apiKey' );
gui.add( params, 'reload' );
gui.close();

}

function onWindowResize() {
Expand Down

0 comments on commit 84b8573

Please sign in to comment.