Moved plugins across to using ReaderWriter::Options* for search paths in addition
to standard osgDB::DataFilePaths
This commit is contained in:
@@ -36,13 +36,13 @@ public:
|
||||
std::string ext = osgDB::getLowerCaseFileExtension(file);
|
||||
if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED;
|
||||
|
||||
std::string fileName = osgDB::findDataFile(file);
|
||||
std::string fileName = osgDB::findDataFile(file, options);
|
||||
if (fileName.empty()) return ReadResult::FILE_NOT_FOUND;
|
||||
|
||||
lwosg::SceneLoader::Options conv_options = parse_options(options);
|
||||
|
||||
lwosg::SceneLoader scene_loader(conv_options);
|
||||
osg::ref_ptr<osg::Node> node = scene_loader.load(fileName);
|
||||
osg::ref_ptr<osg::Node> node = scene_loader.load(fileName, options);
|
||||
if (node.valid()) {
|
||||
return node.take();
|
||||
}
|
||||
|
||||
@@ -80,12 +80,12 @@ SceneLoader::SceneLoader(const Options &options)
|
||||
{
|
||||
}
|
||||
|
||||
osg::Group *SceneLoader::load(const std::string &filename, bool search)
|
||||
osg::Group *SceneLoader::load(const std::string &filename, const osgDB::ReaderWriter::Options *options, bool search)
|
||||
{
|
||||
std::string fname;
|
||||
|
||||
if (search) {
|
||||
fname = osgDB::findDataFile(filename);
|
||||
fname = osgDB::findDataFile(filename, options);
|
||||
if (fname.empty()) return 0;
|
||||
} else {
|
||||
fname = filename;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
|
||||
#include <osgDB/ReaderWriter>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@@ -60,7 +62,7 @@ namespace lwosg
|
||||
SceneLoader();
|
||||
SceneLoader(const Options &options);
|
||||
|
||||
osg::Group *load(const std::string &filename, bool search = false);
|
||||
osg::Group *load(const std::string &filename, const osgDB::ReaderWriter::Options *options, bool search = false);
|
||||
|
||||
inline osg::Group *get_root() { return root_.get(); }
|
||||
inline const osg::Group *get_root() const { return root_.get(); }
|
||||
|
||||
Reference in New Issue
Block a user