terrainground.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Robot Group Leipzig                             *
00003  *    martius@informatik.uni-leipzig.de                                    *
00004  *    fhesse@informatik.uni-leipzig.de                                     *
00005  *    der@informatik.uni-leipzig.de                                        *
00006  *    frankguettler@gmx.de                                                 *
00007  *                                                                         *
00008  *   This program is free software; you can redistribute it and/or modify  *
00009  *   it under the terms of the GNU General Public License as published by  *
00010  *   the Free Software Foundation; either version 2 of the License, or     *
00011  *   (at your option) any later version.                                   *
00012  *                                                                         *
00013  *   This program is distributed in the hope that it will be useful,       *
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00016  *   GNU General Public License for more details.                          *
00017  *                                                                         *
00018  *   You should have received a copy of the GNU General Public License     *
00019  *   along with this program; if not, write to the                         *
00020  *   Free Software Foundation, Inc.,                                       *
00021  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00022  *                                                                         *
00023  *   $Log: terrainground.h,v $
00024  *   Revision 1.8  2006/07/14 12:23:33  martius
00025  *   selforg becomes HEAD
00026  *
00027  *   Revision 1.7.4.4  2006/06/16 22:27:26  martius
00028  *   getMainPrimtive
00029  *
00030  *   Revision 1.7.4.3  2006/05/29 18:55:46  martius
00031  *   moved from meshground to terrainground as it was in former times
00032  *
00033  *   Revision 1.1.2.1  2006/05/28 22:14:56  martius
00034  *   heightfield included
00035  *
00036  *
00037  *                                                                 *
00038  ***************************************************************************/
00039 #ifndef __TERRAINGROUND_H
00040 #define __TERRAINGROUND_H
00041 
00042 #include <stdio.h>
00043 #include <math.h>
00044 
00045 #include "heightfieldprimitive.h"
00046 #include "abstractobstacle.h"
00047  
00048 namespace lpzrobots {
00049 
00050   /** Class provides an terrain based on HeightFields. 
00051       Can be loaded from image or from HeightFieldFiles
00052   */
00053   class TerrainGround : public AbstractObstacle {
00054   public:
00055     
00056   
00057     /** Constructor
00058         @param odeHandle 
00059         @param osgHandle
00060         @param filename name of the file to load. 
00061         If ending is .ppm then it is considered as a bitmap height file.
00062         The coding mode is used to decode the heights. 
00063         Otherwise it is consider to be a OSG HeightFieldFile
00064         @param texture image filename for the texture
00065         @param x_size size in x direction in world coordinates
00066         @param y_size size in y direction in world coordinates
00067         @param height height in world coordinates
00068         @param coding Coding mode, see OSGHeightField (this an own class, not in OSG)
00069     */
00070     TerrainGround(const OdeHandle& odeHandle, const OsgHandle& osgHandle, 
00071                const std::string& filename, const std::string& texture, 
00072                double x_size, double y_size, double height,
00073                OSGHeightField::CodingMode coding = OSGHeightField::Red);
00074 
00075     virtual ~TerrainGround(){}
00076 
00077     /**
00078      * updates the position of the geoms  ( not nessary for static objects)
00079      */
00080     virtual void update(){ };
00081 
00082     virtual void setPose(const osg::Matrix& pose);
00083 
00084 
00085     virtual Primitive* getMainPrimitive() const { return 0; }
00086 
00087   protected:
00088     virtual void create();
00089     virtual void destroy();    
00090 
00091   protected:
00092     std::string filename;
00093     std::string texture;
00094     HeightField* heightfield;
00095     double x_size;
00096     double y_size;
00097     double height;
00098     OSGHeightField::CodingMode coding;
00099   };
00100 }
00101 
00102 #endif

Generated on Mon Aug 7 16:40:14 2006 for Robotsystem of the Robot Group Leipzig by  doxygen 1.4.7