3#include <unordered_set>
20struct UniformBufferSetup;
#define DEBUG_LABEL_ARG_MANY
first debug label argument of many
std::vector< VertexType > VertexTypes
void clear_shader_program()
Clears the current open gl shader program binding.
bool is_bound_for_shader(const std::unordered_set< VertexType > &debug_geom_shader_types)
Verifies if the current shader matches the required vertex types.
void setup_textures(ShaderProgram *shader, const std::vector< Uniform * > &uniform_list)
Sets up textures for a shader program.
bool is_shader_bound(unsigned int program)
Checks if a specific shader program is currently active.
A (inclusive) range between two values.
A list of CompiledVertexElement (for shader)
RAII representation of a open gl shader program.
void set_vec3(const Uniform &uniform, const v3 &v)
Sets a uniform 3d vector.
ShaderProgram(const ShaderProgram &)=delete
Copying is not allowed.
void set_vec4(const Uniform &uniform, const v4 &v)
Sets a uniform 4d vector.
void set_vec3(const Uniform &uniform, float x, float y, float z)
Sets a uniform 3d vector.
void clear()
Turn this object into a zombie by destroying it.
void set_float(const Uniform &uniform, float value)
Sets a uniform float value.
~ShaderProgram()
Destroy the shader if it's loaded.
ShaderProgram(DEBUG_LABEL_ARG_MANY const std::string &vertex_source, const std::string &fragment_source, const CompiledShaderVertexAttributes &layout)
Compile and link a shader.
void setup_uniform_block(const UniformBufferSetup &setup)
Configures a uniform block binding for the shader.
void use() const
Activates the ShaderProgram for rendering.
void set_vec2(const Uniform &uniform, const v2 &v)
Sets a uniform 2d vector.
void set_texture(const Uniform &uniform)
Sets a texture for a uniform.
void set_vec2(const Uniform &uniform, float x, float y)
Sets a uniform 2d vector.
VertexTypes debug_vertex_types
The debug information describing the vertex layout that this shader expects.
void set_mat(const Uniform &uniform, const m4 &mat)
Sets a uniform 4x4 matrix.
void set_bool(const Uniform &uniform, bool value)
Sets a uniform boolean value.
Uniform get_uniform(const std::string &name) const
Get a uniform by name.
void set_vec4(const Uniform &uniform, float x, float y, float z, float w)
Sets a uniform 4d vector.
ShaderProgram & operator=(ShaderProgram &&rhs) noexcept
Take ownership of another shader.
bool is_loaded() const
Checks if the ShaderProgram is loaded and valid.
unsigned int shader_program
The id of the shader program.
ShaderProgram(ShaderProgram &&other) noexcept
Take ownership of another shader.
void operator=(const ShaderProgram &)=delete
Copying is not allowed.