diff options
author | bubnikv <bubnikv@gmail.com> | 2019-09-30 17:25:26 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2019-09-30 17:25:26 +0300 |
commit | 272479826f868725fd8523af4e72400fd761beff (patch) | |
tree | 6017f5e525895262964a5131542ead0592948938 /src/slic3r/GUI/3DScene.cpp | |
parent | b425ee50a9ec27984e0e73d8a21673ca2bcdac2c (diff) |
Refactoring of the G-code preview for lower memory allocation
and for separation of concerns:
The final G-code preview no more uses ExtrusionPaths structure
to hold the G-code path data extracted by parsing the G-code.
Instead, the ExtrusionPath class has been trimmed down back to
the original size before the G-code preview was introduced,
and a new GCodePreviewData::Extrusion::Path class was created to hold
the additional path data as the extruder ID, color change ID
and fan speed.
Diffstat (limited to 'src/slic3r/GUI/3DScene.cpp')
-rw-r--r-- | src/slic3r/GUI/3DScene.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index 8094cdde1..0e127a868 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -1717,13 +1717,18 @@ static void thick_point_to_verts(const Vec3crd& point, point_to_indexed_vertex_array(point, width, height, volume.indexed_vertex_array); } +void _3DScene::extrusionentity_to_verts(const Polyline &polyline, float width, float height, float print_z, GLVolume& volume) +{ + if (polyline.size() >= 2) { + size_t num_segments = polyline.size() - 1; + thick_lines_to_verts(polyline.lines(), std::vector<double>(num_segments, width), std::vector<double>(num_segments, height), false, print_z, volume); + } +} + // Fill in the qverts and tverts with quads and triangles for the extrusion_path. void _3DScene::extrusionentity_to_verts(const ExtrusionPath &extrusion_path, float print_z, GLVolume &volume) { - Lines lines = extrusion_path.polyline.lines(); - std::vector<double> widths(lines.size(), extrusion_path.width); - std::vector<double> heights(lines.size(), extrusion_path.height); - thick_lines_to_verts(lines, widths, heights, false, print_z, volume); + extrusionentity_to_verts(extrusion_path.polyline, extrusion_path.width, extrusion_path.height, print_z, volume); } // Fill in the qverts and tverts with quads and triangles for the extrusion_path. |