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-25 00:01:07 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-25 00:01:07 +0300
commite72fa714a800f851298dc29f736aa5231501dd0b (patch)
treec960d08796a0c507ae53f5a0ca179f61dbc7b744 /source/blender/gpu/shaders
parent6d8394d38b17e602535c75a866332f4427adbfad (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/shaders')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl8
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_vert.glsl8
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
}