[Bf-blender-cvs] [9ab2872] master: Fix T43605: Spot Cone+Curve creates odd shadow

Campbell Barton noreply at git.blender.org
Fri Feb 27 10:56:12 CET 2015


Commit: 9ab28727ac94f537acb8fdd84dd7298acc44d5ab
Author: Campbell Barton
Date:   Fri Feb 27 20:54:57 2015 +1100
Branches: master
https://developer.blender.org/rB9ab28727ac94f537acb8fdd84dd7298acc44d5ab

Fix T43605: Spot Cone+Curve creates odd shadow

Curves could leave glFrontFace in an unknown state.

===================================================================

M	source/blender/editors/space_view3d/drawobject.c

===================================================================

diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 250d8c6..f59b694 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);




More information about the Bf-blender-cvs mailing list