From 8c6304688de8575fa3634868b00cca59e1b2c8bd Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 16 May 2019 15:54:11 +0200 Subject: [PATCH 01/64] Camera refactoring: Frustrum calculations moved into Camera class --- src/slic3r/GUI/Camera.cpp | 43 ++++++++++++++++++++++----- src/slic3r/GUI/Camera.hpp | 7 +++-- src/slic3r/GUI/GLCanvas3D.cpp | 56 +++-------------------------------- 3 files changed, 44 insertions(+), 62 deletions(-) diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index dd6cbefe19..5f7a7ce4b2 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -28,6 +28,8 @@ Camera::Camera() , inverted_phi(false) , m_theta(45.0f) , m_target(Vec3d::Zero()) + , m_view_matrix(Transform3d::Identity()) + , m_projection_matrix(Transform3d::Identity()) { } @@ -65,11 +67,6 @@ void Camera::set_theta(float theta, bool apply_limit) } } -void Camera::set_scene_box(const BoundingBoxf3& box) -{ - m_scene_box = box; -} - bool Camera::select_view(const std::string& direction) { const float* dir_vec = nullptr; @@ -111,13 +108,43 @@ void Camera::apply_view_matrix() const glsafe(::glLoadIdentity()); glsafe(::glRotatef(-m_theta, 1.0f, 0.0f, 0.0f)); // pitch - glsafe(::glRotatef(phi, 0.0f, 0.0f, 1.0f)); // yaw - glsafe(::glTranslated(-m_target(0), -m_target(1), -m_target(2))); + glsafe(::glRotatef(phi, 0.0f, 0.0f, 1.0f)); // yaw + + glsafe(::glTranslated(-m_target(0), -m_target(1), -m_target(2))); // target to origin glsafe(::glGetDoublev(GL_MODELVIEW_MATRIX, m_view_matrix.data())); } -void Camera::apply_ortho_projection(float x_min, float x_max, float y_min, float y_max, float z_min, float z_max) const +void Camera::apply_projection(const BoundingBoxf3& box) const +{ + switch (type) + { + case Ortho: + { + double w2 = (double)m_viewport[2]; + double h2 = (double)m_viewport[3]; + double two_zoom = 2.0 * zoom; + if (two_zoom != 0.0) + { + double inv_two_zoom = 1.0 / two_zoom; + w2 *= inv_two_zoom; + h2 *= inv_two_zoom; + } + + // FIXME: calculate a tighter value for depth will improve z-fighting + // Set at least some minimum depth in case the bounding box is empty to avoid an OpenGL driver error. + double depth = std::max(1.0, 5.0 * box.max_size()); + apply_ortho_projection(-w2, w2, -h2, h2, -depth, depth); + + break; + } +// case Perspective: +// { +// } + } +} + +void Camera::apply_ortho_projection(double x_min, double x_max, double y_min, double y_max, double z_min, double z_max) const { glsafe(::glMatrixMode(GL_PROJECTION)); glsafe(::glLoadIdentity()); diff --git a/src/slic3r/GUI/Camera.hpp b/src/slic3r/GUI/Camera.hpp index 6e1b539ab6..f0d22fd67a 100644 --- a/src/slic3r/GUI/Camera.hpp +++ b/src/slic3r/GUI/Camera.hpp @@ -46,7 +46,7 @@ public: void set_theta(float theta, bool apply_limit); const BoundingBoxf3& get_scene_box() const { return m_scene_box; } - void set_scene_box(const BoundingBoxf3& box); + void set_scene_box(const BoundingBoxf3& box){ m_scene_box = box; } bool select_view(const std::string& direction); @@ -62,7 +62,10 @@ public: void apply_viewport(int x, int y, unsigned int w, unsigned int h) const; void apply_view_matrix() const; - void apply_ortho_projection(float x_min, float x_max, float y_min, float y_max, float z_min, float z_max) const; + void apply_projection(const BoundingBoxf3& box) const; + +private: + void apply_ortho_projection(double x_min, double x_max, double y_min, double y_max, double z_min, double z_max) const; }; } // GUI diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index bb2cb5e2dd..ed9c1bd60a 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1472,6 +1472,7 @@ BoundingBoxf3 GLCanvas3D::scene_bounding_box() const bb.min(2) = std::min(bb.min(2), -h); bb.max(2) = std::max(bb.max(2), h); } + return bb; } @@ -3593,59 +3594,10 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h) // ensures that this canvas is current _set_current(); + + // updates camera m_camera.apply_viewport(0, 0, w, h); - - const BoundingBoxf3& bbox = _max_bounding_box(); - - switch (m_camera.type) - { - case Camera::Ortho: - { - float w2 = w; - float h2 = h; - float two_zoom = 2.0f * m_camera.zoom; - if (two_zoom != 0.0f) - { - float inv_two_zoom = 1.0f / two_zoom; - w2 *= inv_two_zoom; - h2 *= inv_two_zoom; - } - - // FIXME: calculate a tighter value for depth will improve z-fighting - // Set at least some minimum depth in case the bounding box is empty to avoid an OpenGL driver error. - float depth = std::max(1.f, 5.0f * (float)bbox.max_size()); - m_camera.apply_ortho_projection(-w2, w2, -h2, h2, -depth, depth); - - break; - } -// case Camera::Perspective: -// { -// float bbox_r = (float)bbox.radius(); -// float fov = PI * 45.0f / 180.0f; -// float fov_tan = tan(0.5f * fov); -// float cam_distance = 0.5f * bbox_r / fov_tan; -// m_camera.distance = cam_distance; -// -// float nr = cam_distance - bbox_r * 1.1f; -// float fr = cam_distance + bbox_r * 1.1f; -// if (nr < 1.0f) -// nr = 1.0f; -// -// if (fr < nr + 1.0f) -// fr = nr + 1.0f; -// -// float h2 = fov_tan * nr; -// float w2 = h2 * w / h; -// ::glFrustum(-w2, w2, -h2, h2, nr, fr); -// -// break; -// } - default: - { - throw std::runtime_error("Invalid camera type."); - break; - } - } + m_camera.apply_projection(_max_bounding_box()); m_dirty = false; } From 783a52710949153a64beaf1dd50b23c6d0bfe7a7 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 20 May 2019 09:39:57 +0200 Subject: [PATCH 02/64] Added imgui debug dialog for camera statistics --- src/libslic3r/Technologies.hpp | 2 ++ src/slic3r/GUI/Camera.cpp | 27 ++++++++++++++++++++++++++- src/slic3r/GUI/Camera.hpp | 4 ++++ src/slic3r/GUI/GLCanvas3D.cpp | 4 ++++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 3375a282b1..fdc5ef7d27 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -13,6 +13,8 @@ #define ENABLE_RENDER_SELECTION_CENTER 0 // Shows an imgui dialog with render related data #define ENABLE_RENDER_STATISTICS 0 +// Shows an imgui dialog with camera related data +#define ENABLE_CAMERA_STATISTICS 1 //==================== diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index 5f7a7ce4b2..a9edb76264 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -2,6 +2,9 @@ #include "Camera.hpp" #include "3DScene.hpp" +#if ENABLE_CAMERA_STATISTICS +#include "GUI_App.hpp" +#endif // ENABLE_CAMERA_STATISTICS #include @@ -109,7 +112,6 @@ void Camera::apply_view_matrix() const glsafe(::glRotatef(-m_theta, 1.0f, 0.0f, 0.0f)); // pitch glsafe(::glRotatef(phi, 0.0f, 0.0f, 1.0f)); // yaw - glsafe(::glTranslated(-m_target(0), -m_target(1), -m_target(2))); // target to origin glsafe(::glGetDoublev(GL_MODELVIEW_MATRIX, m_view_matrix.data())); @@ -144,6 +146,29 @@ void Camera::apply_projection(const BoundingBoxf3& box) const } } +#if ENABLE_CAMERA_STATISTICS +void Camera::debug_render() const +{ + ImGuiWrapper& imgui = *wxGetApp().imgui(); + imgui.set_next_window_bg_alpha(0.5f); + imgui.begin(std::string("Camera statistics"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse); + + Vec3f position = get_position().cast(); + Vec3f target = m_target.cast(); + Vec3f forward = get_dir_forward().cast(); + Vec3f right = get_dir_right().cast(); + Vec3f up = get_dir_up().cast(); + + ImGui::InputFloat3("Position", position.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); + ImGui::InputFloat3("Target", target.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); + ImGui::Separator(); + ImGui::InputFloat3("Forward", forward.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); + ImGui::InputFloat3("Right", right.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); + ImGui::InputFloat3("Up", up.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); + imgui.end(); +} +#endif // ENABLE_CAMERA_STATISTICS + void Camera::apply_ortho_projection(double x_min, double x_max, double y_min, double y_max, double z_min, double z_max) const { glsafe(::glMatrixMode(GL_PROJECTION)); diff --git a/src/slic3r/GUI/Camera.hpp b/src/slic3r/GUI/Camera.hpp index f0d22fd67a..1f217be280 100644 --- a/src/slic3r/GUI/Camera.hpp +++ b/src/slic3r/GUI/Camera.hpp @@ -64,6 +64,10 @@ public: void apply_view_matrix() const; void apply_projection(const BoundingBoxf3& box) const; +#if ENABLE_CAMERA_STATISTICS + void debug_render() const; +#endif // ENABLE_CAMERA_STATISTICS + private: void apply_ortho_projection(double x_min, double x_max, double y_min, double y_max, double z_min, double z_max) const; }; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index ed9c1bd60a..f01d1a3ada 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1700,6 +1700,10 @@ void GLCanvas3D::render() imgui.end(); #endif // ENABLE_RENDER_STATISTICS +#if ENABLE_CAMERA_STATISTICS + m_camera.debug_render(); +#endif // ENABLE_CAMERA_STATISTICS + wxGetApp().imgui()->render(); m_canvas->SwapBuffers(); From efd247fc585ebd7f848680da7f06aab1a3e00e46 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Tue, 21 May 2019 14:19:03 +0200 Subject: [PATCH 03/64] Use texture compression on GPU --- src/libslic3r/Technologies.hpp | 6 ++++- src/slic3r/GUI/GLCanvas3D.cpp | 24 +++++++++++++++++-- src/slic3r/GUI/GLCanvas3DManager.cpp | 36 +++++++++++++++++----------- src/slic3r/GUI/GLCanvas3DManager.hpp | 15 ++++++++---- src/slic3r/GUI/GLTexture.cpp | 35 +++++++++++++++++++++++++++ src/slic3r/GUI/ImGuiWrapper.cpp | 7 ++++++ 6 files changed, 102 insertions(+), 21 deletions(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index bffc45cde7..3c5626a09d 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -12,7 +12,7 @@ // Renders a small sphere in the center of the bounding box of the current selection when no gizmo is active #define ENABLE_RENDER_SELECTION_CENTER 0 // Shows an imgui dialog with render related data -#define ENABLE_RENDER_STATISTICS 0 +#define ENABLE_RENDER_STATISTICS 1 //==================== @@ -46,4 +46,8 @@ #define ENABLE_SVG_ICONS (1 && ENABLE_1_42_0_ALPHA8 && ENABLE_TEXTURES_FROM_SVG) +// Enable saving textures on GPU in compressed format +#define ENABLE_COMPRESSED_TEXTURES 1 + + #endif // _technologies_h_ diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 26d205055e..bac3a3c64f 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -864,7 +864,14 @@ bool GLCanvas3D::WarningTexture::_generate(const std::string& msg_utf8, const GL glsafe(::glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); glsafe(::glGenTextures(1, &m_id)); glsafe(::glBindTexture(GL_TEXTURE_2D, (GLuint)m_id)); +#if ENABLE_COMPRESSED_TEXTURES + if (GLEW_EXT_texture_compression_s3tc) + glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); + else + glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); +#else glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); +#endif // ENABLE_COMPRESSED_TEXTURES glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0)); @@ -1147,7 +1154,14 @@ bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, c glsafe(::glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); glsafe(::glGenTextures(1, &m_id)); glsafe(::glBindTexture(GL_TEXTURE_2D, (GLuint)m_id)); +#if ENABLE_COMPRESSED_TEXTURES + if (GLEW_EXT_texture_compression_s3tc) + glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); + else + glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); +#else glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); +#endif // ENABLE_COMPRESSED_TEXTURES glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0)); @@ -1691,11 +1705,17 @@ void GLCanvas3D::render() ImGuiWrapper& imgui = *wxGetApp().imgui(); imgui.set_next_window_bg_alpha(0.5f); imgui.begin(std::string("Render statistics"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse); - imgui.text(_(L("Last frame")) +": "); + imgui.text("Last frame: "); ImGui::SameLine(); imgui.text(std::to_string(m_render_stats.last_frame)); ImGui::SameLine(); - imgui.text(" "+_(L("ms"))); + imgui.text(" ms"); +#if ENABLE_COMPRESSED_TEXTURES + ImGui::Separator(); + imgui.text("Textures: "); + ImGui::SameLine(); + imgui.text(GLCanvas3DManager::are_compressed_textures_supported() ? "Compressed" : "Uncompressed"); +#endif // ENABLE_COMPRESSED_TEXTURES imgui.end(); #endif // ENABLE_RENDER_STATISTICS diff --git a/src/slic3r/GUI/GLCanvas3DManager.cpp b/src/slic3r/GUI/GLCanvas3DManager.cpp index e409bed0dd..5f4391a5e2 100644 --- a/src/slic3r/GUI/GLCanvas3DManager.cpp +++ b/src/slic3r/GUI/GLCanvas3DManager.cpp @@ -111,6 +111,9 @@ std::string GLCanvas3DManager::GLInfo::to_string(bool format_as_html, bool exten } GLCanvas3DManager::EMultisampleState GLCanvas3DManager::s_multisample = GLCanvas3DManager::MS_Unknown; +#if ENABLE_COMPRESSED_TEXTURES +bool GLCanvas3DManager::s_compressed_textures_supported = false; +#endif // ENABLE_COMPRESSED_TEXTURES GLCanvas3DManager::GLCanvas3DManager() : m_context(nullptr) @@ -134,7 +137,7 @@ bool GLCanvas3DManager::add(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLTo if (canvas == nullptr) return false; - if (_get_canvas(canvas) != m_canvases.end()) + if (do_get_canvas(canvas) != m_canvases.end()) return false; GLCanvas3D* canvas3D = new GLCanvas3D(canvas, bed, camera, view_toolbar); @@ -159,7 +162,7 @@ bool GLCanvas3DManager::add(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLTo bool GLCanvas3DManager::remove(wxGLCanvas* canvas) { - CanvasesMap::iterator it = _get_canvas(canvas); + CanvasesMap::iterator it = do_get_canvas(canvas); if (it == m_canvases.end()) return false; @@ -195,6 +198,12 @@ void GLCanvas3DManager::init_gl() m_use_legacy_opengl = (config == nullptr) || (config->get("use_legacy_opengl") == "1"); m_use_VBOs = !m_use_legacy_opengl && m_gl_info.is_version_greater_or_equal_to(2, 0); m_gl_initialized = true; +#if ENABLE_COMPRESSED_TEXTURES + if (GLEW_EXT_texture_compression_s3tc) + s_compressed_textures_supported = true; + else + s_compressed_textures_supported = false; +#endif // ENABLE_COMPRESSED_TEXTURES } } @@ -205,16 +214,16 @@ std::string GLCanvas3DManager::get_gl_info(bool format_as_html, bool extensions) bool GLCanvas3DManager::init(wxGLCanvas* canvas) { - CanvasesMap::const_iterator it = _get_canvas(canvas); + CanvasesMap::const_iterator it = do_get_canvas(canvas); if (it != m_canvases.end()) - return (it->second != nullptr) ? _init(*it->second) : false; + return (it->second != nullptr) ? init(*it->second) : false; else return false; } GLCanvas3D* GLCanvas3DManager::get_canvas(wxGLCanvas* canvas) { - CanvasesMap::const_iterator it = _get_canvas(canvas); + CanvasesMap::const_iterator it = do_get_canvas(canvas); return (it != m_canvases.end()) ? it->second : nullptr; } @@ -224,29 +233,28 @@ wxGLCanvas* GLCanvas3DManager::create_wxglcanvas(wxWindow *parent) if (s_multisample == MS_Unknown) { - _detect_multisample(attribList); - // debug output - std::cout << "Multisample " << (can_multisample() ? "enabled" : "disabled") << std::endl; + detect_multisample(attribList); +// // debug output +// std::cout << "Multisample " << (can_multisample() ? "enabled" : "disabled") << std::endl; } - if (! can_multisample()) { + if (! can_multisample()) attribList[4] = 0; - } return new wxGLCanvas(parent, wxID_ANY, attribList, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS); } -GLCanvas3DManager::CanvasesMap::iterator GLCanvas3DManager::_get_canvas(wxGLCanvas* canvas) +GLCanvas3DManager::CanvasesMap::iterator GLCanvas3DManager::do_get_canvas(wxGLCanvas* canvas) { return (canvas == nullptr) ? m_canvases.end() : m_canvases.find(canvas); } -GLCanvas3DManager::CanvasesMap::const_iterator GLCanvas3DManager::_get_canvas(wxGLCanvas* canvas) const +GLCanvas3DManager::CanvasesMap::const_iterator GLCanvas3DManager::do_get_canvas(wxGLCanvas* canvas) const { return (canvas == nullptr) ? m_canvases.end() : m_canvases.find(canvas); } -bool GLCanvas3DManager::_init(GLCanvas3D& canvas) +bool GLCanvas3DManager::init(GLCanvas3D& canvas) { if (!m_gl_initialized) init_gl(); @@ -254,7 +262,7 @@ bool GLCanvas3DManager::_init(GLCanvas3D& canvas) return canvas.init(m_use_VBOs, m_use_legacy_opengl); } -void GLCanvas3DManager::_detect_multisample(int* attribList) +void GLCanvas3DManager::detect_multisample(int* attribList) { int wxVersion = wxMAJOR_VERSION * 10000 + wxMINOR_VERSION * 100 + wxRELEASE_NUMBER; const AppConfig* app_config = GUI::get_app_config(); diff --git a/src/slic3r/GUI/GLCanvas3DManager.hpp b/src/slic3r/GUI/GLCanvas3DManager.hpp index 75647e6b25..d391cd60c7 100644 --- a/src/slic3r/GUI/GLCanvas3DManager.hpp +++ b/src/slic3r/GUI/GLCanvas3DManager.hpp @@ -60,6 +60,9 @@ class GLCanvas3DManager bool m_use_legacy_opengl; bool m_use_VBOs; static EMultisampleState s_multisample; +#if ENABLE_COMPRESSED_TEXTURES + static bool s_compressed_textures_supported; +#endif // ENABLE_COMPRESSED_TEXTURES public: GLCanvas3DManager(); @@ -79,14 +82,18 @@ public: GLCanvas3D* get_canvas(wxGLCanvas* canvas); static bool can_multisample() { return s_multisample == MS_Enabled; } +#if ENABLE_COMPRESSED_TEXTURES + static bool are_compressed_textures_supported() { return s_compressed_textures_supported; } +#endif // ENABLE_COMPRESSED_TEXTURES + static wxGLCanvas* create_wxglcanvas(wxWindow *parent); private: - CanvasesMap::iterator _get_canvas(wxGLCanvas* canvas); - CanvasesMap::const_iterator _get_canvas(wxGLCanvas* canvas) const; + CanvasesMap::iterator do_get_canvas(wxGLCanvas* canvas); + CanvasesMap::const_iterator do_get_canvas(wxGLCanvas* canvas) const; - bool _init(GLCanvas3D& canvas); - static void _detect_multisample(int* attribList); + bool init(GLCanvas3D& canvas); + static void detect_multisample(int* attribList); }; } // namespace GUI diff --git a/src/slic3r/GUI/GLTexture.cpp b/src/slic3r/GUI/GLTexture.cpp index 2fff0869ad..f7d2edfe7b 100644 --- a/src/slic3r/GUI/GLTexture.cpp +++ b/src/slic3r/GUI/GLTexture.cpp @@ -178,7 +178,14 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vectorTexID = (ImTextureID)(intptr_t)m_font_texture; From 844e99f84e4ac640cd9ad0c905efc6068a35cdbb Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 22 May 2019 14:42:38 +0200 Subject: [PATCH 04/64] Prototype of scale to fit print volume command --- src/libslic3r/Technologies.hpp | 6 +- src/slic3r/GUI/Gizmos/GLGizmosManager.cpp | 13 ++++ src/slic3r/GUI/Plater.cpp | 24 ++++++- src/slic3r/GUI/Plater.hpp | 3 + src/slic3r/GUI/Selection.cpp | 81 ++++++++++++++++++++--- src/slic3r/GUI/Selection.hpp | 3 + 6 files changed, 119 insertions(+), 11 deletions(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 3c5626a09d..0bf984b1bf 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -12,7 +12,7 @@ // Renders a small sphere in the center of the bounding box of the current selection when no gizmo is active #define ENABLE_RENDER_SELECTION_CENTER 0 // Shows an imgui dialog with render related data -#define ENABLE_RENDER_STATISTICS 1 +#define ENABLE_RENDER_STATISTICS 0 //==================== @@ -47,7 +47,9 @@ // Enable saving textures on GPU in compressed format -#define ENABLE_COMPRESSED_TEXTURES 1 +#define ENABLE_COMPRESSED_TEXTURES 0 +// Enable scale object to fit print volume +#define ENABLE_SCALE_TO_FIT_PRINT_VOLUME 1 #endif // _technologies_h_ diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index 1a431708aa..ceffd6e0d3 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -847,6 +847,19 @@ bool GLGizmosManager::on_char(wxKeyEvent& evt, GLCanvas3D& canvas) break; } +#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME + case 'F': + case 'f': + { + if (m_current == Scale) + { + wxGetApp().plater()->scale_selection_to_fit_print_volume(); + processed = true; + } + + break; + } +#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME } } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 1a5c322463..05b378407b 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1286,7 +1286,10 @@ struct Plater::priv void sla_optimize_rotation(); void split_object(); void split_volume(); - bool background_processing_enabled() const { return this->get_config("background_processing") == "1"; } +#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME + void scale_selection_to_fit_print_volume(); +#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME + bool background_processing_enabled() const { return this->get_config("background_processing") == "1"; } void update_print_volume_state(); void schedule_background_process(); // Update background processing thread from the current config and Model. @@ -2346,6 +2349,13 @@ void Plater::priv::split_volume() wxGetApp().obj_list()->split(); } +#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME +void Plater::priv::scale_selection_to_fit_print_volume() +{ + this->view3D->get_canvas3d()->get_selection().scale_to_fit_print_volume(*config); +} +#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME + void Plater::priv::schedule_background_process() { delayed_error_message.clear(); @@ -3008,6 +3018,11 @@ bool Plater::priv::init_common_menu(wxMenu* menu, const bool is_part/* = false*/ sidebar->obj_list()->append_menu_item_fix_through_netfabb(menu); +#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME + append_menu_item(menu, wxID_ANY, _(L("Scale to print volume")), _(L("Scale the selected object to fit the print volume")), + [this](wxCommandEvent&) { scale_selection_to_fit_print_volume(); }, "", menu); +#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME + wxMenu* mirror_menu = new wxMenu(); if (mirror_menu == nullptr) return false; @@ -3447,6 +3462,13 @@ bool Plater::is_selection_empty() const return p->get_selection().is_empty() || p->get_selection().is_wipe_tower(); } +#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME +void Plater::scale_selection_to_fit_print_volume() +{ + p->scale_selection_to_fit_print_volume(); +} +#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME + void Plater::cut(size_t obj_idx, size_t instance_idx, coordf_t z, bool keep_upper, bool keep_lower, bool rotate_lower) { wxCHECK_RET(obj_idx < p->model.objects.size(), "obj_idx out of bounds"); diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index bc6d4b942d..b836649dbe 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -162,6 +162,9 @@ public: void decrease_instances(size_t num = 1); void set_number_of_copies(/*size_t num*/); bool is_selection_empty() const; +#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME + void scale_selection_to_fit_print_volume(); +#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME void cut(size_t obj_idx, size_t instance_idx, coordf_t z, bool keep_upper = true, bool keep_lower = true, bool rotate_lower = false); diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 00fbaa42a5..836f1d5727 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -662,14 +662,34 @@ void Selection::scale(const Vec3d& scale, TransformationType transformation_type { GLVolume &volume = *(*m_volumes)[i]; if (is_single_full_instance()) { - assert(transformation_type.absolute()); - if (transformation_type.world() && (std::abs(scale.x() - scale.y()) > EPSILON || std::abs(scale.x() - scale.z()) > EPSILON)) { - // Non-uniform scaling. Transform the scaling factors into the local coordinate system. - // This is only possible, if the instance rotation is mulitples of ninety degrees. - assert(Geometry::is_rotation_ninety_degrees(volume.get_instance_rotation())); - volume.set_instance_scaling_factor((volume.get_instance_transformation().get_matrix(true, false, true, true).matrix().block<3, 3>(0, 0).transpose() * scale).cwiseAbs()); - } else - volume.set_instance_scaling_factor(scale); +#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME + if (transformation_type.relative()) + { + Transform3d m = Geometry::assemble_transform(Vec3d::Zero(), Vec3d::Zero(), scale); + Eigen::Matrix new_matrix = (m * m_cache.volumes_data[i].get_instance_scale_matrix()).matrix().block(0, 0, 3, 3); + // extracts scaling factors from the composed transformation + Vec3d new_scale(new_matrix.col(0).norm(), new_matrix.col(1).norm(), new_matrix.col(2).norm()); + if (transformation_type.joint()) + volume.set_instance_offset(m_cache.dragging_center + m * (m_cache.volumes_data[i].get_instance_position() - m_cache.dragging_center)); + + volume.set_instance_scaling_factor(new_scale); + } + else + { +#else + assert(transformation_type.absolute()); +#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME + if (transformation_type.world() && (std::abs(scale.x() - scale.y()) > EPSILON || std::abs(scale.x() - scale.z()) > EPSILON)) { + // Non-uniform scaling. Transform the scaling factors into the local coordinate system. + // This is only possible, if the instance rotation is mulitples of ninety degrees. + assert(Geometry::is_rotation_ninety_degrees(volume.get_instance_rotation())); + volume.set_instance_scaling_factor((volume.get_instance_transformation().get_matrix(true, false, true, true).matrix().block<3, 3>(0, 0).transpose() * scale).cwiseAbs()); + } + else + volume.set_instance_scaling_factor(scale); +#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME + } +#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME } else if (is_single_volume() || is_single_modifier()) volume.set_volume_scaling_factor(scale); @@ -713,6 +733,51 @@ void Selection::scale(const Vec3d& scale, TransformationType transformation_type this->set_bounding_boxes_dirty(); } +#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME +void Selection::scale_to_fit_print_volume(const DynamicPrintConfig& config) +{ + if (is_empty() || (m_mode == Volume)) + return; + + // adds 1/100th of a mm on all sides to avoid false out of print volume detections due to floating-point roundings + Vec3d box_size = get_bounding_box().size() + 0.01 * Vec3d::Ones(); + + const ConfigOptionPoints* opt = dynamic_cast(config.option("bed_shape")); + if (opt != nullptr) + { + BoundingBox bed_box_2D = get_extents(Polygon::new_scale(opt->values)); + BoundingBoxf3 print_volume(Vec3d(unscale(bed_box_2D.min(0)), unscale(bed_box_2D.min(1)), 0.0), Vec3d(unscale(bed_box_2D.max(0)), unscale(bed_box_2D.max(1)), config.opt_float("max_print_height"))); + Vec3d print_volume_size = print_volume.size(); + double sx = (box_size(0) != 0.0) ? print_volume_size(0) / box_size(0) : 0.0; + double sy = (box_size(1) != 0.0) ? print_volume_size(1) / box_size(1) : 0.0; + double sz = (box_size(2) != 0.0) ? print_volume_size(2) / box_size(2) : 0.0; + if ((sx != 0.0) && (sy != 0.0) && (sz != 0.0)) + { + double s = std::min(sx, std::min(sy, sz)); + if (s != 1.0) + { + TransformationType type; + type.set_world(); + type.set_relative(); + type.set_joint(); + + // apply scale + start_dragging(); + scale(s * Vec3d::Ones(), type); + wxGetApp().plater()->canvas3D()->do_scale(); + + // center selection on print bed + start_dragging(); + translate(print_volume.center() - get_bounding_box().center()); + wxGetApp().plater()->canvas3D()->do_move(); + + wxGetApp().obj_manipul()->set_dirty(); + } + } + } +} +#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME + void Selection::mirror(Axis axis) { if (!m_valid) diff --git a/src/slic3r/GUI/Selection.hpp b/src/slic3r/GUI/Selection.hpp index 99d939acc5..03967b4d4c 100644 --- a/src/slic3r/GUI/Selection.hpp +++ b/src/slic3r/GUI/Selection.hpp @@ -287,6 +287,9 @@ public: void rotate(const Vec3d& rotation, TransformationType transformation_type); void flattening_rotate(const Vec3d& normal); void scale(const Vec3d& scale, TransformationType transformation_type); +#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME + void scale_to_fit_print_volume(const DynamicPrintConfig& config); +#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME void mirror(Axis axis); void translate(unsigned int object_idx, const Vec3d& displacement); From a8e92be6ebd39dacdf1a9db74ec6f60e2ecfc2a5 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 23 May 2019 09:20:11 +0200 Subject: [PATCH 05/64] 1) Added Scale to print volume menu item to objects list context menu 2) Disable [F] key when scale sizmo is dragging --- src/slic3r/GUI/GUI_ObjectList.cpp | 12 ++++++++++++ src/slic3r/GUI/GUI_ObjectList.hpp | 3 +++ src/slic3r/GUI/Gizmos/GLGizmosManager.cpp | 4 +++- src/slic3r/GUI/Plater.cpp | 3 +-- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 5a837f14dd..d49198ca8c 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -1,3 +1,4 @@ +#include "libslic3r/libslic3r.h" #include "GUI_ObjectList.hpp" #include "GUI_ObjectManipulation.hpp" #include "GUI_App.hpp" @@ -1283,6 +1284,14 @@ void ObjectList::append_menu_item_delete(wxMenu* menu) [this](wxCommandEvent&) { remove(); }, "", menu); } +#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME +void ObjectList::append_menu_item_scale_selection_to_fit_print_volume(wxMenu* menu) +{ + append_menu_item(menu, wxID_ANY, _(L("Scale to print volume")), _(L("Scale the selected object to fit the print volume")), + [this](wxCommandEvent&) { wxGetApp().plater()->scale_selection_to_fit_print_volume(); }, "", menu); +} +#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME + void ObjectList::create_object_popupmenu(wxMenu *menu) { #ifdef __WXOSX__ @@ -1291,6 +1300,9 @@ void ObjectList::create_object_popupmenu(wxMenu *menu) append_menu_item_export_stl(menu); append_menu_item_fix_through_netfabb(menu); +#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME + append_menu_item_scale_selection_to_fit_print_volume(menu); +#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME // Split object to parts m_menu_item_split = append_menu_item_split(menu); diff --git a/src/slic3r/GUI/GUI_ObjectList.hpp b/src/slic3r/GUI/GUI_ObjectList.hpp index 0dcfe25600..d030b5c512 100644 --- a/src/slic3r/GUI/GUI_ObjectList.hpp +++ b/src/slic3r/GUI/GUI_ObjectList.hpp @@ -207,6 +207,9 @@ public: void append_menu_item_export_stl(wxMenu* menu) const ; void append_menu_item_change_extruder(wxMenu* menu) const; void append_menu_item_delete(wxMenu* menu); +#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME + void append_menu_item_scale_selection_to_fit_print_volume(wxMenu* menu); +#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME void create_object_popupmenu(wxMenu *menu); void create_sla_object_popupmenu(wxMenu*menu); void create_part_popupmenu(wxMenu*menu); diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index ceffd6e0d3..4926293247 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -853,7 +853,9 @@ bool GLGizmosManager::on_char(wxKeyEvent& evt, GLCanvas3D& canvas) { if (m_current == Scale) { - wxGetApp().plater()->scale_selection_to_fit_print_volume(); + if (!is_dragging()) + wxGetApp().plater()->scale_selection_to_fit_print_volume(); + processed = true; } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 22f239516e..c82955b097 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3021,8 +3021,7 @@ bool Plater::priv::init_common_menu(wxMenu* menu, const bool is_part/* = false*/ sidebar->obj_list()->append_menu_item_fix_through_netfabb(menu); #if ENABLE_SCALE_TO_FIT_PRINT_VOLUME - append_menu_item(menu, wxID_ANY, _(L("Scale to print volume")), _(L("Scale the selected object to fit the print volume")), - [this](wxCommandEvent&) { scale_selection_to_fit_print_volume(); }, "", menu); + sidebar->obj_list()->append_menu_item_scale_selection_to_fit_print_volume(menu); #endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME wxMenu* mirror_menu = new wxMenu(); From 3aa14bddf519bc86d907421c56012d27c9bc3bb9 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 23 May 2019 13:49:57 +0200 Subject: [PATCH 06/64] Max texture size dependent on OpenGL version on Win and Linux and on retina monitors on Mac --- src/libslic3r/Technologies.hpp | 7 +- src/slic3r/GUI/3DBed.cpp | 8 ++ src/slic3r/GUI/3DScene.cpp | 4 + src/slic3r/GUI/GLCanvas3D.cpp | 7 +- src/slic3r/GUI/GLCanvas3DManager.cpp | 155 +++++++++++++++++++++++++++ src/slic3r/GUI/GLCanvas3DManager.hpp | 47 ++++++++ src/slic3r/GUI/GLTexture.cpp | 18 ++++ 7 files changed, 243 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 0bf984b1bf..e571965549 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -12,7 +12,7 @@ // Renders a small sphere in the center of the bounding box of the current selection when no gizmo is active #define ENABLE_RENDER_SELECTION_CENTER 0 // Shows an imgui dialog with render related data -#define ENABLE_RENDER_STATISTICS 0 +#define ENABLE_RENDER_STATISTICS 1 //==================== @@ -47,7 +47,10 @@ // Enable saving textures on GPU in compressed format -#define ENABLE_COMPRESSED_TEXTURES 0 +#define ENABLE_COMPRESSED_TEXTURES 1 + +// Enable texture max size to be dependent on detected OpenGL version +#define ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION 1 // Enable scale object to fit print volume #define ENABLE_SCALE_TO_FIT_PRINT_VOLUME 1 diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index 8392e534a4..2f20a65d90 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -493,6 +493,13 @@ void Bed3D::render_prusa(const std::string &key, bool bottom) const std::string model_path = resources_dir() + "/models/" + key; +#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION + // use anisotropic filter if graphic card allows + GLfloat max_anisotropy = GLCanvas3DManager::get_gl_info().get_max_anisotropy(); + + // use higher resolution images if graphic card and opengl version allow + GLint max_tex_size = GLCanvas3DManager::get_gl_info().get_max_tex_size(); +#else // use anisotropic filter if graphic card allows GLfloat max_anisotropy = 0.0f; if (glewIsSupported("GL_EXT_texture_filter_anisotropic")) @@ -504,6 +511,7 @@ void Bed3D::render_prusa(const std::string &key, bool bottom) const // clamp or the texture generation becomes too slow max_tex_size = std::min(max_tex_size, 8192); +#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION std::string filename = tex_path + ".svg"; diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index 59480de1ce..37e022329c 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -2026,7 +2026,11 @@ bool GLBed::on_init_from_file(const std::string& filename, bool useVBOs) std::string _3DScene::get_gl_info(bool format_as_html, bool extensions) { +#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION + return Slic3r::GUI::GLCanvas3DManager::get_gl_info().to_string(format_as_html, extensions); +#else return s_canvas_mgr.get_gl_info(format_as_html, extensions); +#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION } bool _3DScene::add_canvas(wxGLCanvas* canvas, GUI::Bed3D& bed, GUI::Camera& camera, GUI::GLToolbar& view_toolbar) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index bac3a3c64f..0630e42656 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1714,8 +1714,13 @@ void GLCanvas3D::render() ImGui::Separator(); imgui.text("Textures: "); ImGui::SameLine(); - imgui.text(GLCanvas3DManager::are_compressed_textures_supported() ? "Compressed" : "Uncompressed"); + imgui.text(GLCanvas3DManager::are_compressed_textures_supported() ? "compressed" : "uncompressed"); #endif // ENABLE_COMPRESSED_TEXTURES +#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION + imgui.text("Max texture size: "); + ImGui::SameLine(); + imgui.text(std::to_string(GLCanvas3DManager::get_gl_info().get_max_tex_size())); +#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION imgui.end(); #endif // ENABLE_RENDER_STATISTICS diff --git a/src/slic3r/GUI/GLCanvas3DManager.cpp b/src/slic3r/GUI/GLCanvas3DManager.cpp index 5f4391a5e2..d213990ba3 100644 --- a/src/slic3r/GUI/GLCanvas3DManager.cpp +++ b/src/slic3r/GUI/GLCanvas3DManager.cpp @@ -15,17 +15,115 @@ #include #include +#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION +#ifdef __APPLE__ +#include "../Utils/MacDarkMode.hpp" +#endif // __APPLE__ +#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION + namespace Slic3r { namespace GUI { GLCanvas3DManager::GLInfo::GLInfo() +#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION + : m_detected(false) + , m_version("") + , m_glsl_version("") + , m_vendor("") + , m_renderer("") + , m_max_tex_size(0) + , m_max_anisotropy(0.0f) +#else : version("") , glsl_version("") , vendor("") , renderer("") +#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION { } +#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION +const std::string& GLCanvas3DManager::GLInfo::get_version() const +{ + if (!m_detected) + detect(); + + return m_version; +} + +const std::string& GLCanvas3DManager::GLInfo::get_glsl_version() const +{ + if (!m_detected) + detect(); + + return m_glsl_version; +} + +const std::string& GLCanvas3DManager::GLInfo::get_vendor() const +{ + if (!m_detected) + detect(); + + return m_vendor; +} + +const std::string& GLCanvas3DManager::GLInfo::get_renderer() const +{ + if (!m_detected) + detect(); + + return m_renderer; +} + +int GLCanvas3DManager::GLInfo::get_max_tex_size() const +{ + if (!m_detected) + detect(); + + // clamp to avoid the texture generation become too slow and use too much GPU memory +#ifdef __APPLE__ + // and use smaller texture for non retina systems + return (Slic3r::GUI::mac_max_scaling_factor() > 1.0) ? std::min(m_max_tex_size, 8192) : std::min(m_max_tex_size / 2, 4096); +#else + // and use smaller texture for older OpenGL versions + return is_version_greater_or_equal_to(3, 0) ? std::min(m_max_tex_size, 8192) : std::min(m_max_tex_size / 2, 4096); +#endif // __APPLE__ +} + +float GLCanvas3DManager::GLInfo::get_max_anisotropy() const +{ + if (!m_detected) + detect(); + + return m_max_anisotropy; +} + +void GLCanvas3DManager::GLInfo::detect() const +{ + const char* data = (const char*)::glGetString(GL_VERSION); + if (data != nullptr) + m_version = data; + + data = (const char*)::glGetString(GL_SHADING_LANGUAGE_VERSION); + if (data != nullptr) + m_glsl_version = data; + + data = (const char*)::glGetString(GL_VENDOR); + if (data != nullptr) + m_vendor = data; + + data = (const char*)::glGetString(GL_RENDERER); + if (data != nullptr) + m_renderer = data; + + glsafe(::glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_max_tex_size)); + + if (GLEW_EXT_texture_filter_anisotropic) + glsafe(::glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &m_max_anisotropy)); + + m_detected = true; +} +#else void GLCanvas3DManager::GLInfo::detect() { const char* data = (const char*)::glGetString(GL_VERSION); @@ -44,7 +142,40 @@ void GLCanvas3DManager::GLInfo::detect() if (data != nullptr) renderer = data; } +#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION +#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION +bool GLCanvas3DManager::GLInfo::is_version_greater_or_equal_to(unsigned int major, unsigned int minor) const +{ + if (!m_detected) + detect(); + + std::vector tokens; + boost::split(tokens, m_version, boost::is_any_of(" "), boost::token_compress_on); + + if (tokens.empty()) + return false; + + std::vector numbers; + boost::split(numbers, tokens[0], boost::is_any_of("."), boost::token_compress_on); + + unsigned int gl_major = 0; + unsigned int gl_minor = 0; + + if (numbers.size() > 0) + gl_major = ::atoi(numbers[0].c_str()); + + if (numbers.size() > 1) + gl_minor = ::atoi(numbers[1].c_str()); + + if (gl_major < major) + return false; + else if (gl_major > major) + return true; + else + return gl_minor >= minor; +} +#else bool GLCanvas3DManager::GLInfo::is_version_greater_or_equal_to(unsigned int major, unsigned int minor) const { std::vector tokens; @@ -72,9 +203,15 @@ bool GLCanvas3DManager::GLInfo::is_version_greater_or_equal_to(unsigned int majo else return gl_minor >= minor; } +#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION std::string GLCanvas3DManager::GLInfo::to_string(bool format_as_html, bool extensions) const { +#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION + if (!m_detected) + detect(); +#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION + std::stringstream out; std::string h2_start = format_as_html ? "" : ""; @@ -84,10 +221,17 @@ std::string GLCanvas3DManager::GLInfo::to_string(bool format_as_html, bool exten std::string line_end = format_as_html ? "
" : "\n"; out << h2_start << "OpenGL installation" << h2_end << line_end; +#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION + out << b_start << "GL version: " << b_end << (m_version.empty() ? "N/A" : m_version) << line_end; + out << b_start << "Vendor: " << b_end << (m_vendor.empty() ? "N/A" : m_vendor) << line_end; + out << b_start << "Renderer: " << b_end << (m_renderer.empty() ? "N/A" : m_renderer) << line_end; + out << b_start << "GLSL version: " << b_end << (m_glsl_version.empty() ? "N/A" : m_glsl_version) << line_end; +#else out << b_start << "GL version: " << b_end << (version.empty() ? "N/A" : version) << line_end; out << b_start << "Vendor: " << b_end << (vendor.empty() ? "N/A" : vendor) << line_end; out << b_start << "Renderer: " << b_end << (renderer.empty() ? "N/A" : renderer) << line_end; out << b_start << "GLSL version: " << b_end << (glsl_version.empty() ? "N/A" : glsl_version) << line_end; +#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION if (extensions) { @@ -114,6 +258,9 @@ GLCanvas3DManager::EMultisampleState GLCanvas3DManager::s_multisample = GLCanvas #if ENABLE_COMPRESSED_TEXTURES bool GLCanvas3DManager::s_compressed_textures_supported = false; #endif // ENABLE_COMPRESSED_TEXTURES +#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION +GLCanvas3DManager::GLInfo GLCanvas3DManager::s_gl_info; +#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION GLCanvas3DManager::GLCanvas3DManager() : m_context(nullptr) @@ -193,10 +340,16 @@ void GLCanvas3DManager::init_gl() if (!m_gl_initialized) { glewInit(); +#if !ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION m_gl_info.detect(); +#endif // !ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION const AppConfig* config = GUI::get_app_config(); m_use_legacy_opengl = (config == nullptr) || (config->get("use_legacy_opengl") == "1"); +#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION + m_use_VBOs = !m_use_legacy_opengl && s_gl_info.is_version_greater_or_equal_to(2, 0); +#else m_use_VBOs = !m_use_legacy_opengl && m_gl_info.is_version_greater_or_equal_to(2, 0); +#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION m_gl_initialized = true; #if ENABLE_COMPRESSED_TEXTURES if (GLEW_EXT_texture_compression_s3tc) @@ -207,10 +360,12 @@ void GLCanvas3DManager::init_gl() } } +#if !ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION std::string GLCanvas3DManager::get_gl_info(bool format_as_html, bool extensions) const { return m_gl_info.to_string(format_as_html, extensions); } +#endif // !ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION bool GLCanvas3DManager::init(wxGLCanvas* canvas) { diff --git a/src/slic3r/GUI/GLCanvas3DManager.hpp b/src/slic3r/GUI/GLCanvas3DManager.hpp index d391cd60c7..3ad30411c2 100644 --- a/src/slic3r/GUI/GLCanvas3DManager.hpp +++ b/src/slic3r/GUI/GLCanvas3DManager.hpp @@ -29,6 +29,39 @@ struct Camera; class GLCanvas3DManager { +#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION +public: + class GLInfo + { + mutable bool m_detected; + + mutable std::string m_version; + mutable std::string m_glsl_version; + mutable std::string m_vendor; + mutable std::string m_renderer; + + mutable int m_max_tex_size; + mutable float m_max_anisotropy; + + public: + GLInfo(); + + const std::string& get_version() const; + const std::string& get_glsl_version() const; + const std::string& get_vendor() const; + const std::string& get_renderer() const; + + int get_max_tex_size() const; + float get_max_anisotropy() const; + + bool is_version_greater_or_equal_to(unsigned int major, unsigned int minor) const; + + std::string to_string(bool format_as_html, bool extensions) const; + + private: + void detect() const; + }; +#else struct GLInfo { std::string version; @@ -43,7 +76,11 @@ class GLCanvas3DManager std::string to_string(bool format_as_html, bool extensions) const; }; +#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION +#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION +private: +#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION enum EMultisampleState : unsigned char { MS_Unknown, @@ -55,7 +92,11 @@ class GLCanvas3DManager CanvasesMap m_canvases; wxGLContext* m_context; +#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION + static GLInfo s_gl_info; +#else GLInfo m_gl_info; +#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION bool m_gl_initialized; bool m_use_legacy_opengl; bool m_use_VBOs; @@ -75,7 +116,9 @@ public: unsigned int count() const; void init_gl(); +#if !ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION std::string get_gl_info(bool format_as_html, bool extensions) const; +#endif // !ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION bool init(wxGLCanvas* canvas); @@ -88,6 +131,10 @@ public: static wxGLCanvas* create_wxglcanvas(wxWindow *parent); +#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION + static const GLInfo& get_gl_info() { return s_gl_info; } +#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION + private: CanvasesMap::iterator do_get_canvas(wxGLCanvas* canvas); CanvasesMap::const_iterator do_get_canvas(wxGLCanvas* canvas) const; diff --git a/src/slic3r/GUI/GLTexture.cpp b/src/slic3r/GUI/GLTexture.cpp index f7d2edfe7b..2216a14f24 100644 --- a/src/slic3r/GUI/GLTexture.cpp +++ b/src/slic3r/GUI/GLTexture.cpp @@ -18,6 +18,10 @@ #include "libslic3r/Utils.hpp" +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +#include +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + namespace Slic3r { namespace GUI { @@ -380,6 +384,10 @@ bool GLTexture::load_from_png(const std::string& filename, bool use_mipmaps) bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, unsigned int max_size_px) { +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + auto start_time = std::chrono::high_resolution_clock::now(); +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + NSVGimage* image = nsvgParseFromFile(filename.c_str(), "px", 96.0f); if (image == nullptr) { @@ -426,6 +434,11 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns #else glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); #endif // ENABLE_COMPRESSED_TEXTURES +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + auto end_time = std::chrono::high_resolution_clock::now(); + std::cout << "texture level 0 to GPU in: " << std::chrono::duration_cast(end_time - start_time).count() << std::endl; + start_time = end_time; +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ if (use_mipmaps) { // we manually generate mipmaps because glGenerateMipmap() function is not reliable on all graphics cards @@ -468,6 +481,11 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns nsvgDeleteRasterizer(rast); nsvgDelete(image); +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + end_time = std::chrono::high_resolution_clock::now(); + std::cout << "mipmaps to GPU in: " << std::chrono::duration_cast(end_time - start_time).count() << std::endl; +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + return true; } From e0da08906b62911be2f8128dc249e0862e4a5165 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 27 May 2019 09:20:48 +0200 Subject: [PATCH 07/64] Disabled debug render statistics dialog --- src/libslic3r/Technologies.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 6822582c86..d7e5aed768 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -12,7 +12,7 @@ // Renders a small sphere in the center of the bounding box of the current selection when no gizmo is active #define ENABLE_RENDER_SELECTION_CENTER 0 // Shows an imgui dialog with render related data -#define ENABLE_RENDER_STATISTICS 1 +#define ENABLE_RENDER_STATISTICS 0 //==================== From 886da08f89f8d9a4a2149c2784305b18a24ac5f3 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Tue, 28 May 2019 12:53:16 +0200 Subject: [PATCH 08/64] Texture compression set as an option --- src/slic3r/GUI/3DBed.cpp | 4 ++ src/slic3r/GUI/GLCanvas3D.cpp | 36 +++++++++++-- src/slic3r/GUI/GLCanvas3D.hpp | 8 +++ src/slic3r/GUI/GLTexture.cpp | 64 +++++++++++++++-------- src/slic3r/GUI/GLTexture.hpp | 19 +++++++ src/slic3r/GUI/GLToolbar.cpp | 8 +++ src/slic3r/GUI/Gizmos/GLGizmosManager.cpp | 8 +++ src/slic3r/GUI/ImGuiWrapper.cpp | 10 +++- src/slic3r/GUI/ImGuiWrapper.hpp | 4 ++ 9 files changed, 133 insertions(+), 28 deletions(-) diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index 2f20a65d90..4c4e600e8e 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -517,7 +517,11 @@ void Bed3D::render_prusa(const std::string &key, bool bottom) const if ((m_texture.get_id() == 0) || (m_texture.get_source() != filename)) { +#if ENABLE_COMPRESSED_TEXTURES + if (!m_texture.load_from_svg_file(filename, true, true, max_tex_size)) +#else if (!m_texture.load_from_svg_file(filename, true, max_tex_size)) +#endif // ENABLE_COMPRESSED_TEXTURES { render_custom(); return; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index f64ed41a4a..f7d685502a 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -405,7 +405,11 @@ void GLCanvas3D::LayersEditing::_render_tooltip_texture(const GLCanvas3D& canvas if (m_tooltip_texture.get_id() == 0) { std::string filename = resources_dir() + "/icons/variable_layer_height_tooltip.png"; +#if ENABLE_COMPRESSED_TEXTURES + if (!m_tooltip_texture.load_from_file(filename, false, true)) +#else if (!m_tooltip_texture.load_from_file(filename, false)) +#endif // ENABLE_COMPRESSED_TEXTURES return; } @@ -437,7 +441,11 @@ void GLCanvas3D::LayersEditing::_render_reset_texture(const Rect& reset_rect) co if (m_reset_texture.get_id() == 0) { std::string filename = resources_dir() + "/icons/variable_layer_height_reset.png"; +#if ENABLE_COMPRESSED_TEXTURES + if (!m_reset_texture.load_from_file(filename, false, true)) +#else if (!m_reset_texture.load_from_file(filename, false)) +#endif // ENABLE_COMPRESSED_TEXTURES return; } @@ -729,7 +737,11 @@ void GLCanvas3D::WarningTexture::activate(WarningTexture::Warning warning, bool } } +#if ENABLE_COMPRESSED_TEXTURES + generate(text, canvas, true, red_colored); // GUI::GLTexture::reset() is called at the beginning of generate(...) +#else _generate(text, canvas, red_colored); // GUI::GLTexture::reset() is called at the beginning of generate(...) +#endif // ENABLE_COMPRESSED_TEXTURES // save information for rescaling m_msg_text = text; @@ -790,7 +802,11 @@ static void msw_disable_cleartype(wxFont &font) } #endif /* __WXMSW__ */ +#if ENABLE_COMPRESSED_TEXTURES +bool GLCanvas3D::WarningTexture::generate(const std::string& msg_utf8, const GLCanvas3D& canvas, bool compress, bool red_colored/* = false*/) +#else bool GLCanvas3D::WarningTexture::_generate(const std::string& msg_utf8, const GLCanvas3D& canvas, const bool red_colored/* = false*/) +#endif // ENABLE_COMPRESSED_TEXTURES { reset(); @@ -865,7 +881,7 @@ bool GLCanvas3D::WarningTexture::_generate(const std::string& msg_utf8, const GL glsafe(::glGenTextures(1, &m_id)); glsafe(::glBindTexture(GL_TEXTURE_2D, (GLuint)m_id)); #if ENABLE_COMPRESSED_TEXTURES - if (GLEW_EXT_texture_compression_s3tc) + if (compress && GLEW_EXT_texture_compression_s3tc) glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); else glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); @@ -922,7 +938,11 @@ void GLCanvas3D::WarningTexture::msw_rescale(const GLCanvas3D& canvas) if (m_msg_text.empty()) return; +#if ENABLE_COMPRESSED_TEXTURES + generate(m_msg_text, canvas, true, m_is_colored_red); +#else _generate(m_msg_text, canvas, m_is_colored_red); +#endif // ENABLE_COMPRESSED_TEXTURES } const unsigned char GLCanvas3D::LegendTexture::Squares_Border_Color[3] = { 64, 64, 64 }; @@ -965,7 +985,11 @@ void GLCanvas3D::LegendTexture::fill_color_print_legend_values(const GCodePrevie } } +#if ENABLE_COMPRESSED_TEXTURES +bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, const std::vector& tool_colors, const GLCanvas3D& canvas, bool compress) +#else bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, const std::vector& tool_colors, const GLCanvas3D& canvas) +#endif // ENABLE_COMPRESSED_TEXTURES { reset(); @@ -1155,7 +1179,7 @@ bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, c glsafe(::glGenTextures(1, &m_id)); glsafe(::glBindTexture(GL_TEXTURE_2D, (GLuint)m_id)); #if ENABLE_COMPRESSED_TEXTURES - if (GLEW_EXT_texture_compression_s3tc) + if (compress && GLEW_EXT_texture_compression_s3tc) glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); else glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); @@ -1714,9 +1738,9 @@ void GLCanvas3D::render() imgui.text(" ms"); #if ENABLE_COMPRESSED_TEXTURES ImGui::Separator(); - imgui.text("Textures: "); + imgui.text("Compressed textures: "); ImGui::SameLine(); - imgui.text(GLCanvas3DManager::are_compressed_textures_supported() ? "compressed" : "uncompressed"); + imgui.text(GLCanvas3DManager::are_compressed_textures_supported() ? "supported" : "not supported"); #endif // ENABLE_COMPRESSED_TEXTURES #if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION imgui.text("Max texture size: "); @@ -5698,7 +5722,11 @@ std::vector GLCanvas3D::_parse_colors(const std::vector& col void GLCanvas3D::_generate_legend_texture(const GCodePreviewData& preview_data, const std::vector& tool_colors) { +#if ENABLE_COMPRESSED_TEXTURES + m_legend_texture.generate(preview_data, tool_colors, *this, true); +#else m_legend_texture.generate(preview_data, tool_colors, *this); +#endif // ENABLE_COMPRESSED_TEXTURES } void GLCanvas3D::_set_warning_texture(WarningTexture::Warning warning, bool state) diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 51a36cf69f..6d77a507f1 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -374,7 +374,11 @@ class GLCanvas3D std::vector m_warnings; // Generates the texture with given text. +#if ENABLE_COMPRESSED_TEXTURES + bool generate(const std::string& msg, const GLCanvas3D& canvas, bool compress, bool red_colored = false); +#else bool _generate(const std::string& msg, const GLCanvas3D& canvas, const bool red_colored = false); +#endif // ENABLE_COMPRESSED_TEXTURES }; class LegendTexture : public GUI::GLTexture @@ -397,7 +401,11 @@ class GLCanvas3D void fill_color_print_legend_values(const GCodePreviewData& preview_data, const GLCanvas3D& canvas, std::vector>& cp_legend_values); +#if ENABLE_COMPRESSED_TEXTURES + bool generate(const GCodePreviewData& preview_data, const std::vector& tool_colors, const GLCanvas3D& canvas, bool compress); +#else bool generate(const GCodePreviewData& preview_data, const std::vector& tool_colors, const GLCanvas3D& canvas); +#endif // ENABLE_COMPRESSED_TEXTURES void render(const GLCanvas3D& canvas) const; }; diff --git a/src/slic3r/GUI/GLTexture.cpp b/src/slic3r/GUI/GLTexture.cpp index 2216a14f24..bdd7ee6248 100644 --- a/src/slic3r/GUI/GLTexture.cpp +++ b/src/slic3r/GUI/GLTexture.cpp @@ -18,10 +18,6 @@ #include "libslic3r/Utils.hpp" -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -#include -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - namespace Slic3r { namespace GUI { @@ -40,7 +36,11 @@ GLTexture::~GLTexture() reset(); } +#if ENABLE_COMPRESSED_TEXTURES +bool GLTexture::load_from_file(const std::string& filename, bool use_mipmaps, bool compress) +#else bool GLTexture::load_from_file(const std::string& filename, bool use_mipmaps) +#endif // ENABLE_COMPRESSED_TEXTURES { reset(); @@ -48,12 +48,20 @@ bool GLTexture::load_from_file(const std::string& filename, bool use_mipmaps) return false; if (boost::algorithm::iends_with(filename, ".png")) +#if ENABLE_COMPRESSED_TEXTURES + return load_from_png(filename, use_mipmaps, compress); +#else return load_from_png(filename, use_mipmaps); +#endif // ENABLE_COMPRESSED_TEXTURES else return false; } +#if ENABLE_COMPRESSED_TEXTURES +bool GLTexture::load_from_svg_file(const std::string& filename, bool use_mipmaps, bool compress, unsigned int max_size_px) +#else bool GLTexture::load_from_svg_file(const std::string& filename, bool use_mipmaps, unsigned int max_size_px) +#endif // ENABLE_COMPRESSED_TEXTURES { reset(); @@ -61,12 +69,20 @@ bool GLTexture::load_from_svg_file(const std::string& filename, bool use_mipmaps return false; if (boost::algorithm::iends_with(filename, ".svg")) +#if ENABLE_COMPRESSED_TEXTURES + return load_from_svg(filename, use_mipmaps, compress, max_size_px); +#else return load_from_svg(filename, use_mipmaps, max_size_px); +#endif // ENABLE_COMPRESSED_TEXTURES else return false; } +#if ENABLE_COMPRESSED_TEXTURES +bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector& filenames, const std::vector>& states, unsigned int sprite_size_px, bool compress) +#else bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector& filenames, const std::vector>& states, unsigned int sprite_size_px) +#endif // ENABLE_COMPRESSED_TEXTURES { reset(); @@ -183,7 +199,7 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector(end_time - start_time).count() << std::endl; - start_time = end_time; -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ if (use_mipmaps) { // we manually generate mipmaps because glGenerateMipmap() function is not reliable on all graphics cards @@ -455,7 +478,7 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns nsvgRasterize(rast, image, 0, 0, scale, data.data(), lod_w, lod_h, lod_w * 4); #if ENABLE_COMPRESSED_TEXTURES - if (GLEW_EXT_texture_compression_s3tc) + if (compress && GLEW_EXT_texture_compression_s3tc) glsafe(::glTexImage2D(GL_TEXTURE_2D, level, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, (GLsizei)lod_w, (GLsizei)lod_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); else glsafe(::glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, (GLsizei)lod_w, (GLsizei)lod_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); @@ -481,11 +504,6 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns nsvgDeleteRasterizer(rast); nsvgDelete(image); -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - end_time = std::chrono::high_resolution_clock::now(); - std::cout << "mipmaps to GPU in: " << std::chrono::duration_cast(end_time - start_time).count() << std::endl; -//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - return true; } diff --git a/src/slic3r/GUI/GLTexture.hpp b/src/slic3r/GUI/GLTexture.hpp index e00b3a3bea..b474f7b053 100644 --- a/src/slic3r/GUI/GLTexture.hpp +++ b/src/slic3r/GUI/GLTexture.hpp @@ -38,8 +38,13 @@ namespace GUI { GLTexture(); virtual ~GLTexture(); +#if ENABLE_COMPRESSED_TEXTURES + bool load_from_file(const std::string& filename, bool use_mipmaps, bool compress); + bool load_from_svg_file(const std::string& filename, bool use_mipmaps, bool compress, unsigned int max_size_px); +#else bool load_from_file(const std::string& filename, bool use_mipmaps); bool load_from_svg_file(const std::string& filename, bool use_mipmaps, unsigned int max_size_px); +#endif // ENABLE_COMPRESSED_TEXTURES // meanings of states: (std::pair) // first field (int): // 0 -> no changes @@ -48,7 +53,11 @@ namespace GUI { // second field (bool): // false -> no changes // true -> add background color +#if ENABLE_COMPRESSED_TEXTURES + bool load_from_svg_files_as_sprites_array(const std::vector& filenames, const std::vector>& states, unsigned int sprite_size_px, bool compress); +#else bool load_from_svg_files_as_sprites_array(const std::vector& filenames, const std::vector>& states, unsigned int sprite_size_px); +#endif // ENABLE_COMPRESSED_TEXTURES void reset(); unsigned int get_id() const { return m_id; } @@ -61,10 +70,20 @@ namespace GUI { static void render_sub_texture(unsigned int tex_id, float left, float right, float bottom, float top, const Quad_UVs& uvs); protected: +#if ENABLE_COMPRESSED_TEXTURES + unsigned int generate_mipmaps(wxImage& image, bool compress); +#else unsigned int generate_mipmaps(wxImage& image); +#endif // ENABLE_COMPRESSED_TEXTURES + private: +#if ENABLE_COMPRESSED_TEXTURES + bool load_from_png(const std::string& filename, bool use_mipmaps, bool compress); + bool load_from_svg(const std::string& filename, bool use_mipmaps, bool compress, unsigned int max_size_px); +#else bool load_from_png(const std::string& filename, bool use_mipmaps); bool load_from_svg(const std::string& filename, bool use_mipmaps, unsigned int max_size_px); +#endif // ENABLE_COMPRESSED_TEXTURES }; } // namespace GUI diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp index 00cbdfec71..813a319b80 100644 --- a/src/slic3r/GUI/GLToolbar.cpp +++ b/src/slic3r/GUI/GLToolbar.cpp @@ -194,7 +194,11 @@ bool GLToolbar::init(const ItemsIconsTexture::Metadata& icons_texture, const Bac #endif // ENABLE_SVG_ICONS if (!background_texture.filename.empty()) +#if ENABLE_COMPRESSED_TEXTURES + res = m_background_texture.texture.load_from_file(path + background_texture.filename, false, true); +#else res = m_background_texture.texture.load_from_file(path + background_texture.filename, false); +#endif // ENABLE_COMPRESSED_TEXTURES if (res) m_background_texture.metadata = background_texture; @@ -1338,7 +1342,11 @@ bool GLToolbar::generate_icons_texture() const states.push_back(std::make_pair(1, true)); } +#if ENABLE_COMPRESSED_TEXTURES + bool res = m_icons_texture.load_from_svg_files_as_sprites_array(filenames, states, (unsigned int)(m_layout.icons_size * m_layout.scale), true); +#else bool res = m_icons_texture.load_from_svg_files_as_sprites_array(filenames, states, (unsigned int)(m_layout.icons_size * m_layout.scale)); +#endif // ENABLE_COMPRESSED_TEXTURES if (res) m_icons_texture_dirty = false; diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index 1006d2bd1e..c254f5796d 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -65,7 +65,11 @@ bool GLGizmosManager::init(GLCanvas3D& parent) if (!m_background_texture.metadata.filename.empty()) { +#if ENABLE_COMPRESSED_TEXTURES + if (!m_background_texture.texture.load_from_file(resources_dir() + "/icons/" + m_background_texture.metadata.filename, false, true)) +#else if (!m_background_texture.texture.load_from_file(resources_dir() + "/icons/" + m_background_texture.metadata.filename, false)) +#endif // ENABLE_COMPRESSED_TEXTURES { reset(); return false; @@ -1160,7 +1164,11 @@ bool GLGizmosManager::generate_icons_texture() const states.push_back(std::make_pair(0, false)); states.push_back(std::make_pair(0, true)); +#if ENABLE_COMPRESSED_TEXTURES + bool res = m_icons_texture.load_from_svg_files_as_sprites_array(filenames, states, (unsigned int)(m_overlay_icons_size * m_overlay_scale), true); +#else bool res = m_icons_texture.load_from_svg_files_as_sprites_array(filenames, states, (unsigned int)(m_overlay_icons_size * m_overlay_scale)); +#endif // ENABLE_COMPRESSED_TEXTURES if (res) m_icons_texture_dirty = false; diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index 9202c0ac38..7267da2956 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -206,7 +206,11 @@ void ImGuiWrapper::new_frame() } if (m_font_texture == 0) { +#if ENABLE_COMPRESSED_TEXTURES + init_font(true); +#else init_font(); +#endif // ENABLE_COMPRESSED_TEXTURES } ImGui::NewFrame(); @@ -383,7 +387,11 @@ bool ImGuiWrapper::want_any_input() const return io.WantCaptureMouse || io.WantCaptureKeyboard || io.WantTextInput; } +#if ENABLE_COMPRESSED_TEXTURES +void ImGuiWrapper::init_font(bool compress) +#else void ImGuiWrapper::init_font() +#endif // ENABLE_COMPRESSED_TEXTURES { destroy_font(); @@ -413,7 +421,7 @@ void ImGuiWrapper::init_font() glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); glsafe(::glPixelStorei(GL_UNPACK_ROW_LENGTH, 0)); #if ENABLE_COMPRESSED_TEXTURES - if (GLEW_EXT_texture_compression_s3tc) + if (compress && GLEW_EXT_texture_compression_s3tc) glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels)); else glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels)); diff --git a/src/slic3r/GUI/ImGuiWrapper.hpp b/src/slic3r/GUI/ImGuiWrapper.hpp index 37ef90ff35..a1e4048ac6 100644 --- a/src/slic3r/GUI/ImGuiWrapper.hpp +++ b/src/slic3r/GUI/ImGuiWrapper.hpp @@ -77,7 +77,11 @@ public: bool want_any_input() const; private: +#if ENABLE_COMPRESSED_TEXTURES + void init_font(bool compress); +#else void init_font(); +#endif // ENABLE_COMPRESSED_TEXTURES void init_input(); void init_style(); void render_draw_data(ImDrawData *draw_data); From 8012499206ba2a4fa1b667ce47e4254b5f378aca Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Tue, 28 May 2019 15:21:34 +0200 Subject: [PATCH 09/64] Application of anisotropy to textures moved into GLTexture methods --- src/slic3r/GUI/3DBed.cpp | 8 +++++++- src/slic3r/GUI/GLTexture.cpp | 13 ++++++++++--- src/slic3r/GUI/GLTexture.hpp | 4 ++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index 4c4e600e8e..91275f4e62 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -494,16 +494,20 @@ void Bed3D::render_prusa(const std::string &key, bool bottom) const std::string model_path = resources_dir() + "/models/" + key; #if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION +#if !ENABLE_COMPRESSED_TEXTURES // use anisotropic filter if graphic card allows GLfloat max_anisotropy = GLCanvas3DManager::get_gl_info().get_max_anisotropy(); +#endif // !ENABLE_COMPRESSED_TEXTURES // use higher resolution images if graphic card and opengl version allow GLint max_tex_size = GLCanvas3DManager::get_gl_info().get_max_tex_size(); #else +#if !ENABLE_COMPRESSED_TEXTURES // use anisotropic filter if graphic card allows GLfloat max_anisotropy = 0.0f; if (glewIsSupported("GL_EXT_texture_filter_anisotropic")) glsafe(::glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropy)); +#endif // !ENABLE_COMPRESSED_TEXTURES // use higher resolution images if graphic card allows GLint max_tex_size; @@ -518,7 +522,7 @@ void Bed3D::render_prusa(const std::string &key, bool bottom) const if ((m_texture.get_id() == 0) || (m_texture.get_source() != filename)) { #if ENABLE_COMPRESSED_TEXTURES - if (!m_texture.load_from_svg_file(filename, true, true, max_tex_size)) + if (!m_texture.load_from_svg_file(filename, true, true, true, max_tex_size)) #else if (!m_texture.load_from_svg_file(filename, true, max_tex_size)) #endif // ENABLE_COMPRESSED_TEXTURES @@ -527,12 +531,14 @@ void Bed3D::render_prusa(const std::string &key, bool bottom) const return; } +#if !ENABLE_COMPRESSED_TEXTURES if (max_anisotropy > 0.0f) { glsafe(::glBindTexture(GL_TEXTURE_2D, m_texture.get_id())); glsafe(::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy)); glsafe(::glBindTexture(GL_TEXTURE_2D, 0)); } +#endif // !ENABLE_COMPRESSED_TEXTURES } if (!bottom) diff --git a/src/slic3r/GUI/GLTexture.cpp b/src/slic3r/GUI/GLTexture.cpp index bdd7ee6248..9c1e1f22ef 100644 --- a/src/slic3r/GUI/GLTexture.cpp +++ b/src/slic3r/GUI/GLTexture.cpp @@ -58,7 +58,7 @@ bool GLTexture::load_from_file(const std::string& filename, bool use_mipmaps) } #if ENABLE_COMPRESSED_TEXTURES -bool GLTexture::load_from_svg_file(const std::string& filename, bool use_mipmaps, bool compress, unsigned int max_size_px) +bool GLTexture::load_from_svg_file(const std::string& filename, bool use_mipmaps, bool compress, bool apply_anisotropy, unsigned int max_size_px) #else bool GLTexture::load_from_svg_file(const std::string& filename, bool use_mipmaps, unsigned int max_size_px) #endif // ENABLE_COMPRESSED_TEXTURES @@ -70,7 +70,7 @@ bool GLTexture::load_from_svg_file(const std::string& filename, bool use_mipmaps if (boost::algorithm::iends_with(filename, ".svg")) #if ENABLE_COMPRESSED_TEXTURES - return load_from_svg(filename, use_mipmaps, compress, max_size_px); + return load_from_svg(filename, use_mipmaps, compress, apply_anisotropy, max_size_px); #else return load_from_svg(filename, use_mipmaps, max_size_px); #endif // ENABLE_COMPRESSED_TEXTURES @@ -411,7 +411,7 @@ bool GLTexture::load_from_png(const std::string& filename, bool use_mipmaps) } #if ENABLE_COMPRESSED_TEXTURES -bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, bool compress, unsigned int max_size_px) +bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, bool compress, bool apply_anisotropy, unsigned int max_size_px) #else bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, unsigned int max_size_px) #endif // ENABLE_COMPRESSED_TEXTURES @@ -455,6 +455,13 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns glsafe(::glGenTextures(1, &m_id)); glsafe(::glBindTexture(GL_TEXTURE_2D, m_id)); #if ENABLE_COMPRESSED_TEXTURES + if (apply_anisotropy) + { + GLfloat max_anisotropy = GLCanvas3DManager::get_gl_info().get_max_anisotropy(); + if (max_anisotropy > 1.0f) + glsafe(::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy)); + } + if (compress && GLEW_EXT_texture_compression_s3tc) glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); else diff --git a/src/slic3r/GUI/GLTexture.hpp b/src/slic3r/GUI/GLTexture.hpp index b474f7b053..032d19121f 100644 --- a/src/slic3r/GUI/GLTexture.hpp +++ b/src/slic3r/GUI/GLTexture.hpp @@ -40,7 +40,7 @@ namespace GUI { #if ENABLE_COMPRESSED_TEXTURES bool load_from_file(const std::string& filename, bool use_mipmaps, bool compress); - bool load_from_svg_file(const std::string& filename, bool use_mipmaps, bool compress, unsigned int max_size_px); + bool load_from_svg_file(const std::string& filename, bool use_mipmaps, bool compress, bool apply_anisotropy, unsigned int max_size_px); #else bool load_from_file(const std::string& filename, bool use_mipmaps); bool load_from_svg_file(const std::string& filename, bool use_mipmaps, unsigned int max_size_px); @@ -79,7 +79,7 @@ namespace GUI { private: #if ENABLE_COMPRESSED_TEXTURES bool load_from_png(const std::string& filename, bool use_mipmaps, bool compress); - bool load_from_svg(const std::string& filename, bool use_mipmaps, bool compress, unsigned int max_size_px); + bool load_from_svg(const std::string& filename, bool use_mipmaps, bool compress, bool apply_anisotropy, unsigned int max_size_px); #else bool load_from_png(const std::string& filename, bool use_mipmaps); bool load_from_svg(const std::string& filename, bool use_mipmaps, unsigned int max_size_px); From f0baefb6ff92cdc05575b62d562e0453909a4348 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Fri, 31 May 2019 15:25:02 +0200 Subject: [PATCH 10/64] Asynchronous texture compression on CPU --- src/slic3r/GUI/3DBed.cpp | 4 + src/slic3r/GUI/GLTexture.cpp | 164 +++++- src/slic3r/GUI/GLTexture.hpp | 46 ++ src/stb_dxt/stb_dxt.h | 1049 ++++++++++++++++++++++++++++++++++ 4 files changed, 1256 insertions(+), 7 deletions(-) create mode 100644 src/stb_dxt/stb_dxt.h diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index 91275f4e62..e6589e5481 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -540,6 +540,10 @@ void Bed3D::render_prusa(const std::string &key, bool bottom) const } #endif // !ENABLE_COMPRESSED_TEXTURES } +#if ENABLE_COMPRESSED_TEXTURES + else if (m_texture.unsent_compressed_data_available()) + m_texture.send_compressed_data_to_gpu(); +#endif // ENABLE_COMPRESSED_TEXTURES if (!bottom) { diff --git a/src/slic3r/GUI/GLTexture.cpp b/src/slic3r/GUI/GLTexture.cpp index 9c1e1f22ef..cc6bdc715a 100644 --- a/src/slic3r/GUI/GLTexture.cpp +++ b/src/slic3r/GUI/GLTexture.cpp @@ -12,6 +12,12 @@ #include #include +#if ENABLE_COMPRESSED_TEXTURES +#include + +#define STB_DXT_IMPLEMENTATION +#include "stb_dxt/stb_dxt.h" +#endif // ENABLE_COMPRESSED_TEXTURES #include "nanosvg/nanosvg.h" #include "nanosvg/nanosvgrast.h" @@ -21,6 +27,86 @@ namespace Slic3r { namespace GUI { +#if ENABLE_COMPRESSED_TEXTURES +void GLTexture::Compressor::reset() +{ + // force compression completion, if any + m_abort_compressing = true; + // wait for compression completion, if any + while (m_is_compressing) {} + + m_levels.clear(); +} + +void GLTexture::Compressor::add_level(unsigned int w, unsigned int h, const std::vector& data) +{ + m_levels.emplace_back(w, h, data); +} + +void GLTexture::Compressor::start_compressing() +{ + m_is_compressing = true; + m_abort_compressing = false; + std::thread t(&GLTexture::Compressor::compress, this); + t.detach(); +} + +bool GLTexture::Compressor::unsent_compressed_data_available() const +{ + for (const Level& level : m_levels) + { + if (!level.sent_to_gpu && (level.compressed_data.size() > 0)) + return true; + } + + return false; +} + +void GLTexture::Compressor::send_compressed_data_to_gpu() +{ + glsafe(::glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); + glsafe(::glBindTexture(GL_TEXTURE_2D, m_texture.m_id)); + for (int i = 0; i < (int)m_levels.size(); ++i) + { + Level& level = m_levels[i]; + if (!level.sent_to_gpu && (level.compressed_data.size() > 0)) + { + glsafe(::glCompressedTexSubImage2D(GL_TEXTURE_2D, (GLint)i, 0, 0, (GLsizei)level.w, (GLsizei)level.h, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, (GLsizei)level.compressed_data.size(), (const GLvoid*)level.compressed_data.data())); + glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, i)); + glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (i > 0) ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR)); + level.sent_to_gpu = true; + // we are done with the compressed data, we can discard it + level.compressed_data.clear(); + } + } + glsafe(::glBindTexture(GL_TEXTURE_2D, 0)); +} + +void GLTexture::Compressor::compress() +{ + // reference: https://github.com/Cyan4973/RygsDXTc + + for (Level& level : m_levels) + { + if (m_abort_compressing) + break; + + // stb_dxt library, despite claiming that the needed size of the destination buffer is equal to (source buffer size)/4, + // crashes if doing so, so we start with twice the required size + level.compressed_data = std::vector(level.w * level.h * 2, 0); + int compressed_size = 0; + rygCompress(level.compressed_data.data(), level.src_data.data(), level.w, level.h, 1, compressed_size); + level.compressed_data.resize(compressed_size); + + // we are done with the source data, we can discard it + level.src_data.clear(); + } + + m_is_compressing = false; + m_abort_compressing = false; +} +#endif // ENABLE_COMPRESSED_TEXTURES + GLTexture::Quad_UVs GLTexture::FullTextureUVs = { { 0.0f, 1.0f }, { 1.0f, 1.0f }, { 1.0f, 0.0f }, { 0.0f, 0.0f } }; GLTexture::GLTexture() @@ -28,6 +114,9 @@ GLTexture::GLTexture() , m_width(0) , m_height(0) , m_source("") +#if ENABLE_COMPRESSED_TEXTURES + , m_compressor(*this) +#endif // ENABLE_COMPRESSED_TEXTURES { } @@ -249,8 +338,23 @@ void GLTexture::reset() m_width = 0; m_height = 0; m_source = ""; +#if ENABLE_COMPRESSED_TEXTURES + m_compressor.reset(); +#endif // ENABLE_COMPRESSED_TEXTURES } +#if ENABLE_COMPRESSED_TEXTURES +bool GLTexture::unsent_compressed_data_available() const +{ + return m_compressor.unsent_compressed_data_available(); +} + +void GLTexture::send_compressed_data_to_gpu() +{ + m_compressor.send_compressed_data_to_gpu(); +} +#endif // ENABLE_COMPRESSED_TEXTURES + void GLTexture::render_texture(unsigned int tex_id, float left, float right, float bottom, float top) { render_sub_texture(tex_id, left, right, bottom, top, FullTextureUVs); @@ -416,6 +520,8 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, boo bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, unsigned int max_size_px) #endif // ENABLE_COMPRESSED_TEXTURES { + bool compression_enabled = compress && GLEW_EXT_texture_compression_s3tc; + NSVGimage* image = nsvgParseFromFile(filename.c_str(), "px", 96.0f); if (image == nullptr) { @@ -428,6 +534,22 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns m_width = (int)(scale * image->width); m_height = (int)(scale * image->height); + +#if ENABLE_COMPRESSED_TEXTURES + if (compression_enabled) + { + // the stb_dxt compression library seems to like only texture sizes which are a multiple of 4 + int width_rem = m_width % 4; + int height_rem = m_height % 4; + + if (width_rem != 0) + m_width += (4 - width_rem); + + if (height_rem != 0) + m_height += (4 - height_rem); + } +#endif // ENABLE_COMPRESSED_TEXTURES + int n_pixels = m_width * m_height; if (n_pixels <= 0) @@ -462,8 +584,13 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns glsafe(::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy)); } - if (compress && GLEW_EXT_texture_compression_s3tc) - glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); + if (compression_enabled) + { + // initializes the texture on GPU + glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0)); + // and send the uncompressed data to the compressor + m_compressor.add_level((unsigned int)m_width, (unsigned int)m_height, data); + } else glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); #else @@ -475,7 +602,8 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns int lod_w = m_width; int lod_h = m_height; GLint level = 0; - while ((lod_w > 1) || (lod_h > 1)) + // we do not need to generate all levels down to 1x1 + while ((lod_w > 64) || (lod_h > 64)) { ++level; @@ -483,10 +611,19 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns lod_h = std::max(lod_h / 2, 1); scale /= 2.0f; +#if ENABLE_COMPRESSED_TEXTURES + data.resize(lod_w * lod_h * 4); +#endif // ENABLE_COMPRESSED_TEXTURES + nsvgRasterize(rast, image, 0, 0, scale, data.data(), lod_w, lod_h, lod_w * 4); #if ENABLE_COMPRESSED_TEXTURES - if (compress && GLEW_EXT_texture_compression_s3tc) - glsafe(::glTexImage2D(GL_TEXTURE_2D, level, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, (GLsizei)lod_w, (GLsizei)lod_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); + if (compression_enabled) + { + // initializes the texture on GPU + glsafe(::glTexImage2D(GL_TEXTURE_2D, level, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, (GLsizei)lod_w, (GLsizei)lod_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0)); + // and send the uncompressed data to the compressor + m_compressor.add_level((unsigned int)lod_w, (unsigned int)lod_h, data); + } else glsafe(::glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, (GLsizei)lod_w, (GLsizei)lod_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); #else @@ -494,8 +631,15 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns #endif // ENABLE_COMPRESSED_TEXTURES } - glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, level)); - glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR)); +#if ENABLE_COMPRESSED_TEXTURES + if (!compression_enabled) + { +#endif // ENABLE_COMPRESSED_TEXTURES + glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, level)); + glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR)); +#if ENABLE_COMPRESSED_TEXTURES + } +#endif // ENABLE_COMPRESSED_TEXTURES } else { @@ -508,6 +652,12 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns m_source = filename; +#if ENABLE_COMPRESSED_TEXTURES + if (compression_enabled) + // start asynchronous compression + m_compressor.start_compressing(); +#endif // ENABLE_COMPRESSED_TEXTURES + nsvgDeleteRasterizer(rast); nsvgDelete(image); diff --git a/src/slic3r/GUI/GLTexture.hpp b/src/slic3r/GUI/GLTexture.hpp index 032d19121f..f5cf13a455 100644 --- a/src/slic3r/GUI/GLTexture.hpp +++ b/src/slic3r/GUI/GLTexture.hpp @@ -11,6 +11,42 @@ namespace GUI { class GLTexture { +#if ENABLE_COMPRESSED_TEXTURES + class Compressor + { + struct Level + { + unsigned int w; + unsigned int h; + std::vector src_data; + std::vector compressed_data; + bool sent_to_gpu; + + Level(unsigned int w, unsigned int h, const std::vector& data) : w(w), h(h), src_data(data), sent_to_gpu(false) {} + }; + + GLTexture& m_texture; + std::vector m_levels; + bool m_is_compressing; + bool m_abort_compressing; + + public: + explicit Compressor(GLTexture& texture) : m_texture(texture), m_is_compressing(false), m_abort_compressing(false) {} + + void reset(); + + void add_level(unsigned int w, unsigned int h, const std::vector& data); + + void start_compressing(); + + bool unsent_compressed_data_available() const; + void send_compressed_data_to_gpu(); + + private: + void compress(); + }; +#endif // ENABLE_COMPRESSED_TEXTURES + public: struct UV { @@ -33,6 +69,9 @@ namespace GUI { int m_width; int m_height; std::string m_source; +#if ENABLE_COMPRESSED_TEXTURES + Compressor m_compressor; +#endif // ENABLE_COMPRESSED_TEXTURES public: GLTexture(); @@ -66,6 +105,11 @@ namespace GUI { const std::string& get_source() const { return m_source; } +#if ENABLE_COMPRESSED_TEXTURES + bool unsent_compressed_data_available() const; + void send_compressed_data_to_gpu(); +#endif // ENABLE_COMPRESSED_TEXTURES + static void render_texture(unsigned int tex_id, float left, float right, float bottom, float top); static void render_sub_texture(unsigned int tex_id, float left, float right, float bottom, float top, const Quad_UVs& uvs); @@ -80,6 +124,8 @@ namespace GUI { #if ENABLE_COMPRESSED_TEXTURES bool load_from_png(const std::string& filename, bool use_mipmaps, bool compress); bool load_from_svg(const std::string& filename, bool use_mipmaps, bool compress, bool apply_anisotropy, unsigned int max_size_px); + + friend class Compressor; #else bool load_from_png(const std::string& filename, bool use_mipmaps); bool load_from_svg(const std::string& filename, bool use_mipmaps, unsigned int max_size_px); diff --git a/src/stb_dxt/stb_dxt.h b/src/stb_dxt/stb_dxt.h new file mode 100644 index 0000000000..db19110f43 --- /dev/null +++ b/src/stb_dxt/stb_dxt.h @@ -0,0 +1,1049 @@ +// stb_dxt.h - Real-Time DXT1/DXT5 compressor +// Based on original by fabian "ryg" giesen v1.04 +// Custom version, modified by Yann Collet +// +/* + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + You can contact the author at : + - RygsDXTc source repository : http://code.google.com/p/rygsdxtc/ + +*/ +// use '#define STB_DXT_IMPLEMENTATION' before including to create the implementation +// +// USAGE: +// call stb_compress_dxt_block() for every block (you must pad) +// source should be a 4x4 block of RGBA data in row-major order; +// A is ignored if you specify alpha=0; you can turn on dithering +// and "high quality" using mode. +// +// version history: +// v1.06 - (cyan) implement Fabian Giesen's comments +// v1.05 - (cyan) speed optimizations +// v1.04 - (ryg) default to no rounding bias for lerped colors (as per S3TC/DX10 spec); +// single color match fix (allow for inexact color interpolation); +// optimal DXT5 index finder; "high quality" mode that runs multiple refinement steps. +// v1.03 - (stb) endianness support +// v1.02 - (stb) fix alpha encoding bug +// v1.01 - (stb) fix bug converting to RGB that messed up quality, thanks ryg & cbloom +// v1.00 - (stb) first release + +#ifndef STB_INCLUDE_STB_DXT_H +#define STB_INCLUDE_STB_DXT_H + + +//******************************************************************* +// Enable custom Optimisations +// Comment this define if you want to revert to ryg's original code +#define NEW_OPTIMISATIONS +//******************************************************************* + +// compression mode (bitflags) +#define STB_DXT_NORMAL 0 +#define STB_DXT_DITHER 1 // use dithering. dubious win. never use for normal maps and the like! +#define STB_DXT_HIGHQUAL 2 // high quality mode, does two refinement steps instead of 1. ~30-40% slower. + +// The original signature has been modified by adding the parameter compressed_size which returns +// the size in bytes of the compressed data contained into dst +void rygCompress(unsigned char *dst, unsigned char *src, int w, int h, int isDxt5, int& compressed_size); + +// TODO remove these, not working properly.. +void rygCompressYCoCg( unsigned char *dst, unsigned char *src, int w, int h ); +void linearize( unsigned char * dst, const unsigned char * src, int n ); + +void stb_compress_dxt_block(unsigned char *dest, const unsigned char *src, int alpha, int mode); +#define STB_COMPRESS_DXT_BLOCK + +#ifdef STB_DXT_IMPLEMENTATION + +// configuration options for DXT encoder. set them in the project/makefile or just define +// them at the top. + +// STB_DXT_USE_ROUNDING_BIAS +// use a rounding bias during color interpolation. this is closer to what "ideal" +// interpolation would do but doesn't match the S3TC/DX10 spec. old versions (pre-1.03) +// implicitly had this turned on. +// +// in case you're targeting a specific type of hardware (e.g. console programmers): +// NVidia and Intel GPUs (as of 2010) as well as DX9 ref use DXT decoders that are closer +// to STB_DXT_USE_ROUNDING_BIAS. AMD/ATI, S3 and DX10 ref are closer to rounding with no bias. +// you also see "(a*5 + b*3) / 8" on some old GPU designs. +// #define STB_DXT_USE_ROUNDING_BIAS + +#include +#include +#include +#include // memset +#include +#include +#include + + +static unsigned char stb__Expand5[32]; +static unsigned char stb__Expand6[64]; +static unsigned char stb__OMatch5[256][2]; +static unsigned char stb__OMatch6[256][2]; +static unsigned char stb__QuantRBTab[256+16]; +static unsigned char stb__QuantGTab[256+16]; + +static int stb__Mul8Bit(int a, int b) +{ + int t = a*b + 128; + return (t + (t >> 8)) >> 8; +} + +static void stb__From16Bit(unsigned char *out, unsigned short v) +{ + int rv = (v & 0xf800) >> 11; + int gv = (v & 0x07e0) >> 5; + int bv = (v & 0x001f) >> 0; + + out[0] = stb__Expand5[rv]; + out[1] = stb__Expand6[gv]; + out[2] = stb__Expand5[bv]; + out[3] = 0; +} + +static unsigned short stb__As16Bit(int r, int g, int b) +{ + return (stb__Mul8Bit(r,31) << 11) + (stb__Mul8Bit(g,63) << 5) + stb__Mul8Bit(b,31); +} + +// linear interpolation at 1/3 point between a and b, using desired rounding type +static int stb__Lerp13(int a, int b) +{ +#ifdef STB_DXT_USE_ROUNDING_BIAS + // with rounding bias + return a + stb__Mul8Bit(b-a, 0x55); +#else + // without rounding bias + // replace "/ 3" by "* 0xaaab) >> 17" if your compiler sucks or you really need every ounce of speed. + return (2*a + b) / 3; +#endif +} + +// lerp RGB color +static void stb__Lerp13RGB(unsigned char *out, unsigned char *p1, unsigned char *p2) +{ + out[0] = stb__Lerp13(p1[0], p2[0]); + out[1] = stb__Lerp13(p1[1], p2[1]); + out[2] = stb__Lerp13(p1[2], p2[2]); +} + +/****************************************************************************/ + +// compute table to reproduce constant colors as accurately as possible +static void stb__PrepareOptTable(unsigned char *Table,const unsigned char *expand,int size) +{ + int i,mn,mx; + for (i=0;i<256;i++) { + int bestErr = 256; + for (mn=0;mn> 4)]; + ep1[0] = bp[ 0] - dp[ 0]; + dp[ 4] = quant[bp[ 4] + ((7*ep1[0] + 3*ep2[2] + 5*ep2[1] + ep2[0]) >> 4)]; + ep1[1] = bp[ 4] - dp[ 4]; + dp[ 8] = quant[bp[ 8] + ((7*ep1[1] + 3*ep2[3] + 5*ep2[2] + ep2[1]) >> 4)]; + ep1[2] = bp[ 8] - dp[ 8]; + dp[12] = quant[bp[12] + ((7*ep1[2] + 5*ep2[3] + ep2[2]) >> 4)]; + ep1[3] = bp[12] - dp[12]; + bp += 16; + dp += 16; + et = ep1, ep1 = ep2, ep2 = et; // swap + } + } +} + +// The color matching function +static unsigned int stb__MatchColorsBlock(unsigned char *block, unsigned char *color,int dither) +{ + unsigned int mask = 0; + int dirr = color[0*4+0] - color[1*4+0]; + int dirg = color[0*4+1] - color[1*4+1]; + int dirb = color[0*4+2] - color[1*4+2]; + int dots[16]; + int stops[4]; + int i; + int c0Point, halfPoint, c3Point; + + for(i=0;i<16;i++) + dots[i] = block[i*4+0]*dirr + block[i*4+1]*dirg + block[i*4+2]*dirb; + + for(i=0;i<4;i++) + stops[i] = color[i*4+0]*dirr + color[i*4+1]*dirg + color[i*4+2]*dirb; + + // think of the colors as arranged on a line; project point onto that line, then choose + // next color out of available ones. we compute the crossover points for "best color in top + // half"/"best in bottom half" and then the same inside that subinterval. + // + // relying on this 1d approximation isn't always optimal in terms of euclidean distance, + // but it's very close and a lot faster. + // http://cbloomrants.blogspot.com/2008/12/12-08-08-dxtc-summary.html + + c0Point = (stops[1] + stops[3]) >> 1; + halfPoint = (stops[3] + stops[2]) >> 1; + c3Point = (stops[2] + stops[0]) >> 1; + + if(!dither) + { + // the version without dithering is straightforward + +#ifdef NEW_OPTIMISATIONS + const int indexMap[8] = { 0 << 30,2 << 30,0 << 30,2 << 30,3 << 30,3 << 30,1 << 30,1 << 30 }; + + for(int i=0;i<16;i++) + { + int dot = dots[i]; + mask >>= 2; + + int bits =( (dot < halfPoint) ? 4 : 0 ) + | ( (dot < c0Point) ? 2 : 0 ) + | ( (dot < c3Point) ? 1 : 0 ); + + mask |= indexMap[bits]; + } + +#else + for (i=15;i>=0;i--) { + int dot = dots[i]; + mask <<= 2; + + if(dot < halfPoint) + mask |= (dot < c0Point) ? 1 : 3; + else + mask |= (dot < c3Point) ? 2 : 0; + } +#endif + + } else { + // with floyd-steinberg dithering + int err[8],*ep1 = err,*ep2 = err+4; + int *dp = dots, y; + + c0Point <<= 4; + halfPoint <<= 4; + c3Point <<= 4; + for(i=0;i<8;i++) + err[i] = 0; + + for(y=0;y<4;y++) + { + int dot,lmask,step; + + dot = (dp[0] << 4) + (3*ep2[1] + 5*ep2[0]); + if(dot < halfPoint) + step = (dot < c0Point) ? 1 : 3; + else + step = (dot < c3Point) ? 2 : 0; + ep1[0] = dp[0] - stops[step]; + lmask = step; + + dot = (dp[1] << 4) + (7*ep1[0] + 3*ep2[2] + 5*ep2[1] + ep2[0]); + if(dot < halfPoint) + step = (dot < c0Point) ? 1 : 3; + else + step = (dot < c3Point) ? 2 : 0; + ep1[1] = dp[1] - stops[step]; + lmask |= step<<2; + + dot = (dp[2] << 4) + (7*ep1[1] + 3*ep2[3] + 5*ep2[2] + ep2[1]); + if(dot < halfPoint) + step = (dot < c0Point) ? 1 : 3; + else + step = (dot < c3Point) ? 2 : 0; + ep1[2] = dp[2] - stops[step]; + lmask |= step<<4; + + dot = (dp[3] << 4) + (7*ep1[2] + 5*ep2[3] + ep2[2]); + if(dot < halfPoint) + step = (dot < c0Point) ? 1 : 3; + else + step = (dot < c3Point) ? 2 : 0; + ep1[3] = dp[3] - stops[step]; + lmask |= step<<6; + + dp += 4; + mask |= lmask << (y*8); + { int *et = ep1; ep1 = ep2; ep2 = et; } // swap + } + } + + return mask; +} + +// The color optimization function. (Clever code, part 1) +static void stb__OptimizeColorsBlock(unsigned char *block, unsigned short *pmax16, unsigned short *pmin16) +{ + unsigned char *minp, *maxp; + double magn; + int v_r,v_g,v_b; + static const int nIterPower = 4; + float covf[6],vfr,vfg,vfb; + + // determine color distribution + int cov[6]; + int mu[3],min[3],max[3]; + int ch,i,iter; + + for(ch=0;ch<3;ch++) + { + const unsigned char *bp = ((const unsigned char *) block) + ch; + int muv,minv,maxv; + +#ifdef NEW_OPTIMISATIONS +# define MIN(a,b) (int)a + ( ((int)b-a) & ( ((int)b-a) >> 31 ) ) +# define MAX(a,b) (int)a + ( ((int)b-a) & ( ((int)a-b) >> 31 ) ) +# define RANGE(a,b,n) int min##n = MIN(a,b); int max##n = a+b - min##n; muv += a+b; +# define MINMAX(a,b,n) int min##n = MIN(min##a, min##b); int max##n = MAX(max##a, max##b); + + muv = 0; + RANGE(bp[0], bp[4], 1); + RANGE(bp[8], bp[12], 2); + RANGE(bp[16], bp[20], 3); + RANGE(bp[24], bp[28], 4); + RANGE(bp[32], bp[36], 5); + RANGE(bp[40], bp[44], 6); + RANGE(bp[48], bp[52], 7); + RANGE(bp[56], bp[60], 8); + + MINMAX(1,2,9); + MINMAX(3,4,10); + MINMAX(5,6,11); + MINMAX(7,8,12); + + MINMAX(9,10,13); + MINMAX(11,12,14); + + minv = MIN(min13,min14); + maxv = MAX(max13,max14); + +#else + muv = minv = maxv = bp[0]; + for(i=4;i<64;i+=4) + { + muv += bp[i]; + if (bp[i] < minv) minv = bp[i]; + else if (bp[i] > maxv) maxv = bp[i]; + } +#endif + + mu[ch] = (muv + 8) >> 4; + min[ch] = minv; + max[ch] = maxv; + } + + // determine covariance matrix + for (i=0;i<6;i++) + cov[i] = 0; + + for (i=0;i<16;i++) + { + int r = block[i*4+0] - mu[0]; + int g = block[i*4+1] - mu[1]; + int b = block[i*4+2] - mu[2]; + + cov[0] += r*r; + cov[1] += r*g; + cov[2] += r*b; + cov[3] += g*g; + cov[4] += g*b; + cov[5] += b*b; + } + + // convert covariance matrix to float, find principal axis via power iter + for(i=0;i<6;i++) + covf[i] = cov[i] / 255.0f; + + vfr = (float) (max[0] - min[0]); + vfg = (float) (max[1] - min[1]); + vfb = (float) (max[2] - min[2]); + + for(iter=0;iter magn) magn = fabs(vfg); + if (fabs(vfb) > magn) magn = fabs(vfb); + + if(magn < 4.0f) + { // too small, default to luminance + v_r = 299; // JPEG YCbCr luma coefs, scaled by 1000. + v_g = 587; + v_b = 114; + } else { + magn = 512.0 / magn; + v_r = (int) (vfr * magn); + v_g = (int) (vfg * magn); + v_b = (int) (vfb * magn); + } + + +#ifdef NEW_OPTIMISATIONS + // Pick colors at extreme points + int mind, maxd; + mind = maxd = block[0]*v_r + block[1]*v_g + block[2]*v_b; + minp = maxp = block; + for(i=1;i<16;i++) + { + int dot = block[i*4+0]*v_r + block[i*4+1]*v_g + block[i*4+2]*v_b; + + if (dot < mind) { + mind = dot; + minp = block+i*4; + continue; + } + + if (dot > maxd) { + maxd = dot; + maxp = block+i*4; + } + } +#else + int mind = 0x7fffffff,maxd = -0x7fffffff; + // Pick colors at extreme points + for(i=0;i<16;i++) + { + int dot = block[i*4+0]*v_r + block[i*4+1]*v_g + block[i*4+2]*v_b; + + if (dot < mind) { + mind = dot; + minp = block+i*4; + } + + if (dot > maxd) { + maxd = dot; + maxp = block+i*4; + } + } +#endif + + *pmax16 = stb__As16Bit(maxp[0],maxp[1],maxp[2]); + *pmin16 = stb__As16Bit(minp[0],minp[1],minp[2]); +} + +inline static int stb__sclamp(float y, int p0, int p1) +{ + int x = (int) y; + +#ifdef NEW_OPTIMISATIONS + x = x>p1 ? p1 : x; + return x p1) return p1; + return x; +#endif +} + +// The refinement function. (Clever code, part 2) +// Tries to optimize colors to suit block contents better. +// (By solving a least squares system via normal equations+Cramer's rule) +static int stb__RefineBlock(unsigned char *block, unsigned short *pmax16, unsigned short *pmin16, unsigned int mask) +{ + static const int w1Tab[4] = { 3,0,2,1 }; + static const int prods[4] = { 0x090000,0x000900,0x040102,0x010402 }; + // ^some magic to save a lot of multiplies in the accumulating loop... + // (precomputed products of weights for least squares system, accumulated inside one 32-bit register) + + float frb,fg; + unsigned short oldMin, oldMax, min16, max16; + int i, akku = 0, xx,xy,yy; + int At1_r,At1_g,At1_b; + int At2_r,At2_g,At2_b; + unsigned int cm = mask; + + oldMin = *pmin16; + oldMax = *pmax16; + + if((mask ^ (mask<<2)) < 4) // all pixels have the same index? + { + // yes, linear system would be singular; solve using optimal + // single-color match on average color + int r = 8, g = 8, b = 8; + for (i=0;i<16;++i) { + r += block[i*4+0]; + g += block[i*4+1]; + b += block[i*4+2]; + } + + r >>= 4; g >>= 4; b >>= 4; + + max16 = (stb__OMatch5[r][0]<<11) | (stb__OMatch6[g][0]<<5) | stb__OMatch5[b][0]; + min16 = (stb__OMatch5[r][1]<<11) | (stb__OMatch6[g][1]<<5) | stb__OMatch5[b][1]; + } else { + At1_r = At1_g = At1_b = 0; + At2_r = At2_g = At2_b = 0; + for (i=0;i<16;++i,cm>>=2) + { + int step = cm&3; + int w1 = w1Tab[step]; + int r = block[i*4+0]; + int g = block[i*4+1]; + int b = block[i*4+2]; + + akku += prods[step]; + At1_r += w1*r; + At1_g += w1*g; + At1_b += w1*b; + At2_r += r; + At2_g += g; + At2_b += b; + } + + At2_r = 3*At2_r - At1_r; + At2_g = 3*At2_g - At1_g; + At2_b = 3*At2_b - At1_b; + + // extract solutions and decide solvability + xx = akku >> 16; + yy = (akku >> 8) & 0xff; + xy = (akku >> 0) & 0xff; + + frb = 3.0f * 31.0f / 255.0f / (xx*yy - xy*xy); + fg = frb * 63.0f / 31.0f; + + // solve. + max16 = stb__sclamp((At1_r*yy - At2_r*xy)*frb+0.5f,0,31) << 11; + max16 |= stb__sclamp((At1_g*yy - At2_g*xy)*fg +0.5f,0,63) << 5; + max16 |= stb__sclamp((At1_b*yy - At2_b*xy)*frb+0.5f,0,31) << 0; + + min16 = stb__sclamp((At2_r*xx - At1_r*xy)*frb+0.5f,0,31) << 11; + min16 |= stb__sclamp((At2_g*xx - At1_g*xy)*fg +0.5f,0,63) << 5; + min16 |= stb__sclamp((At2_b*xx - At1_b*xy)*frb+0.5f,0,31) << 0; + } + + *pmin16 = min16; + *pmax16 = max16; + return oldMin != min16 || oldMax != max16; +} + +// Color block compression +static void stb__CompressColorBlock(unsigned char *dest, unsigned char *block, int mode) +{ + unsigned int mask; + int i; + int dither; + int refinecount; + unsigned short max16, min16; + unsigned char dblock[16*4],color[4*4]; + + dither = mode & STB_DXT_DITHER; + refinecount = (mode & STB_DXT_HIGHQUAL) ? 2 : 1; + + // check if block is constant + for (i=1;i<16;i++) + if (((unsigned int *) block)[i] != ((unsigned int *) block)[0]) + break; + + if(i == 16) + { // constant color + int r = block[0], g = block[1], b = block[2]; + mask = 0xaaaaaaaa; + max16 = (stb__OMatch5[r][0]<<11) | (stb__OMatch6[g][0]<<5) | stb__OMatch5[b][0]; + min16 = (stb__OMatch5[r][1]<<11) | (stb__OMatch6[g][1]<<5) | stb__OMatch5[b][1]; + } else + { + // first step: compute dithered version for PCA if desired + if(dither) + stb__DitherBlock(dblock,block); + + // second step: pca+map along principal axis + stb__OptimizeColorsBlock(dither ? dblock : block,&max16,&min16); + if (max16 != min16) + { + stb__EvalColors(color,max16,min16); + mask = stb__MatchColorsBlock(block,color,dither); + } else + mask = 0; + + // third step: refine (multiple times if requested) + for (i=0;i> 8); + dest[2] = (unsigned char) (min16); + dest[3] = (unsigned char) (min16 >> 8); + dest[4] = (unsigned char) (mask); + dest[5] = (unsigned char) (mask >> 8); + dest[6] = (unsigned char) (mask >> 16); + dest[7] = (unsigned char) (mask >> 24); +} + +// Alpha block compression (this is easy for a change) +static void stb__CompressAlphaBlock(unsigned char *dest,unsigned char *src,int mode) +{ + int i,dist,bias,dist4,dist2,bits,mask; + + // find min/max color + int mn,mx; + + mn = mx = src[3]; + for (i=1;i<16;i++) + { + if (src[i*4+3] < mn) mn = src[i*4+3]; + else if (src[i*4+3] > mx) mx = src[i*4+3]; + } + + // encode them + ((unsigned char *)dest)[0] = mx; + ((unsigned char *)dest)[1] = mn; + dest += 2; + +#ifdef NEW_OPTIMISATIONS + // mono-alpha shortcut + if (mn==mx) + { + *(unsigned short*)dest = 0; + dest += 2; + *(unsigned int*)dest = 0; + return; + } +#endif + + // determine bias and emit color indices + // given the choice of mx/mn, these indices are optimal: + // http://fgiesen.wordpress.com/2009/12/15/dxt5-alpha-block-index-determination/ + dist = mx-mn; + //printf("mn = %i; mx = %i; dist = %i\n", mn, mx, dist); + dist4 = dist*4; + dist2 = dist*2; + bias = (dist < 8) ? (dist - 1) : (dist/2 + 2); + bias -= mn * 7; + bits = 0, mask=0; + + for (i=0;i<16;i++) + { + int a = src[i*4+3]*7 + bias; + int ind,t; + + // select index. this is a "linear scale" lerp factor between 0 (val=min) and 7 (val=max). + t = (a >= dist4) ? -1 : 0; ind = t & 4; a -= dist4 & t; + t = (a >= dist2) ? -1 : 0; ind += t & 2; a -= dist2 & t; + ind += (a >= dist); + + // turn linear scale into DXT index (0/1 are extremal pts) + ind = -ind & 7; + ind ^= (2 > ind); + + // write index + mask |= ind << bits; + if((bits += 3) >= 8) + { + *dest++ = mask; + mask >>= 8; + bits -= 8; + } + } +} + + +static void stb__InitDXT() +{ + int i; + for(i=0;i<32;i++) + stb__Expand5[i] = (i<<3)|(i>>2); + + for(i=0;i<64;i++) + stb__Expand6[i] = (i<<2)|(i>>4); + + for(i=0;i<256+16;i++) + { + int v = i-8 < 0 ? 0 : i-8 > 255 ? 255 : i-8; + stb__QuantRBTab[i] = stb__Expand5[stb__Mul8Bit(v,31)]; + stb__QuantGTab[i] = stb__Expand6[stb__Mul8Bit(v,63)]; + } + + stb__PrepareOptTable(&stb__OMatch5[0][0],stb__Expand5,32); + stb__PrepareOptTable(&stb__OMatch6[0][0],stb__Expand6,64); +} + + +void stb_compress_dxt_block(unsigned char *dest, const unsigned char *src, int alpha, int mode) +{ + static int init=1; + if (init) + { + stb__InitDXT(); + init=0; + } + + if (alpha) + { + stb__CompressAlphaBlock(dest,(unsigned char*) src,mode); + dest += 8; + } + + stb__CompressColorBlock(dest,(unsigned char*) src,mode); +} + +int imin(int x, int y) { return (x < y) ? x : y; } + + + + + +static void extractBlock(const unsigned char *src, int x, int y, + int w, int h, unsigned char *block) +{ + int i, j; + +#ifdef NEW_OPTIMISATIONS + if ((w-x >=4) && (h-y >=4)) + { + // Full Square shortcut + src += x*4; + src += y*w*4; + for (i=0; i < 4; ++i) + { + *(unsigned int*)block = *(unsigned int*) src; block += 4; src += 4; + *(unsigned int*)block = *(unsigned int*) src; block += 4; src += 4; + *(unsigned int*)block = *(unsigned int*) src; block += 4; src += 4; + *(unsigned int*)block = *(unsigned int*) src; block += 4; + src += (w*4) - 12; + } + return; + } +#endif + + int bw = imin(w - x, 4); + int bh = imin(h - y, 4); + int bx, by; + + const int rem[] = + { + 0, 0, 0, 0, + 0, 1, 0, 1, + 0, 1, 2, 0, + 0, 1, 2, 3 + }; + + for(i = 0; i < 4; ++i) + { + by = rem[(bh - 1) * 4 + i] + y; + for(j = 0; j < 4; ++j) + { + bx = rem[(bw - 1) * 4 + j] + x; + block[(i * 4 * 4) + (j * 4) + 0] = + src[(by * (w * 4)) + (bx * 4) + 0]; + block[(i * 4 * 4) + (j * 4) + 1] = + src[(by * (w * 4)) + (bx * 4) + 1]; + block[(i * 4 * 4) + (j * 4) + 2] = + src[(by * (w * 4)) + (bx * 4) + 2]; + block[(i * 4 * 4) + (j * 4) + 3] = + src[(by * (w * 4)) + (bx * 4) + 3]; + } + } +} + + // should be a pretty optimized 0-255 clamper +inline static unsigned char clamp255( int n ) +{ + if( n > 255 ) n = 255; + if( n < 0 ) n = 0; + return n; +} + + +void rgbToYCoCgBlock( unsigned char * dst, const unsigned char * src ) +{ + // Calculate Co and Cg extents + int extents = 0; + int n = 0; + int iY, iCo, iCg; //, r, g, b; + int blockCo[16]; + int blockCg[16]; + int i; + + const unsigned char *px = src; + for(i=0;i extents) extents = -iCo; + if( iCo > extents) extents = iCo; + if(-iCg > extents) extents = -iCg; + if( iCg > extents) extents = iCg; + + blockCo[n] = iCo; + blockCg[n++] = iCg; + + px += 4; + } + + // Co = -510..510 + // Cg = -510..510 + float scaleFactor = 1.0f; + if(extents > 127) + scaleFactor = (float)extents * 4.0f / 510.0f; + + // Convert to quantized scalefactor + unsigned char scaleFactorQuantized = (unsigned char)(ceil((scaleFactor - 1.0f) * 31.0f / 3.0f)); + + // Unquantize + scaleFactor = 1.0f + (float)(scaleFactorQuantized / 31.0f) * 3.0f; + + unsigned char bVal = (unsigned char)((scaleFactorQuantized << 3) | (scaleFactorQuantized >> 2)); + + unsigned char *outPx = dst; + + n = 0; + px = src; + /* + for(i=0;i<16;i++) + { + // Calculate components + iY = ( px[0] + (px[1]<<1) + px[2] + 2 ) / 4; + iCo = ((blockCo[n] / scaleFactor) + 128); + iCg = ((blockCg[n] / scaleFactor) + 128); + + if(iCo < 0) iCo = 0; else if(iCo > 255) iCo = 255; + if(iCg < 0) iCg = 0; else if(iCg > 255) iCg = 255; + if(iY < 0) iY = 0; else if(iY > 255) iY = 255; + + px += 4; + + outPx[0] = (unsigned char)iCo; + outPx[1] = (unsigned char)iCg; + outPx[2] = bVal; + outPx[3] = (unsigned char)iY; + + outPx += 4; + }*/ + for(i=0;i<16;i++) + { + // Calculate components + int r = px[0]; + int g = (px[1] + 1) >> 1; + int b = px[2]; + int tmp = (2 + r + b) >> 2; + + // Co + iCo = clamp255( 128 + ((r - b + 1) >> 1) ); + // Y + iY = clamp255( g + tmp ); + // Cg + iCg = clamp255( 128 + g - tmp ); + + px += 4; + + outPx[0] = (unsigned char)iCo; + outPx[1] = (unsigned char)iCg; + outPx[2] = bVal; + outPx[3] = (unsigned char)iY; + + outPx += 4; + } + +} + + +void rygCompress(unsigned char *dst, unsigned char *src, int w, int h, int isDxt5, int& compressed_size) +{ + + unsigned char block[64]; + int x, y; + + unsigned char* initial_dst = dst; + + for (y = 0; y < h; y += 4) + { + for(x = 0; x < w; x += 4) + { + extractBlock(src, x, y, w, h, block); + stb_compress_dxt_block(dst, block, isDxt5, STB_DXT_NORMAL); + dst += isDxt5 ? 16 : 8; + } + } + + compressed_size = dst - initial_dst; +} + +void rygCompressYCoCg( unsigned char *dst, unsigned char *src, int w, int h ) +{ + unsigned char block[64]; + unsigned char ycocgblock[64]; + int x, y; + + for(y = 0; y < h; y += 4) + { + for(x = 0; x < w; x += 4) + { + extractBlock(src, x, y, w, h, block); + rgbToYCoCgBlock(ycocgblock,block); + stb_compress_dxt_block(dst, ycocgblock, 1, 10); + dst += 16; + } + } + +} + +static void stbgl__compress(unsigned char *p, unsigned char *rgba, int w, int h, int isDxt5) +{ + int i,j,y,y2; + int alpha = isDxt5; + + for (j=0; j < w; j += 4) { + int x=4; + for (i=0; i < h; i += 4) { + unsigned char block[16*4]; + if (i+3 >= w) x = w-i; + for (y=0; y < 4; ++y) { + if (j+y >= h) break; + memcpy(block+y*16, rgba + w*4*(j+y) + i*4, x*4); + } + if (x < 4) { + switch (x) { + case 0: assert(0); + case 1: + for (y2=0; y2 < y; ++y2) { + memcpy(block+y2*16+1*4, block+y2*16+0*4, 4); + memcpy(block+y2*16+2*4, block+y2*16+0*4, 8); + } + break; + case 2: + for (y2=0; y2 < y; ++y2) + memcpy(block+y2*16+2*4, block+y2*16+0*4, 8); + break; + case 3: + for (y2=0; y2 < y; ++y2) + memcpy(block+y2*16+3*4, block+y2*16+1*4, 4); + break; + } + } + y2 = 0; + for(; y<4; ++y,++y2) + memcpy(block+y*16, block+y2*16, 4*4); + stb_compress_dxt_block(p, block, alpha, 10); + p += alpha ? 16 : 8; + } + } + // assert(p <= end); +} + +static inline unsigned char linearize(unsigned char inByte) +{ + float srgbVal = ((float)inByte) / 255.0f; + float linearVal; + + if(srgbVal < 0.04045) + linearVal = srgbVal / 12.92f; + else + linearVal = pow( (srgbVal + 0.055f) / 1.055f, 2.4f); + + return (unsigned char)(floor(sqrt(linearVal)* 255.0 + 0.5)); +} + +void linearize( unsigned char * dst, const unsigned char * src, int n ) +{ + n*=4; + for( int i = 0; i < n; i++ ) + dst[i] = linearize(src[i]); +} + + + +#endif // STB_DXT_IMPLEMENTATION + +#endif // STB_INCLUDE_STB_DXT_H From e6af0d3dc4f85e42437dc5fd18d6b1cb528db251 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Sun, 2 Jun 2019 11:01:51 +0200 Subject: [PATCH 11/64] Temporary low-res texture shown while generating compressed data on the CPU --- src/slic3r/GUI/3DBed.cpp | 24 ++++++++++++++++++++++++ src/slic3r/GUI/3DBed.hpp | 4 ++++ src/slic3r/GUI/GLTexture.cpp | 14 +------------- src/slic3r/GUI/GLTexture.hpp | 4 ++-- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index e6589e5481..98f2d7dc32 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -522,6 +522,14 @@ void Bed3D::render_prusa(const std::string &key, bool bottom) const if ((m_texture.get_id() == 0) || (m_texture.get_source() != filename)) { #if ENABLE_COMPRESSED_TEXTURES + // generate a temporary lower resolution texture to show while no main texture levels have been compressed + if (!m_temp_texture.load_from_svg_file(filename, false, false, false, max_tex_size / 8)) + { + render_custom(); + return; + } + + // starts generating the main texture, compression will run asynchronously if (!m_texture.load_from_svg_file(filename, true, true, true, max_tex_size)) #else if (!m_texture.load_from_svg_file(filename, true, max_tex_size)) @@ -542,7 +550,14 @@ void Bed3D::render_prusa(const std::string &key, bool bottom) const } #if ENABLE_COMPRESSED_TEXTURES else if (m_texture.unsent_compressed_data_available()) + { + // sends to gpu the already available compressed levels of the main texture m_texture.send_compressed_data_to_gpu(); + + // the temporary texture is not needed anymore, reset it + if (m_temp_texture.get_id() != 0) + m_temp_texture.reset(); + } #endif // ENABLE_COMPRESSED_TEXTURES if (!bottom) @@ -616,7 +631,16 @@ void Bed3D::render_prusa_shader(bool transparent) const GLint position_id = m_shader.get_attrib_location("v_position"); GLint tex_coords_id = m_shader.get_attrib_location("v_tex_coords"); +#if ENABLE_COMPRESSED_TEXTURES + // show the temporary texture while no compressed data is available + GLuint tex_id = (GLuint)m_temp_texture.get_id(); + if (tex_id == 0) + tex_id = (GLuint)m_texture.get_id(); + + glsafe(::glBindTexture(GL_TEXTURE_2D, tex_id)); +#else glsafe(::glBindTexture(GL_TEXTURE_2D, (GLuint)m_texture.get_id())); +#endif // ENABLE_COMPRESSED_TEXTURES glsafe(::glBindBuffer(GL_ARRAY_BUFFER, m_vbo_id)); if (position_id != -1) diff --git a/src/slic3r/GUI/3DBed.hpp b/src/slic3r/GUI/3DBed.hpp index e60cdf94e1..054b746e5e 100644 --- a/src/slic3r/GUI/3DBed.hpp +++ b/src/slic3r/GUI/3DBed.hpp @@ -91,6 +91,10 @@ private: GeometryBuffer m_gridlines; #if ENABLE_TEXTURES_FROM_SVG mutable GLTexture m_texture; +#if ENABLE_COMPRESSED_TEXTURES + // temporary texture shown until the main texture has still no levels compressed + mutable GLTexture m_temp_texture; +#endif // ENABLE_COMPRESSED_TEXTURES mutable Shader m_shader; mutable unsigned int m_vbo_id; #else diff --git a/src/slic3r/GUI/GLTexture.cpp b/src/slic3r/GUI/GLTexture.cpp index cc6bdc715a..469e192b59 100644 --- a/src/slic3r/GUI/GLTexture.cpp +++ b/src/slic3r/GUI/GLTexture.cpp @@ -343,18 +343,6 @@ void GLTexture::reset() #endif // ENABLE_COMPRESSED_TEXTURES } -#if ENABLE_COMPRESSED_TEXTURES -bool GLTexture::unsent_compressed_data_available() const -{ - return m_compressor.unsent_compressed_data_available(); -} - -void GLTexture::send_compressed_data_to_gpu() -{ - m_compressor.send_compressed_data_to_gpu(); -} -#endif // ENABLE_COMPRESSED_TEXTURES - void GLTexture::render_texture(unsigned int tex_id, float left, float right, float bottom, float top) { render_sub_texture(tex_id, left, right, bottom, top, FullTextureUVs); @@ -603,7 +591,7 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns int lod_h = m_height; GLint level = 0; // we do not need to generate all levels down to 1x1 - while ((lod_w > 64) || (lod_h > 64)) + while ((lod_w > 16) || (lod_h > 16)) { ++level; diff --git a/src/slic3r/GUI/GLTexture.hpp b/src/slic3r/GUI/GLTexture.hpp index f5cf13a455..ed2070a44e 100644 --- a/src/slic3r/GUI/GLTexture.hpp +++ b/src/slic3r/GUI/GLTexture.hpp @@ -106,8 +106,8 @@ namespace GUI { const std::string& get_source() const { return m_source; } #if ENABLE_COMPRESSED_TEXTURES - bool unsent_compressed_data_available() const; - void send_compressed_data_to_gpu(); + bool unsent_compressed_data_available() const { return m_compressor.unsent_compressed_data_available(); } + void send_compressed_data_to_gpu() { m_compressor.send_compressed_data_to_gpu(); } #endif // ENABLE_COMPRESSED_TEXTURES static void render_texture(unsigned int tex_id, float left, float right, float bottom, float top); From 6a8c7a87059c279bf7aba0a5092b5de41ff9b815 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 3 Jun 2019 13:53:30 +0200 Subject: [PATCH 12/64] Fixed race condition while compressing texture data and sending them to the GPU --- src/slic3r/GUI/GLTexture.cpp | 8 ++++++-- src/slic3r/GUI/GLTexture.hpp | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GLTexture.cpp b/src/slic3r/GUI/GLTexture.cpp index 469e192b59..78de38d549 100644 --- a/src/slic3r/GUI/GLTexture.cpp +++ b/src/slic3r/GUI/GLTexture.cpp @@ -55,7 +55,7 @@ bool GLTexture::Compressor::unsent_compressed_data_available() const { for (const Level& level : m_levels) { - if (!level.sent_to_gpu && (level.compressed_data.size() > 0)) + if (!level.sent_to_gpu && level.compressed) return true; } @@ -64,12 +64,14 @@ bool GLTexture::Compressor::unsent_compressed_data_available() const void GLTexture::Compressor::send_compressed_data_to_gpu() { + // this method should be called inside the main thread of Slicer or a new OpenGL context (sharing resources) would be needed + glsafe(::glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); glsafe(::glBindTexture(GL_TEXTURE_2D, m_texture.m_id)); for (int i = 0; i < (int)m_levels.size(); ++i) { Level& level = m_levels[i]; - if (!level.sent_to_gpu && (level.compressed_data.size() > 0)) + if (!level.sent_to_gpu && level.compressed) { glsafe(::glCompressedTexSubImage2D(GL_TEXTURE_2D, (GLint)i, 0, 0, (GLsizei)level.w, (GLsizei)level.h, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, (GLsizei)level.compressed_data.size(), (const GLvoid*)level.compressed_data.data())); glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, i)); @@ -77,6 +79,7 @@ void GLTexture::Compressor::send_compressed_data_to_gpu() level.sent_to_gpu = true; // we are done with the compressed data, we can discard it level.compressed_data.clear(); + level.compressed = false; } } glsafe(::glBindTexture(GL_TEXTURE_2D, 0)); @@ -100,6 +103,7 @@ void GLTexture::Compressor::compress() // we are done with the source data, we can discard it level.src_data.clear(); + level.compressed = true; } m_is_compressing = false; diff --git a/src/slic3r/GUI/GLTexture.hpp b/src/slic3r/GUI/GLTexture.hpp index ed2070a44e..d1ff366c34 100644 --- a/src/slic3r/GUI/GLTexture.hpp +++ b/src/slic3r/GUI/GLTexture.hpp @@ -20,9 +20,10 @@ namespace GUI { unsigned int h; std::vector src_data; std::vector compressed_data; + bool compressed; bool sent_to_gpu; - Level(unsigned int w, unsigned int h, const std::vector& data) : w(w), h(h), src_data(data), sent_to_gpu(false) {} + Level(unsigned int w, unsigned int h, const std::vector& data) : w(w), h(h), src_data(data), compressed(false), sent_to_gpu(false) {} }; GLTexture& m_texture; From 836f2d777fabb94fdd0585d403bd0bedc603c2ce Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 5 Jun 2019 10:07:59 +0200 Subject: [PATCH 13/64] Update 3D scene when all compressed texture data are sent to GPU --- src/slic3r/GUI/3DBed.cpp | 66 +++++++++++++++++++++++++++++++++-- src/slic3r/GUI/3DBed.hpp | 14 ++++++++ src/slic3r/GUI/GLCanvas3D.cpp | 16 +++++++++ src/slic3r/GUI/GLCanvas3D.hpp | 8 +++++ src/slic3r/GUI/GLTexture.cpp | 13 +++++++ src/slic3r/GUI/GLTexture.hpp | 2 ++ 6 files changed, 117 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index 98f2d7dc32..04ab4e2da2 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -9,6 +9,9 @@ #include "GUI_App.hpp" #include "PresetBundle.hpp" #include "Gizmos/GLGizmoBase.hpp" +#if ENABLE_COMPRESSED_TEXTURES +#include "GLCanvas3D.hpp" +#endif // ENABLE_COMPRESSED_TEXTURES #include @@ -273,6 +276,9 @@ void Bed3D::Axes::render_axis(double length) const Bed3D::Bed3D() : m_type(Custom) +#if ENABLE_COMPRESSED_TEXTURES + , m_requires_canvas_update(false) +#endif // ENABLE_COMPRESSED_TEXTURES #if ENABLE_TEXTURES_FROM_SVG , m_vbo_id(0) #endif // ENABLE_TEXTURES_FROM_SVG @@ -328,14 +334,34 @@ Point Bed3D::point_projection(const Point& point) const } #if ENABLE_TEXTURES_FROM_SVG +#if ENABLE_COMPRESSED_TEXTURES +void Bed3D::render(GLCanvas3D* canvas, float theta, bool useVBOs, float scale_factor) const +#else void Bed3D::render(float theta, bool useVBOs, float scale_factor) const +#endif // ENABLE_COMPRESSED_TEXTURES { m_scale_factor = scale_factor; EType type = useVBOs ? m_type : Custom; switch (type) - { +#if ENABLE_COMPRESSED_TEXTURES + case MK2: + { + render_prusa(canvas, "mk2", theta > 90.0f); + break; + } + case MK3: + { + render_prusa(canvas, "mk3", theta > 90.0f); + break; + } + case SL1: + { + render_prusa(canvas, "sl1", theta > 90.0f); + break; + } +#else case MK2: { render_prusa("mk2", theta > 90.0f); @@ -351,6 +377,7 @@ void Bed3D::render(float theta, bool useVBOs, float scale_factor) const render_prusa("sl1", theta > 90.0f); break; } +#endif // ENABLE_COMPRESSED_TEXTURES default: case Custom: { @@ -360,7 +387,11 @@ void Bed3D::render(float theta, bool useVBOs, float scale_factor) const } } #else +#if ENABLE_COMPRESSED_TEXTURES +void Bed3D::render(GLCanvas3D* canvas, float theta, bool useVBOs, float scale_factor) const +#else void Bed3D::render(float theta, bool useVBOs, float scale_factor) const +#endif // ENABLE_COMPRESSED_TEXTURES { m_scale_factor = scale_factor; @@ -369,6 +400,23 @@ void Bed3D::render(float theta, bool useVBOs, float scale_factor) const switch (m_type) { +#if ENABLE_COMPRESSED_TEXTURES + case MK2: + { + render_prusa(canvas, "mk2", theta, useVBOs); + break; + } + case MK3: + { + render_prusa(canvas, "mk3", theta, useVBOs); + break; + } + case SL1: + { + render_prusa(canvas, "sl1", theta, useVBOs); + break; + } +#else case MK2: { render_prusa("mk2", theta, useVBOs); @@ -383,7 +431,8 @@ void Bed3D::render(float theta, bool useVBOs, float scale_factor) const { render_prusa("sl1", theta, useVBOs); break; - } + } +#endif // ENABLE_COMPRESSED_TEXTURES default: case Custom: { @@ -487,7 +536,11 @@ Bed3D::EType Bed3D::detect_type(const Pointfs& shape) const } #if ENABLE_TEXTURES_FROM_SVG +#if ENABLE_COMPRESSED_TEXTURES +void Bed3D::render_prusa(GLCanvas3D* canvas, const std::string &key, bool bottom) const +#else void Bed3D::render_prusa(const std::string &key, bool bottom) const +#endif // ENABLE_COMPRESSED_TEXTURES { std::string tex_path = resources_dir() + "/icons/bed/" + key; @@ -557,6 +610,15 @@ void Bed3D::render_prusa(const std::string &key, bool bottom) const // the temporary texture is not needed anymore, reset it if (m_temp_texture.get_id() != 0) m_temp_texture.reset(); + + m_requires_canvas_update = true; + } + else if (m_requires_canvas_update && m_texture.all_compressed_data_sent_to_gpu()) + { + if (canvas != nullptr) + canvas->stop_keeping_dirty(); + + m_requires_canvas_update = false; } #endif // ENABLE_COMPRESSED_TEXTURES diff --git a/src/slic3r/GUI/3DBed.hpp b/src/slic3r/GUI/3DBed.hpp index 054b746e5e..401f1232f3 100644 --- a/src/slic3r/GUI/3DBed.hpp +++ b/src/slic3r/GUI/3DBed.hpp @@ -13,6 +13,10 @@ typedef class GLUquadric GLUquadricObj; namespace Slic3r { namespace GUI { +#if ENABLE_COMPRESSED_TEXTURES +class GLCanvas3D; +#endif // ENABLE_COMPRESSED_TEXTURES + class GeometryBuffer { #if ENABLE_TEXTURES_FROM_SVG @@ -94,6 +98,8 @@ private: #if ENABLE_COMPRESSED_TEXTURES // temporary texture shown until the main texture has still no levels compressed mutable GLTexture m_temp_texture; + // used to trigger 3D scene update once all compressed textures have been sent to GPU + mutable bool m_requires_canvas_update; #endif // ENABLE_COMPRESSED_TEXTURES mutable Shader m_shader; mutable unsigned int m_vbo_id; @@ -125,7 +131,11 @@ public: bool contains(const Point& point) const; Point point_projection(const Point& point) const; +#if ENABLE_COMPRESSED_TEXTURES + void render(GLCanvas3D* canvas, float theta, bool useVBOs, float scale_factor) const; +#else void render(float theta, bool useVBOs, float scale_factor) const; +#endif // ENABLE_COMPRESSED_TEXTURES void render_axes() const; private: @@ -134,7 +144,11 @@ private: void calc_gridlines(const ExPolygon& poly, const BoundingBox& bed_bbox); EType detect_type(const Pointfs& shape) const; #if ENABLE_TEXTURES_FROM_SVG +#if ENABLE_COMPRESSED_TEXTURES + void render_prusa(GLCanvas3D* canvas, const std::string& key, bool bottom) const; +#else void render_prusa(const std::string& key, bool bottom) const; +#endif // ENABLE_COMPRESSED_TEXTURES void render_prusa_shader(bool transparent) const; #else void render_prusa(const std::string &key, float theta, bool useVBOs) const; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index f7d685502a..90c21608e4 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1266,6 +1266,9 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar #endif // ENABLE_SVG_ICONS , m_use_clipping_planes(false) , m_sidebar_field("") +#if ENABLE_COMPRESSED_TEXTURES + , m_keep_dirty(false) +#endif // ENABLE_COMPRESSED_TEXTURES , m_config(nullptr) , m_process(nullptr) , m_model(nullptr) @@ -1483,6 +1486,10 @@ void GLCanvas3D::bed_shape_changed() m_camera.set_scene_box(scene_bounding_box()); m_camera.requires_zoom_to_bed = true; m_dirty = true; +#if ENABLE_COMPRESSED_TEXTURES + if (m_bed.is_prusa()) + start_keeping_dirty(); +#endif // ENABLE_COMPRESSED_TEXTURES } void GLCanvas3D::set_color_by(const std::string& value) @@ -2353,6 +2360,11 @@ void GLCanvas3D::on_idle(wxIdleEvent& evt) return; _refresh_if_shown_on_screen(); + +#if ENABLE_COMPRESSED_TEXTURES + if (m_keep_dirty) + m_dirty = true; +#endif // ENABLE_COMPRESSED_TEXTURES } void GLCanvas3D::on_char(wxKeyEvent& evt) @@ -3966,7 +3978,11 @@ void GLCanvas3D::_render_bed(float theta) const #if ENABLE_RETINA_GL scale_factor = m_retina_helper->get_scale_factor(); #endif // ENABLE_RETINA_GL +#if ENABLE_COMPRESSED_TEXTURES + m_bed.render(const_cast(this), theta, m_use_VBOs, scale_factor); +#else m_bed.render(theta, m_use_VBOs, scale_factor); +#endif // ENABLE_COMPRESSED_TEXTURES } void GLCanvas3D::_render_axes() const diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 6d77a507f1..d7a4c6d22d 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -449,6 +449,9 @@ private: bool m_use_clipping_planes; mutable SlaCap m_sla_caps[2]; std::string m_sidebar_field; +#if ENABLE_COMPRESSED_TEXTURES + bool m_keep_dirty; +#endif // ENABLE_COMPRESSED_TEXTURES mutable GLVolumeCollection m_volumes; Selection m_selection; @@ -635,6 +638,11 @@ public: void set_cursor(ECursorType type); void msw_rescale(); +#if ENABLE_COMPRESSED_TEXTURES + void start_keeping_dirty() { m_keep_dirty = true; } + void stop_keeping_dirty() { m_keep_dirty = false; } +#endif // ENABLE_COMPRESSED_TEXTURES + private: bool _is_shown_on_screen() const; diff --git a/src/slic3r/GUI/GLTexture.cpp b/src/slic3r/GUI/GLTexture.cpp index 78de38d549..9b373440a1 100644 --- a/src/slic3r/GUI/GLTexture.cpp +++ b/src/slic3r/GUI/GLTexture.cpp @@ -85,6 +85,17 @@ void GLTexture::Compressor::send_compressed_data_to_gpu() glsafe(::glBindTexture(GL_TEXTURE_2D, 0)); } +bool GLTexture::Compressor::all_compressed_data_sent_to_gpu() const +{ + for (const Level& level : m_levels) + { + if (!level.sent_to_gpu) + return false; + } + + return true; +} + void GLTexture::Compressor::compress() { // reference: https://github.com/Cyan4973/RygsDXTc @@ -512,7 +523,9 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, boo bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, unsigned int max_size_px) #endif // ENABLE_COMPRESSED_TEXTURES { +#if ENABLE_COMPRESSED_TEXTURES bool compression_enabled = compress && GLEW_EXT_texture_compression_s3tc; +#endif // ENABLE_COMPRESSED_TEXTURES NSVGimage* image = nsvgParseFromFile(filename.c_str(), "px", 96.0f); if (image == nullptr) diff --git a/src/slic3r/GUI/GLTexture.hpp b/src/slic3r/GUI/GLTexture.hpp index d1ff366c34..5df6189b6f 100644 --- a/src/slic3r/GUI/GLTexture.hpp +++ b/src/slic3r/GUI/GLTexture.hpp @@ -42,6 +42,7 @@ namespace GUI { bool unsent_compressed_data_available() const; void send_compressed_data_to_gpu(); + bool all_compressed_data_sent_to_gpu() const; private: void compress(); @@ -109,6 +110,7 @@ namespace GUI { #if ENABLE_COMPRESSED_TEXTURES bool unsent_compressed_data_available() const { return m_compressor.unsent_compressed_data_available(); } void send_compressed_data_to_gpu() { m_compressor.send_compressed_data_to_gpu(); } + bool all_compressed_data_sent_to_gpu() const { return m_compressor.all_compressed_data_sent_to_gpu(); } #endif // ENABLE_COMPRESSED_TEXTURES static void render_texture(unsigned int tex_id, float left, float right, float bottom, float top); From 6e891c08862510f2209d1f92333480b52d0f47a9 Mon Sep 17 00:00:00 2001 From: "Stuart P. Bentley" Date: Sat, 8 Jun 2019 13:52:03 -0700 Subject: [PATCH 14/64] Update usage string to match new executable name --- src/PrusaSlicer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PrusaSlicer.cpp b/src/PrusaSlicer.cpp index fef1f6e7f0..0aebec420a 100644 --- a/src/PrusaSlicer.cpp +++ b/src/PrusaSlicer.cpp @@ -576,7 +576,7 @@ void CLI::print_help(bool include_print_options, PrinterTechnology printer_techn #endif /* SLIC3R_GUI */ << std::endl << "https://github.com/prusa3d/PrusaSlicer" << std::endl << std::endl - << "Usage: slic3r [ ACTIONS ] [ TRANSFORM ] [ OPTIONS ] [ file.stl ... ]" << std::endl + << "Usage: prusa-slicer [ ACTIONS ] [ TRANSFORM ] [ OPTIONS ] [ file.stl ... ]" << std::endl << std::endl << "Actions:" << std::endl; cli_actions_config_def.print_cli_help(boost::nowide::cout, false); From f0b228c4d2f2d385bbfd3fe917fd928ffaadd1d3 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 13 Jun 2019 09:12:44 +0200 Subject: [PATCH 15/64] Added support for distance between camera position and camera target --- src/slic3r/GUI/Camera.cpp | 15 +++++++++++---- src/slic3r/GUI/Camera.hpp | 5 ++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index a9edb76264..4c7cb314ac 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -22,11 +22,13 @@ static const float VIEW_REAR[2] = { 180.0f, 90.0f }; namespace Slic3r { namespace GUI { +const float Camera::DefaultDistance = 1000.0f; + Camera::Camera() : type(Ortho) , zoom(1.0f) , phi(45.0f) -// , distance(0.0f) + , distance(DefaultDistance) , requires_zoom_to_bed(false) , inverted_phi(false) , m_theta(45.0f) @@ -107,12 +109,18 @@ void Camera::apply_viewport(int x, int y, unsigned int w, unsigned int h) const void Camera::apply_view_matrix() const { + double theta_rad = Geometry::deg2rad(-(double)m_theta); + double phi_rad = Geometry::deg2rad((double)phi); + double sin_theta = ::sin(theta_rad); + Vec3d camera_pos = m_target + (double)distance * Vec3d(sin_theta * ::sin(phi_rad), sin_theta * ::cos(phi_rad), ::cos(theta_rad)); + glsafe(::glMatrixMode(GL_MODELVIEW)); glsafe(::glLoadIdentity()); glsafe(::glRotatef(-m_theta, 1.0f, 0.0f, 0.0f)); // pitch glsafe(::glRotatef(phi, 0.0f, 0.0f, 1.0f)); // yaw - glsafe(::glTranslated(-m_target(0), -m_target(1), -m_target(2))); // target to origin + + glsafe(::glTranslated(-camera_pos(0), -camera_pos(1), -camera_pos(2))); glsafe(::glGetDoublev(GL_MODELVIEW_MATRIX, m_view_matrix.data())); } @@ -136,8 +144,7 @@ void Camera::apply_projection(const BoundingBoxf3& box) const // FIXME: calculate a tighter value for depth will improve z-fighting // Set at least some minimum depth in case the bounding box is empty to avoid an OpenGL driver error. double depth = std::max(1.0, 5.0 * box.max_size()); - apply_ortho_projection(-w2, w2, -h2, h2, -depth, depth); - + apply_ortho_projection(-w2, w2, -h2, h2, (double)distance - depth, (double)distance + depth); break; } // case Perspective: diff --git a/src/slic3r/GUI/Camera.hpp b/src/slic3r/GUI/Camera.hpp index 4b719dc238..83dbb0f6d8 100644 --- a/src/slic3r/GUI/Camera.hpp +++ b/src/slic3r/GUI/Camera.hpp @@ -9,6 +9,8 @@ namespace GUI { struct Camera { + static const float DefaultDistance; + enum EType : unsigned char { Unknown, @@ -20,7 +22,8 @@ struct Camera EType type; float zoom; float phi; -// float distance; + // Distance between camera position and camera target measured along the camera Z axis + float distance; bool requires_zoom_to_bed; bool inverted_phi; From a99466ef1df99d52277a5f78a4fbb5481d2dd584 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 13 Jun 2019 10:24:19 +0200 Subject: [PATCH 16/64] Method Camera::apply_projection() called at every rendered frame --- src/slic3r/GUI/Camera.cpp | 5 ++++- src/slic3r/GUI/GLCanvas3D.cpp | 9 ++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index 4c7cb314ac..5aa881e3e5 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -48,7 +48,7 @@ std::string Camera::get_type_as_string() const // case Perspective: // return "perspective"; case Ortho: - return "ortho"; + return "orthographic"; }; } @@ -160,12 +160,15 @@ void Camera::debug_render() const imgui.set_next_window_bg_alpha(0.5f); imgui.begin(std::string("Camera statistics"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse); + std::string type = get_type_as_string(); Vec3f position = get_position().cast(); Vec3f target = m_target.cast(); Vec3f forward = get_dir_forward().cast(); Vec3f right = get_dir_right().cast(); Vec3f up = get_dir_up().cast(); + ImGui::InputText("Type", const_cast(type.data()), type.length(), ImGuiInputTextFlags_ReadOnly); + ImGui::Separator(); ImGui::InputFloat3("Position", position.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); ImGui::InputFloat3("Target", target.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); ImGui::Separator(); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 151ec3bdb3..6648d744bd 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1624,6 +1624,7 @@ void GLCanvas3D::render() } m_camera.apply_view_matrix(); + m_camera.apply_projection(_max_bounding_box()); GLfloat position_cam[4] = { 1.0f, 0.0f, 1.0f, 0.0f }; glsafe(::glLightfv(GL_LIGHT1, GL_POSITION, position_cam)); @@ -2515,7 +2516,7 @@ void GLCanvas3D::on_mouse_wheel(wxMouseEvent& evt) m_layers_editing.band_width = std::max(std::min(m_layers_editing.band_width * (1.0f + 0.1f * (float)evt.GetWheelRotation() / (float)evt.GetWheelDelta()), 10.0f), 1.5f); if (m_canvas != nullptr) m_canvas->Refresh(); - + return; } } @@ -2526,8 +2527,7 @@ void GLCanvas3D::on_mouse_wheel(wxMouseEvent& evt) return; // Calculate the zoom delta and apply it to the current zoom factor - float zoom = (float)evt.GetWheelRotation() / (float)evt.GetWheelDelta(); - set_camera_zoom(zoom); + set_camera_zoom((float)evt.GetWheelRotation() / (float)evt.GetWheelDelta()); } void GLCanvas3D::on_timer(wxTimerEvent& evt) @@ -3293,7 +3293,7 @@ void GLCanvas3D::set_camera_zoom(float zoom) zoom = std::min(zoom, 100.0f); m_camera.zoom = zoom; - _refresh_if_shown_on_screen(); + m_dirty = true; } void GLCanvas3D::update_gizmos_on_off_state() @@ -3609,7 +3609,6 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h) // updates camera m_camera.apply_viewport(0, 0, w, h); - m_camera.apply_projection(_max_bounding_box()); m_dirty = false; } From 1a91add2e60f3a4d22cdd6c8a10e57dc8095e0a2 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Fri, 14 Jun 2019 10:38:09 +0200 Subject: [PATCH 17/64] Tighter camera frustrum to reduce z-fighting --- src/slic3r/GUI/3DBed.cpp | 26 +++++++- src/slic3r/GUI/3DBed.hpp | 8 ++- src/slic3r/GUI/Camera.cpp | 55 ++++++++++++++-- src/slic3r/GUI/Camera.hpp | 9 +++ src/slic3r/GUI/GLCanvas3D.cpp | 76 ++++++++++------------- src/slic3r/GUI/GLCanvas3D.hpp | 3 +- src/slic3r/GUI/GLTexture.hpp | 1 + src/slic3r/GUI/GLToolbar.cpp | 7 --- src/slic3r/GUI/Gizmos/GLGizmosManager.cpp | 9 --- 9 files changed, 123 insertions(+), 71 deletions(-) diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index 8392e534a4..c82b34f498 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -273,6 +273,7 @@ void Bed3D::Axes::render_axis(double length) const Bed3D::Bed3D() : m_type(Custom) + , m_extended_bounding_box_dirty(true) #if ENABLE_TEXTURES_FROM_SVG , m_vbo_id(0) #endif // ENABLE_TEXTURES_FROM_SVG @@ -290,7 +291,7 @@ bool Bed3D::set_shape(const Pointfs& shape) m_shape = shape; m_type = new_type; - calc_bounding_box(); + calc_bounding_boxes(); ExPolygon poly; for (const Vec2d& p : m_shape) @@ -311,7 +312,9 @@ bool Bed3D::set_shape(const Pointfs& shape) // Set the origin and size for painting of the coordinate system axes. m_axes.origin = Vec3d(0.0, 0.0, (double)GROUND_Z); - m_axes.length = 0.1 * get_bounding_box().max_size() * Vec3d::Ones(); + m_axes.length = 0.1 * m_bounding_box.max_size() * Vec3d::Ones(); + + m_extended_bounding_box_dirty = true; // Let the calee to update the UI. return true; @@ -400,13 +403,27 @@ void Bed3D::render_axes() const m_axes.render(); } -void Bed3D::calc_bounding_box() +void Bed3D::calc_bounding_boxes() const { m_bounding_box = BoundingBoxf3(); for (const Vec2d& p : m_shape) { m_bounding_box.merge(Vec3d(p(0), p(1), 0.0)); } + + m_extended_bounding_box = m_bounding_box; + + if (m_extended_bounding_box_dirty) + { + // extend to contain Z axis + m_extended_bounding_box.merge(0.1 * m_bounding_box.max_size() * Vec3d::UnitZ()); + + if (!m_model.get_filename().empty()) + // extend to contain model + m_extended_bounding_box.merge(m_model.get_bounding_box()); + + m_extended_bounding_box_dirty = false; + } } void Bed3D::calc_triangles(const ExPolygon& poly) @@ -539,6 +556,9 @@ void Bed3D::render_prusa(const std::string &key, bool bottom) const offset += Vec3d(0.0, 0.0, -0.03); m_model.center_around(offset); + + // update extended bounding box + calc_bounding_boxes(); } if (!m_model.get_filename().empty()) diff --git a/src/slic3r/GUI/3DBed.hpp b/src/slic3r/GUI/3DBed.hpp index e60cdf94e1..79e96fdf01 100644 --- a/src/slic3r/GUI/3DBed.hpp +++ b/src/slic3r/GUI/3DBed.hpp @@ -85,7 +85,9 @@ public: private: EType m_type; Pointfs m_shape; - BoundingBoxf3 m_bounding_box; + mutable BoundingBoxf3 m_bounding_box; + mutable BoundingBoxf3 m_extended_bounding_box; + mutable bool m_extended_bounding_box_dirty; Polygon m_polygon; GeometryBuffer m_triangles; GeometryBuffer m_gridlines; @@ -117,7 +119,7 @@ public: // Return true if the bed shape changed, so the calee will update the UI. bool set_shape(const Pointfs& shape); - const BoundingBoxf3& get_bounding_box() const { return m_bounding_box; } + const BoundingBoxf3& get_bounding_box(bool extended) const { return extended ? m_extended_bounding_box : m_bounding_box; } bool contains(const Point& point) const; Point point_projection(const Point& point) const; @@ -125,7 +127,7 @@ public: void render_axes() const; private: - void calc_bounding_box(); + void calc_bounding_boxes() const; void calc_triangles(const ExPolygon& poly); void calc_gridlines(const ExPolygon& poly, const BoundingBox& bed_bbox); EType detect_type(const Pointfs& shape) const; diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index 5aa881e3e5..1fc2f6be36 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -23,6 +23,8 @@ namespace Slic3r { namespace GUI { const float Camera::DefaultDistance = 1000.0f; +double Camera::FrustrumMinZSize = 50.0; +double Camera::FrustrumZMargin = 10.0; Camera::Camera() : type(Ortho) @@ -127,6 +129,8 @@ void Camera::apply_view_matrix() const void Camera::apply_projection(const BoundingBoxf3& box) const { + m_frustrum_zs = calc_tight_frustrum_zs_around(box); + switch (type) { case Ortho: @@ -141,10 +145,7 @@ void Camera::apply_projection(const BoundingBoxf3& box) const h2 *= inv_two_zoom; } - // FIXME: calculate a tighter value for depth will improve z-fighting - // Set at least some minimum depth in case the bounding box is empty to avoid an OpenGL driver error. - double depth = std::max(1.0, 5.0 * box.max_size()); - apply_ortho_projection(-w2, w2, -h2, h2, (double)distance - depth, (double)distance + depth); + apply_ortho_projection(-w2, w2, -h2, h2, m_frustrum_zs.first, m_frustrum_zs.second); break; } // case Perspective: @@ -166,6 +167,8 @@ void Camera::debug_render() const Vec3f forward = get_dir_forward().cast(); Vec3f right = get_dir_right().cast(); Vec3f up = get_dir_up().cast(); + float nearZ = (float)m_frustrum_zs.first; + float farZ = (float)m_frustrum_zs.second; ImGui::InputText("Type", const_cast(type.data()), type.length(), ImGuiInputTextFlags_ReadOnly); ImGui::Separator(); @@ -175,6 +178,9 @@ void Camera::debug_render() const ImGui::InputFloat3("Forward", forward.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); ImGui::InputFloat3("Right", right.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); ImGui::InputFloat3("Up", up.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); + ImGui::Separator(); + ImGui::InputFloat("Near Z", &nearZ, 0.0f, 0.0f, "%.6f", ImGuiInputTextFlags_ReadOnly); + ImGui::InputFloat("Far Z", &farZ, 0.0f, 0.0f, "%.6f", ImGuiInputTextFlags_ReadOnly); imgui.end(); } #endif // ENABLE_CAMERA_STATISTICS @@ -190,6 +196,47 @@ void Camera::apply_ortho_projection(double x_min, double x_max, double y_min, do glsafe(::glMatrixMode(GL_MODELVIEW)); } +std::pair Camera::calc_tight_frustrum_zs_around(const BoundingBoxf3& box) const +{ + std::pair ret = std::make_pair(DBL_MAX, -DBL_MAX); + + Vec3d bb_min = box.min; + Vec3d bb_max = box.max; + + // bbox vertices in world space + std::vector vertices; + vertices.reserve(8); + vertices.push_back(bb_min); + vertices.emplace_back(bb_max(0), bb_min(1), bb_min(2)); + vertices.emplace_back(bb_max(0), bb_max(1), bb_min(2)); + vertices.emplace_back(bb_min(0), bb_max(1), bb_min(2)); + vertices.emplace_back(bb_min(0), bb_min(1), bb_max(2)); + vertices.emplace_back(bb_max(0), bb_min(1), bb_max(2)); + vertices.push_back(bb_max); + vertices.emplace_back(bb_min(0), bb_max(1), bb_max(2)); + + // set the Z range in eye coordinates (only negative Zs are in front of the camera) + for (const Vec3d& v : vertices) + { + // ensure non-negative values + double z = std::max(-(m_view_matrix * v)(2), 0.0); + ret.first = std::min(ret.first, z); + ret.second = std::max(ret.second, z); + } + + // apply margin + ret.first -= FrustrumZMargin; + ret.second += FrustrumZMargin; + + // ensure min size + if (ret.second - ret.first < FrustrumMinZSize) + ret.second = ret.first + FrustrumMinZSize; + + assert(ret.first > 0.0); + + return ret; +} + } // GUI } // Slic3r diff --git a/src/slic3r/GUI/Camera.hpp b/src/slic3r/GUI/Camera.hpp index 83dbb0f6d8..18dec6083c 100644 --- a/src/slic3r/GUI/Camera.hpp +++ b/src/slic3r/GUI/Camera.hpp @@ -10,6 +10,8 @@ namespace GUI { struct Camera { static const float DefaultDistance; + static double FrustrumMinZSize; + static double FrustrumZMargin; enum EType : unsigned char { @@ -34,6 +36,7 @@ private: mutable std::array m_viewport; mutable Transform3d m_view_matrix; mutable Transform3d m_projection_matrix; + mutable std::pair m_frustrum_zs; BoundingBoxf3 m_scene_box; @@ -63,6 +66,9 @@ public: Vec3d get_position() const { return m_view_matrix.matrix().inverse().block(0, 3, 3, 1); } + double get_near_z() const { return m_frustrum_zs.first; } + double get_far_z() const { return m_frustrum_zs.second; } + void apply_viewport(int x, int y, unsigned int w, unsigned int h) const; void apply_view_matrix() const; void apply_projection(const BoundingBoxf3& box) const; @@ -73,6 +79,9 @@ public: private: void apply_ortho_projection(double x_min, double x_max, double y_min, double y_max, double z_min, double z_max) const; + // returns tight values for nearZ and farZ plane around the given bounding box + // the camera MUST be outside of the bounding box in eye coordinate of the given box + std::pair calc_tight_frustrum_zs_around(const BoundingBoxf3& box) const; }; } // GUI diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 6648d744bd..6980e5267d 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -304,22 +304,10 @@ void GLCanvas3D::LayersEditing::render_overlay(const GLCanvas3D& canvas) const const Rect& bar_rect = get_bar_rect_viewport(canvas); const Rect& reset_rect = get_reset_rect_viewport(canvas); - glsafe(::glDisable(GL_DEPTH_TEST)); - - // The viewport and camera are set to complete view and glOrtho(-$x / 2, $x / 2, -$y / 2, $y / 2, -$depth, $depth), - // where x, y is the window size divided by $self->_zoom. - glsafe(::glPushMatrix()); - glsafe(::glLoadIdentity()); - _render_tooltip_texture(canvas, bar_rect, reset_rect); _render_reset_texture(reset_rect); _render_active_object_annotations(canvas, bar_rect); _render_profile(bar_rect); - - // Revert the matrices. - glsafe(::glPopMatrix()); - - glsafe(::glEnable(GL_DEPTH_TEST)); } float GLCanvas3D::LayersEditing::get_cursor_z_relative(const GLCanvas3D& canvas) @@ -880,10 +868,6 @@ void GLCanvas3D::WarningTexture::render(const GLCanvas3D& canvas) const if ((m_id > 0) && (m_original_width > 0) && (m_original_height > 0) && (m_width > 0) && (m_height > 0)) { - glsafe(::glDisable(GL_DEPTH_TEST)); - glsafe(::glPushMatrix()); - glsafe(::glLoadIdentity()); - const Size& cnv_size = canvas.get_canvas_size(); float zoom = canvas.get_camera().zoom; float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; @@ -904,9 +888,6 @@ void GLCanvas3D::WarningTexture::render(const GLCanvas3D& canvas) const uvs.right_top = { uv_right, uv_top }; GLTexture::render_sub_texture(m_id, left, right, bottom, top, uvs); - - glsafe(::glPopMatrix()); - glsafe(::glEnable(GL_DEPTH_TEST)); } } @@ -1160,10 +1141,6 @@ void GLCanvas3D::LegendTexture::render(const GLCanvas3D& canvas) const { if ((m_id > 0) && (m_original_width > 0) && (m_original_height > 0) && (m_width > 0) && (m_height > 0)) { - glsafe(::glDisable(GL_DEPTH_TEST)); - glsafe(::glPushMatrix()); - glsafe(::glLoadIdentity()); - const Size& cnv_size = canvas.get_canvas_size(); float zoom = canvas.get_camera().zoom; float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; @@ -1184,9 +1161,6 @@ void GLCanvas3D::LegendTexture::render(const GLCanvas3D& canvas) const uvs.right_top = { uv_right, uv_top }; GLTexture::render_sub_texture(m_id, left, right, bottom, top, uvs); - - glsafe(::glPopMatrix()); - glsafe(::glEnable(GL_DEPTH_TEST)); } } @@ -1466,7 +1440,7 @@ BoundingBoxf3 GLCanvas3D::volumes_bounding_box() const BoundingBoxf3 GLCanvas3D::scene_bounding_box() const { BoundingBoxf3 bb = volumes_bounding_box(); - bb.merge(m_bed.get_bounding_box()); + bb.merge(m_bed.get_bounding_box(false)); if (m_config != nullptr) { @@ -1550,7 +1524,7 @@ void GLCanvas3D::allow_multisample(bool allow) void GLCanvas3D::zoom_to_bed() { - _zoom_to_bounding_box(m_bed.get_bounding_box()); + _zoom_to_bounding_box(m_bed.get_bounding_box(false)); } void GLCanvas3D::zoom_to_volumes() @@ -1624,7 +1598,7 @@ void GLCanvas3D::render() } m_camera.apply_view_matrix(); - m_camera.apply_projection(_max_bounding_box()); + m_camera.apply_projection(_max_bounding_box(true)); GLfloat position_cam[4] = { 1.0f, 0.0f, 1.0f, 0.0f }; glsafe(::glLightfv(GL_LIGHT1, GL_POSITION, position_cam)); @@ -1686,16 +1660,7 @@ void GLCanvas3D::render() m_rectangle_selection.render(*this); // draw overlays - _render_gizmos_overlay(); - _render_warning_texture(); - _render_legend_texture(); -#if !ENABLE_SVG_ICONS - _resize_toolbars(); -#endif // !ENABLE_SVG_ICONS - _render_toolbar(); - _render_view_toolbar(); - if ((m_layers_editing.last_object_id >= 0) && (m_layers_editing.object_max_z() > 0.0f)) - m_layers_editing.render_overlay(*this); + _render_overlays(); #if ENABLE_RENDER_STATISTICS ImGuiWrapper& imgui = *wxGetApp().imgui(); @@ -3285,7 +3250,7 @@ void GLCanvas3D::set_camera_zoom(float zoom) zoom = m_camera.zoom / (1.0f - zoom); // Don't allow to zoom too far outside the scene. - float zoom_min = _get_zoom_to_bounding_box_factor(_max_bounding_box()); + float zoom_min = _get_zoom_to_bounding_box_factor(_max_bounding_box(false)); if (zoom_min > 0.0f) zoom = std::max(zoom, zoom_min * 0.7f); @@ -3375,7 +3340,7 @@ Linef3 GLCanvas3D::mouse_ray(const Point& mouse_pos) double GLCanvas3D::get_size_proportional_to_max_bed_size(double factor) const { - return factor * m_bed.get_bounding_box().max_size(); + return factor * m_bed.get_bounding_box(false).max_size(); } void GLCanvas3D::set_cursor(ECursorType type) @@ -3613,10 +3578,10 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h) m_dirty = false; } -BoundingBoxf3 GLCanvas3D::_max_bounding_box() const +BoundingBoxf3 GLCanvas3D::_max_bounding_box(bool include_bed_model) const { BoundingBoxf3 bb = volumes_bounding_box(); - bb.merge(m_bed.get_bounding_box()); + bb.merge(m_bed.get_bounding_box(include_bed_model)); return bb; } @@ -3907,7 +3872,7 @@ void GLCanvas3D::_render_objects() const if (m_config != nullptr) { - const BoundingBoxf3& bed_bb = m_bed.get_bounding_box(); + const BoundingBoxf3& bed_bb = m_bed.get_bounding_box(false); m_volumes.set_print_box((float)bed_bb.min(0), (float)bed_bb.min(1), 0.0f, (float)bed_bb.max(0), (float)bed_bb.max(1), (float)m_config->opt_float("max_print_height")); m_volumes.check_outside_state(m_config, nullptr); } @@ -3989,6 +3954,29 @@ void GLCanvas3D::_render_selection_center() const } #endif // ENABLE_RENDER_SELECTION_CENTER +void GLCanvas3D::_render_overlays() const +{ + glsafe(::glDisable(GL_DEPTH_TEST)); + glsafe(::glPushMatrix()); + glsafe(::glLoadIdentity()); + // ensure the textures are renderered inside the frustrum + glsafe(::glTranslated(0.0, 0.0, -(m_camera.get_near_z() + 0.5))); + + _render_gizmos_overlay(); + _render_warning_texture(); + _render_legend_texture(); +#if !ENABLE_SVG_ICONS + _resize_toolbars(); +#endif // !ENABLE_SVG_ICONS + _render_toolbar(); + _render_view_toolbar(); + + if ((m_layers_editing.last_object_id >= 0) && (m_layers_editing.object_max_z() > 0.0f)) + m_layers_editing.render_overlay(*this); + + glsafe(::glPopMatrix()); +} + void GLCanvas3D::_render_warning_texture() const { m_warning_texture.render(*this); diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 51a36cf69f..a0174dd7f4 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -635,7 +635,7 @@ private: bool _set_current(); void _resize(unsigned int w, unsigned int h); - BoundingBoxf3 _max_bounding_box() const; + BoundingBoxf3 _max_bounding_box(bool include_bed_model) const; void _zoom_to_bounding_box(const BoundingBoxf3& bbox); float _get_zoom_to_bounding_box_factor(const BoundingBoxf3& bbox) const; @@ -652,6 +652,7 @@ private: #if ENABLE_RENDER_SELECTION_CENTER void _render_selection_center() const; #endif // ENABLE_RENDER_SELECTION_CENTER + void _render_overlays() const; void _render_warning_texture() const; void _render_legend_texture() const; void _render_volumes_for_picking() const; diff --git a/src/slic3r/GUI/GLTexture.hpp b/src/slic3r/GUI/GLTexture.hpp index e00b3a3bea..0c5c0efbe1 100644 --- a/src/slic3r/GUI/GLTexture.hpp +++ b/src/slic3r/GUI/GLTexture.hpp @@ -62,6 +62,7 @@ namespace GUI { protected: unsigned int generate_mipmaps(wxImage& image); + private: bool load_from_png(const std::string& filename, bool use_mipmaps); bool load_from_svg(const std::string& filename, bool use_mipmaps, unsigned int max_size_px); diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp index 00cbdfec71..e73533d37f 100644 --- a/src/slic3r/GUI/GLToolbar.cpp +++ b/src/slic3r/GUI/GLToolbar.cpp @@ -390,19 +390,12 @@ void GLToolbar::render(const GLCanvas3D& parent) const generate_icons_texture(); #endif // ENABLE_SVG_ICONS - glsafe(::glDisable(GL_DEPTH_TEST)); - - glsafe(::glPushMatrix()); - glsafe(::glLoadIdentity()); - switch (m_layout.type) { default: case Layout::Horizontal: { render_horizontal(parent); break; } case Layout::Vertical: { render_vertical(parent); break; } } - - glsafe(::glPopMatrix()); } bool GLToolbar::on_mouse(wxMouseEvent& evt, GLCanvas3D& parent) diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index 1006d2bd1e..32809c01d3 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -531,18 +531,9 @@ void GLGizmosManager::render_overlay(const GLCanvas3D& canvas, const Selection& generate_icons_texture(); #endif // ENABLE_SVG_ICONS - glsafe(::glDisable(GL_DEPTH_TEST)); - - glsafe(::glPushMatrix()); - glsafe(::glLoadIdentity()); - do_render_overlay(canvas, selection); - - glsafe(::glPopMatrix()); } - - bool GLGizmosManager::on_mouse_wheel(wxMouseEvent& evt, GLCanvas3D& canvas) { bool processed = false; From ac8de0bcaff04b6dc038128c1544ed182f5b3f14 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Fri, 14 Jun 2019 15:37:29 +0200 Subject: [PATCH 18/64] Follow-up of 1a91add2e60f3a4d22cdd6c8a10e57dc8095e0a2 -> Improvements to tighter camera frustrum to reduce z-fighting --- src/slic3r/GUI/3DBed.cpp | 20 ++++++-------------- src/slic3r/GUI/3DBed.hpp | 1 - src/slic3r/GUI/3DScene.hpp | 1 + src/slic3r/GUI/Camera.cpp | 9 ++++++++- src/slic3r/GUI/GLCanvas3D.cpp | 4 ++-- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index c82b34f498..404fb47745 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -211,7 +211,7 @@ const double Bed3D::Axes::ArrowLength = 5.0; Bed3D::Axes::Axes() : origin(Vec3d::Zero()) -, length(Vec3d::Zero()) +, length(25.0 * Vec3d::Ones()) { m_quadric = ::gluNewQuadric(); if (m_quadric != nullptr) @@ -273,7 +273,6 @@ void Bed3D::Axes::render_axis(double length) const Bed3D::Bed3D() : m_type(Custom) - , m_extended_bounding_box_dirty(true) #if ENABLE_TEXTURES_FROM_SVG , m_vbo_id(0) #endif // ENABLE_TEXTURES_FROM_SVG @@ -314,8 +313,6 @@ bool Bed3D::set_shape(const Pointfs& shape) m_axes.origin = Vec3d(0.0, 0.0, (double)GROUND_Z); m_axes.length = 0.1 * m_bounding_box.max_size() * Vec3d::Ones(); - m_extended_bounding_box_dirty = true; - // Let the calee to update the UI. return true; } @@ -413,17 +410,12 @@ void Bed3D::calc_bounding_boxes() const m_extended_bounding_box = m_bounding_box; - if (m_extended_bounding_box_dirty) - { - // extend to contain Z axis - m_extended_bounding_box.merge(0.1 * m_bounding_box.max_size() * Vec3d::UnitZ()); + // extend to contain axes + m_extended_bounding_box.merge(m_axes.length + Axes::ArrowLength * Vec3d::Ones()); - if (!m_model.get_filename().empty()) - // extend to contain model - m_extended_bounding_box.merge(m_model.get_bounding_box()); - - m_extended_bounding_box_dirty = false; - } + // extend to contain model, if any + if (!m_model.get_filename().empty()) + m_extended_bounding_box.merge(m_model.get_transformed_bounding_box()); } void Bed3D::calc_triangles(const ExPolygon& poly) diff --git a/src/slic3r/GUI/3DBed.hpp b/src/slic3r/GUI/3DBed.hpp index 79e96fdf01..98da035423 100644 --- a/src/slic3r/GUI/3DBed.hpp +++ b/src/slic3r/GUI/3DBed.hpp @@ -87,7 +87,6 @@ private: Pointfs m_shape; mutable BoundingBoxf3 m_bounding_box; mutable BoundingBoxf3 m_extended_bounding_box; - mutable bool m_extended_bounding_box_dirty; Polygon m_polygon; GeometryBuffer m_triangles; GeometryBuffer m_gridlines; diff --git a/src/slic3r/GUI/3DScene.hpp b/src/slic3r/GUI/3DScene.hpp index 2ca11073be..c0613badd1 100644 --- a/src/slic3r/GUI/3DScene.hpp +++ b/src/slic3r/GUI/3DScene.hpp @@ -555,6 +555,7 @@ public: const std::string& get_filename() const { return m_filename; } const BoundingBoxf3& get_bounding_box() const { return m_volume.bounding_box; } + const BoundingBoxf3& get_transformed_bounding_box() const { return m_volume.transformed_bounding_box(); } void reset(); diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index 1fc2f6be36..f6cefc8010 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -169,6 +169,7 @@ void Camera::debug_render() const Vec3f up = get_dir_up().cast(); float nearZ = (float)m_frustrum_zs.first; float farZ = (float)m_frustrum_zs.second; + float deltaZ = farZ - nearZ; ImGui::InputText("Type", const_cast(type.data()), type.length(), ImGuiInputTextFlags_ReadOnly); ImGui::Separator(); @@ -181,6 +182,7 @@ void Camera::debug_render() const ImGui::Separator(); ImGui::InputFloat("Near Z", &nearZ, 0.0f, 0.0f, "%.6f", ImGuiInputTextFlags_ReadOnly); ImGui::InputFloat("Far Z", &farZ, 0.0f, 0.0f, "%.6f", ImGuiInputTextFlags_ReadOnly); + ImGui::InputFloat("Delta Z", &deltaZ, 0.0f, 0.0f, "%.6f", ImGuiInputTextFlags_ReadOnly); imgui.end(); } #endif // ENABLE_CAMERA_STATISTICS @@ -230,7 +232,12 @@ std::pair Camera::calc_tight_frustrum_zs_around(const BoundingBo // ensure min size if (ret.second - ret.first < FrustrumMinZSize) - ret.second = ret.first + FrustrumMinZSize; + { + double mid_z = 0.5 * (ret.first + ret.second); + double half_size = 0.5 * FrustrumMinZSize; + ret.first = mid_z - half_size; + ret.second = mid_z + half_size; + } assert(ret.first > 0.0); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index faee2727db..fd77b46096 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1590,8 +1590,8 @@ void GLCanvas3D::render() if (m_camera.requires_zoom_to_bed) { zoom_to_bed(); - const Size& cnv_size = get_canvas_size(); - _resize((unsigned int)cnv_size.get_width(), (unsigned int)cnv_size.get_height()); +// const Size& cnv_size = get_canvas_size(); +// _resize((unsigned int)cnv_size.get_width(), (unsigned int)cnv_size.get_height()); m_camera.requires_zoom_to_bed = false; } From a3e6412113b1760ff2ab980cbecffe6505426ba2 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 19 Jun 2019 13:01:18 +0200 Subject: [PATCH 19/64] Enabled perspective camera --- src/slic3r/GUI/Camera.cpp | 77 +++++++++++++++++++---------------- src/slic3r/GUI/Camera.hpp | 14 ++++--- src/slic3r/GUI/GLCanvas3D.cpp | 2 + 3 files changed, 52 insertions(+), 41 deletions(-) diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index f6cefc8010..1620548ef9 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -22,19 +22,19 @@ static const float VIEW_REAR[2] = { 180.0f, 90.0f }; namespace Slic3r { namespace GUI { -const float Camera::DefaultDistance = 1000.0f; +const double Camera::DefaultDistance = 1000.0; double Camera::FrustrumMinZSize = 50.0; double Camera::FrustrumZMargin = 10.0; Camera::Camera() - : type(Ortho) - , zoom(1.0f) + : zoom(1.0f) , phi(45.0f) - , distance(DefaultDistance) , requires_zoom_to_bed(false) , inverted_phi(false) - , m_theta(45.0f) + , m_type(Ortho) , m_target(Vec3d::Zero()) + , m_theta(45.0f) + , m_distance(DefaultDistance) , m_view_matrix(Transform3d::Identity()) , m_projection_matrix(Transform3d::Identity()) { @@ -42,18 +42,27 @@ Camera::Camera() std::string Camera::get_type_as_string() const { - switch (type) + switch (m_type) { default: case Unknown: return "unknown"; -// case Perspective: -// return "perspective"; + case Perspective: + return "perspective"; case Ortho: return "orthographic"; }; } +void Camera::select_next_type() +{ + unsigned char next = (unsigned char)m_type + 1; + if (next == (unsigned char)Num_types) + next = 1; + + m_type = (EType)next; +} + void Camera::set_target(const Vec3d& target) { m_target = target; @@ -114,7 +123,7 @@ void Camera::apply_view_matrix() const double theta_rad = Geometry::deg2rad(-(double)m_theta); double phi_rad = Geometry::deg2rad((double)phi); double sin_theta = ::sin(theta_rad); - Vec3d camera_pos = m_target + (double)distance * Vec3d(sin_theta * ::sin(phi_rad), sin_theta * ::cos(phi_rad), ::cos(theta_rad)); + Vec3d camera_pos = m_target + m_distance * Vec3d(sin_theta * ::sin(phi_rad), sin_theta * ::cos(phi_rad), ::cos(theta_rad)); glsafe(::glMatrixMode(GL_MODELVIEW)); glsafe(::glLoadIdentity()); @@ -131,27 +140,36 @@ void Camera::apply_projection(const BoundingBoxf3& box) const { m_frustrum_zs = calc_tight_frustrum_zs_around(box); - switch (type) + double w = (double)m_viewport[2]; + double h = (double)m_viewport[3]; + double two_zoom = 2.0 * zoom; + if (two_zoom != 0.0) { + double inv_two_zoom = 1.0 / two_zoom; + w *= inv_two_zoom; + h *= inv_two_zoom; + } + + glsafe(::glMatrixMode(GL_PROJECTION)); + glsafe(::glLoadIdentity()); + + switch (m_type) + { + default: case Ortho: { - double w2 = (double)m_viewport[2]; - double h2 = (double)m_viewport[3]; - double two_zoom = 2.0 * zoom; - if (two_zoom != 0.0) - { - double inv_two_zoom = 1.0 / two_zoom; - w2 *= inv_two_zoom; - h2 *= inv_two_zoom; - } - - apply_ortho_projection(-w2, w2, -h2, h2, m_frustrum_zs.first, m_frustrum_zs.second); + glsafe(::glOrtho(-w, w, -h, h, m_frustrum_zs.first, m_frustrum_zs.second)); break; } -// case Perspective: -// { -// } + case Perspective: + { + glsafe(::glFrustum(-w, w, -h, h, m_frustrum_zs.first, m_frustrum_zs.second)); + break; } + } + + glsafe(::glGetDoublev(GL_PROJECTION_MATRIX, m_projection_matrix.data())); + glsafe(::glMatrixMode(GL_MODELVIEW)); } #if ENABLE_CAMERA_STATISTICS @@ -187,17 +205,6 @@ void Camera::debug_render() const } #endif // ENABLE_CAMERA_STATISTICS -void Camera::apply_ortho_projection(double x_min, double x_max, double y_min, double y_max, double z_min, double z_max) const -{ - glsafe(::glMatrixMode(GL_PROJECTION)); - glsafe(::glLoadIdentity()); - - glsafe(::glOrtho(x_min, x_max, y_min, y_max, z_min, z_max)); - glsafe(::glGetDoublev(GL_PROJECTION_MATRIX, m_projection_matrix.data())); - - glsafe(::glMatrixMode(GL_MODELVIEW)); -} - std::pair Camera::calc_tight_frustrum_zs_around(const BoundingBoxf3& box) const { std::pair ret = std::make_pair(DBL_MAX, -DBL_MAX); diff --git a/src/slic3r/GUI/Camera.hpp b/src/slic3r/GUI/Camera.hpp index 18dec6083c..3f8d676b5b 100644 --- a/src/slic3r/GUI/Camera.hpp +++ b/src/slic3r/GUI/Camera.hpp @@ -9,29 +9,29 @@ namespace GUI { struct Camera { - static const float DefaultDistance; + static const double DefaultDistance; static double FrustrumMinZSize; static double FrustrumZMargin; enum EType : unsigned char { Unknown, -// Perspective, + Perspective, Ortho, Num_types }; - EType type; float zoom; float phi; - // Distance between camera position and camera target measured along the camera Z axis - float distance; bool requires_zoom_to_bed; bool inverted_phi; private: + EType m_type; Vec3d m_target; float m_theta; + // Distance between camera position and camera target measured along the camera Z axis + double m_distance; mutable std::array m_viewport; mutable Transform3d m_view_matrix; @@ -43,7 +43,10 @@ private: public: Camera(); + EType get_type() const { return m_type; } std::string get_type_as_string() const; + void set_type(EType type) { m_type = type; } + void select_next_type(); const Vec3d& get_target() const { return m_target; } void set_target(const Vec3d& target); @@ -78,7 +81,6 @@ public: #endif // ENABLE_CAMERA_STATISTICS private: - void apply_ortho_projection(double x_min, double x_max, double y_min, double y_max, double z_min, double z_max) const; // returns tight values for nearZ and farZ plane around the given bounding box // the camera MUST be outside of the bounding box in eye coordinate of the given box std::pair calc_tight_frustrum_zs_around(const BoundingBoxf3& box) const; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 021a72dcb0..7f8d915836 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2365,6 +2365,8 @@ void GLCanvas3D::on_char(wxKeyEvent& evt) case 'a': { post_event(SimpleEvent(EVT_GLCANVAS_ARRANGE)); break; } case 'B': case 'b': { zoom_to_bed(); break; } + case 'C': + case 'c': { m_camera.select_next_type(); m_dirty = true; break; } case 'I': case 'i': { set_camera_zoom(1.0f); break; } case 'O': From da8179d9c7a7f1892775a3f6d858db60a1c55501 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 19 Jun 2019 14:18:51 +0200 Subject: [PATCH 20/64] More camera related functionalities moved from GLCanvas3D to Camera --- src/slic3r/GUI/Camera.cpp | 98 +++++++++++++++++- src/slic3r/GUI/Camera.hpp | 10 +- src/slic3r/GUI/GLCanvas3D.cpp | 116 ++++------------------ src/slic3r/GUI/GLCanvas3D.hpp | 5 +- src/slic3r/GUI/GLSelectionRectangle.cpp | 2 +- src/slic3r/GUI/GLToolbar.cpp | 12 +-- src/slic3r/GUI/Gizmos/GLGizmosManager.cpp | 2 +- 7 files changed, 131 insertions(+), 114 deletions(-) diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index 1620548ef9..a3ecb5e541 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -27,13 +27,13 @@ double Camera::FrustrumMinZSize = 50.0; double Camera::FrustrumZMargin = 10.0; Camera::Camera() - : zoom(1.0f) - , phi(45.0f) + : phi(45.0f) , requires_zoom_to_bed(false) , inverted_phi(false) , m_type(Ortho) , m_target(Vec3d::Zero()) , m_theta(45.0f) + , m_zoom(1.0) , m_distance(DefaultDistance) , m_view_matrix(Transform3d::Identity()) , m_projection_matrix(Transform3d::Identity()) @@ -83,6 +83,22 @@ void Camera::set_theta(float theta, bool apply_limit) } } +void Camera::set_zoom(double zoom, const BoundingBoxf3& max_box, int canvas_w, int canvas_h) +{ + zoom = std::max(std::min(zoom, 4.0), -4.0) / 10.0; + zoom = m_zoom / (1.0 - zoom); + + // Don't allow to zoom too far outside the scene. + double zoom_min = calc_zoom_to_bounding_box_factor(max_box, canvas_w, canvas_h); + if (zoom_min > 0.0) + zoom = std::max(zoom, zoom_min * 0.7); + + // Don't allow to zoom too close to the scene. + zoom = std::min(zoom, 100.0); + + m_zoom = zoom; +} + bool Camera::select_view(const std::string& direction) { const float* dir_vec = nullptr; @@ -142,7 +158,8 @@ void Camera::apply_projection(const BoundingBoxf3& box) const double w = (double)m_viewport[2]; double h = (double)m_viewport[3]; - double two_zoom = 2.0 * zoom; + + double two_zoom = 2.0 * m_zoom; if (two_zoom != 0.0) { double inv_two_zoom = 1.0 / two_zoom; @@ -172,6 +189,18 @@ void Camera::apply_projection(const BoundingBoxf3& box) const glsafe(::glMatrixMode(GL_MODELVIEW)); } +void Camera::zoom_to_box(const BoundingBoxf3& box, int canvas_w, int canvas_h) +{ + // Calculate the zoom factor needed to adjust the view around the given box. + double zoom = calc_zoom_to_bounding_box_factor(box, canvas_w, canvas_h); + if (zoom > 0.0) + { + m_zoom = zoom; + // center view around box center + m_target = box.center(); + } +} + #if ENABLE_CAMERA_STATISTICS void Camera::debug_render() const { @@ -212,7 +241,7 @@ std::pair Camera::calc_tight_frustrum_zs_around(const BoundingBo Vec3d bb_min = box.min; Vec3d bb_max = box.max; - // bbox vertices in world space + // box vertices in world space std::vector vertices; vertices.reserve(8); vertices.push_back(bb_min); @@ -251,6 +280,67 @@ std::pair Camera::calc_tight_frustrum_zs_around(const BoundingBo return ret; } +double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int canvas_w, int canvas_h) const +{ + double max_bb_size = box.max_size(); + if (max_bb_size == 0.0) + return -1.0; + + // project the box vertices on a plane perpendicular to the camera forward axis + // then calculates the vertices coordinate on this plane along the camera xy axes + + // ensure that the view matrix is updated + apply_view_matrix(); + + Vec3d right = get_dir_right(); + Vec3d up = get_dir_up(); + Vec3d forward = get_dir_forward(); + + Vec3d bb_min = box.min; + Vec3d bb_max = box.max; + Vec3d bb_center = box.center(); + + // box vertices in world space + std::vector vertices; + vertices.reserve(8); + vertices.push_back(bb_min); + vertices.emplace_back(bb_max(0), bb_min(1), bb_min(2)); + vertices.emplace_back(bb_max(0), bb_max(1), bb_min(2)); + vertices.emplace_back(bb_min(0), bb_max(1), bb_min(2)); + vertices.emplace_back(bb_min(0), bb_min(1), bb_max(2)); + vertices.emplace_back(bb_max(0), bb_min(1), bb_max(2)); + vertices.push_back(bb_max); + vertices.emplace_back(bb_min(0), bb_max(1), bb_max(2)); + + double max_x = 0.0; + double max_y = 0.0; + + // margin factor to give some empty space around the box + double margin_factor = 1.25; + + for (const Vec3d& v : vertices) + { + // project vertex on the plane perpendicular to camera forward axis + Vec3d pos(v(0) - bb_center(0), v(1) - bb_center(1), v(2) - bb_center(2)); + Vec3d proj_on_plane = pos - pos.dot(forward) * forward; + + // calculates vertex coordinate along camera xy axes + double x_on_plane = proj_on_plane.dot(right); + double y_on_plane = proj_on_plane.dot(up); + + max_x = std::max(max_x, std::abs(x_on_plane)); + max_y = std::max(max_y, std::abs(y_on_plane)); + } + + if ((max_x == 0.0) || (max_y == 0.0)) + return -1.0f; + + max_x *= margin_factor; + max_y *= margin_factor; + + return std::min((double)canvas_w / (2.0 * max_x), (double)canvas_h / (2.0 * max_y)); +} + } // GUI } // Slic3r diff --git a/src/slic3r/GUI/Camera.hpp b/src/slic3r/GUI/Camera.hpp index 3f8d676b5b..fe6571b056 100644 --- a/src/slic3r/GUI/Camera.hpp +++ b/src/slic3r/GUI/Camera.hpp @@ -21,7 +21,6 @@ struct Camera Num_types }; - float zoom; float phi; bool requires_zoom_to_bed; bool inverted_phi; @@ -30,6 +29,7 @@ private: EType m_type; Vec3d m_target; float m_theta; + double m_zoom; // Distance between camera position and camera target measured along the camera Z axis double m_distance; @@ -54,8 +54,11 @@ public: float get_theta() const { return m_theta; } void set_theta(float theta, bool apply_limit); + double get_zoom() const { return m_zoom; } + void set_zoom(double zoom, const BoundingBoxf3& max_box, int canvas_w, int canvas_h); + const BoundingBoxf3& get_scene_box() const { return m_scene_box; } - void set_scene_box(const BoundingBoxf3& box){ m_scene_box = box; } + void set_scene_box(const BoundingBoxf3& box) { m_scene_box = box; } bool select_view(const std::string& direction); @@ -76,6 +79,8 @@ public: void apply_view_matrix() const; void apply_projection(const BoundingBoxf3& box) const; + void zoom_to_box(const BoundingBoxf3& box, int canvas_w, int canvas_h); + #if ENABLE_CAMERA_STATISTICS void debug_render() const; #endif // ENABLE_CAMERA_STATISTICS @@ -84,6 +89,7 @@ private: // returns tight values for nearZ and farZ plane around the given bounding box // the camera MUST be outside of the bounding box in eye coordinate of the given box std::pair calc_tight_frustrum_zs_around(const BoundingBoxf3& box) const; + double calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int canvas_w, int canvas_h) const; }; } // GUI diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 7f8d915836..d126c54459 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -357,7 +357,7 @@ Rect GLCanvas3D::LayersEditing::get_bar_rect_viewport(const GLCanvas3D& canvas) float half_w = 0.5f * (float)cnv_size.get_width(); float half_h = 0.5f * (float)cnv_size.get_height(); - float zoom = canvas.get_camera().zoom; + float zoom = (float)canvas.get_camera().get_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; return Rect((half_w - thickness_bar_width(canvas)) * inv_zoom, half_h * inv_zoom, half_w * inv_zoom, (-half_h + reset_button_height(canvas)) * inv_zoom); @@ -369,7 +369,7 @@ Rect GLCanvas3D::LayersEditing::get_reset_rect_viewport(const GLCanvas3D& canvas float half_w = 0.5f * (float)cnv_size.get_width(); float half_h = 0.5f * (float)cnv_size.get_height(); - float zoom = canvas.get_camera().zoom; + float zoom = (float)canvas.get_camera().get_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; return Rect((half_w - thickness_bar_width(canvas)) * inv_zoom, (-half_h + reset_button_height(canvas)) * inv_zoom, half_w * inv_zoom, -half_h * inv_zoom); @@ -400,7 +400,7 @@ void GLCanvas3D::LayersEditing::_render_tooltip_texture(const GLCanvas3D& canvas const float width = (float)m_tooltip_texture.get_width() * scale; const float height = (float)m_tooltip_texture.get_height() * scale; - float zoom = canvas.get_camera().zoom; + float zoom = (float)canvas.get_camera().get_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; float gap = 10.0f * inv_zoom; @@ -867,7 +867,7 @@ void GLCanvas3D::WarningTexture::render(const GLCanvas3D& canvas) const if ((m_id > 0) && (m_original_width > 0) && (m_original_height > 0) && (m_width > 0) && (m_height > 0)) { const Size& cnv_size = canvas.get_canvas_size(); - float zoom = canvas.get_camera().zoom; + float zoom = (float)canvas.get_camera().get_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; float left = (-0.5f * (float)m_original_width) * inv_zoom; float top = (-0.5f * (float)cnv_size.get_height() + (float)m_original_height + 2.0f) * inv_zoom; @@ -1140,7 +1140,7 @@ void GLCanvas3D::LegendTexture::render(const GLCanvas3D& canvas) const if ((m_id > 0) && (m_original_width > 0) && (m_original_height > 0) && (m_width > 0) && (m_height > 0)) { const Size& cnv_size = canvas.get_canvas_size(); - float zoom = canvas.get_camera().zoom; + float zoom = (float)canvas.get_camera().get_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; float left = (-0.5f * (float)cnv_size.get_width()) * inv_zoom; float top = (0.5f * (float)cnv_size.get_height()) * inv_zoom; @@ -1523,20 +1523,20 @@ void GLCanvas3D::allow_multisample(bool allow) void GLCanvas3D::zoom_to_bed() { - _zoom_to_bounding_box(m_bed.get_bounding_box(false)); + _zoom_to_box(m_bed.get_bounding_box(false)); } void GLCanvas3D::zoom_to_volumes() { m_apply_zoom_to_volumes_filter = true; - _zoom_to_bounding_box(volumes_bounding_box()); + _zoom_to_box(volumes_bounding_box()); m_apply_zoom_to_volumes_filter = false; } void GLCanvas3D::zoom_to_selection() { if (!m_selection.is_empty()) - _zoom_to_bounding_box(m_selection.get_bounding_box()); + _zoom_to_box(m_selection.get_bounding_box()); } void GLCanvas3D::select_view(const std::string& direction) @@ -2368,9 +2368,9 @@ void GLCanvas3D::on_char(wxKeyEvent& evt) case 'C': case 'c': { m_camera.select_next_type(); m_dirty = true; break; } case 'I': - case 'i': { set_camera_zoom(1.0f); break; } + case 'i': { set_camera_zoom(1.0); break; } case 'O': - case 'o': { set_camera_zoom(-1.0f); break; } + case 'o': { set_camera_zoom(-1.0); break; } case 'Z': case 'z': { m_selection.is_empty() ? zoom_to_volumes() : zoom_to_selection(); break; } default: { evt.Skip(); break; } @@ -2507,7 +2507,7 @@ void GLCanvas3D::on_mouse_wheel(wxMouseEvent& evt) return; // Calculate the zoom delta and apply it to the current zoom factor - set_camera_zoom((float)evt.GetWheelRotation() / (float)evt.GetWheelDelta()); + set_camera_zoom((double)evt.GetWheelRotation() / (double)evt.GetWheelDelta()); } void GLCanvas3D::on_timer(wxTimerEvent& evt) @@ -3259,20 +3259,10 @@ void GLCanvas3D::do_mirror() post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS)); } -void GLCanvas3D::set_camera_zoom(float zoom) +void GLCanvas3D::set_camera_zoom(double zoom) { - zoom = std::max(std::min(zoom, 4.0f), -4.0f) / 10.0f; - zoom = m_camera.zoom / (1.0f - zoom); - - // Don't allow to zoom too far outside the scene. - float zoom_min = _get_zoom_to_bounding_box_factor(_max_bounding_box(false)); - if (zoom_min > 0.0f) - zoom = std::max(zoom, zoom_min * 0.7f); - - // Don't allow to zoom too close to the scene. - zoom = std::min(zoom, 100.0f); - - m_camera.zoom = zoom; + const Size& cnv_size = get_canvas_size(); + m_camera.set_zoom(zoom, _max_bounding_box(false), cnv_size.get_width(), cnv_size.get_height()); m_dirty = true; } @@ -3600,79 +3590,11 @@ BoundingBoxf3 GLCanvas3D::_max_bounding_box(bool include_bed_model) const return bb; } -void GLCanvas3D::_zoom_to_bounding_box(const BoundingBoxf3& bbox) +void GLCanvas3D::_zoom_to_box(const BoundingBoxf3& box) { - // Calculate the zoom factor needed to adjust viewport to bounding box. - float zoom = _get_zoom_to_bounding_box_factor(bbox); - if (zoom > 0.0f) - { - m_camera.zoom = zoom; - // center view around bounding box center - m_camera.set_target(bbox.center()); - m_dirty = true; - } -} - -float GLCanvas3D::_get_zoom_to_bounding_box_factor(const BoundingBoxf3& bbox) const -{ - float max_bb_size = bbox.max_size(); - if (max_bb_size == 0.0f) - return -1.0f; - - // project the bbox vertices on a plane perpendicular to the camera forward axis - // then calculates the vertices coordinate on this plane along the camera xy axes - - // we need the view matrix, we let opengl calculate it (same as done in render()) - m_camera.apply_view_matrix(); - - Vec3d right = m_camera.get_dir_right(); - Vec3d up = m_camera.get_dir_up(); - Vec3d forward = m_camera.get_dir_forward(); - - Vec3d bb_min = bbox.min; - Vec3d bb_max = bbox.max; - Vec3d bb_center = bbox.center(); - - // bbox vertices in world space - std::vector vertices; - vertices.reserve(8); - vertices.push_back(bb_min); - vertices.emplace_back(bb_max(0), bb_min(1), bb_min(2)); - vertices.emplace_back(bb_max(0), bb_max(1), bb_min(2)); - vertices.emplace_back(bb_min(0), bb_max(1), bb_min(2)); - vertices.emplace_back(bb_min(0), bb_min(1), bb_max(2)); - vertices.emplace_back(bb_max(0), bb_min(1), bb_max(2)); - vertices.push_back(bb_max); - vertices.emplace_back(bb_min(0), bb_max(1), bb_max(2)); - - double max_x = 0.0; - double max_y = 0.0; - - // margin factor to give some empty space around the bbox - double margin_factor = 1.25; - - for (const Vec3d& v : vertices) - { - // project vertex on the plane perpendicular to camera forward axis - Vec3d pos(v(0) - bb_center(0), v(1) - bb_center(1), v(2) - bb_center(2)); - Vec3d proj_on_plane = pos - pos.dot(forward) * forward; - - // calculates vertex coordinate along camera xy axes - double x_on_plane = proj_on_plane.dot(right); - double y_on_plane = proj_on_plane.dot(up); - - max_x = std::max(max_x, margin_factor * std::abs(x_on_plane)); - max_y = std::max(max_y, margin_factor * std::abs(y_on_plane)); - } - - if ((max_x == 0.0) || (max_y == 0.0)) - return -1.0f; - - max_x *= 2.0; - max_y *= 2.0; - const Size& cnv_size = get_canvas_size(); - return (float)std::min((double)cnv_size.get_width() / max_x, (double)cnv_size.get_height() / max_y); + m_camera.zoom_to_box(box, cnv_size.get_width(), cnv_size.get_height()); + m_dirty = true; } void GLCanvas3D::_refresh_if_shown_on_screen() @@ -4088,7 +4010,7 @@ void GLCanvas3D::_render_toolbar() const #endif // ENABLE_RETINA_GL Size cnv_size = get_canvas_size(); - float zoom = m_camera.zoom; + float zoom = (float)m_camera.get_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; GLToolbar::Layout::EOrientation orientation = m_toolbar.get_layout_orientation(); @@ -4156,7 +4078,7 @@ void GLCanvas3D::_render_view_toolbar() const #endif // ENABLE_RETINA_GL Size cnv_size = get_canvas_size(); - float zoom = m_camera.zoom; + float zoom = (float)m_camera.get_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; // places the toolbar on the bottom-left corner of the 3d scene diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index d751ecf24f..423e607764 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -598,7 +598,7 @@ public: void do_flatten(); void do_mirror(); - void set_camera_zoom(float zoom); + void set_camera_zoom(double zoom); void update_gizmos_on_off_state(); void reset_all_gizmos() { m_gizmos.reset_all_states(); } @@ -638,8 +638,7 @@ private: BoundingBoxf3 _max_bounding_box(bool include_bed_model) const; - void _zoom_to_bounding_box(const BoundingBoxf3& bbox); - float _get_zoom_to_bounding_box_factor(const BoundingBoxf3& bbox) const; + void _zoom_to_box(const BoundingBoxf3& box); void _refresh_if_shown_on_screen(); diff --git a/src/slic3r/GUI/GLSelectionRectangle.cpp b/src/slic3r/GUI/GLSelectionRectangle.cpp index 9684bb5ec9..327cb1fde8 100644 --- a/src/slic3r/GUI/GLSelectionRectangle.cpp +++ b/src/slic3r/GUI/GLSelectionRectangle.cpp @@ -68,7 +68,7 @@ namespace GUI { if (!is_dragging()) return; - float zoom = canvas.get_camera().zoom; + float zoom = (float)canvas.get_camera().get_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; Size cnv_size = canvas.get_canvas_size(); diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp index e73533d37f..1b8cfc4e8a 100644 --- a/src/slic3r/GUI/GLToolbar.cpp +++ b/src/slic3r/GUI/GLToolbar.cpp @@ -607,7 +607,7 @@ std::string GLToolbar::update_hover_state_horizontal(const Vec2d& mouse_pos, GLC { // NB: mouse_pos is already scaled appropriately - float zoom = parent.get_camera().zoom; + float zoom = (float)parent.get_camera().get_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; #if ENABLE_SVG_ICONS float factor = m_layout.scale * inv_zoom; @@ -712,7 +712,7 @@ std::string GLToolbar::update_hover_state_vertical(const Vec2d& mouse_pos, GLCan { // NB: mouse_pos is already scaled appropriately - float zoom = parent.get_camera().zoom; + float zoom = (float)parent.get_camera().get_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; #if ENABLE_SVG_ICONS float factor = m_layout.scale * inv_zoom; @@ -829,7 +829,7 @@ int GLToolbar::contains_mouse_horizontal(const Vec2d& mouse_pos, const GLCanvas3 { // NB: mouse_pos is already scaled appropriately - float zoom = parent.get_camera().zoom; + float zoom = (float)parent.get_camera().get_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; #if ENABLE_SVG_ICONS float factor = m_layout.scale * inv_zoom; @@ -912,7 +912,7 @@ int GLToolbar::contains_mouse_vertical(const Vec2d& mouse_pos, const GLCanvas3D& { // NB: mouse_pos is already scaled appropriately - float zoom = parent.get_camera().zoom; + float zoom = (float)parent.get_camera().get_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; #if ENABLE_SVG_ICONS float factor = m_layout.scale * inv_zoom; @@ -1008,7 +1008,7 @@ void GLToolbar::render_horizontal(const GLCanvas3D& parent) const return; #endif // !ENABLE_SVG_ICONS - float zoom = parent.get_camera().zoom; + float zoom = (float)parent.get_camera().get_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; #if ENABLE_SVG_ICONS float factor = inv_zoom * m_layout.scale; @@ -1163,7 +1163,7 @@ void GLToolbar::render_vertical(const GLCanvas3D& parent) const return; #endif // !ENABLE_SVG_ICONS - float zoom = parent.get_camera().zoom; + float zoom = (float)parent.get_camera().get_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; #if ENABLE_SVG_ICONS float factor = inv_zoom * m_layout.scale; diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index 32809c01d3..e4b386eb40 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -930,7 +930,7 @@ void GLGizmosManager::do_render_overlay(const GLCanvas3D& canvas, const Selectio float cnv_w = (float)canvas.get_canvas_size().get_width(); float cnv_h = (float)canvas.get_canvas_size().get_height(); - float zoom = canvas.get_camera().zoom; + float zoom = (float)canvas.get_camera().get_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; float height = get_total_overlay_height(); From b91b94ad3cf25e77bf7357e8da458a7fa741095c Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 19 Jun 2019 14:33:09 +0200 Subject: [PATCH 21/64] Key K set as camera type toggle and updated keyboard shortcuts dialog --- src/slic3r/GUI/GLCanvas3D.cpp | 4 ++-- src/slic3r/GUI/KBShortcutsDialog.cpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index d126c54459..efebfa4a52 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2365,10 +2365,10 @@ void GLCanvas3D::on_char(wxKeyEvent& evt) case 'a': { post_event(SimpleEvent(EVT_GLCANVAS_ARRANGE)); break; } case 'B': case 'b': { zoom_to_bed(); break; } - case 'C': - case 'c': { m_camera.select_next_type(); m_dirty = true; break; } case 'I': case 'i': { set_camera_zoom(1.0); break; } + case 'K': + case 'k': { m_camera.select_next_type(); m_dirty = true; break; } case 'O': case 'o': { set_camera_zoom(-1.0); break; } case 'Z': diff --git a/src/slic3r/GUI/KBShortcutsDialog.cpp b/src/slic3r/GUI/KBShortcutsDialog.cpp index 347dac13ea..1af658ed36 100644 --- a/src/slic3r/GUI/KBShortcutsDialog.cpp +++ b/src/slic3r/GUI/KBShortcutsDialog.cpp @@ -147,6 +147,7 @@ void KBShortcutsDialog::fill_shortcuts() plater_shortcuts.push_back(Shortcut("F", L("Press to scale selection to fit print volume\nin Gizmo scale"))); plater_shortcuts.push_back(Shortcut(alt, L("Press to activate deselection rectangle\nor to scale or rotate selected objects\naround their own center"))); plater_shortcuts.push_back(Shortcut(ctrl, L("Press to activate one direction scaling in Gizmo scale"))); + plater_shortcuts.push_back(Shortcut("K", L("Change camera type"))); plater_shortcuts.push_back(Shortcut("B", L("Zoom to Bed"))); plater_shortcuts.push_back(Shortcut("Z", L("Zoom to all objects in scene, if none selected"))); plater_shortcuts.push_back(Shortcut("Z", L("Zoom to selected object"))); From 2ae2672ee92db219ad9210ddd5288f2bd5a62fbc Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Wed, 19 Jun 2019 14:52:55 +0200 Subject: [PATCH 22/64] Building igl statically and moving to the dep scripts Fixing dep build script on Windows and removing some warnings. Use bundled igl by default. Not building with the dependency scripts if not explicitly stated. This way, it will stay in Fix the libigl patch to include C source files in header only mode. --- CMakeLists.txt | 6 +- deps/CMakeLists.txt | 2 + deps/deps-unix-common.cmake | 30 ++++++- deps/deps-windows.cmake | 45 ++++++++++ deps/igl-fixes.patch | 87 +++++++++++++++++++ src/CMakeLists.txt | 1 + src/libigl/CMakeLists.txt | 14 +++ src/{ => libigl}/igl/AABB.cpp | 0 src/{ => libigl}/igl/AABB.h | 0 src/{ => libigl}/igl/ARAPEnergyType.h | 0 src/{ => libigl}/igl/AtA_cached.cpp | 0 src/{ => libigl}/igl/AtA_cached.h | 0 src/{ => libigl}/igl/C_STR.h | 0 src/{ => libigl}/igl/Camera.h | 0 src/{ => libigl}/igl/EPS.cpp | 0 src/{ => libigl}/igl/EPS.h | 0 src/{ => libigl}/igl/HalfEdgeIterator.cpp | 0 src/{ => libigl}/igl/HalfEdgeIterator.h | 0 src/{ => libigl}/igl/Hit.h | 0 src/{ => libigl}/igl/IO | 0 src/{ => libigl}/igl/IndexComparison.h | 0 src/{ => libigl}/igl/LinSpaced.h | 0 src/{ => libigl}/igl/MeshBooleanType.h | 0 src/{ => libigl}/igl/NormalType.h | 0 src/{ => libigl}/igl/ONE.h | 0 src/{ => libigl}/igl/PI.h | 0 src/{ => libigl}/igl/REDRUM.h | 0 src/{ => libigl}/igl/STR.h | 0 ...osition_Givens_QR_Factorization_Kernel.hpp | 0 ...ecomposition_Jacobi_Conjugation_Kernel.hpp | 0 ...alue_Decomposition_Kernel_Declarations.hpp | 0 ...r_Value_Decomposition_Main_Kernel_Body.hpp | 0 .../Singular_Value_Decomposition_Preamble.hpp | 0 src/{ => libigl}/igl/SolverStatus.h | 0 src/{ => libigl}/igl/SortableRow.h | 0 src/{ => libigl}/igl/Timer.h | 0 src/{ => libigl}/igl/Viewport.h | 0 src/{ => libigl}/igl/WindingNumberAABB.h | 0 src/{ => libigl}/igl/WindingNumberMethod.h | 0 src/{ => libigl}/igl/WindingNumberTree.h | 0 src/{ => libigl}/igl/ZERO.h | 0 src/{ => libigl}/igl/active_set.cpp | 0 src/{ => libigl}/igl/active_set.h | 0 src/{ => libigl}/igl/adjacency_list.cpp | 0 src/{ => libigl}/igl/adjacency_list.h | 0 src/{ => libigl}/igl/adjacency_matrix.cpp | 0 src/{ => libigl}/igl/adjacency_matrix.h | 0 src/{ => libigl}/igl/all.cpp | 0 src/{ => libigl}/igl/all.h | 0 src/{ => libigl}/igl/all_edges.cpp | 0 src/{ => libigl}/igl/all_edges.h | 0 src/{ => libigl}/igl/all_pairs_distances.cpp | 0 src/{ => libigl}/igl/all_pairs_distances.h | 0 src/{ => libigl}/igl/ambient_occlusion.cpp | 0 src/{ => libigl}/igl/ambient_occlusion.h | 0 src/{ => libigl}/igl/angular_distance.cpp | 0 src/{ => libigl}/igl/angular_distance.h | 0 .../igl/anttweakbar/ReAntTweakBar.cpp | 0 .../igl/anttweakbar/ReAntTweakBar.h | 0 .../cocoa_key_to_anttweakbar_key.cpp | 0 .../cocoa_key_to_anttweakbar_key.h | 0 src/{ => libigl}/igl/any.cpp | 0 src/{ => libigl}/igl/any.h | 0 src/{ => libigl}/igl/any_of.cpp | 0 src/{ => libigl}/igl/any_of.h | 0 src/{ => libigl}/igl/arap.cpp | 0 src/{ => libigl}/igl/arap.h | 0 src/{ => libigl}/igl/arap_dof.cpp | 0 src/{ => libigl}/igl/arap_dof.h | 0 src/{ => libigl}/igl/arap_linear_block.cpp | 0 src/{ => libigl}/igl/arap_linear_block.h | 0 src/{ => libigl}/igl/arap_rhs.cpp | 0 src/{ => libigl}/igl/arap_rhs.h | 0 src/{ => libigl}/igl/average_onto_faces.cpp | 0 src/{ => libigl}/igl/average_onto_faces.h | 0 .../igl/average_onto_vertices.cpp | 0 src/{ => libigl}/igl/average_onto_vertices.h | 0 src/{ => libigl}/igl/avg_edge_length.cpp | 0 src/{ => libigl}/igl/avg_edge_length.h | 0 src/{ => libigl}/igl/axis_angle_to_quat.cpp | 0 src/{ => libigl}/igl/axis_angle_to_quat.h | 0 src/{ => libigl}/igl/barycenter.cpp | 0 src/{ => libigl}/igl/barycenter.h | 0 .../igl/barycentric_coordinates.cpp | 0 .../igl/barycentric_coordinates.h | 0 .../igl/barycentric_to_global.cpp | 0 src/{ => libigl}/igl/barycentric_to_global.h | 0 src/{ => libigl}/igl/basename.cpp | 0 src/{ => libigl}/igl/basename.h | 0 src/{ => libigl}/igl/bbw.cpp | 0 src/{ => libigl}/igl/bbw.h | 0 src/{ => libigl}/igl/bfs.cpp | 0 src/{ => libigl}/igl/bfs.h | 0 src/{ => libigl}/igl/bfs_orient.cpp | 0 src/{ => libigl}/igl/bfs_orient.h | 0 .../igl/biharmonic_coordinates.cpp | 0 src/{ => libigl}/igl/biharmonic_coordinates.h | 0 .../bijective_composite_harmonic_mapping.cpp | 0 .../bijective_composite_harmonic_mapping.h | 0 src/{ => libigl}/igl/bone_parents.cpp | 0 src/{ => libigl}/igl/bone_parents.h | 0 src/{ => libigl}/igl/boundary_conditions.cpp | 0 src/{ => libigl}/igl/boundary_conditions.h | 0 src/{ => libigl}/igl/boundary_facets.cpp | 0 src/{ => libigl}/igl/boundary_facets.h | 0 src/{ => libigl}/igl/boundary_loop.cpp | 0 src/{ => libigl}/igl/boundary_loop.h | 0 src/{ => libigl}/igl/bounding_box.cpp | 0 src/{ => libigl}/igl/bounding_box.h | 0 .../igl/bounding_box_diagonal.cpp | 0 src/{ => libigl}/igl/bounding_box_diagonal.h | 0 .../igl/canonical_quaternions.cpp | 0 src/{ => libigl}/igl/canonical_quaternions.h | 0 src/{ => libigl}/igl/cat.cpp | 0 src/{ => libigl}/igl/cat.h | 0 src/{ => libigl}/igl/ceil.cpp | 0 src/{ => libigl}/igl/ceil.h | 0 src/{ => libigl}/igl/centroid.cpp | 0 src/{ => libigl}/igl/centroid.h | 0 src/{ => libigl}/igl/circulation.cpp | 0 src/{ => libigl}/igl/circulation.h | 0 src/{ => libigl}/igl/circumradius.cpp | 0 src/{ => libigl}/igl/circumradius.h | 0 src/{ => libigl}/igl/collapse_edge.cpp | 0 src/{ => libigl}/igl/collapse_edge.h | 0 .../igl/collapse_small_triangles.cpp | 0 .../igl/collapse_small_triangles.h | 0 src/{ => libigl}/igl/colon.cpp | 0 src/{ => libigl}/igl/colon.h | 0 src/{ => libigl}/igl/colormap.cpp | 0 src/{ => libigl}/igl/colormap.h | 0 src/{ => libigl}/igl/column_to_quats.cpp | 0 src/{ => libigl}/igl/column_to_quats.h | 0 src/{ => libigl}/igl/columnize.cpp | 0 src/{ => libigl}/igl/columnize.h | 0 src/{ => libigl}/igl/comb_cross_field.cpp | 0 src/{ => libigl}/igl/comb_cross_field.h | 0 src/{ => libigl}/igl/comb_frame_field.cpp | 0 src/{ => libigl}/igl/comb_frame_field.h | 0 src/{ => libigl}/igl/comb_line_field.cpp | 0 src/{ => libigl}/igl/comb_line_field.h | 0 src/{ => libigl}/igl/combine.cpp | 0 src/{ => libigl}/igl/combine.h | 0 src/{ => libigl}/igl/components.cpp | 0 src/{ => libigl}/igl/components.h | 0 .../igl/compute_frame_field_bisectors.cpp | 0 .../igl/compute_frame_field_bisectors.h | 0 .../igl/connect_boundary_to_infinity.cpp | 0 .../igl/connect_boundary_to_infinity.h | 0 src/{ => libigl}/igl/copyleft/README.md | 0 .../cgal/BinaryWindingNumberOperations.h | 0 .../igl/copyleft/cgal/CGAL_includes.hpp | 0 src/{ => libigl}/igl/copyleft/cgal/CSGTree.h | 0 .../cgal/RemeshSelfIntersectionsParam.h | 0 .../igl/copyleft/cgal/SelfIntersectMesh.h | 0 src/{ => libigl}/igl/copyleft/cgal/assign.cpp | 0 src/{ => libigl}/igl/copyleft/cgal/assign.h | 0 .../igl/copyleft/cgal/assign_scalar.cpp | 0 .../igl/copyleft/cgal/assign_scalar.h | 0 .../igl/copyleft/cgal/barycenter.cpp | 0 .../igl/copyleft/cgal/cell_adjacency.cpp | 0 .../igl/copyleft/cgal/cell_adjacency.h | 0 .../igl/copyleft/cgal/closest_facet.cpp | 0 .../igl/copyleft/cgal/closest_facet.h | 0 .../igl/copyleft/cgal/complex_to_mesh.cpp | 0 .../igl/copyleft/cgal/complex_to_mesh.h | 0 .../cgal/component_inside_component.cpp | 0 .../cgal/component_inside_component.h | 0 .../igl/copyleft/cgal/convex_hull.cpp | 0 .../igl/copyleft/cgal/convex_hull.h | 0 .../copyleft/cgal/delaunay_triangulation.cpp | 0 .../copyleft/cgal/delaunay_triangulation.h | 0 .../igl/copyleft/cgal/extract_cells.cpp | 0 .../igl/copyleft/cgal/extract_cells.h | 0 .../igl/copyleft/cgal/extract_feature.cpp | 0 .../igl/copyleft/cgal/extract_feature.h | 0 .../igl/copyleft/cgal/fast_winding_number.cpp | 0 .../igl/copyleft/cgal/fast_winding_number.h | 0 .../igl/copyleft/cgal/half_space_box.cpp | 0 .../igl/copyleft/cgal/half_space_box.h | 0 .../igl/copyleft/cgal/hausdorff.cpp | 0 .../igl/copyleft/cgal/hausdorff.h | 0 .../igl/copyleft/cgal/incircle.cpp | 0 src/{ => libigl}/igl/copyleft/cgal/incircle.h | 0 .../igl/copyleft/cgal/insert_into_cdt.cpp | 0 .../igl/copyleft/cgal/insert_into_cdt.h | 0 .../igl/copyleft/cgal/insphere.cpp | 0 src/{ => libigl}/igl/copyleft/cgal/insphere.h | 0 .../igl/copyleft/cgal/intersect_other.cpp | 0 .../igl/copyleft/cgal/intersect_other.h | 0 .../cgal/intersect_with_half_space.cpp | 0 .../copyleft/cgal/intersect_with_half_space.h | 0 .../cgal/lexicographic_triangulation.cpp | 0 .../cgal/lexicographic_triangulation.h | 0 .../igl/copyleft/cgal/list_to_matrix.cpp | 0 .../igl/copyleft/cgal/mesh_boolean.cpp | 0 .../igl/copyleft/cgal/mesh_boolean.h | 0 .../cgal/mesh_boolean_type_to_funcs.cpp | 0 .../cgal/mesh_boolean_type_to_funcs.h | 0 .../cgal/mesh_to_cgal_triangle_list.cpp | 0 .../cgal/mesh_to_cgal_triangle_list.h | 0 .../igl/copyleft/cgal/mesh_to_polyhedron.cpp | 0 .../igl/copyleft/cgal/mesh_to_polyhedron.h | 0 .../igl/copyleft/cgal/minkowski_sum.cpp | 0 .../igl/copyleft/cgal/minkowski_sum.h | 0 .../cgal/order_facets_around_edge.cpp | 0 .../copyleft/cgal/order_facets_around_edge.h | 0 .../cgal/order_facets_around_edges.cpp | 0 .../copyleft/cgal/order_facets_around_edges.h | 0 .../igl/copyleft/cgal/orient2D.cpp | 0 src/{ => libigl}/igl/copyleft/cgal/orient2D.h | 0 .../igl/copyleft/cgal/orient3D.cpp | 0 src/{ => libigl}/igl/copyleft/cgal/orient3D.h | 0 .../igl/copyleft/cgal/outer_element.cpp | 0 .../igl/copyleft/cgal/outer_element.h | 0 .../igl/copyleft/cgal/outer_facet.cpp | 0 .../igl/copyleft/cgal/outer_facet.h | 0 .../igl/copyleft/cgal/outer_hull.cpp | 0 .../igl/copyleft/cgal/outer_hull.h | 0 .../copyleft/cgal/peel_outer_hull_layers.cpp | 0 .../copyleft/cgal/peel_outer_hull_layers.h | 0 .../cgal/peel_winding_number_layers.cpp | 0 .../cgal/peel_winding_number_layers.h | 0 .../piecewise_constant_winding_number.cpp | 0 .../cgal/piecewise_constant_winding_number.h | 0 .../igl/copyleft/cgal/point_areas.cpp | 0 .../igl/copyleft/cgal/point_areas.h | 0 .../cgal/point_mesh_squared_distance.cpp | 0 .../cgal/point_mesh_squared_distance.h | 0 .../cgal/point_segment_squared_distance.cpp | 0 .../cgal/point_segment_squared_distance.h | 0 .../point_solid_signed_squared_distance.cpp | 0 .../point_solid_signed_squared_distance.h | 0 .../cgal/point_triangle_squared_distance.cpp | 0 .../cgal/point_triangle_squared_distance.h | 0 .../copyleft/cgal/points_inside_component.cpp | 0 .../copyleft/cgal/points_inside_component.h | 0 .../igl/copyleft/cgal/polyhedron_to_mesh.cpp | 0 .../igl/copyleft/cgal/polyhedron_to_mesh.h | 0 .../igl/copyleft/cgal/projected_cdt.cpp | 0 .../igl/copyleft/cgal/projected_cdt.h | 0 .../igl/copyleft/cgal/projected_delaunay.cpp | 0 .../igl/copyleft/cgal/projected_delaunay.h | 0 .../cgal/propagate_winding_numbers.cpp | 0 .../copyleft/cgal/propagate_winding_numbers.h | 0 .../igl/copyleft/cgal/read_triangle_mesh.cpp | 0 .../igl/copyleft/cgal/read_triangle_mesh.h | 0 .../cgal/relabel_small_immersed_cells.cpp | 0 .../cgal/relabel_small_immersed_cells.h | 0 .../copyleft/cgal/remesh_intersections.cpp | 0 .../igl/copyleft/cgal/remesh_intersections.h | 0 .../cgal/remesh_self_intersections.cpp | 0 .../copyleft/cgal/remesh_self_intersections.h | 0 .../igl/copyleft/cgal/remove_unreferenced.cpp | 0 .../copyleft/cgal/resolve_intersections.cpp | 0 .../igl/copyleft/cgal/resolve_intersections.h | 0 .../igl/copyleft/cgal/row_to_point.cpp | 0 .../igl/copyleft/cgal/row_to_point.h | 0 .../cgal/segment_segment_squared_distance.cpp | 0 .../cgal/segment_segment_squared_distance.h | 0 .../cgal/signed_distance_isosurface.cpp | 0 .../cgal/signed_distance_isosurface.h | 0 src/{ => libigl}/igl/copyleft/cgal/slice.cpp | 0 .../igl/copyleft/cgal/slice_mask.cpp | 0 .../igl/copyleft/cgal/snap_rounding.cpp | 0 .../igl/copyleft/cgal/snap_rounding.h | 0 .../cgal/string_to_mesh_boolean_type.cpp | 0 .../cgal/string_to_mesh_boolean_type.h | 0 .../igl/copyleft/cgal/subdivide_segments.cpp | 0 .../igl/copyleft/cgal/subdivide_segments.h | 0 .../igl/copyleft/cgal/submesh_aabb_tree.cpp | 0 .../igl/copyleft/cgal/submesh_aabb_tree.h | 0 .../triangle_triangle_squared_distance.cpp | 0 .../cgal/triangle_triangle_squared_distance.h | 0 .../igl/copyleft/cgal/trim_with_solid.cpp | 0 .../igl/copyleft/cgal/trim_with_solid.h | 0 src/{ => libigl}/igl/copyleft/cgal/unique.cpp | 0 .../igl/copyleft/cgal/unique_rows.cpp | 0 .../igl/copyleft/cgal/wire_mesh.cpp | 0 .../igl/copyleft/cgal/wire_mesh.h | 0 .../igl/copyleft/comiso/frame_field.cpp | 0 .../igl/copyleft/comiso/frame_field.h | 0 src/{ => libigl}/igl/copyleft/comiso/miq.cpp | 0 src/{ => libigl}/igl/copyleft/comiso/miq.h | 0 .../igl/copyleft/comiso/nrosy.cpp | 0 src/{ => libigl}/igl/copyleft/comiso/nrosy.h | 0 .../igl/copyleft/cork/from_cork_mesh.cpp | 0 .../igl/copyleft/cork/from_cork_mesh.h | 0 .../igl/copyleft/cork/mesh_boolean.cpp | 0 .../igl/copyleft/cork/mesh_boolean.h | 0 .../igl/copyleft/cork/to_cork_mesh.cpp | 0 .../igl/copyleft/cork/to_cork_mesh.h | 0 .../igl/copyleft/marching_cubes.cpp | 0 .../igl/copyleft/marching_cubes.h | 0 .../igl/copyleft/marching_cubes_tables.h | 0 .../igl/copyleft/offset_surface.cpp | 0 .../igl/copyleft/offset_surface.h | 0 .../igl/copyleft/opengl2/render_to_tga.cpp | 0 .../igl/copyleft/opengl2/render_to_tga.h | 0 .../igl/copyleft/opengl2/texture_from_tga.cpp | 0 .../igl/copyleft/opengl2/texture_from_tga.h | 0 src/{ => libigl}/igl/copyleft/opengl2/tga.cpp | 0 src/{ => libigl}/igl/copyleft/opengl2/tga.h | 0 .../igl/copyleft/progressive_hulls.cpp | 0 .../igl/copyleft/progressive_hulls.h | 0 .../progressive_hulls_cost_and_placement.cpp | 0 .../progressive_hulls_cost_and_placement.h | 0 src/{ => libigl}/igl/copyleft/quadprog.cpp | 0 src/{ => libigl}/igl/copyleft/quadprog.h | 0 .../igl/copyleft/swept_volume.cpp | 0 src/{ => libigl}/igl/copyleft/swept_volume.h | 0 src/{ => libigl}/igl/copyleft/tetgen/README | 0 src/{ => libigl}/igl/copyleft/tetgen/cdt.cpp | 0 src/{ => libigl}/igl/copyleft/tetgen/cdt.h | 0 .../igl/copyleft/tetgen/mesh_to_tetgenio.cpp | 0 .../igl/copyleft/tetgen/mesh_to_tetgenio.h | 0 .../copyleft/tetgen/mesh_with_skeleton.cpp | 0 .../igl/copyleft/tetgen/mesh_with_skeleton.h | 0 .../copyleft/tetgen/read_into_tetgenio.cpp | 0 .../igl/copyleft/tetgen/read_into_tetgenio.h | 0 .../copyleft/tetgen/tetgenio_to_tetmesh.cpp | 0 .../igl/copyleft/tetgen/tetgenio_to_tetmesh.h | 0 .../igl/copyleft/tetgen/tetrahedralize.cpp | 0 .../igl/copyleft/tetgen/tetrahedralize.h | 0 src/{ => libigl}/igl/cotmatrix.cpp | 0 src/{ => libigl}/igl/cotmatrix.h | 0 src/{ => libigl}/igl/cotmatrix_entries.cpp | 0 src/{ => libigl}/igl/cotmatrix_entries.h | 0 src/{ => libigl}/igl/count.cpp | 0 src/{ => libigl}/igl/count.h | 0 .../igl/covariance_scatter_matrix.cpp | 0 .../igl/covariance_scatter_matrix.h | 0 src/{ => libigl}/igl/cross.cpp | 0 src/{ => libigl}/igl/cross.h | 0 .../igl/cross_field_missmatch.cpp | 0 src/{ => libigl}/igl/cross_field_missmatch.h | 0 .../igl/crouzeix_raviart_cotmatrix.cpp | 0 .../igl/crouzeix_raviart_cotmatrix.h | 0 .../igl/crouzeix_raviart_massmatrix.cpp | 0 .../igl/crouzeix_raviart_massmatrix.h | 0 src/{ => libigl}/igl/cumsum.cpp | 0 src/{ => libigl}/igl/cumsum.h | 0 src/{ => libigl}/igl/cut_mesh.cpp | 0 src/{ => libigl}/igl/cut_mesh.h | 0 .../igl/cut_mesh_from_singularities.cpp | 0 .../igl/cut_mesh_from_singularities.h | 0 src/{ => libigl}/igl/cylinder.cpp | 0 src/{ => libigl}/igl/cylinder.h | 0 src/{ => libigl}/igl/dated_copy.cpp | 0 src/{ => libigl}/igl/dated_copy.h | 0 src/{ => libigl}/igl/decimate.cpp | 0 src/{ => libigl}/igl/decimate.h | 0 src/{ => libigl}/igl/deform_skeleton.cpp | 0 src/{ => libigl}/igl/deform_skeleton.h | 0 .../igl/delaunay_triangulation.cpp | 0 src/{ => libigl}/igl/delaunay_triangulation.h | 0 src/{ => libigl}/igl/deprecated.h | 0 src/{ => libigl}/igl/dfs.cpp | 0 src/{ => libigl}/igl/dfs.h | 0 src/{ => libigl}/igl/diag.cpp | 0 src/{ => libigl}/igl/diag.h | 0 src/{ => libigl}/igl/dihedral_angles.cpp | 0 src/{ => libigl}/igl/dihedral_angles.h | 0 src/{ => libigl}/igl/dijkstra.cpp | 0 src/{ => libigl}/igl/dijkstra.h | 0 .../igl/directed_edge_orientations.cpp | 0 .../igl/directed_edge_orientations.h | 0 .../igl/directed_edge_parents.cpp | 0 src/{ => libigl}/igl/directed_edge_parents.h | 0 src/{ => libigl}/igl/dirname.cpp | 0 src/{ => libigl}/igl/dirname.h | 0 src/{ => libigl}/igl/dot.cpp | 0 src/{ => libigl}/igl/dot.h | 0 src/{ => libigl}/igl/dot_row.cpp | 0 src/{ => libigl}/igl/dot_row.h | 0 src/{ => libigl}/igl/doublearea.cpp | 0 src/{ => libigl}/igl/doublearea.h | 0 src/{ => libigl}/igl/dqs.cpp | 0 src/{ => libigl}/igl/dqs.h | 0 src/{ => libigl}/igl/ears.cpp | 0 src/{ => libigl}/igl/ears.h | 0 .../igl/edge_collapse_is_valid.cpp | 0 src/{ => libigl}/igl/edge_collapse_is_valid.h | 0 src/{ => libigl}/igl/edge_flaps.cpp | 0 src/{ => libigl}/igl/edge_flaps.h | 0 src/{ => libigl}/igl/edge_lengths.cpp | 0 src/{ => libigl}/igl/edge_lengths.h | 0 src/{ => libigl}/igl/edge_topology.cpp | 0 src/{ => libigl}/igl/edge_topology.h | 0 src/{ => libigl}/igl/edges.cpp | 0 src/{ => libigl}/igl/edges.h | 0 src/{ => libigl}/igl/edges_to_path.cpp | 0 src/{ => libigl}/igl/edges_to_path.h | 0 src/{ => libigl}/igl/eigs.cpp | 0 src/{ => libigl}/igl/eigs.h | 0 .../igl/embree/EmbreeIntersector.h | 0 .../igl/embree/Embree_convenience.h | 0 .../igl/embree/ambient_occlusion.cpp | 0 .../igl/embree/ambient_occlusion.h | 0 src/{ => libigl}/igl/embree/bone_heat.cpp | 0 src/{ => libigl}/igl/embree/bone_heat.h | 0 src/{ => libigl}/igl/embree/bone_visible.cpp | 0 src/{ => libigl}/igl/embree/bone_visible.h | 0 src/{ => libigl}/igl/embree/embree2/rtcore.h | 0 .../igl/embree/embree2/rtcore.isph | 0 .../igl/embree/embree2/rtcore_geometry.h | 0 .../igl/embree/embree2/rtcore_geometry.isph | 0 .../igl/embree/embree2/rtcore_geometry_user.h | 0 .../embree/embree2/rtcore_geometry_user.isph | 0 .../igl/embree/embree2/rtcore_ray.h | 0 .../igl/embree/embree2/rtcore_ray.isph | 0 .../igl/embree/embree2/rtcore_scene.h | 0 .../igl/embree/embree2/rtcore_scene.isph | 0 .../igl/embree/line_mesh_intersection.cpp | 0 .../igl/embree/line_mesh_intersection.h | 0 .../igl/embree/reorient_facets_raycast.cpp | 0 .../igl/embree/reorient_facets_raycast.h | 0 .../igl/embree/shape_diameter_function.cpp | 0 .../igl/embree/shape_diameter_function.h | 0 .../igl/embree/unproject_in_mesh.cpp | 0 .../igl/embree/unproject_in_mesh.h | 0 .../igl/embree/unproject_onto_mesh.cpp | 0 .../igl/embree/unproject_onto_mesh.h | 0 src/{ => libigl}/igl/euler_characteristic.cpp | 0 src/{ => libigl}/igl/euler_characteristic.h | 0 src/{ => libigl}/igl/exact_geodesic.cpp | 0 src/{ => libigl}/igl/exact_geodesic.h | 0 src/{ => libigl}/igl/example_fun.cpp | 0 src/{ => libigl}/igl/example_fun.h | 0 src/{ => libigl}/igl/exterior_edges.cpp | 0 src/{ => libigl}/igl/exterior_edges.h | 0 .../igl/extract_manifold_patches.cpp | 0 .../igl/extract_manifold_patches.h | 0 .../igl/extract_non_manifold_edge_curves.cpp | 0 .../igl/extract_non_manifold_edge_curves.h | 0 src/{ => libigl}/igl/face_areas.cpp | 0 src/{ => libigl}/igl/face_areas.h | 0 src/{ => libigl}/igl/face_occurrences.cpp | 0 src/{ => libigl}/igl/face_occurrences.h | 0 src/{ => libigl}/igl/faces_first.cpp | 0 src/{ => libigl}/igl/faces_first.h | 0 src/{ => libigl}/igl/facet_components.cpp | 0 src/{ => libigl}/igl/facet_components.h | 0 .../igl/false_barycentric_subdivision.cpp | 0 .../igl/false_barycentric_subdivision.h | 0 src/{ => libigl}/igl/fast_winding_number.cpp | 0 src/{ => libigl}/igl/fast_winding_number.h | 0 .../igl/file_contents_as_string.cpp | 0 .../igl/file_contents_as_string.h | 0 src/{ => libigl}/igl/file_dialog_open.cpp | 0 src/{ => libigl}/igl/file_dialog_open.h | 0 src/{ => libigl}/igl/file_dialog_save.cpp | 0 src/{ => libigl}/igl/file_dialog_save.h | 0 src/{ => libigl}/igl/file_exists.cpp | 0 src/{ => libigl}/igl/file_exists.h | 0 src/{ => libigl}/igl/find.cpp | 0 src/{ => libigl}/igl/find.h | 0 .../igl/find_cross_field_singularities.cpp | 0 .../igl/find_cross_field_singularities.h | 0 src/{ => libigl}/igl/find_zero.cpp | 0 src/{ => libigl}/igl/find_zero.h | 0 src/{ => libigl}/igl/fit_plane.cpp | 0 src/{ => libigl}/igl/fit_plane.h | 0 src/{ => libigl}/igl/fit_rotations.cpp | 0 src/{ => libigl}/igl/fit_rotations.h | 0 .../igl/flip_avoiding_line_search.cpp | 0 .../igl/flip_avoiding_line_search.h | 0 src/{ => libigl}/igl/flip_edge.cpp | 0 src/{ => libigl}/igl/flip_edge.h | 0 src/{ => libigl}/igl/flipped_triangles.cpp | 0 src/{ => libigl}/igl/flipped_triangles.h | 0 src/{ => libigl}/igl/flood_fill.cpp | 0 src/{ => libigl}/igl/flood_fill.h | 0 src/{ => libigl}/igl/floor.cpp | 0 src/{ => libigl}/igl/floor.h | 0 src/{ => libigl}/igl/for_each.h | 0 src/{ => libigl}/igl/forward_kinematics.cpp | 0 src/{ => libigl}/igl/forward_kinematics.h | 0 src/{ => libigl}/igl/frame_field_deformer.cpp | 0 src/{ => libigl}/igl/frame_field_deformer.h | 0 src/{ => libigl}/igl/frame_to_cross_field.cpp | 0 src/{ => libigl}/igl/frame_to_cross_field.h | 0 src/{ => libigl}/igl/frustum.cpp | 0 src/{ => libigl}/igl/frustum.h | 0 src/{ => libigl}/igl/gaussian_curvature.cpp | 0 src/{ => libigl}/igl/gaussian_curvature.h | 0 src/{ => libigl}/igl/get_seconds.cpp | 0 src/{ => libigl}/igl/get_seconds.h | 0 src/{ => libigl}/igl/get_seconds_hires.cpp | 0 src/{ => libigl}/igl/get_seconds_hires.h | 0 src/{ => libigl}/igl/grad.cpp | 0 src/{ => libigl}/igl/grad.h | 0 src/{ => libigl}/igl/grid.cpp | 0 src/{ => libigl}/igl/grid.h | 0 src/{ => libigl}/igl/grid_search.cpp | 0 src/{ => libigl}/igl/grid_search.h | 0 src/{ => libigl}/igl/group_sum_matrix.cpp | 0 src/{ => libigl}/igl/group_sum_matrix.h | 0 src/{ => libigl}/igl/guess_extension.cpp | 0 src/{ => libigl}/igl/guess_extension.h | 0 src/{ => libigl}/igl/harmonic.cpp | 0 src/{ => libigl}/igl/harmonic.h | 0 src/{ => libigl}/igl/harwell_boeing.cpp | 0 src/{ => libigl}/igl/harwell_boeing.h | 0 src/{ => libigl}/igl/hausdorff.cpp | 0 src/{ => libigl}/igl/hausdorff.h | 0 src/{ => libigl}/igl/hessian.cpp | 0 src/{ => libigl}/igl/hessian.h | 0 src/{ => libigl}/igl/hessian_energy.cpp | 0 src/{ => libigl}/igl/hessian_energy.h | 0 src/{ => libigl}/igl/histc.cpp | 0 src/{ => libigl}/igl/histc.h | 0 src/{ => libigl}/igl/hsv_to_rgb.cpp | 0 src/{ => libigl}/igl/hsv_to_rgb.h | 0 src/{ => libigl}/igl/igl_inline.h | 0 src/{ => libigl}/igl/in_element.cpp | 0 src/{ => libigl}/igl/in_element.h | 0 .../igl/infinite_cost_stopping_condition.cpp | 0 .../igl/infinite_cost_stopping_condition.h | 0 src/{ => libigl}/igl/inradius.cpp | 0 src/{ => libigl}/igl/inradius.h | 0 src/{ => libigl}/igl/internal_angles.cpp | 0 src/{ => libigl}/igl/internal_angles.h | 0 src/{ => libigl}/igl/intersect.cpp | 0 src/{ => libigl}/igl/intersect.h | 0 src/{ => libigl}/igl/invert_diag.cpp | 0 src/{ => libigl}/igl/invert_diag.h | 0 src/{ => libigl}/igl/is_border_vertex.cpp | 0 src/{ => libigl}/igl/is_border_vertex.h | 0 src/{ => libigl}/igl/is_boundary_edge.cpp | 0 src/{ => libigl}/igl/is_boundary_edge.h | 0 src/{ => libigl}/igl/is_dir.cpp | 0 src/{ => libigl}/igl/is_dir.h | 0 src/{ => libigl}/igl/is_edge_manifold.cpp | 0 src/{ => libigl}/igl/is_edge_manifold.h | 0 src/{ => libigl}/igl/is_file.cpp | 0 src/{ => libigl}/igl/is_file.h | 0 src/{ => libigl}/igl/is_irregular_vertex.cpp | 0 src/{ => libigl}/igl/is_irregular_vertex.h | 0 src/{ => libigl}/igl/is_planar.cpp | 0 src/{ => libigl}/igl/is_planar.h | 0 src/{ => libigl}/igl/is_readable.cpp | 0 src/{ => libigl}/igl/is_readable.h | 0 src/{ => libigl}/igl/is_sparse.cpp | 0 src/{ => libigl}/igl/is_sparse.h | 0 src/{ => libigl}/igl/is_stl.cpp | 0 src/{ => libigl}/igl/is_stl.h | 0 src/{ => libigl}/igl/is_symmetric.cpp | 0 src/{ => libigl}/igl/is_symmetric.h | 0 src/{ => libigl}/igl/is_vertex_manifold.cpp | 0 src/{ => libigl}/igl/is_vertex_manifold.h | 0 src/{ => libigl}/igl/is_writable.cpp | 0 src/{ => libigl}/igl/is_writable.h | 0 src/{ => libigl}/igl/isdiag.cpp | 0 src/{ => libigl}/igl/isdiag.h | 0 src/{ => libigl}/igl/ismember.cpp | 0 src/{ => libigl}/igl/ismember.h | 0 src/{ => libigl}/igl/isolines.cpp | 0 src/{ => libigl}/igl/isolines.h | 0 src/{ => libigl}/igl/jet.cpp | 0 src/{ => libigl}/igl/jet.h | 0 src/{ => libigl}/igl/knn.cpp | 0 src/{ => libigl}/igl/knn.h | 0 src/{ => libigl}/igl/launch_medit.cpp | 0 src/{ => libigl}/igl/launch_medit.h | 0 src/{ => libigl}/igl/lbs_matrix.cpp | 0 src/{ => libigl}/igl/lbs_matrix.h | 0 .../igl/lexicographic_triangulation.cpp | 0 .../igl/lexicographic_triangulation.h | 0 src/{ => libigl}/igl/lim/lim.cpp | 0 src/{ => libigl}/igl/lim/lim.h | 0 src/{ => libigl}/igl/limit_faces.cpp | 0 src/{ => libigl}/igl/limit_faces.h | 0 src/{ => libigl}/igl/line_field_missmatch.cpp | 0 src/{ => libigl}/igl/line_field_missmatch.h | 0 src/{ => libigl}/igl/line_search.cpp | 0 src/{ => libigl}/igl/line_search.h | 0 .../igl/line_segment_in_rectangle.cpp | 0 .../igl/line_segment_in_rectangle.h | 0 src/{ => libigl}/igl/linprog.cpp | 0 src/{ => libigl}/igl/linprog.h | 0 src/{ => libigl}/igl/list_to_matrix.cpp | 0 src/{ => libigl}/igl/list_to_matrix.h | 0 src/{ => libigl}/igl/local_basis.cpp | 0 src/{ => libigl}/igl/local_basis.h | 0 src/{ => libigl}/igl/look_at.cpp | 0 src/{ => libigl}/igl/look_at.h | 0 src/{ => libigl}/igl/loop.cpp | 0 src/{ => libigl}/igl/loop.h | 0 src/{ => libigl}/igl/lscm.cpp | 0 src/{ => libigl}/igl/lscm.h | 0 .../igl/map_vertices_to_circle.cpp | 0 src/{ => libigl}/igl/map_vertices_to_circle.h | 0 src/{ => libigl}/igl/massmatrix.cpp | 0 src/{ => libigl}/igl/massmatrix.h | 0 src/{ => libigl}/igl/mat_max.cpp | 0 src/{ => libigl}/igl/mat_max.h | 0 src/{ => libigl}/igl/mat_min.cpp | 0 src/{ => libigl}/igl/mat_min.h | 0 src/{ => libigl}/igl/mat_to_quat.cpp | 0 src/{ => libigl}/igl/mat_to_quat.h | 0 src/{ => libigl}/igl/material_colors.h | 0 src/{ => libigl}/igl/matlab/MatlabWorkspace.h | 0 src/{ => libigl}/igl/matlab/MexStream.h | 0 .../igl/matlab/matlabinterface.cpp | 0 src/{ => libigl}/igl/matlab/matlabinterface.h | 0 src/{ => libigl}/igl/matlab/mexErrMsgTxt.cpp | 0 src/{ => libigl}/igl/matlab/mexErrMsgTxt.h | 0 src/{ => libigl}/igl/matlab/parse_rhs.cpp | 0 src/{ => libigl}/igl/matlab/parse_rhs.h | 0 src/{ => libigl}/igl/matlab/prepare_lhs.cpp | 0 src/{ => libigl}/igl/matlab/prepare_lhs.h | 0 src/{ => libigl}/igl/matlab/requires_arg.cpp | 0 src/{ => libigl}/igl/matlab/requires_arg.h | 0 src/{ => libigl}/igl/matlab/validate_arg.cpp | 0 src/{ => libigl}/igl/matlab/validate_arg.h | 0 src/{ => libigl}/igl/matlab_format.cpp | 0 src/{ => libigl}/igl/matlab_format.h | 0 src/{ => libigl}/igl/matrix_to_list.cpp | 0 src/{ => libigl}/igl/matrix_to_list.h | 0 src/{ => libigl}/igl/max.cpp | 0 src/{ => libigl}/igl/max.h | 0 .../igl/max_faces_stopping_condition.cpp | 0 .../igl/max_faces_stopping_condition.h | 0 src/{ => libigl}/igl/max_size.cpp | 0 src/{ => libigl}/igl/max_size.h | 0 src/{ => libigl}/igl/median.cpp | 0 src/{ => libigl}/igl/median.h | 0 src/{ => libigl}/igl/min.cpp | 0 src/{ => libigl}/igl/min.h | 0 src/{ => libigl}/igl/min_quad_dense.cpp | 0 src/{ => libigl}/igl/min_quad_dense.h | 0 src/{ => libigl}/igl/min_quad_with_fixed.cpp | 0 src/{ => libigl}/igl/min_quad_with_fixed.h | 0 src/{ => libigl}/igl/min_size.cpp | 0 src/{ => libigl}/igl/min_size.h | 0 src/{ => libigl}/igl/mod.cpp | 0 src/{ => libigl}/igl/mod.h | 0 src/{ => libigl}/igl/mode.cpp | 0 src/{ => libigl}/igl/mode.h | 0 src/{ => libigl}/igl/mosek/bbw.cpp | 0 src/{ => libigl}/igl/mosek/bbw.h | 0 src/{ => libigl}/igl/mosek/mosek_guarded.cpp | 0 src/{ => libigl}/igl/mosek/mosek_guarded.h | 0 src/{ => libigl}/igl/mosek/mosek_linprog.cpp | 0 src/{ => libigl}/igl/mosek/mosek_linprog.h | 0 src/{ => libigl}/igl/mosek/mosek_quadprog.cpp | 0 src/{ => libigl}/igl/mosek/mosek_quadprog.h | 0 src/{ => libigl}/igl/mvc.cpp | 0 src/{ => libigl}/igl/mvc.h | 0 src/{ => libigl}/igl/nchoosek.cpp | 0 src/{ => libigl}/igl/nchoosek.h | 0 src/{ => libigl}/igl/next_filename.cpp | 0 src/{ => libigl}/igl/next_filename.h | 0 src/{ => libigl}/igl/normal_derivative.cpp | 0 src/{ => libigl}/igl/normal_derivative.h | 0 src/{ => libigl}/igl/normalize_quat.cpp | 0 src/{ => libigl}/igl/normalize_quat.h | 0 .../igl/normalize_row_lengths.cpp | 0 src/{ => libigl}/igl/normalize_row_lengths.h | 0 src/{ => libigl}/igl/normalize_row_sums.cpp | 0 src/{ => libigl}/igl/normalize_row_sums.h | 0 src/{ => libigl}/igl/null.cpp | 0 src/{ => libigl}/igl/null.h | 0 src/{ => libigl}/igl/octree.cpp | 0 src/{ => libigl}/igl/octree.h | 0 src/{ => libigl}/igl/on_boundary.cpp | 0 src/{ => libigl}/igl/on_boundary.h | 0 src/{ => libigl}/igl/opengl/MeshGL.cpp | 0 src/{ => libigl}/igl/opengl/MeshGL.h | 0 src/{ => libigl}/igl/opengl/ViewerCore.cpp | 0 src/{ => libigl}/igl/opengl/ViewerCore.h | 0 src/{ => libigl}/igl/opengl/ViewerData.cpp | 0 src/{ => libigl}/igl/opengl/ViewerData.h | 0 .../igl/opengl/bind_vertex_attrib_array.cpp | 0 .../igl/opengl/bind_vertex_attrib_array.h | 0 .../igl/opengl/create_index_vbo.cpp | 0 .../igl/opengl/create_index_vbo.h | 0 .../igl/opengl/create_mesh_vbo.cpp | 0 src/{ => libigl}/igl/opengl/create_mesh_vbo.h | 0 .../igl/opengl/create_shader_program.cpp | 0 .../igl/opengl/create_shader_program.h | 0 .../igl/opengl/create_vector_vbo.cpp | 0 .../igl/opengl/create_vector_vbo.h | 0 .../igl/opengl/destroy_shader_program.cpp | 0 .../igl/opengl/destroy_shader_program.h | 0 src/{ => libigl}/igl/opengl/gl.h | 0 src/{ => libigl}/igl/opengl/gl_type_size.cpp | 0 src/{ => libigl}/igl/opengl/gl_type_size.h | 0 src/{ => libigl}/igl/opengl/glfw/Viewer.cpp | 0 src/{ => libigl}/igl/opengl/glfw/Viewer.h | 0 .../igl/opengl/glfw/ViewerPlugin.h | 0 .../igl/opengl/glfw/background_window.cpp | 0 .../igl/opengl/glfw/background_window.h | 0 .../igl/opengl/glfw/imgui/ImGuiHelpers.h | 0 .../igl/opengl/glfw/imgui/ImGuiMenu.cpp | 0 .../igl/opengl/glfw/imgui/ImGuiMenu.h | 0 .../igl/opengl/glfw/map_texture.cpp | 0 .../igl/opengl/glfw/map_texture.h | 0 .../igl/opengl/init_render_to_texture.cpp | 0 .../igl/opengl/init_render_to_texture.h | 0 src/{ => libigl}/igl/opengl/load_shader.cpp | 0 src/{ => libigl}/igl/opengl/load_shader.h | 0 .../igl/opengl/print_program_info_log.cpp | 0 .../igl/opengl/print_program_info_log.h | 0 .../igl/opengl/print_shader_info_log.cpp | 0 .../igl/opengl/print_shader_info_log.h | 0 .../igl/opengl/report_gl_error.cpp | 0 src/{ => libigl}/igl/opengl/report_gl_error.h | 0 .../igl/opengl/uniform_type_to_string.cpp | 0 .../igl/opengl/uniform_type_to_string.h | 0 src/{ => libigl}/igl/opengl/vertex_array.cpp | 0 src/{ => libigl}/igl/opengl/vertex_array.h | 0 .../igl/opengl2/MouseController.h | 0 src/{ => libigl}/igl/opengl2/RotateWidget.h | 0 .../igl/opengl2/TranslateWidget.h | 0 .../igl/opengl2/draw_beach_ball.cpp | 0 .../igl/opengl2/draw_beach_ball.h | 0 src/{ => libigl}/igl/opengl2/draw_floor.cpp | 0 src/{ => libigl}/igl/opengl2/draw_floor.h | 0 src/{ => libigl}/igl/opengl2/draw_mesh.cpp | 0 src/{ => libigl}/igl/opengl2/draw_mesh.h | 0 src/{ => libigl}/igl/opengl2/draw_point.cpp | 0 src/{ => libigl}/igl/opengl2/draw_point.h | 0 .../igl/opengl2/draw_rectangular_marquee.cpp | 0 .../igl/opengl2/draw_rectangular_marquee.h | 0 .../igl/opengl2/draw_skeleton_3d.cpp | 0 .../igl/opengl2/draw_skeleton_3d.h | 0 .../opengl2/draw_skeleton_vector_graphics.cpp | 0 .../opengl2/draw_skeleton_vector_graphics.h | 0 src/{ => libigl}/igl/opengl2/flare_textures.h | 0 src/{ => libigl}/igl/opengl2/gl.h | 0 src/{ => libigl}/igl/opengl2/glext.h | 0 src/{ => libigl}/igl/opengl2/glu.h | 0 src/{ => libigl}/igl/opengl2/lens_flare.cpp | 0 src/{ => libigl}/igl/opengl2/lens_flare.h | 0 .../igl/opengl2/model_proj_viewport.cpp | 0 .../igl/opengl2/model_proj_viewport.h | 0 src/{ => libigl}/igl/opengl2/print_gl_get.cpp | 0 src/{ => libigl}/igl/opengl2/print_gl_get.h | 0 src/{ => libigl}/igl/opengl2/project.cpp | 0 src/{ => libigl}/igl/opengl2/project.h | 0 src/{ => libigl}/igl/opengl2/right_axis.cpp | 0 src/{ => libigl}/igl/opengl2/right_axis.h | 0 src/{ => libigl}/igl/opengl2/shine_textures.h | 0 .../igl/opengl2/sort_triangles.cpp | 0 src/{ => libigl}/igl/opengl2/sort_triangles.h | 0 src/{ => libigl}/igl/opengl2/unproject.cpp | 0 src/{ => libigl}/igl/opengl2/unproject.h | 0 .../igl/opengl2/unproject_to_zero_plane.cpp | 0 .../igl/opengl2/unproject_to_zero_plane.h | 0 src/{ => libigl}/igl/opengl2/up_axis.cpp | 0 src/{ => libigl}/igl/opengl2/up_axis.h | 0 src/{ => libigl}/igl/opengl2/view_axis.cpp | 0 src/{ => libigl}/igl/opengl2/view_axis.h | 0 src/{ => libigl}/igl/orient_outward.cpp | 0 src/{ => libigl}/igl/orient_outward.h | 0 src/{ => libigl}/igl/orientable_patches.cpp | 0 src/{ => libigl}/igl/orientable_patches.h | 0 src/{ => libigl}/igl/oriented_facets.cpp | 0 src/{ => libigl}/igl/oriented_facets.h | 0 src/{ => libigl}/igl/orth.cpp | 0 src/{ => libigl}/igl/orth.h | 0 src/{ => libigl}/igl/ortho.cpp | 0 src/{ => libigl}/igl/ortho.h | 0 src/{ => libigl}/igl/outer_element.cpp | 0 src/{ => libigl}/igl/outer_element.h | 0 src/{ => libigl}/igl/parallel_for.h | 0 .../igl/parallel_transport_angles.cpp | 0 .../igl/parallel_transport_angles.h | 0 src/{ => libigl}/igl/partition.cpp | 0 src/{ => libigl}/igl/partition.h | 0 src/{ => libigl}/igl/parula.cpp | 0 src/{ => libigl}/igl/parula.h | 0 src/{ => libigl}/igl/path_to_executable.cpp | 0 src/{ => libigl}/igl/path_to_executable.h | 0 src/{ => libigl}/igl/pathinfo.cpp | 0 src/{ => libigl}/igl/pathinfo.h | 0 src/{ => libigl}/igl/per_corner_normals.cpp | 0 src/{ => libigl}/igl/per_corner_normals.h | 0 src/{ => libigl}/igl/per_edge_normals.cpp | 0 src/{ => libigl}/igl/per_edge_normals.h | 0 src/{ => libigl}/igl/per_face_normals.cpp | 0 src/{ => libigl}/igl/per_face_normals.h | 0 .../igl/per_vertex_attribute_smoothing.cpp | 0 .../igl/per_vertex_attribute_smoothing.h | 0 src/{ => libigl}/igl/per_vertex_normals.cpp | 0 src/{ => libigl}/igl/per_vertex_normals.h | 0 .../per_vertex_point_to_plane_quadrics.cpp | 0 .../igl/per_vertex_point_to_plane_quadrics.h | 0 .../igl/piecewise_constant_winding_number.cpp | 0 .../igl/piecewise_constant_winding_number.h | 0 src/{ => libigl}/igl/pinv.cpp | 0 src/{ => libigl}/igl/pinv.h | 0 src/{ => libigl}/igl/planarize_quad_mesh.cpp | 0 src/{ => libigl}/igl/planarize_quad_mesh.h | 0 src/{ => libigl}/igl/ply.h | 0 src/{ => libigl}/igl/png/readPNG.cpp | 0 src/{ => libigl}/igl/png/readPNG.h | 0 src/{ => libigl}/igl/png/render_to_png.cpp | 0 src/{ => libigl}/igl/png/render_to_png.h | 0 .../igl/png/render_to_png_async.cpp | 0 .../igl/png/render_to_png_async.h | 0 .../igl/png/texture_from_file.cpp | 0 src/{ => libigl}/igl/png/texture_from_file.h | 0 src/{ => libigl}/igl/png/texture_from_png.cpp | 0 src/{ => libigl}/igl/png/texture_from_png.h | 0 src/{ => libigl}/igl/png/writePNG.cpp | 0 src/{ => libigl}/igl/png/writePNG.h | 0 src/{ => libigl}/igl/point_in_circle.cpp | 0 src/{ => libigl}/igl/point_in_circle.h | 0 src/{ => libigl}/igl/point_in_poly.cpp | 0 src/{ => libigl}/igl/point_in_poly.h | 0 .../igl/point_mesh_squared_distance.cpp | 0 .../igl/point_mesh_squared_distance.h | 0 .../igl/point_simplex_squared_distance.cpp | 0 .../igl/point_simplex_squared_distance.h | 0 src/{ => libigl}/igl/polar_dec.cpp | 0 src/{ => libigl}/igl/polar_dec.h | 0 src/{ => libigl}/igl/polar_svd.cpp | 0 src/{ => libigl}/igl/polar_svd.h | 0 src/{ => libigl}/igl/polar_svd3x3.cpp | 0 src/{ => libigl}/igl/polar_svd3x3.h | 0 .../igl/polygon_mesh_to_triangle_mesh.cpp | 0 .../igl/polygon_mesh_to_triangle_mesh.h | 0 src/{ => libigl}/igl/principal_curvature.cpp | 0 src/{ => libigl}/igl/principal_curvature.h | 0 src/{ => libigl}/igl/print_ijv.cpp | 0 src/{ => libigl}/igl/print_ijv.h | 0 src/{ => libigl}/igl/print_vector.cpp | 0 src/{ => libigl}/igl/print_vector.h | 0 src/{ => libigl}/igl/procrustes.cpp | 0 src/{ => libigl}/igl/procrustes.h | 0 src/{ => libigl}/igl/project.cpp | 0 src/{ => libigl}/igl/project.h | 0 .../igl/project_isometrically_to_plane.cpp | 0 .../igl/project_isometrically_to_plane.h | 0 src/{ => libigl}/igl/project_to_line.cpp | 0 src/{ => libigl}/igl/project_to_line.h | 0 .../igl/project_to_line_segment.cpp | 0 .../igl/project_to_line_segment.h | 0 src/{ => libigl}/igl/pseudonormal_test.cpp | 0 src/{ => libigl}/igl/pseudonormal_test.h | 0 src/{ => libigl}/igl/pso.cpp | 0 src/{ => libigl}/igl/pso.h | 0 src/{ => libigl}/igl/qslim.cpp | 0 src/{ => libigl}/igl/qslim.h | 0 .../qslim_optimal_collapse_edge_callbacks.cpp | 0 .../qslim_optimal_collapse_edge_callbacks.h | 0 src/{ => libigl}/igl/quad_planarity.cpp | 0 src/{ => libigl}/igl/quad_planarity.h | 0 .../igl/quadric_binary_plus_operator.cpp | 0 .../igl/quadric_binary_plus_operator.h | 0 src/{ => libigl}/igl/quat_conjugate.cpp | 0 src/{ => libigl}/igl/quat_conjugate.h | 0 src/{ => libigl}/igl/quat_mult.cpp | 0 src/{ => libigl}/igl/quat_mult.h | 0 src/{ => libigl}/igl/quat_to_axis_angle.cpp | 0 src/{ => libigl}/igl/quat_to_axis_angle.h | 0 src/{ => libigl}/igl/quat_to_mat.cpp | 0 src/{ => libigl}/igl/quat_to_mat.h | 0 src/{ => libigl}/igl/quats_to_column.cpp | 0 src/{ => libigl}/igl/quats_to_column.h | 0 .../igl/ramer_douglas_peucker.cpp | 0 src/{ => libigl}/igl/ramer_douglas_peucker.h | 0 src/{ => libigl}/igl/random_dir.cpp | 0 src/{ => libigl}/igl/random_dir.h | 0 .../igl/random_points_on_mesh.cpp | 0 src/{ => libigl}/igl/random_points_on_mesh.h | 0 src/{ => libigl}/igl/random_quaternion.cpp | 0 src/{ => libigl}/igl/random_quaternion.h | 0 src/{ => libigl}/igl/random_search.cpp | 0 src/{ => libigl}/igl/random_search.h | 0 src/{ => libigl}/igl/randperm.cpp | 0 src/{ => libigl}/igl/randperm.h | 0 src/{ => libigl}/igl/ray_box_intersect.cpp | 0 src/{ => libigl}/igl/ray_box_intersect.h | 0 src/{ => libigl}/igl/ray_mesh_intersect.cpp | 0 src/{ => libigl}/igl/ray_mesh_intersect.h | 0 src/{ => libigl}/igl/ray_sphere_intersect.cpp | 0 src/{ => libigl}/igl/ray_sphere_intersect.h | 0 src/{ => libigl}/igl/raytri.c | 0 src/{ => libigl}/igl/readBF.cpp | 0 src/{ => libigl}/igl/readBF.h | 0 src/{ => libigl}/igl/readCSV.cpp | 0 src/{ => libigl}/igl/readCSV.h | 0 src/{ => libigl}/igl/readDMAT.cpp | 0 src/{ => libigl}/igl/readDMAT.h | 0 src/{ => libigl}/igl/readMESH.cpp | 0 src/{ => libigl}/igl/readMESH.h | 0 src/{ => libigl}/igl/readMSH.cpp | 0 src/{ => libigl}/igl/readMSH.h | 0 src/{ => libigl}/igl/readNODE.cpp | 0 src/{ => libigl}/igl/readNODE.h | 0 src/{ => libigl}/igl/readOBJ.cpp | 0 src/{ => libigl}/igl/readOBJ.h | 0 src/{ => libigl}/igl/readOFF.cpp | 0 src/{ => libigl}/igl/readOFF.h | 0 src/{ => libigl}/igl/readPLY.cpp | 0 src/{ => libigl}/igl/readPLY.h | 0 src/{ => libigl}/igl/readSTL.cpp | 0 src/{ => libigl}/igl/readSTL.h | 0 src/{ => libigl}/igl/readTGF.cpp | 0 src/{ => libigl}/igl/readTGF.h | 0 src/{ => libigl}/igl/readWRL.cpp | 0 src/{ => libigl}/igl/readWRL.h | 0 src/{ => libigl}/igl/read_triangle_mesh.cpp | 0 src/{ => libigl}/igl/read_triangle_mesh.h | 0 src/{ => libigl}/igl/redux.h | 0 src/{ => libigl}/igl/remesh_along_isoline.cpp | 0 src/{ => libigl}/igl/remesh_along_isoline.h | 0 .../igl/remove_duplicate_vertices.cpp | 0 .../igl/remove_duplicate_vertices.h | 0 src/{ => libigl}/igl/remove_duplicates.cpp | 0 src/{ => libigl}/igl/remove_duplicates.h | 0 src/{ => libigl}/igl/remove_unreferenced.cpp | 0 src/{ => libigl}/igl/remove_unreferenced.h | 0 src/{ => libigl}/igl/reorder.cpp | 0 src/{ => libigl}/igl/reorder.h | 0 src/{ => libigl}/igl/repdiag.cpp | 0 src/{ => libigl}/igl/repdiag.h | 0 src/{ => libigl}/igl/repmat.cpp | 0 src/{ => libigl}/igl/repmat.h | 0 .../igl/resolve_duplicated_faces.cpp | 0 .../igl/resolve_duplicated_faces.h | 0 src/{ => libigl}/igl/rgb_to_hsv.cpp | 0 src/{ => libigl}/igl/rgb_to_hsv.h | 0 src/{ => libigl}/igl/rotate_by_quat.cpp | 0 src/{ => libigl}/igl/rotate_by_quat.h | 0 src/{ => libigl}/igl/rotate_vectors.cpp | 0 src/{ => libigl}/igl/rotate_vectors.h | 0 .../igl/rotation_matrix_from_directions.cpp | 0 .../igl/rotation_matrix_from_directions.h | 0 src/{ => libigl}/igl/round.cpp | 0 src/{ => libigl}/igl/round.h | 0 src/{ => libigl}/igl/rows_to_matrix.cpp | 0 src/{ => libigl}/igl/rows_to_matrix.h | 0 src/{ => libigl}/igl/sample_edges.cpp | 0 src/{ => libigl}/igl/sample_edges.h | 0 src/{ => libigl}/igl/seam_edges.cpp | 0 src/{ => libigl}/igl/seam_edges.h | 0 .../igl/segment_segment_intersect.cpp | 0 .../igl/segment_segment_intersect.h | 0 src/{ => libigl}/igl/serialize.h | 0 src/{ => libigl}/igl/setdiff.cpp | 0 src/{ => libigl}/igl/setdiff.h | 0 src/{ => libigl}/igl/setunion.cpp | 0 src/{ => libigl}/igl/setunion.h | 0 src/{ => libigl}/igl/setxor.cpp | 0 src/{ => libigl}/igl/setxor.h | 0 .../igl/shape_diameter_function.cpp | 0 .../igl/shape_diameter_function.h | 0 src/{ => libigl}/igl/shapeup.cpp | 0 src/{ => libigl}/igl/shapeup.h | 0 .../igl/shortest_edge_and_midpoint.cpp | 0 .../igl/shortest_edge_and_midpoint.h | 0 src/{ => libigl}/igl/signed_angle.cpp | 0 src/{ => libigl}/igl/signed_angle.h | 0 src/{ => libigl}/igl/signed_distance.cpp | 0 src/{ => libigl}/igl/signed_distance.h | 0 src/{ => libigl}/igl/simplify_polyhedron.cpp | 0 src/{ => libigl}/igl/simplify_polyhedron.h | 0 src/{ => libigl}/igl/slice.cpp | 0 src/{ => libigl}/igl/slice.h | 0 src/{ => libigl}/igl/slice_cached.cpp | 0 src/{ => libigl}/igl/slice_cached.h | 0 src/{ => libigl}/igl/slice_into.cpp | 0 src/{ => libigl}/igl/slice_into.h | 0 src/{ => libigl}/igl/slice_mask.cpp | 0 src/{ => libigl}/igl/slice_mask.h | 0 src/{ => libigl}/igl/slice_tets.cpp | 0 src/{ => libigl}/igl/slice_tets.h | 0 src/{ => libigl}/igl/slim.cpp | 0 src/{ => libigl}/igl/slim.h | 0 src/{ => libigl}/igl/snap_points.cpp | 0 src/{ => libigl}/igl/snap_points.h | 0 .../igl/snap_to_canonical_view_quat.cpp | 0 .../igl/snap_to_canonical_view_quat.h | 0 src/{ => libigl}/igl/snap_to_fixed_up.cpp | 0 src/{ => libigl}/igl/snap_to_fixed_up.h | 0 src/{ => libigl}/igl/solid_angle.cpp | 0 src/{ => libigl}/igl/solid_angle.h | 0 src/{ => libigl}/igl/sort.cpp | 0 src/{ => libigl}/igl/sort.h | 0 src/{ => libigl}/igl/sort_angles.cpp | 0 src/{ => libigl}/igl/sort_angles.h | 0 src/{ => libigl}/igl/sort_triangles.cpp | 0 src/{ => libigl}/igl/sort_triangles.h | 0 src/{ => libigl}/igl/sort_vectors_ccw.cpp | 0 src/{ => libigl}/igl/sort_vectors_ccw.h | 0 src/{ => libigl}/igl/sortrows.cpp | 0 src/{ => libigl}/igl/sortrows.h | 0 src/{ => libigl}/igl/sparse.cpp | 0 src/{ => libigl}/igl/sparse.h | 0 src/{ => libigl}/igl/sparse_cached.cpp | 0 src/{ => libigl}/igl/sparse_cached.h | 0 src/{ => libigl}/igl/speye.cpp | 0 src/{ => libigl}/igl/speye.h | 0 src/{ => libigl}/igl/squared_edge_lengths.cpp | 0 src/{ => libigl}/igl/squared_edge_lengths.h | 0 src/{ => libigl}/igl/stdin_to_temp.cpp | 0 src/{ => libigl}/igl/stdin_to_temp.h | 0 src/{ => libigl}/igl/straighten_seams.cpp | 0 src/{ => libigl}/igl/straighten_seams.h | 0 src/{ => libigl}/igl/sum.cpp | 0 src/{ => libigl}/igl/sum.h | 0 src/{ => libigl}/igl/svd3x3.cpp | 0 src/{ => libigl}/igl/svd3x3.h | 0 src/{ => libigl}/igl/svd3x3_avx.cpp | 0 src/{ => libigl}/igl/svd3x3_avx.h | 0 src/{ => libigl}/igl/svd3x3_sse.cpp | 0 src/{ => libigl}/igl/svd3x3_sse.h | 0 .../igl/swept_volume_bounding_box.cpp | 0 .../igl/swept_volume_bounding_box.h | 0 .../igl/swept_volume_signed_distance.cpp | 0 .../igl/swept_volume_signed_distance.h | 0 src/{ => libigl}/igl/trackball.cpp | 0 src/{ => libigl}/igl/trackball.h | 0 src/{ => libigl}/igl/transpose_blocks.cpp | 0 src/{ => libigl}/igl/transpose_blocks.h | 0 src/{ => libigl}/igl/triangle/cdt.cpp | 0 src/{ => libigl}/igl/triangle/cdt.h | 0 src/{ => libigl}/igl/triangle/triangulate.cpp | 0 src/{ => libigl}/igl/triangle/triangulate.h | 0 src/{ => libigl}/igl/triangle_fan.cpp | 0 src/{ => libigl}/igl/triangle_fan.h | 0 .../igl/triangle_triangle_adjacency.cpp | 0 .../igl/triangle_triangle_adjacency.h | 0 src/{ => libigl}/igl/triangles_from_strip.cpp | 0 src/{ => libigl}/igl/triangles_from_strip.h | 0 .../igl/two_axis_valuator_fixed_up.cpp | 0 .../igl/two_axis_valuator_fixed_up.h | 0 .../igl/uniformly_sample_two_manifold.cpp | 0 .../igl/uniformly_sample_two_manifold.h | 0 src/{ => libigl}/igl/unique.cpp | 0 src/{ => libigl}/igl/unique.h | 0 src/{ => libigl}/igl/unique_edge_map.cpp | 0 src/{ => libigl}/igl/unique_edge_map.h | 0 src/{ => libigl}/igl/unique_rows.cpp | 0 src/{ => libigl}/igl/unique_rows.h | 0 src/{ => libigl}/igl/unique_simplices.cpp | 0 src/{ => libigl}/igl/unique_simplices.h | 0 src/{ => libigl}/igl/unproject.cpp | 0 src/{ => libigl}/igl/unproject.h | 0 src/{ => libigl}/igl/unproject_in_mesh.cpp | 0 src/{ => libigl}/igl/unproject_in_mesh.h | 0 src/{ => libigl}/igl/unproject_onto_mesh.cpp | 0 src/{ => libigl}/igl/unproject_onto_mesh.h | 0 src/{ => libigl}/igl/unproject_ray.cpp | 0 src/{ => libigl}/igl/unproject_ray.h | 0 src/{ => libigl}/igl/unzip_corners.cpp | 0 src/{ => libigl}/igl/unzip_corners.h | 0 src/{ => libigl}/igl/upsample.cpp | 0 src/{ => libigl}/igl/upsample.h | 0 src/{ => libigl}/igl/vector_area_matrix.cpp | 0 src/{ => libigl}/igl/vector_area_matrix.h | 0 src/{ => libigl}/igl/verbose.h | 0 .../igl/vertex_triangle_adjacency.cpp | 0 .../igl/vertex_triangle_adjacency.h | 0 src/{ => libigl}/igl/volume.cpp | 0 src/{ => libigl}/igl/volume.h | 0 src/{ => libigl}/igl/voxel_grid.cpp | 0 src/{ => libigl}/igl/voxel_grid.h | 0 src/{ => libigl}/igl/winding_number.cpp | 0 src/{ => libigl}/igl/winding_number.h | 0 src/{ => libigl}/igl/writeBF.cpp | 0 src/{ => libigl}/igl/writeBF.h | 0 src/{ => libigl}/igl/writeDMAT.cpp | 0 src/{ => libigl}/igl/writeDMAT.h | 0 src/{ => libigl}/igl/writeMESH.cpp | 0 src/{ => libigl}/igl/writeMESH.h | 0 src/{ => libigl}/igl/writeOBJ.cpp | 0 src/{ => libigl}/igl/writeOBJ.h | 0 src/{ => libigl}/igl/writeOFF.cpp | 0 src/{ => libigl}/igl/writeOFF.h | 0 src/{ => libigl}/igl/writePLY.cpp | 0 src/{ => libigl}/igl/writePLY.h | 0 src/{ => libigl}/igl/writeSTL.cpp | 0 src/{ => libigl}/igl/writeSTL.h | 0 src/{ => libigl}/igl/writeTGF.cpp | 0 src/{ => libigl}/igl/writeTGF.h | 0 src/{ => libigl}/igl/writeWRL.cpp | 0 src/{ => libigl}/igl/writeWRL.h | 0 src/{ => libigl}/igl/write_triangle_mesh.cpp | 0 src/{ => libigl}/igl/write_triangle_mesh.h | 0 .../igl/xml/ReAntTweakBarXMLSerialization.h | 0 src/{ => libigl}/igl/xml/XMLSerializable.h | 0 .../igl/xml/serialization_test.skip | 0 src/{ => libigl}/igl/xml/serialize_xml.cpp | 0 src/{ => libigl}/igl/xml/serialize_xml.h | 0 src/{ => libigl}/igl/xml/writeDAE.cpp | 0 src/{ => libigl}/igl/xml/writeDAE.h | 0 .../igl/xml/write_triangle_mesh.cpp | 0 .../igl/xml/write_triangle_mesh.h | 0 src/libslic3r/CMakeLists.txt | 1 + 1095 files changed, 181 insertions(+), 5 deletions(-) create mode 100644 deps/igl-fixes.patch create mode 100644 src/libigl/CMakeLists.txt rename src/{ => libigl}/igl/AABB.cpp (100%) rename src/{ => libigl}/igl/AABB.h (100%) rename src/{ => libigl}/igl/ARAPEnergyType.h (100%) rename src/{ => libigl}/igl/AtA_cached.cpp (100%) rename src/{ => libigl}/igl/AtA_cached.h (100%) rename src/{ => libigl}/igl/C_STR.h (100%) rename src/{ => libigl}/igl/Camera.h (100%) rename src/{ => libigl}/igl/EPS.cpp (100%) rename src/{ => libigl}/igl/EPS.h (100%) rename src/{ => libigl}/igl/HalfEdgeIterator.cpp (100%) rename src/{ => libigl}/igl/HalfEdgeIterator.h (100%) rename src/{ => libigl}/igl/Hit.h (100%) rename src/{ => libigl}/igl/IO (100%) rename src/{ => libigl}/igl/IndexComparison.h (100%) rename src/{ => libigl}/igl/LinSpaced.h (100%) rename src/{ => libigl}/igl/MeshBooleanType.h (100%) rename src/{ => libigl}/igl/NormalType.h (100%) rename src/{ => libigl}/igl/ONE.h (100%) rename src/{ => libigl}/igl/PI.h (100%) rename src/{ => libigl}/igl/REDRUM.h (100%) rename src/{ => libigl}/igl/STR.h (100%) rename src/{ => libigl}/igl/Singular_Value_Decomposition_Givens_QR_Factorization_Kernel.hpp (100%) rename src/{ => libigl}/igl/Singular_Value_Decomposition_Jacobi_Conjugation_Kernel.hpp (100%) rename src/{ => libigl}/igl/Singular_Value_Decomposition_Kernel_Declarations.hpp (100%) rename src/{ => libigl}/igl/Singular_Value_Decomposition_Main_Kernel_Body.hpp (100%) rename src/{ => libigl}/igl/Singular_Value_Decomposition_Preamble.hpp (100%) rename src/{ => libigl}/igl/SolverStatus.h (100%) rename src/{ => libigl}/igl/SortableRow.h (100%) rename src/{ => libigl}/igl/Timer.h (100%) rename src/{ => libigl}/igl/Viewport.h (100%) rename src/{ => libigl}/igl/WindingNumberAABB.h (100%) rename src/{ => libigl}/igl/WindingNumberMethod.h (100%) rename src/{ => libigl}/igl/WindingNumberTree.h (100%) rename src/{ => libigl}/igl/ZERO.h (100%) rename src/{ => libigl}/igl/active_set.cpp (100%) rename src/{ => libigl}/igl/active_set.h (100%) rename src/{ => libigl}/igl/adjacency_list.cpp (100%) rename src/{ => libigl}/igl/adjacency_list.h (100%) rename src/{ => libigl}/igl/adjacency_matrix.cpp (100%) rename src/{ => libigl}/igl/adjacency_matrix.h (100%) rename src/{ => libigl}/igl/all.cpp (100%) rename src/{ => libigl}/igl/all.h (100%) rename src/{ => libigl}/igl/all_edges.cpp (100%) rename src/{ => libigl}/igl/all_edges.h (100%) rename src/{ => libigl}/igl/all_pairs_distances.cpp (100%) rename src/{ => libigl}/igl/all_pairs_distances.h (100%) rename src/{ => libigl}/igl/ambient_occlusion.cpp (100%) rename src/{ => libigl}/igl/ambient_occlusion.h (100%) rename src/{ => libigl}/igl/angular_distance.cpp (100%) rename src/{ => libigl}/igl/angular_distance.h (100%) rename src/{ => libigl}/igl/anttweakbar/ReAntTweakBar.cpp (100%) rename src/{ => libigl}/igl/anttweakbar/ReAntTweakBar.h (100%) rename src/{ => libigl}/igl/anttweakbar/cocoa_key_to_anttweakbar_key.cpp (100%) rename src/{ => libigl}/igl/anttweakbar/cocoa_key_to_anttweakbar_key.h (100%) rename src/{ => libigl}/igl/any.cpp (100%) rename src/{ => libigl}/igl/any.h (100%) rename src/{ => libigl}/igl/any_of.cpp (100%) rename src/{ => libigl}/igl/any_of.h (100%) rename src/{ => libigl}/igl/arap.cpp (100%) rename src/{ => libigl}/igl/arap.h (100%) rename src/{ => libigl}/igl/arap_dof.cpp (100%) rename src/{ => libigl}/igl/arap_dof.h (100%) rename src/{ => libigl}/igl/arap_linear_block.cpp (100%) rename src/{ => libigl}/igl/arap_linear_block.h (100%) rename src/{ => libigl}/igl/arap_rhs.cpp (100%) rename src/{ => libigl}/igl/arap_rhs.h (100%) rename src/{ => libigl}/igl/average_onto_faces.cpp (100%) rename src/{ => libigl}/igl/average_onto_faces.h (100%) rename src/{ => libigl}/igl/average_onto_vertices.cpp (100%) rename src/{ => libigl}/igl/average_onto_vertices.h (100%) rename src/{ => libigl}/igl/avg_edge_length.cpp (100%) rename src/{ => libigl}/igl/avg_edge_length.h (100%) rename src/{ => libigl}/igl/axis_angle_to_quat.cpp (100%) rename src/{ => libigl}/igl/axis_angle_to_quat.h (100%) rename src/{ => libigl}/igl/barycenter.cpp (100%) rename src/{ => libigl}/igl/barycenter.h (100%) rename src/{ => libigl}/igl/barycentric_coordinates.cpp (100%) rename src/{ => libigl}/igl/barycentric_coordinates.h (100%) rename src/{ => libigl}/igl/barycentric_to_global.cpp (100%) rename src/{ => libigl}/igl/barycentric_to_global.h (100%) rename src/{ => libigl}/igl/basename.cpp (100%) rename src/{ => libigl}/igl/basename.h (100%) rename src/{ => libigl}/igl/bbw.cpp (100%) rename src/{ => libigl}/igl/bbw.h (100%) rename src/{ => libigl}/igl/bfs.cpp (100%) rename src/{ => libigl}/igl/bfs.h (100%) rename src/{ => libigl}/igl/bfs_orient.cpp (100%) rename src/{ => libigl}/igl/bfs_orient.h (100%) rename src/{ => libigl}/igl/biharmonic_coordinates.cpp (100%) rename src/{ => libigl}/igl/biharmonic_coordinates.h (100%) rename src/{ => libigl}/igl/bijective_composite_harmonic_mapping.cpp (100%) rename src/{ => libigl}/igl/bijective_composite_harmonic_mapping.h (100%) rename src/{ => libigl}/igl/bone_parents.cpp (100%) rename src/{ => libigl}/igl/bone_parents.h (100%) rename src/{ => libigl}/igl/boundary_conditions.cpp (100%) rename src/{ => libigl}/igl/boundary_conditions.h (100%) rename src/{ => libigl}/igl/boundary_facets.cpp (100%) rename src/{ => libigl}/igl/boundary_facets.h (100%) rename src/{ => libigl}/igl/boundary_loop.cpp (100%) rename src/{ => libigl}/igl/boundary_loop.h (100%) rename src/{ => libigl}/igl/bounding_box.cpp (100%) rename src/{ => libigl}/igl/bounding_box.h (100%) rename src/{ => libigl}/igl/bounding_box_diagonal.cpp (100%) rename src/{ => libigl}/igl/bounding_box_diagonal.h (100%) rename src/{ => libigl}/igl/canonical_quaternions.cpp (100%) rename src/{ => libigl}/igl/canonical_quaternions.h (100%) rename src/{ => libigl}/igl/cat.cpp (100%) rename src/{ => libigl}/igl/cat.h (100%) rename src/{ => libigl}/igl/ceil.cpp (100%) rename src/{ => libigl}/igl/ceil.h (100%) rename src/{ => libigl}/igl/centroid.cpp (100%) rename src/{ => libigl}/igl/centroid.h (100%) rename src/{ => libigl}/igl/circulation.cpp (100%) rename src/{ => libigl}/igl/circulation.h (100%) rename src/{ => libigl}/igl/circumradius.cpp (100%) rename src/{ => libigl}/igl/circumradius.h (100%) rename src/{ => libigl}/igl/collapse_edge.cpp (100%) rename src/{ => libigl}/igl/collapse_edge.h (100%) rename src/{ => libigl}/igl/collapse_small_triangles.cpp (100%) rename src/{ => libigl}/igl/collapse_small_triangles.h (100%) rename src/{ => libigl}/igl/colon.cpp (100%) rename src/{ => libigl}/igl/colon.h (100%) rename src/{ => libigl}/igl/colormap.cpp (100%) rename src/{ => libigl}/igl/colormap.h (100%) rename src/{ => libigl}/igl/column_to_quats.cpp (100%) rename src/{ => libigl}/igl/column_to_quats.h (100%) rename src/{ => libigl}/igl/columnize.cpp (100%) rename src/{ => libigl}/igl/columnize.h (100%) rename src/{ => libigl}/igl/comb_cross_field.cpp (100%) rename src/{ => libigl}/igl/comb_cross_field.h (100%) rename src/{ => libigl}/igl/comb_frame_field.cpp (100%) rename src/{ => libigl}/igl/comb_frame_field.h (100%) rename src/{ => libigl}/igl/comb_line_field.cpp (100%) rename src/{ => libigl}/igl/comb_line_field.h (100%) rename src/{ => libigl}/igl/combine.cpp (100%) rename src/{ => libigl}/igl/combine.h (100%) rename src/{ => libigl}/igl/components.cpp (100%) rename src/{ => libigl}/igl/components.h (100%) rename src/{ => libigl}/igl/compute_frame_field_bisectors.cpp (100%) rename src/{ => libigl}/igl/compute_frame_field_bisectors.h (100%) rename src/{ => libigl}/igl/connect_boundary_to_infinity.cpp (100%) rename src/{ => libigl}/igl/connect_boundary_to_infinity.h (100%) rename src/{ => libigl}/igl/copyleft/README.md (100%) rename src/{ => libigl}/igl/copyleft/cgal/BinaryWindingNumberOperations.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/CGAL_includes.hpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/CSGTree.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/RemeshSelfIntersectionsParam.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/SelfIntersectMesh.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/assign.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/assign.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/assign_scalar.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/assign_scalar.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/barycenter.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/cell_adjacency.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/cell_adjacency.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/closest_facet.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/closest_facet.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/complex_to_mesh.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/complex_to_mesh.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/component_inside_component.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/component_inside_component.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/convex_hull.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/convex_hull.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/delaunay_triangulation.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/delaunay_triangulation.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/extract_cells.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/extract_cells.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/extract_feature.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/extract_feature.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/fast_winding_number.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/fast_winding_number.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/half_space_box.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/half_space_box.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/hausdorff.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/hausdorff.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/incircle.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/incircle.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/insert_into_cdt.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/insert_into_cdt.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/insphere.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/insphere.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/intersect_other.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/intersect_other.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/intersect_with_half_space.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/intersect_with_half_space.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/lexicographic_triangulation.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/lexicographic_triangulation.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/list_to_matrix.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/mesh_boolean.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/mesh_boolean.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/mesh_boolean_type_to_funcs.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/mesh_boolean_type_to_funcs.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/mesh_to_cgal_triangle_list.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/mesh_to_cgal_triangle_list.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/mesh_to_polyhedron.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/mesh_to_polyhedron.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/minkowski_sum.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/minkowski_sum.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/order_facets_around_edge.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/order_facets_around_edge.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/order_facets_around_edges.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/order_facets_around_edges.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/orient2D.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/orient2D.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/orient3D.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/orient3D.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/outer_element.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/outer_element.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/outer_facet.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/outer_facet.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/outer_hull.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/outer_hull.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/peel_outer_hull_layers.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/peel_outer_hull_layers.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/peel_winding_number_layers.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/peel_winding_number_layers.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/piecewise_constant_winding_number.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/piecewise_constant_winding_number.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/point_areas.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/point_areas.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/point_mesh_squared_distance.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/point_mesh_squared_distance.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/point_segment_squared_distance.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/point_segment_squared_distance.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/point_solid_signed_squared_distance.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/point_solid_signed_squared_distance.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/point_triangle_squared_distance.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/point_triangle_squared_distance.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/points_inside_component.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/points_inside_component.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/polyhedron_to_mesh.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/polyhedron_to_mesh.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/projected_cdt.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/projected_cdt.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/projected_delaunay.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/projected_delaunay.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/propagate_winding_numbers.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/propagate_winding_numbers.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/read_triangle_mesh.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/read_triangle_mesh.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/relabel_small_immersed_cells.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/relabel_small_immersed_cells.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/remesh_intersections.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/remesh_intersections.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/remesh_self_intersections.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/remesh_self_intersections.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/remove_unreferenced.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/resolve_intersections.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/resolve_intersections.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/row_to_point.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/row_to_point.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/segment_segment_squared_distance.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/segment_segment_squared_distance.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/signed_distance_isosurface.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/signed_distance_isosurface.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/slice.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/slice_mask.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/snap_rounding.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/snap_rounding.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/string_to_mesh_boolean_type.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/string_to_mesh_boolean_type.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/subdivide_segments.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/subdivide_segments.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/submesh_aabb_tree.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/submesh_aabb_tree.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/triangle_triangle_squared_distance.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/triangle_triangle_squared_distance.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/trim_with_solid.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/trim_with_solid.h (100%) rename src/{ => libigl}/igl/copyleft/cgal/unique.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/unique_rows.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/wire_mesh.cpp (100%) rename src/{ => libigl}/igl/copyleft/cgal/wire_mesh.h (100%) rename src/{ => libigl}/igl/copyleft/comiso/frame_field.cpp (100%) rename src/{ => libigl}/igl/copyleft/comiso/frame_field.h (100%) rename src/{ => libigl}/igl/copyleft/comiso/miq.cpp (100%) rename src/{ => libigl}/igl/copyleft/comiso/miq.h (100%) rename src/{ => libigl}/igl/copyleft/comiso/nrosy.cpp (100%) rename src/{ => libigl}/igl/copyleft/comiso/nrosy.h (100%) rename src/{ => libigl}/igl/copyleft/cork/from_cork_mesh.cpp (100%) rename src/{ => libigl}/igl/copyleft/cork/from_cork_mesh.h (100%) rename src/{ => libigl}/igl/copyleft/cork/mesh_boolean.cpp (100%) rename src/{ => libigl}/igl/copyleft/cork/mesh_boolean.h (100%) rename src/{ => libigl}/igl/copyleft/cork/to_cork_mesh.cpp (100%) rename src/{ => libigl}/igl/copyleft/cork/to_cork_mesh.h (100%) rename src/{ => libigl}/igl/copyleft/marching_cubes.cpp (100%) rename src/{ => libigl}/igl/copyleft/marching_cubes.h (100%) rename src/{ => libigl}/igl/copyleft/marching_cubes_tables.h (100%) rename src/{ => libigl}/igl/copyleft/offset_surface.cpp (100%) rename src/{ => libigl}/igl/copyleft/offset_surface.h (100%) rename src/{ => libigl}/igl/copyleft/opengl2/render_to_tga.cpp (100%) rename src/{ => libigl}/igl/copyleft/opengl2/render_to_tga.h (100%) rename src/{ => libigl}/igl/copyleft/opengl2/texture_from_tga.cpp (100%) rename src/{ => libigl}/igl/copyleft/opengl2/texture_from_tga.h (100%) rename src/{ => libigl}/igl/copyleft/opengl2/tga.cpp (100%) rename src/{ => libigl}/igl/copyleft/opengl2/tga.h (100%) rename src/{ => libigl}/igl/copyleft/progressive_hulls.cpp (100%) rename src/{ => libigl}/igl/copyleft/progressive_hulls.h (100%) rename src/{ => libigl}/igl/copyleft/progressive_hulls_cost_and_placement.cpp (100%) rename src/{ => libigl}/igl/copyleft/progressive_hulls_cost_and_placement.h (100%) rename src/{ => libigl}/igl/copyleft/quadprog.cpp (100%) rename src/{ => libigl}/igl/copyleft/quadprog.h (100%) rename src/{ => libigl}/igl/copyleft/swept_volume.cpp (100%) rename src/{ => libigl}/igl/copyleft/swept_volume.h (100%) rename src/{ => libigl}/igl/copyleft/tetgen/README (100%) rename src/{ => libigl}/igl/copyleft/tetgen/cdt.cpp (100%) rename src/{ => libigl}/igl/copyleft/tetgen/cdt.h (100%) rename src/{ => libigl}/igl/copyleft/tetgen/mesh_to_tetgenio.cpp (100%) rename src/{ => libigl}/igl/copyleft/tetgen/mesh_to_tetgenio.h (100%) rename src/{ => libigl}/igl/copyleft/tetgen/mesh_with_skeleton.cpp (100%) rename src/{ => libigl}/igl/copyleft/tetgen/mesh_with_skeleton.h (100%) rename src/{ => libigl}/igl/copyleft/tetgen/read_into_tetgenio.cpp (100%) rename src/{ => libigl}/igl/copyleft/tetgen/read_into_tetgenio.h (100%) rename src/{ => libigl}/igl/copyleft/tetgen/tetgenio_to_tetmesh.cpp (100%) rename src/{ => libigl}/igl/copyleft/tetgen/tetgenio_to_tetmesh.h (100%) rename src/{ => libigl}/igl/copyleft/tetgen/tetrahedralize.cpp (100%) rename src/{ => libigl}/igl/copyleft/tetgen/tetrahedralize.h (100%) rename src/{ => libigl}/igl/cotmatrix.cpp (100%) rename src/{ => libigl}/igl/cotmatrix.h (100%) rename src/{ => libigl}/igl/cotmatrix_entries.cpp (100%) rename src/{ => libigl}/igl/cotmatrix_entries.h (100%) rename src/{ => libigl}/igl/count.cpp (100%) rename src/{ => libigl}/igl/count.h (100%) rename src/{ => libigl}/igl/covariance_scatter_matrix.cpp (100%) rename src/{ => libigl}/igl/covariance_scatter_matrix.h (100%) rename src/{ => libigl}/igl/cross.cpp (100%) rename src/{ => libigl}/igl/cross.h (100%) rename src/{ => libigl}/igl/cross_field_missmatch.cpp (100%) rename src/{ => libigl}/igl/cross_field_missmatch.h (100%) rename src/{ => libigl}/igl/crouzeix_raviart_cotmatrix.cpp (100%) rename src/{ => libigl}/igl/crouzeix_raviart_cotmatrix.h (100%) rename src/{ => libigl}/igl/crouzeix_raviart_massmatrix.cpp (100%) rename src/{ => libigl}/igl/crouzeix_raviart_massmatrix.h (100%) rename src/{ => libigl}/igl/cumsum.cpp (100%) rename src/{ => libigl}/igl/cumsum.h (100%) rename src/{ => libigl}/igl/cut_mesh.cpp (100%) rename src/{ => libigl}/igl/cut_mesh.h (100%) rename src/{ => libigl}/igl/cut_mesh_from_singularities.cpp (100%) rename src/{ => libigl}/igl/cut_mesh_from_singularities.h (100%) rename src/{ => libigl}/igl/cylinder.cpp (100%) rename src/{ => libigl}/igl/cylinder.h (100%) rename src/{ => libigl}/igl/dated_copy.cpp (100%) rename src/{ => libigl}/igl/dated_copy.h (100%) rename src/{ => libigl}/igl/decimate.cpp (100%) rename src/{ => libigl}/igl/decimate.h (100%) rename src/{ => libigl}/igl/deform_skeleton.cpp (100%) rename src/{ => libigl}/igl/deform_skeleton.h (100%) rename src/{ => libigl}/igl/delaunay_triangulation.cpp (100%) rename src/{ => libigl}/igl/delaunay_triangulation.h (100%) rename src/{ => libigl}/igl/deprecated.h (100%) rename src/{ => libigl}/igl/dfs.cpp (100%) rename src/{ => libigl}/igl/dfs.h (100%) rename src/{ => libigl}/igl/diag.cpp (100%) rename src/{ => libigl}/igl/diag.h (100%) rename src/{ => libigl}/igl/dihedral_angles.cpp (100%) rename src/{ => libigl}/igl/dihedral_angles.h (100%) rename src/{ => libigl}/igl/dijkstra.cpp (100%) rename src/{ => libigl}/igl/dijkstra.h (100%) rename src/{ => libigl}/igl/directed_edge_orientations.cpp (100%) rename src/{ => libigl}/igl/directed_edge_orientations.h (100%) rename src/{ => libigl}/igl/directed_edge_parents.cpp (100%) rename src/{ => libigl}/igl/directed_edge_parents.h (100%) rename src/{ => libigl}/igl/dirname.cpp (100%) rename src/{ => libigl}/igl/dirname.h (100%) rename src/{ => libigl}/igl/dot.cpp (100%) rename src/{ => libigl}/igl/dot.h (100%) rename src/{ => libigl}/igl/dot_row.cpp (100%) rename src/{ => libigl}/igl/dot_row.h (100%) rename src/{ => libigl}/igl/doublearea.cpp (100%) rename src/{ => libigl}/igl/doublearea.h (100%) rename src/{ => libigl}/igl/dqs.cpp (100%) rename src/{ => libigl}/igl/dqs.h (100%) rename src/{ => libigl}/igl/ears.cpp (100%) rename src/{ => libigl}/igl/ears.h (100%) rename src/{ => libigl}/igl/edge_collapse_is_valid.cpp (100%) rename src/{ => libigl}/igl/edge_collapse_is_valid.h (100%) rename src/{ => libigl}/igl/edge_flaps.cpp (100%) rename src/{ => libigl}/igl/edge_flaps.h (100%) rename src/{ => libigl}/igl/edge_lengths.cpp (100%) rename src/{ => libigl}/igl/edge_lengths.h (100%) rename src/{ => libigl}/igl/edge_topology.cpp (100%) rename src/{ => libigl}/igl/edge_topology.h (100%) rename src/{ => libigl}/igl/edges.cpp (100%) rename src/{ => libigl}/igl/edges.h (100%) rename src/{ => libigl}/igl/edges_to_path.cpp (100%) rename src/{ => libigl}/igl/edges_to_path.h (100%) rename src/{ => libigl}/igl/eigs.cpp (100%) rename src/{ => libigl}/igl/eigs.h (100%) rename src/{ => libigl}/igl/embree/EmbreeIntersector.h (100%) rename src/{ => libigl}/igl/embree/Embree_convenience.h (100%) rename src/{ => libigl}/igl/embree/ambient_occlusion.cpp (100%) rename src/{ => libigl}/igl/embree/ambient_occlusion.h (100%) rename src/{ => libigl}/igl/embree/bone_heat.cpp (100%) rename src/{ => libigl}/igl/embree/bone_heat.h (100%) rename src/{ => libigl}/igl/embree/bone_visible.cpp (100%) rename src/{ => libigl}/igl/embree/bone_visible.h (100%) rename src/{ => libigl}/igl/embree/embree2/rtcore.h (100%) rename src/{ => libigl}/igl/embree/embree2/rtcore.isph (100%) rename src/{ => libigl}/igl/embree/embree2/rtcore_geometry.h (100%) rename src/{ => libigl}/igl/embree/embree2/rtcore_geometry.isph (100%) rename src/{ => libigl}/igl/embree/embree2/rtcore_geometry_user.h (100%) rename src/{ => libigl}/igl/embree/embree2/rtcore_geometry_user.isph (100%) rename src/{ => libigl}/igl/embree/embree2/rtcore_ray.h (100%) rename src/{ => libigl}/igl/embree/embree2/rtcore_ray.isph (100%) rename src/{ => libigl}/igl/embree/embree2/rtcore_scene.h (100%) rename src/{ => libigl}/igl/embree/embree2/rtcore_scene.isph (100%) rename src/{ => libigl}/igl/embree/line_mesh_intersection.cpp (100%) rename src/{ => libigl}/igl/embree/line_mesh_intersection.h (100%) rename src/{ => libigl}/igl/embree/reorient_facets_raycast.cpp (100%) rename src/{ => libigl}/igl/embree/reorient_facets_raycast.h (100%) rename src/{ => libigl}/igl/embree/shape_diameter_function.cpp (100%) rename src/{ => libigl}/igl/embree/shape_diameter_function.h (100%) rename src/{ => libigl}/igl/embree/unproject_in_mesh.cpp (100%) rename src/{ => libigl}/igl/embree/unproject_in_mesh.h (100%) rename src/{ => libigl}/igl/embree/unproject_onto_mesh.cpp (100%) rename src/{ => libigl}/igl/embree/unproject_onto_mesh.h (100%) rename src/{ => libigl}/igl/euler_characteristic.cpp (100%) rename src/{ => libigl}/igl/euler_characteristic.h (100%) rename src/{ => libigl}/igl/exact_geodesic.cpp (100%) rename src/{ => libigl}/igl/exact_geodesic.h (100%) rename src/{ => libigl}/igl/example_fun.cpp (100%) rename src/{ => libigl}/igl/example_fun.h (100%) rename src/{ => libigl}/igl/exterior_edges.cpp (100%) rename src/{ => libigl}/igl/exterior_edges.h (100%) rename src/{ => libigl}/igl/extract_manifold_patches.cpp (100%) rename src/{ => libigl}/igl/extract_manifold_patches.h (100%) rename src/{ => libigl}/igl/extract_non_manifold_edge_curves.cpp (100%) rename src/{ => libigl}/igl/extract_non_manifold_edge_curves.h (100%) rename src/{ => libigl}/igl/face_areas.cpp (100%) rename src/{ => libigl}/igl/face_areas.h (100%) rename src/{ => libigl}/igl/face_occurrences.cpp (100%) rename src/{ => libigl}/igl/face_occurrences.h (100%) rename src/{ => libigl}/igl/faces_first.cpp (100%) rename src/{ => libigl}/igl/faces_first.h (100%) rename src/{ => libigl}/igl/facet_components.cpp (100%) rename src/{ => libigl}/igl/facet_components.h (100%) rename src/{ => libigl}/igl/false_barycentric_subdivision.cpp (100%) rename src/{ => libigl}/igl/false_barycentric_subdivision.h (100%) rename src/{ => libigl}/igl/fast_winding_number.cpp (100%) rename src/{ => libigl}/igl/fast_winding_number.h (100%) rename src/{ => libigl}/igl/file_contents_as_string.cpp (100%) rename src/{ => libigl}/igl/file_contents_as_string.h (100%) rename src/{ => libigl}/igl/file_dialog_open.cpp (100%) rename src/{ => libigl}/igl/file_dialog_open.h (100%) rename src/{ => libigl}/igl/file_dialog_save.cpp (100%) rename src/{ => libigl}/igl/file_dialog_save.h (100%) rename src/{ => libigl}/igl/file_exists.cpp (100%) rename src/{ => libigl}/igl/file_exists.h (100%) rename src/{ => libigl}/igl/find.cpp (100%) rename src/{ => libigl}/igl/find.h (100%) rename src/{ => libigl}/igl/find_cross_field_singularities.cpp (100%) rename src/{ => libigl}/igl/find_cross_field_singularities.h (100%) rename src/{ => libigl}/igl/find_zero.cpp (100%) rename src/{ => libigl}/igl/find_zero.h (100%) rename src/{ => libigl}/igl/fit_plane.cpp (100%) rename src/{ => libigl}/igl/fit_plane.h (100%) rename src/{ => libigl}/igl/fit_rotations.cpp (100%) rename src/{ => libigl}/igl/fit_rotations.h (100%) rename src/{ => libigl}/igl/flip_avoiding_line_search.cpp (100%) rename src/{ => libigl}/igl/flip_avoiding_line_search.h (100%) rename src/{ => libigl}/igl/flip_edge.cpp (100%) rename src/{ => libigl}/igl/flip_edge.h (100%) rename src/{ => libigl}/igl/flipped_triangles.cpp (100%) rename src/{ => libigl}/igl/flipped_triangles.h (100%) rename src/{ => libigl}/igl/flood_fill.cpp (100%) rename src/{ => libigl}/igl/flood_fill.h (100%) rename src/{ => libigl}/igl/floor.cpp (100%) rename src/{ => libigl}/igl/floor.h (100%) rename src/{ => libigl}/igl/for_each.h (100%) rename src/{ => libigl}/igl/forward_kinematics.cpp (100%) rename src/{ => libigl}/igl/forward_kinematics.h (100%) rename src/{ => libigl}/igl/frame_field_deformer.cpp (100%) rename src/{ => libigl}/igl/frame_field_deformer.h (100%) rename src/{ => libigl}/igl/frame_to_cross_field.cpp (100%) rename src/{ => libigl}/igl/frame_to_cross_field.h (100%) rename src/{ => libigl}/igl/frustum.cpp (100%) rename src/{ => libigl}/igl/frustum.h (100%) rename src/{ => libigl}/igl/gaussian_curvature.cpp (100%) rename src/{ => libigl}/igl/gaussian_curvature.h (100%) rename src/{ => libigl}/igl/get_seconds.cpp (100%) rename src/{ => libigl}/igl/get_seconds.h (100%) rename src/{ => libigl}/igl/get_seconds_hires.cpp (100%) rename src/{ => libigl}/igl/get_seconds_hires.h (100%) rename src/{ => libigl}/igl/grad.cpp (100%) rename src/{ => libigl}/igl/grad.h (100%) rename src/{ => libigl}/igl/grid.cpp (100%) rename src/{ => libigl}/igl/grid.h (100%) rename src/{ => libigl}/igl/grid_search.cpp (100%) rename src/{ => libigl}/igl/grid_search.h (100%) rename src/{ => libigl}/igl/group_sum_matrix.cpp (100%) rename src/{ => libigl}/igl/group_sum_matrix.h (100%) rename src/{ => libigl}/igl/guess_extension.cpp (100%) rename src/{ => libigl}/igl/guess_extension.h (100%) rename src/{ => libigl}/igl/harmonic.cpp (100%) rename src/{ => libigl}/igl/harmonic.h (100%) rename src/{ => libigl}/igl/harwell_boeing.cpp (100%) rename src/{ => libigl}/igl/harwell_boeing.h (100%) rename src/{ => libigl}/igl/hausdorff.cpp (100%) rename src/{ => libigl}/igl/hausdorff.h (100%) rename src/{ => libigl}/igl/hessian.cpp (100%) rename src/{ => libigl}/igl/hessian.h (100%) rename src/{ => libigl}/igl/hessian_energy.cpp (100%) rename src/{ => libigl}/igl/hessian_energy.h (100%) rename src/{ => libigl}/igl/histc.cpp (100%) rename src/{ => libigl}/igl/histc.h (100%) rename src/{ => libigl}/igl/hsv_to_rgb.cpp (100%) rename src/{ => libigl}/igl/hsv_to_rgb.h (100%) rename src/{ => libigl}/igl/igl_inline.h (100%) rename src/{ => libigl}/igl/in_element.cpp (100%) rename src/{ => libigl}/igl/in_element.h (100%) rename src/{ => libigl}/igl/infinite_cost_stopping_condition.cpp (100%) rename src/{ => libigl}/igl/infinite_cost_stopping_condition.h (100%) rename src/{ => libigl}/igl/inradius.cpp (100%) rename src/{ => libigl}/igl/inradius.h (100%) rename src/{ => libigl}/igl/internal_angles.cpp (100%) rename src/{ => libigl}/igl/internal_angles.h (100%) rename src/{ => libigl}/igl/intersect.cpp (100%) rename src/{ => libigl}/igl/intersect.h (100%) rename src/{ => libigl}/igl/invert_diag.cpp (100%) rename src/{ => libigl}/igl/invert_diag.h (100%) rename src/{ => libigl}/igl/is_border_vertex.cpp (100%) rename src/{ => libigl}/igl/is_border_vertex.h (100%) rename src/{ => libigl}/igl/is_boundary_edge.cpp (100%) rename src/{ => libigl}/igl/is_boundary_edge.h (100%) rename src/{ => libigl}/igl/is_dir.cpp (100%) rename src/{ => libigl}/igl/is_dir.h (100%) rename src/{ => libigl}/igl/is_edge_manifold.cpp (100%) rename src/{ => libigl}/igl/is_edge_manifold.h (100%) rename src/{ => libigl}/igl/is_file.cpp (100%) rename src/{ => libigl}/igl/is_file.h (100%) rename src/{ => libigl}/igl/is_irregular_vertex.cpp (100%) rename src/{ => libigl}/igl/is_irregular_vertex.h (100%) rename src/{ => libigl}/igl/is_planar.cpp (100%) rename src/{ => libigl}/igl/is_planar.h (100%) rename src/{ => libigl}/igl/is_readable.cpp (100%) rename src/{ => libigl}/igl/is_readable.h (100%) rename src/{ => libigl}/igl/is_sparse.cpp (100%) rename src/{ => libigl}/igl/is_sparse.h (100%) rename src/{ => libigl}/igl/is_stl.cpp (100%) rename src/{ => libigl}/igl/is_stl.h (100%) rename src/{ => libigl}/igl/is_symmetric.cpp (100%) rename src/{ => libigl}/igl/is_symmetric.h (100%) rename src/{ => libigl}/igl/is_vertex_manifold.cpp (100%) rename src/{ => libigl}/igl/is_vertex_manifold.h (100%) rename src/{ => libigl}/igl/is_writable.cpp (100%) rename src/{ => libigl}/igl/is_writable.h (100%) rename src/{ => libigl}/igl/isdiag.cpp (100%) rename src/{ => libigl}/igl/isdiag.h (100%) rename src/{ => libigl}/igl/ismember.cpp (100%) rename src/{ => libigl}/igl/ismember.h (100%) rename src/{ => libigl}/igl/isolines.cpp (100%) rename src/{ => libigl}/igl/isolines.h (100%) rename src/{ => libigl}/igl/jet.cpp (100%) rename src/{ => libigl}/igl/jet.h (100%) rename src/{ => libigl}/igl/knn.cpp (100%) rename src/{ => libigl}/igl/knn.h (100%) rename src/{ => libigl}/igl/launch_medit.cpp (100%) rename src/{ => libigl}/igl/launch_medit.h (100%) rename src/{ => libigl}/igl/lbs_matrix.cpp (100%) rename src/{ => libigl}/igl/lbs_matrix.h (100%) rename src/{ => libigl}/igl/lexicographic_triangulation.cpp (100%) rename src/{ => libigl}/igl/lexicographic_triangulation.h (100%) rename src/{ => libigl}/igl/lim/lim.cpp (100%) rename src/{ => libigl}/igl/lim/lim.h (100%) rename src/{ => libigl}/igl/limit_faces.cpp (100%) rename src/{ => libigl}/igl/limit_faces.h (100%) rename src/{ => libigl}/igl/line_field_missmatch.cpp (100%) rename src/{ => libigl}/igl/line_field_missmatch.h (100%) rename src/{ => libigl}/igl/line_search.cpp (100%) rename src/{ => libigl}/igl/line_search.h (100%) rename src/{ => libigl}/igl/line_segment_in_rectangle.cpp (100%) rename src/{ => libigl}/igl/line_segment_in_rectangle.h (100%) rename src/{ => libigl}/igl/linprog.cpp (100%) rename src/{ => libigl}/igl/linprog.h (100%) rename src/{ => libigl}/igl/list_to_matrix.cpp (100%) rename src/{ => libigl}/igl/list_to_matrix.h (100%) rename src/{ => libigl}/igl/local_basis.cpp (100%) rename src/{ => libigl}/igl/local_basis.h (100%) rename src/{ => libigl}/igl/look_at.cpp (100%) rename src/{ => libigl}/igl/look_at.h (100%) rename src/{ => libigl}/igl/loop.cpp (100%) rename src/{ => libigl}/igl/loop.h (100%) rename src/{ => libigl}/igl/lscm.cpp (100%) rename src/{ => libigl}/igl/lscm.h (100%) rename src/{ => libigl}/igl/map_vertices_to_circle.cpp (100%) rename src/{ => libigl}/igl/map_vertices_to_circle.h (100%) rename src/{ => libigl}/igl/massmatrix.cpp (100%) rename src/{ => libigl}/igl/massmatrix.h (100%) rename src/{ => libigl}/igl/mat_max.cpp (100%) rename src/{ => libigl}/igl/mat_max.h (100%) rename src/{ => libigl}/igl/mat_min.cpp (100%) rename src/{ => libigl}/igl/mat_min.h (100%) rename src/{ => libigl}/igl/mat_to_quat.cpp (100%) rename src/{ => libigl}/igl/mat_to_quat.h (100%) rename src/{ => libigl}/igl/material_colors.h (100%) rename src/{ => libigl}/igl/matlab/MatlabWorkspace.h (100%) rename src/{ => libigl}/igl/matlab/MexStream.h (100%) rename src/{ => libigl}/igl/matlab/matlabinterface.cpp (100%) rename src/{ => libigl}/igl/matlab/matlabinterface.h (100%) rename src/{ => libigl}/igl/matlab/mexErrMsgTxt.cpp (100%) rename src/{ => libigl}/igl/matlab/mexErrMsgTxt.h (100%) rename src/{ => libigl}/igl/matlab/parse_rhs.cpp (100%) rename src/{ => libigl}/igl/matlab/parse_rhs.h (100%) rename src/{ => libigl}/igl/matlab/prepare_lhs.cpp (100%) rename src/{ => libigl}/igl/matlab/prepare_lhs.h (100%) rename src/{ => libigl}/igl/matlab/requires_arg.cpp (100%) rename src/{ => libigl}/igl/matlab/requires_arg.h (100%) rename src/{ => libigl}/igl/matlab/validate_arg.cpp (100%) rename src/{ => libigl}/igl/matlab/validate_arg.h (100%) rename src/{ => libigl}/igl/matlab_format.cpp (100%) rename src/{ => libigl}/igl/matlab_format.h (100%) rename src/{ => libigl}/igl/matrix_to_list.cpp (100%) rename src/{ => libigl}/igl/matrix_to_list.h (100%) rename src/{ => libigl}/igl/max.cpp (100%) rename src/{ => libigl}/igl/max.h (100%) rename src/{ => libigl}/igl/max_faces_stopping_condition.cpp (100%) rename src/{ => libigl}/igl/max_faces_stopping_condition.h (100%) rename src/{ => libigl}/igl/max_size.cpp (100%) rename src/{ => libigl}/igl/max_size.h (100%) rename src/{ => libigl}/igl/median.cpp (100%) rename src/{ => libigl}/igl/median.h (100%) rename src/{ => libigl}/igl/min.cpp (100%) rename src/{ => libigl}/igl/min.h (100%) rename src/{ => libigl}/igl/min_quad_dense.cpp (100%) rename src/{ => libigl}/igl/min_quad_dense.h (100%) rename src/{ => libigl}/igl/min_quad_with_fixed.cpp (100%) rename src/{ => libigl}/igl/min_quad_with_fixed.h (100%) rename src/{ => libigl}/igl/min_size.cpp (100%) rename src/{ => libigl}/igl/min_size.h (100%) rename src/{ => libigl}/igl/mod.cpp (100%) rename src/{ => libigl}/igl/mod.h (100%) rename src/{ => libigl}/igl/mode.cpp (100%) rename src/{ => libigl}/igl/mode.h (100%) rename src/{ => libigl}/igl/mosek/bbw.cpp (100%) rename src/{ => libigl}/igl/mosek/bbw.h (100%) rename src/{ => libigl}/igl/mosek/mosek_guarded.cpp (100%) rename src/{ => libigl}/igl/mosek/mosek_guarded.h (100%) rename src/{ => libigl}/igl/mosek/mosek_linprog.cpp (100%) rename src/{ => libigl}/igl/mosek/mosek_linprog.h (100%) rename src/{ => libigl}/igl/mosek/mosek_quadprog.cpp (100%) rename src/{ => libigl}/igl/mosek/mosek_quadprog.h (100%) rename src/{ => libigl}/igl/mvc.cpp (100%) rename src/{ => libigl}/igl/mvc.h (100%) rename src/{ => libigl}/igl/nchoosek.cpp (100%) rename src/{ => libigl}/igl/nchoosek.h (100%) rename src/{ => libigl}/igl/next_filename.cpp (100%) rename src/{ => libigl}/igl/next_filename.h (100%) rename src/{ => libigl}/igl/normal_derivative.cpp (100%) rename src/{ => libigl}/igl/normal_derivative.h (100%) rename src/{ => libigl}/igl/normalize_quat.cpp (100%) rename src/{ => libigl}/igl/normalize_quat.h (100%) rename src/{ => libigl}/igl/normalize_row_lengths.cpp (100%) rename src/{ => libigl}/igl/normalize_row_lengths.h (100%) rename src/{ => libigl}/igl/normalize_row_sums.cpp (100%) rename src/{ => libigl}/igl/normalize_row_sums.h (100%) rename src/{ => libigl}/igl/null.cpp (100%) rename src/{ => libigl}/igl/null.h (100%) rename src/{ => libigl}/igl/octree.cpp (100%) rename src/{ => libigl}/igl/octree.h (100%) rename src/{ => libigl}/igl/on_boundary.cpp (100%) rename src/{ => libigl}/igl/on_boundary.h (100%) rename src/{ => libigl}/igl/opengl/MeshGL.cpp (100%) rename src/{ => libigl}/igl/opengl/MeshGL.h (100%) rename src/{ => libigl}/igl/opengl/ViewerCore.cpp (100%) rename src/{ => libigl}/igl/opengl/ViewerCore.h (100%) rename src/{ => libigl}/igl/opengl/ViewerData.cpp (100%) rename src/{ => libigl}/igl/opengl/ViewerData.h (100%) rename src/{ => libigl}/igl/opengl/bind_vertex_attrib_array.cpp (100%) rename src/{ => libigl}/igl/opengl/bind_vertex_attrib_array.h (100%) rename src/{ => libigl}/igl/opengl/create_index_vbo.cpp (100%) rename src/{ => libigl}/igl/opengl/create_index_vbo.h (100%) rename src/{ => libigl}/igl/opengl/create_mesh_vbo.cpp (100%) rename src/{ => libigl}/igl/opengl/create_mesh_vbo.h (100%) rename src/{ => libigl}/igl/opengl/create_shader_program.cpp (100%) rename src/{ => libigl}/igl/opengl/create_shader_program.h (100%) rename src/{ => libigl}/igl/opengl/create_vector_vbo.cpp (100%) rename src/{ => libigl}/igl/opengl/create_vector_vbo.h (100%) rename src/{ => libigl}/igl/opengl/destroy_shader_program.cpp (100%) rename src/{ => libigl}/igl/opengl/destroy_shader_program.h (100%) rename src/{ => libigl}/igl/opengl/gl.h (100%) rename src/{ => libigl}/igl/opengl/gl_type_size.cpp (100%) rename src/{ => libigl}/igl/opengl/gl_type_size.h (100%) rename src/{ => libigl}/igl/opengl/glfw/Viewer.cpp (100%) rename src/{ => libigl}/igl/opengl/glfw/Viewer.h (100%) rename src/{ => libigl}/igl/opengl/glfw/ViewerPlugin.h (100%) rename src/{ => libigl}/igl/opengl/glfw/background_window.cpp (100%) rename src/{ => libigl}/igl/opengl/glfw/background_window.h (100%) rename src/{ => libigl}/igl/opengl/glfw/imgui/ImGuiHelpers.h (100%) rename src/{ => libigl}/igl/opengl/glfw/imgui/ImGuiMenu.cpp (100%) rename src/{ => libigl}/igl/opengl/glfw/imgui/ImGuiMenu.h (100%) rename src/{ => libigl}/igl/opengl/glfw/map_texture.cpp (100%) rename src/{ => libigl}/igl/opengl/glfw/map_texture.h (100%) rename src/{ => libigl}/igl/opengl/init_render_to_texture.cpp (100%) rename src/{ => libigl}/igl/opengl/init_render_to_texture.h (100%) rename src/{ => libigl}/igl/opengl/load_shader.cpp (100%) rename src/{ => libigl}/igl/opengl/load_shader.h (100%) rename src/{ => libigl}/igl/opengl/print_program_info_log.cpp (100%) rename src/{ => libigl}/igl/opengl/print_program_info_log.h (100%) rename src/{ => libigl}/igl/opengl/print_shader_info_log.cpp (100%) rename src/{ => libigl}/igl/opengl/print_shader_info_log.h (100%) rename src/{ => libigl}/igl/opengl/report_gl_error.cpp (100%) rename src/{ => libigl}/igl/opengl/report_gl_error.h (100%) rename src/{ => libigl}/igl/opengl/uniform_type_to_string.cpp (100%) rename src/{ => libigl}/igl/opengl/uniform_type_to_string.h (100%) rename src/{ => libigl}/igl/opengl/vertex_array.cpp (100%) rename src/{ => libigl}/igl/opengl/vertex_array.h (100%) rename src/{ => libigl}/igl/opengl2/MouseController.h (100%) rename src/{ => libigl}/igl/opengl2/RotateWidget.h (100%) rename src/{ => libigl}/igl/opengl2/TranslateWidget.h (100%) rename src/{ => libigl}/igl/opengl2/draw_beach_ball.cpp (100%) rename src/{ => libigl}/igl/opengl2/draw_beach_ball.h (100%) rename src/{ => libigl}/igl/opengl2/draw_floor.cpp (100%) rename src/{ => libigl}/igl/opengl2/draw_floor.h (100%) rename src/{ => libigl}/igl/opengl2/draw_mesh.cpp (100%) rename src/{ => libigl}/igl/opengl2/draw_mesh.h (100%) rename src/{ => libigl}/igl/opengl2/draw_point.cpp (100%) rename src/{ => libigl}/igl/opengl2/draw_point.h (100%) rename src/{ => libigl}/igl/opengl2/draw_rectangular_marquee.cpp (100%) rename src/{ => libigl}/igl/opengl2/draw_rectangular_marquee.h (100%) rename src/{ => libigl}/igl/opengl2/draw_skeleton_3d.cpp (100%) rename src/{ => libigl}/igl/opengl2/draw_skeleton_3d.h (100%) rename src/{ => libigl}/igl/opengl2/draw_skeleton_vector_graphics.cpp (100%) rename src/{ => libigl}/igl/opengl2/draw_skeleton_vector_graphics.h (100%) rename src/{ => libigl}/igl/opengl2/flare_textures.h (100%) rename src/{ => libigl}/igl/opengl2/gl.h (100%) rename src/{ => libigl}/igl/opengl2/glext.h (100%) rename src/{ => libigl}/igl/opengl2/glu.h (100%) rename src/{ => libigl}/igl/opengl2/lens_flare.cpp (100%) rename src/{ => libigl}/igl/opengl2/lens_flare.h (100%) rename src/{ => libigl}/igl/opengl2/model_proj_viewport.cpp (100%) rename src/{ => libigl}/igl/opengl2/model_proj_viewport.h (100%) rename src/{ => libigl}/igl/opengl2/print_gl_get.cpp (100%) rename src/{ => libigl}/igl/opengl2/print_gl_get.h (100%) rename src/{ => libigl}/igl/opengl2/project.cpp (100%) rename src/{ => libigl}/igl/opengl2/project.h (100%) rename src/{ => libigl}/igl/opengl2/right_axis.cpp (100%) rename src/{ => libigl}/igl/opengl2/right_axis.h (100%) rename src/{ => libigl}/igl/opengl2/shine_textures.h (100%) rename src/{ => libigl}/igl/opengl2/sort_triangles.cpp (100%) rename src/{ => libigl}/igl/opengl2/sort_triangles.h (100%) rename src/{ => libigl}/igl/opengl2/unproject.cpp (100%) rename src/{ => libigl}/igl/opengl2/unproject.h (100%) rename src/{ => libigl}/igl/opengl2/unproject_to_zero_plane.cpp (100%) rename src/{ => libigl}/igl/opengl2/unproject_to_zero_plane.h (100%) rename src/{ => libigl}/igl/opengl2/up_axis.cpp (100%) rename src/{ => libigl}/igl/opengl2/up_axis.h (100%) rename src/{ => libigl}/igl/opengl2/view_axis.cpp (100%) rename src/{ => libigl}/igl/opengl2/view_axis.h (100%) rename src/{ => libigl}/igl/orient_outward.cpp (100%) rename src/{ => libigl}/igl/orient_outward.h (100%) rename src/{ => libigl}/igl/orientable_patches.cpp (100%) rename src/{ => libigl}/igl/orientable_patches.h (100%) rename src/{ => libigl}/igl/oriented_facets.cpp (100%) rename src/{ => libigl}/igl/oriented_facets.h (100%) rename src/{ => libigl}/igl/orth.cpp (100%) rename src/{ => libigl}/igl/orth.h (100%) rename src/{ => libigl}/igl/ortho.cpp (100%) rename src/{ => libigl}/igl/ortho.h (100%) rename src/{ => libigl}/igl/outer_element.cpp (100%) rename src/{ => libigl}/igl/outer_element.h (100%) rename src/{ => libigl}/igl/parallel_for.h (100%) rename src/{ => libigl}/igl/parallel_transport_angles.cpp (100%) rename src/{ => libigl}/igl/parallel_transport_angles.h (100%) rename src/{ => libigl}/igl/partition.cpp (100%) rename src/{ => libigl}/igl/partition.h (100%) rename src/{ => libigl}/igl/parula.cpp (100%) rename src/{ => libigl}/igl/parula.h (100%) rename src/{ => libigl}/igl/path_to_executable.cpp (100%) rename src/{ => libigl}/igl/path_to_executable.h (100%) rename src/{ => libigl}/igl/pathinfo.cpp (100%) rename src/{ => libigl}/igl/pathinfo.h (100%) rename src/{ => libigl}/igl/per_corner_normals.cpp (100%) rename src/{ => libigl}/igl/per_corner_normals.h (100%) rename src/{ => libigl}/igl/per_edge_normals.cpp (100%) rename src/{ => libigl}/igl/per_edge_normals.h (100%) rename src/{ => libigl}/igl/per_face_normals.cpp (100%) rename src/{ => libigl}/igl/per_face_normals.h (100%) rename src/{ => libigl}/igl/per_vertex_attribute_smoothing.cpp (100%) rename src/{ => libigl}/igl/per_vertex_attribute_smoothing.h (100%) rename src/{ => libigl}/igl/per_vertex_normals.cpp (100%) rename src/{ => libigl}/igl/per_vertex_normals.h (100%) rename src/{ => libigl}/igl/per_vertex_point_to_plane_quadrics.cpp (100%) rename src/{ => libigl}/igl/per_vertex_point_to_plane_quadrics.h (100%) rename src/{ => libigl}/igl/piecewise_constant_winding_number.cpp (100%) rename src/{ => libigl}/igl/piecewise_constant_winding_number.h (100%) rename src/{ => libigl}/igl/pinv.cpp (100%) rename src/{ => libigl}/igl/pinv.h (100%) rename src/{ => libigl}/igl/planarize_quad_mesh.cpp (100%) rename src/{ => libigl}/igl/planarize_quad_mesh.h (100%) rename src/{ => libigl}/igl/ply.h (100%) rename src/{ => libigl}/igl/png/readPNG.cpp (100%) rename src/{ => libigl}/igl/png/readPNG.h (100%) rename src/{ => libigl}/igl/png/render_to_png.cpp (100%) rename src/{ => libigl}/igl/png/render_to_png.h (100%) rename src/{ => libigl}/igl/png/render_to_png_async.cpp (100%) rename src/{ => libigl}/igl/png/render_to_png_async.h (100%) rename src/{ => libigl}/igl/png/texture_from_file.cpp (100%) rename src/{ => libigl}/igl/png/texture_from_file.h (100%) rename src/{ => libigl}/igl/png/texture_from_png.cpp (100%) rename src/{ => libigl}/igl/png/texture_from_png.h (100%) rename src/{ => libigl}/igl/png/writePNG.cpp (100%) rename src/{ => libigl}/igl/png/writePNG.h (100%) rename src/{ => libigl}/igl/point_in_circle.cpp (100%) rename src/{ => libigl}/igl/point_in_circle.h (100%) rename src/{ => libigl}/igl/point_in_poly.cpp (100%) rename src/{ => libigl}/igl/point_in_poly.h (100%) rename src/{ => libigl}/igl/point_mesh_squared_distance.cpp (100%) rename src/{ => libigl}/igl/point_mesh_squared_distance.h (100%) rename src/{ => libigl}/igl/point_simplex_squared_distance.cpp (100%) rename src/{ => libigl}/igl/point_simplex_squared_distance.h (100%) rename src/{ => libigl}/igl/polar_dec.cpp (100%) rename src/{ => libigl}/igl/polar_dec.h (100%) rename src/{ => libigl}/igl/polar_svd.cpp (100%) rename src/{ => libigl}/igl/polar_svd.h (100%) rename src/{ => libigl}/igl/polar_svd3x3.cpp (100%) rename src/{ => libigl}/igl/polar_svd3x3.h (100%) rename src/{ => libigl}/igl/polygon_mesh_to_triangle_mesh.cpp (100%) rename src/{ => libigl}/igl/polygon_mesh_to_triangle_mesh.h (100%) rename src/{ => libigl}/igl/principal_curvature.cpp (100%) rename src/{ => libigl}/igl/principal_curvature.h (100%) rename src/{ => libigl}/igl/print_ijv.cpp (100%) rename src/{ => libigl}/igl/print_ijv.h (100%) rename src/{ => libigl}/igl/print_vector.cpp (100%) rename src/{ => libigl}/igl/print_vector.h (100%) rename src/{ => libigl}/igl/procrustes.cpp (100%) rename src/{ => libigl}/igl/procrustes.h (100%) rename src/{ => libigl}/igl/project.cpp (100%) rename src/{ => libigl}/igl/project.h (100%) rename src/{ => libigl}/igl/project_isometrically_to_plane.cpp (100%) rename src/{ => libigl}/igl/project_isometrically_to_plane.h (100%) rename src/{ => libigl}/igl/project_to_line.cpp (100%) rename src/{ => libigl}/igl/project_to_line.h (100%) rename src/{ => libigl}/igl/project_to_line_segment.cpp (100%) rename src/{ => libigl}/igl/project_to_line_segment.h (100%) rename src/{ => libigl}/igl/pseudonormal_test.cpp (100%) rename src/{ => libigl}/igl/pseudonormal_test.h (100%) rename src/{ => libigl}/igl/pso.cpp (100%) rename src/{ => libigl}/igl/pso.h (100%) rename src/{ => libigl}/igl/qslim.cpp (100%) rename src/{ => libigl}/igl/qslim.h (100%) rename src/{ => libigl}/igl/qslim_optimal_collapse_edge_callbacks.cpp (100%) rename src/{ => libigl}/igl/qslim_optimal_collapse_edge_callbacks.h (100%) rename src/{ => libigl}/igl/quad_planarity.cpp (100%) rename src/{ => libigl}/igl/quad_planarity.h (100%) rename src/{ => libigl}/igl/quadric_binary_plus_operator.cpp (100%) rename src/{ => libigl}/igl/quadric_binary_plus_operator.h (100%) rename src/{ => libigl}/igl/quat_conjugate.cpp (100%) rename src/{ => libigl}/igl/quat_conjugate.h (100%) rename src/{ => libigl}/igl/quat_mult.cpp (100%) rename src/{ => libigl}/igl/quat_mult.h (100%) rename src/{ => libigl}/igl/quat_to_axis_angle.cpp (100%) rename src/{ => libigl}/igl/quat_to_axis_angle.h (100%) rename src/{ => libigl}/igl/quat_to_mat.cpp (100%) rename src/{ => libigl}/igl/quat_to_mat.h (100%) rename src/{ => libigl}/igl/quats_to_column.cpp (100%) rename src/{ => libigl}/igl/quats_to_column.h (100%) rename src/{ => libigl}/igl/ramer_douglas_peucker.cpp (100%) rename src/{ => libigl}/igl/ramer_douglas_peucker.h (100%) rename src/{ => libigl}/igl/random_dir.cpp (100%) rename src/{ => libigl}/igl/random_dir.h (100%) rename src/{ => libigl}/igl/random_points_on_mesh.cpp (100%) rename src/{ => libigl}/igl/random_points_on_mesh.h (100%) rename src/{ => libigl}/igl/random_quaternion.cpp (100%) rename src/{ => libigl}/igl/random_quaternion.h (100%) rename src/{ => libigl}/igl/random_search.cpp (100%) rename src/{ => libigl}/igl/random_search.h (100%) rename src/{ => libigl}/igl/randperm.cpp (100%) rename src/{ => libigl}/igl/randperm.h (100%) rename src/{ => libigl}/igl/ray_box_intersect.cpp (100%) rename src/{ => libigl}/igl/ray_box_intersect.h (100%) rename src/{ => libigl}/igl/ray_mesh_intersect.cpp (100%) rename src/{ => libigl}/igl/ray_mesh_intersect.h (100%) rename src/{ => libigl}/igl/ray_sphere_intersect.cpp (100%) rename src/{ => libigl}/igl/ray_sphere_intersect.h (100%) rename src/{ => libigl}/igl/raytri.c (100%) rename src/{ => libigl}/igl/readBF.cpp (100%) rename src/{ => libigl}/igl/readBF.h (100%) rename src/{ => libigl}/igl/readCSV.cpp (100%) rename src/{ => libigl}/igl/readCSV.h (100%) rename src/{ => libigl}/igl/readDMAT.cpp (100%) rename src/{ => libigl}/igl/readDMAT.h (100%) rename src/{ => libigl}/igl/readMESH.cpp (100%) rename src/{ => libigl}/igl/readMESH.h (100%) rename src/{ => libigl}/igl/readMSH.cpp (100%) rename src/{ => libigl}/igl/readMSH.h (100%) rename src/{ => libigl}/igl/readNODE.cpp (100%) rename src/{ => libigl}/igl/readNODE.h (100%) rename src/{ => libigl}/igl/readOBJ.cpp (100%) rename src/{ => libigl}/igl/readOBJ.h (100%) rename src/{ => libigl}/igl/readOFF.cpp (100%) rename src/{ => libigl}/igl/readOFF.h (100%) rename src/{ => libigl}/igl/readPLY.cpp (100%) rename src/{ => libigl}/igl/readPLY.h (100%) rename src/{ => libigl}/igl/readSTL.cpp (100%) rename src/{ => libigl}/igl/readSTL.h (100%) rename src/{ => libigl}/igl/readTGF.cpp (100%) rename src/{ => libigl}/igl/readTGF.h (100%) rename src/{ => libigl}/igl/readWRL.cpp (100%) rename src/{ => libigl}/igl/readWRL.h (100%) rename src/{ => libigl}/igl/read_triangle_mesh.cpp (100%) rename src/{ => libigl}/igl/read_triangle_mesh.h (100%) rename src/{ => libigl}/igl/redux.h (100%) rename src/{ => libigl}/igl/remesh_along_isoline.cpp (100%) rename src/{ => libigl}/igl/remesh_along_isoline.h (100%) rename src/{ => libigl}/igl/remove_duplicate_vertices.cpp (100%) rename src/{ => libigl}/igl/remove_duplicate_vertices.h (100%) rename src/{ => libigl}/igl/remove_duplicates.cpp (100%) rename src/{ => libigl}/igl/remove_duplicates.h (100%) rename src/{ => libigl}/igl/remove_unreferenced.cpp (100%) rename src/{ => libigl}/igl/remove_unreferenced.h (100%) rename src/{ => libigl}/igl/reorder.cpp (100%) rename src/{ => libigl}/igl/reorder.h (100%) rename src/{ => libigl}/igl/repdiag.cpp (100%) rename src/{ => libigl}/igl/repdiag.h (100%) rename src/{ => libigl}/igl/repmat.cpp (100%) rename src/{ => libigl}/igl/repmat.h (100%) rename src/{ => libigl}/igl/resolve_duplicated_faces.cpp (100%) rename src/{ => libigl}/igl/resolve_duplicated_faces.h (100%) rename src/{ => libigl}/igl/rgb_to_hsv.cpp (100%) rename src/{ => libigl}/igl/rgb_to_hsv.h (100%) rename src/{ => libigl}/igl/rotate_by_quat.cpp (100%) rename src/{ => libigl}/igl/rotate_by_quat.h (100%) rename src/{ => libigl}/igl/rotate_vectors.cpp (100%) rename src/{ => libigl}/igl/rotate_vectors.h (100%) rename src/{ => libigl}/igl/rotation_matrix_from_directions.cpp (100%) rename src/{ => libigl}/igl/rotation_matrix_from_directions.h (100%) rename src/{ => libigl}/igl/round.cpp (100%) rename src/{ => libigl}/igl/round.h (100%) rename src/{ => libigl}/igl/rows_to_matrix.cpp (100%) rename src/{ => libigl}/igl/rows_to_matrix.h (100%) rename src/{ => libigl}/igl/sample_edges.cpp (100%) rename src/{ => libigl}/igl/sample_edges.h (100%) rename src/{ => libigl}/igl/seam_edges.cpp (100%) rename src/{ => libigl}/igl/seam_edges.h (100%) rename src/{ => libigl}/igl/segment_segment_intersect.cpp (100%) rename src/{ => libigl}/igl/segment_segment_intersect.h (100%) rename src/{ => libigl}/igl/serialize.h (100%) rename src/{ => libigl}/igl/setdiff.cpp (100%) rename src/{ => libigl}/igl/setdiff.h (100%) rename src/{ => libigl}/igl/setunion.cpp (100%) rename src/{ => libigl}/igl/setunion.h (100%) rename src/{ => libigl}/igl/setxor.cpp (100%) rename src/{ => libigl}/igl/setxor.h (100%) rename src/{ => libigl}/igl/shape_diameter_function.cpp (100%) rename src/{ => libigl}/igl/shape_diameter_function.h (100%) rename src/{ => libigl}/igl/shapeup.cpp (100%) rename src/{ => libigl}/igl/shapeup.h (100%) rename src/{ => libigl}/igl/shortest_edge_and_midpoint.cpp (100%) rename src/{ => libigl}/igl/shortest_edge_and_midpoint.h (100%) rename src/{ => libigl}/igl/signed_angle.cpp (100%) rename src/{ => libigl}/igl/signed_angle.h (100%) rename src/{ => libigl}/igl/signed_distance.cpp (100%) rename src/{ => libigl}/igl/signed_distance.h (100%) rename src/{ => libigl}/igl/simplify_polyhedron.cpp (100%) rename src/{ => libigl}/igl/simplify_polyhedron.h (100%) rename src/{ => libigl}/igl/slice.cpp (100%) rename src/{ => libigl}/igl/slice.h (100%) rename src/{ => libigl}/igl/slice_cached.cpp (100%) rename src/{ => libigl}/igl/slice_cached.h (100%) rename src/{ => libigl}/igl/slice_into.cpp (100%) rename src/{ => libigl}/igl/slice_into.h (100%) rename src/{ => libigl}/igl/slice_mask.cpp (100%) rename src/{ => libigl}/igl/slice_mask.h (100%) rename src/{ => libigl}/igl/slice_tets.cpp (100%) rename src/{ => libigl}/igl/slice_tets.h (100%) rename src/{ => libigl}/igl/slim.cpp (100%) rename src/{ => libigl}/igl/slim.h (100%) rename src/{ => libigl}/igl/snap_points.cpp (100%) rename src/{ => libigl}/igl/snap_points.h (100%) rename src/{ => libigl}/igl/snap_to_canonical_view_quat.cpp (100%) rename src/{ => libigl}/igl/snap_to_canonical_view_quat.h (100%) rename src/{ => libigl}/igl/snap_to_fixed_up.cpp (100%) rename src/{ => libigl}/igl/snap_to_fixed_up.h (100%) rename src/{ => libigl}/igl/solid_angle.cpp (100%) rename src/{ => libigl}/igl/solid_angle.h (100%) rename src/{ => libigl}/igl/sort.cpp (100%) rename src/{ => libigl}/igl/sort.h (100%) rename src/{ => libigl}/igl/sort_angles.cpp (100%) rename src/{ => libigl}/igl/sort_angles.h (100%) rename src/{ => libigl}/igl/sort_triangles.cpp (100%) rename src/{ => libigl}/igl/sort_triangles.h (100%) rename src/{ => libigl}/igl/sort_vectors_ccw.cpp (100%) rename src/{ => libigl}/igl/sort_vectors_ccw.h (100%) rename src/{ => libigl}/igl/sortrows.cpp (100%) rename src/{ => libigl}/igl/sortrows.h (100%) rename src/{ => libigl}/igl/sparse.cpp (100%) rename src/{ => libigl}/igl/sparse.h (100%) rename src/{ => libigl}/igl/sparse_cached.cpp (100%) rename src/{ => libigl}/igl/sparse_cached.h (100%) rename src/{ => libigl}/igl/speye.cpp (100%) rename src/{ => libigl}/igl/speye.h (100%) rename src/{ => libigl}/igl/squared_edge_lengths.cpp (100%) rename src/{ => libigl}/igl/squared_edge_lengths.h (100%) rename src/{ => libigl}/igl/stdin_to_temp.cpp (100%) rename src/{ => libigl}/igl/stdin_to_temp.h (100%) rename src/{ => libigl}/igl/straighten_seams.cpp (100%) rename src/{ => libigl}/igl/straighten_seams.h (100%) rename src/{ => libigl}/igl/sum.cpp (100%) rename src/{ => libigl}/igl/sum.h (100%) rename src/{ => libigl}/igl/svd3x3.cpp (100%) rename src/{ => libigl}/igl/svd3x3.h (100%) rename src/{ => libigl}/igl/svd3x3_avx.cpp (100%) rename src/{ => libigl}/igl/svd3x3_avx.h (100%) rename src/{ => libigl}/igl/svd3x3_sse.cpp (100%) rename src/{ => libigl}/igl/svd3x3_sse.h (100%) rename src/{ => libigl}/igl/swept_volume_bounding_box.cpp (100%) rename src/{ => libigl}/igl/swept_volume_bounding_box.h (100%) rename src/{ => libigl}/igl/swept_volume_signed_distance.cpp (100%) rename src/{ => libigl}/igl/swept_volume_signed_distance.h (100%) rename src/{ => libigl}/igl/trackball.cpp (100%) rename src/{ => libigl}/igl/trackball.h (100%) rename src/{ => libigl}/igl/transpose_blocks.cpp (100%) rename src/{ => libigl}/igl/transpose_blocks.h (100%) rename src/{ => libigl}/igl/triangle/cdt.cpp (100%) rename src/{ => libigl}/igl/triangle/cdt.h (100%) rename src/{ => libigl}/igl/triangle/triangulate.cpp (100%) rename src/{ => libigl}/igl/triangle/triangulate.h (100%) rename src/{ => libigl}/igl/triangle_fan.cpp (100%) rename src/{ => libigl}/igl/triangle_fan.h (100%) rename src/{ => libigl}/igl/triangle_triangle_adjacency.cpp (100%) rename src/{ => libigl}/igl/triangle_triangle_adjacency.h (100%) rename src/{ => libigl}/igl/triangles_from_strip.cpp (100%) rename src/{ => libigl}/igl/triangles_from_strip.h (100%) rename src/{ => libigl}/igl/two_axis_valuator_fixed_up.cpp (100%) rename src/{ => libigl}/igl/two_axis_valuator_fixed_up.h (100%) rename src/{ => libigl}/igl/uniformly_sample_two_manifold.cpp (100%) rename src/{ => libigl}/igl/uniformly_sample_two_manifold.h (100%) rename src/{ => libigl}/igl/unique.cpp (100%) rename src/{ => libigl}/igl/unique.h (100%) rename src/{ => libigl}/igl/unique_edge_map.cpp (100%) rename src/{ => libigl}/igl/unique_edge_map.h (100%) rename src/{ => libigl}/igl/unique_rows.cpp (100%) rename src/{ => libigl}/igl/unique_rows.h (100%) rename src/{ => libigl}/igl/unique_simplices.cpp (100%) rename src/{ => libigl}/igl/unique_simplices.h (100%) rename src/{ => libigl}/igl/unproject.cpp (100%) rename src/{ => libigl}/igl/unproject.h (100%) rename src/{ => libigl}/igl/unproject_in_mesh.cpp (100%) rename src/{ => libigl}/igl/unproject_in_mesh.h (100%) rename src/{ => libigl}/igl/unproject_onto_mesh.cpp (100%) rename src/{ => libigl}/igl/unproject_onto_mesh.h (100%) rename src/{ => libigl}/igl/unproject_ray.cpp (100%) rename src/{ => libigl}/igl/unproject_ray.h (100%) rename src/{ => libigl}/igl/unzip_corners.cpp (100%) rename src/{ => libigl}/igl/unzip_corners.h (100%) rename src/{ => libigl}/igl/upsample.cpp (100%) rename src/{ => libigl}/igl/upsample.h (100%) rename src/{ => libigl}/igl/vector_area_matrix.cpp (100%) rename src/{ => libigl}/igl/vector_area_matrix.h (100%) rename src/{ => libigl}/igl/verbose.h (100%) rename src/{ => libigl}/igl/vertex_triangle_adjacency.cpp (100%) rename src/{ => libigl}/igl/vertex_triangle_adjacency.h (100%) rename src/{ => libigl}/igl/volume.cpp (100%) rename src/{ => libigl}/igl/volume.h (100%) rename src/{ => libigl}/igl/voxel_grid.cpp (100%) rename src/{ => libigl}/igl/voxel_grid.h (100%) rename src/{ => libigl}/igl/winding_number.cpp (100%) rename src/{ => libigl}/igl/winding_number.h (100%) rename src/{ => libigl}/igl/writeBF.cpp (100%) rename src/{ => libigl}/igl/writeBF.h (100%) rename src/{ => libigl}/igl/writeDMAT.cpp (100%) rename src/{ => libigl}/igl/writeDMAT.h (100%) rename src/{ => libigl}/igl/writeMESH.cpp (100%) rename src/{ => libigl}/igl/writeMESH.h (100%) rename src/{ => libigl}/igl/writeOBJ.cpp (100%) rename src/{ => libigl}/igl/writeOBJ.h (100%) rename src/{ => libigl}/igl/writeOFF.cpp (100%) rename src/{ => libigl}/igl/writeOFF.h (100%) rename src/{ => libigl}/igl/writePLY.cpp (100%) rename src/{ => libigl}/igl/writePLY.h (100%) rename src/{ => libigl}/igl/writeSTL.cpp (100%) rename src/{ => libigl}/igl/writeSTL.h (100%) rename src/{ => libigl}/igl/writeTGF.cpp (100%) rename src/{ => libigl}/igl/writeTGF.h (100%) rename src/{ => libigl}/igl/writeWRL.cpp (100%) rename src/{ => libigl}/igl/writeWRL.h (100%) rename src/{ => libigl}/igl/write_triangle_mesh.cpp (100%) rename src/{ => libigl}/igl/write_triangle_mesh.h (100%) rename src/{ => libigl}/igl/xml/ReAntTweakBarXMLSerialization.h (100%) rename src/{ => libigl}/igl/xml/XMLSerializable.h (100%) rename src/{ => libigl}/igl/xml/serialization_test.skip (100%) rename src/{ => libigl}/igl/xml/serialize_xml.cpp (100%) rename src/{ => libigl}/igl/xml/serialize_xml.h (100%) rename src/{ => libigl}/igl/xml/writeDAE.cpp (100%) rename src/{ => libigl}/igl/xml/writeDAE.h (100%) rename src/{ => libigl}/igl/xml/write_triangle_mesh.cpp (100%) rename src/{ => libigl}/igl/xml/write_triangle_mesh.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index b2fc12c480..ba264c8c36 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,8 +89,6 @@ enable_testing () # Enable C++11 language standard. set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_C_STANDARD 11) -set(CMAKE_C_STANDARD_REQUIRED ON) if(NOT WIN32) # Add DEBUG flags to debug builds. @@ -172,7 +170,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STRE add_compile_options(-Werror=return-type) #removes LOTS of extraneous Eigen warnings - add_compile_options(-Wno-ignored-attributes) + # add_compile_options(-Wno-ignored-attributes) # Tamas: Eigen include dirs are marked as SYSTEM if (SLIC3R_ASAN) add_compile_options(-fsanitize=address -fno-omit-frame-pointer) @@ -314,7 +312,7 @@ if (NOT Eigen3_FOUND) set(Eigen3_FOUND 1) set(EIGEN3_INCLUDE_DIR ${LIBDIR}/eigen/) endif () -include_directories(${EIGEN3_INCLUDE_DIR}) +include_directories(BEFORE SYSTEM ${EIGEN3_INCLUDE_DIR}) # Find expat or use bundled version # Always use the system libexpat on Linux. diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index ca4e63fbc1..c98941b5af 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -35,6 +35,7 @@ set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination direct option(DEP_DEBUG "Build debug variants (only applicable on Windows)" ON) option(DEP_WX_STABLE "Build against wxWidgets stable 3.0 as opposed to default 3.1 (Linux only)" OFF) +option(DEP_BUILD_IGL_STATIC "Build IGL as a static library. Might cause link errors." OFF) message(STATUS "PrusaSlicer deps DESTDIR: ${DESTDIR}") message(STATUS "PrusaSlicer deps debug build: ${DEP_DEBUG}") @@ -99,6 +100,7 @@ else() dep_gtest dep_nlopt dep_qhull + dep_libigl ) endif() diff --git a/deps/deps-unix-common.cmake b/deps/deps-unix-common.cmake index d6a92efcb3..c44a6ec205 100644 --- a/deps/deps-unix-common.cmake +++ b/deps/deps-unix-common.cmake @@ -32,7 +32,6 @@ ExternalProject_Add(dep_nlopt -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local ${DEP_CMAKE_OPTS} ) - find_package(Git REQUIRED) ExternalProject_Add(dep_qhull @@ -45,3 +44,32 @@ ExternalProject_Add(dep_qhull ${DEP_CMAKE_OPTS} PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/qhull-mods.patch ) + +ExternalProject_Add(dep_libigl + EXCLUDE_FROM_ALL 1 + URL "https://github.com/libigl/libigl/archive/v2.0.0.tar.gz" + URL_HASH SHA256=42518e6b106c7209c73435fd260ed5d34edeb254852495b4c95dce2d95401328 + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local + -DLIBIGL_BUILD_PYTHON=OFF + -DLIBIGL_BUILD_TESTS=OFF + -DLIBIGL_BUILD_TUTORIALS=OFF + -DLIBIGL_USE_STATIC_LIBRARY=${DEP_BUILD_IGL_STATIC} + -DLIBIGL_WITHOUT_COPYLEFT=OFF + -DLIBIGL_WITH_CGAL=OFF + -DLIBIGL_WITH_COMISO=OFF + -DLIBIGL_WITH_CORK=OFF + -DLIBIGL_WITH_EMBREE=OFF + -DLIBIGL_WITH_MATLAB=OFF + -DLIBIGL_WITH_MOSEK=OFF + -DLIBIGL_WITH_OPENGL=OFF + -DLIBIGL_WITH_OPENGL_GLFW=OFF + -DLIBIGL_WITH_OPENGL_GLFW_IMGUI=OFF + -DLIBIGL_WITH_PNG=OFF + -DLIBIGL_WITH_PYTHON=OFF + -DLIBIGL_WITH_TETGEN=OFF + -DLIBIGL_WITH_TRIANGLE=OFF + -DLIBIGL_WITH_XML=OFF + PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/igl-fixes.patch +) + diff --git a/deps/deps-windows.cmake b/deps/deps-windows.cmake index 041160f407..d7daf84253 100644 --- a/deps/deps-windows.cmake +++ b/deps/deps-windows.cmake @@ -252,6 +252,51 @@ else () set(DEP_WXWIDGETS_LIBDIR "vc_x64_lib") endif () +find_package(Git REQUIRED) + +ExternalProject_Add(dep_libigl + EXCLUDE_FROM_ALL 1 + URL "https://github.com/libigl/libigl/archive/v2.0.0.tar.gz" + URL_HASH SHA256=42518e6b106c7209c73435fd260ed5d34edeb254852495b4c95dce2d95401328 + CMAKE_GENERATOR "${DEP_MSVC_GEN}" + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local + -DLIBIGL_BUILD_PYTHON=OFF + -DLIBIGL_BUILD_TESTS=OFF + -DLIBIGL_BUILD_TUTORIALS=OFF + -DLIBIGL_USE_STATIC_LIBRARY=${DEP_BUILD_IGL_STATIC} + -DLIBIGL_WITHOUT_COPYLEFT=OFF + -DLIBIGL_WITH_CGAL=OFF + -DLIBIGL_WITH_COMISO=OFF + -DLIBIGL_WITH_CORK=OFF + -DLIBIGL_WITH_EMBREE=OFF + -DLIBIGL_WITH_MATLAB=OFF + -DLIBIGL_WITH_MOSEK=OFF + -DLIBIGL_WITH_OPENGL=OFF + -DLIBIGL_WITH_OPENGL_GLFW=OFF + -DLIBIGL_WITH_OPENGL_GLFW_IMGUI=OFF + -DLIBIGL_WITH_PNG=OFF + -DLIBIGL_WITH_PYTHON=OFF + -DLIBIGL_WITH_TETGEN=OFF + -DLIBIGL_WITH_TRIANGLE=OFF + -DLIBIGL_WITH_XML=OFF + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + -DCMAKE_DEBUG_POSTFIX=d + PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/igl-fixes.patch + BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj + INSTALL_COMMAND "" +) + +if (${DEP_DEBUG}) + ExternalProject_Get_Property(dep_libigl BINARY_DIR) + ExternalProject_Add_Step(dep_libigl build_debug + DEPENDEES build + DEPENDERS install + COMMAND msbuild /m /P:Configuration=Debug INSTALL.vcxproj + WORKING_DIRECTORY "${BINARY_DIR}" + ) +endif () + ExternalProject_Add(dep_wxwidgets EXCLUDE_FROM_ALL 1 GIT_REPOSITORY "https://github.com/prusa3d/wxWidgets" diff --git a/deps/igl-fixes.patch b/deps/igl-fixes.patch new file mode 100644 index 0000000000..2b50e200b9 --- /dev/null +++ b/deps/igl-fixes.patch @@ -0,0 +1,87 @@ +diff --git a/cmake/libigl-config.cmake.in b/cmake/libigl-config.cmake.in +index 317c745c..f9808e1e 100644 +--- a/cmake/libigl-config.cmake.in ++++ b/cmake/libigl-config.cmake.in +@@ -2,28 +2,28 @@ + + include(${CMAKE_CURRENT_LIST_DIR}/libigl-export.cmake) + +-if (TARGET igl::core) +- if (NOT TARGET Eigen3::Eigen) +- find_package(Eigen3 QUIET) +- if (NOT Eigen3_FOUND) +- # try with PkgCOnfig +- find_package(PkgConfig REQUIRED) +- pkg_check_modules(Eigen3 QUIET IMPORTED_TARGET eigen3) +- endif() +- +- if (NOT Eigen3_FOUND) +- message(FATAL_ERROR "Could not find required dependency Eigen3") +- set(libigl_core_FOUND FALSE) +- else() +- target_link_libraries(igl::core INTERFACE PkgConfig::Eigen3) +- set(libigl_core_FOUND TRUE) +- endif() +- else() +- target_link_libraries(igl::core INTERFACE Eigen3::Eigen) +- set(libigl_core_FOUND TRUE) +- endif() +- +-endif() ++# if (TARGET igl::core) ++# if (NOT TARGET Eigen3::Eigen) ++# find_package(Eigen3 QUIET) ++# if (NOT Eigen3_FOUND) ++# # try with PkgCOnfig ++# find_package(PkgConfig REQUIRED) ++# pkg_check_modules(Eigen3 QUIET IMPORTED_TARGET eigen3) ++# endif() ++# ++# if (NOT Eigen3_FOUND) ++# message(FATAL_ERROR "Could not find required dependency Eigen3") ++# set(libigl_core_FOUND FALSE) ++# else() ++# target_link_libraries(igl::core INTERFACE PkgConfig::Eigen3) ++# set(libigl_core_FOUND TRUE) ++# endif() ++# else() ++# target_link_libraries(igl::core INTERFACE Eigen3::Eigen) ++# set(libigl_core_FOUND TRUE) ++# endif() ++# ++# endif() + + check_required_components(libigl) + +diff --git a/cmake/libigl.cmake b/cmake/libigl.cmake +index 4b11007a..47e6c395 100644 +--- a/cmake/libigl.cmake ++++ b/cmake/libigl.cmake +@@ -445,6 +445,7 @@ function(install_dir_files dir_name) + if(NOT LIBIGL_USE_STATIC_LIBRARY) + file(GLOB public_sources + ${CMAKE_CURRENT_SOURCE_DIR}/include/igl${subpath}/*.cpp ++ ${CMAKE_CURRENT_SOURCE_DIR}/include/igl${subpath}/*.c + ) + endif() + list(APPEND files_to_install ${public_sources}) +diff --git a/include/igl/AABB.cpp b/include/igl/AABB.cpp +index 09537335..31594314 100644 +--- a/include/igl/AABB.cpp ++++ b/include/igl/AABB.cpp +@@ -1072,4 +1072,5 @@ template void igl::AABB, 3>::init, 2>::init >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&); + template double igl::AABB, 3>::squared_distance >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::Matrix const&, double, int&, Eigen::PlainObjectBase >&) const; + template bool igl::AABB, 3>::intersect_ray >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::Matrix const&, Eigen::Matrix const&, igl::Hit&) const; ++template bool igl::AABB, 3>::intersect_ray >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::Matrix const&, Eigen::Matrix const&, std::vector&) const; + #endif +diff --git a/include/igl/ray_mesh_intersect.cpp b/include/igl/ray_mesh_intersect.cpp +index 9a70a22b..dda1654b 100644 +--- a/include/igl/ray_mesh_intersect.cpp ++++ b/include/igl/ray_mesh_intersect.cpp +@@ -83,4 +83,5 @@ IGL_INLINE bool igl::ray_mesh_intersect( + template bool igl::ray_mesh_intersect, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, std::vector >&); + template bool igl::ray_mesh_intersect, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, igl::Hit&); + template bool igl::ray_mesh_intersect, Eigen::Matrix, Eigen::Matrix, Eigen::Block const, 1, -1, false> >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase const, 1, -1, false> > const&, igl::Hit&); ++template bool igl::ray_mesh_intersect, Eigen::Matrix, Eigen::Matrix, Eigen::Block const, 1, -1, false> >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase const, 1, -1, false> > const&, std::vector >&); + #endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7240634668..61faa05710 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,6 +12,7 @@ add_subdirectory(poly2tri) add_subdirectory(qhull) add_subdirectory(Shiny) add_subdirectory(semver) +add_subdirectory(libigl) # Adding libnest2d project for bin packing... set(LIBNEST2D_UNITTESTS ON CACHE BOOL "Force generating unittests for libnest2d") diff --git a/src/libigl/CMakeLists.txt b/src/libigl/CMakeLists.txt new file mode 100644 index 0000000000..0852fad729 --- /dev/null +++ b/src/libigl/CMakeLists.txt @@ -0,0 +1,14 @@ +project(libigl) +cmake_minimum_required(VERSION 3.0) + +add_library(libigl INTERFACE) + +find_package(libigl QUIET) + +if(libigl_FOUND) + message(STATUS "IGL found, using system version...") + target_link_libraries(libigl INTERFACE igl::core) +else() + message(STATUS "IGL NOT found, using bundled version...") + target_include_directories(libigl INTERFACE SYSTEM ${LIBDIR}/libigl) +endif() diff --git a/src/igl/AABB.cpp b/src/libigl/igl/AABB.cpp similarity index 100% rename from src/igl/AABB.cpp rename to src/libigl/igl/AABB.cpp diff --git a/src/igl/AABB.h b/src/libigl/igl/AABB.h similarity index 100% rename from src/igl/AABB.h rename to src/libigl/igl/AABB.h diff --git a/src/igl/ARAPEnergyType.h b/src/libigl/igl/ARAPEnergyType.h similarity index 100% rename from src/igl/ARAPEnergyType.h rename to src/libigl/igl/ARAPEnergyType.h diff --git a/src/igl/AtA_cached.cpp b/src/libigl/igl/AtA_cached.cpp similarity index 100% rename from src/igl/AtA_cached.cpp rename to src/libigl/igl/AtA_cached.cpp diff --git a/src/igl/AtA_cached.h b/src/libigl/igl/AtA_cached.h similarity index 100% rename from src/igl/AtA_cached.h rename to src/libigl/igl/AtA_cached.h diff --git a/src/igl/C_STR.h b/src/libigl/igl/C_STR.h similarity index 100% rename from src/igl/C_STR.h rename to src/libigl/igl/C_STR.h diff --git a/src/igl/Camera.h b/src/libigl/igl/Camera.h similarity index 100% rename from src/igl/Camera.h rename to src/libigl/igl/Camera.h diff --git a/src/igl/EPS.cpp b/src/libigl/igl/EPS.cpp similarity index 100% rename from src/igl/EPS.cpp rename to src/libigl/igl/EPS.cpp diff --git a/src/igl/EPS.h b/src/libigl/igl/EPS.h similarity index 100% rename from src/igl/EPS.h rename to src/libigl/igl/EPS.h diff --git a/src/igl/HalfEdgeIterator.cpp b/src/libigl/igl/HalfEdgeIterator.cpp similarity index 100% rename from src/igl/HalfEdgeIterator.cpp rename to src/libigl/igl/HalfEdgeIterator.cpp diff --git a/src/igl/HalfEdgeIterator.h b/src/libigl/igl/HalfEdgeIterator.h similarity index 100% rename from src/igl/HalfEdgeIterator.h rename to src/libigl/igl/HalfEdgeIterator.h diff --git a/src/igl/Hit.h b/src/libigl/igl/Hit.h similarity index 100% rename from src/igl/Hit.h rename to src/libigl/igl/Hit.h diff --git a/src/igl/IO b/src/libigl/igl/IO similarity index 100% rename from src/igl/IO rename to src/libigl/igl/IO diff --git a/src/igl/IndexComparison.h b/src/libigl/igl/IndexComparison.h similarity index 100% rename from src/igl/IndexComparison.h rename to src/libigl/igl/IndexComparison.h diff --git a/src/igl/LinSpaced.h b/src/libigl/igl/LinSpaced.h similarity index 100% rename from src/igl/LinSpaced.h rename to src/libigl/igl/LinSpaced.h diff --git a/src/igl/MeshBooleanType.h b/src/libigl/igl/MeshBooleanType.h similarity index 100% rename from src/igl/MeshBooleanType.h rename to src/libigl/igl/MeshBooleanType.h diff --git a/src/igl/NormalType.h b/src/libigl/igl/NormalType.h similarity index 100% rename from src/igl/NormalType.h rename to src/libigl/igl/NormalType.h diff --git a/src/igl/ONE.h b/src/libigl/igl/ONE.h similarity index 100% rename from src/igl/ONE.h rename to src/libigl/igl/ONE.h diff --git a/src/igl/PI.h b/src/libigl/igl/PI.h similarity index 100% rename from src/igl/PI.h rename to src/libigl/igl/PI.h diff --git a/src/igl/REDRUM.h b/src/libigl/igl/REDRUM.h similarity index 100% rename from src/igl/REDRUM.h rename to src/libigl/igl/REDRUM.h diff --git a/src/igl/STR.h b/src/libigl/igl/STR.h similarity index 100% rename from src/igl/STR.h rename to src/libigl/igl/STR.h diff --git a/src/igl/Singular_Value_Decomposition_Givens_QR_Factorization_Kernel.hpp b/src/libigl/igl/Singular_Value_Decomposition_Givens_QR_Factorization_Kernel.hpp similarity index 100% rename from src/igl/Singular_Value_Decomposition_Givens_QR_Factorization_Kernel.hpp rename to src/libigl/igl/Singular_Value_Decomposition_Givens_QR_Factorization_Kernel.hpp diff --git a/src/igl/Singular_Value_Decomposition_Jacobi_Conjugation_Kernel.hpp b/src/libigl/igl/Singular_Value_Decomposition_Jacobi_Conjugation_Kernel.hpp similarity index 100% rename from src/igl/Singular_Value_Decomposition_Jacobi_Conjugation_Kernel.hpp rename to src/libigl/igl/Singular_Value_Decomposition_Jacobi_Conjugation_Kernel.hpp diff --git a/src/igl/Singular_Value_Decomposition_Kernel_Declarations.hpp b/src/libigl/igl/Singular_Value_Decomposition_Kernel_Declarations.hpp similarity index 100% rename from src/igl/Singular_Value_Decomposition_Kernel_Declarations.hpp rename to src/libigl/igl/Singular_Value_Decomposition_Kernel_Declarations.hpp diff --git a/src/igl/Singular_Value_Decomposition_Main_Kernel_Body.hpp b/src/libigl/igl/Singular_Value_Decomposition_Main_Kernel_Body.hpp similarity index 100% rename from src/igl/Singular_Value_Decomposition_Main_Kernel_Body.hpp rename to src/libigl/igl/Singular_Value_Decomposition_Main_Kernel_Body.hpp diff --git a/src/igl/Singular_Value_Decomposition_Preamble.hpp b/src/libigl/igl/Singular_Value_Decomposition_Preamble.hpp similarity index 100% rename from src/igl/Singular_Value_Decomposition_Preamble.hpp rename to src/libigl/igl/Singular_Value_Decomposition_Preamble.hpp diff --git a/src/igl/SolverStatus.h b/src/libigl/igl/SolverStatus.h similarity index 100% rename from src/igl/SolverStatus.h rename to src/libigl/igl/SolverStatus.h diff --git a/src/igl/SortableRow.h b/src/libigl/igl/SortableRow.h similarity index 100% rename from src/igl/SortableRow.h rename to src/libigl/igl/SortableRow.h diff --git a/src/igl/Timer.h b/src/libigl/igl/Timer.h similarity index 100% rename from src/igl/Timer.h rename to src/libigl/igl/Timer.h diff --git a/src/igl/Viewport.h b/src/libigl/igl/Viewport.h similarity index 100% rename from src/igl/Viewport.h rename to src/libigl/igl/Viewport.h diff --git a/src/igl/WindingNumberAABB.h b/src/libigl/igl/WindingNumberAABB.h similarity index 100% rename from src/igl/WindingNumberAABB.h rename to src/libigl/igl/WindingNumberAABB.h diff --git a/src/igl/WindingNumberMethod.h b/src/libigl/igl/WindingNumberMethod.h similarity index 100% rename from src/igl/WindingNumberMethod.h rename to src/libigl/igl/WindingNumberMethod.h diff --git a/src/igl/WindingNumberTree.h b/src/libigl/igl/WindingNumberTree.h similarity index 100% rename from src/igl/WindingNumberTree.h rename to src/libigl/igl/WindingNumberTree.h diff --git a/src/igl/ZERO.h b/src/libigl/igl/ZERO.h similarity index 100% rename from src/igl/ZERO.h rename to src/libigl/igl/ZERO.h diff --git a/src/igl/active_set.cpp b/src/libigl/igl/active_set.cpp similarity index 100% rename from src/igl/active_set.cpp rename to src/libigl/igl/active_set.cpp diff --git a/src/igl/active_set.h b/src/libigl/igl/active_set.h similarity index 100% rename from src/igl/active_set.h rename to src/libigl/igl/active_set.h diff --git a/src/igl/adjacency_list.cpp b/src/libigl/igl/adjacency_list.cpp similarity index 100% rename from src/igl/adjacency_list.cpp rename to src/libigl/igl/adjacency_list.cpp diff --git a/src/igl/adjacency_list.h b/src/libigl/igl/adjacency_list.h similarity index 100% rename from src/igl/adjacency_list.h rename to src/libigl/igl/adjacency_list.h diff --git a/src/igl/adjacency_matrix.cpp b/src/libigl/igl/adjacency_matrix.cpp similarity index 100% rename from src/igl/adjacency_matrix.cpp rename to src/libigl/igl/adjacency_matrix.cpp diff --git a/src/igl/adjacency_matrix.h b/src/libigl/igl/adjacency_matrix.h similarity index 100% rename from src/igl/adjacency_matrix.h rename to src/libigl/igl/adjacency_matrix.h diff --git a/src/igl/all.cpp b/src/libigl/igl/all.cpp similarity index 100% rename from src/igl/all.cpp rename to src/libigl/igl/all.cpp diff --git a/src/igl/all.h b/src/libigl/igl/all.h similarity index 100% rename from src/igl/all.h rename to src/libigl/igl/all.h diff --git a/src/igl/all_edges.cpp b/src/libigl/igl/all_edges.cpp similarity index 100% rename from src/igl/all_edges.cpp rename to src/libigl/igl/all_edges.cpp diff --git a/src/igl/all_edges.h b/src/libigl/igl/all_edges.h similarity index 100% rename from src/igl/all_edges.h rename to src/libigl/igl/all_edges.h diff --git a/src/igl/all_pairs_distances.cpp b/src/libigl/igl/all_pairs_distances.cpp similarity index 100% rename from src/igl/all_pairs_distances.cpp rename to src/libigl/igl/all_pairs_distances.cpp diff --git a/src/igl/all_pairs_distances.h b/src/libigl/igl/all_pairs_distances.h similarity index 100% rename from src/igl/all_pairs_distances.h rename to src/libigl/igl/all_pairs_distances.h diff --git a/src/igl/ambient_occlusion.cpp b/src/libigl/igl/ambient_occlusion.cpp similarity index 100% rename from src/igl/ambient_occlusion.cpp rename to src/libigl/igl/ambient_occlusion.cpp diff --git a/src/igl/ambient_occlusion.h b/src/libigl/igl/ambient_occlusion.h similarity index 100% rename from src/igl/ambient_occlusion.h rename to src/libigl/igl/ambient_occlusion.h diff --git a/src/igl/angular_distance.cpp b/src/libigl/igl/angular_distance.cpp similarity index 100% rename from src/igl/angular_distance.cpp rename to src/libigl/igl/angular_distance.cpp diff --git a/src/igl/angular_distance.h b/src/libigl/igl/angular_distance.h similarity index 100% rename from src/igl/angular_distance.h rename to src/libigl/igl/angular_distance.h diff --git a/src/igl/anttweakbar/ReAntTweakBar.cpp b/src/libigl/igl/anttweakbar/ReAntTweakBar.cpp similarity index 100% rename from src/igl/anttweakbar/ReAntTweakBar.cpp rename to src/libigl/igl/anttweakbar/ReAntTweakBar.cpp diff --git a/src/igl/anttweakbar/ReAntTweakBar.h b/src/libigl/igl/anttweakbar/ReAntTweakBar.h similarity index 100% rename from src/igl/anttweakbar/ReAntTweakBar.h rename to src/libigl/igl/anttweakbar/ReAntTweakBar.h diff --git a/src/igl/anttweakbar/cocoa_key_to_anttweakbar_key.cpp b/src/libigl/igl/anttweakbar/cocoa_key_to_anttweakbar_key.cpp similarity index 100% rename from src/igl/anttweakbar/cocoa_key_to_anttweakbar_key.cpp rename to src/libigl/igl/anttweakbar/cocoa_key_to_anttweakbar_key.cpp diff --git a/src/igl/anttweakbar/cocoa_key_to_anttweakbar_key.h b/src/libigl/igl/anttweakbar/cocoa_key_to_anttweakbar_key.h similarity index 100% rename from src/igl/anttweakbar/cocoa_key_to_anttweakbar_key.h rename to src/libigl/igl/anttweakbar/cocoa_key_to_anttweakbar_key.h diff --git a/src/igl/any.cpp b/src/libigl/igl/any.cpp similarity index 100% rename from src/igl/any.cpp rename to src/libigl/igl/any.cpp diff --git a/src/igl/any.h b/src/libigl/igl/any.h similarity index 100% rename from src/igl/any.h rename to src/libigl/igl/any.h diff --git a/src/igl/any_of.cpp b/src/libigl/igl/any_of.cpp similarity index 100% rename from src/igl/any_of.cpp rename to src/libigl/igl/any_of.cpp diff --git a/src/igl/any_of.h b/src/libigl/igl/any_of.h similarity index 100% rename from src/igl/any_of.h rename to src/libigl/igl/any_of.h diff --git a/src/igl/arap.cpp b/src/libigl/igl/arap.cpp similarity index 100% rename from src/igl/arap.cpp rename to src/libigl/igl/arap.cpp diff --git a/src/igl/arap.h b/src/libigl/igl/arap.h similarity index 100% rename from src/igl/arap.h rename to src/libigl/igl/arap.h diff --git a/src/igl/arap_dof.cpp b/src/libigl/igl/arap_dof.cpp similarity index 100% rename from src/igl/arap_dof.cpp rename to src/libigl/igl/arap_dof.cpp diff --git a/src/igl/arap_dof.h b/src/libigl/igl/arap_dof.h similarity index 100% rename from src/igl/arap_dof.h rename to src/libigl/igl/arap_dof.h diff --git a/src/igl/arap_linear_block.cpp b/src/libigl/igl/arap_linear_block.cpp similarity index 100% rename from src/igl/arap_linear_block.cpp rename to src/libigl/igl/arap_linear_block.cpp diff --git a/src/igl/arap_linear_block.h b/src/libigl/igl/arap_linear_block.h similarity index 100% rename from src/igl/arap_linear_block.h rename to src/libigl/igl/arap_linear_block.h diff --git a/src/igl/arap_rhs.cpp b/src/libigl/igl/arap_rhs.cpp similarity index 100% rename from src/igl/arap_rhs.cpp rename to src/libigl/igl/arap_rhs.cpp diff --git a/src/igl/arap_rhs.h b/src/libigl/igl/arap_rhs.h similarity index 100% rename from src/igl/arap_rhs.h rename to src/libigl/igl/arap_rhs.h diff --git a/src/igl/average_onto_faces.cpp b/src/libigl/igl/average_onto_faces.cpp similarity index 100% rename from src/igl/average_onto_faces.cpp rename to src/libigl/igl/average_onto_faces.cpp diff --git a/src/igl/average_onto_faces.h b/src/libigl/igl/average_onto_faces.h similarity index 100% rename from src/igl/average_onto_faces.h rename to src/libigl/igl/average_onto_faces.h diff --git a/src/igl/average_onto_vertices.cpp b/src/libigl/igl/average_onto_vertices.cpp similarity index 100% rename from src/igl/average_onto_vertices.cpp rename to src/libigl/igl/average_onto_vertices.cpp diff --git a/src/igl/average_onto_vertices.h b/src/libigl/igl/average_onto_vertices.h similarity index 100% rename from src/igl/average_onto_vertices.h rename to src/libigl/igl/average_onto_vertices.h diff --git a/src/igl/avg_edge_length.cpp b/src/libigl/igl/avg_edge_length.cpp similarity index 100% rename from src/igl/avg_edge_length.cpp rename to src/libigl/igl/avg_edge_length.cpp diff --git a/src/igl/avg_edge_length.h b/src/libigl/igl/avg_edge_length.h similarity index 100% rename from src/igl/avg_edge_length.h rename to src/libigl/igl/avg_edge_length.h diff --git a/src/igl/axis_angle_to_quat.cpp b/src/libigl/igl/axis_angle_to_quat.cpp similarity index 100% rename from src/igl/axis_angle_to_quat.cpp rename to src/libigl/igl/axis_angle_to_quat.cpp diff --git a/src/igl/axis_angle_to_quat.h b/src/libigl/igl/axis_angle_to_quat.h similarity index 100% rename from src/igl/axis_angle_to_quat.h rename to src/libigl/igl/axis_angle_to_quat.h diff --git a/src/igl/barycenter.cpp b/src/libigl/igl/barycenter.cpp similarity index 100% rename from src/igl/barycenter.cpp rename to src/libigl/igl/barycenter.cpp diff --git a/src/igl/barycenter.h b/src/libigl/igl/barycenter.h similarity index 100% rename from src/igl/barycenter.h rename to src/libigl/igl/barycenter.h diff --git a/src/igl/barycentric_coordinates.cpp b/src/libigl/igl/barycentric_coordinates.cpp similarity index 100% rename from src/igl/barycentric_coordinates.cpp rename to src/libigl/igl/barycentric_coordinates.cpp diff --git a/src/igl/barycentric_coordinates.h b/src/libigl/igl/barycentric_coordinates.h similarity index 100% rename from src/igl/barycentric_coordinates.h rename to src/libigl/igl/barycentric_coordinates.h diff --git a/src/igl/barycentric_to_global.cpp b/src/libigl/igl/barycentric_to_global.cpp similarity index 100% rename from src/igl/barycentric_to_global.cpp rename to src/libigl/igl/barycentric_to_global.cpp diff --git a/src/igl/barycentric_to_global.h b/src/libigl/igl/barycentric_to_global.h similarity index 100% rename from src/igl/barycentric_to_global.h rename to src/libigl/igl/barycentric_to_global.h diff --git a/src/igl/basename.cpp b/src/libigl/igl/basename.cpp similarity index 100% rename from src/igl/basename.cpp rename to src/libigl/igl/basename.cpp diff --git a/src/igl/basename.h b/src/libigl/igl/basename.h similarity index 100% rename from src/igl/basename.h rename to src/libigl/igl/basename.h diff --git a/src/igl/bbw.cpp b/src/libigl/igl/bbw.cpp similarity index 100% rename from src/igl/bbw.cpp rename to src/libigl/igl/bbw.cpp diff --git a/src/igl/bbw.h b/src/libigl/igl/bbw.h similarity index 100% rename from src/igl/bbw.h rename to src/libigl/igl/bbw.h diff --git a/src/igl/bfs.cpp b/src/libigl/igl/bfs.cpp similarity index 100% rename from src/igl/bfs.cpp rename to src/libigl/igl/bfs.cpp diff --git a/src/igl/bfs.h b/src/libigl/igl/bfs.h similarity index 100% rename from src/igl/bfs.h rename to src/libigl/igl/bfs.h diff --git a/src/igl/bfs_orient.cpp b/src/libigl/igl/bfs_orient.cpp similarity index 100% rename from src/igl/bfs_orient.cpp rename to src/libigl/igl/bfs_orient.cpp diff --git a/src/igl/bfs_orient.h b/src/libigl/igl/bfs_orient.h similarity index 100% rename from src/igl/bfs_orient.h rename to src/libigl/igl/bfs_orient.h diff --git a/src/igl/biharmonic_coordinates.cpp b/src/libigl/igl/biharmonic_coordinates.cpp similarity index 100% rename from src/igl/biharmonic_coordinates.cpp rename to src/libigl/igl/biharmonic_coordinates.cpp diff --git a/src/igl/biharmonic_coordinates.h b/src/libigl/igl/biharmonic_coordinates.h similarity index 100% rename from src/igl/biharmonic_coordinates.h rename to src/libigl/igl/biharmonic_coordinates.h diff --git a/src/igl/bijective_composite_harmonic_mapping.cpp b/src/libigl/igl/bijective_composite_harmonic_mapping.cpp similarity index 100% rename from src/igl/bijective_composite_harmonic_mapping.cpp rename to src/libigl/igl/bijective_composite_harmonic_mapping.cpp diff --git a/src/igl/bijective_composite_harmonic_mapping.h b/src/libigl/igl/bijective_composite_harmonic_mapping.h similarity index 100% rename from src/igl/bijective_composite_harmonic_mapping.h rename to src/libigl/igl/bijective_composite_harmonic_mapping.h diff --git a/src/igl/bone_parents.cpp b/src/libigl/igl/bone_parents.cpp similarity index 100% rename from src/igl/bone_parents.cpp rename to src/libigl/igl/bone_parents.cpp diff --git a/src/igl/bone_parents.h b/src/libigl/igl/bone_parents.h similarity index 100% rename from src/igl/bone_parents.h rename to src/libigl/igl/bone_parents.h diff --git a/src/igl/boundary_conditions.cpp b/src/libigl/igl/boundary_conditions.cpp similarity index 100% rename from src/igl/boundary_conditions.cpp rename to src/libigl/igl/boundary_conditions.cpp diff --git a/src/igl/boundary_conditions.h b/src/libigl/igl/boundary_conditions.h similarity index 100% rename from src/igl/boundary_conditions.h rename to src/libigl/igl/boundary_conditions.h diff --git a/src/igl/boundary_facets.cpp b/src/libigl/igl/boundary_facets.cpp similarity index 100% rename from src/igl/boundary_facets.cpp rename to src/libigl/igl/boundary_facets.cpp diff --git a/src/igl/boundary_facets.h b/src/libigl/igl/boundary_facets.h similarity index 100% rename from src/igl/boundary_facets.h rename to src/libigl/igl/boundary_facets.h diff --git a/src/igl/boundary_loop.cpp b/src/libigl/igl/boundary_loop.cpp similarity index 100% rename from src/igl/boundary_loop.cpp rename to src/libigl/igl/boundary_loop.cpp diff --git a/src/igl/boundary_loop.h b/src/libigl/igl/boundary_loop.h similarity index 100% rename from src/igl/boundary_loop.h rename to src/libigl/igl/boundary_loop.h diff --git a/src/igl/bounding_box.cpp b/src/libigl/igl/bounding_box.cpp similarity index 100% rename from src/igl/bounding_box.cpp rename to src/libigl/igl/bounding_box.cpp diff --git a/src/igl/bounding_box.h b/src/libigl/igl/bounding_box.h similarity index 100% rename from src/igl/bounding_box.h rename to src/libigl/igl/bounding_box.h diff --git a/src/igl/bounding_box_diagonal.cpp b/src/libigl/igl/bounding_box_diagonal.cpp similarity index 100% rename from src/igl/bounding_box_diagonal.cpp rename to src/libigl/igl/bounding_box_diagonal.cpp diff --git a/src/igl/bounding_box_diagonal.h b/src/libigl/igl/bounding_box_diagonal.h similarity index 100% rename from src/igl/bounding_box_diagonal.h rename to src/libigl/igl/bounding_box_diagonal.h diff --git a/src/igl/canonical_quaternions.cpp b/src/libigl/igl/canonical_quaternions.cpp similarity index 100% rename from src/igl/canonical_quaternions.cpp rename to src/libigl/igl/canonical_quaternions.cpp diff --git a/src/igl/canonical_quaternions.h b/src/libigl/igl/canonical_quaternions.h similarity index 100% rename from src/igl/canonical_quaternions.h rename to src/libigl/igl/canonical_quaternions.h diff --git a/src/igl/cat.cpp b/src/libigl/igl/cat.cpp similarity index 100% rename from src/igl/cat.cpp rename to src/libigl/igl/cat.cpp diff --git a/src/igl/cat.h b/src/libigl/igl/cat.h similarity index 100% rename from src/igl/cat.h rename to src/libigl/igl/cat.h diff --git a/src/igl/ceil.cpp b/src/libigl/igl/ceil.cpp similarity index 100% rename from src/igl/ceil.cpp rename to src/libigl/igl/ceil.cpp diff --git a/src/igl/ceil.h b/src/libigl/igl/ceil.h similarity index 100% rename from src/igl/ceil.h rename to src/libigl/igl/ceil.h diff --git a/src/igl/centroid.cpp b/src/libigl/igl/centroid.cpp similarity index 100% rename from src/igl/centroid.cpp rename to src/libigl/igl/centroid.cpp diff --git a/src/igl/centroid.h b/src/libigl/igl/centroid.h similarity index 100% rename from src/igl/centroid.h rename to src/libigl/igl/centroid.h diff --git a/src/igl/circulation.cpp b/src/libigl/igl/circulation.cpp similarity index 100% rename from src/igl/circulation.cpp rename to src/libigl/igl/circulation.cpp diff --git a/src/igl/circulation.h b/src/libigl/igl/circulation.h similarity index 100% rename from src/igl/circulation.h rename to src/libigl/igl/circulation.h diff --git a/src/igl/circumradius.cpp b/src/libigl/igl/circumradius.cpp similarity index 100% rename from src/igl/circumradius.cpp rename to src/libigl/igl/circumradius.cpp diff --git a/src/igl/circumradius.h b/src/libigl/igl/circumradius.h similarity index 100% rename from src/igl/circumradius.h rename to src/libigl/igl/circumradius.h diff --git a/src/igl/collapse_edge.cpp b/src/libigl/igl/collapse_edge.cpp similarity index 100% rename from src/igl/collapse_edge.cpp rename to src/libigl/igl/collapse_edge.cpp diff --git a/src/igl/collapse_edge.h b/src/libigl/igl/collapse_edge.h similarity index 100% rename from src/igl/collapse_edge.h rename to src/libigl/igl/collapse_edge.h diff --git a/src/igl/collapse_small_triangles.cpp b/src/libigl/igl/collapse_small_triangles.cpp similarity index 100% rename from src/igl/collapse_small_triangles.cpp rename to src/libigl/igl/collapse_small_triangles.cpp diff --git a/src/igl/collapse_small_triangles.h b/src/libigl/igl/collapse_small_triangles.h similarity index 100% rename from src/igl/collapse_small_triangles.h rename to src/libigl/igl/collapse_small_triangles.h diff --git a/src/igl/colon.cpp b/src/libigl/igl/colon.cpp similarity index 100% rename from src/igl/colon.cpp rename to src/libigl/igl/colon.cpp diff --git a/src/igl/colon.h b/src/libigl/igl/colon.h similarity index 100% rename from src/igl/colon.h rename to src/libigl/igl/colon.h diff --git a/src/igl/colormap.cpp b/src/libigl/igl/colormap.cpp similarity index 100% rename from src/igl/colormap.cpp rename to src/libigl/igl/colormap.cpp diff --git a/src/igl/colormap.h b/src/libigl/igl/colormap.h similarity index 100% rename from src/igl/colormap.h rename to src/libigl/igl/colormap.h diff --git a/src/igl/column_to_quats.cpp b/src/libigl/igl/column_to_quats.cpp similarity index 100% rename from src/igl/column_to_quats.cpp rename to src/libigl/igl/column_to_quats.cpp diff --git a/src/igl/column_to_quats.h b/src/libigl/igl/column_to_quats.h similarity index 100% rename from src/igl/column_to_quats.h rename to src/libigl/igl/column_to_quats.h diff --git a/src/igl/columnize.cpp b/src/libigl/igl/columnize.cpp similarity index 100% rename from src/igl/columnize.cpp rename to src/libigl/igl/columnize.cpp diff --git a/src/igl/columnize.h b/src/libigl/igl/columnize.h similarity index 100% rename from src/igl/columnize.h rename to src/libigl/igl/columnize.h diff --git a/src/igl/comb_cross_field.cpp b/src/libigl/igl/comb_cross_field.cpp similarity index 100% rename from src/igl/comb_cross_field.cpp rename to src/libigl/igl/comb_cross_field.cpp diff --git a/src/igl/comb_cross_field.h b/src/libigl/igl/comb_cross_field.h similarity index 100% rename from src/igl/comb_cross_field.h rename to src/libigl/igl/comb_cross_field.h diff --git a/src/igl/comb_frame_field.cpp b/src/libigl/igl/comb_frame_field.cpp similarity index 100% rename from src/igl/comb_frame_field.cpp rename to src/libigl/igl/comb_frame_field.cpp diff --git a/src/igl/comb_frame_field.h b/src/libigl/igl/comb_frame_field.h similarity index 100% rename from src/igl/comb_frame_field.h rename to src/libigl/igl/comb_frame_field.h diff --git a/src/igl/comb_line_field.cpp b/src/libigl/igl/comb_line_field.cpp similarity index 100% rename from src/igl/comb_line_field.cpp rename to src/libigl/igl/comb_line_field.cpp diff --git a/src/igl/comb_line_field.h b/src/libigl/igl/comb_line_field.h similarity index 100% rename from src/igl/comb_line_field.h rename to src/libigl/igl/comb_line_field.h diff --git a/src/igl/combine.cpp b/src/libigl/igl/combine.cpp similarity index 100% rename from src/igl/combine.cpp rename to src/libigl/igl/combine.cpp diff --git a/src/igl/combine.h b/src/libigl/igl/combine.h similarity index 100% rename from src/igl/combine.h rename to src/libigl/igl/combine.h diff --git a/src/igl/components.cpp b/src/libigl/igl/components.cpp similarity index 100% rename from src/igl/components.cpp rename to src/libigl/igl/components.cpp diff --git a/src/igl/components.h b/src/libigl/igl/components.h similarity index 100% rename from src/igl/components.h rename to src/libigl/igl/components.h diff --git a/src/igl/compute_frame_field_bisectors.cpp b/src/libigl/igl/compute_frame_field_bisectors.cpp similarity index 100% rename from src/igl/compute_frame_field_bisectors.cpp rename to src/libigl/igl/compute_frame_field_bisectors.cpp diff --git a/src/igl/compute_frame_field_bisectors.h b/src/libigl/igl/compute_frame_field_bisectors.h similarity index 100% rename from src/igl/compute_frame_field_bisectors.h rename to src/libigl/igl/compute_frame_field_bisectors.h diff --git a/src/igl/connect_boundary_to_infinity.cpp b/src/libigl/igl/connect_boundary_to_infinity.cpp similarity index 100% rename from src/igl/connect_boundary_to_infinity.cpp rename to src/libigl/igl/connect_boundary_to_infinity.cpp diff --git a/src/igl/connect_boundary_to_infinity.h b/src/libigl/igl/connect_boundary_to_infinity.h similarity index 100% rename from src/igl/connect_boundary_to_infinity.h rename to src/libigl/igl/connect_boundary_to_infinity.h diff --git a/src/igl/copyleft/README.md b/src/libigl/igl/copyleft/README.md similarity index 100% rename from src/igl/copyleft/README.md rename to src/libigl/igl/copyleft/README.md diff --git a/src/igl/copyleft/cgal/BinaryWindingNumberOperations.h b/src/libigl/igl/copyleft/cgal/BinaryWindingNumberOperations.h similarity index 100% rename from src/igl/copyleft/cgal/BinaryWindingNumberOperations.h rename to src/libigl/igl/copyleft/cgal/BinaryWindingNumberOperations.h diff --git a/src/igl/copyleft/cgal/CGAL_includes.hpp b/src/libigl/igl/copyleft/cgal/CGAL_includes.hpp similarity index 100% rename from src/igl/copyleft/cgal/CGAL_includes.hpp rename to src/libigl/igl/copyleft/cgal/CGAL_includes.hpp diff --git a/src/igl/copyleft/cgal/CSGTree.h b/src/libigl/igl/copyleft/cgal/CSGTree.h similarity index 100% rename from src/igl/copyleft/cgal/CSGTree.h rename to src/libigl/igl/copyleft/cgal/CSGTree.h diff --git a/src/igl/copyleft/cgal/RemeshSelfIntersectionsParam.h b/src/libigl/igl/copyleft/cgal/RemeshSelfIntersectionsParam.h similarity index 100% rename from src/igl/copyleft/cgal/RemeshSelfIntersectionsParam.h rename to src/libigl/igl/copyleft/cgal/RemeshSelfIntersectionsParam.h diff --git a/src/igl/copyleft/cgal/SelfIntersectMesh.h b/src/libigl/igl/copyleft/cgal/SelfIntersectMesh.h similarity index 100% rename from src/igl/copyleft/cgal/SelfIntersectMesh.h rename to src/libigl/igl/copyleft/cgal/SelfIntersectMesh.h diff --git a/src/igl/copyleft/cgal/assign.cpp b/src/libigl/igl/copyleft/cgal/assign.cpp similarity index 100% rename from src/igl/copyleft/cgal/assign.cpp rename to src/libigl/igl/copyleft/cgal/assign.cpp diff --git a/src/igl/copyleft/cgal/assign.h b/src/libigl/igl/copyleft/cgal/assign.h similarity index 100% rename from src/igl/copyleft/cgal/assign.h rename to src/libigl/igl/copyleft/cgal/assign.h diff --git a/src/igl/copyleft/cgal/assign_scalar.cpp b/src/libigl/igl/copyleft/cgal/assign_scalar.cpp similarity index 100% rename from src/igl/copyleft/cgal/assign_scalar.cpp rename to src/libigl/igl/copyleft/cgal/assign_scalar.cpp diff --git a/src/igl/copyleft/cgal/assign_scalar.h b/src/libigl/igl/copyleft/cgal/assign_scalar.h similarity index 100% rename from src/igl/copyleft/cgal/assign_scalar.h rename to src/libigl/igl/copyleft/cgal/assign_scalar.h diff --git a/src/igl/copyleft/cgal/barycenter.cpp b/src/libigl/igl/copyleft/cgal/barycenter.cpp similarity index 100% rename from src/igl/copyleft/cgal/barycenter.cpp rename to src/libigl/igl/copyleft/cgal/barycenter.cpp diff --git a/src/igl/copyleft/cgal/cell_adjacency.cpp b/src/libigl/igl/copyleft/cgal/cell_adjacency.cpp similarity index 100% rename from src/igl/copyleft/cgal/cell_adjacency.cpp rename to src/libigl/igl/copyleft/cgal/cell_adjacency.cpp diff --git a/src/igl/copyleft/cgal/cell_adjacency.h b/src/libigl/igl/copyleft/cgal/cell_adjacency.h similarity index 100% rename from src/igl/copyleft/cgal/cell_adjacency.h rename to src/libigl/igl/copyleft/cgal/cell_adjacency.h diff --git a/src/igl/copyleft/cgal/closest_facet.cpp b/src/libigl/igl/copyleft/cgal/closest_facet.cpp similarity index 100% rename from src/igl/copyleft/cgal/closest_facet.cpp rename to src/libigl/igl/copyleft/cgal/closest_facet.cpp diff --git a/src/igl/copyleft/cgal/closest_facet.h b/src/libigl/igl/copyleft/cgal/closest_facet.h similarity index 100% rename from src/igl/copyleft/cgal/closest_facet.h rename to src/libigl/igl/copyleft/cgal/closest_facet.h diff --git a/src/igl/copyleft/cgal/complex_to_mesh.cpp b/src/libigl/igl/copyleft/cgal/complex_to_mesh.cpp similarity index 100% rename from src/igl/copyleft/cgal/complex_to_mesh.cpp rename to src/libigl/igl/copyleft/cgal/complex_to_mesh.cpp diff --git a/src/igl/copyleft/cgal/complex_to_mesh.h b/src/libigl/igl/copyleft/cgal/complex_to_mesh.h similarity index 100% rename from src/igl/copyleft/cgal/complex_to_mesh.h rename to src/libigl/igl/copyleft/cgal/complex_to_mesh.h diff --git a/src/igl/copyleft/cgal/component_inside_component.cpp b/src/libigl/igl/copyleft/cgal/component_inside_component.cpp similarity index 100% rename from src/igl/copyleft/cgal/component_inside_component.cpp rename to src/libigl/igl/copyleft/cgal/component_inside_component.cpp diff --git a/src/igl/copyleft/cgal/component_inside_component.h b/src/libigl/igl/copyleft/cgal/component_inside_component.h similarity index 100% rename from src/igl/copyleft/cgal/component_inside_component.h rename to src/libigl/igl/copyleft/cgal/component_inside_component.h diff --git a/src/igl/copyleft/cgal/convex_hull.cpp b/src/libigl/igl/copyleft/cgal/convex_hull.cpp similarity index 100% rename from src/igl/copyleft/cgal/convex_hull.cpp rename to src/libigl/igl/copyleft/cgal/convex_hull.cpp diff --git a/src/igl/copyleft/cgal/convex_hull.h b/src/libigl/igl/copyleft/cgal/convex_hull.h similarity index 100% rename from src/igl/copyleft/cgal/convex_hull.h rename to src/libigl/igl/copyleft/cgal/convex_hull.h diff --git a/src/igl/copyleft/cgal/delaunay_triangulation.cpp b/src/libigl/igl/copyleft/cgal/delaunay_triangulation.cpp similarity index 100% rename from src/igl/copyleft/cgal/delaunay_triangulation.cpp rename to src/libigl/igl/copyleft/cgal/delaunay_triangulation.cpp diff --git a/src/igl/copyleft/cgal/delaunay_triangulation.h b/src/libigl/igl/copyleft/cgal/delaunay_triangulation.h similarity index 100% rename from src/igl/copyleft/cgal/delaunay_triangulation.h rename to src/libigl/igl/copyleft/cgal/delaunay_triangulation.h diff --git a/src/igl/copyleft/cgal/extract_cells.cpp b/src/libigl/igl/copyleft/cgal/extract_cells.cpp similarity index 100% rename from src/igl/copyleft/cgal/extract_cells.cpp rename to src/libigl/igl/copyleft/cgal/extract_cells.cpp diff --git a/src/igl/copyleft/cgal/extract_cells.h b/src/libigl/igl/copyleft/cgal/extract_cells.h similarity index 100% rename from src/igl/copyleft/cgal/extract_cells.h rename to src/libigl/igl/copyleft/cgal/extract_cells.h diff --git a/src/igl/copyleft/cgal/extract_feature.cpp b/src/libigl/igl/copyleft/cgal/extract_feature.cpp similarity index 100% rename from src/igl/copyleft/cgal/extract_feature.cpp rename to src/libigl/igl/copyleft/cgal/extract_feature.cpp diff --git a/src/igl/copyleft/cgal/extract_feature.h b/src/libigl/igl/copyleft/cgal/extract_feature.h similarity index 100% rename from src/igl/copyleft/cgal/extract_feature.h rename to src/libigl/igl/copyleft/cgal/extract_feature.h diff --git a/src/igl/copyleft/cgal/fast_winding_number.cpp b/src/libigl/igl/copyleft/cgal/fast_winding_number.cpp similarity index 100% rename from src/igl/copyleft/cgal/fast_winding_number.cpp rename to src/libigl/igl/copyleft/cgal/fast_winding_number.cpp diff --git a/src/igl/copyleft/cgal/fast_winding_number.h b/src/libigl/igl/copyleft/cgal/fast_winding_number.h similarity index 100% rename from src/igl/copyleft/cgal/fast_winding_number.h rename to src/libigl/igl/copyleft/cgal/fast_winding_number.h diff --git a/src/igl/copyleft/cgal/half_space_box.cpp b/src/libigl/igl/copyleft/cgal/half_space_box.cpp similarity index 100% rename from src/igl/copyleft/cgal/half_space_box.cpp rename to src/libigl/igl/copyleft/cgal/half_space_box.cpp diff --git a/src/igl/copyleft/cgal/half_space_box.h b/src/libigl/igl/copyleft/cgal/half_space_box.h similarity index 100% rename from src/igl/copyleft/cgal/half_space_box.h rename to src/libigl/igl/copyleft/cgal/half_space_box.h diff --git a/src/igl/copyleft/cgal/hausdorff.cpp b/src/libigl/igl/copyleft/cgal/hausdorff.cpp similarity index 100% rename from src/igl/copyleft/cgal/hausdorff.cpp rename to src/libigl/igl/copyleft/cgal/hausdorff.cpp diff --git a/src/igl/copyleft/cgal/hausdorff.h b/src/libigl/igl/copyleft/cgal/hausdorff.h similarity index 100% rename from src/igl/copyleft/cgal/hausdorff.h rename to src/libigl/igl/copyleft/cgal/hausdorff.h diff --git a/src/igl/copyleft/cgal/incircle.cpp b/src/libigl/igl/copyleft/cgal/incircle.cpp similarity index 100% rename from src/igl/copyleft/cgal/incircle.cpp rename to src/libigl/igl/copyleft/cgal/incircle.cpp diff --git a/src/igl/copyleft/cgal/incircle.h b/src/libigl/igl/copyleft/cgal/incircle.h similarity index 100% rename from src/igl/copyleft/cgal/incircle.h rename to src/libigl/igl/copyleft/cgal/incircle.h diff --git a/src/igl/copyleft/cgal/insert_into_cdt.cpp b/src/libigl/igl/copyleft/cgal/insert_into_cdt.cpp similarity index 100% rename from src/igl/copyleft/cgal/insert_into_cdt.cpp rename to src/libigl/igl/copyleft/cgal/insert_into_cdt.cpp diff --git a/src/igl/copyleft/cgal/insert_into_cdt.h b/src/libigl/igl/copyleft/cgal/insert_into_cdt.h similarity index 100% rename from src/igl/copyleft/cgal/insert_into_cdt.h rename to src/libigl/igl/copyleft/cgal/insert_into_cdt.h diff --git a/src/igl/copyleft/cgal/insphere.cpp b/src/libigl/igl/copyleft/cgal/insphere.cpp similarity index 100% rename from src/igl/copyleft/cgal/insphere.cpp rename to src/libigl/igl/copyleft/cgal/insphere.cpp diff --git a/src/igl/copyleft/cgal/insphere.h b/src/libigl/igl/copyleft/cgal/insphere.h similarity index 100% rename from src/igl/copyleft/cgal/insphere.h rename to src/libigl/igl/copyleft/cgal/insphere.h diff --git a/src/igl/copyleft/cgal/intersect_other.cpp b/src/libigl/igl/copyleft/cgal/intersect_other.cpp similarity index 100% rename from src/igl/copyleft/cgal/intersect_other.cpp rename to src/libigl/igl/copyleft/cgal/intersect_other.cpp diff --git a/src/igl/copyleft/cgal/intersect_other.h b/src/libigl/igl/copyleft/cgal/intersect_other.h similarity index 100% rename from src/igl/copyleft/cgal/intersect_other.h rename to src/libigl/igl/copyleft/cgal/intersect_other.h diff --git a/src/igl/copyleft/cgal/intersect_with_half_space.cpp b/src/libigl/igl/copyleft/cgal/intersect_with_half_space.cpp similarity index 100% rename from src/igl/copyleft/cgal/intersect_with_half_space.cpp rename to src/libigl/igl/copyleft/cgal/intersect_with_half_space.cpp diff --git a/src/igl/copyleft/cgal/intersect_with_half_space.h b/src/libigl/igl/copyleft/cgal/intersect_with_half_space.h similarity index 100% rename from src/igl/copyleft/cgal/intersect_with_half_space.h rename to src/libigl/igl/copyleft/cgal/intersect_with_half_space.h diff --git a/src/igl/copyleft/cgal/lexicographic_triangulation.cpp b/src/libigl/igl/copyleft/cgal/lexicographic_triangulation.cpp similarity index 100% rename from src/igl/copyleft/cgal/lexicographic_triangulation.cpp rename to src/libigl/igl/copyleft/cgal/lexicographic_triangulation.cpp diff --git a/src/igl/copyleft/cgal/lexicographic_triangulation.h b/src/libigl/igl/copyleft/cgal/lexicographic_triangulation.h similarity index 100% rename from src/igl/copyleft/cgal/lexicographic_triangulation.h rename to src/libigl/igl/copyleft/cgal/lexicographic_triangulation.h diff --git a/src/igl/copyleft/cgal/list_to_matrix.cpp b/src/libigl/igl/copyleft/cgal/list_to_matrix.cpp similarity index 100% rename from src/igl/copyleft/cgal/list_to_matrix.cpp rename to src/libigl/igl/copyleft/cgal/list_to_matrix.cpp diff --git a/src/igl/copyleft/cgal/mesh_boolean.cpp b/src/libigl/igl/copyleft/cgal/mesh_boolean.cpp similarity index 100% rename from src/igl/copyleft/cgal/mesh_boolean.cpp rename to src/libigl/igl/copyleft/cgal/mesh_boolean.cpp diff --git a/src/igl/copyleft/cgal/mesh_boolean.h b/src/libigl/igl/copyleft/cgal/mesh_boolean.h similarity index 100% rename from src/igl/copyleft/cgal/mesh_boolean.h rename to src/libigl/igl/copyleft/cgal/mesh_boolean.h diff --git a/src/igl/copyleft/cgal/mesh_boolean_type_to_funcs.cpp b/src/libigl/igl/copyleft/cgal/mesh_boolean_type_to_funcs.cpp similarity index 100% rename from src/igl/copyleft/cgal/mesh_boolean_type_to_funcs.cpp rename to src/libigl/igl/copyleft/cgal/mesh_boolean_type_to_funcs.cpp diff --git a/src/igl/copyleft/cgal/mesh_boolean_type_to_funcs.h b/src/libigl/igl/copyleft/cgal/mesh_boolean_type_to_funcs.h similarity index 100% rename from src/igl/copyleft/cgal/mesh_boolean_type_to_funcs.h rename to src/libigl/igl/copyleft/cgal/mesh_boolean_type_to_funcs.h diff --git a/src/igl/copyleft/cgal/mesh_to_cgal_triangle_list.cpp b/src/libigl/igl/copyleft/cgal/mesh_to_cgal_triangle_list.cpp similarity index 100% rename from src/igl/copyleft/cgal/mesh_to_cgal_triangle_list.cpp rename to src/libigl/igl/copyleft/cgal/mesh_to_cgal_triangle_list.cpp diff --git a/src/igl/copyleft/cgal/mesh_to_cgal_triangle_list.h b/src/libigl/igl/copyleft/cgal/mesh_to_cgal_triangle_list.h similarity index 100% rename from src/igl/copyleft/cgal/mesh_to_cgal_triangle_list.h rename to src/libigl/igl/copyleft/cgal/mesh_to_cgal_triangle_list.h diff --git a/src/igl/copyleft/cgal/mesh_to_polyhedron.cpp b/src/libigl/igl/copyleft/cgal/mesh_to_polyhedron.cpp similarity index 100% rename from src/igl/copyleft/cgal/mesh_to_polyhedron.cpp rename to src/libigl/igl/copyleft/cgal/mesh_to_polyhedron.cpp diff --git a/src/igl/copyleft/cgal/mesh_to_polyhedron.h b/src/libigl/igl/copyleft/cgal/mesh_to_polyhedron.h similarity index 100% rename from src/igl/copyleft/cgal/mesh_to_polyhedron.h rename to src/libigl/igl/copyleft/cgal/mesh_to_polyhedron.h diff --git a/src/igl/copyleft/cgal/minkowski_sum.cpp b/src/libigl/igl/copyleft/cgal/minkowski_sum.cpp similarity index 100% rename from src/igl/copyleft/cgal/minkowski_sum.cpp rename to src/libigl/igl/copyleft/cgal/minkowski_sum.cpp diff --git a/src/igl/copyleft/cgal/minkowski_sum.h b/src/libigl/igl/copyleft/cgal/minkowski_sum.h similarity index 100% rename from src/igl/copyleft/cgal/minkowski_sum.h rename to src/libigl/igl/copyleft/cgal/minkowski_sum.h diff --git a/src/igl/copyleft/cgal/order_facets_around_edge.cpp b/src/libigl/igl/copyleft/cgal/order_facets_around_edge.cpp similarity index 100% rename from src/igl/copyleft/cgal/order_facets_around_edge.cpp rename to src/libigl/igl/copyleft/cgal/order_facets_around_edge.cpp diff --git a/src/igl/copyleft/cgal/order_facets_around_edge.h b/src/libigl/igl/copyleft/cgal/order_facets_around_edge.h similarity index 100% rename from src/igl/copyleft/cgal/order_facets_around_edge.h rename to src/libigl/igl/copyleft/cgal/order_facets_around_edge.h diff --git a/src/igl/copyleft/cgal/order_facets_around_edges.cpp b/src/libigl/igl/copyleft/cgal/order_facets_around_edges.cpp similarity index 100% rename from src/igl/copyleft/cgal/order_facets_around_edges.cpp rename to src/libigl/igl/copyleft/cgal/order_facets_around_edges.cpp diff --git a/src/igl/copyleft/cgal/order_facets_around_edges.h b/src/libigl/igl/copyleft/cgal/order_facets_around_edges.h similarity index 100% rename from src/igl/copyleft/cgal/order_facets_around_edges.h rename to src/libigl/igl/copyleft/cgal/order_facets_around_edges.h diff --git a/src/igl/copyleft/cgal/orient2D.cpp b/src/libigl/igl/copyleft/cgal/orient2D.cpp similarity index 100% rename from src/igl/copyleft/cgal/orient2D.cpp rename to src/libigl/igl/copyleft/cgal/orient2D.cpp diff --git a/src/igl/copyleft/cgal/orient2D.h b/src/libigl/igl/copyleft/cgal/orient2D.h similarity index 100% rename from src/igl/copyleft/cgal/orient2D.h rename to src/libigl/igl/copyleft/cgal/orient2D.h diff --git a/src/igl/copyleft/cgal/orient3D.cpp b/src/libigl/igl/copyleft/cgal/orient3D.cpp similarity index 100% rename from src/igl/copyleft/cgal/orient3D.cpp rename to src/libigl/igl/copyleft/cgal/orient3D.cpp diff --git a/src/igl/copyleft/cgal/orient3D.h b/src/libigl/igl/copyleft/cgal/orient3D.h similarity index 100% rename from src/igl/copyleft/cgal/orient3D.h rename to src/libigl/igl/copyleft/cgal/orient3D.h diff --git a/src/igl/copyleft/cgal/outer_element.cpp b/src/libigl/igl/copyleft/cgal/outer_element.cpp similarity index 100% rename from src/igl/copyleft/cgal/outer_element.cpp rename to src/libigl/igl/copyleft/cgal/outer_element.cpp diff --git a/src/igl/copyleft/cgal/outer_element.h b/src/libigl/igl/copyleft/cgal/outer_element.h similarity index 100% rename from src/igl/copyleft/cgal/outer_element.h rename to src/libigl/igl/copyleft/cgal/outer_element.h diff --git a/src/igl/copyleft/cgal/outer_facet.cpp b/src/libigl/igl/copyleft/cgal/outer_facet.cpp similarity index 100% rename from src/igl/copyleft/cgal/outer_facet.cpp rename to src/libigl/igl/copyleft/cgal/outer_facet.cpp diff --git a/src/igl/copyleft/cgal/outer_facet.h b/src/libigl/igl/copyleft/cgal/outer_facet.h similarity index 100% rename from src/igl/copyleft/cgal/outer_facet.h rename to src/libigl/igl/copyleft/cgal/outer_facet.h diff --git a/src/igl/copyleft/cgal/outer_hull.cpp b/src/libigl/igl/copyleft/cgal/outer_hull.cpp similarity index 100% rename from src/igl/copyleft/cgal/outer_hull.cpp rename to src/libigl/igl/copyleft/cgal/outer_hull.cpp diff --git a/src/igl/copyleft/cgal/outer_hull.h b/src/libigl/igl/copyleft/cgal/outer_hull.h similarity index 100% rename from src/igl/copyleft/cgal/outer_hull.h rename to src/libigl/igl/copyleft/cgal/outer_hull.h diff --git a/src/igl/copyleft/cgal/peel_outer_hull_layers.cpp b/src/libigl/igl/copyleft/cgal/peel_outer_hull_layers.cpp similarity index 100% rename from src/igl/copyleft/cgal/peel_outer_hull_layers.cpp rename to src/libigl/igl/copyleft/cgal/peel_outer_hull_layers.cpp diff --git a/src/igl/copyleft/cgal/peel_outer_hull_layers.h b/src/libigl/igl/copyleft/cgal/peel_outer_hull_layers.h similarity index 100% rename from src/igl/copyleft/cgal/peel_outer_hull_layers.h rename to src/libigl/igl/copyleft/cgal/peel_outer_hull_layers.h diff --git a/src/igl/copyleft/cgal/peel_winding_number_layers.cpp b/src/libigl/igl/copyleft/cgal/peel_winding_number_layers.cpp similarity index 100% rename from src/igl/copyleft/cgal/peel_winding_number_layers.cpp rename to src/libigl/igl/copyleft/cgal/peel_winding_number_layers.cpp diff --git a/src/igl/copyleft/cgal/peel_winding_number_layers.h b/src/libigl/igl/copyleft/cgal/peel_winding_number_layers.h similarity index 100% rename from src/igl/copyleft/cgal/peel_winding_number_layers.h rename to src/libigl/igl/copyleft/cgal/peel_winding_number_layers.h diff --git a/src/igl/copyleft/cgal/piecewise_constant_winding_number.cpp b/src/libigl/igl/copyleft/cgal/piecewise_constant_winding_number.cpp similarity index 100% rename from src/igl/copyleft/cgal/piecewise_constant_winding_number.cpp rename to src/libigl/igl/copyleft/cgal/piecewise_constant_winding_number.cpp diff --git a/src/igl/copyleft/cgal/piecewise_constant_winding_number.h b/src/libigl/igl/copyleft/cgal/piecewise_constant_winding_number.h similarity index 100% rename from src/igl/copyleft/cgal/piecewise_constant_winding_number.h rename to src/libigl/igl/copyleft/cgal/piecewise_constant_winding_number.h diff --git a/src/igl/copyleft/cgal/point_areas.cpp b/src/libigl/igl/copyleft/cgal/point_areas.cpp similarity index 100% rename from src/igl/copyleft/cgal/point_areas.cpp rename to src/libigl/igl/copyleft/cgal/point_areas.cpp diff --git a/src/igl/copyleft/cgal/point_areas.h b/src/libigl/igl/copyleft/cgal/point_areas.h similarity index 100% rename from src/igl/copyleft/cgal/point_areas.h rename to src/libigl/igl/copyleft/cgal/point_areas.h diff --git a/src/igl/copyleft/cgal/point_mesh_squared_distance.cpp b/src/libigl/igl/copyleft/cgal/point_mesh_squared_distance.cpp similarity index 100% rename from src/igl/copyleft/cgal/point_mesh_squared_distance.cpp rename to src/libigl/igl/copyleft/cgal/point_mesh_squared_distance.cpp diff --git a/src/igl/copyleft/cgal/point_mesh_squared_distance.h b/src/libigl/igl/copyleft/cgal/point_mesh_squared_distance.h similarity index 100% rename from src/igl/copyleft/cgal/point_mesh_squared_distance.h rename to src/libigl/igl/copyleft/cgal/point_mesh_squared_distance.h diff --git a/src/igl/copyleft/cgal/point_segment_squared_distance.cpp b/src/libigl/igl/copyleft/cgal/point_segment_squared_distance.cpp similarity index 100% rename from src/igl/copyleft/cgal/point_segment_squared_distance.cpp rename to src/libigl/igl/copyleft/cgal/point_segment_squared_distance.cpp diff --git a/src/igl/copyleft/cgal/point_segment_squared_distance.h b/src/libigl/igl/copyleft/cgal/point_segment_squared_distance.h similarity index 100% rename from src/igl/copyleft/cgal/point_segment_squared_distance.h rename to src/libigl/igl/copyleft/cgal/point_segment_squared_distance.h diff --git a/src/igl/copyleft/cgal/point_solid_signed_squared_distance.cpp b/src/libigl/igl/copyleft/cgal/point_solid_signed_squared_distance.cpp similarity index 100% rename from src/igl/copyleft/cgal/point_solid_signed_squared_distance.cpp rename to src/libigl/igl/copyleft/cgal/point_solid_signed_squared_distance.cpp diff --git a/src/igl/copyleft/cgal/point_solid_signed_squared_distance.h b/src/libigl/igl/copyleft/cgal/point_solid_signed_squared_distance.h similarity index 100% rename from src/igl/copyleft/cgal/point_solid_signed_squared_distance.h rename to src/libigl/igl/copyleft/cgal/point_solid_signed_squared_distance.h diff --git a/src/igl/copyleft/cgal/point_triangle_squared_distance.cpp b/src/libigl/igl/copyleft/cgal/point_triangle_squared_distance.cpp similarity index 100% rename from src/igl/copyleft/cgal/point_triangle_squared_distance.cpp rename to src/libigl/igl/copyleft/cgal/point_triangle_squared_distance.cpp diff --git a/src/igl/copyleft/cgal/point_triangle_squared_distance.h b/src/libigl/igl/copyleft/cgal/point_triangle_squared_distance.h similarity index 100% rename from src/igl/copyleft/cgal/point_triangle_squared_distance.h rename to src/libigl/igl/copyleft/cgal/point_triangle_squared_distance.h diff --git a/src/igl/copyleft/cgal/points_inside_component.cpp b/src/libigl/igl/copyleft/cgal/points_inside_component.cpp similarity index 100% rename from src/igl/copyleft/cgal/points_inside_component.cpp rename to src/libigl/igl/copyleft/cgal/points_inside_component.cpp diff --git a/src/igl/copyleft/cgal/points_inside_component.h b/src/libigl/igl/copyleft/cgal/points_inside_component.h similarity index 100% rename from src/igl/copyleft/cgal/points_inside_component.h rename to src/libigl/igl/copyleft/cgal/points_inside_component.h diff --git a/src/igl/copyleft/cgal/polyhedron_to_mesh.cpp b/src/libigl/igl/copyleft/cgal/polyhedron_to_mesh.cpp similarity index 100% rename from src/igl/copyleft/cgal/polyhedron_to_mesh.cpp rename to src/libigl/igl/copyleft/cgal/polyhedron_to_mesh.cpp diff --git a/src/igl/copyleft/cgal/polyhedron_to_mesh.h b/src/libigl/igl/copyleft/cgal/polyhedron_to_mesh.h similarity index 100% rename from src/igl/copyleft/cgal/polyhedron_to_mesh.h rename to src/libigl/igl/copyleft/cgal/polyhedron_to_mesh.h diff --git a/src/igl/copyleft/cgal/projected_cdt.cpp b/src/libigl/igl/copyleft/cgal/projected_cdt.cpp similarity index 100% rename from src/igl/copyleft/cgal/projected_cdt.cpp rename to src/libigl/igl/copyleft/cgal/projected_cdt.cpp diff --git a/src/igl/copyleft/cgal/projected_cdt.h b/src/libigl/igl/copyleft/cgal/projected_cdt.h similarity index 100% rename from src/igl/copyleft/cgal/projected_cdt.h rename to src/libigl/igl/copyleft/cgal/projected_cdt.h diff --git a/src/igl/copyleft/cgal/projected_delaunay.cpp b/src/libigl/igl/copyleft/cgal/projected_delaunay.cpp similarity index 100% rename from src/igl/copyleft/cgal/projected_delaunay.cpp rename to src/libigl/igl/copyleft/cgal/projected_delaunay.cpp diff --git a/src/igl/copyleft/cgal/projected_delaunay.h b/src/libigl/igl/copyleft/cgal/projected_delaunay.h similarity index 100% rename from src/igl/copyleft/cgal/projected_delaunay.h rename to src/libigl/igl/copyleft/cgal/projected_delaunay.h diff --git a/src/igl/copyleft/cgal/propagate_winding_numbers.cpp b/src/libigl/igl/copyleft/cgal/propagate_winding_numbers.cpp similarity index 100% rename from src/igl/copyleft/cgal/propagate_winding_numbers.cpp rename to src/libigl/igl/copyleft/cgal/propagate_winding_numbers.cpp diff --git a/src/igl/copyleft/cgal/propagate_winding_numbers.h b/src/libigl/igl/copyleft/cgal/propagate_winding_numbers.h similarity index 100% rename from src/igl/copyleft/cgal/propagate_winding_numbers.h rename to src/libigl/igl/copyleft/cgal/propagate_winding_numbers.h diff --git a/src/igl/copyleft/cgal/read_triangle_mesh.cpp b/src/libigl/igl/copyleft/cgal/read_triangle_mesh.cpp similarity index 100% rename from src/igl/copyleft/cgal/read_triangle_mesh.cpp rename to src/libigl/igl/copyleft/cgal/read_triangle_mesh.cpp diff --git a/src/igl/copyleft/cgal/read_triangle_mesh.h b/src/libigl/igl/copyleft/cgal/read_triangle_mesh.h similarity index 100% rename from src/igl/copyleft/cgal/read_triangle_mesh.h rename to src/libigl/igl/copyleft/cgal/read_triangle_mesh.h diff --git a/src/igl/copyleft/cgal/relabel_small_immersed_cells.cpp b/src/libigl/igl/copyleft/cgal/relabel_small_immersed_cells.cpp similarity index 100% rename from src/igl/copyleft/cgal/relabel_small_immersed_cells.cpp rename to src/libigl/igl/copyleft/cgal/relabel_small_immersed_cells.cpp diff --git a/src/igl/copyleft/cgal/relabel_small_immersed_cells.h b/src/libigl/igl/copyleft/cgal/relabel_small_immersed_cells.h similarity index 100% rename from src/igl/copyleft/cgal/relabel_small_immersed_cells.h rename to src/libigl/igl/copyleft/cgal/relabel_small_immersed_cells.h diff --git a/src/igl/copyleft/cgal/remesh_intersections.cpp b/src/libigl/igl/copyleft/cgal/remesh_intersections.cpp similarity index 100% rename from src/igl/copyleft/cgal/remesh_intersections.cpp rename to src/libigl/igl/copyleft/cgal/remesh_intersections.cpp diff --git a/src/igl/copyleft/cgal/remesh_intersections.h b/src/libigl/igl/copyleft/cgal/remesh_intersections.h similarity index 100% rename from src/igl/copyleft/cgal/remesh_intersections.h rename to src/libigl/igl/copyleft/cgal/remesh_intersections.h diff --git a/src/igl/copyleft/cgal/remesh_self_intersections.cpp b/src/libigl/igl/copyleft/cgal/remesh_self_intersections.cpp similarity index 100% rename from src/igl/copyleft/cgal/remesh_self_intersections.cpp rename to src/libigl/igl/copyleft/cgal/remesh_self_intersections.cpp diff --git a/src/igl/copyleft/cgal/remesh_self_intersections.h b/src/libigl/igl/copyleft/cgal/remesh_self_intersections.h similarity index 100% rename from src/igl/copyleft/cgal/remesh_self_intersections.h rename to src/libigl/igl/copyleft/cgal/remesh_self_intersections.h diff --git a/src/igl/copyleft/cgal/remove_unreferenced.cpp b/src/libigl/igl/copyleft/cgal/remove_unreferenced.cpp similarity index 100% rename from src/igl/copyleft/cgal/remove_unreferenced.cpp rename to src/libigl/igl/copyleft/cgal/remove_unreferenced.cpp diff --git a/src/igl/copyleft/cgal/resolve_intersections.cpp b/src/libigl/igl/copyleft/cgal/resolve_intersections.cpp similarity index 100% rename from src/igl/copyleft/cgal/resolve_intersections.cpp rename to src/libigl/igl/copyleft/cgal/resolve_intersections.cpp diff --git a/src/igl/copyleft/cgal/resolve_intersections.h b/src/libigl/igl/copyleft/cgal/resolve_intersections.h similarity index 100% rename from src/igl/copyleft/cgal/resolve_intersections.h rename to src/libigl/igl/copyleft/cgal/resolve_intersections.h diff --git a/src/igl/copyleft/cgal/row_to_point.cpp b/src/libigl/igl/copyleft/cgal/row_to_point.cpp similarity index 100% rename from src/igl/copyleft/cgal/row_to_point.cpp rename to src/libigl/igl/copyleft/cgal/row_to_point.cpp diff --git a/src/igl/copyleft/cgal/row_to_point.h b/src/libigl/igl/copyleft/cgal/row_to_point.h similarity index 100% rename from src/igl/copyleft/cgal/row_to_point.h rename to src/libigl/igl/copyleft/cgal/row_to_point.h diff --git a/src/igl/copyleft/cgal/segment_segment_squared_distance.cpp b/src/libigl/igl/copyleft/cgal/segment_segment_squared_distance.cpp similarity index 100% rename from src/igl/copyleft/cgal/segment_segment_squared_distance.cpp rename to src/libigl/igl/copyleft/cgal/segment_segment_squared_distance.cpp diff --git a/src/igl/copyleft/cgal/segment_segment_squared_distance.h b/src/libigl/igl/copyleft/cgal/segment_segment_squared_distance.h similarity index 100% rename from src/igl/copyleft/cgal/segment_segment_squared_distance.h rename to src/libigl/igl/copyleft/cgal/segment_segment_squared_distance.h diff --git a/src/igl/copyleft/cgal/signed_distance_isosurface.cpp b/src/libigl/igl/copyleft/cgal/signed_distance_isosurface.cpp similarity index 100% rename from src/igl/copyleft/cgal/signed_distance_isosurface.cpp rename to src/libigl/igl/copyleft/cgal/signed_distance_isosurface.cpp diff --git a/src/igl/copyleft/cgal/signed_distance_isosurface.h b/src/libigl/igl/copyleft/cgal/signed_distance_isosurface.h similarity index 100% rename from src/igl/copyleft/cgal/signed_distance_isosurface.h rename to src/libigl/igl/copyleft/cgal/signed_distance_isosurface.h diff --git a/src/igl/copyleft/cgal/slice.cpp b/src/libigl/igl/copyleft/cgal/slice.cpp similarity index 100% rename from src/igl/copyleft/cgal/slice.cpp rename to src/libigl/igl/copyleft/cgal/slice.cpp diff --git a/src/igl/copyleft/cgal/slice_mask.cpp b/src/libigl/igl/copyleft/cgal/slice_mask.cpp similarity index 100% rename from src/igl/copyleft/cgal/slice_mask.cpp rename to src/libigl/igl/copyleft/cgal/slice_mask.cpp diff --git a/src/igl/copyleft/cgal/snap_rounding.cpp b/src/libigl/igl/copyleft/cgal/snap_rounding.cpp similarity index 100% rename from src/igl/copyleft/cgal/snap_rounding.cpp rename to src/libigl/igl/copyleft/cgal/snap_rounding.cpp diff --git a/src/igl/copyleft/cgal/snap_rounding.h b/src/libigl/igl/copyleft/cgal/snap_rounding.h similarity index 100% rename from src/igl/copyleft/cgal/snap_rounding.h rename to src/libigl/igl/copyleft/cgal/snap_rounding.h diff --git a/src/igl/copyleft/cgal/string_to_mesh_boolean_type.cpp b/src/libigl/igl/copyleft/cgal/string_to_mesh_boolean_type.cpp similarity index 100% rename from src/igl/copyleft/cgal/string_to_mesh_boolean_type.cpp rename to src/libigl/igl/copyleft/cgal/string_to_mesh_boolean_type.cpp diff --git a/src/igl/copyleft/cgal/string_to_mesh_boolean_type.h b/src/libigl/igl/copyleft/cgal/string_to_mesh_boolean_type.h similarity index 100% rename from src/igl/copyleft/cgal/string_to_mesh_boolean_type.h rename to src/libigl/igl/copyleft/cgal/string_to_mesh_boolean_type.h diff --git a/src/igl/copyleft/cgal/subdivide_segments.cpp b/src/libigl/igl/copyleft/cgal/subdivide_segments.cpp similarity index 100% rename from src/igl/copyleft/cgal/subdivide_segments.cpp rename to src/libigl/igl/copyleft/cgal/subdivide_segments.cpp diff --git a/src/igl/copyleft/cgal/subdivide_segments.h b/src/libigl/igl/copyleft/cgal/subdivide_segments.h similarity index 100% rename from src/igl/copyleft/cgal/subdivide_segments.h rename to src/libigl/igl/copyleft/cgal/subdivide_segments.h diff --git a/src/igl/copyleft/cgal/submesh_aabb_tree.cpp b/src/libigl/igl/copyleft/cgal/submesh_aabb_tree.cpp similarity index 100% rename from src/igl/copyleft/cgal/submesh_aabb_tree.cpp rename to src/libigl/igl/copyleft/cgal/submesh_aabb_tree.cpp diff --git a/src/igl/copyleft/cgal/submesh_aabb_tree.h b/src/libigl/igl/copyleft/cgal/submesh_aabb_tree.h similarity index 100% rename from src/igl/copyleft/cgal/submesh_aabb_tree.h rename to src/libigl/igl/copyleft/cgal/submesh_aabb_tree.h diff --git a/src/igl/copyleft/cgal/triangle_triangle_squared_distance.cpp b/src/libigl/igl/copyleft/cgal/triangle_triangle_squared_distance.cpp similarity index 100% rename from src/igl/copyleft/cgal/triangle_triangle_squared_distance.cpp rename to src/libigl/igl/copyleft/cgal/triangle_triangle_squared_distance.cpp diff --git a/src/igl/copyleft/cgal/triangle_triangle_squared_distance.h b/src/libigl/igl/copyleft/cgal/triangle_triangle_squared_distance.h similarity index 100% rename from src/igl/copyleft/cgal/triangle_triangle_squared_distance.h rename to src/libigl/igl/copyleft/cgal/triangle_triangle_squared_distance.h diff --git a/src/igl/copyleft/cgal/trim_with_solid.cpp b/src/libigl/igl/copyleft/cgal/trim_with_solid.cpp similarity index 100% rename from src/igl/copyleft/cgal/trim_with_solid.cpp rename to src/libigl/igl/copyleft/cgal/trim_with_solid.cpp diff --git a/src/igl/copyleft/cgal/trim_with_solid.h b/src/libigl/igl/copyleft/cgal/trim_with_solid.h similarity index 100% rename from src/igl/copyleft/cgal/trim_with_solid.h rename to src/libigl/igl/copyleft/cgal/trim_with_solid.h diff --git a/src/igl/copyleft/cgal/unique.cpp b/src/libigl/igl/copyleft/cgal/unique.cpp similarity index 100% rename from src/igl/copyleft/cgal/unique.cpp rename to src/libigl/igl/copyleft/cgal/unique.cpp diff --git a/src/igl/copyleft/cgal/unique_rows.cpp b/src/libigl/igl/copyleft/cgal/unique_rows.cpp similarity index 100% rename from src/igl/copyleft/cgal/unique_rows.cpp rename to src/libigl/igl/copyleft/cgal/unique_rows.cpp diff --git a/src/igl/copyleft/cgal/wire_mesh.cpp b/src/libigl/igl/copyleft/cgal/wire_mesh.cpp similarity index 100% rename from src/igl/copyleft/cgal/wire_mesh.cpp rename to src/libigl/igl/copyleft/cgal/wire_mesh.cpp diff --git a/src/igl/copyleft/cgal/wire_mesh.h b/src/libigl/igl/copyleft/cgal/wire_mesh.h similarity index 100% rename from src/igl/copyleft/cgal/wire_mesh.h rename to src/libigl/igl/copyleft/cgal/wire_mesh.h diff --git a/src/igl/copyleft/comiso/frame_field.cpp b/src/libigl/igl/copyleft/comiso/frame_field.cpp similarity index 100% rename from src/igl/copyleft/comiso/frame_field.cpp rename to src/libigl/igl/copyleft/comiso/frame_field.cpp diff --git a/src/igl/copyleft/comiso/frame_field.h b/src/libigl/igl/copyleft/comiso/frame_field.h similarity index 100% rename from src/igl/copyleft/comiso/frame_field.h rename to src/libigl/igl/copyleft/comiso/frame_field.h diff --git a/src/igl/copyleft/comiso/miq.cpp b/src/libigl/igl/copyleft/comiso/miq.cpp similarity index 100% rename from src/igl/copyleft/comiso/miq.cpp rename to src/libigl/igl/copyleft/comiso/miq.cpp diff --git a/src/igl/copyleft/comiso/miq.h b/src/libigl/igl/copyleft/comiso/miq.h similarity index 100% rename from src/igl/copyleft/comiso/miq.h rename to src/libigl/igl/copyleft/comiso/miq.h diff --git a/src/igl/copyleft/comiso/nrosy.cpp b/src/libigl/igl/copyleft/comiso/nrosy.cpp similarity index 100% rename from src/igl/copyleft/comiso/nrosy.cpp rename to src/libigl/igl/copyleft/comiso/nrosy.cpp diff --git a/src/igl/copyleft/comiso/nrosy.h b/src/libigl/igl/copyleft/comiso/nrosy.h similarity index 100% rename from src/igl/copyleft/comiso/nrosy.h rename to src/libigl/igl/copyleft/comiso/nrosy.h diff --git a/src/igl/copyleft/cork/from_cork_mesh.cpp b/src/libigl/igl/copyleft/cork/from_cork_mesh.cpp similarity index 100% rename from src/igl/copyleft/cork/from_cork_mesh.cpp rename to src/libigl/igl/copyleft/cork/from_cork_mesh.cpp diff --git a/src/igl/copyleft/cork/from_cork_mesh.h b/src/libigl/igl/copyleft/cork/from_cork_mesh.h similarity index 100% rename from src/igl/copyleft/cork/from_cork_mesh.h rename to src/libigl/igl/copyleft/cork/from_cork_mesh.h diff --git a/src/igl/copyleft/cork/mesh_boolean.cpp b/src/libigl/igl/copyleft/cork/mesh_boolean.cpp similarity index 100% rename from src/igl/copyleft/cork/mesh_boolean.cpp rename to src/libigl/igl/copyleft/cork/mesh_boolean.cpp diff --git a/src/igl/copyleft/cork/mesh_boolean.h b/src/libigl/igl/copyleft/cork/mesh_boolean.h similarity index 100% rename from src/igl/copyleft/cork/mesh_boolean.h rename to src/libigl/igl/copyleft/cork/mesh_boolean.h diff --git a/src/igl/copyleft/cork/to_cork_mesh.cpp b/src/libigl/igl/copyleft/cork/to_cork_mesh.cpp similarity index 100% rename from src/igl/copyleft/cork/to_cork_mesh.cpp rename to src/libigl/igl/copyleft/cork/to_cork_mesh.cpp diff --git a/src/igl/copyleft/cork/to_cork_mesh.h b/src/libigl/igl/copyleft/cork/to_cork_mesh.h similarity index 100% rename from src/igl/copyleft/cork/to_cork_mesh.h rename to src/libigl/igl/copyleft/cork/to_cork_mesh.h diff --git a/src/igl/copyleft/marching_cubes.cpp b/src/libigl/igl/copyleft/marching_cubes.cpp similarity index 100% rename from src/igl/copyleft/marching_cubes.cpp rename to src/libigl/igl/copyleft/marching_cubes.cpp diff --git a/src/igl/copyleft/marching_cubes.h b/src/libigl/igl/copyleft/marching_cubes.h similarity index 100% rename from src/igl/copyleft/marching_cubes.h rename to src/libigl/igl/copyleft/marching_cubes.h diff --git a/src/igl/copyleft/marching_cubes_tables.h b/src/libigl/igl/copyleft/marching_cubes_tables.h similarity index 100% rename from src/igl/copyleft/marching_cubes_tables.h rename to src/libigl/igl/copyleft/marching_cubes_tables.h diff --git a/src/igl/copyleft/offset_surface.cpp b/src/libigl/igl/copyleft/offset_surface.cpp similarity index 100% rename from src/igl/copyleft/offset_surface.cpp rename to src/libigl/igl/copyleft/offset_surface.cpp diff --git a/src/igl/copyleft/offset_surface.h b/src/libigl/igl/copyleft/offset_surface.h similarity index 100% rename from src/igl/copyleft/offset_surface.h rename to src/libigl/igl/copyleft/offset_surface.h diff --git a/src/igl/copyleft/opengl2/render_to_tga.cpp b/src/libigl/igl/copyleft/opengl2/render_to_tga.cpp similarity index 100% rename from src/igl/copyleft/opengl2/render_to_tga.cpp rename to src/libigl/igl/copyleft/opengl2/render_to_tga.cpp diff --git a/src/igl/copyleft/opengl2/render_to_tga.h b/src/libigl/igl/copyleft/opengl2/render_to_tga.h similarity index 100% rename from src/igl/copyleft/opengl2/render_to_tga.h rename to src/libigl/igl/copyleft/opengl2/render_to_tga.h diff --git a/src/igl/copyleft/opengl2/texture_from_tga.cpp b/src/libigl/igl/copyleft/opengl2/texture_from_tga.cpp similarity index 100% rename from src/igl/copyleft/opengl2/texture_from_tga.cpp rename to src/libigl/igl/copyleft/opengl2/texture_from_tga.cpp diff --git a/src/igl/copyleft/opengl2/texture_from_tga.h b/src/libigl/igl/copyleft/opengl2/texture_from_tga.h similarity index 100% rename from src/igl/copyleft/opengl2/texture_from_tga.h rename to src/libigl/igl/copyleft/opengl2/texture_from_tga.h diff --git a/src/igl/copyleft/opengl2/tga.cpp b/src/libigl/igl/copyleft/opengl2/tga.cpp similarity index 100% rename from src/igl/copyleft/opengl2/tga.cpp rename to src/libigl/igl/copyleft/opengl2/tga.cpp diff --git a/src/igl/copyleft/opengl2/tga.h b/src/libigl/igl/copyleft/opengl2/tga.h similarity index 100% rename from src/igl/copyleft/opengl2/tga.h rename to src/libigl/igl/copyleft/opengl2/tga.h diff --git a/src/igl/copyleft/progressive_hulls.cpp b/src/libigl/igl/copyleft/progressive_hulls.cpp similarity index 100% rename from src/igl/copyleft/progressive_hulls.cpp rename to src/libigl/igl/copyleft/progressive_hulls.cpp diff --git a/src/igl/copyleft/progressive_hulls.h b/src/libigl/igl/copyleft/progressive_hulls.h similarity index 100% rename from src/igl/copyleft/progressive_hulls.h rename to src/libigl/igl/copyleft/progressive_hulls.h diff --git a/src/igl/copyleft/progressive_hulls_cost_and_placement.cpp b/src/libigl/igl/copyleft/progressive_hulls_cost_and_placement.cpp similarity index 100% rename from src/igl/copyleft/progressive_hulls_cost_and_placement.cpp rename to src/libigl/igl/copyleft/progressive_hulls_cost_and_placement.cpp diff --git a/src/igl/copyleft/progressive_hulls_cost_and_placement.h b/src/libigl/igl/copyleft/progressive_hulls_cost_and_placement.h similarity index 100% rename from src/igl/copyleft/progressive_hulls_cost_and_placement.h rename to src/libigl/igl/copyleft/progressive_hulls_cost_and_placement.h diff --git a/src/igl/copyleft/quadprog.cpp b/src/libigl/igl/copyleft/quadprog.cpp similarity index 100% rename from src/igl/copyleft/quadprog.cpp rename to src/libigl/igl/copyleft/quadprog.cpp diff --git a/src/igl/copyleft/quadprog.h b/src/libigl/igl/copyleft/quadprog.h similarity index 100% rename from src/igl/copyleft/quadprog.h rename to src/libigl/igl/copyleft/quadprog.h diff --git a/src/igl/copyleft/swept_volume.cpp b/src/libigl/igl/copyleft/swept_volume.cpp similarity index 100% rename from src/igl/copyleft/swept_volume.cpp rename to src/libigl/igl/copyleft/swept_volume.cpp diff --git a/src/igl/copyleft/swept_volume.h b/src/libigl/igl/copyleft/swept_volume.h similarity index 100% rename from src/igl/copyleft/swept_volume.h rename to src/libigl/igl/copyleft/swept_volume.h diff --git a/src/igl/copyleft/tetgen/README b/src/libigl/igl/copyleft/tetgen/README similarity index 100% rename from src/igl/copyleft/tetgen/README rename to src/libigl/igl/copyleft/tetgen/README diff --git a/src/igl/copyleft/tetgen/cdt.cpp b/src/libigl/igl/copyleft/tetgen/cdt.cpp similarity index 100% rename from src/igl/copyleft/tetgen/cdt.cpp rename to src/libigl/igl/copyleft/tetgen/cdt.cpp diff --git a/src/igl/copyleft/tetgen/cdt.h b/src/libigl/igl/copyleft/tetgen/cdt.h similarity index 100% rename from src/igl/copyleft/tetgen/cdt.h rename to src/libigl/igl/copyleft/tetgen/cdt.h diff --git a/src/igl/copyleft/tetgen/mesh_to_tetgenio.cpp b/src/libigl/igl/copyleft/tetgen/mesh_to_tetgenio.cpp similarity index 100% rename from src/igl/copyleft/tetgen/mesh_to_tetgenio.cpp rename to src/libigl/igl/copyleft/tetgen/mesh_to_tetgenio.cpp diff --git a/src/igl/copyleft/tetgen/mesh_to_tetgenio.h b/src/libigl/igl/copyleft/tetgen/mesh_to_tetgenio.h similarity index 100% rename from src/igl/copyleft/tetgen/mesh_to_tetgenio.h rename to src/libigl/igl/copyleft/tetgen/mesh_to_tetgenio.h diff --git a/src/igl/copyleft/tetgen/mesh_with_skeleton.cpp b/src/libigl/igl/copyleft/tetgen/mesh_with_skeleton.cpp similarity index 100% rename from src/igl/copyleft/tetgen/mesh_with_skeleton.cpp rename to src/libigl/igl/copyleft/tetgen/mesh_with_skeleton.cpp diff --git a/src/igl/copyleft/tetgen/mesh_with_skeleton.h b/src/libigl/igl/copyleft/tetgen/mesh_with_skeleton.h similarity index 100% rename from src/igl/copyleft/tetgen/mesh_with_skeleton.h rename to src/libigl/igl/copyleft/tetgen/mesh_with_skeleton.h diff --git a/src/igl/copyleft/tetgen/read_into_tetgenio.cpp b/src/libigl/igl/copyleft/tetgen/read_into_tetgenio.cpp similarity index 100% rename from src/igl/copyleft/tetgen/read_into_tetgenio.cpp rename to src/libigl/igl/copyleft/tetgen/read_into_tetgenio.cpp diff --git a/src/igl/copyleft/tetgen/read_into_tetgenio.h b/src/libigl/igl/copyleft/tetgen/read_into_tetgenio.h similarity index 100% rename from src/igl/copyleft/tetgen/read_into_tetgenio.h rename to src/libigl/igl/copyleft/tetgen/read_into_tetgenio.h diff --git a/src/igl/copyleft/tetgen/tetgenio_to_tetmesh.cpp b/src/libigl/igl/copyleft/tetgen/tetgenio_to_tetmesh.cpp similarity index 100% rename from src/igl/copyleft/tetgen/tetgenio_to_tetmesh.cpp rename to src/libigl/igl/copyleft/tetgen/tetgenio_to_tetmesh.cpp diff --git a/src/igl/copyleft/tetgen/tetgenio_to_tetmesh.h b/src/libigl/igl/copyleft/tetgen/tetgenio_to_tetmesh.h similarity index 100% rename from src/igl/copyleft/tetgen/tetgenio_to_tetmesh.h rename to src/libigl/igl/copyleft/tetgen/tetgenio_to_tetmesh.h diff --git a/src/igl/copyleft/tetgen/tetrahedralize.cpp b/src/libigl/igl/copyleft/tetgen/tetrahedralize.cpp similarity index 100% rename from src/igl/copyleft/tetgen/tetrahedralize.cpp rename to src/libigl/igl/copyleft/tetgen/tetrahedralize.cpp diff --git a/src/igl/copyleft/tetgen/tetrahedralize.h b/src/libigl/igl/copyleft/tetgen/tetrahedralize.h similarity index 100% rename from src/igl/copyleft/tetgen/tetrahedralize.h rename to src/libigl/igl/copyleft/tetgen/tetrahedralize.h diff --git a/src/igl/cotmatrix.cpp b/src/libigl/igl/cotmatrix.cpp similarity index 100% rename from src/igl/cotmatrix.cpp rename to src/libigl/igl/cotmatrix.cpp diff --git a/src/igl/cotmatrix.h b/src/libigl/igl/cotmatrix.h similarity index 100% rename from src/igl/cotmatrix.h rename to src/libigl/igl/cotmatrix.h diff --git a/src/igl/cotmatrix_entries.cpp b/src/libigl/igl/cotmatrix_entries.cpp similarity index 100% rename from src/igl/cotmatrix_entries.cpp rename to src/libigl/igl/cotmatrix_entries.cpp diff --git a/src/igl/cotmatrix_entries.h b/src/libigl/igl/cotmatrix_entries.h similarity index 100% rename from src/igl/cotmatrix_entries.h rename to src/libigl/igl/cotmatrix_entries.h diff --git a/src/igl/count.cpp b/src/libigl/igl/count.cpp similarity index 100% rename from src/igl/count.cpp rename to src/libigl/igl/count.cpp diff --git a/src/igl/count.h b/src/libigl/igl/count.h similarity index 100% rename from src/igl/count.h rename to src/libigl/igl/count.h diff --git a/src/igl/covariance_scatter_matrix.cpp b/src/libigl/igl/covariance_scatter_matrix.cpp similarity index 100% rename from src/igl/covariance_scatter_matrix.cpp rename to src/libigl/igl/covariance_scatter_matrix.cpp diff --git a/src/igl/covariance_scatter_matrix.h b/src/libigl/igl/covariance_scatter_matrix.h similarity index 100% rename from src/igl/covariance_scatter_matrix.h rename to src/libigl/igl/covariance_scatter_matrix.h diff --git a/src/igl/cross.cpp b/src/libigl/igl/cross.cpp similarity index 100% rename from src/igl/cross.cpp rename to src/libigl/igl/cross.cpp diff --git a/src/igl/cross.h b/src/libigl/igl/cross.h similarity index 100% rename from src/igl/cross.h rename to src/libigl/igl/cross.h diff --git a/src/igl/cross_field_missmatch.cpp b/src/libigl/igl/cross_field_missmatch.cpp similarity index 100% rename from src/igl/cross_field_missmatch.cpp rename to src/libigl/igl/cross_field_missmatch.cpp diff --git a/src/igl/cross_field_missmatch.h b/src/libigl/igl/cross_field_missmatch.h similarity index 100% rename from src/igl/cross_field_missmatch.h rename to src/libigl/igl/cross_field_missmatch.h diff --git a/src/igl/crouzeix_raviart_cotmatrix.cpp b/src/libigl/igl/crouzeix_raviart_cotmatrix.cpp similarity index 100% rename from src/igl/crouzeix_raviart_cotmatrix.cpp rename to src/libigl/igl/crouzeix_raviart_cotmatrix.cpp diff --git a/src/igl/crouzeix_raviart_cotmatrix.h b/src/libigl/igl/crouzeix_raviart_cotmatrix.h similarity index 100% rename from src/igl/crouzeix_raviart_cotmatrix.h rename to src/libigl/igl/crouzeix_raviart_cotmatrix.h diff --git a/src/igl/crouzeix_raviart_massmatrix.cpp b/src/libigl/igl/crouzeix_raviart_massmatrix.cpp similarity index 100% rename from src/igl/crouzeix_raviart_massmatrix.cpp rename to src/libigl/igl/crouzeix_raviart_massmatrix.cpp diff --git a/src/igl/crouzeix_raviart_massmatrix.h b/src/libigl/igl/crouzeix_raviart_massmatrix.h similarity index 100% rename from src/igl/crouzeix_raviart_massmatrix.h rename to src/libigl/igl/crouzeix_raviart_massmatrix.h diff --git a/src/igl/cumsum.cpp b/src/libigl/igl/cumsum.cpp similarity index 100% rename from src/igl/cumsum.cpp rename to src/libigl/igl/cumsum.cpp diff --git a/src/igl/cumsum.h b/src/libigl/igl/cumsum.h similarity index 100% rename from src/igl/cumsum.h rename to src/libigl/igl/cumsum.h diff --git a/src/igl/cut_mesh.cpp b/src/libigl/igl/cut_mesh.cpp similarity index 100% rename from src/igl/cut_mesh.cpp rename to src/libigl/igl/cut_mesh.cpp diff --git a/src/igl/cut_mesh.h b/src/libigl/igl/cut_mesh.h similarity index 100% rename from src/igl/cut_mesh.h rename to src/libigl/igl/cut_mesh.h diff --git a/src/igl/cut_mesh_from_singularities.cpp b/src/libigl/igl/cut_mesh_from_singularities.cpp similarity index 100% rename from src/igl/cut_mesh_from_singularities.cpp rename to src/libigl/igl/cut_mesh_from_singularities.cpp diff --git a/src/igl/cut_mesh_from_singularities.h b/src/libigl/igl/cut_mesh_from_singularities.h similarity index 100% rename from src/igl/cut_mesh_from_singularities.h rename to src/libigl/igl/cut_mesh_from_singularities.h diff --git a/src/igl/cylinder.cpp b/src/libigl/igl/cylinder.cpp similarity index 100% rename from src/igl/cylinder.cpp rename to src/libigl/igl/cylinder.cpp diff --git a/src/igl/cylinder.h b/src/libigl/igl/cylinder.h similarity index 100% rename from src/igl/cylinder.h rename to src/libigl/igl/cylinder.h diff --git a/src/igl/dated_copy.cpp b/src/libigl/igl/dated_copy.cpp similarity index 100% rename from src/igl/dated_copy.cpp rename to src/libigl/igl/dated_copy.cpp diff --git a/src/igl/dated_copy.h b/src/libigl/igl/dated_copy.h similarity index 100% rename from src/igl/dated_copy.h rename to src/libigl/igl/dated_copy.h diff --git a/src/igl/decimate.cpp b/src/libigl/igl/decimate.cpp similarity index 100% rename from src/igl/decimate.cpp rename to src/libigl/igl/decimate.cpp diff --git a/src/igl/decimate.h b/src/libigl/igl/decimate.h similarity index 100% rename from src/igl/decimate.h rename to src/libigl/igl/decimate.h diff --git a/src/igl/deform_skeleton.cpp b/src/libigl/igl/deform_skeleton.cpp similarity index 100% rename from src/igl/deform_skeleton.cpp rename to src/libigl/igl/deform_skeleton.cpp diff --git a/src/igl/deform_skeleton.h b/src/libigl/igl/deform_skeleton.h similarity index 100% rename from src/igl/deform_skeleton.h rename to src/libigl/igl/deform_skeleton.h diff --git a/src/igl/delaunay_triangulation.cpp b/src/libigl/igl/delaunay_triangulation.cpp similarity index 100% rename from src/igl/delaunay_triangulation.cpp rename to src/libigl/igl/delaunay_triangulation.cpp diff --git a/src/igl/delaunay_triangulation.h b/src/libigl/igl/delaunay_triangulation.h similarity index 100% rename from src/igl/delaunay_triangulation.h rename to src/libigl/igl/delaunay_triangulation.h diff --git a/src/igl/deprecated.h b/src/libigl/igl/deprecated.h similarity index 100% rename from src/igl/deprecated.h rename to src/libigl/igl/deprecated.h diff --git a/src/igl/dfs.cpp b/src/libigl/igl/dfs.cpp similarity index 100% rename from src/igl/dfs.cpp rename to src/libigl/igl/dfs.cpp diff --git a/src/igl/dfs.h b/src/libigl/igl/dfs.h similarity index 100% rename from src/igl/dfs.h rename to src/libigl/igl/dfs.h diff --git a/src/igl/diag.cpp b/src/libigl/igl/diag.cpp similarity index 100% rename from src/igl/diag.cpp rename to src/libigl/igl/diag.cpp diff --git a/src/igl/diag.h b/src/libigl/igl/diag.h similarity index 100% rename from src/igl/diag.h rename to src/libigl/igl/diag.h diff --git a/src/igl/dihedral_angles.cpp b/src/libigl/igl/dihedral_angles.cpp similarity index 100% rename from src/igl/dihedral_angles.cpp rename to src/libigl/igl/dihedral_angles.cpp diff --git a/src/igl/dihedral_angles.h b/src/libigl/igl/dihedral_angles.h similarity index 100% rename from src/igl/dihedral_angles.h rename to src/libigl/igl/dihedral_angles.h diff --git a/src/igl/dijkstra.cpp b/src/libigl/igl/dijkstra.cpp similarity index 100% rename from src/igl/dijkstra.cpp rename to src/libigl/igl/dijkstra.cpp diff --git a/src/igl/dijkstra.h b/src/libigl/igl/dijkstra.h similarity index 100% rename from src/igl/dijkstra.h rename to src/libigl/igl/dijkstra.h diff --git a/src/igl/directed_edge_orientations.cpp b/src/libigl/igl/directed_edge_orientations.cpp similarity index 100% rename from src/igl/directed_edge_orientations.cpp rename to src/libigl/igl/directed_edge_orientations.cpp diff --git a/src/igl/directed_edge_orientations.h b/src/libigl/igl/directed_edge_orientations.h similarity index 100% rename from src/igl/directed_edge_orientations.h rename to src/libigl/igl/directed_edge_orientations.h diff --git a/src/igl/directed_edge_parents.cpp b/src/libigl/igl/directed_edge_parents.cpp similarity index 100% rename from src/igl/directed_edge_parents.cpp rename to src/libigl/igl/directed_edge_parents.cpp diff --git a/src/igl/directed_edge_parents.h b/src/libigl/igl/directed_edge_parents.h similarity index 100% rename from src/igl/directed_edge_parents.h rename to src/libigl/igl/directed_edge_parents.h diff --git a/src/igl/dirname.cpp b/src/libigl/igl/dirname.cpp similarity index 100% rename from src/igl/dirname.cpp rename to src/libigl/igl/dirname.cpp diff --git a/src/igl/dirname.h b/src/libigl/igl/dirname.h similarity index 100% rename from src/igl/dirname.h rename to src/libigl/igl/dirname.h diff --git a/src/igl/dot.cpp b/src/libigl/igl/dot.cpp similarity index 100% rename from src/igl/dot.cpp rename to src/libigl/igl/dot.cpp diff --git a/src/igl/dot.h b/src/libigl/igl/dot.h similarity index 100% rename from src/igl/dot.h rename to src/libigl/igl/dot.h diff --git a/src/igl/dot_row.cpp b/src/libigl/igl/dot_row.cpp similarity index 100% rename from src/igl/dot_row.cpp rename to src/libigl/igl/dot_row.cpp diff --git a/src/igl/dot_row.h b/src/libigl/igl/dot_row.h similarity index 100% rename from src/igl/dot_row.h rename to src/libigl/igl/dot_row.h diff --git a/src/igl/doublearea.cpp b/src/libigl/igl/doublearea.cpp similarity index 100% rename from src/igl/doublearea.cpp rename to src/libigl/igl/doublearea.cpp diff --git a/src/igl/doublearea.h b/src/libigl/igl/doublearea.h similarity index 100% rename from src/igl/doublearea.h rename to src/libigl/igl/doublearea.h diff --git a/src/igl/dqs.cpp b/src/libigl/igl/dqs.cpp similarity index 100% rename from src/igl/dqs.cpp rename to src/libigl/igl/dqs.cpp diff --git a/src/igl/dqs.h b/src/libigl/igl/dqs.h similarity index 100% rename from src/igl/dqs.h rename to src/libigl/igl/dqs.h diff --git a/src/igl/ears.cpp b/src/libigl/igl/ears.cpp similarity index 100% rename from src/igl/ears.cpp rename to src/libigl/igl/ears.cpp diff --git a/src/igl/ears.h b/src/libigl/igl/ears.h similarity index 100% rename from src/igl/ears.h rename to src/libigl/igl/ears.h diff --git a/src/igl/edge_collapse_is_valid.cpp b/src/libigl/igl/edge_collapse_is_valid.cpp similarity index 100% rename from src/igl/edge_collapse_is_valid.cpp rename to src/libigl/igl/edge_collapse_is_valid.cpp diff --git a/src/igl/edge_collapse_is_valid.h b/src/libigl/igl/edge_collapse_is_valid.h similarity index 100% rename from src/igl/edge_collapse_is_valid.h rename to src/libigl/igl/edge_collapse_is_valid.h diff --git a/src/igl/edge_flaps.cpp b/src/libigl/igl/edge_flaps.cpp similarity index 100% rename from src/igl/edge_flaps.cpp rename to src/libigl/igl/edge_flaps.cpp diff --git a/src/igl/edge_flaps.h b/src/libigl/igl/edge_flaps.h similarity index 100% rename from src/igl/edge_flaps.h rename to src/libigl/igl/edge_flaps.h diff --git a/src/igl/edge_lengths.cpp b/src/libigl/igl/edge_lengths.cpp similarity index 100% rename from src/igl/edge_lengths.cpp rename to src/libigl/igl/edge_lengths.cpp diff --git a/src/igl/edge_lengths.h b/src/libigl/igl/edge_lengths.h similarity index 100% rename from src/igl/edge_lengths.h rename to src/libigl/igl/edge_lengths.h diff --git a/src/igl/edge_topology.cpp b/src/libigl/igl/edge_topology.cpp similarity index 100% rename from src/igl/edge_topology.cpp rename to src/libigl/igl/edge_topology.cpp diff --git a/src/igl/edge_topology.h b/src/libigl/igl/edge_topology.h similarity index 100% rename from src/igl/edge_topology.h rename to src/libigl/igl/edge_topology.h diff --git a/src/igl/edges.cpp b/src/libigl/igl/edges.cpp similarity index 100% rename from src/igl/edges.cpp rename to src/libigl/igl/edges.cpp diff --git a/src/igl/edges.h b/src/libigl/igl/edges.h similarity index 100% rename from src/igl/edges.h rename to src/libigl/igl/edges.h diff --git a/src/igl/edges_to_path.cpp b/src/libigl/igl/edges_to_path.cpp similarity index 100% rename from src/igl/edges_to_path.cpp rename to src/libigl/igl/edges_to_path.cpp diff --git a/src/igl/edges_to_path.h b/src/libigl/igl/edges_to_path.h similarity index 100% rename from src/igl/edges_to_path.h rename to src/libigl/igl/edges_to_path.h diff --git a/src/igl/eigs.cpp b/src/libigl/igl/eigs.cpp similarity index 100% rename from src/igl/eigs.cpp rename to src/libigl/igl/eigs.cpp diff --git a/src/igl/eigs.h b/src/libigl/igl/eigs.h similarity index 100% rename from src/igl/eigs.h rename to src/libigl/igl/eigs.h diff --git a/src/igl/embree/EmbreeIntersector.h b/src/libigl/igl/embree/EmbreeIntersector.h similarity index 100% rename from src/igl/embree/EmbreeIntersector.h rename to src/libigl/igl/embree/EmbreeIntersector.h diff --git a/src/igl/embree/Embree_convenience.h b/src/libigl/igl/embree/Embree_convenience.h similarity index 100% rename from src/igl/embree/Embree_convenience.h rename to src/libigl/igl/embree/Embree_convenience.h diff --git a/src/igl/embree/ambient_occlusion.cpp b/src/libigl/igl/embree/ambient_occlusion.cpp similarity index 100% rename from src/igl/embree/ambient_occlusion.cpp rename to src/libigl/igl/embree/ambient_occlusion.cpp diff --git a/src/igl/embree/ambient_occlusion.h b/src/libigl/igl/embree/ambient_occlusion.h similarity index 100% rename from src/igl/embree/ambient_occlusion.h rename to src/libigl/igl/embree/ambient_occlusion.h diff --git a/src/igl/embree/bone_heat.cpp b/src/libigl/igl/embree/bone_heat.cpp similarity index 100% rename from src/igl/embree/bone_heat.cpp rename to src/libigl/igl/embree/bone_heat.cpp diff --git a/src/igl/embree/bone_heat.h b/src/libigl/igl/embree/bone_heat.h similarity index 100% rename from src/igl/embree/bone_heat.h rename to src/libigl/igl/embree/bone_heat.h diff --git a/src/igl/embree/bone_visible.cpp b/src/libigl/igl/embree/bone_visible.cpp similarity index 100% rename from src/igl/embree/bone_visible.cpp rename to src/libigl/igl/embree/bone_visible.cpp diff --git a/src/igl/embree/bone_visible.h b/src/libigl/igl/embree/bone_visible.h similarity index 100% rename from src/igl/embree/bone_visible.h rename to src/libigl/igl/embree/bone_visible.h diff --git a/src/igl/embree/embree2/rtcore.h b/src/libigl/igl/embree/embree2/rtcore.h similarity index 100% rename from src/igl/embree/embree2/rtcore.h rename to src/libigl/igl/embree/embree2/rtcore.h diff --git a/src/igl/embree/embree2/rtcore.isph b/src/libigl/igl/embree/embree2/rtcore.isph similarity index 100% rename from src/igl/embree/embree2/rtcore.isph rename to src/libigl/igl/embree/embree2/rtcore.isph diff --git a/src/igl/embree/embree2/rtcore_geometry.h b/src/libigl/igl/embree/embree2/rtcore_geometry.h similarity index 100% rename from src/igl/embree/embree2/rtcore_geometry.h rename to src/libigl/igl/embree/embree2/rtcore_geometry.h diff --git a/src/igl/embree/embree2/rtcore_geometry.isph b/src/libigl/igl/embree/embree2/rtcore_geometry.isph similarity index 100% rename from src/igl/embree/embree2/rtcore_geometry.isph rename to src/libigl/igl/embree/embree2/rtcore_geometry.isph diff --git a/src/igl/embree/embree2/rtcore_geometry_user.h b/src/libigl/igl/embree/embree2/rtcore_geometry_user.h similarity index 100% rename from src/igl/embree/embree2/rtcore_geometry_user.h rename to src/libigl/igl/embree/embree2/rtcore_geometry_user.h diff --git a/src/igl/embree/embree2/rtcore_geometry_user.isph b/src/libigl/igl/embree/embree2/rtcore_geometry_user.isph similarity index 100% rename from src/igl/embree/embree2/rtcore_geometry_user.isph rename to src/libigl/igl/embree/embree2/rtcore_geometry_user.isph diff --git a/src/igl/embree/embree2/rtcore_ray.h b/src/libigl/igl/embree/embree2/rtcore_ray.h similarity index 100% rename from src/igl/embree/embree2/rtcore_ray.h rename to src/libigl/igl/embree/embree2/rtcore_ray.h diff --git a/src/igl/embree/embree2/rtcore_ray.isph b/src/libigl/igl/embree/embree2/rtcore_ray.isph similarity index 100% rename from src/igl/embree/embree2/rtcore_ray.isph rename to src/libigl/igl/embree/embree2/rtcore_ray.isph diff --git a/src/igl/embree/embree2/rtcore_scene.h b/src/libigl/igl/embree/embree2/rtcore_scene.h similarity index 100% rename from src/igl/embree/embree2/rtcore_scene.h rename to src/libigl/igl/embree/embree2/rtcore_scene.h diff --git a/src/igl/embree/embree2/rtcore_scene.isph b/src/libigl/igl/embree/embree2/rtcore_scene.isph similarity index 100% rename from src/igl/embree/embree2/rtcore_scene.isph rename to src/libigl/igl/embree/embree2/rtcore_scene.isph diff --git a/src/igl/embree/line_mesh_intersection.cpp b/src/libigl/igl/embree/line_mesh_intersection.cpp similarity index 100% rename from src/igl/embree/line_mesh_intersection.cpp rename to src/libigl/igl/embree/line_mesh_intersection.cpp diff --git a/src/igl/embree/line_mesh_intersection.h b/src/libigl/igl/embree/line_mesh_intersection.h similarity index 100% rename from src/igl/embree/line_mesh_intersection.h rename to src/libigl/igl/embree/line_mesh_intersection.h diff --git a/src/igl/embree/reorient_facets_raycast.cpp b/src/libigl/igl/embree/reorient_facets_raycast.cpp similarity index 100% rename from src/igl/embree/reorient_facets_raycast.cpp rename to src/libigl/igl/embree/reorient_facets_raycast.cpp diff --git a/src/igl/embree/reorient_facets_raycast.h b/src/libigl/igl/embree/reorient_facets_raycast.h similarity index 100% rename from src/igl/embree/reorient_facets_raycast.h rename to src/libigl/igl/embree/reorient_facets_raycast.h diff --git a/src/igl/embree/shape_diameter_function.cpp b/src/libigl/igl/embree/shape_diameter_function.cpp similarity index 100% rename from src/igl/embree/shape_diameter_function.cpp rename to src/libigl/igl/embree/shape_diameter_function.cpp diff --git a/src/igl/embree/shape_diameter_function.h b/src/libigl/igl/embree/shape_diameter_function.h similarity index 100% rename from src/igl/embree/shape_diameter_function.h rename to src/libigl/igl/embree/shape_diameter_function.h diff --git a/src/igl/embree/unproject_in_mesh.cpp b/src/libigl/igl/embree/unproject_in_mesh.cpp similarity index 100% rename from src/igl/embree/unproject_in_mesh.cpp rename to src/libigl/igl/embree/unproject_in_mesh.cpp diff --git a/src/igl/embree/unproject_in_mesh.h b/src/libigl/igl/embree/unproject_in_mesh.h similarity index 100% rename from src/igl/embree/unproject_in_mesh.h rename to src/libigl/igl/embree/unproject_in_mesh.h diff --git a/src/igl/embree/unproject_onto_mesh.cpp b/src/libigl/igl/embree/unproject_onto_mesh.cpp similarity index 100% rename from src/igl/embree/unproject_onto_mesh.cpp rename to src/libigl/igl/embree/unproject_onto_mesh.cpp diff --git a/src/igl/embree/unproject_onto_mesh.h b/src/libigl/igl/embree/unproject_onto_mesh.h similarity index 100% rename from src/igl/embree/unproject_onto_mesh.h rename to src/libigl/igl/embree/unproject_onto_mesh.h diff --git a/src/igl/euler_characteristic.cpp b/src/libigl/igl/euler_characteristic.cpp similarity index 100% rename from src/igl/euler_characteristic.cpp rename to src/libigl/igl/euler_characteristic.cpp diff --git a/src/igl/euler_characteristic.h b/src/libigl/igl/euler_characteristic.h similarity index 100% rename from src/igl/euler_characteristic.h rename to src/libigl/igl/euler_characteristic.h diff --git a/src/igl/exact_geodesic.cpp b/src/libigl/igl/exact_geodesic.cpp similarity index 100% rename from src/igl/exact_geodesic.cpp rename to src/libigl/igl/exact_geodesic.cpp diff --git a/src/igl/exact_geodesic.h b/src/libigl/igl/exact_geodesic.h similarity index 100% rename from src/igl/exact_geodesic.h rename to src/libigl/igl/exact_geodesic.h diff --git a/src/igl/example_fun.cpp b/src/libigl/igl/example_fun.cpp similarity index 100% rename from src/igl/example_fun.cpp rename to src/libigl/igl/example_fun.cpp diff --git a/src/igl/example_fun.h b/src/libigl/igl/example_fun.h similarity index 100% rename from src/igl/example_fun.h rename to src/libigl/igl/example_fun.h diff --git a/src/igl/exterior_edges.cpp b/src/libigl/igl/exterior_edges.cpp similarity index 100% rename from src/igl/exterior_edges.cpp rename to src/libigl/igl/exterior_edges.cpp diff --git a/src/igl/exterior_edges.h b/src/libigl/igl/exterior_edges.h similarity index 100% rename from src/igl/exterior_edges.h rename to src/libigl/igl/exterior_edges.h diff --git a/src/igl/extract_manifold_patches.cpp b/src/libigl/igl/extract_manifold_patches.cpp similarity index 100% rename from src/igl/extract_manifold_patches.cpp rename to src/libigl/igl/extract_manifold_patches.cpp diff --git a/src/igl/extract_manifold_patches.h b/src/libigl/igl/extract_manifold_patches.h similarity index 100% rename from src/igl/extract_manifold_patches.h rename to src/libigl/igl/extract_manifold_patches.h diff --git a/src/igl/extract_non_manifold_edge_curves.cpp b/src/libigl/igl/extract_non_manifold_edge_curves.cpp similarity index 100% rename from src/igl/extract_non_manifold_edge_curves.cpp rename to src/libigl/igl/extract_non_manifold_edge_curves.cpp diff --git a/src/igl/extract_non_manifold_edge_curves.h b/src/libigl/igl/extract_non_manifold_edge_curves.h similarity index 100% rename from src/igl/extract_non_manifold_edge_curves.h rename to src/libigl/igl/extract_non_manifold_edge_curves.h diff --git a/src/igl/face_areas.cpp b/src/libigl/igl/face_areas.cpp similarity index 100% rename from src/igl/face_areas.cpp rename to src/libigl/igl/face_areas.cpp diff --git a/src/igl/face_areas.h b/src/libigl/igl/face_areas.h similarity index 100% rename from src/igl/face_areas.h rename to src/libigl/igl/face_areas.h diff --git a/src/igl/face_occurrences.cpp b/src/libigl/igl/face_occurrences.cpp similarity index 100% rename from src/igl/face_occurrences.cpp rename to src/libigl/igl/face_occurrences.cpp diff --git a/src/igl/face_occurrences.h b/src/libigl/igl/face_occurrences.h similarity index 100% rename from src/igl/face_occurrences.h rename to src/libigl/igl/face_occurrences.h diff --git a/src/igl/faces_first.cpp b/src/libigl/igl/faces_first.cpp similarity index 100% rename from src/igl/faces_first.cpp rename to src/libigl/igl/faces_first.cpp diff --git a/src/igl/faces_first.h b/src/libigl/igl/faces_first.h similarity index 100% rename from src/igl/faces_first.h rename to src/libigl/igl/faces_first.h diff --git a/src/igl/facet_components.cpp b/src/libigl/igl/facet_components.cpp similarity index 100% rename from src/igl/facet_components.cpp rename to src/libigl/igl/facet_components.cpp diff --git a/src/igl/facet_components.h b/src/libigl/igl/facet_components.h similarity index 100% rename from src/igl/facet_components.h rename to src/libigl/igl/facet_components.h diff --git a/src/igl/false_barycentric_subdivision.cpp b/src/libigl/igl/false_barycentric_subdivision.cpp similarity index 100% rename from src/igl/false_barycentric_subdivision.cpp rename to src/libigl/igl/false_barycentric_subdivision.cpp diff --git a/src/igl/false_barycentric_subdivision.h b/src/libigl/igl/false_barycentric_subdivision.h similarity index 100% rename from src/igl/false_barycentric_subdivision.h rename to src/libigl/igl/false_barycentric_subdivision.h diff --git a/src/igl/fast_winding_number.cpp b/src/libigl/igl/fast_winding_number.cpp similarity index 100% rename from src/igl/fast_winding_number.cpp rename to src/libigl/igl/fast_winding_number.cpp diff --git a/src/igl/fast_winding_number.h b/src/libigl/igl/fast_winding_number.h similarity index 100% rename from src/igl/fast_winding_number.h rename to src/libigl/igl/fast_winding_number.h diff --git a/src/igl/file_contents_as_string.cpp b/src/libigl/igl/file_contents_as_string.cpp similarity index 100% rename from src/igl/file_contents_as_string.cpp rename to src/libigl/igl/file_contents_as_string.cpp diff --git a/src/igl/file_contents_as_string.h b/src/libigl/igl/file_contents_as_string.h similarity index 100% rename from src/igl/file_contents_as_string.h rename to src/libigl/igl/file_contents_as_string.h diff --git a/src/igl/file_dialog_open.cpp b/src/libigl/igl/file_dialog_open.cpp similarity index 100% rename from src/igl/file_dialog_open.cpp rename to src/libigl/igl/file_dialog_open.cpp diff --git a/src/igl/file_dialog_open.h b/src/libigl/igl/file_dialog_open.h similarity index 100% rename from src/igl/file_dialog_open.h rename to src/libigl/igl/file_dialog_open.h diff --git a/src/igl/file_dialog_save.cpp b/src/libigl/igl/file_dialog_save.cpp similarity index 100% rename from src/igl/file_dialog_save.cpp rename to src/libigl/igl/file_dialog_save.cpp diff --git a/src/igl/file_dialog_save.h b/src/libigl/igl/file_dialog_save.h similarity index 100% rename from src/igl/file_dialog_save.h rename to src/libigl/igl/file_dialog_save.h diff --git a/src/igl/file_exists.cpp b/src/libigl/igl/file_exists.cpp similarity index 100% rename from src/igl/file_exists.cpp rename to src/libigl/igl/file_exists.cpp diff --git a/src/igl/file_exists.h b/src/libigl/igl/file_exists.h similarity index 100% rename from src/igl/file_exists.h rename to src/libigl/igl/file_exists.h diff --git a/src/igl/find.cpp b/src/libigl/igl/find.cpp similarity index 100% rename from src/igl/find.cpp rename to src/libigl/igl/find.cpp diff --git a/src/igl/find.h b/src/libigl/igl/find.h similarity index 100% rename from src/igl/find.h rename to src/libigl/igl/find.h diff --git a/src/igl/find_cross_field_singularities.cpp b/src/libigl/igl/find_cross_field_singularities.cpp similarity index 100% rename from src/igl/find_cross_field_singularities.cpp rename to src/libigl/igl/find_cross_field_singularities.cpp diff --git a/src/igl/find_cross_field_singularities.h b/src/libigl/igl/find_cross_field_singularities.h similarity index 100% rename from src/igl/find_cross_field_singularities.h rename to src/libigl/igl/find_cross_field_singularities.h diff --git a/src/igl/find_zero.cpp b/src/libigl/igl/find_zero.cpp similarity index 100% rename from src/igl/find_zero.cpp rename to src/libigl/igl/find_zero.cpp diff --git a/src/igl/find_zero.h b/src/libigl/igl/find_zero.h similarity index 100% rename from src/igl/find_zero.h rename to src/libigl/igl/find_zero.h diff --git a/src/igl/fit_plane.cpp b/src/libigl/igl/fit_plane.cpp similarity index 100% rename from src/igl/fit_plane.cpp rename to src/libigl/igl/fit_plane.cpp diff --git a/src/igl/fit_plane.h b/src/libigl/igl/fit_plane.h similarity index 100% rename from src/igl/fit_plane.h rename to src/libigl/igl/fit_plane.h diff --git a/src/igl/fit_rotations.cpp b/src/libigl/igl/fit_rotations.cpp similarity index 100% rename from src/igl/fit_rotations.cpp rename to src/libigl/igl/fit_rotations.cpp diff --git a/src/igl/fit_rotations.h b/src/libigl/igl/fit_rotations.h similarity index 100% rename from src/igl/fit_rotations.h rename to src/libigl/igl/fit_rotations.h diff --git a/src/igl/flip_avoiding_line_search.cpp b/src/libigl/igl/flip_avoiding_line_search.cpp similarity index 100% rename from src/igl/flip_avoiding_line_search.cpp rename to src/libigl/igl/flip_avoiding_line_search.cpp diff --git a/src/igl/flip_avoiding_line_search.h b/src/libigl/igl/flip_avoiding_line_search.h similarity index 100% rename from src/igl/flip_avoiding_line_search.h rename to src/libigl/igl/flip_avoiding_line_search.h diff --git a/src/igl/flip_edge.cpp b/src/libigl/igl/flip_edge.cpp similarity index 100% rename from src/igl/flip_edge.cpp rename to src/libigl/igl/flip_edge.cpp diff --git a/src/igl/flip_edge.h b/src/libigl/igl/flip_edge.h similarity index 100% rename from src/igl/flip_edge.h rename to src/libigl/igl/flip_edge.h diff --git a/src/igl/flipped_triangles.cpp b/src/libigl/igl/flipped_triangles.cpp similarity index 100% rename from src/igl/flipped_triangles.cpp rename to src/libigl/igl/flipped_triangles.cpp diff --git a/src/igl/flipped_triangles.h b/src/libigl/igl/flipped_triangles.h similarity index 100% rename from src/igl/flipped_triangles.h rename to src/libigl/igl/flipped_triangles.h diff --git a/src/igl/flood_fill.cpp b/src/libigl/igl/flood_fill.cpp similarity index 100% rename from src/igl/flood_fill.cpp rename to src/libigl/igl/flood_fill.cpp diff --git a/src/igl/flood_fill.h b/src/libigl/igl/flood_fill.h similarity index 100% rename from src/igl/flood_fill.h rename to src/libigl/igl/flood_fill.h diff --git a/src/igl/floor.cpp b/src/libigl/igl/floor.cpp similarity index 100% rename from src/igl/floor.cpp rename to src/libigl/igl/floor.cpp diff --git a/src/igl/floor.h b/src/libigl/igl/floor.h similarity index 100% rename from src/igl/floor.h rename to src/libigl/igl/floor.h diff --git a/src/igl/for_each.h b/src/libigl/igl/for_each.h similarity index 100% rename from src/igl/for_each.h rename to src/libigl/igl/for_each.h diff --git a/src/igl/forward_kinematics.cpp b/src/libigl/igl/forward_kinematics.cpp similarity index 100% rename from src/igl/forward_kinematics.cpp rename to src/libigl/igl/forward_kinematics.cpp diff --git a/src/igl/forward_kinematics.h b/src/libigl/igl/forward_kinematics.h similarity index 100% rename from src/igl/forward_kinematics.h rename to src/libigl/igl/forward_kinematics.h diff --git a/src/igl/frame_field_deformer.cpp b/src/libigl/igl/frame_field_deformer.cpp similarity index 100% rename from src/igl/frame_field_deformer.cpp rename to src/libigl/igl/frame_field_deformer.cpp diff --git a/src/igl/frame_field_deformer.h b/src/libigl/igl/frame_field_deformer.h similarity index 100% rename from src/igl/frame_field_deformer.h rename to src/libigl/igl/frame_field_deformer.h diff --git a/src/igl/frame_to_cross_field.cpp b/src/libigl/igl/frame_to_cross_field.cpp similarity index 100% rename from src/igl/frame_to_cross_field.cpp rename to src/libigl/igl/frame_to_cross_field.cpp diff --git a/src/igl/frame_to_cross_field.h b/src/libigl/igl/frame_to_cross_field.h similarity index 100% rename from src/igl/frame_to_cross_field.h rename to src/libigl/igl/frame_to_cross_field.h diff --git a/src/igl/frustum.cpp b/src/libigl/igl/frustum.cpp similarity index 100% rename from src/igl/frustum.cpp rename to src/libigl/igl/frustum.cpp diff --git a/src/igl/frustum.h b/src/libigl/igl/frustum.h similarity index 100% rename from src/igl/frustum.h rename to src/libigl/igl/frustum.h diff --git a/src/igl/gaussian_curvature.cpp b/src/libigl/igl/gaussian_curvature.cpp similarity index 100% rename from src/igl/gaussian_curvature.cpp rename to src/libigl/igl/gaussian_curvature.cpp diff --git a/src/igl/gaussian_curvature.h b/src/libigl/igl/gaussian_curvature.h similarity index 100% rename from src/igl/gaussian_curvature.h rename to src/libigl/igl/gaussian_curvature.h diff --git a/src/igl/get_seconds.cpp b/src/libigl/igl/get_seconds.cpp similarity index 100% rename from src/igl/get_seconds.cpp rename to src/libigl/igl/get_seconds.cpp diff --git a/src/igl/get_seconds.h b/src/libigl/igl/get_seconds.h similarity index 100% rename from src/igl/get_seconds.h rename to src/libigl/igl/get_seconds.h diff --git a/src/igl/get_seconds_hires.cpp b/src/libigl/igl/get_seconds_hires.cpp similarity index 100% rename from src/igl/get_seconds_hires.cpp rename to src/libigl/igl/get_seconds_hires.cpp diff --git a/src/igl/get_seconds_hires.h b/src/libigl/igl/get_seconds_hires.h similarity index 100% rename from src/igl/get_seconds_hires.h rename to src/libigl/igl/get_seconds_hires.h diff --git a/src/igl/grad.cpp b/src/libigl/igl/grad.cpp similarity index 100% rename from src/igl/grad.cpp rename to src/libigl/igl/grad.cpp diff --git a/src/igl/grad.h b/src/libigl/igl/grad.h similarity index 100% rename from src/igl/grad.h rename to src/libigl/igl/grad.h diff --git a/src/igl/grid.cpp b/src/libigl/igl/grid.cpp similarity index 100% rename from src/igl/grid.cpp rename to src/libigl/igl/grid.cpp diff --git a/src/igl/grid.h b/src/libigl/igl/grid.h similarity index 100% rename from src/igl/grid.h rename to src/libigl/igl/grid.h diff --git a/src/igl/grid_search.cpp b/src/libigl/igl/grid_search.cpp similarity index 100% rename from src/igl/grid_search.cpp rename to src/libigl/igl/grid_search.cpp diff --git a/src/igl/grid_search.h b/src/libigl/igl/grid_search.h similarity index 100% rename from src/igl/grid_search.h rename to src/libigl/igl/grid_search.h diff --git a/src/igl/group_sum_matrix.cpp b/src/libigl/igl/group_sum_matrix.cpp similarity index 100% rename from src/igl/group_sum_matrix.cpp rename to src/libigl/igl/group_sum_matrix.cpp diff --git a/src/igl/group_sum_matrix.h b/src/libigl/igl/group_sum_matrix.h similarity index 100% rename from src/igl/group_sum_matrix.h rename to src/libigl/igl/group_sum_matrix.h diff --git a/src/igl/guess_extension.cpp b/src/libigl/igl/guess_extension.cpp similarity index 100% rename from src/igl/guess_extension.cpp rename to src/libigl/igl/guess_extension.cpp diff --git a/src/igl/guess_extension.h b/src/libigl/igl/guess_extension.h similarity index 100% rename from src/igl/guess_extension.h rename to src/libigl/igl/guess_extension.h diff --git a/src/igl/harmonic.cpp b/src/libigl/igl/harmonic.cpp similarity index 100% rename from src/igl/harmonic.cpp rename to src/libigl/igl/harmonic.cpp diff --git a/src/igl/harmonic.h b/src/libigl/igl/harmonic.h similarity index 100% rename from src/igl/harmonic.h rename to src/libigl/igl/harmonic.h diff --git a/src/igl/harwell_boeing.cpp b/src/libigl/igl/harwell_boeing.cpp similarity index 100% rename from src/igl/harwell_boeing.cpp rename to src/libigl/igl/harwell_boeing.cpp diff --git a/src/igl/harwell_boeing.h b/src/libigl/igl/harwell_boeing.h similarity index 100% rename from src/igl/harwell_boeing.h rename to src/libigl/igl/harwell_boeing.h diff --git a/src/igl/hausdorff.cpp b/src/libigl/igl/hausdorff.cpp similarity index 100% rename from src/igl/hausdorff.cpp rename to src/libigl/igl/hausdorff.cpp diff --git a/src/igl/hausdorff.h b/src/libigl/igl/hausdorff.h similarity index 100% rename from src/igl/hausdorff.h rename to src/libigl/igl/hausdorff.h diff --git a/src/igl/hessian.cpp b/src/libigl/igl/hessian.cpp similarity index 100% rename from src/igl/hessian.cpp rename to src/libigl/igl/hessian.cpp diff --git a/src/igl/hessian.h b/src/libigl/igl/hessian.h similarity index 100% rename from src/igl/hessian.h rename to src/libigl/igl/hessian.h diff --git a/src/igl/hessian_energy.cpp b/src/libigl/igl/hessian_energy.cpp similarity index 100% rename from src/igl/hessian_energy.cpp rename to src/libigl/igl/hessian_energy.cpp diff --git a/src/igl/hessian_energy.h b/src/libigl/igl/hessian_energy.h similarity index 100% rename from src/igl/hessian_energy.h rename to src/libigl/igl/hessian_energy.h diff --git a/src/igl/histc.cpp b/src/libigl/igl/histc.cpp similarity index 100% rename from src/igl/histc.cpp rename to src/libigl/igl/histc.cpp diff --git a/src/igl/histc.h b/src/libigl/igl/histc.h similarity index 100% rename from src/igl/histc.h rename to src/libigl/igl/histc.h diff --git a/src/igl/hsv_to_rgb.cpp b/src/libigl/igl/hsv_to_rgb.cpp similarity index 100% rename from src/igl/hsv_to_rgb.cpp rename to src/libigl/igl/hsv_to_rgb.cpp diff --git a/src/igl/hsv_to_rgb.h b/src/libigl/igl/hsv_to_rgb.h similarity index 100% rename from src/igl/hsv_to_rgb.h rename to src/libigl/igl/hsv_to_rgb.h diff --git a/src/igl/igl_inline.h b/src/libigl/igl/igl_inline.h similarity index 100% rename from src/igl/igl_inline.h rename to src/libigl/igl/igl_inline.h diff --git a/src/igl/in_element.cpp b/src/libigl/igl/in_element.cpp similarity index 100% rename from src/igl/in_element.cpp rename to src/libigl/igl/in_element.cpp diff --git a/src/igl/in_element.h b/src/libigl/igl/in_element.h similarity index 100% rename from src/igl/in_element.h rename to src/libigl/igl/in_element.h diff --git a/src/igl/infinite_cost_stopping_condition.cpp b/src/libigl/igl/infinite_cost_stopping_condition.cpp similarity index 100% rename from src/igl/infinite_cost_stopping_condition.cpp rename to src/libigl/igl/infinite_cost_stopping_condition.cpp diff --git a/src/igl/infinite_cost_stopping_condition.h b/src/libigl/igl/infinite_cost_stopping_condition.h similarity index 100% rename from src/igl/infinite_cost_stopping_condition.h rename to src/libigl/igl/infinite_cost_stopping_condition.h diff --git a/src/igl/inradius.cpp b/src/libigl/igl/inradius.cpp similarity index 100% rename from src/igl/inradius.cpp rename to src/libigl/igl/inradius.cpp diff --git a/src/igl/inradius.h b/src/libigl/igl/inradius.h similarity index 100% rename from src/igl/inradius.h rename to src/libigl/igl/inradius.h diff --git a/src/igl/internal_angles.cpp b/src/libigl/igl/internal_angles.cpp similarity index 100% rename from src/igl/internal_angles.cpp rename to src/libigl/igl/internal_angles.cpp diff --git a/src/igl/internal_angles.h b/src/libigl/igl/internal_angles.h similarity index 100% rename from src/igl/internal_angles.h rename to src/libigl/igl/internal_angles.h diff --git a/src/igl/intersect.cpp b/src/libigl/igl/intersect.cpp similarity index 100% rename from src/igl/intersect.cpp rename to src/libigl/igl/intersect.cpp diff --git a/src/igl/intersect.h b/src/libigl/igl/intersect.h similarity index 100% rename from src/igl/intersect.h rename to src/libigl/igl/intersect.h diff --git a/src/igl/invert_diag.cpp b/src/libigl/igl/invert_diag.cpp similarity index 100% rename from src/igl/invert_diag.cpp rename to src/libigl/igl/invert_diag.cpp diff --git a/src/igl/invert_diag.h b/src/libigl/igl/invert_diag.h similarity index 100% rename from src/igl/invert_diag.h rename to src/libigl/igl/invert_diag.h diff --git a/src/igl/is_border_vertex.cpp b/src/libigl/igl/is_border_vertex.cpp similarity index 100% rename from src/igl/is_border_vertex.cpp rename to src/libigl/igl/is_border_vertex.cpp diff --git a/src/igl/is_border_vertex.h b/src/libigl/igl/is_border_vertex.h similarity index 100% rename from src/igl/is_border_vertex.h rename to src/libigl/igl/is_border_vertex.h diff --git a/src/igl/is_boundary_edge.cpp b/src/libigl/igl/is_boundary_edge.cpp similarity index 100% rename from src/igl/is_boundary_edge.cpp rename to src/libigl/igl/is_boundary_edge.cpp diff --git a/src/igl/is_boundary_edge.h b/src/libigl/igl/is_boundary_edge.h similarity index 100% rename from src/igl/is_boundary_edge.h rename to src/libigl/igl/is_boundary_edge.h diff --git a/src/igl/is_dir.cpp b/src/libigl/igl/is_dir.cpp similarity index 100% rename from src/igl/is_dir.cpp rename to src/libigl/igl/is_dir.cpp diff --git a/src/igl/is_dir.h b/src/libigl/igl/is_dir.h similarity index 100% rename from src/igl/is_dir.h rename to src/libigl/igl/is_dir.h diff --git a/src/igl/is_edge_manifold.cpp b/src/libigl/igl/is_edge_manifold.cpp similarity index 100% rename from src/igl/is_edge_manifold.cpp rename to src/libigl/igl/is_edge_manifold.cpp diff --git a/src/igl/is_edge_manifold.h b/src/libigl/igl/is_edge_manifold.h similarity index 100% rename from src/igl/is_edge_manifold.h rename to src/libigl/igl/is_edge_manifold.h diff --git a/src/igl/is_file.cpp b/src/libigl/igl/is_file.cpp similarity index 100% rename from src/igl/is_file.cpp rename to src/libigl/igl/is_file.cpp diff --git a/src/igl/is_file.h b/src/libigl/igl/is_file.h similarity index 100% rename from src/igl/is_file.h rename to src/libigl/igl/is_file.h diff --git a/src/igl/is_irregular_vertex.cpp b/src/libigl/igl/is_irregular_vertex.cpp similarity index 100% rename from src/igl/is_irregular_vertex.cpp rename to src/libigl/igl/is_irregular_vertex.cpp diff --git a/src/igl/is_irregular_vertex.h b/src/libigl/igl/is_irregular_vertex.h similarity index 100% rename from src/igl/is_irregular_vertex.h rename to src/libigl/igl/is_irregular_vertex.h diff --git a/src/igl/is_planar.cpp b/src/libigl/igl/is_planar.cpp similarity index 100% rename from src/igl/is_planar.cpp rename to src/libigl/igl/is_planar.cpp diff --git a/src/igl/is_planar.h b/src/libigl/igl/is_planar.h similarity index 100% rename from src/igl/is_planar.h rename to src/libigl/igl/is_planar.h diff --git a/src/igl/is_readable.cpp b/src/libigl/igl/is_readable.cpp similarity index 100% rename from src/igl/is_readable.cpp rename to src/libigl/igl/is_readable.cpp diff --git a/src/igl/is_readable.h b/src/libigl/igl/is_readable.h similarity index 100% rename from src/igl/is_readable.h rename to src/libigl/igl/is_readable.h diff --git a/src/igl/is_sparse.cpp b/src/libigl/igl/is_sparse.cpp similarity index 100% rename from src/igl/is_sparse.cpp rename to src/libigl/igl/is_sparse.cpp diff --git a/src/igl/is_sparse.h b/src/libigl/igl/is_sparse.h similarity index 100% rename from src/igl/is_sparse.h rename to src/libigl/igl/is_sparse.h diff --git a/src/igl/is_stl.cpp b/src/libigl/igl/is_stl.cpp similarity index 100% rename from src/igl/is_stl.cpp rename to src/libigl/igl/is_stl.cpp diff --git a/src/igl/is_stl.h b/src/libigl/igl/is_stl.h similarity index 100% rename from src/igl/is_stl.h rename to src/libigl/igl/is_stl.h diff --git a/src/igl/is_symmetric.cpp b/src/libigl/igl/is_symmetric.cpp similarity index 100% rename from src/igl/is_symmetric.cpp rename to src/libigl/igl/is_symmetric.cpp diff --git a/src/igl/is_symmetric.h b/src/libigl/igl/is_symmetric.h similarity index 100% rename from src/igl/is_symmetric.h rename to src/libigl/igl/is_symmetric.h diff --git a/src/igl/is_vertex_manifold.cpp b/src/libigl/igl/is_vertex_manifold.cpp similarity index 100% rename from src/igl/is_vertex_manifold.cpp rename to src/libigl/igl/is_vertex_manifold.cpp diff --git a/src/igl/is_vertex_manifold.h b/src/libigl/igl/is_vertex_manifold.h similarity index 100% rename from src/igl/is_vertex_manifold.h rename to src/libigl/igl/is_vertex_manifold.h diff --git a/src/igl/is_writable.cpp b/src/libigl/igl/is_writable.cpp similarity index 100% rename from src/igl/is_writable.cpp rename to src/libigl/igl/is_writable.cpp diff --git a/src/igl/is_writable.h b/src/libigl/igl/is_writable.h similarity index 100% rename from src/igl/is_writable.h rename to src/libigl/igl/is_writable.h diff --git a/src/igl/isdiag.cpp b/src/libigl/igl/isdiag.cpp similarity index 100% rename from src/igl/isdiag.cpp rename to src/libigl/igl/isdiag.cpp diff --git a/src/igl/isdiag.h b/src/libigl/igl/isdiag.h similarity index 100% rename from src/igl/isdiag.h rename to src/libigl/igl/isdiag.h diff --git a/src/igl/ismember.cpp b/src/libigl/igl/ismember.cpp similarity index 100% rename from src/igl/ismember.cpp rename to src/libigl/igl/ismember.cpp diff --git a/src/igl/ismember.h b/src/libigl/igl/ismember.h similarity index 100% rename from src/igl/ismember.h rename to src/libigl/igl/ismember.h diff --git a/src/igl/isolines.cpp b/src/libigl/igl/isolines.cpp similarity index 100% rename from src/igl/isolines.cpp rename to src/libigl/igl/isolines.cpp diff --git a/src/igl/isolines.h b/src/libigl/igl/isolines.h similarity index 100% rename from src/igl/isolines.h rename to src/libigl/igl/isolines.h diff --git a/src/igl/jet.cpp b/src/libigl/igl/jet.cpp similarity index 100% rename from src/igl/jet.cpp rename to src/libigl/igl/jet.cpp diff --git a/src/igl/jet.h b/src/libigl/igl/jet.h similarity index 100% rename from src/igl/jet.h rename to src/libigl/igl/jet.h diff --git a/src/igl/knn.cpp b/src/libigl/igl/knn.cpp similarity index 100% rename from src/igl/knn.cpp rename to src/libigl/igl/knn.cpp diff --git a/src/igl/knn.h b/src/libigl/igl/knn.h similarity index 100% rename from src/igl/knn.h rename to src/libigl/igl/knn.h diff --git a/src/igl/launch_medit.cpp b/src/libigl/igl/launch_medit.cpp similarity index 100% rename from src/igl/launch_medit.cpp rename to src/libigl/igl/launch_medit.cpp diff --git a/src/igl/launch_medit.h b/src/libigl/igl/launch_medit.h similarity index 100% rename from src/igl/launch_medit.h rename to src/libigl/igl/launch_medit.h diff --git a/src/igl/lbs_matrix.cpp b/src/libigl/igl/lbs_matrix.cpp similarity index 100% rename from src/igl/lbs_matrix.cpp rename to src/libigl/igl/lbs_matrix.cpp diff --git a/src/igl/lbs_matrix.h b/src/libigl/igl/lbs_matrix.h similarity index 100% rename from src/igl/lbs_matrix.h rename to src/libigl/igl/lbs_matrix.h diff --git a/src/igl/lexicographic_triangulation.cpp b/src/libigl/igl/lexicographic_triangulation.cpp similarity index 100% rename from src/igl/lexicographic_triangulation.cpp rename to src/libigl/igl/lexicographic_triangulation.cpp diff --git a/src/igl/lexicographic_triangulation.h b/src/libigl/igl/lexicographic_triangulation.h similarity index 100% rename from src/igl/lexicographic_triangulation.h rename to src/libigl/igl/lexicographic_triangulation.h diff --git a/src/igl/lim/lim.cpp b/src/libigl/igl/lim/lim.cpp similarity index 100% rename from src/igl/lim/lim.cpp rename to src/libigl/igl/lim/lim.cpp diff --git a/src/igl/lim/lim.h b/src/libigl/igl/lim/lim.h similarity index 100% rename from src/igl/lim/lim.h rename to src/libigl/igl/lim/lim.h diff --git a/src/igl/limit_faces.cpp b/src/libigl/igl/limit_faces.cpp similarity index 100% rename from src/igl/limit_faces.cpp rename to src/libigl/igl/limit_faces.cpp diff --git a/src/igl/limit_faces.h b/src/libigl/igl/limit_faces.h similarity index 100% rename from src/igl/limit_faces.h rename to src/libigl/igl/limit_faces.h diff --git a/src/igl/line_field_missmatch.cpp b/src/libigl/igl/line_field_missmatch.cpp similarity index 100% rename from src/igl/line_field_missmatch.cpp rename to src/libigl/igl/line_field_missmatch.cpp diff --git a/src/igl/line_field_missmatch.h b/src/libigl/igl/line_field_missmatch.h similarity index 100% rename from src/igl/line_field_missmatch.h rename to src/libigl/igl/line_field_missmatch.h diff --git a/src/igl/line_search.cpp b/src/libigl/igl/line_search.cpp similarity index 100% rename from src/igl/line_search.cpp rename to src/libigl/igl/line_search.cpp diff --git a/src/igl/line_search.h b/src/libigl/igl/line_search.h similarity index 100% rename from src/igl/line_search.h rename to src/libigl/igl/line_search.h diff --git a/src/igl/line_segment_in_rectangle.cpp b/src/libigl/igl/line_segment_in_rectangle.cpp similarity index 100% rename from src/igl/line_segment_in_rectangle.cpp rename to src/libigl/igl/line_segment_in_rectangle.cpp diff --git a/src/igl/line_segment_in_rectangle.h b/src/libigl/igl/line_segment_in_rectangle.h similarity index 100% rename from src/igl/line_segment_in_rectangle.h rename to src/libigl/igl/line_segment_in_rectangle.h diff --git a/src/igl/linprog.cpp b/src/libigl/igl/linprog.cpp similarity index 100% rename from src/igl/linprog.cpp rename to src/libigl/igl/linprog.cpp diff --git a/src/igl/linprog.h b/src/libigl/igl/linprog.h similarity index 100% rename from src/igl/linprog.h rename to src/libigl/igl/linprog.h diff --git a/src/igl/list_to_matrix.cpp b/src/libigl/igl/list_to_matrix.cpp similarity index 100% rename from src/igl/list_to_matrix.cpp rename to src/libigl/igl/list_to_matrix.cpp diff --git a/src/igl/list_to_matrix.h b/src/libigl/igl/list_to_matrix.h similarity index 100% rename from src/igl/list_to_matrix.h rename to src/libigl/igl/list_to_matrix.h diff --git a/src/igl/local_basis.cpp b/src/libigl/igl/local_basis.cpp similarity index 100% rename from src/igl/local_basis.cpp rename to src/libigl/igl/local_basis.cpp diff --git a/src/igl/local_basis.h b/src/libigl/igl/local_basis.h similarity index 100% rename from src/igl/local_basis.h rename to src/libigl/igl/local_basis.h diff --git a/src/igl/look_at.cpp b/src/libigl/igl/look_at.cpp similarity index 100% rename from src/igl/look_at.cpp rename to src/libigl/igl/look_at.cpp diff --git a/src/igl/look_at.h b/src/libigl/igl/look_at.h similarity index 100% rename from src/igl/look_at.h rename to src/libigl/igl/look_at.h diff --git a/src/igl/loop.cpp b/src/libigl/igl/loop.cpp similarity index 100% rename from src/igl/loop.cpp rename to src/libigl/igl/loop.cpp diff --git a/src/igl/loop.h b/src/libigl/igl/loop.h similarity index 100% rename from src/igl/loop.h rename to src/libigl/igl/loop.h diff --git a/src/igl/lscm.cpp b/src/libigl/igl/lscm.cpp similarity index 100% rename from src/igl/lscm.cpp rename to src/libigl/igl/lscm.cpp diff --git a/src/igl/lscm.h b/src/libigl/igl/lscm.h similarity index 100% rename from src/igl/lscm.h rename to src/libigl/igl/lscm.h diff --git a/src/igl/map_vertices_to_circle.cpp b/src/libigl/igl/map_vertices_to_circle.cpp similarity index 100% rename from src/igl/map_vertices_to_circle.cpp rename to src/libigl/igl/map_vertices_to_circle.cpp diff --git a/src/igl/map_vertices_to_circle.h b/src/libigl/igl/map_vertices_to_circle.h similarity index 100% rename from src/igl/map_vertices_to_circle.h rename to src/libigl/igl/map_vertices_to_circle.h diff --git a/src/igl/massmatrix.cpp b/src/libigl/igl/massmatrix.cpp similarity index 100% rename from src/igl/massmatrix.cpp rename to src/libigl/igl/massmatrix.cpp diff --git a/src/igl/massmatrix.h b/src/libigl/igl/massmatrix.h similarity index 100% rename from src/igl/massmatrix.h rename to src/libigl/igl/massmatrix.h diff --git a/src/igl/mat_max.cpp b/src/libigl/igl/mat_max.cpp similarity index 100% rename from src/igl/mat_max.cpp rename to src/libigl/igl/mat_max.cpp diff --git a/src/igl/mat_max.h b/src/libigl/igl/mat_max.h similarity index 100% rename from src/igl/mat_max.h rename to src/libigl/igl/mat_max.h diff --git a/src/igl/mat_min.cpp b/src/libigl/igl/mat_min.cpp similarity index 100% rename from src/igl/mat_min.cpp rename to src/libigl/igl/mat_min.cpp diff --git a/src/igl/mat_min.h b/src/libigl/igl/mat_min.h similarity index 100% rename from src/igl/mat_min.h rename to src/libigl/igl/mat_min.h diff --git a/src/igl/mat_to_quat.cpp b/src/libigl/igl/mat_to_quat.cpp similarity index 100% rename from src/igl/mat_to_quat.cpp rename to src/libigl/igl/mat_to_quat.cpp diff --git a/src/igl/mat_to_quat.h b/src/libigl/igl/mat_to_quat.h similarity index 100% rename from src/igl/mat_to_quat.h rename to src/libigl/igl/mat_to_quat.h diff --git a/src/igl/material_colors.h b/src/libigl/igl/material_colors.h similarity index 100% rename from src/igl/material_colors.h rename to src/libigl/igl/material_colors.h diff --git a/src/igl/matlab/MatlabWorkspace.h b/src/libigl/igl/matlab/MatlabWorkspace.h similarity index 100% rename from src/igl/matlab/MatlabWorkspace.h rename to src/libigl/igl/matlab/MatlabWorkspace.h diff --git a/src/igl/matlab/MexStream.h b/src/libigl/igl/matlab/MexStream.h similarity index 100% rename from src/igl/matlab/MexStream.h rename to src/libigl/igl/matlab/MexStream.h diff --git a/src/igl/matlab/matlabinterface.cpp b/src/libigl/igl/matlab/matlabinterface.cpp similarity index 100% rename from src/igl/matlab/matlabinterface.cpp rename to src/libigl/igl/matlab/matlabinterface.cpp diff --git a/src/igl/matlab/matlabinterface.h b/src/libigl/igl/matlab/matlabinterface.h similarity index 100% rename from src/igl/matlab/matlabinterface.h rename to src/libigl/igl/matlab/matlabinterface.h diff --git a/src/igl/matlab/mexErrMsgTxt.cpp b/src/libigl/igl/matlab/mexErrMsgTxt.cpp similarity index 100% rename from src/igl/matlab/mexErrMsgTxt.cpp rename to src/libigl/igl/matlab/mexErrMsgTxt.cpp diff --git a/src/igl/matlab/mexErrMsgTxt.h b/src/libigl/igl/matlab/mexErrMsgTxt.h similarity index 100% rename from src/igl/matlab/mexErrMsgTxt.h rename to src/libigl/igl/matlab/mexErrMsgTxt.h diff --git a/src/igl/matlab/parse_rhs.cpp b/src/libigl/igl/matlab/parse_rhs.cpp similarity index 100% rename from src/igl/matlab/parse_rhs.cpp rename to src/libigl/igl/matlab/parse_rhs.cpp diff --git a/src/igl/matlab/parse_rhs.h b/src/libigl/igl/matlab/parse_rhs.h similarity index 100% rename from src/igl/matlab/parse_rhs.h rename to src/libigl/igl/matlab/parse_rhs.h diff --git a/src/igl/matlab/prepare_lhs.cpp b/src/libigl/igl/matlab/prepare_lhs.cpp similarity index 100% rename from src/igl/matlab/prepare_lhs.cpp rename to src/libigl/igl/matlab/prepare_lhs.cpp diff --git a/src/igl/matlab/prepare_lhs.h b/src/libigl/igl/matlab/prepare_lhs.h similarity index 100% rename from src/igl/matlab/prepare_lhs.h rename to src/libigl/igl/matlab/prepare_lhs.h diff --git a/src/igl/matlab/requires_arg.cpp b/src/libigl/igl/matlab/requires_arg.cpp similarity index 100% rename from src/igl/matlab/requires_arg.cpp rename to src/libigl/igl/matlab/requires_arg.cpp diff --git a/src/igl/matlab/requires_arg.h b/src/libigl/igl/matlab/requires_arg.h similarity index 100% rename from src/igl/matlab/requires_arg.h rename to src/libigl/igl/matlab/requires_arg.h diff --git a/src/igl/matlab/validate_arg.cpp b/src/libigl/igl/matlab/validate_arg.cpp similarity index 100% rename from src/igl/matlab/validate_arg.cpp rename to src/libigl/igl/matlab/validate_arg.cpp diff --git a/src/igl/matlab/validate_arg.h b/src/libigl/igl/matlab/validate_arg.h similarity index 100% rename from src/igl/matlab/validate_arg.h rename to src/libigl/igl/matlab/validate_arg.h diff --git a/src/igl/matlab_format.cpp b/src/libigl/igl/matlab_format.cpp similarity index 100% rename from src/igl/matlab_format.cpp rename to src/libigl/igl/matlab_format.cpp diff --git a/src/igl/matlab_format.h b/src/libigl/igl/matlab_format.h similarity index 100% rename from src/igl/matlab_format.h rename to src/libigl/igl/matlab_format.h diff --git a/src/igl/matrix_to_list.cpp b/src/libigl/igl/matrix_to_list.cpp similarity index 100% rename from src/igl/matrix_to_list.cpp rename to src/libigl/igl/matrix_to_list.cpp diff --git a/src/igl/matrix_to_list.h b/src/libigl/igl/matrix_to_list.h similarity index 100% rename from src/igl/matrix_to_list.h rename to src/libigl/igl/matrix_to_list.h diff --git a/src/igl/max.cpp b/src/libigl/igl/max.cpp similarity index 100% rename from src/igl/max.cpp rename to src/libigl/igl/max.cpp diff --git a/src/igl/max.h b/src/libigl/igl/max.h similarity index 100% rename from src/igl/max.h rename to src/libigl/igl/max.h diff --git a/src/igl/max_faces_stopping_condition.cpp b/src/libigl/igl/max_faces_stopping_condition.cpp similarity index 100% rename from src/igl/max_faces_stopping_condition.cpp rename to src/libigl/igl/max_faces_stopping_condition.cpp diff --git a/src/igl/max_faces_stopping_condition.h b/src/libigl/igl/max_faces_stopping_condition.h similarity index 100% rename from src/igl/max_faces_stopping_condition.h rename to src/libigl/igl/max_faces_stopping_condition.h diff --git a/src/igl/max_size.cpp b/src/libigl/igl/max_size.cpp similarity index 100% rename from src/igl/max_size.cpp rename to src/libigl/igl/max_size.cpp diff --git a/src/igl/max_size.h b/src/libigl/igl/max_size.h similarity index 100% rename from src/igl/max_size.h rename to src/libigl/igl/max_size.h diff --git a/src/igl/median.cpp b/src/libigl/igl/median.cpp similarity index 100% rename from src/igl/median.cpp rename to src/libigl/igl/median.cpp diff --git a/src/igl/median.h b/src/libigl/igl/median.h similarity index 100% rename from src/igl/median.h rename to src/libigl/igl/median.h diff --git a/src/igl/min.cpp b/src/libigl/igl/min.cpp similarity index 100% rename from src/igl/min.cpp rename to src/libigl/igl/min.cpp diff --git a/src/igl/min.h b/src/libigl/igl/min.h similarity index 100% rename from src/igl/min.h rename to src/libigl/igl/min.h diff --git a/src/igl/min_quad_dense.cpp b/src/libigl/igl/min_quad_dense.cpp similarity index 100% rename from src/igl/min_quad_dense.cpp rename to src/libigl/igl/min_quad_dense.cpp diff --git a/src/igl/min_quad_dense.h b/src/libigl/igl/min_quad_dense.h similarity index 100% rename from src/igl/min_quad_dense.h rename to src/libigl/igl/min_quad_dense.h diff --git a/src/igl/min_quad_with_fixed.cpp b/src/libigl/igl/min_quad_with_fixed.cpp similarity index 100% rename from src/igl/min_quad_with_fixed.cpp rename to src/libigl/igl/min_quad_with_fixed.cpp diff --git a/src/igl/min_quad_with_fixed.h b/src/libigl/igl/min_quad_with_fixed.h similarity index 100% rename from src/igl/min_quad_with_fixed.h rename to src/libigl/igl/min_quad_with_fixed.h diff --git a/src/igl/min_size.cpp b/src/libigl/igl/min_size.cpp similarity index 100% rename from src/igl/min_size.cpp rename to src/libigl/igl/min_size.cpp diff --git a/src/igl/min_size.h b/src/libigl/igl/min_size.h similarity index 100% rename from src/igl/min_size.h rename to src/libigl/igl/min_size.h diff --git a/src/igl/mod.cpp b/src/libigl/igl/mod.cpp similarity index 100% rename from src/igl/mod.cpp rename to src/libigl/igl/mod.cpp diff --git a/src/igl/mod.h b/src/libigl/igl/mod.h similarity index 100% rename from src/igl/mod.h rename to src/libigl/igl/mod.h diff --git a/src/igl/mode.cpp b/src/libigl/igl/mode.cpp similarity index 100% rename from src/igl/mode.cpp rename to src/libigl/igl/mode.cpp diff --git a/src/igl/mode.h b/src/libigl/igl/mode.h similarity index 100% rename from src/igl/mode.h rename to src/libigl/igl/mode.h diff --git a/src/igl/mosek/bbw.cpp b/src/libigl/igl/mosek/bbw.cpp similarity index 100% rename from src/igl/mosek/bbw.cpp rename to src/libigl/igl/mosek/bbw.cpp diff --git a/src/igl/mosek/bbw.h b/src/libigl/igl/mosek/bbw.h similarity index 100% rename from src/igl/mosek/bbw.h rename to src/libigl/igl/mosek/bbw.h diff --git a/src/igl/mosek/mosek_guarded.cpp b/src/libigl/igl/mosek/mosek_guarded.cpp similarity index 100% rename from src/igl/mosek/mosek_guarded.cpp rename to src/libigl/igl/mosek/mosek_guarded.cpp diff --git a/src/igl/mosek/mosek_guarded.h b/src/libigl/igl/mosek/mosek_guarded.h similarity index 100% rename from src/igl/mosek/mosek_guarded.h rename to src/libigl/igl/mosek/mosek_guarded.h diff --git a/src/igl/mosek/mosek_linprog.cpp b/src/libigl/igl/mosek/mosek_linprog.cpp similarity index 100% rename from src/igl/mosek/mosek_linprog.cpp rename to src/libigl/igl/mosek/mosek_linprog.cpp diff --git a/src/igl/mosek/mosek_linprog.h b/src/libigl/igl/mosek/mosek_linprog.h similarity index 100% rename from src/igl/mosek/mosek_linprog.h rename to src/libigl/igl/mosek/mosek_linprog.h diff --git a/src/igl/mosek/mosek_quadprog.cpp b/src/libigl/igl/mosek/mosek_quadprog.cpp similarity index 100% rename from src/igl/mosek/mosek_quadprog.cpp rename to src/libigl/igl/mosek/mosek_quadprog.cpp diff --git a/src/igl/mosek/mosek_quadprog.h b/src/libigl/igl/mosek/mosek_quadprog.h similarity index 100% rename from src/igl/mosek/mosek_quadprog.h rename to src/libigl/igl/mosek/mosek_quadprog.h diff --git a/src/igl/mvc.cpp b/src/libigl/igl/mvc.cpp similarity index 100% rename from src/igl/mvc.cpp rename to src/libigl/igl/mvc.cpp diff --git a/src/igl/mvc.h b/src/libigl/igl/mvc.h similarity index 100% rename from src/igl/mvc.h rename to src/libigl/igl/mvc.h diff --git a/src/igl/nchoosek.cpp b/src/libigl/igl/nchoosek.cpp similarity index 100% rename from src/igl/nchoosek.cpp rename to src/libigl/igl/nchoosek.cpp diff --git a/src/igl/nchoosek.h b/src/libigl/igl/nchoosek.h similarity index 100% rename from src/igl/nchoosek.h rename to src/libigl/igl/nchoosek.h diff --git a/src/igl/next_filename.cpp b/src/libigl/igl/next_filename.cpp similarity index 100% rename from src/igl/next_filename.cpp rename to src/libigl/igl/next_filename.cpp diff --git a/src/igl/next_filename.h b/src/libigl/igl/next_filename.h similarity index 100% rename from src/igl/next_filename.h rename to src/libigl/igl/next_filename.h diff --git a/src/igl/normal_derivative.cpp b/src/libigl/igl/normal_derivative.cpp similarity index 100% rename from src/igl/normal_derivative.cpp rename to src/libigl/igl/normal_derivative.cpp diff --git a/src/igl/normal_derivative.h b/src/libigl/igl/normal_derivative.h similarity index 100% rename from src/igl/normal_derivative.h rename to src/libigl/igl/normal_derivative.h diff --git a/src/igl/normalize_quat.cpp b/src/libigl/igl/normalize_quat.cpp similarity index 100% rename from src/igl/normalize_quat.cpp rename to src/libigl/igl/normalize_quat.cpp diff --git a/src/igl/normalize_quat.h b/src/libigl/igl/normalize_quat.h similarity index 100% rename from src/igl/normalize_quat.h rename to src/libigl/igl/normalize_quat.h diff --git a/src/igl/normalize_row_lengths.cpp b/src/libigl/igl/normalize_row_lengths.cpp similarity index 100% rename from src/igl/normalize_row_lengths.cpp rename to src/libigl/igl/normalize_row_lengths.cpp diff --git a/src/igl/normalize_row_lengths.h b/src/libigl/igl/normalize_row_lengths.h similarity index 100% rename from src/igl/normalize_row_lengths.h rename to src/libigl/igl/normalize_row_lengths.h diff --git a/src/igl/normalize_row_sums.cpp b/src/libigl/igl/normalize_row_sums.cpp similarity index 100% rename from src/igl/normalize_row_sums.cpp rename to src/libigl/igl/normalize_row_sums.cpp diff --git a/src/igl/normalize_row_sums.h b/src/libigl/igl/normalize_row_sums.h similarity index 100% rename from src/igl/normalize_row_sums.h rename to src/libigl/igl/normalize_row_sums.h diff --git a/src/igl/null.cpp b/src/libigl/igl/null.cpp similarity index 100% rename from src/igl/null.cpp rename to src/libigl/igl/null.cpp diff --git a/src/igl/null.h b/src/libigl/igl/null.h similarity index 100% rename from src/igl/null.h rename to src/libigl/igl/null.h diff --git a/src/igl/octree.cpp b/src/libigl/igl/octree.cpp similarity index 100% rename from src/igl/octree.cpp rename to src/libigl/igl/octree.cpp diff --git a/src/igl/octree.h b/src/libigl/igl/octree.h similarity index 100% rename from src/igl/octree.h rename to src/libigl/igl/octree.h diff --git a/src/igl/on_boundary.cpp b/src/libigl/igl/on_boundary.cpp similarity index 100% rename from src/igl/on_boundary.cpp rename to src/libigl/igl/on_boundary.cpp diff --git a/src/igl/on_boundary.h b/src/libigl/igl/on_boundary.h similarity index 100% rename from src/igl/on_boundary.h rename to src/libigl/igl/on_boundary.h diff --git a/src/igl/opengl/MeshGL.cpp b/src/libigl/igl/opengl/MeshGL.cpp similarity index 100% rename from src/igl/opengl/MeshGL.cpp rename to src/libigl/igl/opengl/MeshGL.cpp diff --git a/src/igl/opengl/MeshGL.h b/src/libigl/igl/opengl/MeshGL.h similarity index 100% rename from src/igl/opengl/MeshGL.h rename to src/libigl/igl/opengl/MeshGL.h diff --git a/src/igl/opengl/ViewerCore.cpp b/src/libigl/igl/opengl/ViewerCore.cpp similarity index 100% rename from src/igl/opengl/ViewerCore.cpp rename to src/libigl/igl/opengl/ViewerCore.cpp diff --git a/src/igl/opengl/ViewerCore.h b/src/libigl/igl/opengl/ViewerCore.h similarity index 100% rename from src/igl/opengl/ViewerCore.h rename to src/libigl/igl/opengl/ViewerCore.h diff --git a/src/igl/opengl/ViewerData.cpp b/src/libigl/igl/opengl/ViewerData.cpp similarity index 100% rename from src/igl/opengl/ViewerData.cpp rename to src/libigl/igl/opengl/ViewerData.cpp diff --git a/src/igl/opengl/ViewerData.h b/src/libigl/igl/opengl/ViewerData.h similarity index 100% rename from src/igl/opengl/ViewerData.h rename to src/libigl/igl/opengl/ViewerData.h diff --git a/src/igl/opengl/bind_vertex_attrib_array.cpp b/src/libigl/igl/opengl/bind_vertex_attrib_array.cpp similarity index 100% rename from src/igl/opengl/bind_vertex_attrib_array.cpp rename to src/libigl/igl/opengl/bind_vertex_attrib_array.cpp diff --git a/src/igl/opengl/bind_vertex_attrib_array.h b/src/libigl/igl/opengl/bind_vertex_attrib_array.h similarity index 100% rename from src/igl/opengl/bind_vertex_attrib_array.h rename to src/libigl/igl/opengl/bind_vertex_attrib_array.h diff --git a/src/igl/opengl/create_index_vbo.cpp b/src/libigl/igl/opengl/create_index_vbo.cpp similarity index 100% rename from src/igl/opengl/create_index_vbo.cpp rename to src/libigl/igl/opengl/create_index_vbo.cpp diff --git a/src/igl/opengl/create_index_vbo.h b/src/libigl/igl/opengl/create_index_vbo.h similarity index 100% rename from src/igl/opengl/create_index_vbo.h rename to src/libigl/igl/opengl/create_index_vbo.h diff --git a/src/igl/opengl/create_mesh_vbo.cpp b/src/libigl/igl/opengl/create_mesh_vbo.cpp similarity index 100% rename from src/igl/opengl/create_mesh_vbo.cpp rename to src/libigl/igl/opengl/create_mesh_vbo.cpp diff --git a/src/igl/opengl/create_mesh_vbo.h b/src/libigl/igl/opengl/create_mesh_vbo.h similarity index 100% rename from src/igl/opengl/create_mesh_vbo.h rename to src/libigl/igl/opengl/create_mesh_vbo.h diff --git a/src/igl/opengl/create_shader_program.cpp b/src/libigl/igl/opengl/create_shader_program.cpp similarity index 100% rename from src/igl/opengl/create_shader_program.cpp rename to src/libigl/igl/opengl/create_shader_program.cpp diff --git a/src/igl/opengl/create_shader_program.h b/src/libigl/igl/opengl/create_shader_program.h similarity index 100% rename from src/igl/opengl/create_shader_program.h rename to src/libigl/igl/opengl/create_shader_program.h diff --git a/src/igl/opengl/create_vector_vbo.cpp b/src/libigl/igl/opengl/create_vector_vbo.cpp similarity index 100% rename from src/igl/opengl/create_vector_vbo.cpp rename to src/libigl/igl/opengl/create_vector_vbo.cpp diff --git a/src/igl/opengl/create_vector_vbo.h b/src/libigl/igl/opengl/create_vector_vbo.h similarity index 100% rename from src/igl/opengl/create_vector_vbo.h rename to src/libigl/igl/opengl/create_vector_vbo.h diff --git a/src/igl/opengl/destroy_shader_program.cpp b/src/libigl/igl/opengl/destroy_shader_program.cpp similarity index 100% rename from src/igl/opengl/destroy_shader_program.cpp rename to src/libigl/igl/opengl/destroy_shader_program.cpp diff --git a/src/igl/opengl/destroy_shader_program.h b/src/libigl/igl/opengl/destroy_shader_program.h similarity index 100% rename from src/igl/opengl/destroy_shader_program.h rename to src/libigl/igl/opengl/destroy_shader_program.h diff --git a/src/igl/opengl/gl.h b/src/libigl/igl/opengl/gl.h similarity index 100% rename from src/igl/opengl/gl.h rename to src/libigl/igl/opengl/gl.h diff --git a/src/igl/opengl/gl_type_size.cpp b/src/libigl/igl/opengl/gl_type_size.cpp similarity index 100% rename from src/igl/opengl/gl_type_size.cpp rename to src/libigl/igl/opengl/gl_type_size.cpp diff --git a/src/igl/opengl/gl_type_size.h b/src/libigl/igl/opengl/gl_type_size.h similarity index 100% rename from src/igl/opengl/gl_type_size.h rename to src/libigl/igl/opengl/gl_type_size.h diff --git a/src/igl/opengl/glfw/Viewer.cpp b/src/libigl/igl/opengl/glfw/Viewer.cpp similarity index 100% rename from src/igl/opengl/glfw/Viewer.cpp rename to src/libigl/igl/opengl/glfw/Viewer.cpp diff --git a/src/igl/opengl/glfw/Viewer.h b/src/libigl/igl/opengl/glfw/Viewer.h similarity index 100% rename from src/igl/opengl/glfw/Viewer.h rename to src/libigl/igl/opengl/glfw/Viewer.h diff --git a/src/igl/opengl/glfw/ViewerPlugin.h b/src/libigl/igl/opengl/glfw/ViewerPlugin.h similarity index 100% rename from src/igl/opengl/glfw/ViewerPlugin.h rename to src/libigl/igl/opengl/glfw/ViewerPlugin.h diff --git a/src/igl/opengl/glfw/background_window.cpp b/src/libigl/igl/opengl/glfw/background_window.cpp similarity index 100% rename from src/igl/opengl/glfw/background_window.cpp rename to src/libigl/igl/opengl/glfw/background_window.cpp diff --git a/src/igl/opengl/glfw/background_window.h b/src/libigl/igl/opengl/glfw/background_window.h similarity index 100% rename from src/igl/opengl/glfw/background_window.h rename to src/libigl/igl/opengl/glfw/background_window.h diff --git a/src/igl/opengl/glfw/imgui/ImGuiHelpers.h b/src/libigl/igl/opengl/glfw/imgui/ImGuiHelpers.h similarity index 100% rename from src/igl/opengl/glfw/imgui/ImGuiHelpers.h rename to src/libigl/igl/opengl/glfw/imgui/ImGuiHelpers.h diff --git a/src/igl/opengl/glfw/imgui/ImGuiMenu.cpp b/src/libigl/igl/opengl/glfw/imgui/ImGuiMenu.cpp similarity index 100% rename from src/igl/opengl/glfw/imgui/ImGuiMenu.cpp rename to src/libigl/igl/opengl/glfw/imgui/ImGuiMenu.cpp diff --git a/src/igl/opengl/glfw/imgui/ImGuiMenu.h b/src/libigl/igl/opengl/glfw/imgui/ImGuiMenu.h similarity index 100% rename from src/igl/opengl/glfw/imgui/ImGuiMenu.h rename to src/libigl/igl/opengl/glfw/imgui/ImGuiMenu.h diff --git a/src/igl/opengl/glfw/map_texture.cpp b/src/libigl/igl/opengl/glfw/map_texture.cpp similarity index 100% rename from src/igl/opengl/glfw/map_texture.cpp rename to src/libigl/igl/opengl/glfw/map_texture.cpp diff --git a/src/igl/opengl/glfw/map_texture.h b/src/libigl/igl/opengl/glfw/map_texture.h similarity index 100% rename from src/igl/opengl/glfw/map_texture.h rename to src/libigl/igl/opengl/glfw/map_texture.h diff --git a/src/igl/opengl/init_render_to_texture.cpp b/src/libigl/igl/opengl/init_render_to_texture.cpp similarity index 100% rename from src/igl/opengl/init_render_to_texture.cpp rename to src/libigl/igl/opengl/init_render_to_texture.cpp diff --git a/src/igl/opengl/init_render_to_texture.h b/src/libigl/igl/opengl/init_render_to_texture.h similarity index 100% rename from src/igl/opengl/init_render_to_texture.h rename to src/libigl/igl/opengl/init_render_to_texture.h diff --git a/src/igl/opengl/load_shader.cpp b/src/libigl/igl/opengl/load_shader.cpp similarity index 100% rename from src/igl/opengl/load_shader.cpp rename to src/libigl/igl/opengl/load_shader.cpp diff --git a/src/igl/opengl/load_shader.h b/src/libigl/igl/opengl/load_shader.h similarity index 100% rename from src/igl/opengl/load_shader.h rename to src/libigl/igl/opengl/load_shader.h diff --git a/src/igl/opengl/print_program_info_log.cpp b/src/libigl/igl/opengl/print_program_info_log.cpp similarity index 100% rename from src/igl/opengl/print_program_info_log.cpp rename to src/libigl/igl/opengl/print_program_info_log.cpp diff --git a/src/igl/opengl/print_program_info_log.h b/src/libigl/igl/opengl/print_program_info_log.h similarity index 100% rename from src/igl/opengl/print_program_info_log.h rename to src/libigl/igl/opengl/print_program_info_log.h diff --git a/src/igl/opengl/print_shader_info_log.cpp b/src/libigl/igl/opengl/print_shader_info_log.cpp similarity index 100% rename from src/igl/opengl/print_shader_info_log.cpp rename to src/libigl/igl/opengl/print_shader_info_log.cpp diff --git a/src/igl/opengl/print_shader_info_log.h b/src/libigl/igl/opengl/print_shader_info_log.h similarity index 100% rename from src/igl/opengl/print_shader_info_log.h rename to src/libigl/igl/opengl/print_shader_info_log.h diff --git a/src/igl/opengl/report_gl_error.cpp b/src/libigl/igl/opengl/report_gl_error.cpp similarity index 100% rename from src/igl/opengl/report_gl_error.cpp rename to src/libigl/igl/opengl/report_gl_error.cpp diff --git a/src/igl/opengl/report_gl_error.h b/src/libigl/igl/opengl/report_gl_error.h similarity index 100% rename from src/igl/opengl/report_gl_error.h rename to src/libigl/igl/opengl/report_gl_error.h diff --git a/src/igl/opengl/uniform_type_to_string.cpp b/src/libigl/igl/opengl/uniform_type_to_string.cpp similarity index 100% rename from src/igl/opengl/uniform_type_to_string.cpp rename to src/libigl/igl/opengl/uniform_type_to_string.cpp diff --git a/src/igl/opengl/uniform_type_to_string.h b/src/libigl/igl/opengl/uniform_type_to_string.h similarity index 100% rename from src/igl/opengl/uniform_type_to_string.h rename to src/libigl/igl/opengl/uniform_type_to_string.h diff --git a/src/igl/opengl/vertex_array.cpp b/src/libigl/igl/opengl/vertex_array.cpp similarity index 100% rename from src/igl/opengl/vertex_array.cpp rename to src/libigl/igl/opengl/vertex_array.cpp diff --git a/src/igl/opengl/vertex_array.h b/src/libigl/igl/opengl/vertex_array.h similarity index 100% rename from src/igl/opengl/vertex_array.h rename to src/libigl/igl/opengl/vertex_array.h diff --git a/src/igl/opengl2/MouseController.h b/src/libigl/igl/opengl2/MouseController.h similarity index 100% rename from src/igl/opengl2/MouseController.h rename to src/libigl/igl/opengl2/MouseController.h diff --git a/src/igl/opengl2/RotateWidget.h b/src/libigl/igl/opengl2/RotateWidget.h similarity index 100% rename from src/igl/opengl2/RotateWidget.h rename to src/libigl/igl/opengl2/RotateWidget.h diff --git a/src/igl/opengl2/TranslateWidget.h b/src/libigl/igl/opengl2/TranslateWidget.h similarity index 100% rename from src/igl/opengl2/TranslateWidget.h rename to src/libigl/igl/opengl2/TranslateWidget.h diff --git a/src/igl/opengl2/draw_beach_ball.cpp b/src/libigl/igl/opengl2/draw_beach_ball.cpp similarity index 100% rename from src/igl/opengl2/draw_beach_ball.cpp rename to src/libigl/igl/opengl2/draw_beach_ball.cpp diff --git a/src/igl/opengl2/draw_beach_ball.h b/src/libigl/igl/opengl2/draw_beach_ball.h similarity index 100% rename from src/igl/opengl2/draw_beach_ball.h rename to src/libigl/igl/opengl2/draw_beach_ball.h diff --git a/src/igl/opengl2/draw_floor.cpp b/src/libigl/igl/opengl2/draw_floor.cpp similarity index 100% rename from src/igl/opengl2/draw_floor.cpp rename to src/libigl/igl/opengl2/draw_floor.cpp diff --git a/src/igl/opengl2/draw_floor.h b/src/libigl/igl/opengl2/draw_floor.h similarity index 100% rename from src/igl/opengl2/draw_floor.h rename to src/libigl/igl/opengl2/draw_floor.h diff --git a/src/igl/opengl2/draw_mesh.cpp b/src/libigl/igl/opengl2/draw_mesh.cpp similarity index 100% rename from src/igl/opengl2/draw_mesh.cpp rename to src/libigl/igl/opengl2/draw_mesh.cpp diff --git a/src/igl/opengl2/draw_mesh.h b/src/libigl/igl/opengl2/draw_mesh.h similarity index 100% rename from src/igl/opengl2/draw_mesh.h rename to src/libigl/igl/opengl2/draw_mesh.h diff --git a/src/igl/opengl2/draw_point.cpp b/src/libigl/igl/opengl2/draw_point.cpp similarity index 100% rename from src/igl/opengl2/draw_point.cpp rename to src/libigl/igl/opengl2/draw_point.cpp diff --git a/src/igl/opengl2/draw_point.h b/src/libigl/igl/opengl2/draw_point.h similarity index 100% rename from src/igl/opengl2/draw_point.h rename to src/libigl/igl/opengl2/draw_point.h diff --git a/src/igl/opengl2/draw_rectangular_marquee.cpp b/src/libigl/igl/opengl2/draw_rectangular_marquee.cpp similarity index 100% rename from src/igl/opengl2/draw_rectangular_marquee.cpp rename to src/libigl/igl/opengl2/draw_rectangular_marquee.cpp diff --git a/src/igl/opengl2/draw_rectangular_marquee.h b/src/libigl/igl/opengl2/draw_rectangular_marquee.h similarity index 100% rename from src/igl/opengl2/draw_rectangular_marquee.h rename to src/libigl/igl/opengl2/draw_rectangular_marquee.h diff --git a/src/igl/opengl2/draw_skeleton_3d.cpp b/src/libigl/igl/opengl2/draw_skeleton_3d.cpp similarity index 100% rename from src/igl/opengl2/draw_skeleton_3d.cpp rename to src/libigl/igl/opengl2/draw_skeleton_3d.cpp diff --git a/src/igl/opengl2/draw_skeleton_3d.h b/src/libigl/igl/opengl2/draw_skeleton_3d.h similarity index 100% rename from src/igl/opengl2/draw_skeleton_3d.h rename to src/libigl/igl/opengl2/draw_skeleton_3d.h diff --git a/src/igl/opengl2/draw_skeleton_vector_graphics.cpp b/src/libigl/igl/opengl2/draw_skeleton_vector_graphics.cpp similarity index 100% rename from src/igl/opengl2/draw_skeleton_vector_graphics.cpp rename to src/libigl/igl/opengl2/draw_skeleton_vector_graphics.cpp diff --git a/src/igl/opengl2/draw_skeleton_vector_graphics.h b/src/libigl/igl/opengl2/draw_skeleton_vector_graphics.h similarity index 100% rename from src/igl/opengl2/draw_skeleton_vector_graphics.h rename to src/libigl/igl/opengl2/draw_skeleton_vector_graphics.h diff --git a/src/igl/opengl2/flare_textures.h b/src/libigl/igl/opengl2/flare_textures.h similarity index 100% rename from src/igl/opengl2/flare_textures.h rename to src/libigl/igl/opengl2/flare_textures.h diff --git a/src/igl/opengl2/gl.h b/src/libigl/igl/opengl2/gl.h similarity index 100% rename from src/igl/opengl2/gl.h rename to src/libigl/igl/opengl2/gl.h diff --git a/src/igl/opengl2/glext.h b/src/libigl/igl/opengl2/glext.h similarity index 100% rename from src/igl/opengl2/glext.h rename to src/libigl/igl/opengl2/glext.h diff --git a/src/igl/opengl2/glu.h b/src/libigl/igl/opengl2/glu.h similarity index 100% rename from src/igl/opengl2/glu.h rename to src/libigl/igl/opengl2/glu.h diff --git a/src/igl/opengl2/lens_flare.cpp b/src/libigl/igl/opengl2/lens_flare.cpp similarity index 100% rename from src/igl/opengl2/lens_flare.cpp rename to src/libigl/igl/opengl2/lens_flare.cpp diff --git a/src/igl/opengl2/lens_flare.h b/src/libigl/igl/opengl2/lens_flare.h similarity index 100% rename from src/igl/opengl2/lens_flare.h rename to src/libigl/igl/opengl2/lens_flare.h diff --git a/src/igl/opengl2/model_proj_viewport.cpp b/src/libigl/igl/opengl2/model_proj_viewport.cpp similarity index 100% rename from src/igl/opengl2/model_proj_viewport.cpp rename to src/libigl/igl/opengl2/model_proj_viewport.cpp diff --git a/src/igl/opengl2/model_proj_viewport.h b/src/libigl/igl/opengl2/model_proj_viewport.h similarity index 100% rename from src/igl/opengl2/model_proj_viewport.h rename to src/libigl/igl/opengl2/model_proj_viewport.h diff --git a/src/igl/opengl2/print_gl_get.cpp b/src/libigl/igl/opengl2/print_gl_get.cpp similarity index 100% rename from src/igl/opengl2/print_gl_get.cpp rename to src/libigl/igl/opengl2/print_gl_get.cpp diff --git a/src/igl/opengl2/print_gl_get.h b/src/libigl/igl/opengl2/print_gl_get.h similarity index 100% rename from src/igl/opengl2/print_gl_get.h rename to src/libigl/igl/opengl2/print_gl_get.h diff --git a/src/igl/opengl2/project.cpp b/src/libigl/igl/opengl2/project.cpp similarity index 100% rename from src/igl/opengl2/project.cpp rename to src/libigl/igl/opengl2/project.cpp diff --git a/src/igl/opengl2/project.h b/src/libigl/igl/opengl2/project.h similarity index 100% rename from src/igl/opengl2/project.h rename to src/libigl/igl/opengl2/project.h diff --git a/src/igl/opengl2/right_axis.cpp b/src/libigl/igl/opengl2/right_axis.cpp similarity index 100% rename from src/igl/opengl2/right_axis.cpp rename to src/libigl/igl/opengl2/right_axis.cpp diff --git a/src/igl/opengl2/right_axis.h b/src/libigl/igl/opengl2/right_axis.h similarity index 100% rename from src/igl/opengl2/right_axis.h rename to src/libigl/igl/opengl2/right_axis.h diff --git a/src/igl/opengl2/shine_textures.h b/src/libigl/igl/opengl2/shine_textures.h similarity index 100% rename from src/igl/opengl2/shine_textures.h rename to src/libigl/igl/opengl2/shine_textures.h diff --git a/src/igl/opengl2/sort_triangles.cpp b/src/libigl/igl/opengl2/sort_triangles.cpp similarity index 100% rename from src/igl/opengl2/sort_triangles.cpp rename to src/libigl/igl/opengl2/sort_triangles.cpp diff --git a/src/igl/opengl2/sort_triangles.h b/src/libigl/igl/opengl2/sort_triangles.h similarity index 100% rename from src/igl/opengl2/sort_triangles.h rename to src/libigl/igl/opengl2/sort_triangles.h diff --git a/src/igl/opengl2/unproject.cpp b/src/libigl/igl/opengl2/unproject.cpp similarity index 100% rename from src/igl/opengl2/unproject.cpp rename to src/libigl/igl/opengl2/unproject.cpp diff --git a/src/igl/opengl2/unproject.h b/src/libigl/igl/opengl2/unproject.h similarity index 100% rename from src/igl/opengl2/unproject.h rename to src/libigl/igl/opengl2/unproject.h diff --git a/src/igl/opengl2/unproject_to_zero_plane.cpp b/src/libigl/igl/opengl2/unproject_to_zero_plane.cpp similarity index 100% rename from src/igl/opengl2/unproject_to_zero_plane.cpp rename to src/libigl/igl/opengl2/unproject_to_zero_plane.cpp diff --git a/src/igl/opengl2/unproject_to_zero_plane.h b/src/libigl/igl/opengl2/unproject_to_zero_plane.h similarity index 100% rename from src/igl/opengl2/unproject_to_zero_plane.h rename to src/libigl/igl/opengl2/unproject_to_zero_plane.h diff --git a/src/igl/opengl2/up_axis.cpp b/src/libigl/igl/opengl2/up_axis.cpp similarity index 100% rename from src/igl/opengl2/up_axis.cpp rename to src/libigl/igl/opengl2/up_axis.cpp diff --git a/src/igl/opengl2/up_axis.h b/src/libigl/igl/opengl2/up_axis.h similarity index 100% rename from src/igl/opengl2/up_axis.h rename to src/libigl/igl/opengl2/up_axis.h diff --git a/src/igl/opengl2/view_axis.cpp b/src/libigl/igl/opengl2/view_axis.cpp similarity index 100% rename from src/igl/opengl2/view_axis.cpp rename to src/libigl/igl/opengl2/view_axis.cpp diff --git a/src/igl/opengl2/view_axis.h b/src/libigl/igl/opengl2/view_axis.h similarity index 100% rename from src/igl/opengl2/view_axis.h rename to src/libigl/igl/opengl2/view_axis.h diff --git a/src/igl/orient_outward.cpp b/src/libigl/igl/orient_outward.cpp similarity index 100% rename from src/igl/orient_outward.cpp rename to src/libigl/igl/orient_outward.cpp diff --git a/src/igl/orient_outward.h b/src/libigl/igl/orient_outward.h similarity index 100% rename from src/igl/orient_outward.h rename to src/libigl/igl/orient_outward.h diff --git a/src/igl/orientable_patches.cpp b/src/libigl/igl/orientable_patches.cpp similarity index 100% rename from src/igl/orientable_patches.cpp rename to src/libigl/igl/orientable_patches.cpp diff --git a/src/igl/orientable_patches.h b/src/libigl/igl/orientable_patches.h similarity index 100% rename from src/igl/orientable_patches.h rename to src/libigl/igl/orientable_patches.h diff --git a/src/igl/oriented_facets.cpp b/src/libigl/igl/oriented_facets.cpp similarity index 100% rename from src/igl/oriented_facets.cpp rename to src/libigl/igl/oriented_facets.cpp diff --git a/src/igl/oriented_facets.h b/src/libigl/igl/oriented_facets.h similarity index 100% rename from src/igl/oriented_facets.h rename to src/libigl/igl/oriented_facets.h diff --git a/src/igl/orth.cpp b/src/libigl/igl/orth.cpp similarity index 100% rename from src/igl/orth.cpp rename to src/libigl/igl/orth.cpp diff --git a/src/igl/orth.h b/src/libigl/igl/orth.h similarity index 100% rename from src/igl/orth.h rename to src/libigl/igl/orth.h diff --git a/src/igl/ortho.cpp b/src/libigl/igl/ortho.cpp similarity index 100% rename from src/igl/ortho.cpp rename to src/libigl/igl/ortho.cpp diff --git a/src/igl/ortho.h b/src/libigl/igl/ortho.h similarity index 100% rename from src/igl/ortho.h rename to src/libigl/igl/ortho.h diff --git a/src/igl/outer_element.cpp b/src/libigl/igl/outer_element.cpp similarity index 100% rename from src/igl/outer_element.cpp rename to src/libigl/igl/outer_element.cpp diff --git a/src/igl/outer_element.h b/src/libigl/igl/outer_element.h similarity index 100% rename from src/igl/outer_element.h rename to src/libigl/igl/outer_element.h diff --git a/src/igl/parallel_for.h b/src/libigl/igl/parallel_for.h similarity index 100% rename from src/igl/parallel_for.h rename to src/libigl/igl/parallel_for.h diff --git a/src/igl/parallel_transport_angles.cpp b/src/libigl/igl/parallel_transport_angles.cpp similarity index 100% rename from src/igl/parallel_transport_angles.cpp rename to src/libigl/igl/parallel_transport_angles.cpp diff --git a/src/igl/parallel_transport_angles.h b/src/libigl/igl/parallel_transport_angles.h similarity index 100% rename from src/igl/parallel_transport_angles.h rename to src/libigl/igl/parallel_transport_angles.h diff --git a/src/igl/partition.cpp b/src/libigl/igl/partition.cpp similarity index 100% rename from src/igl/partition.cpp rename to src/libigl/igl/partition.cpp diff --git a/src/igl/partition.h b/src/libigl/igl/partition.h similarity index 100% rename from src/igl/partition.h rename to src/libigl/igl/partition.h diff --git a/src/igl/parula.cpp b/src/libigl/igl/parula.cpp similarity index 100% rename from src/igl/parula.cpp rename to src/libigl/igl/parula.cpp diff --git a/src/igl/parula.h b/src/libigl/igl/parula.h similarity index 100% rename from src/igl/parula.h rename to src/libigl/igl/parula.h diff --git a/src/igl/path_to_executable.cpp b/src/libigl/igl/path_to_executable.cpp similarity index 100% rename from src/igl/path_to_executable.cpp rename to src/libigl/igl/path_to_executable.cpp diff --git a/src/igl/path_to_executable.h b/src/libigl/igl/path_to_executable.h similarity index 100% rename from src/igl/path_to_executable.h rename to src/libigl/igl/path_to_executable.h diff --git a/src/igl/pathinfo.cpp b/src/libigl/igl/pathinfo.cpp similarity index 100% rename from src/igl/pathinfo.cpp rename to src/libigl/igl/pathinfo.cpp diff --git a/src/igl/pathinfo.h b/src/libigl/igl/pathinfo.h similarity index 100% rename from src/igl/pathinfo.h rename to src/libigl/igl/pathinfo.h diff --git a/src/igl/per_corner_normals.cpp b/src/libigl/igl/per_corner_normals.cpp similarity index 100% rename from src/igl/per_corner_normals.cpp rename to src/libigl/igl/per_corner_normals.cpp diff --git a/src/igl/per_corner_normals.h b/src/libigl/igl/per_corner_normals.h similarity index 100% rename from src/igl/per_corner_normals.h rename to src/libigl/igl/per_corner_normals.h diff --git a/src/igl/per_edge_normals.cpp b/src/libigl/igl/per_edge_normals.cpp similarity index 100% rename from src/igl/per_edge_normals.cpp rename to src/libigl/igl/per_edge_normals.cpp diff --git a/src/igl/per_edge_normals.h b/src/libigl/igl/per_edge_normals.h similarity index 100% rename from src/igl/per_edge_normals.h rename to src/libigl/igl/per_edge_normals.h diff --git a/src/igl/per_face_normals.cpp b/src/libigl/igl/per_face_normals.cpp similarity index 100% rename from src/igl/per_face_normals.cpp rename to src/libigl/igl/per_face_normals.cpp diff --git a/src/igl/per_face_normals.h b/src/libigl/igl/per_face_normals.h similarity index 100% rename from src/igl/per_face_normals.h rename to src/libigl/igl/per_face_normals.h diff --git a/src/igl/per_vertex_attribute_smoothing.cpp b/src/libigl/igl/per_vertex_attribute_smoothing.cpp similarity index 100% rename from src/igl/per_vertex_attribute_smoothing.cpp rename to src/libigl/igl/per_vertex_attribute_smoothing.cpp diff --git a/src/igl/per_vertex_attribute_smoothing.h b/src/libigl/igl/per_vertex_attribute_smoothing.h similarity index 100% rename from src/igl/per_vertex_attribute_smoothing.h rename to src/libigl/igl/per_vertex_attribute_smoothing.h diff --git a/src/igl/per_vertex_normals.cpp b/src/libigl/igl/per_vertex_normals.cpp similarity index 100% rename from src/igl/per_vertex_normals.cpp rename to src/libigl/igl/per_vertex_normals.cpp diff --git a/src/igl/per_vertex_normals.h b/src/libigl/igl/per_vertex_normals.h similarity index 100% rename from src/igl/per_vertex_normals.h rename to src/libigl/igl/per_vertex_normals.h diff --git a/src/igl/per_vertex_point_to_plane_quadrics.cpp b/src/libigl/igl/per_vertex_point_to_plane_quadrics.cpp similarity index 100% rename from src/igl/per_vertex_point_to_plane_quadrics.cpp rename to src/libigl/igl/per_vertex_point_to_plane_quadrics.cpp diff --git a/src/igl/per_vertex_point_to_plane_quadrics.h b/src/libigl/igl/per_vertex_point_to_plane_quadrics.h similarity index 100% rename from src/igl/per_vertex_point_to_plane_quadrics.h rename to src/libigl/igl/per_vertex_point_to_plane_quadrics.h diff --git a/src/igl/piecewise_constant_winding_number.cpp b/src/libigl/igl/piecewise_constant_winding_number.cpp similarity index 100% rename from src/igl/piecewise_constant_winding_number.cpp rename to src/libigl/igl/piecewise_constant_winding_number.cpp diff --git a/src/igl/piecewise_constant_winding_number.h b/src/libigl/igl/piecewise_constant_winding_number.h similarity index 100% rename from src/igl/piecewise_constant_winding_number.h rename to src/libigl/igl/piecewise_constant_winding_number.h diff --git a/src/igl/pinv.cpp b/src/libigl/igl/pinv.cpp similarity index 100% rename from src/igl/pinv.cpp rename to src/libigl/igl/pinv.cpp diff --git a/src/igl/pinv.h b/src/libigl/igl/pinv.h similarity index 100% rename from src/igl/pinv.h rename to src/libigl/igl/pinv.h diff --git a/src/igl/planarize_quad_mesh.cpp b/src/libigl/igl/planarize_quad_mesh.cpp similarity index 100% rename from src/igl/planarize_quad_mesh.cpp rename to src/libigl/igl/planarize_quad_mesh.cpp diff --git a/src/igl/planarize_quad_mesh.h b/src/libigl/igl/planarize_quad_mesh.h similarity index 100% rename from src/igl/planarize_quad_mesh.h rename to src/libigl/igl/planarize_quad_mesh.h diff --git a/src/igl/ply.h b/src/libigl/igl/ply.h similarity index 100% rename from src/igl/ply.h rename to src/libigl/igl/ply.h diff --git a/src/igl/png/readPNG.cpp b/src/libigl/igl/png/readPNG.cpp similarity index 100% rename from src/igl/png/readPNG.cpp rename to src/libigl/igl/png/readPNG.cpp diff --git a/src/igl/png/readPNG.h b/src/libigl/igl/png/readPNG.h similarity index 100% rename from src/igl/png/readPNG.h rename to src/libigl/igl/png/readPNG.h diff --git a/src/igl/png/render_to_png.cpp b/src/libigl/igl/png/render_to_png.cpp similarity index 100% rename from src/igl/png/render_to_png.cpp rename to src/libigl/igl/png/render_to_png.cpp diff --git a/src/igl/png/render_to_png.h b/src/libigl/igl/png/render_to_png.h similarity index 100% rename from src/igl/png/render_to_png.h rename to src/libigl/igl/png/render_to_png.h diff --git a/src/igl/png/render_to_png_async.cpp b/src/libigl/igl/png/render_to_png_async.cpp similarity index 100% rename from src/igl/png/render_to_png_async.cpp rename to src/libigl/igl/png/render_to_png_async.cpp diff --git a/src/igl/png/render_to_png_async.h b/src/libigl/igl/png/render_to_png_async.h similarity index 100% rename from src/igl/png/render_to_png_async.h rename to src/libigl/igl/png/render_to_png_async.h diff --git a/src/igl/png/texture_from_file.cpp b/src/libigl/igl/png/texture_from_file.cpp similarity index 100% rename from src/igl/png/texture_from_file.cpp rename to src/libigl/igl/png/texture_from_file.cpp diff --git a/src/igl/png/texture_from_file.h b/src/libigl/igl/png/texture_from_file.h similarity index 100% rename from src/igl/png/texture_from_file.h rename to src/libigl/igl/png/texture_from_file.h diff --git a/src/igl/png/texture_from_png.cpp b/src/libigl/igl/png/texture_from_png.cpp similarity index 100% rename from src/igl/png/texture_from_png.cpp rename to src/libigl/igl/png/texture_from_png.cpp diff --git a/src/igl/png/texture_from_png.h b/src/libigl/igl/png/texture_from_png.h similarity index 100% rename from src/igl/png/texture_from_png.h rename to src/libigl/igl/png/texture_from_png.h diff --git a/src/igl/png/writePNG.cpp b/src/libigl/igl/png/writePNG.cpp similarity index 100% rename from src/igl/png/writePNG.cpp rename to src/libigl/igl/png/writePNG.cpp diff --git a/src/igl/png/writePNG.h b/src/libigl/igl/png/writePNG.h similarity index 100% rename from src/igl/png/writePNG.h rename to src/libigl/igl/png/writePNG.h diff --git a/src/igl/point_in_circle.cpp b/src/libigl/igl/point_in_circle.cpp similarity index 100% rename from src/igl/point_in_circle.cpp rename to src/libigl/igl/point_in_circle.cpp diff --git a/src/igl/point_in_circle.h b/src/libigl/igl/point_in_circle.h similarity index 100% rename from src/igl/point_in_circle.h rename to src/libigl/igl/point_in_circle.h diff --git a/src/igl/point_in_poly.cpp b/src/libigl/igl/point_in_poly.cpp similarity index 100% rename from src/igl/point_in_poly.cpp rename to src/libigl/igl/point_in_poly.cpp diff --git a/src/igl/point_in_poly.h b/src/libigl/igl/point_in_poly.h similarity index 100% rename from src/igl/point_in_poly.h rename to src/libigl/igl/point_in_poly.h diff --git a/src/igl/point_mesh_squared_distance.cpp b/src/libigl/igl/point_mesh_squared_distance.cpp similarity index 100% rename from src/igl/point_mesh_squared_distance.cpp rename to src/libigl/igl/point_mesh_squared_distance.cpp diff --git a/src/igl/point_mesh_squared_distance.h b/src/libigl/igl/point_mesh_squared_distance.h similarity index 100% rename from src/igl/point_mesh_squared_distance.h rename to src/libigl/igl/point_mesh_squared_distance.h diff --git a/src/igl/point_simplex_squared_distance.cpp b/src/libigl/igl/point_simplex_squared_distance.cpp similarity index 100% rename from src/igl/point_simplex_squared_distance.cpp rename to src/libigl/igl/point_simplex_squared_distance.cpp diff --git a/src/igl/point_simplex_squared_distance.h b/src/libigl/igl/point_simplex_squared_distance.h similarity index 100% rename from src/igl/point_simplex_squared_distance.h rename to src/libigl/igl/point_simplex_squared_distance.h diff --git a/src/igl/polar_dec.cpp b/src/libigl/igl/polar_dec.cpp similarity index 100% rename from src/igl/polar_dec.cpp rename to src/libigl/igl/polar_dec.cpp diff --git a/src/igl/polar_dec.h b/src/libigl/igl/polar_dec.h similarity index 100% rename from src/igl/polar_dec.h rename to src/libigl/igl/polar_dec.h diff --git a/src/igl/polar_svd.cpp b/src/libigl/igl/polar_svd.cpp similarity index 100% rename from src/igl/polar_svd.cpp rename to src/libigl/igl/polar_svd.cpp diff --git a/src/igl/polar_svd.h b/src/libigl/igl/polar_svd.h similarity index 100% rename from src/igl/polar_svd.h rename to src/libigl/igl/polar_svd.h diff --git a/src/igl/polar_svd3x3.cpp b/src/libigl/igl/polar_svd3x3.cpp similarity index 100% rename from src/igl/polar_svd3x3.cpp rename to src/libigl/igl/polar_svd3x3.cpp diff --git a/src/igl/polar_svd3x3.h b/src/libigl/igl/polar_svd3x3.h similarity index 100% rename from src/igl/polar_svd3x3.h rename to src/libigl/igl/polar_svd3x3.h diff --git a/src/igl/polygon_mesh_to_triangle_mesh.cpp b/src/libigl/igl/polygon_mesh_to_triangle_mesh.cpp similarity index 100% rename from src/igl/polygon_mesh_to_triangle_mesh.cpp rename to src/libigl/igl/polygon_mesh_to_triangle_mesh.cpp diff --git a/src/igl/polygon_mesh_to_triangle_mesh.h b/src/libigl/igl/polygon_mesh_to_triangle_mesh.h similarity index 100% rename from src/igl/polygon_mesh_to_triangle_mesh.h rename to src/libigl/igl/polygon_mesh_to_triangle_mesh.h diff --git a/src/igl/principal_curvature.cpp b/src/libigl/igl/principal_curvature.cpp similarity index 100% rename from src/igl/principal_curvature.cpp rename to src/libigl/igl/principal_curvature.cpp diff --git a/src/igl/principal_curvature.h b/src/libigl/igl/principal_curvature.h similarity index 100% rename from src/igl/principal_curvature.h rename to src/libigl/igl/principal_curvature.h diff --git a/src/igl/print_ijv.cpp b/src/libigl/igl/print_ijv.cpp similarity index 100% rename from src/igl/print_ijv.cpp rename to src/libigl/igl/print_ijv.cpp diff --git a/src/igl/print_ijv.h b/src/libigl/igl/print_ijv.h similarity index 100% rename from src/igl/print_ijv.h rename to src/libigl/igl/print_ijv.h diff --git a/src/igl/print_vector.cpp b/src/libigl/igl/print_vector.cpp similarity index 100% rename from src/igl/print_vector.cpp rename to src/libigl/igl/print_vector.cpp diff --git a/src/igl/print_vector.h b/src/libigl/igl/print_vector.h similarity index 100% rename from src/igl/print_vector.h rename to src/libigl/igl/print_vector.h diff --git a/src/igl/procrustes.cpp b/src/libigl/igl/procrustes.cpp similarity index 100% rename from src/igl/procrustes.cpp rename to src/libigl/igl/procrustes.cpp diff --git a/src/igl/procrustes.h b/src/libigl/igl/procrustes.h similarity index 100% rename from src/igl/procrustes.h rename to src/libigl/igl/procrustes.h diff --git a/src/igl/project.cpp b/src/libigl/igl/project.cpp similarity index 100% rename from src/igl/project.cpp rename to src/libigl/igl/project.cpp diff --git a/src/igl/project.h b/src/libigl/igl/project.h similarity index 100% rename from src/igl/project.h rename to src/libigl/igl/project.h diff --git a/src/igl/project_isometrically_to_plane.cpp b/src/libigl/igl/project_isometrically_to_plane.cpp similarity index 100% rename from src/igl/project_isometrically_to_plane.cpp rename to src/libigl/igl/project_isometrically_to_plane.cpp diff --git a/src/igl/project_isometrically_to_plane.h b/src/libigl/igl/project_isometrically_to_plane.h similarity index 100% rename from src/igl/project_isometrically_to_plane.h rename to src/libigl/igl/project_isometrically_to_plane.h diff --git a/src/igl/project_to_line.cpp b/src/libigl/igl/project_to_line.cpp similarity index 100% rename from src/igl/project_to_line.cpp rename to src/libigl/igl/project_to_line.cpp diff --git a/src/igl/project_to_line.h b/src/libigl/igl/project_to_line.h similarity index 100% rename from src/igl/project_to_line.h rename to src/libigl/igl/project_to_line.h diff --git a/src/igl/project_to_line_segment.cpp b/src/libigl/igl/project_to_line_segment.cpp similarity index 100% rename from src/igl/project_to_line_segment.cpp rename to src/libigl/igl/project_to_line_segment.cpp diff --git a/src/igl/project_to_line_segment.h b/src/libigl/igl/project_to_line_segment.h similarity index 100% rename from src/igl/project_to_line_segment.h rename to src/libigl/igl/project_to_line_segment.h diff --git a/src/igl/pseudonormal_test.cpp b/src/libigl/igl/pseudonormal_test.cpp similarity index 100% rename from src/igl/pseudonormal_test.cpp rename to src/libigl/igl/pseudonormal_test.cpp diff --git a/src/igl/pseudonormal_test.h b/src/libigl/igl/pseudonormal_test.h similarity index 100% rename from src/igl/pseudonormal_test.h rename to src/libigl/igl/pseudonormal_test.h diff --git a/src/igl/pso.cpp b/src/libigl/igl/pso.cpp similarity index 100% rename from src/igl/pso.cpp rename to src/libigl/igl/pso.cpp diff --git a/src/igl/pso.h b/src/libigl/igl/pso.h similarity index 100% rename from src/igl/pso.h rename to src/libigl/igl/pso.h diff --git a/src/igl/qslim.cpp b/src/libigl/igl/qslim.cpp similarity index 100% rename from src/igl/qslim.cpp rename to src/libigl/igl/qslim.cpp diff --git a/src/igl/qslim.h b/src/libigl/igl/qslim.h similarity index 100% rename from src/igl/qslim.h rename to src/libigl/igl/qslim.h diff --git a/src/igl/qslim_optimal_collapse_edge_callbacks.cpp b/src/libigl/igl/qslim_optimal_collapse_edge_callbacks.cpp similarity index 100% rename from src/igl/qslim_optimal_collapse_edge_callbacks.cpp rename to src/libigl/igl/qslim_optimal_collapse_edge_callbacks.cpp diff --git a/src/igl/qslim_optimal_collapse_edge_callbacks.h b/src/libigl/igl/qslim_optimal_collapse_edge_callbacks.h similarity index 100% rename from src/igl/qslim_optimal_collapse_edge_callbacks.h rename to src/libigl/igl/qslim_optimal_collapse_edge_callbacks.h diff --git a/src/igl/quad_planarity.cpp b/src/libigl/igl/quad_planarity.cpp similarity index 100% rename from src/igl/quad_planarity.cpp rename to src/libigl/igl/quad_planarity.cpp diff --git a/src/igl/quad_planarity.h b/src/libigl/igl/quad_planarity.h similarity index 100% rename from src/igl/quad_planarity.h rename to src/libigl/igl/quad_planarity.h diff --git a/src/igl/quadric_binary_plus_operator.cpp b/src/libigl/igl/quadric_binary_plus_operator.cpp similarity index 100% rename from src/igl/quadric_binary_plus_operator.cpp rename to src/libigl/igl/quadric_binary_plus_operator.cpp diff --git a/src/igl/quadric_binary_plus_operator.h b/src/libigl/igl/quadric_binary_plus_operator.h similarity index 100% rename from src/igl/quadric_binary_plus_operator.h rename to src/libigl/igl/quadric_binary_plus_operator.h diff --git a/src/igl/quat_conjugate.cpp b/src/libigl/igl/quat_conjugate.cpp similarity index 100% rename from src/igl/quat_conjugate.cpp rename to src/libigl/igl/quat_conjugate.cpp diff --git a/src/igl/quat_conjugate.h b/src/libigl/igl/quat_conjugate.h similarity index 100% rename from src/igl/quat_conjugate.h rename to src/libigl/igl/quat_conjugate.h diff --git a/src/igl/quat_mult.cpp b/src/libigl/igl/quat_mult.cpp similarity index 100% rename from src/igl/quat_mult.cpp rename to src/libigl/igl/quat_mult.cpp diff --git a/src/igl/quat_mult.h b/src/libigl/igl/quat_mult.h similarity index 100% rename from src/igl/quat_mult.h rename to src/libigl/igl/quat_mult.h diff --git a/src/igl/quat_to_axis_angle.cpp b/src/libigl/igl/quat_to_axis_angle.cpp similarity index 100% rename from src/igl/quat_to_axis_angle.cpp rename to src/libigl/igl/quat_to_axis_angle.cpp diff --git a/src/igl/quat_to_axis_angle.h b/src/libigl/igl/quat_to_axis_angle.h similarity index 100% rename from src/igl/quat_to_axis_angle.h rename to src/libigl/igl/quat_to_axis_angle.h diff --git a/src/igl/quat_to_mat.cpp b/src/libigl/igl/quat_to_mat.cpp similarity index 100% rename from src/igl/quat_to_mat.cpp rename to src/libigl/igl/quat_to_mat.cpp diff --git a/src/igl/quat_to_mat.h b/src/libigl/igl/quat_to_mat.h similarity index 100% rename from src/igl/quat_to_mat.h rename to src/libigl/igl/quat_to_mat.h diff --git a/src/igl/quats_to_column.cpp b/src/libigl/igl/quats_to_column.cpp similarity index 100% rename from src/igl/quats_to_column.cpp rename to src/libigl/igl/quats_to_column.cpp diff --git a/src/igl/quats_to_column.h b/src/libigl/igl/quats_to_column.h similarity index 100% rename from src/igl/quats_to_column.h rename to src/libigl/igl/quats_to_column.h diff --git a/src/igl/ramer_douglas_peucker.cpp b/src/libigl/igl/ramer_douglas_peucker.cpp similarity index 100% rename from src/igl/ramer_douglas_peucker.cpp rename to src/libigl/igl/ramer_douglas_peucker.cpp diff --git a/src/igl/ramer_douglas_peucker.h b/src/libigl/igl/ramer_douglas_peucker.h similarity index 100% rename from src/igl/ramer_douglas_peucker.h rename to src/libigl/igl/ramer_douglas_peucker.h diff --git a/src/igl/random_dir.cpp b/src/libigl/igl/random_dir.cpp similarity index 100% rename from src/igl/random_dir.cpp rename to src/libigl/igl/random_dir.cpp diff --git a/src/igl/random_dir.h b/src/libigl/igl/random_dir.h similarity index 100% rename from src/igl/random_dir.h rename to src/libigl/igl/random_dir.h diff --git a/src/igl/random_points_on_mesh.cpp b/src/libigl/igl/random_points_on_mesh.cpp similarity index 100% rename from src/igl/random_points_on_mesh.cpp rename to src/libigl/igl/random_points_on_mesh.cpp diff --git a/src/igl/random_points_on_mesh.h b/src/libigl/igl/random_points_on_mesh.h similarity index 100% rename from src/igl/random_points_on_mesh.h rename to src/libigl/igl/random_points_on_mesh.h diff --git a/src/igl/random_quaternion.cpp b/src/libigl/igl/random_quaternion.cpp similarity index 100% rename from src/igl/random_quaternion.cpp rename to src/libigl/igl/random_quaternion.cpp diff --git a/src/igl/random_quaternion.h b/src/libigl/igl/random_quaternion.h similarity index 100% rename from src/igl/random_quaternion.h rename to src/libigl/igl/random_quaternion.h diff --git a/src/igl/random_search.cpp b/src/libigl/igl/random_search.cpp similarity index 100% rename from src/igl/random_search.cpp rename to src/libigl/igl/random_search.cpp diff --git a/src/igl/random_search.h b/src/libigl/igl/random_search.h similarity index 100% rename from src/igl/random_search.h rename to src/libigl/igl/random_search.h diff --git a/src/igl/randperm.cpp b/src/libigl/igl/randperm.cpp similarity index 100% rename from src/igl/randperm.cpp rename to src/libigl/igl/randperm.cpp diff --git a/src/igl/randperm.h b/src/libigl/igl/randperm.h similarity index 100% rename from src/igl/randperm.h rename to src/libigl/igl/randperm.h diff --git a/src/igl/ray_box_intersect.cpp b/src/libigl/igl/ray_box_intersect.cpp similarity index 100% rename from src/igl/ray_box_intersect.cpp rename to src/libigl/igl/ray_box_intersect.cpp diff --git a/src/igl/ray_box_intersect.h b/src/libigl/igl/ray_box_intersect.h similarity index 100% rename from src/igl/ray_box_intersect.h rename to src/libigl/igl/ray_box_intersect.h diff --git a/src/igl/ray_mesh_intersect.cpp b/src/libigl/igl/ray_mesh_intersect.cpp similarity index 100% rename from src/igl/ray_mesh_intersect.cpp rename to src/libigl/igl/ray_mesh_intersect.cpp diff --git a/src/igl/ray_mesh_intersect.h b/src/libigl/igl/ray_mesh_intersect.h similarity index 100% rename from src/igl/ray_mesh_intersect.h rename to src/libigl/igl/ray_mesh_intersect.h diff --git a/src/igl/ray_sphere_intersect.cpp b/src/libigl/igl/ray_sphere_intersect.cpp similarity index 100% rename from src/igl/ray_sphere_intersect.cpp rename to src/libigl/igl/ray_sphere_intersect.cpp diff --git a/src/igl/ray_sphere_intersect.h b/src/libigl/igl/ray_sphere_intersect.h similarity index 100% rename from src/igl/ray_sphere_intersect.h rename to src/libigl/igl/ray_sphere_intersect.h diff --git a/src/igl/raytri.c b/src/libigl/igl/raytri.c similarity index 100% rename from src/igl/raytri.c rename to src/libigl/igl/raytri.c diff --git a/src/igl/readBF.cpp b/src/libigl/igl/readBF.cpp similarity index 100% rename from src/igl/readBF.cpp rename to src/libigl/igl/readBF.cpp diff --git a/src/igl/readBF.h b/src/libigl/igl/readBF.h similarity index 100% rename from src/igl/readBF.h rename to src/libigl/igl/readBF.h diff --git a/src/igl/readCSV.cpp b/src/libigl/igl/readCSV.cpp similarity index 100% rename from src/igl/readCSV.cpp rename to src/libigl/igl/readCSV.cpp diff --git a/src/igl/readCSV.h b/src/libigl/igl/readCSV.h similarity index 100% rename from src/igl/readCSV.h rename to src/libigl/igl/readCSV.h diff --git a/src/igl/readDMAT.cpp b/src/libigl/igl/readDMAT.cpp similarity index 100% rename from src/igl/readDMAT.cpp rename to src/libigl/igl/readDMAT.cpp diff --git a/src/igl/readDMAT.h b/src/libigl/igl/readDMAT.h similarity index 100% rename from src/igl/readDMAT.h rename to src/libigl/igl/readDMAT.h diff --git a/src/igl/readMESH.cpp b/src/libigl/igl/readMESH.cpp similarity index 100% rename from src/igl/readMESH.cpp rename to src/libigl/igl/readMESH.cpp diff --git a/src/igl/readMESH.h b/src/libigl/igl/readMESH.h similarity index 100% rename from src/igl/readMESH.h rename to src/libigl/igl/readMESH.h diff --git a/src/igl/readMSH.cpp b/src/libigl/igl/readMSH.cpp similarity index 100% rename from src/igl/readMSH.cpp rename to src/libigl/igl/readMSH.cpp diff --git a/src/igl/readMSH.h b/src/libigl/igl/readMSH.h similarity index 100% rename from src/igl/readMSH.h rename to src/libigl/igl/readMSH.h diff --git a/src/igl/readNODE.cpp b/src/libigl/igl/readNODE.cpp similarity index 100% rename from src/igl/readNODE.cpp rename to src/libigl/igl/readNODE.cpp diff --git a/src/igl/readNODE.h b/src/libigl/igl/readNODE.h similarity index 100% rename from src/igl/readNODE.h rename to src/libigl/igl/readNODE.h diff --git a/src/igl/readOBJ.cpp b/src/libigl/igl/readOBJ.cpp similarity index 100% rename from src/igl/readOBJ.cpp rename to src/libigl/igl/readOBJ.cpp diff --git a/src/igl/readOBJ.h b/src/libigl/igl/readOBJ.h similarity index 100% rename from src/igl/readOBJ.h rename to src/libigl/igl/readOBJ.h diff --git a/src/igl/readOFF.cpp b/src/libigl/igl/readOFF.cpp similarity index 100% rename from src/igl/readOFF.cpp rename to src/libigl/igl/readOFF.cpp diff --git a/src/igl/readOFF.h b/src/libigl/igl/readOFF.h similarity index 100% rename from src/igl/readOFF.h rename to src/libigl/igl/readOFF.h diff --git a/src/igl/readPLY.cpp b/src/libigl/igl/readPLY.cpp similarity index 100% rename from src/igl/readPLY.cpp rename to src/libigl/igl/readPLY.cpp diff --git a/src/igl/readPLY.h b/src/libigl/igl/readPLY.h similarity index 100% rename from src/igl/readPLY.h rename to src/libigl/igl/readPLY.h diff --git a/src/igl/readSTL.cpp b/src/libigl/igl/readSTL.cpp similarity index 100% rename from src/igl/readSTL.cpp rename to src/libigl/igl/readSTL.cpp diff --git a/src/igl/readSTL.h b/src/libigl/igl/readSTL.h similarity index 100% rename from src/igl/readSTL.h rename to src/libigl/igl/readSTL.h diff --git a/src/igl/readTGF.cpp b/src/libigl/igl/readTGF.cpp similarity index 100% rename from src/igl/readTGF.cpp rename to src/libigl/igl/readTGF.cpp diff --git a/src/igl/readTGF.h b/src/libigl/igl/readTGF.h similarity index 100% rename from src/igl/readTGF.h rename to src/libigl/igl/readTGF.h diff --git a/src/igl/readWRL.cpp b/src/libigl/igl/readWRL.cpp similarity index 100% rename from src/igl/readWRL.cpp rename to src/libigl/igl/readWRL.cpp diff --git a/src/igl/readWRL.h b/src/libigl/igl/readWRL.h similarity index 100% rename from src/igl/readWRL.h rename to src/libigl/igl/readWRL.h diff --git a/src/igl/read_triangle_mesh.cpp b/src/libigl/igl/read_triangle_mesh.cpp similarity index 100% rename from src/igl/read_triangle_mesh.cpp rename to src/libigl/igl/read_triangle_mesh.cpp diff --git a/src/igl/read_triangle_mesh.h b/src/libigl/igl/read_triangle_mesh.h similarity index 100% rename from src/igl/read_triangle_mesh.h rename to src/libigl/igl/read_triangle_mesh.h diff --git a/src/igl/redux.h b/src/libigl/igl/redux.h similarity index 100% rename from src/igl/redux.h rename to src/libigl/igl/redux.h diff --git a/src/igl/remesh_along_isoline.cpp b/src/libigl/igl/remesh_along_isoline.cpp similarity index 100% rename from src/igl/remesh_along_isoline.cpp rename to src/libigl/igl/remesh_along_isoline.cpp diff --git a/src/igl/remesh_along_isoline.h b/src/libigl/igl/remesh_along_isoline.h similarity index 100% rename from src/igl/remesh_along_isoline.h rename to src/libigl/igl/remesh_along_isoline.h diff --git a/src/igl/remove_duplicate_vertices.cpp b/src/libigl/igl/remove_duplicate_vertices.cpp similarity index 100% rename from src/igl/remove_duplicate_vertices.cpp rename to src/libigl/igl/remove_duplicate_vertices.cpp diff --git a/src/igl/remove_duplicate_vertices.h b/src/libigl/igl/remove_duplicate_vertices.h similarity index 100% rename from src/igl/remove_duplicate_vertices.h rename to src/libigl/igl/remove_duplicate_vertices.h diff --git a/src/igl/remove_duplicates.cpp b/src/libigl/igl/remove_duplicates.cpp similarity index 100% rename from src/igl/remove_duplicates.cpp rename to src/libigl/igl/remove_duplicates.cpp diff --git a/src/igl/remove_duplicates.h b/src/libigl/igl/remove_duplicates.h similarity index 100% rename from src/igl/remove_duplicates.h rename to src/libigl/igl/remove_duplicates.h diff --git a/src/igl/remove_unreferenced.cpp b/src/libigl/igl/remove_unreferenced.cpp similarity index 100% rename from src/igl/remove_unreferenced.cpp rename to src/libigl/igl/remove_unreferenced.cpp diff --git a/src/igl/remove_unreferenced.h b/src/libigl/igl/remove_unreferenced.h similarity index 100% rename from src/igl/remove_unreferenced.h rename to src/libigl/igl/remove_unreferenced.h diff --git a/src/igl/reorder.cpp b/src/libigl/igl/reorder.cpp similarity index 100% rename from src/igl/reorder.cpp rename to src/libigl/igl/reorder.cpp diff --git a/src/igl/reorder.h b/src/libigl/igl/reorder.h similarity index 100% rename from src/igl/reorder.h rename to src/libigl/igl/reorder.h diff --git a/src/igl/repdiag.cpp b/src/libigl/igl/repdiag.cpp similarity index 100% rename from src/igl/repdiag.cpp rename to src/libigl/igl/repdiag.cpp diff --git a/src/igl/repdiag.h b/src/libigl/igl/repdiag.h similarity index 100% rename from src/igl/repdiag.h rename to src/libigl/igl/repdiag.h diff --git a/src/igl/repmat.cpp b/src/libigl/igl/repmat.cpp similarity index 100% rename from src/igl/repmat.cpp rename to src/libigl/igl/repmat.cpp diff --git a/src/igl/repmat.h b/src/libigl/igl/repmat.h similarity index 100% rename from src/igl/repmat.h rename to src/libigl/igl/repmat.h diff --git a/src/igl/resolve_duplicated_faces.cpp b/src/libigl/igl/resolve_duplicated_faces.cpp similarity index 100% rename from src/igl/resolve_duplicated_faces.cpp rename to src/libigl/igl/resolve_duplicated_faces.cpp diff --git a/src/igl/resolve_duplicated_faces.h b/src/libigl/igl/resolve_duplicated_faces.h similarity index 100% rename from src/igl/resolve_duplicated_faces.h rename to src/libigl/igl/resolve_duplicated_faces.h diff --git a/src/igl/rgb_to_hsv.cpp b/src/libigl/igl/rgb_to_hsv.cpp similarity index 100% rename from src/igl/rgb_to_hsv.cpp rename to src/libigl/igl/rgb_to_hsv.cpp diff --git a/src/igl/rgb_to_hsv.h b/src/libigl/igl/rgb_to_hsv.h similarity index 100% rename from src/igl/rgb_to_hsv.h rename to src/libigl/igl/rgb_to_hsv.h diff --git a/src/igl/rotate_by_quat.cpp b/src/libigl/igl/rotate_by_quat.cpp similarity index 100% rename from src/igl/rotate_by_quat.cpp rename to src/libigl/igl/rotate_by_quat.cpp diff --git a/src/igl/rotate_by_quat.h b/src/libigl/igl/rotate_by_quat.h similarity index 100% rename from src/igl/rotate_by_quat.h rename to src/libigl/igl/rotate_by_quat.h diff --git a/src/igl/rotate_vectors.cpp b/src/libigl/igl/rotate_vectors.cpp similarity index 100% rename from src/igl/rotate_vectors.cpp rename to src/libigl/igl/rotate_vectors.cpp diff --git a/src/igl/rotate_vectors.h b/src/libigl/igl/rotate_vectors.h similarity index 100% rename from src/igl/rotate_vectors.h rename to src/libigl/igl/rotate_vectors.h diff --git a/src/igl/rotation_matrix_from_directions.cpp b/src/libigl/igl/rotation_matrix_from_directions.cpp similarity index 100% rename from src/igl/rotation_matrix_from_directions.cpp rename to src/libigl/igl/rotation_matrix_from_directions.cpp diff --git a/src/igl/rotation_matrix_from_directions.h b/src/libigl/igl/rotation_matrix_from_directions.h similarity index 100% rename from src/igl/rotation_matrix_from_directions.h rename to src/libigl/igl/rotation_matrix_from_directions.h diff --git a/src/igl/round.cpp b/src/libigl/igl/round.cpp similarity index 100% rename from src/igl/round.cpp rename to src/libigl/igl/round.cpp diff --git a/src/igl/round.h b/src/libigl/igl/round.h similarity index 100% rename from src/igl/round.h rename to src/libigl/igl/round.h diff --git a/src/igl/rows_to_matrix.cpp b/src/libigl/igl/rows_to_matrix.cpp similarity index 100% rename from src/igl/rows_to_matrix.cpp rename to src/libigl/igl/rows_to_matrix.cpp diff --git a/src/igl/rows_to_matrix.h b/src/libigl/igl/rows_to_matrix.h similarity index 100% rename from src/igl/rows_to_matrix.h rename to src/libigl/igl/rows_to_matrix.h diff --git a/src/igl/sample_edges.cpp b/src/libigl/igl/sample_edges.cpp similarity index 100% rename from src/igl/sample_edges.cpp rename to src/libigl/igl/sample_edges.cpp diff --git a/src/igl/sample_edges.h b/src/libigl/igl/sample_edges.h similarity index 100% rename from src/igl/sample_edges.h rename to src/libigl/igl/sample_edges.h diff --git a/src/igl/seam_edges.cpp b/src/libigl/igl/seam_edges.cpp similarity index 100% rename from src/igl/seam_edges.cpp rename to src/libigl/igl/seam_edges.cpp diff --git a/src/igl/seam_edges.h b/src/libigl/igl/seam_edges.h similarity index 100% rename from src/igl/seam_edges.h rename to src/libigl/igl/seam_edges.h diff --git a/src/igl/segment_segment_intersect.cpp b/src/libigl/igl/segment_segment_intersect.cpp similarity index 100% rename from src/igl/segment_segment_intersect.cpp rename to src/libigl/igl/segment_segment_intersect.cpp diff --git a/src/igl/segment_segment_intersect.h b/src/libigl/igl/segment_segment_intersect.h similarity index 100% rename from src/igl/segment_segment_intersect.h rename to src/libigl/igl/segment_segment_intersect.h diff --git a/src/igl/serialize.h b/src/libigl/igl/serialize.h similarity index 100% rename from src/igl/serialize.h rename to src/libigl/igl/serialize.h diff --git a/src/igl/setdiff.cpp b/src/libigl/igl/setdiff.cpp similarity index 100% rename from src/igl/setdiff.cpp rename to src/libigl/igl/setdiff.cpp diff --git a/src/igl/setdiff.h b/src/libigl/igl/setdiff.h similarity index 100% rename from src/igl/setdiff.h rename to src/libigl/igl/setdiff.h diff --git a/src/igl/setunion.cpp b/src/libigl/igl/setunion.cpp similarity index 100% rename from src/igl/setunion.cpp rename to src/libigl/igl/setunion.cpp diff --git a/src/igl/setunion.h b/src/libigl/igl/setunion.h similarity index 100% rename from src/igl/setunion.h rename to src/libigl/igl/setunion.h diff --git a/src/igl/setxor.cpp b/src/libigl/igl/setxor.cpp similarity index 100% rename from src/igl/setxor.cpp rename to src/libigl/igl/setxor.cpp diff --git a/src/igl/setxor.h b/src/libigl/igl/setxor.h similarity index 100% rename from src/igl/setxor.h rename to src/libigl/igl/setxor.h diff --git a/src/igl/shape_diameter_function.cpp b/src/libigl/igl/shape_diameter_function.cpp similarity index 100% rename from src/igl/shape_diameter_function.cpp rename to src/libigl/igl/shape_diameter_function.cpp diff --git a/src/igl/shape_diameter_function.h b/src/libigl/igl/shape_diameter_function.h similarity index 100% rename from src/igl/shape_diameter_function.h rename to src/libigl/igl/shape_diameter_function.h diff --git a/src/igl/shapeup.cpp b/src/libigl/igl/shapeup.cpp similarity index 100% rename from src/igl/shapeup.cpp rename to src/libigl/igl/shapeup.cpp diff --git a/src/igl/shapeup.h b/src/libigl/igl/shapeup.h similarity index 100% rename from src/igl/shapeup.h rename to src/libigl/igl/shapeup.h diff --git a/src/igl/shortest_edge_and_midpoint.cpp b/src/libigl/igl/shortest_edge_and_midpoint.cpp similarity index 100% rename from src/igl/shortest_edge_and_midpoint.cpp rename to src/libigl/igl/shortest_edge_and_midpoint.cpp diff --git a/src/igl/shortest_edge_and_midpoint.h b/src/libigl/igl/shortest_edge_and_midpoint.h similarity index 100% rename from src/igl/shortest_edge_and_midpoint.h rename to src/libigl/igl/shortest_edge_and_midpoint.h diff --git a/src/igl/signed_angle.cpp b/src/libigl/igl/signed_angle.cpp similarity index 100% rename from src/igl/signed_angle.cpp rename to src/libigl/igl/signed_angle.cpp diff --git a/src/igl/signed_angle.h b/src/libigl/igl/signed_angle.h similarity index 100% rename from src/igl/signed_angle.h rename to src/libigl/igl/signed_angle.h diff --git a/src/igl/signed_distance.cpp b/src/libigl/igl/signed_distance.cpp similarity index 100% rename from src/igl/signed_distance.cpp rename to src/libigl/igl/signed_distance.cpp diff --git a/src/igl/signed_distance.h b/src/libigl/igl/signed_distance.h similarity index 100% rename from src/igl/signed_distance.h rename to src/libigl/igl/signed_distance.h diff --git a/src/igl/simplify_polyhedron.cpp b/src/libigl/igl/simplify_polyhedron.cpp similarity index 100% rename from src/igl/simplify_polyhedron.cpp rename to src/libigl/igl/simplify_polyhedron.cpp diff --git a/src/igl/simplify_polyhedron.h b/src/libigl/igl/simplify_polyhedron.h similarity index 100% rename from src/igl/simplify_polyhedron.h rename to src/libigl/igl/simplify_polyhedron.h diff --git a/src/igl/slice.cpp b/src/libigl/igl/slice.cpp similarity index 100% rename from src/igl/slice.cpp rename to src/libigl/igl/slice.cpp diff --git a/src/igl/slice.h b/src/libigl/igl/slice.h similarity index 100% rename from src/igl/slice.h rename to src/libigl/igl/slice.h diff --git a/src/igl/slice_cached.cpp b/src/libigl/igl/slice_cached.cpp similarity index 100% rename from src/igl/slice_cached.cpp rename to src/libigl/igl/slice_cached.cpp diff --git a/src/igl/slice_cached.h b/src/libigl/igl/slice_cached.h similarity index 100% rename from src/igl/slice_cached.h rename to src/libigl/igl/slice_cached.h diff --git a/src/igl/slice_into.cpp b/src/libigl/igl/slice_into.cpp similarity index 100% rename from src/igl/slice_into.cpp rename to src/libigl/igl/slice_into.cpp diff --git a/src/igl/slice_into.h b/src/libigl/igl/slice_into.h similarity index 100% rename from src/igl/slice_into.h rename to src/libigl/igl/slice_into.h diff --git a/src/igl/slice_mask.cpp b/src/libigl/igl/slice_mask.cpp similarity index 100% rename from src/igl/slice_mask.cpp rename to src/libigl/igl/slice_mask.cpp diff --git a/src/igl/slice_mask.h b/src/libigl/igl/slice_mask.h similarity index 100% rename from src/igl/slice_mask.h rename to src/libigl/igl/slice_mask.h diff --git a/src/igl/slice_tets.cpp b/src/libigl/igl/slice_tets.cpp similarity index 100% rename from src/igl/slice_tets.cpp rename to src/libigl/igl/slice_tets.cpp diff --git a/src/igl/slice_tets.h b/src/libigl/igl/slice_tets.h similarity index 100% rename from src/igl/slice_tets.h rename to src/libigl/igl/slice_tets.h diff --git a/src/igl/slim.cpp b/src/libigl/igl/slim.cpp similarity index 100% rename from src/igl/slim.cpp rename to src/libigl/igl/slim.cpp diff --git a/src/igl/slim.h b/src/libigl/igl/slim.h similarity index 100% rename from src/igl/slim.h rename to src/libigl/igl/slim.h diff --git a/src/igl/snap_points.cpp b/src/libigl/igl/snap_points.cpp similarity index 100% rename from src/igl/snap_points.cpp rename to src/libigl/igl/snap_points.cpp diff --git a/src/igl/snap_points.h b/src/libigl/igl/snap_points.h similarity index 100% rename from src/igl/snap_points.h rename to src/libigl/igl/snap_points.h diff --git a/src/igl/snap_to_canonical_view_quat.cpp b/src/libigl/igl/snap_to_canonical_view_quat.cpp similarity index 100% rename from src/igl/snap_to_canonical_view_quat.cpp rename to src/libigl/igl/snap_to_canonical_view_quat.cpp diff --git a/src/igl/snap_to_canonical_view_quat.h b/src/libigl/igl/snap_to_canonical_view_quat.h similarity index 100% rename from src/igl/snap_to_canonical_view_quat.h rename to src/libigl/igl/snap_to_canonical_view_quat.h diff --git a/src/igl/snap_to_fixed_up.cpp b/src/libigl/igl/snap_to_fixed_up.cpp similarity index 100% rename from src/igl/snap_to_fixed_up.cpp rename to src/libigl/igl/snap_to_fixed_up.cpp diff --git a/src/igl/snap_to_fixed_up.h b/src/libigl/igl/snap_to_fixed_up.h similarity index 100% rename from src/igl/snap_to_fixed_up.h rename to src/libigl/igl/snap_to_fixed_up.h diff --git a/src/igl/solid_angle.cpp b/src/libigl/igl/solid_angle.cpp similarity index 100% rename from src/igl/solid_angle.cpp rename to src/libigl/igl/solid_angle.cpp diff --git a/src/igl/solid_angle.h b/src/libigl/igl/solid_angle.h similarity index 100% rename from src/igl/solid_angle.h rename to src/libigl/igl/solid_angle.h diff --git a/src/igl/sort.cpp b/src/libigl/igl/sort.cpp similarity index 100% rename from src/igl/sort.cpp rename to src/libigl/igl/sort.cpp diff --git a/src/igl/sort.h b/src/libigl/igl/sort.h similarity index 100% rename from src/igl/sort.h rename to src/libigl/igl/sort.h diff --git a/src/igl/sort_angles.cpp b/src/libigl/igl/sort_angles.cpp similarity index 100% rename from src/igl/sort_angles.cpp rename to src/libigl/igl/sort_angles.cpp diff --git a/src/igl/sort_angles.h b/src/libigl/igl/sort_angles.h similarity index 100% rename from src/igl/sort_angles.h rename to src/libigl/igl/sort_angles.h diff --git a/src/igl/sort_triangles.cpp b/src/libigl/igl/sort_triangles.cpp similarity index 100% rename from src/igl/sort_triangles.cpp rename to src/libigl/igl/sort_triangles.cpp diff --git a/src/igl/sort_triangles.h b/src/libigl/igl/sort_triangles.h similarity index 100% rename from src/igl/sort_triangles.h rename to src/libigl/igl/sort_triangles.h diff --git a/src/igl/sort_vectors_ccw.cpp b/src/libigl/igl/sort_vectors_ccw.cpp similarity index 100% rename from src/igl/sort_vectors_ccw.cpp rename to src/libigl/igl/sort_vectors_ccw.cpp diff --git a/src/igl/sort_vectors_ccw.h b/src/libigl/igl/sort_vectors_ccw.h similarity index 100% rename from src/igl/sort_vectors_ccw.h rename to src/libigl/igl/sort_vectors_ccw.h diff --git a/src/igl/sortrows.cpp b/src/libigl/igl/sortrows.cpp similarity index 100% rename from src/igl/sortrows.cpp rename to src/libigl/igl/sortrows.cpp diff --git a/src/igl/sortrows.h b/src/libigl/igl/sortrows.h similarity index 100% rename from src/igl/sortrows.h rename to src/libigl/igl/sortrows.h diff --git a/src/igl/sparse.cpp b/src/libigl/igl/sparse.cpp similarity index 100% rename from src/igl/sparse.cpp rename to src/libigl/igl/sparse.cpp diff --git a/src/igl/sparse.h b/src/libigl/igl/sparse.h similarity index 100% rename from src/igl/sparse.h rename to src/libigl/igl/sparse.h diff --git a/src/igl/sparse_cached.cpp b/src/libigl/igl/sparse_cached.cpp similarity index 100% rename from src/igl/sparse_cached.cpp rename to src/libigl/igl/sparse_cached.cpp diff --git a/src/igl/sparse_cached.h b/src/libigl/igl/sparse_cached.h similarity index 100% rename from src/igl/sparse_cached.h rename to src/libigl/igl/sparse_cached.h diff --git a/src/igl/speye.cpp b/src/libigl/igl/speye.cpp similarity index 100% rename from src/igl/speye.cpp rename to src/libigl/igl/speye.cpp diff --git a/src/igl/speye.h b/src/libigl/igl/speye.h similarity index 100% rename from src/igl/speye.h rename to src/libigl/igl/speye.h diff --git a/src/igl/squared_edge_lengths.cpp b/src/libigl/igl/squared_edge_lengths.cpp similarity index 100% rename from src/igl/squared_edge_lengths.cpp rename to src/libigl/igl/squared_edge_lengths.cpp diff --git a/src/igl/squared_edge_lengths.h b/src/libigl/igl/squared_edge_lengths.h similarity index 100% rename from src/igl/squared_edge_lengths.h rename to src/libigl/igl/squared_edge_lengths.h diff --git a/src/igl/stdin_to_temp.cpp b/src/libigl/igl/stdin_to_temp.cpp similarity index 100% rename from src/igl/stdin_to_temp.cpp rename to src/libigl/igl/stdin_to_temp.cpp diff --git a/src/igl/stdin_to_temp.h b/src/libigl/igl/stdin_to_temp.h similarity index 100% rename from src/igl/stdin_to_temp.h rename to src/libigl/igl/stdin_to_temp.h diff --git a/src/igl/straighten_seams.cpp b/src/libigl/igl/straighten_seams.cpp similarity index 100% rename from src/igl/straighten_seams.cpp rename to src/libigl/igl/straighten_seams.cpp diff --git a/src/igl/straighten_seams.h b/src/libigl/igl/straighten_seams.h similarity index 100% rename from src/igl/straighten_seams.h rename to src/libigl/igl/straighten_seams.h diff --git a/src/igl/sum.cpp b/src/libigl/igl/sum.cpp similarity index 100% rename from src/igl/sum.cpp rename to src/libigl/igl/sum.cpp diff --git a/src/igl/sum.h b/src/libigl/igl/sum.h similarity index 100% rename from src/igl/sum.h rename to src/libigl/igl/sum.h diff --git a/src/igl/svd3x3.cpp b/src/libigl/igl/svd3x3.cpp similarity index 100% rename from src/igl/svd3x3.cpp rename to src/libigl/igl/svd3x3.cpp diff --git a/src/igl/svd3x3.h b/src/libigl/igl/svd3x3.h similarity index 100% rename from src/igl/svd3x3.h rename to src/libigl/igl/svd3x3.h diff --git a/src/igl/svd3x3_avx.cpp b/src/libigl/igl/svd3x3_avx.cpp similarity index 100% rename from src/igl/svd3x3_avx.cpp rename to src/libigl/igl/svd3x3_avx.cpp diff --git a/src/igl/svd3x3_avx.h b/src/libigl/igl/svd3x3_avx.h similarity index 100% rename from src/igl/svd3x3_avx.h rename to src/libigl/igl/svd3x3_avx.h diff --git a/src/igl/svd3x3_sse.cpp b/src/libigl/igl/svd3x3_sse.cpp similarity index 100% rename from src/igl/svd3x3_sse.cpp rename to src/libigl/igl/svd3x3_sse.cpp diff --git a/src/igl/svd3x3_sse.h b/src/libigl/igl/svd3x3_sse.h similarity index 100% rename from src/igl/svd3x3_sse.h rename to src/libigl/igl/svd3x3_sse.h diff --git a/src/igl/swept_volume_bounding_box.cpp b/src/libigl/igl/swept_volume_bounding_box.cpp similarity index 100% rename from src/igl/swept_volume_bounding_box.cpp rename to src/libigl/igl/swept_volume_bounding_box.cpp diff --git a/src/igl/swept_volume_bounding_box.h b/src/libigl/igl/swept_volume_bounding_box.h similarity index 100% rename from src/igl/swept_volume_bounding_box.h rename to src/libigl/igl/swept_volume_bounding_box.h diff --git a/src/igl/swept_volume_signed_distance.cpp b/src/libigl/igl/swept_volume_signed_distance.cpp similarity index 100% rename from src/igl/swept_volume_signed_distance.cpp rename to src/libigl/igl/swept_volume_signed_distance.cpp diff --git a/src/igl/swept_volume_signed_distance.h b/src/libigl/igl/swept_volume_signed_distance.h similarity index 100% rename from src/igl/swept_volume_signed_distance.h rename to src/libigl/igl/swept_volume_signed_distance.h diff --git a/src/igl/trackball.cpp b/src/libigl/igl/trackball.cpp similarity index 100% rename from src/igl/trackball.cpp rename to src/libigl/igl/trackball.cpp diff --git a/src/igl/trackball.h b/src/libigl/igl/trackball.h similarity index 100% rename from src/igl/trackball.h rename to src/libigl/igl/trackball.h diff --git a/src/igl/transpose_blocks.cpp b/src/libigl/igl/transpose_blocks.cpp similarity index 100% rename from src/igl/transpose_blocks.cpp rename to src/libigl/igl/transpose_blocks.cpp diff --git a/src/igl/transpose_blocks.h b/src/libigl/igl/transpose_blocks.h similarity index 100% rename from src/igl/transpose_blocks.h rename to src/libigl/igl/transpose_blocks.h diff --git a/src/igl/triangle/cdt.cpp b/src/libigl/igl/triangle/cdt.cpp similarity index 100% rename from src/igl/triangle/cdt.cpp rename to src/libigl/igl/triangle/cdt.cpp diff --git a/src/igl/triangle/cdt.h b/src/libigl/igl/triangle/cdt.h similarity index 100% rename from src/igl/triangle/cdt.h rename to src/libigl/igl/triangle/cdt.h diff --git a/src/igl/triangle/triangulate.cpp b/src/libigl/igl/triangle/triangulate.cpp similarity index 100% rename from src/igl/triangle/triangulate.cpp rename to src/libigl/igl/triangle/triangulate.cpp diff --git a/src/igl/triangle/triangulate.h b/src/libigl/igl/triangle/triangulate.h similarity index 100% rename from src/igl/triangle/triangulate.h rename to src/libigl/igl/triangle/triangulate.h diff --git a/src/igl/triangle_fan.cpp b/src/libigl/igl/triangle_fan.cpp similarity index 100% rename from src/igl/triangle_fan.cpp rename to src/libigl/igl/triangle_fan.cpp diff --git a/src/igl/triangle_fan.h b/src/libigl/igl/triangle_fan.h similarity index 100% rename from src/igl/triangle_fan.h rename to src/libigl/igl/triangle_fan.h diff --git a/src/igl/triangle_triangle_adjacency.cpp b/src/libigl/igl/triangle_triangle_adjacency.cpp similarity index 100% rename from src/igl/triangle_triangle_adjacency.cpp rename to src/libigl/igl/triangle_triangle_adjacency.cpp diff --git a/src/igl/triangle_triangle_adjacency.h b/src/libigl/igl/triangle_triangle_adjacency.h similarity index 100% rename from src/igl/triangle_triangle_adjacency.h rename to src/libigl/igl/triangle_triangle_adjacency.h diff --git a/src/igl/triangles_from_strip.cpp b/src/libigl/igl/triangles_from_strip.cpp similarity index 100% rename from src/igl/triangles_from_strip.cpp rename to src/libigl/igl/triangles_from_strip.cpp diff --git a/src/igl/triangles_from_strip.h b/src/libigl/igl/triangles_from_strip.h similarity index 100% rename from src/igl/triangles_from_strip.h rename to src/libigl/igl/triangles_from_strip.h diff --git a/src/igl/two_axis_valuator_fixed_up.cpp b/src/libigl/igl/two_axis_valuator_fixed_up.cpp similarity index 100% rename from src/igl/two_axis_valuator_fixed_up.cpp rename to src/libigl/igl/two_axis_valuator_fixed_up.cpp diff --git a/src/igl/two_axis_valuator_fixed_up.h b/src/libigl/igl/two_axis_valuator_fixed_up.h similarity index 100% rename from src/igl/two_axis_valuator_fixed_up.h rename to src/libigl/igl/two_axis_valuator_fixed_up.h diff --git a/src/igl/uniformly_sample_two_manifold.cpp b/src/libigl/igl/uniformly_sample_two_manifold.cpp similarity index 100% rename from src/igl/uniformly_sample_two_manifold.cpp rename to src/libigl/igl/uniformly_sample_two_manifold.cpp diff --git a/src/igl/uniformly_sample_two_manifold.h b/src/libigl/igl/uniformly_sample_two_manifold.h similarity index 100% rename from src/igl/uniformly_sample_two_manifold.h rename to src/libigl/igl/uniformly_sample_two_manifold.h diff --git a/src/igl/unique.cpp b/src/libigl/igl/unique.cpp similarity index 100% rename from src/igl/unique.cpp rename to src/libigl/igl/unique.cpp diff --git a/src/igl/unique.h b/src/libigl/igl/unique.h similarity index 100% rename from src/igl/unique.h rename to src/libigl/igl/unique.h diff --git a/src/igl/unique_edge_map.cpp b/src/libigl/igl/unique_edge_map.cpp similarity index 100% rename from src/igl/unique_edge_map.cpp rename to src/libigl/igl/unique_edge_map.cpp diff --git a/src/igl/unique_edge_map.h b/src/libigl/igl/unique_edge_map.h similarity index 100% rename from src/igl/unique_edge_map.h rename to src/libigl/igl/unique_edge_map.h diff --git a/src/igl/unique_rows.cpp b/src/libigl/igl/unique_rows.cpp similarity index 100% rename from src/igl/unique_rows.cpp rename to src/libigl/igl/unique_rows.cpp diff --git a/src/igl/unique_rows.h b/src/libigl/igl/unique_rows.h similarity index 100% rename from src/igl/unique_rows.h rename to src/libigl/igl/unique_rows.h diff --git a/src/igl/unique_simplices.cpp b/src/libigl/igl/unique_simplices.cpp similarity index 100% rename from src/igl/unique_simplices.cpp rename to src/libigl/igl/unique_simplices.cpp diff --git a/src/igl/unique_simplices.h b/src/libigl/igl/unique_simplices.h similarity index 100% rename from src/igl/unique_simplices.h rename to src/libigl/igl/unique_simplices.h diff --git a/src/igl/unproject.cpp b/src/libigl/igl/unproject.cpp similarity index 100% rename from src/igl/unproject.cpp rename to src/libigl/igl/unproject.cpp diff --git a/src/igl/unproject.h b/src/libigl/igl/unproject.h similarity index 100% rename from src/igl/unproject.h rename to src/libigl/igl/unproject.h diff --git a/src/igl/unproject_in_mesh.cpp b/src/libigl/igl/unproject_in_mesh.cpp similarity index 100% rename from src/igl/unproject_in_mesh.cpp rename to src/libigl/igl/unproject_in_mesh.cpp diff --git a/src/igl/unproject_in_mesh.h b/src/libigl/igl/unproject_in_mesh.h similarity index 100% rename from src/igl/unproject_in_mesh.h rename to src/libigl/igl/unproject_in_mesh.h diff --git a/src/igl/unproject_onto_mesh.cpp b/src/libigl/igl/unproject_onto_mesh.cpp similarity index 100% rename from src/igl/unproject_onto_mesh.cpp rename to src/libigl/igl/unproject_onto_mesh.cpp diff --git a/src/igl/unproject_onto_mesh.h b/src/libigl/igl/unproject_onto_mesh.h similarity index 100% rename from src/igl/unproject_onto_mesh.h rename to src/libigl/igl/unproject_onto_mesh.h diff --git a/src/igl/unproject_ray.cpp b/src/libigl/igl/unproject_ray.cpp similarity index 100% rename from src/igl/unproject_ray.cpp rename to src/libigl/igl/unproject_ray.cpp diff --git a/src/igl/unproject_ray.h b/src/libigl/igl/unproject_ray.h similarity index 100% rename from src/igl/unproject_ray.h rename to src/libigl/igl/unproject_ray.h diff --git a/src/igl/unzip_corners.cpp b/src/libigl/igl/unzip_corners.cpp similarity index 100% rename from src/igl/unzip_corners.cpp rename to src/libigl/igl/unzip_corners.cpp diff --git a/src/igl/unzip_corners.h b/src/libigl/igl/unzip_corners.h similarity index 100% rename from src/igl/unzip_corners.h rename to src/libigl/igl/unzip_corners.h diff --git a/src/igl/upsample.cpp b/src/libigl/igl/upsample.cpp similarity index 100% rename from src/igl/upsample.cpp rename to src/libigl/igl/upsample.cpp diff --git a/src/igl/upsample.h b/src/libigl/igl/upsample.h similarity index 100% rename from src/igl/upsample.h rename to src/libigl/igl/upsample.h diff --git a/src/igl/vector_area_matrix.cpp b/src/libigl/igl/vector_area_matrix.cpp similarity index 100% rename from src/igl/vector_area_matrix.cpp rename to src/libigl/igl/vector_area_matrix.cpp diff --git a/src/igl/vector_area_matrix.h b/src/libigl/igl/vector_area_matrix.h similarity index 100% rename from src/igl/vector_area_matrix.h rename to src/libigl/igl/vector_area_matrix.h diff --git a/src/igl/verbose.h b/src/libigl/igl/verbose.h similarity index 100% rename from src/igl/verbose.h rename to src/libigl/igl/verbose.h diff --git a/src/igl/vertex_triangle_adjacency.cpp b/src/libigl/igl/vertex_triangle_adjacency.cpp similarity index 100% rename from src/igl/vertex_triangle_adjacency.cpp rename to src/libigl/igl/vertex_triangle_adjacency.cpp diff --git a/src/igl/vertex_triangle_adjacency.h b/src/libigl/igl/vertex_triangle_adjacency.h similarity index 100% rename from src/igl/vertex_triangle_adjacency.h rename to src/libigl/igl/vertex_triangle_adjacency.h diff --git a/src/igl/volume.cpp b/src/libigl/igl/volume.cpp similarity index 100% rename from src/igl/volume.cpp rename to src/libigl/igl/volume.cpp diff --git a/src/igl/volume.h b/src/libigl/igl/volume.h similarity index 100% rename from src/igl/volume.h rename to src/libigl/igl/volume.h diff --git a/src/igl/voxel_grid.cpp b/src/libigl/igl/voxel_grid.cpp similarity index 100% rename from src/igl/voxel_grid.cpp rename to src/libigl/igl/voxel_grid.cpp diff --git a/src/igl/voxel_grid.h b/src/libigl/igl/voxel_grid.h similarity index 100% rename from src/igl/voxel_grid.h rename to src/libigl/igl/voxel_grid.h diff --git a/src/igl/winding_number.cpp b/src/libigl/igl/winding_number.cpp similarity index 100% rename from src/igl/winding_number.cpp rename to src/libigl/igl/winding_number.cpp diff --git a/src/igl/winding_number.h b/src/libigl/igl/winding_number.h similarity index 100% rename from src/igl/winding_number.h rename to src/libigl/igl/winding_number.h diff --git a/src/igl/writeBF.cpp b/src/libigl/igl/writeBF.cpp similarity index 100% rename from src/igl/writeBF.cpp rename to src/libigl/igl/writeBF.cpp diff --git a/src/igl/writeBF.h b/src/libigl/igl/writeBF.h similarity index 100% rename from src/igl/writeBF.h rename to src/libigl/igl/writeBF.h diff --git a/src/igl/writeDMAT.cpp b/src/libigl/igl/writeDMAT.cpp similarity index 100% rename from src/igl/writeDMAT.cpp rename to src/libigl/igl/writeDMAT.cpp diff --git a/src/igl/writeDMAT.h b/src/libigl/igl/writeDMAT.h similarity index 100% rename from src/igl/writeDMAT.h rename to src/libigl/igl/writeDMAT.h diff --git a/src/igl/writeMESH.cpp b/src/libigl/igl/writeMESH.cpp similarity index 100% rename from src/igl/writeMESH.cpp rename to src/libigl/igl/writeMESH.cpp diff --git a/src/igl/writeMESH.h b/src/libigl/igl/writeMESH.h similarity index 100% rename from src/igl/writeMESH.h rename to src/libigl/igl/writeMESH.h diff --git a/src/igl/writeOBJ.cpp b/src/libigl/igl/writeOBJ.cpp similarity index 100% rename from src/igl/writeOBJ.cpp rename to src/libigl/igl/writeOBJ.cpp diff --git a/src/igl/writeOBJ.h b/src/libigl/igl/writeOBJ.h similarity index 100% rename from src/igl/writeOBJ.h rename to src/libigl/igl/writeOBJ.h diff --git a/src/igl/writeOFF.cpp b/src/libigl/igl/writeOFF.cpp similarity index 100% rename from src/igl/writeOFF.cpp rename to src/libigl/igl/writeOFF.cpp diff --git a/src/igl/writeOFF.h b/src/libigl/igl/writeOFF.h similarity index 100% rename from src/igl/writeOFF.h rename to src/libigl/igl/writeOFF.h diff --git a/src/igl/writePLY.cpp b/src/libigl/igl/writePLY.cpp similarity index 100% rename from src/igl/writePLY.cpp rename to src/libigl/igl/writePLY.cpp diff --git a/src/igl/writePLY.h b/src/libigl/igl/writePLY.h similarity index 100% rename from src/igl/writePLY.h rename to src/libigl/igl/writePLY.h diff --git a/src/igl/writeSTL.cpp b/src/libigl/igl/writeSTL.cpp similarity index 100% rename from src/igl/writeSTL.cpp rename to src/libigl/igl/writeSTL.cpp diff --git a/src/igl/writeSTL.h b/src/libigl/igl/writeSTL.h similarity index 100% rename from src/igl/writeSTL.h rename to src/libigl/igl/writeSTL.h diff --git a/src/igl/writeTGF.cpp b/src/libigl/igl/writeTGF.cpp similarity index 100% rename from src/igl/writeTGF.cpp rename to src/libigl/igl/writeTGF.cpp diff --git a/src/igl/writeTGF.h b/src/libigl/igl/writeTGF.h similarity index 100% rename from src/igl/writeTGF.h rename to src/libigl/igl/writeTGF.h diff --git a/src/igl/writeWRL.cpp b/src/libigl/igl/writeWRL.cpp similarity index 100% rename from src/igl/writeWRL.cpp rename to src/libigl/igl/writeWRL.cpp diff --git a/src/igl/writeWRL.h b/src/libigl/igl/writeWRL.h similarity index 100% rename from src/igl/writeWRL.h rename to src/libigl/igl/writeWRL.h diff --git a/src/igl/write_triangle_mesh.cpp b/src/libigl/igl/write_triangle_mesh.cpp similarity index 100% rename from src/igl/write_triangle_mesh.cpp rename to src/libigl/igl/write_triangle_mesh.cpp diff --git a/src/igl/write_triangle_mesh.h b/src/libigl/igl/write_triangle_mesh.h similarity index 100% rename from src/igl/write_triangle_mesh.h rename to src/libigl/igl/write_triangle_mesh.h diff --git a/src/igl/xml/ReAntTweakBarXMLSerialization.h b/src/libigl/igl/xml/ReAntTweakBarXMLSerialization.h similarity index 100% rename from src/igl/xml/ReAntTweakBarXMLSerialization.h rename to src/libigl/igl/xml/ReAntTweakBarXMLSerialization.h diff --git a/src/igl/xml/XMLSerializable.h b/src/libigl/igl/xml/XMLSerializable.h similarity index 100% rename from src/igl/xml/XMLSerializable.h rename to src/libigl/igl/xml/XMLSerializable.h diff --git a/src/igl/xml/serialization_test.skip b/src/libigl/igl/xml/serialization_test.skip similarity index 100% rename from src/igl/xml/serialization_test.skip rename to src/libigl/igl/xml/serialization_test.skip diff --git a/src/igl/xml/serialize_xml.cpp b/src/libigl/igl/xml/serialize_xml.cpp similarity index 100% rename from src/igl/xml/serialize_xml.cpp rename to src/libigl/igl/xml/serialize_xml.cpp diff --git a/src/igl/xml/serialize_xml.h b/src/libigl/igl/xml/serialize_xml.h similarity index 100% rename from src/igl/xml/serialize_xml.h rename to src/libigl/igl/xml/serialize_xml.h diff --git a/src/igl/xml/writeDAE.cpp b/src/libigl/igl/xml/writeDAE.cpp similarity index 100% rename from src/igl/xml/writeDAE.cpp rename to src/libigl/igl/xml/writeDAE.cpp diff --git a/src/igl/xml/writeDAE.h b/src/libigl/igl/xml/writeDAE.h similarity index 100% rename from src/igl/xml/writeDAE.h rename to src/libigl/igl/xml/writeDAE.h diff --git a/src/igl/xml/write_triangle_mesh.cpp b/src/libigl/igl/xml/write_triangle_mesh.cpp similarity index 100% rename from src/igl/xml/write_triangle_mesh.cpp rename to src/libigl/igl/xml/write_triangle_mesh.cpp diff --git a/src/igl/xml/write_triangle_mesh.h b/src/libigl/igl/xml/write_triangle_mesh.h similarity index 100% rename from src/igl/xml/write_triangle_mesh.h rename to src/libigl/igl/xml/write_triangle_mesh.h diff --git a/src/libslic3r/CMakeLists.txt b/src/libslic3r/CMakeLists.txt index 38e6636043..dc52257aa2 100644 --- a/src/libslic3r/CMakeLists.txt +++ b/src/libslic3r/CMakeLists.txt @@ -189,6 +189,7 @@ target_include_directories(libslic3r PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${LIBNE target_link_libraries(libslic3r libnest2d admesh + libigl miniz boost_libs clipper From b7f67369c99cf204d8071b1d42abc3c2704f1d82 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 20 Jun 2019 10:02:52 +0200 Subject: [PATCH 23/64] Serialized camera type and fixed Mac build --- src/slic3r/GUI/AppConfig.cpp | 3 +++ src/slic3r/GUI/Camera.cpp | 28 ++++++++++++++++++++++++---- src/slic3r/GUI/Camera.hpp | 8 ++++++-- src/slic3r/GUI/GLCanvas3D.cpp | 7 +++---- src/slic3r/GUI/Plater.cpp | 3 +++ 5 files changed, 39 insertions(+), 10 deletions(-) diff --git a/src/slic3r/GUI/AppConfig.cpp b/src/slic3r/GUI/AppConfig.cpp index d4970880b5..edc9845a13 100644 --- a/src/slic3r/GUI/AppConfig.cpp +++ b/src/slic3r/GUI/AppConfig.cpp @@ -73,6 +73,9 @@ void AppConfig::set_defaults() if (get("custom_toolbar_size").empty()) set("custom_toolbar_size", "100"); + if (get("camera_type").empty()) + set("camera_type", "1"); + // Remove legacy window positions/sizes erase("", "main_frame_maximized"); erase("", "main_frame_pos"); diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index a3ecb5e541..b8c182ef4a 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -2,9 +2,8 @@ #include "Camera.hpp" #include "3DScene.hpp" -#if ENABLE_CAMERA_STATISTICS #include "GUI_App.hpp" -#endif // ENABLE_CAMERA_STATISTICS +#include "AppConfig.hpp" #include @@ -44,23 +43,44 @@ std::string Camera::get_type_as_string() const { switch (m_type) { - default: case Unknown: return "unknown"; case Perspective: return "perspective"; + default: case Ortho: return "orthographic"; }; } +void Camera::set_type(EType type) +{ + if (m_type != type) + { + m_type = type; + + wxGetApp().app_config->set("camera_type", std::to_string(m_type)); + wxGetApp().app_config->save(); + } +} + +void Camera::set_type(const std::string& type) +{ + if (!type.empty() && (type != "1")) + { + unsigned char type_id = atoi(type.c_str()); + if (((unsigned char)Ortho < type_id) && (type_id < (unsigned char)Num_types)) + set_type((Camera::EType)type_id); + } +} + void Camera::select_next_type() { unsigned char next = (unsigned char)m_type + 1; if (next == (unsigned char)Num_types) next = 1; - m_type = (EType)next; + set_type((EType)next); } void Camera::set_target(const Vec3d& target) diff --git a/src/slic3r/GUI/Camera.hpp b/src/slic3r/GUI/Camera.hpp index fe6571b056..a64b194f3a 100644 --- a/src/slic3r/GUI/Camera.hpp +++ b/src/slic3r/GUI/Camera.hpp @@ -16,8 +16,8 @@ struct Camera enum EType : unsigned char { Unknown, - Perspective, Ortho, + Perspective, Num_types }; @@ -45,7 +45,8 @@ public: EType get_type() const { return m_type; } std::string get_type_as_string() const; - void set_type(EType type) { m_type = type; } + void set_type(EType type); + void set_type(const std::string& type); void select_next_type(); const Vec3d& get_target() const { return m_target; } @@ -56,6 +57,9 @@ public: double get_zoom() const { return m_zoom; } void set_zoom(double zoom, const BoundingBoxf3& max_box, int canvas_w, int canvas_h); +#if ENABLE_RETINA_GL + void set_zoom(double zoom) { m_zoom = zoom; } +#endif // ENABLE_RETINA_GL const BoundingBoxf3& get_scene_box() const { return m_scene_box; } void set_scene_box(const BoundingBoxf3& box) { m_scene_box = box; } diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 9216eff944..d9a8a870ce 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1593,8 +1593,8 @@ void GLCanvas3D::render() if (m_camera.requires_zoom_to_bed) { zoom_to_bed(); -// const Size& cnv_size = get_canvas_size(); -// _resize((unsigned int)cnv_size.get_width(), (unsigned int)cnv_size.get_height()); + const Size& cnv_size = get_canvas_size(); + _resize((unsigned int)cnv_size.get_width(), (unsigned int)cnv_size.get_height()); m_camera.requires_zoom_to_bed = false; } @@ -3304,8 +3304,7 @@ void GLCanvas3D::update_ui_from_settings() if (new_scaling != orig_scaling) { BOOST_LOG_TRIVIAL(debug) << "GLCanvas3D: Scaling factor: " << new_scaling; - m_camera.zoom /= orig_scaling; - m_camera.zoom *= new_scaling; + m_camera.set_zoom(m_camera.get_zoom() * new_scaling / orig_scaling); _refresh_if_shown_on_screen(); } #endif diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index f8385c0b58..c2456db800 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1772,6 +1772,9 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) q->Layout(); set_current_panel(view3D); + + // updates camera type from .ini file + camera.set_type(get_config("camera_type")); } void Plater::priv::update(bool force_full_scene_refresh) From e5be8adadf72e0f283a602a412c31eda564d8b2e Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 20 Jun 2019 11:05:05 +0200 Subject: [PATCH 24/64] Fixed build on MacOS --- src/slic3r/GUI/Camera.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/Camera.hpp b/src/slic3r/GUI/Camera.hpp index a64b194f3a..6a2f65a30e 100644 --- a/src/slic3r/GUI/Camera.hpp +++ b/src/slic3r/GUI/Camera.hpp @@ -57,9 +57,9 @@ public: double get_zoom() const { return m_zoom; } void set_zoom(double zoom, const BoundingBoxf3& max_box, int canvas_w, int canvas_h); -#if ENABLE_RETINA_GL + // this method does not check if the given zoom is valid, use instead the other set_zoom() method + // called only by: void GLCanvas3D::update_ui_from_settings() void set_zoom(double zoom) { m_zoom = zoom; } -#endif // ENABLE_RETINA_GL const BoundingBoxf3& get_scene_box() const { return m_scene_box; } void set_scene_box(const BoundingBoxf3& box) { m_scene_box = box; } From 09da7a84b5c1e338b81c1435f7cb69b96fc785e1 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Fri, 7 Jun 2019 17:01:19 +0200 Subject: [PATCH 25/64] Firmware updater: Prevent empty flashing jobs --- src/slic3r/GUI/FirmwareDialog.cpp | 57 ++++++++++++++++++++++------ src/slic3r/GUI/ProgressStatusBar.hpp | 1 + src/slic3r/Utils/Serial.hpp | 3 ++ 3 files changed, 50 insertions(+), 11 deletions(-) diff --git a/src/slic3r/GUI/FirmwareDialog.cpp b/src/slic3r/GUI/FirmwareDialog.cpp index b400e27eae..9e209faedd 100644 --- a/src/slic3r/GUI/FirmwareDialog.cpp +++ b/src/slic3r/GUI/FirmwareDialog.cpp @@ -5,11 +5,14 @@ #include #include #include -#include -#include +#include #include #include +#if _WIN32 + #include +#endif + #include "libslic3r/Utils.hpp" #include "avrdude/avrdude-slic3r.hpp" #include "GUI.hpp" @@ -159,6 +162,7 @@ struct FirmwareDialog::priv void flashing_start(unsigned tasks); void flashing_done(AvrDudeComplete complete); void enable_port_picker(bool enable); + void update_flash_enabled(); void load_hex_file(const wxString &path); void queue_event(AvrdudeEvent aevt, wxString message); @@ -171,6 +175,7 @@ struct FirmwareDialog::priv void prepare_mk2(); void prepare_mk3(); void prepare_avr109(Avr109Pid usb_pid); + bool get_serial_port(); void perform_upload(); void user_cancel(); @@ -286,6 +291,14 @@ void FirmwareDialog::priv::enable_port_picker(bool enable) fit_no_shrink(); } +void FirmwareDialog::priv::update_flash_enabled() +{ + const bool hex_exists = wxFileExists(hex_picker->GetPath()); + const bool port_valid = get_serial_port(); + + btn_flash->Enable(hex_exists && port_valid); +} + void FirmwareDialog::priv::load_hex_file(const wxString &path) { hex_file = HexFile(path.wx_str()); @@ -553,6 +566,31 @@ void FirmwareDialog::priv::prepare_avr109(Avr109Pid usb_pid) } +bool FirmwareDialog::priv::get_serial_port() +{ + const int selection = port_picker->GetSelection(); + if (selection != wxNOT_FOUND) { + port = this->ports[selection]; + } else { + // User has supplied a custom filename + + std::string path_u8 = GUI::into_u8(port_picker->GetValue()); +#ifdef _WIN32 + static const std::regex com_pattern("COM[0-9]+", std::regex::icase); + std::smatch matches; + if (std::regex_match(path_u8, matches, com_pattern)) { +#else + if (fs::is_other(fs::path(path_u8))) { +#endif + port = SerialPortInfo(std::move(path_u8)); + } else { + port = boost::none; + } + } + + return !!port; +} + void FirmwareDialog::priv::perform_upload() { auto filename = hex_picker->GetPath(); @@ -560,14 +598,8 @@ void FirmwareDialog::priv::perform_upload() load_hex_file(filename); // Might already be loaded, but we want to make sure it's fresh - int selection = port_picker->GetSelection(); - if (selection != wxNOT_FOUND) { - port = this->ports[selection]; - - // Verify whether the combo box list selection equals to the combo box edit value. - if (wxString::FromUTF8(port->friendly_name.data()) != port_picker->GetValue()) { - return; - } + if (! get_serial_port()) { + return; } const bool extra_verbose = false; // For debugging @@ -836,10 +868,13 @@ FirmwareDialog::FirmwareDialog(wxWindow *parent) : p->hex_picker->Bind(wxEVT_FILEPICKER_CHANGED, [this](wxFileDirPickerEvent& evt) { if (wxFileExists(evt.GetPath())) { this->p->load_hex_file(evt.GetPath()); - this->p->btn_flash->Enable(); } + p->update_flash_enabled(); }); + p->port_picker->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent &) { p->update_flash_enabled(); }); + p->port_picker->Bind(wxEVT_TEXT, [this](wxCommandEvent &) { p->update_flash_enabled(); }); + p->spoiler->Bind(wxEVT_COLLAPSIBLEPANE_CHANGED, [=](wxCollapsiblePaneEvent &evt) { if (evt.GetCollapsed()) { this->SetMinSize(wxSize(p->min_width, p->min_height)); diff --git a/src/slic3r/GUI/ProgressStatusBar.hpp b/src/slic3r/GUI/ProgressStatusBar.hpp index 7d624af90b..413c6ffee5 100644 --- a/src/slic3r/GUI/ProgressStatusBar.hpp +++ b/src/slic3r/GUI/ProgressStatusBar.hpp @@ -2,6 +2,7 @@ #define PROGRESSSTATUSBAR_HPP #include +#include #include #include diff --git a/src/slic3r/Utils/Serial.hpp b/src/slic3r/Utils/Serial.hpp index e4a28de09d..67d64b4ec1 100644 --- a/src/slic3r/Utils/Serial.hpp +++ b/src/slic3r/Utils/Serial.hpp @@ -17,6 +17,9 @@ struct SerialPortInfo { std::string friendly_name; bool is_printer = false; + SerialPortInfo() {} + SerialPortInfo(std::string port) : port(port), friendly_name(std::move(port)) {} + bool id_match(unsigned id_vendor, unsigned id_product) const { return id_vendor == this->id_vendor && id_product == this->id_product; } }; From 8208da0a7b844dd74775c5029b2f097363db5233 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Tue, 11 Jun 2019 12:44:12 +0200 Subject: [PATCH 26/64] Firmware updater: Fix MMU flashing in GUI --- src/slic3r/GUI/FirmwareDialog.cpp | 34 ++++++++++++++++++------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/slic3r/GUI/FirmwareDialog.cpp b/src/slic3r/GUI/FirmwareDialog.cpp index 9e209faedd..15a09aa716 100644 --- a/src/slic3r/GUI/FirmwareDialog.cpp +++ b/src/slic3r/GUI/FirmwareDialog.cpp @@ -107,7 +107,7 @@ struct FirmwareDialog::priv // GUI elements wxComboBox *port_picker; - wxStaticText *port_autodetect; + wxStaticText *txt_port_autodetect; wxFilePickerCtrl *hex_picker; wxStaticText *txt_status; wxGauge *progressbar; @@ -134,6 +134,7 @@ struct FirmwareDialog::priv // Data std::vector ports; optional port; + bool port_autodetect; HexFile hex_file; // This is a shared pointer holding the background AvrDude task @@ -150,6 +151,7 @@ struct FirmwareDialog::priv btn_flash_label_flashing(_(L("Cancel"))), label_status_flashing(_(L("Flashing in progress. Please do not disconnect the printer!"))), timer_pulse(q), + port_autodetect(false), progress_tasks_done(0), progress_tasks_bar(0), user_cancelled(false), @@ -161,7 +163,7 @@ struct FirmwareDialog::priv void set_txt_status(const wxString &label); void flashing_start(unsigned tasks); void flashing_done(AvrDudeComplete complete); - void enable_port_picker(bool enable); + void set_autodetect(bool autodetect); void update_flash_enabled(); void load_hex_file(const wxString &path); void queue_event(AvrdudeEvent aevt, wxString message); @@ -216,8 +218,10 @@ void FirmwareDialog::priv::find_serial_ports() idx = i; break; } - if (idx != -1) + if (idx != -1) { port_picker->SetSelection(idx); + update_flash_enabled(); + } } } } @@ -282,11 +286,13 @@ void FirmwareDialog::priv::flashing_done(AvrDudeComplete complete) } } -void FirmwareDialog::priv::enable_port_picker(bool enable) +void FirmwareDialog::priv::set_autodetect(bool autodetect) { - port_picker->Show(enable); - btn_rescan->Show(enable); - port_autodetect->Show(! enable); + port_autodetect = autodetect; + + port_picker->Show(!autodetect); + btn_rescan->Show(!autodetect); + txt_port_autodetect->Show(autodetect); q->Layout(); fit_no_shrink(); } @@ -294,7 +300,7 @@ void FirmwareDialog::priv::enable_port_picker(bool enable) void FirmwareDialog::priv::update_flash_enabled() { const bool hex_exists = wxFileExists(hex_picker->GetPath()); - const bool port_valid = get_serial_port(); + const bool port_valid = port_autodetect || get_serial_port(); btn_flash->Enable(hex_exists && port_valid); } @@ -302,8 +308,8 @@ void FirmwareDialog::priv::update_flash_enabled() void FirmwareDialog::priv::load_hex_file(const wxString &path) { hex_file = HexFile(path.wx_str()); - const bool auto_lookup = hex_file.device == HexFile::DEV_MM_CONTROL || hex_file.device == HexFile::DEV_CW1; - enable_port_picker(! auto_lookup); + const bool autodetect = hex_file.device == HexFile::DEV_MM_CONTROL || hex_file.device == HexFile::DEV_CW1; + set_autodetect(autodetect); } void FirmwareDialog::priv::queue_event(AvrdudeEvent aevt, wxString message) @@ -598,7 +604,7 @@ void FirmwareDialog::priv::perform_upload() load_hex_file(filename); // Might already be loaded, but we want to make sure it's fresh - if (! get_serial_port()) { + if (!port_autodetect && !get_serial_port()) { return; } @@ -801,13 +807,13 @@ FirmwareDialog::FirmwareDialog(wxWindow *parent) : auto *label_port_picker = new wxStaticText(panel, wxID_ANY, _(L("Serial port:"))); p->port_picker = new wxComboBox(panel, wxID_ANY); - p->port_autodetect = new wxStaticText(panel, wxID_ANY, _(L("Autodetected"))); + p->txt_port_autodetect = new wxStaticText(panel, wxID_ANY, _(L("Autodetected"))); p->btn_rescan = new wxButton(panel, wxID_ANY, _(L("Rescan"))); auto *port_sizer = new wxBoxSizer(wxHORIZONTAL); port_sizer->Add(p->port_picker, 1, wxEXPAND | wxRIGHT, SPACING); port_sizer->Add(p->btn_rescan, 0); - port_sizer->Add(p->port_autodetect, 1, wxEXPAND); - p->enable_port_picker(true); + port_sizer->Add(p->txt_port_autodetect, 1, wxEXPAND); + p->set_autodetect(false); auto *label_progress = new wxStaticText(panel, wxID_ANY, _(L("Progress:"))); p->progressbar = new wxGauge(panel, wxID_ANY, 1, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL | wxGA_SMOOTH); From bb58d0fb6953c8782831f230e50eaf7bb07ae80c Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Thu, 20 Jun 2019 14:15:36 +0200 Subject: [PATCH 27/64] Add some missing methods into the igl patch. Also, make the static igl dep build the default. --- deps/CMakeLists.txt | 2 +- deps/igl-fixes.patch | 49 ++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index c98941b5af..cbf4f3a540 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -35,7 +35,7 @@ set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination direct option(DEP_DEBUG "Build debug variants (only applicable on Windows)" ON) option(DEP_WX_STABLE "Build against wxWidgets stable 3.0 as opposed to default 3.1 (Linux only)" OFF) -option(DEP_BUILD_IGL_STATIC "Build IGL as a static library. Might cause link errors." OFF) +option(DEP_BUILD_IGL_STATIC "Build IGL as a static library. Might cause link errors." ON) message(STATUS "PrusaSlicer deps DESTDIR: ${DESTDIR}") message(STATUS "PrusaSlicer deps debug build: ${DEP_DEBUG}") diff --git a/deps/igl-fixes.patch b/deps/igl-fixes.patch index 2b50e200b9..b0ff9205d0 100644 --- a/deps/igl-fixes.patch +++ b/deps/igl-fixes.patch @@ -66,22 +66,63 @@ index 4b11007a..47e6c395 100644 endif() list(APPEND files_to_install ${public_sources}) diff --git a/include/igl/AABB.cpp b/include/igl/AABB.cpp -index 09537335..31594314 100644 +index 09537335..92e90cb7 100644 --- a/include/igl/AABB.cpp +++ b/include/igl/AABB.cpp -@@ -1072,4 +1072,5 @@ template void igl::AABB, 3>::init, 3>::init, 2>::init >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&); template double igl::AABB, 3>::squared_distance >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::Matrix const&, double, int&, Eigen::PlainObjectBase >&) const; ++template float igl::AABB const, 0, Eigen::Stride<0, 0> >, 3>::squared_distance const, 0, Eigen::Stride<0, 0> > >(Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::Matrix const&, int&, Eigen::PlainObjectBase >&) const; template bool igl::AABB, 3>::intersect_ray >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::Matrix const&, Eigen::Matrix const&, igl::Hit&) const; +template bool igl::AABB, 3>::intersect_ray >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::Matrix const&, Eigen::Matrix const&, std::vector&) const; ++ ++template void igl::AABB const, 0, Eigen::Stride<0, 0> >, 3>::init const, 0, Eigen::Stride<0, 0> > >(Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&); ++ ++template bool igl::AABB const, 0, Eigen::Stride<0, 0> >, 3>::intersect_ray const, 0, Eigen::Stride<0, 0> > >(Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::Matrix const&, Eigen::Matrix const&, std::vector >&) const; + #endif +diff --git a/include/igl/barycenter.cpp b/include/igl/barycenter.cpp +index 065f82aa..ec2d96cd 100644 +--- a/include/igl/barycenter.cpp ++++ b/include/igl/barycenter.cpp +@@ -54,4 +54,6 @@ template void igl::barycenter, Eigen::M + template void igl::barycenter, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); + template void igl::barycenter, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); + template void igl::barycenter, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); ++ ++template void igl::barycenter const, 0, Eigen::Stride<0, 0> >, Eigen::Map const, 0, Eigen::Stride<0, 0> >, Eigen::Matrix >(Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::PlainObjectBase >&); + #endif +diff --git a/include/igl/point_simplex_squared_distance.cpp b/include/igl/point_simplex_squared_distance.cpp +index 2b98bd28..c66d9ae1 100644 +--- a/include/igl/point_simplex_squared_distance.cpp ++++ b/include/igl/point_simplex_squared_distance.cpp +@@ -178,4 +178,6 @@ template void igl::point_simplex_squared_distance<3, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, double, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::Matrix::Index, double&, Eigen::MatrixBase >&, Eigen::PlainObjectBase >&); + template void igl::point_simplex_squared_distance<2, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, double, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::Matrix::Index, double&, Eigen::MatrixBase >&, Eigen::PlainObjectBase >&); + template void igl::point_simplex_squared_distance<2, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, double, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::Matrix::Index, double&, Eigen::MatrixBase >&, Eigen::PlainObjectBase >&); ++ ++template void igl::point_simplex_squared_distance<3, Eigen::Matrix, Eigen::Map const, 0, Eigen::Stride<0, 0> >, Eigen::Map const, 0, Eigen::Stride<0, 0> >, float, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::Map const, 0, Eigen::Stride<0, 0> >::Index, float&, Eigen::MatrixBase >&); + #endif +diff --git a/include/igl/ray_box_intersect.cpp b/include/igl/ray_box_intersect.cpp +index 4a88b89e..b547f8f8 100644 +--- a/include/igl/ray_box_intersect.cpp ++++ b/include/igl/ray_box_intersect.cpp +@@ -147,4 +147,6 @@ IGL_INLINE bool igl::ray_box_intersect( + #ifdef IGL_STATIC_LIBRARY + // Explicit template instantiation + template bool igl::ray_box_intersect, Eigen::Matrix, double>(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::AlignedBox const&, double const&, double const&, double&, double&); ++ ++template bool igl::ray_box_intersect, Eigen::Matrix, float>(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::AlignedBox const&, float const&, float const&, float&, float&); #endif diff --git a/include/igl/ray_mesh_intersect.cpp b/include/igl/ray_mesh_intersect.cpp -index 9a70a22b..dda1654b 100644 +index 9a70a22b..4233e722 100644 --- a/include/igl/ray_mesh_intersect.cpp +++ b/include/igl/ray_mesh_intersect.cpp -@@ -83,4 +83,5 @@ IGL_INLINE bool igl::ray_mesh_intersect( +@@ -83,4 +83,7 @@ IGL_INLINE bool igl::ray_mesh_intersect( template bool igl::ray_mesh_intersect, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, std::vector >&); template bool igl::ray_mesh_intersect, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, igl::Hit&); template bool igl::ray_mesh_intersect, Eigen::Matrix, Eigen::Matrix, Eigen::Block const, 1, -1, false> >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase const, 1, -1, false> > const&, igl::Hit&); +template bool igl::ray_mesh_intersect, Eigen::Matrix, Eigen::Matrix, Eigen::Block const, 1, -1, false> >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase const, 1, -1, false> > const&, std::vector >&); ++ ++template bool igl::ray_mesh_intersect, Eigen::Matrix, Eigen::Map const, 0, Eigen::Stride<0, 0> >, Eigen::Block const, 0, Eigen::Stride<0, 0> > const, 1, -1, true> >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > > const&, Eigen::MatrixBase const, 0, Eigen::Stride<0, 0> > const, 1, -1, true> > const&, std::vector >&); #endif From b8f9d2e2d8b312f3dbf55aed05291a70d4e92d30 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Thu, 20 Jun 2019 12:54:43 +0200 Subject: [PATCH 28/64] Update default igl dependency to header-only. --- deps/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index cbf4f3a540..5bc33c896d 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -35,7 +35,11 @@ set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination direct option(DEP_DEBUG "Build debug variants (only applicable on Windows)" ON) option(DEP_WX_STABLE "Build against wxWidgets stable 3.0 as opposed to default 3.1 (Linux only)" OFF) -option(DEP_BUILD_IGL_STATIC "Build IGL as a static library. Might cause link errors." ON) + +# IGL static library in release mode produces 50MB binary. On the build server, it should be +# disabled and used in header-only mode. On developer machines, it can be enabled to speed +# up conpilation and suppress warnings coming from IGL. +option(DEP_BUILD_IGL_STATIC "Build IGL as a static library. Might cause link errors and increase binary size." OFF) message(STATUS "PrusaSlicer deps DESTDIR: ${DESTDIR}") message(STATUS "PrusaSlicer deps debug build: ${DEP_DEBUG}") From fe395546f0cec0aa6fd6c5333f71c73b812ea56c Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 20 Jun 2019 12:56:23 +0200 Subject: [PATCH 29/64] Added "info" tooltip for a LockButton on Manipulation panel (#2539) --- src/slic3r/GUI/GUI_ObjectManipulation.cpp | 6 ++++-- src/slic3r/GUI/wxExtensions.cpp | 3 +++ src/slic3r/GUI/wxExtensions.hpp | 7 ++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.cpp b/src/slic3r/GUI/GUI_ObjectManipulation.cpp index 310000ecc3..372cd79efb 100644 --- a/src/slic3r/GUI/GUI_ObjectManipulation.cpp +++ b/src/slic3r/GUI/GUI_ObjectManipulation.cpp @@ -499,11 +499,13 @@ void ObjectManipulation::update_if_dirty() if (selection.requires_uniform_scale()) { m_lock_bnt->SetLock(true); - m_lock_bnt->Disable(); + m_lock_bnt->SetToolTip(_(L("You cann't use non-uniform scaling mode for multiple objects/parts selection"))); + m_lock_bnt->disable(); } else { m_lock_bnt->SetLock(m_uniform_scale); - m_lock_bnt->Enable(); + m_lock_bnt->SetToolTip(wxEmptyString); + m_lock_bnt->enable(); } { diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 7b7178a824..406daccf55 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -2472,6 +2472,9 @@ LockButton::LockButton( wxWindow *parent, void LockButton::OnButton(wxCommandEvent& event) { + if (m_disabled) + return; + m_is_pushed = !m_is_pushed; enter_button(true); diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index c496c28a0c..dd035690ad 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -838,9 +838,13 @@ public: void OnEnterBtn(wxMouseEvent& event) { enter_button(true); event.Skip(); } void OnLeaveBtn(wxMouseEvent& event) { enter_button(false); event.Skip(); } - bool IsLocked() const { return m_is_pushed; } + bool IsLocked() const { return m_is_pushed; } void SetLock(bool lock); + // create its own Enable/Disable functions to not really disabled button because of tooltip enabling + void enable() { m_disabled = false; } + void disable() { m_disabled = true; } + void msw_rescale(); protected: @@ -848,6 +852,7 @@ protected: private: bool m_is_pushed = false; + bool m_disabled = false; ScalableBitmap m_bmp_lock_on; ScalableBitmap m_bmp_lock_off; From 503212181c93545f68bbdec69085d11264943f92 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Mon, 3 Jun 2019 11:31:32 +0200 Subject: [PATCH 30/64] Updating: Index installation Prevents cancelled updates from popping up repeatedly on each application startup --- src/slic3r/Config/Version.cpp | 1 + src/slic3r/Config/Version.hpp | 4 ++ src/slic3r/GUI/GUI_App.cpp | 6 +-- src/slic3r/Utils/PresetUpdater.cpp | 86 ++++++++++++++++++------------ src/slic3r/Utils/Semver.hpp | 5 ++ 5 files changed, 65 insertions(+), 37 deletions(-) diff --git a/src/slic3r/Config/Version.cpp b/src/slic3r/Config/Version.cpp index fe3adfd7f1..865884c6fe 100644 --- a/src/slic3r/Config/Version.cpp +++ b/src/slic3r/Config/Version.cpp @@ -192,6 +192,7 @@ size_t Index::load(const boost::filesystem::path &path) { m_configs.clear(); m_vendor = path.stem().string(); + m_path = path; boost::nowide::ifstream ifs(path.string()); std::string line; diff --git a/src/slic3r/Config/Version.hpp b/src/slic3r/Config/Version.hpp index e689286af8..560bc29c21 100644 --- a/src/slic3r/Config/Version.hpp +++ b/src/slic3r/Config/Version.hpp @@ -72,6 +72,9 @@ public: // if the index is valid. const_iterator recommended() const; + // Returns the filesystem path from which this index has originally been loaded + const boost::filesystem::path& path() const { return m_path; } + // Load all vendor specific indices. // Throws Slic3r::file_parser_error and the standard std file access exceptions. static std::vector load_db(); @@ -79,6 +82,7 @@ public: private: std::string m_vendor; std::vector m_configs; + boost::filesystem::path m_path; }; } // namespace Config diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 3aada45f39..4f1c3adc8b 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -265,10 +265,8 @@ bool GUI_App::on_init_inner() } CallAfter([this] { - if (!config_wizard_startup(app_conf_exists)) { - // Only notify if there was no wizard so as not to bother too much ... - preset_updater->slic3r_update_notify(); - } + config_wizard_startup(app_conf_exists); + preset_updater->slic3r_update_notify(); preset_updater->sync(preset_bundle); }); } diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index f34cd8db19..8c3ced31a2 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -45,10 +46,25 @@ static const char *INDEX_FILENAME = "index.idx"; static const char *TMP_EXTENSION = ".download"; +void copy_file_fix(const fs::path &source, const fs::path &target) +{ + static const auto perms = fs::owner_read | fs::owner_write | fs::group_read | fs::others_read; // aka 644 + + BOOST_LOG_TRIVIAL(debug) << boost::format("PresetUpdater: Copying %1% -> %2%") % source % target; + + // Make sure the file has correct permission both before and after we copy over it + if (fs::exists(target)) { + fs::permissions(target, perms); + } + fs::copy_file(source, target, fs::copy_option::overwrite_if_exists); + fs::permissions(target, perms); +} + struct Update { fs::path source; fs::path target; + Version version; std::string vendor; std::string changelog_url; @@ -61,7 +77,13 @@ struct Update , changelog_url(std::move(changelog_url)) {} - friend std::ostream& operator<<(std::ostream& os , const Update &self) { + void install() const + { + copy_file_fix(source, target); + } + + friend std::ostream& operator<<(std::ostream& os, const Update &self) + { os << "Update(" << self.source.string() << " -> " << self.target.string() << ')'; return os; } @@ -115,7 +137,6 @@ struct PresetUpdater::priv bool enabled_version_check; bool enabled_config_update; std::string version_check_url; - bool had_config_update; fs::path cache_path; fs::path rsrc_path; @@ -135,13 +156,10 @@ struct PresetUpdater::priv void check_install_indices() const; Updates get_config_updates() const; void perform_updates(Updates &&updates, bool snapshot = true) const; - - static void copy_file(const fs::path &from, const fs::path &to); }; PresetUpdater::priv::priv() : ver_slic3r(get_slic3r_version()) - , had_config_update(false) , cache_path(fs::path(Slic3r::data_dir()) / "cache") , rsrc_path(fs::path(resources_dir()) / "profiles") , vendor_path(fs::path(Slic3r::data_dir()) / "vendor") @@ -273,7 +291,7 @@ void PresetUpdater::priv::sync_config(const std::set vendors) try { new_index.load(idx_path_temp); } catch (const std::exception & /* err */) { - BOOST_LOG_TRIVIAL(error) << boost::format("Failed loading a downloaded index %1% for vendor %2%: invalid index?") % idx_path_temp % vendor.name; + BOOST_LOG_TRIVIAL(error) << boost::format("Could not load downloaded index %1% for vendor %2%: invalid index?") % idx_path_temp % vendor.name; continue; } if (new_index.version() < index.version()) { @@ -323,7 +341,7 @@ void PresetUpdater::priv::check_install_indices() const if (! fs::exists(path_in_cache)) { BOOST_LOG_TRIVIAL(info) << "Install index from resources: " << path.filename(); - copy_file(path, path_in_cache); + copy_file_fix(path, path_in_cache); } else { Index idx_rsrc, idx_cache; idx_rsrc.load(path); @@ -331,7 +349,7 @@ void PresetUpdater::priv::check_install_indices() const if (idx_cache.version() < idx_rsrc.version()) { BOOST_LOG_TRIVIAL(info) << "Update index from resources: " << path.filename(); - copy_file(path, path_in_cache); + copy_file_fix(path, path_in_cache); } } } @@ -346,6 +364,7 @@ Updates PresetUpdater::priv::get_config_updates() const for (const auto idx : index_db) { auto bundle_path = vendor_path / (idx.vendor() + ".ini"); + auto bundle_path_idx = vendor_path / idx.path().filename(); if (! fs::exists(bundle_path)) { BOOST_LOG_TRIVIAL(info) << "Bundle not present for index, skipping: " << idx.vendor(); @@ -360,8 +379,31 @@ Updates PresetUpdater::priv::get_config_updates() const const auto recommended = idx.recommended(); if (recommended == idx.end()) { BOOST_LOG_TRIVIAL(error) << boost::format("No recommended version for vendor: %1%, invalid index?") % idx.vendor(); + // XXX: what should be done here? + continue; } + // Load 'installed' idx, if any. + // 'Installed' indices are kept alongside the bundle in the `vendor` subdir + // for bookkeeping to remember a cancelled update and not offer it again. + if (fs::exists(bundle_path_idx)) { + Index existing_idx; + try { + existing_idx.load(bundle_path_idx); + + const auto existing_recommended = existing_idx.recommended(); + if (existing_recommended != existing_idx.end() && recommended->config_version == existing_recommended->config_version) { + // The user has already seen (and presumably rejected) this update + BOOST_LOG_TRIVIAL(info) << boost::format("Downloaded index for `%1%` is the same as installed one, not offering an update.") % idx.vendor(); + continue; + } + } catch (const std::exception & /* err */) { + BOOST_LOG_TRIVIAL(error) << boost::format("Could nto load installed index %1%") % bundle_path_idx; + } + } + + copy_file_fix(idx.path(), bundle_path_idx); + const auto ver_current = idx.find(vp.config_version); const bool ver_current_found = ver_current != idx.end(); if (! ver_current_found) { @@ -453,10 +495,10 @@ void PresetUpdater::priv::perform_updates(Updates &&updates, bool snapshot) cons for (const auto &update : updates.updates) { BOOST_LOG_TRIVIAL(info) << '\t' << update; - copy_file(update.source, update.target); + update.install(); PresetBundle bundle; - bundle.load_configbundle(update.target.string(), PresetBundle::LOAD_CFGBNDLE_SYSTEM); + bundle.load_configbundle(update.source.string(), PresetBundle::LOAD_CFGBNDLE_SYSTEM); BOOST_LOG_TRIVIAL(info) << boost::format("Deleting %1% conflicting presets") % (bundle.prints.size() + bundle.filaments.size() + bundle.printers.size()); @@ -491,19 +533,6 @@ void PresetUpdater::priv::perform_updates(Updates &&updates, bool snapshot) cons } } -void PresetUpdater::priv::copy_file(const fs::path &source, const fs::path &target) -{ - static const auto perms = fs::owner_read | fs::owner_write | fs::group_read | fs::others_read; // aka 644 - - // Make sure the file has correct permission both before and after we copy over it - if (fs::exists(target)) { - fs::permissions(target, perms); - } - fs::copy_file(source, target, fs::copy_option::overwrite_if_exists); - fs::permissions(target, perms); -} - - PresetUpdater::PresetUpdater() : p(new priv()) {} @@ -542,11 +571,6 @@ void PresetUpdater::slic3r_update_notify() { if (! p->enabled_version_check) { return; } - if (p->had_config_update) { - BOOST_LOG_TRIVIAL(info) << "New Slic3r version available, but there was a configuration update, notification won't be displayed"; - return; - } - auto* app_config = GUI::wxGetApp().app_config; const auto ver_online_str = app_config->get("version_online"); const auto ver_online = Semver::parse(ver_online_str); @@ -594,8 +618,6 @@ PresetUpdater::UpdateResult PresetUpdater::config_update() const incompats_map.emplace(std::make_pair(incompat.vendor, std::move(restrictions))); } - p->had_config_update = true; // This needs to be done before a dialog is shown because of OnIdle() + CallAfter() in Perl - GUI::MsgDataIncompatible dlg(std::move(incompats_map)); const auto res = dlg.ShowModal(); if (res == wxID_REPLACE) { @@ -620,8 +642,6 @@ PresetUpdater::UpdateResult PresetUpdater::config_update() const updates_msg.emplace_back(update.vendor, update.version.config_version, update.version.comment, std::move(changelog_url)); } - p->had_config_update = true; // Ditto, see above - GUI::MsgUpdateConfig dlg(updates_msg); const auto res = dlg.ShowModal(); @@ -631,7 +651,7 @@ PresetUpdater::UpdateResult PresetUpdater::config_update() const // Reload global configuration auto *app_config = GUI::wxGetApp().app_config; - GUI::wxGetApp().preset_bundle->load_presets(*app_config); + GUI::wxGetApp().preset_bundle->load_presets(*app_config); GUI::wxGetApp().load_current_presets(); return R_UPDATE_INSTALLED; } else { diff --git a/src/slic3r/Utils/Semver.hpp b/src/slic3r/Utils/Semver.hpp index 2fb4e3f4bf..a755becaa5 100644 --- a/src/slic3r/Utils/Semver.hpp +++ b/src/slic3r/Utils/Semver.hpp @@ -137,6 +137,11 @@ public: Semver operator-(const Minor &b) const { Semver res(*this); return res -= b; } Semver operator-(const Patch &b) const { Semver res(*this); return res -= b; } + // Stream output + friend std::ostream& operator<<(std::ostream& os, const Semver &self) { + os << self.to_string(); + return os; + } private: semver_t ver; From 301eda7369acc02c534a454cfe4c49d8c9ccea2a Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 24 Jun 2019 09:27:19 +0200 Subject: [PATCH 31/64] ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION set as default --- src/libslic3r/Technologies.hpp | 3 - src/slic3r/GUI/3DBed.cpp | 16 ------ src/slic3r/GUI/3DScene.cpp | 4 -- src/slic3r/GUI/GLCanvas3D.cpp | 2 - src/slic3r/GUI/GLCanvas3DManager.cpp | 85 ---------------------------- src/slic3r/GUI/GLCanvas3DManager.hpp | 28 --------- 6 files changed, 138 deletions(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index d7e5aed768..657dab95f8 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -49,7 +49,4 @@ // Enable saving textures on GPU in compressed format #define ENABLE_COMPRESSED_TEXTURES 1 -// Enable texture max size to be dependent on detected OpenGL version -#define ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION 1 - #endif // _technologies_h_ diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index 04ab4e2da2..d63e054c56 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -546,7 +546,6 @@ void Bed3D::render_prusa(const std::string &key, bool bottom) const std::string model_path = resources_dir() + "/models/" + key; -#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION #if !ENABLE_COMPRESSED_TEXTURES // use anisotropic filter if graphic card allows GLfloat max_anisotropy = GLCanvas3DManager::get_gl_info().get_max_anisotropy(); @@ -554,21 +553,6 @@ void Bed3D::render_prusa(const std::string &key, bool bottom) const // use higher resolution images if graphic card and opengl version allow GLint max_tex_size = GLCanvas3DManager::get_gl_info().get_max_tex_size(); -#else -#if !ENABLE_COMPRESSED_TEXTURES - // use anisotropic filter if graphic card allows - GLfloat max_anisotropy = 0.0f; - if (glewIsSupported("GL_EXT_texture_filter_anisotropic")) - glsafe(::glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropy)); -#endif // !ENABLE_COMPRESSED_TEXTURES - - // use higher resolution images if graphic card allows - GLint max_tex_size; - glsafe(::glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_tex_size)); - - // clamp or the texture generation becomes too slow - max_tex_size = std::min(max_tex_size, 8192); -#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION std::string filename = tex_path + ".svg"; diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index 2e30f00cae..f9a79f2d8c 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -2015,11 +2015,7 @@ bool GLBed::on_init_from_file(const std::string& filename, bool useVBOs) std::string _3DScene::get_gl_info(bool format_as_html, bool extensions) { -#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION return Slic3r::GUI::GLCanvas3DManager::get_gl_info().to_string(format_as_html, extensions); -#else - return s_canvas_mgr.get_gl_info(format_as_html, extensions); -#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION } bool _3DScene::add_canvas(wxGLCanvas* canvas, GUI::Bed3D& bed, GUI::Camera& camera, GUI::GLToolbar& view_toolbar) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index a71c030967..973fd1dd94 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1756,11 +1756,9 @@ void GLCanvas3D::render() ImGui::SameLine(); imgui.text(GLCanvas3DManager::are_compressed_textures_supported() ? "supported" : "not supported"); #endif // ENABLE_COMPRESSED_TEXTURES -#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION imgui.text("Max texture size: "); ImGui::SameLine(); imgui.text(std::to_string(GLCanvas3DManager::get_gl_info().get_max_tex_size())); -#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION imgui.end(); #endif // ENABLE_RENDER_STATISTICS diff --git a/src/slic3r/GUI/GLCanvas3DManager.cpp b/src/slic3r/GUI/GLCanvas3DManager.cpp index d213990ba3..a123fcfa7c 100644 --- a/src/slic3r/GUI/GLCanvas3DManager.cpp +++ b/src/slic3r/GUI/GLCanvas3DManager.cpp @@ -15,17 +15,14 @@ #include #include -#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION #ifdef __APPLE__ #include "../Utils/MacDarkMode.hpp" #endif // __APPLE__ -#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION namespace Slic3r { namespace GUI { GLCanvas3DManager::GLInfo::GLInfo() -#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION : m_detected(false) , m_version("") , m_glsl_version("") @@ -33,16 +30,9 @@ GLCanvas3DManager::GLInfo::GLInfo() , m_renderer("") , m_max_tex_size(0) , m_max_anisotropy(0.0f) -#else - : version("") - , glsl_version("") - , vendor("") - , renderer("") -#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION { } -#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION const std::string& GLCanvas3DManager::GLInfo::get_version() const { if (!m_detected) @@ -123,28 +113,7 @@ void GLCanvas3DManager::GLInfo::detect() const m_detected = true; } -#else -void GLCanvas3DManager::GLInfo::detect() -{ - const char* data = (const char*)::glGetString(GL_VERSION); - if (data != nullptr) - version = data; - data = (const char*)::glGetString(GL_SHADING_LANGUAGE_VERSION); - if (data != nullptr) - glsl_version = data; - - data = (const char*)::glGetString(GL_VENDOR); - if (data != nullptr) - vendor = data; - - data = (const char*)::glGetString(GL_RENDERER); - if (data != nullptr) - renderer = data; -} -#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION - -#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION bool GLCanvas3DManager::GLInfo::is_version_greater_or_equal_to(unsigned int major, unsigned int minor) const { if (!m_detected) @@ -175,42 +144,11 @@ bool GLCanvas3DManager::GLInfo::is_version_greater_or_equal_to(unsigned int majo else return gl_minor >= minor; } -#else -bool GLCanvas3DManager::GLInfo::is_version_greater_or_equal_to(unsigned int major, unsigned int minor) const -{ - std::vector tokens; - boost::split(tokens, version, boost::is_any_of(" "), boost::token_compress_on); - - if (tokens.empty()) - return false; - - std::vector numbers; - boost::split(numbers, tokens[0], boost::is_any_of("."), boost::token_compress_on); - - unsigned int gl_major = 0; - unsigned int gl_minor = 0; - - if (numbers.size() > 0) - gl_major = ::atoi(numbers[0].c_str()); - - if (numbers.size() > 1) - gl_minor = ::atoi(numbers[1].c_str()); - - if (gl_major < major) - return false; - else if (gl_major > major) - return true; - else - return gl_minor >= minor; -} -#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION std::string GLCanvas3DManager::GLInfo::to_string(bool format_as_html, bool extensions) const { -#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION if (!m_detected) detect(); -#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION std::stringstream out; @@ -221,17 +159,10 @@ std::string GLCanvas3DManager::GLInfo::to_string(bool format_as_html, bool exten std::string line_end = format_as_html ? "
" : "\n"; out << h2_start << "OpenGL installation" << h2_end << line_end; -#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION out << b_start << "GL version: " << b_end << (m_version.empty() ? "N/A" : m_version) << line_end; out << b_start << "Vendor: " << b_end << (m_vendor.empty() ? "N/A" : m_vendor) << line_end; out << b_start << "Renderer: " << b_end << (m_renderer.empty() ? "N/A" : m_renderer) << line_end; out << b_start << "GLSL version: " << b_end << (m_glsl_version.empty() ? "N/A" : m_glsl_version) << line_end; -#else - out << b_start << "GL version: " << b_end << (version.empty() ? "N/A" : version) << line_end; - out << b_start << "Vendor: " << b_end << (vendor.empty() ? "N/A" : vendor) << line_end; - out << b_start << "Renderer: " << b_end << (renderer.empty() ? "N/A" : renderer) << line_end; - out << b_start << "GLSL version: " << b_end << (glsl_version.empty() ? "N/A" : glsl_version) << line_end; -#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION if (extensions) { @@ -258,9 +189,7 @@ GLCanvas3DManager::EMultisampleState GLCanvas3DManager::s_multisample = GLCanvas #if ENABLE_COMPRESSED_TEXTURES bool GLCanvas3DManager::s_compressed_textures_supported = false; #endif // ENABLE_COMPRESSED_TEXTURES -#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION GLCanvas3DManager::GLInfo GLCanvas3DManager::s_gl_info; -#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION GLCanvas3DManager::GLCanvas3DManager() : m_context(nullptr) @@ -340,16 +269,9 @@ void GLCanvas3DManager::init_gl() if (!m_gl_initialized) { glewInit(); -#if !ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION - m_gl_info.detect(); -#endif // !ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION const AppConfig* config = GUI::get_app_config(); m_use_legacy_opengl = (config == nullptr) || (config->get("use_legacy_opengl") == "1"); -#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION m_use_VBOs = !m_use_legacy_opengl && s_gl_info.is_version_greater_or_equal_to(2, 0); -#else - m_use_VBOs = !m_use_legacy_opengl && m_gl_info.is_version_greater_or_equal_to(2, 0); -#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION m_gl_initialized = true; #if ENABLE_COMPRESSED_TEXTURES if (GLEW_EXT_texture_compression_s3tc) @@ -360,13 +282,6 @@ void GLCanvas3DManager::init_gl() } } -#if !ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION -std::string GLCanvas3DManager::get_gl_info(bool format_as_html, bool extensions) const -{ - return m_gl_info.to_string(format_as_html, extensions); -} -#endif // !ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION - bool GLCanvas3DManager::init(wxGLCanvas* canvas) { CanvasesMap::const_iterator it = do_get_canvas(canvas); diff --git a/src/slic3r/GUI/GLCanvas3DManager.hpp b/src/slic3r/GUI/GLCanvas3DManager.hpp index 3ad30411c2..e6e12ca5d6 100644 --- a/src/slic3r/GUI/GLCanvas3DManager.hpp +++ b/src/slic3r/GUI/GLCanvas3DManager.hpp @@ -29,7 +29,6 @@ struct Camera; class GLCanvas3DManager { -#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION public: class GLInfo { @@ -61,26 +60,8 @@ public: private: void detect() const; }; -#else - struct GLInfo - { - std::string version; - std::string glsl_version; - std::string vendor; - std::string renderer; - GLInfo(); - - void detect(); - bool is_version_greater_or_equal_to(unsigned int major, unsigned int minor) const; - - std::string to_string(bool format_as_html, bool extensions) const; - }; -#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION - -#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION private: -#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION enum EMultisampleState : unsigned char { MS_Unknown, @@ -92,11 +73,7 @@ private: CanvasesMap m_canvases; wxGLContext* m_context; -#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION static GLInfo s_gl_info; -#else - GLInfo m_gl_info; -#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION bool m_gl_initialized; bool m_use_legacy_opengl; bool m_use_VBOs; @@ -116,9 +93,6 @@ public: unsigned int count() const; void init_gl(); -#if !ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION - std::string get_gl_info(bool format_as_html, bool extensions) const; -#endif // !ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION bool init(wxGLCanvas* canvas); @@ -131,9 +105,7 @@ public: static wxGLCanvas* create_wxglcanvas(wxWindow *parent); -#if ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION static const GLInfo& get_gl_info() { return s_gl_info; } -#endif // ENABLE_TEXTURES_MAXSIZE_DEPENDENT_ON_OPENGL_VERSION private: CanvasesMap::iterator do_get_canvas(wxGLCanvas* canvas); From 8b3d88bc0a654fe8c488bcf4f30b6896587c116c Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 24 Jun 2019 09:38:46 +0200 Subject: [PATCH 32/64] Adaptive perspective camera frustrum --- src/slic3r/GUI/Camera.cpp | 100 +++++++++++++++++++++++++++++----- src/slic3r/GUI/Camera.hpp | 12 +++- src/slic3r/GUI/GLCanvas3D.cpp | 5 +- 3 files changed, 99 insertions(+), 18 deletions(-) diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index b8c182ef4a..1f8513ac29 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -24,6 +24,8 @@ namespace GUI { const double Camera::DefaultDistance = 1000.0; double Camera::FrustrumMinZSize = 50.0; double Camera::FrustrumZMargin = 10.0; +double Camera::FovMinDeg = 5.0; +double Camera::FovMaxDeg = 75.0; Camera::Camera() : phi(45.0f) @@ -34,6 +36,7 @@ Camera::Camera() , m_theta(45.0f) , m_zoom(1.0) , m_distance(DefaultDistance) + , m_gui_scale(1.0) , m_view_matrix(Transform3d::Identity()) , m_projection_matrix(Transform3d::Identity()) { @@ -148,6 +151,18 @@ bool Camera::select_view(const std::string& direction) return false; } +double Camera::get_fov() const +{ + switch (m_type) + { + case Perspective: + return 2.0 * Geometry::rad2deg(std::atan(1.0 / m_projection_matrix.matrix()(1, 1))); + default: + case Ortho: + return 0.0; + }; +} + void Camera::apply_viewport(int x, int y, unsigned int w, unsigned int h) const { glsafe(::glViewport(0, 0, w, h)); @@ -174,17 +189,67 @@ void Camera::apply_view_matrix() const void Camera::apply_projection(const BoundingBoxf3& box) const { - m_frustrum_zs = calc_tight_frustrum_zs_around(box); + m_distance = DefaultDistance; + double w = 0.0; + double h = 0.0; - double w = (double)m_viewport[2]; - double h = (double)m_viewport[3]; - - double two_zoom = 2.0 * m_zoom; - if (two_zoom != 0.0) + while (true) { - double inv_two_zoom = 1.0 / two_zoom; - w *= inv_two_zoom; - h *= inv_two_zoom; + m_frustrum_zs = calc_tight_frustrum_zs_around(box); + + w = (double)m_viewport[2]; + h = (double)m_viewport[3]; + + double two_zoom = 2.0 * m_zoom; + if (two_zoom != 0.0) + { + double inv_two_zoom = 1.0 / two_zoom; + w *= inv_two_zoom; + h *= inv_two_zoom; + } + + switch (m_type) + { + default: + case Ortho: + { + m_gui_scale = 1.0; + break; + } + case Perspective: + { + // scale near plane to keep w and h constant on the plane at z = m_distance + double scale = m_frustrum_zs.first / m_distance; + w *= scale; + h *= scale; + m_gui_scale = scale; + break; + } + } + + if (m_type == Perspective) + { + double fov_rad = 2.0 * std::atan(h / m_frustrum_zs.first); + double fov_deg = Geometry::rad2deg(fov_rad); + + // adjust camera distance to keep fov in a limited range + if (fov_deg > FovMaxDeg + 0.001) + { + double new_near_z = h / ::tan(0.5 * Geometry::deg2rad(FovMaxDeg)); + m_distance += (new_near_z - m_frustrum_zs.first); + apply_view_matrix(); + } + else if (fov_deg < FovMinDeg - 0.001) + { + double new_near_z = h / ::tan(0.5 * Geometry::deg2rad(FovMinDeg)); + m_distance += (new_near_z - m_frustrum_zs.first); + apply_view_matrix(); + } + else + break; + } + else + break; } glsafe(::glMatrixMode(GL_PROJECTION)); @@ -231,17 +296,22 @@ void Camera::debug_render() const std::string type = get_type_as_string(); Vec3f position = get_position().cast(); Vec3f target = m_target.cast(); + float distance = (float)get_distance(); Vec3f forward = get_dir_forward().cast(); Vec3f right = get_dir_right().cast(); Vec3f up = get_dir_up().cast(); float nearZ = (float)m_frustrum_zs.first; float farZ = (float)m_frustrum_zs.second; float deltaZ = farZ - nearZ; + float zoom = (float)m_zoom; + float fov = (float)get_fov(); + float gui_scale = (float)get_gui_scale(); ImGui::InputText("Type", const_cast(type.data()), type.length(), ImGuiInputTextFlags_ReadOnly); ImGui::Separator(); ImGui::InputFloat3("Position", position.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); ImGui::InputFloat3("Target", target.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); + ImGui::InputFloat("Distance", &distance, 0.0f, 0.0f, "%.6f", ImGuiInputTextFlags_ReadOnly); ImGui::Separator(); ImGui::InputFloat3("Forward", forward.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); ImGui::InputFloat3("Right", right.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); @@ -250,6 +320,11 @@ void Camera::debug_render() const ImGui::InputFloat("Near Z", &nearZ, 0.0f, 0.0f, "%.6f", ImGuiInputTextFlags_ReadOnly); ImGui::InputFloat("Far Z", &farZ, 0.0f, 0.0f, "%.6f", ImGuiInputTextFlags_ReadOnly); ImGui::InputFloat("Delta Z", &deltaZ, 0.0f, 0.0f, "%.6f", ImGuiInputTextFlags_ReadOnly); + ImGui::Separator(); + ImGui::InputFloat("Zoom", &zoom, 0.0f, 0.0f, "%.6f", ImGuiInputTextFlags_ReadOnly); + ImGui::InputFloat("Fov", &fov, 0.0f, 0.0f, "%.6f", ImGuiInputTextFlags_ReadOnly); + ImGui::Separator(); + ImGui::InputFloat("GUI scale", &gui_scale, 0.0f, 0.0f, "%.6f", ImGuiInputTextFlags_ReadOnly); imgui.end(); } #endif // ENABLE_CAMERA_STATISTICS @@ -273,11 +348,10 @@ std::pair Camera::calc_tight_frustrum_zs_around(const BoundingBo vertices.push_back(bb_max); vertices.emplace_back(bb_min(0), bb_max(1), bb_max(2)); - // set the Z range in eye coordinates (only negative Zs are in front of the camera) + // set the Z range in eye coordinates (negative Zs are in front of the camera) for (const Vec3d& v : vertices) { - // ensure non-negative values - double z = std::max(-(m_view_matrix * v)(2), 0.0); + double z = -(m_view_matrix * v)(2); ret.first = std::min(ret.first, z); ret.second = std::max(ret.second, z); } @@ -295,8 +369,6 @@ std::pair Camera::calc_tight_frustrum_zs_around(const BoundingBo ret.second = mid_z + half_size; } - assert(ret.first > 0.0); - return ret; } diff --git a/src/slic3r/GUI/Camera.hpp b/src/slic3r/GUI/Camera.hpp index 6a2f65a30e..bd2541ce2f 100644 --- a/src/slic3r/GUI/Camera.hpp +++ b/src/slic3r/GUI/Camera.hpp @@ -12,6 +12,8 @@ struct Camera static const double DefaultDistance; static double FrustrumMinZSize; static double FrustrumZMargin; + static double FovMinDeg; + static double FovMaxDeg; enum EType : unsigned char { @@ -31,7 +33,8 @@ private: float m_theta; double m_zoom; // Distance between camera position and camera target measured along the camera Z axis - double m_distance; + mutable double m_distance; + mutable double m_gui_scale; mutable std::array m_viewport; mutable Transform3d m_view_matrix; @@ -52,13 +55,14 @@ public: const Vec3d& get_target() const { return m_target; } void set_target(const Vec3d& target); + double get_distance() const { return m_distance; } + double get_gui_scale() const { return m_gui_scale; } + float get_theta() const { return m_theta; } void set_theta(float theta, bool apply_limit); double get_zoom() const { return m_zoom; } void set_zoom(double zoom, const BoundingBoxf3& max_box, int canvas_w, int canvas_h); - // this method does not check if the given zoom is valid, use instead the other set_zoom() method - // called only by: void GLCanvas3D::update_ui_from_settings() void set_zoom(double zoom) { m_zoom = zoom; } const BoundingBoxf3& get_scene_box() const { return m_scene_box; } @@ -79,6 +83,8 @@ public: double get_near_z() const { return m_frustrum_zs.first; } double get_far_z() const { return m_frustrum_zs.second; } + double get_fov() const; + void apply_viewport(int x, int y, unsigned int w, unsigned int h) const; void apply_view_matrix() const; void apply_projection(const BoundingBoxf3& box) const; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index d9a8a870ce..2bb284fd4e 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3902,8 +3902,11 @@ void GLCanvas3D::_render_overlays() const glsafe(::glDisable(GL_DEPTH_TEST)); glsafe(::glPushMatrix()); glsafe(::glLoadIdentity()); - // ensure the textures are renderered inside the frustrum + // ensure that the textures are renderered inside the frustrum glsafe(::glTranslated(0.0, 0.0, -(m_camera.get_near_z() + 0.5))); + // ensure that the overlay fits the frustrum near z plane + double gui_scale = m_camera.get_gui_scale(); + glsafe(::glScaled(gui_scale, gui_scale, 1.0)); _render_gizmos_overlay(); _render_warning_texture(); From 00b9a3ad3250c79a58fc7ea3369932967aa80352 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 24 Jun 2019 09:54:58 +0200 Subject: [PATCH 33/64] ENABLE_COMPRESSED_TEXTURES set as default --- src/libslic3r/Technologies.hpp | 3 - src/slic3r/GUI/3DBed.cpp | 76 ---------------------- src/slic3r/GUI/3DBed.hpp | 12 ---- src/slic3r/GUI/GLCanvas3D.cpp | 48 -------------- src/slic3r/GUI/GLCanvas3D.hpp | 12 ---- src/slic3r/GUI/GLCanvas3DManager.cpp | 4 -- src/slic3r/GUI/GLCanvas3DManager.hpp | 4 -- src/slic3r/GUI/GLTexture.cpp | 78 +---------------------- src/slic3r/GUI/GLTexture.hpp | 24 ------- src/slic3r/GUI/GLToolbar.cpp | 8 --- src/slic3r/GUI/Gizmos/GLGizmosManager.cpp | 8 --- src/slic3r/GUI/ImGuiWrapper.cpp | 12 ---- src/slic3r/GUI/ImGuiWrapper.hpp | 4 -- 13 files changed, 2 insertions(+), 291 deletions(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 657dab95f8..bffc45cde7 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -46,7 +46,4 @@ #define ENABLE_SVG_ICONS (1 && ENABLE_1_42_0_ALPHA8 && ENABLE_TEXTURES_FROM_SVG) -// Enable saving textures on GPU in compressed format -#define ENABLE_COMPRESSED_TEXTURES 1 - #endif // _technologies_h_ diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index d63e054c56..6ffcdcbe87 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -9,9 +9,7 @@ #include "GUI_App.hpp" #include "PresetBundle.hpp" #include "Gizmos/GLGizmoBase.hpp" -#if ENABLE_COMPRESSED_TEXTURES #include "GLCanvas3D.hpp" -#endif // ENABLE_COMPRESSED_TEXTURES #include @@ -276,9 +274,7 @@ void Bed3D::Axes::render_axis(double length) const Bed3D::Bed3D() : m_type(Custom) -#if ENABLE_COMPRESSED_TEXTURES , m_requires_canvas_update(false) -#endif // ENABLE_COMPRESSED_TEXTURES #if ENABLE_TEXTURES_FROM_SVG , m_vbo_id(0) #endif // ENABLE_TEXTURES_FROM_SVG @@ -334,18 +330,13 @@ Point Bed3D::point_projection(const Point& point) const } #if ENABLE_TEXTURES_FROM_SVG -#if ENABLE_COMPRESSED_TEXTURES void Bed3D::render(GLCanvas3D* canvas, float theta, bool useVBOs, float scale_factor) const -#else -void Bed3D::render(float theta, bool useVBOs, float scale_factor) const -#endif // ENABLE_COMPRESSED_TEXTURES { m_scale_factor = scale_factor; EType type = useVBOs ? m_type : Custom; switch (type) { -#if ENABLE_COMPRESSED_TEXTURES case MK2: { render_prusa(canvas, "mk2", theta > 90.0f); @@ -361,23 +352,6 @@ void Bed3D::render(float theta, bool useVBOs, float scale_factor) const render_prusa(canvas, "sl1", theta > 90.0f); break; } -#else - case MK2: - { - render_prusa("mk2", theta > 90.0f); - break; - } - case MK3: - { - render_prusa("mk3", theta > 90.0f); - break; - } - case SL1: - { - render_prusa("sl1", theta > 90.0f); - break; - } -#endif // ENABLE_COMPRESSED_TEXTURES default: case Custom: { @@ -387,11 +361,7 @@ void Bed3D::render(float theta, bool useVBOs, float scale_factor) const } } #else -#if ENABLE_COMPRESSED_TEXTURES void Bed3D::render(GLCanvas3D* canvas, float theta, bool useVBOs, float scale_factor) const -#else -void Bed3D::render(float theta, bool useVBOs, float scale_factor) const -#endif // ENABLE_COMPRESSED_TEXTURES { m_scale_factor = scale_factor; @@ -400,7 +370,6 @@ void Bed3D::render(float theta, bool useVBOs, float scale_factor) const switch (m_type) { -#if ENABLE_COMPRESSED_TEXTURES case MK2: { render_prusa(canvas, "mk2", theta, useVBOs); @@ -416,23 +385,6 @@ void Bed3D::render(float theta, bool useVBOs, float scale_factor) const render_prusa(canvas, "sl1", theta, useVBOs); break; } -#else - case MK2: - { - render_prusa("mk2", theta, useVBOs); - break; - } - case MK3: - { - render_prusa("mk3", theta, useVBOs); - break; - } - case SL1: - { - render_prusa("sl1", theta, useVBOs); - break; - } -#endif // ENABLE_COMPRESSED_TEXTURES default: case Custom: { @@ -536,21 +488,12 @@ Bed3D::EType Bed3D::detect_type(const Pointfs& shape) const } #if ENABLE_TEXTURES_FROM_SVG -#if ENABLE_COMPRESSED_TEXTURES void Bed3D::render_prusa(GLCanvas3D* canvas, const std::string &key, bool bottom) const -#else -void Bed3D::render_prusa(const std::string &key, bool bottom) const -#endif // ENABLE_COMPRESSED_TEXTURES { std::string tex_path = resources_dir() + "/icons/bed/" + key; std::string model_path = resources_dir() + "/models/" + key; -#if !ENABLE_COMPRESSED_TEXTURES - // use anisotropic filter if graphic card allows - GLfloat max_anisotropy = GLCanvas3DManager::get_gl_info().get_max_anisotropy(); -#endif // !ENABLE_COMPRESSED_TEXTURES - // use higher resolution images if graphic card and opengl version allow GLint max_tex_size = GLCanvas3DManager::get_gl_info().get_max_tex_size(); @@ -558,7 +501,6 @@ void Bed3D::render_prusa(const std::string &key, bool bottom) const if ((m_texture.get_id() == 0) || (m_texture.get_source() != filename)) { -#if ENABLE_COMPRESSED_TEXTURES // generate a temporary lower resolution texture to show while no main texture levels have been compressed if (!m_temp_texture.load_from_svg_file(filename, false, false, false, max_tex_size / 8)) { @@ -568,24 +510,11 @@ void Bed3D::render_prusa(const std::string &key, bool bottom) const // starts generating the main texture, compression will run asynchronously if (!m_texture.load_from_svg_file(filename, true, true, true, max_tex_size)) -#else - if (!m_texture.load_from_svg_file(filename, true, max_tex_size)) -#endif // ENABLE_COMPRESSED_TEXTURES { render_custom(); return; } - -#if !ENABLE_COMPRESSED_TEXTURES - if (max_anisotropy > 0.0f) - { - glsafe(::glBindTexture(GL_TEXTURE_2D, m_texture.get_id())); - glsafe(::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy)); - glsafe(::glBindTexture(GL_TEXTURE_2D, 0)); - } -#endif // !ENABLE_COMPRESSED_TEXTURES } -#if ENABLE_COMPRESSED_TEXTURES else if (m_texture.unsent_compressed_data_available()) { // sends to gpu the already available compressed levels of the main texture @@ -604,7 +533,6 @@ void Bed3D::render_prusa(const std::string &key, bool bottom) const m_requires_canvas_update = false; } -#endif // ENABLE_COMPRESSED_TEXTURES if (!bottom) { @@ -677,16 +605,12 @@ void Bed3D::render_prusa_shader(bool transparent) const GLint position_id = m_shader.get_attrib_location("v_position"); GLint tex_coords_id = m_shader.get_attrib_location("v_tex_coords"); -#if ENABLE_COMPRESSED_TEXTURES // show the temporary texture while no compressed data is available GLuint tex_id = (GLuint)m_temp_texture.get_id(); if (tex_id == 0) tex_id = (GLuint)m_texture.get_id(); glsafe(::glBindTexture(GL_TEXTURE_2D, tex_id)); -#else - glsafe(::glBindTexture(GL_TEXTURE_2D, (GLuint)m_texture.get_id())); -#endif // ENABLE_COMPRESSED_TEXTURES glsafe(::glBindBuffer(GL_ARRAY_BUFFER, m_vbo_id)); if (position_id != -1) diff --git a/src/slic3r/GUI/3DBed.hpp b/src/slic3r/GUI/3DBed.hpp index 401f1232f3..a10042cccf 100644 --- a/src/slic3r/GUI/3DBed.hpp +++ b/src/slic3r/GUI/3DBed.hpp @@ -13,9 +13,7 @@ typedef class GLUquadric GLUquadricObj; namespace Slic3r { namespace GUI { -#if ENABLE_COMPRESSED_TEXTURES class GLCanvas3D; -#endif // ENABLE_COMPRESSED_TEXTURES class GeometryBuffer { @@ -95,12 +93,10 @@ private: GeometryBuffer m_gridlines; #if ENABLE_TEXTURES_FROM_SVG mutable GLTexture m_texture; -#if ENABLE_COMPRESSED_TEXTURES // temporary texture shown until the main texture has still no levels compressed mutable GLTexture m_temp_texture; // used to trigger 3D scene update once all compressed textures have been sent to GPU mutable bool m_requires_canvas_update; -#endif // ENABLE_COMPRESSED_TEXTURES mutable Shader m_shader; mutable unsigned int m_vbo_id; #else @@ -131,11 +127,7 @@ public: bool contains(const Point& point) const; Point point_projection(const Point& point) const; -#if ENABLE_COMPRESSED_TEXTURES void render(GLCanvas3D* canvas, float theta, bool useVBOs, float scale_factor) const; -#else - void render(float theta, bool useVBOs, float scale_factor) const; -#endif // ENABLE_COMPRESSED_TEXTURES void render_axes() const; private: @@ -144,11 +136,7 @@ private: void calc_gridlines(const ExPolygon& poly, const BoundingBox& bed_bbox); EType detect_type(const Pointfs& shape) const; #if ENABLE_TEXTURES_FROM_SVG -#if ENABLE_COMPRESSED_TEXTURES void render_prusa(GLCanvas3D* canvas, const std::string& key, bool bottom) const; -#else - void render_prusa(const std::string& key, bool bottom) const; -#endif // ENABLE_COMPRESSED_TEXTURES void render_prusa_shader(bool transparent) const; #else void render_prusa(const std::string &key, float theta, bool useVBOs) const; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 973fd1dd94..c8559cb5d4 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -401,11 +401,7 @@ void GLCanvas3D::LayersEditing::_render_tooltip_texture(const GLCanvas3D& canvas if (m_tooltip_texture.get_id() == 0) { std::string filename = resources_dir() + "/icons/variable_layer_height_tooltip.png"; -#if ENABLE_COMPRESSED_TEXTURES if (!m_tooltip_texture.load_from_file(filename, false, true)) -#else - if (!m_tooltip_texture.load_from_file(filename, false)) -#endif // ENABLE_COMPRESSED_TEXTURES return; } @@ -437,11 +433,7 @@ void GLCanvas3D::LayersEditing::_render_reset_texture(const Rect& reset_rect) co if (m_reset_texture.get_id() == 0) { std::string filename = resources_dir() + "/icons/variable_layer_height_reset.png"; -#if ENABLE_COMPRESSED_TEXTURES if (!m_reset_texture.load_from_file(filename, false, true)) -#else - if (!m_reset_texture.load_from_file(filename, false)) -#endif // ENABLE_COMPRESSED_TEXTURES return; } @@ -736,11 +728,7 @@ void GLCanvas3D::WarningTexture::activate(WarningTexture::Warning warning, bool } } -#if ENABLE_COMPRESSED_TEXTURES generate(text, canvas, true, red_colored); // GUI::GLTexture::reset() is called at the beginning of generate(...) -#else - _generate(text, canvas, red_colored); // GUI::GLTexture::reset() is called at the beginning of generate(...) -#endif // ENABLE_COMPRESSED_TEXTURES // save information for rescaling m_msg_text = text; @@ -801,11 +789,7 @@ static void msw_disable_cleartype(wxFont &font) } #endif /* __WXMSW__ */ -#if ENABLE_COMPRESSED_TEXTURES bool GLCanvas3D::WarningTexture::generate(const std::string& msg_utf8, const GLCanvas3D& canvas, bool compress, bool red_colored/* = false*/) -#else -bool GLCanvas3D::WarningTexture::_generate(const std::string& msg_utf8, const GLCanvas3D& canvas, const bool red_colored/* = false*/) -#endif // ENABLE_COMPRESSED_TEXTURES { reset(); @@ -879,14 +863,10 @@ bool GLCanvas3D::WarningTexture::_generate(const std::string& msg_utf8, const GL glsafe(::glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); glsafe(::glGenTextures(1, &m_id)); glsafe(::glBindTexture(GL_TEXTURE_2D, (GLuint)m_id)); -#if ENABLE_COMPRESSED_TEXTURES if (compress && GLEW_EXT_texture_compression_s3tc) glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); else glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); -#else - glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); -#endif // ENABLE_COMPRESSED_TEXTURES glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0)); @@ -937,11 +917,7 @@ void GLCanvas3D::WarningTexture::msw_rescale(const GLCanvas3D& canvas) if (m_msg_text.empty()) return; -#if ENABLE_COMPRESSED_TEXTURES generate(m_msg_text, canvas, true, m_is_colored_red); -#else - _generate(m_msg_text, canvas, m_is_colored_red); -#endif // ENABLE_COMPRESSED_TEXTURES } const unsigned char GLCanvas3D::LegendTexture::Squares_Border_Color[3] = { 64, 64, 64 }; @@ -984,11 +960,7 @@ void GLCanvas3D::LegendTexture::fill_color_print_legend_values(const GCodePrevie } } -#if ENABLE_COMPRESSED_TEXTURES bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, const std::vector& tool_colors, const GLCanvas3D& canvas, bool compress) -#else -bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, const std::vector& tool_colors, const GLCanvas3D& canvas) -#endif // ENABLE_COMPRESSED_TEXTURES { reset(); @@ -1177,14 +1149,10 @@ bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, c glsafe(::glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); glsafe(::glGenTextures(1, &m_id)); glsafe(::glBindTexture(GL_TEXTURE_2D, (GLuint)m_id)); -#if ENABLE_COMPRESSED_TEXTURES if (compress && GLEW_EXT_texture_compression_s3tc) glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); else glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); -#else - glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); -#endif // ENABLE_COMPRESSED_TEXTURES glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0)); @@ -1267,9 +1235,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar #endif // ENABLE_SVG_ICONS , m_use_clipping_planes(false) , m_sidebar_field("") -#if ENABLE_COMPRESSED_TEXTURES , m_keep_dirty(false) -#endif // ENABLE_COMPRESSED_TEXTURES , m_config(nullptr) , m_process(nullptr) , m_model(nullptr) @@ -1487,10 +1453,8 @@ void GLCanvas3D::bed_shape_changed() m_camera.set_scene_box(scene_bounding_box()); m_camera.requires_zoom_to_bed = true; m_dirty = true; -#if ENABLE_COMPRESSED_TEXTURES if (m_bed.is_prusa()) start_keeping_dirty(); -#endif // ENABLE_COMPRESSED_TEXTURES } void GLCanvas3D::set_color_by(const std::string& value) @@ -1750,12 +1714,10 @@ void GLCanvas3D::render() imgui.text(std::to_string(m_render_stats.last_frame)); ImGui::SameLine(); imgui.text(" ms"); -#if ENABLE_COMPRESSED_TEXTURES ImGui::Separator(); imgui.text("Compressed textures: "); ImGui::SameLine(); imgui.text(GLCanvas3DManager::are_compressed_textures_supported() ? "supported" : "not supported"); -#endif // ENABLE_COMPRESSED_TEXTURES imgui.text("Max texture size: "); ImGui::SameLine(); imgui.text(std::to_string(GLCanvas3DManager::get_gl_info().get_max_tex_size())); @@ -2366,10 +2328,8 @@ void GLCanvas3D::on_idle(wxIdleEvent& evt) _refresh_if_shown_on_screen(); -#if ENABLE_COMPRESSED_TEXTURES if (m_keep_dirty) m_dirty = true; -#endif // ENABLE_COMPRESSED_TEXTURES } void GLCanvas3D::on_char(wxKeyEvent& evt) @@ -4002,11 +3962,7 @@ void GLCanvas3D::_render_bed(float theta) const #if ENABLE_RETINA_GL scale_factor = m_retina_helper->get_scale_factor(); #endif // ENABLE_RETINA_GL -#if ENABLE_COMPRESSED_TEXTURES m_bed.render(const_cast(this), theta, m_use_VBOs, scale_factor); -#else - m_bed.render(theta, m_use_VBOs, scale_factor); -#endif // ENABLE_COMPRESSED_TEXTURES } void GLCanvas3D::_render_axes() const @@ -5762,11 +5718,7 @@ std::vector GLCanvas3D::_parse_colors(const std::vector& col void GLCanvas3D::_generate_legend_texture(const GCodePreviewData& preview_data, const std::vector& tool_colors) { -#if ENABLE_COMPRESSED_TEXTURES m_legend_texture.generate(preview_data, tool_colors, *this, true); -#else - m_legend_texture.generate(preview_data, tool_colors, *this); -#endif // ENABLE_COMPRESSED_TEXTURES } void GLCanvas3D::_set_warning_texture(WarningTexture::Warning warning, bool state) diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 4b97124afb..9520fae0e0 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -376,11 +376,7 @@ class GLCanvas3D std::vector m_warnings; // Generates the texture with given text. -#if ENABLE_COMPRESSED_TEXTURES bool generate(const std::string& msg, const GLCanvas3D& canvas, bool compress, bool red_colored = false); -#else - bool _generate(const std::string& msg, const GLCanvas3D& canvas, const bool red_colored = false); -#endif // ENABLE_COMPRESSED_TEXTURES }; class LegendTexture : public GUI::GLTexture @@ -403,11 +399,7 @@ class GLCanvas3D void fill_color_print_legend_values(const GCodePreviewData& preview_data, const GLCanvas3D& canvas, std::vector>& cp_legend_values); -#if ENABLE_COMPRESSED_TEXTURES bool generate(const GCodePreviewData& preview_data, const std::vector& tool_colors, const GLCanvas3D& canvas, bool compress); -#else - bool generate(const GCodePreviewData& preview_data, const std::vector& tool_colors, const GLCanvas3D& canvas); -#endif // ENABLE_COMPRESSED_TEXTURES void render(const GLCanvas3D& canvas) const; }; @@ -451,9 +443,7 @@ private: bool m_use_clipping_planes; mutable SlaCap m_sla_caps[2]; std::string m_sidebar_field; -#if ENABLE_COMPRESSED_TEXTURES bool m_keep_dirty; -#endif // ENABLE_COMPRESSED_TEXTURES mutable GLVolumeCollection m_volumes; Selection m_selection; @@ -640,10 +630,8 @@ public: void set_cursor(ECursorType type); void msw_rescale(); -#if ENABLE_COMPRESSED_TEXTURES void start_keeping_dirty() { m_keep_dirty = true; } void stop_keeping_dirty() { m_keep_dirty = false; } -#endif // ENABLE_COMPRESSED_TEXTURES private: bool _is_shown_on_screen() const; diff --git a/src/slic3r/GUI/GLCanvas3DManager.cpp b/src/slic3r/GUI/GLCanvas3DManager.cpp index a123fcfa7c..4f64b4e877 100644 --- a/src/slic3r/GUI/GLCanvas3DManager.cpp +++ b/src/slic3r/GUI/GLCanvas3DManager.cpp @@ -186,9 +186,7 @@ std::string GLCanvas3DManager::GLInfo::to_string(bool format_as_html, bool exten } GLCanvas3DManager::EMultisampleState GLCanvas3DManager::s_multisample = GLCanvas3DManager::MS_Unknown; -#if ENABLE_COMPRESSED_TEXTURES bool GLCanvas3DManager::s_compressed_textures_supported = false; -#endif // ENABLE_COMPRESSED_TEXTURES GLCanvas3DManager::GLInfo GLCanvas3DManager::s_gl_info; GLCanvas3DManager::GLCanvas3DManager() @@ -273,12 +271,10 @@ void GLCanvas3DManager::init_gl() m_use_legacy_opengl = (config == nullptr) || (config->get("use_legacy_opengl") == "1"); m_use_VBOs = !m_use_legacy_opengl && s_gl_info.is_version_greater_or_equal_to(2, 0); m_gl_initialized = true; -#if ENABLE_COMPRESSED_TEXTURES if (GLEW_EXT_texture_compression_s3tc) s_compressed_textures_supported = true; else s_compressed_textures_supported = false; -#endif // ENABLE_COMPRESSED_TEXTURES } } diff --git a/src/slic3r/GUI/GLCanvas3DManager.hpp b/src/slic3r/GUI/GLCanvas3DManager.hpp index e6e12ca5d6..26c2558d07 100644 --- a/src/slic3r/GUI/GLCanvas3DManager.hpp +++ b/src/slic3r/GUI/GLCanvas3DManager.hpp @@ -78,9 +78,7 @@ private: bool m_use_legacy_opengl; bool m_use_VBOs; static EMultisampleState s_multisample; -#if ENABLE_COMPRESSED_TEXTURES static bool s_compressed_textures_supported; -#endif // ENABLE_COMPRESSED_TEXTURES public: GLCanvas3DManager(); @@ -99,9 +97,7 @@ public: GLCanvas3D* get_canvas(wxGLCanvas* canvas); static bool can_multisample() { return s_multisample == MS_Enabled; } -#if ENABLE_COMPRESSED_TEXTURES static bool are_compressed_textures_supported() { return s_compressed_textures_supported; } -#endif // ENABLE_COMPRESSED_TEXTURES static wxGLCanvas* create_wxglcanvas(wxWindow *parent); diff --git a/src/slic3r/GUI/GLTexture.cpp b/src/slic3r/GUI/GLTexture.cpp index 9b373440a1..171a5c8851 100644 --- a/src/slic3r/GUI/GLTexture.cpp +++ b/src/slic3r/GUI/GLTexture.cpp @@ -12,12 +12,10 @@ #include #include -#if ENABLE_COMPRESSED_TEXTURES #include #define STB_DXT_IMPLEMENTATION #include "stb_dxt/stb_dxt.h" -#endif // ENABLE_COMPRESSED_TEXTURES #include "nanosvg/nanosvg.h" #include "nanosvg/nanosvgrast.h" @@ -27,7 +25,6 @@ namespace Slic3r { namespace GUI { -#if ENABLE_COMPRESSED_TEXTURES void GLTexture::Compressor::reset() { // force compression completion, if any @@ -120,7 +117,6 @@ void GLTexture::Compressor::compress() m_is_compressing = false; m_abort_compressing = false; } -#endif // ENABLE_COMPRESSED_TEXTURES GLTexture::Quad_UVs GLTexture::FullTextureUVs = { { 0.0f, 1.0f }, { 1.0f, 1.0f }, { 1.0f, 0.0f }, { 0.0f, 0.0f } }; @@ -129,9 +125,7 @@ GLTexture::GLTexture() , m_width(0) , m_height(0) , m_source("") -#if ENABLE_COMPRESSED_TEXTURES , m_compressor(*this) -#endif // ENABLE_COMPRESSED_TEXTURES { } @@ -140,11 +134,7 @@ GLTexture::~GLTexture() reset(); } -#if ENABLE_COMPRESSED_TEXTURES bool GLTexture::load_from_file(const std::string& filename, bool use_mipmaps, bool compress) -#else -bool GLTexture::load_from_file(const std::string& filename, bool use_mipmaps) -#endif // ENABLE_COMPRESSED_TEXTURES { reset(); @@ -152,20 +142,12 @@ bool GLTexture::load_from_file(const std::string& filename, bool use_mipmaps) return false; if (boost::algorithm::iends_with(filename, ".png")) -#if ENABLE_COMPRESSED_TEXTURES return load_from_png(filename, use_mipmaps, compress); -#else - return load_from_png(filename, use_mipmaps); -#endif // ENABLE_COMPRESSED_TEXTURES else return false; } -#if ENABLE_COMPRESSED_TEXTURES bool GLTexture::load_from_svg_file(const std::string& filename, bool use_mipmaps, bool compress, bool apply_anisotropy, unsigned int max_size_px) -#else -bool GLTexture::load_from_svg_file(const std::string& filename, bool use_mipmaps, unsigned int max_size_px) -#endif // ENABLE_COMPRESSED_TEXTURES { reset(); @@ -173,20 +155,12 @@ bool GLTexture::load_from_svg_file(const std::string& filename, bool use_mipmaps return false; if (boost::algorithm::iends_with(filename, ".svg")) -#if ENABLE_COMPRESSED_TEXTURES return load_from_svg(filename, use_mipmaps, compress, apply_anisotropy, max_size_px); -#else - return load_from_svg(filename, use_mipmaps, max_size_px); -#endif // ENABLE_COMPRESSED_TEXTURES else return false; } -#if ENABLE_COMPRESSED_TEXTURES bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector& filenames, const std::vector>& states, unsigned int sprite_size_px, bool compress) -#else -bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector& filenames, const std::vector>& states, unsigned int sprite_size_px) -#endif // ENABLE_COMPRESSED_TEXTURES { reset(); @@ -302,14 +276,10 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vectorwidth); m_height = (int)(scale * image->height); -#if ENABLE_COMPRESSED_TEXTURES if (compression_enabled) { // the stb_dxt compression library seems to like only texture sizes which are a multiple of 4 @@ -553,7 +494,6 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns if (height_rem != 0) m_height += (4 - height_rem); } -#endif // ENABLE_COMPRESSED_TEXTURES int n_pixels = m_width * m_height; @@ -581,7 +521,7 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns glsafe(::glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); glsafe(::glGenTextures(1, &m_id)); glsafe(::glBindTexture(GL_TEXTURE_2D, m_id)); -#if ENABLE_COMPRESSED_TEXTURES + if (apply_anisotropy) { GLfloat max_anisotropy = GLCanvas3DManager::get_gl_info().get_max_anisotropy(); @@ -598,9 +538,7 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns } else glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); -#else - glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); -#endif // ENABLE_COMPRESSED_TEXTURES + if (use_mipmaps) { // we manually generate mipmaps because glGenerateMipmap() function is not reliable on all graphics cards @@ -616,12 +554,9 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns lod_h = std::max(lod_h / 2, 1); scale /= 2.0f; -#if ENABLE_COMPRESSED_TEXTURES data.resize(lod_w * lod_h * 4); -#endif // ENABLE_COMPRESSED_TEXTURES nsvgRasterize(rast, image, 0, 0, scale, data.data(), lod_w, lod_h, lod_w * 4); -#if ENABLE_COMPRESSED_TEXTURES if (compression_enabled) { // initializes the texture on GPU @@ -631,20 +566,13 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns } else glsafe(::glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, (GLsizei)lod_w, (GLsizei)lod_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); -#else - glsafe(::glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, (GLsizei)lod_w, (GLsizei)lod_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data())); -#endif // ENABLE_COMPRESSED_TEXTURES } -#if ENABLE_COMPRESSED_TEXTURES if (!compression_enabled) { -#endif // ENABLE_COMPRESSED_TEXTURES glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, level)); glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR)); -#if ENABLE_COMPRESSED_TEXTURES } -#endif // ENABLE_COMPRESSED_TEXTURES } else { @@ -657,11 +585,9 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns m_source = filename; -#if ENABLE_COMPRESSED_TEXTURES if (compression_enabled) // start asynchronous compression m_compressor.start_compressing(); -#endif // ENABLE_COMPRESSED_TEXTURES nsvgDeleteRasterizer(rast); nsvgDelete(image); diff --git a/src/slic3r/GUI/GLTexture.hpp b/src/slic3r/GUI/GLTexture.hpp index 5df6189b6f..f4dc05a168 100644 --- a/src/slic3r/GUI/GLTexture.hpp +++ b/src/slic3r/GUI/GLTexture.hpp @@ -11,7 +11,6 @@ namespace GUI { class GLTexture { -#if ENABLE_COMPRESSED_TEXTURES class Compressor { struct Level @@ -47,7 +46,6 @@ namespace GUI { private: void compress(); }; -#endif // ENABLE_COMPRESSED_TEXTURES public: struct UV @@ -71,21 +69,14 @@ namespace GUI { int m_width; int m_height; std::string m_source; -#if ENABLE_COMPRESSED_TEXTURES Compressor m_compressor; -#endif // ENABLE_COMPRESSED_TEXTURES public: GLTexture(); virtual ~GLTexture(); -#if ENABLE_COMPRESSED_TEXTURES bool load_from_file(const std::string& filename, bool use_mipmaps, bool compress); bool load_from_svg_file(const std::string& filename, bool use_mipmaps, bool compress, bool apply_anisotropy, unsigned int max_size_px); -#else - bool load_from_file(const std::string& filename, bool use_mipmaps); - bool load_from_svg_file(const std::string& filename, bool use_mipmaps, unsigned int max_size_px); -#endif // ENABLE_COMPRESSED_TEXTURES // meanings of states: (std::pair) // first field (int): // 0 -> no changes @@ -94,11 +85,7 @@ namespace GUI { // second field (bool): // false -> no changes // true -> add background color -#if ENABLE_COMPRESSED_TEXTURES bool load_from_svg_files_as_sprites_array(const std::vector& filenames, const std::vector>& states, unsigned int sprite_size_px, bool compress); -#else - bool load_from_svg_files_as_sprites_array(const std::vector& filenames, const std::vector>& states, unsigned int sprite_size_px); -#endif // ENABLE_COMPRESSED_TEXTURES void reset(); unsigned int get_id() const { return m_id; } @@ -107,32 +94,21 @@ namespace GUI { const std::string& get_source() const { return m_source; } -#if ENABLE_COMPRESSED_TEXTURES bool unsent_compressed_data_available() const { return m_compressor.unsent_compressed_data_available(); } void send_compressed_data_to_gpu() { m_compressor.send_compressed_data_to_gpu(); } bool all_compressed_data_sent_to_gpu() const { return m_compressor.all_compressed_data_sent_to_gpu(); } -#endif // ENABLE_COMPRESSED_TEXTURES static void render_texture(unsigned int tex_id, float left, float right, float bottom, float top); static void render_sub_texture(unsigned int tex_id, float left, float right, float bottom, float top, const Quad_UVs& uvs); protected: -#if ENABLE_COMPRESSED_TEXTURES unsigned int generate_mipmaps(wxImage& image, bool compress); -#else - unsigned int generate_mipmaps(wxImage& image); -#endif // ENABLE_COMPRESSED_TEXTURES private: -#if ENABLE_COMPRESSED_TEXTURES bool load_from_png(const std::string& filename, bool use_mipmaps, bool compress); bool load_from_svg(const std::string& filename, bool use_mipmaps, bool compress, bool apply_anisotropy, unsigned int max_size_px); friend class Compressor; -#else - bool load_from_png(const std::string& filename, bool use_mipmaps); - bool load_from_svg(const std::string& filename, bool use_mipmaps, unsigned int max_size_px); -#endif // ENABLE_COMPRESSED_TEXTURES }; } // namespace GUI diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp index 813a319b80..5a5596ab4b 100644 --- a/src/slic3r/GUI/GLToolbar.cpp +++ b/src/slic3r/GUI/GLToolbar.cpp @@ -194,11 +194,7 @@ bool GLToolbar::init(const ItemsIconsTexture::Metadata& icons_texture, const Bac #endif // ENABLE_SVG_ICONS if (!background_texture.filename.empty()) -#if ENABLE_COMPRESSED_TEXTURES res = m_background_texture.texture.load_from_file(path + background_texture.filename, false, true); -#else - res = m_background_texture.texture.load_from_file(path + background_texture.filename, false); -#endif // ENABLE_COMPRESSED_TEXTURES if (res) m_background_texture.metadata = background_texture; @@ -1342,11 +1338,7 @@ bool GLToolbar::generate_icons_texture() const states.push_back(std::make_pair(1, true)); } -#if ENABLE_COMPRESSED_TEXTURES bool res = m_icons_texture.load_from_svg_files_as_sprites_array(filenames, states, (unsigned int)(m_layout.icons_size * m_layout.scale), true); -#else - bool res = m_icons_texture.load_from_svg_files_as_sprites_array(filenames, states, (unsigned int)(m_layout.icons_size * m_layout.scale)); -#endif // ENABLE_COMPRESSED_TEXTURES if (res) m_icons_texture_dirty = false; diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index c254f5796d..203a928dd6 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -65,11 +65,7 @@ bool GLGizmosManager::init(GLCanvas3D& parent) if (!m_background_texture.metadata.filename.empty()) { -#if ENABLE_COMPRESSED_TEXTURES if (!m_background_texture.texture.load_from_file(resources_dir() + "/icons/" + m_background_texture.metadata.filename, false, true)) -#else - if (!m_background_texture.texture.load_from_file(resources_dir() + "/icons/" + m_background_texture.metadata.filename, false)) -#endif // ENABLE_COMPRESSED_TEXTURES { reset(); return false; @@ -1164,11 +1160,7 @@ bool GLGizmosManager::generate_icons_texture() const states.push_back(std::make_pair(0, false)); states.push_back(std::make_pair(0, true)); -#if ENABLE_COMPRESSED_TEXTURES bool res = m_icons_texture.load_from_svg_files_as_sprites_array(filenames, states, (unsigned int)(m_overlay_icons_size * m_overlay_scale), true); -#else - bool res = m_icons_texture.load_from_svg_files_as_sprites_array(filenames, states, (unsigned int)(m_overlay_icons_size * m_overlay_scale)); -#endif // ENABLE_COMPRESSED_TEXTURES if (res) m_icons_texture_dirty = false; diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index 7267da2956..ca1538bf72 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -206,11 +206,7 @@ void ImGuiWrapper::new_frame() } if (m_font_texture == 0) { -#if ENABLE_COMPRESSED_TEXTURES init_font(true); -#else - init_font(); -#endif // ENABLE_COMPRESSED_TEXTURES } ImGui::NewFrame(); @@ -387,11 +383,7 @@ bool ImGuiWrapper::want_any_input() const return io.WantCaptureMouse || io.WantCaptureKeyboard || io.WantTextInput; } -#if ENABLE_COMPRESSED_TEXTURES void ImGuiWrapper::init_font(bool compress) -#else -void ImGuiWrapper::init_font() -#endif // ENABLE_COMPRESSED_TEXTURES { destroy_font(); @@ -420,14 +412,10 @@ void ImGuiWrapper::init_font() glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); glsafe(::glPixelStorei(GL_UNPACK_ROW_LENGTH, 0)); -#if ENABLE_COMPRESSED_TEXTURES if (compress && GLEW_EXT_texture_compression_s3tc) glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels)); else glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels)); -#else - glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels)); -#endif // ENABLE_COMPRESSED_TEXTURES // Store our identifier io.Fonts->TexID = (ImTextureID)(intptr_t)m_font_texture; diff --git a/src/slic3r/GUI/ImGuiWrapper.hpp b/src/slic3r/GUI/ImGuiWrapper.hpp index a1e4048ac6..0479e47434 100644 --- a/src/slic3r/GUI/ImGuiWrapper.hpp +++ b/src/slic3r/GUI/ImGuiWrapper.hpp @@ -77,11 +77,7 @@ public: bool want_any_input() const; private: -#if ENABLE_COMPRESSED_TEXTURES void init_font(bool compress); -#else - void init_font(); -#endif // ENABLE_COMPRESSED_TEXTURES void init_input(); void init_style(); void render_draw_data(ImDrawData *draw_data); From 38d5817bc9bcc29594587f866cf7cfacbf374940 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 24 Jun 2019 11:23:25 +0200 Subject: [PATCH 34/64] Disabled ENABLE_CAMERA_STATISTICS --- src/libslic3r/Technologies.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index fe4d28a7c3..a5f93b24f2 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -14,7 +14,7 @@ // Shows an imgui dialog with render related data #define ENABLE_RENDER_STATISTICS 0 // Shows an imgui dialog with camera related data -#define ENABLE_CAMERA_STATISTICS 1 +#define ENABLE_CAMERA_STATISTICS 0 //==================== From 6b0d75127b5c8d122052fa06be990ad8cfeadeb6 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 24 Jun 2019 12:26:11 +0200 Subject: [PATCH 35/64] #2428 1) Reworked logic for pasting volumes 2) Fixed paste of volumes into different objects 3) Do not apply offset when pasting into the copied object 4) Keep source transformation matrix and relative positions when copy/pasting volumes into another object --- src/libslic3r/Geometry.cpp | 57 ++++++++++++++++++++++++++++ src/libslic3r/Geometry.hpp | 5 +++ src/slic3r/GUI/GUI_ObjectList.cpp | 62 +------------------------------ src/slic3r/GUI/Selection.cpp | 46 ++++++++++++++++++++--- 4 files changed, 103 insertions(+), 67 deletions(-) diff --git a/src/libslic3r/Geometry.cpp b/src/libslic3r/Geometry.cpp index ccc629723e..accb4e2863 100644 --- a/src/libslic3r/Geometry.cpp +++ b/src/libslic3r/Geometry.cpp @@ -1409,6 +1409,63 @@ Transformation Transformation::operator * (const Transformation& other) const return Transformation(get_matrix() * other.get_matrix()); } +Transformation Transformation::volume_to_bed_transformation(const Transformation& instance_transformation, const BoundingBoxf3& bbox) +{ + Transformation out; + + if (instance_transformation.is_scaling_uniform()) { + // No need to run the non-linear least squares fitting for uniform scaling. + // Just set the inverse. + out.set_from_transform(instance_transformation.get_matrix(true).inverse()); + } + else if (is_rotation_ninety_degrees(instance_transformation.get_rotation())) + { + // Anisotropic scaling, rotation by multiples of ninety degrees. + Eigen::Matrix3d instance_rotation_trafo = + (Eigen::AngleAxisd(instance_transformation.get_rotation().z(), Vec3d::UnitZ()) * + Eigen::AngleAxisd(instance_transformation.get_rotation().y(), Vec3d::UnitY()) * + Eigen::AngleAxisd(instance_transformation.get_rotation().x(), Vec3d::UnitX())).toRotationMatrix(); + Eigen::Matrix3d volume_rotation_trafo = + (Eigen::AngleAxisd(-instance_transformation.get_rotation().x(), Vec3d::UnitX()) * + Eigen::AngleAxisd(-instance_transformation.get_rotation().y(), Vec3d::UnitY()) * + Eigen::AngleAxisd(-instance_transformation.get_rotation().z(), Vec3d::UnitZ())).toRotationMatrix(); + + // 8 corners of the bounding box. + auto pts = Eigen::MatrixXd(8, 3); + pts(0, 0) = bbox.min.x(); pts(0, 1) = bbox.min.y(); pts(0, 2) = bbox.min.z(); + pts(1, 0) = bbox.min.x(); pts(1, 1) = bbox.min.y(); pts(1, 2) = bbox.max.z(); + pts(2, 0) = bbox.min.x(); pts(2, 1) = bbox.max.y(); pts(2, 2) = bbox.min.z(); + pts(3, 0) = bbox.min.x(); pts(3, 1) = bbox.max.y(); pts(3, 2) = bbox.max.z(); + pts(4, 0) = bbox.max.x(); pts(4, 1) = bbox.min.y(); pts(4, 2) = bbox.min.z(); + pts(5, 0) = bbox.max.x(); pts(5, 1) = bbox.min.y(); pts(5, 2) = bbox.max.z(); + pts(6, 0) = bbox.max.x(); pts(6, 1) = bbox.max.y(); pts(6, 2) = bbox.min.z(); + pts(7, 0) = bbox.max.x(); pts(7, 1) = bbox.max.y(); pts(7, 2) = bbox.max.z(); + + // Corners of the bounding box transformed into the modifier mesh coordinate space, with inverse rotation applied to the modifier. + auto qs = pts * + (instance_rotation_trafo * + Eigen::Scaling(instance_transformation.get_scaling_factor().cwiseProduct(instance_transformation.get_mirror())) * + volume_rotation_trafo).inverse().transpose(); + // Fill in scaling based on least squares fitting of the bounding box corners. + Vec3d scale; + for (int i = 0; i < 3; ++i) + scale(i) = pts.col(i).dot(qs.col(i)) / pts.col(i).dot(pts.col(i)); + + out.set_rotation(Geometry::extract_euler_angles(volume_rotation_trafo)); + out.set_scaling_factor(Vec3d(std::abs(scale(0)), std::abs(scale(1)), std::abs(scale(2)))); + out.set_mirror(Vec3d(scale(0) > 0 ? 1. : -1, scale(1) > 0 ? 1. : -1, scale(2) > 0 ? 1. : -1)); + } + else + { + // General anisotropic scaling, general rotation. + // Keep the modifier mesh in the instance coordinate system, so the modifier mesh will not be aligned with the world. + // Scale it to get the required size. + out.set_scaling_factor(instance_transformation.get_scaling_factor().cwiseInverse()); + } + + return out; +} + Eigen::Quaterniond rotation_xyz_diff(const Vec3d &rot_xyz_from, const Vec3d &rot_xyz_to) { return diff --git a/src/libslic3r/Geometry.hpp b/src/libslic3r/Geometry.hpp index 033c24a846..bcbe80a0d8 100644 --- a/src/libslic3r/Geometry.hpp +++ b/src/libslic3r/Geometry.hpp @@ -258,6 +258,11 @@ public: const Transform3d& get_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false, bool dont_mirror = false) const; Transformation operator * (const Transformation& other) const; + + // Find volume transformation, so that the chained (instance_trafo * volume_trafo) will be as close to identity + // as possible in least squares norm in regard to the 8 corners of bbox. + // Bounding box is expected to be centered around zero in all axes. + static Transformation volume_to_bed_transformation(const Transformation& instance_transformation, const BoundingBoxf3& bbox); }; // Rotation when going from the first coordinate system with rotation rot_xyz_from applied diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index a95b71bcb3..d7d1a1af7b 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -1485,66 +1485,6 @@ void ObjectList::load_part( ModelObject* model_object, } -// Find volume transformation, so that the chained (instance_trafo * volume_trafo) will be as close to identity -// as possible in least squares norm in regard to the 8 corners of bbox. -// Bounding box is expected to be centered around zero in all axes. -Geometry::Transformation volume_to_bed_transformation(const Geometry::Transformation &instance_transformation, const BoundingBoxf3 &bbox) -{ - Geometry::Transformation out; - - if (instance_transformation.is_scaling_uniform()) { - // No need to run the non-linear least squares fitting for uniform scaling. - // Just set the inverse. - out.set_from_transform(instance_transformation.get_matrix(true).inverse()); - } - else if (Geometry::is_rotation_ninety_degrees(instance_transformation.get_rotation())) - { - // Anisotropic scaling, rotation by multiples of ninety degrees. - Eigen::Matrix3d instance_rotation_trafo = - (Eigen::AngleAxisd(instance_transformation.get_rotation().z(), Vec3d::UnitZ()) * - Eigen::AngleAxisd(instance_transformation.get_rotation().y(), Vec3d::UnitY()) * - Eigen::AngleAxisd(instance_transformation.get_rotation().x(), Vec3d::UnitX())).toRotationMatrix(); - Eigen::Matrix3d volume_rotation_trafo = - (Eigen::AngleAxisd(-instance_transformation.get_rotation().x(), Vec3d::UnitX()) * - Eigen::AngleAxisd(-instance_transformation.get_rotation().y(), Vec3d::UnitY()) * - Eigen::AngleAxisd(-instance_transformation.get_rotation().z(), Vec3d::UnitZ())).toRotationMatrix(); - - // 8 corners of the bounding box. - auto pts = Eigen::MatrixXd(8, 3); - pts(0, 0) = bbox.min.x(); pts(0, 1) = bbox.min.y(); pts(0, 2) = bbox.min.z(); - pts(1, 0) = bbox.min.x(); pts(1, 1) = bbox.min.y(); pts(1, 2) = bbox.max.z(); - pts(2, 0) = bbox.min.x(); pts(2, 1) = bbox.max.y(); pts(2, 2) = bbox.min.z(); - pts(3, 0) = bbox.min.x(); pts(3, 1) = bbox.max.y(); pts(3, 2) = bbox.max.z(); - pts(4, 0) = bbox.max.x(); pts(4, 1) = bbox.min.y(); pts(4, 2) = bbox.min.z(); - pts(5, 0) = bbox.max.x(); pts(5, 1) = bbox.min.y(); pts(5, 2) = bbox.max.z(); - pts(6, 0) = bbox.max.x(); pts(6, 1) = bbox.max.y(); pts(6, 2) = bbox.min.z(); - pts(7, 0) = bbox.max.x(); pts(7, 1) = bbox.max.y(); pts(7, 2) = bbox.max.z(); - - // Corners of the bounding box transformed into the modifier mesh coordinate space, with inverse rotation applied to the modifier. - auto qs = pts * - (instance_rotation_trafo * - Eigen::Scaling(instance_transformation.get_scaling_factor().cwiseProduct(instance_transformation.get_mirror())) * - volume_rotation_trafo).inverse().transpose(); - // Fill in scaling based on least squares fitting of the bounding box corners. - Vec3d scale; - for (int i = 0; i < 3; ++ i) - scale(i) = pts.col(i).dot(qs.col(i)) / pts.col(i).dot(pts.col(i)); - - out.set_rotation(Geometry::extract_euler_angles(volume_rotation_trafo)); - out.set_scaling_factor(Vec3d(std::abs(scale(0)), std::abs(scale(1)), std::abs(scale(2)))); - out.set_mirror(Vec3d(scale(0) > 0 ? 1. : -1, scale(1) > 0 ? 1. : -1, scale(2) > 0 ? 1. : -1)); - } - else - { - // General anisotropic scaling, general rotation. - // Keep the modifier mesh in the instance coordinate system, so the modifier mesh will not be aligned with the world. - // Scale it to get the required size. - out.set_scaling_factor(instance_transformation.get_scaling_factor().cwiseInverse()); - } - - return out; -} - void ObjectList::load_generic_subobject(const std::string& type_name, const ModelVolumeType type) { const auto obj_idx = get_selected_obj_idx(); @@ -1598,7 +1538,7 @@ void ObjectList::load_generic_subobject(const std::string& type_name, const Mode const GLVolume* v = selection.get_volume(*selection.get_volume_idxs().begin()); // Transform the new modifier to be aligned with the print bed. const BoundingBoxf3 mesh_bb = new_volume->mesh().bounding_box(); - new_volume->set_transformation(volume_to_bed_transformation(v->get_instance_transformation(), mesh_bb)); + new_volume->set_transformation(Geometry::Transformation::volume_to_bed_transformation(v->get_instance_transformation(), mesh_bb)); // Set the modifier position. auto offset = (type_name == "Slab") ? // Slab: Lift to print bed diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 480b59ba03..6e80783ccd 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -1893,25 +1893,59 @@ bool Selection::is_from_fully_selected_instance(unsigned int volume_idx) const void Selection::paste_volumes_from_clipboard() { - int obj_idx = get_object_idx(); - if ((obj_idx < 0) || ((int)m_model->objects.size() <= obj_idx)) + int dst_obj_idx = get_object_idx(); + if ((dst_obj_idx < 0) || ((int)m_model->objects.size() <= dst_obj_idx)) + return; + + ModelObject* dst_object = m_model->objects[dst_obj_idx]; + + int dst_inst_idx = get_instance_idx(); + if ((dst_inst_idx < 0) || ((int)dst_object->instances.size() <= dst_inst_idx)) return; ModelObject* src_object = m_clipboard.get_object(0); if (src_object != nullptr) { - ModelObject* dst_object = m_model->objects[obj_idx]; + ModelInstance* dst_instance = dst_object->instances[dst_inst_idx]; + BoundingBoxf3 dst_instance_bb = dst_object->instance_bounding_box(dst_inst_idx); + Transform3d src_matrix = src_object->instances[0]->get_transformation().get_matrix(true); + Transform3d dst_matrix = dst_instance->get_transformation().get_matrix(true); + bool from_same_object = (src_object->input_file == dst_object->input_file) && src_matrix.isApprox(dst_matrix); + + // used to keep relative position of multivolume selections when pasting from another object + BoundingBoxf3 total_bb; ModelVolumePtrs volumes; for (ModelVolume* src_volume : src_object->volumes) { ModelVolume* dst_volume = dst_object->add_volume(*src_volume); dst_volume->set_new_unique_id(); - double offset = wxGetApp().plater()->canvas3D()->get_size_proportional_to_max_bed_size(0.05); - dst_volume->translate(offset, offset, 0.0); + if (from_same_object) + { +// // if the volume comes from the same object, apply the offset in world system +// double offset = wxGetApp().plater()->canvas3D()->get_size_proportional_to_max_bed_size(0.05); +// dst_volume->translate(dst_matrix.inverse() * Vec3d(offset, offset, 0.0)); + } + else + { + // if the volume comes from another object, apply the offset as done when adding modifiers + // see ObjectList::load_generic_subobject() + total_bb.merge(dst_volume->mesh().bounding_box().transformed(src_volume->get_matrix())); + } + volumes.push_back(dst_volume); } - wxGetApp().obj_list()->paste_volumes_into_list(obj_idx, volumes); + + // keeps relative position of multivolume selections + if (!from_same_object) + { + for (ModelVolume* v : volumes) + { + v->set_offset((v->get_offset() - total_bb.center()) + dst_matrix.inverse() * (Vec3d(dst_instance_bb.max(0), dst_instance_bb.min(1), dst_instance_bb.min(2)) + 0.5 * total_bb.size() - dst_instance->get_transformation().get_offset())); + } + } + + wxGetApp().obj_list()->paste_volumes_into_list(dst_obj_idx, volumes); } } From 1459ad65c66e85770bddf07db462003df32899b0 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 24 Jun 2019 12:35:20 +0200 Subject: [PATCH 36/64] #2433 - Time Estimator: clamp accelerate/decelerate distances to avoid them to become negative --- src/libslic3r/GCodeTimeEstimator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/GCodeTimeEstimator.cpp b/src/libslic3r/GCodeTimeEstimator.cpp index 60d7a4cdf4..b87305da87 100644 --- a/src/libslic3r/GCodeTimeEstimator.cpp +++ b/src/libslic3r/GCodeTimeEstimator.cpp @@ -125,8 +125,8 @@ namespace Slic3r { trapezoid.distance = distance; trapezoid.feedrate = feedrate; - float accelerate_distance = estimate_acceleration_distance(feedrate.entry, feedrate.cruise, acceleration); - float decelerate_distance = estimate_acceleration_distance(feedrate.cruise, feedrate.exit, -acceleration); + float accelerate_distance = std::max(0.0f, estimate_acceleration_distance(feedrate.entry, feedrate.cruise, acceleration)); + float decelerate_distance = std::max(0.0f, estimate_acceleration_distance(feedrate.cruise, feedrate.exit, -acceleration)); float cruise_distance = distance - accelerate_distance - decelerate_distance; // Not enough space to reach the nominal feedrate. From fab363493140a93c1786c7898424a73dd1ed2a2e Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 24 Jun 2019 12:43:18 +0200 Subject: [PATCH 37/64] #2395 - Reworked logic of method Model::convert_multipart_object() --- src/libslic3r/Model.cpp | 52 ++++++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index 8e879a3e68..596f806710 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -489,21 +489,57 @@ void Model::convert_multipart_object(unsigned int max_extruders) reset_auto_extruder_id(); + bool is_single_object = (this->objects.size() == 1); + for (const ModelObject* o : this->objects) + { for (const ModelVolume* v : o->volumes) { - ModelVolume* new_v = object->add_volume(*v); - if (new_v != nullptr) + if (is_single_object) { - new_v->name = o->name; - new_v->config.set_deserialize("extruder", get_auto_extruder_id_as_string(max_extruders)); - new_v->translate(-o->origin_translation); + // If there is only one object, just copy the volumes + ModelVolume* new_v = object->add_volume(*v); + if (new_v != nullptr) + { + new_v->name = o->name; + new_v->config.set_deserialize("extruder", get_auto_extruder_id_as_string(max_extruders)); + new_v->translate(-o->origin_translation); + } + } + else + { + // If there are more than one object, put all volumes together + // Each object may contain any number of volumes and instances + // The volumes transformations are relative to the object containing them... + int counter = 1; + for (const ModelInstance* i : o->instances) + { + ModelVolume* new_v = object->add_volume(*v); + if (new_v != nullptr) + { + new_v->name = o->name + "_" + std::to_string(counter++); + new_v->config.set_deserialize("extruder", get_auto_extruder_id_as_string(max_extruders)); + new_v->translate(-o->origin_translation); + // ...so, transform everything to a common reference system (world) + new_v->set_transformation(i->get_transformation() * v->get_transformation()); + } + } } } + } + + if (is_single_object) + { + // If there is only one object, keep its instances + for (const ModelInstance* i : this->objects.front()->instances) + { + object->add_instance(*i); + } + } + else + // If there are more than one object, create a single instance + object->add_instance(); - for (const ModelInstance* i : this->objects.front()->instances) - object->add_instance(*i); - this->clear_objects(); this->objects.push_back(object); } From 121b6c078b4e5217ca5818b23102a7725e7cf20f Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Mon, 24 Jun 2019 13:01:52 +0200 Subject: [PATCH 38/64] Print bed not considered as object in arrange anymore. --- src/libslic3r/MTUtils.hpp | 9 +++++++++ src/libslic3r/ModelArrange.cpp | 31 ++++++++++++++----------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/libslic3r/MTUtils.hpp b/src/libslic3r/MTUtils.hpp index 0afe3563f9..f6bff2b1f8 100644 --- a/src/libslic3r/MTUtils.hpp +++ b/src/libslic3r/MTUtils.hpp @@ -191,6 +191,15 @@ template bool all_of(const C &container) { }); } +template inline X ceil_i(X x, Y y) +{ + static_assert(std::is_integral::value && + std::is_integral::value && sizeof(X) >= sizeof(Y), + ""); + + return (x % y) ? x / y + 1 : x / y; +} + } #endif // MTUTILS_HPP diff --git a/src/libslic3r/ModelArrange.cpp b/src/libslic3r/ModelArrange.cpp index a440c3999d..36f7e39710 100644 --- a/src/libslic3r/ModelArrange.cpp +++ b/src/libslic3r/ModelArrange.cpp @@ -2,6 +2,7 @@ #include "Model.hpp" #include "Geometry.hpp" #include "SVG.hpp" +#include "MTUtils.hpp" #include @@ -820,15 +821,13 @@ bool arrange(Model &model, // The model with the geometries BoundingBox bbb(bed); auto& cfn = stopcondition; + + coord_t md = ceil_i(min_obj_distance, 2) - SCALED_EPSILON; - auto binbb = Box({ - static_cast(bbb.min(0)), - static_cast(bbb.min(1)) - }, - { - static_cast(bbb.max(0)), - static_cast(bbb.max(1)) - }); + auto binbb = Box({libnest2d::Coord{bbb.min(0)} - md, + libnest2d::Coord{bbb.min(1)} - md}, + {libnest2d::Coord{bbb.max(0)} + md, + libnest2d::Coord{bbb.max(1)} + md}); switch(bedhint.type) { case BedShapeType::BOX: { @@ -916,15 +915,13 @@ void find_new_position(const Model &model, BedShapeHint bedhint = bedShape(bed); BoundingBox bbb(bed); - - auto binbb = Box({ - static_cast(bbb.min(0)), - static_cast(bbb.min(1)) - }, - { - static_cast(bbb.max(0)), - static_cast(bbb.max(1)) - }); + + coord_t md = ceil_i(min_obj_distance, 2) - SCALED_EPSILON; + + auto binbb = Box({libnest2d::Coord{bbb.min(0)} - md, + libnest2d::Coord{bbb.min(1)} - md}, + {libnest2d::Coord{bbb.max(0)} + md, + libnest2d::Coord{bbb.max(1)} + md}); for(auto it = shapemap.begin(); it != shapemap.end(); ++it) { if(std::find(toadd.begin(), toadd.end(), it->first) == toadd.end()) { From 75ed542686c66b21f5b2812ec48061055f2ca738 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Mon, 24 Jun 2019 13:03:46 +0200 Subject: [PATCH 39/64] Reformatted MTUtils with some refined directives. Only whitespace changes in MTUtils.hpp ! --- .clang-format | 8 +- src/libslic3r/MTUtils.hpp | 200 +++++++++++++++++++++++--------------- 2 files changed, 128 insertions(+), 80 deletions(-) diff --git a/.clang-format b/.clang-format index d5740f6894..9cbcf26f26 100644 --- a/.clang-format +++ b/.clang-format @@ -18,7 +18,7 @@ AllowShortLoopsOnASingleLine: true AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: Yes +AlwaysBreakTemplateDeclarations: false BinPackArguments: false BinPackParameters: false BraceWrapping: @@ -37,18 +37,18 @@ BraceWrapping: SplitEmptyFunction: false SplitEmptyRecord: false SplitEmptyNamespace: false -BreakBeforeBinaryOperators: All +BreakBeforeBinaryOperators: None BreakBeforeBraces: Custom BreakBeforeInheritanceComma: false BreakInheritanceList: BeforeColon -BreakBeforeTernaryOperators: true +BreakBeforeTernaryOperators: false BreakConstructorInitializersBeforeComma: false BreakConstructorInitializers: BeforeComma BreakAfterJavaFieldAnnotations: false BreakStringLiterals: true ColumnLimit: 75 CommentPragmas: '^ IWYU pragma:' -CompactNamespaces: false +CompactNamespaces: true ConstructorInitializerAllOnOneLineOrOnePerLine: true ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 diff --git a/src/libslic3r/MTUtils.hpp b/src/libslic3r/MTUtils.hpp index f6bff2b1f8..b261a79be8 100644 --- a/src/libslic3r/MTUtils.hpp +++ b/src/libslic3r/MTUtils.hpp @@ -1,172 +1,218 @@ #ifndef MTUTILS_HPP #define MTUTILS_HPP -#include // for std::atomic_flag and memory orders -#include // for std::lock_guard -#include // for std::function -#include // for std::forward +#include // for std::atomic_flag and memory orders +#include // for std::lock_guard +#include // for std::function +#include // for std::forward #include namespace Slic3r { /// Handy little spin mutex for the cached meshes. /// Implements the "Lockable" concept -class SpinMutex { - std::atomic_flag m_flg; +class SpinMutex +{ + std::atomic_flag m_flg; static const /*constexpr*/ auto MO_ACQ = std::memory_order_acquire; static const /*constexpr*/ auto MO_REL = std::memory_order_release; + public: inline SpinMutex() { m_flg.clear(MO_REL); } - inline void lock() { while(m_flg.test_and_set(MO_ACQ)); } + inline void lock() { while (m_flg.test_and_set(MO_ACQ)) ; } inline bool try_lock() { return !m_flg.test_and_set(MO_ACQ); } inline void unlock() { m_flg.clear(MO_REL); } }; /// A wrapper class around arbitrary object that needs thread safe caching. -template class CachedObject { +template class CachedObject +{ public: // Method type which refreshes the object when it has been invalidated - using Setter = std::function; + using Setter = std::function; + private: - T m_obj; // the object itself - bool m_valid; // invalidation flag - SpinMutex m_lck; // to make the caching thread safe + T m_obj; // the object itself + bool m_valid; // invalidation flag + SpinMutex m_lck; // to make the caching thread safe + + // the setter will be called just before the object's const value is + // about to be retrieved. + std::function m_setter; - // the setter will be called just before the object's const value is about - // to be retrieved. - std::function m_setter; public: - // Forwarded constructor - template inline CachedObject(Setter fn, Args&&...args): - m_obj(std::forward(args)...), m_valid(false), m_setter(fn) {} + template + inline CachedObject(Setter fn, Args &&... args) + : m_obj(std::forward(args)...), m_valid(false), m_setter(fn) + {} - // invalidate the value of the object. The object will be refreshed at the - // next retrieval (Setter will be called). The data that is used in - // the setter function should be guarded as well during modification so the - // modification has to take place in fn. - inline void invalidate(std::function fn) { - std::lock_guard lck(m_lck); fn(); m_valid = false; + // invalidate the value of the object. The object will be refreshed at + // the next retrieval (Setter will be called). The data that is used in + // the setter function should be guarded as well during modification so + // the modification has to take place in fn. + inline void invalidate(std::function fn) + { + std::lock_guard lck(m_lck); + fn(); + m_valid = false; } // Get the const object properly updated. - inline const T& get() { + inline const T &get() + { std::lock_guard lck(m_lck); - if(!m_valid) { m_setter(m_obj); m_valid = true; } + if (!m_valid) { + m_setter(m_obj); + m_valid = true; + } return m_obj; } }; -/// An std compatible random access iterator which uses indices to the source -/// vector thus resistant to invalidation caused by relocations. It also "knows" -/// its container. No comparison is neccesary to the container "end()" iterator. -/// The template can be instantiated with a different value type than that of -/// the container's but the types must be compatible. E.g. a base class of the -/// contained objects is compatible. +/// An std compatible random access iterator which uses indices to the +/// source vector thus resistant to invalidation caused by relocations. It +/// also "knows" its container. No comparison is neccesary to the container +/// "end()" iterator. The template can be instantiated with a different +/// value type than that of the container's but the types must be +/// compatible. E.g. a base class of the contained objects is compatible. /// /// For a constant iterator, one can instantiate this template with a value /// type preceded with 'const'. -template -class IndexBasedIterator { +class IndexBasedIterator +{ static const size_t NONE = size_t(-1); std::reference_wrapper m_index_ref; - size_t m_idx = NONE; -public: + size_t m_idx = NONE; - using value_type = Value; - using pointer = Value *; - using reference = Value &; - using difference_type = long; +public: + using value_type = Value; + using pointer = Value *; + using reference = Value &; + using difference_type = long; using iterator_category = std::random_access_iterator_tag; - inline explicit - IndexBasedIterator(Vector& index, size_t idx): - m_index_ref(index), m_idx(idx) {} + inline explicit IndexBasedIterator(Vector &index, size_t idx) + : m_index_ref(index), m_idx(idx) + {} // Post increment - inline IndexBasedIterator operator++(int) { - IndexBasedIterator cpy(*this); ++m_idx; return cpy; + inline IndexBasedIterator operator++(int) + { + IndexBasedIterator cpy(*this); + ++m_idx; + return cpy; } - inline IndexBasedIterator operator--(int) { - IndexBasedIterator cpy(*this); --m_idx; return cpy; + inline IndexBasedIterator operator--(int) + { + IndexBasedIterator cpy(*this); + --m_idx; + return cpy; } - inline IndexBasedIterator& operator++() { - ++m_idx; return *this; + inline IndexBasedIterator &operator++() + { + ++m_idx; + return *this; } - inline IndexBasedIterator& operator--() { - --m_idx; return *this; + inline IndexBasedIterator &operator--() + { + --m_idx; + return *this; } - inline IndexBasedIterator& operator+=(difference_type l) { - m_idx += size_t(l); return *this; + inline IndexBasedIterator &operator+=(difference_type l) + { + m_idx += size_t(l); + return *this; } - inline IndexBasedIterator operator+(difference_type l) { - auto cpy = *this; cpy += l; return cpy; + inline IndexBasedIterator operator+(difference_type l) + { + auto cpy = *this; + cpy += l; + return cpy; } - inline IndexBasedIterator& operator-=(difference_type l) { - m_idx -= size_t(l); return *this; + inline IndexBasedIterator &operator-=(difference_type l) + { + m_idx -= size_t(l); + return *this; } - inline IndexBasedIterator operator-(difference_type l) { - auto cpy = *this; cpy -= l; return cpy; + inline IndexBasedIterator operator-(difference_type l) + { + auto cpy = *this; + cpy -= l; + return cpy; } operator difference_type() { return difference_type(m_idx); } /// Tesing the end of the container... this is not possible with std /// iterators. - inline bool is_end() const { return m_idx >= m_index_ref.get().size();} + inline bool is_end() const + { + return m_idx >= m_index_ref.get().size(); + } - inline Value & operator*() const { + inline Value &operator*() const + { assert(m_idx < m_index_ref.get().size()); return m_index_ref.get().operator[](m_idx); } - inline Value * operator->() const { + inline Value *operator->() const + { assert(m_idx < m_index_ref.get().size()); return &m_index_ref.get().operator[](m_idx); } /// If both iterators point past the container, they are equal... - inline bool operator ==(const IndexBasedIterator& other) { + inline bool operator==(const IndexBasedIterator &other) + { size_t e = m_index_ref.get().size(); return m_idx == other.m_idx || (m_idx >= e && other.m_idx >= e); } - inline bool operator !=(const IndexBasedIterator& other) { + inline bool operator!=(const IndexBasedIterator &other) + { return !(*this == other); } - inline bool operator <=(const IndexBasedIterator& other) { + inline bool operator<=(const IndexBasedIterator &other) + { return (m_idx < other.m_idx) || (*this == other); } - inline bool operator <(const IndexBasedIterator& other) { + inline bool operator<(const IndexBasedIterator &other) + { return m_idx < other.m_idx && (*this != other); } - inline bool operator >=(const IndexBasedIterator& other) { + inline bool operator>=(const IndexBasedIterator &other) + { return m_idx > other.m_idx || *this == other; } - inline bool operator >(const IndexBasedIterator& other) { + inline bool operator>(const IndexBasedIterator &other) + { return m_idx > other.m_idx && *this != other; } }; /// A very simple range concept implementation with iterator-like objects. -template class Range { +template class Range +{ It from, to; -public: +public: // The class is ready for range based for loops. It begin() const { return from; } It end() const { return to; } @@ -175,15 +221,17 @@ public: using Type = It; Range() = default; - Range(It &&b, It &&e): - from(std::forward(b)), to(std::forward(e)) {} + Range(It &&b, It &&e) + : from(std::forward(b)), to(std::forward(e)) + {} // Some useful container-like methods... inline size_t size() const { return end() - begin(); } - inline bool empty() const { return size() == 0; } + inline bool empty() const { return size() == 0; } }; -template bool all_of(const C &container) { +template bool all_of(const C &container) +{ return std::all_of(container.begin(), container.end(), [](const typename C::value_type &v) { @@ -196,10 +244,10 @@ template inline X ceil_i(X x, Y y) static_assert(std::is_integral::value && std::is_integral::value && sizeof(X) >= sizeof(Y), ""); - + return (x % y) ? x / y + 1 : x / y; } -} +} // namespace Slic3r #endif // MTUTILS_HPP From 14d8621ffe6e7791528fede8d9e101d3b06b56ce Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 24 Jun 2019 13:11:18 +0200 Subject: [PATCH 40/64] Color_print issues : - fixed #1933 - implemented thumb moving to the mouse click position - implemented "discard color changes" button --- src/slic3r/GUI/wxExtensions.cpp | 78 +++++++++++++++++++++++++++++---- src/slic3r/GUI/wxExtensions.hpp | 4 ++ 2 files changed, 73 insertions(+), 9 deletions(-) diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 406daccf55..ed496a97ec 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -1583,6 +1583,9 @@ DoubleSlider::DoubleSlider( wxWindow *parent, m_bmp_one_layer_unlock_off = ScalableBitmap(this, "one_layer_unlock_off.png"); m_lock_icon_dim = m_bmp_one_layer_lock_on.bmp().GetSize().x; + m_bmp_revert = ScalableBitmap(this, "undo"); + m_revert_icon_dim = m_bmp_revert.bmp().GetSize().x; + m_selection = ssUndef; // slider events @@ -1638,6 +1641,9 @@ void DoubleSlider::msw_rescale() m_bmp_one_layer_unlock_off.msw_rescale(); m_lock_icon_dim = m_bmp_one_layer_lock_on.bmp().GetSize().x; + m_bmp_revert.msw_rescale(); + m_revert_icon_dim = m_bmp_revert.bmp().GetSize().x; + SLIDER_MARGIN = 4 + Slic3r::GUI::wxGetApp().em_unit(); SetMinSize(get_min_size()); @@ -1874,8 +1880,11 @@ void DoubleSlider::render() //draw color print ticks draw_ticks(dc); - //draw color print ticks + //draw lock/unlock draw_one_layer_icon(dc); + + //draw revert bitmap (if it's shown) + draw_revert_icon(dc); } void DoubleSlider::draw_action_icon(wxDC& dc, const wxPoint pt_beg, const wxPoint pt_end) @@ -2102,6 +2111,24 @@ void DoubleSlider::draw_one_layer_icon(wxDC& dc) m_rect_one_layer_icon = wxRect(x_draw, y_draw, m_lock_icon_dim, m_lock_icon_dim); } +void DoubleSlider::draw_revert_icon(wxDC& dc) +{ + if (m_ticks.empty()) + return; + + int width, height; + get_size(&width, &height); + + wxCoord x_draw, y_draw; + is_horizontal() ? x_draw = width-2 : x_draw = 0.25*SLIDER_MARGIN; + is_horizontal() ? y_draw = 0.25*SLIDER_MARGIN: y_draw = height-2; + + dc.DrawBitmap(m_bmp_revert.bmp(), x_draw, y_draw); + + //update rect of the lock/unlock icon + m_rect_revert_icon = wxRect(x_draw, y_draw, m_revert_icon_dim, m_revert_icon_dim); +} + void DoubleSlider::update_thumb_rect(const wxCoord& begin_x, const wxCoord& begin_y, const SelectedSlider& selection) { const wxRect& rect = wxRect(begin_x, begin_y, m_thumb_size.x, m_thumb_size.y); @@ -2118,8 +2145,8 @@ int DoubleSlider::get_value_from_position(const wxCoord x, const wxCoord y) if (is_horizontal()) return int(double(x - SLIDER_MARGIN) / step + 0.5); - else - return int(m_min_value + double(height - SLIDER_MARGIN - y) / step + 0.5); + + return int(m_min_value + double(height - SLIDER_MARGIN - y) / step + 0.5); } void DoubleSlider::detect_selected_slider(const wxPoint& pt) @@ -2169,7 +2196,10 @@ void DoubleSlider::ChangeOneLayerLock() void DoubleSlider::OnLeftDown(wxMouseEvent& event) { + if (HasCapture()) + return; this->CaptureMouse(); + wxClientDC dc(this); wxPoint pos = event.GetLogicalPosition(dc); if (is_point_in_rect(pos, m_rect_tick_action) && m_is_enabled_tick_manipulation) { @@ -2179,6 +2209,7 @@ void DoubleSlider::OnLeftDown(wxMouseEvent& event) m_is_left_down = true; if (is_point_in_rect(pos, m_rect_one_layer_icon)) { + // switch on/off one layer mode m_is_one_layer = !m_is_one_layer; if (!m_is_one_layer) { SetLowerValue(m_min_value); @@ -2187,20 +2218,36 @@ void DoubleSlider::OnLeftDown(wxMouseEvent& event) m_selection == ssLower ? correct_lower_value() : correct_higher_value(); if (!m_selection) m_selection = ssHigher; } + else if (is_point_in_rect(pos, m_rect_revert_icon)) { + // discard all color changes + SetLowerValue(m_min_value); + SetHigherValue(m_max_value); + + m_selection == ssLower ? correct_lower_value() : correct_higher_value(); + if (!m_selection) m_selection = ssHigher; + + m_ticks.clear(); + wxPostEvent(this->GetParent(), wxCommandEvent(wxCUSTOMEVT_TICKSCHANGED)); + } else detect_selected_slider(pos); - if (!m_selection && m_is_enabled_tick_manipulation) { - const auto tick = is_point_near_tick(pos); - if (tick >= 0) + if (!m_selection) { + const int tick_val = is_point_near_tick(pos); + /* Set current thumb position to the nearest tick (if it is) + * OR to a value corresponding to the mouse click + * */ + const int mouse_val = tick_val >= 0 && m_is_enabled_tick_manipulation ? tick_val : + get_value_from_position(pos.x, pos.y); + if (mouse_val >= 0) { - if (abs(tick - m_lower_value) < abs(tick - m_higher_value)) { - SetLowerValue(tick); + if (abs(mouse_val - m_lower_value) < abs(mouse_val - m_higher_value)) { + SetLowerValue(mouse_val); correct_lower_value(); m_selection = ssLower; } else { - SetHigherValue(tick); + SetHigherValue(mouse_val); correct_higher_value(); m_selection = ssHigher; } @@ -2240,9 +2287,13 @@ void DoubleSlider::OnMotion(wxMouseEvent& event) const wxClientDC dc(this); const wxPoint pos = event.GetLogicalPosition(dc); + m_is_one_layer_icon_focesed = is_point_in_rect(pos, m_rect_one_layer_icon); + bool is_revert_icon_focused = false; + if (!m_is_left_down && !m_is_one_layer) { m_is_action_icon_focesed = is_point_in_rect(pos, m_rect_tick_action); + is_revert_icon_focused = !m_ticks.empty() && is_point_in_rect(pos, m_rect_revert_icon); } else if (m_is_left_down || m_is_right_down) { if (m_selection == ssLower) { @@ -2262,6 +2313,13 @@ void DoubleSlider::OnMotion(wxMouseEvent& event) Update(); event.Skip(); + // Set tooltips with information for each icon + const wxString tooltip = m_is_one_layer_icon_focesed ? _(L("One layer mode")) : + m_is_action_icon_focesed ? _(L("Add/Del color change")) : + is_revert_icon_focused ? _(L("Discard all color changes")) : + wxEmptyString; + this->SetToolTip(tooltip); + if (action) { wxCommandEvent e(wxEVT_SCROLL_CHANGED); @@ -2412,7 +2470,9 @@ void DoubleSlider::OnChar(wxKeyEvent& event) void DoubleSlider::OnRightDown(wxMouseEvent& event) { + if (HasCapture()) return; this->CaptureMouse(); + const wxClientDC dc(this); detect_selected_slider(event.GetLogicalPosition(dc)); if (!m_selection) diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index dd035690ad..081c0d48f9 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -742,6 +742,7 @@ protected: void draw_ticks(wxDC& dc); void draw_colored_band(wxDC& dc); void draw_one_layer_icon(wxDC& dc); + void draw_revert_icon(wxDC& dc); void draw_thumb_item(wxDC& dc, const wxPoint& pos, const SelectedSlider& selection); void draw_info_line_with_icon(wxDC& dc, const wxPoint& pos, SelectedSlider selection); void draw_thumb_text(wxDC& dc, const wxPoint& pos, const SelectedSlider& selection) const; @@ -783,6 +784,7 @@ private: ScalableBitmap m_bmp_one_layer_lock_off; ScalableBitmap m_bmp_one_layer_unlock_on; ScalableBitmap m_bmp_one_layer_unlock_off; + ScalableBitmap m_bmp_revert; SelectedSlider m_selection; bool m_is_left_down = false; bool m_is_right_down = false; @@ -796,9 +798,11 @@ private: wxRect m_rect_higher_thumb; wxRect m_rect_tick_action; wxRect m_rect_one_layer_icon; + wxRect m_rect_revert_icon; wxSize m_thumb_size; int m_tick_icon_dim; int m_lock_icon_dim; + int m_revert_icon_dim; long m_style; float m_label_koef = 1.0; From 7aaba25520ea37d662ced74b465b66c394f34593 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 24 Jun 2019 13:21:05 +0200 Subject: [PATCH 41/64] Do not allow to copy/paste volumes when using sla printer --- src/slic3r/GUI/GLCanvas3D.cpp | 4 +-- src/slic3r/GUI/MainFrame.cpp | 4 +-- src/slic3r/GUI/Plater.cpp | 58 ++++++++++++++++++++++------------- src/slic3r/GUI/Plater.hpp | 5 ++- src/slic3r/GUI/Selection.cpp | 34 ++++++++++++++++++++ src/slic3r/GUI/Selection.hpp | 3 ++ 6 files changed, 79 insertions(+), 29 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index e0aa670740..ffaa2d20c5 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3488,7 +3488,7 @@ bool GLCanvas3D::_init_toolbar() item.tooltip = _utf8(L("Copy")) + " [" + GUI::shortkey_ctrl_prefix() + "C]"; item.sprite_id = 4; item.action_callback = [this]() { if (m_canvas != nullptr) wxPostEvent(m_canvas, SimpleEvent(EVT_GLTOOLBAR_COPY)); }; - item.enabled_state_callback = []()->bool { return wxGetApp().plater()->can_copy(); }; + item.enabled_state_callback = []()->bool { return wxGetApp().plater()->can_copy_to_clipboard(); }; if (!m_toolbar.add_item(item)) return false; @@ -3499,7 +3499,7 @@ bool GLCanvas3D::_init_toolbar() item.tooltip = _utf8(L("Paste")) + " [" + GUI::shortkey_ctrl_prefix() + "V]"; item.sprite_id = 5; item.action_callback = [this]() { if (m_canvas != nullptr) wxPostEvent(m_canvas, SimpleEvent(EVT_GLTOOLBAR_PASTE)); }; - item.enabled_state_callback = []()->bool { return wxGetApp().plater()->can_paste(); }; + item.enabled_state_callback = []()->bool { return wxGetApp().plater()->can_paste_from_clipboard(); }; if (!m_toolbar.add_item(item)) return false; diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 667dcd899d..d800f6f380 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -505,10 +505,10 @@ void MainFrame::init_menubar() editMenu->AppendSeparator(); append_menu_item(editMenu, wxID_ANY, _(L("&Copy")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + "C", _(L("Copy selection to clipboard")), [this](wxCommandEvent&) { m_plater->copy_selection_to_clipboard(); }, - menu_icon("copy_menu"), nullptr, [this](){return m_plater->can_copy(); }, this); + menu_icon("copy_menu"), nullptr, [this](){return m_plater->can_copy_to_clipboard(); }, this); append_menu_item(editMenu, wxID_ANY, _(L("&Paste")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + "V", _(L("Paste clipboard")), [this](wxCommandEvent&) { m_plater->paste_from_clipboard(); }, - menu_icon("paste_menu"), nullptr, [this](){return m_plater->can_paste(); }, this); + menu_icon("paste_menu"), nullptr, [this](){return m_plater->can_paste_from_clipboard(); }, this); } // Window menu diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index c2456db800..f68267cef0 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -4187,30 +4187,14 @@ void Plater::update_object_menu() { p->update_object_menu(); } void Plater::copy_selection_to_clipboard() { - p->view3D->get_canvas3d()->get_selection().copy_to_clipboard(); + if (can_copy_to_clipboard()) + p->view3D->get_canvas3d()->get_selection().copy_to_clipboard(); } void Plater::paste_from_clipboard() { - p->view3D->get_canvas3d()->get_selection().paste_from_clipboard(); -} - -bool Plater::can_paste_from_clipboard() const -{ - const Selection& selection = p->view3D->get_canvas3d()->get_selection(); - const Selection::Clipboard& clipboard = selection.get_clipboard(); - Selection::EMode mode = clipboard.get_mode(); - - if (clipboard.is_empty()) - return false; - - if ((mode == Selection::Volume) && !selection.is_from_single_instance()) - return false; - - if ((mode == Selection::Instance) && (selection.get_mode() != Selection::Instance)) - return false; - - return true; + if (can_paste_from_clipboard()) + p->view3D->get_canvas3d()->get_selection().paste_from_clipboard(); } void Plater::msw_rescale() @@ -4237,7 +4221,37 @@ bool Plater::can_split_to_objects() const { return p->can_split_to_objects(); } bool Plater::can_split_to_volumes() const { return p->can_split_to_volumes(); } bool Plater::can_arrange() const { return p->can_arrange(); } bool Plater::can_layers_editing() const { return p->can_layers_editing(); } -bool Plater::can_copy() const { return !is_selection_empty(); } -bool Plater::can_paste() const { return can_paste_from_clipboard(); } +bool Plater::can_paste_from_clipboard() const +{ + const Selection& selection = p->view3D->get_canvas3d()->get_selection(); + const Selection::Clipboard& clipboard = selection.get_clipboard(); + + if (clipboard.is_empty()) + return false; + + if ((wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA) && !clipboard.is_sla_compliant()) + return false; + + Selection::EMode mode = clipboard.get_mode(); + if ((mode == Selection::Volume) && !selection.is_from_single_instance()) + return false; + + if ((mode == Selection::Instance) && (selection.get_mode() != Selection::Instance)) + return false; + + return true; +} + +bool Plater::can_copy_to_clipboard() const +{ + if (is_selection_empty()) + return false; + + const Selection& selection = p->view3D->get_canvas3d()->get_selection(); + if ((wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA) && !selection.is_sla_compliant()) + return false; + + return true; +} }} // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 761bf7a052..2851af6544 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -200,7 +200,6 @@ public: void copy_selection_to_clipboard(); void paste_from_clipboard(); - bool can_paste_from_clipboard() const; bool can_delete() const; bool can_delete_all() const; @@ -212,8 +211,8 @@ public: bool can_split_to_volumes() const; bool can_arrange() const; bool can_layers_editing() const; - bool can_copy() const; - bool can_paste() const; + bool can_paste_from_clipboard() const; + bool can_copy_to_clipboard() const; void msw_rescale(); diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 6e80783ccd..97168ee045 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -47,6 +47,26 @@ Selection::VolumeCache::VolumeCache(const Geometry::Transformation& volume_trans { } +bool Selection::Clipboard::is_sla_compliant() const +{ + if (m_mode == Selection::Volume) + return false; + + for (const ModelObject* o : m_model.objects) + { + if (o->is_multiparts()) + return false; + + for (const ModelVolume* v : o->volumes) + { + if (v->is_modifier()) + return false; + } + } + + return true; +} + Selection::Selection() : m_volumes(nullptr) , m_model(nullptr) @@ -385,6 +405,20 @@ bool Selection::is_from_single_object() const return (0 <= idx) && (idx < 1000); } +bool Selection::is_sla_compliant() const +{ + if (m_mode == Volume) + return false; + + for (unsigned int i : m_list) + { + if ((*m_volumes)[i]->is_modifier) + return false; + } + + return true; +} + bool Selection::requires_uniform_scale() const { if (is_single_full_instance() || is_single_modifier() || is_single_volume()) diff --git a/src/slic3r/GUI/Selection.hpp b/src/slic3r/GUI/Selection.hpp index 5da1e477bc..802f8d2847 100644 --- a/src/slic3r/GUI/Selection.hpp +++ b/src/slic3r/GUI/Selection.hpp @@ -152,6 +152,8 @@ public: void reset() { m_model.clear_objects(); } bool is_empty() const { return m_model.objects.empty(); } + bool is_sla_compliant() const; + ModelObject* add_object() { return m_model.add_object(); } ModelObject* get_object(unsigned int id) { return (id < (unsigned int)m_model.objects.size()) ? m_model.objects[id] : nullptr; } const ModelObjectPtrs& get_objects() const { return m_model.objects; } @@ -257,6 +259,7 @@ public: bool is_mixed() const { return m_type == Mixed; } bool is_from_single_instance() const { return get_instance_idx() != -1; } bool is_from_single_object() const; + bool is_sla_compliant() const; bool contains_volume(unsigned int volume_idx) const { return m_list.find(volume_idx) != m_list.end(); } bool requires_uniform_scale() const; From e737f15bfa68236d184dfba5861a3389fb903986 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 24 Jun 2019 13:45:35 +0200 Subject: [PATCH 42/64] Fix of OSX build --- src/slic3r/GUI/wxExtensions.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index ed496a97ec..aed4236749 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -2316,8 +2316,7 @@ void DoubleSlider::OnMotion(wxMouseEvent& event) // Set tooltips with information for each icon const wxString tooltip = m_is_one_layer_icon_focesed ? _(L("One layer mode")) : m_is_action_icon_focesed ? _(L("Add/Del color change")) : - is_revert_icon_focused ? _(L("Discard all color changes")) : - wxEmptyString; + is_revert_icon_focused ? _(L("Discard all color changes")) : ""; this->SetToolTip(tooltip); if (action) From 198600543dd707a51f29660c2583459ae2b34933 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Mon, 24 Jun 2019 15:27:32 +0200 Subject: [PATCH 43/64] Fix of incorrect color print preview due to the tbb::parallel_for not respecting the grain size exactly. Also the tool path generation has been optimized to launch less threads and to produce larger vertex buffers. --- src/slic3r/GUI/GLCanvas3D.cpp | 102 +++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 45 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 19d1bc0edc..3d9b24c11a 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4627,17 +4627,12 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c bool color_by_tool() const { return tool_colors != nullptr; } size_t number_tools() const { return this->color_by_tool() ? tool_colors->size() / 4 : 0; } const float* color_tool(size_t tool) const { return tool_colors->data() + tool * 4; } - int volume_idx(int extruder, int feature) const - { - return this->color_by_color_print() ? 0 : this->color_by_tool() ? std::min(this->number_tools() - 1, std::max(extruder - 1, 0)) : feature; - } // For coloring by a color_print(M600), return a parsed color. bool color_by_color_print() const { return color_print_values!=nullptr; } - const float* color_print_by_layer_idx(const size_t layer_idx) const - { + const size_t color_print_color_idx_by_layer_idx(const size_t layer_idx) const { auto it = std::lower_bound(color_print_values->begin(), color_print_values->end(), layers[layer_idx]->print_z + EPSILON); - return color_tool((it - color_print_values->begin()) % number_tools()); + return (it - color_print_values->begin()) % number_tools(); } } ctxt; @@ -4670,7 +4665,7 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c BOOST_LOG_TRIVIAL(debug) << "Loading print object toolpaths in parallel - start"; //FIXME Improve the heuristics for a grain size. - size_t grain_size = ctxt.color_by_color_print() ? size_t(1) : std::max(ctxt.layers.size() / 16, size_t(1)); + size_t grain_size = std::max(ctxt.layers.size() / 16, size_t(1)); tbb::spin_mutex new_volume_mutex; auto new_volume = [this, &new_volume_mutex](const float *color) -> GLVolume* { auto *volume = new GLVolume(color); @@ -4679,14 +4674,34 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c new_volume_mutex.unlock(); return volume; }; - const size_t volumes_cnt_initial = m_volumes.volumes.size(); - std::vector volumes_per_thread(ctxt.layers.size()); + const size_t volumes_cnt_initial = m_volumes.volumes.size(); tbb::parallel_for( tbb::blocked_range(0, ctxt.layers.size(), grain_size), [&ctxt, &new_volume](const tbb::blocked_range& range) { - GLVolumePtrs vols; - if (ctxt.color_by_color_print()) - vols.emplace_back(new_volume(ctxt.color_print_by_layer_idx(range.begin()))); + GLVolumePtrs vols; + std::vector color_print_layer_to_glvolume; + auto volume = [&ctxt, &vols, &color_print_layer_to_glvolume, &range](size_t layer_idx, int extruder, int feature) -> GLVolume& { + return *vols[ctxt.color_by_color_print() ? + color_print_layer_to_glvolume[layer_idx - range.begin()] : + ctxt.color_by_tool() ? + std::min(ctxt.number_tools() - 1, std::max(extruder - 1, 0)) : + feature + ]; + }; + if (ctxt.color_by_color_print()) { + // Create a map from the layer index to a GLVolume, which is initialized with the correct layer span color. + std::vector color_print_tool_to_glvolume(ctxt.number_tools(), -1); + color_print_layer_to_glvolume.reserve(range.end() - range.begin()); + vols.reserve(ctxt.number_tools()); + for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++ idx_layer) { + int idx_tool = (int)ctxt.color_print_color_idx_by_layer_idx(idx_layer); + if (color_print_tool_to_glvolume[idx_tool] == -1) { + color_print_tool_to_glvolume[idx_tool] = (int)vols.size(); + vols.emplace_back(new_volume(ctxt.color_tool(idx_tool))); + } + color_print_layer_to_glvolume.emplace_back(color_print_tool_to_glvolume[idx_tool]); + } + } else if (ctxt.color_by_tool()) { for (size_t i = 0; i < ctxt.number_tools(); ++i) vols.emplace_back(new_volume(ctxt.color_tool(i))); @@ -4694,33 +4709,31 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c else vols = { new_volume(ctxt.color_perimeters()), new_volume(ctxt.color_infill()), new_volume(ctxt.color_support()) }; for (GLVolume *vol : vols) - vol->indexed_vertex_array.reserve(ctxt.alloc_size_reserve()); - for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++idx_layer) { + vol->indexed_vertex_array.reserve(ctxt.alloc_size_reserve()); + for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++ idx_layer) { const Layer *layer = ctxt.layers[idx_layer]; - for (size_t i = 0; i < vols.size(); ++i) { - GLVolume &vol = *vols[i]; - if (vol.print_zs.empty() || vol.print_zs.back() != layer->print_z) { - vol.print_zs.push_back(layer->print_z); - vol.offsets.push_back(vol.indexed_vertex_array.quad_indices.size()); - vol.offsets.push_back(vol.indexed_vertex_array.triangle_indices.size()); + for (GLVolume *vol : vols) + if (vol->print_zs.empty() || vol->print_zs.back() != layer->print_z) { + vol->print_zs.push_back(layer->print_z); + vol->offsets.push_back(vol->indexed_vertex_array.quad_indices.size()); + vol->offsets.push_back(vol->indexed_vertex_array.triangle_indices.size()); } - } for (const Point © : *ctxt.shifted_copies) { for (const LayerRegion *layerm : layer->regions()) { if (ctxt.has_perimeters) _3DScene::extrusionentity_to_verts(layerm->perimeters, float(layer->print_z), copy, - *vols[ctxt.volume_idx(layerm->region()->config().perimeter_extruder.value, 0)]); + volume(idx_layer, layerm->region()->config().perimeter_extruder.value, 0)); if (ctxt.has_infill) { for (const ExtrusionEntity *ee : layerm->fills.entities) { // fill represents infill extrusions of a single island. const auto *fill = dynamic_cast(ee); - if (!fill->entities.empty()) + if (! fill->entities.empty()) _3DScene::extrusionentity_to_verts(*fill, float(layer->print_z), copy, - *vols[ctxt.volume_idx( - is_solid_infill(fill->entities.front()->role()) ? - layerm->region()->config().solid_infill_extruder : - layerm->region()->config().infill_extruder, - 1)]); + volume(idx_layer, + is_solid_infill(fill->entities.front()->role()) ? + layerm->region()->config().solid_infill_extruder : + layerm->region()->config().infill_extruder, + 1)); } } } @@ -4729,36 +4742,35 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c if (support_layer) { for (const ExtrusionEntity *extrusion_entity : support_layer->support_fills.entities) _3DScene::extrusionentity_to_verts(extrusion_entity, float(layer->print_z), copy, - *vols[ctxt.volume_idx( - (extrusion_entity->role() == erSupportMaterial) ? - support_layer->object()->config().support_material_extruder : - support_layer->object()->config().support_material_interface_extruder, - 2)]); + volume(idx_layer, + (extrusion_entity->role() == erSupportMaterial) ? + support_layer->object()->config().support_material_extruder : + support_layer->object()->config().support_material_interface_extruder, + 2)); } } } - for (size_t i = 0; i < vols.size(); ++i) { - GLVolume &vol = *vols[i]; - if (vol.indexed_vertex_array.vertices_and_normals_interleaved.size() / 6 > ctxt.alloc_size_max()) { + // Ensure that no volume grows over the limits. If the volume is too large, allocate a new one. + for (GLVolume *&vol : vols) + if (vol->indexed_vertex_array.vertices_and_normals_interleaved.size() / 6 > ctxt.alloc_size_max()) { // Store the vertex arrays and restart their containers, - vols[i] = new_volume(vol.color); - GLVolume &vol_new = *vols[i]; + vol = new_volume(vol->color); + GLVolume &vol_new = *vol; // Assign the large pre-allocated buffers to the new GLVolume. - vol_new.indexed_vertex_array = std::move(vol.indexed_vertex_array); + vol_new.indexed_vertex_array = std::move(vol->indexed_vertex_array); // Copy the content back to the old GLVolume. - vol.indexed_vertex_array = vol_new.indexed_vertex_array; + vol->indexed_vertex_array = vol_new.indexed_vertex_array; // Finalize a bounding box of the old GLVolume. - vol.bounding_box = vol.indexed_vertex_array.bounding_box(); + vol->bounding_box = vol->indexed_vertex_array.bounding_box(); // Clear the buffers, but keep them pre-allocated. vol_new.indexed_vertex_array.clear(); // Just make sure that clear did not clear the reserved memory. vol_new.indexed_vertex_array.reserve(ctxt.alloc_size_reserve()); } - } } for (GLVolume *vol : vols) { - vol->bounding_box = vol->indexed_vertex_array.bounding_box(); - vol->indexed_vertex_array.shrink_to_fit(); + vol->bounding_box = vol->indexed_vertex_array.bounding_box(); + vol->indexed_vertex_array.shrink_to_fit(); } }); From 992170c5f66e1bc823c03a26ad43af8b03d188d3 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 24 Jun 2019 15:55:14 +0200 Subject: [PATCH 44/64] 1) Perspective camera set as default camera type 2) Camera type selection added to Preferences dialog --- src/slic3r/GUI/AppConfig.cpp | 4 ++-- src/slic3r/GUI/Camera.cpp | 15 ++++++--------- src/slic3r/GUI/Camera.hpp | 1 + src/slic3r/GUI/GLCanvas3D.cpp | 3 +++ src/slic3r/GUI/GUI_Preview.cpp | 6 ++++++ src/slic3r/GUI/GUI_Preview.hpp | 2 ++ src/slic3r/GUI/Plater.cpp | 4 +--- src/slic3r/GUI/Preferences.cpp | 11 +++++++++-- 8 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/slic3r/GUI/AppConfig.cpp b/src/slic3r/GUI/AppConfig.cpp index edc9845a13..51bee9e756 100644 --- a/src/slic3r/GUI/AppConfig.cpp +++ b/src/slic3r/GUI/AppConfig.cpp @@ -73,8 +73,8 @@ void AppConfig::set_defaults() if (get("custom_toolbar_size").empty()) set("custom_toolbar_size", "100"); - if (get("camera_type").empty()) - set("camera_type", "1"); + if (get("use_perspective_camera").empty()) + set("use_perspective_camera", "1"); // Remove legacy window positions/sizes erase("", "main_frame_maximized"); diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index 1f8513ac29..6cb8ff5201 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -31,7 +31,7 @@ Camera::Camera() : phi(45.0f) , requires_zoom_to_bed(false) , inverted_phi(false) - , m_type(Ortho) + , m_type(Perspective) , m_target(Vec3d::Zero()) , m_theta(45.0f) , m_zoom(1.0) @@ -61,20 +61,17 @@ void Camera::set_type(EType type) if (m_type != type) { m_type = type; - - wxGetApp().app_config->set("camera_type", std::to_string(m_type)); + wxGetApp().app_config->set("use_perspective_camera", (m_type == Perspective) ? "1" : "0"); wxGetApp().app_config->save(); } } void Camera::set_type(const std::string& type) { - if (!type.empty() && (type != "1")) - { - unsigned char type_id = atoi(type.c_str()); - if (((unsigned char)Ortho < type_id) && (type_id < (unsigned char)Num_types)) - set_type((Camera::EType)type_id); - } + if (type == "1") + set_type(Perspective); + else + set_type(Ortho); } void Camera::select_next_type() diff --git a/src/slic3r/GUI/Camera.hpp b/src/slic3r/GUI/Camera.hpp index bd2541ce2f..79e87c7264 100644 --- a/src/slic3r/GUI/Camera.hpp +++ b/src/slic3r/GUI/Camera.hpp @@ -49,6 +49,7 @@ public: EType get_type() const { return m_type; } std::string get_type_as_string() const; void set_type(EType type); + // valid values for type: "0" -> ortho, "1" -> perspective void set_type(const std::string& type); void select_next_type(); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 25319e9ce2..2f265eb928 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3312,6 +3312,9 @@ void GLCanvas3D::handle_sidebar_focus_event(const std::string& opt_key, bool foc void GLCanvas3D::update_ui_from_settings() { + m_camera.set_type(wxGetApp().app_config->get("use_perspective_camera")); + m_dirty = true; + #if ENABLE_RETINA_GL const float orig_scaling = m_retina_helper->get_scale_factor(); diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index 2f5e10962e..671c49eefa 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -313,6 +313,12 @@ Preview::~Preview() } } +void Preview::set_as_dirty() +{ + if (m_canvas != nullptr) + m_canvas->set_as_dirty(); +} + void Preview::set_number_extruders(unsigned int number_extruders) { if (m_number_extruders != number_extruders) diff --git a/src/slic3r/GUI/GUI_Preview.hpp b/src/slic3r/GUI/GUI_Preview.hpp index 93038b0e56..993e260e41 100644 --- a/src/slic3r/GUI/GUI_Preview.hpp +++ b/src/slic3r/GUI/GUI_Preview.hpp @@ -110,6 +110,8 @@ public: wxGLCanvas* get_wxglcanvas() { return m_canvas_widget; } GLCanvas3D* get_canvas3d() { return m_canvas; } + void set_as_dirty(); + void set_number_extruders(unsigned int number_extruders); void set_canvas_as_dirty(); void set_enabled(bool enabled); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index f68267cef0..9d0c979b66 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1774,7 +1774,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) set_current_panel(view3D); // updates camera type from .ini file - camera.set_type(get_config("camera_type")); + camera.set_type(get_config("use_perspective_camera")); } void Plater::priv::update(bool force_full_scene_refresh) @@ -1842,10 +1842,8 @@ void Plater::priv::update_ui_from_settings() // $self->{buttons_sizer}->Layout; // } -#if ENABLE_RETINA_GL view3D->get_canvas3d()->update_ui_from_settings(); preview->get_canvas3d()->update_ui_from_settings(); -#endif } ProgressStatusBar* Plater::priv::statusbar() diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 52cbdbb1d9..7b31870127 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -28,7 +28,7 @@ void PreferencesDialog::build() m_icon_size_sizer->ShowItems(boost::any_cast(value)); this->layout(); } - }; + }; // TODO // $optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new( @@ -97,7 +97,7 @@ void PreferencesDialog::build() option = Option (def,"show_incompatible_presets"); m_optgroup->append_single_option_line(option); - // TODO: remove? + // TODO: remove? def.label = L("Use legacy OpenGL 1.1 rendering"); def.type = coBool; def.tooltip = L("If you have rendering issues caused by a buggy OpenGL 2.0 driver, " @@ -117,6 +117,13 @@ void PreferencesDialog::build() m_optgroup->append_single_option_line(option); #endif + def.label = L("Use perspective camera"); + def.type = coBool; + def.tooltip = L("If enabled, use perspective camera. If not enabled, use orthographic camera."); + def.set_default_value(new ConfigOptionBool{ app_config->get("use_perspective_camera") == "1" }); + option = Option(def, "use_perspective_camera"); + m_optgroup->append_single_option_line(option); + def.label = L("Use custom size for toolbar icons"); def.type = coBool; def.tooltip = L("If enabled, you can change size of toolbar icons manually."); From d689195bda8fe9d0618b97685858dbc2b263bf24 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Tue, 25 Jun 2019 08:56:53 +0200 Subject: [PATCH 45/64] Fix of the previous commit on color change fix. --- src/slic3r/GUI/GLCanvas3D.cpp | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 25319e9ce2..1aa542d0cf 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4646,22 +4646,24 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c } } // Ensure that no volume grows over the limits. If the volume is too large, allocate a new one. - for (GLVolume *&vol : vols) - if (vol->indexed_vertex_array.vertices_and_normals_interleaved.size() / 6 > ctxt.alloc_size_max()) { - // Store the vertex arrays and restart their containers, - vol = new_volume(vol->color); - GLVolume &vol_new = *vol; - // Assign the large pre-allocated buffers to the new GLVolume. - vol_new.indexed_vertex_array = std::move(vol->indexed_vertex_array); - // Copy the content back to the old GLVolume. - vol->indexed_vertex_array = vol_new.indexed_vertex_array; - // Finalize a bounding box of the old GLVolume. - vol->bounding_box = vol->indexed_vertex_array.bounding_box(); - // Clear the buffers, but keep them pre-allocated. - vol_new.indexed_vertex_array.clear(); - // Just make sure that clear did not clear the reserved memory. - vol_new.indexed_vertex_array.reserve(ctxt.alloc_size_reserve()); - } + for (size_t i = 0; i < vols.size(); ++i) { + GLVolume &vol = *vols[i]; + if (vol.indexed_vertex_array.vertices_and_normals_interleaved.size() / 6 > ctxt.alloc_size_max()) { + // Store the vertex arrays and restart their containers, + vols[i] = new_volume(vol.color); + GLVolume &vol_new = *vols[i]; + // Assign the large pre-allocated buffers to the new GLVolume. + vol_new.indexed_vertex_array = std::move(vol.indexed_vertex_array); + // Copy the content back to the old GLVolume. + vol.indexed_vertex_array = vol_new.indexed_vertex_array; + // Finalize a bounding box of the old GLVolume. + vol.bounding_box = vol.indexed_vertex_array.bounding_box(); + // Clear the buffers, but keep them pre-allocated. + vol_new.indexed_vertex_array.clear(); + // Just make sure that clear did not clear the reserved memory. + vol_new.indexed_vertex_array.reserve(ctxt.alloc_size_reserve()); + } + } } for (GLVolume *vol : vols) { vol->bounding_box = vol->indexed_vertex_array.bounding_box(); From 3d755e1bbe642becb73c9f64910616787eade373 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Tue, 25 Jun 2019 09:20:58 +0200 Subject: [PATCH 46/64] Removed 'Use legacy OpenGL 1.1 rendering' option --- src/slic3r/GUI/AppConfig.cpp | 7 +++---- src/slic3r/GUI/GLCanvas3D.cpp | 13 +++---------- src/slic3r/GUI/GLCanvas3D.hpp | 4 +--- src/slic3r/GUI/GLCanvas3DManager.cpp | 10 +++------- src/slic3r/GUI/GLCanvas3DManager.hpp | 1 - src/slic3r/GUI/Preferences.cpp | 13 +------------ 6 files changed, 11 insertions(+), 37 deletions(-) diff --git a/src/slic3r/GUI/AppConfig.cpp b/src/slic3r/GUI/AppConfig.cpp index 51bee9e756..3b62100582 100644 --- a/src/slic3r/GUI/AppConfig.cpp +++ b/src/slic3r/GUI/AppConfig.cpp @@ -54,10 +54,9 @@ void AppConfig::set_defaults() if (get("preset_update").empty()) set("preset_update", "1"); - // Use OpenGL 1.1 even if OpenGL 2.0 is available. This is mainly to support some buggy Intel HD Graphics drivers. - // github.com/prusa3d/PrusaSlicer/issues/233 - if (get("use_legacy_opengl").empty()) - set("use_legacy_opengl", "0"); + // remove old 'use_legacy_opengl' parameter from this config, if present + if (!get("use_legacy_opengl").empty()) + erase("", "use_legacy_opengl"); #if __APPLE__ if (get("use_retina_opengl").empty()) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index cf8a49ea22..c828e0ec66 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -198,8 +198,7 @@ void GLCanvas3D::Shader::_reset() #endif // !ENABLE_TEXTURES_FROM_SVG GLCanvas3D::LayersEditing::LayersEditing() - : m_use_legacy_opengl(false) - , m_enabled(false) + : m_enabled(false) , m_z_texture_id(0) , m_model_object(nullptr) , m_object_max_z(0.f) @@ -274,12 +273,7 @@ void GLCanvas3D::LayersEditing::select_object(const Model &model, int object_id) bool GLCanvas3D::LayersEditing::is_allowed() const { - return !m_use_legacy_opengl && m_shader.is_initialized() && m_shader.get_shader()->shader_program_id > 0 && m_z_texture_id > 0; -} - -void GLCanvas3D::LayersEditing::set_use_legacy_opengl(bool use_legacy_opengl) -{ - m_use_legacy_opengl = use_legacy_opengl; + return m_shader.is_initialized() && m_shader.get_shader()->shader_program_id > 0 && m_z_texture_id > 0; } bool GLCanvas3D::LayersEditing::is_enabled() const @@ -1253,7 +1247,7 @@ void GLCanvas3D::post_event(wxEvent &&event) wxPostEvent(m_canvas, event); } -bool GLCanvas3D::init(bool useVBOs, bool use_legacy_opengl) +bool GLCanvas3D::init(bool useVBOs) { if (m_initialized) return true; @@ -1311,7 +1305,6 @@ bool GLCanvas3D::init(bool useVBOs, bool use_legacy_opengl) return false; m_use_VBOs = useVBOs; - m_layers_editing.set_use_legacy_opengl(use_legacy_opengl); // on linux the gl context is not valid until the canvas is not shown on screen // we defer the geometry finalization of volumes until the first call to render() diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index d39a910b3b..5a42879039 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -197,7 +197,6 @@ class GLCanvas3D static const float THICKNESS_BAR_WIDTH; static const float THICKNESS_RESET_BUTTON_HEIGHT; - bool m_use_legacy_opengl; bool m_enabled; Shader m_shader; unsigned int m_z_texture_id; @@ -250,7 +249,6 @@ class GLCanvas3D void select_object(const Model &model, int object_id); bool is_allowed() const; - void set_use_legacy_opengl(bool use_legacy_opengl); bool is_enabled() const; void set_enabled(bool enabled); @@ -492,7 +490,7 @@ public: wxGLCanvas* get_wxglcanvas() { return m_canvas; } const wxGLCanvas* get_wxglcanvas() const { return m_canvas; } - bool init(bool useVBOs, bool use_legacy_opengl); + bool init(bool useVBOs); void post_event(wxEvent &&event); void set_as_dirty(); diff --git a/src/slic3r/GUI/GLCanvas3DManager.cpp b/src/slic3r/GUI/GLCanvas3DManager.cpp index 4f64b4e877..a1430ef22b 100644 --- a/src/slic3r/GUI/GLCanvas3DManager.cpp +++ b/src/slic3r/GUI/GLCanvas3DManager.cpp @@ -192,7 +192,6 @@ GLCanvas3DManager::GLInfo GLCanvas3DManager::s_gl_info; GLCanvas3DManager::GLCanvas3DManager() : m_context(nullptr) , m_gl_initialized(false) - , m_use_legacy_opengl(false) , m_use_VBOs(false) { } @@ -268,8 +267,7 @@ void GLCanvas3DManager::init_gl() { glewInit(); const AppConfig* config = GUI::get_app_config(); - m_use_legacy_opengl = (config == nullptr) || (config->get("use_legacy_opengl") == "1"); - m_use_VBOs = !m_use_legacy_opengl && s_gl_info.is_version_greater_or_equal_to(2, 0); + m_use_VBOs = s_gl_info.is_version_greater_or_equal_to(2, 0); m_gl_initialized = true; if (GLEW_EXT_texture_compression_s3tc) s_compressed_textures_supported = true; @@ -325,16 +323,14 @@ bool GLCanvas3DManager::init(GLCanvas3D& canvas) if (!m_gl_initialized) init_gl(); - return canvas.init(m_use_VBOs, m_use_legacy_opengl); + return canvas.init(m_use_VBOs); } void GLCanvas3DManager::detect_multisample(int* attribList) { int wxVersion = wxMAJOR_VERSION * 10000 + wxMINOR_VERSION * 100 + wxRELEASE_NUMBER; const AppConfig* app_config = GUI::get_app_config(); - bool enable_multisample = app_config != nullptr - && app_config->get("use_legacy_opengl") != "1" - && wxVersion >= 30003; + bool enable_multisample = wxVersion >= 30003; s_multisample = (enable_multisample && wxGLCanvas::IsDisplaySupported(attribList)) ? MS_Enabled : MS_Disabled; // Alternative method: it was working on previous version of wxWidgets but not with the latest, at least on Windows diff --git a/src/slic3r/GUI/GLCanvas3DManager.hpp b/src/slic3r/GUI/GLCanvas3DManager.hpp index 26c2558d07..7a600dcbdb 100644 --- a/src/slic3r/GUI/GLCanvas3DManager.hpp +++ b/src/slic3r/GUI/GLCanvas3DManager.hpp @@ -75,7 +75,6 @@ private: wxGLContext* m_context; static GLInfo s_gl_info; bool m_gl_initialized; - bool m_use_legacy_opengl; bool m_use_VBOs; static EMultisampleState s_multisample; static bool s_compressed_textures_supported; diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 7b31870127..827d1f4e05 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -97,16 +97,6 @@ void PreferencesDialog::build() option = Option (def,"show_incompatible_presets"); m_optgroup->append_single_option_line(option); - // TODO: remove? - def.label = L("Use legacy OpenGL 1.1 rendering"); - def.type = coBool; - def.tooltip = L("If you have rendering issues caused by a buggy OpenGL 2.0 driver, " - "you may try to check this checkbox. This will disable the layer height " - "editing and anti aliasing, so it is likely better to upgrade your graphics driver."); - def.set_default_value(new ConfigOptionBool{ app_config->get("use_legacy_opengl") == "1" }); - option = Option (def,"use_legacy_opengl"); - m_optgroup->append_single_option_line(option); - #if __APPLE__ def.label = L("Use Retina resolution for the 3D scene"); def.type = coBool; @@ -150,8 +140,7 @@ void PreferencesDialog::build() void PreferencesDialog::accept() { - if (m_values.find("no_defaults") != m_values.end() || - m_values.find("use_legacy_opengl") != m_values.end()) { + if (m_values.find("no_defaults") != m_values.end()) { warning_catcher(this, wxString::Format(_(L("You need to restart %s to make the changes effective.")), SLIC3R_APP_NAME)); } From 2f806dedc762c1ee810be44820aaff8de8cb5d07 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Tue, 25 Jun 2019 09:51:43 +0200 Subject: [PATCH 47/64] Fixed rendering of selection rectangle with perspective camera --- src/slic3r/GUI/GLSelectionRectangle.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GLSelectionRectangle.cpp b/src/slic3r/GUI/GLSelectionRectangle.cpp index 327cb1fde8..684563bff3 100644 --- a/src/slic3r/GUI/GLSelectionRectangle.cpp +++ b/src/slic3r/GUI/GLSelectionRectangle.cpp @@ -68,7 +68,8 @@ namespace GUI { if (!is_dragging()) return; - float zoom = (float)canvas.get_camera().get_zoom(); + const Camera& camera = canvas.get_camera(); + float zoom = (float)camera.get_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; Size cnv_size = canvas.get_canvas_size(); @@ -96,6 +97,11 @@ namespace GUI { glsafe(::glPushMatrix()); glsafe(::glLoadIdentity()); + // ensure that the rectangle is renderered inside the frustrum + glsafe(::glTranslated(0.0, 0.0, -(camera.get_near_z() + 0.5))); + // ensure that the overlay fits the frustrum near z plane + double gui_scale = camera.get_gui_scale(); + glsafe(::glScaled(gui_scale, gui_scale, 1.0)); glsafe(::glPushAttrib(GL_ENABLE_BIT)); glsafe(::glLineStipple(4, 0xAAAA)); From d818d1b429044f547699f2625d2a74501528968f Mon Sep 17 00:00:00 2001 From: BeldrothTheGold Date: Sat, 15 Jun 2019 19:10:14 -0600 Subject: [PATCH 48/64] Add debug option to display picking pass to screen --- src/libslic3r/Technologies.hpp | 2 ++ src/slic3r/GUI/GLCanvas3D.cpp | 2 ++ src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index a5f93b24f2..86a00480b2 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -15,6 +15,8 @@ #define ENABLE_RENDER_STATISTICS 0 // Shows an imgui dialog with camera related data #define ENABLE_CAMERA_STATISTICS 0 +// Render the picking pass instead of the main scene +#define ENABLE_RENDER_PICKING_PASS 0 //==================== diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index c828e0ec66..5d73c9248c 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1625,6 +1625,7 @@ void GLCanvas3D::render() _picking_pass(); } +#if !ENABLE_RENDER_PICKING_PASS // draw scene glsafe(::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)); _render_background(); @@ -1654,6 +1655,7 @@ void GLCanvas3D::render() _render_current_gizmo(); _render_selection_sidebar_hints(); +#endif // !ENABLE_RENDER_PICKING_PASS #if ENABLE_SHOW_CAMERA_TARGET _render_camera_target(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp index cfe07a61cf..7e2b558d94 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp @@ -259,6 +259,10 @@ void GLGizmoSlaSupports::render_clipping_plane(const Selection& selection) const void GLGizmoSlaSupports::on_render_for_picking(const Selection& selection) const { +#if ENABLE_RENDER_PICKING_PASS + m_z_shift = selection.get_volume(*selection.get_volume_idxs().begin())->get_sla_shift_z(); +#endif + glsafe(::glEnable(GL_DEPTH_TEST)); render_points(selection, true); } From ac82cbe0cc6d9123611e24a5aabbad1a1bb4c9de Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 26 Jun 2019 09:48:52 +0200 Subject: [PATCH 49/64] Fix of #2548 --- src/slic3r/GUI/Plater.cpp | 38 +++++++++++++++++++++++++++++++++++--- src/slic3r/GUI/Plater.hpp | 14 +++++++++++++- src/slic3r/GUI/Tab.cpp | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index f68267cef0..ceedece607 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1260,6 +1260,7 @@ struct Plater::priv Preview *preview; BackgroundSlicingProcess background_process; + bool suppressed_backround_processing_update { false }; // A class to handle UI jobs like arranging and optimizing rotation. // These are not instant jobs, the user has to be informed about their @@ -1694,7 +1695,11 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) panels.push_back(preview); this->background_process_timer.SetOwner(this->q, 0); - this->q->Bind(wxEVT_TIMER, [this](wxTimerEvent &evt) { this->update_restart_background_process(false, false); }); + this->q->Bind(wxEVT_TIMER, [this](wxTimerEvent &evt) + { + if (!this->suppressed_backround_processing_update) + this->update_restart_background_process(false, false); + }); update(); @@ -4176,9 +4181,25 @@ void Plater::changed_objects(const std::vector& object_idxs) this->p->schedule_background_process(); } -void Plater::schedule_background_process() +void Plater::schedule_background_process(bool schedule/* = true*/) { - this->p->schedule_background_process(); + if (schedule) + this->p->schedule_background_process(); + + this->p->suppressed_backround_processing_update = false; +} + +bool Plater::is_background_process_running() const +{ + return this->p->background_process_timer.IsRunning(); +} + +void Plater::suppress_background_process(const bool stop_background_process) +{ + if (stop_background_process) + this->p->background_process_timer.Stop(); + + this->p->suppressed_backround_processing_update = true; } void Plater::fix_through_netfabb(const int obj_idx, const int vol_idx/* = -1*/) { p->fix_through_netfabb(obj_idx, vol_idx); } @@ -4254,4 +4275,15 @@ bool Plater::can_copy_to_clipboard() const return true; } +SuppressBackgroundProcessingUpdate::SuppressBackgroundProcessingUpdate() : + m_was_running(wxGetApp().plater()->is_background_process_running()) +{ + wxGetApp().plater()->suppress_background_process(m_was_running); +} + +SuppressBackgroundProcessingUpdate::~SuppressBackgroundProcessingUpdate() +{ + wxGetApp().plater()->schedule_background_process(m_was_running); +} + }} // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 2851af6544..5b1347891e 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -175,7 +175,9 @@ public: void reslice_SLA_supports(const ModelObject &object); void changed_object(int obj_idx); void changed_objects(const std::vector& object_idxs); - void schedule_background_process(); + void schedule_background_process(bool schedule = true); + bool is_background_process_running() const; + void suppress_background_process(const bool stop_background_process) ; void fix_through_netfabb(const int obj_idx, const int vol_idx = -1); void send_gcode(); @@ -219,8 +221,18 @@ public: private: struct priv; std::unique_ptr p; + + friend class SuppressBackgroundProcessingUpdate; }; +class SuppressBackgroundProcessingUpdate +{ +public: + SuppressBackgroundProcessingUpdate(); + ~SuppressBackgroundProcessingUpdate(); +private: + bool m_was_running; +}; }} diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 22aecf38d8..6e8b8a471e 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2314,6 +2314,40 @@ void TabPrinter::build_unregular_pages() auto optgroup = page->new_optgroup(_(L("Size"))); optgroup->append_single_option_line("nozzle_diameter", extruder_idx); + + optgroup->m_on_change = [this, extruder_idx](const t_config_option_key& opt_key, boost::any value) + { + if (m_extruders_count > 1 && opt_key.find_first_of("nozzle_diameter") != std::string::npos) + { + SuppressBackgroundProcessingUpdate sbpu; + const double new_nd = boost::any_cast(value); + std::vector nozzle_diameters = static_cast(m_config->option("nozzle_diameter"))->values; + + // if value was changed + if (fabs(nozzle_diameters[extruder_idx == 0 ? 1 : 0] - new_nd) > EPSILON) + { + const wxString msg_text = _(L("Do you want to change the diameter for all extruders?")); + auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Nozzle diameter")), wxICON_WARNING | wxYES_NO); + + DynamicPrintConfig new_conf = *m_config; + if (dialog->ShowModal() == wxID_YES) { + for (size_t i = 0; i < nozzle_diameters.size(); i++) { + if (i==extruder_idx) + continue; + nozzle_diameters[i] = new_nd; + } + } + else + nozzle_diameters[extruder_idx] = nozzle_diameters[extruder_idx == 0 ? 1 : 0]; + + new_conf.set_key_value("nozzle_diameter", new ConfigOptionFloats(nozzle_diameters)); + load_config(new_conf); + } + } + + update_dirty(); + update(); + }; optgroup = page->new_optgroup(_(L("Layer height limits"))); optgroup->append_single_option_line("min_layer_height", extruder_idx); From 14b32c4f166f094bc10fae06c88c5234cd94b292 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Wed, 26 Jun 2019 10:33:42 +0200 Subject: [PATCH 50/64] Make an order in using scale and unscale, remove some warnings. --- src/libnest2d/tests/test.cpp | 552 +++++++++++++-------------- src/libslic3r/MTUtils.hpp | 91 +++++ src/libslic3r/MinAreaBoundingBox.cpp | 68 ++-- src/libslic3r/ModelArrange.cpp | 2 +- src/libslic3r/SLA/SLABasePool.cpp | 15 +- src/libslic3r/SLAPrint.cpp | 34 +- src/libslic3r/libslic3r.h | 14 - 7 files changed, 408 insertions(+), 368 deletions(-) diff --git a/src/libnest2d/tests/test.cpp b/src/libnest2d/tests/test.cpp index 5741e87b4f..363a3930ce 100644 --- a/src/libnest2d/tests/test.cpp +++ b/src/libnest2d/tests/test.cpp @@ -10,10 +10,6 @@ #include "boost/multiprecision/integer.hpp" #include "boost/rational.hpp" -//#include "../tools/Int128.hpp" - -//#include "gte/Mathematics/GteMinimumAreaBox2.h" - //#include "../tools/libnfpglue.hpp" //#include "../tools/nfp_svgnest_glue.hpp" @@ -42,151 +38,151 @@ struct NfpImpl std::vector& prusaParts() { static std::vector ret; - + if(ret.empty()) { ret.reserve(PRINTER_PART_POLYGONS.size()); for(auto& inp : PRINTER_PART_POLYGONS) ret.emplace_back(inp); } - + return ret; } TEST(BasicFunctionality, Angles) { - + using namespace libnest2d; - + Degrees deg(180); Radians rad(deg); Degrees deg2(rad); - + ASSERT_DOUBLE_EQ(rad, Pi); ASSERT_DOUBLE_EQ(deg, 180); ASSERT_DOUBLE_EQ(deg2, 180); ASSERT_DOUBLE_EQ(rad, Radians(deg)); ASSERT_DOUBLE_EQ( Degrees(rad), deg); - + ASSERT_TRUE(rad == deg); - + Segment seg = {{0, 0}, {12, -10}}; - + ASSERT_TRUE(Degrees(seg.angleToXaxis()) > 270 && Degrees(seg.angleToXaxis()) < 360); - + seg = {{0, 0}, {12, 10}}; - + ASSERT_TRUE(Degrees(seg.angleToXaxis()) > 0 && Degrees(seg.angleToXaxis()) < 90); - + seg = {{0, 0}, {-12, 10}}; - + ASSERT_TRUE(Degrees(seg.angleToXaxis()) > 90 && Degrees(seg.angleToXaxis()) < 180); - + seg = {{0, 0}, {-12, -10}}; - + ASSERT_TRUE(Degrees(seg.angleToXaxis()) > 180 && Degrees(seg.angleToXaxis()) < 270); - + seg = {{0, 0}, {1, 0}}; - + ASSERT_DOUBLE_EQ(Degrees(seg.angleToXaxis()), 0); - + seg = {{0, 0}, {0, 1}}; - + ASSERT_DOUBLE_EQ(Degrees(seg.angleToXaxis()), 90); - - + + seg = {{0, 0}, {-1, 0}}; - + ASSERT_DOUBLE_EQ(Degrees(seg.angleToXaxis()), 180); - - + + seg = {{0, 0}, {0, -1}}; - + ASSERT_DOUBLE_EQ(Degrees(seg.angleToXaxis()), 270); - + } // Simple test, does not use gmock TEST(BasicFunctionality, creationAndDestruction) { using namespace libnest2d; - + Item sh = { {0, 0}, {1, 0}, {1, 1}, {0, 1} }; - + ASSERT_EQ(sh.vertexCount(), 4u); - + Item sh2 ({ {0, 0}, {1, 0}, {1, 1}, {0, 1} }); - + ASSERT_EQ(sh2.vertexCount(), 4u); - + // copy Item sh3 = sh2; - + ASSERT_EQ(sh3.vertexCount(), 4u); - + sh2 = {}; - + ASSERT_EQ(sh2.vertexCount(), 0u); ASSERT_EQ(sh3.vertexCount(), 4u); - + } TEST(GeometryAlgorithms, boundingCircle) { using namespace libnest2d; using placers::boundingCircle; - + PolygonImpl p = {{{0, 10}, {10, 0}, {0, -10}, {0, 10}}, {}}; Circle c = boundingCircle(p); - + ASSERT_EQ(c.center().X, 0); ASSERT_EQ(c.center().Y, 0); ASSERT_DOUBLE_EQ(c.radius(), 10); - + shapelike::translate(p, PointImpl{10, 10}); c = boundingCircle(p); - + ASSERT_EQ(c.center().X, 10); ASSERT_EQ(c.center().Y, 10); ASSERT_DOUBLE_EQ(c.radius(), 10); - + auto parts = prusaParts(); - + int i = 0; for(auto& part : parts) { c = boundingCircle(part.transformedShape()); if(std::isnan(c.radius())) std::cout << "fail: radius is nan" << std::endl; - + else for(auto v : shapelike::contour(part.transformedShape()) ) { - auto d = pointlike::distance(v, c.center()); - if(d > c.radius() ) { - auto e = std::abs( 1.0 - d/c.radius()); - ASSERT_LE(e, 1e-3); + auto d = pointlike::distance(v, c.center()); + if(d > c.radius() ) { + auto e = std::abs( 1.0 - d/c.radius()); + ASSERT_LE(e, 1e-3); + } } - } i++; } - + } TEST(GeometryAlgorithms, Distance) { using namespace libnest2d; - + Point p1 = {0, 0}; - + Point p2 = {10, 0}; Point p3 = {10, 10}; - + ASSERT_DOUBLE_EQ(pointlike::distance(p1, p2), 10); ASSERT_DOUBLE_EQ(pointlike::distance(p1, p3), sqrt(200)); - + Segment seg(p1, p3); - -// ASSERT_DOUBLE_EQ(pointlike::distance(p2, seg), 7.0710678118654755); - + + // ASSERT_DOUBLE_EQ(pointlike::distance(p2, seg), 7.0710678118654755); + auto result = pointlike::horizontalDistance(p2, seg); - + auto check = [](TCompute val, TCompute expected) { if(std::is_floating_point>::value) ASSERT_DOUBLE_EQ(static_cast(val), @@ -194,44 +190,44 @@ TEST(GeometryAlgorithms, Distance) { else ASSERT_EQ(val, expected); }; - + ASSERT_TRUE(result.second); check(result.first, 10); - + result = pointlike::verticalDistance(p2, seg); ASSERT_TRUE(result.second); check(result.first, -10); - + result = pointlike::verticalDistance(Point{10, 20}, seg); ASSERT_TRUE(result.second); check(result.first, 10); - - + + Point p4 = {80, 0}; Segment seg2 = { {0, 0}, {0, 40} }; - + result = pointlike::horizontalDistance(p4, seg2); - + ASSERT_TRUE(result.second); check(result.first, 80); - + result = pointlike::verticalDistance(p4, seg2); // Point should not be related to the segment ASSERT_FALSE(result.second); - + } TEST(GeometryAlgorithms, Area) { using namespace libnest2d; - + Rectangle rect(10, 10); - + ASSERT_EQ(rect.area(), 100); - + Rectangle rect2 = {100, 100}; - + ASSERT_EQ(rect2.area(), 10000); - + Item item = { {61, 97}, {70, 151}, @@ -242,33 +238,33 @@ TEST(GeometryAlgorithms, Area) { {61, 77}, {61, 97} }; - + ASSERT_TRUE(shapelike::area(item.transformedShape()) > 0 ); } TEST(GeometryAlgorithms, IsPointInsidePolygon) { using namespace libnest2d; - + Rectangle rect(10, 10); - + Point p = {1, 1}; - + ASSERT_TRUE(rect.isInside(p)); - + p = {11, 11}; - + ASSERT_FALSE(rect.isInside(p)); - - + + p = {11, 12}; - + ASSERT_FALSE(rect.isInside(p)); - - + + p = {3, 3}; - + ASSERT_TRUE(rect.isInside(p)); - + } //TEST(GeometryAlgorithms, Intersections) { @@ -294,21 +290,21 @@ TEST(GeometryAlgorithms, LeftAndDownPolygon) { using namespace libnest2d; using namespace libnest2d; - + Box bin(100, 100); BottomLeftPlacer placer(bin); - + Item item = {{70, 75}, {88, 60}, {65, 50}, {60, 30}, {80, 20}, {42, 20}, {35, 35}, {35, 55}, {40, 75}, {70, 75}}; - + Item leftControl = { {40, 75}, - {35, 55}, - {35, 35}, - {42, 20}, - {0, 20}, - {0, 75}, - {40, 75}}; - + {35, 55}, + {35, 35}, + {42, 20}, + {0, 20}, + {0, 75}, + {40, 75}}; + Item downControl = {{88, 60}, {88, 0}, {35, 0}, @@ -318,22 +314,22 @@ TEST(GeometryAlgorithms, LeftAndDownPolygon) {60, 30}, {65, 50}, {88, 60}}; - + Item leftp(placer.leftPoly(item)); - + ASSERT_TRUE(shapelike::isValid(leftp.rawShape()).first); ASSERT_EQ(leftp.vertexCount(), leftControl.vertexCount()); - + for(unsigned long i = 0; i < leftControl.vertexCount(); i++) { ASSERT_EQ(getX(leftp.vertex(i)), getX(leftControl.vertex(i))); ASSERT_EQ(getY(leftp.vertex(i)), getY(leftControl.vertex(i))); } - + Item downp(placer.downPoly(item)); - + ASSERT_TRUE(shapelike::isValid(downp.rawShape()).first); ASSERT_EQ(downp.vertexCount(), downControl.vertexCount()); - + for(unsigned long i = 0; i < downControl.vertexCount(); i++) { ASSERT_EQ(getX(downp.vertex(i)), getX(downControl.vertex(i))); ASSERT_EQ(getY(downp.vertex(i)), getY(downControl.vertex(i))); @@ -344,7 +340,7 @@ TEST(GeometryAlgorithms, LeftAndDownPolygon) TEST(GeometryAlgorithms, ArrangeRectanglesTight) { using namespace libnest2d; - + std::vector rects = { {80, 80}, {60, 90}, @@ -366,17 +362,17 @@ TEST(GeometryAlgorithms, ArrangeRectanglesTight) {5, 5}, {5, 5}, {20, 20} }; - - + + Nester arrange(Box(210, 250)); - + auto groups = arrange(rects.begin(), rects.end()); - + ASSERT_EQ(groups.size(), 1u); ASSERT_EQ(groups[0].size(), rects.size()); - + // check for no intersections, no containment: - + for(auto result : groups) { bool valid = true; for(Item& r1 : result) { @@ -389,14 +385,14 @@ TEST(GeometryAlgorithms, ArrangeRectanglesTight) } } } - + } TEST(GeometryAlgorithms, ArrangeRectanglesLoose) { using namespace libnest2d; - -// std::vector rects = { {40, 40}, {10, 10}, {20, 20} }; + + // std::vector rects = { {40, 40}, {10, 10}, {20, 20} }; std::vector rects = { {80, 80}, {60, 90}, @@ -418,17 +414,17 @@ TEST(GeometryAlgorithms, ArrangeRectanglesLoose) {5, 5}, {5, 5}, {20, 20} }; - + Coord min_obj_distance = 5; - + Nester arrange(Box(210, 250), - min_obj_distance); - + min_obj_distance); + auto groups = arrange(rects.begin(), rects.end()); - + ASSERT_EQ(groups.size(), 1u); ASSERT_EQ(groups[0].size(), rects.size()); - + // check for no intersections, no containment: auto result = groups[0]; bool valid = true; @@ -441,7 +437,7 @@ TEST(GeometryAlgorithms, ArrangeRectanglesLoose) } } } - + } namespace { @@ -449,68 +445,68 @@ using namespace libnest2d; template void exportSVG(std::vector>& result, const Bin& bin, int idx = 0) { - - + + std::string loc = "out"; - + static std::string svg_header = -R"raw( + R"raw( )raw"; - + int i = idx; auto r = result; -// for(auto r : result) { - std::fstream out(loc + std::to_string(i) + ".svg", std::fstream::out); - if(out.is_open()) { - out << svg_header; - Item rbin( Rectangle(bin.width(), bin.height()) ); - for(unsigned i = 0; i < rbin.vertexCount(); i++) { - auto v = rbin.vertex(i); - setY(v, -getY(v)/SCALE + 500 ); - setX(v, getX(v)/SCALE); - rbin.setVertex(i, v); - } - out << shapelike::serialize(rbin.rawShape()) << std::endl; - for(Item& sh : r) { - Item tsh(sh.transformedShape()); - for(unsigned i = 0; i < tsh.vertexCount(); i++) { - auto v = tsh.vertex(i); - setY(v, -getY(v)/SCALE + 500); - setX(v, getX(v)/SCALE); - tsh.setVertex(i, v); - } - out << shapelike::serialize(tsh.rawShape()) << std::endl; - } - out << "\n" << std::endl; + // for(auto r : result) { + std::fstream out(loc + std::to_string(i) + ".svg", std::fstream::out); + if(out.is_open()) { + out << svg_header; + Item rbin( Rectangle(bin.width(), bin.height()) ); + for(unsigned i = 0; i < rbin.vertexCount(); i++) { + auto v = rbin.vertex(i); + setY(v, -getY(v)/SCALE + 500 ); + setX(v, getX(v)/SCALE); + rbin.setVertex(i, v); } - out.close(); - -// i++; -// } + out << shapelike::serialize(rbin.rawShape()) << std::endl; + for(Item& sh : r) { + Item tsh(sh.transformedShape()); + for(unsigned i = 0; i < tsh.vertexCount(); i++) { + auto v = tsh.vertex(i); + setY(v, -getY(v)/SCALE + 500); + setX(v, getX(v)/SCALE); + tsh.setVertex(i, v); + } + out << shapelike::serialize(tsh.rawShape()) << std::endl; + } + out << "\n" << std::endl; + } + out.close(); + + // i++; + // } } } TEST(GeometryAlgorithms, BottomLeftStressTest) { using namespace libnest2d; - + const Coord SCALE = 1000000; auto& input = prusaParts(); - + Box bin(210*SCALE, 250*SCALE); BottomLeftPlacer placer(bin); - + auto it = input.begin(); auto next = it; int i = 0; while(it != input.end() && ++next != input.end()) { placer.pack(*it); placer.pack(*next); - + auto result = placer.getItems(); bool valid = true; - + if(result.size() == 2) { Item& r1 = result[0]; Item& r2 = result[1]; @@ -525,7 +521,7 @@ TEST(GeometryAlgorithms, BottomLeftStressTest) { std::cout << "something went terribly wrong!" << std::endl; FAIL(); } - + placer.clearItems(); it++; i++; @@ -534,9 +530,9 @@ TEST(GeometryAlgorithms, BottomLeftStressTest) { TEST(GeometryAlgorithms, convexHull) { using namespace libnest2d; - + ClipperLib::Path poly = PRINTER_PART_POLYGONS[0]; - + auto chull = sl::convexHull(poly); ASSERT_EQ(chull.size(), poly.size()); @@ -545,7 +541,7 @@ TEST(GeometryAlgorithms, convexHull) { TEST(GeometryAlgorithms, NestTest) { std::vector input = prusaParts(); - + PackGroup result = libnest2d::nest(input, Box(250000000, 210000000), [](unsigned cnt) { @@ -553,16 +549,17 @@ TEST(GeometryAlgorithms, NestTest) { << "parts left: " << cnt << std::endl; }); - + ASSERT_LE(result.size(), 2); - - int partsum = std::accumulate(result.begin(), - result.end(), - 0, - [](int s, - const decltype(result)::value_type &bin) { - return s += bin.size(); - }); + + size_t partsum = std::accumulate(result.begin(), + result.end(), + size_t(0), + [](int s, + const decltype( + result)::value_type &bin) { + return s += bin.size(); + }); ASSERT_EQ(input.size(), partsum); } @@ -647,7 +644,7 @@ std::vector nfp_testdata = { {118, 101}, {117, 103}, {117, 107} - }, + }, { {102, 116}, {111, 126}, @@ -658,7 +655,7 @@ std::vector nfp_testdata = { {147, 84}, {102, 84}, {102, 116}, - } + } }, { { @@ -674,7 +671,7 @@ std::vector nfp_testdata = { {108, 70}, {99, 102}, {99, 122}, - }, + }, { {107, 124}, {128, 125}, @@ -691,7 +688,7 @@ std::vector nfp_testdata = { {108, 85}, {107, 86}, {107, 124}, - } + } }, { { @@ -706,7 +703,7 @@ std::vector nfp_testdata = { {132, 57}, {91, 98}, {91, 100}, - }, + }, { {101, 90}, {103, 98}, @@ -724,74 +721,74 @@ std::vector nfp_testdata = { {102, 87}, {101, 89}, {101, 90}, - } + } } }; -std::vector nfp_concave_testdata = { - { // ItemPair - { - { - {533726, 142141}, - {532359, 143386}, - {530141, 142155}, - {528649, 160091}, - {533659, 157607}, - {538669, 160091}, - {537178, 142155}, - {534959, 143386}, - {533726, 142141}, - } - }, - { - { - {118305, 11603}, - {118311, 26616}, - {113311, 26611}, - {109311, 29604}, - {109300, 44608}, - {109311, 49631}, - {113300, 52636}, - {118311, 52636}, - {118308, 103636}, - {223830, 103636}, - {236845, 90642}, - {236832, 11630}, - {232825, 11616}, - {210149, 11616}, - {211308, 13625}, - {209315, 17080}, - {205326, 17080}, - {203334, 13629}, - {204493, 11616}, - {118305, 11603}, - } - }, - } + std::vector nfp_concave_testdata = { + { // ItemPair + { + { + {533726, 142141}, + {532359, 143386}, + {530141, 142155}, + {528649, 160091}, + {533659, 157607}, + {538669, 160091}, + {537178, 142155}, + {534959, 143386}, + {533726, 142141}, + } + }, + { + { + {118305, 11603}, + {118311, 26616}, + {113311, 26611}, + {109311, 29604}, + {109300, 44608}, + {109311, 49631}, + {113300, 52636}, + {118311, 52636}, + {118308, 103636}, + {223830, 103636}, + {236845, 90642}, + {236832, 11630}, + {232825, 11616}, + {210149, 11616}, + {211308, 13625}, + {209315, 17080}, + {205326, 17080}, + {203334, 13629}, + {204493, 11616}, + {118305, 11603}, + } + }, + } }; template void testNfp(const std::vector& testdata) { using namespace libnest2d; - + Box bin(210*SCALE, 250*SCALE); - + int testcase = 0; - + auto& exportfun = exportSVG; - + auto onetest = [&](Item& orbiter, Item& stationary, unsigned /*testidx*/){ testcase++; - + orbiter.translate({210*SCALE, 0}); - + auto&& nfp = nfp::noFitPolygon(stationary.rawShape(), orbiter.transformedShape()); - + placers::correctNfpPosition(nfp, stationary, orbiter); - + auto valid = shapelike::isValid(nfp.first); - + /*Item infp(nfp.first); if(!valid.first) { std::cout << "test instance: " << testidx << " " @@ -799,46 +796,46 @@ void testNfp(const std::vector& testdata) { std::vector> inp = {std::ref(infp)}; exportfun(inp, bin, testidx); }*/ - + ASSERT_TRUE(valid.first); - + Item infp(nfp.first); - + int i = 0; auto rorbiter = orbiter.transformedShape(); auto vo = nfp::referenceVertex(rorbiter); - + ASSERT_TRUE(stationary.isInside(infp)); - + for(auto v : infp) { auto dx = getX(v) - getX(vo); auto dy = getY(v) - getY(vo); - + Item tmp = orbiter; - + tmp.translate({dx, dy}); - + bool touching = Item::touches(tmp, stationary); - + if(!touching || !valid.first) { std::vector> inp = { std::ref(stationary), std::ref(tmp), std::ref(infp) }; - + exportfun(inp, bin, testcase*i++); } - + ASSERT_TRUE(touching); } }; - + unsigned tidx = 0; for(auto& td : testdata) { auto orbiter = td.orbiter; auto stationary = td.stationary; onetest(orbiter, stationary, tidx++); } - + tidx = 0; for(auto& td : testdata) { auto orbiter = td.stationary; @@ -858,19 +855,19 @@ TEST(GeometryAlgorithms, nfpConvexConvex) { TEST(GeometryAlgorithms, pointOnPolygonContour) { using namespace libnest2d; - + Rectangle input(10, 10); - + placers::EdgeCache ecache(input); - + auto first = *input.begin(); ASSERT_TRUE(getX(first) == getX(ecache.coords(0))); ASSERT_TRUE(getY(first) == getY(ecache.coords(0))); - + auto last = *std::prev(input.end()); ASSERT_TRUE(getX(last) == getX(ecache.coords(1.0))); ASSERT_TRUE(getY(last) == getY(ecache.coords(1.0))); - + for(int i = 0; i <= 100; i++) { auto v = ecache.coords(i*(0.01)); ASSERT_TRUE(shapelike::touches(v, input.transformedShape())); @@ -879,24 +876,24 @@ TEST(GeometryAlgorithms, pointOnPolygonContour) { TEST(GeometryAlgorithms, mergePileWithPolygon) { using namespace libnest2d; - + Rectangle rect1(10, 15); Rectangle rect2(15, 15); Rectangle rect3(20, 15); - + rect2.translate({10, 0}); rect3.translate({25, 0}); - + TMultiShape pile; pile.push_back(rect1.transformedShape()); pile.push_back(rect2.transformedShape()); - + auto result = nfp::merge(pile, rect3.transformedShape()); - + ASSERT_EQ(result.size(), 1); - + Rectangle ref(45, 15); - + ASSERT_EQ(shapelike::area(result.front()), ref.area()); } @@ -908,7 +905,7 @@ long double refMinAreaBox(const PolygonImpl& p) { long double min_area = std::numeric_limits::max(); - + auto update_min = [&min_area, &it, &itx, &p]() { Segment s(*it, *itx); @@ -935,67 +932,39 @@ template struct BoostGCD { }; using Unit = int64_t; -using Ratio = boost::rational;// Rational; - -//double gteMinAreaBox(const PolygonImpl& p) { - -// using GteCoord = ClipperLib::cInt; -// using GtePoint = gte::Vector2; - -// gte::MinimumAreaBox2 mb; - -// std::vector points; -// points.reserve(p.Contour.size()); - -// for(auto& pt : p.Contour) points.emplace_back(GtePoint{GteCoord(pt.X), GteCoord(pt.Y)}); - -// mb(int(points.size()), points.data(), 0, nullptr, true); - -// auto min_area = double(mb.GetArea()); - -// return min_area; -//} +using Ratio = boost::rational; } TEST(RotatingCalipers, MinAreaBBCClk) { -// PolygonImpl poly({{-50, 30}, {-50, -50}, {50, -50}, {50, 50}, {-40, 50}}); - -// PolygonImpl poly({{-50, 0}, {50, 0}, {0, 100}}); - auto u = [](ClipperLib::cInt n) { return n*1000000; }; PolygonImpl poly({ {u(0), u(0)}, {u(4), u(1)}, {u(2), u(4)}}); - long double arearef = refMinAreaBox(poly); long double area = minAreaBoundingBox(poly).area(); -// double gtearea = gteMinAreaBox(poly); ASSERT_LE(std::abs(area - arearef), 500e6 ); -// ASSERT_LE(std::abs(gtearea - arearef), 500 ); -// ASSERT_DOUBLE_EQ(gtearea, arearef); } TEST(RotatingCalipers, AllPrusaMinBB) { - size_t idx = 0; + // /size_t idx = 0; long double err_epsilon = 500e6l; for(ClipperLib::Path rinput : PRINTER_PART_POLYGONS) { -// ClipperLib::Path rinput = PRINTER_PART_POLYGONS[idx]; -// rinput.pop_back(); -// std::reverse(rinput.begin(), rinput.end()); + // ClipperLib::Path rinput = PRINTER_PART_POLYGONS[idx]; + // rinput.pop_back(); + // std::reverse(rinput.begin(), rinput.end()); -// PolygonImpl poly(removeCollinearPoints(rinput, 1000000)); + // PolygonImpl poly(removeCollinearPoints(rinput, 1000000)); PolygonImpl poly(rinput); long double arearef = refMinAreaBox(poly); auto bb = minAreaBoundingBox(rinput); long double area = cast(bb.area()); -// double area = gteMinAreaBox(poly); bool succ = std::abs(arearef - area) < err_epsilon; - std::cout << idx++ << " " << (succ? "ok" : "failed") << " ref: " - << arearef << " actual: " << area << std::endl; + // std::cout << idx++ << " " << (succ? "ok" : "failed") << " ref: " +// << arearef << " actual: " << area << std::endl; ASSERT_TRUE(succ); } @@ -1006,21 +975,20 @@ TEST(RotatingCalipers, AllPrusaMinBB) { PolygonImpl poly(removeCollinearPoints(rinput, 1000000)); - long double arearef = refMinAreaBox(poly); auto bb = minAreaBoundingBox(poly); long double area = cast(bb.area()); -// double area = gteMinAreaBox(poly); + bool succ = std::abs(arearef - area) < err_epsilon; - std::cout << idx++ << " " << (succ? "ok" : "failed") << " ref: " - << arearef << " actual: " << area << std::endl; + // std::cout << idx++ << " " << (succ? "ok" : "failed") << " ref: " +// << arearef << " actual: " << area << std::endl; ASSERT_TRUE(succ); } } int main(int argc, char **argv) { - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); } diff --git a/src/libslic3r/MTUtils.hpp b/src/libslic3r/MTUtils.hpp index b261a79be8..df248ca5d9 100644 --- a/src/libslic3r/MTUtils.hpp +++ b/src/libslic3r/MTUtils.hpp @@ -7,6 +7,9 @@ #include // for std::forward #include +#include "libslic3r.h" +#include "Point.hpp" + namespace Slic3r { /// Handy little spin mutex for the cached meshes. @@ -248,6 +251,94 @@ template inline X ceil_i(X x, Y y) return (x % y) ? x / y + 1 : x / y; } +// A shorter C++14 style form of the enable_if metafunction +template +using enable_if_t = typename std::enable_if::type; + +// ///////////////////////////////////////////////////////////////////////////// +// Type safe conversions to and from scaled and unscaled coordinates +// ///////////////////////////////////////////////////////////////////////////// + +// A meta-predicate which is true for integers wider than or equal to coord_t +template struct is_scaled_coord +{ + static const SLIC3R_CONSTEXPR bool value = + std::is_integral::value && + std::numeric_limits::digits >= + std::numeric_limits::digits; +}; + +// Meta predicates for floating, 'scaled coord' and generic arithmetic types +template +using FloatingOnly = enable_if_t::value, T>; + +template +using ScaledCoordOnly = enable_if_t::value, T>; + +template +using ArithmeticOnly = enable_if_t::value, T>; + +// A shorter form for a generic Eigen vector which is widely used in PrusaSlicer +template +using EigenVec = Eigen::Matrix; + +// Semantics are the following: +// Upscaling (scaled()): only from floating point types (or Vec) to either +// floating point or integer 'scaled coord' coordinates. +// Downscaling (unscaled()): from arithmetic types (or Vec) to either +// floating point only + +// Conversion definition from unscaled to floating point scaled +template, + class = FloatingOnly> +inline SLIC3R_CONSTEXPR Tout scaled(const Tin &v) SLIC3R_NOEXCEPT +{ + return static_cast(v / static_cast(SCALING_FACTOR)); +} + +// Conversion definition from unscaled to integer 'scaled coord'. +// TODO: is the rounding necessary ? Here it is to show that it can be different +// but it does not have to be. Using std::round means loosing noexcept and +// constexpr modifiers +template> +inline SLIC3R_CONSTEXPR ScaledCoordOnly scaled(const Tin &v) SLIC3R_NOEXCEPT +{ + //return static_cast(std::round(v / SCALING_FACTOR)); + return static_cast(v / static_cast(SCALING_FACTOR)); +} + +// Conversion for Eigen vectors (N dimensional points) +template> +inline EigenVec, N> scaled(const EigenVec &v) +{ + return v.template cast() / SCALING_FACTOR; +} + +// Conversion from arithmetic scaled type to floating point unscaled +template, + class = FloatingOnly> +inline SLIC3R_CONSTEXPR Tout unscaled(const Tin &v) SLIC3R_NOEXCEPT +{ + return static_cast(v * static_cast(SCALING_FACTOR)); +} + +// Unscaling for Eigen vectors. Input base type can be arithmetic, output base +// type can only be floating point. +template, + class = FloatingOnly> +inline SLIC3R_CONSTEXPR EigenVec unscaled( + const EigenVec &v) SLIC3R_NOEXCEPT +{ + return v.template cast() * SCALING_FACTOR; +} + } // namespace Slic3r #endif // MTUTILS_HPP diff --git a/src/libslic3r/MinAreaBoundingBox.cpp b/src/libslic3r/MinAreaBoundingBox.cpp index 6fc1b3327a..fafb54a585 100644 --- a/src/libslic3r/MinAreaBoundingBox.cpp +++ b/src/libslic3r/MinAreaBoundingBox.cpp @@ -39,7 +39,7 @@ template<> inline Slic3r::Points& contour(Slic3r::Polygon& sh) { return sh.point template<> inline const Slic3r::Points& contour(const Slic3r::Polygon& sh) { return sh.points; } template<> Slic3r::Points::iterator begin(Slic3r::Points& pts, const PathTag&) { return pts.begin();} -template<> Slic3r::Points::const_iterator cbegin(const Slic3r::Points& pts, const PathTag&) { return pts.begin(); } +template<> Slic3r::Points::const_iterator cbegin(const Slic3r::Points& pts, const PathTag&) { return pts.cbegin(); } template<> Slic3r::Points::iterator end(Slic3r::Points& pts, const PathTag&) { return pts.end();} template<> Slic3r::Points::const_iterator cend(const Slic3r::Points& pts, const PathTag&) { return pts.cend(); } @@ -71,62 +71,67 @@ using Rational = boost::rational<__int128>; MinAreaBoundigBox::MinAreaBoundigBox(const Polygon &p, PolygonLevel pc) { - const Polygon& chull = pc == pcConvex ? p : libnest2d::sl::convexHull(p); - - libnest2d::RotatedBox box = - libnest2d::minAreaBoundingBox(chull); - - m_right = box.right_extent(); - m_bottom = box.bottom_extent(); - m_axis = box.axis(); + const Polygon &chull = pc == pcConvex ? p : + libnest2d::sl::convexHull(p); + + libnest2d::RotatedBox box = + libnest2d::minAreaBoundingBox(chull); + + m_right = libnest2d::cast(box.right_extent()); + m_bottom = libnest2d::cast(box.bottom_extent()); + m_axis = box.axis(); } MinAreaBoundigBox::MinAreaBoundigBox(const ExPolygon &p, PolygonLevel pc) { - const ExPolygon& chull = pc == pcConvex ? p : libnest2d::sl::convexHull(p); - - libnest2d::RotatedBox box = - libnest2d::minAreaBoundingBox(chull); - - m_right = box.right_extent(); - m_bottom = box.bottom_extent(); - m_axis = box.axis(); + const ExPolygon &chull = pc == pcConvex ? p : + libnest2d::sl::convexHull(p); + + libnest2d::RotatedBox box = + libnest2d::minAreaBoundingBox(chull); + + m_right = libnest2d::cast(box.right_extent()); + m_bottom = libnest2d::cast(box.bottom_extent()); + m_axis = box.axis(); } MinAreaBoundigBox::MinAreaBoundigBox(const Points &pts, PolygonLevel pc) { - const Points& chull = pc == pcConvex ? pts : libnest2d::sl::convexHull(pts); - - libnest2d::RotatedBox box = - libnest2d::minAreaBoundingBox(chull); - - m_right = box.right_extent(); - m_bottom = box.bottom_extent(); - m_axis = box.axis(); + const Points &chull = pc == pcConvex ? pts : + libnest2d::sl::convexHull(pts); + + libnest2d::RotatedBox box = + libnest2d::minAreaBoundingBox(chull); + + m_right = libnest2d::cast(box.right_extent()); + m_bottom = libnest2d::cast(box.bottom_extent()); + m_axis = box.axis(); } double MinAreaBoundigBox::angle_to_X() const { double ret = std::atan2(m_axis.y(), m_axis.x()); - auto s = std::signbit(ret); - if(s) ret += 2 * PI; + auto s = std::signbit(ret); + if (s) ret += 2 * PI; return -ret; } long double MinAreaBoundigBox::width() const { - return std::abs(m_bottom) / std::sqrt(libnest2d::pl::magnsq(m_axis)); + return std::abs(m_bottom) / + std::sqrt(libnest2d::pl::magnsq(m_axis)); } long double MinAreaBoundigBox::height() const { - return std::abs(m_right) / std::sqrt(libnest2d::pl::magnsq(m_axis)); + return std::abs(m_right) / + std::sqrt(libnest2d::pl::magnsq(m_axis)); } long double MinAreaBoundigBox::area() const { long double asq = libnest2d::pl::magnsq(m_axis); - return m_bottom * m_right / asq; + return m_bottom * m_right / asq; } void remove_collinear_points(Polygon &p) @@ -138,5 +143,4 @@ void remove_collinear_points(ExPolygon &p) { p = libnest2d::removeCollinearPoints(p, Unit(0)); } - -} +} // namespace Slic3r diff --git a/src/libslic3r/ModelArrange.cpp b/src/libslic3r/ModelArrange.cpp index 36f7e39710..bc0f933d1d 100644 --- a/src/libslic3r/ModelArrange.cpp +++ b/src/libslic3r/ModelArrange.cpp @@ -610,7 +610,7 @@ ShapeData2D projectModelFromTop(const Slic3r::Model &model, if(tolerance > EPSILON) { Polygons pp { p }; - pp = p.simplify(double(scaled(tolerance))); + pp = p.simplify(scaled(tolerance)); if (!pp.empty()) p = pp.front(); } diff --git a/src/libslic3r/SLA/SLABasePool.cpp b/src/libslic3r/SLA/SLABasePool.cpp index 3b199c4ebb..04cbd78243 100644 --- a/src/libslic3r/SLA/SLABasePool.cpp +++ b/src/libslic3r/SLA/SLABasePool.cpp @@ -5,6 +5,7 @@ #include "SLABoostAdapter.hpp" #include "ClipperUtils.hpp" #include "Tesselate.hpp" +#include "MTUtils.hpp" // For debugging: //#include @@ -203,7 +204,7 @@ void offset(ExPolygon& sh, coord_t distance) { } ClipperOffset offs; - offs.ArcTolerance = 0.01*scaled(1.0); + offs.ArcTolerance = scaled(0.01); Paths result; offs.AddPath(ctour, jtRound, etClosedPolygon); offs.AddPaths(holes, jtRound, etClosedPolygon); @@ -351,7 +352,7 @@ Contour3D round_edges(const ExPolygon& base_plate, double x2 = xx*xx; double stepy = std::sqrt(r2 - x2); - offset(ob, s*scaled(xx)); + offset(ob, s * scaled(xx)); wh = ceilheight_mm - radius_mm + stepy; Contour3D pwalls; @@ -375,7 +376,7 @@ Contour3D round_edges(const ExPolygon& base_plate, double xx = radius_mm - i*stepx; double x2 = xx*xx; double stepy = std::sqrt(r2 - x2); - offset(ob, s*scaled(xx)); + offset(ob, s * scaled(xx)); wh = ceilheight_mm - radius_mm - stepy; Contour3D pwalls; @@ -476,7 +477,7 @@ ExPolygons concave_hull(const ExPolygons& polys, double max_dist_mm = 50, double dx = x(c) - x(cc), dy = y(c) - y(cc); double l = std::sqrt(dx * dx + dy * dy); double nx = dx / l, ny = dy / l; - double max_dist = scaled(max_dist_mm); + double max_dist = scaled(max_dist_mm); ExPolygon& expo = punion[idx++]; BoundingBox querybb(expo); @@ -492,7 +493,7 @@ ExPolygons concave_hull(const ExPolygons& polys, double max_dist_mm = 50, ctour.reserve(3); ctour.emplace_back(cc); - Point d(coord_t(scaled(1.)*nx), coord_t(scaled(1.)*ny)); + Point d(scaled(nx), scaled(ny)); ctour.emplace_back(c + Point( -y(d), x(d) )); ctour.emplace_back(c + Point( y(d), -x(d) )); offset(r, scaled(1.)); @@ -529,14 +530,14 @@ void base_plate(const TriangleMesh &mesh, ExPolygons &output, float h, ExPolygons tmp; tmp.reserve(count); for(ExPolygons& o : out) for(ExPolygon& e : o) { - auto&& exss = e.simplify(scaled(0.1)); + auto&& exss = e.simplify(scaled(0.1)); for(ExPolygon& ep : exss) tmp.emplace_back(std::move(ep)); } ExPolygons utmp = unify(tmp); for(auto& o : utmp) { - auto&& smp = o.simplify(scaled(0.1)); + auto&& smp = o.simplify(scaled(0.1)); output.insert(output.end(), smp.begin(), smp.end()); } } diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index c73ae5650d..7ae481ffbf 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -668,7 +668,7 @@ void SLAPrint::process() double ilhd = m_material_config.initial_layer_height.getFloat(); auto ilh = float(ilhd); - auto ilhs = scaled(ilhd); + coord_t ilhs = scaled(ilhd); const size_t objcount = m_objects.size(); static const unsigned min_objstatus = 0; // where the per object operations start @@ -694,17 +694,15 @@ void SLAPrint::process() // We need to prepare the slice index... - double lhd = m_objects.front()->m_config.layer_height.getFloat(); - float lh = float(lhd); - auto lhs = scaled(lhd); - - auto &&bb3d = mesh.bounding_box(); - double minZ = bb3d.min(Z) - po.get_elevation(); - double maxZ = bb3d.max(Z); - auto minZf = float(minZ); - - auto minZs = scaled(minZ); - auto maxZs = scaled(maxZ); + double lhd = m_objects.front()->m_config.layer_height.getFloat(); + float lh = float(lhd); + coord_t lhs = scaled(lhd); + auto && bb3d = mesh.bounding_box(); + double minZ = bb3d.min(Z) - po.get_elevation(); + double maxZ = bb3d.max(Z); + auto minZf = float(minZ); + coord_t minZs = scaled(minZ); + coord_t maxZs = scaled(maxZ); po.m_slice_index.clear(); @@ -1013,9 +1011,6 @@ void SLAPrint::process() using ClipperPolygons = std::vector; namespace sl = libnest2d::shapelike; // For algorithms - // If the raster has vertical orientation, we will flip the coordinates -// bool flpXY = m_printer_config.display_orientation.getInt() == SLADisplayOrientation::sladoPortrait; - // Set up custom union and diff functions for clipper polygons auto polyunion = [] (const ClipperPolygons& subjects) { @@ -1066,8 +1061,8 @@ void SLAPrint::process() const int fade_layers_cnt = m_default_object_config.faded_layers.getInt();// 10 // [3;20] - const double width = scaled(m_printer_config.display_width.getFloat()); - const double height = scaled(m_printer_config.display_height.getFloat()); + const auto width = scaled(m_printer_config.display_width.getFloat()); + const auto height = scaled(m_printer_config.display_height.getFloat()); const double display_area = width*height; // get polygons for all instances in the object @@ -1123,11 +1118,6 @@ void SLAPrint::process() sl::translate(poly, ClipperPoint{instances[i].shift(X), instances[i].shift(Y)}); -// if (flpXY) { -// for(auto& p : poly.Contour) std::swap(p.X, p.Y); -// for(auto& h : poly.Holes) for(auto& p : h) std::swap(p.X, p.Y); -// } - polygons.emplace_back(std::move(poly)); } } diff --git a/src/libslic3r/libslic3r.h b/src/libslic3r/libslic3r.h index 8cafae17cf..dc2b6a4ec0 100644 --- a/src/libslic3r/libslic3r.h +++ b/src/libslic3r/libslic3r.h @@ -61,20 +61,6 @@ typedef double coordf_t; #define SLIC3R_NOEXCEPT noexcept #endif -template inline SLIC3R_CONSTEXPR coord_t scaled(Tf val) -{ - static_assert (std::is_floating_point::value, "Floating point only"); - return coord_t(val / Tf(SCALING_FACTOR)); -} - -template inline SLIC3R_CONSTEXPR Tf unscaled(coord_t val) -{ - static_assert (std::is_floating_point::value, "Floating point only"); - return Tf(val * Tf(SCALING_FACTOR)); -} - -inline SLIC3R_CONSTEXPR float unscaledf(coord_t val) { return unscaled(val); } - inline std::string debug_out_path(const char *name, ...) { char buffer[2048]; From 6ff434aba3367e2111b1ff809ea744ca39347a56 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Wed, 26 Jun 2019 11:10:41 +0200 Subject: [PATCH 51/64] Fixes some ModelArrange warnings --- src/libslic3r/MTUtils.hpp | 9 --------- src/libslic3r/ModelArrange.cpp | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/libslic3r/MTUtils.hpp b/src/libslic3r/MTUtils.hpp index df248ca5d9..70603cd15f 100644 --- a/src/libslic3r/MTUtils.hpp +++ b/src/libslic3r/MTUtils.hpp @@ -242,15 +242,6 @@ template bool all_of(const C &container) }); } -template inline X ceil_i(X x, Y y) -{ - static_assert(std::is_integral::value && - std::is_integral::value && sizeof(X) >= sizeof(Y), - ""); - - return (x % y) ? x / y + 1 : x / y; -} - // A shorter C++14 style form of the enable_if metafunction template using enable_if_t = typename std::enable_if::type; diff --git a/src/libslic3r/ModelArrange.cpp b/src/libslic3r/ModelArrange.cpp index bc0f933d1d..db36653b0f 100644 --- a/src/libslic3r/ModelArrange.cpp +++ b/src/libslic3r/ModelArrange.cpp @@ -62,10 +62,10 @@ std::string toString(const Model& model, bool holes = true) { objinst->transform_mesh(&tmpmesh); ExPolygons expolys = tmpmesh.horizontal_projection(); for(auto& expoly_complex : expolys) { - - auto tmp = expoly_complex.simplify(1.0/SCALING_FACTOR); + + ExPolygons tmp = expoly_complex.simplify(scaled(1.)); if(tmp.empty()) continue; - auto expoly = tmp.front(); + ExPolygon expoly = tmp.front(); expoly.contour.make_clockwise(); for(auto& h : expoly.holes) h.make_counter_clockwise(); @@ -633,8 +633,8 @@ ShapeData2D projectModelFromTop(const Slic3r::Model &model, if(item.vertexCount() > 3) { item.rotation(Geometry::rotation_diff_z(rotation0, objinst->get_rotation())); item.translation({ - ClipperLib::cInt(objinst->get_offset(X)/SCALING_FACTOR), - ClipperLib::cInt(objinst->get_offset(Y)/SCALING_FACTOR) + scaled(objinst->get_offset(X)), + scaled(objinst->get_offset(Y)) }); ret.emplace_back(objinst, item); } @@ -658,8 +658,8 @@ ShapeData2D projectModelFromTop(const Slic3r::Model &model, Item item(std::move(pn)); item.rotation(wti.rotation), item.translation({ - ClipperLib::cInt(wti.pos(0)/SCALING_FACTOR), - ClipperLib::cInt(wti.pos(1)/SCALING_FACTOR) + scaled(wti.pos(0)), + scaled(wti.pos(1)) }); ret.emplace_back(nullptr, item); } @@ -822,7 +822,9 @@ bool arrange(Model &model, // The model with the geometries auto& cfn = stopcondition; - coord_t md = ceil_i(min_obj_distance, 2) - SCALED_EPSILON; + // Integer ceiling the min distance from the bed perimeters + coord_t md = min_obj_distance - SCALED_EPSILON; + md = (md % 2) ? md / 2 + 1 : md / 2; auto binbb = Box({libnest2d::Coord{bbb.min(0)} - md, libnest2d::Coord{bbb.min(1)} - md}, From d845332de1e393e7a0d7f37379f6de0a31b4ee82 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 26 Jun 2019 11:49:02 +0200 Subject: [PATCH 52/64] Fixed a crash when using place to bed function with the layer editing active This was caused by trying to render a deleted layer height profile. Other gizmos were not affected because they are not dragging at the time of their action, so the profile was correctly recalculated for them. --- src/slic3r/GUI/GLCanvas3D.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index c828e0ec66..bed3b754b3 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -457,8 +457,10 @@ void GLCanvas3D::LayersEditing::_render_profile(const Rect& bar_rect) const { //FIXME show some kind of legend. + if (!m_slicing_parameters) + return; + // Make the vertical bar a bit wider so the layer height curve does not touch the edge of the bar region. - assert(m_slicing_parameters != nullptr); float scale_x = bar_rect.get_width() / (float)(1.12 * m_slicing_parameters->max_layer_height); float scale_y = bar_rect.get_height() / m_object_max_z; float x = bar_rect.get_left() + (float)m_slicing_parameters->layer_height * scale_x; From d2136ab6253ced47b6ccca2a9256fb265083d734 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 26 Jun 2019 13:12:25 +0200 Subject: [PATCH 53/64] ObjectList no longer caps number of extruders to 9 (fixes https://github.com/prusa3d/PrusaSlicer/issues/2558) --- src/slic3r/GUI/GUI_ObjectList.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index d7d1a1af7b..e926dcf978 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -460,7 +460,7 @@ void ObjectList::update_extruder_in_config(const wxDataViewItem& item) if (!m_config || selection.empty()) return; - const int extruder = selection.size() > 1 ? 0 : atoi(selection.c_str()); + const int extruder = /*selection.size() > 1 ? 0 : */atoi(selection.c_str()); m_config->set_key_value("extruder", new ConfigOptionInt(extruder)); // update scene From 7e52edb88c411339a0203df3049029f4394b8d7d Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Wed, 26 Jun 2019 13:23:08 +0200 Subject: [PATCH 54/64] Try to supress warnings from bundled IGL under Windows. --- src/libigl/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libigl/CMakeLists.txt b/src/libigl/CMakeLists.txt index 0852fad729..3daac757b1 100644 --- a/src/libigl/CMakeLists.txt +++ b/src/libigl/CMakeLists.txt @@ -10,5 +10,5 @@ if(libigl_FOUND) target_link_libraries(libigl INTERFACE igl::core) else() message(STATUS "IGL NOT found, using bundled version...") - target_include_directories(libigl INTERFACE SYSTEM ${LIBDIR}/libigl) + target_include_directories(libigl SYSTEM BEFORE INTERFACE ${LIBDIR}/libigl) endif() From 624a6aefb4b9dc73aae2e5e95cecd62fc1a78f56 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Wed, 26 Jun 2019 13:29:49 +0200 Subject: [PATCH 55/64] Fixed crashes after loading some AMFs. --- src/libslic3r/Model.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index 596f806710..9d68f7141d 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -1564,8 +1564,10 @@ void ModelVolume::center_geometry_after_creation() Vec3d shift = this->mesh().bounding_box().center(); if (!shift.isApprox(Vec3d::Zero())) { - m_mesh->translate(-(float)shift(0), -(float)shift(1), -(float)shift(2)); - m_convex_hull->translate(-(float)shift(0), -(float)shift(1), -(float)shift(2)); + if (m_mesh) + m_mesh->translate(-(float)shift(0), -(float)shift(1), -(float)shift(2)); + if (m_convex_hull) + m_convex_hull->translate(-(float)shift(0), -(float)shift(1), -(float)shift(2)); translate(shift); } } From a07088a8d99499ef3dd770fb95a83d52e10b60b5 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 26 Jun 2019 14:25:05 +0200 Subject: [PATCH 56/64] #2561 - Fixed freezing of perspective camera when zooming-in --- src/slic3r/GUI/Camera.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index 6cb8ff5201..242d00a071 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -24,7 +24,7 @@ namespace GUI { const double Camera::DefaultDistance = 1000.0; double Camera::FrustrumMinZSize = 50.0; double Camera::FrustrumZMargin = 10.0; -double Camera::FovMinDeg = 5.0; +double Camera::FovMinDeg = 0.5; double Camera::FovMaxDeg = 75.0; Camera::Camera() From dd108f4513c8dcd105dfd8ecd399c36eaa615cfe Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Wed, 26 Jun 2019 14:59:39 +0200 Subject: [PATCH 57/64] Hotfix for inconsistent slice index --- src/libslic3r/MTUtils.hpp | 4 ++-- src/libslic3r/SLAPrint.cpp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/MTUtils.hpp b/src/libslic3r/MTUtils.hpp index 70603cd15f..ce26887f2c 100644 --- a/src/libslic3r/MTUtils.hpp +++ b/src/libslic3r/MTUtils.hpp @@ -286,7 +286,7 @@ template> inline SLIC3R_CONSTEXPR Tout scaled(const Tin &v) SLIC3R_NOEXCEPT { - return static_cast(v / static_cast(SCALING_FACTOR)); + return static_cast(v / static_cast(SCALING_FACTOR)); } // Conversion definition from unscaled to integer 'scaled coord'. @@ -297,7 +297,7 @@ template> inline SLIC3R_CONSTEXPR ScaledCoordOnly scaled(const Tin &v) SLIC3R_NOEXCEPT { //return static_cast(std::round(v / SCALING_FACTOR)); - return static_cast(v / static_cast(SCALING_FACTOR)); + return static_cast(v / static_cast(SCALING_FACTOR)); } // Conversion for Eigen vectors (N dimensional points) diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index 7ae481ffbf..1902e74ae6 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -720,8 +720,9 @@ void SLAPrint::process() if(slindex_it == po.m_slice_index.end()) //TRN To be shown at the status bar on SLA slicing error. - throw std::runtime_error(L("Slicing had to be stopped " - "due to an internal error.")); + throw std::runtime_error( + L("Slicing had to be stopped due to an internal error: " + "Inconsistent slice index.")); po.m_model_height_levels.clear(); po.m_model_height_levels.reserve(po.m_slice_index.size()); From 74b420d608623793f00a94f1cde97c3c1e3c0306 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Wed, 26 Jun 2019 17:06:41 +0200 Subject: [PATCH 58/64] Remove option for igl static build due to Eigen version mismatch . --- deps/CMakeLists.txt | 9 +++++---- deps/deps-unix-common.cmake | 2 +- deps/deps-windows.cmake | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 5bc33c896d..d8e72370b5 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -36,10 +36,11 @@ set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination direct option(DEP_DEBUG "Build debug variants (only applicable on Windows)" ON) option(DEP_WX_STABLE "Build against wxWidgets stable 3.0 as opposed to default 3.1 (Linux only)" OFF) -# IGL static library in release mode produces 50MB binary. On the build server, it should be -# disabled and used in header-only mode. On developer machines, it can be enabled to speed -# up conpilation and suppress warnings coming from IGL. -option(DEP_BUILD_IGL_STATIC "Build IGL as a static library. Might cause link errors and increase binary size." OFF) +# On developer machines, it can be enabled to speed up compilation and suppress warnings coming from IGL. +# FIXME: +# Enabling this option is not safe. IGL will compile itself with its own version of Eigen while +# Slic3r compiles with a different version which will cause runtime errors. +# option(DEP_BUILD_IGL_STATIC "Build IGL as a static library. Might cause link errors and increase binary size." OFF) message(STATUS "PrusaSlicer deps DESTDIR: ${DESTDIR}") message(STATUS "PrusaSlicer deps debug build: ${DEP_DEBUG}") diff --git a/deps/deps-unix-common.cmake b/deps/deps-unix-common.cmake index c44a6ec205..3614e94448 100644 --- a/deps/deps-unix-common.cmake +++ b/deps/deps-unix-common.cmake @@ -54,7 +54,7 @@ ExternalProject_Add(dep_libigl -DLIBIGL_BUILD_PYTHON=OFF -DLIBIGL_BUILD_TESTS=OFF -DLIBIGL_BUILD_TUTORIALS=OFF - -DLIBIGL_USE_STATIC_LIBRARY=${DEP_BUILD_IGL_STATIC} + -DLIBIGL_USE_STATIC_LIBRARY=OFF #${DEP_BUILD_IGL_STATIC} -DLIBIGL_WITHOUT_COPYLEFT=OFF -DLIBIGL_WITH_CGAL=OFF -DLIBIGL_WITH_COMISO=OFF diff --git a/deps/deps-windows.cmake b/deps/deps-windows.cmake index d7daf84253..0b3fcb13c8 100644 --- a/deps/deps-windows.cmake +++ b/deps/deps-windows.cmake @@ -264,7 +264,7 @@ ExternalProject_Add(dep_libigl -DLIBIGL_BUILD_PYTHON=OFF -DLIBIGL_BUILD_TESTS=OFF -DLIBIGL_BUILD_TUTORIALS=OFF - -DLIBIGL_USE_STATIC_LIBRARY=${DEP_BUILD_IGL_STATIC} + -DLIBIGL_USE_STATIC_LIBRARY=OFF #${DEP_BUILD_IGL_STATIC} -DLIBIGL_WITHOUT_COPYLEFT=OFF -DLIBIGL_WITH_CGAL=OFF -DLIBIGL_WITH_COMISO=OFF From ec28e55ff00617b711cd46f0302d93219e3c3702 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Wed, 26 Jun 2019 18:03:13 +0200 Subject: [PATCH 59/64] Get rid of the test.cpp warning --- src/libnest2d/tests/test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libnest2d/tests/test.cpp b/src/libnest2d/tests/test.cpp index 363a3930ce..2f2b9beb59 100644 --- a/src/libnest2d/tests/test.cpp +++ b/src/libnest2d/tests/test.cpp @@ -555,7 +555,7 @@ TEST(GeometryAlgorithms, NestTest) { size_t partsum = std::accumulate(result.begin(), result.end(), size_t(0), - [](int s, + [](size_t s, const decltype( result)::value_type &bin) { return s += bin.size(); From da3583b1db45ede894b5c6345b3fb853b0bb6eac Mon Sep 17 00:00:00 2001 From: bubnikv Date: Thu, 27 Jun 2019 09:48:19 +0200 Subject: [PATCH 60/64] Fix of https://github.com/prusa3d/PrusaSlicer/issues/2516 --- src/libslic3r/Config.cpp | 8 ++++---- src/libslic3r/Config.hpp | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/libslic3r/Config.cpp b/src/libslic3r/Config.cpp index 0738b77c6a..76329cceed 100644 --- a/src/libslic3r/Config.cpp +++ b/src/libslic3r/Config.cpp @@ -732,18 +732,18 @@ bool DynamicConfig::read_cli(int argc, char** argv, t_config_option_keys* extra, } // Store the option value. const bool existing = this->has(opt_key); - if (keys != nullptr && !existing) { + if (keys != nullptr && ! existing) { // Save the order of detected keys. keys->push_back(opt_key); } ConfigOption *opt_base = this->option(opt_key, true); ConfigOptionVectorBase *opt_vector = opt_base->is_vector() ? static_cast(opt_base) : nullptr; if (opt_vector) { + if (! existing) + // remove the default values + opt_vector->clear(); // Vector values will be chained. Repeated use of a parameter will append the parameter or parameters // to the end of the value. - if (!existing) - // remove the default values - opt_vector->deserialize("", true); if (opt_base->type() == coBools) static_cast(opt_base)->values.push_back(!no); else diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index ee4bc4e463..a7192a5583 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -167,8 +167,10 @@ public: // Set a single vector item from either a scalar option or the first value of a vector option.vector of ConfigOptions. // This function is useful to split values from multiple extrder / filament settings into separate configurations. virtual void set_at(const ConfigOption *rhs, size_t i, size_t j) = 0; - + // Resize the vector of values, copy the newly added values from opt_default if provided. virtual void resize(size_t n, const ConfigOption *opt_default = nullptr) = 0; + // Clear the values vector. + virtual void clear() = 0; // Get size of this vector. virtual size_t size() const = 0; @@ -277,6 +279,8 @@ public: } } + // Clear the values vector. + void clear() override { this->values.clear(); } size_t size() const override { return this->values.size(); } bool empty() const override { return this->values.empty(); } From 90d1ac2c8f67329ae2cfeee9bf8ce24086db923a Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 27 Jun 2019 11:25:04 +0200 Subject: [PATCH 61/64] Tech ENABLE_RENDER_PICKING_PASS extended so that user can switch between picking pass texture rendering and regular rendering by pressing [T] key --- src/libslic3r/Technologies.hpp | 2 +- src/slic3r/GUI/GLCanvas3D.cpp | 20 ++++++++++++++++++-- src/slic3r/GUI/GLCanvas3D.hpp | 4 ++++ src/slic3r/GUI/KBShortcutsDialog.cpp | 3 +++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 86a00480b2..f05bc0b577 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -15,7 +15,7 @@ #define ENABLE_RENDER_STATISTICS 0 // Shows an imgui dialog with camera related data #define ENABLE_CAMERA_STATISTICS 0 -// Render the picking pass instead of the main scene +// Render the picking pass instead of the main scene (use [T] key to toggle between regular rendering and picking pass only rendering) #define ENABLE_RENDER_PICKING_PASS 0 diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index c3fd020e00..9bb6f45534 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1224,6 +1224,9 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar , m_cursor_type(Standard) , m_color_by("volume") , m_reload_delayed(false) +#if ENABLE_RENDER_PICKING_PASS + , m_show_picking_texture(false) +#endif // ENABLE_RENDER_PICKING_PASS , m_render_sla_auxiliaries(true) { if (m_canvas != nullptr) { @@ -1627,7 +1630,10 @@ void GLCanvas3D::render() _picking_pass(); } -#if !ENABLE_RENDER_PICKING_PASS +#if ENABLE_RENDER_PICKING_PASS + if (!m_picking_enabled || !m_show_picking_texture) + { +#endif // ENABLE_RENDER_PICKING_PASS // draw scene glsafe(::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)); _render_background(); @@ -1657,7 +1663,9 @@ void GLCanvas3D::render() _render_current_gizmo(); _render_selection_sidebar_hints(); -#endif // !ENABLE_RENDER_PICKING_PASS +#if ENABLE_RENDER_PICKING_PASS + } +#endif // ENABLE_RENDER_PICKING_PASS #if ENABLE_SHOW_CAMERA_TARGET _render_camera_target(); @@ -2399,6 +2407,14 @@ void GLCanvas3D::on_char(wxKeyEvent& evt) case 'k': { m_camera.select_next_type(); m_dirty = true; break; } case 'O': case 'o': { set_camera_zoom(-1.0); break; } +#if ENABLE_RENDER_PICKING_PASS + case 'T': + case 't': { + m_show_picking_texture = !m_show_picking_texture; + m_dirty = true; + break; + } +#endif // ENABLE_RENDER_PICKING_PASS case 'Z': case 'z': { m_selection.is_empty() ? zoom_to_volumes() : zoom_to_selection(); break; } default: { evt.Skip(); break; } diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 5a42879039..c891ed06ff 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -477,6 +477,10 @@ private: GCodePreviewVolumeIndex m_gcode_preview_volume_index; +#if ENABLE_RENDER_PICKING_PASS + bool m_show_picking_texture; +#endif // ENABLE_RENDER_PICKING_PASS + #if ENABLE_RENDER_STATISTICS RenderStats m_render_stats; #endif // ENABLE_RENDER_STATISTICS diff --git a/src/slic3r/GUI/KBShortcutsDialog.cpp b/src/slic3r/GUI/KBShortcutsDialog.cpp index 1af658ed36..955c4b60b9 100644 --- a/src/slic3r/GUI/KBShortcutsDialog.cpp +++ b/src/slic3r/GUI/KBShortcutsDialog.cpp @@ -154,6 +154,9 @@ void KBShortcutsDialog::fill_shortcuts() plater_shortcuts.push_back(Shortcut("I", L("Zoom in"))); plater_shortcuts.push_back(Shortcut("O", L("Zoom out"))); plater_shortcuts.push_back(Shortcut("ESC", L("Unselect gizmo / Clear selection"))); +#if ENABLE_RENDER_PICKING_PASS + plater_shortcuts.push_back(Shortcut("T", L("Toggle picking pass texture rendering on/off"))); +#endif // ENABLE_RENDER_PICKING_PASS m_full_shortcuts.push_back(std::make_pair(_(L("Plater Shortcuts")), std::make_pair(plater_shortcuts, szRight))); From 26c8eed1ae9280e15bf6416a2aa88e0659e1a006 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 27 Jun 2019 14:42:55 +0200 Subject: [PATCH 62/64] Removed memory leaks due to GUI_App::app_config, GUI_App::preset_bundle and GUI_App::preset_updater not being deleted --- src/slic3r/GUI/GUI_App.cpp | 12 ++++++++++++ src/slic3r/GUI/GUI_App.hpp | 1 + 2 files changed, 13 insertions(+) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 4f1c3adc8b..0e79a3d028 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -141,6 +141,18 @@ GUI_App::GUI_App() , m_imgui(new ImGuiWrapper()) {} +GUI_App::~GUI_App() +{ + if (app_config != nullptr) + delete app_config; + + if (preset_bundle != nullptr) + delete preset_bundle; + + if (preset_updater != nullptr) + delete preset_updater; +} + bool GUI_App::OnInit() { try { diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index 3f8b23e2d5..5a4da22d3f 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -95,6 +95,7 @@ public: bool initialized() const { return m_initialized; } GUI_App(); + ~GUI_App(); static unsigned get_colour_approx_luma(const wxColour &colour); static bool dark_mode(); From 97bb4a80cc9dc3a16d940e51974b31fa17e9cc54 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 27 Jun 2019 15:16:36 +0200 Subject: [PATCH 63/64] Removed memory leaks due to Sidebar::priv::object_manipulation, Sidebar::priv::object_settings and Sidebar::priv::frequently_changed_parameters not being deleted --- src/slic3r/GUI/Plater.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 472394d436..65cf326df7 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -614,10 +614,10 @@ struct Sidebar::priv PresetComboBox *combo_printer; wxBoxSizer *sizer_params; - FreqChangedParams *frequently_changed_parameters; - ObjectList *object_list; - ObjectManipulation *object_manipulation; - ObjectSettings *object_settings; + FreqChangedParams *frequently_changed_parameters{ nullptr }; + ObjectList *object_list{ nullptr }; + ObjectManipulation *object_manipulation{ nullptr }; + ObjectSettings *object_settings{ nullptr }; ObjectInfo *object_info; SlicedInfo *sliced_info; @@ -626,10 +626,23 @@ struct Sidebar::priv wxButton *btn_send_gcode; priv(Plater *plater) : plater(plater) {} + ~priv(); void show_preset_comboboxes(); }; +Sidebar::priv::~priv() +{ + if (object_manipulation != nullptr) + delete object_manipulation; + + if (object_settings != nullptr) + delete object_settings; + + if (frequently_changed_parameters != nullptr) + delete frequently_changed_parameters; +} + void Sidebar::priv::show_preset_comboboxes() { const bool showSLA = wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA; From 6cfb9bec363f6d485bcf8b5b73747df8c793e320 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 27 Jun 2019 15:23:03 +0200 Subject: [PATCH 64/64] Removed memory leaks due to Plater::priv::config not being deleted --- src/slic3r/GUI/Plater.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 65cf326df7..a0deb52e32 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1526,6 +1526,7 @@ struct Plater::priv static const std::regex pattern_prusa; priv(Plater *q, MainFrame *main_frame); + ~priv(); void update(bool force_full_scene_refresh = false); void select_view(const std::string& direction); @@ -1795,6 +1796,12 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) camera.set_type(get_config("use_perspective_camera")); } +Plater::priv::~priv() +{ + if (config != nullptr) + delete config; +} + void Plater::priv::update(bool force_full_scene_refresh) { // the following line, when enabled, causes flickering on NVIDIA graphics cards