Commit 90c7131c authored by hengli's avatar hengli

Fixed bug in check for osg/osgEarth dependencies for QGC. The Q3DWidget...

Fixed bug in check for osg/osgEarth dependencies for QGC. The Q3DWidget instance runs if OpenSceneGraph libraries are installed. The terrain feature is enabled if osgEarth libraries are installed.
parent 8e9c932c
......@@ -88,7 +88,7 @@ macx {
}
# GNU/Linux
linux-g++-32 {
linux-g++ {
CONFIG += debug
......@@ -127,16 +127,23 @@ linux-g++-32 {
-lSDL \
-lSDLmain
exists(/usr/lib/osg):exists(/usr/lib/osgEarth) {
message("Building support for OSGEARTH")
DEPENDENCIES_PRESENT += osgearth
# Include OpenSceneGraph and osgEarth libraries
LIBS += -losg \
-losgViewer \
-losgEarth
exists(/usr/include/osg) {
message("Building support for OpenSceneGraph")
DEPENDENCIES_PRESENT += osg
# Include OpenSceneGraph libraries
LIBS += -losg
DEFINES += QGC_OSG_ENABLED
}
exists(/usr/include/osgEarth) {
message("Building support for osgEarth")
DEPENDENCIES_PRESENT += osgearth
# Include osgEarth libraries
LIBS += -losgViewer \
-losgEarth
DEFINES += QGC_OSGEARTH_ENABLED
}
QMAKE_CXXFLAGS += -Wl,-E
#-lflite_cmu_us_rms \
......@@ -181,15 +188,22 @@ linux-g++-64 {
-lSDL \
-lSDLmain
exists(/usr/lib/osg):exists(/usr/lib/osgEarth) {
message("Building support for OSGEARTH")
DEPENDENCIES_PRESENT += osgearth
# Include OpenSceneGraph and osgEarth libraries
LIBS += -losg \
-losgViewer \
-losgEarth
exists(/usr/include/osg) {
message("Building support for OpenSceneGraph")
DEPENDENCIES_PRESENT += osg
# Include OpenSceneGraph libraries
LIBS += -losg
DEFINES += QGC_OSG_ENABLED
}
exists(/usr/include/osgEarth) {
message("Building support for osgEarth")
DEPENDENCIES_PRESENT += osgearth
# Include osgEarth libraries
LIBS += -losgViewer \
-losgEarth
DEFINES += QGC_OSGEARTH_ENABLED
}
}
......
......@@ -68,9 +68,11 @@ Pixhawk3DWidget::Pixhawk3DWidget(QWidget* parent)
trailNode = createTrail();
rollingMap->addChild(trailNode);
#ifdef QGC_OSGEARTH_ENABLED
// generate map model
mapNode = createMap();
root->addChild(mapNode);
#endif
// generate target model
allocentricMap->addChild(createTarget());
......@@ -393,6 +395,7 @@ Pixhawk3DWidget::createTrail(void)
return geode;
}
#ifdef QGC_OSGEARTH_ENABLED
osg::ref_ptr<osgEarth::MapNode>
Pixhawk3DWidget::createMap(void)
{
......@@ -401,6 +404,7 @@ Pixhawk3DWidget::createMap(void)
return node;
}
#endif
osg::ref_ptr<osg::Node>
Pixhawk3DWidget::createTarget(void)
......
......@@ -33,7 +33,10 @@
#define PIXHAWK3DWIDGET_H
#include <osgText/Text>
#ifdef QGC_OSGEARTH_ENABLED
#include <osgEarth/MapNode>
#endif
#include "Q3DWidget.h"
......@@ -73,7 +76,11 @@ protected:
private:
osg::ref_ptr<osg::Geode> createGrid(void);
osg::ref_ptr<osg::Geode> createTrail(void);
#ifdef QGC_OSGEARTH_ENABLED
osg::ref_ptr<osgEarth::MapNode> createMap(void);
#endif
osg::ref_ptr<osg::Node> createTarget(void);
osg::ref_ptr<osg::Group> createWaypoints(void);
......@@ -103,7 +110,9 @@ private:
osg::ref_ptr<osg::Geode> trailNode;
osg::ref_ptr<osg::Geometry> trailGeometry;
osg::ref_ptr<osg::DrawArrays> trailDrawArrays;
#ifdef QGC_OSGEARTH_ENABLED
osg::ref_ptr<osgEarth::MapNode> mapNode;
#endif
osg::ref_ptr<osg::Geode> targetNode;
osg::ref_ptr<osg::PositionAttitudeTransform> targetPosition;
osg::ref_ptr<osg::Group> waypointsNode;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment