mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 09:18:45 +02:00
fix resource texture crash
This commit is contained in:
parent
4202685a4b
commit
d96b0534ab
2 changed files with 10 additions and 6 deletions
|
@ -333,10 +333,14 @@ QSharedPointer<Resource> TextureCache::createResourceCopy(const QSharedPointer<R
|
||||||
|
|
||||||
int networkTexturePointerMetaTypeId = qRegisterMetaType<QWeakPointer<NetworkTexture>>();
|
int networkTexturePointerMetaTypeId = qRegisterMetaType<QWeakPointer<NetworkTexture>>();
|
||||||
|
|
||||||
NetworkTexture::NetworkTexture(const QUrl& url) :
|
NetworkTexture::NetworkTexture(const QUrl& url, bool resourceTexture) :
|
||||||
Resource(url),
|
Resource(url),
|
||||||
_maxNumPixels(100)
|
_maxNumPixels(100)
|
||||||
{
|
{
|
||||||
|
if (resourceTexture) {
|
||||||
|
_textureSource = std::make_shared<gpu::TextureSource>(url);
|
||||||
|
_loaded = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkTexture::NetworkTexture(const NetworkTexture& other) :
|
NetworkTexture::NetworkTexture(const NetworkTexture& other) :
|
||||||
|
@ -1244,11 +1248,11 @@ void ImageReader::read() {
|
||||||
Q_ARG(int, texture->getHeight()));
|
Q_ARG(int, texture->getHeight()));
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkTexturePointer TextureCache::getResourceTexture(QUrl resourceTextureUrl) {
|
NetworkTexturePointer TextureCache::getResourceTexture(const QUrl& resourceTextureUrl) {
|
||||||
gpu::TexturePointer texture;
|
gpu::TexturePointer texture;
|
||||||
if (resourceTextureUrl == SPECTATOR_CAMERA_FRAME_URL) {
|
if (resourceTextureUrl == SPECTATOR_CAMERA_FRAME_URL) {
|
||||||
if (!_spectatorCameraNetworkTexture) {
|
if (!_spectatorCameraNetworkTexture) {
|
||||||
_spectatorCameraNetworkTexture.reset(new NetworkTexture(resourceTextureUrl));
|
_spectatorCameraNetworkTexture.reset(new NetworkTexture(resourceTextureUrl, true));
|
||||||
}
|
}
|
||||||
if (!_spectatorCameraFramebuffer) {
|
if (!_spectatorCameraFramebuffer) {
|
||||||
getSpectatorCameraFramebuffer(); // initialize frame buffer
|
getSpectatorCameraFramebuffer(); // initialize frame buffer
|
||||||
|
@ -1259,7 +1263,7 @@ NetworkTexturePointer TextureCache::getResourceTexture(QUrl resourceTextureUrl)
|
||||||
// FIXME: Generalize this, DRY up this code
|
// FIXME: Generalize this, DRY up this code
|
||||||
if (resourceTextureUrl == HMD_PREVIEW_FRAME_URL) {
|
if (resourceTextureUrl == HMD_PREVIEW_FRAME_URL) {
|
||||||
if (!_hmdPreviewNetworkTexture) {
|
if (!_hmdPreviewNetworkTexture) {
|
||||||
_hmdPreviewNetworkTexture.reset(new NetworkTexture(resourceTextureUrl));
|
_hmdPreviewNetworkTexture.reset(new NetworkTexture(resourceTextureUrl, true));
|
||||||
}
|
}
|
||||||
if (_hmdPreviewFramebuffer) {
|
if (_hmdPreviewFramebuffer) {
|
||||||
texture = _hmdPreviewFramebuffer->getRenderBuffer(0);
|
texture = _hmdPreviewFramebuffer->getRenderBuffer(0);
|
||||||
|
|
|
@ -45,7 +45,7 @@ class NetworkTexture : public Resource, public Texture {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkTexture(const QUrl& url);
|
NetworkTexture(const QUrl& url, bool resourceTexture = false);
|
||||||
NetworkTexture(const NetworkTexture& other);
|
NetworkTexture(const NetworkTexture& other);
|
||||||
~NetworkTexture() override;
|
~NetworkTexture() override;
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ public:
|
||||||
gpu::TexturePointer getTextureByHash(const std::string& hash);
|
gpu::TexturePointer getTextureByHash(const std::string& hash);
|
||||||
gpu::TexturePointer cacheTextureByHash(const std::string& hash, const gpu::TexturePointer& texture);
|
gpu::TexturePointer cacheTextureByHash(const std::string& hash, const gpu::TexturePointer& texture);
|
||||||
|
|
||||||
NetworkTexturePointer getResourceTexture(QUrl resourceTextureUrl);
|
NetworkTexturePointer getResourceTexture(const QUrl& resourceTextureUrl);
|
||||||
const gpu::FramebufferPointer& getHmdPreviewFramebuffer(int width, int height);
|
const gpu::FramebufferPointer& getHmdPreviewFramebuffer(int width, int height);
|
||||||
const gpu::FramebufferPointer& getSpectatorCameraFramebuffer();
|
const gpu::FramebufferPointer& getSpectatorCameraFramebuffer();
|
||||||
const gpu::FramebufferPointer& getSpectatorCameraFramebuffer(int width, int height);
|
const gpu::FramebufferPointer& getSpectatorCameraFramebuffer(int width, int height);
|
||||||
|
|
Loading…
Reference in a new issue