Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hnc01 opened this issue Mar 13, 2024 · 0 comments
Open

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

hnc01 opened this issue Mar 13, 2024 · 0 comments

Comments

@hnc01
Copy link

hnc01 commented Mar 13, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant