Fixed screen-size for point markers used to visualize retraction/unretractions and other options in preview

This commit is contained in:
enricoturri1966 2020-11-16 10:29:54 +01:00
parent 9b3ff9b1cf
commit e04c6a4d17
4 changed files with 41 additions and 2 deletions

View file

@ -1,11 +1,22 @@
#version 110
uniform bool use_fixed_screen_size;
uniform float zoom;
uniform float point_size;
uniform float near_plane_height;
float fixed_screen_size()
{
return point_size;
}
float fixed_world_size()
{
return (gl_Position.w == 1.0) ? zoom * near_plane_height * point_size : near_plane_height * point_size / gl_Position.w;
}
void main()
{
gl_Position = ftransform();
gl_PointSize = (gl_Position.w == 1.0) ? zoom * near_plane_height * point_size : near_plane_height * point_size / gl_Position.w;
gl_PointSize = use_fixed_screen_size ? fixed_screen_size() : fixed_world_size();
}