Merge branch 'master' of https://github.com/prusa3d/Slic3r
This commit is contained in:
commit
e498e3f37c
4 changed files with 68 additions and 1 deletions
|
@ -40,6 +40,8 @@
|
||||||
#define ENABLE_NONCUSTOM_DATA_VIEW_RENDERING (0 && ENABLE_1_42_0)
|
#define ENABLE_NONCUSTOM_DATA_VIEW_RENDERING (0 && ENABLE_1_42_0)
|
||||||
// Adds background texture to toolbars
|
// Adds background texture to toolbars
|
||||||
#define ENABLE_TOOLBAR_BACKGROUND_TEXTURE (1 && ENABLE_1_42_0)
|
#define ENABLE_TOOLBAR_BACKGROUND_TEXTURE (1 && ENABLE_1_42_0)
|
||||||
|
// Renders a small sphere in the center of the bounding box of the current selection when no gizmo is active
|
||||||
|
#define ENABLE_RENDER_SELECTION_CENTER (0 && ENABLE_1_42_0)
|
||||||
|
|
||||||
#endif // _technologies_h_
|
#endif // _technologies_h_
|
||||||
|
|
||||||
|
|
|
@ -426,6 +426,11 @@ std::string log_memory_info()
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
std::string log_memory_info()
|
||||||
|
{
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}; // namespace Slic3r
|
}; // namespace Slic3r
|
||||||
|
|
|
@ -1162,8 +1162,21 @@ GLCanvas3D::Selection::Selection()
|
||||||
, m_valid(false)
|
, m_valid(false)
|
||||||
, m_bounding_box_dirty(true)
|
, m_bounding_box_dirty(true)
|
||||||
{
|
{
|
||||||
|
#if ENABLE_RENDER_SELECTION_CENTER
|
||||||
|
m_quadric = ::gluNewQuadric();
|
||||||
|
if (m_quadric != nullptr)
|
||||||
|
::gluQuadricDrawStyle(m_quadric, GLU_FILL);
|
||||||
|
#endif // ENABLE_RENDER_SELECTION_CENTER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLE_RENDER_SELECTION_CENTER
|
||||||
|
GLCanvas3D::Selection::~Selection()
|
||||||
|
{
|
||||||
|
if (m_quadric != nullptr)
|
||||||
|
::gluDeleteQuadric(m_quadric);
|
||||||
|
}
|
||||||
|
#endif // ENABLE_RENDER_SELECTION_CENTER
|
||||||
|
|
||||||
void GLCanvas3D::Selection::set_volumes(GLVolumePtrs* volumes)
|
void GLCanvas3D::Selection::set_volumes(GLVolumePtrs* volumes)
|
||||||
{
|
{
|
||||||
m_volumes = volumes;
|
m_volumes = volumes;
|
||||||
|
@ -1994,7 +2007,7 @@ void GLCanvas3D::Selection::erase()
|
||||||
|
|
||||||
void GLCanvas3D::Selection::render() const
|
void GLCanvas3D::Selection::render() const
|
||||||
{
|
{
|
||||||
if (is_empty())
|
if (!m_valid || is_empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// render cumulative bounding box of selected volumes
|
// render cumulative bounding box of selected volumes
|
||||||
|
@ -2002,6 +2015,28 @@ void GLCanvas3D::Selection::render() const
|
||||||
_render_synchronized_volumes();
|
_render_synchronized_volumes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLE_RENDER_SELECTION_CENTER
|
||||||
|
void GLCanvas3D::Selection::render_center() const
|
||||||
|
{
|
||||||
|
if (!m_valid || is_empty() || (m_quadric == nullptr))
|
||||||
|
return;
|
||||||
|
|
||||||
|
const Vec3d& center = get_bounding_box().center();
|
||||||
|
|
||||||
|
::glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
::glEnable(GL_LIGHTING);
|
||||||
|
|
||||||
|
::glColor3f(1.0f, 1.0f, 1.0f);
|
||||||
|
::glPushMatrix();
|
||||||
|
::glTranslated(center(0), center(1), center(2));
|
||||||
|
::gluSphere(m_quadric, 0.75, 32, 32);
|
||||||
|
::glPopMatrix();
|
||||||
|
|
||||||
|
::glDisable(GL_LIGHTING);
|
||||||
|
}
|
||||||
|
#endif // ENABLE_RENDER_SELECTION_CENTER
|
||||||
|
|
||||||
void GLCanvas3D::Selection::_update_valid()
|
void GLCanvas3D::Selection::_update_valid()
|
||||||
{
|
{
|
||||||
m_valid = (m_volumes != nullptr) && (m_model != nullptr);
|
m_valid = (m_volumes != nullptr) && (m_model != nullptr);
|
||||||
|
@ -4097,6 +4132,10 @@ void GLCanvas3D::render()
|
||||||
if (!is_custom_bed) // textured bed needs to be rendered after objects
|
if (!is_custom_bed) // textured bed needs to be rendered after objects
|
||||||
_render_bed(theta);
|
_render_bed(theta);
|
||||||
|
|
||||||
|
#if ENABLE_RENDER_SELECTION_CENTER
|
||||||
|
_render_selection_center();
|
||||||
|
#endif // ENABLE_RENDER_SELECTION_CENTER
|
||||||
|
|
||||||
// we need to set the mouse's scene position here because the depth buffer
|
// we need to set the mouse's scene position here because the depth buffer
|
||||||
// could be invalidated by the following gizmo render methods
|
// could be invalidated by the following gizmo render methods
|
||||||
// this position is used later into on_mouse() to drag the objects
|
// this position is used later into on_mouse() to drag the objects
|
||||||
|
@ -6138,6 +6177,14 @@ void GLCanvas3D::_render_selection() const
|
||||||
m_selection.render();
|
m_selection.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLE_RENDER_SELECTION_CENTER
|
||||||
|
void GLCanvas3D::_render_selection_center() const
|
||||||
|
{
|
||||||
|
if (!m_gizmos.is_running())
|
||||||
|
m_selection.render_center();
|
||||||
|
}
|
||||||
|
#endif // ENABLE_RENDER_SELECTION_CENTER
|
||||||
|
|
||||||
void GLCanvas3D::_render_warning_texture() const
|
void GLCanvas3D::_render_warning_texture() const
|
||||||
{
|
{
|
||||||
if (!m_warning_texture_enabled)
|
if (!m_warning_texture_enabled)
|
||||||
|
|
|
@ -491,8 +491,15 @@ public:
|
||||||
mutable BoundingBoxf3 m_bounding_box;
|
mutable BoundingBoxf3 m_bounding_box;
|
||||||
mutable bool m_bounding_box_dirty;
|
mutable bool m_bounding_box_dirty;
|
||||||
|
|
||||||
|
#if ENABLE_RENDER_SELECTION_CENTER
|
||||||
|
GLUquadricObj* m_quadric;
|
||||||
|
#endif // ENABLE_RENDER_SELECTION_CENTER
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Selection();
|
Selection();
|
||||||
|
#if ENABLE_RENDER_SELECTION_CENTER
|
||||||
|
~Selection();
|
||||||
|
#endif // ENABLE_RENDER_SELECTION_CENTER
|
||||||
|
|
||||||
void set_volumes(GLVolumePtrs* volumes);
|
void set_volumes(GLVolumePtrs* volumes);
|
||||||
|
|
||||||
|
@ -567,6 +574,9 @@ public:
|
||||||
void erase();
|
void erase();
|
||||||
|
|
||||||
void render() const;
|
void render() const;
|
||||||
|
#if ENABLE_RENDER_SELECTION_CENTER
|
||||||
|
void render_center() const;
|
||||||
|
#endif // ENABLE_RENDER_SELECTION_CENTER
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _update_valid();
|
void _update_valid();
|
||||||
|
@ -1024,6 +1034,9 @@ private:
|
||||||
void _render_axes() const;
|
void _render_axes() const;
|
||||||
void _render_objects() const;
|
void _render_objects() const;
|
||||||
void _render_selection() const;
|
void _render_selection() const;
|
||||||
|
#if ENABLE_RENDER_SELECTION_CENTER
|
||||||
|
void _render_selection_center() const;
|
||||||
|
#endif // ENABLE_RENDER_SELECTION_CENTER
|
||||||
void _render_warning_texture() const;
|
void _render_warning_texture() const;
|
||||||
void _render_legend_texture() const;
|
void _render_legend_texture() const;
|
||||||
void _render_layer_editing_overlay() const;
|
void _render_layer_editing_overlay() const;
|
||||||
|
|
Loading…
Reference in a new issue