mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:37:51 +02:00
add background to forward renderer
This commit is contained in:
parent
b56a15b60a
commit
d00ae05e26
2 changed files with 37 additions and 1 deletions
|
@ -80,6 +80,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 +176,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 +202,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