]> git.mxchange.org Git - simgear.git/commitdiff
Use osgDB::read*File instead of dereferencing the osgDB Registry instance.
authorMathias Froehlich <Mathias.Froehlich@web.de>
Sat, 12 Nov 2011 18:44:56 +0000 (19:44 +0100)
committerMathias Froehlich <Mathias.Froehlich@web.de>
Sun, 13 Nov 2011 17:35:18 +0000 (18:35 +0100)
simgear/scene/material/TextureBuilder.cxx
simgear/scene/model/SGReaderWriterXML.cxx

index 69630b3116428790c0e3ca3cde4fe0782d9cef01..0c141c475c3415b627c354ad8cb53b4a1d52eb69 100644 (file)
@@ -32,6 +32,7 @@
 #include <osg/TextureRectangle>
 #include <osg/TextureCubeMap>
 #include <osgDB/FileUtils>
+#include <osgDB/ReadFile>
 
 #include <boost/lexical_cast.hpp>
 #include <boost/tuple/tuple.hpp>
@@ -240,8 +241,8 @@ void setAttrs(const TexTuple& attrs, Texture* tex,
     if (imageName.empty()) {
         throw BuilderException("no image file");
     } else {
-        osgDB::ReaderWriter::ReadResult result
-            = osgDB::Registry::instance()->readImage(imageName, options);
+        osgDB::ReaderWriter::ReadResult result;
+        result = osgDB::readImageFile(imageName, options);
         if (result.success()) {
             osg::ref_ptr<osg::Image> image = result.getImage();
             image = computeMipmap( image.get(), attrs.get<7>() );
@@ -511,33 +512,33 @@ Texture* CubeMapBuilder::build(Effect* effect, const SGPropertyNode* props,
         cubeTexture->setWrap(osg::Texture3D::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
         cubeTexture->setWrap(osg::Texture3D::WRAP_R, osg::Texture::CLAMP_TO_EDGE);
 
-        osgDB::ReaderWriter::ReadResult result =
-            osgDB::Registry::instance()->readImage(_tuple.get<0>(), options);
+        osgDB::ReaderWriter::ReadResult result;
+        result = osgDB::readImageFile(_tuple.get<0>(), options);
         if(result.success()) {
             osg::Image* image = result.getImage();
             cubeTexture->setImage(TextureCubeMap::POSITIVE_X, image);
         }
-        result = osgDB::Registry::instance()->readImage(_tuple.get<1>(), options);
+        result = osgDB::readImageFile(_tuple.get<1>(), options);
         if(result.success()) {
             osg::Image* image = result.getImage();
             cubeTexture->setImage(TextureCubeMap::NEGATIVE_X, image);
         }
-        result = osgDB::Registry::instance()->readImage(_tuple.get<2>(), options);
+        result = osgDB::readImageFile(_tuple.get<2>(), options);
         if(result.success()) {
             osg::Image* image = result.getImage();
             cubeTexture->setImage(TextureCubeMap::POSITIVE_Y, image);
         }
-        result = osgDB::Registry::instance()->readImage(_tuple.get<3>(), options);
+        result = osgDB::readImageFile(_tuple.get<3>(), options);
         if(result.success()) {
             osg::Image* image = result.getImage();
             cubeTexture->setImage(TextureCubeMap::NEGATIVE_Y, image);
         }
-        result = osgDB::Registry::instance()->readImage(_tuple.get<4>(), options);
+        result = osgDB::readImageFile(_tuple.get<4>(), options);
         if(result.success()) {
             osg::Image* image = result.getImage();
             cubeTexture->setImage(TextureCubeMap::POSITIVE_Z, image);
         }
-        result = osgDB::Registry::instance()->readImage(_tuple.get<5>(), options);
+        result = osgDB::readImageFile(_tuple.get<5>(), options);
         if(result.success()) {
             osg::Image* image = result.getImage();
             cubeTexture->setImage(TextureCubeMap::NEGATIVE_Z, image);
@@ -560,8 +561,8 @@ Texture* CubeMapBuilder::build(Effect* effect, const SGPropertyNode* props,
         if (itr != _crossmaps.end())
             return itr->second.get();
 
-        osgDB::ReaderWriter::ReadResult result =
-            osgDB::Registry::instance()->readImage(texname, options);
+        osgDB::ReaderWriter::ReadResult result;
+        result = osgDB::readImageFile(texname, options);
         if(result.success()) {
             osg::Image* image = result.getImage();
             image->flipVertical();   // Seems like the image coordinates are somewhat funny, flip to get better ones
index 81ccd85a52b49d95d09e128938deeeca2e8ef2d4..2fafbcfa5cc44a6d2a0b7bbff1cf708625a3e783 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <osg/Geode>
 #include <osg/MatrixTransform>
+#include <osgDB/ReadFile>
 #include <osgDB/WriteFile>
 #include <osgDB/Registry>
 #include <osg/Switch>
@@ -280,9 +281,8 @@ sgLoad3DModel_internal(const SGPath& path,
             texturepath = texturepath.dir();
 
         options->setDatabasePath(texturepath.str());
-        osgDB::ReaderWriter::ReadResult modelResult
-            = osgDB::Registry::instance()->readNode(modelpath.str(),
-                                                    options.get());
+        osgDB::ReaderWriter::ReadResult modelResult;
+        modelResult = osgDB::readNodeFile(modelpath.str(), options.get());
         if (!modelResult.validNode())
             throw sg_io_exception("Failed to load 3D model:" + modelResult.message(),
                                   modelpath.str());