H3D API  2.4.1
TwoSidedMaterial.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 __TWOSIDEDMATERIAL_H__
30 #define __TWOSIDEDMATERIAL_H__
31 
32 #include <H3D/X3DMaterialNode.h>
33 #include <H3D/SFFloat.h>
34 #include <H3D/SFColor.h>
35 
36 namespace H3D {
37 
63  class H3DAPI_API TwoSidedMaterial : public X3DMaterialNode {
64  public:
65 
67  TwoSidedMaterial( Inst< DisplayList > _displayList = 0,
68  Inst< SFFloat > _ambientIntensity = 0,
69  Inst< SFColor > _diffuseColor = 0,
70  Inst< SFColor > _emissiveColor = 0,
71  Inst< SFNode > _metadata = 0,
72  Inst< SFFloat > _shininess = 0,
73  Inst< SFColor > _specularColor = 0,
74  Inst< SFFloat > _transparency = 0,
75  Inst< SFFloat > _backAmbientIntensity = 0,
76  Inst< SFColor > _backDiffuseColor = 0,
77  Inst< SFColor > _backEmissiveColor = 0,
78  Inst< SFFloat > _backShininess = 0,
79  Inst< SFColor > _backSpecularColor = 0,
80  Inst< SFFloat > _backTransparency = 0,
81  Inst< SFBool > _separateBackColor = 0);
82 
84  virtual void render();
85 
89  virtual GLbitfield getAffectedGLAttribs() {
90  return GL_COLOR_BUFFER_BIT | GL_LIGHTING_BIT;
91  }
92 
95  virtual bool isTransparent() {
96  return transparency->getValue() > 0 ||
97  (separateBackColor->getValue() && backTransparency->getValue() > 0);
98  }
99 
111  H3DUniquePtr< SFFloat > ambientIntensity;
112 
122  H3DUniquePtr< SFColor > diffuseColor;
123 
133  H3DUniquePtr< SFColor > emissiveColor;
134 
144  H3DUniquePtr< SFFloat > shininess;
145 
153  H3DUniquePtr< SFColor > specularColor;
154 
163  H3DUniquePtr< SFFloat > transparency;
164 
174  H3DUniquePtr< SFFloat > backAmbientIntensity;
175 
185  H3DUniquePtr< SFColor > backDiffuseColor;
186 
187 
197  H3DUniquePtr< SFColor > backEmissiveColor;
198 
208  H3DUniquePtr< SFFloat > backShininess;
209 
210 
220  H3DUniquePtr< SFColor > backSpecularColor;
221 
231  H3DUniquePtr< SFFloat > backTransparency;
232 
242  H3DUniquePtr< SFBool > separateBackColor;
243 
246  };
247 }
248 
249 #endif
Contains the SFColor field class.
Contains the SFFloat field class.
Header file for X3DMaterialNode, X3D scene-graph node.
This node defines material properties that can effect both the front and back side of a polygon indiv...
Definition: TwoSidedMaterial.h:63
H3DUniquePtr< SFFloat > ambientIntensity
The ambientIntensity field specifies how much ambient light from light sources this surface shall ref...
Definition: TwoSidedMaterial.h:111
H3DUniquePtr< SFFloat > backAmbientIntensity
The backAmbientIntensity is the same as the ambientIntensity field but will be used for the back side...
Definition: TwoSidedMaterial.h:174
H3DUniquePtr< SFFloat > backTransparency
The backTransparency is the same as the transparency field but will be used for the back side of the ...
Definition: TwoSidedMaterial.h:231
H3DUniquePtr< SFFloat > backShininess
The backShininess is the same as the shininess field but will be used for the back side of the geomet...
Definition: TwoSidedMaterial.h:208
H3DUniquePtr< SFColor > emissiveColor
The emissiveColor field models "glowing" objects.
Definition: TwoSidedMaterial.h:133
H3DUniquePtr< SFColor > backEmissiveColor
The backEmissiveColor is the same as the emissiveColor field but will be used for the back side of th...
Definition: TwoSidedMaterial.h:197
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: TwoSidedMaterial.h:245
H3DUniquePtr< SFFloat > shininess
Shininess effect the specular highlights.
Definition: TwoSidedMaterial.h:144
H3DUniquePtr< SFColor > diffuseColor
The diffuseColor field reflects all light sources depending on the angle of the surface with respect ...
Definition: TwoSidedMaterial.h:122
virtual bool isTransparent()
This function checks the transparency field to determine if the material requires that the geometry i...
Definition: TwoSidedMaterial.h:95
virtual GLbitfield getAffectedGLAttribs()
Returns a bitmask of the OpenGL attrib bits that will be affected by this node.
Definition: TwoSidedMaterial.h:89
H3DUniquePtr< SFColor > backDiffuseColor
The backDiffuseColor is the same as the diffuseColor field but will be used for the back side of the ...
Definition: TwoSidedMaterial.h:185
H3DUniquePtr< SFFloat > transparency
The transparency field specifies how "clear" an object is, with 1.0 being completely transparent,...
Definition: TwoSidedMaterial.h:163
H3DUniquePtr< SFColor > backSpecularColor
The backSpecularColor is the same as the specularColor field but will be used for the back side of th...
Definition: TwoSidedMaterial.h:220
H3DUniquePtr< SFBool > separateBackColor
If the separateBackColor field is set to TRUE, then the rendering shall render the front and back fac...
Definition: TwoSidedMaterial.h:242
H3DUniquePtr< SFColor > specularColor
The color of the specular highlights.
Definition: TwoSidedMaterial.h:153
This is the base node type for all Material nodes.
Definition: X3DMaterialNode.h:41
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