mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 06:24:43 +02:00
Rename correctly?
This commit is contained in:
parent
7aef4dab4c
commit
5114fd8e1f
4 changed files with 33 additions and 33 deletions
|
@ -24,7 +24,7 @@ void SecondaryCameraRenderTaskConfig::resetSize(int width, int height) { // Care
|
|||
bool wasEnabled = isEnabled();
|
||||
setEnabled(false);
|
||||
auto textureCache = DependencyManager::get<TextureCache>();
|
||||
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<TextureCache>();
|
||||
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;
|
||||
|
|
|
@ -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<NetworkTexture>();
|
||||
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in a new issue