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:
authorCampbell Barton <ideasman42@gmail.com>2010-03-24 19:20:13 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-03-24 19:20:13 +0300
commit8456995181a22ec0ba2a0dc55588c4646423f57b (patch)
tree1252908045b293db975a552f163b0be21340b72f /source/blender/blenlib/intern/uvproject.c
parent6f724c54bcbb9fc0408a6191a8031c278086416d (diff)
xaspect and yaspect were not working with uv project modifier & panorama, also removed some includes.
Diffstat (limited to 'source/blender/blenlib/intern/uvproject.c')
-rw-r--r--source/blender/blenlib/intern/uvproject.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/source/blender/blenlib/intern/uvproject.c b/source/blender/blenlib/intern/uvproject.c
index 273cb01ce1c..0e7c36886ce 100644
--- a/source/blender/blenlib/intern/uvproject.c
+++ b/source/blender/blenlib/intern/uvproject.c
@@ -56,28 +56,31 @@ void project_from_camera(float target[2], float source[3], UvCameraInfo *uci)
if(uci->do_pano) {
float angle= atan2f(pv4[0], -pv4[2]) / (M_PI * 2.0); /* angle around the camera */
if (uci->do_persp==0) {
- target[0] = angle; /* no correct method here, just map to 0-1 */
- target[1] = pv4[1] / uci->camsize;
+ target[0]= angle; /* no correct method here, just map to 0-1 */
+ target[1]= pv4[1] / uci->camsize;
}
else {
float vec2d[2]= {pv4[0], pv4[2]}; /* 2D position from the camera */
- target[0] = angle * (M_PI / uci->camangle);
- target[1] = pv4[1] / (len_v2(vec2d) * uci->camsize);
+ target[0]= angle * (M_PI / uci->camangle);
+ target[1]= pv4[1] / (len_v2(vec2d) * uci->camsize);
}
}
else {
if (pv4[2]==0.0f) pv4[2]= 0.00001f; /* don't allow div by 0 */
if (uci->do_persp==0) {
- target[0]=(pv4[0]/uci->camsize) * uci->xasp;
- target[1]=(pv4[1]/uci->camsize) * uci->yasp;
+ target[0]= (pv4[0]/uci->camsize);
+ target[1]= (pv4[1]/uci->camsize);
}
else {
- target[0]=(-pv4[0]*((1.0f/uci->camsize)/pv4[2])*uci->xasp) / 2.0f;
- target[1]=(-pv4[1]*((1.0f/uci->camsize)/pv4[2])*uci->yasp) / 2.0f;
+ target[0]= (-pv4[0]*((1.0f/uci->camsize)/pv4[2])) / 2.0f;
+ target[1]= (-pv4[1]*((1.0f/uci->camsize)/pv4[2])) / 2.0f;
}
}
+ target[0] *= uci->xasp;
+ target[1] *= uci->yasp;
+
/* adds camera shift + 0.5 */
target[0] += uci->shiftx;
target[1] += uci->shifty;