Allow (ab)using findDataFile to also search directories again.

This commit is contained in:
ThorstenB 2012-02-19 14:38:52 +01:00
parent ae0b8eb3b3
commit 2a9d39f201
2 changed files with 8 additions and 5 deletions

View File

@ -243,8 +243,11 @@ void setAttrs(const TexTuple& attrs, Texture* tex,
} else {
osgDB::ReaderWriter::ReadResult result;
result = osgDB::readImageFile(imageName, options);
if (result.success()) {
osg::ref_ptr<osg::Image> image = result.getImage();
osg::ref_ptr<osg::Image> image;
if (result.success())
image = result.getImage();
if (image.valid())
{
image = computeMipmap( image.get(), attrs.get<7>() );
tex->setImage(GL_FRONT_AND_BACK, image.get());
int s = image->s();
@ -360,7 +363,7 @@ osg::Image* make3DNoiseImage(int texSize)
GLubyte *ptr;
double amp = 0.5;
osg::notify(osg::WARN) << "creating 3D noise texture... ";
SG_LOG(SG_INPUT, SG_INFO, "creating 3D noise texture... ");
for (f = 0, inc = 0; f < numOctaves; ++f, frequency *= 2, ++inc, amp *= 0.5)
{
@ -383,7 +386,7 @@ osg::Image* make3DNoiseImage(int texSize)
}
}
osg::notify(osg::WARN) << "DONE" << std::endl;
SG_LOG(SG_INPUT, SG_INFO, "creating 3D noise textures complete!");
return image;
}

View File

@ -71,7 +71,7 @@ std::string SGModelLib::findDataFile(const std::string& file,
if (file.empty())
return file;
SGPath p = ResourceManager::instance()->findPath(file, currentPath);
if (p.exists()&&p.isFile()) {
if (p.exists()) {
return p.str();
}