Merge branch 'tm_openvdb_integration' into lm_tm_hollowing

* Refactor file names in SLA dir
This commit is contained in:
tamasmeszaros 2019-11-11 11:41:14 +01:00
commit c22423a219
55 changed files with 1644 additions and 592 deletions

View file

@ -5362,6 +5362,8 @@ void GLCanvas3D::_load_sla_shells()
unsigned int initial_volumes_count = (unsigned int)m_volumes.volumes.size();
for (const SLAPrintObject::Instance& instance : obj->instances()) {
add_volume(*obj, 0, instance, obj->transformed_mesh(), GLVolume::MODEL_COLOR[0], true);
if (! obj->hollowed_interior_mesh().empty())
add_volume(*obj, -int(slaposHollowing), instance, obj->hollowed_interior_mesh(), GLVolume::MODEL_COLOR[0], false);
// Set the extruder_id and volume_id to achieve the same color as in the 3D scene when
// through the update_volumes_colors_by_extruder() call.
m_volumes.volumes.back()->extruder_id = obj->model_object()->volumes.front()->extruder_id();

View file

@ -98,6 +98,7 @@ ObjectList::ObjectList(wxWindow* parent) :
// ptSLA
CATEGORY_ICON[L("Supports")] = create_scaled_bitmap(nullptr, "support"/*"sla_supports"*/);
CATEGORY_ICON[L("Pad")] = create_scaled_bitmap(nullptr, "pad");
CATEGORY_ICON[L("Hollowing")] = create_scaled_bitmap(nullptr, "hollowing");
}
// create control

View file

@ -566,11 +566,9 @@ void GLGizmoHollow::on_update(const UpdateData& data)
}
}
void GLGizmoHollow::get_hollowing_parameters(TriangleMesh const** object_mesh, float& offset, float& adaptability) const
std::pair<const TriangleMesh *, sla::HollowingConfig> GLGizmoHollow::get_hollowing_parameters() const
{
offset = m_offset;
adaptability = m_adaptability;
*object_mesh = m_mesh;
return std::make_pair(m_mesh, sla::HollowingConfig{double(m_offset), double(m_accuracy), double(m_closing_d)});
}
void GLGizmoHollow::hollow_mesh()
@ -725,9 +723,12 @@ RENDER_AGAIN:
m_imgui->text("Offset: ");
ImGui::SameLine();
ImGui::SliderFloat(" ", &m_offset, 0.f, 5.f, "%.1f");
m_imgui->text("Adaptibility: ");
m_imgui->text("Quality: ");
ImGui::SameLine();
ImGui::SliderFloat(" ", &m_adaptability, 0.f, 1.f, "%.1f");
ImGui::SliderFloat(" ", &m_accuracy, 0.f, 1.f, "%.1f");
m_imgui->text("Closing distance: ");
ImGui::SameLine();
ImGui::SliderFloat(" ", &m_closing_d, 0.f, 10.f, "%.1f");
// Following is rendered in both editing and non-editing mode:
m_imgui->text("");

View file

@ -4,7 +4,7 @@
#include "GLGizmoBase.hpp"
#include "slic3r/GUI/GLSelectionRectangle.hpp"
#include "libslic3r/SLA/SLACommon.hpp"
#include <libslic3r/SLA/Hollowing.hpp>
#include <wx/dialog.h>
#include <cereal/types/vector.hpp>
@ -77,7 +77,7 @@ public:
void delete_selected_points(bool force = false);
ClippingPlane get_sla_clipping_plane() const;
void update_hollowed_mesh(std::unique_ptr<TriangleMesh> mesh);
void get_hollowing_parameters(TriangleMesh const** object_mesh, float& offset, float& adaptability) const;
std::pair<const TriangleMesh *, sla::HollowingConfig> get_hollowing_parameters() const;
bool is_selection_rectangle_dragging() const { return m_selection_rectangle.is_dragging(); }
@ -105,12 +105,13 @@ private:
float m_density_stash = 0.f; // and again
mutable std::vector<bool> m_selected; // which holes are currently selected
float m_offset = 2.f;
float m_adaptability = 1.f;
float m_offset = 2.0f;
float m_accuracy = 0.5f;
float m_closing_d = 2.f;
float m_clipping_plane_distance = 0.f;
std::unique_ptr<ClippingPlane> m_clipping_plane;
// 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;

