Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiika Hamalainen <blender@miikah.org>2011-11-05 12:04:49 +0400
committerMiika Hamalainen <blender@miikah.org>2011-11-05 12:04:49 +0400
commit2ed6f077b3952123d56916980d18a379ecb3e5ac (patch)
tree1aa273e5566c95214739fb224d4c6cf115417882 /source/blender/modifiers/intern/MOD_uvproject.c
parentb9c83456b27da57a14bcf8d274b460e670d49990 (diff)
parent62f22185546e80b661424b45c88006f8b592d8b1 (diff)
Merge with trunk r41545
Diffstat (limited to 'source/blender/modifiers/intern/MOD_uvproject.c')
-rw-r--r--source/blender/modifiers/intern/MOD_uvproject.c21
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 cf5856b6339..df528a0cb11 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;