// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com) // This file is part of the "Nazara Engine - Graphics module" // For conditions of distribution and use, see copyright notice in Config.hpp #include #include #include #include #include #include #include #include namespace Nz { DebugDrawPipelinePass::DebugDrawPipelinePass(FramePipeline& owner, AbstractViewer* viewer) : m_viewer(viewer), m_pipeline(owner) { } void DebugDrawPipelinePass::Prepare(RenderFrame& renderFrame) { DebugDrawer& debugDrawer = m_pipeline.GetDebugDrawer(); debugDrawer.SetViewerData(m_viewer->GetViewerInstance().GetViewProjMatrix()); debugDrawer.Prepare(renderFrame); } FramePass& DebugDrawPipelinePass::RegisterToFrameGraph(FrameGraph& frameGraph, std::size_t inputColorBufferIndex, std::size_t outputColorBufferIndex) { FramePass& debugDrawPass = frameGraph.AddPass("Debug draw pass"); debugDrawPass.AddInput(inputColorBufferIndex); debugDrawPass.AddOutput(outputColorBufferIndex); debugDrawPass.SetExecutionCallback([&]() { return FramePassExecution::UpdateAndExecute; }); debugDrawPass.SetCommandCallback([this](CommandBufferBuilder& builder, const FramePassEnvironment& /*env*/) { Recti viewport = m_viewer->GetViewport(); builder.SetScissor(viewport); builder.SetViewport(viewport); DebugDrawer& debugDrawer = m_pipeline.GetDebugDrawer(); debugDrawer.Draw(builder); }); return debugDrawPass; } }