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-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl121
1 files changed, 58 insertions, 63 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl
index 220adba817a..4567429f645 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl
@@ -20,26 +20,26 @@ in ivec4 colid_doarrow;
uniform vec4 colors[6];
-#define colStart colors[colid_doarrow[0]]
-#define colEnd colors[colid_doarrow[1]]
-#define colShadow colors[colid_doarrow[2]]
-#define doArrow (colid_doarrow[3] != 0)
+# define colStart colors[colid_doarrow[0]]
+# define colEnd colors[colid_doarrow[1]]
+# define colShadow colors[colid_doarrow[2]]
+# define doArrow (colid_doarrow[3] != 0)
#else
/* Single curve drawcall, use uniform. */
uniform vec2 bezierPts[4];
-#define P0 bezierPts[0]
-#define P1 bezierPts[1]
-#define P2 bezierPts[2]
-#define P3 bezierPts[3]
+# define P0 bezierPts[0]
+# define P1 bezierPts[1]
+# define P2 bezierPts[2]
+# define P3 bezierPts[3]
uniform vec4 colors[3];
uniform bool doArrow;
-#define colShadow colors[0]
-#define colStart colors[1]
-#define colEnd colors[2]
+# define colShadow colors[0]
+# define colStart colors[1]
+# define colEnd colors[2]
#endif
@@ -52,56 +52,51 @@ out vec4 finalColor;
void main(void)
{
- float t = uv.x;
- float t2 = t * t;
- float t2_3 = 3.0 * t2;
- float one_minus_t = 1.0 - t;
- float one_minus_t2 = one_minus_t * one_minus_t;
- float one_minus_t2_3 = 3.0 * one_minus_t2;
-
- vec2 point = (P0 * one_minus_t2 * one_minus_t +
- P1 * one_minus_t2_3 * t +
- P2 * t2_3 * one_minus_t +
- P3 * t2 * t);
-
- vec2 tangent = ((P1 - P0) * one_minus_t2_3 +
- (P2 - P1) * 6.0 * (t - t2) +
- (P3 - P2) * t2_3);
-
- /* tangent space at t */
- tangent = normalize(tangent);
- vec2 normal = tangent.yx * vec2(-1.0, 1.0);
-
- /* Position vertex on the curve tangent space */
- point += (pos.x * tangent + pos.y * normal) * arrowSize;
-
- gl_Position = ModelViewProjectionMatrix * vec4(point, 0.0, 1.0);
-
- vec2 exp_axis = expand.x * tangent + expand.y * normal;
-
- /* rotate & scale the expand axis */
- exp_axis = ModelViewProjectionMatrix[0].xy * exp_axis.xx +
- ModelViewProjectionMatrix[1].xy * exp_axis.yy;
-
-
- float expand_dist = (uv.y * 2.0 - 1.0);
- colorGradient = expand_dist;
-
- if (gl_VertexID < MID_VERTEX) {
- /* Shadow pass */
- finalColor = colShadow;
- }
- else {
- /* Second pass */
- finalColor = mix(colStart, colEnd, uv.x);
- expand_dist *= 0.5;
- }
-
- /* Expand into a line */
- gl_Position.xy += exp_axis * expandSize * expand_dist;
-
- /* if arrow */
- if (expand.y != 1.0 && !doArrow) {
- gl_Position.xy *= 0.0;
- }
+ float t = uv.x;
+ float t2 = t * t;
+ float t2_3 = 3.0 * t2;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ float one_minus_t2_3 = 3.0 * one_minus_t2;
+
+ vec2 point = (P0 * one_minus_t2 * one_minus_t + P1 * one_minus_t2_3 * t +
+ P2 * t2_3 * one_minus_t + P3 * t2 * t);
+
+ vec2 tangent = ((P1 - P0) * one_minus_t2_3 + (P2 - P1) * 6.0 * (t - t2) + (P3 - P2) * t2_3);
+
+ /* tangent space at t */
+ tangent = normalize(tangent);
+ vec2 normal = tangent.yx * vec2(-1.0, 1.0);
+
+ /* Position vertex on the curve tangent space */
+ point += (pos.x * tangent + pos.y * normal) * arrowSize;
+
+ gl_Position = ModelViewProjectionMatrix * vec4(point, 0.0, 1.0);
+
+ vec2 exp_axis = expand.x * tangent + expand.y * normal;
+
+ /* rotate & scale the expand axis */
+ exp_axis = ModelViewProjectionMatrix[0].xy * exp_axis.xx +
+ ModelViewProjectionMatrix[1].xy * exp_axis.yy;
+
+ float expand_dist = (uv.y * 2.0 - 1.0);
+ colorGradient = expand_dist;
+
+ if (gl_VertexID < MID_VERTEX) {
+ /* Shadow pass */
+ finalColor = colShadow;
+ }
+ else {
+ /* Second pass */
+ finalColor = mix(colStart, colEnd, uv.x);
+ expand_dist *= 0.5;
+ }
+
+ /* Expand into a line */
+ gl_Position.xy += exp_axis * expandSize * expand_dist;
+
+ /* if arrow */
+ if (expand.y != 1.0 && !doArrow) {
+ gl_Position.xy *= 0.0;
+ }
}