Remove bloat, add some clipping plane functionality.
This commit is contained in:
parent
878f8a8ead
commit
5aaddd82a4
@ -27,20 +27,8 @@ public:
|
|||||||
Slic3r::GL::Display::set_active(w, h);
|
Slic3r::GL::Display::set_active(w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void repaint(long width, long height) override
|
|
||||||
{
|
|
||||||
Slic3r::GL::Display::repaint(width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
using Slic3r::GL::Display::repaint;
|
|
||||||
|
|
||||||
void swap_buffers() override { SwapBuffers(); }
|
void swap_buffers() override { SwapBuffers(); }
|
||||||
|
|
||||||
void on_scroll(long v, long d, Slic3r::GL::MouseInput::WheelAxis wa) override
|
|
||||||
{
|
|
||||||
Slic3r::GL::Display::on_scroll(v, d, wa);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class...Args>
|
template<class...Args>
|
||||||
Canvas(Args &&...args): wxGLCanvas(std::forward<Args>(args)...)
|
Canvas(Args &&...args): wxGLCanvas(std::forward<Args>(args)...)
|
||||||
{
|
{
|
||||||
|
@ -517,7 +517,13 @@ void Camera::view()
|
|||||||
glRotatef(m_rot.y(), 1.0, 0.0, 0.0);
|
glRotatef(m_rot.y(), 1.0, 0.0, 0.0);
|
||||||
glRotatef(m_rot.x(), 0.0, 0.0, 1.0);
|
glRotatef(m_rot.x(), 0.0, 0.0, 1.0);
|
||||||
|
|
||||||
// glClipPlane()
|
if (m_clip_z > 0.) {
|
||||||
|
GLdouble plane[] = {0., 0., 1., m_clip_z};
|
||||||
|
glClipPlane(GL_CLIP_PLANE0, plane);
|
||||||
|
glEnable(GL_CLIP_PLANE0);
|
||||||
|
} else {
|
||||||
|
glDisable(GL_CLIP_PLANE0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerspectiveCamera::set_screen(long width, long height)
|
void PerspectiveCamera::set_screen(long width, long height)
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
#include "slic3r/GUI/Job.hpp"
|
#include "slic3r/GUI/Job.hpp"
|
||||||
#include "slic3r/GUI/ProgressStatusBar.hpp"
|
#include "slic3r/GUI/ProgressStatusBar.hpp"
|
||||||
//#include "slic3r/GUI/3DEngine.hpp"
|
|
||||||
|
|
||||||
using namespace Slic3r::GL;
|
using namespace Slic3r::GL;
|
||||||
|
|
||||||
@ -59,6 +58,10 @@ class MyFrame: public wxFrame
|
|||||||
m_print = std::make_unique<Slic3r::SLAPrint>();
|
m_print = std::make_unique<Slic3r::SLAPrint>();
|
||||||
m_print->apply(model, cfg);
|
m_print->apply(model, cfg);
|
||||||
|
|
||||||
|
Slic3r::PrintBase::TaskParams params;
|
||||||
|
params.to_object_step = Slic3r::slaposHollowing;
|
||||||
|
m_print->set_task(params);
|
||||||
|
|
||||||
m_print->set_status_callback([this](const Status &status) {
|
m_print->set_status_callback([this](const Status &status) {
|
||||||
update_status(status.percent, status.text);
|
update_status(status.percent, status.text);
|
||||||
});
|
});
|
||||||
@ -77,7 +80,59 @@ class MyFrame: public wxFrame
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size):
|
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void OnExit(wxCommandEvent& /*event*/)
|
||||||
|
{
|
||||||
|
RemoveChild(m_canvas.get());
|
||||||
|
m_canvas->Destroy();
|
||||||
|
Close( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnOpen(wxCommandEvent &/*evt*/)
|
||||||
|
{
|
||||||
|
wxFileDialog dlg(this, "Select project file",
|
||||||
|
wxEmptyString, wxEmptyString, "*.3mf");
|
||||||
|
|
||||||
|
if (dlg.ShowModal() == wxID_OK)
|
||||||
|
{
|
||||||
|
m_ui_job = std::make_unique<SLAJob>(this, dlg.GetPath().ToStdString());
|
||||||
|
m_ui_job->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnShown(wxShowEvent&)
|
||||||
|
{
|
||||||
|
const wxSize ClientSize = GetClientSize();
|
||||||
|
m_canvas->set_active(ClientSize.x, ClientSize.y);
|
||||||
|
|
||||||
|
m_canvas->repaint(ClientSize.x, ClientSize.y);
|
||||||
|
|
||||||
|
// Do the repaint continuously
|
||||||
|
Bind(wxEVT_IDLE, [this](wxIdleEvent &evt) {
|
||||||
|
m_canvas->repaint();
|
||||||
|
evt.RequestMore();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class App : public wxApp {
|
||||||
|
MyFrame *m_frame;
|
||||||
|
public:
|
||||||
|
bool OnInit() override {
|
||||||
|
m_frame = new MyFrame("PrusaSlicer OpenCSG Demo", wxDefaultPosition, wxSize(1024, 768));
|
||||||
|
|
||||||
|
m_frame->Show( true );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
wxIMPLEMENT_APP(App);
|
||||||
|
|
||||||
|
MyFrame::MyFrame(const wxString &title, const wxPoint &pos, const wxSize &size):
|
||||||
wxFrame(nullptr, wxID_ANY, title, pos, size)
|
wxFrame(nullptr, wxID_ANY, title, pos, size)
|
||||||
{
|
{
|
||||||
wxMenu *menuFile = new wxMenu;
|
wxMenu *menuFile = new wxMenu;
|
||||||
@ -161,8 +216,8 @@ public:
|
|||||||
|
|
||||||
auto alg_select = add_combobox("Algorithm", {"Auto", "Goldfeather", "SCS"});
|
auto alg_select = add_combobox("Algorithm", {"Auto", "Goldfeather", "SCS"});
|
||||||
auto depth_select = add_combobox("Depth Complexity", {"Off", "OcclusionQuery", "On"});
|
auto depth_select = add_combobox("Depth Complexity", {"Off", "OcclusionQuery", "On"});
|
||||||
depth_select->Disable();
|
|
||||||
auto optimization_select = add_combobox("Optimization", { "Default", "ForceOn", "On", "Off" });
|
auto optimization_select = add_combobox("Optimization", { "Default", "ForceOn", "On", "Off" });
|
||||||
|
depth_select->Disable();
|
||||||
|
|
||||||
controlsizer->Add(slider_sizer, 0, wxEXPAND);
|
controlsizer->Add(slider_sizer, 0, wxEXPAND);
|
||||||
controlsizer->Add(console_sizer, 1, wxEXPAND);
|
controlsizer->Add(console_sizer, 1, wxEXPAND);
|
||||||
@ -177,6 +232,7 @@ public:
|
|||||||
Bind(wxEVT_MENU, &MyFrame::OnOpen, this, wxID_OPEN);
|
Bind(wxEVT_MENU, &MyFrame::OnOpen, this, wxID_OPEN);
|
||||||
Bind(wxEVT_MENU, &MyFrame::OnExit, this, wxID_EXIT);
|
Bind(wxEVT_MENU, &MyFrame::OnExit, this, wxID_EXIT);
|
||||||
Bind(wxEVT_SHOW, &MyFrame::OnShown, this, GetId());
|
Bind(wxEVT_SHOW, &MyFrame::OnShown, this, GetId());
|
||||||
|
|
||||||
Bind(wxEVT_SLIDER, [this, slider](wxCommandEvent &) {
|
Bind(wxEVT_SLIDER, [this, slider](wxCommandEvent &) {
|
||||||
m_canvas->move_clip_plane(double(slider->GetValue()));
|
m_canvas->move_clip_plane(double(slider->GetValue()));
|
||||||
}, slider->GetId());
|
}, slider->GetId());
|
||||||
@ -229,53 +285,3 @@ public:
|
|||||||
|
|
||||||
m_canvas->set_scene(std::make_shared<Slic3r::GL::Scene>());
|
m_canvas->set_scene(std::make_shared<Slic3r::GL::Scene>());
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void OnExit(wxCommandEvent& /*event*/)
|
|
||||||
{
|
|
||||||
RemoveChild(m_canvas.get());
|
|
||||||
m_canvas->Destroy();
|
|
||||||
Close( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnOpen(wxCommandEvent &/*evt*/)
|
|
||||||
{
|
|
||||||
wxFileDialog dlg(this, "Select project file",
|
|
||||||
wxEmptyString, wxEmptyString, "*.3mf");
|
|
||||||
|
|
||||||
if (dlg.ShowModal() == wxID_OK)
|
|
||||||
{
|
|
||||||
m_ui_job = std::make_unique<SLAJob>(this, dlg.GetPath().ToStdString());
|
|
||||||
m_ui_job->start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnShown(wxShowEvent&)
|
|
||||||
{
|
|
||||||
const wxSize ClientSize = GetClientSize();
|
|
||||||
m_canvas->set_active(ClientSize.x, ClientSize.y);
|
|
||||||
|
|
||||||
m_canvas->repaint(ClientSize.x, ClientSize.y);
|
|
||||||
|
|
||||||
// Do the repaint continuously
|
|
||||||
Bind(wxEVT_IDLE, [this](wxIdleEvent &evt) {
|
|
||||||
m_canvas->repaint();
|
|
||||||
evt.RequestMore();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class App : public wxApp {
|
|
||||||
MyFrame *m_frame;
|
|
||||||
public:
|
|
||||||
bool OnInit() override {
|
|
||||||
|
|
||||||
m_frame = new MyFrame( "PrusaSlicer OpenCSG Demo", wxDefaultPosition, wxSize(1024, 768) );
|
|
||||||
m_frame->Show( true );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
wxIMPLEMENT_APP(App);
|
|
||||||
|
Loading…
Reference in New Issue
Block a user