Developer Documentation
ACG::SceneGraph::ACG::ShaderGenerator Class Reference

Classes

struct  DefaultIODesc
 
struct  Keywords
 

Public Member Functions

void setGLSLVersion (int _version)
 Set glsl version.
 
void addIncludeFile (QString _fileName)
 Imports another shader, same as #include.
 
void initVertexShaderIO (const ShaderGenDesc *_desc, const DefaultIODesc *_iodesc)
 Adds fitting vertex shader io for a given description.
 
void initTessControlShaderIO (const ShaderGenDesc *_desc, ShaderGenerator *_prevStage, const DefaultIODesc *_iodesc)
 Adds fitting tess-control shader io for a given description.
 
void initTessEvalShaderIO (const ShaderGenDesc *_desc, ShaderGenerator *_prevStage, const DefaultIODesc *_iodesc)
 Adds fitting tess-evaluation shader io for a given description.
 
void initGeometryShaderIO (const ShaderGenDesc *_desc, ShaderGenerator *_prevStage, const DefaultIODesc *_iodesc)
 Adds fitting geometry shader io for a given description.
 
void initFragmentShaderIO (const ShaderGenDesc *_desc, ShaderGenerator *_prevStage, const DefaultIODesc *_iodesc)
 Adds fitting fragment shader io for a given description.
 
void initDefaultUniforms ()
 Adds frequently used uniform parameters. More...
 
void addInput (const QString &_input)
 Add one GLSL input specifier. More...
 
void addInput (const QString &_type, const QString &_varname)
 Add one GLSL input specifier. More...
 
void addOutput (const QString &_output)
 Add one GLSL output specifier. More...
 
void addOutput (const QString &_type, const QString &_varname)
 Add one GLSL output specifier. More...
 
void addUniform (QString _uniform, QString _comment="")
 Add one GLSL uniform specifier. More...
 
void addDefine (const QString &_define)
 Add one define. More...
 
void addIODefine (const QString &_macroName, const QString &_resolvedName)
 Assign an opaque name to the abstract macro. More...
 
void addMacros (const QStringList &_macros)
 Add a list of preprocessor macros. More...
 
bool hasDefine (QString _define) const
 Check for define. More...
 
void addLayout (QString _layout)
 Add a layout directive. More...
 
void addRawIOBlock (QStringList _codeBlock)
 Add a raw glsl IO code block. More...
 
void addLight (int lightIndex_, ShaderGenLightType _light)
 Add a light description to shader:
 
void buildShaderCode (QStringList *_pMainCode, const QStringList &_defaultLightingFunctions)
 Shader assembly function. More...
 
const QStringList & getShaderCode ()
 Get result of buildShaderCode.
 
void saveToFile (const char *_fileName)
 Save generated shader code to text file. More...
 
void matchInputs (const ShaderGenerator *_previousShaderStage, bool _passToNextStage, QString _inputPrefix="outVertex", QString _outputPrefix="outGeometry")
 Perform name matching of outputs and inputs between two shader stages. More...
 
void defineIOAbstraction (const DefaultIODesc *_iodesc, bool _vs, bool _fs)
 Define abstract IO names via shader defines. More...
 
int getNumOutputs () const
 get number of outputs
 
QString getOutputName (int _id) const
 get variable name of output More...
 
int getNumInputs () const
 get number of inputs
 
QString getInputName (int _id) const
 get variable name of input More...
 
QString getIOMapName (int _inId) const
 get corresponding output name of an input id More...
 
void setGLSLVersion (int _version)
 Set glsl version.
 
void addIncludeFile (QString _fileName)
 Imports another shader, same as #include.
 
void initVertexShaderIO (const ShaderGenDesc *_desc, const DefaultIODesc *_iodesc)
 Adds fitting vertex shader io for a given description.
 
void initTessControlShaderIO (const ShaderGenDesc *_desc, ShaderGenerator *_prevStage, const DefaultIODesc *_iodesc)
 Adds fitting tess-control shader io for a given description.
 
void initTessEvalShaderIO (const ShaderGenDesc *_desc, ShaderGenerator *_prevStage, const DefaultIODesc *_iodesc)
 Adds fitting tess-evaluation shader io for a given description.
 
