1
0
Fork 0

Merge branch 'next-2' into multiplayer-dev

# Conflicts:
#	utils/fgqcanvas/CMakeLists.txt
This commit is contained in:
Richard Harrison 2017-02-15 05:19:12 +01:00
commit 41ecfd1972
30 changed files with 123 additions and 62 deletions

View file

@ -178,7 +178,6 @@ option(SYSTEM_FLITE "Set to ON to build Flightgear with the system's Flite
option(SYSTEM_HTS_ENGINE "Set to ON to build Flightgear with the system's HTS Engine library" ${SYSTEM_HTS_ENGINE_DEFAULT}) option(SYSTEM_HTS_ENGINE "Set to ON to build Flightgear with the system's HTS Engine library" ${SYSTEM_HTS_ENGINE_DEFAULT})
option(FG_NIGHTLY "Set to ON to mark this as a nightly build" OFF) option(FG_NIGHTLY "Set to ON to mark this as a nightly build" OFF)
option(ENABLE_DEV_WARNINGS "Set to ON to include developer-warnings" OFF) option(ENABLE_DEV_WARNINGS "Set to ON to include developer-warnings" OFF)
option(ENABLE_SIMD "Enable SSE/SSE2 support for x86 compilers" ON)
# additional utilities # additional utilities
option(ENABLE_FGELEV "Set to ON to build the fgelev application (default)" ON) option(ENABLE_FGELEV "Set to ON to build the fgelev application (default)" ON)
@ -265,7 +264,7 @@ if (MSVC)
if (CRASHRPT_FOUND) if (CRASHRPT_FOUND)
set(HAVE_CRASHRPT 1) set(HAVE_CRASHRPT 1)
message(STATUS "Using CrashRpt") message(STATUS "Using CrashRpt")
include_directories( ${CRASHRPT_INCLUDE_DIR}) include_directories( ${CRASHRPT_INCLUDE_DIR})
endif() endif()
endif() endif()
@ -358,6 +357,12 @@ else()
message(STATUS "RTI: DISABLED") message(STATUS "RTI: DISABLED")
endif(ENABLE_RTI) endif(ENABLE_RTI)
if (ENABLE_SIMD)
message(STATUS "SSE/SSE2 support: ENABLED")
else()
message(STATUS "SSE/SSE2 support: DISABLED")
endif()
if(CMAKE_COMPILER_IS_GNUCXX) if(CMAKE_COMPILER_IS_GNUCXX)
set(WARNING_FLAGS_CXX "-Wall") set(WARNING_FLAGS_CXX "-Wall")
set(WARNING_FLAGS_C "-Wall") set(WARNING_FLAGS_C "-Wall")

View file

@ -31,7 +31,7 @@
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
#include <simgear/props/props_io.hxx> #include <simgear/props/props_io.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/math/sg_geodesy.hxx> #include <simgear/math/sg_geodesy.hxx>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/structure/SGSharedPtr.hxx> #include <simgear/structure/SGSharedPtr.hxx>

View file

@ -31,7 +31,7 @@
#include <simgear/constants.h> #include <simgear/constants.h>
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>
#include <simgear/props/props_io.hxx> #include <simgear/props/props_io.hxx>
#include <simgear/misc/gzcontainerfile.hxx> #include <simgear/io/iostreams/gzcontainerfile.hxx>
#include <simgear/misc/sg_dir.hxx> #include <simgear/misc/sg_dir.hxx>
#include <simgear/misc/stdint.hxx> #include <simgear/misc/stdint.hxx>
#include <simgear/misc/strutils.hxx> #include <simgear/misc/strutils.hxx>

View file

@ -37,7 +37,7 @@
#include <simgear/constants.h> #include <simgear/constants.h>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/strutils.hxx> #include <simgear/misc/strutils.hxx>
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>

View file

@ -66,6 +66,16 @@ FGODGauge::~FGODGauge()
} }
/*
* Used to remember the located groups that require modification
*/
typedef struct {
typedef osg::ref_ptr<osg::Group> GroupPtr;
GroupPtr parent;
GroupPtr node;
int unit;
}GroupListItem;
/** /**
* Replace a texture in the airplane model with the gauge texture. * Replace a texture in the airplane model with the gauge texture.
*/ */
@ -182,40 +192,62 @@ class ReplaceStaticTextureVisitor:
if( !osgDB::equalCaseInsensitive(_tex_name, tex_name_simple) ) if( !osgDB::equalCaseInsensitive(_tex_name, tex_name_simple) )
continue; continue;
} }
/*
// insert a new group between the geode an it's parent which overrides * remember this group for modification once the scenegraph has been traversed
// the texture */
GroupPtr group = new osg::Group; GroupListItem gli;
group->setName("canvas texture group"); gli.node = eg;
group->addChild(eg); gli.parent = parent;
parent->removeChild(eg); gli.unit = unit;
parent->addChild(group); groups_to_modify.push_back(gli);
return;
if( _cull_callback )
group->setCullCallback(_cull_callback);
osg::StateSet* stateSet = group->getOrCreateStateSet();
stateSet->setTextureAttribute( unit, _new_texture,
osg::StateAttribute::OVERRIDE );
stateSet->setTextureMode( unit, GL_TEXTURE_2D,
osg::StateAttribute::ON );
_placements.push_back( simgear::canvas::PlacementPtr(
new simgear::canvas::ObjectPlacement(_node, group, _canvas)
));
SG_LOG
(
SG_GL,
SG_INFO,
"Replaced texture '" << _tex_name << "'"
<< " for object '" << parent->getName() << "'"
<< (!_parent_name.empty() ? " with parent '" + _parent_name + "'"
: "")
);
return;
} }
} }
/*
* this section of code used to be in the apply method above, however to work this requires modification of the scenegraph nodes
* that are currently iterating, so instead the apply method will locate the groups to be modified and when finished then the
* nodes can actually be modified safely. Initially found thanks to the debug RTL in MSVC2015 throwing an exception.
*/
void modify_groups()
{
for (GroupList::iterator group_iterator = groups_to_modify.begin(); group_iterator != groups_to_modify.end(); group_iterator++) {
GroupPtr eg = group_iterator->node;
GroupPtr parent = group_iterator->parent;
int unit = group_iterator->unit;
// insert a new group between the geode an it's parent which overrides
// the texture
GroupPtr group = new osg::Group;
group->setName("canvas texture group");
group->addChild(eg);
parent->removeChild(eg);
parent->addChild(group);
if (_cull_callback)
group->setCullCallback(_cull_callback);
osg::StateSet* stateSet = group->getOrCreateStateSet();
stateSet->setTextureAttribute(unit, _new_texture,
osg::StateAttribute::OVERRIDE);
stateSet->setTextureMode(unit, GL_TEXTURE_2D,
osg::StateAttribute::ON);
_placements.push_back(simgear::canvas::PlacementPtr(
new simgear::canvas::ObjectPlacement(_node, group, _canvas)
));
SG_LOG
(
SG_GL,
SG_INFO,
"Replaced texture '" << _tex_name << "'"
<< " for object '" << parent->getName() << "'"
<< (!_parent_name.empty() ? " with parent '" + _parent_name + "'"
: "")
);
}
groups_to_modify.clear();
}
protected: protected:
@ -227,7 +259,8 @@ class ReplaceStaticTextureVisitor:
SGPropertyNode_ptr _node; SGPropertyNode_ptr _node;
osg::Texture2D *_new_texture; osg::Texture2D *_new_texture;
osg::NodeCallback *_cull_callback; osg::NodeCallback *_cull_callback;
typedef std::vector<GroupListItem> GroupList;
GroupList groups_to_modify;
simgear::canvas::CanvasWeakPtr _canvas; simgear::canvas::CanvasWeakPtr _canvas;
simgear::canvas::Placements _placements; simgear::canvas::Placements _placements;
@ -255,6 +288,7 @@ FGODGauge::set_texture( osg::Node* branch,
{ {
ReplaceStaticTextureVisitor visitor(name, new_texture); ReplaceStaticTextureVisitor visitor(name, new_texture);
branch->accept(visitor); branch->accept(visitor);
visitor.modify_groups();
return visitor.getPlacements(); return visitor.getPlacements();
} }
@ -284,6 +318,7 @@ FGODGauge::set_texture( osg::Node* branch,
cull_callback, cull_callback,
canvas ); canvas );
branch->accept(visitor); branch->accept(visitor);
visitor.modify_groups();
return visitor.getPlacements(); return visitor.getPlacements();
} }

