mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 08:04:01 +02:00
Clear resource caches instead of restarting
This commit is contained in:
parent
ed296850e2
commit
ee3a8b1b6e
4 changed files with 19 additions and 4 deletions
|
@ -2414,7 +2414,11 @@ void Application::cameraMenuChanged() {
|
|||
|
||||
void Application::clearCacheAndRestart() {
|
||||
emptyLocalCache();
|
||||
exit(RESTART_CODE);
|
||||
|
||||
DependencyManager::get<AnimationCache>()->refreshAll();
|
||||
DependencyManager::get<GeometryCache>()->refreshAll();
|
||||
DependencyManager::get<SoundCache>()->refreshAll();
|
||||
DependencyManager::get<TextureCache>()->refreshAll();
|
||||
}
|
||||
|
||||
void Application::rotationModeChanged() {
|
||||
|
|
|
@ -101,7 +101,7 @@ void Skybox::render(gpu::Batch& batch, const ViewFrustum& viewFrustum, const Sky
|
|||
batch.setModelTransform(Transform()); // only for Mac
|
||||
batch.setPipeline(thePipeline);
|
||||
batch.setInputBuffer(gpu::Stream::POSITION, theBuffer, 0, 8);
|
||||
batch.setUniformBuffer(SKYBOX_CONSTANTS_SLOT, theConstants, 0, theConstants->getSize());
|
||||
//batch.setUniformBuffer(SKYBOX_CONSTANTS_SLOT, theConstants, 0, theConstants->getSize());
|
||||
batch.setInputFormat(theFormat);
|
||||
batch.setUniformTexture(0, skybox.getCubemap());
|
||||
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||
|
|
|
@ -44,10 +44,20 @@ ResourceCache::~ResourceCache() {
|
|||
}
|
||||
}
|
||||
|
||||
void ResourceCache::refreshAll() {
|
||||
for (auto it = _resources.begin(); it != _resources.end(); ++it) {
|
||||
if (!it.value().isNull()) {
|
||||
it.value().data()->refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ResourceCache::refresh(const QUrl& url) {
|
||||
QSharedPointer<Resource> resource = _resources.value(url);
|
||||
if (!resource.isNull()) {
|
||||
resource->refresh();
|
||||
} else {
|
||||
_resources.remove(url);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,8 @@ public:
|
|||
|
||||
ResourceCache(QObject* parent = NULL);
|
||||
virtual ~ResourceCache();
|
||||
|
||||
|
||||
void refreshAll();
|
||||
void refresh(const QUrl& url);
|
||||
|
||||
public slots:
|
||||
|
@ -110,7 +111,7 @@ protected:
|
|||
private:
|
||||
friend class Resource;
|
||||
|
||||
QHash<QUrl, QWeakPointer<Resource> > _resources;
|
||||
QHash<QUrl, QWeakPointer<Resource>> _resources;
|
||||
int _lastLRUKey = 0;
|
||||
|
||||
static int _requestLimit;
|
||||
|
|
Loading…
Reference in a new issue