All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Heightmap.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Nate Koenig
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 /* Desc: Heightmap geometry
18  * Author: Nate Koenig
19  * Date: 12 May 2009
20  */
21 
22 #ifndef _HEIGHTMAP_HH_
23 #define _HEIGHTMAP_HH_
24 
25 #include <string>
26 #include <vector>
27 
28 #include "common/Image.hh"
29 #include "math/Vector3.hh"
30 #include "math/Vector2d.hh"
31 #include "rendering/Scene.hh"
32 
33 namespace Ogre
34 {
35  class TerrainGlobalOptions;
36  class TerrainGroup;
37  class Terrain;
38 }
39 
40 namespace gazebo
41 {
42  namespace rendering
43  {
46 
49  class Heightmap
50  {
53  public: Heightmap(ScenePtr _scene);
54 
56  public: virtual ~Heightmap();
57 
59  public: void Load();
60 
63  public: void LoadFromMsg(ConstVisualPtr &_msg);
64 
69  public: double GetHeight(double _x, double _y);
70 
73  private: bool InitBlendMaps(Ogre::Terrain *_terrain);
74 
76  private: void ConfigureTerrainDefaults();
77 
81  private: void DefineTerrain(int _x, int _y);
82 
84  private: ScenePtr scene;
85 
87  private: common::Image heightImage;
88 
90  private: math::Vector3 terrainSize;
91 
93  private: unsigned int imageSize;
94 
96  private: double maxPixel;
97 
99  private: math::Vector3 terrainOrigin;
100 
102  private: Ogre::TerrainGlobalOptions *terrainGlobals;
103 
105  private: Ogre::TerrainGroup *terrainGroup;
106 
108  private: bool terrainsImported;
109 
111  private: std::vector<std::string> diffuseTextures;
112 
114  private: std::vector<std::string> normalTextures;
115 
117  private: std::vector<double> worldSizes;
118 
120  private: std::vector<double> blendHeight;
121 
123  private: std::vector<double> blendFade;
124  };
126  }
127 }
128 #endif