27#ifndef EASY3D_RENDERER_SHADER_MANAGER_H
28#define EASY3D_RENDERER_SHADER_MANAGER_H
31#include <unordered_map>
33#include <easy3d/renderer/shader_program.h>
64 const std::string& file_base_name,
65 const std::vector<ShaderProgram::Attribute>& attributes = std::vector<ShaderProgram::Attribute>(),
66 const std::vector<std::string>& outputs = std::vector<std::string>(),
67 bool geom_shader =
false
83 const std::string& vert_file_name,
84 const std::string& frag_file_name,
85 const std::string& geom_file_name =
"",
86 const std::string& extra_vert_code =
"",
87 const std::string& extra_frag_code =
"",
88 const std::string& extra_geom_code =
"",
89 const std::vector<ShaderProgram::Attribute>& attributes = std::vector<ShaderProgram::Attribute>(),
90 const std::vector<std::string>& outputs = std::vector<std::string>()
103 const std::string& vert_code,
104 const std::string& frag_code,
105 const std::string& geom_code =
"",
106 const std::vector<ShaderProgram::Attribute>& attributes = std::vector<ShaderProgram::Attribute>(),
107 const std::vector<std::string>& outputs = std::vector<std::string>()
129 static std::unordered_map<std::string, ShaderProgram*> programs_;
130 static std::unordered_map<std::string, bool> attempt_load_program_;
Management of shader programs.
Definition shader_manager.h:46
static void terminate()
Destroy all shader programs.
Definition shader_manager.cpp:271
static std::vector< ShaderProgram * > all_programs()
Get all shader programs.
Definition shader_manager.cpp:263
static ShaderProgram * create_program_from_files(const std::string &file_base_name, const std::vector< ShaderProgram::Attribute > &attributes=std::vector< ShaderProgram::Attribute >(), const std::vector< std::string > &outputs=std::vector< std::string >(), bool geom_shader=false)
Create a shader program from shader source files specified by the shader file's base name.
Definition shader_manager.cpp:49
static ShaderProgram * get_program(const std::string &shader_name)
Get the shader program if it exists and is working.
Definition shader_manager.cpp:41
static ShaderProgram * create_program_from_codes(const std::string &vert_code, const std::string &frag_code, const std::string &geom_code="", const std::vector< ShaderProgram::Attribute > &attributes=std::vector< ShaderProgram::Attribute >(), const std::vector< std::string > &outputs=std::vector< std::string >())
Create a shader program from completed shader source codes.
Definition shader_manager.cpp:212
static void reload()
Reload all shader programs.
Definition shader_manager.cpp:282
OpenGL Shader Compilation.
Definition shader_program.h:75
Definition collider.cpp:182