Skip to content

Commit

Permalink
Jump all fields to the final target when the camera is moving fast
Browse files Browse the repository at this point in the history
  • Loading branch information
gkjohnson committed Dec 25, 2023
1 parent c3769b2 commit 823ab38
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
10 changes: 10 additions & 0 deletions example/src/FadeManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,16 @@ export class FadeManager {

}

completeAllFades() {

this._fadeState.forEach( ( value, key ) => {

this.completeFade( key );

} );

}

// Fade the object in
fadeIn( object ) {

Expand Down
21 changes: 14 additions & 7 deletions example/src/FadeTilesRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ const _scale = new Vector3();

function onTileVisibilityChange( scene, tile, visible ) {

// ensure the tiles are fading to the right target before stopping fade
if ( this.isMovingFast ) {

this._fadeManager.completeFade( scene );

}

// ensure the tiles are marked as visible on visibility toggle since
// it's possible we disable them when adjusting visibility based on frustum
scene.visible = true;
Expand All @@ -25,13 +32,6 @@ function onTileVisibilityChange( scene, tile, visible ) {

}

// ensure the tiles are fading to the right target before stopping fade
if ( this.isMovingFast ) {

this._fadeManager.completeFade( scene );

}

}

function onLoadModel( scene ) {
Expand Down Expand Up @@ -189,6 +189,13 @@ export const FadeTilesRendererMixin = base => class extends base {

} );


if ( isMovingFast ) {

this._fadeManager.completeAllFades();

}

}

deleteCamera( camera ) {
Expand Down

0 comments on commit 823ab38

Please sign in to comment.