20#ifndef HEADER_SHADER_FILES_MANAGER_HPP
21#define HEADER_SHADER_FILES_MANAGER_HPP
23#include "graphics/gl_headers.hpp"
24#include "utils/log.hpp"
25#include "utils/no_copy.hpp"
32#include <unordered_map>
37 typedef std::shared_ptr<GLuint> SharedShader;
47 void readFile(
const std::string& file, std::ostringstream& code,
48 bool not_header =
true);
50 SharedShader
addShaderFile(
const std::string& full_path,
unsigned type);
58 removeAllShaderFiles();
61 void removeAllShaderFiles()
63 removeUnusedShaderFiles();
67 Log::error(
"ShaderFilesManager",
"Some shader file > 1 ref_count");
73 void removeUnusedShaderFiles()
78 if (it->second.use_count() == 1 || !it->second)
89 SharedShader
loadShader(
const std::string& full_path,
unsigned type);
91 SharedShader
getShaderFile(
const std::string& file,
unsigned type);
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:26
Definition: shader_files_manager.hpp:35
SharedShader loadShader(const std::string &full_path, unsigned type)
Loads a single shader.
Definition: shader_files_manager.cpp:130
const std::string & getHeader()
Returns a string with the content of header.txt (which contains basic shader defines).
Definition: shader_files_manager.cpp:40
SharedShader addShaderFile(const std::string &full_path, unsigned type)
Loads a single shader file, and add it to the loaded (cached) list.
Definition: shader_files_manager.cpp:262
SharedShader getShaderFile(const std::string &file, unsigned type)
Get a shader file.
Definition: shader_files_manager.cpp:282
std::unordered_map< std::string, SharedShader > m_shader_files_loaded
Map from a filename in full path to a shader indentifier.
Definition: shader_files_manager.hpp:42
Definition: singleton.hpp:87