Hollowing params: accuracy and smoothness

This commit is contained in:
tamasmeszaros 2019-11-07 09:34:34 +01:00
parent a82f1268f3
commit bc3d22348a
9 changed files with 85 additions and 23 deletions

View file

@ -595,12 +595,14 @@ void GLGizmoHollow::on_update(const UpdateData& data)
}
void GLGizmoHollow::hollow_mesh(float offset)
void GLGizmoHollow::hollow_mesh()
{
TriangleMesh cavity = hollowed_interior(*m_mesh, double(offset));
if (cavity.empty())
return;
TriangleMesh cavity = hollowed_interior(*m_mesh, double(m_offset),
double(m_accuracy),
double(m_smoothness));
if (cavity.empty()) return;
m_cavity_mesh.reset(new TriangleMesh(cavity));
m_cavity_mesh->merge(*m_mesh);
m_cavity_mesh.get()->require_shared_vertices();
@ -692,7 +694,7 @@ RENDER_AGAIN:
if (m_editing_mode) {
if (m_imgui->button(m_desc.at("hollow"))) {
hollow_mesh(m_offset);
hollow_mesh();
}
float diameter_upper_cap = static_cast<ConfigOptionFloat*>(wxGetApp().preset_bundle->sla_prints.get_edited_preset().config.option("support_pillar_diameter"))->value;
@ -748,12 +750,22 @@ RENDER_AGAIN:
remove_all = m_imgui->button(m_desc.at("remove_all"));
m_imgui->disabled_end();
m_imgui->text(" "); // vertical gap
// m_imgui->text(" "); // vertical gap
m_imgui->text("Offset: ");
ImGui::SameLine();
ImGui::SliderFloat(" ", &m_offset, 0.f, 10.f, "%.1f");
// TODO: only in expert mode:
m_imgui->text("Accuracy: ");
ImGui::SameLine();
ImGui::SliderFloat(" ", &m_accuracy, 0.f, 1.f, "%.1f");
// TODO: only in expert mode:
m_imgui->text("Smoothness: ");
ImGui::SameLine();
ImGui::SliderFloat(" ", &m_smoothness, 0.f, 1.f, "%.1f");
}
else { // not in editing mode:
m_imgui->text(m_desc.at("minimal_distance"));

View file

@ -92,7 +92,7 @@ private:
void render_clipping_plane(const Selection& selection) const;
bool is_mesh_update_necessary() const;
void update_mesh();
void hollow_mesh(float offset = 2.f);
void hollow_mesh();
bool unsaved_changes() const;
const TriangleMesh* mesh() const;
@ -108,14 +108,19 @@ private:
mutable std::vector<CacheEntry> m_editing_cache; // a support point and whether it is currently selected
std::vector<sla::SupportPoint> m_normal_cache; // to restore after discarding changes or undo/redo
float m_offset = 2.f;
float m_offset = 2.0f;
float m_clipping_plane_distance = 0.f;
std::unique_ptr<ClippingPlane> m_clipping_plane;
float m_accuracy = 0.5f;
// This map holds all translated description texts, so they can be easily referenced during layout calculations
// etc. When language changes, GUI is recreated and this class constructed again, so the change takes effect.
std::map<std::string, wxString> m_desc;
float m_smoothness = 0.5f;
GLSelectionRectangle m_selection_rectangle;