Appearance.h

Go to the documentation of this file.
00001 
00002 //    Copyright 2004, SenseGraphics AB
00003 //
00004 //    This file is part of H3D API.
00005 //
00006 //    H3D API is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    H3D API is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with H3D API; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 //
00020 //    A commercial license is also available. Please contact us at 
00021 //    www.sensegraphics.com for more information.
00022 //
00023 //
00027 //
00029 #ifndef __APPEARANCE_H__
00030 #define __APPEARANCE_H__
00031 
00032 #include "X3DAppearanceNode.h"
00033 #include "FillProperties.h"
00034 #include "LineProperties.h"
00035 #include "RenderProperties.h"
00036 #include "X3DMaterialNode.h"
00037 #include "X3DTextureNode.h"
00038 #include "X3DTextureTransformNode.h"
00039 #include "X3DShaderNode.h"
00040 #include "DependentNodeFields.h"
00041 
00042 namespace H3D {
00043 
00087   class H3DAPI_API Appearance : public X3DAppearanceNode {
00088   public:
00091     typedef DependentSFNode< FillProperties, 
00092                              FieldRef< H3DDisplayListObject,
00093                                        H3DDisplayListObject::DisplayList,
00094                                        &H3DDisplayListObject::displayList >, 
00095                              true >
00096     SFFillProperties;
00097 
00100     typedef DependentSFNode< LineProperties, 
00101                              FieldRef< H3DDisplayListObject,
00102                                        H3DDisplayListObject::DisplayList,
00103                                        &H3DDisplayListObject::displayList >, 
00104                              true >
00105     SFLineProperties;
00106 
00109     typedef DependentSFNode< X3DMaterialNode, 
00110                              FieldRef< H3DDisplayListObject,
00111                                        H3DDisplayListObject::DisplayList,
00112                                        &H3DDisplayListObject::displayList >, 
00113                              true >
00114     SFMaterialNode;
00115     
00118     typedef DependentSFNode< X3DTextureTransformNode, 
00119                              FieldRef< H3DDisplayListObject,
00120                                        H3DDisplayListObject::DisplayList,
00121                                        &H3DDisplayListObject::displayList >, 
00122                              true >
00123     SFTextureTransformNode;
00124 
00127     typedef DependentSFNode< X3DTextureNode, 
00128                              FieldRef< H3DDisplayListObject,
00129                                        H3DDisplayListObject::DisplayList,
00130                                        &H3DDisplayListObject::displayList >, 
00131                              true >
00132     SFTextureNode;
00133 
00136     typedef DependentMFNode< X3DShaderNode, 
00137                              FieldRef< H3DDisplayListObject,
00138                                        H3DDisplayListObject::DisplayList,
00139                                        &H3DDisplayListObject::displayList >, 
00140                              true >
00141     MFShaderNode;
00142 
00145     typedef DependentSFNode< RenderProperties, 
00146                              FieldRef< H3DDisplayListObject,
00147                                        H3DDisplayListObject::DisplayList,
00148                                        &H3DDisplayListObject::displayList >, 
00149                              true >
00150     SFRenderProperties;
00151 
00153     Appearance( Inst< DisplayList            > _displayList = 0,
00154                 Inst< SFFillProperties       > _fillProperties   = 0,
00155                 Inst< SFLineProperties       > _lineProperties   = 0,
00156                 Inst< SFMaterialNode         > _material         = 0,
00157                 Inst< SFNode                 > _metadata         = 0,
00158                 Inst< SFTextureNode          > _texture          = 0,
00159                 Inst< SFTextureTransformNode > _textureTransform = 0
00160 #ifdef USE_HAPTICS
00161                                                                 ,
00162                 Inst< SFSurface              > _surface          = 0
00163 #endif
00164                                                                 ,
00165                 Inst< MFShaderNode           > _shaders           = 0,
00166                 Inst< SFRenderProperties     > _renderProperties  = 0 );
00167 
00169     virtual void render();
00170 
00175     virtual void preRender();
00176 
00180     virtual void postRender();
00181 
00182 #ifdef USE_HAPTICS
00183     virtual void traverseSG( TraverseInfo &ti ); 
00184 #endif
00185 
00186 
00189     virtual bool isTransparent() {
00190       X3DMaterialNode *m = material->getValue();
00191       if ( m )
00192         return m->isTransparent();
00193       else
00194         return false;
00195     }
00196     
00203     auto_ptr< SFFillProperties >  fillProperties;
00204 
00211     auto_ptr< SFLineProperties >  lineProperties;
00212 
00221     auto_ptr< SFMaterialNode >  material;
00222 
00228     auto_ptr< SFTextureNode >  texture;
00229 
00236     auto_ptr< SFTextureTransformNode >  textureTransform;
00237 
00247     auto_ptr< MFShaderNode >  shaders;
00248 
00257     auto_ptr< SFRenderProperties > renderProperties;
00258 
00260     static H3DNodeDatabase database;
00261   };
00262 }
00263 
00264 #endif

Generated on Thu Aug 24 12:38:32 2006 for H3D API by  doxygen 1.4.5