A GLSL shader program (vertex + pixel) with build-error reporting and uniform setters. Usually owned and shared through a ShaderLibrary and referenced by a Material rather than used directly.
More...
#include <Shader.hpp>
|
| | Shader (const Path &pixel_shader_path, const Path &vertex_shader_path) |
| | Shader () |
| | ~Shader () |
| bool | valid () const |
| | Whether the last build (compile + link) succeeded.
|
| const std::string & | log () const |
| | Driver log of the last build (empty on success on most drivers).
|
| bool | use () const |
| | Bind this shader as the active one on the current display.
|
| ALLEGRO_SHADER * | native () const |
| | Underlying Allegro shader handle.
|
| bool | set_float (const char *name, float v) |
| bool | set_int (const char *name, int v) |
| bool | set_bool (const char *name, bool v) |
| bool | set_vec2 (const char *name, float x, float y) |
| bool | set_vec3 (const char *name, float x, float y, float z) |
| bool | set_vec4 (const char *name, float x, float y, float z, float w) |
| bool | set_sampler (const char *name, Texture *texture, int unit) |
| void | set_vertex_shader (const Path &vertex_shader_path) |
| void | set_pixel_shader (const Path &pixel_shader_path) |
| void | remove_vertex_shader () |
| void | remove_pixel_shader () |
|
| bool | build () |
| | (Re)link the shader and capture valid()/log().
|
A GLSL shader program (vertex + pixel) with build-error reporting and uniform setters. Usually owned and shared through a ShaderLibrary and referenced by a Material rather than used directly.
◆ Shader() [1/2]
| turbo::Shader::Shader |
( |
const Path & | pixel_shader_path, |
|
|
const Path & | vertex_shader_path ) |
◆ Shader() [2/2]
| turbo::Shader::Shader |
( |
| ) |
|
◆ ~Shader()
| turbo::Shader::~Shader |
( |
| ) |
|
◆ build()
| bool turbo::Shader::build |
( |
| ) |
|
|
protected |
(Re)link the shader and capture valid()/log().
◆ from_source()
| Shader * turbo::Shader::from_source |
( |
const std::string & | vertex_src, |
|
|
const std::string & | pixel_src ) |
|
static |
Build a shader directly from GLSL source strings.
- Returns
- a shader whose valid()/log() report the compile/link result.
◆ get_active_shader()
| Shader * turbo::Shader::get_active_shader |
( |
| ) |
|
|
static |
Retrieve the current shader
- Returns
◆ init_shaders()
| void turbo::Shader::init_shaders |
( |
| ) |
|
|
static |
already initialized internally, do not call this
◆ log()
| const std::string & turbo::Shader::log |
( |
| ) |
const |
|
inline |
Driver log of the last build (empty on success on most drivers).
◆ native()
| ALLEGRO_SHADER * turbo::Shader::native |
( |
| ) |
const |
|
inline |
Underlying Allegro shader handle.
◆ read_file()
| std::string turbo::Shader::read_file |
( |
const Path & | path | ) |
|
|
staticprotected |
◆ remove_pixel_shader()
| void turbo::Shader::remove_pixel_shader |
( |
| ) |
|
Reset the pixel shader to the default shader
◆ remove_vertex_shader()
| void turbo::Shader::remove_vertex_shader |
( |
| ) |
|
Reset the vertex shader to the default shader
◆ set_active_shader()
| void turbo::Shader::set_active_shader |
( |
Shader * | shader | ) |
|
|
static |
Set the active shader
- Parameters
-
◆ set_bool()
| bool turbo::Shader::set_bool |
( |
const char * | name, |
|
|
bool | v ) |
◆ set_float()
| bool turbo::Shader::set_float |
( |
const char * | name, |
|
|
float | v ) |
◆ set_int()
| bool turbo::Shader::set_int |
( |
const char * | name, |
|
|
int | v ) |
◆ set_pixel_shader()
| void turbo::Shader::set_pixel_shader |
( |
const Path & | pixel_shader_path | ) |
|
Set the specified GLSL pixel shader file
- Parameters
-
| pixel_shader_path | path to the shader file |
◆ set_sampler()
| bool turbo::Shader::set_sampler |
( |
const char * | name, |
|
|
Texture * | texture, |
|
|
int | unit ) |
◆ set_vec2()
| bool turbo::Shader::set_vec2 |
( |
const char * | name, |
|
|
float | x, |
|
|
float | y ) |
◆ set_vec3()
| bool turbo::Shader::set_vec3 |
( |
const char * | name, |
|
|
float | x, |
|
|
float | y, |
|
|
float | z ) |
◆ set_vec4()
| bool turbo::Shader::set_vec4 |
( |
const char * | name, |
|
|
float | x, |
|
|
float | y, |
|
|
float | z, |
|
|
float | w ) |
◆ set_vertex_shader()
| void turbo::Shader::set_vertex_shader |
( |
const Path & | vertex_shader_path | ) |
|
Load the specified GLSL vertex shader file
- Parameters
-
| vertex_shader_path | path to the shader file |
◆ use()
| bool turbo::Shader::use |
( |
| ) |
const |
Bind this shader as the active one on the current display.
◆ valid()
| bool turbo::Shader::valid |
( |
| ) |
const |
|
inline |
Whether the last build (compile + link) succeeded.
◆ current_shader
| Shader* turbo::Shader::current_shader = nullptr |
|
inlinestaticprotected |
◆ log_
| std::string turbo::Shader::log_ |
|
protected |
◆ pixel_shader_src
| std::string turbo::Shader::pixel_shader_src |
|
protected |
◆ shader
| ALLEGRO_SHADER* turbo::Shader::shader = nullptr |
|
protected |
◆ valid_
| bool turbo::Shader::valid_ = false |
|
protected |
◆ vertex_shader_src
| std::string turbo::Shader::vertex_shader_src |
|
protected |
The documentation for this class was generated from the following files: