From 5114fd8e1f46a52b1d31f5a6f35ab6926cd561f6 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 7 Jun 2017 14:46:59 -0700 Subject: [PATCH] Rename correctly? --- interface/src/SecondaryCamera.cpp | 4 +- .../src/model-networking/TextureCache.cpp | 42 +++++++++---------- .../src/model-networking/TextureCache.h | 18 ++++---- scripts/system/spectatorCamera.js | 2 +- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/interface/src/SecondaryCamera.cpp b/interface/src/SecondaryCamera.cpp index c6f7526256..4603a4be79 100644 --- a/interface/src/SecondaryCamera.cpp +++ b/interface/src/SecondaryCamera.cpp @@ -24,7 +24,7 @@ void SecondaryCameraRenderTaskConfig::resetSize(int width, int height) { // Care bool wasEnabled = isEnabled(); setEnabled(false); auto textureCache = DependencyManager::get(); - textureCache->resetSecondaryCameraFramebuffer(width, height); + textureCache->resetSpectatorCameraFramebuffer(width, height); setEnabled(wasEnabled); } @@ -48,7 +48,7 @@ public: void run(const render::RenderContextPointer& renderContext, RenderArgsPointer& cachedArgs) { auto args = renderContext->args; auto textureCache = DependencyManager::get(); - auto destFramebuffer = textureCache->getSecondaryCameraFramebuffer(); + auto destFramebuffer = textureCache->getSpectatorCameraFramebuffer(); // Caching/restoring the old values doesn't seem to be needed. Is it because we happen to be last in the pipeline (which would be a bug waiting to happen)? _cachedArgsPointer->_blitFramebuffer = args->_blitFramebuffer; _cachedArgsPointer->_viewport = args->_viewport; diff --git a/libraries/model-networking/src/model-networking/TextureCache.cpp b/libraries/model-networking/src/model-networking/TextureCache.cpp index f64b917520..f8b48833f7 100644 --- a/libraries/model-networking/src/model-networking/TextureCache.cpp +++ b/libraries/model-networking/src/model-networking/TextureCache.cpp @@ -50,7 +50,7 @@ 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_EXT { "ktx" }; -const std::string TextureCache::SECONDARY_CAMERA_FRAME_URL { "http://secondaryCameraFrame" }; +const std::string TextureCache::SPECTATOR_CAMERA_FRAME_URL { "http://spectatorCameraFrame" }; static const float SKYBOX_LOAD_PRIORITY { 10.0f }; // Make sure skybox loads first static const float HIGH_MIPS_LOAD_PRIORITY { 9.0f }; // Make sure high mips loads after skybox but before models @@ -182,9 +182,9 @@ ScriptableResource* TextureCache::prefetch(const QUrl& url, int type, int maxNum } NetworkTexturePointer TextureCache::getTexture(const QUrl& url, image::TextureUsage::Type type, const QByteArray& content, int maxNumPixels) { - if (url == QUrl(SECONDARY_CAMERA_FRAME_URL.c_str())) { + if (url == QUrl(SPECTATOR_CAMERA_FRAME_URL.c_str())) { - return getSecondaryCameraNetworkTexture(); + return getSpectatorCameraNetworkTexture(); } TextureExtra extra = { type, content, maxNumPixels }; return ResourceCache::getResource(url, QUrl(), &extra).staticCast(); @@ -885,31 +885,31 @@ void ImageReader::read() { } -NetworkTexturePointer TextureCache::getSecondaryCameraNetworkTexture() { - if (!_secondaryCameraNetworkTexture) { - _secondaryCameraNetworkTexture.reset(new NetworkTexture(QUrl(SECONDARY_CAMERA_FRAME_URL.c_str()))); - auto texture = getSecondaryCameraTexture(); - _secondaryCameraNetworkTexture->setImage(texture, texture->getWidth(), texture->getHeight()); +NetworkTexturePointer TextureCache::getSpectatorCameraNetworkTexture() { + if (!_spectatorCameraNetworkTexture) { + _spectatorCameraNetworkTexture.reset(new NetworkTexture(QUrl(SPECTATOR_CAMERA_FRAME_URL.c_str()))); + auto texture = getSpectatorCameraTexture(); + _spectatorCameraNetworkTexture->setImage(texture, texture->getWidth(), texture->getHeight()); } - return _secondaryCameraNetworkTexture; + return _spectatorCameraNetworkTexture; } -const gpu::TexturePointer& TextureCache::getSecondaryCameraTexture() { - if (!_secondaryCameraTexture) { - getSecondaryCameraFramebuffer(); +const gpu::TexturePointer& TextureCache::getSpectatorCameraTexture() { + if (!_spectatorCameraTexture) { + getSpectatorCameraFramebuffer(); } - return _secondaryCameraTexture; + return _spectatorCameraTexture; } -const gpu::FramebufferPointer& TextureCache::getSecondaryCameraFramebuffer() { - if (!_secondaryCameraFramebuffer) { - resetSecondaryCameraFramebuffer(2048, 1024); +const gpu::FramebufferPointer& TextureCache::getSpectatorCameraFramebuffer() { + if (!_spectatorCameraFramebuffer) { + resetSpectatorCameraFramebuffer(2048, 1024); } - return _secondaryCameraFramebuffer; + return _spectatorCameraFramebuffer; } -void TextureCache::resetSecondaryCameraFramebuffer(int width, int height) { - _secondaryCameraFramebuffer.reset(gpu::Framebuffer::create("secondaryCamera", gpu::Element::COLOR_SRGBA_32, 2048, 1024)); - _secondaryCameraTexture = _secondaryCameraFramebuffer->getRenderBuffer(0); - _secondaryCameraNetworkTexture.reset(); +void TextureCache::resetSpectatorCameraFramebuffer(int width, int height) { + _spectatorCameraFramebuffer.reset(gpu::Framebuffer::create("spectatorCamera", gpu::Element::COLOR_SRGBA_32, 2048, 1024)); + _spectatorCameraTexture = _spectatorCameraFramebuffer->getRenderBuffer(0); + _spectatorCameraNetworkTexture.reset(); } diff --git a/libraries/model-networking/src/model-networking/TextureCache.h b/libraries/model-networking/src/model-networking/TextureCache.h index 498a5ffb8f..38cb8e1982 100644 --- a/libraries/model-networking/src/model-networking/TextureCache.h +++ b/libraries/model-networking/src/model-networking/TextureCache.h @@ -170,11 +170,11 @@ public: gpu::TexturePointer cacheTextureByHash(const std::string& hash, const gpu::TexturePointer& texture); - /// SecondaryCamera rendering targets. - NetworkTexturePointer getSecondaryCameraNetworkTexture(); - const gpu::TexturePointer& getSecondaryCameraTexture(); - const gpu::FramebufferPointer& getSecondaryCameraFramebuffer(); - void resetSecondaryCameraFramebuffer(int width, int height); + /// SpectatorCamera rendering targets. + NetworkTexturePointer getSpectatorCameraNetworkTexture(); + const gpu::TexturePointer& getSpectatorCameraTexture(); + const gpu::FramebufferPointer& getSpectatorCameraFramebuffer(); + void resetSpectatorCameraFramebuffer(int width, int height); protected: // Overload ResourceCache::prefetch to allow specifying texture type for loads @@ -193,7 +193,7 @@ private: static const std::string KTX_DIRNAME; static const std::string KTX_EXT; - static const std::string SECONDARY_CAMERA_FRAME_URL; + static const std::string SPECTATOR_CAMERA_FRAME_URL; KTXCache _ktxCache; // Map from image hashes to texture weak pointers @@ -207,9 +207,9 @@ private: gpu::TexturePointer _blackTexture; - gpu::FramebufferPointer _secondaryCameraFramebuffer; - gpu::TexturePointer _secondaryCameraTexture; - NetworkTexturePointer _secondaryCameraNetworkTexture; + gpu::FramebufferPointer _spectatorCameraFramebuffer; + gpu::TexturePointer _spectatorCameraTexture; + NetworkTexturePointer _spectatorCameraNetworkTexture; }; #endif // hifi_TextureCache_h diff --git a/scripts/system/spectatorCamera.js b/scripts/system/spectatorCamera.js index 04aa2b8186..9df7dade53 100644 --- a/scripts/system/spectatorCamera.js +++ b/scripts/system/spectatorCamera.js @@ -105,7 +105,7 @@ }, true); // Put an image3d overlay on the near face, as a viewFinder. viewFinderOverlay = Overlays.addOverlay("image3d", { - url: "http://secondaryCameraFrame", + url: "http://spectatorCameraFrame", parentID: camera, alpha: 1, position: inFrontOf(-0.25, cameraPosition, cameraRotation),