Heightmap.hh
00001 /*
00002  * Copyright 2011 Nate Koenig & Andrew Howard
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  *
00016 */
00017 /* Desc: Heightmap geometry
00018  * Author: Nate Keonig
00019  * Date: 12 May 2009
00020  * SVN: $Id:$
00021  */
00022 
00023 #ifndef HEIGHTMAP_HH
00024 #define HEIGHTMAP_HH
00025 
00026 // TODO: remove this line
00027 #include "rendering/ogre.h"
00028 
00029 #include "math/Vector3.hh"
00030 #include "math/Vector2d.hh"
00031 
00032 namespace gazebo
00033 {
00034     namespace rendering
00035   {
00036     class Scene;
00037 
00040  
00042     class Heightmap : public Ogre::RaySceneQueryListener
00043     {
00045       public: Heightmap(Scene *scene);
00046   
00048       public: virtual ~Heightmap();
00049   
00051       public: float GetHeightAt(const math::Vector2d &pos);
00052   
00054       public: virtual bool queryResult(Ogre::MovableObject *obj, Ogre::Real dist);
00055   
00057       public: virtual bool queryResult(Ogre::SceneQuery::WorldFragment *frag, Ogre::Real dist);
00058   
00060       public: virtual void Load( std::string imageFilename, 
00061                                     std::string worldTexture, 
00062                                     std::string detialTexture,
00063                                     math::Vector3 terrainSize);
00064   
00065       private: math::Vector3 terrainSize;
00066   
00067       private: Ogre::Ray ray;
00068       private: Ogre::RaySceneQuery *rayQuery;
00069   
00070       private: double distToTerrain;
00071       private: Scene *scene;
00072     };
00074   }
00075 
00076 }
00077 #endif