diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-21 07:57:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-21 08:15:30 +0300 |
commit | 07673a3460cd0dc37aa9435ade76fabbc78d2c1e (patch) | |
tree | 30da135f129ac99219c3a1f71f673c440e6bb268 /source/blender/draw/modes/shaders/paint_weight_vert.glsl | |
parent | dd3f5186260eddc2c115b560bb832baff0f108ae (diff) |
DRW: Support edit-mesh clipping
Diffstat (limited to 'source/blender/draw/modes/shaders/paint_weight_vert.glsl')
-rw-r--r-- | source/blender/draw/modes/shaders/paint_weight_vert.glsl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/draw/modes/shaders/paint_weight_vert.glsl b/source/blender/draw/modes/shaders/paint_weight_vert.glsl index 78a3695c82c..ab0fb775e54 100644 --- a/source/blender/draw/modes/shaders/paint_weight_vert.glsl +++ b/source/blender/draw/modes/shaders/paint_weight_vert.glsl @@ -1,5 +1,11 @@ uniform mat4 ModelViewProjectionMatrix; +uniform mat4 ModelMatrix; + +#ifdef USE_WORLD_CLIP_PLANES +uniform vec4 WorldClipPlanes[6]; +uniform int WorldClipPlanesLen; +#endif in float weight; in vec3 pos; @@ -12,4 +18,13 @@ void main() /* Separate actual weight and alerts for independent interpolation */ weight_interp = max(vec2(weight, -weight), 0.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 } |