diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-04-13 07:13:46 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-04-13 07:13:46 +0300 |
commit | c0a9e388b34298daa6c9f1e9c8f68fde85e319a8 (patch) | |
tree | 358818bbd7162d24adc48909e48551b27fa30592 /source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_frag.glsl | |
parent | 64660b902c3fb52fe5a3cb5bf232f90283db8732 (diff) |
GLSL: rename edit_overlay -> edit_mesh_overlay
Avoid confusion with overlays with non-mesh types
Diffstat (limited to 'source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_frag.glsl')
-rw-r--r-- | source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_frag.glsl | 29 |
1 files changed, 29 insertions, 0 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 new file mode 100644 index 00000000000..049333c8e4f --- /dev/null +++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_frag.glsl @@ -0,0 +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 mat4 stipple_matrix = mat4( + 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]; + } +} |