Panorama render is now border-render safe.
This commit is contained in:
Ton Roosendaal
2010-12-16 12:49:48 +00:00
parent 566bda734a
commit 4e26b4ec38
2 changed files with 6 additions and 11 deletions

View File

@@ -1494,14 +1494,15 @@ static void *do_part_thread(void *pa_v)
float panorama_pixel_rot(Render *re)
{
float psize, phi, xfac;
float borderfac= (float)(re->disprect.xmax - re->disprect.xmin) / (float)re->winx;
/* size of 1 pixel mapped to viewplane coords */
psize= (re->viewplane.xmax-re->viewplane.xmin)/(float)re->winx;
psize= (re->viewplane.xmax-re->viewplane.xmin)/(float)(re->winx);
/* angle of a pixel */
phi= atan(psize/re->clipsta);
/* correction factor for viewplane shifting, first calculate how much the viewplane angle is */
xfac= ((re->viewplane.xmax-re->viewplane.xmin))/(float)re->xparts;
xfac= borderfac*((re->viewplane.xmax-re->viewplane.xmin))/(float)re->xparts;
xfac= atan(0.5f*xfac/re->clipsta);
/* and how much the same viewplane angle is wrapped */
psize= 0.5f*phi*((float)re->partx);
@@ -1532,9 +1533,9 @@ static RenderPart *find_next_pano_slice(Render *re, int *minx, rctf *viewplane)
if(best) {
float phi= panorama_pixel_rot(re);
/* R.disprect.xmax - R.disprect.xmin rather then R.winx for border render */
R.panodxp= (re->winx - (best->disprect.xmin + best->disprect.xmax) )/2;
R.panodxv= ((viewplane->xmax-viewplane->xmin)*R.panodxp)/(float)(R.disprect.xmax - R.disprect.xmin);
R.panodxv= ((viewplane->xmax-viewplane->xmin)*R.panodxp)/(float)(re->winx);
/* shift viewplane */
R.viewplane.xmin = viewplane->xmin + R.panodxv;

View File

@@ -97,13 +97,7 @@ void calc_view_vector(float *view, float x, float y)
else {
if(R.r.mode & R_PANORAMA) {
if(R.r.mode & R_BORDER) {
/* scale by the win/border size */
x-= R.panodxp * ((float)R.winx / (float)(R.disprect.xmax - R.disprect.xmin));
}
else {
x-= R.panodxp;
}
x-= R.panodxp;
}
/* move x and y to real viewplane coords */