A shader program plus a named set of uniform values.
More...
#include <Material.hpp>
|
| | Material (Shader *shader) |
| void | set_float (const std::string &name, float v) |
| void | set_int (const std::string &name, int v) |
| void | set_bool (const std::string &name, bool v) |
| void | set_vec2 (const std::string &name, float x, float y) |
| void | set_vec3 (const std::string &name, float x, float y, float z) |
| void | set_vec4 (const std::string &name, float x, float y, float z, float w) |
| void | set_sampler (const std::string &name, Texture *t, int unit) |
| bool | bind () const |
| | Bind the shader and push every stored uniform. Call before drawing.
|
| bool | bind_at (float time) |
| | Refresh the "time" uniform (only if the material declares one) then bind. Lets animated shaders advance without pushing a uniform to shaders that don't use it.
|
| Shader * | shader () const |
| const std::map< std::string, UniformValue > & | uniforms () const |
| std::map< std::string, UniformValue > & | uniforms () |
| const std::string & | name () const |
| void | set_name (const std::string &name) |
A shader program plus a named set of uniform values.
A Material does not own its Shader (shaders are shared and owned by the ShaderLibrary). Uniform values are stored and only pushed to the GPU on bind(), which is the seam an inspector UI will later edit.
◆ Material()
| turbo::Material::Material |
( |
Shader * | shader | ) |
|
|
inlineexplicit |
◆ bind()
| bool turbo::Material::bind |
( |
| ) |
const |
Bind the shader and push every stored uniform. Call before drawing.
◆ bind_at()
| bool turbo::Material::bind_at |
( |
float | time | ) |
|
|
inline |
Refresh the "time" uniform (only if the material declares one) then bind. Lets animated shaders advance without pushing a uniform to shaders that don't use it.
◆ name()
| const std::string & turbo::Material::name |
( |
| ) |
const |
|
inline |
◆ set_bool()
| void turbo::Material::set_bool |
( |
const std::string & | name, |
|
|
bool | v ) |
|
inline |
◆ set_float()
| void turbo::Material::set_float |
( |
const std::string & | name, |
|
|
float | v ) |
|
inline |
◆ set_int()
| void turbo::Material::set_int |
( |
const std::string & | name, |
|
|
int | v ) |
|
inline |
◆ set_name()
| void turbo::Material::set_name |
( |
const std::string & | name | ) |
|
|
inline |
◆ set_sampler()
| void turbo::Material::set_sampler |
( |
const std::string & | name, |
|
|
Texture * | t, |
|
|
int | unit ) |
|
inline |
◆ set_vec2()
| void turbo::Material::set_vec2 |
( |
const std::string & | name, |
|
|
float | x, |
|
|
float | y ) |
|
inline |
◆ set_vec3()
| void turbo::Material::set_vec3 |
( |
const std::string & | name, |
|
|
float | x, |
|
|
float | y, |
|
|
float | z ) |
|
inline |
◆ set_vec4()
| void turbo::Material::set_vec4 |
( |
const std::string & | name, |
|
|
float | x, |
|
|
float | y, |
|
|
float | z, |
|
|
float | w ) |
|
inline |
◆ shader()
| Shader * turbo::Material::shader |
( |
| ) |
const |
|
inline |
◆ uniforms() [1/2]
| std::map< std::string, UniformValue > & turbo::Material::uniforms |
( |
| ) |
|
|
inline |
◆ uniforms() [2/2]
| const std::map< std::string, UniformValue > & turbo::Material::uniforms |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files: