mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +00:00
Various changes and fixes
Hopefully this works, I haven't yet checked in detail for any problems.
This commit is contained in:
parent
e05544b84e
commit
51cb37570a
14 changed files with 72 additions and 56 deletions
|
@ -217,7 +217,6 @@ class GameGlobalShaderUniformSetter : public IShaderUniformSetter
|
|||
}};
|
||||
float m_user_exposure_compensation;
|
||||
bool m_bloom_enabled;
|
||||
bool m_color_grading_enabled;
|
||||
CachedPixelShaderSetting<float> m_bloom_intensity_pixel{"bloomIntensity"};
|
||||
CachedPixelShaderSetting<float> m_bloom_strength_pixel{"bloomStrength"};
|
||||
CachedPixelShaderSetting<float> m_bloom_radius_pixel{"bloomRadius"};
|
||||
|
@ -234,9 +233,9 @@ class GameGlobalShaderUniformSetter : public IShaderUniformSetter
|
|||
CachedPixelShaderSetting<float>
|
||||
m_volumetric_light_strength_pixel{"volumetricLightStrength"};
|
||||
CachedPixelShaderSetting<float, 3>
|
||||
m_volumetric_beta_r0_pixel{ "beta_r0_l" };
|
||||
m_atmospheric_scattering_coefficients_pixel{ "scattering_coefficients" };
|
||||
CachedVertexShaderSetting<float, 3>
|
||||
m_volumetric_beta_r0_vertex{ "beta_r0_l" };
|
||||
m_atmospheric_scattering_coefficients_vertex{ "scattering_coefficients" };
|
||||
CachedPixelShaderSetting<float, 3> m_cdl_slope_pixel{"cdl_slope"};
|
||||
CachedPixelShaderSetting<float, 3> m_cdl_offset_pixel{"cdl_offset"};
|
||||
CachedPixelShaderSetting<float, 3> m_cdl_power_pixel{"cdl_power"};
|
||||
|
@ -275,7 +274,6 @@ public:
|
|||
m_bloom_enabled = g_settings->getBool("enable_bloom");
|
||||
m_volumetric_light_enabled = g_settings->getBool("enable_volumetric_lighting") && m_bloom_enabled;
|
||||
m_gamma = g_settings->getFloat("secondstage_gamma");
|
||||
m_color_grading_enabled = g_settings->getBool("enable_color_grading");
|
||||
}
|
||||
|
||||
~GameGlobalShaderUniformSetter()
|
||||
|
@ -356,12 +354,10 @@ public:
|
|||
m_foliage_translucency_pixel.set(&lighting.foliage_translucency, services);
|
||||
m_specular_intensity_pixel.set(&lighting.specular_intensity, services);
|
||||
|
||||
if (m_color_grading_enabled) {
|
||||
const ColorDecisionList& cdl_params = lighting.cdl;
|
||||
m_cdl_slope_pixel.set(cdl_params.slope, services);
|
||||
m_cdl_offset_pixel.set(cdl_params.offset, services);
|
||||
m_cdl_power_pixel.set(cdl_params.power, services);
|
||||
}
|
||||
const ColorDecisionList& cdl_params = lighting.cdl;
|
||||
m_cdl_slope_pixel.set(cdl_params.slope, services);
|
||||
m_cdl_offset_pixel.set(cdl_params.offset, services);
|
||||
m_cdl_power_pixel.set(cdl_params.power, services);
|
||||
|
||||
if (m_volumetric_light_enabled) {
|
||||
// Map directional light to screen space
|
||||
|
@ -407,9 +403,9 @@ public:
|
|||
m_volumetric_light_strength_pixel.set(&volumetric_light_strength, services);
|
||||
}
|
||||
|
||||
v3f beta_r0 = lighting.volumetric_beta_r0;
|
||||
m_volumetric_beta_r0_vertex.set(beta_r0, services);
|
||||
m_volumetric_beta_r0_pixel.set(beta_r0, services);
|
||||
v3f scattering_coefficients = lighting.scattering_coefficients;
|
||||
m_atmospheric_scattering_coefficients_vertex.set(scattering_coefficients, services);
|
||||
m_atmospheric_scattering_coefficients_pixel.set(scattering_coefficients, services);
|
||||
}
|
||||
|
||||
void onSetMaterial(const video::SMaterial &material) override
|
||||
|
@ -504,8 +500,9 @@ public:
|
|||
#undef PROVIDE
|
||||
|
||||
bool enable_waving_water = g_settings->getBool("enable_waving_water");
|
||||
bool enable_water_reflections = g_settings->getBool("enable_water_reflections");
|
||||
constants["ENABLE_WAVING_WATER"] = enable_waving_water ? 1 : 0;
|
||||
if (enable_waving_water) {
|
||||
if (enable_waving_water || enable_water_reflections) {
|
||||
constants["WATER_WAVE_HEIGHT"] = g_settings->getFloat("water_wave_height");
|
||||
constants["WATER_WAVE_LENGTH"] = g_settings->getFloat("water_wave_length");
|
||||
constants["WATER_WAVE_SPEED"] = g_settings->getFloat("water_wave_speed");
|
||||
|
|
|
@ -225,6 +225,9 @@ public:
|
|||
float shadow_soft_radius = std::max(1.f,
|
||||
g_settings->getFloat("shadow_soft_radius"));
|
||||
constants["SOFTSHADOWRADIUS"] = shadow_soft_radius;
|
||||
|
||||
if (g_settings->getBool("enable_sun_tint"))
|
||||
constants["ENABLE_TINTED_SUNLIGHT"] = 1;
|
||||
}
|
||||
|
||||
if (g_settings->getBool("enable_bloom")) {
|
||||
|
|
|
@ -333,7 +333,6 @@ 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("secondstage_gamma", "1.6");
|
||||
settings->setDefault("debanding", "true");
|
||||
settings->setDefault("antialiasing", "none");
|
||||
|
@ -343,7 +342,6 @@ void set_default_settings()
|
|||
settings->setDefault("enable_volumetric_depth_attenuation", "false");
|
||||
settings->setDefault("enable_water_reflections", "false");
|
||||
settings->setDefault("enable_translucent_foliage", "false");
|
||||
settings->setDefault("enable_node_specular", "false");
|
||||
settings->setDefault("enable_tinted_fog", "false");
|
||||
|
||||
// Effects Shadows
|
||||
|
|
|
@ -80,8 +80,8 @@ struct Lighting
|
|||
float specular_intensity{0.0f};
|
||||
// These factors are calculated based on expected value of scattering factor of 1e-5
|
||||
// for Nitrogen at 532nm (green), 2e25 molecules/m3 in atmosphere
|
||||
v3f volumetric_beta_r0{ 3.3362176e-01f, 8.753783e-01f, 1.9534237f };
|
||||
video::SColor artificial_light_color{ 255, 133, 133, 133 };
|
||||
v3f scattering_coefficients{ 3.3362176e-01f, 8.753783e-01f, 1.9534237f };
|
||||
video::SColorf artificial_light_color{ 1.0f, 1.04f, 1.04f, 1.04f };
|
||||
video::SColor shadow_tint {255, 0, 0, 0};
|
||||
float bloom_intensity {0.05f};
|
||||
float bloom_strength_factor {1.0f};
|
||||
|
|
|
@ -62,7 +62,7 @@ private:
|
|||
// These calls explicitly use the templated version of operator<<,
|
||||
// so that they won't use the overloads created by ADD_NULL_CHECK.
|
||||
if (arg == nullptr)
|
||||
return this->operator<< <const char*> ("(null)");
|
||||
return this->operator<< ((const char*) ("(null)"));
|
||||
else
|
||||
return this->operator<< <T>(std::forward<T>(arg));
|
||||
}
|
||||
|
|
|
@ -1795,8 +1795,10 @@ void Client::handleCommand_SetLighting(NetworkPacket *pkt)
|
|||
>> lighting.bloom_radius;
|
||||
}
|
||||
if (pkt->getRemainingBytes() >= 72) {
|
||||
*pkt >> lighting.artificial_light_color;
|
||||
*pkt >> lighting.volumetric_beta_r0;
|
||||
*pkt >> lighting.artificial_light_color.r
|
||||
>> lighting.artificial_light_color.g
|
||||
>> lighting.artificial_light_color.b;
|
||||
*pkt >> lighting.scattering_coefficients;
|
||||
*pkt >> lighting.vignette.dark
|
||||
>> lighting.vignette.bright
|
||||
>> lighting.vignette.power;
|
||||
|
|
|
@ -61,10 +61,10 @@
|
|||
[scheduled bump for 5.10.0]
|
||||
PROTOCOL VERSION 47
|
||||
Add particle blend mode "clip"
|
||||
Add artificial light color, beta_r0, vignette, specular intensity, foliage translucency and cdl parameters to Lighting packets
|
||||
[scheduled bump for 5.11.0]
|
||||
PROTOCOL VERSION 48
|
||||
Add compression to some existing packets
|
||||
Add compression to some existing packets, artificial light color, scattering_coefficients,
|
||||
vignette, specular intensity, foliage translucency and cdl parameters to Lighting packets
|
||||
[scheduled bump for 5.12.0]
|
||||
*/
|
||||
|
||||
|
|
|
@ -2660,8 +2660,10 @@ int ObjectRef::l_set_lighting(lua_State *L)
|
|||
lighting = player->getLighting();
|
||||
|
||||
lua_getfield(L, 2, "artificial_light");
|
||||
if (!lua_isnil(L, -1)) {
|
||||
read_color(L, -1, &lighting.artificial_light_color);
|
||||
if (lua_istable(L, -1)) {
|
||||
getfloatfield(L, -1, "r", lighting.artificial_light_color.r);
|
||||
getfloatfield(L, -1, "g", lighting.artificial_light_color.g);
|
||||
getfloatfield(L, -1, "b", lighting.artificial_light_color.b);
|
||||
}
|
||||
lua_pop(L, 1); // artificial_light
|
||||
|
||||
|
@ -2694,11 +2696,11 @@ int ObjectRef::l_set_lighting(lua_State *L)
|
|||
getfloatfield(L, -1, "strength", lighting.volumetric_light_strength);
|
||||
lighting.volumetric_light_strength = rangelim(lighting.volumetric_light_strength, 0.0f, 1.0f);
|
||||
|
||||
lua_getfield(L, -1, "beta_r0");
|
||||
lua_getfield(L, -1, "scattering_coefficients");
|
||||
if (!lua_isnil(L, -1)) {
|
||||
lighting.volumetric_beta_r0 = read_v3f(L, -1);
|
||||
lighting.scattering_coefficients = read_v3f(L, -1);
|
||||
}
|
||||
lua_pop(L, 1); // beta_r0
|
||||
lua_pop(L, 1); // scattering_coefficients
|
||||
}
|
||||
lua_pop(L, 1); // volumetric_light
|
||||
|
||||
|
@ -2752,7 +2754,13 @@ int ObjectRef::l_get_lighting(lua_State *L)
|
|||
const Lighting &lighting = player->getLighting();
|
||||
|
||||
lua_newtable(L); // result
|
||||
push_ARGB8(L, lighting.artificial_light_color);
|
||||
lua_newtable(L); // artificial_light
|
||||
lua_pushnumber(L, lighting.artificial_light_color.r);
|
||||
lua_setfield(L, -2, "r");
|
||||
lua_pushnumber(L, lighting.artificial_light_color.g);
|
||||
lua_setfield(L, -2, "g");
|
||||
lua_pushnumber(L, lighting.artificial_light_color.b);
|
||||
lua_setfield(L, -2, "b");
|
||||
lua_setfield(L, -2, "artificial_light");
|
||||
lua_pushnumber(L, lighting.foliage_translucency);
|
||||
lua_setfield(L, -2, "foliage_translucency");
|
||||
|
@ -2783,8 +2791,8 @@ int ObjectRef::l_get_lighting(lua_State *L)
|
|||
lua_newtable(L); // "volumetric_light"
|
||||
lua_pushnumber(L, lighting.volumetric_light_strength);
|
||||
lua_setfield(L, -2, "strength");
|
||||
push_v3f(L, lighting.volumetric_beta_r0);
|
||||
lua_setfield(L, -2, "beta_r0");
|
||||
push_v3f(L, lighting.scattering_coefficients);
|
||||
lua_setfield(L, -2, "scattering_coefficients");
|
||||
lua_setfield(L, -2, "volumetric_light");
|
||||
lua_newtable(L); // "bloom"
|
||||
lua_pushnumber(L, lighting.bloom_intensity);
|
||||
|
|
|
@ -1947,8 +1947,10 @@ void Server::SendSetLighting(session_t peer_id, const Lighting &lighting)
|
|||
pkt << lighting.volumetric_light_strength << lighting.shadow_tint;
|
||||
pkt << lighting.bloom_intensity << lighting.bloom_strength_factor <<
|
||||
lighting.bloom_radius;
|
||||
pkt << lighting.artificial_light_color;
|
||||
pkt << lighting.volumetric_beta_r0;
|
||||
pkt << lighting.artificial_light_color.r
|
||||
<< lighting.artificial_light_color.g
|
||||
<< lighting.artificial_light_color.b;
|
||||
pkt << lighting.scattering_coefficients;
|
||||
pkt << lighting.vignette.dark
|
||||
<< lighting.vignette.bright
|
||||
<< lighting.vignette.power;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue