From 75856d5e652196b8841ad77ec1dc845d6a6e3913 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 30 Nov 2021 08:36:55 +0100 Subject: [PATCH] Tech ENABLE_SEAMS_USING_MODELS set as default --- src/libslic3r/Technologies.hpp | 6 +- src/slic3r/GUI/GCodeViewer.cpp | 159 ---------------------------- src/slic3r/GUI/GCodeViewer.hpp | 38 +------ src/slic3r/GUI/GLCanvas3D.cpp | 2 - src/slic3r/GUI/GLCanvas3D.hpp | 2 - src/slic3r/GUI/GLModel.cpp | 2 - src/slic3r/GUI/GLModel.hpp | 2 - src/slic3r/GUI/GLShadersManager.cpp | 4 - src/slic3r/GUI/Plater.cpp | 2 - 9 files changed, 3 insertions(+), 214 deletions(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 3b288198e..9ba98dab1 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -43,8 +43,6 @@ // Enable implementation of retract acceleration in gcode processor #define ENABLE_RETRACT_ACCELERATION (1 && ENABLE_2_4_0_ALPHA1) -// Enable rendering seams (and other options) in preview using models -#define ENABLE_SEAMS_USING_MODELS (1 && ENABLE_2_4_0_ALPHA1) // Enable save and save as commands to be enabled also when the plater is empty and allow to load empty projects #define ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED (1 && ENABLE_2_4_0_ALPHA1) @@ -55,9 +53,9 @@ #define ENABLE_2_4_0_ALPHA2 1 // Enable rendering seams (and other options) in preview using batched models on systems not supporting OpenGL 3.3 -#define ENABLE_SEAMS_USING_BATCHED_MODELS (1 && ENABLE_SEAMS_USING_MODELS && ENABLE_2_4_0_ALPHA2) +#define ENABLE_SEAMS_USING_BATCHED_MODELS (1 && ENABLE_2_4_0_ALPHA2) // Enable fixing the z position of color change, pause print and custom gcode markers in preview -#define ENABLE_FIX_PREVIEW_OPTIONS_Z (1 && ENABLE_SEAMS_USING_MODELS && ENABLE_2_4_0_ALPHA2) +#define ENABLE_FIX_PREVIEW_OPTIONS_Z (1 && ENABLE_2_4_0_ALPHA2) // Enable replacing a missing file during reload from disk command #define ENABLE_RELOAD_FROM_DISK_REPLACE_FILE (1 && ENABLE_2_4_0_ALPHA2) // Enable fixing the synchronization of seams with the horizontal slider in preview diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 3b583154c..d3de10fd5 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -89,7 +89,6 @@ void GCodeViewer::VBuffer::reset() count = 0; } -#if ENABLE_SEAMS_USING_MODELS void GCodeViewer::InstanceVBuffer::Ranges::reset() { for (Range& range : ranges) { @@ -107,7 +106,6 @@ void GCodeViewer::InstanceVBuffer::reset() buffer.clear(); render_ranges.reset(); } -#endif // ENABLE_SEAMS_USING_MODELS void GCodeViewer::IBuffer::reset() { @@ -150,12 +148,10 @@ bool GCodeViewer::Path::matches(const GCodeProcessorResult::MoveVertex& move) co } } -#if ENABLE_SEAMS_USING_MODELS void GCodeViewer::TBuffer::Model::reset() { instances.reset(); } -#endif // ENABLE_SEAMS_USING_MODELS void GCodeViewer::TBuffer::reset() { @@ -167,9 +163,7 @@ void GCodeViewer::TBuffer::reset() indices.clear(); paths.clear(); render_paths.clear(); -#if ENABLE_SEAMS_USING_MODELS model.reset(); -#endif // ENABLE_SEAMS_USING_MODELS } void GCodeViewer::TBuffer::add_path(const GCodeProcessorResult::MoveVertex& move, unsigned int b_id, size_t i_id, size_t s_id) @@ -567,48 +561,11 @@ const GCodeViewer::Color GCodeViewer::Neutral_Color = { 0.25f, 0.25f, 0.25f, 1.0 GCodeViewer::GCodeViewer() { -#if !ENABLE_SEAMS_USING_MODELS - // initializes non OpenGL data of TBuffers - // OpenGL data are initialized into render().init_gl_data() - for (size_t i = 0; i < m_buffers.size(); ++i) { - TBuffer& buffer = m_buffers[i]; - switch (buffer_type(i)) - { - default: { break; } - case EMoveType::Tool_change: - case EMoveType::Color_change: - case EMoveType::Pause_Print: - case EMoveType::Custom_GCode: - case EMoveType::Retract: - case EMoveType::Unretract: - case EMoveType::Seam: { - buffer.render_primitive_type = TBuffer::ERenderPrimitiveType::Point; - buffer.vertices.format = VBuffer::EFormat::Position; - break; - } - case EMoveType::Wipe: - case EMoveType::Extrude: { - buffer.render_primitive_type = TBuffer::ERenderPrimitiveType::Triangle; - buffer.vertices.format = VBuffer::EFormat::PositionNormal3; - break; - } - case EMoveType::Travel: { - buffer.render_primitive_type = TBuffer::ERenderPrimitiveType::Line; - buffer.vertices.format = VBuffer::EFormat::PositionNormal1; - break; - } - } - } - - set_toolpath_move_type_visible(EMoveType::Extrude, true); -#endif // !ENABLE_SEAMS_USING_MODELS - m_extrusions.reset_role_visibility_flags(); // m_sequential_view.skip_invisible_moves = true; } -#if ENABLE_SEAMS_USING_MODELS void GCodeViewer::init() { if (m_gl_data_initialized) @@ -689,7 +646,6 @@ void GCodeViewer::init() m_gl_data_initialized = true; } -#endif // ENABLE_SEAMS_USING_MODELS void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& print, bool initialized) { @@ -879,72 +835,11 @@ void GCodeViewer::reset() void GCodeViewer::render() { -#if !ENABLE_SEAMS_USING_MODELS - auto init_gl_data = [this]() { - // initializes opengl data of TBuffers - for (size_t i = 0; i < m_buffers.size(); ++i) { - TBuffer& buffer = m_buffers[i]; - EMoveType type = buffer_type(i); - switch (type) - { - default: { break; } - case EMoveType::Tool_change: - case EMoveType::Color_change: - case EMoveType::Pause_Print: - case EMoveType::Custom_GCode: - case EMoveType::Retract: - case EMoveType::Unretract: - case EMoveType::Seam: { - if (wxGetApp().is_gl_version_greater_or_equal_to(3, 3)) { - buffer.render_primitive_type = TBuffer::ERenderPrimitiveType::Model; - buffer.shader = "gouraud_light_instanced"; - buffer.model.model.init_from(diamond(16)); - buffer.model.color = option_color(type); - } - else { - buffer.render_primitive_type = TBuffer::ERenderPrimitiveType::Point; - buffer.vertices.format = VBuffer::EFormat::Position; - buffer.shader = wxGetApp().is_glsl_version_greater_or_equal_to(1, 20) ? "options_120" : "options_110"; - } - break; - } - case EMoveType::Wipe: - case EMoveType::Extrude: { - buffer.shader = "gouraud_light"; - break; - } - case EMoveType::Travel: { - buffer.shader = "toolpaths_lines"; - break; - } - } - } - - // initializes tool marker - m_sequential_view.marker.init(); - - // initializes point sizes - std::array point_sizes; - ::glGetIntegerv(GL_ALIASED_POINT_SIZE_RANGE, point_sizes.data()); - m_detected_point_sizes = { static_cast(point_sizes[0]), static_cast(point_sizes[1]) }; - m_gl_data_initialized = true; - }; -#endif // !ENABLE_SEAMS_USING_MODELS - #if ENABLE_GCODE_VIEWER_STATISTICS m_statistics.reset_opengl(); -#if ENABLE_SEAMS_USING_MODELS m_statistics.total_instances_gpu_size = 0; -#endif // ENABLE_SEAMS_USING_MODELS #endif // ENABLE_GCODE_VIEWER_STATISTICS -#if !ENABLE_SEAMS_USING_MODELS - // OpenGL data must be initialized after the glContext has been created. - // This is ensured when this method is called by GLCanvas3D::_render_gcode(). - if (!m_gl_data_initialized) - init_gl_data(); -#endif // !ENABLE_SEAMS_USING_MODELS - if (m_roles.empty()) return; @@ -1501,7 +1396,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) sq_prev_length = sq_length; }; -#if ENABLE_SEAMS_USING_MODELS // format data into the buffers to be rendered as instanced model auto add_model_instance = [](const GCodeProcessorResult::MoveVertex& curr, InstanceBuffer& instances, InstanceIdBuffer& instances_ids, size_t move_id) { // append position @@ -1559,7 +1453,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) } }; #endif // ENABLE_SEAMS_USING_BATCHED_MODELS -#endif // ENABLE_SEAMS_USING_MODELS #if ENABLE_GCODE_VIEWER_STATISTICS auto start_time = std::chrono::high_resolution_clock::now(); @@ -1614,10 +1507,8 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) std::vector vertices(m_buffers.size()); std::vector indices(m_buffers.size()); -#if ENABLE_SEAMS_USING_MODELS std::vector instances(m_buffers.size()); std::vector instances_ids(m_buffers.size()); -#endif // ENABLE_SEAMS_USING_MODELS #if ENABLE_FIX_SEAMS_SYNCH std::vector instances_offsets(m_buffers.size()); #endif // ENABLE_FIX_SEAMS_SYNCH @@ -1658,13 +1549,11 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) const unsigned char id = buffer_id(curr.type); TBuffer& t_buffer = m_buffers[id]; MultiVertexBuffer& v_multibuffer = vertices[id]; -#if ENABLE_SEAMS_USING_MODELS InstanceBuffer& inst_buffer = instances[id]; InstanceIdBuffer& inst_id_buffer = instances_ids[id]; #if ENABLE_FIX_SEAMS_SYNCH InstancesOffsets& inst_offsets = instances_offsets[id]; #endif // ENABLE_FIX_SEAMS_SYNCH -#endif // ENABLE_SEAMS_USING_MODELS // ensure there is at least one vertex buffer if (v_multibuffer.empty()) @@ -1701,7 +1590,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) #else case TBuffer::ERenderPrimitiveType::Triangle: { add_vertices_as_solid(prev, curr, t_buffer, static_cast(v_multibuffer.size()) - 1, v_buffer, i); break; } #endif // ENABLE_FIX_SEAMS_SYNCH -#if ENABLE_SEAMS_USING_MODELS #if ENABLE_SEAMS_USING_BATCHED_MODELS case TBuffer::ERenderPrimitiveType::InstancedModel: { @@ -1742,7 +1630,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) #endif // ENABLE_GCODE_VIEWER_STATISTICS break; } -#endif // ENABLE_SEAMS_USING_MODELS #endif // ENABLE_SEAMS_USING_BATCHED_MODELS } @@ -1951,7 +1838,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) // send vertices data to gpu, where needed for (size_t i = 0; i < m_buffers.size(); ++i) { TBuffer& t_buffer = m_buffers[i]; -#if ENABLE_SEAMS_USING_MODELS #if ENABLE_SEAMS_USING_BATCHED_MODELS if (t_buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::InstancedModel) { const InstanceBuffer& inst_buffer = instances[i]; @@ -1987,7 +1873,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) } else { #endif // ENABLE_SEAMS_USING_BATCHED_MODELS -#endif // ENABLE_SEAMS_USING_MODELS const MultiVertexBuffer& v_multibuffer = vertices[i]; for (const VertexBuffer& v_buffer : v_multibuffer) { const size_t size_elements = v_buffer.size(); @@ -2010,9 +1895,7 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) t_buffer.vertices.vbos.push_back(static_cast(id)); t_buffer.vertices.sizes.push_back(size_bytes); } -#if ENABLE_SEAMS_USING_MODELS } -#endif // ENABLE_SEAMS_USING_MODELS } #if ENABLE_GCODE_VIEWER_STATISTICS @@ -2023,10 +1906,8 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) // dismiss vertices data, no more needed std::vector().swap(vertices); -#if ENABLE_SEAMS_USING_MODELS std::vector().swap(instances); std::vector().swap(instances_ids); -#endif // ENABLE_SEAMS_USING_MODELS // toolpaths data -> extract indices from result // paths may have been filled while extracting vertices, @@ -2082,9 +1963,7 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) // ensure there is at least one index buffer if (i_multibuffer.empty()) { i_multibuffer.push_back(IndexBuffer()); -#if ENABLE_SEAMS_USING_MODELS if (!t_buffer.vertices.vbos.empty()) -#endif // ENABLE_SEAMS_USING_MODELS vbo_index_list.push_back(t_buffer.vertices.vbos[curr_vertex_buffer.first]); } @@ -2192,13 +2071,11 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) // toolpaths data -> send indices data to gpu for (size_t i = 0; i < m_buffers.size(); ++i) { TBuffer& t_buffer = m_buffers[i]; -#if ENABLE_SEAMS_USING_MODELS #if ENABLE_SEAMS_USING_BATCHED_MODELS if (t_buffer.render_primitive_type != TBuffer::ERenderPrimitiveType::InstancedModel) { #else if (t_buffer.render_primitive_type != TBuffer::ERenderPrimitiveType::Model) { #endif // ENABLE_SEAMS_USING_BATCHED_MODELS -#endif // ENABLE_SEAMS_USING_MODELS const MultiIndexBuffer& i_multibuffer = indices[i]; for (const IndexBuffer& i_buffer : i_multibuffer) { const size_t size_elements = i_buffer.size(); @@ -2221,9 +2098,7 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result) glsafe(::glBufferData(GL_ELEMENT_ARRAY_BUFFER, size_bytes, i_buffer.data(), GL_STATIC_DRAW)); glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); } -#if ENABLE_SEAMS_USING_MODELS } -#endif // ENABLE_SEAMS_USING_MODELS } if (progress_dialog != nullptr) { @@ -2474,9 +2349,7 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool #if ENABLE_GCODE_VIEWER_STATISTICS Statistics* statistics = const_cast(&m_statistics); statistics->render_paths_size = 0; -#if ENABLE_SEAMS_USING_MODELS statistics->models_instances_size = 0; -#endif // ENABLE_SEAMS_USING_MODELS #endif // ENABLE_GCODE_VIEWER_STATISTICS const bool top_layer_only = get_app_config()->get("seq_top_layer_only") == "1"; @@ -2497,7 +2370,6 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool if (!buffer.visible) continue; -#if ENABLE_SEAMS_USING_MODELS #if ENABLE_SEAMS_USING_BATCHED_MODELS if (buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::InstancedModel || buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::BatchedModel) { @@ -2521,7 +2393,6 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool } } else { -#endif // ENABLE_SEAMS_USING_MODELS for (size_t i = 0; i < buffer.paths.size(); ++i) { const Path& path = buffer.paths[i]; if (path.type == EMoveType::Travel) { @@ -2555,9 +2426,7 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool } } } -#if ENABLE_SEAMS_USING_MODELS } -#endif // ENABLE_SEAMS_USING_MODELS } // update current sequential position @@ -2567,7 +2436,6 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool // get the world position from the vertex buffer bool found = false; for (const TBuffer& buffer : m_buffers) { -#if ENABLE_SEAMS_USING_MODELS #if ENABLE_SEAMS_USING_BATCHED_MODELS if (buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::InstancedModel || buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::BatchedModel) { @@ -2590,7 +2458,6 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool } } else { -#endif // ENABLE_SEAMS_USING_MODELS // searches the path containing the current position for (const Path& path : buffer.paths) { if (path.contains(m_sequential_view.current.last)) { @@ -2631,9 +2498,7 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool } } } -#if ENABLE_SEAMS_USING_MODELS } -#endif // ENABLE_SEAMS_USING_MODELS if (found) break; @@ -2740,7 +2605,6 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool #endif } -#if ENABLE_SEAMS_USING_MODELS #if ENABLE_SEAMS_USING_BATCHED_MODELS // second pass: for buffers using instanced and batched models, update the instances render ranges #else @@ -2796,14 +2660,11 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool } } } -#endif // ENABLE_SEAMS_USING_MODELS // set sequential data to their final value sequential_view->endpoints = top_layer_only ? top_layer_endpoints : global_endpoints; sequential_view->current.first = !top_layer_only && keep_sequential_current_first ? std::clamp(sequential_view->current.first, sequential_view->endpoints.first, sequential_view->endpoints.last) : sequential_view->endpoints.first; -#if ENABLE_SEAMS_USING_MODELS sequential_view->global = global_endpoints; -#endif // ENABLE_SEAMS_USING_MODELS // updates sequential range caps std::array* sequential_range_caps = const_cast*>(&m_sequential_range_caps); @@ -2925,11 +2786,9 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool statistics->render_paths_size += SLIC3R_STDVEC_MEMSIZE(path.sizes, unsigned int); statistics->render_paths_size += SLIC3R_STDVEC_MEMSIZE(path.offsets, size_t); } -#if ENABLE_SEAMS_USING_MODELS statistics->models_instances_size += SLIC3R_STDVEC_MEMSIZE(buffer.model.instances.buffer, float); statistics->models_instances_size += SLIC3R_STDVEC_MEMSIZE(buffer.model.instances.s_ids, size_t); statistics->models_instances_size += SLIC3R_STDVEC_MEMSIZE(buffer.model.instances.render_ranges.ranges, InstanceVBuffer::Ranges::Range); -#endif // ENABLE_SEAMS_USING_MODELS } statistics->refresh_paths_time = std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - start_time).count(); #endif // ENABLE_GCODE_VIEWER_STATISTICS @@ -3018,7 +2877,6 @@ void GCodeViewer::render_toolpaths() } }; -#if ENABLE_SEAMS_USING_MODELS #if ENABLE_GCODE_VIEWER_STATISTICS auto render_as_instanced_model = [this] #else @@ -3103,7 +2961,6 @@ void GCodeViewer::render_toolpaths() } }; #endif // ENABLE_SEAMS_USING_BATCHED_MODELS -#endif // ENABLE_SEAMS_USING_MODELS auto line_width = [](double zoom) { return (zoom < 5.0) ? 1.0 : (1.0 + 5.0 * (zoom - 5.0) / (100.0 - 5.0)); @@ -3113,11 +2970,7 @@ void GCodeViewer::render_toolpaths() unsigned char end_id = buffer_id(EMoveType::Count); for (unsigned char i = begin_id; i < end_id; ++i) { -#if ENABLE_SEAMS_USING_MODELS TBuffer& buffer = m_buffers[i]; -#else - const TBuffer& buffer = m_buffers[i]; -#endif // ENABLE_SEAMS_USING_MODELS if (!buffer.visible || !buffer.has_data()) continue; @@ -3125,7 +2978,6 @@ void GCodeViewer::render_toolpaths() if (shader != nullptr) { shader->start_using(); -#if ENABLE_SEAMS_USING_MODELS #if ENABLE_SEAMS_USING_BATCHED_MODELS if (buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::InstancedModel) { #else @@ -3143,7 +2995,6 @@ void GCodeViewer::render_toolpaths() } #endif // ENABLE_SEAMS_USING_BATCHED_MODELS else { -#endif // ENABLE_SEAMS_USING_MODELS for (size_t j = 0; j < buffer.indices.size(); ++j) { const IBuffer& i_buffer = buffer.indices[j]; @@ -3184,9 +3035,7 @@ void GCodeViewer::render_toolpaths() glsafe(::glDisableClientState(GL_VERTEX_ARRAY)); glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0)); } -#if ENABLE_SEAMS_USING_MODELS } -#endif // ENABLE_SEAMS_USING_MODELS shader->stop_using(); } @@ -4198,13 +4047,11 @@ void GCodeViewer::render_statistics() add_counter(std::string("Multi GL_LINES:"), m_statistics.gl_multi_lines_calls_count); add_counter(std::string("Multi GL_TRIANGLES:"), m_statistics.gl_multi_triangles_calls_count); add_counter(std::string("GL_TRIANGLES:"), m_statistics.gl_triangles_calls_count); -#if ENABLE_SEAMS_USING_MODELS ImGui::Separator(); add_counter(std::string("Instanced models:"), m_statistics.gl_instanced_models_calls_count); #if ENABLE_SEAMS_USING_BATCHED_MODELS add_counter(std::string("Batched models:"), m_statistics.gl_batched_models_calls_count); #endif // ENABLE_SEAMS_USING_BATCHED_MODELS -#endif // ENABLE_SEAMS_USING_MODELS } if (ImGui::CollapsingHeader("CPU memory")) { @@ -4213,17 +4060,13 @@ void GCodeViewer::render_statistics() ImGui::Separator(); add_memory(std::string("Paths:"), m_statistics.paths_size); add_memory(std::string("Render paths:"), m_statistics.render_paths_size); -#if ENABLE_SEAMS_USING_MODELS add_memory(std::string("Models instances:"), m_statistics.models_instances_size); -#endif // ENABLE_SEAMS_USING_MODELS } if (ImGui::CollapsingHeader("GPU memory")) { add_memory(std::string("Vertices:"), m_statistics.total_vertices_gpu_size); add_memory(std::string("Indices:"), m_statistics.total_indices_gpu_size); -#if ENABLE_SEAMS_USING_MODELS add_memory(std::string("Instances:"), m_statistics.total_instances_gpu_size); -#endif // ENABLE_SEAMS_USING_MODELS ImGui::Separator(); add_memory(std::string("Max VBuffer:"), m_statistics.max_vbuffer_gpu_size); add_memory(std::string("Max IBuffer:"), m_statistics.max_ibuffer_gpu_size); @@ -4233,12 +4076,10 @@ void GCodeViewer::render_statistics() add_counter(std::string("Travel segments count:"), m_statistics.travel_segments_count); add_counter(std::string("Wipe segments count:"), m_statistics.wipe_segments_count); add_counter(std::string("Extrude segments count:"), m_statistics.extrude_segments_count); -#if ENABLE_SEAMS_USING_MODELS add_counter(std::string("Instances count:"), m_statistics.instances_count); #if ENABLE_SEAMS_USING_BATCHED_MODELS add_counter(std::string("Batched count:"), m_statistics.batched_count); #endif // ENABLE_SEAMS_USING_BATCHED_MODELS -#endif // ENABLE_SEAMS_USING_MODELS ImGui::Separator(); add_counter(std::string("VBuffers count:"), m_statistics.vbuffers_count); add_counter(std::string("IBuffers count:"), m_statistics.ibuffers_count); diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp index f81cb823e..3dd12415a 100644 --- a/src/slic3r/GUI/GCodeViewer.hpp +++ b/src/slic3r/GUI/GCodeViewer.hpp @@ -27,10 +27,8 @@ class GCodeViewer using MultiVertexBuffer = std::vector; using IndexBuffer = std::vector; using MultiIndexBuffer = std::vector; -#if ENABLE_SEAMS_USING_MODELS using InstanceBuffer = std::vector; using InstanceIdBuffer = std::vector; -#endif // ENABLE_SEAMS_USING_MODELS #if ENABLE_FIX_SEAMS_SYNCH using InstancesOffsets = std::vector; #endif // ENABLE_FIX_SEAMS_SYNCH @@ -107,7 +105,6 @@ class GCodeViewer void reset(); }; -#if ENABLE_SEAMS_USING_MODELS #if ENABLE_SEAMS_USING_BATCHED_MODELS // buffer containing instances data used to render a toolpaths using instanced or batched models // instance record format: @@ -178,7 +175,6 @@ class GCodeViewer void reset(); }; -#endif // ENABLE_SEAMS_USING_MODELS // ibo buffer containing indices data (for lines/triangles) used to render a specific toolpath type struct IBuffer @@ -313,7 +309,6 @@ class GCodeViewer { Point, Line, -#if ENABLE_SEAMS_USING_MODELS Triangle, #if ENABLE_SEAMS_USING_BATCHED_MODELS InstancedModel, @@ -321,9 +316,6 @@ class GCodeViewer #else Model #endif // ENABLE_SEAMS_USING_BATCHED_MODELS -#else - Triangle -#endif // ENABLE_SEAMS_USING_MODELS }; ERenderPrimitiveType render_primitive_type; @@ -332,7 +324,6 @@ class GCodeViewer VBuffer vertices; std::vector indices; -#if ENABLE_SEAMS_USING_MODELS struct Model { GLModel model; @@ -347,7 +338,6 @@ class GCodeViewer // contain the buffer for model primitive types Model model; -#endif // ENABLE_SEAMS_USING_MODELS std::string shader; std::vector paths; @@ -396,7 +386,6 @@ class GCodeViewer } size_t max_indices_per_segment_size_bytes() const { return max_indices_per_segment() * sizeof(IBufferType); } -#if ENABLE_SEAMS_USING_MODELS bool has_data() const { switch (render_primitive_type) { @@ -417,11 +406,6 @@ class GCodeViewer default: { return false; } } } -#else - bool has_data() const { - return !vertices.vbos.empty() && vertices.vbos.front() != 0 && !indices.empty() && indices.front().ibo != 0; - } -#endif // ENABLE_SEAMS_USING_MODELS }; // helper to render shells @@ -569,36 +553,28 @@ class GCodeViewer int64_t gl_multi_lines_calls_count{ 0 }; int64_t gl_multi_triangles_calls_count{ 0 }; int64_t gl_triangles_calls_count{ 0 }; -#if ENABLE_SEAMS_USING_MODELS int64_t gl_instanced_models_calls_count{ 0 }; #if ENABLE_SEAMS_USING_BATCHED_MODELS int64_t gl_batched_models_calls_count{ 0 }; #endif // ENABLE_SEAMS_USING_BATCHED_MODELS -#endif // ENABLE_SEAMS_USING_MODELS // memory int64_t results_size{ 0 }; int64_t total_vertices_gpu_size{ 0 }; int64_t total_indices_gpu_size{ 0 }; -#if ENABLE_SEAMS_USING_MODELS int64_t total_instances_gpu_size{ 0 }; -#endif // ENABLE_SEAMS_USING_MODELS int64_t max_vbuffer_gpu_size{ 0 }; int64_t max_ibuffer_gpu_size{ 0 }; int64_t paths_size{ 0 }; int64_t render_paths_size{ 0 }; -#if ENABLE_SEAMS_USING_MODELS int64_t models_instances_size{ 0 }; -#endif // ENABLE_SEAMS_USING_MODELS // other int64_t travel_segments_count{ 0 }; int64_t wipe_segments_count{ 0 }; int64_t extrude_segments_count{ 0 }; -#if ENABLE_SEAMS_USING_MODELS int64_t instances_count{ 0 }; #if ENABLE_SEAMS_USING_BATCHED_MODELS int64_t batched_count{ 0 }; #endif // ENABLE_SEAMS_USING_BATCHED_MODELS -#endif // ENABLE_SEAMS_USING_MODELS int64_t vbuffers_count{ 0 }; int64_t ibuffers_count{ 0 }; @@ -624,40 +600,32 @@ class GCodeViewer gl_multi_lines_calls_count = 0; gl_multi_triangles_calls_count = 0; gl_triangles_calls_count = 0; -#if ENABLE_SEAMS_USING_MODELS gl_instanced_models_calls_count = 0; #if ENABLE_SEAMS_USING_BATCHED_MODELS gl_batched_models_calls_count = 0; #endif // ENABLE_SEAMS_USING_BATCHED_MODELS -#endif // ENABLE_SEAMS_USING_MODELS } void reset_sizes() { results_size = 0; total_vertices_gpu_size = 0; total_indices_gpu_size = 0; -#if ENABLE_SEAMS_USING_MODELS total_instances_gpu_size = 0; -#endif // ENABLE_SEAMS_USING_MODELS max_vbuffer_gpu_size = 0; max_ibuffer_gpu_size = 0; paths_size = 0; render_paths_size = 0; -#if ENABLE_SEAMS_USING_MODELS models_instances_size = 0; -#endif // ENABLE_SEAMS_USING_MODELS } void reset_others() { travel_segments_count = 0; wipe_segments_count = 0; - extrude_segments_count = 0; -#if ENABLE_SEAMS_USING_MODELS + extrude_segments_count = 0; instances_count = 0; #if ENABLE_SEAMS_USING_BATCHED_MODELS batched_count = 0; #endif // ENABLE_SEAMS_USING_BATCHED_MODELS -#endif // ENABLE_SEAMS_USING_MODELS vbuffers_count = 0; ibuffers_count = 0; } @@ -743,9 +711,7 @@ public: Endpoints endpoints; Endpoints current; Endpoints last_current; -#if ENABLE_SEAMS_USING_MODELS Endpoints global; -#endif // ENABLE_SEAMS_USING_MODELS Vec3f current_position{ Vec3f::Zero() }; #if ENABLE_FIX_SEAMS_SYNCH Vec3f current_offset{ Vec3f::Zero() }; @@ -811,9 +777,7 @@ public: GCodeViewer(); ~GCodeViewer() { reset(); } -#if ENABLE_SEAMS_USING_MODELS void init(); -#endif // ENABLE_SEAMS_USING_MODELS // extract rendering data from the given parameters void load(const GCodeProcessorResult& gcode_result, const Print& print, bool initialized); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index f65c7521d..f660a3c33 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1422,10 +1422,8 @@ void GLCanvas3D::render() if (!is_initialized() && !init()) return; -#if ENABLE_SEAMS_USING_MODELS if (!m_main_toolbar.is_enabled()) m_gcode_viewer.init(); -#endif // ENABLE_SEAMS_USING_MODELS if (! m_bed.build_volume().valid()) { // this happens at startup when no data is still saved under <>\AppData\Roaming\Slic3rPE diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 92819136a..605d75ddd 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -623,9 +623,7 @@ public: void reset_volumes(); ModelInstanceEPrintVolumeState check_volumes_outside_state() const; -#if ENABLE_SEAMS_USING_MODELS void init_gcode_viewer() { m_gcode_viewer.init(); } -#endif // ENABLE_SEAMS_USING_MODELS void reset_gcode_toolpaths() { m_gcode_viewer.reset(); } const GCodeViewer::SequentialView& get_gcode_sequential_view() const { return m_gcode_viewer.get_sequential_view(); } void update_gcode_sequential_view_current(unsigned int first, unsigned int last) { m_gcode_viewer.update_sequential_view_current(first, last); } diff --git a/src/slic3r/GUI/GLModel.cpp b/src/slic3r/GUI/GLModel.cpp index fb27aced5..35841b32e 100644 --- a/src/slic3r/GUI/GLModel.cpp +++ b/src/slic3r/GUI/GLModel.cpp @@ -231,7 +231,6 @@ void GLModel::render() const } } -#if ENABLE_SEAMS_USING_MODELS void GLModel::render_instanced(unsigned int instances_vbo, unsigned int instances_count) const { if (instances_vbo == 0) @@ -308,7 +307,6 @@ void GLModel::render_instanced(unsigned int instances_vbo, unsigned int instance glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0)); } -#endif // ENABLE_SEAMS_USING_MODELS void GLModel::send_to_gpu(RenderData& data, const std::vector& vertices, const std::vector& indices) { diff --git a/src/slic3r/GUI/GLModel.hpp b/src/slic3r/GUI/GLModel.hpp index f2fc9da9b..c022acb2e 100644 --- a/src/slic3r/GUI/GLModel.hpp +++ b/src/slic3r/GUI/GLModel.hpp @@ -80,9 +80,7 @@ namespace GUI { void reset(); void render() const; -#if ENABLE_SEAMS_USING_MODELS void render_instanced(unsigned int instances_vbo, unsigned int instances_count) const; -#endif // ENABLE_SEAMS_USING_MODELS bool is_initialized() const { return !m_render_data.empty(); } diff --git a/src/slic3r/GUI/GLShadersManager.cpp b/src/slic3r/GUI/GLShadersManager.cpp index e1d66fa5d..8c2f6860a 100644 --- a/src/slic3r/GUI/GLShadersManager.cpp +++ b/src/slic3r/GUI/GLShadersManager.cpp @@ -46,17 +46,13 @@ std::pair GLShadersManager::init() if (GUI::wxGetApp().is_gl_version_greater_or_equal_to(3, 3)) valid &= append_shader("gouraud_light_instanced", { "gouraud_light_instanced.vs", "gouraud_light_instanced.fs" }); #else -#if ENABLE_SEAMS_USING_MODELS if (GUI::wxGetApp().is_gl_version_greater_or_equal_to(3, 3)) valid &= append_shader("gouraud_light_instanced", { "gouraud_light_instanced.vs", "gouraud_light_instanced.fs" }); else { -#endif // ENABLE_SEAMS_USING_MODELS valid &= append_shader("options_110", { "options_110.vs", "options_110.fs" }); if (GUI::wxGetApp().is_glsl_version_greater_or_equal_to(1, 20)) valid &= append_shader("options_120", { "options_120.vs", "options_120.fs" }); -#if ENABLE_SEAMS_USING_MODELS } -#endif // ENABLE_SEAMS_USING_MODELS #endif // ENABLE_SEAMS_USING_BATCHED_MODELS // used to render extrusion and travel paths as lines in gcode preview valid &= append_shader("toolpaths_lines", { "toolpaths_lines.vs", "toolpaths_lines.fs" }); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 4e60f09e2..4cdb91053 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3904,9 +3904,7 @@ void Plater::priv::set_current_panel(wxPanel* panel) bool export_in_progress = this->background_process.is_export_scheduled(); bool model_fits = view3D->get_canvas3d()->check_volumes_outside_state() != ModelInstancePVS_Partly_Outside; if (!model.objects.empty() && !export_in_progress && model_fits) { -#if ENABLE_SEAMS_USING_MODELS preview->get_canvas3d()->init_gcode_viewer(); -#endif // ENABLE_SEAMS_USING_MODELS q->reslice(); } // keeps current gcode preview, if any