[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54633] trunk/blender/source/blender/ editors/space_view3d/drawmesh.c: Fix #34290: backface culling option in 3d view was not interacting well with the
Brecht Van Lommel
brechtvanlommel at pandora.be
Mon Feb 18 16:08:23 CET 2013
Revision: 54633
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54633
Author: blendix
Date: 2013-02-18 15:08:23 +0000 (Mon, 18 Feb 2013)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_view3d/drawmesh.c
Modified: trunk/blender/source/blender/editors/space_view3d/drawmesh.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawmesh.c 2013-02-18 14:52:49 UTC (rev 54632)
+++ trunk/blender/source/blender/editors/space_view3d/drawmesh.c 2013-02-18 15:08:23 UTC (rev 54633)
@@ -236,8 +236,9 @@
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 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 @@
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 @@
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);
}
More information about the Bf-blender-cvs
mailing list