diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-02-27 12:54:57 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-02-27 12:54:57 +0300 |
commit | 9ab28727ac94f537acb8fdd84dd7298acc44d5ab (patch) | |
tree | b040fc09e10c19df30e554adb31a5dfb3cbc7ef3 /source/blender/editors | |
parent | 9683c2b129e5a1bacdb12a18497e544f4d4b82ae (diff) |
Fix T43605: Spot Cone+Curve creates odd shadow
Curves could leave glFrontFace in an unknown state.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 250d8c6278e..f59b6945744 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -4340,17 +4340,6 @@ static bool drawDispList_nobackface(Scene *scene, View3D *v3d, RegionView3D *rv3 const bool render_only = (v3d->flag2 & V3D_RENDER_OVERRIDE) != 0; const bool solid = (dt > OB_WIRE); - if (drawCurveDerivedMesh(scene, v3d, rv3d, base, dt) == false) { - return false; - } - - if (ob->type == OB_MBALL) { - glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW); - } - else { - glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CCW : GL_CW); - } - switch (ob->type) { case OB_FONT: case OB_CURVE: @@ -4478,7 +4467,28 @@ static bool drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *ba ensure_curve_cache(scene, base->object); #endif - retval = drawDispList_nobackface(scene, v3d, rv3d, base, dt, dflag, ob_wire_col); + if (drawCurveDerivedMesh(scene, v3d, rv3d, base, dt) == false) { + return false; + } + else { + Object *ob = base->object; + GLenum mode; + + if (ob->type == OB_MBALL) { + mode = (ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW; + } + else { + mode = (ob->transflag & OB_NEG_SCALE) ? GL_CCW : GL_CW; + } + + glFrontFace(mode); + + retval = drawDispList_nobackface(scene, v3d, rv3d, base, dt, dflag, ob_wire_col); + + if (mode != GL_CCW) { + glFrontFace(GL_CCW); + } + } if (v3d->flag2 & V3D_BACKFACE_CULLING) { glDisable(GL_CULL_FACE); |