H3D API  2.4.1
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
H3D::ShaderCombiner Class Reference

The ShaderCombiner node combines the output of several fragment shaders in different ways to produce a final value by a combination of the output values of the shaders. More...

#include <H3D/ShaderCombiner.h>

Inheritance diagram for H3D::ShaderCombiner:
Inheritance graph

Public Member Functions

 ShaderCombiner (Inst< DisplayList > _displayList=0, Inst< SFNode > _metadata=0, Inst< SFBool > _isSelected=0, Inst< SFBool > _isValid=0, Inst< SFBool > _activate=0, Inst< SFString > _language=0, Inst< MFShaderPart > _parts=0, Inst< SFBool > _suppressUniformWarnings=0, Inst< MFString > _fragmentShaderString=0, Inst< MFString > _vertexShaderString=0, Inst< MFGeneratedFragmentShaderNode > _shaders=0, Inst< SFString > _function=0, Inst< SFString > _arg0Modifier=0, Inst< SFString > _arg1Modifier=0, Inst< SFFloat > _value=0, Inst< SFFloat > _arg0Value=0, Inst< SFFloat > _arg1Value=0, Inst< SFString > _alphaFunction=0, Inst< SFString > _alphaArg0Modifier=0, Inst< SFString > _alphaArg1Modifier=0, Inst< SFFloat > _alphaValue=0, Inst< SFFloat > _alphaArg0Value=0, Inst< SFFloat > _alphaArg1Value=0)
 Constructor.
 
virtual void traverseSG (TraverseInfo &ti)
 Traverse the scene-graph.
 
- Public Member Functions inherited from H3D::H3DGeneratedFragmentShaderNode
 H3DGeneratedFragmentShaderNode (Inst< DisplayList > _displayList=0, Inst< SFNode > _metadata=0, Inst< SFBool > _isSelected=0, Inst< SFBool > _isValid=0, Inst< SFBool > _activate=0, Inst< SFString > _language=0, Inst< MFShaderPart > _parts=0, Inst< SFBool > _suppressUniformWarnings=0, Inst< MFString > _fragmentShaderString=0, Inst< MFString > _vertexShaderString=0)
 Constructor.
 
- Public Member Functions inherited from H3D::H3DGeneratedShaderNode
 H3DGeneratedShaderNode (Inst< DisplayList > _displayList=0, Inst< SFNode > _metadata=0, Inst< SFBool > _isSelected=0, Inst< SFBool > _isValid=0, Inst< SFBool > _activate=0, Inst< SFString > _language=0, Inst< MFShaderPart > _parts=0, Inst< SFBool > _suppressUniformWarnings=0, Inst< MFString > _fragmentShaderString=0, Inst< MFString > _vertexShaderString=0)
 Constructor.
 
virtual void buildShader ()
 Rebuilds the generated shader, causing a full rebuild and relink of the shader.
 
virtual void preRender ()
 The preRender method is extended to make sure that the shader is up to date before rendering.
 
virtual string getFinalFragmentShaderOutputString ()
 Returns the string that is the last thing that is done in the fragment shader. More...
 
virtual string uniqueShaderName (const string &base_name)
 The uniqueShaderName function is used to generate a name unique for this instance of the shader generator node class. More...
 
virtual string getFragmentShaderHeader ()
 Return a string that is placed at the beginning of a fragment shader to specify minimum required version of the shader as well as enabled extensions.
 
virtual string getVertexShaderHeader ()
 Return a string that is placed at the beginning of a vertex shader to specify minimum required version of the shader as well as enabled extensions.
 
