scenery: ModelLoadHelper is no longer needed.

This commit is contained in:
Mathias Froehlich 2012-03-15 20:08:38 +01:00
parent 2a2be51b8f
commit 8cb8395a24
2 changed files with 22 additions and 48 deletions

View File

@ -58,8 +58,6 @@
using std::string;
using namespace simgear;
static ModelLoadHelper *_modelLoader=0;
static SGBucket getBucketFromFileName(const std::string& fileName)
{
std::istringstream ss(osgDB::getNameLessExtension(fileName));
@ -152,17 +150,13 @@ loadStgFile(const std::string& absoluteFileName, osg::Group& group, const osgDB:
/// Hmm, the findDataFile should happen downstream
std::string absName = osgDB::findDataFile(name,
staticOptions.get());
if(_modelLoader) {
node = _modelLoader->loadTileModel(absName, false);
} else {
osg::ref_ptr<SGReaderWriterOptions> opt;
opt = new SGReaderWriterOptions(*staticOptions);
if (SGPath(absName).lower_extension() == "ac")
opt->setInstantiateEffects(true);
else
opt->setInstantiateEffects(false);
node = osgDB::readRefNodeFile(absName, opt.get());
}
osg::ref_ptr<SGReaderWriterOptions> opt;
opt = new SGReaderWriterOptions(*staticOptions);
if (SGPath(absName).lower_extension() == "ac")
opt->setInstantiateEffects(true);
else
opt->setInstantiateEffects(false);
node = osgDB::readRefNodeFile(absName, opt.get());
if (!node.valid()) {
SG_LOG( SG_TERRAIN, SG_ALERT, absoluteFileName
@ -171,25 +165,21 @@ loadStgFile(const std::string& absoluteFileName, osg::Group& group, const osgDB:
}
} else if ( token == "OBJECT_SHARED" ) {
if(_modelLoader) {
node = _modelLoader->loadTileModel(name, true);
} else {
osg::ref_ptr<SGReaderWriterOptions> opt;
opt = new SGReaderWriterOptions(*sharedOptions);
/// Hmm, the findDataFile should happen in the downstream readers
std::string absName = osgDB::findDataFile(name, opt.get());
osg::ProxyNode* proxyNode = new osg::ProxyNode;
proxyNode->setLoadingExternalReferenceMode(osg::ProxyNode::DEFER_LOADING_TO_DATABASE_PAGER);
proxyNode->setFileName(0, absName);
if (SGPath(absName).lower_extension() == "ac")
opt->setInstantiateEffects(true);
else
opt->setInstantiateEffects(false);
proxyNode->setDatabaseOptions(opt.get());
node = proxyNode;
}
osg::ref_ptr<SGReaderWriterOptions> opt;
opt = new SGReaderWriterOptions(*sharedOptions);
/// Hmm, the findDataFile should happen in the downstream readers
std::string absName = osgDB::findDataFile(name, opt.get());
osg::ProxyNode* proxyNode = new osg::ProxyNode;
proxyNode->setLoadingExternalReferenceMode(osg::ProxyNode::DEFER_LOADING_TO_DATABASE_PAGER);
proxyNode->setFileName(0, absName);
if (SGPath(absName).lower_extension() == "ac")
opt->setInstantiateEffects(true);
else
opt->setInstantiateEffects(false);
proxyNode->setDatabaseOptions(opt.get());
node = proxyNode;
if (!node.valid()) {
SG_LOG( SG_TERRAIN, SG_ALERT, absoluteFileName
@ -231,12 +221,6 @@ loadStgFile(const std::string& absoluteFileName, osg::Group& group, const osgDB:
return has_base;
}
void
TileEntry::setModelLoadHelper(ModelLoadHelper *m)
{
_modelLoader=m;
}
// Constructor
TileEntry::TileEntry ( const SGBucket& b )
: tile_bucket( b ),

View File

@ -48,8 +48,6 @@
namespace simgear {
class ModelLoadHelper;
/**
* A class to encapsulate everything we need to know about a scenery tile.
*/
@ -89,8 +87,6 @@ public:
// Destructor
~TileEntry();
static void setModelLoadHelper(ModelLoadHelper *m);
// Update the ssg transform node for this tile so it can be
// properly drawn relative to our (0,0,0) point
void prep_ssg_node(float vis);
@ -157,12 +153,6 @@ public:
}
};
class ModelLoadHelper {
public:
virtual osg::Node *loadTileModel(const std::string& modelPath, bool cacheModel)=0;
};
}
#endif // _TILEENTRY_HXX