void initGeometryShaderIO (const ShaderGenDesc *_desc, ShaderGenerator *_prevStage, const DefaultIODesc *_iodesc)
 Adds fitting geometry shader io for a given description.
 
void initFragmentShaderIO (const ShaderGenDesc *_desc, ShaderGenerator *_prevStage, const DefaultIODesc *_iodesc)
 Adds fitting fragment shader io for a given description.
 
void initDefaultUniforms ()
 Adds frequently used uniform parameters. More...
 
void addInput (const QString &_input)
 Add one GLSL input specifier. More...
 
void addInput (const QString &_type, const QString &_varname)
 Add one GLSL input specifier. More...
 
void addOutput (const QString &_output)
 Add one GLSL output specifier. More...
 
void addOutput (const QString &_type, const QString &_varname)
 Add one GLSL output specifier. More...
 
void addUniform (QString _uniform, QString _comment="")
 Add one GLSL uniform specifier. More...
 
void addDefine (const QString &_define)
 Add one define. More...
 
void addIODefine (const QString &_macroName, const QString &_resolvedName)
 Assign an opaque name to the abstract macro. More...
 
void addMacros (const QStringList &_macros)
 Add a list of preprocessor macros. More...
 
bool hasDefine (QString _define) const
 Check for define. More...
 
void addLayout (QString _layout)
 Add a layout directive. More...
 
void addRawIOBlock (QStringList _codeBlock)
 Add a raw glsl IO code block. More...
 
void addLight (int lightIndex_, ShaderGenLightType _light)
 Add a light description to shader:
 
void buildShaderCode (QStringList *_pMainCode, const QStringList &_defaultLightingFunctions)
 Shader assembly function. More...
 
const QStringList & getShaderCode ()
 Get result of buildShaderCode.
 
void saveToFile (const char *_fileName)
 Save generated shader code to text file. More...
 
void matchInputs (const ShaderGenerator *_previousShaderStage, bool _passToNextStage, QString _inputPrefix="outVertex", QString _outputPrefix="outGeometry")
 Perform name matching of outputs and inputs between two shader stages. More...
 
void defineIOAbstraction (const DefaultIODesc *_iodesc, bool _vs, bool _fs)
 Define abstract IO names via shader defines. More...
 
int getNumOutputs () const
 get number of outputs
 
QString getOutputName (int _id) const
 get variable name of output More...
 
int getNumInputs () const
 get number of inputs
 
QString getInputName (int _id) const
 get variable name of input More...
 
QString getIOMapName (int _inId) const
 get corresponding output name of an input id More...
 
void setGLSLVersion (int _version)
 Set glsl version.
 
void addIncludeFile (QString _fileName)
 Imports another shader, same as #include.
 
void initVertexShaderIO (const ShaderGenDesc *_desc, const DefaultIODesc *_iodesc)
 Adds fitting vertex shader io for a given description.
 
void initTessControlShaderIO (const ShaderGenDesc *_desc, ShaderGenerator *_prevStage, const DefaultIODesc *_iodesc)
 Adds fitting tess-control shader io for a given description.
 
void initTessEvalShaderIO (const ShaderGenDesc *_desc, ShaderGenerator *_prevStage, const DefaultIODesc *_iodesc)
 Adds fitting tess-evaluation shader io for a given description.
 
void initGeometryShaderIO (const ShaderGenDesc *_desc, ShaderGenerator *_prevStage, const DefaultIODesc *_iodesc)
 Adds fitting geometry shader io for a given description.
 
void initFragmentShaderIO (const ShaderGenDesc *_desc, ShaderGenerator *_prevStage, const DefaultIODesc *_iodesc)
 Adds fitting fragment shader io for a given description.
 
void initDefaultUniforms ()
 Adds frequently used uniform parameters. More...
 
void addInput (const QString &_input)
 Add one GLSL input specifier. More...
 
void addInput (const QString &_type, const QString &_varname)
 Add one GLSL input specifier. More...
 
void addOutput (const QString &_output)
 Add one GLSL output specifier. More...
 
void addOutput (const QString &_type, const QString &_varname)
 Add one GLSL output specifier. More...
 
