Loading...
Searching...
No Matches
hellfire::ShaderUniformBinder Class Reference

#include <ShaderUniformBinder.h>

Collaboration diagram for hellfire::ShaderUniformBinder:

Public Member Functions

 ShaderUniformBinder (const uint32_t shader_program)
 
void set_bool (const std::string &name, const bool value) const
 
void set_int (const std::string &name, const int value) const
 
void set_uint (const std::string &name, const uint32_t value) const
 
void set_float (const std::string &name, const float value) const
 
void set_vec2 (const std::string &name, const glm::vec2 &value) const
 
void set_vec3 (const std::string &name, const glm::vec3 &value) const
 
void set_vec4 (const std::string &name, const glm::vec4 &value) const
 
void set_mat2 (const std::string &name, const glm::mat2 &value) const
 
void set_mat3 (const std::string &name, const glm::mat3 &value) const
 
void set_mat4 (const std::string &name, const glm::mat4 &value) const
 
bool has_uniform (const std::string &name) const
 
void clear_cache ()
 
uint32_t get_shader_program () const
 

Private Member Functions

GLint get_uniform_location (const std::string &name) const
 

Private Attributes

uint32_t shader_program_
 
std::unordered_map< std::string, GLint > uniform_cache_
 

Detailed Description

Abstraction layer for shader uniform binding Hides OpenGL implementation details and provides uniform caching

Definition at line 19 of file ShaderUniformBinder.h.

Constructor & Destructor Documentation

◆ ShaderUniformBinder()

hellfire::ShaderUniformBinder::ShaderUniformBinder ( const uint32_t  shader_program)
inlineexplicit

Definition at line 21 of file ShaderUniformBinder.h.

Member Function Documentation

◆ clear_cache()

void hellfire::ShaderUniformBinder::clear_cache ( )
inline

Definition at line 92 of file ShaderUniformBinder.h.

◆ get_shader_program()

uint32_t hellfire::ShaderUniformBinder::get_shader_program ( ) const
inline

Definition at line 96 of file ShaderUniformBinder.h.

◆ get_uniform_location()

GLint hellfire::ShaderUniformBinder::get_uniform_location ( const std::string &  name) const
inlineprivate

Definition at line 104 of file ShaderUniformBinder.h.

◆ has_uniform()

bool hellfire::ShaderUniformBinder::has_uniform ( const std::string &  name) const
inline

Definition at line 88 of file ShaderUniformBinder.h.

◆ set_bool()

void hellfire::ShaderUniformBinder::set_bool ( const std::string &  name,
const bool  value 
) const
inline

Definition at line 25 of file ShaderUniformBinder.h.

◆ set_float()

void hellfire::ShaderUniformBinder::set_float ( const std::string &  name,
const float  value 
) const
inline

Definition at line 43 of file ShaderUniformBinder.h.

◆ set_int()

void hellfire::ShaderUniformBinder::set_int ( const std::string &  name,
const int  value 
) const
inline

Definition at line 31 of file ShaderUniformBinder.h.

◆ set_mat2()

void hellfire::ShaderUniformBinder::set_mat2 ( const std::string &  name,
const glm::mat2 &  value 
) const
inline

Definition at line 69 of file ShaderUniformBinder.h.

◆ set_mat3()

void hellfire::ShaderUniformBinder::set_mat3 ( const std::string &  name,
const glm::mat3 &  value 
) const
inline

Definition at line 75 of file ShaderUniformBinder.h.

◆ set_mat4()

void hellfire::ShaderUniformBinder::set_mat4 ( const std::string &  name,
const glm::mat4 &  value 
) const
inline

Definition at line 81 of file ShaderUniformBinder.h.

◆ set_uint()

void hellfire::ShaderUniformBinder::set_uint ( const std::string &  name,
const uint32_t  value 
) const
inline

Definition at line 37 of file ShaderUniformBinder.h.

◆ set_vec2()

void hellfire::ShaderUniformBinder::set_vec2 ( const std::string &  name,
const glm::vec2 &  value 
) const
inline

Definition at line 50 of file ShaderUniformBinder.h.

◆ set_vec3()

void hellfire::ShaderUniformBinder::set_vec3 ( const std::string &  name,
const glm::vec3 &  value 
) const
inline

Definition at line 56 of file ShaderUniformBinder.h.

◆ set_vec4()

void hellfire::ShaderUniformBinder::set_vec4 ( const std::string &  name,
const glm::vec4 &  value 
) const
inline

Definition at line 62 of file ShaderUniformBinder.h.

Member Data Documentation

◆ shader_program_

uint32_t hellfire::ShaderUniformBinder::shader_program_
private

Definition at line 101 of file ShaderUniformBinder.h.

◆ uniform_cache_

std::unordered_map<std::string, GLint> hellfire::ShaderUniformBinder::uniform_cache_
mutableprivate

Definition at line 102 of file ShaderUniformBinder.h.


The documentation for this class was generated from the following file: