提交 6822d171 编写于 作者: M Mr.doob

PerspectiveCamera: More robust fov. See #5364.

上级 7a790adc
......@@ -92,10 +92,12 @@ THREE.PerspectiveCamera.prototype.setViewOffset = function ( fullWidth, fullHeig
THREE.PerspectiveCamera.prototype.updateProjectionMatrix = function () {
var fov = THREE.Math.radToDeg( 2 * Math.atan( Math.tan( THREE.Math.degToRad( this.fov ) * 0.5 ) / this.zoom ) );
if ( this.fullWidth ) {
var aspect = this.fullWidth / this.fullHeight;
var top = Math.tan( THREE.Math.degToRad( ( this.fov / this.zoom ) * 0.5 ) ) * this.near;
var top = Math.tan( THREE.Math.degToRad( fov * 0.5 ) ) * this.near;
var bottom = - top;
var left = aspect * bottom;
var right = aspect * top;
......@@ -113,7 +115,7 @@ THREE.PerspectiveCamera.prototype.updateProjectionMatrix = function () {
} else {
this.projectionMatrix.makePerspective( this.fov / this.zoom, this.aspect, this.near, this.far );
this.projectionMatrix.makePerspective( fov, this.aspect, this.near, this.far );
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册