From 5c06f05cf9c3b881bc35a5af55e7781201722d64 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 31 Oct 2023 13:06:05 +0100 Subject: [PATCH] Tool marker NOT rendered by the new visualization code --- src/libslic3r/Technologies.hpp | 2 +- src/slic3r/GUI/GCodeViewer.cpp | 20 +++++++++----------- src/slic3r/GUI/GCodeViewer.hpp | 4 ++-- src/slic3r/GUI/LibVGCode/CogMarker.hpp | 2 -- src/slic3r/GUI/LibVGCode/PathVertex.hpp | 2 -- src/slic3r/GUI/LibVGCode/Range.hpp | 5 ++++- src/slic3r/GUI/LibVGCode/Settings.hpp | 2 +- src/slic3r/GUI/LibVGCode/Shaders.hpp | 2 +- src/slic3r/GUI/LibVGCode/ToolMarker.cpp | 4 ++-- src/slic3r/GUI/LibVGCode/ToolMarker.hpp | 6 ++---- src/slic3r/GUI/LibVGCode/Types.hpp | 21 +++++++++++++++++---- src/slic3r/GUI/LibVGCode/Utils.hpp | 1 - src/slic3r/GUI/LibVGCode/Viewer.cpp | 2 +- src/slic3r/GUI/LibVGCode/Viewer.hpp | 2 +- src/slic3r/GUI/LibVGCode/ViewerImpl.cpp | 12 +++++------- src/slic3r/GUI/LibVGCode/ViewerImpl.hpp | 12 ++++++------ 16 files changed, 52 insertions(+), 47 deletions(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 85346827af..adb7c21c5b 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -61,7 +61,7 @@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ #define ENABLE_NEW_GCODE_VIEWER 1 -#define ENABLE_NEW_GCODE_VIEWER_DEBUG (1 && ENABLE_NEW_GCODE_VIEWER) +#define ENABLE_NEW_GCODE_VIEWER_DEBUG (0 && ENABLE_NEW_GCODE_VIEWER) #define ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS (1 && ENABLE_NEW_GCODE_VIEWER) //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 9af33b005c..a4169d8612 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -730,7 +730,7 @@ void GCodeViewer::SequentialView::GCodeWindow::render(float top, float bottom, s } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -#if ENABLE_NEW_GCODE_VIEWER +#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS void GCodeViewer::SequentialView::render(float legend_height, bool show_marker) { if (show_marker) @@ -739,7 +739,7 @@ void GCodeViewer::SequentialView::render(float legend_height, bool show_marker) void GCodeViewer::SequentialView::render(float legend_height) { //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -#endif // ENABLE_NEW_GCODE_VIEWER +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ marker.render(); //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ -1225,14 +1225,14 @@ void GCodeViewer::render() std::memcpy(converted_view_matrix.data(), view_matrix.data(), 16 * sizeof(float)); libvgcode::Mat4x4f converted_projetion_matrix; std::memcpy(converted_projetion_matrix.data(), projection_matrix.data(), 16 * sizeof(float)); +#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS libvgcode::Vec3f converted_tool_marker_position; std::memcpy(converted_tool_marker_position.data(), m_sequential_view.current_position.data(), 3 * sizeof(float)); -#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS m_new_viewer.set_cog_marker_scale_factor(m_cog_marker_fixed_screen_size ? 10.0f * m_cog_marker_size * camera.get_inv_zoom() : m_cog_marker_size); -#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS m_new_viewer.set_tool_marker_position(converted_tool_marker_position); m_new_viewer.set_tool_marker_scale_factor(m_tool_marker_fixed_screen_size ? 10.0f * m_tool_marker_size * camera.get_inv_zoom() : m_tool_marker_size); +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS m_new_viewer.render(converted_view_matrix, converted_projetion_matrix); } else @@ -1248,13 +1248,13 @@ void GCodeViewer::render() m_sequential_view.marker.set_world_offset(m_sequential_view.current_offset); m_sequential_view.marker.set_z_offset(m_z_offset); //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -#if ENABLE_NEW_GCODE_VIEWER +#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS m_sequential_view.render(legend_height, !m_use_new_viewer); #else //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ m_sequential_view.render(legend_height); //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -#endif // ENABLE_NEW_GCODE_VIEWER +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ } } @@ -1263,12 +1263,11 @@ void GCodeViewer::render() #endif // ENABLE_GCODE_VIEWER_STATISTICS //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -#if ENABLE_NEW_GCODE_VIEWER_DEBUG +#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS if (m_use_new_viewer) { ImGuiWrapper& imgui = *Slic3r::GUI::wxGetApp().imgui(); imgui.begin(std::string("LibVGCode Viewer Controller"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse); -#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS imgui.checkbox("Cog marker fixed screen size", m_cog_marker_fixed_screen_size); if (ImGui::BeginTable("Cog", 2)) { @@ -1280,7 +1279,6 @@ void GCodeViewer::render() ImGui::EndTable(); } -#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS imgui.checkbox("Tool marker fixed screen size", m_tool_marker_fixed_screen_size); if (ImGui::BeginTable("Tool", 2)) { @@ -1296,7 +1294,7 @@ void GCodeViewer::render() imgui.end(); } -#endif // ENABLE_NEW_GCODE_VIEWER_DEBUG +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ } @@ -4827,7 +4825,7 @@ void GCodeViewer::render_legend(float& legend_height) //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ #if ENABLE_NEW_GCODE_VIEWER #if ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS - if (type != Preview::OptionType::CenterOfGravity) + if (type != Preview::OptionType::CenterOfGravity && type != Preview::OptionType::ToolMarker && type != Preview::OptionType::Shells) #endif // ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS m_new_viewer.toggle_option_visibility((libvgcode::EOptionType)type); #endif // ENABLE_NEW_GCODE_VIEWER diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp index de182ea36f..ff9eda3402 100644 --- a/src/slic3r/GUI/GCodeViewer.hpp +++ b/src/slic3r/GUI/GCodeViewer.hpp @@ -813,13 +813,13 @@ public: std::vector gcode_ids; //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -#if ENABLE_NEW_GCODE_VIEWER +#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS void render(float legend_height, bool show_marker); #else //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ void render(float legend_height); //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -#endif // ENABLE_NEW_GCODE_VIEWER +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ }; diff --git a/src/slic3r/GUI/LibVGCode/CogMarker.hpp b/src/slic3r/GUI/LibVGCode/CogMarker.hpp index 08fbc47b13..005f824f5e 100644 --- a/src/slic3r/GUI/LibVGCode/CogMarker.hpp +++ b/src/slic3r/GUI/LibVGCode/CogMarker.hpp @@ -12,8 +12,6 @@ #include "Types.hpp" -#include - namespace libvgcode { class CogMarker diff --git a/src/slic3r/GUI/LibVGCode/PathVertex.hpp b/src/slic3r/GUI/LibVGCode/PathVertex.hpp index 99c86d0c02..10d4a8e6de 100644 --- a/src/slic3r/GUI/LibVGCode/PathVertex.hpp +++ b/src/slic3r/GUI/LibVGCode/PathVertex.hpp @@ -12,8 +12,6 @@ #include "Types.hpp" -#include - namespace libvgcode { struct PathVertex diff --git a/src/slic3r/GUI/LibVGCode/Range.hpp b/src/slic3r/GUI/LibVGCode/Range.hpp index 7829b28335..e9c4472475 100644 --- a/src/slic3r/GUI/LibVGCode/Range.hpp +++ b/src/slic3r/GUI/LibVGCode/Range.hpp @@ -29,7 +29,10 @@ public: bool operator != (const Range& other) const; private: - // [0] = min, [1] = max + // + // [0] = min + // [1] = max + // std::array m_range{ 0, 0 }; }; diff --git a/src/slic3r/GUI/LibVGCode/Settings.hpp b/src/slic3r/GUI/LibVGCode/Settings.hpp index c6d4493d99..bbd09fae39 100644 --- a/src/slic3r/GUI/LibVGCode/Settings.hpp +++ b/src/slic3r/GUI/LibVGCode/Settings.hpp @@ -37,9 +37,9 @@ struct Settings { EOptionType::CustomGCodes, false }, #if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS { EOptionType::CenterOfGravity, false }, -#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS { EOptionType::Shells, false }, { EOptionType::ToolMarker, true } +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS } }; std::map extrusion_roles_visibility{ { diff --git a/src/slic3r/GUI/LibVGCode/Shaders.hpp b/src/slic3r/GUI/LibVGCode/Shaders.hpp index f6c3b3760f..9a3fc751fb 100644 --- a/src/slic3r/GUI/LibVGCode/Shaders.hpp +++ b/src/slic3r/GUI/LibVGCode/Shaders.hpp @@ -252,7 +252,6 @@ static const char* Cog_Marker_Fragment_Shader = " vec3 color = delta.x * delta.y * delta.z > 0.0 ? BLACK : WHITE;\n" " out_color = intensity * vec4(color, 1.0);\n" "}\n"; -#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS static const char* Tool_Marker_Vertex_Shader = "#version 150\n" @@ -294,6 +293,7 @@ static const char* Tool_Marker_Fragment_Shader = "void main() {\n" " fragment_color = color;\n" "}\n"; +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS } // namespace libvgcode diff --git a/src/slic3r/GUI/LibVGCode/ToolMarker.cpp b/src/slic3r/GUI/LibVGCode/ToolMarker.cpp index 33ad9b5596..3a727f2177 100644 --- a/src/slic3r/GUI/LibVGCode/ToolMarker.cpp +++ b/src/slic3r/GUI/LibVGCode/ToolMarker.cpp @@ -15,7 +15,7 @@ //################################################################################################################################ // PrusaSlicer development only -> !!!TO BE REMOVED!!! -#if ENABLE_NEW_GCODE_VIEWER +#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS //################################################################################################################################ namespace libvgcode { @@ -208,5 +208,5 @@ void ToolMarker::set_alpha(float alpha) //################################################################################################################################ // PrusaSlicer development only -> !!!TO BE REMOVED!!! -#endif // ENABLE_NEW_GCODE_VIEWER +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS //################################################################################################################################ diff --git a/src/slic3r/GUI/LibVGCode/ToolMarker.hpp b/src/slic3r/GUI/LibVGCode/ToolMarker.hpp index 9c10e23d67..2b1f2648a6 100644 --- a/src/slic3r/GUI/LibVGCode/ToolMarker.hpp +++ b/src/slic3r/GUI/LibVGCode/ToolMarker.hpp @@ -7,13 +7,11 @@ //################################################################################################################################ // PrusaSlicer development only -> !!!TO BE REMOVED!!! -#if ENABLE_NEW_GCODE_VIEWER +#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS //################################################################################################################################ #include "Types.hpp" -#include - namespace libvgcode { class ToolMarker @@ -57,7 +55,7 @@ private: //################################################################################################################################ // PrusaSlicer development only -> !!!TO BE REMOVED!!! -#endif // ENABLE_NEW_GCODE_VIEWER +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS //################################################################################################################################ #endif // VGCODE_TOOLMARKER_HPP \ No newline at end of file diff --git a/src/slic3r/GUI/LibVGCode/Types.hpp b/src/slic3r/GUI/LibVGCode/Types.hpp index ebeac85b27..6d98919545 100644 --- a/src/slic3r/GUI/LibVGCode/Types.hpp +++ b/src/slic3r/GUI/LibVGCode/Types.hpp @@ -11,15 +11,28 @@ //################################################################################################################################ #include +#include namespace libvgcode { static constexpr float PI = 3.141592f; -using Vec3f = std::array; -// 4 by 4 square matrix with column-major order +using Vec3f = std::array; +// +// 4 by 4 square matrix with column-major order: +// | a[0] a[4] a[8] a[12] | +// | a[1] a[5] a[9] a[13] | +// | a[2] a[6] a[10] a[14] | +// | a[3] a[7] a[11] a[15] | +// using Mat4x4f = std::array; -using Color = std::array; +// +// [0] = red +// [1] = green +// [2] = blue +// values should belong to [0..1] +// +using Color = std::array; // Alias for GCodeViewer::EViewType defined into GCodeViewer.hpp enum class EViewType : uint8_t @@ -90,9 +103,9 @@ enum class EOptionType : uint8_t CustomGCodes, #if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS CenterOfGravity, -#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS Shells, ToolMarker, +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS COUNT }; diff --git a/src/slic3r/GUI/LibVGCode/Utils.hpp b/src/slic3r/GUI/LibVGCode/Utils.hpp index 0b647c3800..3b8b2088cd 100644 --- a/src/slic3r/GUI/LibVGCode/Utils.hpp +++ b/src/slic3r/GUI/LibVGCode/Utils.hpp @@ -12,7 +12,6 @@ #include "Types.hpp" -#include #include namespace libvgcode { diff --git a/src/slic3r/GUI/LibVGCode/Viewer.cpp b/src/slic3r/GUI/LibVGCode/Viewer.cpp index b1506e794b..ae4ab573b7 100644 --- a/src/slic3r/GUI/LibVGCode/Viewer.cpp +++ b/src/slic3r/GUI/LibVGCode/Viewer.cpp @@ -133,7 +133,6 @@ void Viewer::set_cog_marker_scale_factor(float factor) { m_impl.set_cog_marker_scale_factor(factor); } -#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS const Vec3f& Viewer::get_tool_marker_position() const { @@ -174,6 +173,7 @@ void Viewer::set_tool_marker_alpha(float alpha) { m_impl.set_tool_marker_alpha(alpha); } +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS } // namespace libvgcode diff --git a/src/slic3r/GUI/LibVGCode/Viewer.hpp b/src/slic3r/GUI/LibVGCode/Viewer.hpp index 8f054b055e..39dee54c15 100644 --- a/src/slic3r/GUI/LibVGCode/Viewer.hpp +++ b/src/slic3r/GUI/LibVGCode/Viewer.hpp @@ -79,7 +79,6 @@ public: float get_cog_marker_scale_factor() const; void set_cog_marker_scale_factor(float factor); -#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS const Vec3f& get_tool_marker_position() const; void set_tool_marker_position(const Vec3f& position); @@ -92,6 +91,7 @@ public: float get_tool_marker_alpha() const; void set_tool_marker_alpha(float alpha); +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS private: ViewerImpl m_impl; diff --git a/src/slic3r/GUI/LibVGCode/ViewerImpl.cpp b/src/slic3r/GUI/LibVGCode/ViewerImpl.cpp index 425cf92e2b..b0666f7181 100644 --- a/src/slic3r/GUI/LibVGCode/ViewerImpl.cpp +++ b/src/slic3r/GUI/LibVGCode/ViewerImpl.cpp @@ -520,7 +520,6 @@ void ViewerImpl::init() m_uni_cog_marker_projection_matrix != -1); m_cog_marker.init(32, 1.0f); -#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS // tool marker shader m_tool_marker_shader_id = init_shader("tool_marker", Tool_Marker_Vertex_Shader, Tool_Marker_Fragment_Shader); @@ -539,6 +538,7 @@ void ViewerImpl::init() m_uni_tool_marker_color_base != -1); m_tool_marker.init(32, 2.0f, 4.0f, 1.0f, 8.0f); +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS } void ViewerImpl::load(const Slic3r::GCodeProcessorResult& gcode_result, const std::vector& str_tool_colors) @@ -862,9 +862,9 @@ void ViewerImpl::render(const Mat4x4f& view_matrix, const Mat4x4f& projection_ma render_segments(view_matrix, projection_matrix, camera_position); render_options(view_matrix, projection_matrix); +#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS if (m_settings.options_visibility.at(EOptionType::ToolMarker)) render_tool_marker(view_matrix, projection_matrix); -#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS if (m_settings.options_visibility.at(EOptionType::CenterOfGravity)) render_cog_marker(view_matrix, projection_matrix); #endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS @@ -1043,7 +1043,6 @@ float ViewerImpl::get_cog_marker_scale_factor() const { return m_cog_marker_scale_factor; } -#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS const Vec3f& ViewerImpl::get_tool_marker_position() const { @@ -1070,12 +1069,10 @@ float ViewerImpl::get_tool_marker_alpha() const return m_tool_marker.get_alpha(); } -#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS void ViewerImpl::set_cog_marker_scale_factor(float factor) { m_cog_marker_scale_factor = std::max(factor, 0.001f); } -#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS void ViewerImpl::set_tool_marker_position(const Vec3f& position) { @@ -1101,6 +1098,7 @@ void ViewerImpl::set_tool_marker_alpha(float alpha) { m_tool_marker.set_alpha(alpha); } +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS static void delete_textures(unsigned int& id) { @@ -1433,7 +1431,6 @@ void ViewerImpl::render_cog_marker(const Mat4x4f& view_matrix, const Mat4x4f& pr glsafe(glUseProgram(curr_shader)); } -#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS void ViewerImpl::render_tool_marker(const Mat4x4f& view_matrix, const Mat4x4f& projection_matrix) { @@ -1479,6 +1476,7 @@ void ViewerImpl::render_tool_marker(const Mat4x4f& view_matrix, const Mat4x4f& p glsafe(glUseProgram(curr_shader)); } +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS #if ENABLE_NEW_GCODE_VIEWER_DEBUG void ViewerImpl::render_debug_window() @@ -1563,7 +1561,6 @@ void ViewerImpl::render_debug_window() ImGui::EndTable(); } -#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS ImGui::Separator(); @@ -1601,6 +1598,7 @@ void ViewerImpl::render_debug_window() ImGui::EndTable(); } +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS } imgui.end(); diff --git a/src/slic3r/GUI/LibVGCode/ViewerImpl.hpp b/src/slic3r/GUI/LibVGCode/ViewerImpl.hpp index f9c38c36b8..1815f88ef7 100644 --- a/src/slic3r/GUI/LibVGCode/ViewerImpl.hpp +++ b/src/slic3r/GUI/LibVGCode/ViewerImpl.hpp @@ -15,8 +15,8 @@ #include "OptionTemplate.hpp" #if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS #include "CogMarker.hpp" -#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS #include "ToolMarker.hpp" +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS #include "PathVertex.hpp" #include "Bitset.hpp" #include "ColorRange.hpp" @@ -110,24 +110,24 @@ public: #if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS Vec3f get_cog_marker_position() const; float get_cog_marker_scale_factor() const; -#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS const Vec3f& get_tool_marker_position() const; float get_tool_marker_offset_z() const; float get_tool_marker_scale_factor() const; const Color& get_tool_marker_color() const; float get_tool_marker_alpha() const; +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS // // Properties setters // #if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS void set_cog_marker_scale_factor(float factor); -#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS void set_tool_marker_position(const Vec3f& position); void set_tool_marker_offset_z(float offset_z); void set_tool_marker_scale_factor(float factor); void set_tool_marker_color(const Color& color); void set_tool_marker_alpha(float size); +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS private: Settings m_settings; @@ -152,13 +152,13 @@ private: // CogMarker m_cog_marker; float m_cog_marker_scale_factor{ 1.0f }; -#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS // // The OpenGL element used to represent the tool nozzle // ToolMarker m_tool_marker; float m_tool_marker_scale_factor{ 1.0f }; +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS // // cpu buffer to store vertices @@ -229,7 +229,6 @@ private: int m_uni_cog_marker_scale_factor{ -1 }; int m_uni_cog_marker_view_matrix{ -1 }; int m_uni_cog_marker_projection_matrix{ -1 }; -#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS // // Cache for OpenGL uniforms id for tool marker shader @@ -239,6 +238,7 @@ private: int m_uni_tool_marker_view_matrix{ -1 }; int m_uni_tool_marker_projection_matrix{ -1 }; int m_uni_tool_marker_color_base{ -1 }; +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS // // gpu buffers to store positions @@ -274,8 +274,8 @@ private: void render_options(const Mat4x4f& view_matrix, const Mat4x4f& projection_matrix); #if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS void render_cog_marker(const Mat4x4f& view_matrix, const Mat4x4f& projection_matrix); -#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS void render_tool_marker(const Mat4x4f& view_matrix, const Mat4x4f& projection_matrix); +#endif // !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS #if ENABLE_NEW_GCODE_VIEWER_DEBUG // Debug