mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-22 08:11:11 -06:00
3DScene layer_editing_allowed method moved to c++
This commit is contained in:
parent
c51ce63b9b
commit
a8311bd1bd
9 changed files with 51 additions and 18 deletions
|
@ -1939,6 +1939,11 @@ bool _3DScene::is_picking_enabled(wxGLCanvas* canvas)
|
|||
return s_canvas_mgr.is_picking_enabled(canvas);
|
||||
}
|
||||
|
||||
bool _3DScene::is_layers_editing_allowed(wxGLCanvas* canvas)
|
||||
{
|
||||
return s_canvas_mgr.is_layers_editing_allowed(canvas);
|
||||
}
|
||||
|
||||
bool _3DScene::is_multisample_allowed(wxGLCanvas* canvas)
|
||||
{
|
||||
return s_canvas_mgr.is_multisample_allowed(canvas);
|
||||
|
|
|
@ -598,6 +598,7 @@ public:
|
|||
|
||||
static bool is_layers_editing_enabled(wxGLCanvas* canvas);
|
||||
static bool is_picking_enabled(wxGLCanvas* canvas);
|
||||
static bool is_layers_editing_allowed(wxGLCanvas* canvas);
|
||||
static bool is_multisample_allowed(wxGLCanvas* canvas);
|
||||
|
||||
static void enable_layers_editing(wxGLCanvas* canvas, bool enable);
|
||||
|
|
|
@ -589,7 +589,7 @@ GLCanvas3D::LayersEditing::GLTextureData::GLTextureData(unsigned int id, int wid
|
|||
}
|
||||
|
||||
GLCanvas3D::LayersEditing::LayersEditing()
|
||||
: m_allowed(false)
|
||||
: m_use_legacy_opengl(false)
|
||||
, m_enabled(false)
|
||||
, m_z_texture_id(0)
|
||||
, m_band_width(2.0f)
|
||||
|
@ -636,12 +636,12 @@ bool GLCanvas3D::LayersEditing::init(const std::string& vertex_shader_filename,
|
|||
|
||||
bool GLCanvas3D::LayersEditing::is_allowed() const
|
||||
{
|
||||
return m_allowed;
|
||||
return m_use_legacy_opengl && m_shader.is_initialized();
|
||||
}
|
||||
|
||||
void GLCanvas3D::LayersEditing::set_allowed(bool allowed)
|
||||
void GLCanvas3D::LayersEditing::set_use_legacy_opengl(bool use_legacy_opengl)
|
||||
{
|
||||
m_allowed = allowed;
|
||||
m_use_legacy_opengl = use_legacy_opengl;
|
||||
}
|
||||
|
||||
bool GLCanvas3D::LayersEditing::is_enabled() const
|
||||
|
@ -651,7 +651,7 @@ bool GLCanvas3D::LayersEditing::is_enabled() const
|
|||
|
||||
void GLCanvas3D::LayersEditing::set_enabled(bool enabled)
|
||||
{
|
||||
m_enabled = m_allowed && m_shader.is_initialized() && enabled;
|
||||
m_enabled = is_allowed() && enabled;
|
||||
}
|
||||
|
||||
unsigned int GLCanvas3D::LayersEditing::get_z_texture_id() const
|
||||
|
@ -1030,7 +1030,7 @@ bool GLCanvas3D::init(bool useVBOs, bool use_legacy_opengl)
|
|||
if (useVBOs && !m_layers_editing.init("variable_layer_height.vs", "variable_layer_height.fs"))
|
||||
return false;
|
||||
|
||||
m_layers_editing.set_allowed(!use_legacy_opengl);
|
||||
m_layers_editing.set_use_legacy_opengl(!use_legacy_opengl);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1335,6 +1335,11 @@ bool GLCanvas3D::is_picking_enabled() const
|
|||
return m_picking_enabled;
|
||||
}
|
||||
|
||||
bool GLCanvas3D::is_layers_editing_allowed() const
|
||||
{
|
||||
return m_layers_editing.is_allowed();
|
||||
}
|
||||
|
||||
bool GLCanvas3D::is_multisample_allowed() const
|
||||
{
|
||||
return m_multisample_allowed;
|
||||
|
|
|
@ -211,7 +211,7 @@ public:
|
|||
GLTextureData(unsigned int id, int width, int height);
|
||||
};
|
||||
|
||||
bool m_allowed;
|
||||
bool m_use_legacy_opengl;
|
||||
bool m_enabled;
|
||||
Shader m_shader;
|
||||
unsigned int m_z_texture_id;
|
||||
|
@ -226,7 +226,7 @@ public:
|
|||
bool init(const std::string& vertex_shader_filename, const std::string& fragment_shader_filename);
|
||||
|
||||
bool is_allowed() const;
|
||||
void set_allowed(bool allowed);
|
||||
void set_use_legacy_opengl(bool use_legacy_opengl);
|
||||
|
||||
bool is_enabled() const;
|
||||
void set_enabled(bool enabled);
|
||||
|
@ -360,6 +360,7 @@ public:
|
|||
|
||||
bool is_layers_editing_enabled() const;
|
||||
bool is_picking_enabled() const;
|
||||
bool is_layers_editing_allowed() const;
|
||||
bool is_multisample_allowed() const;
|
||||
|
||||
void enable_layers_editing(bool enable);
|
||||
|
|
|
@ -380,6 +380,12 @@ bool GLCanvas3DManager::is_picking_enabled(wxGLCanvas* canvas) const
|
|||
return (it != m_canvases.end()) ? it->second->is_picking_enabled() : false;
|
||||
}
|
||||
|
||||
bool GLCanvas3DManager::is_layers_editing_allowed(wxGLCanvas* canvas) const
|
||||
{
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
return (it != m_canvases.end()) ? it->second->is_layers_editing_allowed() : false;
|
||||
}
|
||||
|
||||
bool GLCanvas3DManager::is_multisample_allowed(wxGLCanvas* canvas) const
|
||||
{
|
||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||
|
|
|
@ -98,6 +98,7 @@ public:
|
|||
|
||||
bool is_layers_editing_enabled(wxGLCanvas* canvas) const;
|
||||
bool is_picking_enabled(wxGLCanvas* canvas) const;
|
||||
bool is_layers_editing_allowed(wxGLCanvas* canvas) const;
|
||||
bool is_multisample_allowed(wxGLCanvas* canvas) const;
|
||||
|
||||
void enable_layers_editing(wxGLCanvas* canvas, bool enable);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue