New gcode visualization integration - Removed dependency on imgui from new visualizer

This commit is contained in:
enricoturri1966 2023-11-23 10:43:36 +01:00 committed by Lukas Matena
parent 1ee29acc4f
commit 0feb93206b
11 changed files with 378 additions and 209 deletions

View File

@ -268,10 +268,6 @@ static GCodeInputData convert(const Slic3r::GCodeProcessorResult& result)
} }
ret.vertices.shrink_to_fit(); ret.vertices.shrink_to_fit();
for (size_t i = 0; i < static_cast<size_t>(Slic3r::PrintEstimatedStatistics::ETimeMode::Count); ++i) {
ret.times[static_cast<size_t>(convert(static_cast<Slic3r::PrintEstimatedStatistics::ETimeMode>(i)))] = result.print_statistics.modes[i].time;
}
return ret; return ret;
} }
@ -1484,7 +1480,15 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr
m_print_statistics = gcode_result.print_statistics; m_print_statistics = gcode_result.print_statistics;
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#if !ENABLE_NEW_GCODE_VIEWER #if ENABLE_NEW_GCODE_VIEWER
PrintEstimatedStatistics::ETimeMode time_mode = convert(m_new_viewer.get_time_mode());
if (m_new_viewer.get_time_mode() != libvgcode::ETimeMode::Normal) {
const float time = m_print_statistics.modes[static_cast<size_t>(time_mode)].time;
if (time == 0.0f ||
short_time(get_time_dhms(time)) == short_time(get_time_dhms(m_print_statistics.modes[static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Normal)].time)))
m_new_viewer.set_time_mode(libvgcode::convert(PrintEstimatedStatistics::ETimeMode::Normal));
}
#else
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
if (m_time_estimate_mode != PrintEstimatedStatistics::ETimeMode::Normal) { if (m_time_estimate_mode != PrintEstimatedStatistics::ETimeMode::Normal) {
const float time = m_print_statistics.modes[static_cast<size_t>(m_time_estimate_mode)].time; const float time = m_print_statistics.modes[static_cast<size_t>(m_time_estimate_mode)].time;
@ -1493,7 +1497,7 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr
m_time_estimate_mode = PrintEstimatedStatistics::ETimeMode::Normal; m_time_estimate_mode = PrintEstimatedStatistics::ETimeMode::Normal;
} }
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#endif // !ENABLE_NEW_GCODE_VIEWER #endif // ENABLE_NEW_GCODE_VIEWER
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
m_conflict_result = gcode_result.conflict_result; m_conflict_result = gcode_result.conflict_result;
@ -1705,19 +1709,8 @@ void GCodeViewer::render()
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#if ENABLE_NEW_GCODE_VIEWER #if ENABLE_NEW_GCODE_VIEWER
if (m_use_new_viewer) { if (m_use_new_viewer)
const Camera& camera = wxGetApp().plater()->get_camera(); render_new_toolpaths();
libvgcode::Mat4x4 converted_view_matrix = libvgcode::convert(static_cast<Matrix4f>(camera.get_view_matrix().matrix().cast<float>()));
libvgcode::Mat4x4 converted_projetion_matrix = libvgcode::convert(static_cast<Matrix4f>(camera.get_projection_matrix().matrix().cast<float>()));
#if !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
libvgcode::Vec3 converted_tool_marker_position = libvgcode::convert(m_sequential_view.current_position);
m_new_viewer.set_cog_marker_scale_factor(m_cog_marker_fixed_screen_size ? 10.0f * m_cog_marker_size * camera.get_inv_zoom() : m_cog_marker_size);
m_new_viewer.enable_tool_marker(m_sequential_view.current.last != m_sequential_view.endpoints.last);
m_new_viewer.set_tool_marker_position(converted_tool_marker_position);
m_new_viewer.set_tool_marker_scale_factor(m_tool_marker_fixed_screen_size ? 10.0f * m_tool_marker_size * camera.get_inv_zoom() : m_tool_marker_size);
#endif // !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
m_new_viewer.render(converted_view_matrix, converted_projetion_matrix);
}
else else
#endif // ENABLE_NEW_GCODE_VIEWER #endif // ENABLE_NEW_GCODE_VIEWER
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ -3902,6 +3895,151 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
#endif // ENABLE_GCODE_VIEWER_STATISTICS #endif // ENABLE_GCODE_VIEWER_STATISTICS
} }
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#if ENABLE_NEW_GCODE_VIEWER
void GCodeViewer::render_new_toolpaths()
{
const Camera& camera = wxGetApp().plater()->get_camera();
libvgcode::Mat4x4 converted_view_matrix = libvgcode::convert(static_cast<Matrix4f>(camera.get_view_matrix().matrix().cast<float>()));
libvgcode::Mat4x4 converted_projetion_matrix = libvgcode::convert(static_cast<Matrix4f>(camera.get_projection_matrix().matrix().cast<float>()));
#if !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
libvgcode::Vec3 converted_tool_marker_position = libvgcode::convert(m_sequential_view.current_position);
m_new_viewer.set_cog_marker_scale_factor(m_cog_marker_fixed_screen_size ? 10.0f * m_cog_marker_size * camera.get_inv_zoom() : m_cog_marker_size);
m_new_viewer.enable_tool_marker(m_sequential_view.current.last != m_sequential_view.endpoints.last);
m_new_viewer.set_tool_marker_position(converted_tool_marker_position);
m_new_viewer.set_tool_marker_scale_factor(m_tool_marker_fixed_screen_size ? 10.0f * m_tool_marker_size * camera.get_inv_zoom() : m_tool_marker_size);
#endif // !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
m_new_viewer.render(converted_view_matrix, converted_projetion_matrix);
#if ENABLE_NEW_GCODE_VIEWER_DEBUG
Slic3r::GUI::ImGuiWrapper& imgui = *Slic3r::GUI::wxGetApp().imgui();
imgui.begin(std::string("LibVGCode Viewer Debug"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
if (ImGui::BeginTable("Data", 2)) {
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "# vertices");
ImGui::TableSetColumnIndex(1);
imgui.text(std::to_string(m_new_viewer.get_vertices_count()));
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "# enabled lines");
ImGui::TableSetColumnIndex(1);
const std::array<uint32_t, 2>& enabled_segments_range = m_new_viewer.get_enabled_segments_range();
imgui.text(std::to_string(m_new_viewer.get_enabled_segments_count()) + " [" + std::to_string(enabled_segments_range[0]) +
"-" + std::to_string(enabled_segments_range[1]) + "]");
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "# enabled options");
ImGui::TableSetColumnIndex(1);
const std::array<uint32_t, 2>& enabled_options_range = m_new_viewer.get_enabled_options_range();
imgui.text(std::to_string(m_new_viewer.get_enabled_options_count()) + " [" + std::to_string(enabled_options_range[0]) +
"-" + std::to_string(enabled_options_range[1]) + "]");
ImGui::Separator();
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "layers range");
ImGui::TableSetColumnIndex(1);
const std::array<uint32_t, 2>& layers_range = m_new_viewer.get_layers_range();
imgui.text(std::to_string(layers_range[0]) + " - " + std::to_string(layers_range[1]));
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "view range (current)");
ImGui::TableSetColumnIndex(1);
const std::array<uint32_t, 2>& current_view_range = m_new_viewer.get_view_current_range();
imgui.text(std::to_string(current_view_range[0]) + " - " + std::to_string(current_view_range[1]));
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "view range (global)");
ImGui::TableSetColumnIndex(1);
const std::array<uint32_t, 2>& global_view_range = m_new_viewer.get_view_global_range();
imgui.text(std::to_string(global_view_range[0]) + " - " + std::to_string(global_view_range[1]));
auto add_range_property_row = [&imgui](const std::string& label, const std::array<float, 2>& range) {
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, label);
ImGui::TableSetColumnIndex(1);
char buf[64];
sprintf(buf, "%.3f - %.3f", range[0], range[1]);
imgui.text(buf);
};
add_range_property_row("height range", m_new_viewer.get_height_range());
add_range_property_row("width range", m_new_viewer.get_width_range());
add_range_property_row("speed range", m_new_viewer.get_speed_range());
add_range_property_row("fan speed range", m_new_viewer.get_fan_speed_range());
add_range_property_row("temperature range", m_new_viewer.get_temperature_range());
add_range_property_row("volumetric rate range", m_new_viewer.get_volumetric_rate_range());
add_range_property_row("layer time linear range", m_new_viewer.get_layer_time_range(libvgcode::ColorRange::EType::Linear));
add_range_property_row("layer time logarithmic range", m_new_viewer.get_layer_time_range(libvgcode::ColorRange::EType::Logarithmic));
ImGui::EndTable();
#if !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
ImGui::Separator();
if (ImGui::BeginTable("Cog", 2)) {
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "Cog marker scale factor");
ImGui::TableSetColumnIndex(1);
imgui.text(std::to_string(get_cog_marker_scale_factor()));
ImGui::EndTable();
}
ImGui::Separator();
if (ImGui::BeginTable("Tool", 2)) {
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "Tool marker scale factor");
ImGui::TableSetColumnIndex(1);
imgui.text(std::to_string(m_new_viewer.get_tool_marker_scale_factor()));
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "Tool marker z offset");
ImGui::TableSetColumnIndex(1);
float tool_z_offset = m_new_viewer.get_tool_marker_offset_z();
if (imgui.slider_float("##ToolZOffset", &tool_z_offset, 0.0f, 1.0f))
m_new_viewer.set_tool_marker_offset_z(tool_z_offset);
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "Tool marker color");
ImGui::TableSetColumnIndex(1);
libvgcode::Color color = m_new_viewer.get_tool_marker_color();
if (ImGui::ColorPicker3("##ToolColor", color.data()))
m_new_viewer.set_tool_marker_color(color);
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "Tool marker alpha");
ImGui::TableSetColumnIndex(1);
float tool_alpha = m_new_viewer.get_tool_marker_alpha();
if (imgui.slider_float("##ToolAlpha", &tool_alpha, 0.25f, 0.75f))
m_new_viewer.set_tool_marker_alpha(tool_alpha);
ImGui::EndTable();
}
#endif // !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
}
imgui.end();
#endif // ENABLE_NEW_GCODE_VIEWER_DEBUG
}
#endif // ENABLE_NEW_GCODE_VIEWER
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
void GCodeViewer::render_toolpaths() void GCodeViewer::render_toolpaths()
{ {
const Camera& camera = wxGetApp().plater()->get_camera(); const Camera& camera = wxGetApp().plater()->get_camera();

View File

@ -1120,6 +1120,11 @@ public:
private: private:
void load_toolpaths(const GCodeProcessorResult& gcode_result); void load_toolpaths(const GCodeProcessorResult& gcode_result);
void load_wipetower_shell(const Print& print); void load_wipetower_shell(const Print& print);
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#if ENABLE_NEW_GCODE_VIEWER
void render_new_toolpaths();
#endif // ENABLE_NEW_GCODE_VIEWER
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
void render_toolpaths(); void render_toolpaths();
void render_shells(); void render_shells();
void render_legend(float& legend_height); void render_legend(float& legend_height);

View File

@ -26,9 +26,6 @@ ColorRange::ColorRange(EType type)
void ColorRange::update(float value) void ColorRange::update(float value)
{ {
if (std::abs(value - m_range[0]) > 0.001 && std::abs(value - m_range[1]) > 0.001)
++m_count;
m_range[0] = std::min(m_range[0], value); m_range[0] = std::min(m_range[0], value);
m_range[1] = std::max(m_range[1], value); m_range[1] = std::max(m_range[1], value);
} }
@ -36,7 +33,6 @@ void ColorRange::update(float value)
void ColorRange::reset() void ColorRange::reset()
{ {
m_range = { FLT_MAX, -FLT_MAX }; m_range = { FLT_MAX, -FLT_MAX };
m_count = 0;
} }
static float step_size(const std::array<float, 2>& range, ColorRange::EType type) static float step_size(const std::array<float, 2>& range, ColorRange::EType type)
@ -85,17 +81,10 @@ Color ColorRange::get_color_at(float value) const
return lerp(Ranges_Colors[color_low_idx], Ranges_Colors[color_high_idx], global_t - static_cast<float>(color_low_idx)); return lerp(Ranges_Colors[color_low_idx], Ranges_Colors[color_high_idx], global_t - static_cast<float>(color_low_idx));
} }
unsigned int ColorRange::get_count() const
{
return m_count;
}
#if ENABLE_NEW_GCODE_VIEWER_DEBUG
const std::array<float, 2>& ColorRange::get_range() const const std::array<float, 2>& ColorRange::get_range() const
{ {
return m_range; return m_range;
} }
#endif // ENABLE_NEW_GCODE_VIEWER_DEBUG
} // namespace libvgcode } // namespace libvgcode

