The Vish Visualization Shell 0.3
Vish
Public Member Functions | Public Attributes | List of all members
Wizt::RenderNamespace::ProgramVariables Struct Reference

A collection of variables that are parameters to shaders, also known as uniforms in GLSL. More...

#include <ocean/Anemonia/RenderNamespace.hpp>

Inheritance diagram for Wizt::RenderNamespace::ProgramVariables:
Wizt::RenderBasin::Program Wizt::RenderNamespace::LightSource Wizt::GLProgram Wizt::WebGLProgram Wizt::ShaderLightSource::MyLightSource

Public Member Functions

ProgramVariablesmerge (const ProgramVariables &, substitutes_t &substitutes, const std::string &src_original, const std::string &src_substitute)
 Merge a set of program variables into this current one and substitute the variable names by another string thereby.
 
void remove (const substitutes_t &substitutes)
 Remove all variables as given in the set.
 
template<class T >
void setMandatoryValue (const std::string &name, const T &t, bool isMandatory=true)
 Set a value that will raise an exception if that variable is not used in the shader program.
 
void setPointValue (const std::string &name, const Eagle::FixedArray< double, 3 > &v)
 Set an vec3 uniform that is suspect to coordinate shifting.
 
void setValue (const std::string &name, const Eagle::FixedArray< double, 2 > &v)
 Set an vec2 uniform.
 
void setValue (const std::string &name, const Eagle::FixedArray< double, 3 > &v)
 Set an vec3 uniform.
 
void setValue (const std::string &name, const Eagle::FixedArray< double, 4 > &v)
 Set an vec4 uniform.
 
void setValue (const std::string &name, const Eagle::FixedArray< float, 4 > &v)
 Set an vec4 uniform of floats.
 
void setValue (const std::string &name, const Eagle::FixedArray< int, 2 > &v)
 Set an vec2 uniform.
 
void setValue (const std::string &name, const Eagle::FixedArray< int, 3 > &v)
 Set an vec3 uniform.
 
void setValue (const std::string &name, const Eagle::Quadratic< 3, float > &M)
 Set an integer uniform.
 
void setValue (const std::string &name, double d)
 Set a floating point uniform.
 
void setValue (const std::string &name, int i)
 Set an integer uniform.
 

Public Attributes

FloatValues_t FloatValues
 A set of floating point values that will be set for this program.
 
IntValues_t IntValues
 A set of integer values that will be set for this program.
 
std::map< std::string, Eagle::FixedArray< int, 2 > > iVec2Values
 A set of 3D integer vectors that will be set for this program as uniforms.
 
std::map< std::string, Eagle::FixedArray< int, 3 > > iVec3Values
 A set of 3D integer vectors that will be set for this program as uniforms.
 
std::map< std::string, std::vector< Eagle::Quadratic< 3, float > > > M33ArrayValues
 A set of matric values that will be set for this program.
 
std::map< std::string, Eagle::Quadratic< 3, float > > M33Values
 A set of matric values that will be set for this program.
 
std::map< std::string, Eagle::FixedArray< double, 3 > > Point3Values
 A set of 3D vectors that will be set for this program as uniforms.
 
std::map< std::string, Eagle::FixedArray< double, 2 > > Vec2Values
 A set of 2D vectors that will be set for this program as uniforms.
 
std::map< std::string, Eagle::FixedArray< double, 3 > > Vec3Values
 A set of 3D vectors that will be set for this program as uniforms.
 
std::map< std::string, Eagle::FixedArray< double, 4 > > Vec4Values
 A set of 4D vectors that will be set for this program as uniforms.
 

Detailed Description

A collection of variables that are parameters to shaders, also known as uniforms in GLSL.

This collection of variables holds those values on the CPU and can be sent to the GPU then at once by the appropriate call in class Program . It also supports merging another set of program variables while changing the name of the merged variables. This is used when dealing with light sources, where each light source gets an unique number only at render time when the number of active light sources is known.

Member Function Documentation

◆ merge()

RenderNamespace::ProgramVariables & Wizt::RenderNamespace::ProgramVariables::merge ( const ProgramVariables PV,
substitutes_t &  substitutes,
const std::string &  src_original,
const std::string &  src_substitute 
)

Merge a set of program variables into this current one and substitute the variable names by another string thereby.

Remembers which variables have been substituted such that those can be removed later one.

References FloatValues, IntValues, iVec2Values, iVec3Values, M33ArrayValues, M33Values, Point3Values, Vec2Values, Vec3Values, and Vec4Values.

Referenced by Wizt::RenderBasin::mergeIlluminationUniforms().