瀏覽代碼

Improved camera.setLens code as suggested in #2323.

Mr.doob 13 年之前
父節點
當前提交
24a6a533ec
共有 2 個文件被更改,包括 2 次插入2 次删除
  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 );