View File

@ -14,11 +14,10 @@
namespace libvgcode { namespace libvgcode {
// Alias for GCodeViewer::Extrusion::Range
class ColorRange class ColorRange
{ {
public: public:
enum class EType : unsigned char enum class EType : uint8_t
{ {
Linear, Linear,
Logarithmic, Logarithmic,
@ -32,20 +31,17 @@ public:
EType get_type() const; EType get_type() const;
Color get_color_at(float value) const; Color get_color_at(float value) const;
unsigned int get_count() const;
#if ENABLE_NEW_GCODE_VIEWER_DEBUG
const std::array<float, 2>& get_range() const; const std::array<float, 2>& get_range() const;
#endif // ENABLE_NEW_GCODE_VIEWER_DEBUG
private: private:
EType m_type{ EType::Linear }; EType m_type{ EType::Linear };
// [0] = min, [1] = max // [0] = min, [1] = max
std::array<float, 2> m_range{ FLT_MAX, -FLT_MAX }; std::array<float, 2> m_range{ FLT_MAX, -FLT_MAX };
// updates counter
unsigned int m_count{ 0 };
}; };
static constexpr size_t Color_Range_Types_Count = static_cast<size_t>(ColorRange::EType::COUNT);
} // namespace libvgcode } // namespace libvgcode
//################################################################################################################################ //################################################################################################################################

View File

@ -20,11 +20,6 @@ struct GCodeInputData
// List of path vertices // List of path vertices
// //
std::vector<PathVertex> vertices; std::vector<PathVertex> vertices;
//
// Total time for each time mode
//
std::array<float, Time_Modes_Count> times{ 0.0f, 0.0f };
}; };
} // namespace libvgcode } // namespace libvgcode

