Developer Documentation
|
#include <ACG/GL/ShaderGenerator.hh>
Public Member Functions | |
virtual void | modifyVertexIO (ShaderGenerator *_shader) |
Add your own inputs/outputs to the vertex shader. More... | |
virtual void | modifyVertexBeginCode (QStringList *_code) |
Append code the the vertex shader. More... | |
virtual void | modifyVertexEndCode (QStringList *_code) |
Append code the the vertex shader. More... | |
virtual void | modifyGeometryIO (ShaderGenerator *_shader) |
Add your own inputs/outputs to the geometry shader. More... | |
virtual void | modifyTessControlIO (ShaderGenerator *_shader) |
Add your own inputs/outputs to the tessellation control shader. More... | |
virtual void | modifyTessEvalIO (ShaderGenerator *_shader) |
Add your own inputs/outputs to the tessellation evaluation shader. More... | |
virtual void | modifyFragmentIO (ShaderGenerator *_shader) |
Add your own inputs/outputs to the fragment shader. More... | |
virtual void | modifyFragmentBeginCode (QStringList *_code) |
Append code the the fragment shader. More... | |
virtual void | modifyFragmentEndCode (QStringList *_code) |
Append code the the fragment shader. More... | |
virtual void | modifyLightingCode (QStringList *_code, int _lightId, ShaderGenLightType _lightType) |
Modify the default lighting code of the shader generator. More... | |
virtual bool | replaceDefaultLightingCode () |
Specify whether this modifier replaces or extends the default lighting code. More... | |
unsigned int | getID () |
Returns the modifier ID. More... | |
operator std::vector< unsigned int > () const | |
std::vector< unsigned int > | operator| (const std::vector< unsigned int > &_v) const |
Static Public Member Functions | |
static ShaderModifier * | loadFromFile (QString _filename) |
Load a modifier from file. More... | |
Private Attributes | |
unsigned int | modifierID_ |
Friends | |
class | ShaderProgGenerator |
A shader modifier can modify uniforms, in/outputs and glsl code of vertex and fragment shaders. This is useful for global effects like shadow mapping and depth peeling, where only little changes in code are necessary.
Usage:
Example:
To use the modifiers, you have to register them to the shader generator:
Definition at line 932 of file ShaderGenerator.hh.
|
inline |
Returns the modifier ID.
Definition at line 1095 of file ShaderGenerator.hh.
|
static |
Load a modifier from file.
Shader Mod text file format:
The file can begin with a glsl version directive (optionally): #version glsl_version
The rest of the file contains glsl code blocks, which are separated by keywords. Each keyword must be at the beginning of a line. Furthermore they end on a colon ':'. The keyword defines the meaning of the following code block.
IO code blocks are specified by the keywords: VertexIO:, TessControlIO:, TessEvalIO:, GeometryIO: and FragmentIO:
example
VertexIO: in vec3 customInputName; out vec3 custumOutputName; uniform vec4 param0;
Shader code modifications are done via the keywords: VertexBeginCode:, VertexEndCode:, FragmentBeginCode: and FragmentEndCode:
The returned modifier should not be deleted manually.
_filename | absolute or relative (from shaderdir) file name |
Definition at line 2679 of file ShaderGenerator.cc.
|
inlinevirtual |
Append code the the fragment shader.
Refer to the generation structure (Shader Generator ) to see where your code is added and which variables you can modify. Use
to insert your code here
_code | string list of shader code. |
Reimplemented in ACG::ShaderModifierFile, PeelDualLayerModifier, and PeelLayerModifier.
Definition at line 1048 of file ShaderGenerator.hh.
|
inlinevirtual |
Append code the the fragment shader.
Refer to the generation structure (Shader Generator ) to see where your code is added and which variables you can modify. Use
to insert your code here.
_code | string list of shader code. |
Reimplemented in ACG::ShaderModifierFile, ACG::IRenderer::DepthMapPass, PeelDualInitModifier, PeelDualLayerModifier, PeelInitModifier, CelShadingModifier, PeelLayerModifier, and NormalFragmentModifier.
Definition at line 1064 of file ShaderGenerator.hh.
|
inlinevirtual |
Add your own inputs/outputs to the fragment shader.
your implementation may look like this:
_shader | shader interface |
Reimplemented in ACG::ShaderModifierFile, PeelDualLayerModifier, PeelInitModifier, CelShadingModifier, and PeelLayerModifier.
Definition at line 1032 of file ShaderGenerator.hh.
|
inlinevirtual |
Add your own inputs/outputs to the geometry shader.
your implementation may look like this:
_shader | shader interface |
Reimplemented in ACG::ShaderModifierFile.
Definition at line 993 of file ShaderGenerator.hh.
|
inlinevirtual |
Modify the default lighting code of the shader generator.
Refer to the generation structure (Shader Generator ) to see where your code is added and which variables you can modify.
Use
to insert your code here.
_code | string list of shader code. |
_lightId | light index, use g_vLightDir__{_lightId}, etc. in shader code to use light parameters |
_lightType | light type: point, spot or directional light |
Reimplemented in CelShadingModifier.
Definition at line 1083 of file ShaderGenerator.hh.
|
inlinevirtual |
Add your own inputs/outputs to the tessellation control shader.
your implementation may look like this:
_shader | shader interface |
Reimplemented in ACG::ShaderModifierFile.
Definition at line 1006 of file ShaderGenerator.hh.
|
inlinevirtual |
Add your own inputs/outputs to the tessellation evaluation shader.
your implementation may look like this:
_shader | shader interface |
Reimplemented in ACG::ShaderModifierFile.
Definition at line 1019 of file ShaderGenerator.hh.
|
inlinevirtual |
Append code the the vertex shader.
Refer to the generation structure (Shader Generator ) to see where your code is added and which variables you can modify. Use
to insert your code here.
_code | string list of shader code. |
Reimplemented in ACG::ShaderModifierFile.
Definition at line 965 of file ShaderGenerator.hh.
|
inlinevirtual |
Append code the the vertex shader.
Refer to the generation structure (Shader Generator ) to see where your code is added and which variables you can modify. Use
to insert your code here
_code | string list of shader code. |
Reimplemented in ACG::ShaderModifierFile.
Definition at line 980 of file ShaderGenerator.hh.
|
inlinevirtual |
Add your own inputs/outputs to the vertex shader.
Your implementation may look like this:
_shader | shader interface |
Reimplemented in ACG::ShaderModifierFile, CelShadingModifier, and NormalFragmentModifier.
Definition at line 951 of file ShaderGenerator.hh.
|
inlinevirtual |
Specify whether this modifier replaces or extends the default lighting code.
Reimplemented in CelShadingModifier.
Definition at line 1089 of file ShaderGenerator.hh.