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-01-23 15:30:30 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-23 15:37:25 +0300
commit48eed058b170e3def90fbc420933638d3986ca2c (patch)
tree5e2ddb5fae907ae921b26f027b77437c1cd2ccbe /source/blender/gpu
parent44e9fe024bba014aa49b3a106fe89aa0b6e610cd (diff)
3D View: draw clipping region
Only for workbench solid/wire modes.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/GPU_shader.h2
-rw-r--r--source/blender/gpu/intern/gpu_shader.c6
-rw-r--r--source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl4
3 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h
index d339d0a2f81..0004642ea5b 100644
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@ -162,6 +162,8 @@ typedef enum eGPUBuiltinShader {
* \param pos: in vec3
*/
GPU_SHADER_3D_UNIFORM_COLOR,
+ /* Sets Z-depth to 1.0 (draw onto background). */
+ GPU_SHADER_3D_UNIFORM_COLOR_BACKGROUND,
GPU_SHADER_3D_UNIFORM_COLOR_INSTANCE,
/**
* Take a 3D position and color for each vertex without color interpolation.
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c
index c5a2c2ea6e5..5d5084c4eb9 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -804,6 +804,9 @@ static const GPUShaderStages builtin_shader_stages[GPU_NUM_BUILTIN_SHADERS] = {
[GPU_SHADER_3D_UNIFORM_COLOR] =
{ datatoc_gpu_shader_3D_vert_glsl,
datatoc_gpu_shader_uniform_color_frag_glsl },
+ [GPU_SHADER_3D_UNIFORM_COLOR_BACKGROUND] =
+ { datatoc_gpu_shader_3D_vert_glsl,
+ datatoc_gpu_shader_uniform_color_frag_glsl },
[GPU_SHADER_3D_FLAT_COLOR] =
{ datatoc_gpu_shader_3D_flat_color_vert_glsl,
datatoc_gpu_shader_flat_color_frag_glsl },
@@ -1030,7 +1033,8 @@ static const char *gpu_shader_get_builtin_shader_defines(
case GPU_SHADER_2D_UV_FACES_STRETCH_ANGLE:
return "#define STRETCH_ANGLE\n";
-
+ case GPU_SHADER_3D_UNIFORM_COLOR_BACKGROUND:
+ return "#define USE_BACKGROUND\n";
default:
return NULL;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl
index 118a661863d..f6f0f5b83ec 100644
--- a/source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl
@@ -18,4 +18,8 @@ void main()
#else
fragColor = color;
#endif
+
+#if defined(USE_BACKGROUND)
+ gl_FragDepth = 1.0;
+#endif
}