diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2019-06-20 17:50:08 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2019-06-21 10:47:03 +0300 |
commit | a3a6cda8fb678432e0552d23b0226e8617f26e5f (patch) | |
tree | 7e23565133d47288eee38cf65151b5c9350991f6 /source | |
parent | 0c538fc923803c8611c3c7c7af9ca51fc5293b75 (diff) |
Fix T65745: Bone Selection X-Ray Drawing.
The Pose Bone Selection used normal matric multiplication, but that
mismatched the Depth buffer from all draw engines. They used the
optimized matrices from common_view_lib.
This change will use the optimized version, so the depth buffer matches
and the render artifacts would be correct.
Please note that bone selection is not using shcfg and therefore render clipping is still off.
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D5100
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/draw/modes/pose_mode.c | 12 | ||||
-rw-r--r-- | source/blender/draw/modes/shaders/pose_selection_vert.glsl | 12 |
3 files changed, 24 insertions, 1 deletions
diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt index 44551a4e04b..5a8a4d46ac9 100644 --- a/source/blender/draw/CMakeLists.txt +++ b/source/blender/draw/CMakeLists.txt @@ -325,6 +325,7 @@ data_to_c_simple(modes/shaders/paint_wire_vert.glsl SRC) data_to_c_simple(modes/shaders/paint_vert_frag.glsl SRC) data_to_c_simple(modes/shaders/particle_strand_frag.glsl SRC) data_to_c_simple(modes/shaders/particle_strand_vert.glsl SRC) +data_to_c_simple(modes/shaders/pose_selection_vert.glsl SRC) data_to_c_simple(modes/shaders/sculpt_mask_vert.glsl SRC) data_to_c_simple(modes/shaders/volume_velocity_vert.glsl SRC) diff --git a/source/blender/draw/modes/pose_mode.c b/source/blender/draw/modes/pose_mode.c index 8cdf28f177a..3a5c87688fe 100644 --- a/source/blender/draw/modes/pose_mode.c +++ b/source/blender/draw/modes/pose_mode.c @@ -35,6 +35,10 @@ #include "draw_common.h" #include "draw_mode_engines.h" +extern char datatoc_common_view_lib_glsl[]; +extern char datatoc_gpu_shader_uniform_color_frag_glsl[]; +extern char datatoc_pose_selection_vert_glsl[]; + /* *********** LISTS *********** */ /** * All lists are per viewport specific datas. @@ -93,12 +97,18 @@ static bool POSE_is_bone_selection_overlay_active(void) static void POSE_engine_init(void *UNUSED(vedata)) { if (!e_data.bone_selection_sh) { - e_data.bone_selection_sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR); + e_data.bone_selection_sh = DRW_shader_create_with_lib( + datatoc_pose_selection_vert_glsl, + NULL, + datatoc_gpu_shader_uniform_color_frag_glsl, + datatoc_common_view_lib_glsl, + NULL); } } static void POSE_engine_free(void) { + DRW_SHADER_FREE_SAFE(e_data.bone_selection_sh); } /* Here init all passes and shading groups diff --git a/source/blender/draw/modes/shaders/pose_selection_vert.glsl b/source/blender/draw/modes/shaders/pose_selection_vert.glsl new file mode 100644 index 00000000000..2dd84c0a060 --- /dev/null +++ b/source/blender/draw/modes/shaders/pose_selection_vert.glsl @@ -0,0 +1,12 @@ + +in vec3 pos; + +void main() +{ + vec3 world_pos = point_object_to_world(pos); + gl_Position = point_world_to_ndc(world_pos); + +#ifdef USE_WORLD_CLIP_PLANES + world_clip_planes_calc_clip_distance(world_pos); +#endif +} |