diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-25 00:01:07 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-25 00:01:07 +0300 |
commit | e72fa714a800f851298dc29f736aa5231501dd0b (patch) | |
tree | c960d08796a0c507ae53f5a0ca179f61dbc7b744 /source/blender/gpu | |
parent | 6d8394d38b17e602535c75a866332f4427adbfad (diff) |
Cleanup: remove duplicated shaders that only added clipping checks
Originally I wanted to avoid adding draw manager specific ifdef's all
over generic shaders however this isn't needed in so many places.
Also there are shaders that are only used by the draw manager so
duplicating them only to have the original unused doesn't make sense.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl | 8 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_3D_vert.glsl | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl index a1feb2f75b7..955ce07780c 100644 --- a/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl @@ -1,6 +1,10 @@ uniform mat4 ModelViewProjectionMatrix; +#ifdef USE_WORLD_CLIP_PLANES +uniform mat4 ModelMatrix; +#endif + in vec3 pos; in vec4 color; @@ -10,4 +14,8 @@ void main() { gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0); finalColor = color; + +#ifdef USE_WORLD_CLIP_PLANES + world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz); +#endif } diff --git a/source/blender/gpu/shaders/gpu_shader_3D_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_vert.glsl index 059473ebb74..9fc748b292b 100644 --- a/source/blender/gpu/shaders/gpu_shader_3D_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_3D_vert.glsl @@ -1,9 +1,17 @@ uniform mat4 ModelViewProjectionMatrix; +#ifdef USE_WORLD_CLIP_PLANES +uniform mat4 ModelMatrix; +#endif + in vec3 pos; void main() { gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0); + +#ifdef USE_WORLD_CLIP_PLANES + world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz); +#endif } |