- Public Member Functions inherited from H3D::ComposedShader
 ComposedShader (Inst< DisplayList > _displayList=0, Inst< SFNode > _metadata=0, Inst< SFBool > _isSelected=0, Inst< SFBool > _isValid=0, Inst< SFBool > _activate=0, Inst< SFString > _language=0, Inst< MFShaderPart > _parts=0, Inst< SFBool > _suppressUniformWarnings=0, Inst< SFString > _geometryInputType=0, Inst< SFString > _geometryOutputType=0, Inst< SFInt32 > _geometryVerticesOut=0, Inst< SFString > _transparencyDetectMode=0, Inst< MFString > _transformFeedbackVaryings=0, Inst< SFBool > _printShaderWarnings=0, Inst< SFShaderConstants > _shaderConstants=0)
 Constructor.
 
virtual ~ComposedShader ()
 Destructor.
 
virtual bool addField (const string &_name, const Field::AccessType &access, Field *field)
 The addField method is specialized to add a route from the field added to the displayList field.
 
virtual bool removeField (const string &_name)
 The removeField method is specialized to remove the route from the field to the displayList field.
 
virtual void render ()
 Sets up the shader program and sets uniform variable values.
 
virtual void postRender ()
 Disables the shader program.
 
virtual GLbitfield getAffectedGLAttribs ()
 Returns a bitmask of the OpenGL attrib bits that will be affected by this node. More...
 
virtual bool isTransparent (X3DMaterialNode *material)
 Returns a hint if the X3DShaderNode produces an alpha channel that is < 1, i.e. More...
 
GLhandleARB getProgramHandle ()
 Returns the OpenGL shader program handle used by the ComposedShader.
 
- Public Member Functions inherited from H3D::X3DShaderNode
 X3DShaderNode (Inst< DisplayList > _displayList=0, Inst< SFNode > _metadata=0, Inst< SFBool > _isSelected=0, Inst< SFBool > _isValid=0, Inst< SFBool > _activate=0, Inst< SFString > _language=0)
 Constructor.
 
virtual bool isSupported ()
 Returns true if the shader node type is supported by the browser. More...
 
void setSelected (bool selected)
 Set the isSelected field.
 
virtual string defaultXMLContainerField ()
 Returns the default xml containerField attribute value. More...
 
- Public Member Functions inherited from H3D::X3DAppearanceChildNode
 X3DAppearanceChildNode (Inst< DisplayList > _displayList=0, Inst< SFNode > _metadata=0)
 Constructor.
 
- Public Member Functions inherited from H3D::X3DNode
 X3DNode (Inst< SFNode > _metadata=0)
 Constructor.
 
X3DMetadataObjectgetMetadataByName (const string &_name)
 Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More...
 
- Public Member Functions inherited from H3D::Node
 Node ()
 Constructor.
 
virtual Nodeclone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL)
 Returns a new instance of this node type with the same state as this one. More...
 
virtual ~Node ()
 Destructor.
 
X3DPrototypeInstancegetProtoInstanceParent ()
 If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More...
 
void setProtoInstanceParent (X3DPrototypeInstance *p)
 Set the X3DPrototypeInstance this node is the the root node if applicaple.
 
virtual bool lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result)
 Detect intersection between a line segment and the Node. More...
 
virtual void closestPoint (const Vec3f &p, NodeIntersectResult &result)
 Find closest point on Node to p. More...
 
virtual bool movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result)
 Detect collision between a moving sphere and the Node. More...
 
virtual FieldgetField (const string &_name) const
 return a pointer to the field specified by name within this instance
 
int addDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
int removeDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
- Public Member Functions inherited from H3D::H3DDisplayListObject
 H3DDisplayListObject (Inst< DisplayList > _displayList=0)
 Constructor.
 
- Public Member Functions inherited from H3D::X3DProgrammableShaderObject
 X3DProgrammableShaderObject (H3DNodeDatabase *_database)
 Constructor.
 
virtual void clearFields ()
 Remove all dynamic fields that have been previously added.
 
virtual ~X3DProgrammableShaderObject ()
 Destructor.
 
- Public Member Functions inherited from H3D::H3DDynamicFieldsObject
field_iterator firstField ()
 Get an iterator to the first of the dynamic fields.
 
