antimatter15 / splat

WebGL 3D Gaussian Splat Viewer
https://antimatter15.com/splat/
MIT License
1.7k stars 169 forks source link

Is there a way to set the initial view as camera 0 or camera 1? #46

Open hnc01 opened 3 months ago

hnc01 commented 3 months ago

I added code to set the initial view as cameras[0] or cameras[1] by doing this:

        const fr = new FileReader();

        fr.onload = () => {
            cameras = JSON.parse(fr.result);
            viewMatrix = getViewMatrix(cameras[1]);
            projectionMatrix = getProjectionMatrix(
                camera.fx / downsample,
                camera.fy / downsample,
                canvas.width,
                canvas.height,
            );
            gl.uniformMatrix4fv(u_projection, false, projectionMatrix);

            console.log("Loaded Cameras");
        };

        fr.readAsText(data);

I do this onload of page but the initial view is not changing. Is there anything else I should be doing?