Clear Cache

Hello,
I saw in the SDK that was a function called “ClearCache()” in CapturingReality.Utilities.h, but i don’t know how to use it in the meshing example program.
Thanks.

Hello.

You can create an instance of the CapturingReality::IResourceCache interface with CapturingReality::Utilities::CreateResourceCache(…). The interface of this object allows you to store and access data that are used during some computation (e.g., during the computation of a Sfm). The data that you store using the IResourceCache interface are saved in the folder that you specify in the CreateResourceCache command. Once the data stored in this IResourceCache object are not needed anymore, you can clear the data with ClearCache(). This also deletes the files in the cache folder.

Here is a sample code:

Code:
HRESULT hr = S_OK;

CComPtr<CapturingReality::IResourceCache> spCache;
hr = CapturingReality::Utilities::CreateResourceCache(CapturingReality::RCL_CUSTOM, L"_crTmp", &spCache);

if ( SUCCEEDED( hr ) )
{
CComPtr<CapturingReality::Sfm::IStructureFromMotion> spSfm;
CComPtr<CapturingReality::IConfig> spConfig;

// Create and initialize spConfig here

hr = CapturingReality::Sfm::Hierarchical::CreateHierarchicalSfmPipeline( spConfig, NULL, NULL, spCache, NULL, NULL, &spSfm);
// You can align some images here using spSfm->AddImage(...) and spSfm->RegisterImages(...).
// During the computation, spSfm will use spCache to store data that are used during the alignation

if ( SUCCEEDED( hr ) )
{
hr = spCache->ClearCache(); // once the data stored in the spCache are not needed, you can clear the cache
}
}

Hope this helps.

Nice