Explorar o código

Improved camera.setLens code as suggested in #2323.

Mr.doob %!s(int64=13) %!d(string=hai) anos
pai
achega
24a6a533ec
Modificáronse 2 ficheiros con 2 adicións e 2 borrados
  1. 1 1
      src/cameras/PerspectiveCamera.js
  2. 1 1
      src/extras/cameras/CombinedCamera.js

+ 1 - 1
src/cameras/PerspectiveCamera.js

@@ -28,7 +28,7 @@ THREE.PerspectiveCamera.prototype = Object.create( THREE.Camera.prototype );
 
 THREE.PerspectiveCamera.prototype.setLens = function ( focalLength, frameHeight ) {
 
-	frameHeight = frameHeight !== undefined ? frameHeight : 24;
+	if ( frameHeight === undefined ) frameHeight = 24;
 
 	this.fov = 2 * Math.atan( frameHeight / ( focalLength * 2 ) ) * ( 180 / Math.PI );
 	this.updateProjectionMatrix();

+ 1 - 1
src/extras/cameras/CombinedCamera.js

@@ -152,7 +152,7 @@ THREE.CombinedCamera.prototype.updateProjectionMatrix = function() {
 */
 THREE.CombinedCamera.prototype.setLens = function ( focalLength, frameHeight ) {
 
-	frameHeight = frameHeight !== undefined ? frameHeight : 24;
+	if ( frameHeight === undefined ) frameHeight = 24;
 
 	var fov = 2 * Math.atan( frameHeight / ( focalLength * 2 ) ) * ( 180 / Math.PI );