field_iterator endField ()
 Get an iterator pointing to the end of the dynamic fields.
 
 H3DDynamicFieldsObject ()
 Constructor.
 

Public Attributes

H3DUniquePtr< MFGeneratedFragmentShaderNodeshaders
 The shaders field specifies a number of H3DGeneratedFragmentShaderNode instances that are to be combined. More...
 
H3DUniquePtr< SFStringfunction
 The function field specifies the combine function to use for RGB values. More...
 
H3DUniquePtr< SFStringarg0Modifier
 arg0Modifyier field specifies a modifier function that can be applied to the RGB output of the shader before being combined. More...
 
H3DUniquePtr< SFStringarg1Modifier
 arg1Modifyier field specifies a modifier function that can be applied to the RGB output of the shader before being combined. More...
 
H3DUniquePtr< SFFloatvalue
 The value field specifies a value that is used together with some of the combiner functions, e.g. More...
 
H3DUniquePtr< SFFloatarg0Value
 The arg0Value field specifies a value that is used together with some of the arg0Modifier functions. More...
 
H3DUniquePtr< SFFloatarg1Value
 The arg0Value field specifies a value that is used together with some of the arg0Modifier functions. More...
 
H3DUniquePtr< SFStringalphaFunction
 The function field specifies the combine function to use for alpha values. More...
 
H3DUniquePtr< SFStringalphaArg0Modifier
 alphaArg0Modifyier field specifies a modifier function that can be applied to the alpha output of the shader before being combined. More...
 
H3DUniquePtr< SFStringalphaArg1Modifier
 alphaArg1Modifyier field specifies a modifier function that can be applied to the alpha output of the shader before being combined. More...
 
H3DUniquePtr< SFFloatalphaValue
 The alphavalue field specifies a value that is used together with some of the alpha combiner functions, e.g. More...
 
H3DUniquePtr< SFFloatalphaArg0Value
 The alphaArg0Value field specifies a value that is used together with some of the alphaArg0Modifier functions. More...
 
H3DUniquePtr< SFFloatalphaArg1Value
 The alphaArg1Value field specifies a value that is used together with some of the alphaArg1Modifier functions. More...
 
- Public Attributes inherited from H3D::H3DGeneratedShaderNode
H3DUniquePtr< MFStringfragmentShaderString
 Contains the generated fragment shader code. More...
 
H3DUniquePtr< MFStringvertexShaderString
 Contains the generated vertex shader code. More...
 
H3DUniquePtr< RebuildShaderrebuildShader
 Field used to update the shader code when an event is received. More...
 
- Public Attributes inherited from H3D::ComposedShader
H3DUniquePtr< SFShaderConstants > shaderConstants
 The shaderConstants field can contain a ShaderConstants node defining constants that can be used by all ShaderPart instances in the ComposedShader node. More...
 
H3DUniquePtr< MFShaderPartparts
 The shader parts to use in the ComposedShader. More...
 
H3DUniquePtr< SFBoolsuppressUniformWarnings
 Suppress the warnings printed to the console about setting uniform fields that do not exist in the shader. More...
 
H3DUniquePtr< SFStringgeometryInputType
 The input geometry type of the geometry being rendered with a geometry shader. More...
 
H3DUniquePtr< SFStringgeometryOutputType
 The output geometry type of the geometry being rendered with a geometry shader. More...
 
H3DUniquePtr< SFInt32geometryVerticesOut
 The number of vertices the geometry shader generates. More...
 
H3DUniquePtr< SFStringtransparencyDetectMode
 Determines how the render system will determine if the shader used generates any fragment that has an alpha channel that is < 1, i.e. More...
 
H3DUniquePtr< MFStringtransformFeedbackVaryings
 List of varying names to capture during transform feedback. More...
 
H3DUniquePtr< SFBoolprintShaderWarnings
 Always print shader warnings to console. More...
 
- Public Attributes inherited from H3D::X3DShaderNode
H3DUniquePtr< SFBoolisSelected
 The isSelected output field is used to indicate that this shader instance is the one selected for use by the browser. More...
 
H3DUniquePtr< SFBoolisValid
 The isValid field is used to indicate whether the current shader objects can be run as a shader program. More...
 
H3DUniquePtr< SFBoolactivate
 The activate field forces the shader to activate the contained objects. More...
 
H3DUniquePtr< EventCollectingField< Field > > activateMonitor
 field used to monitor if activate field is modified
 
H3DUniquePtr< SFStringlanguage
 The language field is used to indicate to the browser which shading language is used for the source file(s). More...
 
- Public Attributes inherited from H3D::X3DNode
H3DUniquePtr< SFNodemetadata
 Meta data about the node. More...
 
- Public Attributes inherited from H3D::H3DDisplayListObject
H3DUniquePtr< DisplayListdisplayList
 The DisplayList instance handling the OpenGL caching of this object.
 

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::H3DGeneratedFragmentShaderNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::H3DGeneratedShaderNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::ComposedShader
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DShaderNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DProgrammableShaderObject
static bool use_bindless_textures = false
 True if we should use bindless textures.
 

Protected Member Functions

virtual string addUniformFields (ComposedShader *)
 Adds uniform fields to the shader. More...
 
virtual string getFunctionShaderString ()
 Get a string with GLSL function definitions to be used by the generated shader.
 
virtual void getVaryingVariables (vector< VaryingVariable > &variables)
 Get the varying variables used by the shader generator.
 
virtual void getAttributes (vector< Attribute > &attributes)
 Get the attribues used by the shader generator.
 
virtual string getVertexShaderString ()
 Returns the shader code for the fragment shader.
 
virtual string getFragmentShaderString ()
 Returns the shader code for the fragment shader.
 
string applyModifier (const string &variable_name, const string &modifier, const string &_value="0")
 Returns a glsl string to perform the specified modifier function. More...
 
string applyAlphaModifier (const string &variable_name, const string &modifier, const string &_value="0")
 Returns a glsl string to perform the specified modifier function. More...
 
string combineFunction (const string &v0, const string &v1, const string &_function, const string &_value="0")
 Returns a glsl string that evaluates to the variable v0 and v1 combined with the specified funtion. More...
 
- Protected Member Functions inherited from H3D::ComposedShader
void setGeometryShaderParameters (GLenum _program_handle)
 Sets geometry shader paramters based on fields.
 
- Protected Member Functions inherited from H3D::Node
void cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for the clone() method. More...
 

Additional Inherited Members

- Public Types inherited from H3D::ComposedShader
typedef DependentSFNode< ShaderConstants, FieldRef< H3DDisplayListObject, H3DDisplayListObject::DisplayList, &H3DDisplayListObject::displayList >, true > SFShaderConstantsBase
 The SFShaderConstants field is dependent on the displayList field of the containing ShaderConstants node.
 
typedef DependentMFNode< ShaderPart, FieldRef< ShaderPart, ShaderPart::SFShaderString, &ShaderPart::shaderString >, true > MFShaderPartBase
 The MFShaderPartBase is dependent on the url field of the containing ShaderPart node.
 
- Public Types inherited from H3D::Node
typedef std::map< Node *, Node * > DeepCopyMap
 A map type used during a deep copy clone() to map from original nodes to cloned nodes.
 
- Static Public Member Functions inherited from H3D::H3DGeneratedShaderNode
static string addUniformToFragmentShader (ComposedShader *shader, const string &name, const string &glsl_type, const Field::AccessType &access, Field *field, int array_size=-1, bool delete_unadded_field=true)
 Convenience function to add field in addUniformFields function to add uniform to fragment shader. More...
 
- Static Public Member Functions inherited from H3D::X3DShaderNode
static X3DShaderNodegetActiveShader ()
 Gets the currently active shader, i.e. More...
 
