Skip to content

Commit

Permalink
fix Qt5 build failure
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed May 26, 2018
1 parent 13a4f84 commit ba99fff
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/Gui/CMakeLists.txt
Expand Up @@ -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
Expand All @@ -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}
Expand Down
35 changes: 20 additions & 15 deletions src/Gui/NaviCube.cpp
Expand Up @@ -75,16 +75,13 @@
# include <Inventor/SoPickedPoint.h>
# include <Inventor/VRMLnodes/SoVRMLGroup.h>
# include <QEventLoop>
# include <QGLFramebufferObject>
# include <QGLPixelBuffer>
# include <QKeyEvent>
# include <QWheelEvent>
# include <QMessageBox>
# include <QTimer>
# include <QStatusBar>
# include <QBitmap>
# include <QMimeData>
# include <MainWindow.h>
#endif

#include <sstream>
Expand All @@ -98,6 +95,7 @@
#include "View3DInventorViewer.h"
#include "View3DInventor.h"
#include "Application.h"
#include "MainWindow.h"
#include "MDIView.h"
#include "Command.h"

Expand All @@ -110,14 +108,21 @@
#include <QImage>
#include <QPainterPath>
#include <QApplication>
#include <QOpenGLTexture>

#if defined(HAVE_QT5_OPENGL)
# include <QOpenGLTexture>
#else
# include <QGLFramebufferObject>
#endif

//#include <OpenGL/glu.h>
#include <Eigen/Dense>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>


using namespace Eigen;
using namespace std;
using namespace Gui;
Expand Down Expand Up @@ -250,7 +255,7 @@ class NaviCubeImplementation {
bool m_Dragging = false;
bool m_MightDrag = false;

QGLFramebufferObject* m_PickingFramebuffer;
QtGLFramebufferObject* m_PickingFramebuffer;

bool m_NaviCubeInitialised = false;

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 6 additions & 2 deletions src/Gui/NaviCube.h
Expand Up @@ -23,6 +23,10 @@
#ifndef SRC_GUI_NAVICUBE_H_
#define SRC_GUI_NAVICUBE_H_

#include <CXX/Extensions.hxx>

class SoEvent;

namespace Gui {
class View3DInventorViewer;
}
Expand All @@ -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;
};
Expand Down
1 change: 1 addition & 0 deletions src/Gui/View3DInventorViewer.cpp
Expand Up @@ -537,6 +537,7 @@ void View3DInventorViewer::init()

View3DInventorViewer::~View3DInventorViewer()
{
delete naviCube;
// cleanup
this->backgroundroot->unref();
this->backgroundroot = 0;
Expand Down
1 change: 1 addition & 0 deletions src/Gui/View3DInventorViewer.h
Expand Up @@ -397,6 +397,7 @@ class GuiExport View3DInventorViewer : public Quarter::SoQTQuarterAdaptor, publi
void setCursorRepresentation(int mode);

private:
NaviCube* naviCube;
std::set<ViewProvider*> _ViewProviderSet;
std::map<SoSeparator*,ViewProvider*> _ViewProviderMap;
std::list<GLGraphicsItem*> graphicsItems;
Expand Down

0 comments on commit ba99fff

Please sign in to comment.