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
This commit is contained in:
Jeroen Bakker 2019-06-20 16:50:08 +02:00
parent 0c538fc923
commit a3a6cda8fb
Notes: blender-bot 2023-02-14 02:13:09 +01:00
Referenced by issue #65745, X-ray Broken in Pose mode
3 changed files with 24 additions and 1 deletions

View File

@ -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)

View File

@ -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

View File

@ -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
}