- Static Public Member Functions inherited from H3D::Node
static unsigned int nrNodesAlive ()
 Returns the nr of nodes currently alive, i.e. nodes created but not destructed.
 
static int nrNodesCreated ()
 Returns the number of nodes created in total since the start of the program.
 
- Static Protected Member Functions inherited from H3D::Node
static NodegetClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for nodes that implement clone() More...
 
- Protected Attributes inherited from H3D::ComposedShader
GLhandleARB program_handle
 The handle to the program object used for the shader in OpenGL.
 
vector< GLhandleARB > current_shaders
 A vector of the handles to all shader objects that are currently linked into the program object.
 
H3DUniquePtr< SetupDynamicRoutessetupDynamicRoutes
 C++ fields only. Contains instance of SetupDynamicRoutes.
 
list< H3DSingleTextureNode * > shader_textures
 list of textures to be used by the composedshader
 
H3DUniquePtr< UpdateUniformsupdateUniforms
 A field used to update any uniforms from their corresponding fields.
 
- Static Protected Attributes inherited from H3D::ComposedShader
static bool tessellation_support_checked = false
 True if a warning has already been output about missing tessellation shader support.
 
- Static Protected Attributes inherited from H3D::X3DProgrammableShaderObject
static bool use_bindless_textures_set = false
 True if use_bindless_textures has already be set once.
 

Detailed Description

The ShaderCombiner node combines the output of several fragment shaders in different ways to produce a final value by a combination of the output values of the shaders.

Several functions are provided both to modify the shader output before combining and to combine the different shaders. Alpha channel and rgb values are treated separately with all fields affecting alpha starts with alpha..

There are two kinds of functions: combine functions and modifiers. Combine functions combine two values in some way and modifiers change a single value.

Let the input to the combine functions be called arg0 and arg1, the combine function f and the modifier function for arg0 and arg1 be mod0 and mod1 respectively.

The value from a combine function is then: value = f( mod0( arg0 ), mod1( arg1 ) )

The function and alphaFunction field specifies the combine function to use for RGB values and alpha values respectively. For RGB values all operations are component-wise and for arg0 and arg1 below have the modifier already applied:

"SELECT0"arg0
"SELECT1"arg1
"ADD"arg0 + arg1
"SUBTRACT"arg0 - arg1
"MULTIPLY"arg0 * arg1
"DIVIDE"arg0 / arg1
"BLEND_VALUE"value * arg0 + (1-value)*arg1 where value is the value field.

For the RGB modifier fields arg0Modifyier and arg1Modifier the following values are possible. The modifiers are applied before the combine function and is per component. value in the table below is arg0Value or arg1Value depending on which argument is modified.

"COMPLEMENT"1-v
"ADD"v + value
"SUBTRACT"v - value
"MULTIPLY"v * value
"DIVIDE"v / value
"NEGATE"-v
"MULTIPLY_ALPHA"v.rgb * v.a.
"MULTIPLY_ONE_MINUS_ALPHA" v.rgb * (1-v.a)

For the alpha modifier fields alphaArg0Modifyier and alphaArg1Modifier the following values are possible. The modifiers are applied before the combine function and is per component. value in the table below is alphaArg0Value or alphaArg1Value depending on which argument is modified.

"COMPLEMENT"1-v
"ADD"v + value
"SUBTRACT"v - value
"MULTIPLY"v * value
"DIVIDE"v / value
"NEGATE"-v

The shaders field contains the shaders to be combined. If only one shader is provided only the arg0Modifyier and alphaArg0Modifier is applied and the function is ignored.

If more than two shaders are provided the functions are applied in succession like e.g. for three shaders:

[s0, s1, s2]
t0 = func( mod0(s0), mod1(s1) )
final_color = func( mod0( t0 ), mod1( s2) )

Examples:

Internal routes:

