diff --git a/resources/shaders/options_110.vs b/resources/shaders/options_110.vs index 7592f86a4..5f2ab2350 100644 --- a/resources/shaders/options_110.vs +++ b/resources/shaders/options_110.vs @@ -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(); } diff --git a/resources/shaders/options_120.vs b/resources/shaders/options_120.vs index baf3cd3a7..edb503fb2 100644 --- a/resources/shaders/options_120.vs +++ b/resources/shaders/options_120.vs @@ -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(); } diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index a5d2d4682..7b30958a9 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -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_ diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 383ef5eb0..5e2702b3c 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -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 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(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);