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>2018-07-01 09:42:16 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-07-01 09:42:16 +0300
commitb4998548ab1edc513a47038872b3282efe6dfef9 (patch)
tree4244014dcb1bbbccd3fa6d136731c677475b62d5 /source/blender/gpu
parentab6e23ffbbcdadaba305008bcaeae8516fd98c2b (diff)
Cleanup: use '_len' suffix for line stipple
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl10
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_line_dashed_width_geom.glsl4
3 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl
index 7caf00f58fd..3c5b0d1ca0a 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl
@@ -10,9 +10,9 @@ uniform float dash_width;
/* Simple mode, discarding non-dash parts (so no need for blending at all). */
uniform float dash_factor; /* if > 1.0, solid line. */
-/* More advanced mode, allowing for complex, multi-colored patterns. Enabled when num_colors > 0. */
+/* More advanced mode, allowing for complex, multi-colored patterns. Enabled when colors_len > 0. */
/* Note: max number of steps/colors in pattern is 32! */
-uniform int num_colors; /* Enabled if > 0, 1 for solid line. */
+uniform int colors_len; /* Enabled if > 0, 1 for solid line. */
uniform vec4 colors[32];
noperspective in float distance_along_line;
@@ -23,15 +23,15 @@ out vec4 fragColor;
void main()
{
/* Multi-color option. */
- if (num_colors > 0) {
+ if (colors_len > 0) {
/* Solid line case, simple. */
- if (num_colors == 1) {
+ if (colors_len == 1) {
fragColor = colors[0];
}
/* Actually dashed line... */
else {
float normalized_distance = fract(distance_along_line / dash_width);
- fragColor = colors[int(normalized_distance * num_colors)];
+ fragColor = colors[int(normalized_distance * colors_len)];
}
}
/* Single color option. */
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl
index db4bdf0a9f0..8fa19f94b39 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl
@@ -12,7 +12,7 @@ uniform vec2 viewport_size;
/* Uniforms from fragment shader, used here to optimize out useless computation in case of solid line. */
uniform float dash_factor; /* if > 1.0, solid line. */
-uniform int num_colors; /* Enabled if > 0, 1 for solid line. */
+uniform int colors_len; /* Enabled if > 0, 1 for solid line. */
layout(lines) in;
@@ -34,7 +34,7 @@ void main()
gl_Position = v2;
color_geom = color_vert[1];
- if ((num_colors == 1) || (dash_factor >= 1.0f)) {
+ if ((colors_len == 1) || (dash_factor >= 1.0f)) {
/* Solid line, optimize out distance computation! */
distance_along_line = 0.0f;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_width_geom.glsl b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_width_geom.glsl
index 20c72f4407d..5a4da5cc9d4 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_width_geom.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_width_geom.glsl
@@ -10,7 +10,7 @@ uniform float width; /* in pixels, screen space. */
/* Uniforms from fragment shader, used here to optimize out useless computation in case of solid line. */
uniform float dash_factor; /* if > 1.0, solid line. */
-uniform int num_colors; /* Enabled if > 0, 1 for solid line. */
+uniform int colors_len; /* Enabled if > 0, 1 for solid line. */
layout(lines) in;
@@ -36,7 +36,7 @@ void main()
gl_Position = v1 - (wdir * w1);
EmitVertex();
- if ((num_colors == 1) || (dash_factor >= 1.0f)) {
+ if ((colors_len == 1) || (dash_factor >= 1.0f)) {
/* Solid line, optimize out distance computation! */
distance_along_line = 0.0f;
}