Allow configuration of bloom settings from config files in snowballs

--HG--
branch : multipass-stereo
This commit is contained in:
kaetemi 2013-06-16 23:48:40 +02:00
parent 87c30bceea
commit f17145cde6

View file

@ -179,6 +179,8 @@ void releaseIngame();
void releaseOnline(); void releaseOnline();
void releaseOffline(); void releaseOffline();
void cbGraphicsDriver(CConfigFile::CVar &var); void cbGraphicsDriver(CConfigFile::CVar &var);
void cbSquareBloom(CConfigFile::CVar &var);
void cbDensityBloom(CConfigFile::CVar &var);
// //
// Functions // Functions
@ -362,6 +364,8 @@ void initIngame()
CBloomEffect::instance().setDriver(Driver); CBloomEffect::instance().setDriver(Driver);
CBloomEffect::instance().setScene(Scene); CBloomEffect::instance().setScene(Scene);
CBloomEffect::instance().init(ConfigFile->getVar("OpenGL").asInt() == 1); CBloomEffect::instance().init(ConfigFile->getVar("OpenGL").asInt() == 1);
CConfiguration::setAndCallback("SquareBloom", cbSquareBloom);
CConfiguration::setAndCallback("DensityBloom", cbDensityBloom);
// Init the landscape using the previously created UScene // Init the landscape using the previously created UScene
displayLoadingState("Initialize Landscape"); displayLoadingState("Initialize Landscape");
@ -562,6 +566,8 @@ void releaseIngame()
MouseListener = NULL; MouseListener = NULL;
// release bloom effect // release bloom effect
CConfiguration::dropCallback("SquareBloom");
CConfiguration::dropCallback("DensityBloom");
CBloomEffect::instance().releaseInstance(); CBloomEffect::instance().releaseInstance();
Driver->deleteScene(Scene); Driver->deleteScene(Scene);
@ -884,6 +890,16 @@ void cbGraphicsDriver(CConfigFile::CVar &var)
NextGameState = GameStateReset; NextGameState = GameStateReset;
} }
void cbSquareBloom(CConfigFile::CVar &var)
{
CBloomEffect::instance().setSquareBloom(var.asBool());
}
void cbDensityBloom(CConfigFile::CVar &var)
{
CBloomEffect::instance().setDensityBloom((uint8)(var.asInt() & 0xFF));
}
// //
// Loading state procedure // Loading state procedure
// //