diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-07-03 14:48:18 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-07-03 14:48:18 +0400 |
commit | fe62b62cb0b61c03bea111d8fecb73b2166fcddf (patch) | |
tree | c00777008f9f826c27829a90949f19efa5591284 /source | |
parent | 78c43d18fc47c3728a55e1710901c1e7f964195f (diff) |
fix 2 bugs in project from view from a camera object
- panorama mode was scaled 2x too high.
- scaled camera objects would incorrectly effect the result.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenlib/intern/uvproject.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/uvproject.c b/source/blender/blenlib/intern/uvproject.c index ecb42315ee3..be7682a63d4 100644 --- a/source/blender/blenlib/intern/uvproject.c +++ b/source/blender/blenlib/intern/uvproject.c @@ -70,7 +70,7 @@ void project_from_camera(float target[2], float source[3], UvCameraInfo *uci) vec2d[0]= pv4[0]; vec2d[1]= pv4[2]; target[0]= angle * ((float)M_PI / uci->camangle); - target[1]= pv4[1] / (len_v2(vec2d) * uci->camsize); + target[1]= pv4[1] / (len_v2(vec2d) * (uci->camsize * 2.0f)); } } else { @@ -146,7 +146,11 @@ UvCameraInfo *project_camera_info(Object *ob, float (*rotmat)[4], float winx, fl uci.camangle= lens_to_angle(camera->lens) / 2.0f; uci.camsize= uci.do_persp ? tanf(uci.camangle) : camera->ortho_scale; - if (invert_m4_m4(uci.caminv, ob->obmat)) { + /* account for scaled cameras */ + copy_m4_m4(uci.caminv, ob->obmat); + normalize_m4(uci.caminv); + + if (invert_m4(uci.caminv)) { UvCameraInfo *uci_pt; /* normal projection */ |