diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-13 17:34:13 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-13 17:34:20 +0300 |
commit | b8015ece51c22224265c55196eff61a8f33d7239 (patch) | |
tree | 754584931fb35d97c41491ae02944617307cd757 /source | |
parent | cd0a4836d4c4dbb47a00ebccbc8c1e68290b5d30 (diff) |
Revert "T55456: EditDrawMode"
This reverts commit da6ed54569d03d18512e46ae08629bf72a592a82.
Diffstat (limited to 'source')
3 files changed, 41 insertions, 1 deletions
diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_frag.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_frag.glsl index 6e6e1eff35f..23b794d9b8b 100644 --- a/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_frag.glsl +++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_frag.glsl @@ -1,8 +1,29 @@ + +/* Solid Wirefram implementation + * Mike Erwin, Clément Foucault */ + +/* This shader follows the principles of + * http://developer.download.nvidia.com/SDK/10/direct3d/Source/SolidWireframe/Doc/SolidWireframe.pdf */ + flat in vec4 faceColor; +flat in int faceActive; out vec4 FragColor; +const vec4 stipple_matrix[4] = vec4[4]( + vec4(1.0, 0.0, 0.0, 0.0), + vec4(0.0, 0.0, 0.0, 0.0), + vec4(0.0, 0.0, 1.0, 0.0), + vec4(0.0, 0.0, 0.0, 0.0) +); + void main() { FragColor = faceColor; + + if (faceActive == 1) { + int x = int(gl_FragCoord.x) & 0x3; /* mod 4 */ + int y = int(gl_FragCoord.y) & 0x3; /* mod 4 */ + FragColor *= stipple_matrix[x][y]; + } } diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_vert.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_vert.glsl index 6b87a358588..3b9aa77306f 100644 --- a/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_vert.glsl +++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_vert.glsl @@ -5,6 +5,7 @@ in vec3 pos; in ivec4 data; flat out vec4 faceColor; +flat out int faceActive; #define FACE_ACTIVE (1 << 2) #define FACE_SELECTED (1 << 3) @@ -15,11 +16,14 @@ void main() if ((data.x & FACE_ACTIVE) != 0) { faceColor = colorEditMeshActive; + faceActive = 1; } else if ((data.x & FACE_SELECTED) != 0) { faceColor = colorFaceSelect; + faceActive = 0; } else { faceColor = colorFace; + faceActive = 0; } } diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_frag.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_frag.glsl index 7d546bd2309..4bf5f348c27 100644 --- a/source/blender/draw/modes/shaders/edit_mesh_overlay_frag.glsl +++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_frag.glsl @@ -75,6 +75,13 @@ const ivec3 clipPointIdx[6] = ivec3[6]( ivec3(2, 1, 0) ); +const vec4 stipple_matrix[4] = vec4[4]( + vec4(1.0, 0.0, 0.0, 0.0), + vec4(0.0, 0.0, 0.0, 0.0), + vec4(0.0, 0.0, 1.0, 0.0), + vec4(0.0, 0.0, 0.0, 0.0) +); + void colorDist(vec4 color, float dist) { FragColor = (dist < 0) ? color : FragColor; @@ -138,7 +145,15 @@ void main() /* First */ FragColor = faceColor; - FragColor.a *= faceAlphaMod; + + if ((flag[0] & FACE_ACTIVE) != 0) { + int x = int(gl_FragCoord.x) & 0x3; /* mod 4 */ + int y = int(gl_FragCoord.y) & 0x3; /* mod 4 */ + FragColor *= stipple_matrix[x][y]; + } + else { + FragColor.a *= faceAlphaMod; + } /* Edges */ for (int v = 0; v < 3; ++v) { |