Moved plugins across to using ReaderWriter::Options* for search paths in addition

to standard osgDB::DataFilePaths
This commit is contained in:
Robert Osfield
2004-11-22 23:54:45 +00:00
parent e54f46f630
commit ce07879e2e
51 changed files with 301 additions and 263 deletions

View File

@@ -446,12 +446,12 @@ osg::Node* ReaderWriterOBJ::convertModelToSceneGraph(obj::Model& model)
// read file and convert to OSG.
osgDB::ReaderWriter::ReadResult ReaderWriterOBJ::readNode(const std::string& file, const osgDB::ReaderWriter::Options*)
osgDB::ReaderWriter::ReadResult ReaderWriterOBJ::readNode(const std::string& file, const osgDB::ReaderWriter::Options* options)
{
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;
@@ -461,7 +461,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterOBJ::readNode(const std::string& fil
obj::Model model;
model.setDatabasePath(osgDB::getFilePath(fileName.c_str()));
model.readOBJ(fin);
model.readOBJ(fin, options);
osg::Node* node = convertModelToSceneGraph(model);
return node;
@@ -470,12 +470,12 @@ osgDB::ReaderWriter::ReadResult ReaderWriterOBJ::readNode(const std::string& fil
return ReadResult::FILE_NOT_HANDLED;
}
osgDB::ReaderWriter::ReadResult ReaderWriterOBJ::readNode(std::istream& fin, const Options*)
osgDB::ReaderWriter::ReadResult ReaderWriterOBJ::readNode(std::istream& fin, const Options* options)
{
if (fin)
{
obj::Model model;
model.readOBJ(fin);
model.readOBJ(fin, options);
osg::Node* node = convertModelToSceneGraph(model);
return node;

View File

@@ -260,7 +260,7 @@ bool Model::readMTL(std::istream& fin)
return true;
}
bool Model::readOBJ(std::istream& fin)
bool Model::readOBJ(std::istream& fin, const osgDB::ReaderWriter::Options* options)
{
osg::notify(osg::INFO)<<"Reading OBJ file"<<std::endl;
@@ -390,7 +390,7 @@ bool Model::readOBJ(std::istream& fin)
else if (strncmp(line,"mtllib ",7)==0)
{
std::string fileName = osgDB::findDataFile( line+7 );
std::string fileName = osgDB::findDataFile( line+7, options );
if (!fileName.empty())
{
std::ifstream mfin(fileName.c_str());

View File

@@ -25,6 +25,8 @@
#include <osg/Vec3>
#include <osg/Vec4>
#include <osgDB/ReaderWriter>
namespace obj
{
@@ -157,7 +159,7 @@ public:
const std::string& getDatabasePath() const { return databasePath; }
bool readMTL(std::istream& fin);
bool readOBJ(std::istream& fin);
bool readOBJ(std::istream& fin, const osgDB::ReaderWriter::Options* options);
bool readline(std::istream& fin, char* line, const int LINE_SIZE);
void addElement(Element* element);