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)
|
||||
// Adds background texture to toolbars
|
||||
#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_
|
||||
|
||||
|
|
|
@ -426,6 +426,11 @@ std::string log_memory_info()
|
|||
return out;
|
||||
}
|
||||
|
||||
#else
|
||||
std::string log_memory_info()
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
#endif
|
||||
|
||||
}; // namespace Slic3r
|
||||
|
|
|
@ -1162,8 +1162,21 @@ GLCanvas3D::Selection::Selection()
|
|||
, m_valid(false)
|
||||
, 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)
|
||||
{
|
||||
m_volumes = volumes;
|
||||
|
@ -1994,7 +2007,7 @@ void GLCanvas3D::Selection::erase()
|
|||
|
||||
void GLCanvas3D::Selection::render() const
|
||||
{
|
||||
if (is_empty())
|
||||
if (!m_valid || is_empty())
|
||||
return;
|
||||
|
||||
// render cumulative bounding box of selected volumes
|
||||
|
@ -2002,6 +2015,28 @@ void GLCanvas3D::Selection::render() const
|
|||
_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()
|
||||
{
|
||||
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
|
||||
_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
|
||||
// could be invalidated by the following gizmo render methods
|
||||
// this position is used later into on_mouse() to drag the objects
|
||||
|
@ -6138,6 +6177,14 @@ void GLCanvas3D::_render_selection() const
|
|||
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
|
||||
{
|
||||
if (!m_warning_texture_enabled)
|
||||
|
|
|
@ -491,8 +491,15 @@ public:
|
|||
mutable BoundingBoxf3 m_bounding_box;
|
||||
mutable bool m_bounding_box_dirty;
|
||||
|
||||
#if ENABLE_RENDER_SELECTION_CENTER
|
||||
GLUquadricObj* m_quadric;
|
||||
#endif // ENABLE_RENDER_SELECTION_CENTER
|
||||
|
||||
public:
|
||||
Selection();
|
||||
#if ENABLE_RENDER_SELECTION_CENTER
|
||||
~Selection();
|
||||
#endif // ENABLE_RENDER_SELECTION_CENTER
|
||||
|
||||
void set_volumes(GLVolumePtrs* volumes);
|
||||
|
||||
|
@ -567,6 +574,9 @@ public:
|
|||
void erase();
|
||||
|
||||
void render() const;
|
||||
#if ENABLE_RENDER_SELECTION_CENTER
|
||||
void render_center() const;
|
||||
#endif // ENABLE_RENDER_SELECTION_CENTER
|
||||
|
||||
private:
|
||||
void _update_valid();
|
||||
|
@ -1024,6 +1034,9 @@ private:
|
|||
void _render_axes() const;
|
||||
void _render_objects() 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_legend_texture() const;
|
||||
void _render_layer_editing_overlay() const;
|
||||
|
|
Loading…
Reference in a new issue