00001 /*************************************************************************** 00002 * Copyright (C) 2005-2011 LpzRobots development team * 00003 * Georg Martius <georg dot martius at web dot de> * 00004 * Frank Guettler <guettler at informatik dot uni-leipzig dot de * 00005 * Frank Hesse <frank at nld dot ds dot mpg dot de> * 00006 * Ralf Der <ralfder at mis dot mpg dot 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 ***************************************************************************/ 00024 #ifndef __MESHGROUND_H 00025 #define __MESHGROUND_H 00026 00027 #include <stdio.h> 00028 #include <cmath> 00029 00030 #include "heightfieldprimitive.h" 00031 #include "abstractobstacle.h" 00032 00033 namespace lpzrobots { 00034 00035 class MeshGround : public AbstractObstacle { 00036 public: 00037 00038 00039 /** Constructor 00040 @param odeHandle 00041 @param osgHandle 00042 @param filename name of the file to load. 00043 If ending is .ppm then it is considered as a bitmap height file. 00044 The coding mode is used to decode the heights. 00045 Otherwise it is consider to be a OSG HeightFieldFile 00046 @param texture image filename for the texture 00047 @param x_size size in x direction in world coordinates 00048 @param y_size size in y direction in world coordinates 00049 @param height height in world coordinates 00050 @param coding Coding mode, see OSGHeightField (this an own class, not in OSG) 00051 */ 00052 MeshGround(const OdeHandle& odeHandle, const OsgHandle& osgHandle, 00053 const std::string& filename, const std::string& texture, 00054 double x_size, double y_size, double height, 00055 OSGHeightField::CodingMode coding = OSGHeightField::Red); 00056 00057 /** 00058 * updates the position of the geoms ( not nessary for static objects) 00059 */ 00060 virtual void update(){ }; 00061 00062 virtual void setPose(const osg::Matrix& pose); 00063 00064 00065 protected: 00066 virtual void create(); 00067 virtual void destroy(); 00068 00069 protected: 00070 std::string filename; 00071 std::string texture; 00072 HeightField* heightfield; 00073 double x_size; 00074 double y_size; 00075 double height; 00076 OSGHeightField::CodingMode coding; 00077 }; 00078 } 00079 00080 #endif