Add diagonal stripe shader (GPU_SHADER_2D_DIAG_STRIPES)
Reviewed By: merwin Differential Revision: https://developer.blender.org/D2512
This commit is contained in:
parent
077988dd44
commit
ff53949145
|
@ -134,6 +134,7 @@ set(SRC
|
|||
data_to_c_simple(shaders/gpu_shader_depth_only_frag.glsl SRC)
|
||||
data_to_c_simple(shaders/gpu_shader_uniform_color_frag.glsl SRC)
|
||||
data_to_c_simple(shaders/gpu_shader_checker_frag.glsl SRC)
|
||||
data_to_c_simple(shaders/gpu_shader_diag_stripes_frag.glsl SRC)
|
||||
data_to_c_simple(shaders/gpu_shader_simple_lighting_frag.glsl SRC)
|
||||
data_to_c_simple(shaders/gpu_shader_flat_color_frag.glsl SRC)
|
||||
data_to_c_simple(shaders/gpu_shader_flat_color_alpha_test_0_frag.glsl SRC)
|
||||
|
|
|
@ -109,6 +109,7 @@ typedef enum GPUBuiltinShader {
|
|||
GPU_SHADER_2D_SMOOTH_COLOR,
|
||||
GPU_SHADER_2D_IMAGE_COLOR,
|
||||
GPU_SHADER_2D_CHECKER,
|
||||
GPU_SHADER_2D_DIAG_STRIPES,
|
||||
/* for simple 3D drawing */
|
||||
GPU_SHADER_3D_UNIFORM_COLOR,
|
||||
GPU_SHADER_3D_UNIFORM_COLOR_INSTANCE,
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
extern char datatoc_gpu_shader_depth_only_frag_glsl[];
|
||||
extern char datatoc_gpu_shader_uniform_color_frag_glsl[];
|
||||
extern char datatoc_gpu_shader_checker_frag_glsl[];
|
||||
extern char datatoc_gpu_shader_diag_stripes_frag_glsl[];
|
||||
extern char datatoc_gpu_shader_simple_lighting_frag_glsl[];
|
||||
extern char datatoc_gpu_shader_flat_color_frag_glsl[];
|
||||
extern char datatoc_gpu_shader_flat_color_alpha_test_0_frag_glsl[];
|
||||
|
@ -679,6 +680,8 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader)
|
|||
datatoc_gpu_shader_image_interlace_frag_glsl },
|
||||
[GPU_SHADER_2D_CHECKER] = { datatoc_gpu_shader_2D_vert_glsl, datatoc_gpu_shader_checker_frag_glsl },
|
||||
|
||||
[GPU_SHADER_2D_DIAG_STRIPES] = { datatoc_gpu_shader_2D_vert_glsl, datatoc_gpu_shader_diag_stripes_frag_glsl },
|
||||
|
||||
[GPU_SHADER_2D_UNIFORM_COLOR] = { datatoc_gpu_shader_2D_vert_glsl, datatoc_gpu_shader_uniform_color_frag_glsl },
|
||||
[GPU_SHADER_2D_FLAT_COLOR] = { datatoc_gpu_shader_2D_flat_color_vert_glsl,
|
||||
datatoc_gpu_shader_flat_color_frag_glsl },
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
uniform vec4 color1;
|
||||
uniform vec4 color2;
|
||||
uniform int size1;
|
||||
uniform int size2;
|
||||
|
||||
#if __VERSION__ == 120
|
||||
#define fragColor gl_FragColor
|
||||
#else
|
||||
out vec4 fragColor;
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
float phase = mod((gl_FragCoord.x + gl_FragCoord.y), (size1 + size2));
|
||||
|
||||
if (phase < size1)
|
||||
{
|
||||
fragColor = color1;
|
||||
}
|
||||
else {
|
||||
fragColor = color2;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue