mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 12:28:02 +02:00
Created outline task but still need to create specific render job with z-pass shaders
This commit is contained in:
parent
75e06b691f
commit
d6ea01c4f3
4 changed files with 75 additions and 17 deletions
|
@ -12,6 +12,10 @@
|
||||||
|
|
||||||
#include "GeometryCache.h"
|
#include "GeometryCache.h"
|
||||||
|
|
||||||
|
#include <render/FilterTask.h>
|
||||||
|
|
||||||
|
#include "RenderDeferredTask.h"
|
||||||
|
|
||||||
#include "gpu/Context.h"
|
#include "gpu/Context.h"
|
||||||
#include "gpu/StandardShaderLib.h"
|
#include "gpu/StandardShaderLib.h"
|
||||||
|
|
||||||
|
@ -294,3 +298,38 @@ const gpu::PipelinePointer& DebugOutline::getDebugPipeline() {
|
||||||
|
|
||||||
return _debugPipeline;
|
return _debugPipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DrawOutlineTask::DrawOutlineTask() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawOutlineTask::configure(const Config& config) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawOutlineTask::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs) {
|
||||||
|
const auto input = inputs.get<Inputs>();
|
||||||
|
const auto selectedMetas = inputs.getN<Inputs>(0);
|
||||||
|
const auto shapePlumber = input.get1();
|
||||||
|
const auto lightingModel = inputs.getN<Inputs>(2);
|
||||||
|
const auto deferredFramebuffer = inputs.getN<Inputs>(3);
|
||||||
|
const auto primaryFramebuffer = inputs.getN<Inputs>(4);
|
||||||
|
const auto deferredFrameTransform = inputs.getN<Inputs>(5);
|
||||||
|
|
||||||
|
const auto& outlinedItems = task.addJob<render::MetaToSubItems>("OutlinedMetaToSubItems", selectedMetas);
|
||||||
|
|
||||||
|
// Render opaque outline objects first in DeferredBuffer
|
||||||
|
const auto outlineInputs = DrawStateSortDeferred::Inputs(outlinedItems, lightingModel).asVarying();
|
||||||
|
task.addJob<DrawStateSortDeferred>("DrawOutlinedDepth", outlineInputs, shapePlumber);
|
||||||
|
|
||||||
|
// Retrieve z value of the outlined objects
|
||||||
|
const auto outlinePrepareInputs = PrepareOutline::Inputs(outlinedItems, deferredFramebuffer).asVarying();
|
||||||
|
const auto outlinedFrameBuffer = task.addJob<PrepareOutline>("CopyOutlineDepth", outlinePrepareInputs);
|
||||||
|
|
||||||
|
// Draw outline
|
||||||
|
const auto drawOutlineInputs = DrawOutline::Inputs(deferredFrameTransform, deferredFramebuffer, outlinedFrameBuffer, primaryFramebuffer).asVarying();
|
||||||
|
task.addJob<DrawOutline>("DrawOutlineEffect", drawOutlineInputs);
|
||||||
|
|
||||||
|
// Debug outline
|
||||||
|
task.addJob<DebugOutline>("DebugOutline", outlinedFrameBuffer);
|
||||||
|
}
|
||||||
|
|
|
@ -165,6 +165,21 @@ private:
|
||||||
bool _isDisplayDepthEnabled{ false };
|
bool _isDisplayDepthEnabled{ false };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#include "LightingModel.h"
|
||||||
|
|
||||||
|
class DrawOutlineTask {
|
||||||
|
public:
|
||||||
|
using Inputs = render::VaryingSet6<render::ItemBounds, render::ShapePlumberPointer, LightingModelPointer, DeferredFramebufferPointer, gpu::FramebufferPointer, DeferredFrameTransformPointer>;
|
||||||
|
using Config = render::Task::Config;
|
||||||
|
using JobModel = render::Task::ModelI<DrawOutlineTask, Inputs, Config>;
|
||||||
|
|
||||||
|
DrawOutlineTask();
|
||||||
|
|
||||||
|
void configure(const Config& config);
|
||||||
|
void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
#endif // hifi_render_utils_OutlineEffect_h
|
#endif // hifi_render_utils_OutlineEffect_h
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -95,17 +95,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
task.addJob<PrepareStencil>("PrepareStencil", primaryFramebuffer);
|
task.addJob<PrepareStencil>("PrepareStencil", primaryFramebuffer);
|
||||||
|
|
||||||
// Select items that need to be outlined
|
// Select items that need to be outlined
|
||||||
const auto outlineSelectionName = "contextOverlayHighlightList";
|
|
||||||
const auto selectedMetas = task.addJob<SelectItems>("PassTestSelection", metas, "contextOverlayHighlightList");
|
const auto selectedMetas = task.addJob<SelectItems>("PassTestSelection", metas, "contextOverlayHighlightList");
|
||||||
const auto outlinedItems = task.addJob<MetaToSubItems>("OutlinedMetaToSubItems", selectedMetas);
|
|
||||||
|
|
||||||
// Render opaque outline objects first in DeferredBuffer
|
|
||||||
const auto outlineInputs = DrawStateSortDeferred::Inputs(outlinedItems, lightingModel).asVarying();
|
|
||||||
task.addJob<DrawStateSortDeferred>("DrawOutlinedDepth", outlineInputs, shapePlumber);
|
|
||||||
|
|
||||||
// Retrieve z value of the outlined objects
|
|
||||||
const auto outlinePrepareInputs = PrepareOutline::Inputs(outlinedItems, deferredFramebuffer).asVarying();
|
|
||||||
const auto outlinedFrameBuffer = task.addJob<PrepareOutline>("PrepareOutline", outlinePrepareInputs);
|
|
||||||
|
|
||||||
// Render opaque objects in DeferredBuffer
|
// Render opaque objects in DeferredBuffer
|
||||||
const auto opaqueInputs = DrawStateSortDeferred::Inputs(opaques, lightingModel).asVarying();
|
const auto opaqueInputs = DrawStateSortDeferred::Inputs(opaques, lightingModel).asVarying();
|
||||||
|
@ -173,12 +163,11 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
const auto toneAndPostRangeTimer = task.addJob<BeginGPURangeTimer>("BeginToneAndPostRangeTimer", "PostToneOverlaysAntialiasing");
|
const auto toneAndPostRangeTimer = task.addJob<BeginGPURangeTimer>("BeginToneAndPostRangeTimer", "PostToneOverlaysAntialiasing");
|
||||||
|
|
||||||
// Lighting Buffer ready for tone mapping
|
// Lighting Buffer ready for tone mapping
|
||||||
const auto toneMappingInputs = render::Varying(ToneMappingDeferred::Inputs(lightingFramebuffer, primaryFramebuffer));
|
const auto toneMappingInputs = ToneMappingDeferred::Inputs(lightingFramebuffer, primaryFramebuffer).asVarying();
|
||||||
task.addJob<ToneMappingDeferred>("ToneMapping", toneMappingInputs);
|
task.addJob<ToneMappingDeferred>("ToneMapping", toneMappingInputs);
|
||||||
|
|
||||||
// Draw outline
|
const auto outlineInputs = DrawOutlineTask::Inputs(selectedMetas, shapePlumber, lightingModel, deferredFramebuffer, primaryFramebuffer, deferredFrameTransform).asVarying();
|
||||||
const auto drawOutlineInputs = DrawOutline::Inputs(deferredFrameTransform, deferredFramebuffer, outlinedFrameBuffer, primaryFramebuffer).asVarying();
|
task.addJob<DrawOutlineTask>("DrawOutline", outlineInputs);
|
||||||
task.addJob<DrawOutline>("DrawOutline", drawOutlineInputs);
|
|
||||||
|
|
||||||
{ // DEbug the bounds of the rendered items, still look at the zbuffer
|
{ // DEbug the bounds of the rendered items, still look at the zbuffer
|
||||||
task.addJob<DrawBounds>("DrawMetaBounds", metas);
|
task.addJob<DrawBounds>("DrawMetaBounds", metas);
|
||||||
|
@ -213,9 +202,6 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
const auto debugAmbientOcclusionInputs = DebugAmbientOcclusion::Inputs(deferredFrameTransform, deferredFramebuffer, linearDepthTarget, ambientOcclusionUniforms).asVarying();
|
const auto debugAmbientOcclusionInputs = DebugAmbientOcclusion::Inputs(deferredFrameTransform, deferredFramebuffer, linearDepthTarget, ambientOcclusionUniforms).asVarying();
|
||||||
task.addJob<DebugAmbientOcclusion>("DebugAmbientOcclusion", debugAmbientOcclusionInputs);
|
task.addJob<DebugAmbientOcclusion>("DebugAmbientOcclusion", debugAmbientOcclusionInputs);
|
||||||
|
|
||||||
// Debug outline
|
|
||||||
task.addJob<DebugOutline>("DebugOutline", outlinedFrameBuffer);
|
|
||||||
|
|
||||||
// Scene Octree Debugging job
|
// Scene Octree Debugging job
|
||||||
{
|
{
|
||||||
task.addJob<DrawSceneOctree>("DrawSceneOctree", spatialSelection);
|
task.addJob<DrawSceneOctree>("DrawSceneOctree", spatialSelection);
|
||||||
|
|
|
@ -238,6 +238,24 @@ public:
|
||||||
const T5& get5() const { return std::get<5>((*this)).template get<T5>(); }
|
const T5& get5() const { return std::get<5>((*this)).template get<T5>(); }
|
||||||
T5& edit5() { return std::get<5>((*this)).template edit<T5>(); }
|
T5& edit5() { return std::get<5>((*this)).template edit<T5>(); }
|
||||||
|
|
||||||
|
virtual Varying operator[] (uint8_t index) const {
|
||||||
|
switch (index) {
|
||||||
|
default:
|
||||||
|
return std::get<0>((*this));
|
||||||
|
case 1:
|
||||||
|
return std::get<1>((*this));
|
||||||
|
case 2:
|
||||||
|
return std::get<2>((*this));
|
||||||
|
case 3:
|
||||||
|
return std::get<3>((*this));
|
||||||
|
case 4:
|
||||||
|
return std::get<4>((*this));
|
||||||
|
case 5:
|
||||||
|
return std::get<5>((*this));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
virtual uint8_t length() const { return 6; }
|
||||||
|
|
||||||
Varying asVarying() const { return Varying((*this)); }
|
Varying asVarying() const { return Varying((*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue