mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 03:59:18 +02:00
Debugging scripts working again with correct occlusion management
This commit is contained in:
parent
10643feb78
commit
25ff132fc7
7 changed files with 23 additions and 31 deletions
|
@ -145,12 +145,12 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I
|
||||||
auto mainFrameBuffer = inputs.get1();
|
auto mainFrameBuffer = inputs.get1();
|
||||||
|
|
||||||
if (mainFrameBuffer) {
|
if (mainFrameBuffer) {
|
||||||
auto sceneDepthBuffer = mainFrameBuffer->getPrimaryDepthTexture();
|
auto sceneDepthBuffer = inputs.get2();
|
||||||
const auto frameTransform = inputs.get0();
|
const auto frameTransform = inputs.get0();
|
||||||
auto outlinedDepthBuffer = inputs.get2();
|
auto outlinedDepthBuffer = mainFrameBuffer->getPrimaryDepthTexture();
|
||||||
auto destinationFrameBuffer = inputs.get3();
|
auto destinationFrameBuffer = inputs.get3();
|
||||||
auto pipeline = getPipeline();
|
auto pipeline = getPipeline();
|
||||||
auto framebufferSize = glm::ivec2(sceneDepthBuffer->getDimensions());
|
auto framebufferSize = glm::ivec2(outlinedDepthBuffer->getDimensions());
|
||||||
|
|
||||||
if (!_primaryWithoutDepthBuffer || framebufferSize!=_frameBufferSize) {
|
if (!_primaryWithoutDepthBuffer || framebufferSize!=_frameBufferSize) {
|
||||||
// Failing to recreate this frame buffer when the screen has been resized creates a bug on Mac
|
// Failing to recreate this frame buffer when the screen has been resized creates a bug on Mac
|
||||||
|
@ -159,7 +159,7 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I
|
||||||
_frameBufferSize = framebufferSize;
|
_frameBufferSize = framebufferSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outlinedDepthBuffer) {
|
if (sceneDepthBuffer) {
|
||||||
auto args = renderContext->args;
|
auto args = renderContext->args;
|
||||||
{
|
{
|
||||||
auto& configuration = _configuration.edit();
|
auto& configuration = _configuration.edit();
|
||||||
|
@ -185,8 +185,8 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I
|
||||||
|
|
||||||
batch.setUniformBuffer(OUTLINE_PARAMS_SLOT, _configuration);
|
batch.setUniformBuffer(OUTLINE_PARAMS_SLOT, _configuration);
|
||||||
batch.setUniformBuffer(FRAME_TRANSFORM_SLOT, frameTransform->getFrameTransformBuffer());
|
batch.setUniformBuffer(FRAME_TRANSFORM_SLOT, frameTransform->getFrameTransformBuffer());
|
||||||
batch.setResourceTexture(SCENE_DEPTH_SLOT, sceneDepthBuffer);
|
batch.setResourceTexture(SCENE_DEPTH_SLOT, sceneDepthBuffer->getDepthTexture());
|
||||||
batch.setResourceTexture(OUTLINED_DEPTH_SLOT, outlinedDepthBuffer->getDepthTexture());
|
batch.setResourceTexture(OUTLINED_DEPTH_SLOT, outlinedDepthBuffer);
|
||||||
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||||
|
|
||||||
// Restore previous frame buffer
|
// Restore previous frame buffer
|
||||||
|
@ -255,7 +255,7 @@ void DebugOutline::run(const render::RenderContextPointer& renderContext, const
|
||||||
batch.setModelTransform(Transform());
|
batch.setModelTransform(Transform());
|
||||||
|
|
||||||
batch.setPipeline(getDebugPipeline());
|
batch.setPipeline(getDebugPipeline());
|
||||||
batch.setResourceTexture(0, outlineFramebuffer->getDepthTexture());
|
batch.setResourceTexture(0, outlineFramebuffer->getPrimaryDepthTexture());
|
||||||
|
|
||||||
const glm::vec4 color(1.0f, 0.5f, 0.2f, 1.0f);
|
const glm::vec4 color(1.0f, 0.5f, 0.2f, 1.0f);
|
||||||
const glm::vec2 bottomLeft(-1.0f, -1.0f);
|
const glm::vec2 bottomLeft(-1.0f, -1.0f);
|
||||||
|
@ -369,7 +369,7 @@ void DrawOutlineTask::build(JobModel& task, const render::Varying& inputs, rende
|
||||||
const auto input = inputs.get<Inputs>();
|
const auto input = inputs.get<Inputs>();
|
||||||
const auto selectedMetas = inputs.getN<Inputs>(0);
|
const auto selectedMetas = inputs.getN<Inputs>(0);
|
||||||
const auto shapePlumber = input.get1();
|
const auto shapePlumber = input.get1();
|
||||||
const auto deferredFramebuffer = inputs.getN<Inputs>(2);
|
const auto outlinedFrameBuffer = inputs.getN<Inputs>(2);
|
||||||
const auto primaryFramebuffer = inputs.getN<Inputs>(3);
|
const auto primaryFramebuffer = inputs.getN<Inputs>(3);
|
||||||
const auto deferredFrameTransform = inputs.getN<Inputs>(4);
|
const auto deferredFrameTransform = inputs.getN<Inputs>(4);
|
||||||
|
|
||||||
|
@ -383,22 +383,22 @@ void DrawOutlineTask::build(JobModel& task, const render::Varying& inputs, rende
|
||||||
initZPassPipelines(*shapePlumberZPass, state);
|
initZPassPipelines(*shapePlumberZPass, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& outlinedItemIDs = task.addJob<render::MetaToSubItems>("MetaToSubItemIDs", selectedMetas);
|
const auto& outlinedItemIDs = task.addJob<render::MetaToSubItems>("OutlineMetaToSubItemIDs", selectedMetas);
|
||||||
const auto& outlinedItems = task.addJob<render::IDsToBounds>("MetaToSubItems", outlinedItemIDs, true);
|
const auto& outlinedItems = task.addJob<render::IDsToBounds>("OutlineMetaToSubItems", outlinedItemIDs, true);
|
||||||
|
|
||||||
|
// Retrieve z value of the scene objects
|
||||||
|
const auto outlinePrepareInputs = PrepareOutline::Inputs(outlinedItems, outlinedFrameBuffer).asVarying();
|
||||||
|
const auto sceneFrameBuffer = task.addJob<PrepareOutline>("OutlineCopyDepth", outlinePrepareInputs);
|
||||||
|
|
||||||
// Sort
|
// Sort
|
||||||
const auto& sortedPipelines = task.addJob<render::PipelineSortShapes>("PipelineSort", outlinedItems);
|
const auto& sortedPipelines = task.addJob<render::PipelineSortShapes>("OutlinePipelineSort", outlinedItems);
|
||||||
const auto& sortedShapes = task.addJob<render::DepthSortShapes>("DepthSort", sortedPipelines);
|
const auto& sortedShapes = task.addJob<render::DepthSortShapes>("OutlineDepthSort", sortedPipelines);
|
||||||
task.addJob<DrawOutlineDepth>("Depth", sortedShapes, shapePlumberZPass);
|
task.addJob<DrawOutlineDepth>("OutlineDepth", sortedShapes, shapePlumberZPass);
|
||||||
|
|
||||||
// Retrieve z value of the outlined objects
|
|
||||||
const auto outlinePrepareInputs = PrepareOutline::Inputs(outlinedItems, deferredFramebuffer).asVarying();
|
|
||||||
const auto outlinedFrameBuffer = task.addJob<PrepareOutline>("CopyDepth", outlinePrepareInputs);
|
|
||||||
|
|
||||||
// Draw outline
|
// Draw outline
|
||||||
const auto drawOutlineInputs = DrawOutline::Inputs(deferredFrameTransform, deferredFramebuffer, outlinedFrameBuffer, primaryFramebuffer).asVarying();
|
const auto drawOutlineInputs = DrawOutline::Inputs(deferredFrameTransform, outlinedFrameBuffer, sceneFrameBuffer, primaryFramebuffer).asVarying();
|
||||||
task.addJob<DrawOutline>("Effect", drawOutlineInputs);
|
task.addJob<DrawOutline>("OutlineEffect", drawOutlineInputs);
|
||||||
|
|
||||||
// Debug outline
|
// Debug outline
|
||||||
task.addJob<DebugOutline>("Debug", outlinedFrameBuffer);
|
task.addJob<DebugOutline>("OutlineDebug", outlinedFrameBuffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,7 @@ signals:
|
||||||
|
|
||||||
class DebugOutline {
|
class DebugOutline {
|
||||||
public:
|
public:
|
||||||
using Inputs = OutlineFramebufferPointer;
|
using Inputs = DeferredFramebufferPointer;
|
||||||
using Config = DebugOutlineConfig;
|
using Config = DebugOutlineConfig;
|
||||||
using JobModel = render::Job::ModelI<DebugOutline, Inputs, Config>;
|
using JobModel = render::Job::ModelI<DebugOutline, Inputs, Config>;
|
||||||
|
|
||||||
|
|
BIN
scripts/developer/utilities/lib/plotperf/PlotPerf.qmlc
Normal file
BIN
scripts/developer/utilities/lib/plotperf/PlotPerf.qmlc
Normal file
Binary file not shown.
Binary file not shown.
BIN
scripts/developer/utilities/render/fade.qmlc
Normal file
BIN
scripts/developer/utilities/render/fade.qmlc
Normal file
Binary file not shown.
|
@ -14,20 +14,12 @@ import "configSlider"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
property var pickConfig: Render.getConfig("RenderMainView.PickOutlined")
|
property var debugConfig: Render.getConfig("RenderMainView.OutlineDebug")
|
||||||
property var debugConfig: Render.getConfig("RenderMainView.DebugOutline")
|
property var drawConfig: Render.getConfig("RenderMainView.OutlineEffect")
|
||||||
property var drawConfig: Render.getConfig("RenderMainView.DrawOutline")
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
CheckBox {
|
|
||||||
text: "Edit Outline"
|
|
||||||
checked: root.pickConfig["pick"]
|
|
||||||
onCheckedChanged: {
|
|
||||||
root.pickConfig["pick"] = checked;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CheckBox {
|
CheckBox {
|
||||||
text: "View Outlined Depth"
|
text: "View Outlined Depth"
|
||||||
checked: root.debugConfig["viewOutlinedDepth"]
|
checked: root.debugConfig["viewOutlinedDepth"]
|
||||||
|
|
BIN
scripts/developer/utilities/render/outline.qmlc
Normal file
BIN
scripts/developer/utilities/render/outline.qmlc
Normal file
Binary file not shown.
Loading…
Reference in a new issue