forked from bartvdbraak/blender
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.
This commit is contained in:
parent
78c43d18fc
commit
fe62b62cb0
@ -70,7 +70,7 @@ void project_from_camera(float target[2], float source[3], UvCameraInfo *uci)
|
|||||||
vec2d[0]= pv4[0];
|
vec2d[0]= pv4[0];
|
||||||
vec2d[1]= pv4[2];
|
vec2d[1]= pv4[2];
|
||||||
target[0]= angle * ((float)M_PI / uci->camangle);
|
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 {
|
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.camangle= lens_to_angle(camera->lens) / 2.0f;
|
||||||
uci.camsize= uci.do_persp ? tanf(uci.camangle) : camera->ortho_scale;
|
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;
|
UvCameraInfo *uci_pt;
|
||||||
|
|
||||||
/* normal projection */
|
/* normal projection */
|
||||||
|
Loading…
Reference in New Issue
Block a user