diff options
Diffstat (limited to 'source/blender/draw/engines')
3 files changed, 16 insertions, 6 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_shader.c b/source/blender/draw/engines/overlay/overlay_shader.c index 389704b3d66..9899dce5df6 100644 --- a/source/blender/draw/engines/overlay/overlay_shader.c +++ b/source/blender/draw/engines/overlay/overlay_shader.c @@ -323,7 +323,9 @@ GPUShader *OVERLAY_shader_edit_mesh_vert(void) datatoc_edit_mesh_common_lib_glsl, datatoc_edit_mesh_vert_glsl, NULL}, - .frag = (const char *[]){datatoc_gpu_shader_point_varying_color_frag_glsl, NULL}, + .frag = (const char *[]){datatoc_common_globals_lib_glsl, + datatoc_gpu_shader_point_varying_color_frag_glsl, + NULL}, .defs = (const char *[]){sh_cfg->def, "#define VERT\n", NULL}, }); } diff --git a/source/blender/draw/engines/overlay/shaders/edit_mesh_common_lib.glsl b/source/blender/draw/engines/overlay/shaders/edit_mesh_common_lib.glsl index 195d2a5a7b7..418c7bceb63 100644 --- a/source/blender/draw/engines/overlay/shaders/edit_mesh_common_lib.glsl +++ b/source/blender/draw/engines/overlay/shaders/edit_mesh_common_lib.glsl @@ -36,7 +36,7 @@ vec4 EDIT_MESH_edge_vertex_color(int vertex_flag) return color; } -vec4 EDIT_MESH_vertex_color(int vertex_flag) +vec4 EDIT_MESH_vertex_color(int vertex_flag, float vertex_crease) { if ((vertex_flag & VERT_ACTIVE) != 0) { return vec4(colorEditMeshActive.xyz, 1.0); @@ -45,6 +45,10 @@ vec4 EDIT_MESH_vertex_color(int vertex_flag) return colorVertexSelect; } else { + /* Full crease color if not selected nor active. */ + if (vertex_crease > 0.0) { + return mix(colorVertex, colorEdgeCrease, vertex_crease); + } return colorVertex; } } diff --git a/source/blender/draw/engines/overlay/shaders/edit_mesh_vert.glsl b/source/blender/draw/engines/overlay/shaders/edit_mesh_vert.glsl index a3ff277b714..5cee976f9a8 100644 --- a/source/blender/draw/engines/overlay/shaders/edit_mesh_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/edit_mesh_vert.glsl @@ -13,6 +13,9 @@ in vec4 norAndFlag; #endif out vec4 finalColor; +#ifdef VERT +out float vertexCrease; +#endif #ifdef EDGE out vec4 finalColorOuter; #endif @@ -44,8 +47,9 @@ void main() ivec4 m_data = data & dataMask; #if defined(VERT) - finalColor = EDIT_MESH_vertex_color(m_data.y); - gl_PointSize = sizeVertex * 2.0; + vertexCrease = float(m_data.z >> 4) / 15.0; + finalColor = EDIT_MESH_vertex_color(m_data.y, vertexCrease); + gl_PointSize = sizeVertex * ((vertexCrease > 0.0) ? 3.0 : 2.0); /* Make selected and active vertex always on top. */ if ((data.x & VERT_SELECTED) != 0) { gl_Position.z -= 5e-7 * abs(gl_Position.w); @@ -65,9 +69,9 @@ void main() selectOverride = (m_data.y & EDGE_SELECTED); # endif - float crease = float(m_data.z) / 255.0; + float edge_crease = float(m_data.z & 0xF) / 15.0; float bweight = float(m_data.w) / 255.0; - finalColorOuter = EDIT_MESH_edge_color_outer(m_data.y, m_data.x, crease, bweight); + finalColorOuter = EDIT_MESH_edge_color_outer(m_data.y, m_data.x, edge_crease, bweight); if (finalColorOuter.a > 0.0) { gl_Position.z -= 5e-7 * abs(gl_Position.w); |