Moved plugins across to using ReaderWriter::Options* for search paths in addition
to standard osgDB::DataFilePaths
This commit is contained in:
@@ -53,27 +53,27 @@ public:
|
||||
|
||||
virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options)
|
||||
{
|
||||
std::string ext = osgDB::getLowerCaseFileExtension(file);
|
||||
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;
|
||||
|
||||
ReadResult result = readNode_LWO1(fileName,options);
|
||||
if (result.success()) return result;
|
||||
|
||||
if (!options || options->getOptionString() != "USE_OLD_READER") {
|
||||
ReadResult result = readNode_LWO2(fileName, options);
|
||||
if (result.success()) return result;
|
||||
}
|
||||
if (!options || options->getOptionString() != "USE_OLD_READER") {
|
||||
ReadResult result = readNode_LWO2(fileName, options);
|
||||
if (result.success()) return result;
|
||||
}
|
||||
|
||||
return readNode_old_LWO2(fileName, options);
|
||||
return readNode_old_LWO2(fileName, options);
|
||||
}
|
||||
|
||||
lwosg::Converter::Options parse_options(const Options *options) const;
|
||||
lwosg::Converter::Options parse_options(const Options *options) const;
|
||||
|
||||
virtual ReadResult readNode_LWO2(const std::string& fileName, const osgDB::ReaderWriter::Options*);
|
||||
virtual ReadResult readNode_old_LWO2(const std::string& fileName, const osgDB::ReaderWriter::Options*);
|
||||
virtual ReadResult readNode_old_LWO2(const std::string& fileName, const osgDB::ReaderWriter::Options*);
|
||||
virtual ReadResult readNode_LWO1(const std::string& fileName, const osgDB::ReaderWriter::Options*);
|
||||
|
||||
protected:
|
||||
@@ -84,25 +84,25 @@ protected:
|
||||
|
||||
lwosg::Converter::Options ReaderWriterLWO::parse_options(const Options *options) const
|
||||
{
|
||||
lwosg::Converter::Options conv_options;
|
||||
lwosg::Converter::Options conv_options;
|
||||
|
||||
if (options) {
|
||||
std::istringstream iss(options->getOptionString());
|
||||
std::string opt;
|
||||
while (iss >> opt) {
|
||||
if (opt == "FORCE_ARB_COMPRESSION") conv_options.force_arb_compression = true;
|
||||
if (opt == "USE_OSGFX") conv_options.use_osgfx = true;
|
||||
if (opt == "NO_LIGHTMODEL_ATTRIBUTE") conv_options.apply_light_model = false;
|
||||
if (opt == "MAX_TEXTURE_UNITS") {
|
||||
int n;
|
||||
if (iss >> n) {
|
||||
conv_options.max_tex_units = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (options) {
|
||||
std::istringstream iss(options->getOptionString());
|
||||
std::string opt;
|
||||
while (iss >> opt) {
|
||||
if (opt == "FORCE_ARB_COMPRESSION") conv_options.force_arb_compression = true;
|
||||
if (opt == "USE_OSGFX") conv_options.use_osgfx = true;
|
||||
if (opt == "NO_LIGHTMODEL_ATTRIBUTE") conv_options.apply_light_model = false;
|
||||
if (opt == "MAX_TEXTURE_UNITS") {
|
||||
int n;
|
||||
if (iss >> n) {
|
||||
conv_options.max_tex_units = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return conv_options;
|
||||
return conv_options;
|
||||
}
|
||||
|
||||
|
||||
@@ -111,15 +111,15 @@ osgDB::RegisterReaderWriterProxy<ReaderWriterLWO> g_lwoReaderWriterProxy;
|
||||
|
||||
osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO2(const std::string &fileName, const osgDB::ReaderWriter::Options *options)
|
||||
{
|
||||
lwosg::Converter::Options conv_options = parse_options(options);
|
||||
lwosg::Converter::Options conv_options = parse_options(options);
|
||||
|
||||
lwosg::Converter converter(conv_options);
|
||||
osg::ref_ptr<osg::Node> node = converter.convert(fileName);
|
||||
if (node.valid()) {
|
||||
return node.take();
|
||||
}
|
||||
lwosg::Converter converter(conv_options);
|
||||
osg::ref_ptr<osg::Node> node = converter.convert(fileName, options);
|
||||
if (node.valid()) {
|
||||
return node.take();
|
||||
}
|
||||
|
||||
return ReadResult::FILE_NOT_HANDLED;
|
||||
return ReadResult::FILE_NOT_HANDLED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user