diff --git a/code/3rd_QGLViewer/CMakeLists.txt b/code/3rd_QGLViewer/CMakeLists.txt index 1e1c907..b6dbf25 100644 --- a/code/3rd_QGLViewer/CMakeLists.txt +++ b/code/3rd_QGLViewer/CMakeLists.txt @@ -1,9 +1,5 @@ -if(POLICY CMP0048) - cmake_policy(SET CMP0048 NEW) -endif() - -project(libQGLViewer LANGUAGES CXX VERSION 2.9.1) -cmake_minimum_required(VERSION 3.16) +get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) +project(${PROJECT_NAME}) include(../cmake/UseQt.cmake) @@ -37,6 +33,14 @@ set(QGLViewer_SRC "${PROJECT_SOURCE_DIR}/QGLViewer/quaternion.cpp" "${PROJECT_SOURCE_DIR}/QGLViewer/saveSnapshot.cpp" "${PROJECT_SOURCE_DIR}/QGLViewer/vec.cpp") -add_library(3rd_QGLViewer SHARED ${QGLViewer_SRC}) -target_include_directories(3rd_QGLViewer INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) -target_link_libraries(3rd_QGLViewer PUBLIC ${QtLibs} OpenGL::GL OpenGL::GLU) \ No newline at end of file + +add_library(${PROJECT_NAME} STATIC ${QGLViewer_SRC}) +target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(${PROJECT_NAME} PUBLIC ${QtLibs} OpenGL::GL OpenGL::GLU) + +target_compile_definitions(${PROJECT_NAME} PUBLIC QGLVIEWER_STATIC) + +# get a clean windows +if (WIN32 OR MSVC) + target_compile_definitions(${PROJECT_NAME} PUBLIC NOMINMAX) +endif() \ No newline at end of file diff --git a/code/3rd_QGLViewer/QGLViewer/VRender/Vector2.cpp b/code/3rd_QGLViewer/QGLViewer/VRender/Vector2.cpp index 905cf9f..a738d10 100644 --- a/code/3rd_QGLViewer/QGLViewer/VRender/Vector2.cpp +++ b/code/3rd_QGLViewer/QGLViewer/VRender/Vector2.cpp @@ -3,9 +3,6 @@ #include #include -#ifdef WIN32 -# include -#endif using namespace vrender; using namespace std; diff --git a/code/3rd_QGLViewer/QGLViewer/VRender/Vector3.cpp b/code/3rd_QGLViewer/QGLViewer/VRender/Vector3.cpp index 4418f91..81a4a55 100644 --- a/code/3rd_QGLViewer/QGLViewer/VRender/Vector3.cpp +++ b/code/3rd_QGLViewer/QGLViewer/VRender/Vector3.cpp @@ -4,10 +4,6 @@ #include #include -#ifdef WIN32 -# include -#endif - using namespace vrender; using namespace std; diff --git a/code/3rd_QGLViewer/QGLViewer/camera.h b/code/3rd_QGLViewer/QGLViewer/camera.h index 0148532..0574bbe 100644 --- a/code/3rd_QGLViewer/QGLViewer/camera.h +++ b/code/3rd_QGLViewer/QGLViewer/camera.h @@ -1,7 +1,7 @@ #ifndef QGLVIEWER_CAMERA_H #define QGLVIEWER_CAMERA_H -#include "../basic/canvas.h" +#include "../../basic/canvas.h" #include #include "keyFrameInterpolator.h" class QGLViewer; diff --git a/code/3rd_QGLViewer/QGLViewer/manipulatedCameraFrame.cpp b/code/3rd_QGLViewer/QGLViewer/manipulatedCameraFrame.cpp index a9f2fb0..5dd8456 100644 --- a/code/3rd_QGLViewer/QGLViewer/manipulatedCameraFrame.cpp +++ b/code/3rd_QGLViewer/QGLViewer/manipulatedCameraFrame.cpp @@ -443,7 +443,7 @@ void ManipulatedCameraFrame::wheelEvent(QWheelEvent *const event, case QGLViewer::MOVE_BACKWARD: //#CONNECTION# mouseMoveEvent() MOVE_FORWARD case translate( -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) inverseTransformOf(Vec(0.0, 0.0, 0.2 * flySpeed() * event->delta()))); #else inverseTransformOf(Vec(0.0, 0.0, 0.2 * flySpeed() * event->angleDelta().y()))); diff --git a/code/3rd_QGLViewer/QGLViewer/manipulatedFrame.cpp b/code/3rd_QGLViewer/QGLViewer/manipulatedFrame.cpp index dd74fb6..e84cc02 100644 --- a/code/3rd_QGLViewer/QGLViewer/manipulatedFrame.cpp +++ b/code/3rd_QGLViewer/QGLViewer/manipulatedFrame.cpp @@ -263,7 +263,7 @@ qreal ManipulatedFrame::deltaWithPrevPos(QMouseEvent *const event, qreal ManipulatedFrame::wheelDelta(const QWheelEvent *event) const { static const qreal WHEEL_SENSITIVITY_COEF = 8E-4; -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) return event->delta() * wheelSensitivity() * WHEEL_SENSITIVITY_COEF; #else return event->angleDelta().y() * wheelSensitivity() * WHEEL_SENSITIVITY_COEF; diff --git a/code/3rd_QGLViewer/QGLViewer/qglviewer.cpp b/code/3rd_QGLViewer/QGLViewer/qglviewer.cpp index 8073aa5..0e0d713 100644 --- a/code/3rd_QGLViewer/QGLViewer/qglviewer.cpp +++ b/code/3rd_QGLViewer/QGLViewer/qglviewer.cpp @@ -585,7 +585,11 @@ void QGLViewer::setDefaultMouseBindings() { (mh == FRAME) ? frameKeyboardModifiers : cameraKeyboardModifiers; setMouseBinding(modifiers, Qt::LeftButton, mh, ROTATE); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) setMouseBinding(modifiers, Qt::MidButton, mh, ZOOM); +#else + setMouseBinding(modifiers, Qt::MiddleButton, mh, ZOOM); +#endif setMouseBinding(modifiers, Qt::RightButton, mh, TRANSLATE); setMouseBinding(Qt::Key_R, modifiers, Qt::LeftButton, mh, SCREEN_ROTATE); @@ -594,7 +598,11 @@ void QGLViewer::setDefaultMouseBindings() { } // Z o o m o n r e g i o n +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) setMouseBinding(Qt::ShiftModifier, Qt::MidButton, CAMERA, ZOOM_ON_REGION); +#else + setMouseBinding(Qt::ShiftModifier, Qt::MiddleButton, CAMERA, ZOOM_ON_REGION); +#endif // S e l e c t setMouseBinding(Qt::ShiftModifier, Qt::LeftButton, SELECT); @@ -602,7 +610,11 @@ void QGLViewer::setDefaultMouseBindings() { setMouseBinding(Qt::ShiftModifier, Qt::RightButton, RAP_FROM_PIXEL); // D o u b l e c l i c k setMouseBinding(Qt::NoModifier, Qt::LeftButton, ALIGN_CAMERA, true); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) setMouseBinding(Qt::NoModifier, Qt::MidButton, SHOW_ENTIRE_SCENE, true); +#else + setMouseBinding(Qt::NoModifier, Qt::MiddleButton, SHOW_ENTIRE_SCENE, true); +#endif setMouseBinding(Qt::NoModifier, Qt::RightButton, CENTER_SCENE, true); setMouseBinding(frameKeyboardModifiers, Qt::LeftButton, ALIGN_FRAME, true); @@ -1228,7 +1240,11 @@ static QString mouseButtonsString(Qt::MouseButtons b) { result += QGLViewer::tr("Left", "left mouse button"); addAmpersand = true; } +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) if (b & Qt::MidButton) { +#else + if (b & Qt::MiddleButton) { +#endif if (addAmpersand) result += " & "; result += QGLViewer::tr("Middle", "middle mouse button"); @@ -3336,27 +3352,43 @@ void QGLViewer::toggleCameraMode() { camera()->frame()->stopSpinning(); setMouseBinding(modifiers, Qt::LeftButton, CAMERA, MOVE_FORWARD); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) setMouseBinding(modifiers, Qt::MidButton, CAMERA, LOOK_AROUND); +#else + setMouseBinding(modifiers, Qt::MiddleButton, CAMERA, LOOK_AROUND); +#endif setMouseBinding(modifiers, Qt::RightButton, CAMERA, MOVE_BACKWARD); setMouseBinding(Qt::Key_R, modifiers, Qt::LeftButton, CAMERA, ROLL); setMouseBinding(Qt::NoModifier, Qt::LeftButton, NO_CLICK_ACTION, true); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) setMouseBinding(Qt::NoModifier, Qt::MidButton, NO_CLICK_ACTION, true); +#else + setMouseBinding(Qt::NoModifier, Qt::MiddleButton, NO_CLICK_ACTION, true); +#endif setMouseBinding(Qt::NoModifier, Qt::RightButton, NO_CLICK_ACTION, true); setWheelBinding(modifiers, CAMERA, MOVE_FORWARD); } else { // Should stop flyTimer. But unlikely and not easy. setMouseBinding(modifiers, Qt::LeftButton, CAMERA, ROTATE); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) setMouseBinding(modifiers, Qt::MidButton, CAMERA, ZOOM); +#else + setMouseBinding(modifiers, Qt::MiddleButton, CAMERA, ZOOM); +#endif setMouseBinding(modifiers, Qt::RightButton, CAMERA, TRANSLATE); setMouseBinding(Qt::Key_R, modifiers, Qt::LeftButton, CAMERA, SCREEN_ROTATE); setMouseBinding(Qt::NoModifier, Qt::LeftButton, ALIGN_CAMERA, true); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) setMouseBinding(Qt::NoModifier, Qt::MidButton, SHOW_ENTIRE_SCENE, true); +#else + setMouseBinding(Qt::NoModifier, Qt::MiddleButton, SHOW_ENTIRE_SCENE, true); +#endif setMouseBinding(Qt::NoModifier, Qt::RightButton, CENTER_SCENE, true); setWheelBinding(modifiers, CAMERA, ZOOM); diff --git a/code/3rd_QGLViewer/QGLViewer/qglviewer.h b/code/3rd_QGLViewer/QGLViewer/qglviewer.h index 0b27621..d5e51e1 100644 --- a/code/3rd_QGLViewer/QGLViewer/qglviewer.h +++ b/code/3rd_QGLViewer/QGLViewer/qglviewer.h @@ -2,7 +2,7 @@ #define QGLVIEWER_QGLVIEWER_H #include "camera.h" -#include "../basic/canvas.h" +#include "../../basic/canvas.h" #include #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) diff --git a/code/3rd_QGLViewer/QGLViewer/saveSnapshot.cpp b/code/3rd_QGLViewer/QGLViewer/saveSnapshot.cpp index 4ea90a1..f1c7237 100644 --- a/code/3rd_QGLViewer/QGLViewer/saveSnapshot.cpp +++ b/code/3rd_QGLViewer/QGLViewer/saveSnapshot.cpp @@ -52,7 +52,7 @@ Then calls setSnapshotFormat() with the selected one (unless the user cancels). Returns \c false if the user presses the Cancel button and \c true otherwise. */ bool QGLViewer::openSnapshotFormatDialog() { bool ok = false; -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) QStringList list = formats.split(";;", QString::SkipEmptyParts); #else QStringList list = formats.split(";;", Qt::SkipEmptyParts); @@ -543,7 +543,7 @@ void QGLViewer::saveSnapshot(bool automatic, bool overwrite) { this, "Choose a file name to save under", snapshotFileName(), formats, &selectedFormat, overwrite ? QFileDialog::DontConfirmOverwrite - : QFlags(0)); + : QFlags()); setSnapshotFormat(Qtformat[selectedFormat]); if (checkFileName(fileName, this, snapshotFormat())) diff --git a/code/PolyFit/paint_canvas.cpp b/code/PolyFit/paint_canvas.cpp index 1317631..097fe9d 100644 --- a/code/PolyFit/paint_canvas.cpp +++ b/code/PolyFit/paint_canvas.cpp @@ -233,7 +233,7 @@ void PaintCanvas::draw() { mesh_render_->draw(optimized_mesh_, interacting); } - const static QFont font("Helvetica", 12/*, QFont::Bold*/); // "Times", "Helvetica", "Bradley Hand ITC" + const static QFont font("Times", 12/*, QFont::Bold*/); // "Times", "Helvetica", "Bradley Hand ITC" if (show_hint_text_) { if (!hint_text_.isEmpty()) { glColor3f(0, 0, 0.7f); @@ -245,10 +245,13 @@ void PaintCanvas::draw() { if (show_mouse_hint_) { glColor3f(0, 0, 0); - drawText(30, 120, "Mouse Operations:", font); - drawText(30, 150, " - Orbit: left button", font); - drawText(30, 180, " - Pan: right button", font); - drawText(30, 210, " - Zoom: wheel", font); + drawText(30, 100, "Mouse Operations:", font); + glColor3f(0, 0, 0); + drawText(30, 130, " - Orbit: left button", font); + glColor3f(0, 0, 0); + drawText(30, 160, " - Pan: right button", font); + glColor3f(0, 0, 0); + drawText(30, 190, " - Zoom: wheel", font); } // Liangliang: It seems the renderText() func disables multi-sample and depth test @@ -606,7 +609,6 @@ void PaintCanvas::optimization() { FaceSelection selector(point_set_, mesh); selector.optimize(adjacency, main_window_->active_solver()); - // to have consistent orientation for the final model adjacency = hypothesis_->extract_adjacency(mesh); selector.re_orient(adjacency, main_window_->active_solver()); diff --git a/code/method/alpha_shape_CGAL4.11_and_later.h b/code/method/alpha_shape_CGAL4.11_and_later.h index 550ae65..66f0907 100644 --- a/code/method/alpha_shape_CGAL4.11_and_later.h +++ b/code/method/alpha_shape_CGAL4.11_and_later.h @@ -80,8 +80,8 @@ class Alpha_shape_2 : public Dt typedef Type_of_alpha FT; //check simplices are correctly instantiated - static_assert( (boost::is_same::value) ); - static_assert( (boost::is_same::value) ); + static_assert( (boost::is_same::value), "NT type in Dt::Face does not match NT" ); + static_assert( (boost::is_same::value), "NT type in Dt::Vertex does not match NT"); typedef typename Dt::Point Point;