void addUniform (QString _uniform, QString _comment="")
 Add one GLSL uniform specifier. More...
 
void addDefine (const QString &_define)
 Add one define. More...
 
void addIODefine (const QString &_macroName, const QString &_resolvedName)
 Assign an opaque name to the abstract macro. More...
 
void addMacros (const QStringList &_macros)
 Add a list of preprocessor macros. More...
 
bool hasDefine (QString _define) const
 Check for define. More...
 
void addLayout (QString _layout)
 Add a layout directive. More...
 
void addRawIOBlock (QStringList _codeBlock)
 Add a raw glsl IO code block. More...
 
void addLight (int lightIndex_, ShaderGenLightType _light)
 Add a light description to shader:
 
void buildShaderCode (QStringList *_pMainCode, const QStringList &_defaultLightingFunctions)
 Shader assembly function. More...
 
const QStringList & getShaderCode ()
 Get result of buildShaderCode.
 
void saveToFile (const char *_fileName)
 Save generated shader code to text file. More...
 
void matchInputs (const ShaderGenerator *_previousShaderStage, bool _passToNextStage, QString _inputPrefix="outVertex", QString _outputPrefix="outGeometry")
 Perform name matching of outputs and inputs between two shader stages. More...
 
void defineIOAbstraction (const DefaultIODesc *_iodesc, bool _vs, bool _fs)
 Define abstract IO names via shader defines. More...
 
int getNumOutputs () const
 get number of outputs
 
QString getOutputName (int _id) const
 get variable name of output More...
 
int getNumInputs () const
 get number of inputs
 
QString getInputName (int _id) const
 get variable name of input More...
 
QString getIOMapName (int _inId) const
 get corresponding output name of an input id More...
 

Static Public Attributes

static const Keywords keywords
 

Private Member Functions

void addStringToList (QString _str, QStringList *_list, QString _prefix="", QString _postfix="")
 
void addIOToCode (const QStringList &_cmds)
 
void addStringToList (QString _str, QStringList *_list, QString _prefix="", QString _postfix="")
 
void addIOToCode (const QStringList &_cmds)
 
void addStringToList (QString _str, QStringList *_list, QString _prefix="", QString _postfix="")
 
void addIOToCode (const QStringList &_cmds)
 

Private Attributes

QStringList code_
 
