GCodeViewer -> Added bounding box to fix camera frustum tighting

This commit is contained in:
enricoturri1966 2020-04-17 13:28:25 +02:00
parent 9776d7c5a1
commit 83816afb3f
3 changed files with 12 additions and 3 deletions
src/slic3r/GUI

View file

@ -104,6 +104,7 @@ void GCodeViewer::reset()
buffer.reset();
}
m_bounding_box = BoundingBoxf3();
m_extrusions.reset_role_visibility_flags();
m_shells.volumes.clear();
m_layers_zs = std::vector<double>();
@ -198,13 +199,14 @@ void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result)
if (m_vertices.vertices_count == 0)
return;
// vertex data -> extract from result
// vertex data / bounding box -> extract from result
std::vector<float> vertices_data;
for (const GCodeProcessor::MoveVertex& move : gcode_result.moves)
{
for (int j = 0; j < 3; ++j)
{
vertices_data.insert(vertices_data.end(), move.position[j]);
m_bounding_box.merge(move.position.cast<double>());
}
}