Skip to content

Could we skip off-screen scenes rendering? #18

Description

@Peque

We used to have this check in the loop:

    scenes.forEach( function ( scene ) {

        var rect = scene.userData.view.getBoundingClientRect();
        // check if it's offscreen. If so skip it
        if ( rect.bottom < 0 || rect.top > renderer.domElement.clientHeight ||
             rect.right < 0 || rect.left > renderer.domElement.clientWidth ) {

            return; // it's off screen

        }

        // set the viewport
        var width = rect.right - rect.left;
        var height = rect.bottom - rect.top;
        var left = rect.left;
        var bottom = renderer.domElement.clientHeight - rect.bottom;

        renderer.setViewport( left, bottom, width, height );
        renderer.setScissor( left, bottom, width, height );

        var camera = scene.userData.camera
        camera.aspect = width / height;
        camera.updateProjectionMatrix();

        renderer.render( scene, scene.userData.camera );

    } );

However, it resulted in scenes "sticking" when scrolling up/down.

How to reproduce: go to one scene and scroll fast up or down. The scene, or part of it, may get stuck to the view, as long as another scene does not appear with the scroll (i.e.: try to scroll away from any scenes).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions