From Wang Rui, "I also did a small fix to the ObjectWrapper header, to add a

OSGDB_EXPORT macro to RegisterCompressorProxy, and modified the
findCompressor() method to look for custom compressors in libraries
such like osgdb_compressor_name.so, which was described in the wiki
page chapter 2.4."
This commit is contained in:
Robert Osfield 2010-02-04 10:20:17 +00:00
parent bdcddc10f8
commit 7103707815
2 changed files with 10 additions and 16 deletions

View File

@ -139,7 +139,7 @@ protected:
typedef CLASS MyClass; \
void wrapper_propfunc_##NAME(osgDB::ObjectWrapper* wrapper)
class RegisterCompressorProxy
class OSGDB_EXPORT RegisterCompressorProxy
{
public:
RegisterCompressorProxy( const std::string& name, BaseCompressor* compressor );

View File

@ -490,23 +490,17 @@ BaseCompressor* ObjectWrapperManager::findCompressor( const std::string& name )
if ( itr!=_compressors.end() ) return itr->second.get();
// Load external libraries
std::string::size_type posDoubleColon = name.rfind("::");
if ( posDoubleColon!=std::string::npos )
{
std::string libName = std::string( name, 0, posDoubleColon );
std::string nodeKitLib = osgDB::Registry::instance()->createLibraryNameForNodeKit(name);
if ( osgDB::Registry::instance()->loadLibrary(nodeKitLib)==osgDB::Registry::LOADED )
return findCompressor(name);
std::string nodeKitLib = osgDB::Registry::instance()->createLibraryNameForNodeKit(libName);
if ( osgDB::Registry::instance()->loadLibrary(nodeKitLib)==osgDB::Registry::LOADED )
return findCompressor(name);
std::string pluginLib = osgDB::Registry::instance()->createLibraryNameForExtension(std::string("compressor_")+name);
if ( osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED )
return findCompressor(name);
std::string pluginLib = osgDB::Registry::instance()->createLibraryNameForExtension(std::string("compressor_")+libName);
if ( osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED )
return findCompressor(name);
pluginLib = osgDB::Registry::instance()->createLibraryNameForExtension(libName);
if ( osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED )
return findCompressor(name);
}
pluginLib = osgDB::Registry::instance()->createLibraryNameForExtension(name);
if ( osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED )
return findCompressor(name);
return NULL;
}