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-04-20 16:15:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-04-20 16:26:06 +0300
commitbc11cb3daa60c28e41bc400df29d7f8085993888 (patch)
treed520208ed5cbedd63cba22749949544d97e8a2d1 /source/blender/gpu
parenta1cc75f22ded9669a3f41d5d335135aec26be8a8 (diff)
UI: Support for runtime geometry icons
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/CMakeLists.txt1
-rw-r--r--source/blender/gpu/GPU_shader.h1
-rw-r--r--source/blender/gpu/intern/gpu_shader.c3
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_smooth_color_uniform_alpha_vert.glsl14
4 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index c3ef9d18f13..f915191fc28 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -142,6 +142,7 @@ data_to_c_simple(shaders/gpu_shader_2D_line_dashed_frag.glsl SRC)
data_to_c_simple(shaders/gpu_shader_2D_line_dashed_geom.glsl SRC)
data_to_c_simple(shaders/gpu_shader_2D_smooth_color_vert.glsl SRC)
data_to_c_simple(shaders/gpu_shader_2D_smooth_color_frag.glsl SRC)
+data_to_c_simple(shaders/gpu_shader_2D_smooth_color_uniform_alpha_vert.glsl SRC)
data_to_c_simple(shaders/gpu_shader_2D_image_vert.glsl SRC)
data_to_c_simple(shaders/gpu_shader_2D_image_rect_vert.glsl SRC)
data_to_c_simple(shaders/gpu_shader_2D_image_multi_rect_vert.glsl SRC)
diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h
index df38b08d5c4..9131f56a07e 100644
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@ -111,6 +111,7 @@ typedef enum GPUBuiltinShader {
GPU_SHADER_2D_UNIFORM_COLOR,
GPU_SHADER_2D_FLAT_COLOR,
GPU_SHADER_2D_SMOOTH_COLOR,
+ GPU_SHADER_2D_SMOOTH_COLOR_UNIFORM_ALPHA,
GPU_SHADER_2D_IMAGE,
GPU_SHADER_2D_IMAGE_COLOR,
GPU_SHADER_2D_IMAGE_ALPHA_COLOR,
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c
index f88b00dfb93..db464498a27 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -63,6 +63,7 @@ extern char datatoc_gpu_shader_flat_color_alpha_test_0_frag_glsl[];
extern char datatoc_gpu_shader_flat_id_frag_glsl[];
extern char datatoc_gpu_shader_2D_vert_glsl[];
extern char datatoc_gpu_shader_2D_flat_color_vert_glsl[];
+extern char datatoc_gpu_shader_2D_smooth_color_uniform_alpha_vert_glsl[];
extern char datatoc_gpu_shader_2D_smooth_color_vert_glsl[];
extern char datatoc_gpu_shader_2D_smooth_color_frag_glsl[];
extern char datatoc_gpu_shader_2D_image_vert_glsl[];
@@ -699,6 +700,8 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader)
datatoc_gpu_shader_flat_color_frag_glsl },
[GPU_SHADER_2D_SMOOTH_COLOR] = { datatoc_gpu_shader_2D_smooth_color_vert_glsl,
datatoc_gpu_shader_2D_smooth_color_frag_glsl },
+ [GPU_SHADER_2D_SMOOTH_COLOR_UNIFORM_ALPHA] = { datatoc_gpu_shader_2D_smooth_color_uniform_alpha_vert_glsl,
+ datatoc_gpu_shader_2D_smooth_color_frag_glsl },
[GPU_SHADER_2D_IMAGE_LINEAR_TO_SRGB] = { datatoc_gpu_shader_2D_image_vert_glsl,
datatoc_gpu_shader_image_linear_frag_glsl },
[GPU_SHADER_2D_IMAGE] = { datatoc_gpu_shader_2D_image_vert_glsl,
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_uniform_alpha_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_uniform_alpha_vert.glsl
new file mode 100644
index 00000000000..a8ad5575235
--- /dev/null
+++ b/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_uniform_alpha_vert.glsl
@@ -0,0 +1,14 @@
+
+uniform mat4 ModelViewProjectionMatrix;
+uniform float alpha;
+
+in vec2 pos;
+in vec4 color;
+
+noperspective out vec4 finalColor;
+
+void main()
+{
+ gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
+ finalColor = vec4(color[0], color[1], color[2], color[3] * alpha);
+}