Fix T49090: color picking draws wrong when using subsurf in material draw mode.

ccgDM_drawMappedFacesMat was missig a smooth shade model restore, some other
functions were redundantly setting it since we can assume it to be the default
state already.
This commit is contained in:
Brecht Van Lommel 2016-08-19 23:04:43 +02:00
parent 62e3849f40
commit cf53389425
Notes: blender-bot 2023-02-14 19:45:25 +01:00
Referenced by issue #49118, Blender 3D view - Solid (Blender Render) material diffuse and/specular not updating until tabbing into edit mode.
Referenced by issue #49124, Some scenes render transparent with big tiles and OpenCL rendering
Referenced by issue #49078, When rendering fire in cycles, odd duplicates appear when the camera is located inside the domain
Referenced by issue #49057, 2.77.3 Textured viewport smooth shading regression
Referenced by issue blender/blender-addons#49090, color picker broken
1 changed files with 3 additions and 11 deletions

View File

@ -2707,7 +2707,6 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
GPU_vertex_setup(dm);
GPU_normal_setup(dm);
GPU_triangle_setup(dm);
glShadeModel(GL_SMOOTH);
for (a = 0; a < dm->drawObject->totmaterial; a++) {
if (!setMaterial || setMaterial(dm->drawObject->materials[a].mat_nr + 1, NULL)) {
GPU_buffer_draw_elements(dm->drawObject->triangles, GL_TRIANGLES, dm->drawObject->materials[a].start,
@ -2811,8 +2810,6 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
}
#endif
glShadeModel(GL_SMOOTH);
CCG_key_top_level(&key, ss);
ccgdm_pbvh_update(ccgdm);
@ -2965,6 +2962,7 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
}
}
glShadeModel(GL_SMOOTH);
#undef PASSATTRIB
}
else {
@ -3170,8 +3168,6 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
MEM_freeN(mat_orig_to_new);
MEM_freeN(matconv);
}
glShadeModel(GL_SMOOTH);
}
static void ccgDM_drawFacesGLSL(DerivedMesh *dm, DMSetMaterial setMaterial)
@ -3369,6 +3365,7 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm,
}
}
glShadeModel(GL_SMOOTH);
#undef PASSATTRIB
}
@ -3503,7 +3500,6 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
next_actualFace = 0;
glShadeModel(GL_SMOOTH);
/* lastFlag = 0; */ /* UNUSED */
for (mat_index = 0; mat_index < dm->drawObject->totmaterial; mat_index++) {
GPUBufferMaterial *bufmat = dm->drawObject->materials + mat_index;
@ -3681,8 +3677,8 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm,
if (do_draw) {
glShadeModel(draw_smooth ? GL_SMOOTH : GL_FLAT);
ccgSubSurf_drawGLMesh(ss, true, -1, -1);
glShadeModel(GL_SMOOTH);
}
glShadeModel(GL_SMOOTH);
return;
}
#endif
@ -3744,10 +3740,6 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm,
GPU_basic_shader_stipple(GPU_SHADER_STIPPLE_QUARTTONE);
}
/* no need to set shading mode to flat because
* normals are already used to change shading */
glShadeModel(GL_SMOOTH);
for (S = 0; S < numVerts; S++) {
CCGElem *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
if (ln) {