mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 06:19:02 +02:00
Merge pull request #9282 from zzmp/graphics/forward-bg
Add background to forward rendering path
This commit is contained in:
commit
f077ac7672
2 changed files with 37 additions and 7 deletions
|
@ -31,14 +31,8 @@
|
||||||
#include <render/drawItemBounds_frag.h>
|
#include <render/drawItemBounds_frag.h>
|
||||||
|
|
||||||
using namespace render;
|
using namespace render;
|
||||||
extern void initOverlay3DPipelines(render::ShapePlumber& plumber);
|
|
||||||
extern void initDeferredPipelines(render::ShapePlumber& plumber);
|
|
||||||
|
|
||||||
RenderForwardTask::RenderForwardTask(CullFunctor cullFunctor) {
|
RenderForwardTask::RenderForwardTask(CullFunctor cullFunctor) {
|
||||||
// Prepare the ShapePipelines
|
|
||||||
ShapePlumberPointer shapePlumber = std::make_shared<ShapePlumber>();
|
|
||||||
initDeferredPipelines(*shapePlumber);
|
|
||||||
|
|
||||||
// CPU jobs:
|
// CPU jobs:
|
||||||
// Fetch and cull the items from the scene
|
// Fetch and cull the items from the scene
|
||||||
const auto spatialSelection = addJob<FetchSpatialTree>("FetchSceneSelection");
|
const auto spatialSelection = addJob<FetchSpatialTree>("FetchSceneSelection");
|
||||||
|
@ -80,6 +74,9 @@ RenderForwardTask::RenderForwardTask(CullFunctor cullFunctor) {
|
||||||
|
|
||||||
const auto framebuffer = addJob<PrepareFramebuffer>("PrepareFramebuffer");
|
const auto framebuffer = addJob<PrepareFramebuffer>("PrepareFramebuffer");
|
||||||
|
|
||||||
|
addJob<DrawBackground>("DrawBackground", background);
|
||||||
|
|
||||||
|
// bounds do not draw on stencil buffer, so they must come last
|
||||||
addJob<DrawBounds>("DrawBounds", opaques);
|
addJob<DrawBounds>("DrawBounds", opaques);
|
||||||
|
|
||||||
// Blit!
|
// Blit!
|
||||||
|
@ -173,6 +170,8 @@ void DrawBounds::run(const SceneContextPointer& sceneContext, const RenderContex
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
|
|
||||||
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
||||||
|
args->_batch = &batch;
|
||||||
|
|
||||||
// Setup projection
|
// Setup projection
|
||||||
glm::mat4 projMat;
|
glm::mat4 projMat;
|
||||||
Transform viewMat;
|
Transform viewMat;
|
||||||
|
@ -197,3 +196,26 @@ void DrawBounds::run(const SceneContextPointer& sceneContext, const RenderContex
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawBackground::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const Inputs& items) {
|
||||||
|
RenderArgs* args = renderContext->args;
|
||||||
|
|
||||||
|
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
||||||
|
args->_batch = &batch;
|
||||||
|
|
||||||
|
batch.enableSkybox(true);
|
||||||
|
batch.setViewportTransform(args->_viewport);
|
||||||
|
batch.setStateScissorRect(args->_viewport);
|
||||||
|
|
||||||
|
// Setup projection
|
||||||
|
glm::mat4 projMat;
|
||||||
|
Transform viewMat;
|
||||||
|
args->getViewFrustum().evalProjectionMatrix(projMat);
|
||||||
|
args->getViewFrustum().evalViewTransform(viewMat);
|
||||||
|
batch.setProjectionTransform(projMat);
|
||||||
|
batch.setViewTransform(viewMat);
|
||||||
|
|
||||||
|
renderItems(sceneContext, renderContext, items);
|
||||||
|
});
|
||||||
|
args->_batch = nullptr;
|
||||||
|
}
|
||||||
|
|
|
@ -53,4 +53,12 @@ private:
|
||||||
int _scaleLocation { -1 };
|
int _scaleLocation { -1 };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_RenderForwardTask_h
|
class DrawBackground {
|
||||||
|
public:
|
||||||
|
using Inputs = render::ItemBounds;
|
||||||
|
using JobModel = render::Job::ModelI<DrawBackground, Inputs>;
|
||||||
|
|
||||||
|
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& background);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_RenderForwardTask_h
|
||||||
|
|
Loading…
Reference in a new issue