Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_view3d/drawmesh.c')
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c74
1 files changed, 51 insertions, 23 deletions
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 530b26d566a..b5c44fd1a8c 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -926,14 +926,14 @@ static int tex_mat_set_face_editmesh_cb(void *userData, int index)
return !BM_elem_flag_test(efa, BM_ELEM_HIDDEN);
}
-void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags)
+void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, const int draw_flags)
{
- if ((!scene_use_new_shading_nodes(scene)) || (draw_flags & DRAW_MODIFIERS_PREVIEW)) {
+ if ((!BKE_scene_use_new_shading_nodes(scene)) || (draw_flags & DRAW_MODIFIERS_PREVIEW)) {
draw_mesh_textured_old(scene, v3d, rv3d, ob, dm, draw_flags);
return;
}
else if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
- draw_mesh_paint(rv3d, ob, dm, draw_flags);
+ draw_mesh_paint(v3d, rv3d, ob, dm, draw_flags);
return;
}
@@ -1002,51 +1002,79 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
/* Vertex Paint and Weight Paint */
-void draw_mesh_paint(RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags)
+void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags)
{
DMSetDrawOptions facemask = NULL;
Mesh *me = ob->data;
+ const short do_light = (v3d->drawtype >= OB_SOLID);
/* hide faces in face select mode */
if (draw_flags & DRAW_FACE_SELECT)
facemask = wpaint__setSolidDrawOptions_facemask;
if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
- /* enforce default material settings */
- GPU_enable_material(0, NULL);
+
+ if (do_light) {
+ /* enforce default material settings */
+ GPU_enable_material(0, NULL);
- /* but set default spec */
- glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
- glEnable(GL_COLOR_MATERIAL); /* according manpages needed */
- glColor3ub(120, 120, 120);
- glDisable(GL_COLOR_MATERIAL);
+ /* but set default spec */
+ glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
+ glEnable(GL_COLOR_MATERIAL); /* according manpages needed */
+ glColor3ub(120, 120, 120);
+ glDisable(GL_COLOR_MATERIAL);
- /* diffuse */
- glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
- glEnable(GL_LIGHTING);
- glEnable(GL_COLOR_MATERIAL);
+ /* diffuse */
+ glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
+ glEnable(GL_LIGHTING);
+ glEnable(GL_COLOR_MATERIAL);
+ }
dm->drawMappedFaces(dm, facemask, GPU_enable_material, NULL, me,
- DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
+ DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
- glDisable(GL_COLOR_MATERIAL);
- glDisable(GL_LIGHTING);
+ if (do_light) {
+ glDisable(GL_COLOR_MATERIAL);
+ glDisable(GL_LIGHTING);
- GPU_disable_material();
+ GPU_disable_material();
+ }
}
else if (ob->mode & OB_MODE_VERTEX_PAINT) {
- if (me->mloopcol)
+ if (me->mloopcol) {
dm->drawMappedFaces(dm, facemask, GPU_enable_material, NULL, me,
- DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
+ DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
+ }
else {
glColor3f(1.0f, 1.0f, 1.0f);
dm->drawMappedFaces(dm, facemask, GPU_enable_material, NULL, me,
- DM_DRAW_ALWAYS_SMOOTH);
+ DM_DRAW_ALWAYS_SMOOTH);
}
}
/* draw face selection on top */
- if (draw_flags & DRAW_FACE_SELECT)
+ if (draw_flags & DRAW_FACE_SELECT) {
draw_mesh_face_select(rv3d, me, dm);
+ }
+ else if ((do_light == FALSE) || (ob->dtx & OB_DRAWWIRE)) {
+
+ /* weight paint in solid mode, special case. focus on making the weights clear
+ * rather than the shading, this is also forced in wire view */
+
+ bglPolygonOffset(rv3d->dist, 1.0);
+ glDepthMask(0); // disable write in zbuffer, selected edge wires show better
+
+ glEnable(GL_BLEND);
+ glColor4ub(255, 255, 255, 96);
+ glEnable(GL_LINE_STIPPLE);
+ glLineStipple(1, 0xAAAA);
+
+ dm->drawEdges(dm, 1, 1);
+
+ bglPolygonOffset(rv3d->dist, 0.0);
+ glDepthMask(1);
+ glDisable(GL_LINE_STIPPLE);
+ glDisable(GL_BLEND);
+ }
}