mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-28 17:31:58 +08:00
Follow-up of f708d9fcb9b84ca98474475152cba45cc793c218 - Fixed rendering of printbed reference axes when any gizmo is open
This commit is contained in:
parent
6f5b71b7df
commit
750e374357
@ -157,26 +157,23 @@ Point Bed3D::point_projection(const Point& point) const
|
|||||||
return m_polygon.point_projection(point);
|
return m_polygon.point_projection(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bed3D::render(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor, bool show_axes, bool show_texture)
|
void Bed3D::render(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor, bool show_texture)
|
||||||
{
|
{
|
||||||
render_internal(canvas, view_matrix, projection_matrix, bottom, scale_factor, show_axes, show_texture, false);
|
render_internal(canvas, view_matrix, projection_matrix, bottom, scale_factor, show_texture, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bed3D::render_for_picking(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor)
|
void Bed3D::render_for_picking(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor)
|
||||||
{
|
{
|
||||||
render_internal(canvas, view_matrix, projection_matrix, bottom, scale_factor, false, false, true);
|
render_internal(canvas, view_matrix, projection_matrix, bottom, scale_factor, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bed3D::render_internal(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor,
|
void Bed3D::render_internal(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor,
|
||||||
bool show_axes, bool show_texture, bool picking)
|
bool show_texture, bool picking)
|
||||||
{
|
{
|
||||||
m_scale_factor = scale_factor;
|
m_scale_factor = scale_factor;
|
||||||
|
|
||||||
glsafe(::glEnable(GL_DEPTH_TEST));
|
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||||
|
|
||||||
if (show_axes)
|
|
||||||
render_axes();
|
|
||||||
|
|
||||||
m_model.model.set_color(picking ? PICKING_MODEL_COLOR : DEFAULT_MODEL_COLOR);
|
m_model.model.set_color(picking ? PICKING_MODEL_COLOR : DEFAULT_MODEL_COLOR);
|
||||||
|
|
||||||
switch (m_type)
|
switch (m_type)
|
||||||
@ -366,9 +363,6 @@ std::tuple<Bed3D::Type, std::string, std::string> Bed3D::detect_type(const Point
|
|||||||
|
|
||||||
void Bed3D::render_axes()
|
void Bed3D::render_axes()
|
||||||
{
|
{
|
||||||
if (!m_show_axes)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (m_build_volume.valid())
|
if (m_build_volume.valid())
|
||||||
#if ENABLE_WORLD_COORDINATE
|
#if ENABLE_WORLD_COORDINATE
|
||||||
m_axes.render(Transform3d::Identity(), 0.25f);
|
m_axes.render(Transform3d::Identity(), 0.25f);
|
||||||
|
@ -84,7 +84,6 @@ private:
|
|||||||
#endif // ENABLE_WORLD_COORDINATE
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
|
|
||||||
float m_scale_factor{ 1.0f };
|
float m_scale_factor{ 1.0f };
|
||||||
bool m_show_axes{ true };
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Bed3D() = default;
|
Bed3D() = default;
|
||||||
@ -112,9 +111,8 @@ public:
|
|||||||
bool contains(const Point& point) const;
|
bool contains(const Point& point) const;
|
||||||
Point point_projection(const Point& point) const;
|
Point point_projection(const Point& point) const;
|
||||||
|
|
||||||
void toggle_show_axes() { m_show_axes = !m_show_axes; }
|
void render(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor, bool show_texture);
|
||||||
|
void render_axes();
|
||||||
void render(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor, bool show_axes, bool show_texture);
|
|
||||||
void render_for_picking(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor);
|
void render_for_picking(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -125,8 +123,7 @@ private:
|
|||||||
void init_contourlines();
|
void init_contourlines();
|
||||||
static std::tuple<Type, std::string, std::string> detect_type(const Pointfs& shape);
|
static std::tuple<Type, std::string, std::string> detect_type(const Pointfs& shape);
|
||||||
void render_internal(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor,
|
void render_internal(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor,
|
||||||
bool show_axes, bool show_texture, bool picking);
|
bool show_texture, bool picking);
|
||||||
void render_axes();
|
|
||||||
void render_system(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, bool show_texture);
|
void render_system(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, bool show_texture);
|
||||||
void render_texture(bool bottom, GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix);
|
void render_texture(bool bottom, GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix);
|
||||||
void render_model(const Transform3d& view_matrix, const Transform3d& projection_matrix);
|
void render_model(const Transform3d& view_matrix, const Transform3d& projection_matrix);
|
||||||
|
@ -1573,8 +1573,10 @@ void GLCanvas3D::render()
|
|||||||
_render_objects(GLVolumeCollection::ERenderType::Opaque);
|
_render_objects(GLVolumeCollection::ERenderType::Opaque);
|
||||||
_render_sla_slices();
|
_render_sla_slices();
|
||||||
_render_selection();
|
_render_selection();
|
||||||
|
if (m_show_bed_axes)
|
||||||
|
_render_bed_axes();
|
||||||
if (is_looking_downward)
|
if (is_looking_downward)
|
||||||
_render_bed(camera.get_view_matrix(), camera.get_projection_matrix(), false, true);
|
_render_bed(camera.get_view_matrix(), camera.get_projection_matrix(), false);
|
||||||
if (!m_main_toolbar.is_enabled())
|
if (!m_main_toolbar.is_enabled())
|
||||||
_render_gcode();
|
_render_gcode();
|
||||||
_render_objects(GLVolumeCollection::ERenderType::Transparent);
|
_render_objects(GLVolumeCollection::ERenderType::Transparent);
|
||||||
@ -1597,7 +1599,7 @@ void GLCanvas3D::render()
|
|||||||
_render_selection_sidebar_hints();
|
_render_selection_sidebar_hints();
|
||||||
_render_current_gizmo();
|
_render_current_gizmo();
|
||||||
if (!is_looking_downward)
|
if (!is_looking_downward)
|
||||||
_render_bed(camera.get_view_matrix(), camera.get_projection_matrix(), true, true);
|
_render_bed(camera.get_view_matrix(), camera.get_projection_matrix(), true);
|
||||||
|
|
||||||
#if ENABLE_RAYCAST_PICKING_DEBUG
|
#if ENABLE_RAYCAST_PICKING_DEBUG
|
||||||
if (m_picking_enabled && !m_mouse.dragging && !m_gizmos.is_dragging() && !m_rectangle_selection.is_dragging())
|
if (m_picking_enabled && !m_mouse.dragging && !m_gizmos.is_dragging() && !m_rectangle_selection.is_dragging())
|
||||||
@ -2355,7 +2357,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
|||||||
#else /* __APPLE__ */
|
#else /* __APPLE__ */
|
||||||
case WXK_CONTROL_D:
|
case WXK_CONTROL_D:
|
||||||
#endif /* __APPLE__ */
|
#endif /* __APPLE__ */
|
||||||
m_bed.toggle_show_axes();
|
m_show_bed_axes = !m_show_bed_axes;
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
break;
|
break;
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
@ -4423,7 +4425,7 @@ void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, const
|
|||||||
glsafe(::glDisable(GL_DEPTH_TEST));
|
glsafe(::glDisable(GL_DEPTH_TEST));
|
||||||
|
|
||||||
if (thumbnail_params.show_bed)
|
if (thumbnail_params.show_bed)
|
||||||
_render_bed(view_matrix, projection_matrix, !camera.is_looking_downward(), false);
|
_render_bed(view_matrix, projection_matrix, !camera.is_looking_downward());
|
||||||
|
|
||||||
// restore background color
|
// restore background color
|
||||||
if (thumbnail_params.transparent_background)
|
if (thumbnail_params.transparent_background)
|
||||||
@ -5477,7 +5479,7 @@ void GLCanvas3D::_render_background()
|
|||||||
glsafe(::glEnable(GL_DEPTH_TEST));
|
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::_render_bed(const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, bool show_axes)
|
void GLCanvas3D::_render_bed(const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom)
|
||||||
{
|
{
|
||||||
float scale_factor = 1.0;
|
float scale_factor = 1.0;
|
||||||
#if ENABLE_RETINA_GL
|
#if ENABLE_RETINA_GL
|
||||||
@ -5491,7 +5493,12 @@ void GLCanvas3D::_render_bed(const Transform3d& view_matrix, const Transform3d&
|
|||||||
&& m_gizmos.get_current_type() != GLGizmosManager::Seam
|
&& m_gizmos.get_current_type() != GLGizmosManager::Seam
|
||||||
&& m_gizmos.get_current_type() != GLGizmosManager::MmuSegmentation);
|
&& m_gizmos.get_current_type() != GLGizmosManager::MmuSegmentation);
|
||||||
|
|
||||||
m_bed.render(*this, view_matrix, projection_matrix, bottom, scale_factor, show_axes, show_texture);
|
m_bed.render(*this, view_matrix, projection_matrix, bottom, scale_factor, show_texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLCanvas3D::_render_bed_axes()
|
||||||
|
{
|
||||||
|
m_bed.render_axes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::_render_bed_for_picking(const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom)
|
void GLCanvas3D::_render_bed_for_picking(const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom)
|
||||||
|
@ -522,6 +522,7 @@ private:
|
|||||||
ECursorType m_cursor_type;
|
ECursorType m_cursor_type;
|
||||||
GLSelectionRectangle m_rectangle_selection;
|
GLSelectionRectangle m_rectangle_selection;
|
||||||
std::vector<int> m_hover_volume_idxs;
|
std::vector<int> m_hover_volume_idxs;
|
||||||
|
bool m_show_bed_axes{ true };
|
||||||
|
|
||||||
// Following variable is obsolete and it should be safe to remove it.
|
// Following variable is obsolete and it should be safe to remove it.
|
||||||
// I just don't want to do it now before a release (Lukas Matena 24.3.2019)
|
// I just don't want to do it now before a release (Lukas Matena 24.3.2019)
|
||||||
@ -984,7 +985,8 @@ private:
|
|||||||
void _picking_pass();
|
void _picking_pass();
|
||||||
void _rectangular_selection_picking_pass();
|
void _rectangular_selection_picking_pass();
|
||||||
void _render_background();
|
void _render_background();
|
||||||
void _render_bed(const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, bool show_axes);
|
void _render_bed(const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom);
|
||||||
|
void _render_bed_axes();
|
||||||
void _render_bed_for_picking(const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom);
|
void _render_bed_for_picking(const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom);
|
||||||
void _render_objects(GLVolumeCollection::ERenderType type);
|
void _render_objects(GLVolumeCollection::ERenderType type);
|
||||||
void _render_gcode();
|
void _render_gcode();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user