1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-16 01:45:36 +02:00

Factor shadow constants out of MainShaderConstantSetter

This commit is contained in:
sfan5
2024-02-20 10:38:29 +01:00
parent 5da18d34ba
commit e9ab5bc223
6 changed files with 118 additions and 81 deletions

View File

@@ -23,6 +23,47 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <IShaderConstantSetCallBack.h>
#include "client/shader.h"
// Used by main game rendering
class ShadowConstantSetter : public IShaderConstantSetter
{
CachedPixelShaderSetting<f32, 16> m_shadow_view_proj{"m_ShadowViewProj"};
CachedPixelShaderSetting<f32, 3> m_light_direction{"v_LightDirection"};
CachedPixelShaderSetting<f32> m_texture_res{"f_textureresolution"};
CachedPixelShaderSetting<f32> m_shadow_strength{"f_shadow_strength"};
CachedPixelShaderSetting<f32> m_time_of_day{"f_timeofday"};
CachedPixelShaderSetting<f32> m_shadowfar{"f_shadowfar"};
CachedPixelShaderSetting<f32, 4> m_camera_pos{"CameraPos"};
CachedPixelShaderSetting<s32> m_shadow_texture{"ShadowMapSampler"};
CachedVertexShaderSetting<f32>
m_perspective_bias0_vertex{"xyPerspectiveBias0"};
CachedPixelShaderSetting<f32>
m_perspective_bias0_pixel{"xyPerspectiveBias0"};
CachedVertexShaderSetting<f32>
m_perspective_bias1_vertex{"xyPerspectiveBias1"};
CachedPixelShaderSetting<f32>
m_perspective_bias1_pixel{"xyPerspectiveBias1"};
CachedVertexShaderSetting<f32>
m_perspective_zbias_vertex{"zPerspectiveBias"};
CachedPixelShaderSetting<f32> m_perspective_zbias_pixel{"zPerspectiveBias"};
public:
ShadowConstantSetter() = default;
~ShadowConstantSetter() = default;
virtual void onSetConstants(video::IMaterialRendererServices *services) override;
};
class ShadowConstantSetterFactory : public IShaderConstantSetterFactory
{
public:
virtual IShaderConstantSetter *create() {
return new ShadowConstantSetter();
}
};
// Used by depth shader
class ShadowDepthShaderCB : public video::IShaderConstantSetCallBack
{
public: