diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-21 09:48:16 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-21 09:50:31 +0300 |
commit | a06b2b25adb2b0a1232ae78ba82e0ecef8cdf976 (patch) | |
tree | 38438ecdb7dc3d339ad665395144c9356b9c4bae /source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl | |
parent | 1ab071bd5cc662be5088bc48c1bb605a727c3656 (diff) |
DRW: pass clipping to geom shader via 'gl_in'
Removes need to pass the worldspace location.
Diffstat (limited to 'source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl')
-rw-r--r-- | source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl index d513c1302f1..d4d7c455b1b 100644 --- a/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl +++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl @@ -24,9 +24,6 @@ in vec3 vnor; in ivec4 data; out vec4 pPos; -#ifdef USE_WORLD_CLIP_PLANES -out vec3 wsPos; -#endif out ivec4 vData; # ifdef VERTEX_FACING out float vFacing; @@ -45,9 +42,14 @@ void main() vFacing = dot(view_vec, view_normal); # endif -#ifdef USE_WORLD_CLIP_PLANES - wsPos = (ModelMatrix * vec4(pos, 1.0)).xyz; -#endif +# 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 } #else /* EDGE_FIX */ @@ -112,14 +114,14 @@ void main() facing = dot(view_vec, view_normal); # endif -#ifdef USE_WORLD_CLIP_PLANES +# 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 +# endif } #endif |