00001 #include "ShaderManager.hpp" 00002 00003 ShaderManager *ShaderManager::m_instance = 0; 00004 00005 ShaderManager *ShaderManager::getInstance(void) 00006 { 00007 if(m_instance != 0) 00008 return m_instance; 00009 else 00010 return m_instance = new ShaderManager(); 00011 } 00012 00013 ShaderManager::ShaderManager(void) 00014 { 00015 } 00016 00017 ShaderManager::~ShaderManager(void) 00018 { 00019 m_shaders.clear(); 00020 } 00021 00022 Shader *ShaderManager::getShader(unsigned int id) 00023 { 00024 if(m_shaders.find(id) != m_shaders.end()) 00025 return m_shaders[id]; 00026 else 00027 return m_shaders[0]; 00028 } 00029 00030 void ShaderManager::loadShader(unsigned int id, std::string path) 00031 { 00032 if(m_shaders.find(id) == m_shaders.end()) 00033 m_shaders[id] = new Shader(path); 00034 }