Fixed screen-size for point markers used to visualize retraction/unretractions and other options in preview
This commit is contained in:
parent
9b3ff9b1cf
commit
e04c6a4d17
@ -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();
|
||||
}
|
||||
|
@ -1,11 +1,22 @@
|
||||
#version 120
|
||||
|
||||
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();
|
||||
}
|
||||
|
@ -65,4 +65,12 @@
|
||||
#define ENABLE_CTRL_M_ON_WINDOWS (0 && ENABLE_2_3_0_ALPHA3)
|
||||
|
||||
|
||||
//===================
|
||||
// 2.3.0.alpha4 techs
|
||||
//===================
|
||||
#define ENABLE_2_3_0_ALPHA4 1
|
||||
|
||||
#define ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS (1 && ENABLE_GCODE_VIEWER && ENABLE_2_3_0_ALPHA4)
|
||||
|
||||
|
||||
#endif // _prusaslicer_technologies_h_
|
||||
|
@ -1883,7 +1883,11 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
|
||||
|
||||
void GCodeViewer::render_toolpaths() const
|
||||
{
|
||||
#if ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS
|
||||
float point_size = 20.0f;
|
||||
#else
|
||||
float point_size = 0.8f;
|
||||
#endif // ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS
|
||||
std::array<float, 4> light_intensity = { 0.25f, 0.70f, 0.75f, 0.75f };
|
||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||
double zoom = camera.get_zoom();
|
||||
@ -1899,6 +1903,11 @@ void GCodeViewer::render_toolpaths() const
|
||||
auto render_as_points = [this, zoom, point_size, near_plane_height, set_uniform_color]
|
||||
(const TBuffer& buffer, unsigned int index_buffer_id, EOptionsColors color_id, GLShaderProgram& shader) {
|
||||
set_uniform_color(Options_Colors[static_cast<unsigned int>(color_id)], shader);
|
||||
#if ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS
|
||||
shader.set_uniform("use_fixed_screen_size", 1);
|
||||
#else
|
||||
shader.set_uniform("use_fixed_screen_size", 0);
|
||||
#endif // ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS
|
||||
shader.set_uniform("zoom", zoom);
|
||||
shader.set_uniform("percent_outline_radius", 0.0f);
|
||||
shader.set_uniform("percent_center_radius", 0.33f);
|
||||
|
Loading…
Reference in New Issue
Block a user