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:
authorClément Foucault <foucault.clem@gmail.com>2020-04-24 00:05:39 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-04-24 00:07:48 +0300
commitd712f1f83af881be536ec0d183b7d3025c172684 (patch)
treeeabecb450ce2d4697468d2758df28fd990c14ed6 /source/blender/gpu/shaders/gpu_shader_3D_polyline_vert.glsl
parentd0ff3434cffa2e056e4f191ead21226f32ea8c15 (diff)
GPU: Add Polyline shader (wide line emulation)
This new shader is able to emulate smooth wide lines drawing using a geometry shader. This shader needs viewportSize and lineWidth uniforms to be set. There is multiple variants to replace the usage of wide lines for most shaders. This patch only fix the gizmo_types files and the navigation gizmo. Other areas could be fixed afterward, I just limited the patch size. Fix T57570. Reviewed By: billreynish Differential Revision: https://developer.blender.org/D7487
Diffstat (limited to 'source/blender/gpu/shaders/gpu_shader_3D_polyline_vert.glsl')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_polyline_vert.glsl28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_polyline_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_polyline_vert.glsl
new file mode 100644
index 00000000000..28aa2a4ccc6
--- /dev/null
+++ b/source/blender/gpu/shaders/gpu_shader_3D_polyline_vert.glsl
@@ -0,0 +1,28 @@
+
+uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 ModelMatrix;
+uniform vec4 ClipPlane;
+
+in vec3 pos;
+
+#if !defined(UNIFORM)
+in vec4 color;
+
+out vec4 finalColor_g;
+#endif
+
+#ifdef CLIP
+out float clip_g;
+#endif
+
+void main()
+{
+ gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
+#if !defined(UNIFORM)
+ finalColor_g = color;
+#endif
+
+#ifdef CLIP
+ clip_g = dot(ModelMatrix * vec4(pos, 1.0), ClipPlane);
+#endif
+}