From f622afe55d5ac162d8b152e336cc725248e91fde Mon Sep 17 00:00:00 2001 From: FlayaN Date: Thu, 8 Feb 2024 15:36:39 +0100 Subject: [PATCH] refactor: move LightingData into common (#174) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: move LightingData into common fix #171 * style: 🎨 apply clang-format changes * style: add endline --------- Co-authored-by: FlayaN --- features/Grass Lighting/Shaders/RunGrass.hlsl | 9 +-------- features/Tree LOD Lighting/Shaders/DistantTree.hlsl | 9 +-------- package/Shaders/Common/LightingData.hlsl | 7 +++++++ package/Shaders/Lighting.hlsl | 9 +-------- 4 files changed, 10 insertions(+), 24 deletions(-) create mode 100644 package/Shaders/Common/LightingData.hlsl diff --git a/features/Grass Lighting/Shaders/RunGrass.hlsl b/features/Grass Lighting/Shaders/RunGrass.hlsl index 4aa36e5f6..284925e03 100644 --- a/features/Grass Lighting/Shaders/RunGrass.hlsl +++ b/features/Grass Lighting/Shaders/RunGrass.hlsl @@ -1,15 +1,8 @@ #include "Common/Color.hlsl" #include "Common/FrameBuffer.hlsl" +#include "Common/LightingData.hlsl" #include "Common/MotionBlur.hlsl" -struct LightingData -{ - float WaterHeight[25]; - bool Reflections; -}; - -StructuredBuffer lightingData : register(t126); - #define GRASS struct VS_INPUT diff --git a/features/Tree LOD Lighting/Shaders/DistantTree.hlsl b/features/Tree LOD Lighting/Shaders/DistantTree.hlsl index cebc3fea7..5b133ed11 100644 --- a/features/Tree LOD Lighting/Shaders/DistantTree.hlsl +++ b/features/Tree LOD Lighting/Shaders/DistantTree.hlsl @@ -1,15 +1,8 @@ #include "Common/Color.hlsl" #include "Common/FrameBuffer.hlsl" +#include "Common/LightingData.hlsl" #include "Common/MotionBlur.hlsl" -struct LightingData -{ - float WaterHeight[25]; - bool Reflections; -}; - -StructuredBuffer lightingData : register(t126); - cbuffer PerFrame : register(b3) { row_major float3x4 DirectionalAmbient; diff --git a/package/Shaders/Common/LightingData.hlsl b/package/Shaders/Common/LightingData.hlsl new file mode 100644 index 000000000..641e133ac --- /dev/null +++ b/package/Shaders/Common/LightingData.hlsl @@ -0,0 +1,7 @@ +struct LightingData +{ + float WaterHeight[25]; + bool Reflections; +}; + +StructuredBuffer lightingData : register(t126); diff --git a/package/Shaders/Lighting.hlsl b/package/Shaders/Lighting.hlsl index 9db60eaf5..5421ef946 100644 --- a/package/Shaders/Lighting.hlsl +++ b/package/Shaders/Lighting.hlsl @@ -1,18 +1,11 @@ #include "Common/Color.hlsl" #include "Common/FrameBuffer.hlsl" +#include "Common/LightingData.hlsl" #include "Common/MotionBlur.hlsl" #include "Common/Permutation.hlsl" #define PI 3.1415927 -struct LightingData -{ - float WaterHeight[25]; - bool Reflections; -}; - -StructuredBuffer lightingData : register(t126); - #if (defined(TREE_ANIM) || defined(LANDSCAPE)) && !defined(VC) # define VC #endif // TREE_ANIM || LANDSCAPE || !VC