Raise minimum OSG version to 3.4.1
This commit is contained in:
parent
06e0924bfc
commit
bd666f952e
16 changed files with 8 additions and 114 deletions
|
@ -297,7 +297,7 @@ endif()
|
||||||
# check required dependencies
|
# check required dependencies
|
||||||
find_package(Boost REQUIRED)
|
find_package(Boost REQUIRED)
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
find_package(OpenSceneGraph 3.2.0 REQUIRED
|
find_package(OpenSceneGraph 3.4.1 REQUIRED
|
||||||
osgText
|
osgText
|
||||||
osgSim
|
osgSim
|
||||||
osgDB
|
osgDB
|
||||||
|
|
|
@ -85,11 +85,7 @@ namespace canvas
|
||||||
{
|
{
|
||||||
SGPath valid_path = fgValidatePath(p, false);
|
SGPath valid_path = fgValidatePath(p, false);
|
||||||
if( !valid_path.isNull() )
|
if( !valid_path.isNull() )
|
||||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
|
||||||
return osgDB::readRefImageFile(valid_path.utf8Str());
|
return osgDB::readRefImageFile(valid_path.utf8Str());
|
||||||
#else
|
|
||||||
return osgDB::readRefImageFile(valid_path.utf8Str());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SG_LOG(SG_IO, SG_ALERT, "canvas::Image: reading '" << path << "' denied");
|
SG_LOG(SG_IO, SG_ALERT, "canvas::Image: reading '" << path << "' denied");
|
||||||
}
|
}
|
||||||
|
@ -97,11 +93,7 @@ namespace canvas
|
||||||
{
|
{
|
||||||
SGPath tpath = globals->resolve_resource_path(path);
|
SGPath tpath = globals->resolve_resource_path(path);
|
||||||
if( !tpath.isNull() )
|
if( !tpath.isNull() )
|
||||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
|
||||||
return osgDB::readImageFile(tpath.utf8Str());
|
|
||||||
#else
|
|
||||||
return osgDB::readRefImageFile(tpath.utf8Str());
|
return osgDB::readRefImageFile(tpath.utf8Str());
|
||||||
#endif
|
|
||||||
|
|
||||||
SG_LOG(SG_IO, SG_ALERT, "canvas::Image: No such image: '" << path << "'");
|
SG_LOG(SG_IO, SG_ALERT, "canvas::Image: No such image: '" << path << "'");
|
||||||
}
|
}
|
||||||
|
|
|
@ -577,10 +577,6 @@ int fgMainInit( int argc, char **argv )
|
||||||
SG_LOG( SG_GENERAL, SG_INFO, "Jenkins number/ID " << JENKINS_BUILD_NUMBER << ":"
|
SG_LOG( SG_GENERAL, SG_INFO, "Jenkins number/ID " << JENKINS_BUILD_NUMBER << ":"
|
||||||
<< JENKINS_BUILD_ID);
|
<< JENKINS_BUILD_ID);
|
||||||
|
|
||||||
#if OSG_VERSION_LESS_THAN(3,4,1)
|
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "Minimum supported OpenScenegraph is V3.4.1 - currently using " << osgGetVersion() << " This can cause fatal OSG 'final reference count' errors at runtime");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
flightgear::addSentryTag("jenkins-build-number", std::to_string(JENKINS_BUILD_NUMBER));
|
flightgear::addSentryTag("jenkins-build-number", std::to_string(JENKINS_BUILD_NUMBER));
|
||||||
flightgear::addSentryTag("osg-version", osgGetVersion());
|
flightgear::addSentryTag("osg-version", osgGetVersion());
|
||||||
|
|
||||||
|
|
|
@ -314,13 +314,7 @@ FGPanelNode::drawImplementation(osg::State& state) const
|
||||||
_panel->draw(state);
|
_panel->draw(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::BoundingBox
|
osg::BoundingBox FGPanelNode::computeBoundingBox() const
|
||||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
|
||||||
FGPanelNode::computeBound()
|
|
||||||
#else
|
|
||||||
FGPanelNode::computeBoundingBox()
|
|
||||||
#endif
|
|
||||||
const
|
|
||||||
{
|
{
|
||||||
|
|
||||||
osg::Vec3 coords[3];
|
osg::Vec3 coords[3];
|
||||||
|
|
|
@ -32,13 +32,7 @@ public:
|
||||||
|
|
||||||
void drawImplementation(osg::State& state) const;
|
void drawImplementation(osg::State& state) const;
|
||||||
|
|
||||||
virtual osg::BoundingBox
|
osg::BoundingBox computeBoundingBox() const override;
|
||||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
|
||||||
computeBound()
|
|
||||||
#else
|
|
||||||
computeBoundingBox()
|
|
||||||
#endif
|
|
||||||
const;
|
|
||||||
|
|
||||||
|
|
||||||
/** Return true, FGPanelNode does support accept(PrimitiveFunctor&). */
|
/** Return true, FGPanelNode does support accept(PrimitiveFunctor&). */
|
||||||
|
|
|
@ -27,8 +27,6 @@
|
||||||
#include <osg/Group>
|
#include <osg/Group>
|
||||||
#include <osgDB/DatabasePager>
|
#include <osgDB/DatabasePager>
|
||||||
|
|
||||||
#include <simgear/structure/OSGVersion.hxx>
|
|
||||||
|
|
||||||
namespace flightgear
|
namespace flightgear
|
||||||
{
|
{
|
||||||
class SceneryPager : public osgDB::DatabasePager
|
class SceneryPager : public osgDB::DatabasePager
|
||||||
|
|
|
@ -121,11 +121,8 @@ void FGPgtTerrain::init( osg::Group* terrain ) {
|
||||||
options->setDem(_dem);
|
options->setDem(_dem);
|
||||||
|
|
||||||
SG_LOG(SG_TERRAIN, SG_INFO, "Terrain init - Load w180s90-360x180.pgt" );
|
SG_LOG(SG_TERRAIN, SG_INFO, "Terrain init - Load w180s90-360x180.pgt" );
|
||||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile("w180s90-360x180.pgt", options.get());
|
|
||||||
#else
|
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFile("w180s90-360x180.pgt", options.get());
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFile("w180s90-360x180.pgt", options.get());
|
||||||
#endif
|
|
||||||
if ( loadedModel ) {
|
if ( loadedModel ) {
|
||||||
terrain_branch->addChild( loadedModel.get() );
|
terrain_branch->addChild( loadedModel.get() );
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#include <simgear/props/props_io.hxx> // for copyProperties
|
#include <simgear/props/props_io.hxx> // for copyProperties
|
||||||
#include <simgear/structure/exception.hxx>
|
#include <simgear/structure/exception.hxx>
|
||||||
#include <simgear/structure/OSGUtils.hxx>
|
#include <simgear/structure/OSGUtils.hxx>
|
||||||
#include <simgear/structure/OSGVersion.hxx>
|
|
||||||
#include <simgear/scene/material/EffectCullVisitor.hxx>
|
#include <simgear/scene/material/EffectCullVisitor.hxx>
|
||||||
#include <simgear/scene/util/RenderConstants.hxx>
|
#include <simgear/scene/util/RenderConstants.hxx>
|
||||||
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
|
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#include <simgear/props/props.hxx>
|
#include <simgear/props/props.hxx>
|
||||||
#include <simgear/props/props_io.hxx> // for copyProperties
|
#include <simgear/props/props_io.hxx> // for copyProperties
|
||||||
#include <simgear/structure/OSGUtils.hxx>
|
#include <simgear/structure/OSGUtils.hxx>
|
||||||
#include <simgear/structure/OSGVersion.hxx>
|
|
||||||
#include <simgear/scene/material/EffectCullVisitor.hxx>
|
#include <simgear/scene/material/EffectCullVisitor.hxx>
|
||||||
#include <simgear/scene/util/RenderConstants.hxx>
|
#include <simgear/scene/util/RenderConstants.hxx>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include <osg/Quat>
|
#include <osg/Quat>
|
||||||
#include <osgGA/GUIEventHandler>
|
#include <osgGA/GUIEventHandler>
|
||||||
#include <osgViewer/ViewerEventHandlers>
|
#include <osgViewer/ViewerEventHandlers>
|
||||||
#include <simgear/structure/OSGVersion.hxx>
|
|
||||||
|
|
||||||
#include <Main/fg_os.hxx>
|
#include <Main/fg_os.hxx>
|
||||||
|
|
||||||
|
@ -34,8 +33,8 @@ public:
|
||||||
virtual void init(const osgGA::GUIEventAdapter& ea,
|
virtual void init(const osgGA::GUIEventAdapter& ea,
|
||||||
osgGA::GUIActionAdapter& us);
|
osgGA::GUIActionAdapter& us);
|
||||||
#endif
|
#endif
|
||||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,
|
bool handle(const osgGA::GUIEventAdapter& ea,
|
||||||
osgGA::GUIActionAdapter& us);
|
osgGA::GUIActionAdapter& us) override;
|
||||||
|
|
||||||
void setIdleHandler(fgIdleHandler idleHandler)
|
void setIdleHandler(fgIdleHandler idleHandler)
|
||||||
{
|
{
|
||||||
|
|
|
@ -421,10 +421,8 @@ bool GraphicsWindowQt5::init( Qt::WindowFlags f )
|
||||||
getState()->setGraphicsContext(this);
|
getState()->setGraphicsContext(this);
|
||||||
getState()->setContextID( osg::GraphicsContext::createNewContextID() );
|
getState()->setContextID( osg::GraphicsContext::createNewContextID() );
|
||||||
|
|
||||||
#if OSG_VERSION_GREATER_OR_EQUAL(3, 4, 0)
|
|
||||||
// make sure the event queue has the correct window rectangle size and input range
|
// make sure the event queue has the correct window rectangle size and input range
|
||||||
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -632,10 +630,8 @@ bool GraphicsWindowQt5::realizeImplementation()
|
||||||
_window->show();
|
_window->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OSG_VERSION_GREATER_OR_EQUAL(3, 4, 0)
|
|
||||||
// make sure the event queue has the correct window rectangle size and input range
|
// make sure the event queue has the correct window rectangle size and input range
|
||||||
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
||||||
#endif
|
|
||||||
|
|
||||||
getEventQueue()->getCurrentEventState()->setMouseYOrientation(osgGA::GUIEventAdapter::Y_INCREASING_DOWNWARDS);
|
getEventQueue()->getCurrentEventState()->setMouseYOrientation(osgGA::GUIEventAdapter::Y_INCREASING_DOWNWARDS);
|
||||||
|
|
||||||
|
|
|
@ -57,40 +57,6 @@
|
||||||
|
|
||||||
using namespace flightgear;
|
using namespace flightgear;
|
||||||
|
|
||||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
|
||||||
|
|
||||||
// this class kindly provided by Wojtek Lewandowsk on ths OpenSceneGraph-users
|
|
||||||
// mailing list from his code-archive, it's needed to poke the camera setup
|
|
||||||
// after resizing the FBO backing storage, on OSG 3.2.x
|
|
||||||
|
|
||||||
class PUICamera::UpdateViewportAndFBOAfterTextureResizeCallback : public osg::NodeCallback
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
UpdateViewportAndFBOAfterTextureResizeCallback(bool dirty = false) : _dirty(dirty) {}
|
|
||||||
|
|
||||||
void setDirty(bool dirty) { _dirty = dirty; }
|
|
||||||
bool getDirty() { return _dirty; }
|
|
||||||
|
|
||||||
void operator()(osg::Node *node, osg::NodeVisitor *nv)
|
|
||||||
{
|
|
||||||
if (_dirty)
|
|
||||||
{
|
|
||||||
osgUtil::CullVisitor *cv = static_cast<osgUtil::CullVisitor *>(nv);
|
|
||||||
if (cv && node == cv->getCurrentRenderStage()->getCamera())
|
|
||||||
{
|
|
||||||
cv->getCurrentRenderStage()->setCameraRequiresSetUp(true);
|
|
||||||
_dirty = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
traverse(node, nv);
|
|
||||||
}
|
|
||||||
protected:
|
|
||||||
bool _dirty;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
double static_pixelRatio = 1.0;
|
double static_pixelRatio = 1.0;
|
||||||
|
|
||||||
class PUIDrawable : public osg::Drawable
|
class PUIDrawable : public osg::Drawable
|
||||||
|
@ -326,11 +292,6 @@ void PUICamera::init(osg::Group* parent, osgViewer::Viewer* viewer)
|
||||||
// set the camera's node mask, ensure the pick bit is clear
|
// set the camera's node mask, ensure the pick bit is clear
|
||||||
setNodeMask(SG_NODEMASK_GUI_BIT);
|
setNodeMask(SG_NODEMASK_GUI_BIT);
|
||||||
|
|
||||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
|
||||||
_resizeCullCallback = new UpdateViewportAndFBOAfterTextureResizeCallback;
|
|
||||||
setCullCallback(_resizeCullCallback);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// geode+drawable to call puDisplay, as a child of this FBO-camera
|
// geode+drawable to call puDisplay, as a child of this FBO-camera
|
||||||
osg::Geode* geode = new osg::Geode;
|
osg::Geode* geode = new osg::Geode;
|
||||||
geode->setName("PUIDrawableGeode");
|
geode->setName("PUIDrawableGeode");
|
||||||
|
@ -393,13 +354,9 @@ void PUICamera::resizeUi(int width, int height)
|
||||||
const int scaledHeight = static_cast<int>(height / static_pixelRatio);
|
const int scaledHeight = static_cast<int>(height / static_pixelRatio);
|
||||||
|
|
||||||
setViewport(0, 0, scaledWidth, scaledHeight);
|
setViewport(0, 0, scaledWidth, scaledHeight);
|
||||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
|
||||||
manuallyResizeFBO(scaledWidth, scaledHeight);
|
|
||||||
_resizeCullCallback->setDirty(true);
|
|
||||||
#else
|
|
||||||
osg::Camera::resize(scaledWidth, scaledHeight);
|
osg::Camera::resize(scaledWidth, scaledHeight);
|
||||||
resizeAttachments(scaledWidth, scaledHeight);
|
resizeAttachments(scaledWidth, scaledHeight);
|
||||||
#endif
|
|
||||||
|
|
||||||
const float puiZ = 1.0;
|
const float puiZ = 1.0;
|
||||||
// resize the full-screen quad
|
// resize the full-screen quad
|
||||||
|
|
|
@ -49,10 +49,6 @@ public:
|
||||||
void init(osg::Group* parent, osgViewer::Viewer* viewer);
|
void init(osg::Group* parent, osgViewer::Viewer* viewer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
|
||||||
class UpdateViewportAndFBOAfterTextureResizeCallback;
|
|
||||||
UpdateViewportAndFBOAfterTextureResizeCallback* _resizeCullCallback = nullptr;
|
|
||||||
#endif
|
|
||||||
void manuallyResizeFBO(int width, int height);
|
void manuallyResizeFBO(int width, int height);
|
||||||
|
|
||||||
osg::Texture2D* _fboTexture = nullptr;
|
osg::Texture2D* _fboTexture = nullptr;
|
||||||
|
|
|
@ -86,13 +86,10 @@ SplashScreen::~SplashScreen()
|
||||||
void SplashScreen::createNodes()
|
void SplashScreen::createNodes()
|
||||||
{
|
{
|
||||||
std::string splashImage = selectSplashImage();
|
std::string splashImage = selectSplashImage();
|
||||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
|
||||||
_splashImage = osgDB::readImageFile(splashImage);
|
|
||||||
#else
|
|
||||||
osg::ref_ptr<SGReaderWriterOptions> staticOptions = SGReaderWriterOptions::copyOrCreate(osgDB::Registry::instance()->getOptions());
|
osg::ref_ptr<SGReaderWriterOptions> staticOptions = SGReaderWriterOptions::copyOrCreate(osgDB::Registry::instance()->getOptions());
|
||||||
staticOptions->setLoadOriginHint(SGReaderWriterOptions::LoadOriginHint::ORIGIN_SPLASH_SCREEN);
|
staticOptions->setLoadOriginHint(SGReaderWriterOptions::LoadOriginHint::ORIGIN_SPLASH_SCREEN);
|
||||||
_splashImage = osgDB::readRefImageFile(splashImage, staticOptions);
|
_splashImage = osgDB::readRefImageFile(splashImage, staticOptions);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!_splashImage){
|
if (!_splashImage){
|
||||||
SG_LOG(SG_VIEW, SG_INFO, "Splash Image " << splashImage << " failed to load");
|
SG_LOG(SG_VIEW, SG_INFO, "Splash Image " << splashImage << " failed to load");
|
||||||
|
@ -307,11 +304,7 @@ void SplashScreen::setupLogoImage()
|
||||||
osg::ref_ptr<simgear::SGReaderWriterOptions> staticOptions = simgear::SGReaderWriterOptions::copyOrCreate(osgDB::Registry::instance()->getOptions());
|
osg::ref_ptr<simgear::SGReaderWriterOptions> staticOptions = simgear::SGReaderWriterOptions::copyOrCreate(osgDB::Registry::instance()->getOptions());
|
||||||
staticOptions->setLoadOriginHint(simgear::SGReaderWriterOptions::LoadOriginHint::ORIGIN_SPLASH_SCREEN);
|
staticOptions->setLoadOriginHint(simgear::SGReaderWriterOptions::LoadOriginHint::ORIGIN_SPLASH_SCREEN);
|
||||||
|
|
||||||
#if OSG_VERSION_LESS_THAN(3, 4, 0)
|
|
||||||
_logoImage = osgDB::readImageFile(logoPath.utf8Str(), staticOptions);
|
|
||||||
#else
|
|
||||||
_logoImage = osgDB::readRefImageFile(logoPath.utf8Str(), staticOptions);
|
_logoImage = osgDB::readRefImageFile(logoPath.utf8Str(), staticOptions);
|
||||||
#endif
|
|
||||||
if (!_logoImage) {
|
if (!_logoImage) {
|
||||||
SG_LOG(SG_VIEW, SG_INFO, "Splash logo image " << logoPath << " failed to load");
|
SG_LOG(SG_VIEW, SG_INFO, "Splash logo image " << logoPath << " failed to load");
|
||||||
return;
|
return;
|
||||||
|
@ -590,11 +583,7 @@ void SplashScreen::resize( int width, int height )
|
||||||
_height = height;
|
_height = height;
|
||||||
|
|
||||||
_splashQuadCamera->setViewport(0, 0, width, height);
|
_splashQuadCamera->setViewport(0, 0, width, height);
|
||||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
|
||||||
manuallyResizeFBO(width, height);
|
|
||||||
#else
|
|
||||||
_splashFBOCamera->resizeAttachments(width, height);
|
_splashFBOCamera->resizeAttachments(width, height);
|
||||||
#endif
|
|
||||||
_splashFBOCamera->setViewport(0, 0, width, height);
|
_splashFBOCamera->setViewport(0, 0, width, height);
|
||||||
_splashFBOCamera->setProjectionMatrixAsOrtho2D(-width * 0.5, width * 0.5,
|
_splashFBOCamera->setProjectionMatrixAsOrtho2D(-width * 0.5, width * 0.5,
|
||||||
-height * 0.5, height * 0.5);
|
-height * 0.5, height * 0.5);
|
||||||
|
|
|
@ -553,12 +553,8 @@ Viewer::insertSceneData(const std::string& fileName, const osgDB::Options* optio
|
||||||
proxyNode->setFileName(0, fileName);
|
proxyNode->setFileName(0, fileName);
|
||||||
insertSceneData(proxyNode);
|
insertSceneData(proxyNode);
|
||||||
return true;
|
return true;
|
||||||
#else
|
|
||||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
|
||||||
osg::ref_ptr<osg::Node> node = osgDB::readNodeFile(fileName, options);
|
|
||||||
#else
|
#else
|
||||||
osg::ref_ptr<osg::Node> node = osgDB::readRefNodeFile(fileName, options);
|
osg::ref_ptr<osg::Node> node = osgDB::readRefNodeFile(fileName, options);
|
||||||
#endif
|
|
||||||
if (!node.valid())
|
if (!node.valid())
|
||||||
return false;
|
return false;
|
||||||
insertSceneData(node.get());
|
insertSceneData(node.get());
|
||||||
|
|
|
@ -254,19 +254,11 @@ main(int argc, char** argv)
|
||||||
osg::ref_ptr<osg::Node> loadedModel;
|
osg::ref_ptr<osg::Node> loadedModel;
|
||||||
if (1 < arguments.argc()) {
|
if (1 < arguments.argc()) {
|
||||||
// read the scene from the list of file specified command line args.
|
// read the scene from the list of file specified command line args.
|
||||||
#if OSG_VERSION_LESS_THAN(3,4,1)
|
|
||||||
loadedModel = osgDB::readNodeFiles(arguments, options.get());
|
|
||||||
#else
|
|
||||||
loadedModel = osgDB::readRefNodeFiles(arguments, options.get());
|
loadedModel = osgDB::readRefNodeFiles(arguments, options.get());
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
// if no arguments given resort to the whole world scenery
|
// if no arguments given resort to the whole world scenery
|
||||||
options->setPluginStringData("SimGear::FG_EARTH", "ON");
|
options->setPluginStringData("SimGear::FG_EARTH", "ON");
|
||||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
|
||||||
loadedModel = osgDB::readNodeFile("w180s90-360x180.spt", options.get());
|
|
||||||
#else
|
|
||||||
loadedModel = osgDB::readRefNodeFile("w180s90-360x180.spt", options.get());
|
loadedModel = osgDB::readRefNodeFile("w180s90-360x180.spt", options.get());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if no model has been successfully loaded report failure.
|
// if no model has been successfully loaded report failure.
|
||||||
|
|
Loading…
Add table
Reference in a new issue