mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 04:35:54 +08:00
Fixed camera frustum for preview to take in account for shells
This commit is contained in:
parent
d48b01d939
commit
61c8940cf6
@ -892,8 +892,8 @@ void GCodeViewer::reset()
|
|||||||
buffer.reset();
|
buffer.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_paths_bounding_box = BoundingBoxf3();
|
m_paths_bounding_box.reset();
|
||||||
m_max_bounding_box = BoundingBoxf3();
|
m_max_bounding_box.reset();
|
||||||
m_max_print_height = 0.0f;
|
m_max_print_height = 0.0f;
|
||||||
m_tool_colors = std::vector<ColorRGBA>();
|
m_tool_colors = std::vector<ColorRGBA>();
|
||||||
m_extruders_count = 0;
|
m_extruders_count = 0;
|
||||||
@ -1541,6 +1541,8 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||||||
m_statistics.results_time = gcode_result.time;
|
m_statistics.results_time = gcode_result.time;
|
||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
|
|
||||||
|
m_max_bounding_box.reset();
|
||||||
|
|
||||||
m_moves_count = gcode_result.moves.size();
|
m_moves_count = gcode_result.moves.size();
|
||||||
if (m_moves_count == 0)
|
if (m_moves_count == 0)
|
||||||
return;
|
return;
|
||||||
@ -1566,10 +1568,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set approximate max bounding box (take in account also the tool marker)
|
|
||||||
m_max_bounding_box = m_paths_bounding_box;
|
|
||||||
m_max_bounding_box.merge(m_paths_bounding_box.max + m_sequential_view.marker.get_bounding_box().size().z() * Vec3d::UnitZ());
|
|
||||||
|
|
||||||
if (wxGetApp().is_editor())
|
if (wxGetApp().is_editor())
|
||||||
m_contained_in_bed = wxGetApp().plater()->build_volume().all_paths_inside(gcode_result, m_paths_bounding_box);
|
m_contained_in_bed = wxGetApp().plater()->build_volume().all_paths_inside(gcode_result, m_paths_bounding_box);
|
||||||
|
|
||||||
@ -2289,6 +2287,13 @@ void GCodeViewer::load_shells(const Print& print)
|
|||||||
volume->force_native_color = true;
|
volume->force_native_color = true;
|
||||||
volume->set_render_color(true);
|
volume->set_render_color(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_shells_bounding_box.reset();
|
||||||
|
for (const GLVolume* volume : m_shells.volumes.volumes) {
|
||||||
|
m_shells_bounding_box.merge(volume->transformed_bounding_box());
|
||||||
|
}
|
||||||
|
|
||||||
|
m_max_bounding_box.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last) const
|
void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last) const
|
||||||
|
@ -752,7 +752,9 @@ private:
|
|||||||
std::vector<TBuffer> m_buffers{ static_cast<size_t>(EMoveType::Extrude) };
|
std::vector<TBuffer> m_buffers{ static_cast<size_t>(EMoveType::Extrude) };
|
||||||
// bounding box of toolpaths
|
// bounding box of toolpaths
|
||||||
BoundingBoxf3 m_paths_bounding_box;
|
BoundingBoxf3 m_paths_bounding_box;
|
||||||
// bounding box of toolpaths + marker tools
|
// bounding box of shells
|
||||||
|
BoundingBoxf3 m_shells_bounding_box;
|
||||||
|
// bounding box of toolpaths + marker tools + shells
|
||||||
BoundingBoxf3 m_max_bounding_box;
|
BoundingBoxf3 m_max_bounding_box;
|
||||||
float m_max_print_height{ 0.0f };
|
float m_max_print_height{ 0.0f };
|
||||||
std::vector<ColorRGBA> m_tool_colors;
|
std::vector<ColorRGBA> m_tool_colors;
|
||||||
@ -811,7 +813,16 @@ public:
|
|||||||
bool can_export_toolpaths() const;
|
bool can_export_toolpaths() const;
|
||||||
|
|
||||||
const BoundingBoxf3& get_paths_bounding_box() const { return m_paths_bounding_box; }
|
const BoundingBoxf3& get_paths_bounding_box() const { return m_paths_bounding_box; }
|
||||||
const BoundingBoxf3& get_max_bounding_box() const { return m_max_bounding_box; }
|
const BoundingBoxf3& get_shells_bounding_box() const { return m_shells_bounding_box; }
|
||||||
|
const BoundingBoxf3& get_max_bounding_box() const {
|
||||||
|
BoundingBoxf3& max_bounding_box = const_cast<BoundingBoxf3&>(m_max_bounding_box);
|
||||||
|
if (!max_bounding_box.defined) {
|
||||||
|
max_bounding_box = m_shells_bounding_box;
|
||||||
|
max_bounding_box.merge(m_paths_bounding_box);
|
||||||
|
max_bounding_box.merge(m_paths_bounding_box.max + m_sequential_view.marker.get_bounding_box().size().z() * Vec3d::UnitZ());
|
||||||
|
}
|
||||||
|
return m_max_bounding_box;
|
||||||
|
}
|
||||||
const std::vector<double>& get_layers_zs() const { return m_layers.get_zs(); }
|
const std::vector<double>& get_layers_zs() const { return m_layers.get_zs(); }
|
||||||
|
|
||||||
const SequentialView& get_sequential_view() const { return m_sequential_view; }
|
const SequentialView& get_sequential_view() const { return m_sequential_view; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user