mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-06 17:41:04 +00:00
Lots of changes
some redundant stuff in vertex shaders needs fixing
This commit is contained in:
parent
ded1b09838
commit
ca4f04ecab
9 changed files with 138 additions and 23 deletions
|
@ -409,6 +409,8 @@ class GameGlobalShaderConstantSetter : public IShaderConstantSetter
|
|||
CachedPixelShaderSetting<float> m_bloom_radius_pixel{"bloomRadius"};
|
||||
float m_bloom_radius;
|
||||
CachedPixelShaderSetting<float> m_saturation_pixel{"saturation"};
|
||||
float m_gamma;
|
||||
CachedPixelShaderSetting<float> m_gamma_pixel{"gamma"};
|
||||
bool m_volumetric_light_enabled;
|
||||
CachedPixelShaderSetting<float, 3>
|
||||
m_sun_position_pixel{"sunPositionScreen"};
|
||||
|
@ -419,11 +421,12 @@ class GameGlobalShaderConstantSetter : public IShaderConstantSetter
|
|||
CachedPixelShaderSetting<float>
|
||||
m_volumetric_light_strength_pixel{"volumetricLightStrength"};
|
||||
|
||||
static constexpr std::array<const char*, 4> SETTING_CALLBACKS = {
|
||||
static constexpr std::array<const char*, 5> SETTING_CALLBACKS = {
|
||||
"exposure_compensation",
|
||||
"bloom_intensity",
|
||||
"bloom_strength_factor",
|
||||
"bloom_radius"
|
||||
"bloom_radius",
|
||||
"gamma"
|
||||
};
|
||||
|
||||
public:
|
||||
|
@ -437,6 +440,8 @@ public:
|
|||
m_bloom_strength = RenderingEngine::BASE_BLOOM_STRENGTH * g_settings->getFloat("bloom_strength_factor", 0.1f, 10.0f);
|
||||
if (name == "bloom_radius")
|
||||
m_bloom_radius = g_settings->getFloat("bloom_radius", 0.1f, 8.0f);
|
||||
if (name == "gamma")
|
||||
m_gamma = g_settings->getFloat("gamma", 1.0f, 5.0f);
|
||||
}
|
||||
|
||||
static void settingsCallback(const std::string &name, void *userdata)
|
||||
|
@ -458,6 +463,7 @@ public:
|
|||
m_bloom_intensity = g_settings->getFloat("bloom_intensity", 0.01f, 1.0f);
|
||||
m_bloom_strength = RenderingEngine::BASE_BLOOM_STRENGTH * g_settings->getFloat("bloom_strength_factor", 0.1f, 10.0f);
|
||||
m_bloom_radius = g_settings->getFloat("bloom_radius", 0.1f, 8.0f);
|
||||
m_gamma = g_settings->getFloat("gamma", 1.0f, 5.0f);
|
||||
m_volumetric_light_enabled = g_settings->getBool("enable_volumetric_lighting") && m_bloom_enabled;
|
||||
}
|
||||
|
||||
|
@ -523,6 +529,8 @@ public:
|
|||
m_bloom_strength_pixel.set(&m_bloom_strength, services);
|
||||
}
|
||||
|
||||
m_gamma_pixel.set(&m_gamma, services);
|
||||
|
||||
const auto &lighting = m_client->getEnv().getLocalPlayer()->getLighting();
|
||||
float saturation = lighting.saturation;
|
||||
m_saturation_pixel.set(&saturation, services);
|
||||
|
|
|
@ -688,6 +688,9 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
|
|||
if (g_settings->getBool("shadow_poisson_filter"))
|
||||
shaders_header << "#define POISSON_FILTER 1\n";
|
||||
|
||||
if (g_settings->getBool("enable_bumpmaps"))
|
||||
shaders_header << "#define ENABLE_BUMPMAPS 1\n";
|
||||
|
||||
s32 shadow_filter = g_settings->getS32("shadow_filters");
|
||||
shaders_header << "#define SHADOW_FILTER " << shadow_filter << "\n";
|
||||
|
||||
|
@ -706,6 +709,12 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
|
|||
if (g_settings->getBool("enable_auto_exposure"))
|
||||
shaders_header << "#define ENABLE_AUTO_EXPOSURE 1\n";
|
||||
|
||||
if (g_settings->getBool("enable_color_grading"))
|
||||
shaders_header << "#define ENABLE_COLOR_GRADING 1\n";
|
||||
|
||||
if (g_settings->getBool("enable_vignette"))
|
||||
shaders_header << "#define ENABLE_VIGNETTE 1\n";
|
||||
|
||||
if (g_settings->get("antialiasing") == "ssaa") {
|
||||
shaders_header << "#define ENABLE_SSAA 1\n";
|
||||
u16 ssaa_scale = MYMAX(2, g_settings->getU16("fsaa"));
|
||||
|
|
|
@ -331,6 +331,9 @@ void set_default_settings()
|
|||
settings->setDefault("enable_waving_plants", "false");
|
||||
settings->setDefault("exposure_compensation", "0.0");
|
||||
settings->setDefault("enable_auto_exposure", "false");
|
||||
settings->setDefault("enable_color_grading", "false");
|
||||
settings->setDefault("enable_vignette", "false");
|
||||
settings->setDefault("gamma", "1.6");
|
||||
settings->setDefault("debanding", "true");
|
||||
settings->setDefault("antialiasing", "none");
|
||||
settings->setDefault("enable_bloom", "false");
|
||||
|
@ -339,6 +342,7 @@ void set_default_settings()
|
|||
settings->setDefault("bloom_intensity", "0.05");
|
||||
settings->setDefault("bloom_radius", "1");
|
||||
settings->setDefault("enable_volumetric_lighting", "false");
|
||||
settings->setDefault("enable_bumpmaps", "false");
|
||||
|
||||
// Effects Shadows
|
||||
settings->setDefault("enable_dynamic_shadows", "false");
|
||||
|
|
|
@ -56,5 +56,5 @@ struct Lighting
|
|||
float shadow_intensity {0.0f};
|
||||
float saturation {1.0f};
|
||||
float volumetric_light_strength {0.0f};
|
||||
video::SColor artificial_light_color{ 133, 133, 133, 255 };
|
||||
video::SColor artificial_light_color{ 255, 133, 133, 133 };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue