bugfix [#22794] Inconsistent behaviour with Panorama, border rendering
authorCampbell Barton <ideasman42@gmail.com>
Tue, 9 Nov 2010 01:37:58 +0000 (01:37 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 9 Nov 2010 01:37:58 +0000 (01:37 +0000)
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/rendercore.c

index 50fd5aba87bcda939fe20c5aa08e9b6e76f1e373..0c2e1c8dcea8cd78a601b6b784a1d1fccd7a48cd 100644 (file)
@@ -1531,10 +1531,10 @@ 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.winx;
-               
+               R.panodxv= ((viewplane->xmax-viewplane->xmin)*R.panodxp)/(float)(R.disprect.xmax - R.disprect.xmin);
+
                /* shift viewplane */
                R.viewplane.xmin = viewplane->xmin + R.panodxv;
                R.viewplane.xmax = viewplane->xmax + R.panodxv;
@@ -2663,10 +2663,6 @@ int RE_is_rendering_allowed(Scene *scene, void *erh, void (*error)(void *handle,
        
        /* forbidden combinations */
        if(scene->r.mode & R_PANORAMA) {
-               if(scene->r.mode & R_BORDER) {
-                       error(erh, "No border supported for Panorama");
-                       return 0;
-               }
                if(scene->r.mode & R_ORTHO) {
                        error(erh, "No Ortho render possible for Panorama");
                        return 0;
index bd4af52cd912a54f8680f3180a3b7d401252b6e1..3ddfabfa11012c9dd5548fd82ec6b987b6ff00d3 100644 (file)
@@ -96,8 +96,15 @@ void calc_view_vector(float *view, float x, float y)
        }
        else {
                
-               if(R.r.mode & R_PANORAMA)
-                       x-= R.panodxp;
+               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;
+                       }
+               }
                
                /* move x and y to real viewplane coords */
                x= (x/(float)R.winx);