mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 08:04:01 +02:00
Variable renaming pass
This commit is contained in:
parent
a4f5d327a2
commit
7aef4dab4c
6 changed files with 59 additions and 61 deletions
|
@ -114,7 +114,7 @@
|
|||
#include <render/RenderFetchCullSortTask.h>
|
||||
#include <RenderDeferredTask.h>
|
||||
#include <RenderForwardTask.h>
|
||||
#include <PrototypeSelfie.h>
|
||||
#include <SecondaryCamera.h>
|
||||
#include <ResourceCache.h>
|
||||
#include <ResourceRequest.h>
|
||||
#include <SandboxUtils.h>
|
||||
|
@ -1874,7 +1874,7 @@ void Application::initializeGL() {
|
|||
}
|
||||
|
||||
_renderEngine->addJob<MainRenderTask>("MainFrame", cullFunctor, isDeferred);
|
||||
_renderEngine->addJob<SelfieRenderTask>("SelfieFrame", cullFunctor);
|
||||
_renderEngine->addJob<SecondaryCameraRenderTask>("SecondaryCameraFrame", cullFunctor);
|
||||
|
||||
|
||||
/* _renderEngine->addJob<RenderShadowTask>("RenderShadowTask", cullFunctor);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#include "PrototypeSelfie.h"
|
||||
#include "SecondaryCamera.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>;
|
||||
|
||||
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();
|
||||
setEnabled(false);
|
||||
auto textureCache = DependencyManager::get<TextureCache>();
|
||||
textureCache->resetSelfieFramebuffer(width, height);
|
||||
textureCache->resetSecondaryCameraFramebuffer(width, height);
|
||||
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::quat _orientation{};
|
||||
public:
|
||||
using Config = BeginSelfieFrameConfig;
|
||||
using JobModel = render::Job::ModelO<BeginSelfieFrame, RenderArgsPointer, Config>;
|
||||
BeginSelfieFrame() {
|
||||
using Config = BeginSecondaryCameraFrameConfig;
|
||||
using JobModel = render::Job::ModelO<BeginSecondaryCameraFrame, RenderArgsPointer, Config>;
|
||||
BeginSecondaryCameraFrame() {
|
||||
_cachedArgsPointer = std::make_shared<RenderArgs>(_cachedArgs);
|
||||
}
|
||||
|
||||
|
@ -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->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)?
|
||||
_cachedArgsPointer->_blitFramebuffer = args->_blitFramebuffer;
|
||||
_cachedArgsPointer->_viewport = args->_viewport;
|
||||
|
@ -76,9 +76,9 @@ protected:
|
|||
RenderArgsPointer _cachedArgsPointer;
|
||||
};
|
||||
|
||||
class EndSelfieFrame { // Restores renderContext.
|
||||
class EndSecondaryCameraFrame { // Restores renderContext.
|
||||
public:
|
||||
using JobModel = render::Job::ModelI<EndSelfieFrame, RenderArgsPointer>;
|
||||
using JobModel = render::Job::ModelI<EndSecondaryCameraFrame, RenderArgsPointer>;
|
||||
|
||||
void run(const render::RenderContextPointer& renderContext, const RenderArgsPointer& cachedArgs) {
|
||||
auto args = renderContext->args;
|
||||
|
@ -93,10 +93,10 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
void SelfieRenderTask::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor) {
|
||||
const auto cachedArg = task.addJob<BeginSelfieFrame>("BeginSelfie");
|
||||
void SecondaryCameraRenderTask::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor) {
|
||||
const auto cachedArg = task.addJob<BeginSecondaryCameraFrame>("BeginSecondaryCamera");
|
||||
const auto items = task.addJob<RenderFetchCullSortTask>("FetchCullSort", cullFunctor);
|
||||
assert(items.canCast<RenderFetchCullSortTask::Output>());
|
||||
task.addJob<RenderDeferredTask>("RenderDeferredTask", items);
|
||||
task.addJob<EndSelfieFrame>("EndSelfie", cachedArg);
|
||||
task.addJob<EndSecondaryCameraFrame>("EndSecondaryCamera", cachedArg);
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#ifndef hifi_PrototypeSelfie_h
|
||||
#define hifi_PrototypeSelfie_h
|
||||
#ifndef hifi_SecondaryCamera_h
|
||||
#define hifi_SecondaryCamera_h
|
||||
|
||||
#include <RenderShadowTask.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);
|
||||
};
|
||||
|
||||
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_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
|
||||
public:
|
||||
glm::vec3 position{};
|
||||
glm::quat orientation{};
|
||||
BeginSelfieFrameConfig() : render::Task::Config(false) {}
|
||||
BeginSecondaryCameraFrameConfig() : render::Task::Config(false) {}
|
||||
signals:
|
||||
void dirty();
|
||||
};
|
||||
|
||||
class SelfieRenderTaskConfig : public render::Task::Config {
|
||||
class SecondaryCameraRenderTaskConfig : public render::Task::Config {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SelfieRenderTaskConfig() : render::Task::Config(false) {}
|
||||
SecondaryCameraRenderTaskConfig() : render::Task::Config(false) {}
|
||||
signals:
|
||||
void dirty();
|
||||
public slots:
|
||||
void resetSize(int width, int height);
|
||||
};
|
||||
|
||||
class SelfieRenderTask {
|
||||
class SecondaryCameraRenderTask {
|
||||
public:
|
||||
using Config = SelfieRenderTaskConfig;
|
||||
using JobModel = render::Task::Model<SelfieRenderTask, Config>;
|
||||
SelfieRenderTask() {}
|
||||
using Config = SecondaryCameraRenderTaskConfig;
|
||||
using JobModel = render::Task::Model<SecondaryCameraRenderTask, Config>;
|
||||
SecondaryCameraRenderTask() {}
|
||||
void configure(const Config& config) {}
|
||||
void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor);
|
||||
};
|
|
@ -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::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 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(SELFIE_FRAME_URL.c_str())) {
|
||||
if (url == QUrl(SECONDARY_CAMERA_FRAME_URL.c_str())) {
|
||||
|
||||
return getSelfieNetworkTexture();
|
||||
return getSecondaryCameraNetworkTexture();
|
||||
}
|
||||
TextureExtra extra = { type, content, maxNumPixels };
|
||||
return ResourceCache::getResource(url, QUrl(), &extra).staticCast<NetworkTexture>();
|
||||
|
@ -885,31 +885,31 @@ void ImageReader::read() {
|
|||
}
|
||||
|
||||
|
||||
NetworkTexturePointer TextureCache::getSelfieNetworkTexture() {
|
||||
if (!_selfieNetworkTexture) {
|
||||
_selfieNetworkTexture.reset(new NetworkTexture(QUrl(SELFIE_FRAME_URL.c_str())));
|
||||
auto texture = getSelfieTexture();
|
||||
_selfieNetworkTexture->setImage(texture, texture->getWidth(), texture->getHeight());
|
||||
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());
|
||||
}
|
||||
return _selfieNetworkTexture;
|
||||
return _secondaryCameraNetworkTexture;
|
||||
}
|
||||
|
||||
const gpu::TexturePointer& TextureCache::getSelfieTexture() {
|
||||
if (!_selfieTexture) {
|
||||
getSelfieFramebuffer();
|
||||
const gpu::TexturePointer& TextureCache::getSecondaryCameraTexture() {
|
||||
if (!_secondaryCameraTexture) {
|
||||
getSecondaryCameraFramebuffer();
|
||||
}
|
||||
return _selfieTexture;
|
||||
return _secondaryCameraTexture;
|
||||
}
|
||||
const gpu::FramebufferPointer& TextureCache::getSelfieFramebuffer() {
|
||||
if (!_selfieFramebuffer) {
|
||||
resetSelfieFramebuffer(2048, 1024);
|
||||
const gpu::FramebufferPointer& TextureCache::getSecondaryCameraFramebuffer() {
|
||||
if (!_secondaryCameraFramebuffer) {
|
||||
resetSecondaryCameraFramebuffer(2048, 1024);
|
||||
}
|
||||
|
||||
return _selfieFramebuffer;
|
||||
return _secondaryCameraFramebuffer;
|
||||
}
|
||||
|
||||
void TextureCache::resetSelfieFramebuffer(int width, int height) {
|
||||
_selfieFramebuffer.reset(gpu::Framebuffer::create("selfie", gpu::Element::COLOR_SRGBA_32, 2048, 1024));
|
||||
_selfieTexture = _selfieFramebuffer->getRenderBuffer(0);
|
||||
_selfieNetworkTexture.reset();
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -170,11 +170,11 @@ public:
|
|||
gpu::TexturePointer cacheTextureByHash(const std::string& hash, const gpu::TexturePointer& texture);
|
||||
|
||||
|
||||
/// Selfie rendering targets.
|
||||
NetworkTexturePointer getSelfieNetworkTexture();
|
||||
const gpu::TexturePointer& getSelfieTexture();
|
||||
const gpu::FramebufferPointer& getSelfieFramebuffer();
|
||||
void resetSelfieFramebuffer(int width, int height);
|
||||
/// SecondaryCamera rendering targets.
|
||||
NetworkTexturePointer getSecondaryCameraNetworkTexture();
|
||||
const gpu::TexturePointer& getSecondaryCameraTexture();
|
||||
const gpu::FramebufferPointer& getSecondaryCameraFramebuffer();
|
||||
void resetSecondaryCameraFramebuffer(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 SELFIE_FRAME_URL;
|
||||
static const std::string SECONDARY_CAMERA_FRAME_URL;
|
||||
|
||||
KTXCache _ktxCache;
|
||||
// Map from image hashes to texture weak pointers
|
||||
|
@ -207,9 +207,9 @@ private:
|
|||
gpu::TexturePointer _blackTexture;
|
||||
|
||||
|
||||
gpu::FramebufferPointer _selfieFramebuffer;
|
||||
gpu::TexturePointer _selfieTexture;
|
||||
NetworkTexturePointer _selfieNetworkTexture;
|
||||
gpu::FramebufferPointer _secondaryCameraFramebuffer;
|
||||
gpu::TexturePointer _secondaryCameraTexture;
|
||||
NetworkTexturePointer _secondaryCameraNetworkTexture;
|
||||
};
|
||||
|
||||
#endif // hifi_TextureCache_h
|
||||
|
|
|
@ -54,8 +54,8 @@
|
|||
// The update function for the spectator camera. Modifies the camera's position
|
||||
// and orientation.
|
||||
//
|
||||
var spectatorFrameRenderConfig = Render.getConfig("SelfieFrame");
|
||||
var beginSpectatorFrameRenderConfig = Render.getConfig("BeginSelfie");
|
||||
var spectatorFrameRenderConfig = Render.getConfig("SecondaryCameraFrame");
|
||||
var beginSpectatorFrameRenderConfig = Render.getConfig("BeginSecondaryCamera");
|
||||
var viewFinderOverlay = false;
|
||||
var camera = false;
|
||||
var cameraIsDynamic = false;
|
||||
|
@ -105,8 +105,7 @@
|
|||
}, true);
|
||||
// Put an image3d overlay on the near face, as a viewFinder.
|
||||
viewFinderOverlay = Overlays.addOverlay("image3d", {
|
||||
url: "http://selfieFrame",
|
||||
//url: "http://1.bp.blogspot.com/-1GABEq__054/T03B00j_OII/AAAAAAAAAa8/jo55LcvEPHI/s1600/Winning.jpg",
|
||||
url: "http://secondaryCameraFrame",
|
||||
parentID: camera,
|
||||
alpha: 1,
|
||||
position: inFrontOf(-0.25, cameraPosition, cameraRotation),
|
||||
|
@ -141,7 +140,6 @@
|
|||
}
|
||||
if (camera) {
|
||||
Entities.deleteEntity(camera);
|
||||
print("ZACH FOX GOODBYE");
|
||||
}
|
||||
if (viewFinderOverlay) {
|
||||
Overlays.deleteOverlay(viewFinderOverlay);
|
||||
|
|
Loading…
Reference in a new issue