diff --git a/pvt/src/rendering/shader_strings.cpp b/pvt/src/rendering/shader_strings.cpp index 895daebbcb2b35b231be1d2329eeaf6b4d91afbb..308a4ac17b9e5fdef369800d232158d8c03a6fc3 100644 --- a/pvt/src/rendering/shader_strings.cpp +++ b/pvt/src/rendering/shader_strings.cpp @@ -957,6 +957,8 @@ void main() std::string scatter_plot_vert = R"(\ #version 400 +uniform mat4 view; +uniform mat4 projection; uniform float scale; in vec3 vertex ; @@ -966,7 +968,7 @@ flat out int vert_selected; void main() { - gl_Position = vec4(vertex, 1.0); + gl_Position = projection * view * vec4(vertex, 1.0); gl_PointSize = scale; vert_selected = selected; } @@ -974,8 +976,9 @@ void main() std::string scatter_plot_frag = R"(\ #version 400 -uniform vec4 normal_color ; -uniform vec4 selected_color; +uniform vec4 background_color; +uniform vec4 normal_color ; +uniform vec4 selected_color ; flat in int vert_selected; @@ -983,15 +986,24 @@ out vec4 frag_color; void main() { + float radius = length(gl_PointCoord - vec2(0.5)); + if(radius > 0.5) + discard; + + vec4 color; if(vert_selected == 0) - frag_color = normal_color; + color = normal_color; else - frag_color = selected_color; + color = selected_color; + + frag_color = mix(color, background_color, smoothstep(0.0, 0.6, radius)); } )"; std::string scatter_plot_click_vert = R"(\ #version 400 +uniform mat4 view; +uniform mat4 projection; uniform float scale; in vec3 vertex; @@ -1001,7 +1013,7 @@ flat out int vert_id; void main() { - gl_Position = vec4(vertex, 1.0); + gl_Position = projection * view * vec4(vertex, 1.0); gl_PointSize = scale; vert_id = id; } @@ -1015,6 +1027,9 @@ out int frag_id; void main() { + if(length(gl_PointCoord - vec2(0.5)) > 0.5) + discard; + frag_id = vert_id; } )";