View File

@ -49,6 +49,7 @@ void Layers::update(const PathVertex& vertex, uint32_t vertex_id)
void Layers::reset() void Layers::reset()
{ {
m_items.clear(); m_items.clear();
m_view_range.reset();
} }
bool Layers::empty() const bool Layers::empty() const
@ -79,6 +80,21 @@ std::vector<float> Layers::get_times(ETimeMode mode) const
return ret; return ret;
} }
const std::array<uint32_t, 2>& Layers::get_view_range() const
{
return m_view_range.get();
}
void Layers::set_view_range(const std::array<uint32_t, 2>& range)
{
set_view_range(range[0], range[1]);
}
void Layers::set_view_range(uint32_t min, uint32_t max)
{
m_view_range.set(min, max);
}
bool Layers::layer_contains_colorprint_options(uint32_t layer_id) const bool Layers::layer_contains_colorprint_options(uint32_t layer_id) const
{ {
return (layer_id < static_cast<uint32_t>(m_items.size())) ? m_items[layer_id].contains_colorprint_options : false; return (layer_id < static_cast<uint32_t>(m_items.size())) ? m_items[layer_id].contains_colorprint_options : false;

View File

@ -29,6 +29,10 @@ public:
float get_time(ETimeMode mode, uint32_t layer_id) const; float get_time(ETimeMode mode, uint32_t layer_id) const;
std::vector<float> get_times(ETimeMode mode) const; std::vector<float> get_times(ETimeMode mode) const;
const std::array<uint32_t, 2>& get_view_range() const;
void set_view_range(const std::array<uint32_t, 2>& range);
void set_view_range(uint32_t min, uint32_t max);
bool layer_contains_colorprint_options(uint32_t layer_id) const; bool layer_contains_colorprint_options(uint32_t layer_id) const;
private: private:
@ -40,6 +44,7 @@ private:
}; };
std::vector<Item> m_items; std::vector<Item> m_items;
Range m_view_range;
}; };
} // namespace libvgcode } // namespace libvgcode

