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