mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-10 18:51:05 +00:00
Allow saturation to be controlled by the server. (#13075)
This commit is contained in:
parent
afd5caa26a
commit
1e7804aaf6
10 changed files with 23 additions and 16 deletions
|
@ -436,7 +436,6 @@ class GameGlobalShaderConstantSetter : public IShaderConstantSetter
|
|||
float m_bloom_strength;
|
||||
CachedPixelShaderSetting<float> m_bloom_radius_pixel;
|
||||
float m_bloom_radius;
|
||||
float m_saturation;
|
||||
CachedPixelShaderSetting<float> m_saturation_pixel;
|
||||
|
||||
public:
|
||||
|
@ -452,8 +451,6 @@ 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 == "saturation")
|
||||
m_saturation = g_settings->getFloat("saturation", 0.0f, 5.0f);
|
||||
}
|
||||
|
||||
static void settingsCallback(const std::string &name, void *userdata)
|
||||
|
@ -503,7 +500,6 @@ 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_saturation = g_settings->getFloat("saturation", 0.0f, 5.0f);
|
||||
}
|
||||
|
||||
~GameGlobalShaderConstantSetter()
|
||||
|
@ -591,7 +587,8 @@ public:
|
|||
m_bloom_radius_pixel.set(&m_bloom_radius, services);
|
||||
m_bloom_strength_pixel.set(&m_bloom_strength, services);
|
||||
}
|
||||
m_saturation_pixel.set(&m_saturation, services);
|
||||
float saturation = m_client->getEnv().getLocalPlayer()->getLighting().saturation;
|
||||
m_saturation_pixel.set(&saturation, services);
|
||||
}
|
||||
|
||||
void onSetMaterial(const video::SMaterial &material)
|
||||
|
|
|
@ -281,7 +281,6 @@ void set_default_settings()
|
|||
settings->setDefault("bloom_strength_factor", "1.0");
|
||||
settings->setDefault("bloom_intensity", "0.05");
|
||||
settings->setDefault("bloom_radius", "1");
|
||||
settings->setDefault("saturation", "1.0");
|
||||
|
||||
// Effects Shadows
|
||||
settings->setDefault("enable_dynamic_shadows", "false");
|
||||
|
|
|
@ -24,4 +24,5 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
struct Lighting
|
||||
{
|
||||
float shadow_intensity {0.0f};
|
||||
float saturation {1.0f};
|
||||
};
|
||||
|
|
|
@ -1764,4 +1764,6 @@ void Client::handleCommand_SetLighting(NetworkPacket *pkt)
|
|||
|
||||
if (pkt->getRemainingBytes() >= 4)
|
||||
*pkt >> lighting.shadow_intensity;
|
||||
if (pkt->getRemainingBytes() >= 4)
|
||||
*pkt >> lighting.saturation;
|
||||
}
|
||||
|
|
|
@ -830,6 +830,7 @@ enum ToClientCommand
|
|||
TOCLIENT_SET_LIGHTING = 0x63,
|
||||
/*
|
||||
f32 shadow_intensity
|
||||
f32 saturation
|
||||
*/
|
||||
|
||||
TOCLIENT_NUM_MSG_TYPES = 0x64,
|
||||
|
|
|
@ -2294,8 +2294,9 @@ int ObjectRef::l_set_lighting(lua_State *L)
|
|||
Lighting lighting = player->getLighting();
|
||||
lua_getfield(L, 2, "shadows");
|
||||
if (lua_istable(L, -1)) {
|
||||
lighting.shadow_intensity = getfloatfield_default(L, -1, "intensity", lighting.shadow_intensity);
|
||||
lighting.shadow_intensity = getfloatfield_default(L, -1, "intensity", lighting.shadow_intensity);
|
||||
}
|
||||
lighting.saturation = getfloatfield_default(L, 2, "saturation", lighting.saturation);
|
||||
lua_pop(L, -1);
|
||||
|
||||
getServer(L)->setLighting(player, lighting);
|
||||
|
@ -2318,6 +2319,8 @@ int ObjectRef::l_get_lighting(lua_State *L)
|
|||
lua_pushnumber(L, lighting.shadow_intensity);
|
||||
lua_setfield(L, -2, "intensity");
|
||||
lua_setfield(L, -2, "shadows");
|
||||
lua_pushnumber(L, lighting.saturation);
|
||||
lua_setfield(L, -2, "saturation");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1864,6 +1864,7 @@ void Server::SendSetLighting(session_t peer_id, const Lighting &lighting)
|
|||
4, peer_id);
|
||||
|
||||
pkt << lighting.shadow_intensity;
|
||||
pkt << lighting.saturation;
|
||||
|
||||
Send(&pkt);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue