diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-02-18 19:08:23 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-02-18 19:08:23 +0400 |
commit | b0c6f87e2d31207b8046d809f0b384265c4ad903 (patch) | |
tree | da467e8e5e023e1e0d486d1277994474aa064dc9 /source/blender/editors/space_view3d | |
parent | 4ae3a28fcb0a53b634205fc54a2fc7869ab54f36 (diff) |
Fix #34290: backface culling option in 3d view was not interacting well with the
option in the material in texture draw mode, now it always overrides the material.
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/drawmesh.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 35a0111e575..2cef10e1981 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -236,8 +236,9 @@ static struct TextureDrawState { Object *ob; int is_lit, is_tex; int color_profile; + bool use_backface_culling; unsigned char obcol[4]; -} Gtexdraw = {NULL, 0, 0, 0, {0, 0, 0, 0}}; +} Gtexdraw = {NULL, 0, 0, 0, false, {0, 0, 0, 0}}; static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *ma, struct TextureDrawState gtexdraw) { @@ -250,7 +251,7 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m static int c_has_texface; Object *litob = NULL; /* to get mode to turn off mipmap in painting mode */ - int backculled = GEMAT_BACKCULL; + int backculled = GEMAT_BACKCULL || gtexdraw.use_backface_culling; int alphablend = 0; int textured = 0; int lit = 0; @@ -274,7 +275,7 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m if (ma) { alphablend = ma->game.alpha_blend; if (ma->mode & MA_SHLESS) lit = 0; - backculled = ma->game.flag & GEMAT_BACKCULL; + backculled = (ma->game.flag & GEMAT_BACKCULL) || gtexdraw.use_backface_culling; } if (texface) { @@ -375,17 +376,12 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O Gtexdraw.is_tex = is_tex; Gtexdraw.color_profile = BKE_scene_check_color_management_enabled(scene); + Gtexdraw.use_backface_culling = (v3d->flag2 & V3D_BACKFACE_CULLING) != 0; memcpy(Gtexdraw.obcol, obcol, sizeof(obcol)); set_draw_settings_cached(1, NULL, NULL, Gtexdraw); glShadeModel(GL_SMOOTH); - if (v3d->flag2 & V3D_BACKFACE_CULLING) { - glEnable(GL_CULL_FACE); - glCullFace(GL_BACK); - } - else { - glDisable(GL_CULL_FACE); - } + glCullFace(GL_BACK); glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, (me->flag & ME_TWOSIDED) ? GL_TRUE : GL_FALSE); } |