Member Function Documentation

◆ addUniformFields()

string ShaderCombiner::addUniformFields ( ComposedShader shader)
protectedvirtual

◆ applyAlphaModifier()

string ShaderCombiner::applyAlphaModifier ( const string &  variable_name,
const string &  modifier,
const string &  _value = "0" 
)
protected

Returns a glsl string to perform the specified modifier function.

It returns a line variable_name.a = ...; that modifies the variable according to the modifier name. Possible values for modifier is the same as for the alphaArg0Modifier field.

Referenced by getFragmentShaderString().

◆ applyModifier()

string ShaderCombiner::applyModifier ( const string &  variable_name,
const string &  modifier,
const string &  _value = "0" 
)
protected

Returns a glsl string to perform the specified modifier function.

It returns a line variable_name.rgb = ...; that modifies the variable according to the modifier name. Possible values for modifier is the same as for the arg0Modifier field.

Referenced by getFragmentShaderString().

◆ combineFunction()

string ShaderCombiner::combineFunction ( const string &  v0,
const string &  v1,
const string &  _function,
const string &  _value = "0" 
)
protected

Returns a glsl string that evaluates to the variable v0 and v1 combined with the specified funtion.

Possible values for modifier is the same as for the function field.

Referenced by getFragmentShaderString().

Member Data Documentation

◆ alphaArg0Modifier

H3DUniquePtr< SFString > H3D::ShaderCombiner::alphaArg0Modifier

alphaArg0Modifyier field specifies a modifier function that can be applied to the alpha output of the shader before being combined.

Operations are component-wise. Possible values are:

"COMPLEMENT"1-v
"ADD"v + alphaArg0Value
"SUBTRACT"v - alphaArg0Value
"MULTIPLY"v * alphaArg0Value
"DIVIDE"v / alphaArg0Value
"NEGATE"-v

Access type: inputOutput
Default value:"NONE"

Referenced by addUniformFields(), getFragmentShaderString(), and ShaderCombiner().

◆ alphaArg0Value

H3DUniquePtr< SFFloat > H3D::ShaderCombiner::alphaArg0Value

The alphaArg0Value field specifies a value that is used together with some of the alphaArg0Modifier functions.

Access type: inputOutput
Default value:0

Referenced by addUniformFields(), and ShaderCombiner().

◆ alphaArg1Modifier

H3DUniquePtr< SFString > H3D::ShaderCombiner::alphaArg1Modifier

alphaArg1Modifyier field specifies a modifier function that can be applied to the alpha output of the shader before being combined.

Operations are component-wise. Possible values are:

"COMPLEMENT"1-v
"ADD"v + alphaArg1Value
"SUBTRACT"v - alphaArg1Value
"MULTIPLY"v * alphaArg1Value
"DIVIDE"v / alphaArg1Value
"NEGATE"-v

Access type: inputOutput
Default value:"NONE"

Referenced by addUniformFields(), getFragmentShaderString(), and ShaderCombiner().

◆ alphaArg1Value

H3DUniquePtr< SFFloat > H3D::ShaderCombiner::alphaArg1Value

The alphaArg1Value field specifies a value that is used together with some of the alphaArg1Modifier functions.

Access type: inputOutput
Default value:0

Referenced by addUniformFields(), and ShaderCombiner().

◆ alphaFunction

H3DUniquePtr< SFString > H3D::ShaderCombiner::alphaFunction

The function field specifies the combine function to use for alpha values.

arg0 and arg1 have already had its modifier applied to it.

"SELECT0"arg0
"SELECT1"arg1
"ADD"arg0 + arg1
"SUBTRACT"arg0 - arg1
"MULTIPLY"arg0 * arg1
"DIVIDE"arg0 / arg1
"BLEND_VALUE"alphaValue * arg0 + (1-value)*arg1 where value is the value field.

Access type: inputOutput
Default value:"SELECT1"

