H3D API  2.4.1
RenderProperties.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 __RENDERPROPERTIES_H__
30 #define __RENDERPROPERTIES_H__
31 
33 #include <H3D/SFColor.h>
34 #include <H3D/SFInt32.h>
35 #include <H3D/SFColorRGBA.h>
36 #include <H3D/SFString.h>
37 #include <H3D/SFFloat.h>
38 
39 namespace H3D {
40 
79  class H3DAPI_API RenderProperties : public X3DAppearanceChildNode {
80  public:
81 
83  RenderProperties( Inst< SFNode > _metadata = 0 ,
84  Inst< DisplayList > _displayList = 0,
85  Inst< SFBool > _depthTestEnabled = 0,
86  Inst< SFString > _depthFunc = 0,
87  Inst< SFBool > _smoothShading = 0,
88  Inst< SFBool > _multiPassTransparency = 0,
89  Inst< SFBool > _depthBufferWriteEnabled = 0,
90  Inst< SFBool > _colorBufferRedWriteEnabled = 0,
91  Inst< SFBool > _colorBufferGreenWriteEnabled = 0,
92  Inst< SFBool > _colorBufferBlueWriteEnabled = 0,
93  Inst< SFBool > _colorBufferAlphaWriteEnabled = 0,
94  Inst< SFString > _alphaFunc = 0,
95  Inst< SFFloat > _alphaFuncValue = 0,
96  Inst< SFString > _blendFuncSrcFactorRGB = 0,
97  Inst< SFString > _blendFuncSrcFactorAlpha = 0,
98  Inst< SFString > _blendFuncDstFactorRGB = 0,
99  Inst< SFString > _blendFuncDstFactorAlpha = 0,
100  Inst< SFString > _blendEquationRGB = 0,
101  Inst< SFString > _blendEquationAlpha = 0,
102  Inst< SFColorRGBA > _blendColor = 0,
103  Inst< SFBool > _blendEnabled = 0
104  );
105 
106 
110  virtual GLbitfield getAffectedGLAttribs() {
111  return( GL_LIGHTING_BIT | GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
112  }
113 
115  virtual void render();
116 
120  virtual string defaultXMLContainerField() {
121  return "renderProperties";
122  }
123 
133  H3DUniquePtr< SFBool > depthTestEnabled;
134 
146  H3DUniquePtr< SFString > depthFunc;
147 
159  H3DUniquePtr< SFBool > smoothShading;
160 
174  H3DUniquePtr< SFBool > multiPassTransparency;
175 
183  H3DUniquePtr< SFBool > depthBufferWriteEnabled;
184 
192  H3DUniquePtr< SFBool > colorBufferRedWriteEnabled;
193 
201  H3DUniquePtr< SFBool > colorBufferGreenWriteEnabled;
202 
210  H3DUniquePtr< SFBool > colorBufferBlueWriteEnabled;
211 
219  H3DUniquePtr< SFBool > colorBufferAlphaWriteEnabled;
220 
232  H3DUniquePtr< SFString > alphaFunc;
233 
242  H3DUniquePtr< SFFloat > alphaFuncValue;
243 
258  H3DUniquePtr< SFString > blendFuncSrcFactorRGB;
259 
273  H3DUniquePtr< SFString > blendFuncDstFactorRGB;
274 
289  H3DUniquePtr< SFString > blendFuncSrcFactorAlpha;
290 
304  H3DUniquePtr< SFString > blendFuncDstFactorAlpha;
305 
316  H3DUniquePtr< SFString > blendEquationRGB;
317 
328  H3DUniquePtr< SFString > blendEquationAlpha;
329 
338  H3DUniquePtr< SFColorRGBA > blendColor;
339 
346  H3DUniquePtr< SFBool > blendEnabled;
347 
350  protected:
351  int getSFactor( const string &sfactor_string, GLenum &sfactor );
352  int getDFactor( const string &dfactor_string, GLenum &dfactor );
353  int getBlendEquation( const string &equation_string, GLenum &equation );
354  int getAlphaFunc( const string &alpha_func_string, GLenum &alpha_func );
355  int getDepthFunc( const string &depth_func_string, GLenum &depth_func );
356  };
357 }
358 
359 #endif
Contains the SFColorRGBA field class.
Contains the SFColor field class.
Contains the SFFloat field class.
Contains the SFInt32 field class.
Contains the SFString field class.
Header file for X3DAppearanceChildNode, X3D scene-graph node.
The RenderProperties node specifies additional rendering options that cannot be specified with the X3...
Definition: RenderProperties.h:79
H3DUniquePtr< SFBool > depthBufferWriteEnabled
The depthBufferWriteEnabled field specifies if depth values should be written to the depth buffer of ...
Definition: RenderProperties.h:183
H3DUniquePtr< SFBool > depthTestEnabled
The depthTestEnabled field specifies if depth test should be enabled or not.
Definition: RenderProperties.h:133
H3DUniquePtr< SFBool > colorBufferBlueWriteEnabled
The colorBufferBlueWriteEnabled field specifies if blue color values should be written to the color b...
Definition: RenderProperties.h:210
H3DUniquePtr< SFString > blendFuncSrcFactorRGB
The blendFuncSrcFactorRGB field specifies how the red, blue and green channels are computed for sourc...
Definition: RenderProperties.h:258
H3DUniquePtr< SFString > blendFuncSrcFactorAlpha
The blendFuncSrcFactorAlpha field specifies how the alpha channel is computed for source when using a...
Definition: RenderProperties.h:289
virtual string defaultXMLContainerField()
Returns the default xml containerField attribute value.
Definition: RenderProperties.h:120
H3DUniquePtr< SFBool > colorBufferGreenWriteEnabled
The colorBufferGreenWriteEnabled field specifies if green color values should be written to the color...
Definition: RenderProperties.h:201
H3DUniquePtr< SFFloat > alphaFuncValue
The alphaFuncValue field specifies the reference value when alpha testing is enabled.
Definition: RenderProperties.h:242
H3DUniquePtr< SFColorRGBA > blendColor
The blendColor field specifies the blend color.
Definition: RenderProperties.h:338
H3DUniquePtr< SFBool > smoothShading
The smoothShading field specifies if smooth shading of colors should be used.
Definition: RenderProperties.h:159
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: RenderProperties.h:349
H3DUniquePtr< SFString > alphaFunc
The alphaFunc field specifies if a alpha testing should be used and in that case how the function sho...
Definition: RenderProperties.h:232
H3DUniquePtr< SFString > blendFuncDstFactorRGB
The blendFuncDstFactorRGB field specifies how the red, blue and green channels are computed for desti...
Definition: RenderProperties.h:273
H3DUniquePtr< SFBool > colorBufferAlphaWriteEnabled
The colorBufferAlphaWriteEnabled field specifies if alpha values should be written to the color buffe...
Definition: RenderProperties.h:219
H3DUniquePtr< SFString > blendEquationRGB
The blendEquationRGB field specifies the blend equation used to combine the red, green and blue chann...
Definition: RenderProperties.h:316
H3DUniquePtr< SFString > depthFunc
The depthFunc field specifies if a alpha testing should be used and in that case how the function sho...
Definition: RenderProperties.h:146
H3DUniquePtr< SFString > blendEquationAlpha
The blendEquationAlpha field specifies the blend equation used to combine the alpha channel.
Definition: RenderProperties.h:328
H3DUniquePtr< SFBool > colorBufferRedWriteEnabled
The colorBufferRedWriteEnabled field specifies if red color values should be written to the color buf...
Definition: RenderProperties.h:192
H3DUniquePtr< SFString > blendFuncDstFactorAlpha
The blendFuncDstFactorAlpha field specifies how the alpha channel is computed for destination when us...
Definition: RenderProperties.h:304
H3DUniquePtr< SFBool > blendEnabled
The blendEnabled field specifies if blending should be enabled or not.
Definition: RenderProperties.h:346
virtual GLbitfield getAffectedGLAttribs()
Returns a bitmask of the OpenGL attrib bits that will be affected by this node.
Definition: RenderProperties.h:110
H3DUniquePtr< SFBool > multiPassTransparency
If the multiPassTransparency field is true, and we have a transparent shape, the entire scene will be...
Definition: RenderProperties.h:174
This is the base node type for the child nodes of the X3DAppearanceNode type.
Definition: X3DAppearanceChildNode.h:44
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