View File

@ -131,6 +131,26 @@ PathVertex Viewer::get_vertex_at(uint32_t id) const
return m_impl.get_vertex_at(id); return m_impl.get_vertex_at(id);
} }
size_t Viewer::get_enabled_segments_count() const
{
return m_impl.get_enabled_segments_count();
}
const std::array<uint32_t, 2>& Viewer::get_enabled_segments_range() const
{
return m_impl.get_enabled_segments_range();
}
size_t Viewer::get_enabled_options_count() const
{
return m_impl.get_enabled_options_count();
}
const std::array<uint32_t, 2>& Viewer::get_enabled_options_range() const
{
return m_impl.get_enabled_options_range();
}
uint32_t Viewer::get_extrusion_roles_count() const uint32_t Viewer::get_extrusion_roles_count() const
{ {
return m_impl.get_extrusion_roles_count(); return m_impl.get_extrusion_roles_count();
@ -186,6 +206,41 @@ void Viewer::set_tool_colors(const std::vector<Color>& colors)
m_impl.set_tool_colors(colors); m_impl.set_tool_colors(colors);
} }
const std::array<float, 2>& Viewer::get_height_range() const
{
return m_impl.get_height_range();
}
const std::array<float, 2>& Viewer::get_width_range() const
{
return m_impl.get_width_range();
}
const std::array<float, 2>& Viewer::get_speed_range() const
{
return m_impl.get_speed_range();
}
const std::array<float, 2>& Viewer::get_fan_speed_range() const
{
return m_impl.get_fan_speed_range();
}
const std::array<float, 2>& Viewer::get_temperature_range() const
{
return m_impl.get_temperature_range();
}
const std::array<float, 2>& Viewer::get_volumetric_rate_range() const
{
return m_impl.get_volumetric_rate_range();
}
std::array<float, 2> Viewer::get_layer_time_range(ColorRange::EType type) const
{
return m_impl.get_layer_time_range(type);
}
#if !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS #if !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
Vec3 Viewer::get_cog_position() const Vec3 Viewer::get_cog_position() const
{ {
@ -222,6 +277,16 @@ void Viewer::set_tool_marker_position(const Vec3& position)
m_impl.set_tool_marker_position(position); m_impl.set_tool_marker_position(position);
} }
float Viewer::get_tool_marker_offset_z() const
{
return m_impl.get_tool_marker_offset_z();
}
void Viewer::set_tool_marker_offset_z(float offset_z)
{
m_impl.set_tool_marker_offset_z(offset_z);
}
float Viewer::get_tool_marker_scale_factor() const float Viewer::get_tool_marker_scale_factor() const
{ {
return m_impl.get_tool_marker_scale_factor(); return m_impl.get_tool_marker_scale_factor();

View File

@ -62,42 +62,66 @@ public:
// Return the count of vertices used to render the toolpaths // Return the count of vertices used to render the toolpaths
// //
uint32_t get_vertices_count() const; uint32_t get_vertices_count() const;
// //
// Return the vertex pointed by the max value of the view current range // Return the vertex pointed by the max value of the view current range
// //
PathVertex get_current_vertex() const; PathVertex get_current_vertex() const;
// //
// Return the vertex at the given index // Return the vertex at the given index
// //
PathVertex get_vertex_at(uint32_t id) const; PathVertex get_vertex_at(uint32_t id) const;
//
// Return the count of path segments enabled for rendering
//
size_t get_enabled_segments_count() const;
const std::array<uint32_t, 2>& get_enabled_segments_range() const;
//
// Return the count of options enabled for rendering
//
size_t get_enabled_options_count() const;
const std::array<uint32_t, 2>& get_enabled_options_range() const;
// //
// Return the count of detected extrusion roles // Return the count of detected extrusion roles
// //
uint32_t get_extrusion_roles_count() const; uint32_t get_extrusion_roles_count() const;
// //
// Return the list of detected extrusion roles // Return the list of detected extrusion roles
// //
std::vector<EGCodeExtrusionRole> get_extrusion_roles() const; std::vector<EGCodeExtrusionRole> get_extrusion_roles() const;
// //
// Return the estimated time for the given role and the current time mode // Return the estimated time for the given role and the current time mode
// //
float get_extrusion_role_time(EGCodeExtrusionRole role) const; float get_extrusion_role_time(EGCodeExtrusionRole role) const;
// //
// Return the estimated time for the given role and the given time mode // Return the estimated time for the given role and the given time mode
// //
float get_extrusion_role_time(EGCodeExtrusionRole role, ETimeMode mode) const; float get_extrusion_role_time(EGCodeExtrusionRole role, ETimeMode mode) const;
// //
// Return the estimated time for the travel moves and the current time mode // Return the estimated time for the travel moves and the current time mode
// //
float get_travels_time() const; float get_travels_time() const;
// //
// Return the estimated time for the travel moves and the given time mode // Return the estimated time for the travel moves and the given time mode
// //
float get_travels_time(ETimeMode mode) const; float get_travels_time(ETimeMode mode) const;
// //
// Return the list of layers time for the current time mode // Return the list of layers time for the current time mode
// //
std::vector<float> get_layers_times() const; std::vector<float> get_layers_times() const;
// //
// Return the list of layers time for the given time mode // Return the list of layers time for the given time mode
// //
@ -107,6 +131,14 @@ public:
const std::vector<Color>& get_tool_colors() const; const std::vector<Color>& get_tool_colors() const;
void set_tool_colors(const std::vector<Color>& colors); void set_tool_colors(const std::vector<Color>& colors);
const std::array<float, 2>& get_height_range() const;
const std::array<float, 2>& get_width_range() const;
const std::array<float, 2>& get_speed_range() const;
const std::array<float, 2>& get_fan_speed_range() const;
const std::array<float, 2>& get_temperature_range() const;
const std::array<float, 2>& get_volumetric_rate_range() const;
std::array<float, 2> get_layer_time_range(ColorRange::EType type) const;
#if !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS #if !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
// //
// Returns the position of the center of gravity of the toolpaths. // Returns the position of the center of gravity of the toolpaths.
@ -128,6 +160,9 @@ public:
const Vec3& get_tool_marker_position() const; const Vec3& get_tool_marker_position() const;
void set_tool_marker_position(const Vec3& position); void set_tool_marker_position(const Vec3& position);
float get_tool_marker_offset_z() const;
void set_tool_marker_offset_z(float offset_z);
float get_tool_marker_scale_factor() const; float get_tool_marker_scale_factor() const;
void set_tool_marker_scale_factor(float factor); void set_tool_marker_scale_factor(float factor);

View File

@ -16,8 +16,6 @@
//################################################################################################################################ //################################################################################################################################
// PrusaSlicer development only -> !!!TO BE REMOVED!!! // PrusaSlicer development only -> !!!TO BE REMOVED!!!
#if ENABLE_NEW_GCODE_VIEWER #if ENABLE_NEW_GCODE_VIEWER
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/ImGuiWrapper.hpp"
//################################################################################################################################ //################################################################################################################################
#include <map> #include <map>
@ -445,7 +443,6 @@ void ViewerImpl::init()
void ViewerImpl::reset() void ViewerImpl::reset()
{ {
m_layers.reset(); m_layers.reset();
m_layers_range.reset();
m_view_range.reset(); m_view_range.reset();
m_extrusion_roles.reset(); m_extrusion_roles.reset();
m_travels_time = { 0.0f, 0.0f }; m_travels_time = { 0.0f, 0.0f };
@ -473,18 +470,6 @@ void ViewerImpl::reset()
void ViewerImpl::load(GCodeInputData&& gcode_data) void ViewerImpl::load(GCodeInputData&& gcode_data)
{ {
if (m_settings.time_mode != ETimeMode::Normal) {
bool force_normal_mode = static_cast<size_t>(m_settings.time_mode) >= gcode_data.times.size();
if (!force_normal_mode) {
const float normal_time = gcode_data.times[static_cast<size_t>(ETimeMode::Normal)];
const float mode_time = gcode_data.times[static_cast<size_t>(m_settings.time_mode)];
force_normal_mode = mode_time == 0.0f ||
short_time(get_time_dhms(mode_time)) == short_time(get_time_dhms(normal_time)); // TO CHECK -> Is this necessary ?
}
if (force_normal_mode)
m_settings.time_mode = ETimeMode::Normal;
}
m_vertices = std::move(gcode_data.vertices); m_vertices = std::move(gcode_data.vertices);
for (size_t i = 0; i < m_vertices.size(); ++i) { for (size_t i = 0; i < m_vertices.size(); ++i) {
@ -513,6 +498,9 @@ void ViewerImpl::load(GCodeInputData&& gcode_data)
} }
} }
if (!m_layers.empty())
m_layers.set_view_range(0, static_cast<uint32_t>(m_layers.count()) - 1);
// reset segments visibility bitset // reset segments visibility bitset
m_valid_lines_bitset = BitSet<>(m_vertices.size()); m_valid_lines_bitset = BitSet<>(m_vertices.size());
m_valid_lines_bitset.setAll(); m_valid_lines_bitset.setAll();
@ -648,12 +636,14 @@ void ViewerImpl::update_enabled_entities()
m_enabled_segments_count = enabled_segments.size(); m_enabled_segments_count = enabled_segments.size();
m_enabled_options_count = enabled_options.size(); m_enabled_options_count = enabled_options.size();
#if ENABLE_NEW_GCODE_VIEWER_DEBUG if (m_enabled_segments_count > 0)
m_enabled_segments_range = (m_enabled_segments_count > 0) ? m_enabled_segments_range.set(enabled_segments.front(), enabled_segments.back());
std::make_pair((uint32_t)enabled_segments.front(), (uint32_t)enabled_segments.back()) : std::make_pair((uint32_t)0, (uint32_t)0); else
m_enabled_options_range = (m_enabled_options_count > 0) ? m_enabled_segments_range.reset();
std::make_pair((uint32_t)enabled_options.front(), (uint32_t)enabled_options.back()) : std::make_pair((uint32_t)0, (uint32_t)0); if (m_enabled_options_count > 0)
#endif // ENABLE_NEW_GCODE_VIEWER_DEBUG m_enabled_options_range.set(enabled_options.front(), enabled_options.back());
else
m_enabled_options_range.reset();
// update gpu buffer for enabled segments // update gpu buffer for enabled segments
assert(m_enabled_segments_buf_id > 0); assert(m_enabled_segments_buf_id > 0);
@ -686,7 +676,7 @@ void ViewerImpl::update_colors()
{ {
update_color_ranges(); update_color_ranges();
const uint32_t top_layer_id = m_settings.top_layer_only_view_range ? m_layers_range.get()[1] : 0; const uint32_t top_layer_id = m_settings.top_layer_only_view_range ? m_layers.get_view_range()[1] : 0;
const bool color_top_layer_only = m_view_range.get_global()[1] != m_view_range.get_current()[1]; const bool color_top_layer_only = m_view_range.get_global()[1] != m_view_range.get_current()[1];
std::vector<float> colors(m_vertices.size()); std::vector<float> colors(m_vertices.size());
for (size_t i = 0; i < m_vertices.size(); i++) { for (size_t i = 0; i < m_vertices.size(); i++) {
@ -728,10 +718,6 @@ void ViewerImpl::render(const Mat4x4& view_matrix, const Mat4x4& projection_matr
if (m_settings.options_visibility.at(EOptionType::CenterOfGravity)) if (m_settings.options_visibility.at(EOptionType::CenterOfGravity))
render_cog_marker(view_matrix, projection_matrix); render_cog_marker(view_matrix, projection_matrix);
#endif // !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS #endif // !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
#if ENABLE_NEW_GCODE_VIEWER_DEBUG
render_debug_window();
#endif // ENABLE_NEW_GCODE_VIEWER_DEBUG
} }
EViewType ViewerImpl::get_view_type() const EViewType ViewerImpl::get_view_type() const
@ -758,7 +744,7 @@ void ViewerImpl::set_time_mode(ETimeMode mode)
const std::array<uint32_t, 2>& ViewerImpl::get_layers_range() const const std::array<uint32_t, 2>& ViewerImpl::get_layers_range() const
{ {
return m_layers_range.get(); return m_layers.get_view_range();
} }
void ViewerImpl::set_layers_range(const std::array<uint32_t, 2>& range) void ViewerImpl::set_layers_range(const std::array<uint32_t, 2>& range)
@ -768,7 +754,7 @@ void ViewerImpl::set_layers_range(const std::array<uint32_t, 2>& range)
void ViewerImpl::set_layers_range(uint32_t min, uint32_t max) void ViewerImpl::set_layers_range(uint32_t min, uint32_t max)
{ {
m_layers_range.set(min, max); m_layers.set_view_range(min, max);
m_settings.update_view_global_range = true; m_settings.update_view_global_range = true;
m_settings.update_enabled_entities = true; m_settings.update_enabled_entities = true;
m_settings.update_colors = true; m_settings.update_colors = true;
@ -906,6 +892,26 @@ PathVertex ViewerImpl::get_vertex_at(size_t id) const
return (id < m_vertices.size()) ? m_vertices[id] : PathVertex(); return (id < m_vertices.size()) ? m_vertices[id] : PathVertex();
} }
size_t ViewerImpl::get_enabled_segments_count() const
{
return m_enabled_segments_count;
}
const std::array<uint32_t, 2>& ViewerImpl::get_enabled_segments_range() const
{
return m_enabled_segments_range.get();
}
size_t ViewerImpl::get_enabled_options_count() const
{
return m_enabled_options_count;
}
const std::array<uint32_t, 2>& ViewerImpl::get_enabled_options_range() const
{
return m_enabled_options_range.get();
}
std::vector<EGCodeExtrusionRole> ViewerImpl::get_extrusion_roles() const std::vector<EGCodeExtrusionRole> ViewerImpl::get_extrusion_roles() const
{ {
return m_extrusion_roles.get_roles(); return m_extrusion_roles.get_roles();
@ -962,6 +968,46 @@ void ViewerImpl::set_tool_colors(const std::vector<Color>& colors)
m_settings.update_colors = true; m_settings.update_colors = true;
} }
const std::array<float, 2>& ViewerImpl::get_height_range() const
{
return m_height_range.get_range();
}
const std::array<float, 2>& ViewerImpl::get_width_range() const
{
return m_width_range.get_range();
}
const std::array<float, 2>& ViewerImpl::get_speed_range() const
{
return m_speed_range.get_range();
}
const std::array<float, 2>& ViewerImpl::get_fan_speed_range() const
{
return m_fan_speed_range.get_range();
}
const std::array<float, 2>& ViewerImpl::get_temperature_range() const
{
return m_temperature_range.get_range();
}
const std::array<float, 2>& ViewerImpl::get_volumetric_rate_range() const
{
return m_volumetric_rate_range.get_range();
}
std::array<float, 2> ViewerImpl::get_layer_time_range(ColorRange::EType type) const
{
try {
return m_layer_time_range[static_cast<size_t>(type)].get_range();
}
catch (...) {
return { 0.0f, 0.0f };
}
}
#if !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS #if !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
Vec3 ViewerImpl::get_cog_marker_position() const Vec3 ViewerImpl::get_cog_marker_position() const
{ {
@ -1059,7 +1105,7 @@ static bool is_visible(EMoveType type, const Settings& settings)
void ViewerImpl::update_view_global_range() void ViewerImpl::update_view_global_range()
{ {
const std::array<uint32_t, 2>& layers_range = m_layers_range.get(); const std::array<uint32_t, 2>& layers_range = m_layers.get_view_range();
const bool travels_visible = m_settings.options_visibility.at(EOptionType::Travels); const bool travels_visible = m_settings.options_visibility.at(EOptionType::Travels);
auto first_it = m_vertices.begin(); auto first_it = m_vertices.begin();
@ -1404,133 +1450,6 @@ void ViewerImpl::render_tool_marker(const Mat4x4& view_matrix, const Mat4x4& pro
} }
#endif // !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS #endif // !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
#if ENABLE_NEW_GCODE_VIEWER_DEBUG
void ViewerImpl::render_debug_window()
{
Slic3r::GUI::ImGuiWrapper& imgui = *Slic3r::GUI::wxGetApp().imgui();
imgui.begin(std::string("LibVGCode Viewer Debug"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
if (ImGui::BeginTable("Data", 2)) {
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "# vertices");
ImGui::TableSetColumnIndex(1);
imgui.text(std::to_string(m_vertices.size()));
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "# enabled lines");
ImGui::TableSetColumnIndex(1);
imgui.text(std::to_string(m_enabled_segments_count) + " [" + std::to_string(m_enabled_segments_range.first) + "-" + std::to_string(m_enabled_segments_range.second) + "]");
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "# enabled options");
ImGui::TableSetColumnIndex(1);
imgui.text(std::to_string(m_enabled_options_count) + " [" + std::to_string(m_enabled_options_range.first) + "-" + std::to_string(m_enabled_options_range.second) + "]");
ImGui::Separator();
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "layers range");
ImGui::TableSetColumnIndex(1);
const std::array<uint32_t, 2>& layers_range = get_layers_range();
imgui.text(std::to_string(layers_range[0]) + " - " + std::to_string(layers_range[1]));
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "view range (current)");
ImGui::TableSetColumnIndex(1);
const std::array<uint32_t, 2>& current_view_range = get_view_current_range();
imgui.text(std::to_string(current_view_range[0]) + " - " + std::to_string(current_view_range[1]));
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "view range (global)");
ImGui::TableSetColumnIndex(1);
const std::array<uint32_t, 2>& global_view_range = get_view_global_range();
imgui.text(std::to_string(global_view_range[0]) + " - " + std::to_string(global_view_range[1]));
auto add_range_property_row = [&imgui](const std::string& label, const std::array<float, 2>& range) {
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, label);
ImGui::TableSetColumnIndex(1);
char buf[64];
sprintf(buf, "%.3f - %.3f", range[0], range[1]);
imgui.text(buf);
};
add_range_property_row("height range", m_height_range.get_range());
add_range_property_row("width range", m_width_range.get_range());
add_range_property_row("speed range", m_speed_range.get_range());
add_range_property_row("fan speed range", m_fan_speed_range.get_range());
add_range_property_row("temperature range", m_temperature_range.get_range());
add_range_property_row("volumetric rate range", m_volumetric_rate_range.get_range());
add_range_property_row("layer time linear range", m_layer_time_range[0].get_range());
add_range_property_row("layer time logarithmic range", m_layer_time_range[1].get_range());
ImGui::EndTable();
#if !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
ImGui::Separator();
if (ImGui::BeginTable("Cog", 2)) {
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "Cog marker scale factor");
ImGui::TableSetColumnIndex(1);
imgui.text(std::to_string(get_cog_marker_scale_factor()));
ImGui::EndTable();
}
ImGui::Separator();
if (ImGui::BeginTable("Tool", 2)) {
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "Tool marker scale factor");
ImGui::TableSetColumnIndex(1);
imgui.text(std::to_string(get_tool_marker_scale_factor()));
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "Tool marker z offset");
ImGui::TableSetColumnIndex(1);
float tool_z_offset = get_tool_marker_offset_z();
if (imgui.slider_float("##ToolZOffset", &tool_z_offset, 0.0f, 1.0f))
set_tool_marker_offset_z(tool_z_offset);
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "Tool marker color");
ImGui::TableSetColumnIndex(1);
Color color = get_tool_marker_color();
if (ImGui::ColorPicker3("##ToolColor", color.data()))
set_tool_marker_color(color);
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(Slic3r::GUI::ImGuiWrapper::COL_ORANGE_LIGHT, "Tool marker alpha");
ImGui::TableSetColumnIndex(1);
float tool_alpha = get_tool_marker_alpha();
if (imgui.slider_float("##ToolAlpha", &tool_alpha, 0.25f, 0.75f))
set_tool_marker_alpha(tool_alpha);
ImGui::EndTable();
}
#endif // !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
}
imgui.end();
}
#endif // ENABLE_NEW_GCODE_VIEWER_DEBUG
} // namespace libvgcode } // namespace libvgcode
//################################################################################################################################ //################################################################################################################################

