Merge branch 'releases/2.2.0' into next
Conflicts: simgear/scene/model/SGPagedLOD.cxx
This commit is contained in:
@@ -54,7 +54,7 @@ void CheckSceneryVisitor::apply(osg::PagedLOD& node)
|
|||||||
// if the DatabasePager would load LODs while the splashscreen
|
// if the DatabasePager would load LODs while the splashscreen
|
||||||
// is there, we could just wait for the models to be loaded
|
// is there, we could just wait for the models to be loaded
|
||||||
// by only setting setLoaded(false) here
|
// by only setting setLoaded(false) here
|
||||||
sgplod->forceLoad(_dbp,_framestamp);
|
sgplod->forceLoad(_dbp,_framestamp, getNodePath());
|
||||||
setLoaded(false);
|
setLoaded(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,37 +61,30 @@ bool SGPagedLOD::addChild(osg::Node *child)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SGPagedLOD::forceLoad(osgDB::DatabasePager *dbp, osg::FrameStamp* framestamp)
|
// Work around interface change in osgDB::DatabasePager::requestNodeFile
|
||||||
|
struct NodePathProxy
|
||||||
|
{
|
||||||
|
NodePathProxy(NodePath& nodePath)
|
||||||
|
: _nodePath(nodePath)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
operator Group* () { return static_cast<Group*>(_nodePath.back()); }
|
||||||
|
operator NodePath& () { return _nodePath; }
|
||||||
|
NodePath& _nodePath;
|
||||||
|
};
|
||||||
|
|
||||||
|
void SGPagedLOD::forceLoad(osgDB::DatabasePager *dbp, FrameStamp* framestamp,
|
||||||
|
NodePath& path)
|
||||||
{
|
{
|
||||||
//SG_LOG(SG_GENERAL, SG_ALERT, "SGPagedLOD::forceLoad(" <<
|
//SG_LOG(SG_GENERAL, SG_ALERT, "SGPagedLOD::forceLoad(" <<
|
||||||
//getFileName(getNumChildren()) << ")");
|
//getFileName(getNumChildren()) << ")");
|
||||||
unsigned childNum = getNumChildren();
|
unsigned childNum = getNumChildren();
|
||||||
setTimeStamp(childNum, 0);
|
setTimeStamp(childNum, 0);
|
||||||
double priority=1.0;
|
double priority=1.0;
|
||||||
#if SG_OSG_MIN_VERSION_REQUIRED(2,9,11)
|
dbp->requestNodeFile(getFileName(childNum), NodePathProxy(path),
|
||||||
// osgDB::DatabasePager::requestNodeFile changed with OSG 2.9.11
|
priority, framestamp,
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
#warning !! Your version of OpenSceneGraph is currently unsupported.
|
|
||||||
#warning !! Use latest stable OSG (2.8.3) or a OSG developer release up to 2.9.10.
|
|
||||||
#warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
#else
|
|
||||||
// Alas! Why is MSVC different (again)? :)
|
|
||||||
#pragma WARNING( Your version of OpenSceneGraph is currently unsupported. )
|
|
||||||
#pragma WARNING( Use latest stable OSG (2.8.3) or a OSG developer release up to 2.9.10. )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//TODO We need to adapt to OSG 2.9.11 (and future releases). This doesn't work yet...
|
|
||||||
dbp->requestNodeFile(getFileName(childNum),this,priority,framestamp,
|
|
||||||
getDatabaseRequest(childNum),
|
getDatabaseRequest(childNum),
|
||||||
_readerWriterOptions.get());
|
_readerWriterOptions.get());
|
||||||
#else
|
|
||||||
// OSG revisions up to 2.9.10
|
|
||||||
dbp->requestNodeFile(getFileName(childNum),this,priority,framestamp,
|
|
||||||
getDatabaseRequest(childNum),
|
|
||||||
_readerWriterOptions.get());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SGPagedLOD_writeLocalData(const Object& obj, osgDB::Output& fw)
|
bool SGPagedLOD_writeLocalData(const Object& obj, osgDB::Output& fw)
|
||||||
|
|||||||
@@ -18,10 +18,13 @@
|
|||||||
#define SGPAGEDLOD_HXX 1
|
#define SGPAGEDLOD_HXX 1
|
||||||
|
|
||||||
#include <simgear/structure/OSGVersion.hxx>
|
#include <simgear/structure/OSGVersion.hxx>
|
||||||
|
|
||||||
|
#define SG_PAGEDLOD_HAS_OPTIONS \
|
||||||
|
(SG_OSG_VERSION >= 29005 \
|
||||||
|
|| (SG_OSG_VERSION < 29000 && SG_OSG_VERSION >= 28003))
|
||||||
|
|
||||||
#include <osg/PagedLOD>
|
#include <osg/PagedLOD>
|
||||||
#if SG_OSG_MIN_VERSION_REQUIRED(2,9,5)
|
#include <osgDB/Registry>
|
||||||
#include <osgDB/Options>
|
|
||||||
#endif
|
|
||||||
#include <osgDB/ReaderWriter>
|
#include <osgDB/ReaderWriter>
|
||||||
#include <simgear/props/props.hxx>
|
#include <simgear/props/props.hxx>
|
||||||
|
|
||||||
@@ -43,26 +46,35 @@ public:
|
|||||||
META_Node(simgear, SGPagedLOD);
|
META_Node(simgear, SGPagedLOD);
|
||||||
|
|
||||||
// virtual void traverse(osg::NodeVisitor& nv);
|
// virtual void traverse(osg::NodeVisitor& nv);
|
||||||
virtual void forceLoad(osgDB::DatabasePager* dbp, osg::FrameStamp* framestamp);
|
virtual void forceLoad(osgDB::DatabasePager* dbp,
|
||||||
|
osg::FrameStamp* framestamp,
|
||||||
|
osg::NodePath& path);
|
||||||
|
|
||||||
// reimplemented to notify the loading through ModelData
|
// reimplemented to notify the loading through ModelData
|
||||||
bool addChild(osg::Node *child);
|
bool addChild(osg::Node *child);
|
||||||
|
|
||||||
void setReaderWriterOptions(osgDB::ReaderWriter::Options *options) {
|
void setReaderWriterOptions(osgDB::ReaderWriter::Options *options) {
|
||||||
_readerWriterOptions = options;
|
|
||||||
options->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_NONE);
|
options->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_NONE);
|
||||||
#if SG_OSG_MIN_VERSION_REQUIRED(2,9,5)
|
#if SG_PAGEDLOD_HAS_OPTIONS
|
||||||
setDatabaseOptions(options);
|
setDatabaseOptions(options);
|
||||||
|
#else
|
||||||
|
_readerWriterOptions = options;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
osgDB::ReaderWriter::Options* getReaderWriterOptions() {
|
osgDB::ReaderWriter::Options* getReaderWriterOptions() {
|
||||||
|
#if SG_PAGEDLOD_HAS_OPTIONS
|
||||||
|
return static_cast<osgDB::ReaderWriter::Options*>(getDatabaseOptions());
|
||||||
|
#else
|
||||||
return _readerWriterOptions.get();
|
return _readerWriterOptions.get();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~SGPagedLOD();
|
virtual ~SGPagedLOD();
|
||||||
|
#if SG_PAGEDLOD_HAS_OPTIONS
|
||||||
osg::ref_ptr<osgDB::ReaderWriter::Options> _readerWriterOptions;
|
osg::ref_ptr<osgDB::ReaderWriter::Options> _readerWriterOptions;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include <simgear/scene/tgdb/obj.hxx>
|
#include <simgear/scene/tgdb/obj.hxx>
|
||||||
class SGReaderWriterBTGOptions : public osgDB::ReaderWriter::Options {
|
class SGReaderWriterBTGOptions : public osgDB::ReaderWriter::Options {
|
||||||
public:
|
public:
|
||||||
|
META_Object(simgear,SGReaderWriterBTGOptions);
|
||||||
SGReaderWriterBTGOptions(const std::string& str = std::string()) :
|
SGReaderWriterBTGOptions(const std::string& str = std::string()) :
|
||||||
osgDB::ReaderWriter::Options(str),
|
osgDB::ReaderWriter::Options(str),
|
||||||
_matlib(0), _calcLights(true),
|
_matlib(0), _calcLights(true),
|
||||||
|
|||||||
Reference in New Issue
Block a user