Browse Source

Changed PerspectiveCamera and CombinedCamera .setLens() as per #1212.

Mr.doob 13 years ago
parent
commit
fb89ad0136
2 changed files with 8 additions and 10 deletions
  1. 3 5
      src/cameras/PerspectiveCamera.js
  2. 5 5
      src/extras/cameras/CombinedCamera.js

+ 3 - 5
src/cameras/PerspectiveCamera.js

@@ -27,13 +27,11 @@ THREE.PerspectiveCamera.prototype.constructor = THREE.PerspectiveCamera;
  * Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html
  * Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html
  */
  */
 
 
-THREE.PerspectiveCamera.prototype.setLens = function ( focalLength, frameSize ) {
+THREE.PerspectiveCamera.prototype.setLens = function ( focalLength, frameHeight ) {
 
 
-	frameSize = frameSize !== undefined ? frameSize : 43.25; // 36x24mm
-
-	this.fov = 2 * Math.atan( frameSize / ( focalLength * 2 ) );
-	this.fov = 180 / Math.PI * this.fov;
+	frameHeight = frameHeight !== undefined ? frameHeight : 24;
 
 
+	this.fov = 2 * Math.atan( frameHeight / ( focalLength * 2 ) ) * ( 180 / Math.PI );
 	this.updateProjectionMatrix();
 	this.updateProjectionMatrix();
 
 
 }
 }

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

@@ -112,13 +112,13 @@ THREE.CombinedCamera.prototype.setFov = function(fov) {
 * 35mm (fullframe) camera is used if frame size is not specified;
 * 35mm (fullframe) camera is used if frame size is not specified;
 * Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html
 * Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html
 */
 */
-THREE.CombinedCamera.prototype.setLens = function(focalLength, framesize) {
+THREE.CombinedCamera.prototype.setLens = function ( focalLength, frameHeight ) {
 
 
-	if (!framesize) framesize = 43.25; // 36x24mm
+	frameHeight = frameHeight !== undefined ? frameHeight : 24;
 
 
-	var fov = 2 * Math.atan( framesize / (focalLength * 2));
-	fov = 180 / Math.PI * fov;
-	this.setFov(fov);
+	var fov = 2 * Math.atan( frameHeight / ( focalLength * 2 ) ) * ( 180 / Math.PI );
+
+	this.setFov( fov );
 
 
 	return fov;
 	return fov;
 };
 };