| | |
| | | SCREEN_WIDTH = document.body.clientWidth; //window.innerWidth; |
| | | SCREEN_HEIGHT = document.body.clientHeight; //window.innerHeight; |
| | | |
| | | renderer.setPixelRatio(pixelRatio); |
| | | // renderer.setPixelRatio(pixelRatio); |
| | | renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); |
| | | |
| | | fontAspect = (SCREEN_WIDTH / 175) * (SCREEN_HEIGHT / 200); |
| | |
| | | |
| | | // since I use the lil-gui.min.js minified version of lil-gui without modern exports, |
| | | //'g()' is 'GUI()' ('g' is the shortened version of 'GUI' inside the lil-gui.min.js file) |
| | | gui = new g(); // same as gui = new GUI(); |
| | | // gui = new g(); // same as gui = new GUI(); |
| | | |
| | | pixel_ResolutionController = gui.add(pixel_ResolutionObject, 'pixel_Resolution', 0.5, 1.0, 0.05).onChange(handlePixelResolutionChange); |
| | | // pixel_ResolutionController = gui.add(pixel_ResolutionObject, 'pixel_Resolution', 0.5, 1.0, 0.05).onChange(handlePixelResolutionChange); |
| | | if (!mouseControl) |
| | | orthographicCamera_ToggleController = gui.add(orthographicCamera_ToggleObject, 'Orthographic_Camera', false).onChange(handleCameraProjectionChange); |
| | | |
| | | gui.domElement.style.userSelect = "none"; |
| | | gui.domElement.style.MozUserSelect = "none"; |
| | | // gui.domElement.style.userSelect = "none"; |
| | | // gui.domElement.style.MozUserSelect = "none"; |
| | | |
| | | |
| | | if (mouseControl) |
| | | { |
| | | |
| | | gui.domElement.addEventListener("mouseenter", function (event) |
| | | { |
| | | ableToEngagePointerLock = false; |
| | | }, false); |
| | | gui.domElement.addEventListener("mouseleave", function (event) |
| | | { |
| | | ableToEngagePointerLock = true; |
| | | }, false); |
| | | // gui.domElement.addEventListener("mouseenter", function (event) |
| | | // { |
| | | // ableToEngagePointerLock = false; |
| | | // }, false); |
| | | // gui.domElement.addEventListener("mouseleave", function (event) |
| | | // { |
| | | // ableToEngagePointerLock = true; |
| | | // }, false); |
| | | |
| | | window.addEventListener('wheel', onMouseWheel, false); |
| | | |
| | |
| | | // setup scene/demo-specific objects, variables, GUI elements, and data |
| | | initSceneData(); |
| | | |
| | | pixel_ResolutionController.setValue(pixelRatio); |
| | | // pixel_ResolutionController.setValue(pixelRatio); |
| | | if (!allowOrthographicCamera && !mouseControl) |
| | | { |
| | | orthographicCamera_ToggleController.domElement.hidden = true; |
| | |
| | | // if GUI has been used, update |
| | | if (needChangePixelResolution) |
| | | { |
| | | pixelRatio = pixel_ResolutionController.getValue(); |
| | | // pixelRatio = pixel_ResolutionController.getValue(); |
| | | onWindowResize(); |
| | | needChangePixelResolution = false; |
| | | } |