FIX: render the opaque shell to the transparent shell

alpha channel is not need to update in shell

Change-Id: I4ad3caa7d40f69ec799f1076cf617805ba1a240b
(cherry picked from commit 315605926764121f6d0ccedf0e88a1ffc3aa0b46)
This commit is contained in:
zhou.xu 2023-06-12 11:11:36 +08:00 committed by Lane.Wei
parent ca81c370fd
commit cc447bf122
3 changed files with 10 additions and 4 deletions

View file

@ -1533,7 +1533,7 @@ void GLVolumeCollection::reset_outside_state()
} }
} }
void GLVolumeCollection::update_colors_by_extruder(const DynamicPrintConfig* config) void GLVolumeCollection::update_colors_by_extruder(const DynamicPrintConfig *config, bool is_update_alpha)
{ {
static const float inv_255 = 1.0f / 255.0f; static const float inv_255 = 1.0f / 255.0f;
@ -1603,7 +1603,13 @@ void GLVolumeCollection::update_colors_by_extruder(const DynamicPrintConfig* con
const Color& color = colors[extruder_id]; const Color& color = colors[extruder_id];
if (!color.text.empty()) { if (!color.text.empty()) {
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
volume->color[i] = (float)color.rgba[i] * inv_255; if (is_update_alpha == false) {
if (i < 3) {
volume->color[i] = (float) color.rgba[i] * inv_255;
}
continue;
}
volume->color[i] = (float) color.rgba[i] * inv_255;
} }
} }
} }

View file

@ -702,7 +702,7 @@ public:
bool check_outside_state(const Slic3r::BuildVolume& build_volume, ModelInstanceEPrintVolumeState* out_state) const; bool check_outside_state(const Slic3r::BuildVolume& build_volume, ModelInstanceEPrintVolumeState* out_state) const;
void reset_outside_state(); void reset_outside_state();
void update_colors_by_extruder(const DynamicPrintConfig* config); void update_colors_by_extruder(const DynamicPrintConfig *config, bool is_update_alpha = true);
// Returns a vector containing the sorted list of all the print_zs of the volumes contained in this collection // Returns a vector containing the sorted list of all the print_zs of the volumes contained in this collection
std::vector<double> get_current_print_zs(bool active_only) const; std::vector<double> get_current_print_zs(bool active_only) const;

View file

@ -1217,7 +1217,7 @@ void GCodeViewer::refresh_render_paths()
void GCodeViewer::update_shells_color_by_extruder(const DynamicPrintConfig* config) void GCodeViewer::update_shells_color_by_extruder(const DynamicPrintConfig* config)
{ {
if (config != nullptr) if (config != nullptr)
m_shells.volumes.update_colors_by_extruder(config); m_shells.volumes.update_colors_by_extruder(config,false);
} }
//BBS: always load shell at preview //BBS: always load shell at preview