3D viewport render preview:
authorTon Roosendaal <ton@blender.org>
Sun, 12 May 2013 13:15:41 +0000 (13:15 +0000)
committerTon Roosendaal <ton@blender.org>
Sun, 12 May 2013 13:15:41 +0000 (13:15 +0000)
- Put it available as a default now (no debug value needed)
- Fixed viewport size error, viewport was badly set
  (visible with border render, property regions)
- Fixed hanging lock in conflict between drawing and initialize
  new renders.

source/blender/editors/render/render_internal.c
source/blender/editors/render/render_preview.c
source/blender/render/extern/include/RE_pipeline.h
source/blender/render/intern/include/render_types.h
source/blender/render/intern/source/external_engine.c
source/blender/render/intern/source/pipeline.c

index b1ec1f5c099eb924894352ac909b705f1e006334..41dfaf82f6b3fb82e7bd5b5ffa0052a7fa0b1310 100644 (file)
@@ -854,10 +854,10 @@ static void render_view3d_startjob(void *customdata, short *stop, short *do_upda
                /* initalize always */
                if (render_view3d_disprect(rp->scene, rp->ar, rp->v3d, rp->rv3d, &cliprct)) {
                        rdata.mode |= R_BORDER;
-                       RE_InitState(re, NULL, &rdata, NULL, rp->sa->winx, rp->sa->winy, &cliprct);
+                       RE_InitState(re, NULL, &rdata, NULL, rp->ar->winx, rp->ar->winy, &cliprct);
                }
                else
-                       RE_InitState(re, NULL, &rdata, NULL, rp->sa->winx, rp->sa->winy, NULL);
+                       RE_InitState(re, NULL, &rdata, NULL, rp->ar->winx, rp->ar->winy, NULL);
        }
 
        if (orth)
@@ -1030,7 +1030,7 @@ void render_view3d_draw(RenderEngine *engine, const bContext *C)
        if (rres.rectf) {
                unsigned char *rect_byte = MEM_mallocN(rres.rectx * rres.recty * sizeof(int), "ed_preview_draw_rect");
                                
-               RE_ResultGet32(re, (unsigned int *)rect_byte);
+               RE_AcquiredResultGet32(re, &rres, (unsigned int *)rect_byte);
                
                glEnable(GL_BLEND);
                glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
index 23a3288209d04d95602fe26823b2078b863202cf..34903c26ca0e85fabfc5f9f7be2109e7df65267e 100644 (file)
@@ -563,7 +563,7 @@ static int ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti *rect, r
                                float fx = rect->xmin + offx;
                                float fy = rect->ymin;
                                
-                               RE_ResultGet32(re, (unsigned int *)rect_byte);
+                               RE_AcquiredResultGet32(re, &rres, (unsigned int *)rect_byte);
                                glaDrawPixelsSafe(fx, fy, rres.rectx, rres.recty, rres.rectx, GL_RGBA, GL_UNSIGNED_BYTE, rect_byte);
                                
                                MEM_freeN(rect_byte);
index 9e8432b378730ffe271dd8e91f6c22358f66ae89..52d42cd20a408eceb5da74a3deb88ceed5d6e71a 100644 (file)
@@ -179,7 +179,10 @@ void RE_AcquireResultImage(struct Render *re, struct RenderResult *rr);
 void RE_ReleaseResultImage(struct Render *re);
 void RE_SwapResult(struct Render *re, struct RenderResult **rr);
 struct RenderStats *RE_GetStats(struct Render *re);
+
 void RE_ResultGet32(struct Render *re, unsigned int *rect);
+void RE_AcquiredResultGet32(struct Render *re, struct RenderResult *result, unsigned int *rect);
+
 struct RenderLayer *RE_GetRenderLayer(struct RenderResult *rr, const char *name);
 float *RE_RenderLayerGetPass(struct RenderLayer *rl, int passtype);
 
index 4706cd02dd12e4c9a1b41c8a676bf7281fad89b9..5bd0e9747d49dcd4720711fcdfbb8051b9fc01b2 100644 (file)
@@ -345,7 +345,8 @@ typedef struct ObjectInstanceRen {
        Object *ob, *par;
        int index, psysindex, lay;
 
-       float mat[4][4], nmat[3][3]; /* nmat is inverse mat tranposed */
+       float mat[4][4], imat[4][4];
+       float nmat[3][3]; /* nmat is inverse mat tranposed */
        short flag;
 
        float dupliorco[3], dupliuv[2];
index 7ce5d9f72de4bd382ce9b12e0612916156be7526..b7cd40043f42927597ad10f657abbdbb5032de0b 100644 (file)
@@ -115,18 +115,6 @@ RenderEngineType *RE_engines_find(const char *idname)
        type = BLI_findstring(&R_engines, idname, offsetof(RenderEngineType, idname));
        if (!type)
                type = &internal_render_type;
-
-       /* XXX Hack to make this a debug-only option, remove section to make it available default */
-       if (type == &internal_render_type) {
-               static RenderEngineType rtype;
-               
-               if (type->view_update == NULL)
-                       rtype = internal_render_type;
-               else if (G.debug_value != -1) {
-                       type = &rtype;
-               }
-       }
-       /* XXX end hack */
        
        return type;
 }
index 4f719821c10d08066fbecec5212c01490e96566a..67d3354f6d3faa47656590ab5cf34eef932c44a9 100644 (file)
@@ -348,6 +348,13 @@ void RE_ResultGet32(Render *re, unsigned int *rect)
        RE_ReleaseResultImage(re);
 }
 
+/* caller is responsible for allocating rect in correct size! */
+/* Only for acquired results, for lock */
+void RE_AcquiredResultGet32(Render *re, RenderResult *result, unsigned int *rect)
+{
+       render_result_rect_get_pixels(result, rect, re->rectx, re->recty, &re->scene->view_settings, &re->scene->display_settings);
+}
+
 RenderStats *RE_GetStats(Render *re)
 {
        return &re->i;
@@ -2446,7 +2453,7 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
                if (ibuf->rect == NULL) {
                        ibuf->rect = MEM_mapallocN(sizeof(int) * rres.rectx * rres.recty, "temp 32 bits rect");
                        ibuf->mall |= IB_rect;
-                       RE_ResultGet32(re, ibuf->rect);
+                       RE_AcquiredResultGet32(re, &rres, ibuf->rect);
                        do_free = TRUE;
                }