From ba99fff1d9618cac61564e05c48ffddd6f8a5f8a Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 25 May 2018 17:57:02 +0200 Subject: [PATCH] fix Qt5 build failure --- src/Gui/CMakeLists.txt | 2 +- src/Gui/NaviCube.cpp | 35 ++++++++++++++++++-------------- src/Gui/NaviCube.h | 8 ++++++-- src/Gui/View3DInventorViewer.cpp | 1 + src/Gui/View3DInventorViewer.h | 1 + 5 files changed, 29 insertions(+), 18 deletions(-) diff --git a/src/Gui/CMakeLists.txt b/src/Gui/CMakeLists.txt index dccfe4dfc292..5e102d2273f4 100644 --- a/src/Gui/CMakeLists.txt +++ b/src/Gui/CMakeLists.txt @@ -27,7 +27,6 @@ if (BUILD_ADDONMGR) endif(BUILD_ADDONMGR) include_directories( - ${EIGEN3_INCLUDE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/Quarter @@ -40,6 +39,7 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR}/Quarter ${CMAKE_CURRENT_BINARY_DIR}/DAGView ${Boost_INCLUDE_DIRS} + ${EIGEN3_INCLUDE_DIR} ${COIN3D_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} ${XercesC_INCLUDE_DIRS} diff --git a/src/Gui/NaviCube.cpp b/src/Gui/NaviCube.cpp index 90540dad1718..4f5b7da32164 100644 --- a/src/Gui/NaviCube.cpp +++ b/src/Gui/NaviCube.cpp @@ -75,8 +75,6 @@ # include # include # include -# include -# include # include # include # include @@ -84,7 +82,6 @@ # include # include # include -# include #endif #include @@ -98,6 +95,7 @@ #include "View3DInventorViewer.h" #include "View3DInventor.h" #include "Application.h" +#include "MainWindow.h" #include "MDIView.h" #include "Command.h" @@ -110,7 +108,13 @@ #include #include #include -#include + +#if defined(HAVE_QT5_OPENGL) +# include +#else +# include +#endif + //#include #include #include @@ -118,6 +122,7 @@ #include #include + using namespace Eigen; using namespace std; using namespace Gui; @@ -250,7 +255,7 @@ class NaviCubeImplementation { bool m_Dragging = false; bool m_MightDrag = false; - QGLFramebufferObject* m_PickingFramebuffer; + QtGLFramebufferObject* m_PickingFramebuffer; bool m_NaviCubeInitialised = false; @@ -372,7 +377,7 @@ QOpenGLTexture* NaviCubeImplementation::createButtonTex(int button) { QPainterPath path; - float as1 = 0.12; // arrow size + float as1 = 0.12f; // arrow size float as3 = as1 / 3; switch (button) { @@ -614,11 +619,11 @@ void NaviCubeImplementation::initNaviCube() { 0, cs, -sn, 0, sn, cs; - m_Textures[TEX_CORNER_FACE] = createCubeFaceTex(0, 0.5, NULL); - m_Textures[TEX_BACK_FACE] = createCubeFaceTex(0.02, 0.3, NULL); + m_Textures[TEX_CORNER_FACE] = createCubeFaceTex(0, 0.5f, NULL); + m_Textures[TEX_BACK_FACE] = createCubeFaceTex(0.02f, 0.3f, NULL); - float gap = 0.12; - float radius = 0.12; + float gap = 0.12f; + float radius = 0.12f; m_Textures[TEX_FRONT] = createCubeFaceTex(gap, radius, "Front"); m_Textures[TEX_REAR] = createCubeFaceTex(gap, radius, "Rear"); @@ -659,8 +664,8 @@ void NaviCubeImplementation::initNaviCube() { z = r45z * r45x * z; x = r45z * r45x * x; - x *= 0.25; // corner face size - z *= 1.45; // corner face position + x *= 0.25f; // corner face size + z *= 1.45f; // corner face position addFace(x, z, TEX_CORNER_FACE, TEX_CORNER_FACE, TEX_CORNER_FACE, TEX_BOTTOM_RIGHT_REAR); @@ -699,7 +704,7 @@ void NaviCubeImplementation::initNaviCube() { m_Buttons.push_back(TEX_ARROW_LEFT); m_Buttons.push_back(TEX_ARROW_RIGHT); - m_PickingFramebuffer = new QGLFramebufferObject(2*m_CubeWidgetSize,2* m_CubeWidgetSize, QGLFramebufferObject::CombinedDepthStencil); + m_PickingFramebuffer = new QtGLFramebufferObject(2*m_CubeWidgetSize,2* m_CubeWidgetSize, QtGLFramebufferObject::CombinedDepthStencil); } void NaviCubeImplementation::drawNaviCube() { @@ -825,7 +830,7 @@ void NaviCubeImplementation::drawNaviCube(bool pickMode) { if (!pickMode) { // Draw the axes glDisable(GL_TEXTURE_2D); - float a=1.1; + float a=1.1f; static GLubyte xbmp[] = { 0x11,0x11,0x0a,0x04,0x0a,0x11,0x11 }; glColor3f(1, 0, 0); @@ -1053,7 +1058,7 @@ bool NaviCubeImplementation::mouseReleased(short x, short y) { m_MouseDown = false; if (!m_Dragging) { float rot = 45 ; //30; - float tilt = 90-54.7356 ; //30; // 90 + deg(asin(-sqrt(1.0/3.0))) + float tilt = 90-54.7356f ; //30; // 90 + deg(asin(-sqrt(1.0/3.0))) int pick = pickFace(x,y); switch (pick) { default: diff --git a/src/Gui/NaviCube.h b/src/Gui/NaviCube.h index 3f9b7555c3da..f520210ee049 100644 --- a/src/Gui/NaviCube.h +++ b/src/Gui/NaviCube.h @@ -23,6 +23,10 @@ #ifndef SRC_GUI_NAVICUBE_H_ #define SRC_GUI_NAVICUBE_H_ +#include + +class SoEvent; + namespace Gui { class View3DInventorViewer; } @@ -33,8 +37,8 @@ class NaviCube { public: NaviCube(Gui::View3DInventorViewer* viewer) ; virtual ~NaviCube(); - void drawNaviCube() ; - bool processSoEvent(const SoEvent* ev) ; + void drawNaviCube(); + bool processSoEvent(const SoEvent* ev); private: NaviCubeImplementation* m_NaviCubeImplementation; }; diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index e1322f71f70e..cb1c7d97403a 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -537,6 +537,7 @@ void View3DInventorViewer::init() View3DInventorViewer::~View3DInventorViewer() { + delete naviCube; // cleanup this->backgroundroot->unref(); this->backgroundroot = 0; diff --git a/src/Gui/View3DInventorViewer.h b/src/Gui/View3DInventorViewer.h index a54bcba375bc..17d9b810a5cd 100644 --- a/src/Gui/View3DInventorViewer.h +++ b/src/Gui/View3DInventorViewer.h @@ -397,6 +397,7 @@ class GuiExport View3DInventorViewer : public Quarter::SoQTQuarterAdaptor, publi void setCursorRepresentation(int mode); private: + NaviCube* naviCube; std::set _ViewProviderSet; std::map _ViewProviderMap; std::list graphicsItems;