diff options
author | Germano Cavalcante <mano-wii> | 2022-04-30 20:50:46 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2022-04-30 20:50:57 +0300 |
commit | 57b4efc250a76ef7172cf5700e84138c4f22e62c (patch) | |
tree | d08e5c1974ba7016604f8fbb0e6caf7271f2fad6 /source/blender/draw/engines/overlay | |
parent | fc40356ed8be9118a0e4a3f328e619dc08ac7ce2 (diff) |
Overlay: port paint shaders to use 'GPUShaderCreateInfo'
Simple port.
Also a description of how each shader is used has been added.
NOTE: The shader created using `OVERLAY_shader_paint_vertcol` cannot be tested.
Apparently it is created but not used.
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D14812
Diffstat (limited to 'source/blender/draw/engines/overlay')
11 files changed, 226 insertions, 161 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_shader.c b/source/blender/draw/engines/overlay/overlay_shader.c index 6d6035be176..bd00d4d47f0 100644 --- a/source/blender/draw/engines/overlay/overlay_shader.c +++ b/source/blender/draw/engines/overlay/overlay_shader.c @@ -89,15 +89,6 @@ extern char datatoc_outline_detect_frag_glsl[]; extern char datatoc_outline_prepass_frag_glsl[]; extern char datatoc_outline_prepass_geom_glsl[]; extern char datatoc_outline_prepass_vert_glsl[]; -extern char datatoc_paint_face_vert_glsl[]; -extern char datatoc_paint_point_vert_glsl[]; -extern char datatoc_paint_texture_frag_glsl[]; -extern char datatoc_paint_texture_vert_glsl[]; -extern char datatoc_paint_vertcol_frag_glsl[]; -extern char datatoc_paint_vertcol_vert_glsl[]; -extern char datatoc_paint_weight_frag_glsl[]; -extern char datatoc_paint_weight_vert_glsl[]; -extern char datatoc_paint_wire_vert_glsl[]; extern char datatoc_particle_vert_glsl[]; extern char datatoc_particle_frag_glsl[]; extern char datatoc_sculpt_mask_vert_glsl[]; @@ -958,17 +949,11 @@ GPUShader *OVERLAY_shader_outline_detect(void) GPUShader *OVERLAY_shader_paint_face(void) { const DRWContextState *draw_ctx = DRW_context_state_get(); - const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg]; - OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; + eGPUShaderConfig sh_cfg = draw_ctx->sh_cfg; + OVERLAY_Shaders *sh_data = &e_data.sh_data[sh_cfg]; if (!sh_data->paint_face) { - sh_data->paint_face = GPU_shader_create_from_arrays({ - .vert = (const char *[]){sh_cfg->lib, - datatoc_common_view_lib_glsl, - datatoc_paint_face_vert_glsl, - NULL}, - .frag = (const char *[]){datatoc_gpu_shader_uniform_color_frag_glsl, NULL}, - .defs = (const char *[]){sh_cfg->def, NULL}, - }); + sh_data->paint_face = GPU_shader_create_from_info_name( + sh_cfg == GPU_SHADER_CFG_CLIPPED ? "overlay_paint_face_clipped" : "overlay_paint_face"); } return sh_data->paint_face; } @@ -976,18 +961,11 @@ GPUShader *OVERLAY_shader_paint_face(void) GPUShader *OVERLAY_shader_paint_point(void) { const DRWContextState *draw_ctx = DRW_context_state_get(); - const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg]; - OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; + eGPUShaderConfig sh_cfg = draw_ctx->sh_cfg; + OVERLAY_Shaders *sh_data = &e_data.sh_data[sh_cfg]; if (!sh_data->paint_point) { - sh_data->paint_point = GPU_shader_create_from_arrays({ - .vert = (const char *[]){sh_cfg->lib, - datatoc_common_globals_lib_glsl, - datatoc_common_view_lib_glsl, - datatoc_paint_point_vert_glsl, - NULL}, - .frag = (const char *[]){datatoc_gpu_shader_point_varying_color_frag_glsl, NULL}, - .defs = (const char *[]){sh_cfg->def, NULL}, - }); + sh_data->paint_point = GPU_shader_create_from_info_name( + sh_cfg == GPU_SHADER_CFG_CLIPPED ? "overlay_paint_point_clipped" : "overlay_paint_point"); } return sh_data->paint_point; } @@ -995,19 +973,11 @@ GPUShader *OVERLAY_shader_paint_point(void) GPUShader *OVERLAY_shader_paint_texture(void) { const DRWContextState *draw_ctx = DRW_context_state_get(); - const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg]; - OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; + eGPUShaderConfig sh_cfg = draw_ctx->sh_cfg; + OVERLAY_Shaders *sh_data = &e_data.sh_data[sh_cfg]; if (!sh_data->paint_texture) { - sh_data->paint_texture = GPU_shader_create_from_arrays({ - .vert = (const char *[]){sh_cfg->lib, - datatoc_common_view_lib_glsl, - datatoc_paint_texture_vert_glsl, - NULL}, - .frag = (const char *[]){datatoc_common_colormanagement_lib_glsl, - datatoc_paint_texture_frag_glsl, - NULL}, - .defs = (const char *[]){sh_cfg->def, NULL}, - }); + sh_data->paint_texture = GPU_shader_create_from_info_name( + sh_cfg ? "overlay_paint_texture_clipped" : "overlay_paint_texture"); } return sh_data->paint_texture; } @@ -1015,42 +985,27 @@ GPUShader *OVERLAY_shader_paint_texture(void) GPUShader *OVERLAY_shader_paint_vertcol(void) { const DRWContextState *draw_ctx = DRW_context_state_get(); - const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg]; - OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; + eGPUShaderConfig sh_cfg = draw_ctx->sh_cfg; + OVERLAY_Shaders *sh_data = &e_data.sh_data[sh_cfg]; if (!sh_data->paint_vertcol) { - sh_data->paint_vertcol = GPU_shader_create_from_arrays({ - .vert = (const char *[]){sh_cfg->lib, - datatoc_common_globals_lib_glsl, - datatoc_common_view_lib_glsl, - datatoc_paint_vertcol_vert_glsl, - NULL}, - .frag = (const char *[]){datatoc_common_globals_lib_glsl, - datatoc_paint_vertcol_frag_glsl, - NULL}, - .defs = (const char *[]){sh_cfg->def, NULL}, - }); + sh_data->paint_vertcol = GPU_shader_create_from_info_name( + sh_cfg ? "overlay_paint_vertcol_clipped" : "overlay_paint_vertcol"); } return sh_data->paint_vertcol; } GPUShader *OVERLAY_shader_paint_weight(const bool shading) { + const char *info_name[2][2] = { + {"overlay_paint_weight", "overlay_paint_weight_fake_shading"}, + {"overlay_paint_weight_clipped", "overlay_paint_weight_fake_shading_clipped"}, + }; int index = shading ? 1 : 0; const DRWContextState *draw_ctx = DRW_context_state_get(); - const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg]; - OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; + eGPUShaderConfig sh_cfg = draw_ctx->sh_cfg; + OVERLAY_Shaders *sh_data = &e_data.sh_data[sh_cfg]; if (!sh_data->paint_weight[index]) { - sh_data->paint_weight[index] = GPU_shader_create_from_arrays({ - .vert = (const char *[]){sh_cfg->lib, - datatoc_common_globals_lib_glsl, - datatoc_common_view_lib_glsl, - datatoc_paint_weight_vert_glsl, - NULL}, - .frag = (const char *[]){datatoc_common_globals_lib_glsl, - datatoc_paint_weight_frag_glsl, - NULL}, - .defs = (const char *[]){sh_cfg->def, shading ? "#define FAKE_SHADING\n" : "", NULL}, - }); + sh_data->paint_weight[index] = GPU_shader_create_from_info_name(info_name[sh_cfg][index]); } return sh_data->paint_weight[index]; } @@ -1058,18 +1013,11 @@ GPUShader *OVERLAY_shader_paint_weight(const bool shading) GPUShader *OVERLAY_shader_paint_wire(void) { const DRWContextState *draw_ctx = DRW_context_state_get(); - const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg]; - OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; + eGPUShaderConfig sh_cfg = draw_ctx->sh_cfg; + OVERLAY_Shaders *sh_data = &e_data.sh_data[sh_cfg]; if (!sh_data->paint_wire) { - sh_data->paint_wire = GPU_shader_create_from_arrays({ - .vert = (const char *[]){sh_cfg->lib, - datatoc_common_globals_lib_glsl, - datatoc_common_view_lib_glsl, - datatoc_paint_wire_vert_glsl, - NULL}, - .frag = (const char *[]){datatoc_gpu_shader_flat_color_frag_glsl, NULL}, - .defs = (const char *[]){sh_cfg->def, NULL}, - }); + sh_data->paint_wire = GPU_shader_create_from_info_name(sh_cfg ? "overlay_paint_wire_clipped" : + "overlay_paint_wire"); } return sh_data->paint_wire; } diff --git a/source/blender/draw/engines/overlay/shaders/infos/paint_info.hh b/source/blender/draw/engines/overlay/shaders/infos/paint_info.hh new file mode 100644 index 00000000000..bbec79d515f --- /dev/null +++ b/source/blender/draw/engines/overlay/shaders/infos/paint_info.hh @@ -0,0 +1,180 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "gpu_shader_create_info.hh" + +/* -------------------------------------------------------------------- */ +/** \name OVERLAY_shader_paint_face. + * + * Used for face selection mode in Weight, Vertex and Texture Paint. + * \{ */ + +GPU_SHADER_CREATE_INFO(overlay_paint_face) + .do_static_compilation(true) + .define("srgbTarget", "false") /* NOTE: Color already in Linear space. */ + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC4, "nor") /* Select flag on the 4th component. */ + .push_constant(Type::VEC4, "color") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("paint_face_vert.glsl") + .fragment_source("gpu_shader_uniform_color_frag.glsl") + .additional_info("draw_modelmat"); + +GPU_SHADER_CREATE_INFO(overlay_paint_face_clipped) + .additional_info("overlay_paint_face") + .additional_info("drw_clipped") + .do_static_compilation(true); + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name OVERLAY_shader_paint_point. + * + * Used for vertex selection mode in Weight and Vertex Paint. + * \{ */ + +GPU_SHADER_INTERFACE_INFO(overlay_overlay_paint_point_iface, "").smooth(Type::VEC4, "finalColor"); + +GPU_SHADER_CREATE_INFO(overlay_paint_point) + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC4, "nor") /* Select flag on the 4th component. */ + .vertex_out(overlay_overlay_paint_point_iface) + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("paint_point_vert.glsl") + .fragment_source("gpu_shader_point_varying_color_frag.glsl") + .additional_info("draw_modelmat", "draw_globals"); + +GPU_SHADER_CREATE_INFO(overlay_paint_point_clipped) + .additional_info("overlay_paint_point") + .additional_info("drw_clipped") + .do_static_compilation(true); + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name OVERLAY_shader_paint_texture. + * + * Used in Texture Paint mode for the Stencil Image Masking. + * \{ */ + +GPU_SHADER_INTERFACE_INFO(overlay_paint_texture_iface, "").smooth(Type::VEC2, "uv_interp"); + +GPU_SHADER_CREATE_INFO(overlay_paint_texture) + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC2, "mu") /* Masking uv map. */ + .vertex_out(overlay_paint_texture_iface) + .sampler(0, ImageType::FLOAT_2D, "maskImage") + .push_constant(Type::VEC3, "maskColor") + .push_constant(Type::FLOAT, "opacity") /* `1.0` by default. */ + .push_constant(Type::BOOL, "maskInvertStencil") + .push_constant(Type::BOOL, "maskImagePremultiplied") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("paint_texture_vert.glsl") + .fragment_source("paint_texture_frag.glsl") + .additional_info("draw_modelmat"); + +GPU_SHADER_CREATE_INFO(overlay_paint_texture_clipped) + .additional_info("overlay_paint_texture") + .additional_info("drw_clipped") + .do_static_compilation(true); + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name OVERLAY_shader_paint_vertcol. + * + * It should be used to draw a Vertex Paint overlay. But it is currently unreachable. + * \{ */ + +GPU_SHADER_INTERFACE_INFO(overlay_paint_vertcol_iface, "").smooth(Type::VEC3, "finalColor"); + +GPU_SHADER_CREATE_INFO(overlay_paint_vertcol) + .do_static_compilation(true) + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC3, "ac") /* Active color. */ + .vertex_out(overlay_paint_vertcol_iface) + .push_constant(Type::FLOAT, "opacity") /* `1.0` by default. */ + .push_constant(Type::BOOL, "useAlphaBlend") /* `false` by default. */ + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("paint_vertcol_vert.glsl") + .fragment_source("paint_vertcol_frag.glsl") + .additional_info("draw_modelmat"); + +GPU_SHADER_CREATE_INFO(overlay_paint_vertcol_clipped) + .additional_info("overlay_paint_vertcol") + .additional_info("drw_clipped") + .do_static_compilation(true); + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name OVERLAY_shader_paint_weight. + * + * Used to display Vertex Weights. + * `overlay paint weight` is for wireframe display mode. + * \{ */ + +GPU_SHADER_INTERFACE_INFO(overlay_paint_weight_iface, "") + .smooth(Type::VEC2, "weight_interp") /* (weight, alert) */ + .smooth(Type::FLOAT, "color_fac"); + +GPU_SHADER_CREATE_INFO(overlay_paint_weight) + .do_static_compilation(true) + .vertex_in(0, Type::FLOAT, "weight") + .vertex_in(1, Type::VEC3, "pos") + .vertex_in(2, Type::VEC3, "nor") + .vertex_out(overlay_paint_weight_iface) + .sampler(0, ImageType::FLOAT_1D, "colorramp") + .push_constant(Type::FLOAT, "opacity") /* `1.0` by default. */ + .push_constant(Type::BOOL, "drawContours") /* `false` by default. */ + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("paint_weight_vert.glsl") + .fragment_source("paint_weight_frag.glsl") + .additional_info("draw_modelmat", "draw_globals"); + +GPU_SHADER_CREATE_INFO(overlay_paint_weight_fake_shading) + .additional_info("overlay_paint_weight") + .define("FAKE_SHADING") + .push_constant(Type::VEC3, "light_dir") + .do_static_compilation(true); + +GPU_SHADER_CREATE_INFO(overlay_paint_weight_clipped) + .additional_info("overlay_paint_weight") + .additional_info("drw_clipped") + .do_static_compilation(true); + +GPU_SHADER_CREATE_INFO(overlay_paint_weight_fake_shading_clipped) + .additional_info("overlay_paint_weight_fake_shading") + .additional_info("drw_clipped") + .do_static_compilation(true); + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name OVERLAY_shader_paint_wire. + * + * Used in face selection mode to display edges of selected faces in Weight, Vertex and Texture + * paint modes. + * \{ */ + +GPU_SHADER_INTERFACE_INFO(overlay_paint_wire_iface, "").flat(Type::VEC4, "finalColor"); + +GPU_SHADER_CREATE_INFO(overlay_paint_wire) + .do_static_compilation(true) + .define("srgbTarget", "false") /* NOTE: Color already in Linear space. */ + .vertex_in(0, Type::VEC3, "pos") + .vertex_in(1, Type::VEC4, "nor") /* flag stored in w */ + .vertex_out(overlay_paint_wire_iface) + .push_constant(Type::BOOL, "useSelect") + .fragment_out(0, Type::VEC4, "fragColor") + .vertex_source("paint_wire_vert.glsl") + .fragment_source("gpu_shader_flat_color_frag.glsl") + .additional_info("draw_modelmat", "draw_globals"); + +GPU_SHADER_CREATE_INFO(overlay_paint_wire_clipped) + .additional_info("overlay_paint_vertcol") + .additional_info("drw_clipped") + .do_static_compilation(true); + +/** \} */ diff --git a/source/blender/draw/engines/overlay/shaders/paint_face_vert.glsl b/source/blender/draw/engines/overlay/shaders/paint_face_vert.glsl index 2b5d586bdd1..22906bf1526 100644 --- a/source/blender/draw/engines/overlay/shaders/paint_face_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/paint_face_vert.glsl @@ -1,6 +1,5 @@ - -in vec3 pos; -in vec4 nor; /* select flag on the 4th component */ +#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl) +#pragma BLENDER_REQUIRE(common_view_lib.glsl) void main() { @@ -17,8 +16,6 @@ void main() gl_Position = vec4(-2.0, -2.0, -2.0, 1.0); } else { -#ifdef USE_WORLD_CLIP_PLANES - world_clip_planes_calc_clip_distance(world_pos); -#endif + view_clipping_distances(world_pos); } } diff --git a/source/blender/draw/engines/overlay/shaders/paint_point_vert.glsl b/source/blender/draw/engines/overlay/shaders/paint_point_vert.glsl index 052ad2a7f36..8736b2a87db 100644 --- a/source/blender/draw/engines/overlay/shaders/paint_point_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/paint_point_vert.glsl @@ -1,8 +1,5 @@ - -in vec3 pos; -in vec4 nor; /* select flag on the 4th component */ - -out vec4 finalColor; +#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl) +#pragma BLENDER_REQUIRE(common_view_lib.glsl) void main() { @@ -26,7 +23,5 @@ void main() gl_PointSize = sizeVertex * 2.0; -#ifdef USE_WORLD_CLIP_PLANES - world_clip_planes_calc_clip_distance(world_pos); -#endif + view_clipping_distances(world_pos); } diff --git a/source/blender/draw/engines/overlay/shaders/paint_texture_frag.glsl b/source/blender/draw/engines/overlay/shaders/paint_texture_frag.glsl index ebaa898429d..e5af0e7bd88 100644 --- a/source/blender/draw/engines/overlay/shaders/paint_texture_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/paint_texture_frag.glsl @@ -1,13 +1,4 @@ -in vec2 uv_interp; - -out vec4 fragColor; - -uniform float opacity = 1.0; - -uniform sampler2D maskImage; -uniform bool maskImagePremultiplied; -uniform vec3 maskColor; -uniform bool maskInvertStencil; +#pragma BLENDER_REQUIRE(common_colormanagement_lib.glsl) void main() { diff --git a/source/blender/draw/engines/overlay/shaders/paint_texture_vert.glsl b/source/blender/draw/engines/overlay/shaders/paint_texture_vert.glsl index cb29fefb7ef..f93d0050950 100644 --- a/source/blender/draw/engines/overlay/shaders/paint_texture_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/paint_texture_vert.glsl @@ -1,8 +1,5 @@ - -in vec3 pos; -in vec2 mu; /* masking uv map */ - -out vec2 uv_interp; +#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl) +#pragma BLENDER_REQUIRE(common_view_lib.glsl) void main() { @@ -13,7 +10,5 @@ void main() uv_interp = mu; -#ifdef USE_WORLD_CLIP_PLANES - world_clip_planes_calc_clip_distance(world_pos); -#endif + view_clipping_distances(world_pos); } diff --git a/source/blender/draw/engines/overlay/shaders/paint_vertcol_frag.glsl b/source/blender/draw/engines/overlay/shaders/paint_vertcol_frag.glsl index 2500ff83abe..193fabc65cb 100644 --- a/source/blender/draw/engines/overlay/shaders/paint_vertcol_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/paint_vertcol_frag.glsl @@ -1,11 +1,3 @@ - -in vec3 finalColor; - -out vec4 fragColor; - -uniform float opacity = 1.0; -uniform bool useAlphaBlend = false; - vec3 linear_to_srgb_attr(vec3 c) { c = max(c, vec3(0.0)); diff --git a/source/blender/draw/engines/overlay/shaders/paint_vertcol_vert.glsl b/source/blender/draw/engines/overlay/shaders/paint_vertcol_vert.glsl index e060e33deba..650070dcfd5 100644 --- a/source/blender/draw/engines/overlay/shaders/paint_vertcol_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/paint_vertcol_vert.glsl @@ -1,8 +1,5 @@ - -in vec3 pos; -in vec3 ac; /* active color */ - -out vec3 finalColor; +#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl) +#pragma BLENDER_REQUIRE(common_view_lib.glsl) vec3 srgb_to_linear_attr(vec3 c) { @@ -21,7 +18,5 @@ void main() finalColor = srgb_to_linear_attr(ac); -#ifdef USE_WORLD_CLIP_PLANES - world_clip_planes_calc_clip_distance(world_pos); -#endif + view_clipping_distances(world_pos); } diff --git a/source/blender/draw/engines/overlay/shaders/paint_weight_frag.glsl b/source/blender/draw/engines/overlay/shaders/paint_weight_frag.glsl index 8009713d655..1befe7506c4 100644 --- a/source/blender/draw/engines/overlay/shaders/paint_weight_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/paint_weight_frag.glsl @@ -1,14 +1,3 @@ - -in vec2 weight_interp; /* (weight, alert) */ -in float color_fac; - -out vec4 fragColor; - -uniform float opacity = 1.0; -uniform sampler1D colorramp; - -uniform bool drawContours = false; - float contours(float value, float steps, float width_px, float max_rel_width, float gradient) { /* Minimum visible and minimum full strength line width in screen space for fade out. */ diff --git a/source/blender/draw/engines/overlay/shaders/paint_weight_vert.glsl b/source/blender/draw/engines/overlay/shaders/paint_weight_vert.glsl index 31b6dc42cf4..cff79d606d6 100644 --- a/source/blender/draw/engines/overlay/shaders/paint_weight_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/paint_weight_vert.glsl @@ -1,13 +1,5 @@ -#ifdef FAKE_SHADING -uniform vec3 light_dir; -#endif - -in float weight; -in vec3 pos; -in vec3 nor; - -out vec2 weight_interp; /* (weight, alert) */ -out float color_fac; +#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl) +#pragma BLENDER_REQUIRE(common_view_lib.glsl) void main() { @@ -29,7 +21,5 @@ void main() color_fac = 1.0; #endif -#ifdef USE_WORLD_CLIP_PLANES - world_clip_planes_calc_clip_distance(world_pos); -#endif + view_clipping_distances(world_pos); } diff --git a/source/blender/draw/engines/overlay/shaders/paint_wire_vert.glsl b/source/blender/draw/engines/overlay/shaders/paint_wire_vert.glsl index 6a937d846c4..749cc92f082 100644 --- a/source/blender/draw/engines/overlay/shaders/paint_wire_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/paint_wire_vert.glsl @@ -1,10 +1,5 @@ - -uniform bool useSelect; - -in vec3 pos; -in vec4 nor; /* flag stored in w */ - -flat out vec4 finalColor; +#pragma BLENDER_REQUIRE(common_view_clipping_lib.glsl) +#pragma BLENDER_REQUIRE(common_view_lib.glsl) void main() { @@ -32,7 +27,5 @@ void main() finalColor = vec4(1.0, 1.0, 1.0, 0.3); } -#ifdef USE_WORLD_CLIP_PLANES - world_clip_planes_calc_clip_distance(world_pos); -#endif + view_clipping_distances(world_pos); } |