H3D API  2.4.1
Appearance.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 __APPEARANCE_H__
30 #define __APPEARANCE_H__
31 
32 #include <H3D/X3DAppearanceNode.h>
33 #include <H3D/FillProperties.h>
34 #include <H3D/LineProperties.h>
35 #include <H3D/RenderProperties.h>
36 #include <H3D/X3DMaterialNode.h>
37 #include <H3D/X3DTextureNode.h>
39 #include <H3D/X3DShaderNode.h>
41 
42 namespace H3D {
43 
99  class H3DAPI_API Appearance : public X3DAppearanceNode {
100  public:
107  true >
109 
116  true >
118 
125  true >
127 
134  true >
136 
143  true >
145 
148  typedef DependentMFNode< X3DShaderNode,
152  true >
154 
161  true >
163 
165  Appearance( Inst< DisplayList > _displayList = 0,
166  Inst< SFFillProperties > _fillProperties = 0,
167  Inst< SFLineProperties > _lineProperties = 0,
168  Inst< SFMaterialNode > _material = 0,
169  Inst< SFNode > _metadata = 0,
170  Inst< SFTextureNode > _texture = 0,
171  Inst< SFTextureTransformNode > _textureTransform = 0,
172  Inst< SFSurface > _surface = 0,
173  Inst< MFShaderNode > _shaders = 0,
174  Inst< SFRenderProperties > _renderProperties = 0,
175  Inst< SFBool > _shadow = 0);
176 
178  virtual void render();
179 
182  virtual void preRender();
183 
187  virtual void postRender();
188 
192  virtual GLbitfield getAffectedGLAttribs();
193 
194  virtual void traverseSG( TraverseInfo &ti );
195 
198  virtual bool isTransparent();
199 
202  virtual bool hasGeometryShadow() {
203  return shadow->getValue();
204  }
205 
208  virtual bool usingMultiPassTransparency() {
209  RenderProperties *rp = renderProperties->getValue();
210  if ( rp )
211  return rp->multiPassTransparency->getValue();
212  return default_using_multi_pass_transparency;
213  }
214 
221  H3DUniquePtr< SFFillProperties > fillProperties;
222 
229  H3DUniquePtr< SFLineProperties > lineProperties;
230 
239  H3DUniquePtr< SFMaterialNode > material;
240 
246  H3DUniquePtr< SFTextureNode > texture;
247 
254  H3DUniquePtr< SFTextureTransformNode > textureTransform;
255 
265  H3DUniquePtr< MFShaderNode > shaders;
266 
275  H3DUniquePtr< SFRenderProperties > renderProperties;
276 
284  H3DUniquePtr< SFBool > shadow;
285 
288  };
289 }
290 
291 #endif
Contains the DependentSFNode and DependentMFNode template classes.
Header file for FillProperties, X3D scene-graph node.
Header file for LineProperties, X3D scene-graph node.
Header file for RenderProperties, X3D scene-graph node.
Header file for X3DAppearanceNode, X3D scene-graph node.
Header file for X3DMaterialNode, X3D scene-graph node.
Header file for X3DShaderNode, X3D scene-graph node.
Header file for X3DTextureNode, X3D abstract texture scene-graph node.
Header file for X3DTextureTransformNode, X3D scene-graph node.
The Appearance node specifies the visual properties of geometry.
Definition: Appearance.h:99
H3DUniquePtr< SFFillProperties > fillProperties
If specified it contains a FillProperties node that specifies additional properties to be applied to ...
Definition: Appearance.h:221
DependentSFNode< X3DMaterialNode, FieldRef< H3DDisplayListObject, H3DDisplayListObject::DisplayList, &H3DDisplayListObject::displayList >, true > SFMaterialNode
The SFMaterialNode field is dependent on the displayList field of the containing X3DMaterialNode.
Definition: Appearance.h:126
DependentSFNode< LineProperties, FieldRef< H3DDisplayListObject, H3DDisplayListObject::DisplayList, &H3DDisplayListObject::displayList >, true > SFLineProperties
The SFLineProperties field is dependent on the displayList field of the containing LineProperties nod...
Definition: Appearance.h:117
H3DUniquePtr< SFTextureTransformNode > textureTransform
Contains a X3DTextureTransformNode that specifies a transformation of texture coordinates.
Definition: Appearance.h:254
DependentSFNode< RenderProperties, FieldRef< H3DDisplayListObject, H3DDisplayListObject::DisplayList, &H3DDisplayListObject::displayList >, true > SFRenderProperties
The SFRenderProperties field is dependent on the displayList field of the containing X3DShaderNode no...
Definition: Appearance.h:162
DependentSFNode< FillProperties, FieldRef< H3DDisplayListObject, H3DDisplayListObject::DisplayList, &H3DDisplayListObject::displayList >, true > SFFillProperties
The SFFillProperties field is dependent on the displayList field of the containing FillProperties nod...
Definition: Appearance.h:108
H3DUniquePtr< MFShaderNode > shaders
The shaders field defines the collection of shaders of various languages in the order of preference.
Definition: Appearance.h:265
H3DUniquePtr< SFMaterialNode > material
The material field, if specified, shall contain a Material node.
Definition: Appearance.h:239
virtual bool hasGeometryShadow()
This function return true if the appearance has decided that shadow should be cast.
Definition: Appearance.h:202
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: Appearance.h:287
virtual bool usingMultiPassTransparency()
This function checks if multi-pass transparency should be used or not (see RenderProperties_multiPass...
Definition: Appearance.h:208
H3DUniquePtr< SFTextureNode > texture
Contains a X3DTextureNode to be used in the texturing.
Definition: Appearance.h:246
H3DUniquePtr< SFBool > shadow
The shadow field specifies if the geometry this Appearance is used on should cast a shadow or not.
Definition: Appearance.h:284
DependentSFNode< X3DTextureTransformNode, FieldRef< H3DDisplayListObject, H3DDisplayListObject::DisplayList, &H3DDisplayListObject::displayList >, true > SFTextureTransformNode
The SFTextureTransformNode field is dependent on the displayList field of the containing X3DTextureTr...
Definition: Appearance.h:135
H3DUniquePtr< SFLineProperties > lineProperties
If specified it contains a LineProperties node that specifies additional properties to be applied to ...
Definition: Appearance.h:229
DependentSFNode< X3DTextureNode, FieldRef< H3DDisplayListObject, H3DDisplayListObject::DisplayList, &H3DDisplayListObject::displayList >, true > SFTextureNode
The SFTextureNode field is dependent on the displayList field of the containing X3DTextureNode node.
Definition: Appearance.h:144
H3DUniquePtr< SFRenderProperties > renderProperties
The renderProperties field, if specified, shall contain a RenderProperties node.
Definition: Appearance.h:275
DependentMFNode< X3DShaderNode, FieldRef< H3DDisplayListObject, H3DDisplayListObject::DisplayList, &H3DDisplayListObject::displayList >, true > MFShaderNode
The MFShaderNode field is dependent on the displayList field of the containing X3DShaderNode node.
Definition: Appearance.h:153
DependentMFNode are modified TypedMFNode fields where the field dirty status is dependent on fields i...
Definition: DependentNodeFields.h:336
DependentSFNode are modified TypedSFNode fields where the field dirty status is dependent on fields i...
Definition: DependentNodeFields.h:294
Class used for specifying a field member of a node in a DependentSFNode or DependentMFNode specificat...
Definition: DependentNodeFields.h:48
The FillProperties node specifies additional properties to be applied to all polygonal areas on top o...
Definition: FillProperties.h:78
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 LineProperties node specifies additional properties to be applied to all line geometry.
Definition: LineProperties.h:76
The RenderProperties node specifies additional rendering options that cannot be specified with the X3...
Definition: RenderProperties.h:79
H3DUniquePtr< SFBool > multiPassTransparency
If the multiPassTransparency field is true, and we have a transparent shape, the entire scene will be...
Definition: RenderProperties.h:174
TraverseInfo is a structure that is passed along when traversing the scene graph.
Definition: TraverseInfo.h:57
This is the base node type for all Appearance nodes.
Definition: X3DAppearanceNode.h:44
This is the base node type for all Material nodes.
Definition: X3DMaterialNode.h:41
This abstract node type is the base type for all node types which specify a programmable shader.
Definition: X3DShaderNode.h:61
This abstract node type is the base type for all node types which specify sources for texture images.
Definition: X3DTextureNode.h:47
This abstract node type is the base type for all node types which specify a transformation of texture...
Definition: X3DTextureTransformNode.h:40
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