FDM painting gizmos (support/seam) now render object in neutral color

The goal is to ensure enough contrast independent on current filament color
This commit is contained in:
Lukas Matena 2020-09-25 16:04:28 +02:00
parent 2647dd1d5d
commit f890cd5b9c
4 changed files with 27 additions and 6 deletions

View File

@ -306,6 +306,7 @@ const float GLVolume::MODEL_COLOR[4][4] = {
}; };
const float GLVolume::SLA_SUPPORT_COLOR[4] = { 0.75f, 0.75f, 0.75f, 1.0f }; const float GLVolume::SLA_SUPPORT_COLOR[4] = { 0.75f, 0.75f, 0.75f, 1.0f };
const float GLVolume::SLA_PAD_COLOR[4] = { 0.0f, 0.2f, 0.0f, 1.0f }; const float GLVolume::SLA_PAD_COLOR[4] = { 0.0f, 0.2f, 0.0f, 1.0f };
const float GLVolume::NEUTRAL_COLOR[4] = { 0.9f, 0.9f, 0.9f, 1.0f };
GLVolume::GLVolume(float r, float g, float b, float a) GLVolume::GLVolume(float r, float g, float b, float a)
: m_transformed_bounding_box_dirty(true) : m_transformed_bounding_box_dirty(true)
@ -327,6 +328,7 @@ GLVolume::GLVolume(float r, float g, float b, float a)
, is_extrusion_path(false) , is_extrusion_path(false)
, force_transparent(false) , force_transparent(false)
, force_native_color(false) , force_native_color(false)
, force_neutral_color(false)
, tverts_range(0, size_t(-1)) , tverts_range(0, size_t(-1))
, qverts_range(0, size_t(-1)) , qverts_range(0, size_t(-1))
{ {
@ -352,12 +354,16 @@ void GLVolume::set_render_color(const float* rgba, unsigned int size)
void GLVolume::set_render_color() void GLVolume::set_render_color()
{ {
if (force_native_color) if (force_native_color || force_neutral_color)
{ {
if (is_outside && shader_outside_printer_detection_enabled) if (is_outside && shader_outside_printer_detection_enabled)
set_render_color(OUTSIDE_COLOR, 4); set_render_color(OUTSIDE_COLOR, 4);
else else {
if (force_native_color)
set_render_color(color, 4); set_render_color(color, 4);
else
set_render_color(NEUTRAL_COLOR, 4);
}
} }
else { else {
if (hover == HS_Select) if (hover == HS_Select)

View File

@ -251,6 +251,7 @@ public:
static const float MODEL_COLOR[4][4]; static const float MODEL_COLOR[4][4];
static const float SLA_SUPPORT_COLOR[4]; static const float SLA_SUPPORT_COLOR[4];
static const float SLA_PAD_COLOR[4]; static const float SLA_PAD_COLOR[4];
static const float NEUTRAL_COLOR[4];
enum EHoverState : unsigned char enum EHoverState : unsigned char
{ {
@ -336,6 +337,8 @@ public:
bool force_transparent : 1; bool force_transparent : 1;
// Whether or not always use the volume's own color (not using SELECTED/HOVER/DISABLED/OUTSIDE) // 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
bool force_neutral_color : 1;
}; };
// Is mouse or rectangle selection over this object to select/deselect it ? // Is mouse or rectangle selection over this object to select/deselect it ?

View File

@ -1725,7 +1725,19 @@ void GLCanvas3D::toggle_model_objects_visibility(bool visible, const ModelObject
if ((mo == nullptr || m_model->objects[vol->composite_id.object_id] == mo) if ((mo == nullptr || m_model->objects[vol->composite_id.object_id] == mo)
&& (instance_idx == -1 || vol->composite_id.instance_id == instance_idx)) { && (instance_idx == -1 || vol->composite_id.instance_id == instance_idx)) {
vol->is_active = visible; vol->is_active = visible;
vol->force_native_color = (instance_idx != -1);
if (instance_idx == -1) {
vol->force_native_color = false;
vol->force_neutral_color = false;
} else {
const GLGizmosManager& gm = get_gizmos_manager();
auto gizmo_type = gm.get_current_type();
if (gizmo_type == GLGizmosManager::FdmSupports
|| gizmo_type == GLGizmosManager::Seam)
vol->force_neutral_color = true;
else
vol->force_native_color = true;
}
} }
} }
} }

View File

@ -504,13 +504,13 @@ void TriangleSelectorGUI::render(ImGuiWrapper* imgui)
m_iva_blockers.finalize_geometry(true); m_iva_blockers.finalize_geometry(true);
if (m_iva_enforcers.has_VBOs()) { if (m_iva_enforcers.has_VBOs()) {
::glColor4f(0.f, 0.f, 1.f, 0.2f); ::glColor4f(0.f, 0.f, 1.f, 0.3f);
m_iva_enforcers.render(); m_iva_enforcers.render();
} }
if (m_iva_blockers.has_VBOs()) { if (m_iva_blockers.has_VBOs()) {
::glColor4f(1.f, 0.f, 0.f, 0.2f); ::glColor4f(1.f, 0.f, 0.f, 0.3f);
m_iva_blockers.render(); m_iva_blockers.render();
} }