Graphics: Add gamma correction

This commit is contained in:
SirLynix
2023-09-10 14:34:56 +02:00
committed by Jérôme Leclercq
parent 041be74b9d
commit d40b8af68d
12 changed files with 269 additions and 10 deletions

View File

@@ -45,8 +45,9 @@ namespace Nz
{
DebugDraw,
DepthPrepass,
GammaCorrection,
Max = DepthPrepass
Max = GammaCorrection
};
template<>

View File

@@ -20,6 +20,7 @@
#include <Nazara/Graphics/Light.hpp>
#include <Nazara/Graphics/LightShadowData.hpp>
#include <Nazara/Graphics/MaterialPass.hpp>
#include <Nazara/Graphics/PostProcessPipelinePass.hpp>
#include <Nazara/Graphics/RenderElement.hpp>
#include <Nazara/Graphics/RenderQueue.hpp>
#include <Nazara/Graphics/RenderQueueRegistry.hpp>
@@ -138,6 +139,7 @@ namespace Nz
std::unique_ptr<DepthPipelinePass> depthPrepass;
std::unique_ptr<ForwardPipelinePass> forwardPass;
std::unique_ptr<DebugDrawPipelinePass> debugDrawPass;
std::unique_ptr<PostProcessPipelinePass> gammaCorrectionPass;
AbstractViewer* viewer;
Int32 renderOrder = 0;
RenderQueueRegistry forwardRegistry;

View File

@@ -0,0 +1,57 @@
// 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
#pragma once
#ifndef NAZARA_GRAPHICS_POSTPROCESSPIPELINEPASS_HPP
#define NAZARA_GRAPHICS_POSTPROCESSPIPELINEPASS_HPP
#include <NazaraUtils/Prerequisites.hpp>
#include <Nazara/Graphics/Config.hpp>
#include <Nazara/Graphics/FramePipelinePass.hpp>
#include <Nazara/Graphics/UberShader.hpp>
namespace Nz
{
class FrameGraph;
class FramePass;
class FramePipeline;
class RenderFrame;
class RenderPipeline;
class ShaderBinding;
class NAZARA_GRAPHICS_API PostProcessPipelinePass : public FramePipelinePass
{
public:
PostProcessPipelinePass(FramePipeline& owner, std::string passName, std::string shaderName);
PostProcessPipelinePass(const PostProcessPipelinePass&) = delete;
PostProcessPipelinePass(PostProcessPipelinePass&&) = delete;
~PostProcessPipelinePass() = default;
void Prepare(RenderFrame& renderFrame);
FramePass& RegisterToFrameGraph(FrameGraph& frameGraph, std::size_t inputColorBufferIndex, std::size_t outputColorBufferIndex);
PostProcessPipelinePass& operator=(const PostProcessPipelinePass&) = delete;
PostProcessPipelinePass& operator=(PostProcessPipelinePass&&) = delete;
private:
void BuildPipeline();
NazaraSlot(UberShader, OnShaderUpdated, m_onShaderUpdated);
std::shared_ptr<RenderPipelineLayout> m_renderPipelineLayout;
std::shared_ptr<RenderPipeline> m_renderPipeline;
std::shared_ptr<RenderPipeline> m_nextRenderPipeline;
std::shared_ptr<ShaderBinding> m_shaderBinding;
std::string m_passName;
UberShader m_shader;
FramePipeline& m_pipeline;
bool m_rebuildFramePass;
};
}
#include <Nazara/Graphics/PostProcessPipelinePass.inl>
#endif // NAZARA_GRAPHICS_POSTPROCESSPIPELINEPASS_HPP

View File

@@ -0,0 +1,11 @@
// 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 <Nazara/Graphics/Debug.hpp>
namespace Nz
{
}
#include <Nazara/Graphics/DebugOff.hpp>