3DScene's enable_picking variable moved to c++

This commit is contained in:
Enrico Turri 2018-05-22 09:02:42 +02:00
parent 59af3fb866
commit 451c58d58f
10 changed files with 101 additions and 13 deletions

View file

@ -1898,6 +1898,11 @@ bool _3DScene::is_layers_editing_enabled(wxGLCanvas* canvas)
return s_canvas_mgr.is_layers_editing_enabled(canvas);
}
bool _3DScene::is_picking_enabled(wxGLCanvas* canvas)
{
return s_canvas_mgr.is_picking_enabled(canvas);
}
void _3DScene::enable_warning_texture(wxGLCanvas* canvas, bool enable)
{
s_canvas_mgr.enable_warning_texture(canvas, enable);
@ -1908,6 +1913,11 @@ void _3DScene::enable_legend_texture(wxGLCanvas* canvas, bool enable)
s_canvas_mgr.enable_legend_texture(canvas, enable);
}
void _3DScene::enable_picking(wxGLCanvas* canvas, bool enable)
{
s_canvas_mgr.enable_picking(canvas, enable);
}
void _3DScene::zoom_to_bed(wxGLCanvas* canvas)
{
s_canvas_mgr.zoom_to_bed(canvas);

View file

@ -589,9 +589,11 @@ public:
static void set_camera_target(wxGLCanvas* canvas, const Pointf3* target);
static bool is_layers_editing_enabled(wxGLCanvas* canvas);
static bool is_picking_enabled(wxGLCanvas* canvas);
static void enable_warning_texture(wxGLCanvas* canvas, bool enable);
static void enable_legend_texture(wxGLCanvas* canvas, bool enable);
static void enable_picking(wxGLCanvas* canvas, bool enable);
static void zoom_to_bed(wxGLCanvas* canvas);
static void zoom_to_volumes(wxGLCanvas* canvas);

View file

@ -421,6 +421,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, wxGLContext* context)
, m_apply_zoom_to_volumes_filter(false)
, m_warning_texture_enabled(false)
, m_legend_texture_enabled(false)
, m_picking_enabled(false)
{
}
@ -692,6 +693,11 @@ bool GLCanvas3D::is_layers_editing_enabled() const
return m_layers_editing.is_enabled();
}
bool GLCanvas3D::is_picking_enabled() const
{
return m_picking_enabled;
}
void GLCanvas3D::enable_warning_texture(bool enable)
{
m_warning_texture_enabled = enable;
@ -702,6 +708,11 @@ void GLCanvas3D::enable_legend_texture(bool enable)
m_legend_texture_enabled = enable;
}
void GLCanvas3D::enable_picking(bool enable)
{
m_picking_enabled = enable;
}
void GLCanvas3D::zoom_to_bed()
{
_zoom_to_bounding_box(bed_bounding_box());
@ -793,7 +804,10 @@ void GLCanvas3D::render_volumes(bool fake_colors) const
if (m_volumes == nullptr)
return;
::glEnable(GL_LIGHTING);
if (fake_colors)
::glDisable(GL_LIGHTING);
else
::glEnable(GL_LIGHTING);
// do not cull backfaces to show broken geometry, if any
::glDisable(GL_CULL_FACE);
@ -805,7 +819,7 @@ void GLCanvas3D::render_volumes(bool fake_colors) const
::glEnableClientState(GL_NORMAL_ARRAY);
unsigned int volume_id = 0;
for (const GLVolume* vol : m_volumes->volumes)
for (GLVolume* vol : m_volumes->volumes)
{
if (fake_colors)
{
@ -816,7 +830,10 @@ void GLCanvas3D::render_volumes(bool fake_colors) const
::glColor4f((float)r * INV_255, (float)g * INV_255, (float)b * INV_255, 1.0f);
}
else
{
vol->set_render_color();
::glColor4f(vol->render_color[0], vol->render_color[1], vol->render_color[2], vol->render_color[3]);
}
vol->render();
++volume_id;

View file

@ -156,6 +156,7 @@ private:
bool m_apply_zoom_to_volumes_filter;
bool m_warning_texture_enabled;
bool m_legend_texture_enabled;
bool m_picking_enabled;
PerlCallback m_on_viewport_changed_callback;
@ -217,9 +218,11 @@ public:
BoundingBoxf3 max_bounding_box() const;
bool is_layers_editing_enabled() const;
bool is_picking_enabled() const;
void enable_warning_texture(bool enable);
void enable_legend_texture(bool enable);
void enable_picking(bool enable);
void zoom_to_bed();
void zoom_to_volumes();

View file

@ -355,6 +355,12 @@ bool GLCanvas3DManager::is_layers_editing_enabled(wxGLCanvas* canvas) const
return (it != m_canvases.end()) ? it->second->is_layers_editing_enabled() : false;
}
bool GLCanvas3DManager::is_picking_enabled(wxGLCanvas* canvas) const
{
CanvasesMap::const_iterator it = _get_canvas(canvas);
return (it != m_canvases.end()) ? it->second->is_picking_enabled() : false;
}
void GLCanvas3DManager::enable_warning_texture(wxGLCanvas* canvas, bool enable)
{
CanvasesMap::iterator it = _get_canvas(canvas);
@ -369,6 +375,13 @@ void GLCanvas3DManager::enable_legend_texture(wxGLCanvas* canvas, bool enable)
it->second->enable_legend_texture(enable);
}
void GLCanvas3DManager::enable_picking(wxGLCanvas* canvas, bool enable)
{
CanvasesMap::iterator it = _get_canvas(canvas);
if (it != m_canvases.end())
it->second->enable_picking(enable);
}
void GLCanvas3DManager::zoom_to_bed(wxGLCanvas* canvas)
{
CanvasesMap::iterator it = _get_canvas(canvas);

View file

@ -99,9 +99,11 @@ public:
void set_camera_target(wxGLCanvas* canvas, const Pointf3* target);
bool is_layers_editing_enabled(wxGLCanvas* canvas) const;
bool is_picking_enabled(wxGLCanvas* canvas) const;
void enable_warning_texture(wxGLCanvas* canvas, bool enable);
void enable_legend_texture(wxGLCanvas* canvas, bool enable);
void enable_picking(wxGLCanvas* canvas, bool enable);
void zoom_to_bed(wxGLCanvas* canvas);
void zoom_to_volumes(wxGLCanvas* canvas);