| 1850 | | // not an option so assume string is a filename. |
| 1851 | | image_3d = osgDB::readImageFile( arguments[pos]); |
| | 1851 | std::string filename = arguments[pos]; |
| | 1852 | |
| | 1853 | osgDB::FileType fileType = osgDB::fileType(filename); |
| | 1854 | if (fileType == osgDB::FILE_NOT_FOUND) |
| | 1855 | { |
| | 1856 | filename = osgDB::findDataFile(filename); |
| | 1857 | fileType = osgDB::fileType(filename); |
| | 1858 | } |
| | 1859 | |
| | 1860 | if (fileType == osgDB::DIRECTORY) |
| | 1861 | { |
| | 1862 | osgDB::DirectoryContents contents = osgDB::getDirectoryContents(filename); |
| | 1863 | |
| | 1864 | std::sort(contents.begin(), contents.end()); |
| | 1865 | |
| | 1866 | ImageList imageList; |
| | 1867 | for(osgDB::DirectoryContents::iterator itr = contents.begin(); |
| | 1868 | itr != contents.end(); |
| | 1869 | ++itr) |
| | 1870 | { |
| | 1871 | std::string localFile = filename + "/" + *itr; |
| | 1872 | std::cout<<"contents = "<<localFile<<std::endl; |
| | 1873 | if (osgDB::fileType(localFile) == osgDB::REGULAR_FILE) |
| | 1874 | { |
| | 1875 | // not an option so assume string is a filename. |
| | 1876 | osg::Image *image = osgDB::readImageFile(localFile); |
| | 1877 | if(image) |
| | 1878 | { |
| | 1879 | imageList.push_back(image); |
| | 1880 | } |
| | 1881 | } |
| | 1882 | } |
| | 1883 | |
| | 1884 | // pack the textures into a single texture. |
| | 1885 | ProcessRow processRow; |
| | 1886 | image_3d = createTexture3D(imageList, processRow, numComponentsDesired, s_maximumTextureSize, t_maximumTextureSize, r_maximumTextureSize, resizeToPowerOfTwo); |
| | 1887 | |
| | 1888 | } |
| | 1889 | else if (fileType == osgDB::REGULAR_FILE) |
| | 1890 | { |
| | 1891 | // not an option so assume string is a filename. |
| | 1892 | image_3d = osgDB::readImageFile( filename ); |
| | 1893 | } |
| | 1894 | else |
| | 1895 | { |
| | 1896 | osg::notify(osg::NOTICE)<<"Error: could not find file: "<<filename<<std::endl; |
| | 1897 | return 1; |
| | 1898 | } |
| | 1899 | |