Skip to content

Commit

Permalink
update r3f examples
Browse files Browse the repository at this point in the history
  • Loading branch information
gkjohnson committed Jan 14, 2025
1 parent 52fdb64 commit ac6a4e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
13 changes: 3 additions & 10 deletions example/r3f/atmosphere.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {

// Plugins
import {
GoogleCloudAuthPlugin,
CesiumIonAuthPlugin,
UpdateOnChangePlugin,
TileCompressionPlugin,
TilesFadePlugin,
Expand Down Expand Up @@ -64,11 +64,6 @@ const dracoLoader = new DRACOLoader().setDecoderPath( 'https://www.gstatic.com/d
function App() {

const levaParams = {
apiToken: {
value: localStorage.getItem( 'google-token' ) || 'put-your-api-key-here',
onChange: ( value ) => localStorage.setItem( 'google-token', value ),
transient: false,
},
ortho: false,
};

Expand Down Expand Up @@ -103,13 +98,11 @@ function App() {

} );

window.CAMERA = camera;

const { apiToken, ortho } = useControls( levaParams );
const { ortho } = useControls( levaParams );
return (
<>
<TilesRenderer>
<TilesPlugin plugin={ GoogleCloudAuthPlugin } args={ { apiToken } } />
<TilesPlugin plugin={ CesiumIonAuthPlugin } args={ { apiToken: import.meta.env.VITE_ION_KEY, assetId: '2275207', autoRefreshToken: true } } />
<TilesPlugin plugin={ GLTFExtensionsPlugin } dracoLoader={ dracoLoader } />
<TilesPlugin plugin={ TileCompressionPlugin } />
<TilesPlugin plugin={ UpdateOnChangePlugin } />
Expand Down
11 changes: 3 additions & 8 deletions example/r3f/globe.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {

// Plugins
import {
GoogleCloudAuthPlugin,
CesiumIonAuthPlugin,
UpdateOnChangePlugin,
TileCompressionPlugin,
TilesFadePlugin,
Expand Down Expand Up @@ -74,19 +74,14 @@ function Pointer() {
function App() {

const levaParams = {
apiToken: {
value: localStorage.getItem( 'google-token' ) || 'put-your-api-key-here',
onChange: ( value ) => localStorage.setItem( 'google-token', value ),
transient: false,
},
ortho: false,
};

// TODO: the renderer is rerendering due to floating point issues
// - see if we should trigger an invalidate on tiles plugin add and params change
// - see if we need to trigger a force update on plugin add for the UpdateOnChange plugin

const { apiToken, ortho } = useControls( levaParams );
const { ortho } = useControls( levaParams );
return (
<Canvas
frameloop='demand'
Expand All @@ -106,7 +101,7 @@ function App() {
<color attach="background" args={ [ 0x111111 ] } />

<TilesRenderer group={ { rotation: [ - Math.PI / 2, 0, 0 ] } }>
<TilesPlugin plugin={ GoogleCloudAuthPlugin } args={ { apiToken } } />
<TilesPlugin plugin={ CesiumIonAuthPlugin } args={ { apiToken: import.meta.env.VITE_ION_KEY, assetId: '2275207', autoRefreshToken: true } } />
<TilesPlugin plugin={ GLTFExtensionsPlugin } dracoLoader={ dracoLoader } />
<TilesPlugin plugin={ TileCompressionPlugin } />
<TilesPlugin plugin={ UpdateOnChangePlugin } />
Expand Down

0 comments on commit ac6a4e4

Please sign in to comment.