Tech ENABLE_SINKING_CONTOURS -> Sinking contours updated during render pass and shown also while dragging an object
This commit is contained in:
parent
d99ea7c20f
commit
0146013b4e
@ -335,6 +335,7 @@ void GLVolume::SinkingContours::update()
|
||||
}
|
||||
}
|
||||
m_model.init_from(init_data);
|
||||
set_color(m_parent.render_color);
|
||||
}
|
||||
else
|
||||
m_shift = box.center() - m_old_box.center();
|
||||
@ -348,8 +349,10 @@ void GLVolume::SinkingContours::set_color(const std::array<float, 4>& color)
|
||||
m_model.set_color(-1, { 1.0f - color[0], 1.0f - color[1], 1.0f - color[2], color[3] });
|
||||
}
|
||||
|
||||
void GLVolume::SinkingContours::render() const
|
||||
void GLVolume::SinkingContours::render()
|
||||
{
|
||||
update();
|
||||
|
||||
glsafe(::glPushMatrix());
|
||||
glsafe(::glTranslated(m_shift.x(), m_shift.y(), m_shift.z()));
|
||||
m_model.render();
|
||||
@ -597,18 +600,9 @@ bool GLVolume::is_below_printbed() const
|
||||
}
|
||||
|
||||
#if ENABLE_SINKING_CONTOURS
|
||||
void GLVolume::update_sinking_contours()
|
||||
{
|
||||
m_sinking_contours.update();
|
||||
}
|
||||
|
||||
void GLVolume::update_sinking_contours_color()
|
||||
{
|
||||
m_sinking_contours.set_color(render_color);
|
||||
}
|
||||
|
||||
void GLVolume::render_sinking_contours()
|
||||
{
|
||||
m_sinking_contours.set_color(render_color);
|
||||
m_sinking_contours.render();
|
||||
}
|
||||
#endif // ENABLE_SINKING_CONTOURS
|
||||
@ -857,7 +851,6 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
|
||||
if (volume.first->is_sinking() && !volume.first->is_below_printbed() &&
|
||||
volume.first->hover == GLVolume::HS_None && !volume.first->force_sinking_contours) {
|
||||
shader->stop_using();
|
||||
volume.first->update_sinking_contours_color();
|
||||
volume.first->render_sinking_contours();
|
||||
shader->start_using();
|
||||
}
|
||||
@ -905,7 +898,6 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
|
||||
(volume.first->hover != GLVolume::HS_None || volume.first->force_sinking_contours)) {
|
||||
shader->stop_using();
|
||||
glsafe(::glDepthFunc(GL_ALWAYS));
|
||||
volume.first->update_sinking_contours_color();
|
||||
volume.first->render_sinking_contours();
|
||||
glsafe(::glDepthFunc(GL_LESS));
|
||||
shader->start_using();
|
||||
|
@ -294,7 +294,7 @@ private:
|
||||
SinkingContours(GLVolume& volume) : m_parent(volume) {}
|
||||
void update();
|
||||
void set_color(const std::array<float, 4>& color);
|
||||
void render() const;
|
||||
void render();
|
||||
};
|
||||
|
||||
SinkingContours m_sinking_contours;
|
||||
@ -492,8 +492,6 @@ public:
|
||||
bool is_sinking() const;
|
||||
bool is_below_printbed() const;
|
||||
#if ENABLE_SINKING_CONTOURS
|
||||
void update_sinking_contours();
|
||||
void update_sinking_contours_color();
|
||||
void render_sinking_contours();
|
||||
#endif // ENABLE_SINKING_CONTOURS
|
||||
|
||||
|
@ -2054,12 +2054,6 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
||||
m_gizmos.update_data();
|
||||
m_gizmos.refresh_on_off_state();
|
||||
|
||||
#if ENABLE_SINKING_CONTOURS
|
||||
for (GLVolume* v : m_volumes.volumes) {
|
||||
v->update_sinking_contours();
|
||||
}
|
||||
#endif // ENABLE_SINKING_CONTOURS
|
||||
|
||||
// Update the toolbar
|
||||
if (update_object_list)
|
||||
post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT));
|
||||
@ -2968,6 +2962,14 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
for (GLVolume* volume : m_volumes.volumes) {
|
||||
volume->force_sinking_contours = false;
|
||||
}
|
||||
|
||||
auto show_sinking_contours = [this]() {
|
||||
const Selection::IndicesList& idxs = m_selection.get_volume_idxs();
|
||||
for (unsigned int idx : idxs) {
|
||||
m_volumes.volumes[idx]->force_sinking_contours = true;
|
||||
}
|
||||
m_dirty = true;
|
||||
};
|
||||
#endif // ENABLE_SINKING_CONTOURS
|
||||
|
||||
if (m_gizmos.on_mouse(evt)) {
|
||||
@ -3002,11 +3004,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
case GLGizmosManager::EType::Scale:
|
||||
case GLGizmosManager::EType::Rotate:
|
||||
{
|
||||
const Selection::IndicesList& idxs = m_selection.get_volume_idxs();
|
||||
for (unsigned int idx : idxs) {
|
||||
m_volumes.volumes[idx]->force_sinking_contours = true;
|
||||
}
|
||||
m_dirty = true;
|
||||
show_sinking_contours();
|
||||
break;
|
||||
}
|
||||
default: { break; }
|
||||
@ -3137,6 +3135,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
m_selection.start_dragging();
|
||||
m_mouse.drag.start_position_3D = m_mouse.scene_position;
|
||||
m_sequential_print_clearance_first_displacement = true;
|
||||
#if ENABLE_SINKING_CONTOURS
|
||||
show_sinking_contours();
|
||||
#endif // ENABLE_SINKING_CONTOURS
|
||||
m_moving = true;
|
||||
}
|
||||
}
|
||||
|
@ -674,9 +674,6 @@ void Selection::translate(const Vec3d& displacement, bool local)
|
||||
translation_type = Volume;
|
||||
}
|
||||
}
|
||||
#if ENABLE_SINKING_CONTOURS
|
||||
v.update_sinking_contours();
|
||||
#endif // ENABLE_SINKING_CONTOURS
|
||||
}
|
||||
|
||||
#if !DISABLE_INSTANCES_SYNCH
|
||||
@ -711,9 +708,6 @@ void Selection::rotate(const Vec3d& rotation, TransformationType transformation_
|
||||
v.set_volume_rotation(m_cache.volumes_data[i].get_volume_rotation());
|
||||
v.set_volume_offset(m_cache.volumes_data[i].get_volume_position());
|
||||
}
|
||||
#if ENABLE_SINKING_CONTOURS
|
||||
v.update_sinking_contours();
|
||||
#endif // ENABLE_SINKING_CONTOURS
|
||||
}
|
||||
}
|
||||
else { // this is not the wipe tower
|
||||
@ -781,9 +775,6 @@ void Selection::rotate(const Vec3d& rotation, TransformationType transformation_
|
||||
v.set_volume_rotation(new_rotation);
|
||||
}
|
||||
}
|
||||
#if ENABLE_SINKING_CONTOURS
|
||||
v.update_sinking_contours();
|
||||
#endif // ENABLE_SINKING_CONTOURS
|
||||
}
|
||||
}
|
||||
|
||||
@ -828,9 +819,6 @@ void Selection::flattening_rotate(const Vec3d& normal)
|
||||
// Additional rotation to align tnormal with the down vector in the world coordinate space.
|
||||
auto extra_rotation = Eigen::Quaterniond().setFromTwoVectors(tnormal, - Vec3d::UnitZ());
|
||||
v.set_instance_rotation(Geometry::extract_euler_angles(extra_rotation.toRotationMatrix() * m_cache.volumes_data[i].get_instance_rotation_matrix()));
|
||||
#if ENABLE_SINKING_CONTOURS
|
||||
v.update_sinking_contours();
|
||||
#endif // ENABLE_SINKING_CONTOURS
|
||||
}
|
||||
|
||||
#if !DISABLE_INSTANCES_SYNCH
|
||||
@ -901,9 +889,6 @@ void Selection::scale(const Vec3d& scale, TransformationType transformation_type
|
||||
v.set_volume_scaling_factor(new_scale);
|
||||
}
|
||||
}
|
||||
#if ENABLE_SINKING_CONTOURS
|
||||
v.update_sinking_contours();
|
||||
#endif // ENABLE_SINKING_CONTOURS
|
||||
}
|
||||
|
||||
#if !DISABLE_INSTANCES_SYNCH
|
||||
@ -975,9 +960,6 @@ void Selection::mirror(Axis axis)
|
||||
v.set_instance_mirror(axis, -(*m_volumes)[i]->get_instance_mirror(axis));
|
||||
else if (m_mode == Volume)
|
||||
v.set_volume_mirror(axis, -(*m_volumes)[i]->get_volume_mirror(axis));
|
||||
#if ENABLE_SINKING_CONTOURS
|
||||
v.update_sinking_contours();
|
||||
#endif // ENABLE_SINKING_CONTOURS
|
||||
}
|
||||
|
||||
#if !DISABLE_INSTANCES_SYNCH
|
||||
|
Loading…
Reference in New Issue
Block a user