QStringList imports_
 glsl code imports (with #include )
 
int version_
 
QStringList inputs_
 
QStringList outputs_
 
QStringList uniforms_
 
QStringList genDefines_
 
QStringList layouts_
 
QStringList rawIO_
 io block as glsl code
 
bool inputArrays_
 inputs of shader are arrays (tess-control, tess-eval, geometry)
 
bool outputArrays_
 outputs of shader are arrays (tess-control)
 
QString inputPrefix_
 prefix of inputs to this shader, same as prefix of ouputs of previous stage
 
QString outputPrefix_
 prefix of outputs of this shader
 

Detailed Description

The ShaderGenerator is used to collect shader io, uniforms, defines and includes.

The shader main-function is not generated here and must be provided as a parameter to the buildShaderCode function.

Definition at line 524 of file MeshNode2T.cc.

Member Function Documentation

void ACG::SceneGraph::ACG::ShaderGenerator::addDefine ( const QString &  _define)

Add one define.

Example:

#define SG_GOURAUD 1
void ACG::SceneGraph::ACG::ShaderGenerator::addDefine ( const QString &  _define)

Add one define.

Example:

#define SG_GOURAUD 1
void ACG::SceneGraph::ACG::ShaderGenerator::addDefine ( const QString &  _define)

Add one define.

Example:

#define SG_GOURAUD 1
void ACG::SceneGraph::ACG::ShaderGenerator::addInput ( const QString &  _input)

Add one GLSL input specifier.

Stores string pointer only Example:

in vec4 inPosition;
void ACG::SceneGraph::ACG::ShaderGenerator::addInput ( const QString &  _input)

Add one GLSL input specifier.

Stores string pointer only Example:

in vec4 inPosition;
void ACG::SceneGraph::ACG::ShaderGenerator::addInput ( const QString &  _input)

Add one GLSL input specifier.

Stores string pointer only Example:

in vec4 inPosition;
void ACG::SceneGraph::ACG::ShaderGenerator::addInput ( const QString &  _type,
const QString &  _varname 
)
inline

Add one GLSL input specifier.

Stores string pointer only Example:

in vec4 inPosition;

Definition at line 606 of file MeshNode2T.cc.

void ACG::SceneGraph::ACG::ShaderGenerator::addInput ( const QString &  _type,
const QString &  _varname 
)
inline

Add one GLSL input specifier.

Stores string pointer only Example:

in vec4 inPosition;

Definition at line 606 of file MeshNode2T.cc.

void ACG::SceneGraph::ACG::ShaderGenerator::addInput ( const QString &  _type,
const QString &  _varname 
)
inline

Add one GLSL input specifier.

Stores string pointer only Example:

in vec4 inPosition;

Definition at line 606 of file MeshNode2T.cc.

void ACG::SceneGraph::ACG::ShaderGenerator::addIODefine ( const QString &  _macroName,
const QString &  _resolvedName 
)

Assign an opaque name to the abstract macro.

void ACG::SceneGraph::ACG::ShaderGenerator::addIODefine ( const QString &  _macroName,
const QString &  _resolvedName 
)

Assign an opaque name to the abstract macro.

void ACG::SceneGraph::ACG::ShaderGenerator::addIODefine ( const QString &  _macroName,
const QString &  _resolvedName 
)

Assign an opaque name to the abstract macro.

void ACG::SceneGraph::ACG::ShaderGenerator::addIOToCode ( const QStringList &  _cmds)
private

Adds command lines to the shader code. Eventually appends missing ';'

void ACG::SceneGraph::ACG::ShaderGenerator::addIOToCode ( const QStringList &  _cmds)
private

Adds command lines to the shader code. Eventually appends missing ';'

void ACG::SceneGraph::ACG::ShaderGenerator::addIOToCode ( const QStringList &  _cmds)
private

Adds command lines to the shader code. Eventually appends missing ';'

void ACG::SceneGraph::ACG::ShaderGenerator::addLayout ( QString  _layout)

Add a layout directive.

Example:

layout(vertices = 3) out;
void ACG::SceneGraph::ACG::ShaderGenerator::addLayout ( QString  _layout)

Add a layout directive.

Example:

layout(vertices = 3) out;
void ACG::SceneGraph::ACG::ShaderGenerator::addLayout ( QString  _layout)

Add a layout directive.

Example:

layout(vertices = 3) out;
void ACG::SceneGraph::ACG::ShaderGenerator::addMacros ( const QStringList &  _macros)

Add a list of preprocessor macros.

void ACG::SceneGraph::ACG::ShaderGenerator::addMacros ( const QStringList &  _macros)

Add a list of preprocessor macros.

void ACG::SceneGraph::ACG::ShaderGenerator::addMacros ( const QStringList &  _macros)

Add a list of preprocessor macros.

void ACG::SceneGraph::ACG::ShaderGenerator::addOutput ( const QString &  _output)

Add one GLSL output specifier.

Stores string pointer only Example:

out vec4 inPosition;
void ACG::SceneGraph::ACG::ShaderGenerator::addOutput ( const QString &  _output)

Add one GLSL output specifier.

Stores string pointer only Example:

out vec4 inPosition;
void ACG::SceneGraph::ACG::ShaderGenerator::addOutput ( const QString &  _output)

Add one GLSL output specifier.

Stores string pointer only Example:

out vec4 inPosition;
void ACG::SceneGraph::ACG::ShaderGenerator::addOutput ( const QString &  _type,
const QString &  _varname 
)
inline

Add one GLSL output specifier.

Stores string pointer only Example:

out vec4 inPosition;

Definition at line 626 of file MeshNode2T.cc.

void ACG::SceneGraph::ACG::ShaderGenerator::addOutput ( const QString &  _type,
const QString &  _varname 
)
inline

Add one GLSL output specifier.

Stores string pointer only Example:

out vec4 inPosition;

Definition at line 626 of file MeshNode2T.cc.

void ACG::SceneGraph::ACG::ShaderGenerator::addOutput ( const QString &  _type,
const QString &  _varname 
)
inline

Add one GLSL output specifier.

Stores string pointer only Example:

out vec4 inPosition;

Definition at line 626 of file MeshNode2T.cc.

void ACG::SceneGraph::ACG::ShaderGenerator::addRawIOBlock ( QStringList  _codeBlock)
inline

Add a raw glsl IO code block.

This code block is inserted between the generated IO block and the main function.

Example:

in vec3 someInput;
out vec3 outSomeOutput;
uniform vec3 paramA;
#define USE_METHOD_X
#include "imports.h"
..

Definition at line 691 of file MeshNode2T.cc.

void ACG::SceneGraph::ACG::ShaderGenerator::addRawIOBlock ( QStringList  _codeBlock)
inline

Add a raw glsl IO code block.

This code block is inserted between the generated IO block and the main function.

Example:

in vec3 someInput;
out vec3 outSomeOutput;
uniform vec3 paramA;
#define USE_METHOD_X
#include "imports.h"
..

Definition at line 691 of file MeshNode2T.cc.

void ACG::SceneGraph::ACG::ShaderGenerator::addRawIOBlock ( QStringList  _codeBlock)
inline

Add a raw glsl IO code block.

This code block is inserted between the generated IO block and the main function.

Example:

in vec3 someInput;
out vec3 outSomeOutput;
uniform vec3 paramA;
#define USE_METHOD_X
#include "imports.h"
..

Definition at line 691 of file MeshNode2T.cc.

void ACG::SceneGraph::ACG::ShaderGenerator::addStringToList ( QString  _str,
QStringList *  _list,
QString  _prefix = "",
QString  _postfix = "" 
)
private

aborts if string already present prefix, postfix functionality is very basic: only checks for occurrence and disregards location

void ACG::SceneGraph::ACG::ShaderGenerator::addStringToList ( QString  _str,
QStringList *  _list,
QString  _prefix = "",
QString  _postfix = "" 
)
private

aborts if string already present prefix, postfix functionality is very basic: only checks for occurrence and disregards location

void ACG::SceneGraph::ACG::ShaderGenerator::addStringToList ( QString  _str,
QStringList *  _list,
QString  _prefix = "",
QString  _postfix = "" 
)
private

aborts if string already present prefix, postfix functionality is very basic: only checks for occurrence and disregards location

void ACG::SceneGraph::ACG::ShaderGenerator::addUniform ( QString  _uniform,
QString  _comment = "" 
)

Add one GLSL uniform specifier.

Stores string pointer only Example:

uniform sampler2D sampAmbient;
void ACG::SceneGraph::ACG::ShaderGenerator::addUniform ( QString  _uniform,
QString  _comment = "" 
)

Add one GLSL uniform specifier.

Stores string pointer only Example:

uniform sampler2D sampAmbient;
void ACG::SceneGraph::ACG::ShaderGenerator::addUniform ( QString  _uniform,
QString  _comment = "" 
)

Add one GLSL uniform specifier.

Stores string pointer only Example:

uniform sampler2D sampAmbient;
void ACG::SceneGraph::ACG::ShaderGenerator::buildShaderCode ( QStringList *  _pMainCode,
const QStringList &  _defaultLightingFunctions 
)

Shader assembly function.

Also scans shader code for references to default lighting functions LitPointLight(), LitDirLight(), LitSpotLight() and eventually adds these to the shader.

void ACG::SceneGraph::ACG::ShaderGenerator::buildShaderCode ( QStringList *  _pMainCode,
const QStringList &  _defaultLightingFunctions 
)

Shader assembly function.

Also scans shader code for references to default lighting functions LitPointLight(), LitDirLight(), LitSpotLight() and eventually adds these to the shader.

void ACG::SceneGraph::ACG::ShaderGenerator::buildShaderCode ( QStringList *  _pMainCode,
const QStringList &  _defaultLightingFunctions 
)

Shader assembly function.

Also scans shader code for references to default lighting functions LitPointLight(), LitDirLight(), LitSpotLight() and eventually adds these to the shader.

void ACG::SceneGraph::ACG::ShaderGenerator::defineIOAbstraction ( const DefaultIODesc _iodesc,
bool  _vs,
bool  _fs 
)

Define abstract IO names via shader defines.

Default shader inputs and outputs can be conveniently accessed via SG_INPUT_X and SG_OUTPUT_X defines without having to worry about the combinatoric problem of shader stages. For example, in a fragment-shader view-space normals can always be accessed via SG_INPUT_NORMALVS, regardless whether there is a geometry shader or not.

Parameters
_iodescshader IO descriptor
_vsIO abstraction for vertex shader
_fsIO abstraction for fragment shader
void ACG::SceneGraph::ACG::ShaderGenerator::defineIOAbstraction ( const DefaultIODesc _iodesc,
bool  _vs,
bool  _fs 
)

Define abstract IO names via shader defines.

Default shader inputs and outputs can be conveniently accessed via SG_INPUT_X and SG_OUTPUT_X defines without having to worry about the combinatoric problem of shader stages. For example, in a fragment-shader view-space normals can always be accessed via SG_INPUT_NORMALVS, regardless whether there is a geometry shader or not.

Parameters
_iodescshader IO descriptor
_vsIO abstraction for vertex shader
_fsIO abstraction for fragment shader
void ACG::SceneGraph::ACG::ShaderGenerator::defineIOAbstraction ( const DefaultIODesc _iodesc,
bool  _vs,
bool  _fs 
)

Define abstract IO names via shader defines.

Default shader inputs and outputs can be conveniently accessed via SG_INPUT_X and SG_OUTPUT_X defines without having to worry about the combinatoric problem of shader stages. For example, in a fragment-shader view-space normals can always be accessed via SG_INPUT_NORMALVS, regardless whether there is a geometry shader or not.

Parameters
_iodescshader IO descriptor
_vsIO abstraction for vertex shader
_fsIO abstraction for fragment shader
QString ACG::SceneGraph::ACG::ShaderGenerator::getInputName ( int  _id) const

get variable name of input

Parameters
_idzero based index of input
QString ACG::SceneGraph::ACG::ShaderGenerator::getInputName ( int  _id) const

get variable name of input

Parameters
_idzero based index of input
QString ACG::SceneGraph::ACG::ShaderGenerator::getInputName ( int  _id) const

get variable name of input

Parameters
_idzero based index of input
QString ACG::SceneGraph::ACG::ShaderGenerator::getIOMapName ( int  _inId) const

get corresponding output name of an input id

Parameters
_inIdzero-based index of input id
Returns
matching output name
QString ACG::SceneGraph::ACG::ShaderGenerator::getIOMapName ( int  _inId) const

get corresponding output name of an input id

Parameters
_inIdzero-based index of input id
Returns
matching output name
QString ACG::SceneGraph::ACG::ShaderGenerator::getIOMapName ( int  _inId) const

get corresponding output name of an input id

Parameters
_inIdzero-based index of input id
Returns
matching output name
QString ACG::SceneGraph::ACG::ShaderGenerator::getOutputName ( int  _id) const

get variable name of output

Parameters
_idzero based index of output
QString ACG::SceneGraph::ACG::ShaderGenerator::getOutputName ( int  _id) const

get variable name of output

Parameters
_idzero based index of output
QString ACG::SceneGraph::ACG::ShaderGenerator::getOutputName ( int  _id) const

get variable name of output

Parameters
_idzero based index of output
bool ACG::SceneGraph::ACG::ShaderGenerator::hasDefine ( QString  _define) const

Check for define.

Example:

hasDefine("#define SG_REQUEST_NORMAL")
bool ACG::SceneGraph::ACG::ShaderGenerator::hasDefine ( QString  _define) const

Check for define.

Example:

hasDefine("#define SG_REQUEST_NORMAL")
bool ACG::SceneGraph::ACG::ShaderGenerator::hasDefine ( QString  _define) const

Check for define.

Example:

hasDefine("#define SG_REQUEST_NORMAL")
void ACG::SceneGraph::ACG::ShaderGenerator::initDefaultUniforms ( )

Adds frequently used uniform parameters.

Adds frequently used uniform parameters like:

  • world, view, projection matrices
  • cam pos, view dir
  • per object material names: g_cDiffuse, g_cAmbient...
void ACG::SceneGraph::ACG::ShaderGenerator::initDefaultUniforms ( )

Adds frequently used uniform parameters.

Adds frequently used uniform parameters like:

  • world, view, projection matrices
  • cam pos, view dir
  • per object material names: g_cDiffuse, g_cAmbient...
void ACG::SceneGraph::ACG::ShaderGenerator::initDefaultUniforms ( )

Adds frequently used uniform parameters.

Adds frequently used uniform parameters like:

  • world, view, projection matrices
  • cam pos, view dir
  • per object material names: g_cDiffuse, g_cAmbient...
void ACG::SceneGraph::ACG::ShaderGenerator::matchInputs ( const ShaderGenerator _previousShaderStage,
bool  _passToNextStage,
QString  _inputPrefix = "outVertex",
QString  _outputPrefix = "outGeometry" 
)

Perform name matching of outputs and inputs between two shader stages.

IO of this shader (for instance fragment-shader) and its previous shader (for instance vertex shader) require matching names. Example: The vertex shader has an output "out vec3 outVertexNormal", then this function simply adds the input "in vec3 outVertexNormal" to the current shader (either a geometry or fragment shader). If this is a geometry shader, _passToNextStage should be set to true so that "out vec3 outGeometryNormal" is also added to the outputs.

Parameters
_previousShaderStageshader of the previous stage, which should have all outputs setup already
_passToNextStageall outputs of the previous shader stage are passed to the next stage (should be false for fragment shader for instance)
_inputPrefixname prefix of inputs to this shader (only necessary if _passToNextStage is true)
_outputPrefixname prefix of outputs of this shader (only necessary if _passToNextStage is true)
void ACG::SceneGraph::ACG::ShaderGenerator::matchInputs ( const ShaderGenerator _previousShaderStage,
bool  _passToNextStage,
QString  _inputPrefix = "outVertex",
QString  _outputPrefix = "outGeometry" 
)

Perform name matching of outputs and inputs between two shader stages.

IO of this shader (for instance fragment-shader) and its previous shader (for instance vertex shader) require matching names. Example: The vertex shader has an output "out vec3 outVertexNormal", then this function simply adds the input "in vec3 outVertexNormal" to the current shader (either a geometry or fragment shader). If this is a geometry shader, _passToNextStage should be set to true so that "out vec3 outGeometryNormal" is also added to the outputs.

Parameters
_previousShaderStageshader of the previous stage, which should have all outputs setup already
_passToNextStageall outputs of the previous shader stage are passed to the next stage (should be false for fragment shader for instance)
_inputPrefixname prefix of inputs to this shader (only necessary if _passToNextStage is true)
_outputPrefixname prefix of outputs of this shader (only necessary if _passToNextStage is true)
void ACG::SceneGraph::ACG::ShaderGenerator::matchInputs ( const ShaderGenerator _previousShaderStage,
bool  _passToNextStage,
QString  _inputPrefix = "outVertex",
QString  _outputPrefix = "outGeometry" 
)

Perform name matching of outputs and inputs between two shader stages.

IO of this shader (for instance fragment-shader) and its previous shader (for instance vertex shader) require matching names. Example: The vertex shader has an output "out vec3 outVertexNormal", then this function simply adds the input "in vec3 outVertexNormal" to the current shader (either a geometry or fragment shader). If this is a geometry shader, _passToNextStage should be set to true so that "out vec3 outGeometryNormal" is also added to the outputs.

Parameters
_previousShaderStageshader of the previous stage, which should have all outputs setup already
_passToNextStageall outputs of the previous shader stage are passed to the next stage (should be false for fragment shader for instance)
_inputPrefixname prefix of inputs to this shader (only necessary if _passToNextStage is true)
_outputPrefixname prefix of outputs of this shader (only necessary if _passToNextStage is true)
void ACG::SceneGraph::ACG::ShaderGenerator::saveToFile ( const char *  _fileName)

Save generated shader code to text file.

Parameters
_fileNameWhere to save
void ACG::SceneGraph::ACG::ShaderGenerator::saveToFile ( const char *  _fileName)

Save generated shader code to text file.

Parameters
_fileNameWhere to save
void ACG::SceneGraph::ACG::ShaderGenerator::saveToFile ( const char *  _fileName)

Save generated shader code to text file.

Parameters
_fileNameWhere to save

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