Fix simplify

This commit is contained in:
Filip Sykala 2021-08-30 10:51:04 +02:00
parent f90b10b63e
commit ffc92090cc
4 changed files with 17 additions and 9 deletions

View File

@ -1,3 +1,6 @@
#ifndef slic3r_quadric_edge_collapse_hpp_
#define slic3r_quadric_edge_collapse_hpp_
// paper: https://people.eecs.berkeley.edu/~jrs/meshpapers/GarlandHeckbert2.pdf
// sum up: https://users.csc.calpoly.edu/~zwood/teaching/csc570/final06/jseeba/
// inspiration: https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification
@ -26,3 +29,4 @@ void its_quadric_edge_collapse(
std::function<void(int)> statusfn = nullptr);
} // namespace Slic3r
#endif // slic3r_quadric_edge_collapse_hpp_

View File

@ -11,10 +11,8 @@
namespace Slic3r::GUI {
GLGizmoSimplify::GLGizmoSimplify(GLCanvas3D & parent,
const std::string &icon_filename,
unsigned int sprite_id)
: GLGizmoBase(parent, icon_filename, -1)
GLGizmoSimplify::GLGizmoSimplify(GLCanvas3D &parent)
: GLGizmoBase(parent, M_ICON_FILENAME, -1)
, m_state(State::settings)
, m_is_valid_result(false)
, m_exist_preview(false)
@ -383,4 +381,7 @@ void GLGizmoSimplify::request_rerender() {
});
}
// any existing icon filename to not influence GUI
const std::string GLGizmoSimplify::M_ICON_FILENAME = "cut.svg";
} // namespace Slic3r::GUI

View File

@ -19,7 +19,7 @@ namespace GUI {
class GLGizmoSimplify : public GLGizmoBase
{
public:
GLGizmoSimplify(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
GLGizmoSimplify(GLCanvas3D& parent);
virtual ~GLGizmoSimplify();
protected:
virtual bool on_init() override;
@ -99,6 +99,8 @@ private:
const std::string tr_preview;
const std::string tr_detail_level;
const std::string tr_decimate_ratio;
static const std::string M_ICON_FILENAME;
};
} // namespace GUI

View File

@ -104,7 +104,7 @@ bool GLGizmosManager::init()
m_gizmos.emplace_back(new GLGizmoFdmSupports(m_parent, "fdm_supports.svg", 7));
m_gizmos.emplace_back(new GLGizmoSeam(m_parent, "seam.svg", 8));
m_gizmos.emplace_back(new GLGizmoMmuSegmentation(m_parent, "mmu_segmentation.svg", 9));
m_gizmos.emplace_back(new GLGizmoSimplify(m_parent, "cut.svg", 10));
m_gizmos.emplace_back(new GLGizmoSimplify(m_parent));
m_common_gizmos_data.reset(new CommonGizmosDataPool(&m_parent));
@ -1133,9 +1133,10 @@ bool GLGizmosManager::generate_icons_texture() const
std::vector<std::string> filenames;
for (size_t idx=0; idx<m_gizmos.size(); ++idx)
{
if (m_gizmos[idx] != nullptr)
auto &gizmo = m_gizmos[idx];
if (gizmo != nullptr)
{
const std::string& icon_filename = m_gizmos[idx]->get_icon_filename();
const std::string& icon_filename = gizmo->get_icon_filename();
if (!icon_filename.empty())
filenames.push_back(path + icon_filename);
}