On-demand rendering solution broken since 5.29

In the code originally, we generally updated the view matrix with each rendered frame or if there was some camera movement with a PointerInfo object. Technically, this should be decoupled from the picking/pointer info and added to the camera.update function (assuming there was pending movement for a camera). I am looking into how best to do without adversely affecting performance but I did think of a slight workaround that could work for you in the meantime:

function render() {
        camera.update()
       // In your render loop, you could check for pending camera movements and call
       // the function below to update everything.
        if (camera.inertialAlphaOffset !== 0 || 
            camera.inertialBetaOffset !== 0 ||
            camera.inertialRadiusOffset !== 0 ||
            camera.inertialPanningX !== 0 ||
            camera.inertialPanningY !== 0
        ) {
            scene.updateTransformMatrix();
        }
        if (dirty > 0) {
            console.log("RENDER");
            scene.render(false);
            dirty--;
        }
    }

You could also simplify this further by using that camera change criteria to directly call the render function (which has a function that calls the updateTransformMatrix (ultimately calling the onViewMatrixChangedObserverable)

function render() {
        camera.update()
        if (camera.inertialAlphaOffset !== 0 || 
            camera.inertialBetaOffset !== 0 ||
            camera.inertialRadiusOffset !== 0 ||
            camera.inertialPanningX !== 0 ||
            camera.inertialPanningY !== 0
        ) {
            console.log("RENDER");
            scene.render(false);
        }
    }

I’m not sure if this will work for your specific use case but I wanted to give you a couple of options to unblock you while I work on this.

NOTE: Those 5 inertial values are only applicable to the ArcRotateCamera. The other cameras use cameraRotation and cameraDirection.

1 Like