js/render.js
// Update the camera and renderer parameters when the window changes size
Update the camera and renderer parameters when the window changes size
Update the camera and renderer parameters when the window changes size
function handleResize() {
  let w = window.innerWidth;
  let h = window.innerHeight;
  camera2d.left   = -w / 2;
  camera2d.right  =  w / 2;
  camera2d.top    =  h / 2;
  camera2d.bottom = -h / 2;
  camera2d.updateProjectionMatrix();
  camera3d.aspect = window.innerWidth / window.innerHeight;
  camera3d.updateProjectionMatrix();
  renderer.setSize(window.innerWidth, window.innerHeight);
}
function handleResize ( ) { let w = window . innerWidth ; let h = window . innerHeight ; camera2d . left = - w / 2 ; camera2d . right = w / 2 ; camera2d . top = h / 2 ; camera2d . bottom = - h / 2 ; camera2d . updateProjectionMatrix ( ) ; camera3d . aspect = window . innerWidth / window . innerHeight ; camera3d . updateProjectionMatrix ( ) ; renderer . setSize ( window . innerWidth , window . innerHeight ) ; }
Update the camera and renderer parameters when the window changes size
Update the camera and renderer parameters when the window changes size