Painting gizmos: show painted triangles inside modifier meshes
This commit is contained in:
parent
8bcdbb7a60
commit
b155e58a9d
8 changed files with 42 additions and 6 deletions
|
@ -5461,6 +5461,20 @@ void GLCanvas3D::_render_objects() const
|
|||
});
|
||||
}
|
||||
|
||||
// In case a painting gizmo is open, it should render the painted triangles
|
||||
// before transparent objects are rendered. Otherwise they would not be
|
||||
// visible when inside modifier meshes etc.
|
||||
{
|
||||
const GLGizmosManager& gm = get_gizmos_manager();
|
||||
GLGizmosManager::EType type = gm.get_current_type();
|
||||
if (type == GLGizmosManager::FdmSupports
|
||||
|| type == GLGizmosManager::Seam) {
|
||||
shader->stop_using();
|
||||
gm.render_painter_gizmo();
|
||||
shader->start_using();
|
||||
}
|
||||
}
|
||||
|
||||
m_volumes.render(GLVolumeCollection::Transparent, false, wxGetApp().plater()->get_camera().get_view_matrix());
|
||||
shader->stop_using();
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ bool GLGizmoFdmSupports::on_init()
|
|||
|
||||
|
||||
|
||||
void GLGizmoFdmSupports::on_render() const
|
||||
void GLGizmoFdmSupports::render_painter_gizmo() const
|
||||
{
|
||||
const Selection& selection = m_parent.get_selection();
|
||||
|
||||
|
|
|
@ -13,14 +13,14 @@ public:
|
|||
GLGizmoFdmSupports(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id)
|
||||
: GLGizmoPainterBase(parent, icon_filename, sprite_id) {}
|
||||
|
||||
void render_painter_gizmo() const override;
|
||||
|
||||
protected:
|
||||
void on_render_input_window(float x, float y, float bottom_limit) override;
|
||||
std::string on_get_name() const override;
|
||||
|
||||
private:
|
||||
bool on_init() override;
|
||||
void on_render() const override;
|
||||
void on_render_for_picking() const override {}
|
||||
|
||||
void update_model_object() const override;
|
||||
void update_from_model_object() override;
|
||||
|
|
|
@ -59,6 +59,8 @@ class GLGizmoPainterBase : public GLGizmoBase
|
|||
private:
|
||||
ObjectID m_old_mo_id;
|
||||
size_t m_old_volumes_size = 0;
|
||||
virtual void on_render() const {}
|
||||
virtual void on_render_for_picking() const {}
|
||||
|
||||
public:
|
||||
GLGizmoPainterBase(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
|
||||
|
@ -66,6 +68,12 @@ public:
|
|||
void set_painter_gizmo_data(const Selection& selection);
|
||||
bool gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down, bool alt_down, bool control_down);
|
||||
|
||||
// Following function renders the triangles and cursor. Having this separated
|
||||
// from usual on_render method allows to render them before transparent objects,
|
||||
// so they can be seen inside them. The usual on_render is called after all
|
||||
// volumes (including transparent ones) are rendered.
|
||||
virtual void render_painter_gizmo() const = 0;
|
||||
|
||||
protected:
|
||||
void render_triangles(const Selection& selection) const;
|
||||
void render_cursor() const;
|
||||
|
|
|
@ -46,7 +46,7 @@ std::string GLGizmoSeam::on_get_name() const
|
|||
|
||||
|
||||
|
||||
void GLGizmoSeam::on_render() const
|
||||
void GLGizmoSeam::render_painter_gizmo() const
|
||||
{
|
||||
const Selection& selection = m_parent.get_selection();
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ public:
|
|||
GLGizmoSeam(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id)
|
||||
: GLGizmoPainterBase(parent, icon_filename, sprite_id) {}
|
||||
|
||||
void render_painter_gizmo() const override;
|
||||
|
||||
protected:
|
||||
void on_render_input_window(float x, float y, float bottom_limit) override;
|
||||
std::string on_get_name() const override;
|
||||
|
@ -20,8 +22,6 @@ protected:
|
|||
|
||||
private:
|
||||
bool on_init() override;
|
||||
void on_render() const override;
|
||||
void on_render_for_picking() const override {}
|
||||
|
||||
void update_model_object() const override;
|
||||
void update_from_model_object() override;
|
||||
|
|
|
@ -437,6 +437,19 @@ void GLGizmosManager::render_current_gizmo() const
|
|||
m_gizmos[m_current]->render();
|
||||
}
|
||||
|
||||
void GLGizmosManager::render_painter_gizmo() const
|
||||
{
|
||||
// This function shall only be called when current gizmo is
|
||||
// derived from GLGizmoPainterBase.
|
||||
|
||||
if (!m_enabled || m_current == Undefined)
|
||||
return;
|
||||
|
||||
auto* gizmo = dynamic_cast<GLGizmoPainterBase*>(get_current());
|
||||
assert(gizmo); // check the precondition
|
||||
gizmo->render_painter_gizmo();
|
||||
}
|
||||
|
||||
void GLGizmosManager::render_current_gizmo_for_picking_pass() const
|
||||
{
|
||||
if (! m_enabled || m_current == Undefined)
|
||||
|
|
|
@ -212,6 +212,7 @@ public:
|
|||
|
||||
void render_current_gizmo() const;
|
||||
void render_current_gizmo_for_picking_pass() const;
|
||||
void render_painter_gizmo() const;
|
||||
|
||||
void render_overlay() const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue