1 #ifndef SHADER_MANAGER_H
2 #define SHADER_MANAGER_H
6 #include <chaiscript/chaiscript.hpp>
17 std::map<std::string, std::shared_ptr<Shader>> shaders_to_names;
18 std::string shader_directory;
19 bool checkCompilation(
const unsigned int& shader_object);
20 void logShaderInfoLog(
const unsigned int& shader_object);
54 bool loadShader(
const std::string& name,
const bool geometry_shader =
false);
65 bool loadShader(
const std::string& name,
const std::string& vertex_filename,
const std::string& fragment_filename,
const std::string& geometry_filename);
74 std::shared_ptr<Shader>
operator[](
const std::string& name)
const;
82 std::shared_ptr<Shader>
getShader(
const std::string& name)
const;
107 for(
auto& i : shaders_to_names) {
108 i.second->setUniform(name, data);
static char const * GEOMETRY_EXTENSION
Definition: shader_manager.h:33
static char const * FRAGMENT_EXTENSION
Definition: shader_manager.h:29
Class for shader manager.
Definition: shader_manager.h:15
static char const * VERTEX_EXTENSION
Definition: shader_manager.h:25
std::shared_ptr< Shader > operator[](const std::string &name) const
looks up shader by name
Definition: shader_manager.cpp:141
bool loadShader(const std::string &name, const bool geometry_shader=false)
Loads a shader.
Definition: shader_manager.cpp:28
std::shared_ptr< Shader > getShader(const std::string &name) const
Gets the shader.
Definition: shader_manager.cpp:145
void setUniformForAllPrograms(const Uniform &u)
Sets the uniform for all programs.
Definition: shader_manager.cpp:152
~ShaderManager()
Destroys the object.
Definition: shader_manager.cpp:24