diff --git a/src/graphics/shaders.cpp b/src/graphics/shaders.cpp index a79e38b88..606fc74e5 100644 --- a/src/graphics/shaders.cpp +++ b/src/graphics/shaders.cpp @@ -90,8 +90,6 @@ */ -#define SHADER_NAMES - #include "graphics/shaders.hpp" #include "graphics/callbacks.hpp" @@ -111,9 +109,13 @@ bool Shaders::m_has_been_initialised = false; video::IShaderConstantSetCallBack *Shaders::m_callbacks[ES_COUNT]; int Shaders::m_shaders[ES_COUNT]; -using namespace video; +// Use macro FOREACH_SHADER from shaders.hpp to create an array +// with all shader names. +#define STR(a) #a, +const char *Shaders::shader_names[] = { FOREACH_SHADER(STR) }; +#undef STR -std::vector CleanTable; +using namespace video; void Shaders::init() { @@ -305,19 +307,9 @@ void Shaders::loadShaders() } initGL(); - CleanTable.clear(); SharedGPUObjects::init(); } // loadShaders -// ---------------------------------------------------------------------------- -/** C -*/ -void Shaders::killShaders() -{ - for (unsigned i = 0; i < CleanTable.size(); i++) - CleanTable[i](); -} // killShaders - // ---------------------------------------------------------------------------- void Shaders::check(const int num) { diff --git a/src/graphics/shaders.hpp b/src/graphics/shaders.hpp index 1f72c1287..8b051c7de 100644 --- a/src/graphics/shaders.hpp +++ b/src/graphics/shaders.hpp @@ -52,24 +52,19 @@ class ParticleSystemProxy; ACT(ES_DISPLACE) \ #define ENUM(a) a, -#define STR(a) #a, enum ShaderType { FOREACH_SHADER(ENUM) - ES_COUNT }; +#undef ENUM -#ifdef SHADER_NAMES -static const char *shader_names[] = { - FOREACH_SHADER(STR) -}; -#endif class Shaders { private: + static const char *shader_names[]; static bool m_has_been_initialised; static int m_shaders[ES_COUNT]; @@ -99,11 +94,6 @@ public: { return m_has_been_initialised ? m_callbacks[num] : NULL; } // getCallback - // ------------------------------------------------------------------------ - - - - void killShaders(); // ======================================================================== /** Shader to draw a colored line. @@ -166,8 +156,4 @@ public: }; // class Shaders -#undef ENUM -#undef STR -#undef FOREACH_SHADER - #endif