# Conflicts: # Content/Shaders/GI/DDGI.flax # Content/Shaders/GI/GlobalSurfaceAtlas.flax # Content/Shaders/TAA.flax # Content/Shaders/VolumetricFog.flax # Source/Editor/CustomEditors/Editors/ActorTagEditor.cs # Source/Engine/Core/Config/GraphicsSettings.cpp # Source/Engine/Engine/PostProcessEffect.cs # Source/Engine/Graphics/GPUResourcesCollection.cpp # Source/Engine/Graphics/GPUResourcesCollection.h # Source/Engine/Graphics/PostProcessBase.h # Source/FlaxEngine.Gen.cs
65 lines
1.9 KiB
C++
65 lines
1.9 KiB
C++
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "Engine/Graphics/RenderView.h"
|
|
#include "Engine/Graphics/GPUPipelineStatePermutations.h"
|
|
#include "RendererPass.h"
|
|
#include "Engine/Content/Assets/Shader.h"
|
|
#include "Engine/Content/Assets/Model.h"
|
|
|
|
/// <summary>
|
|
/// Lighting rendering service. Handles dynamic lights diffuse and specular color calculations.
|
|
/// </summary>
|
|
class LightPass : public RendererPass<LightPass>
|
|
{
|
|
private:
|
|
AssetReference<Shader> _shader;
|
|
GPUPipelineStatePermutationsPs<2> _psLightDir;
|
|
GPUPipelineStatePermutationsPs<4> _psLightPointNormal;
|
|
GPUPipelineStatePermutationsPs<4> _psLightPointInverted;
|
|
GPUPipelineStatePermutationsPs<4> _psLightSpotNormal;
|
|
GPUPipelineStatePermutationsPs<4> _psLightSpotInverted;
|
|
GPUPipelineState* _psLightSkyNormal = nullptr;
|
|
GPUPipelineState* _psLightSkyInverted = nullptr;
|
|
GPUPipelineState* _psClearDiffuse = nullptr;
|
|
AssetReference<Model> _sphereModel;
|
|
PixelFormat _shadowMaskFormat;
|
|
|
|
public:
|
|
/// <summary>
|
|
/// Performs the lighting rendering for the input task.
|
|
/// </summary>
|
|
/// <param name="renderContextBatch">The rendering context batch.</param>
|
|
/// <param name="lightBuffer">The light accumulation buffer (input and output).</param>
|
|
void RenderLight(RenderContextBatch& renderContextBatch, GPUTextureView* lightBuffer);
|
|
|
|
private:
|
|
|
|
#if COMPILE_WITH_DEV_ENV
|
|
void OnShaderReloading(Asset* obj)
|
|
{
|
|
_psLightDir.Release();
|
|
_psLightPointNormal.Release();
|
|
_psLightPointInverted.Release();
|
|
_psLightSpotNormal.Release();
|
|
_psLightSpotInverted.Release();
|
|
_psLightSkyNormal->ReleaseGPU();
|
|
_psLightSkyInverted->ReleaseGPU();
|
|
invalidateResources();
|
|
}
|
|
#endif
|
|
|
|
public:
|
|
|
|
// [RendererPass]
|
|
String ToString() const override;
|
|
bool Init() override;
|
|
void Dispose() override;
|
|
|
|
protected:
|
|
|
|
// [RendererPass]
|
|
bool setupResources() override;
|
|
};
|