IndexedFaceSet.h

Go to the documentation of this file.
00001 
00003 //    Copyright 2004, SenseGraphics AB
00004 //
00005 //    This file is part of H3D API.
00006 //
00007 //    H3D API is free software; you can redistribute it and/or modify
00008 //    it under the terms of the GNU General Public License as published by
00009 //    the Free Software Foundation; either version 2 of the License, or
00010 //    (at your option) any later version.
00011 //
00012 //    H3D API is distributed in the hope that it will be useful,
00013 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //    GNU General Public License for more details.
00016 //
00017 //    You should have received a copy of the GNU General Public License
00018 //    along with H3D API; if not, write to the Free Software
00019 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 //
00021 //    A commercial license is also available. Please contact us at 
00022 //    www.sensegraphics.com for more information.
00023 //
00024 //
00028 //
00030 #ifndef __INDEXEDFACESET_H__
00031 #define __INDEXEDFACESET_H__
00032 
00033 #include "X3DComposedGeometryNode.h"
00034 #include "CoordBoundField.h"
00035 #include "MFInt32.h"
00036 #include "SFFloat.h"
00037 
00038 namespace H3D {
00039 
00157   class H3DAPI_API IndexedFaceSet : 
00158     public X3DComposedGeometryNode {
00159   public:
00160     H3D_VALUE_EXCEPTION( int, InvalidTexCoordIndex );
00161     H3D_VALUE_EXCEPTION( int, InvalidNormalIndex );
00162     H3D_VALUE_EXCEPTION( int, InvalidColorIndex );
00163 
00177     
00178     class H3DAPI_API AutoNormal: 
00179       public TypedField< SFNormalNode,
00180                          Types< SFBool, 
00181                                 SFCoordinateNode, 
00182                                 MFInt32, 
00183                                 SFBool, 
00184                                 SFFloat > > {
00185       virtual void update();
00186 
00210       virtual X3DNormalNode *generateNormalsPerVertex( 
00211                                     X3DCoordinateNode *coord,
00212                                     const vector< int > &coord_index,
00213                                     bool ccw,
00214                                     H3DFloat crease_angle );
00215     
00231        virtual X3DNormalNode *generateNormalsPerVertex( 
00232                                     X3DCoordinateNode *coord,
00233                                     const vector< int > &coord_index,
00234                                     bool ccw );
00235 
00252       virtual X3DNormalNode *generateNormalsPerFace( 
00253                                     X3DCoordinateNode *coord,
00254                                     const vector< int > &coord_index,
00255                                     bool ccw );
00256 
00257     };
00258 
00260     typedef CoordBoundField SFBound;
00261 
00263     IndexedFaceSet( Inst< SFNode           > _metadata        = 0,
00264                     Inst< SFBound          > _bound           = 0,
00265                     Inst< DisplayList      > _displayList     = 0,
00266                     Inst< SFColorNode      > _color           = 0,
00267                     Inst< SFCoordinateNode >  _coord          = 0,
00268                     Inst< SFNormalNode     > _normal          = 0,
00269                     Inst< SFTextureCoordinateNode >  _texCoord = 0,
00270                     Inst< SFBool       > _ccw                = 0,
00271                     Inst< SFBool       > _colorPerVertex     = 0,
00272                     Inst< SFBool       >  _normalPerVertex   = 0,
00273                     Inst< SFBool       > _solid              = 0,
00274                     Inst< MFVertexAttributeNode > _attrib     = 0,
00275                     Inst< AutoNormal   > _autoNormal         = 0,
00276                     Inst< SFBool       > _convex             = 0,
00277                     Inst< SFFloat      > _creaseAngle        = 0,
00278                     Inst< MFInt32      > _set_colorIndex     = 0,
00279                     Inst< MFInt32      > _set_coordIndex     = 0,
00280                     Inst< MFInt32      > _set_normalIndex    = 0,
00281                     Inst< MFInt32      > _set_texCoordIndex  = 0,
00282                     Inst< MFInt32      > _colorIndex         = 0,
00283                     Inst< MFInt32      > _coordIndex         = 0,
00284                     Inst< MFInt32      > _normalIndex        = 0,
00285                     Inst< MFInt32      > _texCoordIndex      = 0 );
00286 
00287     virtual X3DCoordinateNode *getCoord() {
00288       return static_cast< X3DCoordinateNode * >( coord->getValue() );
00289     }
00290 
00292     virtual void render();
00293 
00294 #ifdef USE_HAPTICS
00297     virtual void traverseSG( TraverseInfo &ti );  
00298 #endif
00299 
00304     auto_ptr< MFInt32 >  set_colorIndex;
00305 
00310     auto_ptr< MFInt32 >  set_coordIndex;
00311 
00316     auto_ptr< MFInt32 >  set_normalIndex;
00317 
00322     auto_ptr< MFInt32 >  set_texCoordIndex;
00323     
00332     auto_ptr< MFInt32 >  colorIndex;
00333 
00344     auto_ptr< SFBool  >  convex;
00345 
00354     auto_ptr< MFInt32 >  coordIndex;
00355 
00368     auto_ptr< SFFloat >  creaseAngle;
00369 
00378     auto_ptr< MFInt32 >  normalIndex;
00379 
00388     auto_ptr< MFInt32 >  texCoordIndex;
00389 
00394     auto_ptr< AutoNormal  >  autoNormal;
00395 
00397     static H3DNodeDatabase database;
00398   };
00399 }
00400 
00401 #endif

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