1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Revert "Make the GameGlobalShaderConstantSetter use the settings callback (8% perf improvement in game loop)"

This reverts commit a555e2d9b0.
This commit is contained in:
Craig Robbins 2015-01-25 01:19:40 +10:00
parent 800d192702
commit 2c4a5e1861
4 changed files with 11 additions and 27 deletions

View file

@ -809,31 +809,15 @@ class GameGlobalShaderConstantSetter : public IShaderConstantSetter
bool *m_force_fog_off;
f32 *m_fog_range;
Client *m_client;
bool m_fogEnabled;
public:
void onSettingsChange(const std::string &name)
{
if (name == "enable_fog")
m_fogEnabled = g_settings->getBool("enable_fog");
}
static void SettingsCallback(const std::string name, void *userdata)
{
reinterpret_cast<GameGlobalShaderConstantSetter*>(userdata)->onSettingsChange(name);
}
GameGlobalShaderConstantSetter(Sky *sky, bool *force_fog_off,
f32 *fog_range, Client *client) :
m_sky(sky),
m_force_fog_off(force_fog_off),
m_fog_range(fog_range),
m_client(client)
{
g_settings->registerChangedCallback("enable_fog", SettingsCallback, this);
}
{}
~GameGlobalShaderConstantSetter() {}
virtual void onSetConstants(video::IMaterialRendererServices *services,
@ -856,7 +840,7 @@ public:
// Fog distance
float fog_distance = 10000 * BS;
if (m_fogEnabled && !*m_force_fog_off)
if (g_settings->getBool("enable_fog") && !*m_force_fog_off)
fog_distance = *m_fog_range;
services->setPixelShaderConstant("fogDistance", &fog_distance, 1);