View File

@ -98,6 +98,12 @@ public:
PathVertex get_current_vertex() const; PathVertex get_current_vertex() const;
PathVertex get_vertex_at(size_t id) const; PathVertex get_vertex_at(size_t id) const;
size_t get_enabled_segments_count() const;
const std::array<uint32_t, 2>& get_enabled_segments_range() const;
size_t get_enabled_options_count() const;
const std::array<uint32_t, 2>& get_enabled_options_range() const;
size_t get_extrusion_roles_count() const; size_t get_extrusion_roles_count() const;
std::vector<EGCodeExtrusionRole> get_extrusion_roles() const; std::vector<EGCodeExtrusionRole> get_extrusion_roles() const;
float get_extrusion_role_time(EGCodeExtrusionRole role) const; float get_extrusion_role_time(EGCodeExtrusionRole role) const;
@ -112,6 +118,14 @@ public:
const std::vector<Color>& get_tool_colors() const; const std::vector<Color>& get_tool_colors() const;
void set_tool_colors(const std::vector<Color>& colors); void set_tool_colors(const std::vector<Color>& colors);
const std::array<float, 2>& get_height_range() const;
const std::array<float, 2>& get_width_range() const;
const std::array<float, 2>& get_speed_range() const;
const std::array<float, 2>& get_fan_speed_range() const;
const std::array<float, 2>& get_temperature_range() const;
const std::array<float, 2>& get_volumetric_rate_range() const;
std::array<float, 2> get_layer_time_range(ColorRange::EType type) const;
#if !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS #if !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
Vec3 get_cog_marker_position() const; Vec3 get_cog_marker_position() const;
@ -140,7 +154,6 @@ public:
private: private:
Settings m_settings; Settings m_settings;
Layers m_layers; Layers m_layers;
Range m_layers_range;
ViewRange m_view_range; ViewRange m_view_range;
ExtrusionRoles m_extrusion_roles; ExtrusionRoles m_extrusion_roles;
std::array<float, Time_Modes_Count> m_travels_time{ 0.0f, 0.0f }; std::array<float, Time_Modes_Count> m_travels_time{ 0.0f, 0.0f };
@ -173,10 +186,8 @@ private:
// cpu buffer to store vertices // cpu buffer to store vertices
// //
std::vector<PathVertex> m_vertices; std::vector<PathVertex> m_vertices;
#if ENABLE_NEW_GCODE_VIEWER_DEBUG Range m_enabled_segments_range;
std::pair<uint32_t, uint32_t> m_enabled_segments_range{ 0, 0 }; Range m_enabled_options_range;
std::pair<uint32_t, uint32_t> m_enabled_options_range{ 0, 0 };
#endif // ENABLE_NEW_GCODE_VIEWER_DEBUG
// //
// Member variables used for toolpaths visibiliity // Member variables used for toolpaths visibiliity
@ -194,7 +205,7 @@ private:
ColorRange m_fan_speed_range; ColorRange m_fan_speed_range;
ColorRange m_temperature_range; ColorRange m_temperature_range;
ColorRange m_volumetric_rate_range; ColorRange m_volumetric_rate_range;
std::array<ColorRange, static_cast<size_t>(ColorRange::EType::COUNT)> m_layer_time_range{ std::array<ColorRange, Color_Range_Types_Count> m_layer_time_range{
ColorRange(ColorRange::EType::Linear), ColorRange(ColorRange::EType::Logarithmic) ColorRange(ColorRange::EType::Linear), ColorRange(ColorRange::EType::Logarithmic)
}; };
std::vector<Color> m_tool_colors; std::vector<Color> m_tool_colors;
@ -282,11 +293,6 @@ private:
void render_cog_marker(const Mat4x4& view_matrix, const Mat4x4& projection_matrix); void render_cog_marker(const Mat4x4& view_matrix, const Mat4x4& projection_matrix);
void render_tool_marker(const Mat4x4& view_matrix, const Mat4x4& projection_matrix); void render_tool_marker(const Mat4x4& view_matrix, const Mat4x4& projection_matrix);
#endif // !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS #endif // !ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
#if ENABLE_NEW_GCODE_VIEWER_DEBUG
// Debug
void render_debug_window();
#endif // ENABLE_NEW_GCODE_VIEWER_DEBUG
}; };
} // namespace libvgcode } // namespace libvgcode