mirror of
https://github.com/lubosz/overte.git
synced 2025-04-16 06:16:18 +02:00
Repaired Luci shadow cascade and depth visualisation
This commit is contained in:
parent
a3e1eb997d
commit
d1d6782381
3 changed files with 44 additions and 3 deletions
|
@ -211,6 +211,9 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
|||
const auto overlaysInFrontOpaque = filteredOverlaysOpaque.getN<FilterLayeredItems::Outputs>(0);
|
||||
const auto overlaysInFrontTransparent = filteredOverlaysTransparent.getN<FilterLayeredItems::Outputs>(0);
|
||||
|
||||
// We don't want the overlay to clear the deferred frame buffer depth because we would like to keep it for debugging visualisation
|
||||
task.addJob<SetSeparateDeferredDepthBuffer>("SeparateDepthForOverlay", deferredFramebuffer);
|
||||
|
||||
const auto overlayInFrontOpaquesInputs = DrawOverlay3D::Inputs(overlaysInFrontOpaque, lightingModel, jitter).asVarying();
|
||||
const auto overlayInFrontTransparentsInputs = DrawOverlay3D::Inputs(overlaysInFrontTransparent, lightingModel, jitter).asVarying();
|
||||
task.addJob<DrawOverlay3D>("DrawOverlayInFrontOpaque", overlayInFrontOpaquesInputs, true);
|
||||
|
@ -451,3 +454,26 @@ void DrawStateSortDeferred::run(const RenderContextPointer& renderContext, const
|
|||
|
||||
config->setNumDrawn((int)inItems.size());
|
||||
}
|
||||
|
||||
void SetSeparateDeferredDepthBuffer::run(const render::RenderContextPointer& renderContext, const Inputs& inputs) {
|
||||
assert(renderContext->args);
|
||||
|
||||
const auto deferredFramebuffer = inputs->getDeferredFramebuffer();
|
||||
const auto frameSize = deferredFramebuffer->getSize();
|
||||
const auto renderbufferCount = deferredFramebuffer->getNumRenderBuffers();
|
||||
|
||||
if (!_framebuffer || _framebuffer->getSize() != frameSize || _framebuffer->getNumRenderBuffers() != renderbufferCount) {
|
||||
auto depthFormat = deferredFramebuffer->getDepthStencilBufferFormat();
|
||||
auto depthStencilTexture = gpu::TexturePointer(gpu::Texture::createRenderBuffer(depthFormat, frameSize.x, frameSize.y));
|
||||
_framebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("deferredFramebufferSeparateDepth"));
|
||||
_framebuffer->setDepthStencilBuffer(depthStencilTexture, depthFormat);
|
||||
for (decltype(deferredFramebuffer->getNumRenderBuffers()) i = 0; i < renderbufferCount; i++) {
|
||||
_framebuffer->setRenderBuffer(i, deferredFramebuffer->getRenderBuffer(i));
|
||||
}
|
||||
}
|
||||
|
||||
RenderArgs* args = renderContext->args;
|
||||
gpu::doInBatch("SetSeparateDeferredDepthBuffer::run", args->_context, [this](gpu::Batch& batch) {
|
||||
batch.setFramebuffer(_framebuffer);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -87,7 +87,8 @@ public:
|
|||
using JobModel = render::Job::ModelI<DrawStateSortDeferred, Inputs, Config>;
|
||||
|
||||
DrawStateSortDeferred(render::ShapePlumberPointer shapePlumber)
|
||||
: _shapePlumber{ shapePlumber } {}
|
||||
: _shapePlumber{ shapePlumber } {
|
||||
}
|
||||
|
||||
void configure(const Config& config) {
|
||||
_maxDrawn = config.maxDrawn;
|
||||
|
@ -101,6 +102,19 @@ protected:
|
|||
bool _stateSort;
|
||||
};
|
||||
|
||||
class SetSeparateDeferredDepthBuffer {
|
||||
public:
|
||||
using Inputs = DeferredFramebufferPointer;
|
||||
using JobModel = render::Job::ModelI<SetSeparateDeferredDepthBuffer, Inputs>;
|
||||
|
||||
SetSeparateDeferredDepthBuffer() = default;
|
||||
|
||||
void run(const render::RenderContextPointer& renderContext, const Inputs& inputs);
|
||||
|
||||
protected:
|
||||
gpu::FramebufferPointer _framebuffer;
|
||||
};
|
||||
|
||||
class RenderDeferredTaskConfig : public render::Task::Config {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(float fadeScale MEMBER fadeScale NOTIFY dirty)
|
||||
|
|
|
@ -80,9 +80,10 @@ void RenderForwardTask::build(JobModel& task, const render::Varying& input, rend
|
|||
const auto filteredOverlaysTransparent = task.addJob<FilterLayeredItems>("FilterOverlaysLayeredTransparent", overlayTransparents, render::hifi::LAYER_3D_FRONT);
|
||||
const auto overlaysInFrontOpaque = filteredOverlaysOpaque.getN<FilterLayeredItems::Outputs>(0);
|
||||
const auto overlaysInFrontTransparent = filteredOverlaysTransparent.getN<FilterLayeredItems::Outputs>(0);
|
||||
const auto nullJitter = Varying(glm::vec2(0.0f, 0.0f));
|
||||
|
||||
const auto overlayInFrontOpaquesInputs = DrawOverlay3D::Inputs(overlaysInFrontOpaque, lightingModel, nullptr).asVarying();
|
||||
const auto overlayInFrontTransparentsInputs = DrawOverlay3D::Inputs(overlaysInFrontTransparent, lightingModel, nullptr).asVarying();
|
||||
const auto overlayInFrontOpaquesInputs = DrawOverlay3D::Inputs(overlaysInFrontOpaque, lightingModel, nullJitter).asVarying();
|
||||
const auto overlayInFrontTransparentsInputs = DrawOverlay3D::Inputs(overlaysInFrontTransparent, lightingModel, nullJitter).asVarying();
|
||||
task.addJob<DrawOverlay3D>("DrawOverlayInFrontOpaque", overlayInFrontOpaquesInputs, true);
|
||||
task.addJob<DrawOverlay3D>("DrawOverlayInFrontTransparent", overlayInFrontTransparentsInputs, false);
|
||||
|
||||
|
|
Loading…
Reference in a new issue