Skip to content

Commit

Permalink
fix resize
Browse files Browse the repository at this point in the history
  • Loading branch information
vincerubinetti committed Jan 3, 2024
1 parent 3509a76 commit 9fc38a9
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/viz.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,6 @@ scene.background = light;
const camera = new PerspectiveCamera();
const clock = new Clock();

// resize/reset scene/camera
const reset = () => {
camera.aspect = canvas.clientWidth / canvas.clientHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(canvas.clientWidth, canvas.clientHeight, false);
};
reset();
window.addEventListener("resize", reset);

// post-processing
const renderPass = new RenderPass(scene, camera);
const bloomPass = new UnrealBloomPass(
Expand All @@ -100,6 +90,18 @@ composer.addPass(renderPass);
composer.addPass(bloomPass);
composer.addPass(outputPass);

// resize/reset scene/camera
const reset = async () => {
camera.aspect = canvas.clientWidth / canvas.clientHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(canvas.clientWidth, canvas.clientHeight, false);
composer.setPixelRatio(window.devicePixelRatio);
composer.setSize(canvas.clientWidth, canvas.clientHeight, false);
};
reset();
window.addEventListener("resize", reset);

// generate helix
const leftPoints = [];
const rightPoints = [];
Expand Down

0 comments on commit 9fc38a9

Please sign in to comment.