diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-13 05:44:25 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-13 05:44:25 +0300 |
commit | 6559209dbfddfc1cadb4d3509cee25a3434ef8e7 (patch) | |
tree | 9487b1c304fae3c0a2003d249a5c156c773d394c /source | |
parent | 25a2eb4675f8e1fcf8b990bc345aac694dba8228 (diff) |
[#26482] Solidify / Animation Opengl render. no texture.
workaround for view3d datamask not being correct on opengl render.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 1 | ||||
-rw-r--r-- | source/blender/editors/include/ED_view3d.h | 1 | ||||
-rw-r--r-- | source/blender/editors/render/render_opengl.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 28 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 3 |
6 files changed, 29 insertions, 11 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index eb5d2de7383..1146f844b5e 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4469,6 +4469,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) sce->obedit= NULL; sce->stats= NULL; sce->fps_info= NULL; + sce->customdata_mask_modal= 0; sound_create_scene(sce); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 9b70b655b3d..a48e311ae97 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -179,6 +179,7 @@ Base *ED_view3d_give_base_under_cursor(struct bContext *C, short *mval); void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, short do_clip); int ED_view3d_lock(struct RegionView3D *rv3d); +unsigned int ED_view3d_datamask(struct Scene *scene, struct View3D *v3d); unsigned int ED_viewedit_datamask(struct bScreen *screen); #endif /* ED_VIEW3D_H */ diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 43fb41a5e3d..364b0805237 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -294,6 +294,9 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) oglrender->v3d= CTX_wm_view3d(C); oglrender->ar= CTX_wm_region(C); oglrender->rv3d= CTX_wm_region_view3d(C); + + /* MUST be cleared on exit */ + oglrender->scene->customdata_mask_modal= ED_view3d_datamask(oglrender->scene, oglrender->v3d); } /* create image and image user */ @@ -337,6 +340,8 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) GPU_offscreen_free(oglrender->ofs); + oglrender->scene->customdata_mask_modal= 0; + MEM_freeN(oglrender); } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 6e286578dad..dadc51b89fe 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1943,6 +1943,22 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d) /* *********************** customdata **************** */ +CustomDataMask ED_view3d_datamask(Scene *scene, View3D *v3d) +{ + CustomDataMask mask= 0; + if(v3d->drawtype == OB_SHADED) { + /* this includes normals for mesh_create_shadedColors */ + mask |= CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_NORMAL | CD_MASK_ORCO; + } + if((v3d->drawtype == OB_TEXTURE) || ((v3d->drawtype == OB_SOLID) && (v3d->flag2 & V3D_SOLID_TEX))) { + mask |= CD_MASK_MTFACE | CD_MASK_MCOL; + + if(scene->gm.matmode == GAME_MAT_GLSL) + mask |= CD_MASK_ORCO; + } + + return mask; +} /* goes over all modes and view3d settings */ CustomDataMask ED_viewedit_datamask(bScreen *screen) { @@ -1958,17 +1974,7 @@ CustomDataMask ED_viewedit_datamask(bScreen *screen) /* check if we need tfaces & mcols due to view mode */ for(sa = screen->areabase.first; sa; sa = sa->next) { if(sa->spacetype == SPACE_VIEW3D) { - View3D *view = sa->spacedata.first; - if(view->drawtype == OB_SHADED) { - /* this includes normals for mesh_create_shadedColors */ - mask |= CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_NORMAL | CD_MASK_ORCO; - } - if((view->drawtype == OB_TEXTURE) || ((view->drawtype == OB_SOLID) && (view->flag2 & V3D_SOLID_TEX))) { - mask |= CD_MASK_MTFACE | CD_MASK_MCOL; - - if(scene->gm.matmode == GAME_MAT_GLSL) - mask |= CD_MASK_ORCO; - } + mask |= ED_view3d_datamask(scene, (View3D *)sa->spacedata.first); } } diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 00818f3b92c..cc35658b63f 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -784,6 +784,8 @@ typedef struct Scene { unsigned int lay; /* bitflags for layer visibility */ int layact; /* active layer */ unsigned int customdata_mask; /* XXX. runtime flag for drawing, actually belongs in the window, only used by object_handle_update() */ + unsigned int customdata_mask_modal; /* XXX. same as above but for temp operator use (gl renders) */ + unsigned int pad4; short flag; /* various settings */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index e7bbdf07407..20f9a4b7a51 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -313,6 +313,9 @@ void wm_event_do_notifiers(bContext *C) /* copied to set's in scene_update_tagged_recursive() */ win->screen->scene->customdata_mask= win_combine_v3d_datamask; + /* XXX, hack so operators can enforce datamasks [#26482], gl render */ + win->screen->scene->customdata_mask |= win->screen->scene->customdata_mask_modal; + scene_update_tagged(CTX_data_main(C), win->screen->scene); } } |