diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index 29fb765e6..e4e435414 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -89,29 +89,16 @@ std::vector> get_extruders_colors() } float FullyTransparentMaterialThreshold = 0.1f; float FullTransparentModdifiedToFixAlpha = 0.3f; -std::array adjust_color_for_rendering(const std::array &colors, int whichView) +std::array adjust_color_for_rendering(const std::array &colors) { - if (whichView == (int) Slic3r::GUI::GLCanvas3D::ECanvasType::CanvasView3D || - whichView == (int) Slic3r::GUI::GLCanvas3D::ECanvasType::CanvasAssembleView) { - if (colors[3] < FullyTransparentMaterialThreshold) { // completely transparent + if (colors[3] < FullyTransparentMaterialThreshold) { // completely transparent std::array new_color; new_color[0] = 1; new_color[1] = 1; new_color[2] = 1; new_color[3] = FullTransparentModdifiedToFixAlpha; return new_color; - } - } else { - if (colors[3] < FullyTransparentMaterialThreshold) { // completely transparent - std::array new_color; - new_color[0] = 1; - new_color[1] = 1; - new_color[2] = 1; - new_color[3] = 0.05f; - return new_color; - } - } - + } return colors; } diff --git a/src/slic3r/GUI/3DScene.hpp b/src/slic3r/GUI/3DScene.hpp index fa599e61f..4547b5ca5 100644 --- a/src/slic3r/GUI/3DScene.hpp +++ b/src/slic3r/GUI/3DScene.hpp @@ -33,7 +33,7 @@ extern std::vector> get_extruders_colors(); extern float FullyTransparentMaterialThreshold; extern float FullTransparentModdifiedToFixAlpha; -extern std::array adjust_color_for_rendering(const std::array &colors, int whichView=0); +extern std::array adjust_color_for_rendering(const std::array &colors); namespace Slic3r { diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index f7e2f541b..c8a0b6ecd 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -1153,7 +1153,7 @@ void GCodeViewer::refresh(const GCodeProcessorResult& gcode_result, const std::v } for (int i = 0; i < m_tools.m_tool_colors.size(); i++) { - m_tools.m_tool_colors[i] = adjust_color_for_rendering(m_tools.m_tool_colors[i], GLCanvas3D::ECanvasType::CanvasPreview); + m_tools.m_tool_colors[i] = adjust_color_for_rendering(m_tools.m_tool_colors[i]); } // ensure there are enough colors defined while (m_tools.m_tool_colors.size() < std::max(size_t(1), gcode_result.extruders_count)) { @@ -3266,7 +3266,7 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool color = { 0.5f, 0.5f, 0.5f, 1.0f }; else { color = m_tools.m_tool_colors[path.cp_color_id]; - color = adjust_color_for_rendering(color, GLCanvas3D::ECanvasType::CanvasPreview); + color = adjust_color_for_rendering(color); } break; } @@ -3876,10 +3876,6 @@ void GCodeViewer::render_toolpaths() ](std::vector::reverse_iterator it_path, std::vector::reverse_iterator it_end, GLShaderProgram& shader, int uniform_color) { for (auto it = it_path; it != it_end && it_path->ibuffer_id == it->ibuffer_id; ++it) { const RenderPath& path = *it; - if (path.color[3] < 1.0) { - glsafe(::glEnable(GL_BLEND)); - glsafe(::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); - } // Some OpenGL drivers crash on empty glMultiDrawElements, see GH #7415. assert(! path.sizes.empty()); assert(! path.offsets.empty()); @@ -3888,9 +3884,6 @@ void GCodeViewer::render_toolpaths() #if ENABLE_GCODE_VIEWER_STATISTICS ++m_statistics.gl_multi_triangles_calls_count; #endif // ENABLE_GCODE_VIEWER_STATISTICS - if (path.color[3] < 1.0) { - glsafe(::glDisable(GL_BLEND)); - } } }; @@ -4170,7 +4163,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector filament_colors = decode_colors(wxGetApp().plater()->get_extruder_colors_from_plater_config(gcode_result_list.back())); for (int i = 0; i < filament_colors.size(); i++) { - filament_colors[i] = adjust_color_for_rendering(filament_colors[i], GLCanvas3D::ECanvasType::CanvasPreview); + filament_colors[i] = adjust_color_for_rendering(filament_colors[i]); } bool imperial_units = wxGetApp().app_config->get("use_inches") == "1"; diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp index d09c38d59..a6f5b6722 100644 --- a/src/slic3r/GUI/GCodeViewer.hpp +++ b/src/slic3r/GUI/GCodeViewer.hpp @@ -734,13 +734,6 @@ public: //BBS ConflictResultOpt m_conflict_result; - bool GetGcodeGenOk() - { - if (m_roles.empty()) - return false; - else - return true; - } private: std::vector m_plater_extruder; bool m_gl_data_initialized{ false }; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index e4f1cdfd1..eb0a4440e 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1899,10 +1899,6 @@ void GLCanvas3D::render(bool only_init) _render_selection(); _render_bed(!camera.is_looking_downward(), show_axes); _render_platelist(!camera.is_looking_downward(), only_current, true, hover_id); - // BBS: add outline logic - if (m_gcode_viewer.GetGcodeGenOk()==false) { - _render_objects(GLVolumeCollection::ERenderType::Transparent, !m_gizmos.is_running()); - } // BBS: GUI refactor: add canvas size as parameters _render_gcode(cnv_size.get_width(), cnv_size.get_height()); }