From f17145cde6b461d30b16b4a8dcf114aa608c508d Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 16 Jun 2013 23:48:40 +0200 Subject: [PATCH] Allow configuration of bloom settings from config files in snowballs --HG-- branch : multipass-stereo --- code/snowballs2/client/src/snowballs_client.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/code/snowballs2/client/src/snowballs_client.cpp b/code/snowballs2/client/src/snowballs_client.cpp index c5cb73072..76338cfa5 100644 --- a/code/snowballs2/client/src/snowballs_client.cpp +++ b/code/snowballs2/client/src/snowballs_client.cpp @@ -179,6 +179,8 @@ void releaseIngame(); void releaseOnline(); void releaseOffline(); void cbGraphicsDriver(CConfigFile::CVar &var); +void cbSquareBloom(CConfigFile::CVar &var); +void cbDensityBloom(CConfigFile::CVar &var); // // Functions @@ -362,6 +364,8 @@ void initIngame() CBloomEffect::instance().setDriver(Driver); CBloomEffect::instance().setScene(Scene); CBloomEffect::instance().init(ConfigFile->getVar("OpenGL").asInt() == 1); + CConfiguration::setAndCallback("SquareBloom", cbSquareBloom); + CConfiguration::setAndCallback("DensityBloom", cbDensityBloom); // Init the landscape using the previously created UScene displayLoadingState("Initialize Landscape"); @@ -562,6 +566,8 @@ void releaseIngame() MouseListener = NULL; // release bloom effect + CConfiguration::dropCallback("SquareBloom"); + CConfiguration::dropCallback("DensityBloom"); CBloomEffect::instance().releaseInstance(); Driver->deleteScene(Scene); @@ -884,6 +890,16 @@ void cbGraphicsDriver(CConfigFile::CVar &var) 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 //