Ensure dpr is not undefined when window.devicePixelRatio is falsy

This commit is contained in:
2025-05-28 17:59:50 +02:00
parent 65b84cb3e2
commit 5ba5ee3f65

View File

@@ -34,7 +34,7 @@ const renderer = new THREE.WebGLRenderer({ antialias: !IS_MOBILE });
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.shadowMap.enabled = !IS_MOBILE;
renderer.shadowMap.type = IS_MOBILE ? THREE.BasicShadowMap : THREE.PCFSoftShadowMap;
const dpr = Math.min(window.devicePixelRatio, IS_MOBILE ? 1.0 : 2.0);
const dpr = Math.min(window.devicePixelRatio || 1, IS_MOBILE ? 1 : 2);
renderer.setPixelRatio(dpr);
container.appendChild(renderer.domElement);