3DScene reset_object method moved to c++

This commit is contained in:
Enrico Turri 2018-05-18 14:08:59 +02:00
parent 5fc8fdee11
commit a7fc57a176
12 changed files with 135 additions and 31 deletions

View file

@ -395,6 +395,16 @@ void GLCanvas3D::CuttingPlane::render_contour()
::glDisableClientState(GL_VERTEX_ARRAY);
}
GLCanvas3D::LayersEditing::LayersEditing()
: m_enabled(false)
{
}
bool GLCanvas3D::LayersEditing::is_enabled() const
{
return m_enabled;
}
GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, wxGLContext* context)
: m_canvas(canvas)
, m_context(context)
@ -409,10 +419,15 @@ GLCanvas3D::~GLCanvas3D()
_deregister_callbacks();
}
void GLCanvas3D::set_current()
bool GLCanvas3D::set_current()
{
if ((m_canvas != nullptr) && (m_context != nullptr))
{
m_canvas->SetCurrent(*m_context);
return true;
}
return false;
}
bool GLCanvas3D::is_dirty() const
@ -507,6 +522,16 @@ void GLCanvas3D::set_volumes(GLVolumeCollection* volumes)
m_volumes = volumes;
}
void GLCanvas3D::reset_volumes()
{
if (set_current() && (m_volumes != nullptr))
{
m_volumes->release_geometry();
m_volumes->clear();
set_dirty(true);
}
}
void GLCanvas3D::set_bed_shape(const Pointfs& shape)
{
m_bed.set_shape(shape);
@ -652,6 +677,11 @@ BoundingBoxf3 GLCanvas3D::max_bounding_box() const
return bb;
}
bool GLCanvas3D::is_layers_editing_enabled() const
{
return m_layers_editing.is_enabled();
}
void GLCanvas3D::zoom_to_bed()
{
_zoom_to_bounding_box(bed_bounding_box());