UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

16 lines (15 loc) 720 B
export function defaultPixelRatio() { // pixel ratio used to be set to: // - for mobile: 1 // - for desktop: Math.max(2, window.devicePixelRatio) // using return CoreUserAgent.isMobile() ? 1 : Math.max(2, window.devicePixelRatio); // I've considerred keeping it simple and setting to window.devicePixelRatio for every device, // but the loss of resolution is noticeable on desktop. // so Math.max(2, window.devicePixelRatio) seems like a good compromise between // simplicity and result. // Any further customisation can be done with the rop/WebGLRenderer node // return Math.max(2, window.devicePixelRatio); // using a fixed value of 2 now, // since high dpi devices probably don't need higher return 2; }