Radium Engine  1.5.0
Ra::Engine::Data::ShaderProgram Class Referencefinal

#include <Engine/Data/ShaderProgram.hpp>

+ Collaboration diagram for Ra::Engine::Data::ShaderProgram:

Public Member Functions

 ShaderProgram (const Data::ShaderConfiguration &shaderConfig)
 
void load (const Data::ShaderConfiguration &shaderConfig)
 
void reload ()
 
Data::ShaderConfiguration getBasicConfiguration () const
 
void bind () const
 
void validate () const
 
void unbind () const
 
template<typename T >
void setUniform (const char *name, const T &value) const
 Uniform setters.
 
void setUniform (const char *name, Texture *tex, int texUnit) const
 
void setUniformTexture (const char *name, Texture *tex) const
 
globjects::Program * getProgramObject () const
 
void addShaderFromSource (Data::ShaderType type, std::unique_ptr< globjects::StaticStringSource > &&source, const std::string &name="", bool fromFile=true)
 
void link ()
 
template<>
void setUniform (const char *name, const Core::Vector2d &value) const
 
template<>
void setUniform (const char *name, const Core::Vector3d &value) const
 
template<>
void setUniform (const char *name, const Core::Vector4d &value) const
 
template<>
void setUniform (const char *name, const Core::Matrix2d &value) const
 
template<>
void setUniform (const char *name, const Core::Matrix3d &value) const
 
template<>
void setUniform (const char *name, const Core::Matrix4d &value) const
 
template<>
void setUniform (const char *name, const Scalar &value) const
 
template<>
void setUniform (const char *name, const std::vector< Scalar > &value) const
 

Detailed Description

Abstraction of OpenGL Shader Program

See also
globjects::Program and https://www.khronos.org/opengl/wiki/Shader

Definition at line 34 of file ShaderProgram.hpp.

Member Function Documentation

◆ addShaderFromSource()

void Ra::Engine::Data::ShaderProgram::addShaderFromSource ( Data::ShaderType  type,
std::unique_ptr< globjects::StaticStringSource > &&  source,
const std::string &  name = "",
bool  fromFile = true 
)
Todo:
go private, and update ShaderConfiguration to add from source !

Definition at line 168 of file ShaderProgram.cpp.

◆ link()

void Ra::Engine::Data::ShaderProgram::link ( )
Todo:
add other sampler type (or manage all type of sampler automatically)

Definition at line 210 of file ShaderProgram.cpp.

◆ setUniformTexture()

void Ra::Engine::Data::ShaderProgram::setUniformTexture ( const char *  name,
Texture tex 
) const

use automatic texture unit computation if you want to send a particular texture unit, use setUniform. It binds tex on an "arbitrary" tex unit.

Warning
, call a std::map::find (in O(log(active tex unit in the shader)))

Definition at line 365 of file ShaderProgram.cpp.

+ Here is the call graph for this function:

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