WIP TreeSupports: Fixed some compiler warnings

This commit is contained in:
Vojtech Bubnik 2022-08-24 14:03:21 +02:00
parent 5b62a4954e
commit 9045ff8f0e
5 changed files with 20 additions and 12 deletions

View File

@ -396,7 +396,6 @@ SupportParameters::SupportParameters(const PrintObject &object)
} }
PrintObjectSupportMaterial::PrintObjectSupportMaterial(const PrintObject *object, const SlicingParameters &slicing_params) : PrintObjectSupportMaterial::PrintObjectSupportMaterial(const PrintObject *object, const SlicingParameters &slicing_params) :
m_object (object),
m_print_config (&object->print()->config()), m_print_config (&object->print()->config()),
m_object_config (&object->config()), m_object_config (&object->config()),
m_slicing_params (slicing_params), m_slicing_params (slicing_params),
@ -795,6 +794,9 @@ public:
) )
{ {
switch (m_style) { switch (m_style) {
case smsTree:
assert(false);
[[fallthrough]];
case smsGrid: case smsGrid:
{ {
#ifdef SUPPORT_USE_AGG_RASTERIZER #ifdef SUPPORT_USE_AGG_RASTERIZER

View File

@ -267,7 +267,6 @@ private:
*/ */
// Following objects are not owned by SupportMaterial class. // Following objects are not owned by SupportMaterial class.
const PrintObject *m_object;
const PrintConfig *m_print_config; const PrintConfig *m_print_config;
const PrintObjectConfig *m_object_config; const PrintObjectConfig *m_object_config;
// Pre-calculated parameters shared between the object slicer and the support generator, // Pre-calculated parameters shared between the object slicer and the support generator,

View File

@ -109,7 +109,9 @@ TreeModelVolumes::TreeModelVolumes(
double progress_multiplier, double progress_offset, const std::vector<Polygons>& additional_excluded_areas) : double progress_multiplier, double progress_offset, const std::vector<Polygons>& additional_excluded_areas) :
// -2 to avoid rounding errors // -2 to avoid rounding errors
m_max_move{ std::max<coord_t>(max_move - 2, 0) }, m_max_move_slow{ std::max<coord_t>(max_move_slow - 2, 0) }, m_max_move{ std::max<coord_t>(max_move - 2, 0) }, m_max_move_slow{ std::max<coord_t>(max_move_slow - 2, 0) },
#ifdef SLIC3R_TREESUPPORTS_PROGRESS
m_progress_multiplier{ progress_multiplier }, m_progress_offset{ progress_offset }, m_progress_multiplier{ progress_multiplier }, m_progress_offset{ progress_offset },
#endif // SLIC3R_TREESUPPORTS_PROGRESS
m_machine_border{ calculateMachineBorderCollision(build_volume.polygon()) } m_machine_border{ calculateMachineBorderCollision(build_volume.polygon()) }
{ {
#if 0 #if 0
@ -428,7 +430,6 @@ void TreeModelVolumes::calculateCollision(const coord_t radius, const LayerIndex
if (const std::vector<Polygons> &outlines = m_layer_outlines[outline_idx].second; ! outlines.empty()) { if (const std::vector<Polygons> &outlines = m_layer_outlines[outline_idx].second; ! outlines.empty()) {
const TreeSupportMeshGroupSettings &settings = m_layer_outlines[outline_idx].first; const TreeSupportMeshGroupSettings &settings = m_layer_outlines[outline_idx].first;
const coord_t layer_height = settings.layer_height; const coord_t layer_height = settings.layer_height;
const bool support_rests_on_model = ! settings.support_material_buildplate_only;
const coord_t z_distance_bottom = settings.support_bottom_distance; const coord_t z_distance_bottom = settings.support_bottom_distance;
const int z_distance_bottom_layers = round_up_divide<int>(z_distance_bottom, layer_height); const int z_distance_bottom_layers = round_up_divide<int>(z_distance_bottom, layer_height);
const int z_distance_top_layers = round_up_divide<int>(settings.support_top_distance, layer_height); const int z_distance_top_layers = round_up_divide<int>(settings.support_top_distance, layer_height);
@ -482,7 +483,7 @@ void TreeModelVolumes::calculateCollision(const coord_t radius, const LayerIndex
if (calculate_placable) { if (calculate_placable) {
// Calculating both the collision areas and placable areas. // Calculating both the collision areas and placable areas.
tbb::parallel_for(tbb::blocked_range<LayerIndex>(std::max(min_layer_last + 1, z_distance_bottom_layers + 1), max_layer_idx + 1), tbb::parallel_for(tbb::blocked_range<LayerIndex>(std::max(min_layer_last + 1, z_distance_bottom_layers + 1), max_layer_idx + 1),
[&collision_areas_offsetted, &anti_overhang = m_anti_overhang, min_layer_bottom, radius, z_distance_bottom_layers, z_distance_top_layers, last, min_resolution = m_min_resolution, &data_placeable, min_layer_last] [&collision_areas_offsetted, &anti_overhang = m_anti_overhang, min_layer_bottom, z_distance_bottom_layers, last, min_resolution = m_min_resolution, &data_placeable, min_layer_last]
(const tbb::blocked_range<LayerIndex>& range) { (const tbb::blocked_range<LayerIndex>& range) {
for (LayerIndex layer_idx = range.begin(); layer_idx != range.end(); ++ layer_idx) { for (LayerIndex layer_idx = range.begin(); layer_idx != range.end(); ++ layer_idx) {
LayerIndex layer_idx_below = layer_idx - (z_distance_bottom_layers + 1) - min_layer_bottom; LayerIndex layer_idx_below = layer_idx - (z_distance_bottom_layers + 1) - min_layer_bottom;

View File

@ -509,6 +509,7 @@ private:
* \brief Does at least one mesh allow support to rest on a model. * \brief Does at least one mesh allow support to rest on a model.
*/ */
bool m_support_rests_on_model; bool m_support_rests_on_model;
#ifdef SLIC3R_TREESUPPORTS_PROGRESS
/*! /*!
* \brief The progress of the precalculate function for communicating it to the progress bar. * \brief The progress of the precalculate function for communicating it to the progress bar.
*/ */
@ -523,6 +524,7 @@ private:
* Required for the progress bar the behave as expected when areas have to be calculated multiple times * Required for the progress bar the behave as expected when areas have to be calculated multiple times
*/ */
double m_progress_offset; double m_progress_offset;
#endif // SLIC3R_TREESUPPORTS_PROGRESS
/*! /*!
* \brief Increase radius in the resulting drawn branches, even if the avoidance does not allow it. Will be cut later to still fit. * \brief Increase radius in the resulting drawn branches, even if the avoidance does not allow it. Will be cut later to still fit.
*/ */

View File

@ -226,6 +226,7 @@ static std::vector<std::pair<TreeSupport::TreeSupportSettings, std::vector<size_
return grouped_meshes; return grouped_meshes;
} }
#if 0
// todo remove as only for debugging relevant // todo remove as only for debugging relevant
[[nodiscard]] static std::string getPolygonAsString(const Polygons& poly) [[nodiscard]] static std::string getPolygonAsString(const Polygons& poly)
{ {
@ -238,6 +239,7 @@ static std::vector<std::pair<TreeSupport::TreeSupportSettings, std::vector<size_
} }
return ret; return ret;
} }
#endif
//todo Remove! Only relevant for public BETA! //todo Remove! Only relevant for public BETA!
static bool inline g_showed_critical_error = false; static bool inline g_showed_critical_error = false;
@ -2122,17 +2124,14 @@ void TreeSupport::increaseAreas(std::unordered_map<SupportElement, Polygons>& to
void TreeSupport::createLayerPathing(std::vector<std::set<SupportElement*>>& move_bounds) void TreeSupport::createLayerPathing(std::vector<std::set<SupportElement*>>& move_bounds)
{ {
const double data_size_inverse = 1 / double(move_bounds.size());
#ifdef SLIC3R_TREESUPPORTS_PROGRESS #ifdef SLIC3R_TREESUPPORTS_PROGRESS
const double data_size_inverse = 1 / double(move_bounds.size());
double progress_total = TREE_PROGRESS_PRECALC_AVO + TREE_PROGRESS_PRECALC_COLL + TREE_PROGRESS_GENERATE_NODES; double progress_total = TREE_PROGRESS_PRECALC_AVO + TREE_PROGRESS_PRECALC_COLL + TREE_PROGRESS_GENERATE_NODES;
#endif // SLIC3R_TREESUPPORTS_PROGRESS #endif // SLIC3R_TREESUPPORTS_PROGRESS
auto dur_inc = std::chrono::duration_values<std::chrono::nanoseconds>::zero(); auto dur_inc = std::chrono::duration_values<std::chrono::nanoseconds>::zero();
auto dur_merge = std::chrono::duration_values<std::chrono::nanoseconds>::zero(); auto dur_merge = std::chrono::duration_values<std::chrono::nanoseconds>::zero();
auto dur_inc_recent = std::chrono::duration_values<std::chrono::nanoseconds>::zero();
auto dur_merge_recent = std::chrono::duration_values<std::chrono::nanoseconds>::zero();
LayerIndex last_merge = move_bounds.size(); LayerIndex last_merge = move_bounds.size();
bool new_element = false; bool new_element = false;
@ -2672,7 +2671,12 @@ void TreeSupport::finalizeInterfaceAndSupportAreas(
support_roof->polygons = diff(support_roof->polygons, support_layer_storage[layer_idx]); support_roof->polygons = diff(support_roof->polygons, support_layer_storage[layer_idx]);
break; break;
//FIXME //FIXME
#if 0 #if 1
case InterfacePreference::INTERFACE_LINES_OVERWRITE_SUPPORT:
case InterfacePreference::SUPPORT_LINES_OVERWRITE_INTERFACE:
assert(false);
[[fallthrough]];
#else
case InterfacePreference::INTERFACE_LINES_OVERWRITE_SUPPORT: case InterfacePreference::INTERFACE_LINES_OVERWRITE_SUPPORT:
{ {
// Hatch the support roof interfaces, offset them by their line width and subtract them from support base. // Hatch the support roof interfaces, offset them by their line width and subtract them from support base.
@ -2790,7 +2794,7 @@ void TreeSupport::drawAreas(
auto t_drop = std::chrono::high_resolution_clock::now(); auto t_drop = std::chrono::high_resolution_clock::now();
// single threaded combining all dropped down support areas to the right layers. ONLY COPYS DATA! // single threaded combining all dropped down support areas to the right layers. ONLY COPYS DATA!
for (coord_t i = 0; i < static_cast<coord_t>(dropped_down_areas.size()); i++) for (coord_t i = 0; i < static_cast<coord_t>(dropped_down_areas.size()); i++)
for (std::pair<LayerIndex, Polygons> pair : dropped_down_areas[i]) for (std::pair<LayerIndex, Polygons> &pair : dropped_down_areas[i])
append(support_layer_storage[pair.first], std::move(pair.second)); append(support_layer_storage[pair.first], std::move(pair.second));
// single threaded combining all support areas to the right layers. ONLY COPYS DATA! // single threaded combining all support areas to the right layers. ONLY COPYS DATA!