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
|
||||
// is there, we could just wait for the models to be loaded
|
||||
// by only setting setLoaded(false) here
|
||||
sgplod->forceLoad(_dbp,_framestamp);
|
||||
sgplod->forceLoad(_dbp,_framestamp, getNodePath());
|
||||
setLoaded(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,37 +61,30 @@ bool SGPagedLOD::addChild(osg::Node *child)
|
||||
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(" <<
|
||||
//getFileName(getNumChildren()) << ")");
|
||||
unsigned childNum = getNumChildren();
|
||||
setTimeStamp(childNum, 0);
|
||||
double priority=1.0;
|
||||
#if SG_OSG_MIN_VERSION_REQUIRED(2,9,11)
|
||||
// osgDB::DatabasePager::requestNodeFile changed with OSG 2.9.11
|
||||
|
||||
#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,
|
||||
dbp->requestNodeFile(getFileName(childNum), NodePathProxy(path),
|
||||
priority, framestamp,
|
||||
getDatabaseRequest(childNum),
|
||||
_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)
|
||||
|
||||
@@ -18,10 +18,13 @@
|
||||
#define SGPAGEDLOD_HXX 1
|
||||
|
||||
#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>
|
||||
#if SG_OSG_MIN_VERSION_REQUIRED(2,9,5)
|
||||
#include <osgDB/Options>
|
||||
#endif
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/ReaderWriter>
|
||||
#include <simgear/props/props.hxx>
|
||||
|
||||
@@ -43,26 +46,35 @@ public:
|
||||
META_Node(simgear, SGPagedLOD);
|
||||
|
||||
// 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
|
||||
bool addChild(osg::Node *child);
|
||||
|
||||
void setReaderWriterOptions(osgDB::ReaderWriter::Options *options) {
|
||||
_readerWriterOptions = options;
|
||||
options->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_NONE);
|
||||
#if SG_OSG_MIN_VERSION_REQUIRED(2,9,5)
|
||||
#if SG_PAGEDLOD_HAS_OPTIONS
|
||||
setDatabaseOptions(options);
|
||||
#else
|
||||
_readerWriterOptions = options;
|
||||
#endif
|
||||
}
|
||||
|
||||
osgDB::ReaderWriter::Options* getReaderWriterOptions() {
|
||||
#if SG_PAGEDLOD_HAS_OPTIONS
|
||||
return static_cast<osgDB::ReaderWriter::Options*>(getDatabaseOptions());
|
||||
#else
|
||||
return _readerWriterOptions.get();
|
||||
#endif
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~SGPagedLOD();
|
||||
#if SG_PAGEDLOD_HAS_OPTIONS
|
||||
osg::ref_ptr<osgDB::ReaderWriter::Options> _readerWriterOptions;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <simgear/scene/tgdb/obj.hxx>
|
||||
class SGReaderWriterBTGOptions : public osgDB::ReaderWriter::Options {
|
||||
public:
|
||||
META_Object(simgear,SGReaderWriterBTGOptions);
|
||||
SGReaderWriterBTGOptions(const std::string& str = std::string()) :
|
||||
osgDB::ReaderWriter::Options(str),
|
||||
_matlib(0), _calcLights(true),
|
||||
|
||||
Reference in New Issue
Block a user