Skip to content

Provide example of render on Change with GlobeControls #1082

@Brakebein

Description

@Brakebein

Question

In the Readme as well as in #112 and #118 it is stated how to use the TilesRenderer for render-on-change approach. However, I could not find any example how to use the GlobeControls without render loop. In other projects using for example OrbitControls, I am just listening to the change event to trigger rendering the scene. Here with GlobeControls I had some struggles.

For minimum working example, I cloned the repo and made changes to the mapTiles.js example.

controls.addEventListener( 'change', () => {

    render();

} );

function render() {

    // requestAnimationFrame( render );

    controls.update();
    camera.updateMatrixWorld();

    tiles.errorTarget = params.errorTarget;
    tiles.setCamera( camera );
    tiles.setResolutionFromRenderer( camera, renderer );
    tiles.update();

    renderer.render( scene, camera );

}

However, to make it finally work, I also needed to remove this.dispatchEvent( _changeEvent ); within the update() method of the EnvironmentControls (and add it to wheelCallback to react on changes when zooming).

I assume the GlobeControls/EnvironmentControls are not yet ready or have not yet been tested for working without render loop. Or how are they supposed to work for this use case (without changing their code)?

Supplemental Data

No response

Library Version

v0.4.8

Three.js Version

r170

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions