提交 3423b6d9 编写于 作者: C Charles Flèche 提交者: Mr.doob

Fix perspective camera FOV export. (#9482)

From blender, `camera.angle` returns the fov according to longest rendering dimension in radians. This patch returns a value three.js expects: an horizontal fov in degrees.
上级 51e25a86
import math
from bpy import data, types, context
from .. import logger
......@@ -74,7 +75,11 @@ def fov(camera):
"""
logger.debug("camera.fov(%s)", camera)
return camera.angle
fov_in_radians = camera.angle
aspect_ratio = aspect(camera)
if aspect_ratio > 1:
fov_in_radians = 2 * math.atan(math.tan(fov_in_radians / 2) / aspect_ratio)
return math.degrees(fov_in_radians)
@_camera
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册