Loading...
Searching...
No Matches
Shader Class Reference

#include <Shader.h>

Collaboration diagram for Shader:

Public Member Functions

 Shader (const uint32_t program_id)
 
 Shader ()
 
 Shader (const Shader &)=delete
 
Shaderoperator= (const Shader &)=delete
 
 Shader (Shader &&other) noexcept
 
Shaderoperator= (Shader &&other) noexcept
 
void use () const
 
uint32_t get_program_id () const
 
bool is_valid () const
 
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_vec2 (const std::string &name, const float x, const float y) const
 
void set_vec3 (const std::string &name, const glm::vec3 &value) const
 
void set_vec3 (const std::string &name, const float x, const float y, const float z) const
 
void set_vec4 (const std::string &name, const glm::vec4 &value) const
 
void set_vec4 (const std::string &name, float x, float y, float z, float w) 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
 
void set_transform_matrices (const glm::mat4 &model, const glm::mat4 &view, const glm::mat4 &projection) const
 
void set_view_projection (const glm::mat4 &view, const glm::mat4 &projection) const
 
void set_camera_position (const glm::vec3 &position) const
 
void set_time (const float time) const
 
void set_light_counts (const int directional_lights, const int point_lights) const
 
void set_directional_light (const int index, const glm::vec3 &direction, const glm::vec3 &color, const float intensity=1.0f) const
 
void set_point_light (const int index, const glm::vec3 &position, const glm::vec3 &color, const float constant=1.0f, const float linear=0.09f, const float quadratic=0.032f) const
 
void set_texture (const std::string &name, const int texture_unit) const
 
bool has_uniform (const std::string &name) const
 

Static Public Member Functions

static Shader from_id (const uint32_t shader_id)
 

Private Member Functions

hellfire::ShaderUniformBinder get_binder () const
 

Private Attributes

uint32_t program_id_
 

Detailed Description

Definition at line 10 of file Shader.h.

Constructor & Destructor Documentation

◆ Shader() [1/4]

Shader::Shader ( const uint32_t  program_id)
inlineexplicit

Definition at line 12 of file Shader.h.

◆ Shader() [2/4]

Shader::Shader ( )
inline

Definition at line 15 of file Shader.h.

◆ Shader() [3/4]

Shader::Shader ( const Shader )
delete

◆ Shader() [4/4]

Shader::Shader ( Shader &&  other)
inlinenoexcept

Definition at line 22 of file Shader.h.

Member Function Documentation

◆ from_id()

static Shader Shader::from_id ( const uint32_t  shader_id)
inlinestatic

Definition at line 34 of file Shader.h.

◆ get_binder()

hellfire::ShaderUniformBinder Shader::get_binder ( ) const
inlineprivate

Definition at line 169 of file Shader.h.

◆ get_program_id()

uint32_t Shader::get_program_id ( ) const
inline

Definition at line 45 of file Shader.h.

◆ has_uniform()

bool Shader::has_uniform ( const std::string &  name) const
inline

Definition at line 162 of file Shader.h.

◆ is_valid()

bool Shader::is_valid ( ) const
inline

Definition at line 46 of file Shader.h.

◆ operator=() [1/2]

Shader & Shader::operator= ( const Shader )
delete

◆ operator=() [2/2]

Shader & Shader::operator= ( Shader &&  other)
inlinenoexcept

Definition at line 26 of file Shader.h.

◆ set_bool()

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

Definition at line 49 of file Shader.h.

◆ set_camera_position()

void Shader::set_camera_position ( const glm::vec3 &  position) const
inline

Definition at line 122 of file Shader.h.

◆ set_directional_light()

void Shader::set_directional_light ( const int  index,
const glm::vec3 &  direction,
const glm::vec3 &  color,
const float  intensity = 1.0f 
) const
inline

Definition at line 137 of file Shader.h.

◆ set_float()

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

Definition at line 61 of file Shader.h.

◆ set_int()

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

Definition at line 53 of file Shader.h.

◆ set_light_counts()

void Shader::set_light_counts ( const int  directional_lights,
const int  point_lights 
) const
inline

Definition at line 130 of file Shader.h.

◆ set_mat2()

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

Definition at line 91 of file Shader.h.

◆ set_mat3()

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

Definition at line 95 of file Shader.h.

◆ set_mat4()

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

Definition at line 99 of file Shader.h.

◆ set_point_light()

void Shader::set_point_light ( const int  index,
const glm::vec3 &  position,
const glm::vec3 &  color,
const float  constant = 1.0f,
const float  linear = 0.09f,
const float  quadratic = 0.032f 
) const
inline

Definition at line 145 of file Shader.h.

◆ set_texture()

void Shader::set_texture ( const std::string &  name,
const int  texture_unit 
) const
inline

Definition at line 157 of file Shader.h.

◆ set_time()

void Shader::set_time ( const float  time) const
inline

Definition at line 126 of file Shader.h.

◆ set_transform_matrices()

void Shader::set_transform_matrices ( const glm::mat4 &  model,
const glm::mat4 &  view,
const glm::mat4 &  projection 
) const
inline

Definition at line 104 of file Shader.h.

◆ set_uint()

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

Definition at line 57 of file Shader.h.

◆ set_vec2() [1/2]

void Shader::set_vec2 ( const std::string &  name,
const float  x,
const float  y 
) const
inline

Definition at line 70 of file Shader.h.

◆ set_vec2() [2/2]

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

Definition at line 66 of file Shader.h.

◆ set_vec3() [1/2]

void Shader::set_vec3 ( const std::string &  name,
const float  x,
const float  y,
const float  z 
) const
inline

Definition at line 78 of file Shader.h.

◆ set_vec3() [2/2]

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

Definition at line 74 of file Shader.h.

◆ set_vec4() [1/2]

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

Definition at line 82 of file Shader.h.

◆ set_vec4() [2/2]

void Shader::set_vec4 ( const std::string &  name,
float  x,
float  y,
float  z,
float  w 
) const
inline

Definition at line 86 of file Shader.h.

◆ set_view_projection()

void Shader::set_view_projection ( const glm::mat4 &  view,
const glm::mat4 &  projection 
) const
inline

Definition at line 116 of file Shader.h.

◆ use()

void Shader::use ( ) const
inline

Definition at line 39 of file Shader.h.

Member Data Documentation

◆ program_id_

uint32_t Shader::program_id_
private

Definition at line 167 of file Shader.h.


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