ElevationGrid.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 __ELEVATIONGRID_H__
00030 #define __ELEVATIONGRID_H__
00031 
00032 #include "X3DGeometryNode.h"
00033 #include "X3DCoordinateNode.h"
00034 #include "TextureCoordinateGenerator.h"
00035 #include "X3DColorNode.h"
00036 #include "X3DNormalNode.h"
00037 #include "X3DVertexAttributeNode.h"
00038 #include "DependentNodeFields.h"
00039 #include "SFInt32.h"
00040 #include "SFFloat.h"
00041 
00042 namespace H3D {
00043 
00112   class H3DAPI_API ElevationGrid : public X3DGeometryNode {
00113   public:
00116     typedef  DependentSFNode< X3DColorNode,
00117                               FieldRef< X3DGeometricPropertyNode,
00118                                         Field,
00119                                         &X3DColorNode::propertyChanged > >  
00120     SFColorNode;
00121     
00124     typedef DependentSFNode< X3DNormalNode,
00125                              FieldRef< X3DGeometricPropertyNode,
00126                                        Field,
00127                                        &X3DNormalNode::propertyChanged > > 
00128     SFNormalNode;
00129 
00132     typedef DependentSFNode< 
00133                 X3DTextureCoordinateNode,
00134                 FieldRef< X3DGeometricPropertyNode,
00135                           Field,
00136                           &X3DTextureCoordinateNode::propertyChanged > > 
00137     SFTextureCoordinateNode;   
00138 
00141     typedef DependentMFNode< 
00142                 X3DVertexAttributeNode,
00143                 FieldRef< X3DGeometricPropertyNode,
00144                           Field,
00145                           &X3DVertexAttributeNode::propertyChanged > > 
00146     MFVertexAttributeNode;    
00147 
00164     class H3DAPI_API AutoNormal: 
00165       public TypedField< SFNormalNode,
00166                          Types< SFBool, 
00167                                 SFInt32, 
00168                                 SFInt32, 
00169                                 SFFloat,
00170                                 SFFloat,
00171                                 MFFloat,
00172                                 SFBool,
00173                                 SFFloat > > {
00174       virtual void update();
00175 
00179       virtual X3DNormalNode *generateNormalsPerVertex( 
00180                                H3DInt32 x_dim,
00181                                H3DInt32 z_dim,
00182                                H3DFloat x_spacing,
00183                                H3DFloat z_spacing,
00184                                const vector< H3DFloat > &height,
00185                                bool ccw,
00186                                H3DFloat crease_angle );
00187     
00192        virtual X3DNormalNode *generateNormalsPerVertex( 
00193                                H3DInt32 x_dim,
00194                                H3DInt32 z_dim,
00195                                H3DFloat x_spacing,
00196                                H3DFloat z_spacing,
00197                                const vector< H3DFloat > &height,
00198                                bool ccw );
00199 
00202       virtual X3DNormalNode *generateNormalsPerFace(  
00203                                H3DInt32 x_dim,
00204                                H3DInt32 z_dim,
00205                                H3DFloat x_spacing,
00206                                H3DFloat z_spacing,
00207                                const vector< H3DFloat > &height,
00208                                bool ccw );
00209 
00210     };
00211 
00221     class H3DAPI_API SFBound: public TypedField< X3DGeometryNode::SFBound,
00222                                       Types< SFInt32, SFInt32, 
00223                                              SFFloat, SFFloat, MFFloat > >{
00224       virtual void update();
00225     };
00226 
00235     class H3DAPI_API DisplayList: public X3DGeometryNode::DisplayList {
00236     protected:
00238       virtual void callList( bool build_list );
00239     };
00240 
00247     virtual void startTexGen( TextureCoordinateGenerator *tex_coord_gen );
00248 
00250     virtual void stopTexGen( TextureCoordinateGenerator *tex_coord_gen );
00251 
00256     virtual void renderTexCoord( int index, X3DTextureCoordinateNode *tc );
00257 
00262     virtual void renderTexCoord( const Vec3f &tc );
00263 
00267     virtual void renderTexCoordArray( X3DTextureCoordinateNode *tc );
00268 
00270     virtual void disableTexCoordArray( X3DTextureCoordinateNode *tc );
00271 
00273     virtual void render();
00274 
00276     ElevationGrid( Inst< SFNode           > _metadata        = 0,
00277                    Inst< SFBound          > _bound           = 0,
00278                    Inst< DisplayList      > _displayList     = 0,
00279                    Inst< SFColorNode      > _color           = 0,
00280                    Inst< SFNormalNode     > _normal          = 0,
00281                    Inst< SFTextureCoordinateNode > _texCoord = 0,
00282                    Inst< SFBool           > _ccw             = 0,
00283                    Inst< SFBool           > _colorPerVertex  = 0,
00284                    Inst< SFBool           > _normalPerVertex = 0,
00285                    Inst< SFBool           > _solid           = 0,
00286                    Inst< MFVertexAttributeNode > _attrib     = 0,
00287                    Inst< AutoNormal       > _autoNormal      = 0,
00288                    Inst< SFFloat          > _creaseAngle     = 0,
00289                    Inst< SFInt32          > _xDimension      = 0,
00290                    Inst< SFInt32          > _zDimension      = 0,
00291                    Inst< SFFloat          > _xSpacing        = 0,
00292                    Inst< SFFloat          > _zSpacing        = 0,
00293                    Inst< MFFloat          > _height          = 0 );
00294 
00303     auto_ptr< SFColorNode >  color;
00304 
00315     auto_ptr< SFNormalNode >  normal;
00316     
00323     auto_ptr< SFTextureCoordinateNode >  texCoord;
00324     
00342     auto_ptr< SFBool >  ccw;
00343     
00351     auto_ptr< SFBool >  colorPerVertex;
00352 
00360     auto_ptr< SFBool >  normalPerVertex;
00361 
00373     auto_ptr< SFBool >  solid;
00374     
00382     auto_ptr< MFVertexAttributeNode > attrib;
00383 
00396     auto_ptr< SFFloat > creaseAngle;
00397 
00405     auto_ptr< SFInt32 > xDimension;
00406 
00414     auto_ptr< SFInt32 > zDimension;
00415   
00423     auto_ptr< SFFloat > xSpacing;
00424 
00432     auto_ptr< SFFloat > zSpacing;
00433 
00441     auto_ptr< MFFloat > height;
00442 
00447     auto_ptr< AutoNormal  >  autoNormal;
00448 
00450     static H3DNodeDatabase database;
00451   };
00452 }
00453 
00454 #endif

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