diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-21 11:08:42 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-21 11:08:42 +0300 |
commit | 78d2abd9c16f97be2ab272ee38ba7e398f57a742 (patch) | |
tree | ab83647a2f0477ab7fda9665eecccd6db6da951b /source/blender/draw/modes/shaders/overlay_face_orientation_vert.glsl | |
parent | 7bc9a563e65842629a98f0655578e1e4f8c8c960 (diff) |
DRW: Support wire overlay clipping
Diffstat (limited to 'source/blender/draw/modes/shaders/overlay_face_orientation_vert.glsl')
-rw-r--r-- | source/blender/draw/modes/shaders/overlay_face_orientation_vert.glsl | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/draw/modes/shaders/overlay_face_orientation_vert.glsl b/source/blender/draw/modes/shaders/overlay_face_orientation_vert.glsl index d8a72f28eee..2d025bc65ee 100644 --- a/source/blender/draw/modes/shaders/overlay_face_orientation_vert.glsl +++ b/source/blender/draw/modes/shaders/overlay_face_orientation_vert.glsl @@ -1,7 +1,23 @@ uniform mat4 ModelViewProjectionMatrix; +uniform mat4 ModelMatrix; + +#ifdef USE_WORLD_CLIP_PLANES +uniform vec4 WorldClipPlanes[6]; +uniform int WorldClipPlanesLen; +#endif + in vec3 pos; void main() { gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0); + +#ifdef USE_WORLD_CLIP_PLANES + { + vec3 worldPosition = (ModelMatrix * vec4(pos, 1.0)).xyz; + for (int i = 0; i < WorldClipPlanesLen; i++) { + gl_ClipDistance[i] = dot(WorldClipPlanes[i].xyz, worldPosition) + WorldClipPlanes[i].w; + } + } +#endif } |