Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-01-21 07:57:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-21 08:15:30 +0300
commit07673a3460cd0dc37aa9435ade76fabbc78d2c1e (patch)
tree30da135f129ac99219c3a1f71f673c440e6bb268 /source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl
parentdd3f5186260eddc2c115b560bb832baff0f108ae (diff)
DRW: Support edit-mesh clipping
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.glsl23
1 files changed, 23 insertions, 0 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 b78c7a7a476..d513c1302f1 100644
--- a/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl
+++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl
@@ -6,8 +6,15 @@ uniform mat3 NormalMatrix;
uniform mat4 ProjectionMatrix;
uniform mat4 ModelViewMatrix;
uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
uniform ivec4 dataMask = ivec4(0xFF);
+#ifdef USE_WORLD_CLIP_PLANES
+uniform vec4 WorldClipPlanes[6];
+uniform int WorldClipPlanesLen;
+#endif
+
+
in vec3 pos;
#ifdef VERTEX_FACING
in vec3 vnor;
@@ -17,6 +24,9 @@ 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;
@@ -34,6 +44,10 @@ void main()
: vec3(0.0, 0.0, 1.0);
vFacing = dot(view_vec, view_normal);
# endif
+
+#ifdef USE_WORLD_CLIP_PLANES
+ wsPos = (ModelMatrix * vec4(pos, 1.0)).xyz;
+#endif
}
#else /* EDGE_FIX */
@@ -97,6 +111,15 @@ void main()
: vec3(0.0, 0.0, 1.0);
facing = dot(view_vec, view_normal);
# 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
}
#endif