Variable renaming pass

This commit is contained in:
Zach Fox 2017-06-07 11:02:23 -07:00
parent a4f5d327a2
commit 7aef4dab4c
6 changed files with 59 additions and 61 deletions

View file

@ -114,7 +114,7 @@
#include <render/RenderFetchCullSortTask.h> #include <render/RenderFetchCullSortTask.h>
#include <RenderDeferredTask.h> #include <RenderDeferredTask.h>
#include <RenderForwardTask.h> #include <RenderForwardTask.h>
#include <PrototypeSelfie.h> #include <SecondaryCamera.h>
#include <ResourceCache.h> #include <ResourceCache.h>
#include <ResourceRequest.h> #include <ResourceRequest.h>
#include <SandboxUtils.h> #include <SandboxUtils.h>
@ -1874,7 +1874,7 @@ void Application::initializeGL() {
} }
_renderEngine->addJob<MainRenderTask>("MainFrame", cullFunctor, isDeferred); _renderEngine->addJob<MainRenderTask>("MainFrame", cullFunctor, isDeferred);
_renderEngine->addJob<SelfieRenderTask>("SelfieFrame", cullFunctor); _renderEngine->addJob<SecondaryCameraRenderTask>("SecondaryCameraFrame", cullFunctor);
/* _renderEngine->addJob<RenderShadowTask>("RenderShadowTask", cullFunctor); /* _renderEngine->addJob<RenderShadowTask>("RenderShadowTask", cullFunctor);

View file

@ -1,5 +1,5 @@
#include "PrototypeSelfie.h" #include "SecondaryCamera.h"
#include <gpu/Context.h> #include <gpu/Context.h>
@ -20,21 +20,21 @@ void MainRenderTask::build(JobModel& task, const render::Varying& inputs, render
using RenderArgsPointer = std::shared_ptr<RenderArgs>; using RenderArgsPointer = std::shared_ptr<RenderArgs>;
void SelfieRenderTaskConfig::resetSize(int width, int height) { // Carefully adjust the framebuffer / texture. void SecondaryCameraRenderTaskConfig::resetSize(int width, int height) { // Carefully adjust the framebuffer / texture.
bool wasEnabled = isEnabled(); bool wasEnabled = isEnabled();
setEnabled(false); setEnabled(false);
auto textureCache = DependencyManager::get<TextureCache>(); auto textureCache = DependencyManager::get<TextureCache>();
textureCache->resetSelfieFramebuffer(width, height); textureCache->resetSecondaryCameraFramebuffer(width, height);
setEnabled(wasEnabled); setEnabled(wasEnabled);
} }
class BeginSelfieFrame { // Changes renderContext for our framebuffer and and view. class BeginSecondaryCameraFrame { // Changes renderContext for our framebuffer and and view.
glm::vec3 _position{}; glm::vec3 _position{};
glm::quat _orientation{}; glm::quat _orientation{};
public: public:
using Config = BeginSelfieFrameConfig; using Config = BeginSecondaryCameraFrameConfig;
using JobModel = render::Job::ModelO<BeginSelfieFrame, RenderArgsPointer, Config>; using JobModel = render::Job::ModelO<BeginSecondaryCameraFrame, RenderArgsPointer, Config>;
BeginSelfieFrame() { BeginSecondaryCameraFrame() {
_cachedArgsPointer = std::make_shared<RenderArgs>(_cachedArgs); _cachedArgsPointer = std::make_shared<RenderArgs>(_cachedArgs);
} }
@ -48,7 +48,7 @@ public:
void run(const render::RenderContextPointer& renderContext, RenderArgsPointer& cachedArgs) { void run(const render::RenderContextPointer& renderContext, RenderArgsPointer& cachedArgs) {
auto args = renderContext->args; auto args = renderContext->args;
auto textureCache = DependencyManager::get<TextureCache>(); auto textureCache = DependencyManager::get<TextureCache>();
auto destFramebuffer = textureCache->getSelfieFramebuffer(); auto destFramebuffer = textureCache->getSecondaryCameraFramebuffer();
// 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)? // 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->_blitFramebuffer = args->_blitFramebuffer;
_cachedArgsPointer->_viewport = args->_viewport; _cachedArgsPointer->_viewport = args->_viewport;
@ -76,9 +76,9 @@ protected:
RenderArgsPointer _cachedArgsPointer; RenderArgsPointer _cachedArgsPointer;
}; };
class EndSelfieFrame { // Restores renderContext. class EndSecondaryCameraFrame { // Restores renderContext.
public: public:
using JobModel = render::Job::ModelI<EndSelfieFrame, RenderArgsPointer>; using JobModel = render::Job::ModelI<EndSecondaryCameraFrame, RenderArgsPointer>;
void run(const render::RenderContextPointer& renderContext, const RenderArgsPointer& cachedArgs) { void run(const render::RenderContextPointer& renderContext, const RenderArgsPointer& cachedArgs) {
auto args = renderContext->args; auto args = renderContext->args;
@ -93,10 +93,10 @@ public:
} }
}; };
void SelfieRenderTask::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor) { void SecondaryCameraRenderTask::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor) {
const auto cachedArg = task.addJob<BeginSelfieFrame>("BeginSelfie"); const auto cachedArg = task.addJob<BeginSecondaryCameraFrame>("BeginSecondaryCamera");
const auto items = task.addJob<RenderFetchCullSortTask>("FetchCullSort", cullFunctor); const auto items = task.addJob<RenderFetchCullSortTask>("FetchCullSort", cullFunctor);
assert(items.canCast<RenderFetchCullSortTask::Output>()); assert(items.canCast<RenderFetchCullSortTask::Output>());
task.addJob<RenderDeferredTask>("RenderDeferredTask", items); task.addJob<RenderDeferredTask>("RenderDeferredTask", items);
task.addJob<EndSelfieFrame>("EndSelfie", cachedArg); task.addJob<EndSecondaryCameraFrame>("EndSecondaryCamera", cachedArg);
} }

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#ifndef hifi_PrototypeSelfie_h #ifndef hifi_SecondaryCamera_h
#define hifi_PrototypeSelfie_h #define hifi_SecondaryCamera_h
#include <RenderShadowTask.h> #include <RenderShadowTask.h>
#include <render/RenderFetchCullSortTask.h> #include <render/RenderFetchCullSortTask.h>
@ -18,33 +18,33 @@ public:
void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor, bool isDeferred = true); void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor, bool isDeferred = true);
}; };
class BeginSelfieFrameConfig : public render::Task::Config { // Exposes view frustum position/orientation to javascript. class BeginSecondaryCameraFrameConfig : public render::Task::Config { // Exposes view frustum position/orientation to javascript.
Q_OBJECT Q_OBJECT
Q_PROPERTY(glm::vec3 position MEMBER position NOTIFY dirty) // of viewpoint to render from Q_PROPERTY(glm::vec3 position MEMBER position NOTIFY dirty) // of viewpoint to render from
Q_PROPERTY(glm::quat orientation MEMBER orientation NOTIFY dirty) // of viewpoint to render from Q_PROPERTY(glm::quat orientation MEMBER orientation NOTIFY dirty) // of viewpoint to render from
public: public:
glm::vec3 position{}; glm::vec3 position{};
glm::quat orientation{}; glm::quat orientation{};
BeginSelfieFrameConfig() : render::Task::Config(false) {} BeginSecondaryCameraFrameConfig() : render::Task::Config(false) {}
signals: signals:
void dirty(); void dirty();
}; };
class SelfieRenderTaskConfig : public render::Task::Config { class SecondaryCameraRenderTaskConfig : public render::Task::Config {
Q_OBJECT Q_OBJECT
public: public:
SelfieRenderTaskConfig() : render::Task::Config(false) {} SecondaryCameraRenderTaskConfig() : render::Task::Config(false) {}
signals: signals:
void dirty(); void dirty();
public slots: public slots:
void resetSize(int width, int height); void resetSize(int width, int height);
}; };
class SelfieRenderTask { class SecondaryCameraRenderTask {
public: public:
using Config = SelfieRenderTaskConfig; using Config = SecondaryCameraRenderTaskConfig;
using JobModel = render::Task::Model<SelfieRenderTask, Config>; using JobModel = render::Task::Model<SecondaryCameraRenderTask, Config>;
SelfieRenderTask() {} SecondaryCameraRenderTask() {}
void configure(const Config& config) {} void configure(const Config& config) {}
void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor); void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor);
}; };

View file

@ -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_DIRNAME { "ktx_cache" };
const std::string TextureCache::KTX_EXT { "ktx" }; const std::string TextureCache::KTX_EXT { "ktx" };
const std::string TextureCache::SELFIE_FRAME_URL { "http://selfieFrame" }; const std::string TextureCache::SECONDARY_CAMERA_FRAME_URL { "http://secondaryCameraFrame" };
static const float SKYBOX_LOAD_PRIORITY { 10.0f }; // Make sure skybox loads first 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 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) { NetworkTexturePointer TextureCache::getTexture(const QUrl& url, image::TextureUsage::Type type, const QByteArray& content, int maxNumPixels) {
if (url == QUrl(SELFIE_FRAME_URL.c_str())) { if (url == QUrl(SECONDARY_CAMERA_FRAME_URL.c_str())) {
return getSelfieNetworkTexture(); return getSecondaryCameraNetworkTexture();
} }
TextureExtra extra = { type, content, maxNumPixels }; TextureExtra extra = { type, content, maxNumPixels };
return ResourceCache::getResource(url, QUrl(), &extra).staticCast<NetworkTexture>(); return ResourceCache::getResource(url, QUrl(), &extra).staticCast<NetworkTexture>();
@ -885,31 +885,31 @@ void ImageReader::read() {
} }
NetworkTexturePointer TextureCache::getSelfieNetworkTexture() { NetworkTexturePointer TextureCache::getSecondaryCameraNetworkTexture() {
if (!_selfieNetworkTexture) { if (!_secondaryCameraNetworkTexture) {
_selfieNetworkTexture.reset(new NetworkTexture(QUrl(SELFIE_FRAME_URL.c_str()))); _secondaryCameraNetworkTexture.reset(new NetworkTexture(QUrl(SECONDARY_CAMERA_FRAME_URL.c_str())));
auto texture = getSelfieTexture(); auto texture = getSecondaryCameraTexture();
_selfieNetworkTexture->setImage(texture, texture->getWidth(), texture->getHeight()); _secondaryCameraNetworkTexture->setImage(texture, texture->getWidth(), texture->getHeight());
} }
return _selfieNetworkTexture; return _secondaryCameraNetworkTexture;
} }
const gpu::TexturePointer& TextureCache::getSelfieTexture() { const gpu::TexturePointer& TextureCache::getSecondaryCameraTexture() {
if (!_selfieTexture) { if (!_secondaryCameraTexture) {
getSelfieFramebuffer(); getSecondaryCameraFramebuffer();
} }
return _selfieTexture; return _secondaryCameraTexture;
} }
const gpu::FramebufferPointer& TextureCache::getSelfieFramebuffer() { const gpu::FramebufferPointer& TextureCache::getSecondaryCameraFramebuffer() {
if (!_selfieFramebuffer) { if (!_secondaryCameraFramebuffer) {
resetSelfieFramebuffer(2048, 1024); resetSecondaryCameraFramebuffer(2048, 1024);
} }
return _selfieFramebuffer; return _secondaryCameraFramebuffer;
} }
void TextureCache::resetSelfieFramebuffer(int width, int height) { void TextureCache::resetSecondaryCameraFramebuffer(int width, int height) {
_selfieFramebuffer.reset(gpu::Framebuffer::create("selfie", gpu::Element::COLOR_SRGBA_32, 2048, 1024)); _secondaryCameraFramebuffer.reset(gpu::Framebuffer::create("secondaryCamera", gpu::Element::COLOR_SRGBA_32, 2048, 1024));
_selfieTexture = _selfieFramebuffer->getRenderBuffer(0); _secondaryCameraTexture = _secondaryCameraFramebuffer->getRenderBuffer(0);
_selfieNetworkTexture.reset(); _secondaryCameraNetworkTexture.reset();
} }

View file

@ -170,11 +170,11 @@ public:
gpu::TexturePointer cacheTextureByHash(const std::string& hash, const gpu::TexturePointer& texture); gpu::TexturePointer cacheTextureByHash(const std::string& hash, const gpu::TexturePointer& texture);
/// Selfie rendering targets. /// SecondaryCamera rendering targets.
NetworkTexturePointer getSelfieNetworkTexture(); NetworkTexturePointer getSecondaryCameraNetworkTexture();
const gpu::TexturePointer& getSelfieTexture(); const gpu::TexturePointer& getSecondaryCameraTexture();
const gpu::FramebufferPointer& getSelfieFramebuffer(); const gpu::FramebufferPointer& getSecondaryCameraFramebuffer();
void resetSelfieFramebuffer(int width, int height); void resetSecondaryCameraFramebuffer(int width, int height);
protected: protected:
// Overload ResourceCache::prefetch to allow specifying texture type for loads // 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_DIRNAME;
static const std::string KTX_EXT; static const std::string KTX_EXT;
static const std::string SELFIE_FRAME_URL; static const std::string SECONDARY_CAMERA_FRAME_URL;
KTXCache _ktxCache; KTXCache _ktxCache;
// Map from image hashes to texture weak pointers // Map from image hashes to texture weak pointers
@ -207,9 +207,9 @@ private:
gpu::TexturePointer _blackTexture; gpu::TexturePointer _blackTexture;
gpu::FramebufferPointer _selfieFramebuffer; gpu::FramebufferPointer _secondaryCameraFramebuffer;
gpu::TexturePointer _selfieTexture; gpu::TexturePointer _secondaryCameraTexture;
NetworkTexturePointer _selfieNetworkTexture; NetworkTexturePointer _secondaryCameraNetworkTexture;
}; };
#endif // hifi_TextureCache_h #endif // hifi_TextureCache_h

View file

@ -54,8 +54,8 @@
// The update function for the spectator camera. Modifies the camera's position // The update function for the spectator camera. Modifies the camera's position
// and orientation. // and orientation.
// //
var spectatorFrameRenderConfig = Render.getConfig("SelfieFrame"); var spectatorFrameRenderConfig = Render.getConfig("SecondaryCameraFrame");
var beginSpectatorFrameRenderConfig = Render.getConfig("BeginSelfie"); var beginSpectatorFrameRenderConfig = Render.getConfig("BeginSecondaryCamera");
var viewFinderOverlay = false; var viewFinderOverlay = false;
var camera = false; var camera = false;
var cameraIsDynamic = false; var cameraIsDynamic = false;
@ -105,8 +105,7 @@
}, true); }, true);
// Put an image3d overlay on the near face, as a viewFinder. // Put an image3d overlay on the near face, as a viewFinder.
viewFinderOverlay = Overlays.addOverlay("image3d", { viewFinderOverlay = Overlays.addOverlay("image3d", {
url: "http://selfieFrame", url: "http://secondaryCameraFrame",
//url: "http://1.bp.blogspot.com/-1GABEq__054/T03B00j_OII/AAAAAAAAAa8/jo55LcvEPHI/s1600/Winning.jpg",
parentID: camera, parentID: camera,
alpha: 1, alpha: 1,
position: inFrontOf(-0.25, cameraPosition, cameraRotation), position: inFrontOf(-0.25, cameraPosition, cameraRotation),
@ -141,7 +140,6 @@
} }
if (camera) { if (camera) {
Entities.deleteEntity(camera); Entities.deleteEntity(camera);
print("ZACH FOX GOODBYE");
} }
if (viewFinderOverlay) { if (viewFinderOverlay) {
Overlays.deleteOverlay(viewFinderOverlay); Overlays.deleteOverlay(viewFinderOverlay);