Feature implementation complete: save and load cache data
This commit is contained in:
parent
4924db7491
commit
f099ae27c5
|
@ -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 );
|
||||||
|
|
||||||
|
aCacheItem->sceneData = (SCENEGRAPH*)S3D::ReadCache( fname );
|
||||||
|
|
||||||
|
if( NULL == aCacheItem->sceneData )
|
||||||
return false;
|
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;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue