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 __HEIGHTFIELDPRIMITIVES_H 00025 #define __HEIGHTFIELDPRIMITIVES_H 00026 00027 #include "primitive.h" 00028 #include "osgheightfield.h" 00029 #include <ode-dbl/ode.h> 00030 00031 namespace lpzrobots { 00032 00033 00034 /** Height field primitive */ 00035 class HeightField : public Primitive { 00036 public: 00037 HeightField(const std::string& filename, float x_size, float y_size, float height); 00038 HeightField(osg::HeightField* heightfield, float x_size, float y_size); 00039 00040 virtual ~HeightField(); 00041 virtual void init(const OdeHandle& odeHandle, double mass, 00042 const OsgHandle& osgHandle, 00043 char mode = Body | Geom | Draw) ; 00044 00045 00046 virtual void setPose(const osg::Matrix& pose); 00047 00048 virtual void update(); 00049 virtual OSGPrimitive* getOSGPrimitive() { return osgheightfield; } 00050 00051 virtual void setMass(double mass) {} 00052 00053 protected: 00054 OSGHeightField* osgheightfield; 00055 dTriMeshDataID data; 00056 00057 }; 00058 00059 00060 } 00061 00062 #endif