diff --git a/simgear/scene/material/TextureBuilder.cxx b/simgear/scene/material/TextureBuilder.cxx index fa571912..5634d966 100644 --- a/simgear/scene/material/TextureBuilder.cxx +++ b/simgear/scene/material/TextureBuilder.cxx @@ -257,7 +257,8 @@ bool setAttrs(const TexTuple& attrs, Texture* tex, return false; osgDB::ReaderWriter::ReadResult result; - result = osgDB::readImageFile(imageName, options); + + result = osgDB::readRefImageFile(imageName, options); osg::ref_ptr image; if (result.success()) image = result.getImage(); @@ -590,27 +591,27 @@ Texture* CubeMapBuilder::build(Effect* effect, Pass* pass, const SGPropertyNode* osg::Image* image = result.getImage(); cubeTexture->setImage(TextureCubeMap::POSITIVE_X, image); } - result = osgDB::readImageFile(_tuple.get<1>(), options); + result = osgDB::readRefImageFile(_tuple.get<1>(), options); if(result.success()) { osg::Image* image = result.getImage(); cubeTexture->setImage(TextureCubeMap::NEGATIVE_X, image); } - result = osgDB::readImageFile(_tuple.get<2>(), options); + result = osgDB::readRefImageFile(_tuple.get<2>(), options); if(result.success()) { osg::Image* image = result.getImage(); cubeTexture->setImage(TextureCubeMap::POSITIVE_Y, image); } - result = osgDB::readImageFile(_tuple.get<3>(), options); + result = osgDB::readRefImageFile(_tuple.get<3>(), options); if(result.success()) { osg::Image* image = result.getImage(); cubeTexture->setImage(TextureCubeMap::NEGATIVE_Y, image); } - result = osgDB::readImageFile(_tuple.get<4>(), options); + result = osgDB::readRefImageFile(_tuple.get<4>(), options); if(result.success()) { osg::Image* image = result.getImage(); cubeTexture->setImage(TextureCubeMap::POSITIVE_Z, image); } - result = osgDB::readImageFile(_tuple.get<5>(), options); + result = osgDB::readRefImageFile(_tuple.get<5>(), options); if(result.success()) { osg::Image* image = result.getImage(); cubeTexture->setImage(TextureCubeMap::NEGATIVE_Z, image); @@ -634,7 +635,7 @@ Texture* CubeMapBuilder::build(Effect* effect, Pass* pass, const SGPropertyNode* return cubeTexture.release(); osgDB::ReaderWriter::ReadResult result; - result = osgDB::readImageFile(texname, options); + result = osgDB::readRefImageFile(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 diff --git a/simgear/scene/material/mat.cxx b/simgear/scene/material/mat.cxx index 916d4cbd..ba9d63f7 100644 --- a/simgear/scene/material/mat.cxx +++ b/simgear/scene/material/mat.cxx @@ -227,7 +227,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options, } else { - osg::Image* image = osgDB::readImageFile(fullMaskPath, options); + osg::Image* image = osgDB::readRefImageFile(fullMaskPath, options); if (image && image->valid()) { Texture2DRef object_mask = new osg::Texture2D; diff --git a/simgear/scene/model/SGReaderWriterXML.cxx b/simgear/scene/model/SGReaderWriterXML.cxx index 4c6304ac..f195f2c0 100644 --- a/simgear/scene/model/SGReaderWriterXML.cxx +++ b/simgear/scene/model/SGReaderWriterXML.cxx @@ -335,7 +335,7 @@ sgLoad3DModel_internal(const SGPath& path, options->setDatabasePath(texturepath.local8BitStr()); osgDB::ReaderWriter::ReadResult modelResult; - modelResult = osgDB::readNodeFile(modelpath.local8BitStr(), options.get()); + modelResult = osgDB::readRefNodeFile(modelpath.local8BitStr(), options.get()); if (!modelResult.validNode()) throw sg_io_exception("Failed to load 3D model:" + modelResult.message(), modelpath); diff --git a/simgear/scene/model/model.cxx b/simgear/scene/model/model.cxx index 6b34ea9c..0b86f701 100644 --- a/simgear/scene/model/model.cxx +++ b/simgear/scene/model/model.cxx @@ -43,9 +43,9 @@ SGLoadTexture2D(bool staticTexture, const std::string& path, { osg::Image* image; if (options) - image = osgDB::readImageFile(path, options); + image = osgDB::readRefImageFile(path, options); else - image = osgDB::readImageFile(path); + image = osgDB::readRefImageFile(path); osg::ref_ptr texture = new osg::Texture2D; texture->setImage(image); if (staticTexture) @@ -141,7 +141,7 @@ Texture2D* TextureUpdateVisitor::textureReplace(int unit, const StateAttribute* // If it is empty or they are identical then there is nothing to do if (fullLiveryFile.empty() || fullLiveryFile == *fullFilePath) return 0; - Image* newImage = readImageFile(fullLiveryFile); + Image* newImage = readRefImageFile(fullLiveryFile); if (!newImage) return 0; CopyOp copyOp(CopyOp::DEEP_COPY_ALL & ~CopyOp::DEEP_COPY_IMAGES); diff --git a/simgear/scene/tgdb/ReaderWriterSPT.cxx b/simgear/scene/tgdb/ReaderWriterSPT.cxx index cb6f4df1..39facca1 100644 --- a/simgear/scene/tgdb/ReaderWriterSPT.cxx +++ b/simgear/scene/tgdb/ReaderWriterSPT.cxx @@ -208,7 +208,7 @@ ReaderWriterSPT::readObject(const std::string& fileName, const osgDB::Options* o imageFileName = osgDB::concatPaths(imageFileName, "Globe"); imageFileName = osgDB::concatPaths(imageFileName, "world.topo.bathy.200407.3x4096x2048.png"); } - if (osg::Image* image = osgDB::readImageFile(imageFileName, options)) { + if (osg::Image* image = osgDB::readRefImageFile(imageFileName, options)) { osg::Texture2D* texture = new osg::Texture2D; texture->setImage(image); texture->setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::REPEAT);