[Bf-blender-cvs] [5abf1a4] blender2.8: OpenGL: enable fancy wireframes
Mike Erwin
noreply at git.blender.org
Mon Nov 7 20:15:14 CET 2016
Commit: 5abf1a4e9d185b57eaf0b1488c4a5333662a26d0
Author: Mike Erwin
Date: Mon Nov 7 20:03:51 2016 +0100
Branches: blender2.8
https://developer.blender.org/rB5abf1a4e9d185b57eaf0b1488c4a5333662a26d0
OpenGL: enable fancy wireframes
Most of this was already in place, just enabling & adding comments.
One fix was needed to make batch uniforms stick between multiple draws.
Added comments to selection outline; no functional changes there.
===================================================================
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 106a6ef..1983731 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -4293,7 +4293,7 @@ static void draw_mesh_object_outline_new(View3D *v3d, RegionView3D *rv3d, Object
float outline_color[4];
UI_GetThemeColor4fv((is_active ? TH_ACTIVE : TH_SELECT), outline_color);
-#if 1
+#if 1 /* new version that draws only silhouette edges */
Batch *fancy_edges = MBC_get_fancy_edges(dm);
if (rv3d->persp == RV3D_ORTHO) {
@@ -4313,13 +4313,13 @@ static void draw_mesh_object_outline_new(View3D *v3d, RegionView3D *rv3d, Object
Batch_Uniform4fv(fancy_edges, "silhouetteColor", outline_color);
Batch_draw(fancy_edges);
-
-#else
+#else /* alternate version that matches look of old viewport (but more efficient) */
Batch *batch = MBC_get_all_edges(dm);
Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR);
Batch_Uniform4fv(batch, "color", outline_color);
Batch_draw(batch);
#endif
+
glDepthMask(GL_TRUE);
}
}
@@ -4802,7 +4802,8 @@ static void draw_mesh_fancy_new(Scene *scene, ARegion *ar, View3D *v3d, RegionVi
glLineWidth(1.0f);
-#if 0
+#if 1 /* fancy wireframes */
+
Batch *fancy_edges = MBC_get_fancy_edges(dm);
if (rv3d->persp == RV3D_ORTHO) {
@@ -4829,15 +4830,18 @@ static void draw_mesh_fancy_new(Scene *scene, ARegion *ar, View3D *v3d, RegionVi
Batch_draw(fancy_edges);
+ /* extra oomph for the silhouette contours */
glLineWidth(2.0f);
-
+ Batch_use_program(fancy_edges); /* hack to make the following uniforms stick */
Batch_Uniform1b(fancy_edges, "drawFront", false);
Batch_Uniform1b(fancy_edges, "drawBack", false);
Batch_Uniform1b(fancy_edges, "drawSilhouette", true);
Batch_Uniform4fv(fancy_edges, "silhouetteColor", outlineColor);
Batch_draw(fancy_edges);
-#else
+
+#else /* simple wireframes */
+
Batch *batch = MBC_get_all_edges(dm);
Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR);
More information about the Bf-blender-cvs
mailing list