View file

@ -4,7 +4,7 @@
#include "GLGizmoBase.hpp"
#include "slic3r/GUI/GLSelectionRectangle.hpp"
#include "libslic3r/SLA/SLACommon.hpp"
#include "libslic3r/SLA/Common.hpp"
#include <wx/dialog.h>
#include <cereal/types/vector.hpp>

View file

@ -3,7 +3,7 @@
#include "libslic3r/Point.hpp"
#include "libslic3r/Geometry.hpp"
#include "libslic3r/SLA/SLACommon.hpp"
#include "libslic3r/SLA/EigenMesh3D.hpp"
#include <cfloat>

View file

@ -33,12 +33,13 @@
#include "libslic3r/Format/3mf.hpp"
#include "libslic3r/GCode/PreviewData.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/OpenVDBUtils.hpp"
#include "libslic3r/SLA/Hollowing.hpp"
#include "libslic3r/SLA/Rotfinder.hpp"
#include "libslic3r/SLA/SupportPoint.hpp"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/Print.hpp"
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/SLAPrint.hpp"
#include "libslic3r/SLA/SLARotfinder.hpp"
#include "libslic3r/Utils.hpp"
//#include "libslic3r/ClipperUtils.hpp"
@ -1715,8 +1716,7 @@ struct Plater::priv
private:
std::unique_ptr<TriangleMesh> m_output;
const TriangleMesh* m_object_mesh = nullptr;
float m_offset = 0.f;
float m_adaptability = 0.f;
sla::HollowingConfig m_cfg;
};
// Jobs defined inside the group class will be managed so that only one can
@ -2864,22 +2864,22 @@ void Plater::priv::HollowJob::prepare()
const GLGizmosManager& gizmo_manager = plater().q->canvas3D()->get_gizmos_manager();
const GLGizmoHollow* gizmo_hollow = dynamic_cast<const GLGizmoHollow*>(gizmo_manager.get_current());
assert(gizmo_hollow);
gizmo_hollow->get_hollowing_parameters(&m_object_mesh, m_offset, m_adaptability);
auto hlw_data = gizmo_hollow->get_hollowing_parameters();
m_object_mesh = hlw_data.first;
m_cfg = hlw_data.second;
m_output.reset();
}
void Plater::priv::HollowJob::process()
{
Slic3r::sla::Contour3D imesh{*m_object_mesh};
auto ptr = meshToVolume(imesh, {});
sla::Contour3D omesh = volumeToMesh(*ptr, -m_offset, m_adaptability, true);
sla::JobController ctl;
TriangleMesh omesh = sla::generate_interior(*m_object_mesh, m_cfg, ctl);
if (omesh.empty()) return;
if (omesh.empty())
return;
imesh.merge(omesh);
m_output.reset(new TriangleMesh());
*m_output = sla::to_triangle_mesh(imesh);
m_output.reset(new TriangleMesh{*m_object_mesh});
m_output->merge(omesh);
m_output->require_shared_vertices();
}

View file

@ -496,6 +496,10 @@ const std::vector<std::string>& Preset::sla_print_options()
"pad_object_connector_stride",
"pad_object_connector_width",
"pad_object_connector_penetration",
"hollowing_enable",
"hollowing_min_thickness",
"hollowing_quality",
"hollowing_closing_distance",
"output_filename_format",
"default_sla_print_profile",
"compatible_printers",

View file

@ -3563,6 +3563,13 @@ void TabSLAPrint::build()
optgroup->append_single_option_line("pad_object_connector_stride");
optgroup->append_single_option_line("pad_object_connector_width");
optgroup->append_single_option_line("pad_object_connector_penetration");
page = add_options_page(_(L("Hollowing")), "hollowing");
optgroup = page->new_optgroup(_(L("Hollowing")));
optgroup->append_single_option_line("hollowing_enable");
optgroup->append_single_option_line("hollowing_min_thickness");
optgroup->append_single_option_line("hollowing_quality");
optgroup->append_single_option_line("hollowing_closing_distance");
page = add_options_page(_(L("Advanced")), "wrench");
optgroup = page->new_optgroup(_(L("Slicing")));