![]() |
Jopnal Engine
alpha 0.4
Simple Component Based 2D/3D Game Engine
|
#include <ShaderProgram.hpp>
Public Member Functions | |
| ShaderProgram (const std::string &name) | |
| Constructor. More... | |
| ~ShaderProgram () | |
| Destructor. More... | |
| template<typename... Args> | |
| bool | load (const std::string &pp, const Args &...args) |
| Load shaders. More... | |
| bool | attachShader (const Shader &shader) |
| Attach shader to the program. More... | |
| bool | link () |
| Link the shader program. More... | |
| void | unlink () |
| Unlink the shader program. More... | |
| bool | bind () const |
| Bind this shader program for use. More... | |
| void | unbind () const |
| Unbind this shader program. More... | |
| bool | validate () const |
| Validate program status. More... | |
| bool | isValid () const |
| Check if this program is valid. More... | |
| bool | setUniform (const std::string &name, const glm::mat4 &matrix) |
| Set a mat4 uniform. More... | |
| bool | setUniform (const std::string &name, const float *matrices, const unsigned int amount) |
| Set an array of matrices. More... | |
| bool | setUniform (const std::string &name, const glm::mat3 &matrix) |
| Set a mat3 uniform. More... | |
| bool | setUniform (const std::string &name, const glm::vec2 &vector) |
| Set a two-dimensional float vector uniform. More... | |
| bool | setUniform (const std::string &name, const glm::vec3 &vector) |
| Set a vec3 uniform. More... | |
| bool | setUniform (const std::string &name, const glm::vec4 &vector) |
| Set a vec4 uniform. More... | |
| bool | setUniform (const std::string &name, const Texture &texture, const unsigned int unit) |
| Set a texture uniform. More... | |
| bool | setUniform (const std::string &name, const float value) |
| Set a float uniform. More... | |
| bool | setUniform (const std::string &name, const int value) |
| Set an integer uniform. More... | |
| bool | setUniform (const std::string &name, const bool value) |
| Set a boolean uniform. More... | |
Public Member Functions inherited from jop::Resource | |
| Resource (const std::string &name) | |
| Constructor. More... | |
| virtual | ~Resource ()=0 |
| Virtual destructor. More... | |
| const std::string & | getName () const |
| Get the name of this resource. More... | |
| void | setPersistence (const unsigned short level) |
| Set the persistence level. More... | |
| unsigned short | getPersistence () const |
| Get the persistence level. More... | |
Public Member Functions inherited from jop::SafeReferenceable< Resource > | |
| WeakReference< Resource > | getReference () const |
| Get a weak reference to the bound object. More... | |
Public Member Functions inherited from jop::SerializeInfo | |
| SerializeInfo () | |
| void | setSerializePackage (const uint16 package) |
| uint16 | getSerializePackage () const |
| void | setShouldSerialize (const bool set) |
| bool | shouldSerialize () const |
| void | setLightSerializeable (const bool set) |
| bool | isLightSerializeable () const |
Static Public Member Functions | |
| static ShaderProgram & | getDefault () |
| Get the default shader program. More... | |
| static ShaderProgram & | getError () |
| Get the error shader program. More... | |
| static unsigned int | getMaxAttributes () |
| Get the maximum vertex attributes. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from jop::Resource | |
| Resource (const Resource &other, const std::string &newName) | |
| Copy constructor. More... | |
Protected Member Functions inherited from jop::SafeReferenceable< Resource > | |
| SafeReferenceable (Resource *ref) | |
| Constructor. More... | |
| SafeReferenceable (SafeReferenceable< Resource > &&other) | |
| Move constructor. More... | |
| SafeReferenceable & | operator= (SafeReferenceable< Resource > &&other) |
| Move assignment operator. More... | |
| ~SafeReferenceable () | |
| Protected destructor. More... | |
Definition at line 40 of file ShaderProgram.hpp.
| jop::ShaderProgram::ShaderProgram | ( | const std::string & | name | ) |
Constructor.
| name | Name of the resource |
| jop::ShaderProgram::~ShaderProgram | ( | ) |
Destructor.
| bool jop::ShaderProgram::attachShader | ( | const Shader & | shader | ) |
Attach shader to the program.
| shader | Reference to shader object |
| bool jop::ShaderProgram::bind | ( | ) | const |
Bind this shader program for use.
|
static |
Get the default shader program.
|
static |
Get the error shader program.
This shader will paint any drawn object bright red.
|
static |
Get the maximum vertex attributes.
| bool jop::ShaderProgram::isValid | ( | ) | const |
Check if this program is valid.
| bool jop::ShaderProgram::link | ( | ) |
Link the shader program.
| bool jop::ShaderProgram::load | ( | const std::string & | pp, |
| const Args &... | args | ||
| ) |
Load shaders.
Attaches a variable number of shaders to shader program.
Invalid shader objects or empty sources will be silently ignored and won't be used in the final link operation.
| pp | Preprocessor string |
| args | Variable amount of shaders objects or shader sources |
| bool jop::ShaderProgram::setUniform | ( | const std::string & | name, |
| const glm::mat4 & | matrix | ||
| ) |
Set a mat4 uniform.
| name | Uniform name |
| matrix | A 4x4 matrix |
| bool jop::ShaderProgram::setUniform | ( | const std::string & | name, |
| const float * | matrices, | ||
| const unsigned int | amount | ||
| ) |
Set an array of matrices.
This is for 4x4 matrices (glm::mat4).
| name | The uniform name |
| matrices | Pointer to the first element of the first matrix |
| amount | Amount of the matrices |
| bool jop::ShaderProgram::setUniform | ( | const std::string & | name, |
| const glm::mat3 & | matrix | ||
| ) |
Set a mat3 uniform.
| name | Uniform name |
| matrix | A 3x3 matrix |
| bool jop::ShaderProgram::setUniform | ( | const std::string & | name, |
| const glm::vec2 & | vector | ||
| ) |
Set a two-dimensional float vector uniform.
| name | Name of the uniform |
| vector | The vector to set |
| bool jop::ShaderProgram::setUniform | ( | const std::string & | name, |
| const glm::vec3 & | vector | ||
| ) |
Set a vec3 uniform.
| name | Uniform name |
| vector | A 3-dimensional vector |
| bool jop::ShaderProgram::setUniform | ( | const std::string & | name, |
| const glm::vec4 & | vector | ||
| ) |
Set a vec4 uniform.
| name | Uniform name |
| vector | A 4-dimensional vector |
| bool jop::ShaderProgram::setUniform | ( | const std::string & | name, |
| const Texture & | texture, | ||
| const unsigned int | unit | ||
| ) |
Set a texture uniform.
| name | Uniform name |
| texture | A texture |
| unit | The texture unit |
| bool jop::ShaderProgram::setUniform | ( | const std::string & | name, |
| const float | value | ||
| ) |
Set a float uniform.
| name | Name of the uniform |
| value | The float value |
| bool jop::ShaderProgram::setUniform | ( | const std::string & | name, |
| const int | value | ||
| ) |
Set an integer uniform.
| name | Name of the uniform |
| value | The integer to set |
| bool jop::ShaderProgram::setUniform | ( | const std::string & | name, |
| const bool | value | ||
| ) |
Set a boolean uniform.
| name | Name of the uniform |
| value | The boolean to set |
| void jop::ShaderProgram::unbind | ( | ) | const |
Unbind this shader program.
| void jop::ShaderProgram::unlink | ( | ) |
Unlink the shader program.
Unbinds shader program and destroys it.
| bool jop::ShaderProgram::validate | ( | ) | const |
Validate program status.
1.8.11