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: meshground.h,v $ 00024 * Revision 1.3 2008/09/16 14:49:46 martius 00025 * use cmath instead of math.h 00026 * 00027 * Revision 1.2 2006/07/14 12:23:33 martius 00028 * selforg becomes HEAD 00029 * 00030 * Revision 1.1.2.2 2006/05/29 20:10:28 martius 00031 * docu, but moved to terrainground anyway 00032 * 00033 * Revision 1.1.2.1 2006/05/28 22:14:56 martius 00034 * heightfield included 00035 * 00036 * 00037 * * 00038 ***************************************************************************/ 00039 #ifndef __MESHGROUND_H 00040 #define __MESHGROUND_H 00041 00042 #include <stdio.h> 00043 #include <cmath> 00044 00045 #include "heightfieldprimitive.h" 00046 #include "abstractobstacle.h" 00047 00048 namespace lpzrobots { 00049 00050 class MeshGround : public AbstractObstacle { 00051 public: 00052 00053 00054 /** Constructor 00055 @param odeHandle 00056 @param osgHandle 00057 @param filename name of the file to load. 00058 If ending is .ppm then it is considered as a bitmap height file. 00059 The coding mode is used to decode the heights. 00060 Otherwise it is consider to be a OSG HeightFieldFile 00061 @param texture image filename for the texture 00062 @param x_size size in x direction in world coordinates 00063 @param y_size size in y direction in world coordinates 00064 @param height height in world coordinates 00065 @param coding Coding mode, see OSGHeightField (this an own class, not in OSG) 00066 */ 00067 MeshGround(const OdeHandle& odeHandle, const OsgHandle& osgHandle, 00068 const std::string& filename, const std::string& texture, 00069 double x_size, double y_size, double height, 00070 OSGHeightField::CodingMode coding = OSGHeightField::Red); 00071 00072 /** 00073 * updates the position of the geoms ( not nessary for static objects) 00074 */ 00075 virtual void update(){ }; 00076 00077 virtual void setPose(const osg::Matrix& pose); 00078 00079 00080 protected: 00081 virtual void create(); 00082 virtual void destroy(); 00083 00084 protected: 00085 std::string filename; 00086 std::string texture; 00087 HeightField* heightfield; 00088 double x_size; 00089 double y_size; 00090 double height; 00091 OSGHeightField::CodingMode coding; 00092 }; 00093 } 00094 00095 #endif