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>2018-12-13 03:26:07 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-12-14 18:17:29 +0300
commit2afed99da3a8e76b8041e9f636fb198b332896cc (patch)
tree685db211975adce08a3b299e3eb9cbf7fb7a8d44 /source/blender/draw/modes/shaders/edit_curve_overlay_normals_vert.glsl
parent77164e30c730be27910d92a666d4b6c2d2d30721 (diff)
Curve Batch Cache: Rework Implementation to use new batch request
Shaded triangles are not yet implemented (request from gpumaterials). This also changes the mechanism to draw curve normals to make it not dependant on normal size display. This way different viewport can reuse the same batch.
Diffstat (limited to 'source/blender/draw/modes/shaders/edit_curve_overlay_normals_vert.glsl')
-rw-r--r--source/blender/draw/modes/shaders/edit_curve_overlay_normals_vert.glsl23
1 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/draw/modes/shaders/edit_curve_overlay_normals_vert.glsl b/source/blender/draw/modes/shaders/edit_curve_overlay_normals_vert.glsl
new file mode 100644
index 00000000000..06be402d737
--- /dev/null
+++ b/source/blender/draw/modes/shaders/edit_curve_overlay_normals_vert.glsl
@@ -0,0 +1,23 @@
+
+/* Draw Curve Normals */
+
+uniform mat4 ModelViewProjectionMatrix;
+uniform float normalSize;
+
+in vec3 pos;
+in vec3 nor;
+in vec3 tan;
+in float rad;
+
+void main()
+{
+ vec3 final_pos = pos;
+
+ float flip = (gl_InstanceID != 0) ? -1.0 : 1.0;
+
+ if (gl_VertexID % 2 == 0) {
+ final_pos += normalSize * rad * (flip * nor - tan);
+ }
+
+ gl_Position = ModelViewProjectionMatrix * vec4(final_pos, 1.0);
+}