From b55ed0c56ba54f46284b08afc5cc3a672b6aba39 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sat, 13 Sep 2008 13:38:06 +0000 Subject: [PATCH] Added reading of whole directories of images --- examples/osgvolume/osgvolume.cpp | 52 ++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/examples/osgvolume/osgvolume.cpp b/examples/osgvolume/osgvolume.cpp index 671ddcaaf..dbad28ea8 100644 --- a/examples/osgvolume/osgvolume.cpp +++ b/examples/osgvolume/osgvolume.cpp @@ -51,6 +51,7 @@ #include +#include #include @@ -1847,8 +1848,55 @@ int main( int argc, char **argv ) { if (!arguments.isOption(pos)) { - // not an option so assume string is a filename. - image_3d = osgDB::readImageFile( arguments[pos]); + std::string filename = arguments[pos]; + + osgDB::FileType fileType = osgDB::fileType(filename); + if (fileType == osgDB::FILE_NOT_FOUND) + { + filename = osgDB::findDataFile(filename); + fileType = osgDB::fileType(filename); + } + + if (fileType == osgDB::DIRECTORY) + { + osgDB::DirectoryContents contents = osgDB::getDirectoryContents(filename); + + std::sort(contents.begin(), contents.end()); + + ImageList imageList; + for(osgDB::DirectoryContents::iterator itr = contents.begin(); + itr != contents.end(); + ++itr) + { + std::string localFile = filename + "/" + *itr; + std::cout<<"contents = "<