From Serge Lages, introduce readRef*File() methods which pass back ref_ptr<> rather than C pointers.
This commit is contained in:
@@ -238,3 +238,35 @@ Node* osgDB::readNodeFiles(osg::ArgumentParser& arguments,const ReaderWriter::Op
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Object> osgDB::readRefObjectFile(const std::string& filename,const ReaderWriter::Options* options)
|
||||
{
|
||||
ReaderWriter::ReadResult rr = Registry::instance()->readObject(filename,options);
|
||||
if (rr.validObject()) return osg::ref_ptr<osg::Object>(rr.getObject());
|
||||
if (rr.error()) notify(WARN) << rr.message() << std::endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Image> osgDB::readRefImageFile(const std::string& filename,const ReaderWriter::Options* options)
|
||||
{
|
||||
ReaderWriter::ReadResult rr = Registry::instance()->readImage(filename,options);
|
||||
if (rr.validImage()) return osg::ref_ptr<osg::Image>(rr.getImage());
|
||||
if (rr.error()) notify(WARN) << rr.message() << std::endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::HeightField> osgDB::readRefHeightFieldFile(const std::string& filename,const ReaderWriter::Options* options)
|
||||
{
|
||||
ReaderWriter::ReadResult rr = Registry::instance()->readHeightField(filename,options);
|
||||
if (rr.validHeightField()) return osg::ref_ptr<osg::HeightField>(rr.getHeightField());
|
||||
if (rr.error()) notify(WARN) << rr.message() << std::endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Node> osgDB::readRefNodeFile(const std::string& filename,const ReaderWriter::Options* options)
|
||||
{
|
||||
ReaderWriter::ReadResult rr = Registry::instance()->readNode(filename,options);
|
||||
if (rr.validNode()) return osg::ref_ptr<osg::Node>(rr.getNode());
|
||||
if (rr.error()) notify(WARN) << rr.message() << std::endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user