From Serge Lages, introduce readRef*File() methods which pass back ref_ptr<> rather than C pointers.

This commit is contained in:
Robert Osfield
2007-12-12 17:04:48 +00:00
parent 88f3a864ac
commit 256391c3b4
10 changed files with 248 additions and 8 deletions

View File

@@ -344,7 +344,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
_activeGraphicsContexts.end(),
bind1st(mem_fun(&osg::Texture::getTextureObject),
texture))
== _activeGraphicsContexts.size());
== (int)_activeGraphicsContexts.size());
}
inline static bool isCompiled(const osg::StateSet* stateSet,
@@ -376,7 +376,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
_activeGraphicsContexts.end(),
bind1st(mem_fun(&osg::Texture::getTextureObject),
texture))
!= _activeGraphicsContexts.size()))
!= (int)_activeGraphicsContexts.size()))
return false;
}
return true;
@@ -402,7 +402,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
_activeGraphicsContexts.end(),
bind1st(mem_fun(&osg::Drawable::getDisplayList),
drawable))
== _activeGraphicsContexts.size());
== (int)_activeGraphicsContexts.size());
}
return true;
}

View File

@@ -46,7 +46,6 @@ inline osg::Object* readObjectFile(const std::string& filename)
return readObjectFile(filename,Registry::instance()->getOptions());
}
/** Read an osg::Image from file.
* Return valid osg::Image on success,
* return NULL on failure.
@@ -133,6 +132,88 @@ inline osg::Node* readNodeFiles(osg::ArgumentParser& parser)
return readNodeFiles(parser,Registry::instance()->getOptions());
}
/** Read an osg::Object from file.
* Return an assigned osg::ref_ptr on success,
* return an osg::ref_ptr with a NULL pointer assigned to it on failure.
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
* for the filename extension, and this plugin then handles the request
* to read the specified file.*/
extern OSGDB_EXPORT osg::ref_ptr<osg::Object> readRefObjectFile(const std::string& filename,const ReaderWriter::Options* options);
/** Read an osg::Object from file.
* Return an assigned osg::ref_ptr on success,
* return an osg::ref_ptr with a NULL pointer assigned to it on failure.
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
* for the filename extension, and this plugin then handles the request
* to read the specified file.*/
inline osg::ref_ptr<osg::Object> readRefObjectFile(const std::string& filename)
{
return readRefObjectFile(filename,Registry::instance()->getOptions());
}
/** Read an osg::Image from file.
* Return an assigned osg::ref_ptr on success,
* return an osg::ref_ptr with a NULL pointer assigned to it on failure.
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
* for the filename extension, and this plugin then handles the request
* to read the specified file.*/
extern OSGDB_EXPORT osg::ref_ptr<osg::Image> readRefImageFile(const std::string& filename,const ReaderWriter::Options* options);
/** Read an osg::Image from file.
* Return an assigned osg::ref_ptr on success,
* return an osg::ref_ptr with a NULL pointer assigned to it on failure.
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
* for the filename extension, and this plugin then handles the request
* to read the specified file.*/
inline osg::ref_ptr<osg::Image> readRefImageFile(const std::string& filename)
{
return readRefImageFile(filename,Registry::instance()->getOptions());
}
/** Read an osg::HeightField from file.
* Return an assigned osg::ref_ptr on success,
* return an osg::ref_ptr with a NULL pointer assigned to it on failure.
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
* for the filename extension, and this plugin then handles the request
* to read the specified file.*/
extern OSGDB_EXPORT osg::ref_ptr<osg::HeightField> readRefHeightFieldFile(const std::string& filename,const ReaderWriter::Options* options);
/** Read an osg::HeightField from file.
* Return an assigned osg::ref_ptr on success,
* return an osg::ref_ptr with a NULL pointer assigned to it on failure.
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
* for the filename extension, and this plugin then handles the request
* to read the specified file.*/
inline osg::ref_ptr<osg::HeightField> readRefHeightFieldFile(const std::string& filename)
{
return readRefHeightFieldFile(filename,Registry::instance()->getOptions());
}
/** Read an osg::Node from file.
* Return an assigned osg::ref_ptr on success,
* return an osg::ref_ptr with a NULL pointer assigned to it on failure.
* Use the Options object to control cache operations and file search paths in osgDB::Registry.
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
* for the filename extension, and this plugin then handles the request
* to read the specified file.*/
extern OSGDB_EXPORT osg::ref_ptr<osg::Node> readRefNodeFile(const std::string& filename,const ReaderWriter::Options* options);
/** Read an osg::Node from file.
* Return an assigned osg::ref_ptr on success,
* return an osg::ref_ptr with a NULL pointer assigned to it on failure.
* The osgDB::Registry is used to load the appropriate ReaderWriter plugin
* for the filename extension, and this plugin then handles the request
* to read the specified file.*/
inline osg::ref_ptr<osg::Node> readRefNodeFile(const std::string& filename)
{
return readRefNodeFile(filename,Registry::instance()->getOptions());
}
}
#endif

View File

@@ -59,6 +59,10 @@ extern OSGTEXT_EXPORT Font* readFontFile(const std::string& filename, const osgD
/** read a font from specified stream.*/
extern OSGTEXT_EXPORT Font* readFontStream(std::istream& stream, const osgDB::ReaderWriter::Options* userOptions = 0);
extern OSGTEXT_EXPORT osg::ref_ptr<Font> readRefFontFile(const std::string& filename, const osgDB::ReaderWriter::Options* userOptions = 0);
extern OSGTEXT_EXPORT osg::ref_ptr<Font> readRefFontStream(std::istream& stream, const osgDB::ReaderWriter::Options* userOptions = 0);
extern OSGTEXT_EXPORT std::string findFontFile(const std::string& str);
/** Pure virtual base class for fonts.

View File

@@ -54,6 +54,10 @@ extern OSGTEXT_EXPORT Font3D* readFont3DFile(const std::string& filename, const
/** read a font from specified stream.*/
extern OSGTEXT_EXPORT Font3D* readFont3DStream(std::istream& stream, const osgDB::ReaderWriter::Options* userOptions = 0);
extern OSGTEXT_EXPORT osg::ref_ptr<Font3D> readRefFont3DFile(const std::string& filename, const osgDB::ReaderWriter::Options* userOptions = 0);
extern OSGTEXT_EXPORT osg::ref_ptr<Font3D> readRefFont3DStream(std::istream& stream, const osgDB::ReaderWriter::Options* userOptions = 0);
extern OSGTEXT_EXPORT std::string findFont3DFile(const std::string& str);
/** Pure virtual base class for fonts.