H3D API  2.4.1
ShaderCombiner.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __SHADERCOMBINER_H__
30 #define __SHADERCOMBINER_H__
31 
34 
35 namespace H3D {
36 
124  class H3DAPI_API ShaderCombiner :
126  public:
127 
132  true >
134 
135 
137  ShaderCombiner( Inst< DisplayList > _displayList = 0,
138  Inst< SFNode > _metadata = 0,
139  Inst< SFBool > _isSelected = 0,
140  Inst< SFBool > _isValid = 0,
141  Inst< SFBool > _activate = 0,
142  Inst< SFString > _language = 0,
143  Inst< MFShaderPart > _parts = 0,
144  Inst< SFBool > _suppressUniformWarnings = 0,
145  Inst< MFString > _fragmentShaderString = 0,
146  Inst< MFString > _vertexShaderString = 0,
147  Inst< MFGeneratedFragmentShaderNode > _shaders = 0,
148  Inst< SFString > _function = 0,
149  Inst< SFString > _arg0Modifier = 0,
150  Inst< SFString > _arg1Modifier = 0,
151  Inst< SFFloat > _value = 0,
152  Inst< SFFloat > _arg0Value = 0,
153  Inst< SFFloat > _arg1Value = 0,
154  Inst< SFString > _alphaFunction = 0,
155  Inst< SFString > _alphaArg0Modifier = 0,
156  Inst< SFString > _alphaArg1Modifier = 0,
157  Inst< SFFloat > _alphaValue = 0,
158  Inst< SFFloat > _alphaArg0Value = 0,
159  Inst< SFFloat > _alphaArg1Value = 0 );
160 
161 
163  virtual void traverseSG( TraverseInfo &ti );
164 
171  H3DUniquePtr< MFGeneratedFragmentShaderNode > shaders;
172 
191  H3DUniquePtr< SFString > function;
192 
212  H3DUniquePtr< SFString > arg0Modifier;
213 
233  H3DUniquePtr< SFString > arg1Modifier;
234 
242  H3DUniquePtr< SFFloat > value;
243 
251  H3DUniquePtr< SFFloat > arg0Value;
252 
260  H3DUniquePtr< SFFloat > arg1Value;
261 
280  H3DUniquePtr< SFString > alphaFunction;
281 
299  H3DUniquePtr< SFString > alphaArg0Modifier;
300 
318  H3DUniquePtr< SFString > alphaArg1Modifier;
319 
327  H3DUniquePtr< SFFloat > alphaValue;
328 
336  H3DUniquePtr< SFFloat > alphaArg0Value;
337 
345  H3DUniquePtr< SFFloat > alphaArg1Value;
346 
349  protected:
354  virtual string addUniformFields( ComposedShader * );
355 
358  virtual string getFunctionShaderString();
359 
361  virtual void getVaryingVariables( vector< VaryingVariable > &variables );
362 
364  virtual void getAttributes( vector< Attribute > &attributes );
365 
367  virtual string getVertexShaderString();
368 
370  virtual string getFragmentShaderString();
371 
378  string applyModifier( const string &variable_name,
379  const string &modifier,
380  const string &_value = "0" );
381 
388  string applyAlphaModifier( const string &variable_name,
389  const string &modifier,
390  const string &_value = "0" );
391 
396  string combineFunction( const string &v0,
397  const string &v1,
398  const string &_function,
399  const string &_value = "0" );
400  };
401 }
402 
403 #endif
Header file for H3DGeneratedFragmentShaderNode.
Header file for H3DGeneratedVertexShaderNode.
The ComposedShader node defines a shader where the individual source files are not individually progr...
Definition: ComposedShader.h:77
DependentMFNode are modified TypedMFNode fields where the field dirty status is dependent on fields i...
Definition: DependentNodeFields.h:336
Class used for specifying a field member of a node in a DependentSFNode or DependentMFNode specificat...
Definition: DependentNodeFields.h:48
We use the Field's lazy evaluation mechanisms to manage the GL display lists for rendering,...
Definition: H3DDisplayListObject.h:60
This abstract interface class is the base class for all node types that wants to create an OpenGL dis...
Definition: H3DDisplayListObject.h:54
H3DUniquePtr< DisplayList > displayList
The DisplayList instance handling the OpenGL caching of this object.
Definition: H3DDisplayListObject.h:256
The H3DGeneratedFragmentShaderNode node is the base class for shader generator nodes that specify a f...
Definition: H3DGeneratedFragmentShaderNode.h:44
The ShaderCombiner node combines the output of several fragment shaders in different ways to produce ...
Definition: ShaderCombiner.h:125
H3DUniquePtr< MFGeneratedFragmentShaderNode > shaders
The shaders field specifies a number of H3DGeneratedFragmentShaderNode instances that are to be combi...
Definition: ShaderCombiner.h:171
H3DUniquePtr< SFFloat > alphaValue
The alphavalue field specifies a value that is used together with some of the alpha combiner function...
Definition: ShaderCombiner.h:327
H3DUniquePtr< SFString > alphaArg1Modifier
alphaArg1Modifyier field specifies a modifier function that can be applied to the alpha output of the...
Definition: ShaderCombiner.h:318
H3DUniquePtr< SFString > arg1Modifier
arg1Modifyier field specifies a modifier function that can be applied to the RGB output of the shader...
Definition: ShaderCombiner.h:233
H3DUniquePtr< SFFloat > arg1Value
The arg0Value field specifies a value that is used together with some of the arg0Modifier functions.
Definition: ShaderCombiner.h:260
H3DUniquePtr< SFString > alphaFunction
The function field specifies the combine function to use for alpha values.
Definition: ShaderCombiner.h:280
H3DUniquePtr< SFFloat > value
The value field specifies a value that is used together with some of the combiner functions,...
Definition: ShaderCombiner.h:242
H3DUniquePtr< SFFloat > alphaArg0Value
The alphaArg0Value field specifies a value that is used together with some of the alphaArg0Modifier f...
Definition: ShaderCombiner.h:336
H3DUniquePtr< SFString > arg0Modifier
arg0Modifyier field specifies a modifier function that can be applied to the RGB output of the shader...
Definition: ShaderCombiner.h:212
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: ShaderCombiner.h:348
H3DUniquePtr< SFString > alphaArg0Modifier
alphaArg0Modifyier field specifies a modifier function that can be applied to the alpha output of the...
Definition: ShaderCombiner.h:299
H3DUniquePtr< SFFloat > arg0Value
The arg0Value field specifies a value that is used together with some of the arg0Modifier functions.
Definition: ShaderCombiner.h:251
H3DUniquePtr< SFFloat > alphaArg1Value
The alphaArg1Value field specifies a value that is used together with some of the alphaArg1Modifier f...
Definition: ShaderCombiner.h:345
TraverseInfo is a structure that is passed along when traversing the scene graph.
Definition: TraverseInfo.h:57
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194