1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
#include "IGroundDecalDrawer.h"
#include "Rendering/Env/Decals/GroundDecalHandler.h"
#include "Rendering/Env/Decals/DecalsDrawerGL4.h"
#include "System/Config/ConfigHandler.h"
#include "System/Log/ILog.h"
CONFIG(int, GroundDecals).defaultValue(1).minimumValue(0).description("Controls whether ground decals underneath buildings and ground scars from explosions will be rendered. Values >1 define how long such decals will stay.");
bool IGroundDecalDrawer::drawDecals = 0;
unsigned int IGroundDecalDrawer::decalLevel = 0;
static IGroundDecalDrawer* singleton = NULL;
IGroundDecalDrawer::IGroundDecalDrawer()
{
decalLevel = std::max(0, configHandler->GetInt("GroundDecals"));
drawDecals = (decalLevel > 0); //FIXME
}
IGroundDecalDrawer* IGroundDecalDrawer::GetInstance()
{
if (!singleton) {
#if 0
try {
singleton = new CDecalsDrawerGL4();
LOG_L(L_INFO, "Loaded DecalsDrawer: %s", "GL4");
} catch(const unsupported_error& ex) {
} catch(const opengl_error& ex) {
LOG_L(L_ERROR, "IGroundDecalDrawer loading failed: %s", ex.what());
#endif
delete singleton;
singleton = new CGroundDecalHandler();
LOG_L(L_INFO, "Loaded DecalsDrawer: %s", "Legacy");
#if 0
}
#endif
}
return singleton;
}
void IGroundDecalDrawer::FreeInstance()
{
delete singleton;
singleton = NULL;
}
|