Refactoring - Removed member variable GLVolume::force_transparent
This commit is contained in:
parent
6f9efbf19a
commit
403f6d45f9
@ -377,7 +377,6 @@ GLVolume::GLVolume(float r, float g, float b, float a)
|
|||||||
, is_modifier(false)
|
, is_modifier(false)
|
||||||
, is_wipe_tower(false)
|
, is_wipe_tower(false)
|
||||||
, is_extrusion_path(false)
|
, is_extrusion_path(false)
|
||||||
, force_transparent(false)
|
|
||||||
, force_native_color(false)
|
, force_native_color(false)
|
||||||
, force_neutral_color(false)
|
, force_neutral_color(false)
|
||||||
, force_sinking_contours(false)
|
, force_sinking_contours(false)
|
||||||
@ -388,7 +387,7 @@ GLVolume::GLVolume(float r, float g, float b, float a)
|
|||||||
set_render_color(color);
|
set_render_color(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLVolume::set_render_color()
|
void GLVolume::set_render_color(bool force_transparent)
|
||||||
{
|
{
|
||||||
bool outside = is_outside || is_below_printbed();
|
bool outside = is_outside || is_below_printbed();
|
||||||
|
|
||||||
@ -812,11 +811,7 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
|
|||||||
glsafe(::glDisable(GL_CULL_FACE));
|
glsafe(::glDisable(GL_CULL_FACE));
|
||||||
|
|
||||||
for (GLVolumeWithIdAndZ& volume : to_render) {
|
for (GLVolumeWithIdAndZ& volume : to_render) {
|
||||||
if (type == ERenderType::Transparent)
|
volume.first->set_render_color(true);
|
||||||
volume.first->force_transparent = true;
|
|
||||||
volume.first->set_render_color();
|
|
||||||
if (type == ERenderType::Transparent)
|
|
||||||
volume.first->force_transparent = false;
|
|
||||||
|
|
||||||
// render sinking contours of non-hovered volumes
|
// render sinking contours of non-hovered volumes
|
||||||
if (m_show_sinking_contours)
|
if (m_show_sinking_contours)
|
||||||
|
@ -358,9 +358,7 @@ public:
|
|||||||
bool is_wipe_tower : 1;
|
bool is_wipe_tower : 1;
|
||||||
// Wheter or not this volume has been generated from an extrusion path
|
// Wheter or not this volume has been generated from an extrusion path
|
||||||
bool is_extrusion_path : 1;
|
bool is_extrusion_path : 1;
|
||||||
// Wheter or not to always render this volume using its own alpha
|
// Whether or not always use the volume's own color (not using SELECTED/HOVER/DISABLED/OUTSIDE)
|
||||||
bool force_transparent : 1;
|
|
||||||
// Whether or not always use the volume's own color (not using SELECTED/HOVER/DISABLED/OUTSIDE)
|
|
||||||
bool force_native_color : 1;
|
bool force_native_color : 1;
|
||||||
// Whether or not render this volume in neutral
|
// Whether or not render this volume in neutral
|
||||||
bool force_neutral_color : 1;
|
bool force_neutral_color : 1;
|
||||||
@ -397,7 +395,7 @@ public:
|
|||||||
void set_color(const ColorRGBA& rgba) { color = rgba; }
|
void set_color(const ColorRGBA& rgba) { color = rgba; }
|
||||||
void set_render_color(const ColorRGBA& rgba) { render_color = rgba; }
|
void set_render_color(const ColorRGBA& rgba) { render_color = rgba; }
|
||||||
// Sets render color in dependence of current state
|
// Sets render color in dependence of current state
|
||||||
void set_render_color();
|
void set_render_color(bool force_transparent);
|
||||||
// set color according to model volume
|
// set color according to model volume
|
||||||
void set_color_from_model_volume(const ModelVolume& model_volume);
|
void set_color_from_model_volume(const ModelVolume& model_volume);
|
||||||
|
|
||||||
|
@ -2155,7 +2155,7 @@ void GCodeViewer::load_shells(const Print& print, bool initialized)
|
|||||||
volume->zoom_to_volumes = false;
|
volume->zoom_to_volumes = false;
|
||||||
volume->color.a(0.25f);
|
volume->color.a(0.25f);
|
||||||
volume->force_native_color = true;
|
volume->force_native_color = true;
|
||||||
volume->set_render_color();
|
volume->set_render_color(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1845,12 +1845,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||||||
volume->is_modifier = !mvs->model_volume->is_model_part();
|
volume->is_modifier = !mvs->model_volume->is_model_part();
|
||||||
volume->set_color(color_from_model_volume(*mvs->model_volume));
|
volume->set_color(color_from_model_volume(*mvs->model_volume));
|
||||||
// force update of render_color alpha channel
|
// force update of render_color alpha channel
|
||||||
bool transparent = volume->color.is_transparent();
|
volume->set_render_color(volume->color.is_transparent());
|
||||||
if (transparent)
|
|
||||||
volume->force_transparent = true;
|
|
||||||
volume->set_render_color();
|
|
||||||
if (transparent)
|
|
||||||
volume->force_transparent = false;
|
|
||||||
|
|
||||||
// updates volumes transformations
|
// updates volumes transformations
|
||||||
volume->set_instance_transformation(mvs->model_volume->get_object()->instances[mvs->composite_id.instance_id]->get_transformation());
|
volume->set_instance_transformation(mvs->model_volume->get_object()->instances[mvs->composite_id.instance_id]->get_transformation());
|
||||||
|
@ -452,12 +452,7 @@ void Selection::clear()
|
|||||||
for (unsigned int i : m_list) {
|
for (unsigned int i : m_list) {
|
||||||
GLVolume& volume = *(*m_volumes)[i];
|
GLVolume& volume = *(*m_volumes)[i];
|
||||||
volume.selected = false;
|
volume.selected = false;
|
||||||
bool is_transparent = volume.color.is_transparent();
|
volume.set_render_color(volume.color.is_transparent());
|
||||||
if (is_transparent)
|
|
||||||
volume.force_transparent = true;
|
|
||||||
volume.set_render_color();
|
|
||||||
if (is_transparent)
|
|
||||||
volume.force_transparent = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_list.clear();
|
m_list.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user