Referenced by addUniformFields(), getFragmentShaderString(), and ShaderCombiner().

◆ alphaValue

H3DUniquePtr< SFFloat > H3D::ShaderCombiner::alphaValue

The alphavalue field specifies a value that is used together with some of the alpha combiner functions, e.g.

the "BLEND_VALUE" function.

Access type: inputOutput
Default value:0

Referenced by addUniformFields(), and ShaderCombiner().

◆ arg0Modifier

H3DUniquePtr< SFString > H3D::ShaderCombiner::arg0Modifier

arg0Modifyier field specifies a modifier function that can be applied to the RGB output of the shader before being combined.

Operations are component-wise. Possible values are:

"COMPLEMENT"1-v
"ADD"v + arg0Value
"SUBTRACT"v - arg0Value
"MULTIPLY"v * arg0Value
"DIVIDE"v / arg0Value
"NEGATE"-v
"MULTIPLY_ALPHA" v.rgb * v.a.
"MULTIPLY_ONE_MINUS_ALPHA" v.rgb * (1-v.a)

Access type: inputOutput
Default value:"NONE"

Referenced by addUniformFields(), getFragmentShaderString(), and ShaderCombiner().

◆ arg0Value

H3DUniquePtr< SFFloat > H3D::ShaderCombiner::arg0Value

The arg0Value field specifies a value that is used together with some of the arg0Modifier functions.

Access type: inputOutput
Default value:0

Referenced by addUniformFields(), and ShaderCombiner().

◆ arg1Modifier

H3DUniquePtr< SFString > H3D::ShaderCombiner::arg1Modifier

arg1Modifyier field specifies a modifier function that can be applied to the RGB output of the shader before being combined.

Operations are component-wise. Possible values are:

"COMPLEMENT"1-v
"ADD"v + arg1Value
"SUBTRACT"v - arg1Value
"MULTIPLY"v * arg1Value
"DIVIDE"v / arg1Value
"NEGATE"-v
"MULTIPLY_ALPHA" v.rgb * v.a.
"MULTIPLY_ONE_MINUS_ALPHA" v.rgb * (1-v.a)

Access type: inputOutput
Default value:"NONE"

Referenced by addUniformFields(), getFragmentShaderString(), and ShaderCombiner().

◆ arg1Value

H3DUniquePtr< SFFloat > H3D::ShaderCombiner::arg1Value

The arg0Value field specifies a value that is used together with some of the arg0Modifier functions.

Access type: inputOutput
Default value:0

Referenced by addUniformFields(), and ShaderCombiner().

◆ function

H3DUniquePtr< SFString > H3D::ShaderCombiner::function

The function field specifies the combine function to use for RGB values.

For RGB values all operations are component-wise and for arg0 and arg1 below have the modifier already applied:

"SELECT0"arg0
"SELECT1"arg1
"ADD"arg0 + arg1
"SUBTRACT"arg0 - arg1
"MULTIPLY"arg0 * arg1
"DIVIDE"arg0 / arg1
"BLEND_VALUE"value * arg0 + (1-value)*arg1 where value is the value field.

Access type: inputOutput
Default value:"SELECT1"

◆ shaders

H3DUniquePtr< MFGeneratedFragmentShaderNode > H3D::ShaderCombiner::shaders

The shaders field specifies a number of H3DGeneratedFragmentShaderNode instances that are to be combined.

Access type: inputOutput

Referenced by addUniformFields(), getAttributes(), getFragmentShaderString(), getFunctionShaderString(), getVaryingVariables(), getVertexShaderString(), ShaderCombiner(), and traverseSG().

◆ value

H3DUniquePtr< SFFloat > H3D::ShaderCombiner::value

The value field specifies a value that is used together with some of the combiner functions, e.g.

the "BLEND_VALUE" function.

Access type: inputOutput
Default value:0

Referenced by addUniformFields(), and ShaderCombiner().


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