diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-11-04 18:36:06 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-11-04 18:36:06 +0400 |
commit | 4ea816837de646af124ffc82758cae37950a0a51 (patch) | |
tree | 771c7a0e084446080d6f6d12258585a479bf2887 /source/blender/blenlib/intern/math_rotation.c | |
parent | 82dc05391cdda573f1523325bfd4c6a2a5233323 (diff) |
Configurable sensor size:
- Added support of variable size sensor width and height.
- Added presets for most common cameras, also new presets can be defined by user.
- Added option to control which dimension (vertical or horizontal) of sensor
size defines FOV. Old behavior of automatic FOV calculation is also kept.
- Renderer, viewport, game engine and collada importer/exporter should
deal fine with this changes. Other exporters would be updated soon.
Diffstat (limited to 'source/blender/blenlib/intern/math_rotation.c')
-rw-r--r-- | source/blender/blenlib/intern/math_rotation.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 0ca8b72c1e3..7fecbae8229 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -1688,14 +1688,14 @@ void vec_apply_track(float vec[3], short axis) } /* lens/angle conversion (radians) */ -float lens_to_angle(float lens) +float focallength_to_fov(float focal_length, float sensor) { - return 2.0f * atanf(16.0f/lens); + return 2.0f * atanf((sensor/2.0f) / focal_length); } -float angle_to_lens(float angle) +float fov_to_focallength(float hfov, float sensor) { - return 16.0f / tanf(angle * 0.5f); + return (sensor/2.0f) / tanf(hfov * 0.5f); } /* 'mod_inline(-3,4)= 1', 'fmod(-3,4)= -3' */ |