mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 14:14:28 +02:00
Load skybox first and sounds later
This commit is contained in:
parent
1555fc3088
commit
70ece9f0fd
3 changed files with 10 additions and 2 deletions
|
@ -14,6 +14,8 @@
|
||||||
#include "AudioLogging.h"
|
#include "AudioLogging.h"
|
||||||
#include "SoundCache.h"
|
#include "SoundCache.h"
|
||||||
|
|
||||||
|
static const int SOUNDS_LOADING_PRIORITY { -7 }; // Make sure sounds load after the low rez texture mips
|
||||||
|
|
||||||
int soundPointerMetaTypeId = qRegisterMetaType<SharedSoundPointer>();
|
int soundPointerMetaTypeId = qRegisterMetaType<SharedSoundPointer>();
|
||||||
|
|
||||||
SoundCache::SoundCache(QObject* parent) :
|
SoundCache::SoundCache(QObject* parent) :
|
||||||
|
@ -37,5 +39,7 @@ SharedSoundPointer SoundCache::getSound(const QUrl& url) {
|
||||||
QSharedPointer<Resource> SoundCache::createResource(const QUrl& url, const QSharedPointer<Resource>& fallback,
|
QSharedPointer<Resource> SoundCache::createResource(const QUrl& url, const QSharedPointer<Resource>& fallback,
|
||||||
const void* extra) {
|
const void* extra) {
|
||||||
qCDebug(audio) << "Requesting sound at" << url.toString();
|
qCDebug(audio) << "Requesting sound at" << url.toString();
|
||||||
return QSharedPointer<Resource>(new Sound(url), &Resource::deleter);
|
auto resource = QSharedPointer<Resource>(new Sound(url), &Resource::deleter);
|
||||||
|
resource->setLoadPriority(this, SOUNDS_LOADING_PRIORITY);
|
||||||
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,8 @@ Q_LOGGING_CATEGORY(trace_resource_parse_image_ktx, "trace.resource.parse.image.k
|
||||||
const std::string TextureCache::KTX_DIRNAME { "ktx_cache" };
|
const std::string TextureCache::KTX_DIRNAME { "ktx_cache" };
|
||||||
const std::string TextureCache::KTX_EXT { "ktx" };
|
const std::string TextureCache::KTX_EXT { "ktx" };
|
||||||
|
|
||||||
|
static const int SKYBOX_LOAD_PRIORITY { 10 }; // Make sure skybox loads first
|
||||||
|
|
||||||
TextureCache::TextureCache() :
|
TextureCache::TextureCache() :
|
||||||
_ktxCache(KTX_DIRNAME, KTX_EXT) {
|
_ktxCache(KTX_DIRNAME, KTX_EXT) {
|
||||||
setUnusedResourceCacheSize(0);
|
setUnusedResourceCacheSize(0);
|
||||||
|
@ -259,6 +261,9 @@ QSharedPointer<Resource> TextureCache::createResource(const QUrl& url, const QSh
|
||||||
auto content = textureExtra ? textureExtra->content : QByteArray();
|
auto content = textureExtra ? textureExtra->content : QByteArray();
|
||||||
auto maxNumPixels = textureExtra ? textureExtra->maxNumPixels : ABSOLUTE_MAX_TEXTURE_NUM_PIXELS;
|
auto maxNumPixels = textureExtra ? textureExtra->maxNumPixels : ABSOLUTE_MAX_TEXTURE_NUM_PIXELS;
|
||||||
NetworkTexture* texture = new NetworkTexture(url, type, content, maxNumPixels);
|
NetworkTexture* texture = new NetworkTexture(url, type, content, maxNumPixels);
|
||||||
|
if (type == image::TextureUsage::CUBE_TEXTURE) {
|
||||||
|
texture->setLoadPriority(this, SKYBOX_LOAD_PRIORITY);
|
||||||
|
}
|
||||||
return QSharedPointer<Resource>(texture, &Resource::deleter);
|
return QSharedPointer<Resource>(texture, &Resource::deleter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -558,7 +558,6 @@ void ModelMeshPartPayload::render(RenderArgs* args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_materialNeedsUpdate && _model->getGeometry()->areTexturesLoaded()) {
|
if (_materialNeedsUpdate && _model->getGeometry()->areTexturesLoaded()) {
|
||||||
qDebug() << "Updating for textures";
|
|
||||||
_model->setRenderItemsNeedUpdate();
|
_model->setRenderItemsNeedUpdate();
|
||||||
_materialNeedsUpdate = false;
|
_materialNeedsUpdate = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue