Gazebo

HeightmapGeom.hh

00001 /*
00002  *  Gazebo - Outdoor Multi-Robot Simulator
00003  *  Copyright (C) 2003  
00004  *     Nate Koenig & Andrew Howard
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 /* Desc: Trimesh geometry
00022  * Author: Nate Keonig, Andrew Howard
00023  * Date: 8 May 2003
00024  * CVS: $Id: HeightmapGeom.hh 152 2007-11-01 23:45:07Z natepak $
00025  */
00026 
00027 #ifndef HEIGHTMAPGEOM_HH
00028 #define HEIGHTMAPGEOM_HH
00029 
00030 #include <Ogre.h>
00031 
00032 #include "Geom.hh"
00033 
00034 namespace gazebo
00035 {
00038 
00070 
00071 
00072 
00073 
00074 
00076   class HeightmapGeom : public Geom, public Ogre::RaySceneQueryListener
00077   {
00079     public: HeightmapGeom(Body *body);
00080 
00082     public: virtual ~HeightmapGeom();
00083 
00085     public: void UpdateChild();
00086 
00088     public: double GetHeightAt(const Vector2<double> &pos);
00089 
00091     public: virtual bool queryResult(Ogre::MovableObject *obj, Ogre::Real dist);
00092 
00094     public: virtual bool queryResult(Ogre::SceneQuery::WorldFragment *frag, Ogre::Real dist);
00095 
00097     protected: virtual void LoadChild(XMLConfigNode *node);
00098 
00100     private: void FillHeightMap();
00101 
00103     private: static dReal GetHeightCallback(void *data, int x, int y);
00104 
00105     private: dHeightfieldDataID odeData;
00106 
00107     private: Vector3 terrainSize;
00108     private: Vector3 terrainScale;
00109 
00110     private: unsigned int odeVertSize;
00111     private: Vector3 odeScale;
00112 
00113     private: unsigned int terrainVertSize;
00114     private: std::string terrainImage;
00115 
00116     private: Ogre::Ray ray;
00117     private: Ogre::RaySceneQuery *rayQuery;
00118 
00119     private: double distToTerrain;
00120 
00121     private: std::vector<double> heights;
00122   };
00123 
00125 }
00126 
00127 #endif

Last updated Aug 04 2007