View file

@ -102,6 +102,25 @@ void AddOnsPage::onAddSceneryPath()
{ {
QString path = QFileDialog::getExistingDirectory(this, tr("Choose scenery folder")); QString path = QFileDialog::getExistingDirectory(this, tr("Choose scenery folder"));
if (!path.isEmpty()) { if (!path.isEmpty()) {
// validation
SGPath p(path.toStdString());
SGPath objectsPath = p / "Objects";
SGPath terrainPath = p / "Terrain";
if (!objectsPath.exists() && !terrainPath.exists()) {
QMessageBox mb;
mb.setText(QString("The folder '%1' doesn't appear to contain scenery - add anyway?").arg(path));
mb.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
mb.setDefaultButton(QMessageBox::No);
mb.setInformativeText("Added scenery should contain folders called 'Objects' and / or 'Terrain'");
mb.exec();
if (mb.result() == QMessageBox::No) {
return;
}
}
m_ui->sceneryPathsList->addItem(path); m_ui->sceneryPathsList->addItem(path);
saveSceneryPaths(); saveSceneryPaths();
} }

View file

@ -48,7 +48,7 @@ using std::string;
#include <simgear/constants.h> #include <simgear/constants.h>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>
#include <simgear/props/props_io.hxx> #include <simgear/props/props_io.hxx>

View file

@ -31,7 +31,7 @@
#include <simgear/constants.h> #include <simgear/constants.h>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/props/props_io.hxx> #include <simgear/props/props_io.hxx>
#include <osg/GLU> #include <osg/GLU>

View file

@ -27,7 +27,7 @@
#include <simgear/sg_inlines.h> #include <simgear/sg_inlines.h>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/timing/sg_time.hxx> #include <simgear/timing/sg_time.hxx>
#include <simgear/magvar/magvar.hxx> #include <simgear/magvar/magvar.hxx>
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>

View file

@ -2,7 +2,7 @@
#include <fstream> #include <fstream>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>
#include <Main/fg_init.hxx> #include <Main/fg_init.hxx>

View file

@ -14,7 +14,7 @@
#include <simgear/sg_inlines.h> #include <simgear/sg_inlines.h>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/math/sg_random.h> #include <simgear/math/sg_random.h>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/scene/material/mat.hxx> #include <simgear/scene/material/mat.hxx>
#include <simgear/scene/material/matlib.hxx> #include <simgear/scene/material/matlib.hxx>
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>

View file

@ -58,7 +58,7 @@
#include <simgear/structure/SGPerfMon.hxx> #include <simgear/structure/SGPerfMon.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/misc/sg_dir.hxx> #include <simgear/misc/sg_dir.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/strutils.hxx> #include <simgear/misc/strutils.hxx>
#include <simgear/props/props_io.hxx> #include <simgear/props/props_io.hxx>
#include <simgear/scene/tsync/terrasync.hxx> #include <simgear/scene/tsync/terrasync.hxx>

View file

@ -46,7 +46,7 @@
#include <simgear/math/sg_random.h> #include <simgear/math/sg_random.h>
#include <simgear/props/props_io.hxx> #include <simgear/props/props_io.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/misc/sg_dir.hxx> #include <simgear/misc/sg_dir.hxx>
#include <simgear/scene/material/mat.hxx> #include <simgear/scene/material/mat.hxx>

View file

@ -39,7 +39,7 @@
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/magvar/magvar.hxx> #include <simgear/magvar/magvar.hxx>
#include <simgear/timing/sg_time.hxx> #include <simgear/timing/sg_time.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/strutils.hxx> #include <simgear/misc/strutils.hxx>
#include <simgear/props/props_io.hxx> #include <simgear/props/props_io.hxx>
#include <simgear/xml/easyxml.hxx> #include <simgear/xml/easyxml.hxx>

View file

@ -28,7 +28,7 @@
#include <simgear/sg_inlines.h> #include <simgear/sg_inlines.h>
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>

View file

@ -30,7 +30,7 @@
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/route/waypoint.hxx> #include <simgear/route/waypoint.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>

View file

@ -30,7 +30,7 @@
#include <map> #include <map>
#include <vector> #include <vector>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
//#include "parking.hxx" //#include "parking.hxx"

View file

@ -32,7 +32,7 @@
#include <errno.h> #include <errno.h>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/misc/strutils.hxx> // simgear::strutils::split() #include <simgear/misc/strutils.hxx> // simgear::strutils::split()
#include <simgear/math/sg_geodesy.hxx> #include <simgear/math/sg_geodesy.hxx>

View file

@ -39,7 +39,7 @@
#include <simgear/misc/strutils.hxx> #include <simgear/misc/strutils.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/props/props_io.hxx> #include <simgear/props/props_io.hxx>
#include <simgear/sg_inlines.h> #include <simgear/sg_inlines.h>

View file

@ -26,7 +26,7 @@
#include <istream> #include <istream>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>

View file

@ -30,7 +30,7 @@
#include <simgear/math/sg_geodesy.hxx> #include <simgear/math/sg_geodesy.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <Navaids/NavDataCache.hxx> #include <Navaids/NavDataCache.hxx>

View file

@ -38,7 +38,7 @@
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/magvar/magvar.hxx> #include <simgear/magvar/magvar.hxx>
#include <simgear/timing/sg_time.hxx> #include <simgear/timing/sg_time.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/strutils.hxx> #include <simgear/misc/strutils.hxx>
#include <simgear/props/props_io.hxx> #include <simgear/props/props_io.hxx>

View file

@ -26,7 +26,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <fstream> #include <fstream>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include "antenna.hxx" #include "antenna.hxx"

View file

@ -24,7 +24,7 @@
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
#include <simgear/math/sg_random.h> #include <simgear/math/sg_random.h>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/sg_dir.hxx> #include <simgear/misc/sg_dir.hxx>
#include <simgear/misc/strutils.hxx> #include <simgear/misc/strutils.hxx>
#include <simgear/misc/SimpleMarkdown.hxx> #include <simgear/misc/SimpleMarkdown.hxx>

View file

@ -54,7 +54,7 @@
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/sg_dir.hxx> #include <simgear/misc/sg_dir.hxx>
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
#include <simgear/structure/subsystem_mgr.hxx> #include <simgear/structure/subsystem_mgr.hxx>

View file

@ -7,7 +7,7 @@
#include <iostream> #include <iostream>
#include <simgear/constants.h> #include <simgear/constants.h>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/strutils.hxx> #include <simgear/misc/strutils.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>

View file

@ -9,7 +9,7 @@
#include <simgear/constants.h> #include <simgear/constants.h>
#include <simgear/io/sg_file.hxx> #include <simgear/io/sg_file.hxx>
#include <simgear/math/sg_geodesy.hxx> #include <simgear/math/sg_geodesy.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/strutils.hxx> #include <simgear/misc/strutils.hxx>
#include <simgear/misc/stdint.hxx> #include <simgear/misc/stdint.hxx>

View file

@ -9,7 +9,7 @@
#include <simgear/io/sg_file.hxx> #include <simgear/io/sg_file.hxx>
#include <simgear/math/sg_geodesy.hxx> #include <simgear/math/sg_geodesy.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/strutils.hxx> #include <simgear/misc/strutils.hxx>
#include <simgear/misc/stdint.hxx> #include <simgear/misc/stdint.hxx>

View file

@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_STANDARD_REQUIRED YES)
include(GNUInstallDirs)
project(FGQCanvas) project(FGQCanvas)
find_package(Qt5 5.4 COMPONENTS Widgets WebSockets) find_package(Qt5 5.4 COMPONENTS Widgets WebSockets)
@ -56,4 +58,4 @@ target_include_directories(fgqcanvas PRIVATE ${PROJECT_SOURCE_DIR})
# so ui_foo.h files are found # so ui_foo.h files are found
target_include_directories(fgqcanvas PRIVATE ${PROJECT_BINARY_DIR}) target_include_directories(fgqcanvas PRIVATE ${PROJECT_BINARY_DIR})
install(TARGETS fgqcanvas RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS fgqcanvas RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

View file

@ -52,7 +52,7 @@
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/math/SGGeodesy.hxx> #include <simgear/math/SGGeodesy.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/misc/sgstream.hxx> #include <simgear/io/iostreams/sgstream.hxx>
#include <simgear/misc/ResourceManager.hxx> #include <simgear/misc/ResourceManager.hxx>
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
#include <simgear/props/props_io.hxx> #include <simgear/props/props_io.hxx>