Feature implementation complete: save and load cache data

This commit is contained in:
Cirilo Bernardo 2015-12-14 20:15:44 +11:00
parent 4924db7491
commit f099ae27c5
1 changed files with 15 additions and 15 deletions

View File

@ -281,6 +281,9 @@ SCENEGRAPH* S3D_CACHE::checkCache( const wxString& aFileName )
ep->sceneData = m_Plugins->Load3DModel( aFileName ); ep->sceneData = m_Plugins->Load3DModel( aFileName );
if( NULL != ep->sceneData )
saveCacheData( ep );
return ep->sceneData; return ep->sceneData;
} }
@ -342,22 +345,22 @@ bool S3D_CACHE::loadCacheData( S3D_CACHE_ENTRY* aCacheItem )
wxString fname = m_CacheDir + bname + wxT( ".3dc" ); wxString fname = m_CacheDir + bname + wxT( ".3dc" );
// determine if the file exists and is a regular file if( !wxFileName::FileExists( fname ) )
struct stat info;
if( stat( fname.ToUTF8(), &info ) )
return false;
if( !S_ISREG( info.st_mode ) )
{ {
std::cerr << " * [3D model] path exists but is not a regular file: '"; std::cerr << " * [3D model] cannot open file '";
std::cerr << fname.ToUTF8() << "'\n"; std::cerr << fname.ToUTF8() << "'\n";
return false; return false;
} }
#warning NOT IMPLEMENTED if( NULL != aCacheItem->sceneData )
// XXX - proceed with loading the cache data S3D::DestroyNode( (SGNODE*) aCacheItem->sceneData );
return false;
aCacheItem->sceneData = (SCENEGRAPH*)S3D::ReadCache( fname );
if( NULL == aCacheItem->sceneData )
return false;
return true;
} }
@ -412,10 +415,7 @@ bool S3D_CACHE::saveCacheData( S3D_CACHE_ENTRY* aCacheItem )
return true; return true;
} }
#warning NOT IMPLEMENTED return S3D::WriteCache( fname, true, (SGNODE*)aCacheItem->sceneData );
// XXX - proceed with saving the cache data
return false;
} }