From Torben Dannhauer, "Modification to osgfilecache: Now source data can also be local.:

find attached my modifications to osgfilecache.

It now allows also the caching of LOCAL terrain databases. In combination with the extends and level cmd parameter it allows to extract parts of terrain databases and write it in a new "Sub database".
I also modified osgDB::FileCache to create correct filenames if the data source is local."
This commit is contained in:
Robert Osfield 2012-02-09 17:52:13 +00:00
parent 0b73ee7933
commit 9b6e10ddf0
2 changed files with 3 additions and 2 deletions

View File

@ -309,7 +309,7 @@ public:
osg::Node* readNodeFileAndWriteToCache(const std::string& filename) osg::Node* readNodeFileAndWriteToCache(const std::string& filename)
{ {
osg::Node* node = 0; osg::Node* node = 0;
if (_fileCache.valid() && osgDB::containsServerAddress(filename)) if (_fileCache.valid() )
{ {
if (_fileCache->existsInCache(filename)) if (_fileCache->existsInCache(filename))
{ {

View File

@ -42,8 +42,9 @@ bool FileCache::isFileAppropriateForFileCache(const std::string& originalFileNam
std::string FileCache::createCacheFileName(const std::string& originalFileName) const std::string FileCache::createCacheFileName(const std::string& originalFileName) const
{ {
std::string serverAddress = osgDB::getServerAddress(originalFileName);
std::string cacheFileName = _fileCachePath + "/" + std::string cacheFileName = _fileCachePath + "/" +
osgDB::getServerAddress(originalFileName) + "/" + serverAddress + (serverAddress.empty()?"":"/") +
osgDB::getServerFileName(originalFileName); osgDB::getServerFileName(originalFileName);
OSG_INFO<<"FileCache::createCacheFileName("<<originalFileName<<") = "<<cacheFileName<<std::endl; OSG_INFO<<"FileCache::createCacheFileName("<<originalFileName<<") = "<<cacheFileName<<std::endl;