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/modifiers | |
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/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_uvproject.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 36d773ad605..d5dd0078a80 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -38,6 +38,7 @@ #include "DNA_meshdata_types.h" #include "DNA_camera_types.h" #include "DNA_object_types.h" +#include "DNA_scene_types.h" #include "BLI_math.h" #include "BLI_string.h" @@ -159,7 +160,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, float scax= umd->scalex ? umd->scalex : 1.0f; float scay= umd->scaley ? umd->scaley : 1.0f; int free_uci= 0; - + aspect = aspx / aspy; for(i = 0; i < umd->num_projectors; ++i) @@ -194,16 +195,28 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, free_uci= 1; } else { - float scale= (cam->type == CAM_PERSP) ? cam->clipsta * 32.0f / cam->lens : cam->ortho_scale; + float sensor= (cam->sensor_fit == CAMERA_SENSOR_FIT_VERT) ? (cam->sensor_y) : cam->sensor_x; + float scale= (cam->type == CAM_PERSP) ? cam->clipsta * sensor / cam->lens : cam->ortho_scale; float xmax, xmin, ymax, ymin; - if(aspect > 1.0f) { + if(cam->sensor_fit==CAMERA_SENSOR_FIT_AUTO) { + if(aspect > 1.0f) { + xmax = 0.5f * scale; + ymax = xmax / aspect; + } else { + ymax = 0.5f * scale; + xmax = ymax * aspect; + } + } + else if(cam->sensor_fit==CAMERA_SENSOR_FIT_HOR) { xmax = 0.5f * scale; ymax = xmax / aspect; - } else { + } + else { ymax = 0.5f * scale; xmax = ymax * aspect; } + xmin = -xmax; ymin = -ymax; |