Represents a linked shader program object within the OpenGL context.
More...
#include <Shader.hpp>
|
| void | use () const |
| | Binds the shader program. More...
|
| |
| unsigned | id () const |
| | Returns the OpenGL ID of the shader program. More...
|
| |
| void | set_bool (const std::string &name, bool value) const |
| | Sets a boolean uniform value. More...
|
| |
| void | set_int (const std::string &name, int value) const |
| | Sets an integer uniform value. More...
|
| |
| void | set_float (const std::string &name, float value) const |
| | Sets a float uniform value. More...
|
| |
| void | set_vec2 (const std::string &name, const glm::vec2 &value) const |
| | Sets a 2D vector uniform value. More...
|
| |
| void | set_vec3 (const std::string &name, const glm::vec3 &value) const |
| | Sets a 3D vector uniform value. More...
|
| |
| void | set_vec4 (const std::string &name, const glm::vec4 &value) const |
| | Sets a 4D vector uniform value. More...
|
| |
| void | set_mat2 (const std::string &name, const glm::mat2 &mat) const |
| | Sets a 2x2 matrix uniform value. More...
|
| |
| void | set_mat3 (const std::string &name, const glm::mat3 &mat) const |
| | Sets a 3x3 matrix uniform value. More...
|
| |
| void | set_mat4 (const std::string &name, const glm::mat4 &mat) const |
| | Sets a 4x4 matrix uniform value. More...
|
| |
| const std::string & | name () const |
| | Returns the name of the shader program by which it can be referenced using the engine::resources::ResourcesController::shader function. More...
|
| |
| const std::string & | source () const |
| | Returns the source code of the shader program. More...
|
| |
| const std::filesystem::path & | source_path () const |
| | Returns the path to the source file from which the shader program was compiled. More...
|
| |
Represents a linked shader program object within the OpenGL context.
◆ Shader()
| engine::resources::Shader::Shader |
( |
unsigned |
shader_id, |
|
|
std::string |
name, |
|
|
std::string |
source, |
|
|
std::filesystem::path |
source_path = "" |
|
) |
| |
|
private |
Constructs a Shader object.
- Parameters
-
| shader_id | The OpenGL ID of the shader program. |
| name | The name of the shader program. |
| source | The source code of the shader program. |
| source_path | The path to the source file from which the shader program was compiled. |
◆ use()
| void engine::resources::Shader::use |
( |
| ) |
const |
Binds the shader program.
◆ id()
| unsigned engine::resources::Shader::id |
( |
| ) |
const |
Returns the OpenGL ID of the shader program.
- Returns
- The OpenGL ID of the shader program.
◆ set_bool()
| void engine::resources::Shader::set_bool |
( |
const std::string & |
name, |
|
|
bool |
value |
|
) |
| const |
Sets a boolean uniform value.
- Parameters
-
| name | The name of the uniform. |
| value | The value to set. |
◆ set_int()
| void engine::resources::Shader::set_int |
( |
const std::string & |
name, |
|
|
int |
value |
|
) |
| const |
Sets an integer uniform value.
- Parameters
-
| name | The name of the uniform. |
| value | The value to set. |
◆ set_float()
| void engine::resources::Shader::set_float |
( |
const std::string & |
name, |
|
|
float |
value |
|
) |
| const |
Sets a float uniform value.
- Parameters
-
| name | The name of the uniform. |
| value | The value to set. |
◆ set_vec2()
| void engine::resources::Shader::set_vec2 |
( |
const std::string & |
name, |
|
|
const glm::vec2 & |
value |
|
) |
| const |
Sets a 2D vector uniform value.
- Parameters
-
| name | The name of the uniform. |
| value | The value to set. |
◆ set_vec3()
| void engine::resources::Shader::set_vec3 |
( |
const std::string & |
name, |
|
|
const glm::vec3 & |
value |
|
) |
| const |
Sets a 3D vector uniform value.
- Parameters
-
| name | The name of the uniform. |
| value | The value to set. |
◆ set_vec4()
| void engine::resources::Shader::set_vec4 |
( |
const std::string & |
name, |
|
|
const glm::vec4 & |
value |
|
) |
| const |
Sets a 4D vector uniform value.
- Parameters
-
| name | The name of the uniform. |
| value | The value to set. |
◆ set_mat2()
| void engine::resources::Shader::set_mat2 |
( |
const std::string & |
name, |
|
|
const glm::mat2 & |
mat |
|
) |
| const |
Sets a 2x2 matrix uniform value.
- Parameters
-
| name | The name of the uniform. |
| mat | The value to set. |
◆ set_mat3()
| void engine::resources::Shader::set_mat3 |
( |
const std::string & |
name, |
|
|
const glm::mat3 & |
mat |
|
) |
| const |
Sets a 3x3 matrix uniform value.
- Parameters
-
| name | The name of the uniform. |
| mat | The value to set. |
◆ set_mat4()
| void engine::resources::Shader::set_mat4 |
( |
const std::string & |
name, |
|
|
const glm::mat4 & |
mat |
|
) |
| const |
Sets a 4x4 matrix uniform value.
- Parameters
-
| name | The name of the uniform. |
| mat | The value to set. |
◆ name()
| const std::string& engine::resources::Shader::name |
( |
| ) |
const |
◆ source()
| const std::string& engine::resources::Shader::source |
( |
| ) |
const |
Returns the source code of the shader program.
- Returns
- The source code of the shader.
◆ source_path()
| const std::filesystem::path& engine::resources::Shader::source_path |
( |
| ) |
const |
Returns the path to the source file from which the shader program was compiled.
- Returns
- The path to the source file of the shader program.
◆ destroy()
| void engine::resources::Shader::destroy |
( |
| ) |
const |
|
private |
Destroys the shader program in the OpenGL context.
◆ ShaderCompiler
◆ m_shaderId
| unsigned engine::resources::Shader::m_shaderId |
|
private |
The OpenGL ID of the shader program.
◆ m_name
| std::string engine::resources::Shader::m_name |
|
private |
The name of the shader program.
◆ m_source
| std::string engine::resources::Shader::m_source |
|
private |
◆ m_source_path
| std::filesystem::path engine::resources::Shader::m_source_path |
|
private |
The documentation for this class was generated from the following files: