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.9  2008/09/16 14:49:46  martius
00025  *   use cmath instead of math.h
00026  *
00027  *   Revision 1.8  2006/07/14 12:23:33  martius
00028  *   selforg becomes HEAD
00029  *
00030  *   Revision 1.7.4.4  2006/06/16 22:27:26  martius
00031  *   getMainPrimtive
00032  *
00033  *   Revision 1.7.4.3  2006/05/29 18:55:46  martius
00034  *   moved from meshground to terrainground as it was in former times
00035  *
00036  *   Revision 1.1.2.1  2006/05/28 22:14:56  martius
00037  *   heightfield included
00038  *
00039  *
00040  *                                                                 *
00041  ***************************************************************************/
00042 #ifndef __TERRAINGROUND_H
00043 #define __TERRAINGROUND_H
00044 
00045 #include <stdio.h>
00046 #include <cmath>
00047 
00048 #include "heightfieldprimitive.h"
00049 #include "abstractobstacle.h"
00050  
00051 namespace lpzrobots {
00052 
00053   /** Class provides an terrain based on HeightFields. 
00054       Can be loaded from image or from HeightFieldFiles
00055   */
00056   class TerrainGround : public AbstractObstacle {
00057   public:
00058     
00059   
00060     /** Constructor
00061         @param odeHandle 
00062         @param osgHandle
00063         @param filename name of the file to load. 
00064         If ending is .ppm then it is considered as a bitmap height file.
00065         The coding mode is used to decode the heights. 
00066         Otherwise it is consider to be a OSG HeightFieldFile
00067         @param texture image filename for the texture
00068         @param x_size size in x direction in world coordinates
00069         @param y_size size in y direction in world coordinates
00070         @param height height in world coordinates
00071         @param coding Coding mode, see OSGHeightField (this an own class, not in OSG)
00072     */
00073     TerrainGround(const OdeHandle& odeHandle, const OsgHandle& osgHandle, 
00074                const std::string& filename, const std::string& texture, 
00075                double x_size, double y_size, double height,
00076                OSGHeightField::CodingMode coding = OSGHeightField::Red);
00077 
00078     virtual ~TerrainGround(){}
00079 
00080     /**
00081      * updates the position of the geoms  ( not nessary for static objects)
00082      */
00083     virtual void update(){ };
00084 
00085     virtual void setPose(const osg::Matrix& pose);
00086 
00087 
00088     virtual Primitive* getMainPrimitive() const { return 0; }
00089 
00090   protected:
00091     virtual void create();
00092     virtual void destroy();    
00093 
00094   protected:
00095     std::string filename;
00096     std::string texture;
00097     HeightField* heightfield;
00098     double x_size;
00099     double y_size;
00100     double height;
00101     OSGHeightField::CodingMode coding;
00102   };
00103 }
00104 
00105 #endif

Generated on Fri Oct 30 16:29:01 2009 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.4.7